@coinbase/agentkit 0.9.1 → 0.10.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.
Files changed (36) hide show
  1. package/README.md +106 -54
  2. package/dist/action-providers/cdp/cdpApiActionProvider.js +2 -0
  3. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.d.ts +43 -0
  4. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +151 -0
  5. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.d.ts +1 -0
  6. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +242 -0
  7. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +42 -0
  8. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +132 -0
  9. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.d.ts +1 -0
  10. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +199 -0
  11. package/dist/action-providers/cdp/index.d.ts +3 -0
  12. package/dist/action-providers/cdp/index.js +3 -0
  13. package/dist/action-providers/cdp/schemas.d.ts +29 -0
  14. package/dist/action-providers/cdp/schemas.js +32 -1
  15. package/dist/action-providers/cdp/spendPermissionUtils.d.ts +24 -0
  16. package/dist/action-providers/cdp/spendPermissionUtils.js +66 -0
  17. package/dist/action-providers/index.d.ts +1 -0
  18. package/dist/action-providers/index.js +1 -0
  19. package/dist/action-providers/zerion/constants.d.ts +1 -0
  20. package/dist/action-providers/zerion/constants.js +4 -0
  21. package/dist/action-providers/zerion/index.d.ts +2 -0
  22. package/dist/action-providers/zerion/index.js +18 -0
  23. package/dist/action-providers/zerion/schemas.d.ts +11 -0
  24. package/dist/action-providers/zerion/schemas.js +15 -0
  25. package/dist/action-providers/zerion/types.d.ts +125 -0
  26. package/dist/action-providers/zerion/types.js +16 -0
  27. package/dist/action-providers/zerion/utils.d.ts +3 -0
  28. package/dist/action-providers/zerion/utils.js +45 -0
  29. package/dist/action-providers/zerion/zerionActionProvider.d.ts +57 -0
  30. package/dist/action-providers/zerion/zerionActionProvider.js +159 -0
  31. package/dist/action-providers/zerion/zerionActionProvider.test.d.ts +1 -0
  32. package/dist/action-providers/zerion/zerionActionProvider.test.js +213 -0
  33. package/dist/wallet-providers/cdpShared.d.ts +4 -0
  34. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +8 -1
  35. package/dist/wallet-providers/cdpSmartWalletProvider.js +23 -11
  36. package/package.json +2 -2
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _CdpSmartWalletProvider_instances, _CdpSmartWalletProvider_publicClient, _CdpSmartWalletProvider_smartAccount, _CdpSmartWalletProvider_ownerAccount, _CdpSmartWalletProvider_cdp, _CdpSmartWalletProvider_network, _CdpSmartWalletProvider_getCdpSdkNetwork;
13
+ var _CdpSmartWalletProvider_instances, _CdpSmartWalletProvider_publicClient, _CdpSmartWalletProvider_ownerAccount, _CdpSmartWalletProvider_cdp, _CdpSmartWalletProvider_network, _CdpSmartWalletProvider_paymasterUrl, _CdpSmartWalletProvider_getCdpSdkNetwork;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CdpSmartWalletProvider = void 0;
16
16
  const cdp_sdk_1 = require("@coinbase/cdp-sdk");
@@ -30,15 +30,16 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
30
30
  super();
31
31
  _CdpSmartWalletProvider_instances.add(this);
32
32
  _CdpSmartWalletProvider_publicClient.set(this, void 0);
33
- _CdpSmartWalletProvider_smartAccount.set(this, void 0);
34
33
  _CdpSmartWalletProvider_ownerAccount.set(this, void 0);
35
34
  _CdpSmartWalletProvider_cdp.set(this, void 0);
36
35
  _CdpSmartWalletProvider_network.set(this, void 0);
37
- __classPrivateFieldSet(this, _CdpSmartWalletProvider_smartAccount, config.smartAccount, "f");
36
+ _CdpSmartWalletProvider_paymasterUrl.set(this, void 0);
37
+ this.smartAccount = config.smartAccount;
38
38
  __classPrivateFieldSet(this, _CdpSmartWalletProvider_ownerAccount, config.ownerAccount, "f");
39
39
  __classPrivateFieldSet(this, _CdpSmartWalletProvider_cdp, config.cdp, "f");
40
40
  __classPrivateFieldSet(this, _CdpSmartWalletProvider_publicClient, config.publicClient, "f");
41
41
  __classPrivateFieldSet(this, _CdpSmartWalletProvider_network, config.network, "f");
42
+ __classPrivateFieldSet(this, _CdpSmartWalletProvider_paymasterUrl, config.paymasterUrl, "f");
42
43
  }
43
44
  /**
44
45
  * Configures a new CdpSmartWalletProvider with a smart wallet.
@@ -52,6 +53,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
52
53
  const apiKeySecret = config.apiKeySecret || process.env.CDP_API_KEY_SECRET;
53
54
  const walletSecret = config.walletSecret || process.env.CDP_WALLET_SECRET;
54
55
  const idempotencyKey = config.idempotencyKey || process.env.IDEMPOTENCY_KEY;
56
+ const paymasterUrl = config.paymasterUrl || process.env.PAYMASTER_URL;
55
57
  if (!apiKeyId || !apiKeySecret || !walletSecret) {
56
58
  throw new Error("Missing required environment variables. CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET are required.");
57
59
  }
@@ -100,6 +102,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
100
102
  smartAccount,
101
103
  ownerAccount,
102
104
  network,
105
+ paymasterUrl,
103
106
  });
104
107
  }
105
108
  /**
@@ -109,8 +112,8 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
109
112
  */
110
113
  async exportWallet() {
111
114
  return {
112
- name: __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f").name,
113
- address: __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f").address,
115
+ name: this.smartAccount.name,
116
+ address: this.smartAccount.address,
114
117
  ownerAddress: __classPrivateFieldGet(this, _CdpSmartWalletProvider_ownerAccount, "f").address,
115
118
  };
116
119
  }
@@ -132,7 +135,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
132
135
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
136
  async signTypedData(typedData) {
134
137
  const { domain, types, primaryType, message } = typedData;
135
- return await __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f").signTypedData({
138
+ return await this.smartAccount.signTypedData({
136
139
  domain,
137
140
  types,
138
141
  primaryType,
@@ -164,9 +167,10 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
164
167
  },
165
168
  ];
166
169
  const userOperation = await __classPrivateFieldGet(this, _CdpSmartWalletProvider_cdp, "f").evm.sendUserOperation({
167
- smartAccount: __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f"),
170
+ smartAccount: this.smartAccount,
168
171
  network: __classPrivateFieldGet(this, _CdpSmartWalletProvider_instances, "m", _CdpSmartWalletProvider_getCdpSdkNetwork).call(this),
169
172
  calls,
173
+ paymasterUrl: __classPrivateFieldGet(this, _CdpSmartWalletProvider_paymasterUrl, "f"),
170
174
  });
171
175
  return userOperation.userOpHash;
172
176
  }
@@ -176,7 +180,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
176
180
  * @returns The address of the smart wallet.
177
181
  */
178
182
  getAddress() {
179
- return __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f").address;
183
+ return this.smartAccount.address;
180
184
  }
181
185
  /**
182
186
  * Gets the network of the wallet.
@@ -202,13 +206,21 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
202
206
  getClient() {
203
207
  return __classPrivateFieldGet(this, _CdpSmartWalletProvider_cdp, "f");
204
208
  }
209
+ /**
210
+ * Gets the paymaster URL for gasless transactions.
211
+ *
212
+ * @returns The paymaster URL if configured, undefined otherwise.
213
+ */
214
+ getPaymasterUrl() {
215
+ return __classPrivateFieldGet(this, _CdpSmartWalletProvider_paymasterUrl, "f");
216
+ }
205
217
  /**
206
218
  * Gets the balance of the smart wallet.
207
219
  *
208
220
  * @returns The balance of the wallet in wei
209
221
  */
210
222
  async getBalance() {
211
- return await __classPrivateFieldGet(this, _CdpSmartWalletProvider_publicClient, "f").getBalance({ address: __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f").address });
223
+ return await __classPrivateFieldGet(this, _CdpSmartWalletProvider_publicClient, "f").getBalance({ address: this.smartAccount.address });
212
224
  }
213
225
  /**
214
226
  * Waits for a user operation receipt.
@@ -222,7 +234,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
222
234
  // This is a simplified implementation - in practice you might want to poll
223
235
  // the CDP API for user operation status
224
236
  return __classPrivateFieldGet(this, _CdpSmartWalletProvider_cdp, "f").evm.waitForUserOperation({
225
- smartAccountAddress: __classPrivateFieldGet(this, _CdpSmartWalletProvider_smartAccount, "f").address,
237
+ smartAccountAddress: this.smartAccount.address,
226
238
  userOpHash,
227
239
  });
228
240
  }
@@ -251,7 +263,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
251
263
  }
252
264
  }
253
265
  exports.CdpSmartWalletProvider = CdpSmartWalletProvider;
254
- _CdpSmartWalletProvider_publicClient = new WeakMap(), _CdpSmartWalletProvider_smartAccount = new WeakMap(), _CdpSmartWalletProvider_ownerAccount = new WeakMap(), _CdpSmartWalletProvider_cdp = new WeakMap(), _CdpSmartWalletProvider_network = new WeakMap(), _CdpSmartWalletProvider_instances = new WeakSet(), _CdpSmartWalletProvider_getCdpSdkNetwork = function _CdpSmartWalletProvider_getCdpSdkNetwork() {
266
+ _CdpSmartWalletProvider_publicClient = new WeakMap(), _CdpSmartWalletProvider_ownerAccount = new WeakMap(), _CdpSmartWalletProvider_cdp = new WeakMap(), _CdpSmartWalletProvider_network = new WeakMap(), _CdpSmartWalletProvider_paymasterUrl = new WeakMap(), _CdpSmartWalletProvider_instances = new WeakSet(), _CdpSmartWalletProvider_getCdpSdkNetwork = function _CdpSmartWalletProvider_getCdpSdkNetwork() {
255
267
  switch (__classPrivateFieldGet(this, _CdpSmartWalletProvider_network, "f").networkId) {
256
268
  case "base-sepolia":
257
269
  return "base-sepolia";
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.9.1",
5
+ "version": "0.10.0",
6
6
  "author": "Coinbase Inc.",
7
7
  "license": "Apache-2.0",
8
8
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@across-protocol/app-sdk": "^0.2.0",
26
26
  "@alloralabs/allora-sdk": "^0.1.0",
27
- "@coinbase/cdp-sdk": "^1.26.0",
27
+ "@coinbase/cdp-sdk": "^1.34.0",
28
28
  "@coinbase/coinbase-sdk": "^0.20.0",
29
29
  "@jup-ag/api": "^6.0.39",
30
30
  "@privy-io/public-api": "2.18.5",