@coinbase/agentkit 0.8.2 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +404 -235
  2. package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +15 -15
  3. package/dist/action-providers/cdp/cdpApiActionProvider.js +110 -63
  4. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +205 -124
  5. package/dist/action-providers/cdp/index.d.ts +0 -1
  6. package/dist/action-providers/cdp/index.js +0 -1
  7. package/dist/action-providers/cdp/schemas.d.ts +9 -70
  8. package/dist/action-providers/cdp/schemas.js +12 -61
  9. package/dist/action-providers/cdp-legacy/index.d.ts +3 -0
  10. package/dist/action-providers/cdp-legacy/index.js +19 -0
  11. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.d.ts +45 -0
  12. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.js +130 -0
  13. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.test.js +146 -0
  14. package/dist/action-providers/{cdp/cdpWalletActionProvider.d.ts → cdp-legacy/legacyCdpWalletActionProvider.d.ts} +8 -8
  15. package/dist/action-providers/{cdp/cdpWalletActionProvider.js → cdp-legacy/legacyCdpWalletActionProvider.js} +14 -14
  16. package/dist/action-providers/{cdp/cdpWalletActionProvider.test.js → cdp-legacy/legacyCdpWalletActionProvider.test.js} +3 -3
  17. package/dist/action-providers/cdp-legacy/schemas.d.ts +91 -0
  18. package/dist/action-providers/cdp-legacy/schemas.js +77 -0
  19. package/dist/action-providers/erc20/erc20ActionProvider.js +1 -1
  20. package/dist/action-providers/farcaster/farcasterActionProvider.js +2 -0
  21. package/dist/action-providers/farcaster/farcasterActionProvider.test.js +55 -0
  22. package/dist/action-providers/farcaster/schemas.d.ts +13 -0
  23. package/dist/action-providers/farcaster/schemas.js +6 -0
  24. package/dist/action-providers/index.d.ts +3 -1
  25. package/dist/action-providers/index.js +3 -1
  26. package/dist/action-providers/jupiter/jupiterActionProvider.test.js +2 -4
  27. package/dist/action-providers/truemarkets/constants.d.ts +179 -0
  28. package/dist/action-providers/truemarkets/constants.js +46 -0
  29. package/dist/action-providers/truemarkets/index.d.ts +1 -0
  30. package/dist/action-providers/truemarkets/index.js +17 -0
  31. package/dist/action-providers/truemarkets/schemas.d.ts +21 -0
  32. package/dist/action-providers/truemarkets/schemas.js +29 -0
  33. package/dist/action-providers/truemarkets/truemarketsActionProvider.d.ts +51 -0
  34. package/dist/action-providers/truemarkets/truemarketsActionProvider.js +469 -0
  35. package/dist/action-providers/truemarkets/truemarketsActionProvider.test.js +217 -0
  36. package/dist/action-providers/truemarkets/utils.d.ts +10 -0
  37. package/dist/action-providers/truemarkets/utils.js +9 -0
  38. package/dist/action-providers/twitter/schemas.d.ts +16 -0
  39. package/dist/action-providers/twitter/schemas.js +23 -1
  40. package/dist/action-providers/twitter/twitterActionProvider.d.ts +8 -1
  41. package/dist/action-providers/twitter/twitterActionProvider.js +56 -5
  42. package/dist/action-providers/twitter/twitterActionProvider.test.js +52 -2
  43. package/dist/action-providers/weth/constants.d.ts +9 -0
  44. package/dist/action-providers/weth/constants.js +12 -0
  45. package/dist/action-providers/weth/schemas.d.ts +7 -0
  46. package/dist/action-providers/weth/schemas.js +7 -1
  47. package/dist/action-providers/weth/wethActionProvider.d.ts +9 -1
  48. package/dist/action-providers/weth/wethActionProvider.js +50 -1
  49. package/dist/action-providers/weth/wethActionProvider.test.js +60 -0
  50. package/dist/action-providers/x402/schemas.d.ts +58 -11
  51. package/dist/action-providers/x402/schemas.js +60 -8
  52. package/dist/action-providers/x402/x402ActionProvider.d.ts +33 -16
  53. package/dist/action-providers/x402/x402ActionProvider.js +203 -153
  54. package/dist/action-providers/x402/x402ActionProvider.test.js +78 -225
  55. package/dist/action-providers/zora/index.d.ts +3 -0
  56. package/dist/action-providers/{cdp-v2 → zora}/index.js +2 -1
  57. package/dist/action-providers/zora/schemas.d.ts +29 -0
  58. package/dist/action-providers/zora/schemas.js +31 -0
  59. package/dist/action-providers/zora/utils.d.ts +28 -0
  60. package/dist/action-providers/zora/utils.js +200 -0
  61. package/dist/action-providers/zora/zoraActionProvider.d.ts +36 -0
  62. package/dist/action-providers/zora/zoraActionProvider.js +151 -0
  63. package/dist/action-providers/zora/zoraActionProvider.test.js +205 -0
  64. package/dist/agentkit.d.ts +1 -0
  65. package/dist/agentkit.js +3 -2
  66. package/dist/wallet-providers/{cdpV2EvmWalletProvider.d.ts → cdpEvmWalletProvider.d.ts} +16 -7
  67. package/dist/wallet-providers/{cdpV2EvmWalletProvider.js → cdpEvmWalletProvider.js} +50 -39
  68. package/dist/wallet-providers/{cdpV2EvmWalletProvider.test.js → cdpEvmWalletProvider.test.js} +7 -7
  69. package/dist/wallet-providers/{cdpV2Shared.d.ts → cdpShared.d.ts} +15 -4
  70. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +115 -0
  71. package/dist/wallet-providers/cdpSmartWalletProvider.js +263 -0
  72. package/dist/wallet-providers/cdpSmartWalletProvider.test.d.ts +1 -0
  73. package/dist/wallet-providers/cdpSmartWalletProvider.test.js +287 -0
  74. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.d.ts → cdpSolanaWalletProvider.d.ts} +16 -7
  75. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.js → cdpSolanaWalletProvider.js} +43 -32
  76. package/dist/wallet-providers/cdpSolanaWalletProvider.test.d.ts +1 -0
  77. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.test.js → cdpSolanaWalletProvider.test.js} +7 -7
  78. package/dist/wallet-providers/index.d.ts +6 -6
  79. package/dist/wallet-providers/index.js +6 -6
  80. package/dist/wallet-providers/{smartWalletProvider.d.ts → legacyCdpSmartWalletProvider.d.ts} +3 -3
  81. package/dist/wallet-providers/{smartWalletProvider.js → legacyCdpSmartWalletProvider.js} +21 -21
  82. package/dist/wallet-providers/legacyCdpSmartWalletProvider.test.d.ts +1 -0
  83. package/dist/wallet-providers/{smartWalletProvider.test.js → legacyCdpSmartWalletProvider.test.js} +2 -2
  84. package/dist/wallet-providers/{cdpWalletProvider.d.ts → legacyCdpWalletProvider.d.ts} +15 -11
  85. package/dist/wallet-providers/{cdpWalletProvider.js → legacyCdpWalletProvider.js} +72 -70
  86. package/dist/wallet-providers/legacyCdpWalletProvider.test.d.ts +1 -0
  87. package/dist/wallet-providers/{cdpWalletProvider.test.js → legacyCdpWalletProvider.test.js} +10 -10
  88. package/package.json +4 -2
  89. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.d.ts +0 -34
  90. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.js +0 -98
  91. package/dist/action-providers/cdp-v2/index.d.ts +0 -2
  92. package/dist/action-providers/cdp-v2/schemas.d.ts +0 -11
  93. package/dist/action-providers/cdp-v2/schemas.js +0 -13
  94. package/dist/wallet-providers/cdpV2WalletProvider.d.ts +0 -35
  95. package/dist/wallet-providers/cdpV2WalletProvider.js +0 -42
  96. /package/dist/action-providers/{cdp → cdp-legacy}/constants.d.ts +0 -0
  97. /package/dist/action-providers/{cdp → cdp-legacy}/constants.js +0 -0
  98. /package/dist/action-providers/{cdp/cdpWalletActionProvider.test.d.ts → cdp-legacy/legacyCdpApiActionProvider.test.d.ts} +0 -0
  99. /package/dist/{wallet-providers/cdpV2EvmWalletProvider.test.d.ts → action-providers/cdp-legacy/legacyCdpWalletActionProvider.test.d.ts} +0 -0
  100. /package/dist/{wallet-providers/cdpV2SolanaWalletProvider.test.d.ts → action-providers/truemarkets/truemarketsActionProvider.test.d.ts} +0 -0
  101. /package/dist/{wallet-providers/cdpWalletProvider.test.d.ts → action-providers/zora/zoraActionProvider.test.d.ts} +0 -0
  102. /package/dist/wallet-providers/{smartWalletProvider.test.d.ts → cdpEvmWalletProvider.test.d.ts} +0 -0
  103. /package/dist/wallet-providers/{cdpV2Shared.js → cdpShared.js} +0 -0
package/README.md CHANGED
@@ -18,14 +18,27 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
18
18
  - [Adding Actions to your Action Provider that use a Wallet Provider](#adding-actions-to-your-action-provider-that-use-a-wallet-provider)
19
19
  - [Adding an Action Provider to your AgentKit instance](#adding-an-action-provider-to-your-agentkit-instance)
20
20
  - [EVM Wallet Providers](#evm-wallet-providers)
21
- - [CdpV2EvmWalletProvider](#cdpv2evmwalletprovider)
22
- - [CdpWalletProvider](#cdpwalletprovider)
21
+ - [CdpEvmWalletProvider](#cdpevmwalletprovider)
22
+ - [Basic Configuration](#basic-configuration)
23
+ - [Using an existing wallet](#using-an-existing-wallet)
24
+ - [Creating a new wallet](#creating-a-new-wallet)
25
+ - [Environment Variables](#environment-variables)
26
+ - [Exporting a wallet](#exporting-a-wallet)
27
+ - [CdpSmartWalletProvider](#cdpsmartwalletprovider)
28
+ - [Basic Configuration](#basic-configuration-1)
29
+ - [Using an Existing Smart Wallet](#using-an-existing-smart-wallet)
30
+ - [Specifying an Owner Account](#specifying-an-owner-account)
31
+ - [Creating a New Smart Wallet](#creating-a-new-smart-wallet)
32
+ - [Environment Variables](#environment-variables-1)
33
+ - [Exporting Smart Wallet Information](#exporting-smart-wallet-information)
34
+ - [Key Differences from Regular Wallets](#key-differences-from-regular-wallets)
35
+ - [LegacyCdpWalletProvider](#legacycdpwalletprovider)
23
36
  - [Network Configuration](#network-configuration)
24
37
  - [Configuring from an existing CDP API Wallet](#configuring-from-an-existing-cdp-api-wallet)
25
38
  - [Configuring from a mnemonic phrase](#configuring-from-a-mnemonic-phrase)
26
39
  - [Exporting a wallet](#exporting-a-wallet)
27
40
  - [Importing a wallet from WalletData JSON string](#importing-a-wallet-from-walletdata-json-string)
28
- - [Configuring gas parameters](#configuring-cdpwalletprovider-gas-parameters)
41
+ - [Configuring gas parameters](#configuring-legacycdpwalletprovider-gas-parameters)
29
42
  - [ViemWalletProvider](#viemwalletprovider)
30
43
  - [Configuring gas parameters](#configuring-viemwalletprovider-gas-parameters)
31
44
  - [PrivyWalletProvider](#privywalletprovider)
@@ -37,7 +50,7 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
37
50
  - [Configuring from PrivyWalletProvider](#configuring-from-privywalletprovider)
38
51
  - [Configuring from ViemWalletProvider](#configuring-from-viemwalletprovider)
39
52
  - [SVM Wallet Providers](#svm-wallet-providers)
40
- - [CdpV2SolanaWalletProvider](#cdpv2solanawalletprovider)
53
+ - [CdpSolanaWalletProvider](#cdpsolanawalletprovider)
41
54
  - [SolanaKeypairWalletProvider](#solanakeypairwalletprovider)
42
55
  - [Network Configuration](#solana-network-configuration)
43
56
  - [RPC URL Configuration](#rpc-url-configuration)
@@ -49,7 +62,8 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
49
62
 
50
63
  ## Getting Started
51
64
 
52
- *Prerequisites*:
65
+ _Prerequisites_:
66
+
53
67
  - [Node.js 18+](https://nodejs.org/en/download/)
54
68
  - [CDP Secret API Key](https://docs.cdp.coinbase.com/get-started/docs/cdp-api-keys#creating-secret-api-keys)
55
69
 
@@ -66,7 +80,7 @@ npm install @coinbase/agentkit
66
80
  ```typescript
67
81
  const agentKit = await AgentKit.from({
68
82
  cdpApiKeyId: "CDP API KEY NAME",
69
- cdpApiKeyPrivate: "CDP API KEY SECRET",
83
+ cdpApiKeySecret: "CDP API KEY SECRET",
70
84
  });
71
85
  ```
72
86
 
@@ -77,7 +91,7 @@ If no wallet or action provider are specified, the agent will use the `CdpWallet
77
91
  ```typescript
78
92
  const agentKit = await AgentKit.from({
79
93
  cdpApiKeyId: "CDP API KEY NAME",
80
- cdpApiKeyPrivate: "CDP API KEY SECRET",
94
+ cdpApiKeySecret: "CDP API KEY SECRET",
81
95
  });
82
96
  ```
83
97
 
@@ -87,13 +101,13 @@ const agentKit = await AgentKit.from({
87
101
  import { CdpWalletProvider } from "@coinbase/agentkit";
88
102
 
89
103
  const walletProvider = await CdpWalletProvider.configureWithWallet({
90
- apiKeyId: "CDP API KEY NAME",
91
- apiKeyPrivate: "CDP API KEY SECRET",
92
- networkId: "base-mainnet",
104
+ apiKeyId: "CDP API KEY NAME",
105
+ apiKeyPrivate: "CDP API KEY SECRET",
106
+ networkId: "base-mainnet",
93
107
  });
94
108
 
95
109
  const agentKit = await AgentKit.from({
96
- walletProvider,
110
+ walletProvider,
97
111
  });
98
112
  ```
99
113
 
@@ -103,20 +117,21 @@ const agentKit = await AgentKit.from({
103
117
  import { cdpApiActionProvider, pythActionProvider } from "@coinbase/agentkit";
104
118
 
105
119
  const agentKit = await AgentKit.from({
106
- walletProvider,
107
- actionProviders: [
108
- cdpApiActionProvider({
109
- apiKeyId: "CDP API KEY NAME",
110
- apiKeyPrivate: "CDP API KEY SECRET",
111
- }),
112
- pythActionProvider(),
113
- ],
120
+ walletProvider,
121
+ actionProviders: [
122
+ cdpApiActionProvider({
123
+ apiKeyId: "CDP API KEY NAME",
124
+ apiKeyPrivate: "CDP API KEY SECRET",
125
+ }),
126
+ pythActionProvider(),
127
+ ],
114
128
  });
115
129
  ```
116
130
 
117
131
  ### Use the agent's actions with a framework extension. For example, using LangChain + OpenAI.
118
132
 
119
- *Prerequisites*:
133
+ _Prerequisites_:
134
+
120
135
  - [OpenAI API Key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)
121
136
  - Set `OPENAI_API_KEY` environment variable.
122
137
 
@@ -132,16 +147,17 @@ import { ChatOpenAI } from "@langchain/openai";
132
147
  const tools = await getLangChainTools(agentKit);
133
148
 
134
149
  const llm = new ChatOpenAI({
135
- model: "gpt-4o-mini",
150
+ model: "gpt-4o-mini",
136
151
  });
137
152
 
138
153
  const agent = createReactAgent({
139
- llm,
140
- tools,
154
+ llm,
155
+ tools,
141
156
  });
142
157
  ```
143
158
 
144
159
  ## Action Providers
160
+
145
161
  <details>
146
162
  <summary><strong>Across</strong></summary>
147
163
  <table width="100%">
@@ -165,27 +181,6 @@ const agent = createReactAgent({
165
181
  </table>
166
182
  </details>
167
183
  <details>
168
- <summary><strong>CDP Wallet</strong></summary>
169
- <table width="100%">
170
- <tr>
171
- <td width="200"><code>deploy_contract</code></td>
172
- <td width="768">Deploys a custom smart contract using specified Solidity version and constructor arguments.</td>
173
- </tr>
174
- <tr>
175
- <td width="200"><code>deploy_nft</code></td>
176
- <td width="768">Deploys a standard ERC-721 NFT contract with configurable name, symbol, and metadata URI.</td>
177
- </tr>
178
- <tr>
179
- <td width="200"><code>deploy_token</code></td>
180
- <td width="768">Deploys a standard ERC-20 token contract with configurable name, symbol, and initial supply.</td>
181
- </tr>
182
- <tr>
183
- <td width="200"><code>trade</code></td>
184
- <td width="768">Executes a token swap between two assets at current market rates on mainnet networks.</td>
185
- </tr>
186
- </table>
187
- </details>
188
- <details>
189
184
  <summary><strong>Compound</strong></summary>
190
185
  <table width="100%">
191
186
  <tr>
@@ -266,7 +261,7 @@ const agent = createReactAgent({
266
261
  </tr>
267
262
  <tr>
268
263
  <td width="200"><code>post_cast</code></td>
269
- <td width="768">Creates a new cast (message) on Farcaster with up to 280 characters.</td>
264
+ <td width="768">Creates a new cast (message) on Farcaster with up to 280 characters and support for up to 2 embedded URLs.</td>
270
265
  </tr>
271
266
  </table>
272
267
  </details>
@@ -367,6 +362,23 @@ const agent = createReactAgent({
367
362
  <td width="200"><code>post_tweet_reply</code></td>
368
363
  <td width="768">Creates a reply to an existing tweet using the tweet's unique identifier.</td>
369
364
  </tr>
365
+ <tr>
366
+ <td width="200"><code>upload_media</code></td>
367
+ <td width="768">Uploads media (images, videos) to Twitter that can be attached to tweets.</td>
368
+ </tr>
369
+ </table>
370
+ </details>
371
+ <details>
372
+ <summary><strong>TrueMarkets</strong></summary>
373
+ <table width="100%">
374
+ <tr>
375
+ <td width="200"><code>get_active_markets</code></td>
376
+ <td width="768">Retrieves active prediction markets from Truemarkets with pagination and sorting options.</td>
377
+ </tr>
378
+ <tr>
379
+ <td width="200"><code>get_market_details</code></td>
380
+ <td width="768">Fetches comprehensive details for a specific Truemarkets prediction market including question, status, prices, and liquidity.</td>
381
+ </tr>
370
382
  </table>
371
383
  </details>
372
384
  <details>
@@ -389,6 +401,10 @@ const agent = createReactAgent({
389
401
  <td width="200"><code>wrap_eth</code></td>
390
402
  <td width="768">Converts native ETH to Wrapped ETH (WETH) on Base Sepolia or Base Mainnet.</td>
391
403
  </tr>
404
+ <tr>
405
+ <td width="200"><code>unwrap_eth</code></td>
406
+ <td width="768">Converts Wrapped ETH (WETH) to Native ETH on Base Sepolia or Base Mainnet.</td>
407
+ </tr>
392
408
  </table>
393
409
  </details>
394
410
  <details>
@@ -418,15 +434,20 @@ const agent = createReactAgent({
418
434
  </table>
419
435
  </details>
420
436
  <details>
421
- <summary><strong>X402</strong></summary>
437
+ <summary><strong>x402</strong></summary>
422
438
  <table width="100%">
423
439
  <tr>
424
- <td width="200"><code>paid_request</code></td>
425
- <td width="768">Makes HTTP requests to x402-protected API endpoints with automatic payment handling.</td>
440
+ <td width="200"><code>make_http_request</code></td>
441
+ <td width="768">Makes a basic HTTP request to an API endpoint. If the endpoint requires payment (returns 402),
442
+ it will return payment details that can be used on retry.</td>
426
443
  </tr>
427
444
  <tr>
428
- <td width="200"><code>fetch_payment_info</code></td>
429
- <td width="768">Fetches payment information from x402-protected endpoints without making payments.</td>
445
+ <td width="200"><code>retry_http_request_with_x402</code></td>
446
+ <td width="768">Retries an HTTP request with x402 payment after receiving a 402 Payment Required response.</td>
447
+ </tr>
448
+ <tr>
449
+ <td width="200"><code>make_http_request_with_x402</code></td>
450
+ <td width="768">Combines make_http_request and retry_http_request_with_x402 into a single step.</td>
430
451
  </tr>
431
452
  </table>
432
453
  </details>
@@ -439,6 +460,15 @@ const agent = createReactAgent({
439
460
  </tr>
440
461
  </table>
441
462
  </details>
463
+ <details>
464
+ <summary><strong>Zora</strong></summary>
465
+ <table width="100%">
466
+ <tr>
467
+ <td width="200"><code>coinIt</code></td>
468
+ <td width="768">Creates a new Zora coin with customizable name, symbol, description, and image.</td>
469
+ </tr>
470
+ </table>
471
+ </details>
442
472
 
443
473
  ## Creating an Action Provider
444
474
 
@@ -449,12 +479,12 @@ import { ActionProvider, WalletProvider, Network } from "@coinbase/agentkit";
449
479
 
450
480
  // Define an action provider that uses a wallet provider.
451
481
  class MyActionProvider extends ActionProvider<WalletProvider> {
452
- constructor() {
453
- super("my-action-provider", []);
454
- }
482
+ constructor() {
483
+ super("my-action-provider", []);
484
+ }
455
485
 
456
- // Define if the action provider supports the given network
457
- supportsNetwork = (network: Network) => true;
486
+ // Define if the action provider supports the given network
487
+ supportsNetwork = (network: Network) => true;
458
488
  }
459
489
  ```
460
490
 
@@ -468,11 +498,11 @@ Creating actions with the `@CreateAction` decorator requires the following compi
468
498
 
469
499
  ```json
470
500
  {
471
- "compilerOptions": {
472
- "experimentalDecorators": true,
473
- "emitDecoratorMetadata": true
474
- }
475
- }
501
+ "compilerOptions": {
502
+ "experimentalDecorators": true,
503
+ "emitDecoratorMetadata": true
504
+ }
505
+ }
476
506
  ```
477
507
 
478
508
  #### Steps to create an action
@@ -493,20 +523,20 @@ export const MyActionSchema = z.object({
493
523
  import { ActionProvider, WalletProvider, Network, CreateAction } from "@coinbase/agentkit";
494
524
 
495
525
  class MyActionProvider extends ActionProvider<WalletProvider> {
496
- constructor() {
497
- super("my-action-provider", []);
498
- }
499
-
500
- @CreateAction({
501
- name: "my-action",
502
- description: "My action description",
503
- schema: MyActionSchema,
504
- })
505
- async myAction(args: z.infer<typeof MyActionSchema>): Promise<string> {
506
- return args.myField;
507
- }
508
-
509
- supportsNetwork = (network: Network) => true;
526
+ constructor() {
527
+ super("my-action-provider", []);
528
+ }
529
+
530
+ @CreateAction({
531
+ name: "my-action",
532
+ description: "My action description",
533
+ schema: MyActionSchema,
534
+ })
535
+ async myAction(args: z.infer<typeof MyActionSchema>): Promise<string> {
536
+ return args.myField;
537
+ }
538
+
539
+ supportsNetwork = (network: Network) => true;
510
540
  }
511
541
 
512
542
  export const myActionProvider = () => new MyActionProvider();
@@ -518,31 +548,34 @@ Actions that use a wallet provider can be defined as instance methods on the act
518
548
 
519
549
  ```typescript
520
550
  class MyActionProvider extends ActionProvider<WalletProvider> {
521
- constructor() {
522
- super("my-action-provider", []);
523
- }
524
-
525
- @CreateAction({
526
- name: "my-action",
527
- description: "My action description",
528
- schema: MyActionSchema,
529
- })
530
- async myAction(walletProvider: WalletProvider, args: z.infer<typeof MyActionSchema>): Promise<string> {
531
- return walletProvider.signMessage(args.myField);
532
- }
533
-
534
- supportsNetwork = (network: Network) => true;
551
+ constructor() {
552
+ super("my-action-provider", []);
553
+ }
554
+
555
+ @CreateAction({
556
+ name: "my-action",
557
+ description: "My action description",
558
+ schema: MyActionSchema,
559
+ })
560
+ async myAction(
561
+ walletProvider: WalletProvider,
562
+ args: z.infer<typeof MyActionSchema>,
563
+ ): Promise<string> {
564
+ return walletProvider.signMessage(args.myField);
565
+ }
566
+
567
+ supportsNetwork = (network: Network) => true;
535
568
  }
536
569
  ```
537
570
 
538
- ### Adding an Action Provider to your AgentKit instance.
571
+ ### Adding an Action Provider to your AgentKit instance.
539
572
 
540
573
  This gives your agent access to the actions defined in the action provider.
541
574
 
542
575
  ```typescript
543
576
  const agentKit = new AgentKit({
544
577
  cdpApiKeyId: "CDP API KEY NAME",
545
- cdpApiKeyPrivate: "CDP API KEY SECRET",
578
+ cdpApiKeySecret: "CDP API KEY SECRET",
546
579
  actionProviders: [myActionProvider()],
547
580
  });
548
581
  ```
@@ -552,26 +585,27 @@ const agentKit = new AgentKit({
552
585
  Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
553
586
 
554
587
  EVM:
555
- - [CdpV2EvmWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpV2EvmWalletProvider.ts)
556
- - [CdpWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpWalletProvider.ts)
588
+
589
+ - [CdpEvmWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpEvmWalletProvider.ts)
590
+ - [CdpSmartWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpSmartWalletProvider.ts)
557
591
  - [ViemWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/viemWalletProvider.ts)
558
592
  - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privyWalletProvider.ts)
559
593
  - [ZeroDevWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/zeroDevWalletProvider.ts)
560
594
 
561
- ### CdpV2EvmWalletProvider
595
+ ### CdpEvmWalletProvider
562
596
 
563
- The `CdpV2EvmWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) V2 API. It provides a more modern and streamlined interface for interacting with CDP wallets.
597
+ The `CdpEvmWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) [v2 Wallet API](https://docs.cdp.coinbase.com/wallet-api/v2/introduction/welcome). It provides a more modern and streamlined interface for interacting with CDP wallets.
564
598
 
565
599
  #### Basic Configuration
566
600
 
567
601
  ```typescript
568
- import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
602
+ import { CdpEvmWalletProvider } from "@coinbase/agentkit";
569
603
 
570
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
571
- apiKeyId: "CDP_API_KEY_ID",
572
- apiKeySecret: "CDP_API_KEY_SECRET",
573
- walletSecret: "CDP_WALLET_SECRET",
574
- networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
604
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
605
+ apiKeyId: "CDP_API_KEY_ID",
606
+ apiKeySecret: "CDP_API_KEY_SECRET",
607
+ walletSecret: "CDP_WALLET_SECRET",
608
+ networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
575
609
  });
576
610
  ```
577
611
 
@@ -580,14 +614,14 @@ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
580
614
  You can configure the provider with an existing wallet by providing the wallet's address:
581
615
 
582
616
  ```typescript
583
- import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
584
-
585
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
586
- apiKeyId: "CDP_API_KEY_ID",
587
- apiKeySecret: "CDP_API_KEY_SECRET",
588
- walletSecret: "CDP_WALLET_SECRET",
589
- address: "0x...", // The address of an existing wallet
590
- networkId: "base-sepolia",
617
+ import { CdpEvmWalletProvider } from "@coinbase/agentkit";
618
+
619
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
620
+ apiKeyId: "CDP_API_KEY_ID",
621
+ apiKeySecret: "CDP_API_KEY_SECRET",
622
+ walletSecret: "CDP_WALLET_SECRET",
623
+ address: "0x...", // The address of an existing wallet
624
+ networkId: "base-sepolia",
591
625
  });
592
626
  ```
593
627
 
@@ -596,14 +630,124 @@ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
596
630
  To create a new wallet, you can provide an idempotency key. The same idempotency key will always generate the same wallet address, and these keys are valid for 24 hours:
597
631
 
598
632
  ```typescript
599
- import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
600
-
601
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
602
- apiKeyId: "CDP_API_KEY_ID",
603
- apiKeySecret: "CDP_API_KEY_SECRET",
604
- walletSecret: "CDP_WALLET_SECRET",
605
- idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
606
- networkId: "base-sepolia",
633
+ import { CdpEvmWalletProvider } from "@coinbase/agentkit";
634
+
635
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
636
+ apiKeyId: "CDP_API_KEY_ID",
637
+ apiKeySecret: "CDP_API_KEY_SECRET",
638
+ walletSecret: "CDP_WALLET_SECRET",
639
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
640
+ networkId: "base-sepolia",
641
+ });
642
+ ```
643
+
644
+ #### Environment Variables
645
+
646
+ The provider can also be configured using environment variables:
647
+
648
+ ```typescript
649
+ // Environment variables:
650
+ // CDP_API_KEY_ID=your_api_key_id
651
+ // CDP_API_KEY_SECRET=your_api_key_secret
652
+ // CDP_WALLET_SECRET=your_wallet_secret
653
+ // NETWORK_ID=base-sepolia (optional)
654
+ // IDEMPOTENCY_KEY=unique-key-123 (optional)
655
+
656
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet();
657
+ ```
658
+
659
+ #### Exporting a wallet
660
+
661
+ The `CdpEvmWalletProvider` can export a wallet by calling the `exportWallet` method:
662
+
663
+ ```typescript
664
+ const walletData = await walletProvider.exportWallet();
665
+ ```
666
+
667
+ ### CdpSmartWalletProvider
668
+
669
+ The `CdpSmartWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) [Smart Wallets](https://docs.cdp.coinbase.com/wallet-api/docs/smart-wallets). Smart wallets are ERC-4337 compliant smart contract wallets that provide enhanced features like gasless transactions, batch operations, and account recovery.
670
+
671
+ **Note:** Smart wallets are currently only supported on Base networks (base-sepolia and base-mainnet).
672
+
673
+ #### Basic Configuration
674
+
675
+ ```typescript
676
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
677
+
678
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
679
+ apiKeyId: "CDP_API_KEY_ID",
680
+ apiKeySecret: "CDP_API_KEY_SECRET",
681
+ walletSecret: "CDP_WALLET_SECRET",
682
+ networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
683
+ });
684
+ ```
685
+
686
+ #### Using an Existing Smart Wallet
687
+
688
+ You can configure the provider with an existing smart wallet by providing either the wallet's address or name:
689
+
690
+ ```typescript
691
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
692
+
693
+ // Using smart wallet address
694
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
695
+ apiKeyId: "CDP_API_KEY_ID",
696
+ apiKeySecret: "CDP_API_KEY_SECRET",
697
+ walletSecret: "CDP_WALLET_SECRET",
698
+ address: "0x...", // The address of an existing smart wallet
699
+ networkId: "base-sepolia",
700
+ });
701
+
702
+ // Or using smart wallet name
703
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
704
+ apiKeyId: "CDP_API_KEY_ID",
705
+ apiKeySecret: "CDP_API_KEY_SECRET",
706
+ walletSecret: "CDP_WALLET_SECRET",
707
+ smartAccountName: "my-smart-wallet", // The name of an existing smart wallet
708
+ networkId: "base-sepolia",
709
+ });
710
+ ```
711
+
712
+ #### Specifying an Owner Account
713
+
714
+ Smart wallets require an owner account. You can specify an existing owner account by providing its address or the account object itself:
715
+
716
+ ```typescript
717
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
718
+
719
+ // Using owner address
720
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
721
+ apiKeyId: "CDP_API_KEY_ID",
722
+ apiKeySecret: "CDP_API_KEY_SECRET",
723
+ walletSecret: "CDP_WALLET_SECRET",
724
+ owner: "0x...", // The address of the owner account
725
+ networkId: "base-sepolia",
726
+ });
727
+
728
+ // Using owner account object
729
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
730
+ apiKeyId: "CDP_API_KEY_ID",
731
+ apiKeySecret: "CDP_API_KEY_SECRET",
732
+ walletSecret: "CDP_WALLET_SECRET",
733
+ owner: ownerAccount, // An EvmServerAccount or PrivateKeyAccount object
734
+ networkId: "base-sepolia",
735
+ });
736
+ ```
737
+
738
+ #### Creating a New Smart Wallet
739
+
740
+ To create a new smart wallet, provide an idempotency key. The same idempotency key will always generate the same owner account address, and these keys are valid for 24 hours:
741
+
742
+ ```typescript
743
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
744
+
745
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
746
+ apiKeyId: "CDP_API_KEY_ID",
747
+ apiKeySecret: "CDP_API_KEY_SECRET",
748
+ walletSecret: "CDP_WALLET_SECRET",
749
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new owner account will be created
750
+ networkId: "base-sepolia",
607
751
  });
608
752
  ```
609
753
 
@@ -619,64 +763,87 @@ The provider can also be configured using environment variables:
619
763
  // NETWORK_ID=base-sepolia (optional)
620
764
  // IDEMPOTENCY_KEY=unique-key-123 (optional)
621
765
 
622
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet();
766
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet();
623
767
  ```
624
768
 
625
- ### CdpWalletProvider
769
+ #### Exporting Smart Wallet Information
626
770
 
627
- The `CdpWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) [API Wallet](https://docs.cdp.coinbase.com/wallet-api/docs/welcome).
771
+ The `CdpSmartWalletProvider` can export wallet information by calling the `exportWallet` method:
772
+
773
+ ```typescript
774
+ const walletData = await walletProvider.exportWallet();
775
+
776
+ // walletData will be in the following format:
777
+ {
778
+ name: string | undefined; // The smart wallet name (if set)
779
+ address: string; // The smart wallet address
780
+ ownerAddress: string; // The owner account address
781
+ }
782
+ ```
783
+
784
+ #### Key Differences from Regular Wallets
785
+
786
+ 1. **User Operations**: Smart wallets use ERC-4337 user operations instead of regular transactions
787
+ 2. **No Direct Transaction Signing**: Smart wallets cannot sign transactions directly; all operations go through the user operation flow
788
+ 3. **Gasless Transactions**: Smart wallets can be configured to use paymasters for sponsored transactions
789
+ 4. **Batch Operations**: Multiple operations can be bundled into a single user operation
790
+ 5. **Base Networks Only**: Currently limited to base-sepolia and base-mainnet
791
+
792
+ ### LegacyCdpWalletProvider
793
+
794
+ The `LegacyCdpWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) [v1 Wallet API](https://docs.cdp.coinbase.com/wallet-api/v1/introduction/welcome).
628
795
 
629
796
  #### Network Configuration
630
797
 
631
- The `CdpWalletProvider` can be configured to use a specific network by passing the `networkId` parameter to the `configureWithWallet` method. The `networkId` is the ID of the network you want to use. You can find a list of [supported networks on the CDP API docs](https://docs.cdp.coinbase.com/cdp-apis/docs/networks).
798
+ The `LegacyCdpWalletProvider` can be configured to use a specific network by passing the `networkId` parameter to the `configureWithWallet` method. The `networkId` is the ID of the network you want to use. You can find a list of [supported networks on the CDP API docs](https://docs.cdp.coinbase.com/cdp-apis/docs/networks).
632
799
 
633
800
  ```typescript
634
- import { CdpWalletProvider } from "@coinbase/agentkit";
801
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
635
802
 
636
803
  const walletProvider = await CdpWalletProvider.configureWithWallet({
637
- apiKeyId: "CDP API KEY NAME",
638
- apiKeyPrivate: "CDP API KEY SECRET",
639
- networkId: "base-mainnet",
804
+ apiKeyId: "CDP API KEY NAME",
805
+ apiKeyPrivate: "CDP API KEY SECRET",
806
+ networkId: "base-mainnet",
640
807
  });
641
808
  ```
642
809
 
643
810
  #### Configuring from an existing CDP API Wallet
644
811
 
645
- If you already have a CDP API Wallet, you can configure the `CdpWalletProvider` by passing the `wallet` parameter to the `configureWithWallet` method.
812
+ If you already have a CDP API Wallet, you can configure the `LegacyCdpWalletProvider` by passing the `wallet` parameter to the `configureWithWallet` method.
646
813
 
647
814
  ```typescript
648
- import { CdpWalletProvider } from "@coinbase/agentkit";
815
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
649
816
  import { Wallet } from "@coinbase/coinbase-sdk";
650
- const walletProvider = await CdpWalletProvider.configureWithWallet({
651
- wallet,
652
- apiKeyId: "CDP API KEY NAME",
653
- apiKeyPrivate: "CDP API KEY SECRET",
817
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
818
+ wallet,
819
+ apiKeyId: "CDP API KEY NAME",
820
+ apiKeyPrivate: "CDP API KEY SECRET",
654
821
  });
655
822
  ```
656
823
 
657
824
  #### Configuring from a mnemonic phrase
658
825
 
659
- The `CdpWalletProvider` can be configured from a mnemonic phrase by passing the `mnemonicPhrase` and `networkId` parameters to the `configureWithWallet` method. If `networkId` is not defined, the `CdpWalletProvider` will fall back to the env var `NETWORK_ID`, and if that is not defined, it will default to `base-sepolia`.
826
+ The `LegacyCdpWalletProvider` can be configured from a mnemonic phrase by passing the `mnemonicPhrase` and `networkId` parameters to the `configureWithWallet` method. If `networkId` is not defined, the `LegacyCdpWalletProvider` will fall back to the env var `NETWORK_ID`, and if that is not defined, it will default to `base-sepolia`.
660
827
 
661
828
  ```typescript
662
- import { CdpWalletProvider } from "@coinbase/agentkit";
829
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
663
830
 
664
- const walletProvider = await CdpWalletProvider.configureWithWallet({
665
- mnemonicPhrase: "MNEMONIC PHRASE",
666
- networkId: "base-sepolia",
831
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
832
+ mnemonicPhrase: "MNEMONIC PHRASE",
833
+ networkId: "base-sepolia",
667
834
  });
668
835
  ```
669
836
 
670
837
  #### Exporting a wallet
671
838
 
672
- The `CdpWalletProvider` can export a wallet by calling the `exportWallet` method.
839
+ The `LegacyCdpWalletProvider` can export a wallet by calling the `exportWallet` method.
673
840
 
674
841
  ```typescript
675
- import { CdpWalletProvider } from "@coinbase/agentkit";
842
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
676
843
 
677
- const walletProvider = await CdpWalletProvider.configureWithWallet({
678
- mnemonicPhrase: "MNEMONIC PHRASE",
679
- networkId: "base-sepolia",
844
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
845
+ mnemonicPhrase: "MNEMONIC PHRASE",
846
+ networkId: "base-sepolia",
680
847
  });
681
848
 
682
849
  const walletData = await walletProvider.exportWallet();
@@ -684,39 +851,38 @@ const walletData = await walletProvider.exportWallet();
684
851
 
685
852
  #### Importing a wallet from `WalletData` JSON string
686
853
 
687
- The `CdpWalletProvider` can import a wallet from a `WalletData` JSON string by passing the `cdpWalletData` parameter to the `configureWithWallet` method.
854
+ The `LegacyCdpWalletProvider` can import a wallet from a `WalletData` JSON string by passing the `cdpWalletData` parameter to the `configureWithWallet` method.
688
855
 
689
856
  ```typescript
690
- import { CdpWalletProvider } from "@coinbase/agentkit";
857
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
691
858
 
692
- const walletProvider = await CdpWalletProvider.configureWithWallet({
693
- cdpWalletData: "WALLET DATA JSON STRING",
694
- apiKeyId: "CDP API KEY NAME",
695
- apiKeyPrivate: "CDP API KEY SECRET",
859
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
860
+ cdpWalletData: "WALLET DATA JSON STRING",
861
+ apiKeyId: "CDP API KEY NAME",
862
+ apiKeyPrivate: "CDP API KEY SECRET",
696
863
  });
697
864
  ```
698
865
 
699
- #### Configuring CdpWalletProvider gas parameters
866
+ #### Configuring LegacyCdpWalletProvider gas parameters
700
867
 
701
- The `CdpWalletProvider` also exposes parameters for effecting the gas calculations.
868
+ The `LegacyCdpWalletProvider` also exposes parameters for effecting the gas calculations.
702
869
 
703
870
  ```typescript
704
- import { CdpWalletProvider } from "@coinbase/agentkit";
705
-
706
- const walletProvider = await CdpWalletProvider.configureWithWallet({
707
- cdpWalletData: "WALLET DATA JSON STRING",
708
- apiKeyId: "CDP API KEY NAME",
709
- apiKeyPrivate: "CDP API KEY SECRET",
710
- gas: {
711
- gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
712
- feePerGasMultiplier: 2.0, // Adjusts max fee per gas
713
- }
871
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
872
+
873
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
874
+ cdpWalletData: "WALLET DATA JSON STRING",
875
+ apiKeyId: "CDP API KEY NAME",
876
+ apiKeyPrivate: "CDP API KEY SECRET",
877
+ gas: {
878
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
879
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
880
+ },
714
881
  });
715
882
  ```
716
883
 
717
884
  **Note**: Gas parameters only impact the `walletProvider.sendTransaction` behavior. Actions that do not rely on direct transaction calls, such as `deploy_token`, `deploy_contract`, and `native_transfer`, remain unaffected.
718
885
 
719
-
720
886
  ### ViemWalletProvider
721
887
 
722
888
  The `ViemWalletProvider` is a wallet provider that uses the [Viem library](https://viem.sh/docs/getting-started). It is useful for interacting with any EVM-compatible chain.
@@ -763,8 +929,8 @@ const client = createWalletClient({
763
929
  });
764
930
 
765
931
  const walletProvider = new ViemWalletProvider(client, {
766
- gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
767
- feePerGasMultiplier: 2.0, // Adjusts max fee per gas
932
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
933
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
768
934
  });
769
935
  ```
770
936
 
@@ -779,12 +945,12 @@ import { PrivyWalletProvider } from "@coinbase/agentkit";
779
945
 
780
946
  // Configure Server Wallet Provider
781
947
  const config = {
782
- appId: "PRIVY_APP_ID",
783
- appSecret: "PRIVY_APP_SECRET",
784
- chainId: "84532", // base-sepolia
785
- walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
786
- authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY", // optional, required if your account is using authorization keys
787
- authorizationKeyId: "PRIVY_WALLET_AUTHORIZATION_KEY_ID", // optional, only required to create a new wallet if walletId is not provided
948
+ appId: "PRIVY_APP_ID",
949
+ appSecret: "PRIVY_APP_SECRET",
950
+ chainId: "84532", // base-sepolia
951
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
952
+ authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY", // optional, required if your account is using authorization keys
953
+ authorizationKeyId: "PRIVY_WALLET_AUTHORIZATION_KEY_ID", // optional, only required to create a new wallet if walletId is not provided
788
954
  };
789
955
 
790
956
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -799,12 +965,12 @@ import { PrivyWalletProvider } from "@coinbase/agentkit";
799
965
 
800
966
  // Configure Embedded Wallet Provider
801
967
  const config = {
802
- appId: "PRIVY_APP_ID",
803
- appSecret: "PRIVY_APP_SECRET",
804
- authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY",
805
- walletId: "PRIVY_DELEGATED_WALLET_ID", // The ID of the wallet that was delegated to your server
806
- networkId: "base-mainnet", // or any supported network
807
- walletType: "embedded" // Specify "embedded" to use the embedded wallet provider
968
+ appId: "PRIVY_APP_ID",
969
+ appSecret: "PRIVY_APP_SECRET",
970
+ authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY",
971
+ walletId: "PRIVY_DELEGATED_WALLET_ID", // The ID of the wallet that was delegated to your server
972
+ networkId: "base-mainnet", // or any supported network
973
+ walletType: "embedded", // Specify "embedded" to use the embedded wallet provider
808
974
  };
809
975
 
810
976
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -835,23 +1001,23 @@ When using authorization keys, you must provide the `authorizationPrivateKey` an
835
1001
 
836
1002
  #### Exporting Privy Wallet information
837
1003
 
838
- The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
1004
+ The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
839
1005
 
840
1006
  ```typescript
841
1007
  const walletData = await walletProvider.exportWallet();
842
1008
 
843
1009
  // For server wallets, walletData will be in the following format:
844
1010
  {
845
- walletId: string;
846
- authorizationKey: string | undefined;
847
- chainId: string | undefined;
1011
+ walletId: string;
1012
+ authorizationKey: string | undefined;
1013
+ chainId: string | undefined;
848
1014
  }
849
1015
 
850
1016
  // For embedded wallets, walletData will be in the following format:
851
1017
  {
852
- walletId: string;
853
- networkId: string;
854
- chainId: string | undefined;
1018
+ walletId: string;
1019
+ networkId: string;
1020
+ chainId: string | undefined;
855
1021
  }
856
1022
  ```
857
1023
 
@@ -879,11 +1045,11 @@ const walletProvider = await SmartWalletProvider.configureWithWallet({
879
1045
 
880
1046
  ### ZeroDevWalletProvider
881
1047
 
882
- The `ZeroDevWalletProvider` is a wallet provider that uses [ZeroDev](https://docs.zerodev.app/) smart accounts. It supports features like chain abstraction, gasless transactions, batched transactions, and more.
1048
+ The `ZeroDevWalletProvider` is a wallet provider that uses [ZeroDev](https://docs.zerodev.app/) smart accounts. It supports features like chain abstraction, gasless transactions, batched transactions, and more.
883
1049
 
884
- In the context of Agent Kit, "chain abstraction" means that the agent can spend funds across chains without explicitly bridging. For example, if you send funds to the agent's address on Base, the agent will be able to spend the funds on any supported EVM chains such as Arbitrum and Optimism.
1050
+ In the context of Agent Kit, "chain abstraction" means that the agent can spend funds across chains without explicitly bridging. For example, if you send funds to the agent's address on Base, the agent will be able to spend the funds on any supported EVM chains such as Arbitrum and Optimism.
885
1051
 
886
- The ZeroDev wallet provider does not itself manage keys. Rather, it can be used with any EVM wallet provider (e.g. CDP/Privy/Viem) which serves as the "signer" for the ZeroDev smart account.
1052
+ The ZeroDev wallet provider does not itself manage keys. Rather, it can be used with any EVM wallet provider (e.g. CDP/Privy/Viem) which serves as the "signer" for the ZeroDev smart account.
887
1053
 
888
1054
  #### Configuring from CdpWalletProvider
889
1055
 
@@ -892,17 +1058,17 @@ import { ZeroDevWalletProvider, CdpWalletProvider } from "@coinbase/agentkit";
892
1058
 
893
1059
  // First create a CDP wallet provider as the signer
894
1060
  const cdpWalletProvider = await CdpWalletProvider.configureWithWallet({
895
- apiKeyId: "CDP API KEY NAME",
896
- apiKeyPrivate: "CDP API KEY SECRET",
897
- networkId: "base-mainnet",
1061
+ apiKeyId: "CDP API KEY NAME",
1062
+ apiKeyPrivate: "CDP API KEY SECRET",
1063
+ networkId: "base-mainnet",
898
1064
  });
899
1065
 
900
1066
  // Configure ZeroDev Wallet Provider with CDP signer
901
1067
  const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
902
- signer: cdpWalletProvider.toSigner(),
903
- projectId: "ZERODEV_PROJECT_ID",
904
- entryPointVersion: "0.7" as const,
905
- networkId: "base-mainnet",
1068
+ signer: cdpWalletProvider.toSigner(),
1069
+ projectId: "ZERODEV_PROJECT_ID",
1070
+ entryPointVersion: "0.7" as const,
1071
+ networkId: "base-mainnet",
906
1072
  });
907
1073
  ```
908
1074
 
@@ -913,17 +1079,17 @@ import { ZeroDevWalletProvider, PrivyWalletProvider } from "@coinbase/agentkit";
913
1079
 
914
1080
  // First create a Privy wallet provider as the signer
915
1081
  const privyWalletProvider = await PrivyWalletProvider.configureWithWallet({
916
- appId: "PRIVY_APP_ID",
917
- appSecret: "PRIVY_APP_SECRET",
918
- chainId: "8453", // base-mainnet
1082
+ appId: "PRIVY_APP_ID",
1083
+ appSecret: "PRIVY_APP_SECRET",
1084
+ chainId: "8453", // base-mainnet
919
1085
  });
920
1086
 
921
1087
  // Configure ZeroDev Wallet Provider with Privy signer
922
1088
  const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
923
- signer: privyWalletProvider.toSigner(),
924
- projectId: "ZERODEV_PROJECT_ID",
925
- entryPointVersion: "0.7" as const,
926
- networkId: "base-mainnet",
1089
+ signer: privyWalletProvider.toSigner(),
1090
+ projectId: "ZERODEV_PROJECT_ID",
1091
+ entryPointVersion: "0.7" as const,
1092
+ networkId: "base-mainnet",
927
1093
  });
928
1094
  ```
929
1095
 
@@ -943,15 +1109,15 @@ const viemWalletProvider = new ViemWalletProvider(
943
1109
  account,
944
1110
  chain: base,
945
1111
  transport: http(),
946
- })
1112
+ }),
947
1113
  );
948
1114
 
949
1115
  // Configure ZeroDev Wallet Provider with Viem signer
950
1116
  const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
951
- signer: viemWalletProvider.toSigner(),
952
- projectId: "ZERODEV_PROJECT_ID",
953
- entryPointVersion: "0.7" as const,
954
- networkId: "base-mainnet",
1117
+ signer: viemWalletProvider.toSigner(),
1118
+ projectId: "ZERODEV_PROJECT_ID",
1119
+ entryPointVersion: "0.7" as const,
1120
+ networkId: "base-mainnet",
955
1121
  });
956
1122
  ```
957
1123
 
@@ -960,6 +1126,7 @@ const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
960
1126
  Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
961
1127
 
962
1128
  SVM:
1129
+
963
1130
  - [CdpV2SolanaWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpV2SolanaWalletProvider.ts)
964
1131
  - [SolanaKeypairWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/solanaKeypairWalletProvider.ts)
965
1132
  - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privySvmWalletProvider.ts)
@@ -974,10 +1141,10 @@ The `CdpV2SolanaWalletProvider` is a wallet provider that uses the Coinbase Deve
974
1141
  import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
975
1142
 
976
1143
  const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
977
- apiKeyId: "CDP_API_KEY_ID",
978
- apiKeySecret: "CDP_API_KEY_SECRET",
979
- walletSecret: "CDP_WALLET_SECRET",
980
- networkId: "solana-devnet", // Optional, defaults to "solana-devnet"
1144
+ apiKeyId: "CDP_API_KEY_ID",
1145
+ apiKeySecret: "CDP_API_KEY_SECRET",
1146
+ walletSecret: "CDP_WALLET_SECRET",
1147
+ networkId: "solana-devnet", // Optional, defaults to "solana-devnet"
981
1148
  });
982
1149
  ```
983
1150
 
@@ -989,11 +1156,11 @@ You can configure the provider with an existing wallet by providing the wallet's
989
1156
  import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
990
1157
 
991
1158
  const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
992
- apiKeyId: "CDP_API_KEY_ID",
993
- apiKeySecret: "CDP_API_KEY_SECRET",
994
- walletSecret: "CDP_WALLET_SECRET",
995
- address: "your-solana-address", // The address of an existing wallet
996
- networkId: "solana-devnet",
1159
+ apiKeyId: "CDP_API_KEY_ID",
1160
+ apiKeySecret: "CDP_API_KEY_SECRET",
1161
+ walletSecret: "CDP_WALLET_SECRET",
1162
+ address: "your-solana-address", // The address of an existing wallet
1163
+ networkId: "solana-devnet",
997
1164
  });
998
1165
  ```
999
1166
 
@@ -1005,11 +1172,11 @@ To create a new wallet, you can provide an idempotency key. The same idempotency
1005
1172
  import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
1006
1173
 
1007
1174
  const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
1008
- apiKeyId: "CDP_API_KEY_ID",
1009
- apiKeySecret: "CDP_API_KEY_SECRET",
1010
- walletSecret: "CDP_WALLET_SECRET",
1011
- idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
1012
- networkId: "solana-devnet",
1175
+ apiKeyId: "CDP_API_KEY_ID",
1176
+ apiKeySecret: "CDP_API_KEY_SECRET",
1177
+ walletSecret: "CDP_WALLET_SECRET",
1178
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
1179
+ networkId: "solana-devnet",
1013
1180
  });
1014
1181
  ```
1015
1182
 
@@ -1031,6 +1198,7 @@ const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet();
1031
1198
  #### Supported Networks
1032
1199
 
1033
1200
  The `CdpV2SolanaWalletProvider` supports the following Solana networks:
1201
+
1034
1202
  - `solana-mainnet`
1035
1203
  - `solana-devnet`
1036
1204
  - `solana-testnet`
@@ -1046,6 +1214,7 @@ NOTE: It is highly recommended to use a dedicated RPC provider. See [here](https
1046
1214
  The `SolanaKeypairWalletProvider` can be configured to use a specific network by passing the `networkId` parameter to the `fromNetwork` method. The `networkId` is the ID of the Solana network you want to use. Valid values are `solana-mainnet`, `solana-devnet` and `solana-testnet`.
1047
1215
 
1048
1216
  The default RPC endpoints for each network are as follows:
1217
+
1049
1218
  - `solana-mainnet`: `https://api.mainnet-beta.solana.com`
1050
1219
  - `solana-devnet`: `https://api.devnet.solana.com`
1051
1220
  - `solana-testnet`: `https://api.testnet.solana.com`
@@ -1083,14 +1252,14 @@ import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";
1083
1252
 
1084
1253
  // Configure Wallet Provider
1085
1254
  const config: PrivyWalletConfig = {
1086
- appId: "PRIVY_APP_ID",
1087
- appSecret: "PRIVY_APP_SECRET",
1088
- connection,
1089
- chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1090
- networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1091
- walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1092
- authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1093
- authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1255
+ appId: "PRIVY_APP_ID",
1256
+ appSecret: "PRIVY_APP_SECRET",
1257
+ connection,
1258
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1259
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1260
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1261
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1262
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1094
1263
  };
1095
1264
 
1096
1265
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -1107,14 +1276,14 @@ const connection = new Connection("YOUR_RPC_URL");
1107
1276
 
1108
1277
  // Configure Wallet Provider
1109
1278
  const config: PrivyWalletConfig = {
1110
- appId: "PRIVY_APP_ID",
1111
- appSecret: "PRIVY_APP_SECRET",
1112
- connection,
1113
- chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1114
- networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1115
- walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1116
- authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1117
- authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1279
+ appId: "PRIVY_APP_ID",
1280
+ appSecret: "PRIVY_APP_SECRET",
1281
+ connection,
1282
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1283
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1284
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1285
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1286
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1118
1287
  };
1119
1288
 
1120
1289
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -1137,9 +1306,9 @@ const walletData = await walletProvider.exportWallet();
1137
1306
 
1138
1307
  // walletData will be in the following format:
1139
1308
  {
1140
- walletId: string;
1141
- authorizationKey: string | undefined;
1142
- networkId: string | undefined;
1309
+ walletId: string;
1310
+ authorizationKey: string | undefined;
1311
+ networkId: string | undefined;
1143
1312
  }
1144
1313
  ```
1145
1314