@coinbase/agentkit 0.10.2 → 0.10.3

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 (62) hide show
  1. package/README.md +42 -0
  2. package/dist/action-providers/cdp/cdpApiActionProvider.js +7 -30
  3. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +2 -8
  4. package/dist/action-providers/cdp/faucetUtils.d.ts +38 -0
  5. package/dist/action-providers/cdp/faucetUtils.js +81 -0
  6. package/dist/action-providers/clanker/schemas.d.ts +4 -4
  7. package/dist/action-providers/enso/constants.d.ts +4 -0
  8. package/dist/action-providers/enso/constants.js +10 -0
  9. package/dist/action-providers/enso/ensoActionProvider.d.ts +34 -0
  10. package/dist/action-providers/enso/ensoActionProvider.js +125 -0
  11. package/dist/action-providers/enso/ensoActionProvider.test.d.ts +1 -0
  12. package/dist/action-providers/enso/ensoActionProvider.test.js +141 -0
  13. package/dist/action-providers/enso/index.d.ts +1 -0
  14. package/dist/action-providers/enso/index.js +17 -0
  15. package/dist/action-providers/enso/schemas.d.ts +23 -0
  16. package/dist/action-providers/enso/schemas.js +22 -0
  17. package/dist/action-providers/erc20/constants.d.ts +2 -0
  18. package/dist/action-providers/erc20/constants.js +2 -0
  19. package/dist/action-providers/erc20/erc20ActionProvider.d.ts +17 -1
  20. package/dist/action-providers/erc20/erc20ActionProvider.js +103 -1
  21. package/dist/action-providers/erc20/erc20ActionProvider.test.js +201 -0
  22. package/dist/action-providers/erc20/schemas.d.ts +29 -0
  23. package/dist/action-providers/erc20/schemas.js +34 -1
  24. package/dist/action-providers/index.d.ts +3 -1
  25. package/dist/action-providers/index.js +3 -1
  26. package/dist/action-providers/wallet/walletActionProvider.js +1 -1
  27. package/dist/action-providers/weth/constants.d.ts +0 -1
  28. package/dist/action-providers/weth/constants.js +1 -2
  29. package/dist/action-providers/weth/schemas.js +6 -2
  30. package/dist/action-providers/weth/wethActionProvider.d.ts +7 -0
  31. package/dist/action-providers/weth/wethActionProvider.js +57 -32
  32. package/dist/action-providers/weth/wethActionProvider.test.js +60 -11
  33. package/dist/action-providers/x402/utils.d.ts +4 -4
  34. package/dist/action-providers/x402/utils.js +42 -5
  35. package/dist/action-providers/x402/x402ActionProvider.d.ts +6 -6
  36. package/dist/action-providers/x402/x402ActionProvider.js +23 -8
  37. package/dist/action-providers/x402/x402ActionProvider.test.js +50 -6
  38. package/dist/action-providers/yelay/constants.d.ts +64 -0
  39. package/dist/action-providers/yelay/constants.js +137 -0
  40. package/dist/action-providers/yelay/index.d.ts +2 -0
  41. package/dist/action-providers/yelay/index.js +18 -0
  42. package/dist/action-providers/yelay/schemas.d.ts +47 -0
  43. package/dist/action-providers/yelay/schemas.js +59 -0
  44. package/dist/action-providers/yelay/types.d.ts +24 -0
  45. package/dist/action-providers/yelay/types.js +2 -0
  46. package/dist/action-providers/yelay/yelayActionProvider.d.ts +70 -0
  47. package/dist/action-providers/yelay/yelayActionProvider.js +329 -0
  48. package/dist/action-providers/yelay/yelayActionProvider.test.d.ts +1 -0
  49. package/dist/action-providers/yelay/yelayActionProvider.test.js +302 -0
  50. package/dist/wallet-providers/cdpSmartWalletProvider.js +1 -3
  51. package/dist/wallet-providers/cdpSolanaWalletProvider.d.ts +14 -0
  52. package/dist/wallet-providers/cdpSolanaWalletProvider.js +39 -3
  53. package/dist/wallet-providers/cdpSolanaWalletProvider.test.js +16 -0
  54. package/dist/wallet-providers/privySvmWalletProvider.d.ts +14 -0
  55. package/dist/wallet-providers/privySvmWalletProvider.js +17 -0
  56. package/dist/wallet-providers/privySvmWalletProvider.test.js +10 -0
  57. package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +14 -0
  58. package/dist/wallet-providers/solanaKeypairWalletProvider.js +17 -0
  59. package/dist/wallet-providers/svmWalletProvider.d.ts +34 -0
  60. package/dist/wallet-providers/svmWalletProvider.js +43 -0
  61. package/dist/wallet-providers/svmWalletProvider.test.js +10 -0
  62. package/package.json +3 -1
@@ -37,9 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const x402ActionProvider_1 = require("./x402ActionProvider");
40
+ const wallet_providers_1 = require("../../wallet-providers");
40
41
  const axios_1 = __importDefault(require("axios"));
41
42
  const x402axios = __importStar(require("x402-axios"));
42
43
  const x402Verify = __importStar(require("x402/verify"));
44
+ const utils = __importStar(require("./utils"));
43
45
  // Mock external facilitator dependency
44
46
  jest.mock("@coinbase/x402", () => ({
45
47
  facilitator: {},
@@ -48,6 +50,7 @@ jest.mock("@coinbase/x402", () => ({
48
50
  jest.mock("axios");
49
51
  jest.mock("x402-axios");
50
52
  jest.mock("x402/verify");
53
+ jest.mock("./utils");
51
54
  // Create mock functions
52
55
  const mockRequest = jest.fn();
53
56
  // Create a complete mock axios instance
@@ -90,6 +93,10 @@ const mockAxios = {
90
93
  const mockWithPaymentInterceptor = jest.fn().mockReturnValue(mockAxiosInstance);
91
94
  const mockDecodeXPaymentResponse = jest.fn();
92
95
  const mockUseFacilitator = jest.fn();
96
+ const mockIsUsdcAsset = jest.fn();
97
+ const mockConvertWholeUnitsToAtomic = jest.fn();
98
+ const mockFormatPaymentOption = jest.fn();
99
+ const mockGetX402Network = jest.fn();
93
100
  // Override the mocked modules
94
101
  axios_1.default.create = mockAxios.create;
95
102
  axios_1.default.request = mockRequest;
@@ -98,11 +105,25 @@ axios_1.default.isAxiosError = mockAxios.isAxiosError;
98
105
  jest.mocked(x402axios.withPaymentInterceptor).mockImplementation(mockWithPaymentInterceptor);
99
106
  jest.mocked(x402axios.decodeXPaymentResponse).mockImplementation(mockDecodeXPaymentResponse);
100
107
  jest.mocked(x402Verify.useFacilitator).mockImplementation(mockUseFacilitator);
101
- // Mock wallet provider
102
- const makeMockWalletProvider = (networkId) => ({
103
- toSigner: jest.fn().mockReturnValue("mock-signer"),
104
- getNetwork: jest.fn().mockReturnValue({ protocolFamily: "evm", networkId }),
108
+ // Mock utils functions
109
+ jest.mocked(utils.isUsdcAsset).mockImplementation(mockIsUsdcAsset);
110
+ jest.mocked(utils.convertWholeUnitsToAtomic).mockImplementation(mockConvertWholeUnitsToAtomic);
111
+ jest.mocked(utils.formatPaymentOption).mockImplementation(mockFormatPaymentOption);
112
+ jest.mocked(utils.getX402Network).mockImplementation(mockGetX402Network);
113
+ jest.mocked(utils.handleHttpError).mockImplementation((error, url) => {
114
+ return JSON.stringify({
115
+ error: true,
116
+ message: error instanceof Error ? error.message : "Network error",
117
+ url: url,
118
+ });
105
119
  });
120
+ // Mock wallet provider
121
+ const makeMockWalletProvider = (networkId) => {
122
+ const mockProvider = Object.create(wallet_providers_1.EvmWalletProvider.prototype);
123
+ mockProvider.toSigner = jest.fn().mockReturnValue("mock-signer");
124
+ mockProvider.getNetwork = jest.fn().mockReturnValue({ protocolFamily: "evm", networkId });
125
+ return mockProvider;
126
+ };
106
127
  // Sample responses based on real examples
107
128
  const MOCK_PAYMENT_INFO_RESPONSE = {
108
129
  paymentRequired: true,
@@ -150,6 +171,11 @@ describe("X402ActionProvider", () => {
150
171
  .mockImplementation((error) => Boolean(error &&
151
172
  typeof error === "object" &&
152
173
  ("isAxiosError" in error || "response" in error || "request" in error)));
174
+ // Reset all utility mocks to default behavior
175
+ mockGetX402Network.mockImplementation(network => network.networkId);
176
+ mockIsUsdcAsset.mockReturnValue(false);
177
+ mockConvertWholeUnitsToAtomic.mockResolvedValue("100000");
178
+ mockFormatPaymentOption.mockResolvedValue("mocked payment option");
153
179
  });
154
180
  afterEach(() => {
155
181
  jest.clearAllMocks();
@@ -167,8 +193,12 @@ describe("X402ActionProvider", () => {
167
193
  const network = { protocolFamily: "evm", networkId: "ethereum" };
168
194
  expect(provider.supportsNetwork(network)).toBe(false);
169
195
  });
170
- it("should not support non-EVM networks", () => {
171
- const network = { protocolFamily: "solana", networkId: "mainnet" };
196
+ it("should support SVM networks", () => {
197
+ const network = { protocolFamily: "svm", networkId: "solana-mainnet" };
198
+ expect(provider.supportsNetwork(network)).toBe(true);
199
+ });
200
+ it("should not support non-EVM/SVM networks", () => {
201
+ const network = { protocolFamily: "bitcoin", networkId: "mainnet" };
172
202
  expect(provider.supportsNetwork(network)).toBe(false);
173
203
  });
174
204
  });
@@ -190,6 +220,8 @@ describe("X402ActionProvider", () => {
190
220
  expect(parsedResult.data).toEqual({ message: "Success" });
191
221
  });
192
222
  it("should handle 402 responses with payment options", async () => {
223
+ mockGetX402Network.mockReturnValue("base-sepolia");
224
+ mockFormatPaymentOption.mockResolvedValue("10000 USDC on base-sepolia network");
193
225
  mockRequest.mockResolvedValue({
194
226
  status: 402,
195
227
  data: MOCK_PAYMENT_INFO_RESPONSE.data,
@@ -241,6 +273,7 @@ describe("X402ActionProvider", () => {
241
273
  ],
242
274
  });
243
275
  mockUseFacilitator.mockReturnValue({ list: mockList });
276
+ mockGetX402Network.mockReturnValue("base-sepolia");
244
277
  const result = await provider.discoverX402Services(makeMockWalletProvider("base-sepolia"), {});
245
278
  const parsed = JSON.parse(result);
246
279
  expect(parsed.success).toBe(true);
@@ -299,6 +332,14 @@ describe("X402ActionProvider", () => {
299
332
  ],
300
333
  });
301
334
  mockUseFacilitator.mockReturnValue({ list: mockList });
335
+ // Mock the utility functions for this test
336
+ mockGetX402Network.mockReturnValue("base-sepolia");
337
+ mockIsUsdcAsset.mockReturnValue(true); // All assets are USDC
338
+ mockConvertWholeUnitsToAtomic
339
+ .mockResolvedValueOnce("100000") // 0.1 USDC in atomic units
340
+ .mockResolvedValueOnce("100000")
341
+ .mockResolvedValueOnce("100000");
342
+ mockFormatPaymentOption.mockResolvedValue("formatted payment option");
302
343
  const result = await provider.discoverX402Services(makeMockWalletProvider("base-sepolia"), {
303
344
  maxUsdcPrice: 0.1,
304
345
  });
@@ -319,6 +360,7 @@ describe("X402ActionProvider", () => {
319
360
  describe("retryHttpRequestWithX402", () => {
320
361
  it("should successfully retry with payment", async () => {
321
362
  mockDecodeXPaymentResponse.mockReturnValue(MOCK_PAYMENT_RESPONSE);
363
+ mockGetX402Network.mockReturnValue("base-sepolia");
322
364
  mockRequest.mockResolvedValue({
323
365
  status: 200,
324
366
  statusText: "OK",
@@ -353,6 +395,7 @@ describe("X402ActionProvider", () => {
353
395
  error.isAxiosError = true;
354
396
  error.request = {};
355
397
  mockRequest.mockRejectedValue(error);
398
+ mockGetX402Network.mockReturnValue("base-sepolia");
356
399
  const result = await provider.retryWithX402(makeMockWalletProvider("base-sepolia"), {
357
400
  url: "https://www.x402.org/protected",
358
401
  method: "GET",
@@ -395,6 +438,7 @@ describe("X402ActionProvider", () => {
395
438
  });
396
439
  });
397
440
  it("should handle successful non-payment requests", async () => {
441
+ mockDecodeXPaymentResponse.mockReturnValue(null); // No payment made
398
442
  mockRequest.mockResolvedValue({
399
443
  status: 200,
400
444
  statusText: "OK",
@@ -0,0 +1,64 @@
1
+ export declare const YELAY_BACKEND_URL = "https://lite.api.yelay.io/v2";
2
+ export declare const RETAIL_POOL_ID = 10;
3
+ export declare const YELAY_VAULT_ABI: {
4
+ type: string;
5
+ name: string;
6
+ inputs: {
7
+ name: string;
8
+ type: string;
9
+ internalType: string;
10
+ }[];
11
+ outputs: {
12
+ name: string;
13
+ type: string;
14
+ internalType: string;
15
+ }[];
16
+ stateMutability: string;
17
+ }[];
18
+ export declare const YIELD_EXTRACTOR_ABI: ({
19
+ inputs: {
20
+ components: {
21
+ internalType: string;
22
+ name: string;
23
+ type: string;
24
+ }[];
25
+ internalType: string;
26
+ name: string;
27
+ type: string;
28
+ }[];
29
+ name: string;
30
+ outputs: never[];
31
+ stateMutability: string;
32
+ type: string;
33
+ } | {
34
+ inputs: {
35
+ internalType: string;
36
+ name: string;
37
+ type: string;
38
+ }[];
39
+ name: string;
40
+ outputs: {
41
+ internalType: string;
42
+ name: string;
43
+ type: string;
44
+ }[];
45
+ stateMutability: string;
46
+ type: string;
47
+ })[];
48
+ export declare const CONTRACTS_BY_CHAIN: {
49
+ readonly 1: {
50
+ readonly YieldExtractor: "0x226239384EB7d78Cdf279BA6Fb458E2A4945E275";
51
+ };
52
+ readonly 146: {
53
+ readonly YieldExtractor: "0xB84B621D3da3E5e47A1927883C685455Ad731D7C";
54
+ };
55
+ readonly 8453: {
56
+ readonly YieldExtractor: "0x4d6a89dc55d8bacc0cbc3824bd7e44fa051c3958";
57
+ };
58
+ readonly 42161: {
59
+ readonly YieldExtractor: "0x79b7e90F1BAe837362DBD2c83Bd0715c2De5E47f";
60
+ };
61
+ readonly 43114: {
62
+ readonly YieldExtractor: "0x98732e2FEb854bAd400D4b5336f4439E7E53fe88";
63
+ };
64
+ };
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONTRACTS_BY_CHAIN = exports.YIELD_EXTRACTOR_ABI = exports.YELAY_VAULT_ABI = exports.RETAIL_POOL_ID = exports.YELAY_BACKEND_URL = void 0;
4
+ exports.YELAY_BACKEND_URL = "https://lite.api.yelay.io/v2";
5
+ exports.RETAIL_POOL_ID = 10;
6
+ exports.YELAY_VAULT_ABI = [
7
+ {
8
+ type: "function",
9
+ name: "deposit",
10
+ inputs: [
11
+ { name: "assets", type: "uint256", internalType: "uint256" },
12
+ { name: "projectId", type: "uint256", internalType: "uint256" },
13
+ { name: "receiver", type: "address", internalType: "address" },
14
+ ],
15
+ outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }],
16
+ stateMutability: "nonpayable",
17
+ },
18
+ {
19
+ type: "function",
20
+ name: "redeem",
21
+ inputs: [
22
+ { name: "shares", type: "uint256", internalType: "uint256" },
23
+ { name: "projectId", type: "uint256", internalType: "uint256" },
24
+ { name: "receiver", type: "address", internalType: "address" },
25
+ ],
26
+ outputs: [{ name: "assets", type: "uint256", internalType: "uint256" }],
27
+ stateMutability: "nonpayable",
28
+ },
29
+ {
30
+ inputs: [
31
+ {
32
+ internalType: "address",
33
+ name: "account",
34
+ type: "address",
35
+ },
36
+ {
37
+ internalType: "uint256",
38
+ name: "id",
39
+ type: "uint256",
40
+ },
41
+ ],
42
+ name: "balanceOf",
43
+ outputs: [
44
+ {
45
+ internalType: "uint256",
46
+ name: "",
47
+ type: "uint256",
48
+ },
49
+ ],
50
+ stateMutability: "view",
51
+ type: "function",
52
+ },
53
+ ];
54
+ exports.YIELD_EXTRACTOR_ABI = [
55
+ {
56
+ inputs: [
57
+ {
58
+ components: [
59
+ { internalType: "address", name: "yelayLiteVault", type: "address" },
60
+ {
61
+ internalType: "uint256",
62
+ name: "projectId",
63
+ type: "uint256",
64
+ },
65
+ {
66
+ internalType: "uint256",
67
+ name: "cycle",
68
+ type: "uint256",
69
+ },
70
+ {
71
+ internalType: "uint256",
72
+ name: "yieldSharesTotal",
73
+ type: "uint256",
74
+ },
75
+ {
76
+ internalType: "bytes32[]",
77
+ name: "proof",
78
+ type: "bytes32[]",
79
+ },
80
+ ],
81
+ internalType: "struct YieldExtractor.ClaimRequest[]",
82
+ name: "data",
83
+ type: "tuple[]",
84
+ },
85
+ ],
86
+ name: "claim",
87
+ outputs: [],
88
+ stateMutability: "nonpayable",
89
+ type: "function",
90
+ },
91
+ {
92
+ inputs: [
93
+ {
94
+ internalType: "address",
95
+ name: "user",
96
+ type: "address",
97
+ },
98
+ {
99
+ internalType: "address",
100
+ name: "yelayLiteVault",
101
+ type: "address",
102
+ },
103
+ {
104
+ internalType: "uint256",
105
+ name: "poolID",
106
+ type: "uint256",
107
+ },
108
+ ],
109
+ name: "yieldSharesClaimed",
110
+ outputs: [
111
+ {
112
+ internalType: "uint256",
113
+ name: "",
114
+ type: "uint256",
115
+ },
116
+ ],
117
+ stateMutability: "view",
118
+ type: "function",
119
+ },
120
+ ];
121
+ exports.CONTRACTS_BY_CHAIN = {
122
+ 1: {
123
+ YieldExtractor: "0x226239384EB7d78Cdf279BA6Fb458E2A4945E275",
124
+ },
125
+ 146: {
126
+ YieldExtractor: "0xB84B621D3da3E5e47A1927883C685455Ad731D7C",
127
+ },
128
+ 8453: {
129
+ YieldExtractor: "0x4d6a89dc55d8bacc0cbc3824bd7e44fa051c3958",
130
+ },
131
+ 42161: {
132
+ YieldExtractor: "0x79b7e90F1BAe837362DBD2c83Bd0715c2De5E47f",
133
+ },
134
+ 43114: {
135
+ YieldExtractor: "0x98732e2FEb854bAd400D4b5336f4439E7E53fe88",
136
+ },
137
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./yelayActionProvider";
2
+ export * from "./schemas";
@@ -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("./yelayActionProvider"), exports);
18
+ __exportStar(require("./schemas"), exports);
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Input schema for Yelay Vault deposit action.
4
+ */
5
+ export declare const YelayDepositSchema: z.ZodObject<{
6
+ assets: z.ZodString;
7
+ vaultAddress: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ assets: string;
10
+ vaultAddress: string;
11
+ }, {
12
+ assets: string;
13
+ vaultAddress: string;
14
+ }>;
15
+ /**
16
+ * Input schema for Yelay Vault redeem action.
17
+ */
18
+ export declare const YelayRedeemSchema: z.ZodObject<{
19
+ assets: z.ZodString;
20
+ vaultAddress: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ assets: string;
23
+ vaultAddress: string;
24
+ }, {
25
+ assets: string;
26
+ vaultAddress: string;
27
+ }>;
28
+ /**
29
+ * Input schema for Yelay Vault claim action.
30
+ */
31
+ export declare const YelayClaimSchema: z.ZodObject<{
32
+ vaultAddress: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ vaultAddress: string;
35
+ }, {
36
+ vaultAddress: string;
37
+ }>;
38
+ /**
39
+ * Input schema for Yelay Vault balance action.
40
+ */
41
+ export declare const YelayBalanceSchema: z.ZodObject<{
42
+ vaultAddress: z.ZodString;
43
+ }, "strip", z.ZodTypeAny, {
44
+ vaultAddress: string;
45
+ }, {
46
+ vaultAddress: string;
47
+ }>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YelayBalanceSchema = exports.YelayClaimSchema = exports.YelayRedeemSchema = exports.YelayDepositSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Input schema for Yelay Vault deposit action.
7
+ */
8
+ exports.YelayDepositSchema = zod_1.z
9
+ .object({
10
+ assets: zod_1.z
11
+ .string()
12
+ .regex(/^\d+(\.\d+)?$/, "Must be a valid integer or decimal value")
13
+ .describe("The quantity of assets to deposit"),
14
+ vaultAddress: zod_1.z
15
+ .string()
16
+ .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
17
+ .describe("The vault address which will receive the shares"),
18
+ })
19
+ .describe("Input schema for Yelay Vault deposit action");
20
+ /**
21
+ * Input schema for Yelay Vault redeem action.
22
+ */
23
+ exports.YelayRedeemSchema = zod_1.z
24
+ .object({
25
+ assets: zod_1.z
26
+ .string()
27
+ .regex(/^\d+(\.\d+)?$/, "Must be a valid integer or decimal value")
28
+ .describe("The amount of assets to redeem"),
29
+ vaultAddress: zod_1.z
30
+ .string()
31
+ .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
32
+ .describe("The vault address from which will redeem the shares"),
33
+ })
34
+ .strip()
35
+ .describe("Input schema for Yelay Vault redeem action");
36
+ /**
37
+ * Input schema for Yelay Vault claim action.
38
+ */
39
+ exports.YelayClaimSchema = zod_1.z
40
+ .object({
41
+ vaultAddress: zod_1.z
42
+ .string()
43
+ .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
44
+ .describe("The vault address from which will claim yield"),
45
+ })
46
+ .strip()
47
+ .describe("Input schema for Yelay Vault claim action");
48
+ /**
49
+ * Input schema for Yelay Vault balance action.
50
+ */
51
+ exports.YelayBalanceSchema = zod_1.z
52
+ .object({
53
+ vaultAddress: zod_1.z
54
+ .string()
55
+ .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
56
+ .describe("The vault address where deposit was made"),
57
+ })
58
+ .strip()
59
+ .describe("Input schema for Yelay Vault balance action");
@@ -0,0 +1,24 @@
1
+ export type VaultsDetailsResponse = {
2
+ address: `0x${string}`;
3
+ name: string;
4
+ underlying: `0x${string}`;
5
+ decimals: number;
6
+ chainId: ChainId;
7
+ };
8
+ export type APYResponse = {
9
+ vault: `0x${string}`;
10
+ startBlock: number;
11
+ finishBlock: number;
12
+ startTimestamp: number;
13
+ finishTimestamp: number;
14
+ yield: string;
15
+ apy: string;
16
+ };
17
+ export type ClaimRequest = {
18
+ yelayLiteVault: `0x${string}`;
19
+ projectId: number;
20
+ cycle: number;
21
+ yieldSharesTotal: string;
22
+ proof: string[];
23
+ };
24
+ export type ChainId = "1" | "146" | "8453" | "42161" | "43114";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import { ActionProvider } from "../actionProvider";
3
+ import { Network } from "../../network";
4
+ import { EvmWalletProvider } from "../../wallet-providers";
5
+ import { YelayClaimSchema, YelayDepositSchema, YelayRedeemSchema, YelayBalanceSchema } from "./schemas";
6
+ /**
7
+ * YelayActionProvider provides actions for yelay 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 YelayActionProvider extends ActionProvider<EvmWalletProvider> {
14
+ /**
15
+ * Constructor for the YelayActionProvider.
16
+ */
17
+ constructor();
18
+ /**
19
+ * Gets the details of the Yelay vaults with their last week APY.
20
+ *
21
+ * @param wallet - The wallet instance to get chainId
22
+ * @returns A formatted string containing the list of vaults with their APY.
23
+ */
24
+ getVaults(wallet: EvmWalletProvider): Promise<string>;
25
+ /**
26
+ * Deposits assets into a Yelay Vault
27
+ *
28
+ * @param wallet - The wallet instance to execute the transaction
29
+ * @param args - The input arguments for the action
30
+ * @returns A success message with transaction details or an error message
31
+ */
32
+ deposit(wallet: EvmWalletProvider, args: z.infer<typeof YelayDepositSchema>): Promise<string>;
33
+ /**
34
+ * Redeems assets from a Yelay Vault
35
+ *
36
+ * @param wallet - The wallet instance to execute the transaction
37
+ * @param args - The input arguments for the action
38
+ * @returns A success message with transaction details or an error message
39
+ */
40
+ redeem(wallet: EvmWalletProvider, args: z.infer<typeof YelayRedeemSchema>): Promise<string>;
41
+ /**
42
+ * Claims yield from Yelay
43
+ *
44
+ * @param wallet - The wallet instance to execute the transaction
45
+ * @param args - The input arguments for the action
46
+ * @returns A success message with transaction details or an error message
47
+ */
48
+ claim(wallet: EvmWalletProvider, args: z.infer<typeof YelayClaimSchema>): Promise<string>;
49
+ /**
50
+ * Gets user balance from Yelay
51
+ *
52
+ * @param wallet - The wallet instance to execute the transaction
53
+ * @param args - The input arguments for the action
54
+ * @returns A success message with user postion, generated and claimedyield
55
+ */
56
+ getBalance(wallet: EvmWalletProvider, args: z.infer<typeof YelayBalanceSchema>): Promise<string>;
57
+ /**
58
+ * Checks if this provider supports the given network.
59
+ *
60
+ * @param network - The network to check support for
61
+ * @returns True if the network is supported
62
+ */
63
+ supportsNetwork(network: Network): boolean;
64
+ }
65
+ /**
66
+ * Creates a new YelayActionProvider instance
67
+ *
68
+ * @returns A new YelayActionProvider instance
69
+ */
70
+ export declare const yelayActionProvider: () => YelayActionProvider;