@coinbase/agentkit 0.0.0-nightly-20250905210407 → 0.0.0-nightly-20250906210355
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 +25 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +0 -1
- package/dist/action-providers/cdp/cdpApiActionProvider.js +0 -16
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.d.ts +1 -2
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +4 -25
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +8 -0
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +0 -1
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +3 -20
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +11 -1
- package/dist/action-providers/clanker/clankerActionProvider.d.ts +43 -0
- package/dist/action-providers/clanker/clankerActionProvider.js +130 -0
- package/dist/action-providers/clanker/clankerActionProvider.test.d.ts +4 -0
- package/dist/action-providers/clanker/clankerActionProvider.test.js +119 -0
- package/dist/action-providers/clanker/index.d.ts +2 -0
- package/dist/action-providers/clanker/index.js +18 -0
- package/dist/action-providers/clanker/schemas.d.ts +56 -0
- package/dist/action-providers/clanker/schemas.js +47 -0
- package/dist/action-providers/clanker/utils.d.ts +9 -0
- package/dist/action-providers/clanker/utils.js +23 -0
- package/dist/action-providers/index.d.ts +1 -0
- package/dist/action-providers/index.js +1 -0
- package/dist/action-providers/pyth/pythActionProvider.js +5 -0
- package/dist/action-providers/pyth/pythActionProvider.test.js +5 -1
- package/dist/wallet-providers/cdpEvmWalletProvider.d.ts +12 -0
- package/dist/wallet-providers/cdpEvmWalletProvider.js +29 -23
- package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +12 -0
- package/dist/wallet-providers/cdpSmartWalletProvider.js +30 -24
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -182,6 +182,14 @@ const agent = createReactAgent({
|
|
|
182
182
|
<td width="200"><code>use_spend_permission</code></td>
|
|
183
183
|
<td width="768">Uses a spend permission to spend tokens on behalf of a smart account that the current EVM wallet has permission to spend.</td>
|
|
184
184
|
</tr>
|
|
185
|
+
<tr>
|
|
186
|
+
<td width="200"><code>get_swap_price</code></td>
|
|
187
|
+
<td width="768">Fetches a price quote for swapping between two tokens using the CDP Swap API (does not execute swap).</td>
|
|
188
|
+
</tr>
|
|
189
|
+
<tr>
|
|
190
|
+
<td width="200"><code>swap</code></td>
|
|
191
|
+
<td width="768">Executes a token swap using the CDP Swap API with automatic token approvals.</td>
|
|
192
|
+
</tr>
|
|
185
193
|
</table>
|
|
186
194
|
</details>
|
|
187
195
|
<details>
|
|
@@ -195,6 +203,14 @@ const agent = createReactAgent({
|
|
|
195
203
|
<td width="200"><code>use_spend_permission</code></td>
|
|
196
204
|
<td width="768">Uses a spend permission to spend tokens on behalf of a smart account that the current smart wallet has permission to spend.</td>
|
|
197
205
|
</tr>
|
|
206
|
+
<tr>
|
|
207
|
+
<td width="200"><code>get_swap_price</code></td>
|
|
208
|
+
<td width="768">Fetches a price quote for swapping between two tokens using the CDP Swap API (does not execute swap).</td>
|
|
209
|
+
</tr>
|
|
210
|
+
<tr>
|
|
211
|
+
<td width="200"><code>swap</code></td>
|
|
212
|
+
<td width="768">Executes a token swap using the CDP Swap API with automatic token approvals.</td>
|
|
213
|
+
</tr>
|
|
198
214
|
</table>
|
|
199
215
|
</details>
|
|
200
216
|
<details>
|
|
@@ -220,6 +236,15 @@ const agent = createReactAgent({
|
|
|
220
236
|
</table>
|
|
221
237
|
</details>
|
|
222
238
|
<details>
|
|
239
|
+
<summary><strong>Clanker</strong></summary>
|
|
240
|
+
<table width="100%">
|
|
241
|
+
<tr>
|
|
242
|
+
<td width="200"><code>clank_token</code></td>
|
|
243
|
+
<td width="768">Deploys an ERC20 Clanker token based on the supplied config.</td>
|
|
244
|
+
</tr>
|
|
245
|
+
</table>
|
|
246
|
+
</details>
|
|
247
|
+
<details>
|
|
223
248
|
<summary><strong>Compound</strong></summary>
|
|
224
249
|
<table width="100%">
|
|
225
250
|
<tr>
|
|
@@ -9,7 +9,6 @@ import { RequestFaucetFundsV2Schema } from "./schemas";
|
|
|
9
9
|
* This provider is used for any action that uses the CDP API, but does not require a CDP Wallet.
|
|
10
10
|
*/
|
|
11
11
|
export declare class CdpApiActionProvider extends ActionProvider<WalletProvider> {
|
|
12
|
-
#private;
|
|
13
12
|
/**
|
|
14
13
|
* Constructor for the CdpApiActionProvider class.
|
|
15
14
|
*/
|
|
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
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
|
-
var _CdpApiActionProvider_instances, _CdpApiActionProvider_getCdpSdkNetwork;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.cdpApiActionProvider = exports.CdpApiActionProvider = void 0;
|
|
14
13
|
const zod_1 = require("zod");
|
|
@@ -28,7 +27,6 @@ class CdpApiActionProvider extends actionProvider_1.ActionProvider {
|
|
|
28
27
|
*/
|
|
29
28
|
constructor() {
|
|
30
29
|
super("cdp_api", []);
|
|
31
|
-
_CdpApiActionProvider_instances.add(this);
|
|
32
30
|
/**
|
|
33
31
|
* Checks if the CDP action provider supports the given network.
|
|
34
32
|
*
|
|
@@ -81,20 +79,6 @@ class CdpApiActionProvider extends actionProvider_1.ActionProvider {
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
exports.CdpApiActionProvider = CdpApiActionProvider;
|
|
84
|
-
_CdpApiActionProvider_instances = new WeakSet(), _CdpApiActionProvider_getCdpSdkNetwork = function _CdpApiActionProvider_getCdpSdkNetwork(networkId) {
|
|
85
|
-
switch (networkId) {
|
|
86
|
-
case "base-sepolia":
|
|
87
|
-
return "base-sepolia";
|
|
88
|
-
case "base-mainnet":
|
|
89
|
-
return "base";
|
|
90
|
-
case "ethereum-sepolia":
|
|
91
|
-
return "ethereum-sepolia";
|
|
92
|
-
case "ethereum-mainnet":
|
|
93
|
-
return "ethereum";
|
|
94
|
-
default:
|
|
95
|
-
return networkId; // For other networks, use as-is
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
82
|
__decorate([
|
|
99
83
|
(0, actionDecorator_1.CreateAction)({
|
|
100
84
|
name: "request_faucet_funds",
|
|
@@ -11,7 +11,6 @@ import type { Network } from "../../network";
|
|
|
11
11
|
* that are optimized for EVM functionality, including spend permission usage.
|
|
12
12
|
*/
|
|
13
13
|
export declare class CdpEvmWalletActionProvider extends ActionProvider<CdpEvmWalletProvider> {
|
|
14
|
-
#private;
|
|
15
14
|
/**
|
|
16
15
|
* Constructor for the CdpEvmWalletActionProvider class.
|
|
17
16
|
*/
|
|
@@ -31,7 +30,7 @@ export declare class CdpEvmWalletActionProvider extends ActionProvider<CdpEvmWal
|
|
|
31
30
|
* @param args - The input arguments for using the spend permission.
|
|
32
31
|
* @returns A confirmation message with transaction details.
|
|
33
32
|
*/
|
|
34
|
-
useSpendPermission(walletProvider:
|
|
33
|
+
useSpendPermission(walletProvider: CdpEvmWalletProvider, args: z.infer<typeof UseSpendPermissionSchema>): Promise<string>;
|
|
35
34
|
/**
|
|
36
35
|
* Gets a price quote for swapping tokens using the CDP Swap API.
|
|
37
36
|
*
|
|
@@ -8,12 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
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
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
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");
|
|
14
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
-
};
|
|
16
|
-
var _CdpEvmWalletActionProvider_instances, _CdpEvmWalletActionProvider_getCdpSdkNetwork;
|
|
17
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
12
|
exports.cdpEvmWalletActionProvider = exports.CdpEvmWalletActionProvider = void 0;
|
|
19
13
|
const zod_1 = require("zod");
|
|
@@ -38,7 +32,6 @@ class CdpEvmWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
38
32
|
*/
|
|
39
33
|
constructor() {
|
|
40
34
|
super("cdp_evm_wallet", []);
|
|
41
|
-
_CdpEvmWalletActionProvider_instances.add(this);
|
|
42
35
|
/**
|
|
43
36
|
* Checks if the EVM wallet action provider supports the given network.
|
|
44
37
|
*
|
|
@@ -80,7 +73,7 @@ class CdpEvmWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
80
73
|
*/
|
|
81
74
|
async useSpendPermission(walletProvider, args) {
|
|
82
75
|
const network = walletProvider.getNetwork();
|
|
83
|
-
const cdpNetwork =
|
|
76
|
+
const cdpNetwork = walletProvider.getCdpSdkNetwork();
|
|
84
77
|
if ((0, cdpShared_1.isWalletProviderWithClient)(walletProvider)) {
|
|
85
78
|
if (network.protocolFamily === "evm") {
|
|
86
79
|
try {
|
|
@@ -119,7 +112,7 @@ class CdpEvmWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
119
112
|
// Get CDP SDK network
|
|
120
113
|
const network = walletProvider.getNetwork();
|
|
121
114
|
const networkId = network.networkId;
|
|
122
|
-
const cdpNetwork =
|
|
115
|
+
const cdpNetwork = walletProvider.getCdpSdkNetwork();
|
|
123
116
|
// Check if the network is supported
|
|
124
117
|
if (networkId !== "base-mainnet" && networkId !== "ethereum-mainnet")
|
|
125
118
|
return JSON.stringify({
|
|
@@ -174,7 +167,7 @@ class CdpEvmWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
174
167
|
// Get CDP SDK network
|
|
175
168
|
const network = walletProvider.getNetwork();
|
|
176
169
|
const networkId = network.networkId;
|
|
177
|
-
const cdpNetwork =
|
|
170
|
+
const cdpNetwork = walletProvider.getCdpSdkNetwork();
|
|
178
171
|
// Check if the network is supported
|
|
179
172
|
if (networkId !== "base-mainnet" && networkId !== "ethereum-mainnet")
|
|
180
173
|
return JSON.stringify({
|
|
@@ -285,20 +278,6 @@ class CdpEvmWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
285
278
|
}
|
|
286
279
|
}
|
|
287
280
|
exports.CdpEvmWalletActionProvider = CdpEvmWalletActionProvider;
|
|
288
|
-
_CdpEvmWalletActionProvider_instances = new WeakSet(), _CdpEvmWalletActionProvider_getCdpSdkNetwork = function _CdpEvmWalletActionProvider_getCdpSdkNetwork(networkId) {
|
|
289
|
-
switch (networkId) {
|
|
290
|
-
case "base-sepolia":
|
|
291
|
-
return "base-sepolia";
|
|
292
|
-
case "base-mainnet":
|
|
293
|
-
return "base";
|
|
294
|
-
case "ethereum-sepolia":
|
|
295
|
-
return "ethereum-sepolia";
|
|
296
|
-
case "ethereum-mainnet":
|
|
297
|
-
return "ethereum";
|
|
298
|
-
default:
|
|
299
|
-
return networkId; // For other networks, use as-is
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
281
|
__decorate([
|
|
303
282
|
(0, actionDecorator_1.CreateAction)({
|
|
304
283
|
name: "list_spend_permissions",
|
|
@@ -322,7 +301,7 @@ This action is specifically designed for EVM wallets and uses the EVM wallet for
|
|
|
322
301
|
schema: schemas_1.UseSpendPermissionSchema,
|
|
323
302
|
}),
|
|
324
303
|
__metadata("design:type", Function),
|
|
325
|
-
__metadata("design:paramtypes", [
|
|
304
|
+
__metadata("design:paramtypes", [cdpEvmWalletProvider_1.CdpEvmWalletProvider, void 0]),
|
|
326
305
|
__metadata("design:returntype", Promise)
|
|
327
306
|
], CdpEvmWalletActionProvider.prototype, "useSpendPermission", null);
|
|
328
307
|
__decorate([
|
|
@@ -68,6 +68,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
68
68
|
getClient: jest.fn(),
|
|
69
69
|
sendTransaction: jest.fn(),
|
|
70
70
|
waitForTransactionReceipt: jest.fn(),
|
|
71
|
+
getCdpSdkNetwork: jest.fn(),
|
|
71
72
|
};
|
|
72
73
|
// Default setup for utility functions
|
|
73
74
|
mockRetryWithExponentialBackoff.mockImplementation(async (fn) => {
|
|
@@ -86,6 +87,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
86
87
|
});
|
|
87
88
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
88
89
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
90
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base-sepolia");
|
|
89
91
|
});
|
|
90
92
|
it("should successfully list spend permissions for EVM wallets", async () => {
|
|
91
93
|
const expectedResult = "Found 2 spend permission(s):\n1. Token: USDC, Allowance: 500, Period: 1800 seconds, Start: 111111, End: 222222\n2. Token: ETH, Allowance: 1000, Period: 3600 seconds, Start: 123456, End: 234567";
|
|
@@ -127,6 +129,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
127
129
|
});
|
|
128
130
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
129
131
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
132
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base-sepolia");
|
|
130
133
|
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
131
134
|
});
|
|
132
135
|
it("should successfully use spend permission for EVM wallets", async () => {
|
|
@@ -174,6 +177,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
174
177
|
networkId: testCase.networkId,
|
|
175
178
|
});
|
|
176
179
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
180
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue(testCase.expected);
|
|
177
181
|
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
178
182
|
await actionProvider.useSpendPermission(mockWalletProvider, mockArgs);
|
|
179
183
|
expect(mockAccount.useSpendPermission).toHaveBeenCalledWith({
|
|
@@ -188,6 +192,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
188
192
|
protocolFamily: "evm",
|
|
189
193
|
networkId: "polygon-mainnet",
|
|
190
194
|
});
|
|
195
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("polygon-mainnet");
|
|
191
196
|
const mockPermission = { spender: "0x1234", token: "MATIC" };
|
|
192
197
|
const mockSpendResult = { status: "completed" };
|
|
193
198
|
spendPermissionUtils.findLatestSpendPermission.mockResolvedValue(mockPermission);
|
|
@@ -251,6 +256,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
251
256
|
beforeEach(() => {
|
|
252
257
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
253
258
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
259
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base");
|
|
254
260
|
mockGetTokenDetails.mockResolvedValue({
|
|
255
261
|
fromTokenDecimals: 18,
|
|
256
262
|
toTokenDecimals: 6,
|
|
@@ -288,6 +294,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
288
294
|
protocolFamily: "evm",
|
|
289
295
|
networkId: "ethereum-mainnet",
|
|
290
296
|
});
|
|
297
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("ethereum");
|
|
291
298
|
mockCdpClient.evm.getSwapPrice.mockResolvedValue({
|
|
292
299
|
toAmount: "990000",
|
|
293
300
|
minToAmount: "980000",
|
|
@@ -337,6 +344,7 @@ describe("CDP EVM Wallet Action Provider", () => {
|
|
|
337
344
|
beforeEach(() => {
|
|
338
345
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
339
346
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
347
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base");
|
|
340
348
|
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
341
349
|
mockWalletProvider.waitForTransactionReceipt.mockResolvedValue({ status: "success" });
|
|
342
350
|
mockGetTokenDetails.mockResolvedValue({
|
|
@@ -10,7 +10,6 @@ import type { Network } from "../../network";
|
|
|
10
10
|
* that are optimized for smart wallet functionality.
|
|
11
11
|
*/
|
|
12
12
|
export declare class CdpSmartWalletActionProvider extends ActionProvider<CdpSmartWalletProvider> {
|
|
13
|
-
#private;
|
|
14
13
|
/**
|
|
15
14
|
* Constructor for the CdpSmartWalletActionProvider class.
|
|
16
15
|
*/
|
|
@@ -8,12 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
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
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
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");
|
|
14
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
-
};
|
|
16
|
-
var _CdpSmartWalletActionProvider_instances, _CdpSmartWalletActionProvider_getCdpSdkNetwork;
|
|
17
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
12
|
exports.cdpSmartWalletActionProvider = exports.CdpSmartWalletActionProvider = void 0;
|
|
19
13
|
const zod_1 = require("zod");
|
|
@@ -36,7 +30,6 @@ class CdpSmartWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
36
30
|
*/
|
|
37
31
|
constructor() {
|
|
38
32
|
super("cdp_smart_wallet", []);
|
|
39
|
-
_CdpSmartWalletActionProvider_instances.add(this);
|
|
40
33
|
/**
|
|
41
34
|
* Checks if the smart wallet action provider supports the given network.
|
|
42
35
|
*
|
|
@@ -73,7 +66,7 @@ class CdpSmartWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
73
66
|
*/
|
|
74
67
|
async useSpendPermission(walletProvider, args) {
|
|
75
68
|
const network = walletProvider.getNetwork();
|
|
76
|
-
const cdpNetwork =
|
|
69
|
+
const cdpNetwork = walletProvider.getCdpSdkNetwork();
|
|
77
70
|
if (network.protocolFamily === "evm") {
|
|
78
71
|
try {
|
|
79
72
|
const permission = await (0, spendPermissionUtils_1.findLatestSpendPermission)(walletProvider.getClient(), args.smartAccountAddress, walletProvider.getAddress());
|
|
@@ -109,8 +102,8 @@ class CdpSmartWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
109
102
|
error: "CDP Swap API for smart wallets is currently only supported on Base networks.",
|
|
110
103
|
});
|
|
111
104
|
}
|
|
112
|
-
const cdpNetwork = __classPrivateFieldGet(this, _CdpSmartWalletActionProvider_instances, "m", _CdpSmartWalletActionProvider_getCdpSdkNetwork).call(this, networkId);
|
|
113
105
|
try {
|
|
106
|
+
const cdpNetwork = walletProvider.getCdpSdkNetwork();
|
|
114
107
|
// Get token details
|
|
115
108
|
const { fromTokenDecimals, toTokenDecimals, fromTokenName, toTokenName } = await (0, swapUtils_1.getTokenDetails)(walletProvider, args.fromToken, args.toToken);
|
|
116
109
|
// Get swap price quote
|
|
@@ -164,12 +157,12 @@ class CdpSmartWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
164
157
|
error: "CDP Swap API for smart wallets is currently only supported on Base networks.",
|
|
165
158
|
});
|
|
166
159
|
}
|
|
167
|
-
const cdpNetwork = __classPrivateFieldGet(this, _CdpSmartWalletActionProvider_instances, "m", _CdpSmartWalletActionProvider_getCdpSdkNetwork).call(this, networkId);
|
|
168
160
|
// Check if the owner account is a CDP server account
|
|
169
161
|
if (walletProvider.ownerAccount.type === "local") {
|
|
170
162
|
throw new Error("Smart wallet owner account is not a CDP server account.");
|
|
171
163
|
}
|
|
172
164
|
try {
|
|
165
|
+
const cdpNetwork = walletProvider.getCdpSdkNetwork();
|
|
173
166
|
// Get token details
|
|
174
167
|
const { fromTokenDecimals, fromTokenName, toTokenName, toTokenDecimals } = await (0, swapUtils_1.getTokenDetails)(walletProvider, args.fromToken, args.toToken);
|
|
175
168
|
// Estimate swap price first to check liquidity, token balance and permit2 approval status
|
|
@@ -271,16 +264,6 @@ class CdpSmartWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
271
264
|
}
|
|
272
265
|
}
|
|
273
266
|
exports.CdpSmartWalletActionProvider = CdpSmartWalletActionProvider;
|
|
274
|
-
_CdpSmartWalletActionProvider_instances = new WeakSet(), _CdpSmartWalletActionProvider_getCdpSdkNetwork = function _CdpSmartWalletActionProvider_getCdpSdkNetwork(networkId) {
|
|
275
|
-
switch (networkId) {
|
|
276
|
-
case "base-sepolia":
|
|
277
|
-
return "base-sepolia";
|
|
278
|
-
case "base-mainnet":
|
|
279
|
-
return "base";
|
|
280
|
-
default:
|
|
281
|
-
throw new Error(`Unsupported network for smart wallets: ${networkId}`);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
267
|
__decorate([
|
|
285
268
|
(0, actionDecorator_1.CreateAction)({
|
|
286
269
|
name: "list_spend_permissions",
|
|
@@ -73,6 +73,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
73
73
|
sendTransaction: jest.fn(),
|
|
74
74
|
waitForTransactionReceipt: jest.fn(),
|
|
75
75
|
getPaymasterUrl: jest.fn(),
|
|
76
|
+
getCdpSdkNetwork: jest.fn(),
|
|
76
77
|
};
|
|
77
78
|
// Default setup for utility functions
|
|
78
79
|
mockRetryWithExponentialBackoff.mockImplementation(async (fn) => {
|
|
@@ -91,6 +92,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
91
92
|
});
|
|
92
93
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
93
94
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
95
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base-sepolia");
|
|
94
96
|
});
|
|
95
97
|
it("should successfully list spend permissions for EVM networks", async () => {
|
|
96
98
|
const expectedResult = "Found 1 spend permission(s):\n1. Token: ETH, Allowance: 1000, Period: 3600 seconds, Start: 123456, End: 234567";
|
|
@@ -127,6 +129,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
127
129
|
});
|
|
128
130
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
129
131
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
132
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base-sepolia");
|
|
130
133
|
});
|
|
131
134
|
it("should successfully use spend permission for EVM networks", async () => {
|
|
132
135
|
const mockPermission = {
|
|
@@ -157,6 +160,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
157
160
|
protocolFamily: "evm",
|
|
158
161
|
networkId: "base-mainnet",
|
|
159
162
|
});
|
|
163
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base");
|
|
160
164
|
const mockPermission = { spender: "0x1234", token: "ETH" };
|
|
161
165
|
const mockSpendResult = { status: "completed" };
|
|
162
166
|
spendPermissionUtils.findLatestSpendPermission.mockResolvedValue(mockPermission);
|
|
@@ -173,6 +177,9 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
173
177
|
protocolFamily: "evm",
|
|
174
178
|
networkId: "ethereum-mainnet",
|
|
175
179
|
});
|
|
180
|
+
mockWalletProvider.getCdpSdkNetwork.mockImplementation(() => {
|
|
181
|
+
throw new Error("Unsupported network for smart wallets: ethereum-mainnet");
|
|
182
|
+
});
|
|
176
183
|
await expect(actionProvider.useSpendPermission(mockWalletProvider, mockArgs)).rejects.toThrow("Unsupported network for smart wallets: ethereum-mainnet");
|
|
177
184
|
});
|
|
178
185
|
it("should return error message for non-EVM networks", async () => {
|
|
@@ -180,7 +187,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
180
187
|
protocolFamily: "svm",
|
|
181
188
|
networkId: "solana-devnet",
|
|
182
189
|
});
|
|
183
|
-
await expect(actionProvider.useSpendPermission(mockWalletProvider, mockArgs)).rejects.toThrow("
|
|
190
|
+
await expect(actionProvider.useSpendPermission(mockWalletProvider, mockArgs)).rejects.toThrow("Spend permissions are currently only supported on EVM networks.");
|
|
184
191
|
});
|
|
185
192
|
it("should handle spend permission not found error", async () => {
|
|
186
193
|
spendPermissionUtils.findLatestSpendPermission.mockRejectedValue(new Error("No spend permissions found"));
|
|
@@ -215,6 +222,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
215
222
|
beforeEach(() => {
|
|
216
223
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
217
224
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
225
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base");
|
|
218
226
|
mockGetTokenDetails.mockResolvedValue({
|
|
219
227
|
fromTokenDecimals: 18,
|
|
220
228
|
toTokenDecimals: 6,
|
|
@@ -252,6 +260,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
252
260
|
protocolFamily: "evm",
|
|
253
261
|
networkId: "base-sepolia",
|
|
254
262
|
});
|
|
263
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base-sepolia");
|
|
255
264
|
mockCdpClient.evm.getSwapPrice.mockResolvedValue({
|
|
256
265
|
toAmount: "990000",
|
|
257
266
|
minToAmount: "980000",
|
|
@@ -301,6 +310,7 @@ describe("CDP Smart Wallet Action Provider", () => {
|
|
|
301
310
|
beforeEach(() => {
|
|
302
311
|
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
303
312
|
mockWalletProvider.getAddress.mockReturnValue("0x1234567890123456789012345678901234567890");
|
|
313
|
+
mockWalletProvider.getCdpSdkNetwork.mockReturnValue("base");
|
|
304
314
|
mockWalletProvider.waitForTransactionReceipt.mockResolvedValue({ status: "complete" });
|
|
305
315
|
mockWalletProvider.getPaymasterUrl.mockReturnValue("https://paymaster.example");
|
|
306
316
|
mockGetTokenDetails.mockResolvedValue({
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionProvider } from "../actionProvider";
|
|
3
|
+
import { Network } from "../../network";
|
|
4
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
5
|
+
import { ClankTokenSchema } from "./schemas";
|
|
6
|
+
/**
|
|
7
|
+
* ClankerActionProvider provides actions for clanker operations.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* This provider is designed to work with EvmWalletProvider for blockchain interactions.
|
|
11
|
+
* It supports all evm networks.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ClankerActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor for the ClankerActionProvider.
|
|
16
|
+
*/
|
|
17
|
+
constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Clanker action provider
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* This action deploys a clanker token using the Clanker sdk
|
|
23
|
+
* It automatically includes the coin in the Clanker ecosystem
|
|
24
|
+
*
|
|
25
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
26
|
+
* @param args - Clanker arguments (modify these to fine tune token deployment, like initial quote token and rewards config)
|
|
27
|
+
* @returns A promise that resolves to a string describing the clanker result
|
|
28
|
+
*/
|
|
29
|
+
clankToken(walletProvider: EvmWalletProvider, args: z.infer<typeof ClankTokenSchema>): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if this provider supports the given network.
|
|
32
|
+
*
|
|
33
|
+
* @param network - The network to check support for
|
|
34
|
+
* @returns True if the network is supported
|
|
35
|
+
*/
|
|
36
|
+
supportsNetwork(network: Network): boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Factory function to create a new ClankerActionProvider instance.
|
|
40
|
+
*
|
|
41
|
+
* @returns A new ClankerActionProvider instance
|
|
42
|
+
*/
|
|
43
|
+
export declare const clankerActionProvider: () => ClankerActionProvider;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.clankerActionProvider = exports.ClankerActionProvider = void 0;
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const actionProvider_1 = require("../actionProvider");
|
|
15
|
+
const actionDecorator_1 = require("../actionDecorator");
|
|
16
|
+
const wallet_providers_1 = require("../../wallet-providers");
|
|
17
|
+
const schemas_1 = require("./schemas");
|
|
18
|
+
const utils_1 = require("./utils");
|
|
19
|
+
/**
|
|
20
|
+
* ClankerActionProvider provides actions for clanker operations.
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* This provider is designed to work with EvmWalletProvider for blockchain interactions.
|
|
24
|
+
* It supports all evm networks.
|
|
25
|
+
*/
|
|
26
|
+
class ClankerActionProvider extends actionProvider_1.ActionProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Constructor for the ClankerActionProvider.
|
|
29
|
+
*/
|
|
30
|
+
constructor() {
|
|
31
|
+
super("clanker", []);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Clanker action provider
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* This action deploys a clanker token using the Clanker sdk
|
|
38
|
+
* It automatically includes the coin in the Clanker ecosystem
|
|
39
|
+
*
|
|
40
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
41
|
+
* @param args - Clanker arguments (modify these to fine tune token deployment, like initial quote token and rewards config)
|
|
42
|
+
* @returns A promise that resolves to a string describing the clanker result
|
|
43
|
+
*/
|
|
44
|
+
async clankToken(walletProvider, args) {
|
|
45
|
+
const network = walletProvider.getNetwork();
|
|
46
|
+
const networkId = network.networkId || "base-mainnet";
|
|
47
|
+
if (!this.supportsNetwork(network)) {
|
|
48
|
+
return `Can't Clank token; network ${networkId} is not supported`;
|
|
49
|
+
}
|
|
50
|
+
const clanker = await (0, utils_1.createClankerClient)(walletProvider, networkId);
|
|
51
|
+
const lockDuration = args.lockDuration_Days * 24 * 60 * 60;
|
|
52
|
+
const vestingDuration = args.vestingDuration_Days * 24 * 60 * 60;
|
|
53
|
+
const tokenConfig = {
|
|
54
|
+
name: args.tokenName,
|
|
55
|
+
symbol: args.tokenSymbol,
|
|
56
|
+
image: args.image,
|
|
57
|
+
metadata: {
|
|
58
|
+
socialMediaUrls: args.socialMediaUrls,
|
|
59
|
+
description: args.description,
|
|
60
|
+
},
|
|
61
|
+
context: {
|
|
62
|
+
interface: args.interface,
|
|
63
|
+
id: args.id,
|
|
64
|
+
},
|
|
65
|
+
tokenAdmin: walletProvider.getAddress(),
|
|
66
|
+
vault: {
|
|
67
|
+
percentage: args.vaultPercentage,
|
|
68
|
+
lockupDuration: lockDuration,
|
|
69
|
+
vestingDuration: vestingDuration,
|
|
70
|
+
},
|
|
71
|
+
chainId: Number(network.chainId),
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
const res = await clanker.deploy(tokenConfig);
|
|
75
|
+
if ("error" in res) {
|
|
76
|
+
return `There was an error deploying the clanker token: ${res}`;
|
|
77
|
+
}
|
|
78
|
+
const { txHash } = res;
|
|
79
|
+
const confirmed = await res.waitForTransaction();
|
|
80
|
+
if ("error" in confirmed) {
|
|
81
|
+
return `There was an error confirming the clanker token deployment: ${confirmed}`;
|
|
82
|
+
}
|
|
83
|
+
const { address } = confirmed;
|
|
84
|
+
return `Clanker token deployed at ${address}! View the transaction at ${txHash}, or view the token page at https://clanker.world/clanker/${address}`;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return `There was an error deploying the clanker token: ${error}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if this provider supports the given network.
|
|
92
|
+
*
|
|
93
|
+
* @param network - The network to check support for
|
|
94
|
+
* @returns True if the network is supported
|
|
95
|
+
*/
|
|
96
|
+
supportsNetwork(network) {
|
|
97
|
+
return (network.networkId === "base-mainnet" ||
|
|
98
|
+
network.networkId === "base-sepolia" ||
|
|
99
|
+
network.networkId === "arbitrum-mainnet");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.ClankerActionProvider = ClankerActionProvider;
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, actionDecorator_1.CreateAction)({
|
|
105
|
+
name: "clank_token",
|
|
106
|
+
description: `
|
|
107
|
+
his tool will launch a Clanker token using the Clanker SDK.
|
|
108
|
+
It takes the following inputs:
|
|
109
|
+
- tokenName: The name of the deployed token
|
|
110
|
+
- tokenSymbol: The symbol of the deployed token
|
|
111
|
+
- description: An optional description of the token or token project
|
|
112
|
+
- socialMediaUrls: An optional array of social media links for the token, each with a platform and url
|
|
113
|
+
- image: A normal or ipfs URL pointing to the image of the token
|
|
114
|
+
- vaultPercentage: The percentage of the token supply to allocate to a vault accessible to the deployed after the lockup period with optional vesting
|
|
115
|
+
- lockDuration_Days: The lock duration of the tokens in the vault (in days) (minimum 7 days)
|
|
116
|
+
- vestingDuration_Days: The duration (in days) that the token should vest after lockup period, vesting is linear.
|
|
117
|
+
`,
|
|
118
|
+
schema: schemas_1.ClankTokenSchema,
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
|
|
122
|
+
__metadata("design:returntype", Promise)
|
|
123
|
+
], ClankerActionProvider.prototype, "clankToken", null);
|
|
124
|
+
/**
|
|
125
|
+
* Factory function to create a new ClankerActionProvider instance.
|
|
126
|
+
*
|
|
127
|
+
* @returns A new ClankerActionProvider instance
|
|
128
|
+
*/
|
|
129
|
+
const clankerActionProvider = () => new ClankerActionProvider();
|
|
130
|
+
exports.clankerActionProvider = clankerActionProvider;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Clanker Action Provider tests
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const clankerActionProvider_1 = require("./clankerActionProvider");
|
|
7
|
+
const schemas_1 = require("./schemas");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
jest.mock("./utils", () => ({
|
|
10
|
+
createClankerClient: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
const createClankerClientMock = utils_1.createClankerClient;
|
|
13
|
+
const DEPLOYED_HASH = "0xdeadbeef";
|
|
14
|
+
const DEPLOYED_TOKEN_ADDRESS = "0xabc123abc123abc123abc123abc123abc123abc1";
|
|
15
|
+
describe("Clanker action provider tests", () => {
|
|
16
|
+
const provider = (0, clankerActionProvider_1.clankerActionProvider)();
|
|
17
|
+
let mockWalletProvider;
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
mockWalletProvider = {
|
|
20
|
+
getAddress: jest.fn(),
|
|
21
|
+
getBalance: jest.fn(),
|
|
22
|
+
getName: jest.fn(),
|
|
23
|
+
getNetwork: jest.fn().mockReturnValue({
|
|
24
|
+
protocolFamily: "evm",
|
|
25
|
+
networkId: "base-mainnet",
|
|
26
|
+
}),
|
|
27
|
+
nativeTransfer: jest.fn(),
|
|
28
|
+
};
|
|
29
|
+
const fakeClanker = {
|
|
30
|
+
deploy: jest.fn(async (_tokenCfg) => ({
|
|
31
|
+
txHash: DEPLOYED_HASH,
|
|
32
|
+
waitForTransaction: async () => ({ address: DEPLOYED_TOKEN_ADDRESS }),
|
|
33
|
+
})),
|
|
34
|
+
};
|
|
35
|
+
createClankerClientMock.mockResolvedValue(fakeClanker);
|
|
36
|
+
});
|
|
37
|
+
describe("network validation", () => {
|
|
38
|
+
it("should support the protocol family and network", () => {
|
|
39
|
+
expect(provider.supportsNetwork({
|
|
40
|
+
protocolFamily: "evm",
|
|
41
|
+
networkId: "base-mainnet",
|
|
42
|
+
})).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
it("should not support other protocol families", () => {
|
|
45
|
+
expect(provider.supportsNetwork({
|
|
46
|
+
protocolFamily: "other-protocol-family",
|
|
47
|
+
})).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
it("should handle invalid network objects", () => {
|
|
50
|
+
expect(provider.supportsNetwork({ protocolFamily: "invalid-protocol" })).toBe(false);
|
|
51
|
+
expect(provider.supportsNetwork({})).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("schema validation", () => {
|
|
55
|
+
it("should validate example action schema", () => {
|
|
56
|
+
const validInput = {
|
|
57
|
+
tokenName: "testTokenName",
|
|
58
|
+
tokenSymbol: "TTN",
|
|
59
|
+
image: "https://test.com",
|
|
60
|
+
vaultPercentage: 10,
|
|
61
|
+
vestingDuration_Days: 30,
|
|
62
|
+
lockDuration_Days: 30,
|
|
63
|
+
interface: "CDP AgentKit",
|
|
64
|
+
id: "test-id",
|
|
65
|
+
};
|
|
66
|
+
const parseResult = schemas_1.ClankTokenSchema.safeParse(validInput);
|
|
67
|
+
expect(parseResult.success).toBe(true);
|
|
68
|
+
if (parseResult.success) {
|
|
69
|
+
expect(parseResult.data.tokenName).toBe("testTokenName");
|
|
70
|
+
expect(parseResult.data.tokenSymbol).toBe("TTN");
|
|
71
|
+
expect(parseResult.data.image).toBe("https://test.com");
|
|
72
|
+
expect(parseResult.data.vaultPercentage).toBe(10);
|
|
73
|
+
expect(parseResult.data.vestingDuration_Days).toBe(30);
|
|
74
|
+
expect(parseResult.data.lockDuration_Days).toBe(30);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
it("should reject invalid example action input", () => {
|
|
78
|
+
const invalidInput = {
|
|
79
|
+
fieldName: "",
|
|
80
|
+
amount: "invalid",
|
|
81
|
+
};
|
|
82
|
+
const parseResult = schemas_1.ClankTokenSchema.safeParse(invalidInput);
|
|
83
|
+
expect(parseResult.success).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe("clanker action execution", () => {
|
|
87
|
+
it("should execute the clanker action with wallet provider", async () => {
|
|
88
|
+
const args = {
|
|
89
|
+
tokenName: "testTokenName",
|
|
90
|
+
tokenSymbol: "TTN",
|
|
91
|
+
image: "https://test.com",
|
|
92
|
+
vaultPercentage: 10,
|
|
93
|
+
vestingDuration_Days: 30,
|
|
94
|
+
lockDuration_Days: 30,
|
|
95
|
+
interface: "CDP AgentKit",
|
|
96
|
+
id: "test-id",
|
|
97
|
+
};
|
|
98
|
+
const result = await provider.clankToken(mockWalletProvider, args);
|
|
99
|
+
expect(result).toContain(`Clanker token deployed at ${DEPLOYED_TOKEN_ADDRESS}`);
|
|
100
|
+
expect(result).toContain(`View the transaction at ${DEPLOYED_HASH}`);
|
|
101
|
+
expect(mockWalletProvider.getNetwork).toHaveBeenCalled();
|
|
102
|
+
expect(createClankerClientMock).toHaveBeenCalledWith(expect.any(Object), expect.any(String));
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe("supportsNetwork", () => {
|
|
106
|
+
it("should return true for base-mainnet with evm protocol", () => {
|
|
107
|
+
expect(provider.supportsNetwork({
|
|
108
|
+
protocolFamily: "evm",
|
|
109
|
+
networkId: "base-mainnet",
|
|
110
|
+
})).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
it("should return false for non-base networks", () => {
|
|
113
|
+
expect(provider.supportsNetwork({
|
|
114
|
+
protocolFamily: "evm",
|
|
115
|
+
networkId: "ethereum-mainnet",
|
|
116
|
+
})).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./clankerActionProvider"), exports);
|
|
18
|
+
__exportStar(require("./schemas"), exports);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Action schemas for the clanker action provider.
|
|
4
|
+
*
|
|
5
|
+
* This file contains the Zod schemas that define the shape and validation
|
|
6
|
+
* rules for action parameters in the clanker action provider.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ClankTokenSchema: z.ZodObject<{
|
|
9
|
+
tokenName: z.ZodString;
|
|
10
|
+
tokenSymbol: z.ZodString;
|
|
11
|
+
image: z.ZodString;
|
|
12
|
+
vaultPercentage: z.ZodNumber;
|
|
13
|
+
lockDuration_Days: z.ZodNumber;
|
|
14
|
+
vestingDuration_Days: z.ZodNumber;
|
|
15
|
+
description: z.ZodOptional<z.ZodString>;
|
|
16
|
+
socialMediaUrls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
platform: z.ZodString;
|
|
18
|
+
url: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
url: string;
|
|
21
|
+
platform: string;
|
|
22
|
+
}, {
|
|
23
|
+
url: string;
|
|
24
|
+
platform: string;
|
|
25
|
+
}>, "many">>;
|
|
26
|
+
interface: z.ZodDefault<z.ZodString>;
|
|
27
|
+
id: z.ZodDefault<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
id: string;
|
|
30
|
+
tokenSymbol: string;
|
|
31
|
+
image: string;
|
|
32
|
+
tokenName: string;
|
|
33
|
+
vaultPercentage: number;
|
|
34
|
+
lockDuration_Days: number;
|
|
35
|
+
vestingDuration_Days: number;
|
|
36
|
+
interface: string;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
socialMediaUrls?: {
|
|
39
|
+
url: string;
|
|
40
|
+
platform: string;
|
|
41
|
+
}[] | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
tokenSymbol: string;
|
|
44
|
+
image: string;
|
|
45
|
+
tokenName: string;
|
|
46
|
+
vaultPercentage: number;
|
|
47
|
+
lockDuration_Days: number;
|
|
48
|
+
vestingDuration_Days: number;
|
|
49
|
+
id?: string | undefined;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
socialMediaUrls?: {
|
|
52
|
+
url: string;
|
|
53
|
+
platform: string;
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
interface?: string | undefined;
|
|
56
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClankTokenSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Action schemas for the clanker action provider.
|
|
7
|
+
*
|
|
8
|
+
* This file contains the Zod schemas that define the shape and validation
|
|
9
|
+
* rules for action parameters in the clanker action provider.
|
|
10
|
+
*/
|
|
11
|
+
exports.ClankTokenSchema = zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
tokenName: zod_1.z.string().min(1).max(100).describe("The name of the token (max 100 characters)"),
|
|
14
|
+
tokenSymbol: zod_1.z.string().min(1).max(10).describe("The symbol of the token (max 10 characters)"),
|
|
15
|
+
image: zod_1.z.string().url().describe("Normal or ipfs URL pointing to the token image"),
|
|
16
|
+
vaultPercentage: zod_1.z
|
|
17
|
+
.number()
|
|
18
|
+
.min(0)
|
|
19
|
+
.max(90)
|
|
20
|
+
.describe("Percentage of token supply allocated to a vault that can be claimed by deployer after lockup period with optional vesting"),
|
|
21
|
+
lockDuration_Days: zod_1.z
|
|
22
|
+
.number()
|
|
23
|
+
.min(7)
|
|
24
|
+
.describe("Lockup duration of token (in days), minimum 7 days"),
|
|
25
|
+
vestingDuration_Days: zod_1.z
|
|
26
|
+
.number()
|
|
27
|
+
.min(0)
|
|
28
|
+
.describe("Vesting duration of token after lockup has passed (in days). Vesting is linear over the duration"),
|
|
29
|
+
description: zod_1.z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Description of the token or token project (optional)"),
|
|
33
|
+
socialMediaUrls: zod_1.z
|
|
34
|
+
.array(zod_1.z.object({ platform: zod_1.z.string(), url: zod_1.z.string() }))
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Socials for the token. These may be displayed on aggregators."),
|
|
37
|
+
interface: zod_1.z
|
|
38
|
+
.string()
|
|
39
|
+
.default("CDP AgentKit")
|
|
40
|
+
.describe('System the token was deployed via. Defaults to "CDP AgentKit".'),
|
|
41
|
+
id: zod_1.z
|
|
42
|
+
.string()
|
|
43
|
+
.default("")
|
|
44
|
+
.describe("User id of the poster on the social platform the token was deployed from. Used for provenance and will be verified by aggregators."),
|
|
45
|
+
})
|
|
46
|
+
.strip()
|
|
47
|
+
.describe("Instructions for deploying a Clanker token");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
2
|
+
/**
|
|
3
|
+
* Creates the client Clanker expects from the EvmWalletProvider
|
|
4
|
+
*
|
|
5
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
6
|
+
* @param networkId - The network to Clank on
|
|
7
|
+
* @returns The Clanker implementation
|
|
8
|
+
*/
|
|
9
|
+
export declare function createClankerClient(walletProvider: EvmWalletProvider, networkId: string): Promise<import("clanker-sdk/v4", { with: { "resolution-mode": "import" } }).Clanker>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createClankerClient = createClankerClient;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const network_1 = require("../../network");
|
|
6
|
+
/**
|
|
7
|
+
* Creates the client Clanker expects from the EvmWalletProvider
|
|
8
|
+
*
|
|
9
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
10
|
+
* @param networkId - The network to Clank on
|
|
11
|
+
* @returns The Clanker implementation
|
|
12
|
+
*/
|
|
13
|
+
async function createClankerClient(walletProvider, networkId) {
|
|
14
|
+
const { Clanker } = await import("clanker-sdk/v4");
|
|
15
|
+
const account = walletProvider.toSigner();
|
|
16
|
+
const publicClient = walletProvider.getPublicClient();
|
|
17
|
+
const wallet = (0, viem_1.createWalletClient)({
|
|
18
|
+
account,
|
|
19
|
+
chain: network_1.NETWORK_ID_TO_VIEM_CHAIN[networkId],
|
|
20
|
+
transport: (0, viem_1.http)(publicClient.transport.url),
|
|
21
|
+
});
|
|
22
|
+
return new Clanker({ wallet, publicClient });
|
|
23
|
+
}
|
|
@@ -37,6 +37,11 @@ class PythActionProvider extends actionProvider_1.ActionProvider {
|
|
|
37
37
|
* @returns The price feed ID as a string.
|
|
38
38
|
*/
|
|
39
39
|
async fetchPriceFeed(args) {
|
|
40
|
+
// Stop-gap solution: Return hardcoded price feed ID for ETH
|
|
41
|
+
// This is temporary until proper new API link is provided after talking to the Pyth team
|
|
42
|
+
if (args.tokenSymbol.toUpperCase() === "ETH") {
|
|
43
|
+
return "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace";
|
|
44
|
+
}
|
|
40
45
|
const url = `https://hermes.pyth.network/v2/price_feeds?query=${args.tokenSymbol}&asset_type=crypto`;
|
|
41
46
|
const response = await fetch(url);
|
|
42
47
|
if (!response.ok) {
|
|
@@ -22,7 +22,11 @@ describe("PythActionProvider", () => {
|
|
|
22
22
|
ok: true,
|
|
23
23
|
json: async () => [{ id: "some-price-feed-id", attributes: { base: "BTC" } }],
|
|
24
24
|
});
|
|
25
|
-
await expect(provider.fetchPriceFeed({ tokenSymbol: "
|
|
25
|
+
await expect(provider.fetchPriceFeed({ tokenSymbol: "SOL" })).rejects.toThrow("No price feed found for SOL");
|
|
26
|
+
});
|
|
27
|
+
it("should return hardcoded price feed ID for ETH", async () => {
|
|
28
|
+
const priceFeedId = await provider.fetchPriceFeed({ tokenSymbol: "ETH" });
|
|
29
|
+
expect(priceFeedId).toEqual("0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace");
|
|
26
30
|
});
|
|
27
31
|
it("should throw an error if the response is not ok", async () => {
|
|
28
32
|
fetchMock.mockResolvedValueOnce({
|
|
@@ -3,6 +3,10 @@ import { Abi, Address, ContractFunctionArgs, ContractFunctionName, Hex, PublicCl
|
|
|
3
3
|
import { Network } from "../network";
|
|
4
4
|
import { EvmWalletProvider } from "./evmWalletProvider";
|
|
5
5
|
import { WalletProviderWithClient, CdpWalletProviderConfig } from "./cdpShared";
|
|
6
|
+
/**
|
|
7
|
+
* Supported network types for CDP SDK EVM transactions
|
|
8
|
+
*/
|
|
9
|
+
type CdpEvmNetwork = "base" | "base-sepolia" | "ethereum" | "ethereum-sepolia" | "polygon" | "arbitrum" | "optimism";
|
|
6
10
|
/**
|
|
7
11
|
* A wallet provider that uses the Coinbase SDK.
|
|
8
12
|
*/
|
|
@@ -117,4 +121,12 @@ export declare class CdpEvmWalletProvider extends EvmWalletProvider implements W
|
|
|
117
121
|
* @returns The transaction hash.
|
|
118
122
|
*/
|
|
119
123
|
nativeTransfer(to: Address, value: string): Promise<Hex>;
|
|
124
|
+
/**
|
|
125
|
+
* Converts the internal network ID to the format expected by the CDP SDK.
|
|
126
|
+
*
|
|
127
|
+
* @returns The network ID in CDP SDK format
|
|
128
|
+
* @throws Error if the network is not supported
|
|
129
|
+
*/
|
|
130
|
+
getCdpSdkNetwork(): CdpEvmNetwork;
|
|
120
131
|
}
|
|
132
|
+
export {};
|
|
@@ -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
|
|
13
|
+
var _CdpEvmWalletProvider_publicClient, _CdpEvmWalletProvider_serverAccount, _CdpEvmWalletProvider_cdp, _CdpEvmWalletProvider_network;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CdpEvmWalletProvider = void 0;
|
|
16
16
|
const cdp_sdk_1 = require("@coinbase/cdp-sdk");
|
|
@@ -28,7 +28,6 @@ class CdpEvmWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
28
28
|
*/
|
|
29
29
|
constructor(config) {
|
|
30
30
|
super();
|
|
31
|
-
_CdpEvmWalletProvider_instances.add(this);
|
|
32
31
|
_CdpEvmWalletProvider_publicClient.set(this, void 0);
|
|
33
32
|
_CdpEvmWalletProvider_serverAccount.set(this, void 0);
|
|
34
33
|
_CdpEvmWalletProvider_cdp.set(this, void 0);
|
|
@@ -153,7 +152,7 @@ class CdpEvmWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
153
152
|
const result = await __classPrivateFieldGet(this, _CdpEvmWalletProvider_cdp, "f").evm.sendTransaction({
|
|
154
153
|
address: __classPrivateFieldGet(this, _CdpEvmWalletProvider_serverAccount, "f").address,
|
|
155
154
|
transaction: (0, viem_1.serializeTransaction)(txWithGasParams),
|
|
156
|
-
network:
|
|
155
|
+
network: this.getCdpSdkNetwork(),
|
|
157
156
|
});
|
|
158
157
|
return result.transactionHash;
|
|
159
158
|
}
|
|
@@ -238,25 +237,32 @@ class CdpEvmWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
238
237
|
data: "0x",
|
|
239
238
|
});
|
|
240
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Converts the internal network ID to the format expected by the CDP SDK.
|
|
242
|
+
*
|
|
243
|
+
* @returns The network ID in CDP SDK format
|
|
244
|
+
* @throws Error if the network is not supported
|
|
245
|
+
*/
|
|
246
|
+
getCdpSdkNetwork() {
|
|
247
|
+
switch (__classPrivateFieldGet(this, _CdpEvmWalletProvider_network, "f").networkId) {
|
|
248
|
+
case "base-sepolia":
|
|
249
|
+
return "base-sepolia";
|
|
250
|
+
case "base-mainnet":
|
|
251
|
+
return "base";
|
|
252
|
+
case "ethereum-mainnet":
|
|
253
|
+
return "ethereum";
|
|
254
|
+
case "ethereum-sepolia":
|
|
255
|
+
return "ethereum-sepolia";
|
|
256
|
+
case "polygon-mainnet":
|
|
257
|
+
return "polygon";
|
|
258
|
+
case "arbitrum-mainnet":
|
|
259
|
+
return "arbitrum";
|
|
260
|
+
case "optimism-mainnet":
|
|
261
|
+
return "optimism";
|
|
262
|
+
default:
|
|
263
|
+
throw new Error(`Unsupported network for CDP SDK: ${__classPrivateFieldGet(this, _CdpEvmWalletProvider_network, "f").networkId}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
241
266
|
}
|
|
242
267
|
exports.CdpEvmWalletProvider = CdpEvmWalletProvider;
|
|
243
|
-
_CdpEvmWalletProvider_publicClient = new WeakMap(), _CdpEvmWalletProvider_serverAccount = new WeakMap(), _CdpEvmWalletProvider_cdp = new WeakMap(), _CdpEvmWalletProvider_network = new WeakMap()
|
|
244
|
-
switch (__classPrivateFieldGet(this, _CdpEvmWalletProvider_network, "f").networkId) {
|
|
245
|
-
case "base-sepolia":
|
|
246
|
-
return "base-sepolia";
|
|
247
|
-
case "base-mainnet":
|
|
248
|
-
return "base";
|
|
249
|
-
case "ethereum-mainnet":
|
|
250
|
-
return "ethereum";
|
|
251
|
-
case "ethereum-sepolia":
|
|
252
|
-
return "ethereum-sepolia";
|
|
253
|
-
case "polygon-mainnet":
|
|
254
|
-
return "polygon";
|
|
255
|
-
case "arbitrum-mainnet":
|
|
256
|
-
return "arbitrum";
|
|
257
|
-
case "optimism-mainnet":
|
|
258
|
-
return "optimism";
|
|
259
|
-
default:
|
|
260
|
-
throw new Error(`Unsupported network for CDP SDK: ${__classPrivateFieldGet(this, _CdpEvmWalletProvider_network, "f").networkId}`);
|
|
261
|
-
}
|
|
262
|
-
};
|
|
268
|
+
_CdpEvmWalletProvider_publicClient = new WeakMap(), _CdpEvmWalletProvider_serverAccount = new WeakMap(), _CdpEvmWalletProvider_cdp = new WeakMap(), _CdpEvmWalletProvider_network = new WeakMap();
|
|
@@ -3,6 +3,10 @@ import { Abi, Address, ContractFunctionArgs, ContractFunctionName, Hex, PublicCl
|
|
|
3
3
|
import { Network } from "../network";
|
|
4
4
|
import { EvmWalletProvider } from "./evmWalletProvider";
|
|
5
5
|
import { WalletProviderWithClient, CdpSmartWalletProviderConfig } from "./cdpShared";
|
|
6
|
+
/**
|
|
7
|
+
* Supported network types for CDP SDK smart wallet operations
|
|
8
|
+
*/
|
|
9
|
+
type CdpSmartWalletNetwork = "base" | "base-sepolia" | "ethereum" | "ethereum-sepolia" | "polygon" | "arbitrum" | "optimism";
|
|
6
10
|
/**
|
|
7
11
|
* A wallet provider that uses the Coinbase CDP SDK smart wallets.
|
|
8
12
|
*/
|
|
@@ -126,4 +130,12 @@ export declare class CdpSmartWalletProvider extends EvmWalletProvider implements
|
|
|
126
130
|
* @returns The user operation hash.
|
|
127
131
|
*/
|
|
128
132
|
nativeTransfer(to: Address, value: string): Promise<Hex>;
|
|
133
|
+
/**
|
|
134
|
+
* Converts the internal network ID to the format expected by the CDP SDK.
|
|
135
|
+
*
|
|
136
|
+
* @returns The network ID in CDP SDK format
|
|
137
|
+
* @throws Error if the network is not supported
|
|
138
|
+
*/
|
|
139
|
+
getCdpSdkNetwork(): CdpSmartWalletNetwork;
|
|
129
140
|
}
|
|
141
|
+
export {};
|
|
@@ -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
|
|
13
|
+
var _CdpSmartWalletProvider_publicClient, _CdpSmartWalletProvider_cdp, _CdpSmartWalletProvider_network, _CdpSmartWalletProvider_paymasterUrl;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CdpSmartWalletProvider = void 0;
|
|
16
16
|
const cdp_sdk_1 = require("@coinbase/cdp-sdk");
|
|
@@ -28,7 +28,6 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
28
28
|
*/
|
|
29
29
|
constructor(config) {
|
|
30
30
|
super();
|
|
31
|
-
_CdpSmartWalletProvider_instances.add(this);
|
|
32
31
|
_CdpSmartWalletProvider_publicClient.set(this, void 0);
|
|
33
32
|
_CdpSmartWalletProvider_cdp.set(this, void 0);
|
|
34
33
|
_CdpSmartWalletProvider_network.set(this, void 0);
|
|
@@ -140,7 +139,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
140
139
|
types,
|
|
141
140
|
primaryType,
|
|
142
141
|
message,
|
|
143
|
-
network:
|
|
142
|
+
network: this.getCdpSdkNetwork(),
|
|
144
143
|
});
|
|
145
144
|
}
|
|
146
145
|
/**
|
|
@@ -168,7 +167,7 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
168
167
|
];
|
|
169
168
|
const userOperation = await __classPrivateFieldGet(this, _CdpSmartWalletProvider_cdp, "f").evm.sendUserOperation({
|
|
170
169
|
smartAccount: this.smartAccount,
|
|
171
|
-
network:
|
|
170
|
+
network: this.getCdpSdkNetwork(),
|
|
172
171
|
calls,
|
|
173
172
|
paymasterUrl: __classPrivateFieldGet(this, _CdpSmartWalletProvider_paymasterUrl, "f"),
|
|
174
173
|
});
|
|
@@ -269,25 +268,32 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
269
268
|
data: "0x",
|
|
270
269
|
});
|
|
271
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Converts the internal network ID to the format expected by the CDP SDK.
|
|
273
|
+
*
|
|
274
|
+
* @returns The network ID in CDP SDK format
|
|
275
|
+
* @throws Error if the network is not supported
|
|
276
|
+
*/
|
|
277
|
+
getCdpSdkNetwork() {
|
|
278
|
+
switch (__classPrivateFieldGet(this, _CdpSmartWalletProvider_network, "f").networkId) {
|
|
279
|
+
case "base-sepolia":
|
|
280
|
+
return "base-sepolia";
|
|
281
|
+
case "base-mainnet":
|
|
282
|
+
return "base";
|
|
283
|
+
case "ethereum-mainnet":
|
|
284
|
+
return "ethereum";
|
|
285
|
+
case "ethereum-sepolia":
|
|
286
|
+
return "ethereum-sepolia";
|
|
287
|
+
case "polygon-mainnet":
|
|
288
|
+
return "polygon";
|
|
289
|
+
case "arbitrum-mainnet":
|
|
290
|
+
return "arbitrum";
|
|
291
|
+
case "optimism-mainnet":
|
|
292
|
+
return "optimism";
|
|
293
|
+
default:
|
|
294
|
+
throw new Error(`Unsupported network for smart wallets: ${__classPrivateFieldGet(this, _CdpSmartWalletProvider_network, "f").networkId}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
272
297
|
}
|
|
273
298
|
exports.CdpSmartWalletProvider = CdpSmartWalletProvider;
|
|
274
|
-
_CdpSmartWalletProvider_publicClient = new WeakMap(), _CdpSmartWalletProvider_cdp = new WeakMap(), _CdpSmartWalletProvider_network = new WeakMap(), _CdpSmartWalletProvider_paymasterUrl = new WeakMap()
|
|
275
|
-
switch (__classPrivateFieldGet(this, _CdpSmartWalletProvider_network, "f").networkId) {
|
|
276
|
-
case "base-sepolia":
|
|
277
|
-
return "base-sepolia";
|
|
278
|
-
case "base-mainnet":
|
|
279
|
-
return "base";
|
|
280
|
-
case "ethereum-mainnet":
|
|
281
|
-
return "ethereum";
|
|
282
|
-
case "ethereum-sepolia":
|
|
283
|
-
return "ethereum-sepolia";
|
|
284
|
-
case "polygon-mainnet":
|
|
285
|
-
return "polygon";
|
|
286
|
-
case "arbitrum-mainnet":
|
|
287
|
-
return "arbitrum";
|
|
288
|
-
case "optimism-mainnet":
|
|
289
|
-
return "optimism";
|
|
290
|
-
default:
|
|
291
|
-
throw new Error(`Unsupported network for smart wallets: ${__classPrivateFieldGet(this, _CdpSmartWalletProvider_network, "f").networkId}`);
|
|
292
|
-
}
|
|
293
|
-
};
|
|
299
|
+
_CdpSmartWalletProvider_publicClient = new WeakMap(), _CdpSmartWalletProvider_cdp = new WeakMap(), _CdpSmartWalletProvider_network = new WeakMap(), _CdpSmartWalletProvider_paymasterUrl = new WeakMap();
|
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.0.0-nightly-
|
|
5
|
+
"version": "0.0.0-nightly-20250906210355",
|
|
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.36.
|
|
27
|
+
"@coinbase/cdp-sdk": "^1.36.1",
|
|
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",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"axios": "^1.9.0",
|
|
39
39
|
"bs58": "^4.0.1",
|
|
40
40
|
"canonicalize": "^2.1.0",
|
|
41
|
+
"clanker-sdk": "^4.1.18",
|
|
41
42
|
"decimal.js": "^10.5.0",
|
|
42
43
|
"ethers": "^6.13.5",
|
|
43
44
|
"graphql-request": "^7.2.0",
|