@coinbase/agentkit 0.0.0-nightly-20251001210424 → 0.0.0-nightly-20251002210424
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/dist/action-providers/erc20/constants.d.ts +2 -0
- package/dist/action-providers/erc20/constants.js +2 -0
- package/dist/action-providers/weth/constants.d.ts +0 -1
- package/dist/action-providers/weth/constants.js +1 -2
- package/dist/action-providers/weth/schemas.js +6 -2
- package/dist/action-providers/weth/wethActionProvider.d.ts +7 -0
- package/dist/action-providers/weth/wethActionProvider.js +57 -32
- package/dist/action-providers/weth/wethActionProvider.test.js +60 -11
- package/dist/wallet-providers/cdpSmartWalletProvider.js +1 -3
- package/package.json +1 -1
|
@@ -30,8 +30,10 @@ export declare const TOKEN_ADDRESSES_BY_SYMBOLS: {
|
|
|
30
30
|
};
|
|
31
31
|
readonly "arbitrum-mainnet": {
|
|
32
32
|
readonly USDC: "0xaf88d065e77c8cc2239327c5edb3a432268e5831";
|
|
33
|
+
readonly WETH: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
|
|
33
34
|
};
|
|
34
35
|
readonly "optimism-mainnet": {
|
|
35
36
|
readonly USDC: "0x0b2c639c533813f4aa9d7837caf62653d097ff85";
|
|
37
|
+
readonly WETH: "0x4200000000000000000000000000000000000006";
|
|
36
38
|
};
|
|
37
39
|
};
|
|
@@ -43,8 +43,10 @@ exports.TOKEN_ADDRESSES_BY_SYMBOLS = {
|
|
|
43
43
|
},
|
|
44
44
|
"arbitrum-mainnet": {
|
|
45
45
|
USDC: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
46
|
+
WETH: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
46
47
|
},
|
|
47
48
|
"optimism-mainnet": {
|
|
48
49
|
USDC: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
|
|
50
|
+
WETH: "0x4200000000000000000000000000000000000006",
|
|
49
51
|
},
|
|
50
52
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WETH_ABI =
|
|
4
|
-
exports.WETH_ADDRESS = "0x4200000000000000000000000000000000000006";
|
|
3
|
+
exports.WETH_ABI = void 0;
|
|
5
4
|
exports.WETH_ABI = [
|
|
6
5
|
{
|
|
7
6
|
inputs: [],
|
|
@@ -4,13 +4,17 @@ exports.UnwrapEthSchema = exports.WrapEthSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.WrapEthSchema = zod_1.z
|
|
6
6
|
.object({
|
|
7
|
-
amountToWrap: zod_1.z
|
|
7
|
+
amountToWrap: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("Amount of ETH to wrap in human-readable format (e.g., 0.1 for 0.1 ETH)"),
|
|
8
10
|
})
|
|
9
11
|
.strip()
|
|
10
12
|
.describe("Instructions for wrapping ETH to WETH");
|
|
11
13
|
exports.UnwrapEthSchema = zod_1.z
|
|
12
14
|
.object({
|
|
13
|
-
amountToUnwrap: zod_1.z
|
|
15
|
+
amountToUnwrap: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.describe("Amount of WETH to unwrap in human-readable format (e.g., 0.1 for 0.1 WETH)"),
|
|
14
18
|
})
|
|
15
19
|
.strip()
|
|
16
20
|
.describe("Instructions for unwrapping WETH to ETH");
|
|
@@ -3,6 +3,13 @@ import { ActionProvider } from "../actionProvider";
|
|
|
3
3
|
import { Network } from "../../network";
|
|
4
4
|
import { WrapEthSchema, UnwrapEthSchema } from "./schemas";
|
|
5
5
|
import { EvmWalletProvider } from "../../wallet-providers";
|
|
6
|
+
/**
|
|
7
|
+
* Gets the WETH address for the given network.
|
|
8
|
+
*
|
|
9
|
+
* @param network - The network to get the WETH address for.
|
|
10
|
+
* @returns The WETH address for the network, or undefined if not supported.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getWethAddress: (network: Network) => string | undefined;
|
|
6
13
|
/**
|
|
7
14
|
* WethActionProvider is an action provider for WETH.
|
|
8
15
|
*/
|
|
@@ -9,14 +9,26 @@ 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.wethActionProvider = exports.WethActionProvider = void 0;
|
|
12
|
+
exports.wethActionProvider = exports.WethActionProvider = exports.getWethAddress = void 0;
|
|
13
13
|
const zod_1 = require("zod");
|
|
14
14
|
const actionProvider_1 = require("../actionProvider");
|
|
15
15
|
const actionDecorator_1 = require("../actionDecorator");
|
|
16
16
|
const schemas_1 = require("./schemas");
|
|
17
17
|
const constants_1 = require("./constants");
|
|
18
|
+
const constants_2 = require("../erc20/constants");
|
|
18
19
|
const viem_1 = require("viem");
|
|
19
20
|
const wallet_providers_1 = require("../../wallet-providers");
|
|
21
|
+
/**
|
|
22
|
+
* Gets the WETH address for the given network.
|
|
23
|
+
*
|
|
24
|
+
* @param network - The network to get the WETH address for.
|
|
25
|
+
* @returns The WETH address for the network, or undefined if not supported.
|
|
26
|
+
*/
|
|
27
|
+
const getWethAddress = (network) => {
|
|
28
|
+
const networkTokens = constants_2.TOKEN_ADDRESSES_BY_SYMBOLS[network.networkId];
|
|
29
|
+
return networkTokens && "WETH" in networkTokens ? networkTokens.WETH : undefined;
|
|
30
|
+
};
|
|
31
|
+
exports.getWethAddress = getWethAddress;
|
|
20
32
|
/**
|
|
21
33
|
* WethActionProvider is an action provider for WETH.
|
|
22
34
|
*/
|
|
@@ -32,7 +44,9 @@ class WethActionProvider extends actionProvider_1.ActionProvider {
|
|
|
32
44
|
* @param network - The network to check.
|
|
33
45
|
* @returns True if the Weth action provider supports the network, false otherwise.
|
|
34
46
|
*/
|
|
35
|
-
this.supportsNetwork = (network) =>
|
|
47
|
+
this.supportsNetwork = (network) => {
|
|
48
|
+
return (0, exports.getWethAddress)(network) !== undefined;
|
|
49
|
+
};
|
|
36
50
|
}
|
|
37
51
|
/**
|
|
38
52
|
* Wraps ETH to WETH.
|
|
@@ -42,17 +56,30 @@ class WethActionProvider extends actionProvider_1.ActionProvider {
|
|
|
42
56
|
* @returns A message containing the transaction hash.
|
|
43
57
|
*/
|
|
44
58
|
async wrapEth(walletProvider, args) {
|
|
59
|
+
const network = walletProvider.getNetwork();
|
|
60
|
+
const wethAddress = (0, exports.getWethAddress)(network);
|
|
61
|
+
if (!wethAddress) {
|
|
62
|
+
return `Error: WETH not supported on network ${network.networkId}`;
|
|
63
|
+
}
|
|
45
64
|
try {
|
|
65
|
+
// Convert human-readable ETH amount to wei (ETH has 18 decimals)
|
|
66
|
+
const amountInWei = (0, viem_1.parseUnits)(args.amountToWrap, 18);
|
|
67
|
+
// Check ETH balance before wrapping
|
|
68
|
+
const ethBalance = await walletProvider.getBalance();
|
|
69
|
+
if (ethBalance < amountInWei) {
|
|
70
|
+
const ethBalanceFormatted = (0, viem_1.formatUnits)(ethBalance, 18);
|
|
71
|
+
return `Error: Insufficient ETH balance. Requested to wrap ${args.amountToWrap} ETH, but only ${ethBalanceFormatted} ETH is available.`;
|
|
72
|
+
}
|
|
46
73
|
const hash = await walletProvider.sendTransaction({
|
|
47
|
-
to:
|
|
74
|
+
to: wethAddress,
|
|
48
75
|
data: (0, viem_1.encodeFunctionData)({
|
|
49
76
|
abi: constants_1.WETH_ABI,
|
|
50
77
|
functionName: "deposit",
|
|
51
78
|
}),
|
|
52
|
-
value:
|
|
79
|
+
value: amountInWei,
|
|
53
80
|
});
|
|
54
81
|
await walletProvider.waitForTransactionReceipt(hash);
|
|
55
|
-
return `Wrapped ETH
|
|
82
|
+
return `Wrapped ${args.amountToWrap} ETH to WETH. Transaction hash: ${hash}`;
|
|
56
83
|
}
|
|
57
84
|
catch (error) {
|
|
58
85
|
return `Error wrapping ETH: ${error}`;
|
|
@@ -66,17 +93,35 @@ class WethActionProvider extends actionProvider_1.ActionProvider {
|
|
|
66
93
|
* @returns A message containing the transaction hash.
|
|
67
94
|
*/
|
|
68
95
|
async unwrapEth(walletProvider, args) {
|
|
96
|
+
const network = walletProvider.getNetwork();
|
|
97
|
+
const wethAddress = (0, exports.getWethAddress)(network);
|
|
98
|
+
if (!wethAddress) {
|
|
99
|
+
return `Error: WETH not supported on network ${network.networkId}`;
|
|
100
|
+
}
|
|
69
101
|
try {
|
|
102
|
+
// Convert human-readable WETH amount to wei (WETH has 18 decimals)
|
|
103
|
+
const amountInWei = (0, viem_1.parseUnits)(args.amountToUnwrap, 18);
|
|
104
|
+
// Check WETH balance before unwrapping
|
|
105
|
+
const wethBalance = await walletProvider.readContract({
|
|
106
|
+
address: wethAddress,
|
|
107
|
+
abi: viem_1.erc20Abi,
|
|
108
|
+
functionName: "balanceOf",
|
|
109
|
+
args: [walletProvider.getAddress()],
|
|
110
|
+
});
|
|
111
|
+
if (wethBalance < amountInWei) {
|
|
112
|
+
const wethBalanceFormatted = (0, viem_1.formatUnits)(wethBalance, 18);
|
|
113
|
+
return `Error: Insufficient WETH balance. Requested to unwrap ${args.amountToUnwrap} WETH, but only ${wethBalanceFormatted} WETH is available.`;
|
|
114
|
+
}
|
|
70
115
|
const hash = await walletProvider.sendTransaction({
|
|
71
|
-
to:
|
|
116
|
+
to: wethAddress,
|
|
72
117
|
data: (0, viem_1.encodeFunctionData)({
|
|
73
118
|
abi: constants_1.WETH_ABI,
|
|
74
119
|
functionName: "withdraw",
|
|
75
|
-
args: [
|
|
120
|
+
args: [amountInWei],
|
|
76
121
|
}),
|
|
77
122
|
});
|
|
78
123
|
await walletProvider.waitForTransactionReceipt(hash);
|
|
79
|
-
return `Unwrapped WETH
|
|
124
|
+
return `Unwrapped ${args.amountToUnwrap} WETH to ETH. Transaction hash: ${hash}`;
|
|
80
125
|
}
|
|
81
126
|
catch (error) {
|
|
82
127
|
return `Error unwrapping WETH: ${error}`;
|
|
@@ -88,20 +133,10 @@ __decorate([
|
|
|
88
133
|
(0, actionDecorator_1.CreateAction)({
|
|
89
134
|
name: "wrap_eth",
|
|
90
135
|
description: `
|
|
91
|
-
This tool
|
|
92
|
-
Do not use this tool for any other purpose, or trading other assets.
|
|
136
|
+
This tool wraps ETH to WETH.
|
|
93
137
|
|
|
94
138
|
Inputs:
|
|
95
|
-
- Amount of ETH to wrap.
|
|
96
|
-
|
|
97
|
-
Important notes:
|
|
98
|
-
- The amount is a string and cannot have any decimal points, since the unit of measurement is wei.
|
|
99
|
-
- Make sure to use the exact amount provided, and if there's any doubt, check by getting more information before continuing with the action.
|
|
100
|
-
- 1 wei = 0.000000000000000001 WETH
|
|
101
|
-
- Minimum purchase amount is 100000000000 wei (0.0000001 WETH)
|
|
102
|
-
- Only supported on the following networks:
|
|
103
|
-
- Base Sepolia (ie, 'base-sepolia')
|
|
104
|
-
- Base Mainnet (ie, 'base', 'base-mainnet')
|
|
139
|
+
- Amount of ETH to wrap in human-readable format (e.g., 0.1 for 0.1 ETH).
|
|
105
140
|
`,
|
|
106
141
|
schema: schemas_1.WrapEthSchema,
|
|
107
142
|
}),
|
|
@@ -113,20 +148,10 @@ __decorate([
|
|
|
113
148
|
(0, actionDecorator_1.CreateAction)({
|
|
114
149
|
name: "unwrap_eth",
|
|
115
150
|
description: `
|
|
116
|
-
This tool
|
|
117
|
-
Do not use this tool for any other purpose, or trading other assets.
|
|
151
|
+
This tool unwraps WETH to ETH.
|
|
118
152
|
|
|
119
153
|
Inputs:
|
|
120
|
-
- Amount of WETH to unwrap.
|
|
121
|
-
|
|
122
|
-
Important notes:
|
|
123
|
-
- The amount is a string and cannot have any decimal points, since the unit of measurement is wei.
|
|
124
|
-
- Make sure to use the exact amount provided, and if there's any doubt, check by getting more information before continuing with the action.
|
|
125
|
-
- 1 wei = 0.000000000000000001 WETH
|
|
126
|
-
- Minimum unwrap amount is 100000000000 wei (0.0000001 WETH)
|
|
127
|
-
- Only supported on the following networks:
|
|
128
|
-
- Base Sepolia (ie, 'base-sepolia')
|
|
129
|
-
- Base Mainnet (ie, 'base', 'base-mainnet')
|
|
154
|
+
- Amount of WETH to unwrap in human-readable format (e.g., 0.1 for 0.1 WETH).
|
|
130
155
|
`,
|
|
131
156
|
schema: schemas_1.UnwrapEthSchema,
|
|
132
157
|
}),
|
|
@@ -42,6 +42,11 @@ describe("Wrap Eth Action", () => {
|
|
|
42
42
|
beforeEach(async () => {
|
|
43
43
|
mockWallet = {
|
|
44
44
|
getAddress: jest.fn().mockReturnValue(MOCK_ADDRESS),
|
|
45
|
+
getNetwork: jest.fn().mockReturnValue({
|
|
46
|
+
protocolFamily: "evm",
|
|
47
|
+
networkId: "base-mainnet",
|
|
48
|
+
}),
|
|
49
|
+
getBalance: jest.fn().mockResolvedValue((0, viem_1.parseUnits)("20", 18)), // 20 ETH balance
|
|
45
50
|
sendTransaction: jest.fn(),
|
|
46
51
|
waitForTransactionReceipt: jest.fn(),
|
|
47
52
|
};
|
|
@@ -54,14 +59,14 @@ describe("Wrap Eth Action", () => {
|
|
|
54
59
|
mockWallet.sendTransaction.mockResolvedValue(hash);
|
|
55
60
|
const response = await actionProvider.wrapEth(mockWallet, args);
|
|
56
61
|
expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
|
|
57
|
-
to:
|
|
62
|
+
to: (0, wethActionProvider_1.getWethAddress)({ protocolFamily: "evm", networkId: "base-mainnet" }),
|
|
58
63
|
data: (0, viem_1.encodeFunctionData)({
|
|
59
64
|
abi: constants_1.WETH_ABI,
|
|
60
65
|
functionName: "deposit",
|
|
61
66
|
}),
|
|
62
|
-
value:
|
|
67
|
+
value: (0, viem_1.parseUnits)(MOCK_AMOUNT, 18),
|
|
63
68
|
});
|
|
64
|
-
expect(response).toContain(`Wrapped ETH
|
|
69
|
+
expect(response).toContain(`Wrapped ${MOCK_AMOUNT} ETH to WETH. Transaction hash: ${hash}`);
|
|
65
70
|
});
|
|
66
71
|
it("should fail with an error", async () => {
|
|
67
72
|
const args = {
|
|
@@ -71,15 +76,25 @@ describe("Wrap Eth Action", () => {
|
|
|
71
76
|
mockWallet.sendTransaction.mockRejectedValue(error);
|
|
72
77
|
const response = await actionProvider.wrapEth(mockWallet, args);
|
|
73
78
|
expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
|
|
74
|
-
to:
|
|
79
|
+
to: (0, wethActionProvider_1.getWethAddress)({ protocolFamily: "evm", networkId: "base-mainnet" }),
|
|
75
80
|
data: (0, viem_1.encodeFunctionData)({
|
|
76
81
|
abi: constants_1.WETH_ABI,
|
|
77
82
|
functionName: "deposit",
|
|
78
83
|
}),
|
|
79
|
-
value:
|
|
84
|
+
value: (0, viem_1.parseUnits)(MOCK_AMOUNT, 18),
|
|
80
85
|
});
|
|
81
86
|
expect(response).toContain(`Error wrapping ETH: ${error}`);
|
|
82
87
|
});
|
|
88
|
+
it("should fail with insufficient ETH balance", async () => {
|
|
89
|
+
const args = {
|
|
90
|
+
amountToWrap: MOCK_AMOUNT,
|
|
91
|
+
};
|
|
92
|
+
// Mock insufficient balance (less than 15 ETH)
|
|
93
|
+
mockWallet.getBalance.mockResolvedValue((0, viem_1.parseUnits)("10", 18));
|
|
94
|
+
const response = await actionProvider.wrapEth(mockWallet, args);
|
|
95
|
+
expect(mockWallet.sendTransaction).not.toHaveBeenCalled();
|
|
96
|
+
expect(response).toContain("Error: Insufficient ETH balance");
|
|
97
|
+
});
|
|
83
98
|
});
|
|
84
99
|
describe("Unwrap Eth Action", () => {
|
|
85
100
|
let mockWallet;
|
|
@@ -87,6 +102,11 @@ describe("Unwrap Eth Action", () => {
|
|
|
87
102
|
beforeEach(async () => {
|
|
88
103
|
mockWallet = {
|
|
89
104
|
getAddress: jest.fn().mockReturnValue(MOCK_ADDRESS),
|
|
105
|
+
getNetwork: jest.fn().mockReturnValue({
|
|
106
|
+
protocolFamily: "evm",
|
|
107
|
+
networkId: "base-mainnet",
|
|
108
|
+
}),
|
|
109
|
+
readContract: jest.fn().mockResolvedValue((0, viem_1.parseUnits)("20", 18)), // 20 WETH balance
|
|
90
110
|
sendTransaction: jest.fn(),
|
|
91
111
|
waitForTransactionReceipt: jest.fn(),
|
|
92
112
|
};
|
|
@@ -98,15 +118,21 @@ describe("Unwrap Eth Action", () => {
|
|
|
98
118
|
const hash = "0x1234567890123456789012345678901234567890";
|
|
99
119
|
mockWallet.sendTransaction.mockResolvedValue(hash);
|
|
100
120
|
const response = await actionProvider.unwrapEth(mockWallet, args);
|
|
121
|
+
expect(mockWallet.readContract).toHaveBeenCalledWith({
|
|
122
|
+
address: (0, wethActionProvider_1.getWethAddress)({ protocolFamily: "evm", networkId: "base-mainnet" }),
|
|
123
|
+
abi: viem_1.erc20Abi,
|
|
124
|
+
functionName: "balanceOf",
|
|
125
|
+
args: [MOCK_ADDRESS],
|
|
126
|
+
});
|
|
101
127
|
expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
|
|
102
|
-
to:
|
|
128
|
+
to: (0, wethActionProvider_1.getWethAddress)({ protocolFamily: "evm", networkId: "base-mainnet" }),
|
|
103
129
|
data: (0, viem_1.encodeFunctionData)({
|
|
104
130
|
abi: constants_1.WETH_ABI,
|
|
105
131
|
functionName: "withdraw",
|
|
106
|
-
args: [
|
|
132
|
+
args: [(0, viem_1.parseUnits)(MOCK_AMOUNT, 18)],
|
|
107
133
|
}),
|
|
108
134
|
});
|
|
109
|
-
expect(response).toContain(`Unwrapped WETH
|
|
135
|
+
expect(response).toContain(`Unwrapped ${MOCK_AMOUNT} WETH to ETH. Transaction hash: ${hash}`);
|
|
110
136
|
});
|
|
111
137
|
it("should fail with an error", async () => {
|
|
112
138
|
const args = {
|
|
@@ -115,16 +141,32 @@ describe("Unwrap Eth Action", () => {
|
|
|
115
141
|
const error = new Error("Failed to unwrap WETH");
|
|
116
142
|
mockWallet.sendTransaction.mockRejectedValue(error);
|
|
117
143
|
const response = await actionProvider.unwrapEth(mockWallet, args);
|
|
144
|
+
expect(mockWallet.readContract).toHaveBeenCalledWith({
|
|
145
|
+
address: (0, wethActionProvider_1.getWethAddress)({ protocolFamily: "evm", networkId: "base-mainnet" }),
|
|
146
|
+
abi: viem_1.erc20Abi,
|
|
147
|
+
functionName: "balanceOf",
|
|
148
|
+
args: [MOCK_ADDRESS],
|
|
149
|
+
});
|
|
118
150
|
expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
|
|
119
|
-
to:
|
|
151
|
+
to: (0, wethActionProvider_1.getWethAddress)({ protocolFamily: "evm", networkId: "base-mainnet" }),
|
|
120
152
|
data: (0, viem_1.encodeFunctionData)({
|
|
121
153
|
abi: constants_1.WETH_ABI,
|
|
122
154
|
functionName: "withdraw",
|
|
123
|
-
args: [
|
|
155
|
+
args: [(0, viem_1.parseUnits)(MOCK_AMOUNT, 18)],
|
|
124
156
|
}),
|
|
125
157
|
});
|
|
126
158
|
expect(response).toContain(`Error unwrapping WETH: ${error}`);
|
|
127
159
|
});
|
|
160
|
+
it("should fail with insufficient WETH balance", async () => {
|
|
161
|
+
const args = {
|
|
162
|
+
amountToUnwrap: MOCK_AMOUNT,
|
|
163
|
+
};
|
|
164
|
+
// Mock insufficient WETH balance (less than 15 WETH)
|
|
165
|
+
mockWallet.readContract.mockResolvedValue((0, viem_1.parseUnits)("10", 18));
|
|
166
|
+
const response = await actionProvider.unwrapEth(mockWallet, args);
|
|
167
|
+
expect(mockWallet.sendTransaction).not.toHaveBeenCalled();
|
|
168
|
+
expect(response).toContain("Error: Insufficient WETH balance");
|
|
169
|
+
});
|
|
128
170
|
});
|
|
129
171
|
describe("supportsNetwork", () => {
|
|
130
172
|
const actionProvider = (0, wethActionProvider_1.wethActionProvider)();
|
|
@@ -142,11 +184,18 @@ describe("supportsNetwork", () => {
|
|
|
142
184
|
});
|
|
143
185
|
expect(result).toBe(true);
|
|
144
186
|
});
|
|
145
|
-
it("should return
|
|
187
|
+
it("should return true for ethereum-mainnet", () => {
|
|
146
188
|
const result = actionProvider.supportsNetwork({
|
|
147
189
|
protocolFamily: "evm",
|
|
148
190
|
networkId: "ethereum-mainnet",
|
|
149
191
|
});
|
|
192
|
+
expect(result).toBe(true);
|
|
193
|
+
});
|
|
194
|
+
it("should return false for networks without WETH", () => {
|
|
195
|
+
const result = actionProvider.supportsNetwork({
|
|
196
|
+
protocolFamily: "evm",
|
|
197
|
+
networkId: "polygon-mainnet",
|
|
198
|
+
});
|
|
150
199
|
expect(result).toBe(false);
|
|
151
200
|
});
|
|
152
201
|
});
|
|
@@ -246,15 +246,13 @@ class CdpSmartWalletProvider extends evmWalletProvider_1.EvmWalletProvider {
|
|
|
246
246
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
247
|
async waitForTransactionReceipt(userOpHash) {
|
|
248
248
|
// For smart wallets, we need to wait for the user operation to be confirmed
|
|
249
|
-
// This is a simplified implementation - in practice you might want to poll
|
|
250
|
-
// the CDP API for user operation status
|
|
251
249
|
const receipt = await __classPrivateFieldGet(this, _CdpSmartWalletProvider_cdp, "f").evm.waitForUserOperation({
|
|
252
250
|
smartAccountAddress: this.smartAccount.address,
|
|
253
251
|
userOpHash,
|
|
254
252
|
});
|
|
255
253
|
// Append transaction logs if available
|
|
256
254
|
if (receipt.status === "complete") {
|
|
257
|
-
const receiptTx = await __classPrivateFieldGet(this, _CdpSmartWalletProvider_publicClient, "f").
|
|
255
|
+
const receiptTx = await __classPrivateFieldGet(this, _CdpSmartWalletProvider_publicClient, "f").waitForTransactionReceipt({
|
|
258
256
|
hash: receipt.transactionHash,
|
|
259
257
|
});
|
|
260
258
|
if (receiptTx.logs)
|
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-20251002210424",
|
|
6
6
|
"author": "Coinbase Inc.",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "dist/index.js",
|