@coinbase/agentkit 0.10.1 → 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 (127) hide show
  1. package/README.md +179 -40
  2. package/dist/action-providers/across/schemas.d.ts +1 -1
  3. package/dist/action-providers/baseAccount/baseAccountActionProvider.d.ts +46 -0
  4. package/dist/action-providers/baseAccount/baseAccountActionProvider.js +404 -0
  5. package/dist/action-providers/baseAccount/baseAccountActionProvider.test.d.ts +1 -0
  6. package/dist/action-providers/baseAccount/baseAccountActionProvider.test.js +325 -0
  7. package/dist/action-providers/baseAccount/index.d.ts +2 -0
  8. package/dist/action-providers/baseAccount/index.js +18 -0
  9. package/dist/action-providers/baseAccount/schemas.d.ts +43 -0
  10. package/dist/action-providers/baseAccount/schemas.js +62 -0
  11. package/dist/action-providers/baseAccount/types.d.ts +17 -0
  12. package/dist/action-providers/baseAccount/types.js +2 -0
  13. package/dist/action-providers/baseAccount/utils.d.ts +14 -0
  14. package/dist/action-providers/baseAccount/utils.js +57 -0
  15. package/dist/action-providers/cdp/cdpApiActionProvider.js +7 -30
  16. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +2 -8
  17. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +2 -1
  18. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +3 -1
  19. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +2 -1
  20. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +3 -1
  21. package/dist/action-providers/cdp/faucetUtils.d.ts +38 -0
  22. package/dist/action-providers/cdp/faucetUtils.js +81 -0
  23. package/dist/action-providers/cdp/swapUtils.d.ts +0 -9
  24. package/dist/action-providers/cdp/swapUtils.js +0 -36
  25. package/dist/action-providers/clanker/schemas.d.ts +6 -6
  26. package/dist/action-providers/enso/constants.d.ts +4 -0
  27. package/dist/action-providers/enso/constants.js +10 -0
  28. package/dist/action-providers/enso/ensoActionProvider.d.ts +34 -0
  29. package/dist/action-providers/enso/ensoActionProvider.js +125 -0
  30. package/dist/action-providers/enso/ensoActionProvider.test.d.ts +1 -0
  31. package/dist/action-providers/enso/ensoActionProvider.test.js +141 -0
  32. package/dist/action-providers/enso/index.d.ts +1 -0
  33. package/dist/action-providers/enso/index.js +17 -0
  34. package/dist/action-providers/enso/schemas.d.ts +23 -0
  35. package/dist/action-providers/enso/schemas.js +22 -0
  36. package/dist/action-providers/erc20/constants.d.ts +2 -0
  37. package/dist/action-providers/erc20/constants.js +2 -0
  38. package/dist/action-providers/erc20/erc20ActionProvider.d.ts +17 -1
  39. package/dist/action-providers/erc20/erc20ActionProvider.js +103 -1
  40. package/dist/action-providers/erc20/erc20ActionProvider.test.js +201 -0
  41. package/dist/action-providers/erc20/schemas.d.ts +29 -0
  42. package/dist/action-providers/erc20/schemas.js +34 -1
  43. package/dist/action-providers/flaunch/client_utils.d.ts +25 -0
  44. package/dist/action-providers/flaunch/client_utils.js +62 -0
  45. package/dist/action-providers/flaunch/constants.d.ts +41 -20
  46. package/dist/action-providers/flaunch/constants.js +111 -36
  47. package/dist/action-providers/flaunch/flaunchActionProvider.d.ts +4 -43
  48. package/dist/action-providers/flaunch/flaunchActionProvider.js +132 -200
  49. package/dist/action-providers/flaunch/flaunchActionProvider.test.js +108 -13
  50. package/dist/action-providers/flaunch/metadata_utils.d.ts +12 -0
  51. package/dist/action-providers/flaunch/metadata_utils.js +216 -0
  52. package/dist/action-providers/flaunch/schemas.d.ts +39 -3
  53. package/dist/action-providers/flaunch/schemas.js +62 -10
  54. package/dist/action-providers/flaunch/{utils.d.ts → swap_utils.d.ts} +17 -19
  55. package/dist/action-providers/flaunch/{utils.js → swap_utils.js} +137 -172
  56. package/dist/action-providers/index.d.ts +4 -1
  57. package/dist/action-providers/index.js +4 -1
  58. package/dist/action-providers/pyth/pythActionProvider.d.ts +2 -2
  59. package/dist/action-providers/pyth/pythActionProvider.js +83 -31
  60. package/dist/action-providers/pyth/pythActionProvider.test.js +178 -26
  61. package/dist/action-providers/pyth/schemas.d.ts +6 -0
  62. package/dist/action-providers/pyth/schemas.js +9 -1
  63. package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.js +5 -4
  64. package/dist/action-providers/superfluid/utils/parseLogs.d.ts +2 -1
  65. package/dist/action-providers/superfluid/utils/parseLogs.js +6 -3
  66. package/dist/action-providers/wallet/walletActionProvider.js +4 -1
  67. package/dist/action-providers/weth/constants.d.ts +0 -1
  68. package/dist/action-providers/weth/constants.js +1 -2
  69. package/dist/action-providers/weth/schemas.js +6 -2
  70. package/dist/action-providers/weth/wethActionProvider.d.ts +7 -0
  71. package/dist/action-providers/weth/wethActionProvider.js +57 -32
  72. package/dist/action-providers/weth/wethActionProvider.test.js +60 -11
  73. package/dist/action-providers/x402/schemas.d.ts +7 -0
  74. package/dist/action-providers/x402/schemas.js +11 -1
  75. package/dist/action-providers/x402/utils.d.ts +55 -0
  76. package/dist/action-providers/x402/utils.js +197 -0
  77. package/dist/action-providers/x402/x402ActionProvider.d.ts +14 -14
  78. package/dist/action-providers/x402/x402ActionProvider.js +179 -45
  79. package/dist/action-providers/x402/x402ActionProvider.test.js +162 -12
  80. package/dist/action-providers/yelay/constants.d.ts +64 -0
  81. package/dist/action-providers/yelay/constants.js +137 -0
  82. package/dist/action-providers/yelay/index.d.ts +2 -0
  83. package/dist/action-providers/yelay/index.js +18 -0
  84. package/dist/action-providers/yelay/schemas.d.ts +47 -0
  85. package/dist/action-providers/yelay/schemas.js +59 -0
  86. package/dist/action-providers/yelay/types.d.ts +24 -0
  87. package/dist/action-providers/yelay/types.js +2 -0
  88. package/dist/action-providers/yelay/yelayActionProvider.d.ts +70 -0
  89. package/dist/action-providers/yelay/yelayActionProvider.js +329 -0
  90. package/dist/action-providers/yelay/yelayActionProvider.test.d.ts +1 -0
  91. package/dist/action-providers/yelay/yelayActionProvider.test.js +302 -0
  92. package/dist/utils.d.ts +10 -0
  93. package/dist/utils.js +43 -13
  94. package/dist/wallet-providers/cdpEvmWalletProvider.d.ts +7 -0
  95. package/dist/wallet-providers/cdpEvmWalletProvider.js +14 -21
  96. package/dist/wallet-providers/cdpEvmWalletProvider.test.js +7 -0
  97. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +7 -0
  98. package/dist/wallet-providers/cdpSmartWalletProvider.js +23 -8
  99. package/dist/wallet-providers/cdpSmartWalletProvider.test.js +6 -10
  100. package/dist/wallet-providers/cdpSolanaWalletProvider.d.ts +14 -0
  101. package/dist/wallet-providers/cdpSolanaWalletProvider.js +39 -3
  102. package/dist/wallet-providers/cdpSolanaWalletProvider.test.js +16 -0
  103. package/dist/wallet-providers/evmWalletProvider.d.ts +9 -2
  104. package/dist/wallet-providers/evmWalletProvider.js +4 -0
  105. package/dist/wallet-providers/legacyCdpSmartWalletProvider.d.ts +9 -0
  106. package/dist/wallet-providers/legacyCdpSmartWalletProvider.js +11 -0
  107. package/dist/wallet-providers/legacyCdpWalletProvider.d.ts +7 -0
  108. package/dist/wallet-providers/legacyCdpWalletProvider.js +16 -0
  109. package/dist/wallet-providers/legacyCdpWalletProvider.test.js +6 -0
  110. package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.d.ts +7 -0
  111. package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.js +27 -0
  112. package/dist/wallet-providers/privyEvmWalletProvider.test.js +11 -0
  113. package/dist/wallet-providers/privySvmWalletProvider.d.ts +14 -0
  114. package/dist/wallet-providers/privySvmWalletProvider.js +17 -0
  115. package/dist/wallet-providers/privySvmWalletProvider.test.js +10 -0
  116. package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +14 -0
  117. package/dist/wallet-providers/solanaKeypairWalletProvider.js +17 -0
  118. package/dist/wallet-providers/svmWalletProvider.d.ts +34 -0
  119. package/dist/wallet-providers/svmWalletProvider.js +43 -0
  120. package/dist/wallet-providers/svmWalletProvider.test.js +10 -0
  121. package/dist/wallet-providers/viemWalletProvider.d.ts +8 -1
  122. package/dist/wallet-providers/viemWalletProvider.js +21 -1
  123. package/dist/wallet-providers/viemWalletProvider.test.js +21 -1
  124. package/dist/wallet-providers/zeroDevWalletProvider.d.ts +7 -0
  125. package/dist/wallet-providers/zeroDevWalletProvider.js +12 -0
  126. package/dist/wallet-providers/zeroDevWalletProvider.test.js +10 -0
  127. package/package.json +8 -4
@@ -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;