@coinbase/agentkit 0.0.0-nightly-20250713210421 → 0.0.0-nightly-20250715210401

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 (66) hide show
  1. package/README.md +360 -226
  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/cdpEvmWalletActionProvider.d.ts +17 -0
  6. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +20 -0
  7. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +17 -0
  8. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +20 -0
  9. package/dist/action-providers/cdp/cdpSolanaWalletActionProvider.d.ts +17 -0
  10. package/dist/action-providers/cdp/cdpSolanaWalletActionProvider.js +20 -0
  11. package/dist/action-providers/cdp/index.d.ts +3 -1
  12. package/dist/action-providers/cdp/index.js +3 -1
  13. package/dist/action-providers/cdp/schemas.d.ts +9 -70
  14. package/dist/action-providers/cdp/schemas.js +12 -61
  15. package/dist/action-providers/cdp-legacy/index.d.ts +3 -0
  16. package/dist/action-providers/{cdp-v2 → cdp-legacy}/index.js +2 -1
  17. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.d.ts +45 -0
  18. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.js +130 -0
  19. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.test.js +146 -0
  20. package/dist/action-providers/{cdp/cdpWalletActionProvider.d.ts → cdp-legacy/legacyCdpWalletActionProvider.d.ts} +8 -8
  21. package/dist/action-providers/{cdp/cdpWalletActionProvider.js → cdp-legacy/legacyCdpWalletActionProvider.js} +14 -14
  22. package/dist/action-providers/{cdp/cdpWalletActionProvider.test.js → cdp-legacy/legacyCdpWalletActionProvider.test.js} +3 -3
  23. package/dist/action-providers/cdp-legacy/schemas.d.ts +91 -0
  24. package/dist/action-providers/cdp-legacy/schemas.js +77 -0
  25. package/dist/action-providers/erc20/erc20ActionProvider.js +1 -1
  26. package/dist/action-providers/index.d.ts +1 -1
  27. package/dist/action-providers/index.js +1 -1
  28. package/dist/action-providers/jupiter/jupiterActionProvider.test.js +2 -4
  29. package/dist/agentkit.d.ts +1 -0
  30. package/dist/agentkit.js +3 -2
  31. package/dist/wallet-providers/{cdpV2EvmWalletProvider.d.ts → cdpEvmWalletProvider.d.ts} +16 -7
  32. package/dist/wallet-providers/{cdpV2EvmWalletProvider.js → cdpEvmWalletProvider.js} +50 -39
  33. package/dist/wallet-providers/{cdpV2EvmWalletProvider.test.js → cdpEvmWalletProvider.test.js} +7 -7
  34. package/dist/wallet-providers/{cdpV2Shared.d.ts → cdpShared.d.ts} +15 -4
  35. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +115 -0
  36. package/dist/wallet-providers/cdpSmartWalletProvider.js +256 -0
  37. package/dist/wallet-providers/cdpSmartWalletProvider.test.js +267 -0
  38. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.d.ts → cdpSolanaWalletProvider.d.ts} +16 -7
  39. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.js → cdpSolanaWalletProvider.js} +43 -32
  40. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.test.js → cdpSolanaWalletProvider.test.js} +7 -7
  41. package/dist/wallet-providers/index.d.ts +6 -6
  42. package/dist/wallet-providers/index.js +6 -6
  43. package/dist/wallet-providers/{smartWalletProvider.d.ts → legacyCdpSmartWalletProvider.d.ts} +3 -3
  44. package/dist/wallet-providers/{smartWalletProvider.js → legacyCdpSmartWalletProvider.js} +21 -21
  45. package/dist/wallet-providers/legacyCdpSmartWalletProvider.test.d.ts +1 -0
  46. package/dist/wallet-providers/{smartWalletProvider.test.js → legacyCdpSmartWalletProvider.test.js} +2 -2
  47. package/dist/wallet-providers/{cdpWalletProvider.d.ts → legacyCdpWalletProvider.d.ts} +15 -11
  48. package/dist/wallet-providers/{cdpWalletProvider.js → legacyCdpWalletProvider.js} +72 -70
  49. package/dist/wallet-providers/legacyCdpWalletProvider.test.d.ts +1 -0
  50. package/dist/wallet-providers/{cdpWalletProvider.test.js → legacyCdpWalletProvider.test.js} +10 -10
  51. package/package.json +2 -2
  52. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.d.ts +0 -34
  53. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.js +0 -98
  54. package/dist/action-providers/cdp-v2/index.d.ts +0 -2
  55. package/dist/action-providers/cdp-v2/schemas.d.ts +0 -11
  56. package/dist/action-providers/cdp-v2/schemas.js +0 -13
  57. package/dist/wallet-providers/cdpV2WalletProvider.d.ts +0 -35
  58. package/dist/wallet-providers/cdpV2WalletProvider.js +0 -42
  59. /package/dist/action-providers/{cdp → cdp-legacy}/constants.d.ts +0 -0
  60. /package/dist/action-providers/{cdp → cdp-legacy}/constants.js +0 -0
  61. /package/dist/action-providers/{cdp/cdpWalletActionProvider.test.d.ts → cdp-legacy/legacyCdpApiActionProvider.test.d.ts} +0 -0
  62. /package/dist/{wallet-providers/cdpV2EvmWalletProvider.test.d.ts → action-providers/cdp-legacy/legacyCdpWalletActionProvider.test.d.ts} +0 -0
  63. /package/dist/wallet-providers/{cdpV2SolanaWalletProvider.test.d.ts → cdpEvmWalletProvider.test.d.ts} +0 -0
  64. /package/dist/wallet-providers/{cdpV2Shared.js → cdpShared.js} +0 -0
  65. /package/dist/wallet-providers/{cdpWalletProvider.test.d.ts → cdpSmartWalletProvider.test.d.ts} +0 -0
  66. /package/dist/wallet-providers/{smartWalletProvider.test.d.ts → cdpSolanaWalletProvider.test.d.ts} +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
 
@@ -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>
@@ -454,12 +449,12 @@ import { ActionProvider, WalletProvider, Network } from "@coinbase/agentkit";
454
449
 
455
450
  // Define an action provider that uses a wallet provider.
456
451
  class MyActionProvider extends ActionProvider<WalletProvider> {
457
- constructor() {
458
- super("my-action-provider", []);
459
- }
452
+ constructor() {
453
+ super("my-action-provider", []);
454
+ }
460
455
 
461
- // Define if the action provider supports the given network
462
- supportsNetwork = (network: Network) => true;
456
+ // Define if the action provider supports the given network
457
+ supportsNetwork = (network: Network) => true;
463
458
  }
464
459
  ```
465
460
 
@@ -473,11 +468,11 @@ Creating actions with the `@CreateAction` decorator requires the following compi
473
468
 
474
469
  ```json
475
470
  {
476
- "compilerOptions": {
477
- "experimentalDecorators": true,
478
- "emitDecoratorMetadata": true
479
- }
480
- }
471
+ "compilerOptions": {
472
+ "experimentalDecorators": true,
473
+ "emitDecoratorMetadata": true
474
+ }
475
+ }
481
476
  ```
482
477
 
483
478
  #### Steps to create an action
@@ -498,20 +493,20 @@ export const MyActionSchema = z.object({
498
493
  import { ActionProvider, WalletProvider, Network, CreateAction } from "@coinbase/agentkit";
499
494
 
500
495
  class MyActionProvider extends ActionProvider<WalletProvider> {
501
- constructor() {
502
- super("my-action-provider", []);
503
- }
504
-
505
- @CreateAction({
506
- name: "my-action",
507
- description: "My action description",
508
- schema: MyActionSchema,
509
- })
510
- async myAction(args: z.infer<typeof MyActionSchema>): Promise<string> {
511
- return args.myField;
512
- }
513
-
514
- supportsNetwork = (network: Network) => true;
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;
515
510
  }
516
511
 
517
512
  export const myActionProvider = () => new MyActionProvider();
@@ -523,24 +518,27 @@ Actions that use a wallet provider can be defined as instance methods on the act
523
518
 
524
519
  ```typescript
525
520
  class MyActionProvider extends ActionProvider<WalletProvider> {
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(walletProvider: WalletProvider, args: z.infer<typeof MyActionSchema>): Promise<string> {
536
- return walletProvider.signMessage(args.myField);
537
- }
538
-
539
- supportsNetwork = (network: Network) => true;
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(
531
+ walletProvider: WalletProvider,
532
+ args: z.infer<typeof MyActionSchema>,
533
+ ): Promise<string> {
534
+ return walletProvider.signMessage(args.myField);
535
+ }
536
+
537
+ supportsNetwork = (network: Network) => true;
540
538
  }
541
539
  ```
542
540
 
543
- ### Adding an Action Provider to your AgentKit instance.
541
+ ### Adding an Action Provider to your AgentKit instance.
544
542
 
545
543
  This gives your agent access to the actions defined in the action provider.
546
544
 
@@ -557,26 +555,27 @@ const agentKit = new AgentKit({
557
555
  Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
558
556
 
559
557
  EVM:
560
- - [CdpV2EvmWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpV2EvmWalletProvider.ts)
561
- - [CdpWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpWalletProvider.ts)
558
+
559
+ - [CdpEvmWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpEvmWalletProvider.ts)
560
+ - [CdpSmartWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpSmartWalletProvider.ts)
562
561
  - [ViemWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/viemWalletProvider.ts)
563
562
  - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privyWalletProvider.ts)
564
563
  - [ZeroDevWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/zeroDevWalletProvider.ts)
565
564
 
566
- ### CdpV2EvmWalletProvider
565
+ ### CdpEvmWalletProvider
567
566
 
568
- 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.
567
+ 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.
569
568
 
570
569
  #### Basic Configuration
571
570
 
572
571
  ```typescript
573
- import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
572
+ import { CdpEvmWalletProvider } from "@coinbase/agentkit";
574
573
 
575
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
576
- apiKeyId: "CDP_API_KEY_ID",
577
- apiKeySecret: "CDP_API_KEY_SECRET",
578
- walletSecret: "CDP_WALLET_SECRET",
579
- networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
574
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
575
+ apiKeyId: "CDP_API_KEY_ID",
576
+ apiKeySecret: "CDP_API_KEY_SECRET",
577
+ walletSecret: "CDP_WALLET_SECRET",
578
+ networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
580
579
  });
581
580
  ```
582
581
 
@@ -585,14 +584,14 @@ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
585
584
  You can configure the provider with an existing wallet by providing the wallet's address:
586
585
 
587
586
  ```typescript
588
- import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
589
-
590
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
591
- apiKeyId: "CDP_API_KEY_ID",
592
- apiKeySecret: "CDP_API_KEY_SECRET",
593
- walletSecret: "CDP_WALLET_SECRET",
594
- address: "0x...", // The address of an existing wallet
595
- networkId: "base-sepolia",
587
+ import { CdpEvmWalletProvider } from "@coinbase/agentkit";
588
+
589
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
590
+ apiKeyId: "CDP_API_KEY_ID",
591
+ apiKeySecret: "CDP_API_KEY_SECRET",
592
+ walletSecret: "CDP_WALLET_SECRET",
593
+ address: "0x...", // The address of an existing wallet
594
+ networkId: "base-sepolia",
596
595
  });
597
596
  ```
598
597
 
@@ -601,14 +600,124 @@ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
601
600
  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:
602
601
 
603
602
  ```typescript
604
- import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
605
-
606
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
607
- apiKeyId: "CDP_API_KEY_ID",
608
- apiKeySecret: "CDP_API_KEY_SECRET",
609
- walletSecret: "CDP_WALLET_SECRET",
610
- idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
611
- networkId: "base-sepolia",
603
+ import { CdpEvmWalletProvider } from "@coinbase/agentkit";
604
+
605
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
606
+ apiKeyId: "CDP_API_KEY_ID",
607
+ apiKeySecret: "CDP_API_KEY_SECRET",
608
+ walletSecret: "CDP_WALLET_SECRET",
609
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
610
+ networkId: "base-sepolia",
611
+ });
612
+ ```
613
+
614
+ #### Environment Variables
615
+
616
+ The provider can also be configured using environment variables:
617
+
618
+ ```typescript
619
+ // Environment variables:
620
+ // CDP_API_KEY_ID=your_api_key_id
621
+ // CDP_API_KEY_SECRET=your_api_key_secret
622
+ // CDP_WALLET_SECRET=your_wallet_secret
623
+ // NETWORK_ID=base-sepolia (optional)
624
+ // IDEMPOTENCY_KEY=unique-key-123 (optional)
625
+
626
+ const walletProvider = await CdpEvmWalletProvider.configureWithWallet();
627
+ ```
628
+
629
+ #### Exporting a wallet
630
+
631
+ The `CdpEvmWalletProvider` can export a wallet by calling the `exportWallet` method:
632
+
633
+ ```typescript
634
+ const walletData = await walletProvider.exportWallet();
635
+ ```
636
+
637
+ ### CdpSmartWalletProvider
638
+
639
+ 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.
640
+
641
+ **Note:** Smart wallets are currently only supported on Base networks (base-sepolia and base-mainnet).
642
+
643
+ #### Basic Configuration
644
+
645
+ ```typescript
646
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
647
+
648
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
649
+ apiKeyId: "CDP_API_KEY_ID",
650
+ apiKeySecret: "CDP_API_KEY_SECRET",
651
+ walletSecret: "CDP_WALLET_SECRET",
652
+ networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
653
+ });
654
+ ```
655
+
656
+ #### Using an Existing Smart Wallet
657
+
658
+ You can configure the provider with an existing smart wallet by providing either the wallet's address or name:
659
+
660
+ ```typescript
661
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
662
+
663
+ // Using smart wallet address
664
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
665
+ apiKeyId: "CDP_API_KEY_ID",
666
+ apiKeySecret: "CDP_API_KEY_SECRET",
667
+ walletSecret: "CDP_WALLET_SECRET",
668
+ address: "0x...", // The address of an existing smart wallet
669
+ networkId: "base-sepolia",
670
+ });
671
+
672
+ // Or using smart wallet name
673
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
674
+ apiKeyId: "CDP_API_KEY_ID",
675
+ apiKeySecret: "CDP_API_KEY_SECRET",
676
+ walletSecret: "CDP_WALLET_SECRET",
677
+ smartAccountName: "my-smart-wallet", // The name of an existing smart wallet
678
+ networkId: "base-sepolia",
679
+ });
680
+ ```
681
+
682
+ #### Specifying an Owner Account
683
+
684
+ Smart wallets require an owner account. You can specify an existing owner account by providing its address or the account object itself:
685
+
686
+ ```typescript
687
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
688
+
689
+ // Using owner address
690
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
691
+ apiKeyId: "CDP_API_KEY_ID",
692
+ apiKeySecret: "CDP_API_KEY_SECRET",
693
+ walletSecret: "CDP_WALLET_SECRET",
694
+ owner: "0x...", // The address of the owner account
695
+ networkId: "base-sepolia",
696
+ });
697
+
698
+ // Using owner account object
699
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
700
+ apiKeyId: "CDP_API_KEY_ID",
701
+ apiKeySecret: "CDP_API_KEY_SECRET",
702
+ walletSecret: "CDP_WALLET_SECRET",
703
+ owner: ownerAccount, // An EvmServerAccount or PrivateKeyAccount object
704
+ networkId: "base-sepolia",
705
+ });
706
+ ```
707
+
708
+ #### Creating a New Smart Wallet
709
+
710
+ 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:
711
+
712
+ ```typescript
713
+ import { CdpSmartWalletProvider } from "@coinbase/agentkit";
714
+
715
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet({
716
+ apiKeyId: "CDP_API_KEY_ID",
717
+ apiKeySecret: "CDP_API_KEY_SECRET",
718
+ walletSecret: "CDP_WALLET_SECRET",
719
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new owner account will be created
720
+ networkId: "base-sepolia",
612
721
  });
613
722
  ```
614
723
 
@@ -624,64 +733,87 @@ The provider can also be configured using environment variables:
624
733
  // NETWORK_ID=base-sepolia (optional)
625
734
  // IDEMPOTENCY_KEY=unique-key-123 (optional)
626
735
 
627
- const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet();
736
+ const walletProvider = await CdpSmartWalletProvider.configureWithWallet();
628
737
  ```
629
738
 
630
- ### CdpWalletProvider
739
+ #### Exporting Smart Wallet Information
631
740
 
632
- The `CdpWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) [API Wallet](https://docs.cdp.coinbase.com/wallet-api/docs/welcome).
741
+ The `CdpSmartWalletProvider` can export wallet information by calling the `exportWallet` method:
742
+
743
+ ```typescript
744
+ const walletData = await walletProvider.exportWallet();
745
+
746
+ // walletData will be in the following format:
747
+ {
748
+ name: string | undefined; // The smart wallet name (if set)
749
+ address: string; // The smart wallet address
750
+ ownerAddress: string; // The owner account address
751
+ }
752
+ ```
753
+
754
+ #### Key Differences from Regular Wallets
755
+
756
+ 1. **User Operations**: Smart wallets use ERC-4337 user operations instead of regular transactions
757
+ 2. **No Direct Transaction Signing**: Smart wallets cannot sign transactions directly; all operations go through the user operation flow
758
+ 3. **Gasless Transactions**: Smart wallets can be configured to use paymasters for sponsored transactions
759
+ 4. **Batch Operations**: Multiple operations can be bundled into a single user operation
760
+ 5. **Base Networks Only**: Currently limited to base-sepolia and base-mainnet
761
+
762
+ ### LegacyCdpWalletProvider
763
+
764
+ 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).
633
765
 
634
766
  #### Network Configuration
635
767
 
636
- 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).
768
+ 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).
637
769
 
638
770
  ```typescript
639
- import { CdpWalletProvider } from "@coinbase/agentkit";
771
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
640
772
 
641
773
  const walletProvider = await CdpWalletProvider.configureWithWallet({
642
- apiKeyId: "CDP API KEY NAME",
643
- apiKeyPrivate: "CDP API KEY SECRET",
644
- networkId: "base-mainnet",
774
+ apiKeyId: "CDP API KEY NAME",
775
+ apiKeyPrivate: "CDP API KEY SECRET",
776
+ networkId: "base-mainnet",
645
777
  });
646
778
  ```
647
779
 
648
780
  #### Configuring from an existing CDP API Wallet
649
781
 
650
- If you already have a CDP API Wallet, you can configure the `CdpWalletProvider` by passing the `wallet` parameter to the `configureWithWallet` method.
782
+ If you already have a CDP API Wallet, you can configure the `LegacyCdpWalletProvider` by passing the `wallet` parameter to the `configureWithWallet` method.
651
783
 
652
784
  ```typescript
653
- import { CdpWalletProvider } from "@coinbase/agentkit";
785
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
654
786
  import { Wallet } from "@coinbase/coinbase-sdk";
655
- const walletProvider = await CdpWalletProvider.configureWithWallet({
656
- wallet,
657
- apiKeyId: "CDP API KEY NAME",
658
- apiKeyPrivate: "CDP API KEY SECRET",
787
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
788
+ wallet,
789
+ apiKeyId: "CDP API KEY NAME",
790
+ apiKeyPrivate: "CDP API KEY SECRET",
659
791
  });
660
792
  ```
661
793
 
662
794
  #### Configuring from a mnemonic phrase
663
795
 
664
- 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`.
796
+ 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`.
665
797
 
666
798
  ```typescript
667
- import { CdpWalletProvider } from "@coinbase/agentkit";
799
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
668
800
 
669
- const walletProvider = await CdpWalletProvider.configureWithWallet({
670
- mnemonicPhrase: "MNEMONIC PHRASE",
671
- networkId: "base-sepolia",
801
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
802
+ mnemonicPhrase: "MNEMONIC PHRASE",
803
+ networkId: "base-sepolia",
672
804
  });
673
805
  ```
674
806
 
675
807
  #### Exporting a wallet
676
808
 
677
- The `CdpWalletProvider` can export a wallet by calling the `exportWallet` method.
809
+ The `LegacyCdpWalletProvider` can export a wallet by calling the `exportWallet` method.
678
810
 
679
811
  ```typescript
680
- import { CdpWalletProvider } from "@coinbase/agentkit";
812
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
681
813
 
682
- const walletProvider = await CdpWalletProvider.configureWithWallet({
683
- mnemonicPhrase: "MNEMONIC PHRASE",
684
- networkId: "base-sepolia",
814
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
815
+ mnemonicPhrase: "MNEMONIC PHRASE",
816
+ networkId: "base-sepolia",
685
817
  });
686
818
 
687
819
  const walletData = await walletProvider.exportWallet();
@@ -689,39 +821,38 @@ const walletData = await walletProvider.exportWallet();
689
821
 
690
822
  #### Importing a wallet from `WalletData` JSON string
691
823
 
692
- The `CdpWalletProvider` can import a wallet from a `WalletData` JSON string by passing the `cdpWalletData` parameter to the `configureWithWallet` method.
824
+ The `LegacyCdpWalletProvider` can import a wallet from a `WalletData` JSON string by passing the `cdpWalletData` parameter to the `configureWithWallet` method.
693
825
 
694
826
  ```typescript
695
- import { CdpWalletProvider } from "@coinbase/agentkit";
827
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
696
828
 
697
- const walletProvider = await CdpWalletProvider.configureWithWallet({
698
- cdpWalletData: "WALLET DATA JSON STRING",
699
- apiKeyId: "CDP API KEY NAME",
700
- apiKeyPrivate: "CDP API KEY SECRET",
829
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
830
+ cdpWalletData: "WALLET DATA JSON STRING",
831
+ apiKeyId: "CDP API KEY NAME",
832
+ apiKeyPrivate: "CDP API KEY SECRET",
701
833
  });
702
834
  ```
703
835
 
704
- #### Configuring CdpWalletProvider gas parameters
836
+ #### Configuring LegacyCdpWalletProvider gas parameters
705
837
 
706
- The `CdpWalletProvider` also exposes parameters for effecting the gas calculations.
838
+ The `LegacyCdpWalletProvider` also exposes parameters for effecting the gas calculations.
707
839
 
708
840
  ```typescript
709
- import { CdpWalletProvider } from "@coinbase/agentkit";
710
-
711
- const walletProvider = await CdpWalletProvider.configureWithWallet({
712
- cdpWalletData: "WALLET DATA JSON STRING",
713
- apiKeyId: "CDP API KEY NAME",
714
- apiKeyPrivate: "CDP API KEY SECRET",
715
- gas: {
716
- gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
717
- feePerGasMultiplier: 2.0, // Adjusts max fee per gas
718
- }
841
+ import { LegacyCdpWalletProvider } from "@coinbase/agentkit";
842
+
843
+ const walletProvider = await LegacyCdpWalletProvider.configureWithWallet({
844
+ cdpWalletData: "WALLET DATA JSON STRING",
845
+ apiKeyId: "CDP API KEY NAME",
846
+ apiKeyPrivate: "CDP API KEY SECRET",
847
+ gas: {
848
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
849
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
850
+ },
719
851
  });
720
852
  ```
721
853
 
722
854
  **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.
723
855
 
724
-
725
856
  ### ViemWalletProvider
726
857
 
727
858
  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.
@@ -768,8 +899,8 @@ const client = createWalletClient({
768
899
  });
769
900
 
770
901
  const walletProvider = new ViemWalletProvider(client, {
771
- gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
772
- feePerGasMultiplier: 2.0, // Adjusts max fee per gas
902
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
903
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
773
904
  });
774
905
  ```
775
906
 
@@ -784,12 +915,12 @@ import { PrivyWalletProvider } from "@coinbase/agentkit";
784
915
 
785
916
  // Configure Server Wallet Provider
786
917
  const config = {
787
- appId: "PRIVY_APP_ID",
788
- appSecret: "PRIVY_APP_SECRET",
789
- chainId: "84532", // base-sepolia
790
- walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
791
- authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY", // optional, required if your account is using authorization keys
792
- authorizationKeyId: "PRIVY_WALLET_AUTHORIZATION_KEY_ID", // optional, only required to create a new wallet if walletId is not provided
918
+ appId: "PRIVY_APP_ID",
919
+ appSecret: "PRIVY_APP_SECRET",
920
+ chainId: "84532", // base-sepolia
921
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
922
+ authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY", // optional, required if your account is using authorization keys
923
+ authorizationKeyId: "PRIVY_WALLET_AUTHORIZATION_KEY_ID", // optional, only required to create a new wallet if walletId is not provided
793
924
  };
794
925
 
795
926
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -804,12 +935,12 @@ import { PrivyWalletProvider } from "@coinbase/agentkit";
804
935
 
805
936
  // Configure Embedded Wallet Provider
806
937
  const config = {
807
- appId: "PRIVY_APP_ID",
808
- appSecret: "PRIVY_APP_SECRET",
809
- authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY",
810
- walletId: "PRIVY_DELEGATED_WALLET_ID", // The ID of the wallet that was delegated to your server
811
- networkId: "base-mainnet", // or any supported network
812
- walletType: "embedded" // Specify "embedded" to use the embedded wallet provider
938
+ appId: "PRIVY_APP_ID",
939
+ appSecret: "PRIVY_APP_SECRET",
940
+ authorizationPrivateKey: "PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY",
941
+ walletId: "PRIVY_DELEGATED_WALLET_ID", // The ID of the wallet that was delegated to your server
942
+ networkId: "base-mainnet", // or any supported network
943
+ walletType: "embedded", // Specify "embedded" to use the embedded wallet provider
813
944
  };
814
945
 
815
946
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -840,23 +971,23 @@ When using authorization keys, you must provide the `authorizationPrivateKey` an
840
971
 
841
972
  #### Exporting Privy Wallet information
842
973
 
843
- The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
974
+ The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
844
975
 
845
976
  ```typescript
846
977
  const walletData = await walletProvider.exportWallet();
847
978
 
848
979
  // For server wallets, walletData will be in the following format:
849
980
  {
850
- walletId: string;
851
- authorizationKey: string | undefined;
852
- chainId: string | undefined;
981
+ walletId: string;
982
+ authorizationKey: string | undefined;
983
+ chainId: string | undefined;
853
984
  }
854
985
 
855
986
  // For embedded wallets, walletData will be in the following format:
856
987
  {
857
- walletId: string;
858
- networkId: string;
859
- chainId: string | undefined;
988
+ walletId: string;
989
+ networkId: string;
990
+ chainId: string | undefined;
860
991
  }
861
992
  ```
862
993
 
@@ -884,11 +1015,11 @@ const walletProvider = await SmartWalletProvider.configureWithWallet({
884
1015
 
885
1016
  ### ZeroDevWalletProvider
886
1017
 
887
- 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.
1018
+ 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.
888
1019
 
889
- 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.
1020
+ 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.
890
1021
 
891
- 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.
1022
+ 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.
892
1023
 
893
1024
  #### Configuring from CdpWalletProvider
894
1025
 
@@ -897,17 +1028,17 @@ import { ZeroDevWalletProvider, CdpWalletProvider } from "@coinbase/agentkit";
897
1028
 
898
1029
  // First create a CDP wallet provider as the signer
899
1030
  const cdpWalletProvider = await CdpWalletProvider.configureWithWallet({
900
- apiKeyId: "CDP API KEY NAME",
901
- apiKeyPrivate: "CDP API KEY SECRET",
902
- networkId: "base-mainnet",
1031
+ apiKeyId: "CDP API KEY NAME",
1032
+ apiKeyPrivate: "CDP API KEY SECRET",
1033
+ networkId: "base-mainnet",
903
1034
  });
904
1035
 
905
1036
  // Configure ZeroDev Wallet Provider with CDP signer
906
1037
  const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
907
- signer: cdpWalletProvider.toSigner(),
908
- projectId: "ZERODEV_PROJECT_ID",
909
- entryPointVersion: "0.7" as const,
910
- networkId: "base-mainnet",
1038
+ signer: cdpWalletProvider.toSigner(),
1039
+ projectId: "ZERODEV_PROJECT_ID",
1040
+ entryPointVersion: "0.7" as const,
1041
+ networkId: "base-mainnet",
911
1042
  });
912
1043
  ```
913
1044
 
@@ -918,17 +1049,17 @@ import { ZeroDevWalletProvider, PrivyWalletProvider } from "@coinbase/agentkit";
918
1049
 
919
1050
  // First create a Privy wallet provider as the signer
920
1051
  const privyWalletProvider = await PrivyWalletProvider.configureWithWallet({
921
- appId: "PRIVY_APP_ID",
922
- appSecret: "PRIVY_APP_SECRET",
923
- chainId: "8453", // base-mainnet
1052
+ appId: "PRIVY_APP_ID",
1053
+ appSecret: "PRIVY_APP_SECRET",
1054
+ chainId: "8453", // base-mainnet
924
1055
  });
925
1056
 
926
1057
  // Configure ZeroDev Wallet Provider with Privy signer
927
1058
  const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
928
- signer: privyWalletProvider.toSigner(),
929
- projectId: "ZERODEV_PROJECT_ID",
930
- entryPointVersion: "0.7" as const,
931
- networkId: "base-mainnet",
1059
+ signer: privyWalletProvider.toSigner(),
1060
+ projectId: "ZERODEV_PROJECT_ID",
1061
+ entryPointVersion: "0.7" as const,
1062
+ networkId: "base-mainnet",
932
1063
  });
933
1064
  ```
934
1065
 
@@ -948,15 +1079,15 @@ const viemWalletProvider = new ViemWalletProvider(
948
1079
  account,
949
1080
  chain: base,
950
1081
  transport: http(),
951
- })
1082
+ }),
952
1083
  );
953
1084
 
954
1085
  // Configure ZeroDev Wallet Provider with Viem signer
955
1086
  const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
956
- signer: viemWalletProvider.toSigner(),
957
- projectId: "ZERODEV_PROJECT_ID",
958
- entryPointVersion: "0.7" as const,
959
- networkId: "base-mainnet",
1087
+ signer: viemWalletProvider.toSigner(),
1088
+ projectId: "ZERODEV_PROJECT_ID",
1089
+ entryPointVersion: "0.7" as const,
1090
+ networkId: "base-mainnet",
960
1091
  });
961
1092
  ```
962
1093
 
@@ -965,6 +1096,7 @@ const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
965
1096
  Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
966
1097
 
967
1098
  SVM:
1099
+
968
1100
  - [CdpV2SolanaWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpV2SolanaWalletProvider.ts)
969
1101
  - [SolanaKeypairWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/solanaKeypairWalletProvider.ts)
970
1102
  - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privySvmWalletProvider.ts)
@@ -979,10 +1111,10 @@ The `CdpV2SolanaWalletProvider` is a wallet provider that uses the Coinbase Deve
979
1111
  import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
980
1112
 
981
1113
  const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
982
- apiKeyId: "CDP_API_KEY_ID",
983
- apiKeySecret: "CDP_API_KEY_SECRET",
984
- walletSecret: "CDP_WALLET_SECRET",
985
- networkId: "solana-devnet", // Optional, defaults to "solana-devnet"
1114
+ apiKeyId: "CDP_API_KEY_ID",
1115
+ apiKeySecret: "CDP_API_KEY_SECRET",
1116
+ walletSecret: "CDP_WALLET_SECRET",
1117
+ networkId: "solana-devnet", // Optional, defaults to "solana-devnet"
986
1118
  });
987
1119
  ```
988
1120
 
@@ -994,11 +1126,11 @@ You can configure the provider with an existing wallet by providing the wallet's
994
1126
  import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
995
1127
 
996
1128
  const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
997
- apiKeyId: "CDP_API_KEY_ID",
998
- apiKeySecret: "CDP_API_KEY_SECRET",
999
- walletSecret: "CDP_WALLET_SECRET",
1000
- address: "your-solana-address", // The address of an existing wallet
1001
- networkId: "solana-devnet",
1129
+ apiKeyId: "CDP_API_KEY_ID",
1130
+ apiKeySecret: "CDP_API_KEY_SECRET",
1131
+ walletSecret: "CDP_WALLET_SECRET",
1132
+ address: "your-solana-address", // The address of an existing wallet
1133
+ networkId: "solana-devnet",
1002
1134
  });
1003
1135
  ```
1004
1136
 
@@ -1010,11 +1142,11 @@ To create a new wallet, you can provide an idempotency key. The same idempotency
1010
1142
  import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
1011
1143
 
1012
1144
  const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
1013
- apiKeyId: "CDP_API_KEY_ID",
1014
- apiKeySecret: "CDP_API_KEY_SECRET",
1015
- walletSecret: "CDP_WALLET_SECRET",
1016
- idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
1017
- networkId: "solana-devnet",
1145
+ apiKeyId: "CDP_API_KEY_ID",
1146
+ apiKeySecret: "CDP_API_KEY_SECRET",
1147
+ walletSecret: "CDP_WALLET_SECRET",
1148
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
1149
+ networkId: "solana-devnet",
1018
1150
  });
1019
1151
  ```
1020
1152
 
@@ -1036,6 +1168,7 @@ const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet();
1036
1168
  #### Supported Networks
1037
1169
 
1038
1170
  The `CdpV2SolanaWalletProvider` supports the following Solana networks:
1171
+
1039
1172
  - `solana-mainnet`
1040
1173
  - `solana-devnet`
1041
1174
  - `solana-testnet`
@@ -1051,6 +1184,7 @@ NOTE: It is highly recommended to use a dedicated RPC provider. See [here](https
1051
1184
  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`.
1052
1185
 
1053
1186
  The default RPC endpoints for each network are as follows:
1187
+
1054
1188
  - `solana-mainnet`: `https://api.mainnet-beta.solana.com`
1055
1189
  - `solana-devnet`: `https://api.devnet.solana.com`
1056
1190
  - `solana-testnet`: `https://api.testnet.solana.com`
@@ -1088,14 +1222,14 @@ import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";
1088
1222
 
1089
1223
  // Configure Wallet Provider
1090
1224
  const config: PrivyWalletConfig = {
1091
- appId: "PRIVY_APP_ID",
1092
- appSecret: "PRIVY_APP_SECRET",
1093
- connection,
1094
- chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1095
- networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1096
- walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1097
- authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1098
- authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1225
+ appId: "PRIVY_APP_ID",
1226
+ appSecret: "PRIVY_APP_SECRET",
1227
+ connection,
1228
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1229
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1230
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1231
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1232
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1099
1233
  };
1100
1234
 
1101
1235
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -1112,14 +1246,14 @@ const connection = new Connection("YOUR_RPC_URL");
1112
1246
 
1113
1247
  // Configure Wallet Provider
1114
1248
  const config: PrivyWalletConfig = {
1115
- appId: "PRIVY_APP_ID",
1116
- appSecret: "PRIVY_APP_SECRET",
1117
- connection,
1118
- chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1119
- networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1120
- walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1121
- authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1122
- authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1249
+ appId: "PRIVY_APP_ID",
1250
+ appSecret: "PRIVY_APP_SECRET",
1251
+ connection,
1252
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
1253
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
1254
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
1255
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
1256
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
1123
1257
  };
1124
1258
 
1125
1259
  const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
@@ -1142,9 +1276,9 @@ const walletData = await walletProvider.exportWallet();
1142
1276
 
1143
1277
  // walletData will be in the following format:
1144
1278
  {
1145
- walletId: string;
1146
- authorizationKey: string | undefined;
1147
- networkId: string | undefined;
1279
+ walletId: string;
1280
+ authorizationKey: string | undefined;
1281
+ networkId: string | undefined;
1148
1282
  }
1149
1283
  ```
1150
1284