@coinbase/agentkit 0.7.2 → 0.8.0

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.
package/README.md CHANGED
@@ -65,8 +65,8 @@ npm install @coinbase/agentkit
65
65
 
66
66
  ```typescript
67
67
  const agentKit = await AgentKit.from({
68
- cdpApiKeyName: "CDP API KEY NAME",
69
- cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
68
+ cdpApiKeyId: "CDP API KEY NAME",
69
+ cdpApiKeyPrivate: "CDP API KEY SECRET",
70
70
  });
71
71
  ```
72
72
 
@@ -76,8 +76,8 @@ If no wallet or action provider are specified, the agent will use the `CdpWallet
76
76
 
77
77
  ```typescript
78
78
  const agentKit = await AgentKit.from({
79
- cdpApiKeyName: "CDP API KEY NAME",
80
- cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
79
+ cdpApiKeyId: "CDP API KEY NAME",
80
+ cdpApiKeyPrivate: "CDP API KEY SECRET",
81
81
  });
82
82
  ```
83
83
 
@@ -87,8 +87,8 @@ const agentKit = await AgentKit.from({
87
87
  import { CdpWalletProvider } from "@coinbase/agentkit";
88
88
 
89
89
  const walletProvider = await CdpWalletProvider.configureWithWallet({
90
- apiKeyName: "CDP API KEY NAME",
91
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
90
+ apiKeyId: "CDP API KEY NAME",
91
+ apiKeyPrivate: "CDP API KEY SECRET",
92
92
  networkId: "base-mainnet",
93
93
  });
94
94
 
@@ -106,8 +106,8 @@ const agentKit = await AgentKit.from({
106
106
  walletProvider,
107
107
  actionProviders: [
108
108
  cdpApiActionProvider({
109
- apiKeyName: "CDP API KEY NAME",
110
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
109
+ apiKeyId: "CDP API KEY NAME",
110
+ apiKeyPrivate: "CDP API KEY SECRET",
111
111
  }),
112
112
  pythActionProvider(),
113
113
  ],
@@ -528,8 +528,8 @@ This gives your agent access to the actions defined in the action provider.
528
528
 
529
529
  ```typescript
530
530
  const agentKit = new AgentKit({
531
- cdpApiKeyName: "CDP API KEY NAME",
532
- cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
531
+ cdpApiKeyId: "CDP API KEY NAME",
532
+ cdpApiKeyPrivate: "CDP API KEY SECRET",
533
533
  actionProviders: [myActionProvider()],
534
534
  });
535
535
  ```
@@ -621,8 +621,8 @@ The `CdpWalletProvider` can be configured to use a specific network by passing t
621
621
  import { CdpWalletProvider } from "@coinbase/agentkit";
622
622
 
623
623
  const walletProvider = await CdpWalletProvider.configureWithWallet({
624
- apiKeyName: "CDP API KEY NAME",
625
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
624
+ apiKeyId: "CDP API KEY NAME",
625
+ apiKeyPrivate: "CDP API KEY SECRET",
626
626
  networkId: "base-mainnet",
627
627
  });
628
628
  ```
@@ -636,8 +636,8 @@ import { CdpWalletProvider } from "@coinbase/agentkit";
636
636
  import { Wallet } from "@coinbase/coinbase-sdk";
637
637
  const walletProvider = await CdpWalletProvider.configureWithWallet({
638
638
  wallet,
639
- apiKeyName: "CDP API KEY NAME",
640
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
639
+ apiKeyId: "CDP API KEY NAME",
640
+ apiKeyPrivate: "CDP API KEY SECRET",
641
641
  });
642
642
  ```
643
643
 
@@ -678,8 +678,8 @@ import { CdpWalletProvider } from "@coinbase/agentkit";
678
678
 
679
679
  const walletProvider = await CdpWalletProvider.configureWithWallet({
680
680
  cdpWalletData: "WALLET DATA JSON STRING",
681
- apiKeyName: "CDP API KEY NAME",
682
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
681
+ apiKeyId: "CDP API KEY NAME",
682
+ apiKeyPrivate: "CDP API KEY SECRET",
683
683
  });
684
684
  ```
685
685
 
@@ -692,8 +692,8 @@ import { CdpWalletProvider } from "@coinbase/agentkit";
692
692
 
693
693
  const walletProvider = await CdpWalletProvider.configureWithWallet({
694
694
  cdpWalletData: "WALLET DATA JSON STRING",
695
- apiKeyName: "CDP API KEY NAME",
696
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
695
+ apiKeyId: "CDP API KEY NAME",
696
+ apiKeyPrivate: "CDP API KEY SECRET",
697
697
  gas: {
698
698
  gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
699
699
  feePerGasMultiplier: 2.0, // Adjusts max fee per gas
@@ -879,8 +879,8 @@ import { ZeroDevWalletProvider, CdpWalletProvider } from "@coinbase/agentkit";
879
879
 
880
880
  // First create a CDP wallet provider as the signer
881
881
  const cdpWalletProvider = await CdpWalletProvider.configureWithWallet({
882
- apiKeyName: "CDP API KEY NAME",
883
- apiKeyPrivate: "CDP API KEY PRIVATE KEY",
882
+ apiKeyId: "CDP API KEY NAME",
883
+ apiKeyPrivate: "CDP API KEY SECRET",
884
884
  networkId: "base-mainnet",
885
885
  });
886
886
 
@@ -39,10 +39,10 @@ class CdpApiActionProvider extends actionProvider_1.ActionProvider {
39
39
  * @returns True if the Cdp action provider supports the network, false otherwise.
40
40
  */
41
41
  this.supportsNetwork = (_) => true;
42
- if (config.apiKeyName && config.apiKeyPrivateKey) {
42
+ if (config.apiKeyId && config.apiKeySecret) {
43
43
  coinbase_sdk_1.Coinbase.configure({
44
- apiKeyName: config.apiKeyName,
45
- privateKey: config.apiKeyPrivateKey?.replace(/\\n/g, "\n"),
44
+ apiKeyName: config.apiKeyId,
45
+ privateKey: config.apiKeySecret?.replace(/\\n/g, "\n"),
46
46
  source: "agentkit",
47
47
  sourceVersion: package_json_1.version,
48
48
  });
@@ -38,10 +38,10 @@ class CdpWalletActionProvider extends actionProvider_1.ActionProvider {
38
38
  * @returns True if the Cdp action provider supports the network, false otherwise.
39
39
  */
40
40
  this.supportsNetwork = (network) => network.protocolFamily === "evm";
41
- if (config.apiKeyName && config.apiKeyPrivateKey) {
41
+ if (config.apiKeyId && config.apiKeySecret) {
42
42
  coinbase_sdk_1.Coinbase.configure({
43
- apiKeyName: config.apiKeyName,
44
- privateKey: config.apiKeyPrivateKey?.replace(/\\n/g, "\n"),
43
+ apiKeyName: config.apiKeyId,
44
+ privateKey: config.apiKeySecret?.replace(/\\n/g, "\n"),
45
45
  source: "agentkit",
46
46
  sourceVersion: package_json_1.version,
47
47
  });
@@ -4,8 +4,8 @@ import { Action, ActionProvider } from "./action-providers";
4
4
  * Configuration options for AgentKit
5
5
  */
6
6
  export type AgentKitOptions = {
7
- cdpApiKeyName?: string;
8
- cdpApiKeyPrivateKey?: string;
7
+ cdpApiKeyId?: string;
8
+ cdpApiKeySecret?: string;
9
9
  walletProvider?: WalletProvider;
10
10
  actionProviders?: ActionProvider[];
11
11
  };
package/dist/agentkit.js CHANGED
@@ -32,12 +32,12 @@ class AgentKit {
32
32
  static async from(config = { actionProviders: [(0, action_providers_1.walletActionProvider)()] }) {
33
33
  let walletProvider = config.walletProvider;
34
34
  if (!config.walletProvider) {
35
- if (!config.cdpApiKeyName || !config.cdpApiKeyPrivateKey) {
36
- throw new Error("cdpApiKeyName and cdpApiKeyPrivateKey are required if not providing a walletProvider");
35
+ if (!config.cdpApiKeyId || !config.cdpApiKeySecret) {
36
+ throw new Error("cdpApiKeyId and cdpApiKeySecret are required if not providing a walletProvider");
37
37
  }
38
38
  walletProvider = await wallet_providers_1.CdpWalletProvider.configureWithWallet({
39
- apiKeyName: config.cdpApiKeyName,
40
- apiKeyPrivateKey: config.cdpApiKeyPrivateKey,
39
+ apiKeyId: config.cdpApiKeyId,
40
+ apiKeySecret: config.cdpApiKeySecret,
41
41
  });
42
42
  }
43
43
  return new AgentKit({ ...config, walletProvider: walletProvider });
@@ -9,11 +9,11 @@ export interface CdpProviderConfig {
9
9
  /**
10
10
  * The CDP API Key Name.
11
11
  */
12
- apiKeyName?: string;
12
+ apiKeyId?: string;
13
13
  /**
14
14
  * The CDP API Key Private Key.
15
15
  */
16
- apiKeyPrivateKey?: string;
16
+ apiKeySecret?: string;
17
17
  }
18
18
  /**
19
19
  * Configuration options for the CdpActionProvider.
@@ -56,10 +56,10 @@ class CdpWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
56
56
  * @throws Error if required environment variables are missing or wallet initialization fails
57
57
  */
58
58
  static async configureWithWallet(config = {}) {
59
- if (config.apiKeyName && config.apiKeyPrivateKey) {
59
+ if (config.apiKeyId && config.apiKeySecret) {
60
60
  coinbase_sdk_1.Coinbase.configure({
61
- apiKeyName: config.apiKeyName,
62
- privateKey: config.apiKeyPrivateKey?.replace(/\\n/g, "\n"),
61
+ apiKeyName: config.apiKeyId,
62
+ privateKey: config.apiKeySecret?.replace(/\\n/g, "\n"),
63
63
  source: "agentkit",
64
64
  sourceVersion: package_json_1.version,
65
65
  });
@@ -199,16 +199,16 @@ describe("CdpWalletProvider", () => {
199
199
  expect(provider.getNetwork()).toEqual(MOCK_NETWORK);
200
200
  });
201
201
  it("should initialize with API keys", async () => {
202
- const apiKeyName = "test-key";
203
- const apiKeyPrivateKey = "private-key";
202
+ const apiKeyId = "test-key";
203
+ const apiKeySecret = "private-key";
204
204
  const provider = await cdpWalletProvider_1.CdpWalletProvider.configureWithWallet({
205
- apiKeyName,
206
- apiKeyPrivateKey,
205
+ apiKeyId,
206
+ apiKeySecret,
207
207
  networkId: MOCK_NETWORK_ID,
208
208
  });
209
209
  expect(coinbase_sdk_1.Coinbase.configure).toHaveBeenCalledWith({
210
- apiKeyName,
211
- privateKey: apiKeyPrivateKey,
210
+ apiKeyName: apiKeyId,
211
+ privateKey: apiKeySecret,
212
212
  source: "agentkit",
213
213
  sourceVersion: "1.0.0",
214
214
  });
@@ -3,8 +3,8 @@ import { Abi, Address, ContractFunctionArgs, ContractFunctionName, Hex, ReadCont
3
3
  import { Network } from "../network";
4
4
  import { EvmWalletProvider } from "./evmWalletProvider";
5
5
  export interface ConfigureSmartWalletOptions {
6
- cdpApiKeyName?: string;
7
- cdpApiKeyPrivateKey?: string;
6
+ cdpApiKeyId?: string;
7
+ cdpApiKeySecret?: string;
8
8
  networkId?: string;
9
9
  smartWalletAddress?: Hex;
10
10
  paymasterUrl?: string;
@@ -39,8 +39,8 @@ export declare class SmartWalletProvider extends EvmWalletProvider {
39
39
  * const smartWalletProvider = await SmartWalletProvider.configureWithWallet({
40
40
  * networkId: "base-sepolia",
41
41
  * signer: privateKeyToAccount("0xethprivatekey"),
42
- * cdpApiKeyName: "my-api-key",
43
- * cdpApiKeyPrivateKey: "my-private-key",
42
+ * cdpApiKeyId: "my-api-key",
43
+ * cdpApiKeySecret: "my-private-key",
44
44
  * smartWalletAddress: "0x123456...",
45
45
  * });
46
46
  * ```
@@ -57,8 +57,8 @@ class SmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
57
57
  * const smartWalletProvider = await SmartWalletProvider.configureWithWallet({
58
58
  * networkId: "base-sepolia",
59
59
  * signer: privateKeyToAccount("0xethprivatekey"),
60
- * cdpApiKeyName: "my-api-key",
61
- * cdpApiKeyPrivateKey: "my-private-key",
60
+ * cdpApiKeyId: "my-api-key",
61
+ * cdpApiKeySecret: "my-private-key",
62
62
  * smartWalletAddress: "0x123456...",
63
63
  * });
64
64
  * ```
@@ -77,12 +77,12 @@ class SmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
77
77
  if (!supportedChainIds.includes(network.chainId)) {
78
78
  throw new Error(`Invalid chain id ${network.chainId}. Chain id must be one of ${supportedChainIds.join(", ")}`);
79
79
  }
80
- const cdpApiKeyName = config.cdpApiKeyName || process.env.CDP_API_KEY_NAME;
81
- const cdpApiKeyPrivateKey = config.cdpApiKeyPrivateKey || process.env.CDP_API_KEY_PRIVATE_KEY;
82
- if (cdpApiKeyName && cdpApiKeyPrivateKey) {
80
+ const cdpApiKeyId = config.cdpApiKeyId || process.env.CDP_API_KEY_ID;
81
+ const cdpApiKeySecret = config.cdpApiKeySecret || process.env.CDP_API_KEY_SECRET;
82
+ if (cdpApiKeyId && cdpApiKeySecret) {
83
83
  coinbase_sdk_1.Coinbase.configure({
84
- apiKeyName: cdpApiKeyName,
85
- privateKey: cdpApiKeyPrivateKey?.replace(/\\n/g, "\n"),
84
+ apiKeyName: cdpApiKeyId,
85
+ privateKey: cdpApiKeySecret?.replace(/\\n/g, "\n"),
86
86
  source: "agentkit",
87
87
  sourceVersion: package_json_1.version,
88
88
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@coinbase/agentkit",
3
3
  "description": "Coinbase AgentKit core primitives",
4
4
  "repository": "https://github.com/coinbase/agentkit",
5
- "version": "0.7.2",
5
+ "version": "0.8.0",
6
6
  "author": "Coinbase Inc.",
7
7
  "license": "Apache-2.0",
8
8
  "main": "dist/index.js",