@coinbase/agentkit 0.10.0 → 0.10.2

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 (169) hide show
  1. package/README.md +195 -23
  2. package/dist/action-providers/across/acrossActionProvider.js +3 -3
  3. package/dist/action-providers/across/schemas.d.ts +1 -1
  4. package/dist/action-providers/baseAccount/baseAccountActionProvider.d.ts +46 -0
  5. package/dist/action-providers/baseAccount/baseAccountActionProvider.js +404 -0
  6. package/dist/action-providers/baseAccount/baseAccountActionProvider.test.d.ts +1 -0
  7. package/dist/action-providers/baseAccount/baseAccountActionProvider.test.js +325 -0
  8. package/dist/action-providers/baseAccount/index.d.ts +2 -0
  9. package/dist/action-providers/baseAccount/index.js +18 -0
  10. package/dist/action-providers/baseAccount/schemas.d.ts +43 -0
  11. package/dist/action-providers/baseAccount/schemas.js +62 -0
  12. package/dist/action-providers/baseAccount/types.d.ts +17 -0
  13. package/dist/action-providers/baseAccount/types.js +2 -0
  14. package/dist/action-providers/baseAccount/utils.d.ts +14 -0
  15. package/dist/action-providers/baseAccount/utils.js +57 -0
  16. package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +3 -12
  17. package/dist/action-providers/cdp/cdpApiActionProvider.js +2 -81
  18. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +0 -125
  19. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.d.ts +18 -3
  20. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +224 -23
  21. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +280 -0
  22. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +17 -2
  23. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +224 -18
  24. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +267 -1
  25. package/dist/action-providers/cdp/schemas.d.ts +12 -12
  26. package/dist/action-providers/cdp/schemas.js +17 -5
  27. package/dist/action-providers/cdp/swapUtils.d.ts +23 -0
  28. package/dist/action-providers/cdp/swapUtils.js +106 -0
  29. package/dist/action-providers/clanker/clankerActionProvider.d.ts +43 -0
  30. package/dist/action-providers/clanker/clankerActionProvider.js +130 -0
  31. package/dist/action-providers/clanker/clankerActionProvider.test.d.ts +4 -0
  32. package/dist/action-providers/clanker/clankerActionProvider.test.js +119 -0
  33. package/dist/action-providers/clanker/index.d.ts +2 -0
  34. package/dist/action-providers/clanker/index.js +18 -0
  35. package/dist/action-providers/clanker/schemas.d.ts +56 -0
  36. package/dist/action-providers/clanker/schemas.js +47 -0
  37. package/dist/action-providers/clanker/utils.d.ts +9 -0
  38. package/dist/action-providers/clanker/utils.js +23 -0
  39. package/dist/action-providers/compound/constants.d.ts +1 -1
  40. package/dist/action-providers/compound/constants.js +2 -2
  41. package/dist/action-providers/erc20/constants.d.ts +35 -135
  42. package/dist/action-providers/erc20/constants.js +37 -189
  43. package/dist/action-providers/erc20/erc20ActionProvider.d.ts +9 -1
  44. package/dist/action-providers/erc20/erc20ActionProvider.js +87 -35
  45. package/dist/action-providers/erc20/erc20ActionProvider.test.js +115 -52
  46. package/dist/action-providers/erc20/schemas.d.ts +25 -12
  47. package/dist/action-providers/erc20/schemas.js +34 -6
  48. package/dist/action-providers/erc20/utils.d.ts +19 -0
  49. package/dist/action-providers/erc20/utils.js +54 -0
  50. package/dist/action-providers/flaunch/client_utils.d.ts +25 -0
  51. package/dist/action-providers/flaunch/client_utils.js +62 -0
  52. package/dist/action-providers/flaunch/constants.d.ts +42 -21
  53. package/dist/action-providers/flaunch/constants.js +113 -38
  54. package/dist/action-providers/flaunch/flaunchActionProvider.d.ts +4 -43
  55. package/dist/action-providers/flaunch/flaunchActionProvider.js +133 -209
  56. package/dist/action-providers/flaunch/flaunchActionProvider.test.js +113 -13
  57. package/dist/action-providers/flaunch/metadata_utils.d.ts +12 -0
  58. package/dist/action-providers/flaunch/metadata_utils.js +216 -0
  59. package/dist/action-providers/flaunch/schemas.d.ts +39 -3
  60. package/dist/action-providers/flaunch/schemas.js +62 -10
  61. package/dist/action-providers/flaunch/{utils.d.ts → swap_utils.d.ts} +17 -19
  62. package/dist/action-providers/flaunch/{utils.js → swap_utils.js} +137 -172
  63. package/dist/action-providers/index.d.ts +4 -0
  64. package/dist/action-providers/index.js +4 -0
  65. package/dist/action-providers/jupiter/schemas.d.ts +1 -1
  66. package/dist/action-providers/moonwell/schemas.d.ts +2 -2
  67. package/dist/action-providers/morpho/morphoActionProvider.js +5 -5
  68. package/dist/action-providers/morpho/schemas.d.ts +2 -2
  69. package/dist/action-providers/pyth/pythActionProvider.d.ts +2 -2
  70. package/dist/action-providers/pyth/pythActionProvider.js +83 -26
  71. package/dist/action-providers/pyth/pythActionProvider.test.js +179 -23
  72. package/dist/action-providers/pyth/schemas.d.ts +6 -0
  73. package/dist/action-providers/pyth/schemas.js +9 -1
  74. package/dist/action-providers/superfluid/constants.d.ts +814 -0
  75. package/dist/action-providers/superfluid/constants.js +2826 -0
  76. package/dist/action-providers/superfluid/graphQueries/endpoints.d.ts +2 -0
  77. package/dist/action-providers/superfluid/graphQueries/endpoints.js +5 -0
  78. package/dist/action-providers/superfluid/graphQueries/queries.d.ts +1 -0
  79. package/dist/action-providers/superfluid/graphQueries/queries.js +35 -0
  80. package/dist/action-providers/superfluid/graphQueries/superfluidGraphQueries.d.ts +8 -0
  81. package/dist/action-providers/superfluid/graphQueries/superfluidGraphQueries.js +24 -0
  82. package/dist/action-providers/superfluid/graphQueries/types.d.ts +27 -0
  83. package/dist/action-providers/superfluid/graphQueries/types.js +2 -0
  84. package/dist/action-providers/superfluid/index.d.ts +7 -0
  85. package/dist/action-providers/superfluid/index.js +23 -0
  86. package/dist/action-providers/superfluid/schemas.d.ts +86 -0
  87. package/dist/action-providers/superfluid/schemas.js +103 -0
  88. package/dist/action-providers/superfluid/superfluidActionProvider.d.ts +20 -0
  89. package/dist/action-providers/superfluid/superfluidActionProvider.js +36 -0
  90. package/dist/action-providers/superfluid/superfluidPoolActionProvider.d.ts +46 -0
  91. package/dist/action-providers/superfluid/superfluidPoolActionProvider.js +143 -0
  92. package/dist/action-providers/superfluid/superfluidPoolActionProvider.test.d.ts +1 -0
  93. package/dist/action-providers/superfluid/superfluidPoolActionProvider.test.js +92 -0
  94. package/dist/action-providers/superfluid/superfluidQueryActionProvider.d.ts +27 -0
  95. package/dist/action-providers/superfluid/superfluidQueryActionProvider.js +71 -0
  96. package/dist/action-providers/superfluid/superfluidQueryActionProvider.test.d.ts +1 -0
  97. package/dist/action-providers/superfluid/superfluidQueryActionProvider.test.js +57 -0
  98. package/dist/action-providers/superfluid/superfluidStreamActionProvider.d.ts +56 -0
  99. package/dist/action-providers/superfluid/superfluidStreamActionProvider.js +191 -0
  100. package/dist/action-providers/superfluid/superfluidStreamActionProvider.test.d.ts +1 -0
  101. package/dist/action-providers/superfluid/superfluidStreamActionProvider.test.js +80 -0
  102. package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.d.ts +30 -0
  103. package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.js +109 -0
  104. package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.test.d.ts +1 -0
  105. package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.test.js +75 -0
  106. package/dist/action-providers/superfluid/superfluidWrapperActionProvider.d.ts +32 -0
  107. package/dist/action-providers/superfluid/superfluidWrapperActionProvider.js +101 -0
  108. package/dist/action-providers/superfluid/superfluidWrapperActionProvider.test.d.ts +1 -0
  109. package/dist/action-providers/superfluid/superfluidWrapperActionProvider.test.js +85 -0
  110. package/dist/action-providers/superfluid/utils/parseLogs.d.ts +19 -0
  111. package/dist/action-providers/superfluid/utils/parseLogs.js +81 -0
  112. package/dist/action-providers/truemarkets/truemarketsActionProvider.d.ts +4 -16
  113. package/dist/action-providers/truemarkets/truemarketsActionProvider.js +20 -41
  114. package/dist/action-providers/truemarkets/truemarketsActionProvider.test.js +11 -33
  115. package/dist/action-providers/wallet/walletActionProvider.js +24 -10
  116. package/dist/action-providers/wallet/walletActionProvider.test.js +6 -2
  117. package/dist/action-providers/x402/schemas.d.ts +7 -0
  118. package/dist/action-providers/x402/schemas.js +11 -1
  119. package/dist/action-providers/x402/utils.d.ts +55 -0
  120. package/dist/action-providers/x402/utils.js +160 -0
  121. package/dist/action-providers/x402/x402ActionProvider.d.ts +9 -9
  122. package/dist/action-providers/x402/x402ActionProvider.js +158 -39
  123. package/dist/action-providers/x402/x402ActionProvider.test.js +116 -10
  124. package/dist/action-providers/zeroX/index.d.ts +1 -0
  125. package/dist/action-providers/zeroX/index.js +17 -0
  126. package/dist/action-providers/zeroX/schemas.d.ts +51 -0
  127. package/dist/action-providers/zeroX/schemas.js +82 -0
  128. package/dist/action-providers/zeroX/utils.d.ts +23 -0
  129. package/dist/action-providers/zeroX/utils.js +106 -0
  130. package/dist/action-providers/zeroX/zeroXActionProvider.d.ts +57 -0
  131. package/dist/action-providers/zeroX/zeroXActionProvider.js +407 -0
  132. package/dist/action-providers/zeroX/zeroXActionProvider.test.d.ts +1 -0
  133. package/dist/action-providers/zeroX/zeroXActionProvider.test.js +445 -0
  134. package/dist/utils.d.ts +10 -0
  135. package/dist/utils.js +43 -13
  136. package/dist/wallet-providers/cdpEvmWalletProvider.d.ts +27 -2
  137. package/dist/wallet-providers/cdpEvmWalletProvider.js +54 -36
  138. package/dist/wallet-providers/cdpEvmWalletProvider.test.js +7 -0
  139. package/dist/wallet-providers/cdpShared.d.ts +5 -0
  140. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +29 -3
  141. package/dist/wallet-providers/cdpSmartWalletProvider.js +66 -25
  142. package/dist/wallet-providers/cdpSmartWalletProvider.test.js +6 -10
  143. package/dist/wallet-providers/cdpSolanaWalletProvider.d.ts +1 -1
  144. package/dist/wallet-providers/cdpSolanaWalletProvider.js +7 -7
  145. package/dist/wallet-providers/cdpSolanaWalletProvider.test.js +15 -12
  146. package/dist/wallet-providers/evmWalletProvider.d.ts +13 -2
  147. package/dist/wallet-providers/evmWalletProvider.js +4 -0
  148. package/dist/wallet-providers/legacyCdpSmartWalletProvider.d.ts +18 -2
  149. package/dist/wallet-providers/legacyCdpSmartWalletProvider.js +23 -2
  150. package/dist/wallet-providers/legacyCdpWalletProvider.d.ts +19 -2
  151. package/dist/wallet-providers/legacyCdpWalletProvider.js +27 -2
  152. package/dist/wallet-providers/legacyCdpWalletProvider.test.js +6 -0
  153. package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.d.ts +17 -2
  154. package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.js +39 -3
  155. package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.test.js +1 -1
  156. package/dist/wallet-providers/privyEvmWalletProvider.d.ts +2 -0
  157. package/dist/wallet-providers/privyEvmWalletProvider.js +2 -1
  158. package/dist/wallet-providers/privyEvmWalletProvider.test.js +12 -1
  159. package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +1 -1
  160. package/dist/wallet-providers/solanaKeypairWalletProvider.js +3 -4
  161. package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +4 -2
  162. package/dist/wallet-providers/viemWalletProvider.d.ts +20 -3
  163. package/dist/wallet-providers/viemWalletProvider.js +33 -4
  164. package/dist/wallet-providers/viemWalletProvider.test.js +27 -6
  165. package/dist/wallet-providers/walletProvider.d.ts +1 -1
  166. package/dist/wallet-providers/zeroDevWalletProvider.d.ts +17 -2
  167. package/dist/wallet-providers/zeroDevWalletProvider.js +26 -5
  168. package/dist/wallet-providers/zeroDevWalletProvider.test.js +12 -2
  169. package/package.json +8 -4
@@ -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,4 @@
1
+ /**
2
+ * Clanker Action Provider tests
3
+ */
4
+ export {};
@@ -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,2 @@
1
+ export * from "./clankerActionProvider";
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("./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
+ tokenName: string;
31
+ tokenSymbol: string;
32
+ image: 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
+ tokenName: string;
44
+ tokenSymbol: string;
45
+ image: 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
+ }
@@ -1,5 +1,5 @@
1
1
  import { Address } from "viem";
2
- import { abi as ERC20_ABI } from "../erc20/constants";
2
+ import { erc20Abi as ERC20_ABI } from "viem";
3
3
  export declare const SUPPORTED_NETWORKS: string[];
4
4
  export declare const COMET_ADDRESSES: Record<string, Address>;
5
5
  export declare const ASSET_ADDRESSES: Record<string, Record<string, Address>>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PRICE_FEED_ABI = exports.COMET_ABI = exports.ERC20_ABI = exports.ASSET_ADDRESSES = exports.COMET_ADDRESSES = exports.SUPPORTED_NETWORKS = void 0;
4
- const constants_1 = require("../erc20/constants");
5
- Object.defineProperty(exports, "ERC20_ABI", { enumerable: true, get: function () { return constants_1.abi; } });
4
+ const viem_1 = require("viem");
5
+ Object.defineProperty(exports, "ERC20_ABI", { enumerable: true, get: function () { return viem_1.erc20Abi; } });
6
6
  exports.SUPPORTED_NETWORKS = ["base-mainnet", "base-sepolia"];
7
7
  exports.COMET_ADDRESSES = {
8
8
  "base-mainnet": "0xb125E6687d4313864e53df431d5425969c15Eb2F",
@@ -1,137 +1,37 @@
1
- export declare const abi: readonly [{
2
- readonly type: "event";
3
- readonly name: "Approval";
4
- readonly inputs: readonly [{
5
- readonly indexed: true;
6
- readonly name: "owner";
7
- readonly type: "address";
8
- }, {
9
- readonly indexed: true;
10
- readonly name: "spender";
11
- readonly type: "address";
12
- }, {
13
- readonly indexed: false;
14
- readonly name: "value";
15
- readonly type: "uint256";
16
- }];
17
- }, {
18
- readonly type: "event";
19
- readonly name: "Transfer";
20
- readonly inputs: readonly [{
21
- readonly indexed: true;
22
- readonly name: "from";
23
- readonly type: "address";
24
- }, {
25
- readonly indexed: true;
26
- readonly name: "to";
27
- readonly type: "address";
28
- }, {
29
- readonly indexed: false;
30
- readonly name: "value";
31
- readonly type: "uint256";
32
- }];
33
- }, {
34
- readonly type: "function";
35
- readonly name: "allowance";
36
- readonly stateMutability: "view";
37
- readonly inputs: readonly [{
38
- readonly name: "owner";
39
- readonly type: "address";
40
- }, {
41
- readonly name: "spender";
42
- readonly type: "address";
43
- }];
44
- readonly outputs: readonly [{
45
- readonly type: "uint256";
46
- }];
47
- }, {
48
- readonly type: "function";
49
- readonly name: "approve";
50
- readonly stateMutability: "nonpayable";
51
- readonly inputs: readonly [{
52
- readonly name: "spender";
53
- readonly type: "address";
54
- }, {
55
- readonly name: "amount";
56
- readonly type: "uint256";
57
- }];
58
- readonly outputs: readonly [{
59
- readonly type: "bool";
60
- }];
61
- }, {
62
- readonly type: "function";
63
- readonly name: "balanceOf";
64
- readonly stateMutability: "view";
65
- readonly inputs: readonly [{
66
- readonly name: "account";
67
- readonly type: "address";
68
- }];
69
- readonly outputs: readonly [{
70
- readonly type: "uint256";
71
- }];
72
- }, {
73
- readonly type: "function";
74
- readonly name: "decimals";
75
- readonly stateMutability: "view";
76
- readonly inputs: readonly [];
77
- readonly outputs: readonly [{
78
- readonly type: "uint8";
79
- }];
80
- }, {
81
- readonly type: "function";
82
- readonly name: "name";
83
- readonly stateMutability: "view";
84
- readonly inputs: readonly [];
85
- readonly outputs: readonly [{
86
- readonly type: "string";
87
- }];
88
- }, {
89
- readonly type: "function";
90
- readonly name: "symbol";
91
- readonly stateMutability: "view";
92
- readonly inputs: readonly [];
93
- readonly outputs: readonly [{
94
- readonly type: "string";
95
- }];
96
- }, {
97
- readonly type: "function";
98
- readonly name: "totalSupply";
99
- readonly stateMutability: "view";
100
- readonly inputs: readonly [];
101
- readonly outputs: readonly [{
102
- readonly type: "uint256";
103
- }];
104
- }, {
105
- readonly type: "function";
106
- readonly name: "transfer";
107
- readonly stateMutability: "nonpayable";
108
- readonly inputs: readonly [{
109
- readonly name: "recipient";
110
- readonly type: "address";
111
- }, {
112
- readonly name: "amount";
113
- readonly type: "uint256";
114
- }];
115
- readonly outputs: readonly [{
116
- readonly type: "bool";
117
- }];
118
- }, {
119
- readonly type: "function";
120
- readonly name: "transferFrom";
121
- readonly stateMutability: "nonpayable";
122
- readonly inputs: readonly [{
123
- readonly name: "sender";
124
- readonly type: "address";
125
- }, {
126
- readonly name: "recipient";
127
- readonly type: "address";
128
- }, {
129
- readonly name: "amount";
130
- readonly type: "uint256";
131
- }];
132
- readonly outputs: readonly [{
133
- readonly type: "bool";
134
- }];
135
- }];
136
1
  export declare const BaseTokenToAssetId: Map<string, string>;
137
2
  export declare const BaseSepoliaTokenToAssetId: Map<string, string>;
3
+ export declare const TOKEN_ADDRESSES_BY_SYMBOLS: {
4
+ readonly "base-mainnet": {
5
+ readonly USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
6
+ readonly EURC: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42";
7
+ readonly CBBTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
8
+ readonly CBETH: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22";
9
+ readonly WETH: "0x4200000000000000000000000000000000000006";
10
+ readonly ZORA: "0x1111111111166b7FE7bd91427724B487980aFc69";
11
+ readonly AERO: "0x940181a94a35a4569e4529a3cdfb74e38fd98631";
12
+ readonly BNKR: "0x22af33fe49fd1fa80c7149773dde5890d3c76f3b";
13
+ readonly CLANKER: "0x1bc0c42215582d5a085795f4badbac3ff36d1bcb";
14
+ };
15
+ readonly "base-sepolia": {
16
+ readonly USDC: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
17
+ readonly EURC: "0x808456652fdb597867f38412077A9182bf77359F";
18
+ readonly CBBTC: "0xcbB7C0006F23900c38EB856149F799620fcb8A4a";
19
+ readonly WETH: "0x4200000000000000000000000000000000000006";
20
+ };
21
+ readonly "ethereum-mainnet": {
22
+ readonly USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
23
+ readonly EURC: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c";
24
+ readonly CBBTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
25
+ readonly WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
26
+ readonly CBETH: "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704";
27
+ };
28
+ readonly "polygon-mainnet": {
29
+ readonly USDC: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359";
30
+ };
31
+ readonly "arbitrum-mainnet": {
32
+ readonly USDC: "0xaf88d065e77c8cc2239327c5edb3a432268e5831";
33
+ };
34
+ readonly "optimism-mainnet": {
35
+ readonly USDC: "0x0b2c639c533813f4aa9d7837caf62653d097ff85";
36
+ };
37
+ };