Skip to content

Commit e08a3ae

Browse files
committed
failing on base
1 parent accc5bd commit e08a3ae

7 files changed

+32
-45
lines changed

integrations/coinbase-agentkit/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"start": "tsx --env-file=.env src/index.ts"
1111
},
1212
"dependencies": {
13-
"@coinbase/agentkit": "^0.2.0",
14-
"@coinbase/agentkit-langchain": "^0.2.0",
13+
"@coinbase/agentkit": "latest",
14+
"@coinbase/agentkit-langchain": "latest",
1515
"@langchain/core": "^0.3.20",
1616
"@langchain/langgraph": "^0.2.24",
1717
"@langchain/openai": "^0.3.14",

integrations/coinbase-agentkit/src/cdp.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,26 @@ export async function initializeAgent(
108108
tools,
109109
checkpointSaver: memory,
110110
messageModifier: `
111-
You are a DeFi Payment Agent that assists users with sending payments to any wallet address using natural language instructions.
111+
You are a DeFi Payment Agent that assists users with sending payments to any wallet address using natural language instructions.
112112
113113
When a user asks you to make a payment:
114-
1. Provide clear information about network fees (if any) and transaction status.
115-
2. Notify users of successful transactions with relevant details.
116-
114+
1. Notify users of successful transactions with relevant details.
115+
2. Explain that you create a new wallet for each user and that the user needs to transfer funds to your wallet before making payments.
116+
117117
You can only perform payment-related tasks. For other requests, politely explain that you're
118118
specialized in processing payments and can't assist with other tasks.
119119
120120
Your default currency is USDC and the token address is 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913. It's gasless on base-mainnet.
121-
122-
If you encounter an error, provide clear troubleshooting advice and offer to retry the transaction.
123-
124-
Before executing your first action, get the wallet balance to see how much funds you have.
125-
If you don't have enough funds, ask the user to deposit more funds into your wallet and provide them your wallet address.
126-
121+
122+
Important: When a user confirms a transaction with short responses like "yes," "confirm," "proceed," or similar, immediately execute the transaction that was previously discussed. Never restart the conversation or ask for the payment details again.
123+
If there is a 5XX (internal) HTTP error, ask the user to try again later.
124+
125+
Be concise, helpful, and security-focused in all your interactions.ovide clear troubleshooting advice and offer to retry the transaction.
126+
Before executing your first action, get the wallet balance to see how much USDC you have.
127+
If you don't have enough USDC, ask the user to deposit more funds into your wallet and provide them your wallet address.
128+
127129
If there is a 5XX (internal) HTTP error, ask the user to try again later.
128-
130+
129131
Be concise, helpful, and security-focused in all your interactions.
130132
`,
131133
});

integrations/coinbase-agentkit/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async function main(): Promise<void> {
8282
await initStorage();
8383

8484
// Initialize XMTP client
85-
const { client: xmtpClient } = await initializeXmtpClient();
85+
const xmtpClient = await initializeXmtpClient();
8686

8787
// Start listening for messages
8888
await startMessageListener(xmtpClient, handleMessage);

integrations/coinbase-agentkit/src/xmtp.ts

+16-31
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,29 @@ export async function initializeXmtpClient() {
1414
"WALLET_KEY and ENCRYPTION_KEY must be set in environment variables",
1515
);
1616
}
17-
console.log(`WALLET_KEY: ${WALLET_KEY}`);
18-
console.log(`ENCRYPTION_KEY: ${ENCRYPTION_KEY}`);
19-
console.log(`XMTP_ENV: ${XMTP_ENV}`);
20-
2117
// Create the signer using viem
2218
const signer = createSigner(WALLET_KEY);
23-
try {
24-
const encryptionKey = getEncryptionKeyFromHex(ENCRYPTION_KEY);
19+
const encryptionKey = getEncryptionKeyFromHex(ENCRYPTION_KEY);
2520

26-
const identifier = await signer.getIdentifier();
27-
const address = identifier.identifier;
28-
console.log(`Address: ${address}`);
29-
// Set the environment to dev or production
30-
const env: XmtpEnv = XMTP_ENV as XmtpEnv;
21+
const identifier = await signer.getIdentifier();
22+
const address = identifier.identifier;
23+
// Set the environment to dev or production
24+
const env: XmtpEnv = XMTP_ENV as XmtpEnv;
3125

32-
if (!fs.existsSync(XMTP_DB_PATH)) {
33-
fs.mkdirSync(XMTP_DB_PATH, { recursive: true });
34-
}
35-
const dbPath = `${XMTP_DB_PATH}/${address}-${env}`;
36-
console.log(`DB Path: ${dbPath}`);
37-
console.log(`Creating XMTP client on the '${env}' network...`);
38-
const client = await Client.create(signer, encryptionKey, { env, dbPath });
26+
if (!fs.existsSync(XMTP_DB_PATH)) {
27+
fs.mkdirSync(XMTP_DB_PATH, { recursive: true });
28+
}
29+
const dbPath = `${XMTP_DB_PATH}/${address}-${env}`;
30+
const client = await Client.create(signer, encryptionKey, { env, dbPath });
3931

40-
console.log("Syncing conversations...");
41-
await client.conversations.sync();
32+
console.log("Syncing conversations...");
33+
await client.conversations.sync();
4234

43-
console.log(
44-
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}?env=${env}`,
45-
);
35+
console.log(
36+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}?env=${env}`,
37+
);
4638

47-
return { client, env };
48-
} catch (error) {
49-
console.error("Error initializing XMTP client:", error);
50-
console.error(
51-
"Please check that your ENCRYPTION_KEY is a valid hexadecimal string",
52-
);
53-
throw error;
54-
}
39+
return client;
5540
}
5641

5742
export type MessageHandler = (message: any, conversation: any) => Promise<void>;

0 commit comments

Comments
 (0)