@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
@@ -1,20 +1,20 @@
1
1
  import { z } from "zod";
2
2
  import { ActionProvider } from "../actionProvider";
3
3
  import { Network } from "../../network";
4
- import { CdpWalletProvider, CdpProviderConfig } from "../../wallet-providers";
4
+ import { LegacyCdpWalletProvider, LegacyCdpProviderConfig } from "../../wallet-providers";
5
5
  import { DeployContractSchema, DeployNftSchema, DeployTokenSchema, TradeSchema } from "./schemas";
6
6
  /**
7
7
  * CdpWalletActionProvider is an action provider for Cdp.
8
8
  *
9
9
  * This provider is used for any action that requires a CDP Wallet.
10
10
  */
11
- export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletProvider> {
11
+ export declare class LegacyCdpWalletActionProvider extends ActionProvider<LegacyCdpWalletProvider> {
12
12
  /**
13
13
  * Constructor for the CdpWalletActionProvider class.
14
14
  *
15
15
  * @param config - The configuration options for the CdpWalletActionProvider.
16
16
  */
17
- constructor(config?: CdpProviderConfig);
17
+ constructor(config?: LegacyCdpProviderConfig);
18
18
  /**
19
19
  * Deploys a contract.
20
20
  *
@@ -22,7 +22,7 @@ export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletPro
22
22
  * @param args - The input arguments for the action
23
23
  * @returns A message containing the deployed contract address and details
24
24
  */
25
- deployContract(walletProvider: CdpWalletProvider, args: z.infer<typeof DeployContractSchema>): Promise<string>;
25
+ deployContract(walletProvider: LegacyCdpWalletProvider, args: z.infer<typeof DeployContractSchema>): Promise<string>;
26
26
  /**
27
27
  * Deploys an NFT (ERC-721) token collection onchain from the wallet.
28
28
  *
@@ -30,7 +30,7 @@ export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletPro
30
30
  * @param args - The input arguments for the action.
31
31
  * @returns A message containing the NFT token deployment details.
32
32
  */
33
- deployNFT(walletProvider: CdpWalletProvider, args: z.infer<typeof DeployNftSchema>): Promise<string>;
33
+ deployNFT(walletProvider: LegacyCdpWalletProvider, args: z.infer<typeof DeployNftSchema>): Promise<string>;
34
34
  /**
35
35
  * Deploys a token.
36
36
  *
@@ -38,7 +38,7 @@ export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletPro
38
38
  * @param args - The arguments for the token deployment.
39
39
  * @returns The deployed token.
40
40
  */
41
- deployToken(walletProvider: CdpWalletProvider, args: z.infer<typeof DeployTokenSchema>): Promise<string>;
41
+ deployToken(walletProvider: LegacyCdpWalletProvider, args: z.infer<typeof DeployTokenSchema>): Promise<string>;
42
42
  /**
43
43
  * Trades a specified amount of a from asset to a to asset for the wallet.
44
44
  *
@@ -46,7 +46,7 @@ export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletPro
46
46
  * @param args - The input arguments for the action.
47
47
  * @returns A message containing the trade details.
48
48
  */
49
- trade(walletProvider: CdpWalletProvider, args: z.infer<typeof TradeSchema>): Promise<string>;
49
+ trade(walletProvider: LegacyCdpWalletProvider, args: z.infer<typeof TradeSchema>): Promise<string>;
50
50
  /**
51
51
  * Checks if the Cdp action provider supports the given network.
52
52
  *
@@ -55,4 +55,4 @@ export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletPro
55
55
  */
56
56
  supportsNetwork: (network: Network) => boolean;
57
57
  }
58
- export declare const cdpWalletActionProvider: (config?: CdpProviderConfig) => CdpWalletActionProvider;
58
+ export declare const legacyCdpWalletActionProvider: (config?: LegacyCdpProviderConfig) => LegacyCdpWalletActionProvider;
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.cdpWalletActionProvider = exports.CdpWalletActionProvider = void 0;
12
+ exports.legacyCdpWalletActionProvider = exports.LegacyCdpWalletActionProvider = void 0;
13
13
  const coinbase_sdk_1 = require("@coinbase/coinbase-sdk");
14
14
  const zod_1 = require("zod");
15
15
  const package_json_1 = require("../../../package.json");
@@ -23,14 +23,14 @@ const schemas_1 = require("./schemas");
23
23
  *
24
24
  * This provider is used for any action that requires a CDP Wallet.
25
25
  */
26
- class CdpWalletActionProvider extends actionProvider_1.ActionProvider {
26
+ class LegacyCdpWalletActionProvider extends actionProvider_1.ActionProvider {
27
27
  /**
28
28
  * Constructor for the CdpWalletActionProvider class.
29
29
  *
30
30
  * @param config - The configuration options for the CdpWalletActionProvider.
31
31
  */
32
32
  constructor(config = {}) {
33
- super("cdp_wallet", []);
33
+ super("legacy_cdp_wallet", []);
34
34
  /**
35
35
  * Checks if the Cdp action provider supports the given network.
36
36
  *
@@ -154,7 +154,7 @@ class CdpWalletActionProvider extends actionProvider_1.ActionProvider {
154
154
  }
155
155
  }
156
156
  }
157
- exports.CdpWalletActionProvider = CdpWalletActionProvider;
157
+ exports.LegacyCdpWalletActionProvider = LegacyCdpWalletActionProvider;
158
158
  __decorate([
159
159
  (0, actionDecorator_1.CreateAction)({
160
160
  name: "deploy_contract",
@@ -176,9 +176,9 @@ map where the key is the arg name and the value is the arg value. Encode uint/in
176
176
  schema: schemas_1.DeployContractSchema,
177
177
  }),
178
178
  __metadata("design:type", Function),
179
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
179
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
180
180
  __metadata("design:returntype", Promise)
181
- ], CdpWalletActionProvider.prototype, "deployContract", null);
181
+ ], LegacyCdpWalletActionProvider.prototype, "deployContract", null);
182
182
  __decorate([
183
183
  (0, actionDecorator_1.CreateAction)({
184
184
  name: "deploy_nft",
@@ -187,9 +187,9 @@ __decorate([
187
187
  schema: schemas_1.DeployNftSchema,
188
188
  }),
189
189
  __metadata("design:type", Function),
190
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
190
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
191
191
  __metadata("design:returntype", Promise)
192
- ], CdpWalletActionProvider.prototype, "deployNFT", null);
192
+ ], LegacyCdpWalletActionProvider.prototype, "deployNFT", null);
193
193
  __decorate([
194
194
  (0, actionDecorator_1.CreateAction)({
195
195
  name: "deploy_token",
@@ -198,9 +198,9 @@ The token will be deployed using the wallet's default address as the owner and i
198
198
  schema: schemas_1.DeployTokenSchema,
199
199
  }),
200
200
  __metadata("design:type", Function),
201
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
201
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
202
202
  __metadata("design:returntype", Promise)
203
- ], CdpWalletActionProvider.prototype, "deployToken", null);
203
+ ], LegacyCdpWalletActionProvider.prototype, "deployToken", null);
204
204
  __decorate([
205
205
  (0, actionDecorator_1.CreateAction)({
206
206
  name: "trade",
@@ -217,8 +217,8 @@ Important notes:
217
217
  schema: schemas_1.TradeSchema,
218
218
  }),
219
219
  __metadata("design:type", Function),
220
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
220
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
221
221
  __metadata("design:returntype", Promise)
222
- ], CdpWalletActionProvider.prototype, "trade", null);
223
- const cdpWalletActionProvider = (config = {}) => new CdpWalletActionProvider(config);
224
- exports.cdpWalletActionProvider = cdpWalletActionProvider;
222
+ ], LegacyCdpWalletActionProvider.prototype, "trade", null);
223
+ const legacyCdpWalletActionProvider = (config = {}) => new LegacyCdpWalletActionProvider(config);
224
+ exports.legacyCdpWalletActionProvider = legacyCdpWalletActionProvider;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const cdpWalletActionProvider_1 = require("./cdpWalletActionProvider");
3
+ const legacyCdpWalletActionProvider_1 = require("./legacyCdpWalletActionProvider");
4
4
  const schemas_1 = require("./schemas");
5
5
  // Mock the entire module
6
6
  jest.mock("@coinbase/coinbase-sdk");
@@ -55,7 +55,7 @@ describe("CDP Wallet Action Provider Input Schemas", () => {
55
55
  });
56
56
  });
57
57
  });
58
- describe("CDP Wallet Action Provider", () => {
58
+ describe("Legacy CDP Wallet Action Provider", () => {
59
59
  let actionProvider;
60
60
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
61
  let mockExternalAddressInstance;
@@ -63,7 +63,7 @@ describe("CDP Wallet Action Provider", () => {
63
63
  beforeEach(() => {
64
64
  // Reset all mocks before each test
65
65
  jest.clearAllMocks();
66
- actionProvider = new cdpWalletActionProvider_1.CdpWalletActionProvider();
66
+ actionProvider = new legacyCdpWalletActionProvider_1.LegacyCdpWalletActionProvider();
67
67
  mockExternalAddressInstance = {
68
68
  reputation: jest.fn(),
69
69
  faucet: jest.fn(),
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Input schema for address reputation check.
4
+ */
5
+ export declare const AddressReputationSchema: z.ZodObject<{
6
+ address: z.ZodString;
7
+ network: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ address: string;
10
+ network: string;
11
+ }, {
12
+ address: string;
13
+ network: string;
14
+ }>;
15
+ /**
16
+ * Input schema for deploy contract action.
17
+ */
18
+ export declare const DeployContractSchema: z.ZodObject<{
19
+ solidityVersion: z.ZodEnum<[string, ...string[]]>;
20
+ solidityInputJson: z.ZodString;
21
+ contractName: z.ZodString;
22
+ constructorArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ solidityVersion: string;
25
+ solidityInputJson: string;
26
+ contractName: string;
27
+ constructorArgs?: Record<string, any> | undefined;
28
+ }, {
29
+ solidityVersion: string;
30
+ solidityInputJson: string;
31
+ contractName: string;
32
+ constructorArgs?: Record<string, any> | undefined;
33
+ }>;
34
+ /**
35
+ * Input schema for deploy NFT action
36
+ */
37
+ export declare const DeployNftSchema: z.ZodObject<{
38
+ name: z.ZodString;
39
+ symbol: z.ZodString;
40
+ baseURI: z.ZodString;
41
+ }, "strip", z.ZodTypeAny, {
42
+ symbol: string;
43
+ name: string;
44
+ baseURI: string;
45
+ }, {
46
+ symbol: string;
47
+ name: string;
48
+ baseURI: string;
49
+ }>;
50
+ /**
51
+ * Input schema for deploy token action.
52
+ */
53
+ export declare const DeployTokenSchema: z.ZodObject<{
54
+ name: z.ZodString;
55
+ symbol: z.ZodString;
56
+ totalSupply: z.ZodType<bigint, z.ZodTypeDef, bigint>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ symbol: string;
59
+ name: string;
60
+ totalSupply: bigint;
61
+ }, {
62
+ symbol: string;
63
+ name: string;
64
+ totalSupply: bigint;
65
+ }>;
66
+ /**
67
+ * Input schema for request faucet funds action.
68
+ */
69
+ export declare const RequestFaucetFundsSchema: z.ZodObject<{
70
+ assetId: z.ZodOptional<z.ZodString>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ assetId?: string | undefined;
73
+ }, {
74
+ assetId?: string | undefined;
75
+ }>;
76
+ /**
77
+ * Input schema for trade action.
78
+ */
79
+ export declare const TradeSchema: z.ZodObject<{
80
+ amount: z.ZodType<bigint, z.ZodTypeDef, bigint>;
81
+ fromAssetId: z.ZodString;
82
+ toAssetId: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ amount: bigint;
85
+ fromAssetId: string;
86
+ toAssetId: string;
87
+ }, {
88
+ amount: bigint;
89
+ fromAssetId: string;
90
+ toAssetId: string;
91
+ }>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradeSchema = exports.RequestFaucetFundsSchema = exports.DeployTokenSchema = exports.DeployNftSchema = exports.DeployContractSchema = exports.AddressReputationSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("./constants");
6
+ /**
7
+ * Input schema for address reputation check.
8
+ */
9
+ exports.AddressReputationSchema = zod_1.z
10
+ .object({
11
+ address: zod_1.z
12
+ .string()
13
+ .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
14
+ .describe("The Ethereum address to check"),
15
+ network: zod_1.z.string().describe("The network to check the address on"),
16
+ })
17
+ .strip()
18
+ .describe("Input schema for address reputation check");
19
+ /**
20
+ * Input schema for deploy contract action.
21
+ */
22
+ exports.DeployContractSchema = zod_1.z
23
+ .object({
24
+ solidityVersion: zod_1.z
25
+ .enum(Object.keys(constants_1.SolidityVersions))
26
+ .describe("The solidity compiler version"),
27
+ solidityInputJson: zod_1.z.string().describe("The input json for the solidity compiler"),
28
+ contractName: zod_1.z.string().describe("The name of the contract class to be deployed"),
29
+ constructorArgs: zod_1.z
30
+ .record(zod_1.z.string(), zod_1.z.any())
31
+ .describe("The constructor arguments for the contract")
32
+ .optional(),
33
+ })
34
+ .strip()
35
+ .describe("Instructions for deploying an arbitrary contract");
36
+ /**
37
+ * Input schema for deploy NFT action
38
+ */
39
+ exports.DeployNftSchema = zod_1.z
40
+ .object({
41
+ name: zod_1.z.string().describe("The name of the NFT collection"),
42
+ symbol: zod_1.z.string().describe("The symbol of the NFT collection"),
43
+ baseURI: zod_1.z.string().describe("The base URI for the token metadata"),
44
+ })
45
+ .strip()
46
+ .describe("Instructions for deploying an NFT collection");
47
+ /**
48
+ * Input schema for deploy token action.
49
+ */
50
+ exports.DeployTokenSchema = zod_1.z
51
+ .object({
52
+ name: zod_1.z.string().describe("The name of the token"),
53
+ symbol: zod_1.z.string().describe("The token symbol"),
54
+ totalSupply: zod_1.z.custom().describe("The total supply of tokens to mint"),
55
+ })
56
+ .strip()
57
+ .describe("Instructions for deploying a token");
58
+ /**
59
+ * Input schema for request faucet funds action.
60
+ */
61
+ exports.RequestFaucetFundsSchema = zod_1.z
62
+ .object({
63
+ assetId: zod_1.z.string().optional().describe("The optional asset ID to request from faucet"),
64
+ })
65
+ .strip()
66
+ .describe("Instructions for requesting faucet funds");
67
+ /**
68
+ * Input schema for trade action.
69
+ */
70
+ exports.TradeSchema = zod_1.z
71
+ .object({
72
+ amount: zod_1.z.custom().describe("The amount of the from asset to trade"),
73
+ fromAssetId: zod_1.z.string().describe("The from asset ID to trade"),
74
+ toAssetId: zod_1.z.string().describe("The to asset ID to receive from the trade"),
75
+ })
76
+ .strip()
77
+ .describe("Instructions for trading assets");
@@ -78,7 +78,7 @@ class ERC20ActionProvider extends actionProvider_1.ActionProvider {
78
78
  ((network.networkId === "base-mainnet" && constants_1.BaseTokenToAssetId.has(tokenAddress)) ||
79
79
  (network.networkId === "base-sepolia" && constants_1.BaseSepoliaTokenToAssetId.has(tokenAddress)));
80
80
  if (canDoGasless) {
81
- // Cast to CdpWalletProvider to access erc20Transfer
81
+ // Cast to LegacyCdpWalletProvider to access erc20Transfer
82
82
  const cdpWallet = walletProvider;
83
83
  const assetId = network.networkId === "base-mainnet"
84
84
  ? constants_1.BaseTokenToAssetId.get(tokenAddress)
@@ -4,8 +4,8 @@ export * from "./customActionProvider";
4
4
  export * from "./across";
5
5
  export * from "./alchemy";
6
6
  export * from "./basename";
7
+ export * from "./cdp-legacy";
7
8
  export * from "./cdp";
8
- export * from "./cdp-v2";
9
9
  export * from "./compound";
10
10
  export * from "./defillama";
11
11
  export * from "./erc20";
@@ -20,8 +20,8 @@ __exportStar(require("./customActionProvider"), exports);
20
20
  __exportStar(require("./across"), exports);
21
21
  __exportStar(require("./alchemy"), exports);
22
22
  __exportStar(require("./basename"), exports);
23
+ __exportStar(require("./cdp-legacy"), exports);
23
24
  __exportStar(require("./cdp"), exports);
24
- __exportStar(require("./cdp-v2"), exports);
25
25
  __exportStar(require("./compound"), exports);
26
26
  __exportStar(require("./defillama"), exports);
27
27
  __exportStar(require("./erc20"), exports);
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const web3_js_1 = require("@solana/web3.js");
4
4
  const jupiterActionProvider_1 = require("./jupiterActionProvider");
5
5
  const api_1 = require("@jup-ag/api");
6
- // Default SPL token decimals for tests
7
- const DECIMALS = 6;
8
6
  // Mock the @solana/web3.js module
9
7
  jest.mock("@solana/web3.js", () => ({
10
8
  // Preserve the actual implementation of @solana/web3.js while overriding specific methods
@@ -28,7 +26,7 @@ jest.mock("@solana/spl-token", () => ({
28
26
  // Preserve the actual implementation of @solana/spl-token while overriding specific methods
29
27
  ...jest.requireActual("@solana/spl-token"),
30
28
  // Mock getMint to always return a fixed decimal value for tokens
31
- getMint: jest.fn().mockReturnValue({ decimals: DECIMALS }),
29
+ getMint: jest.fn().mockReturnValue({ decimals: 6 }),
32
30
  }));
33
31
  // Mock the @jup-ag/api module
34
32
  jest.mock("@jup-ag/api", () => ({
@@ -107,7 +105,7 @@ describe("JupiterActionProvider", () => {
107
105
  expect(mockQuoteGet).toHaveBeenCalledWith({
108
106
  inputMint: INPUT_MINT,
109
107
  outputMint: OUTPUT_MINT,
110
- amount: swapArgs.amount * 10 ** DECIMALS, // Ensure correct decimal conversion
108
+ amount: swapArgs.amount * 10 ** 6, // Ensure correct decimal conversion
111
109
  slippageBps: swapArgs.slippageBps,
112
110
  });
113
111
  expect(mockSwapPost).toHaveBeenCalled();
@@ -6,6 +6,7 @@ import { Action, ActionProvider } from "./action-providers";
6
6
  export type AgentKitOptions = {
7
7
  cdpApiKeyId?: string;
8
8
  cdpApiKeySecret?: string;
9
+ cdpWalletSecret?: string;
9
10
  walletProvider?: WalletProvider;
10
11
  actionProviders?: ActionProvider[];
11
12
  };
package/dist/agentkit.js CHANGED
@@ -32,12 +32,13 @@ 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.cdpApiKeyId || !config.cdpApiKeySecret) {
35
+ if (!config.cdpApiKeyId || !config.cdpApiKeySecret || !config.cdpWalletSecret) {
36
36
  throw new Error("cdpApiKeyId and cdpApiKeySecret are required if not providing a walletProvider");
37
37
  }
38
- walletProvider = await wallet_providers_1.CdpWalletProvider.configureWithWallet({
38
+ walletProvider = await wallet_providers_1.CdpSmartWalletProvider.configureWithWallet({
39
39
  apiKeyId: config.cdpApiKeyId,
40
40
  apiKeySecret: config.cdpApiKeySecret,
41
+ walletSecret: config.cdpWalletSecret,
41
42
  });
42
43
  }
43
44
  return new AgentKit({ ...config, walletProvider: walletProvider });
@@ -2,26 +2,35 @@ import { CdpClient } from "@coinbase/cdp-sdk";
2
2
  import { Abi, Address, ContractFunctionArgs, ContractFunctionName, Hex, ReadContractParameters, ReadContractReturnType, TransactionRequest } from "viem";
3
3
  import { Network } from "../network";
4
4
  import { EvmWalletProvider } from "./evmWalletProvider";
5
- import { WalletProviderWithClient, CdpV2WalletProviderConfig } from "./cdpV2Shared";
5
+ import { WalletProviderWithClient, CdpWalletProviderConfig } from "./cdpShared";
6
6
  /**
7
7
  * A wallet provider that uses the Coinbase SDK.
8
8
  */
9
- export declare class CdpV2EvmWalletProvider extends EvmWalletProvider implements WalletProviderWithClient {
9
+ export declare class CdpEvmWalletProvider extends EvmWalletProvider implements WalletProviderWithClient {
10
10
  #private;
11
11
  /**
12
- * Constructs a new CdpWalletProvider.
12
+ * Constructs a new CdpServerWalletProvider.
13
13
  *
14
- * @param config - The configuration options for the CdpWalletProvider.
14
+ * @param config - The configuration options for the CdpServerWalletProvider.
15
15
  */
16
16
  private constructor();
17
17
  /**
18
- * Configures a new CdpWalletProvider with a wallet.
18
+ * Configures a new CdpServerWalletProvider with a wallet.
19
19
  *
20
20
  * @param config - Optional configuration parameters
21
- * @returns A Promise that resolves to a new CdpWalletProvider instance
21
+ * @returns A Promise that resolves to a new CdpServerWalletProvider instance
22
22
  * @throws Error if required environment variables are missing or wallet initialization fails
23
23
  */
24
- static configureWithWallet(config?: CdpV2WalletProviderConfig): Promise<CdpV2EvmWalletProvider>;
24
+ static configureWithWallet(config?: CdpWalletProviderConfig): Promise<CdpEvmWalletProvider>;
25
+ /**
26
+ * Exports the wallet.
27
+ *
28
+ * @returns The wallet's data.
29
+ */
30
+ exportWallet(): Promise<{
31
+ name: string | undefined;
32
+ address: `0x${string}`;
33
+ }>;
25
34
  /**
26
35
  * Signs a message.
27
36
  *