@coinbase/agentkit 0.0.0-nightly-20250328174338

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 (292) hide show
  1. package/README.md +827 -0
  2. package/dist/action-providers/across/acrossActionProvider.d.ts +50 -0
  3. package/dist/action-providers/across/acrossActionProvider.js +333 -0
  4. package/dist/action-providers/across/acrossActionProvider.test.d.ts +1 -0
  5. package/dist/action-providers/across/acrossActionProvider.test.js +391 -0
  6. package/dist/action-providers/across/constants.d.ts +1 -0
  7. package/dist/action-providers/across/constants.js +2 -0
  8. package/dist/action-providers/across/index.d.ts +1 -0
  9. package/dist/action-providers/across/index.js +17 -0
  10. package/dist/action-providers/across/schemas.d.ts +36 -0
  11. package/dist/action-providers/across/schemas.js +46 -0
  12. package/dist/action-providers/across/utils.d.ts +7 -0
  13. package/dist/action-providers/across/utils.js +25 -0
  14. package/dist/action-providers/actionDecorator.d.ts +69 -0
  15. package/dist/action-providers/actionDecorator.js +96 -0
  16. package/dist/action-providers/actionProvider.d.ts +48 -0
  17. package/dist/action-providers/actionProvider.js +62 -0
  18. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.d.ts +55 -0
  19. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.js +173 -0
  20. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.d.ts +1 -0
  21. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.js +131 -0
  22. package/dist/action-providers/alchemy/index.d.ts +2 -0
  23. package/dist/action-providers/alchemy/index.js +18 -0
  24. package/dist/action-providers/alchemy/schemas.d.ts +41 -0
  25. package/dist/action-providers/alchemy/schemas.js +34 -0
  26. package/dist/action-providers/allora/alloraActionProvider.d.ts +44 -0
  27. package/dist/action-providers/allora/alloraActionProvider.js +195 -0
  28. package/dist/action-providers/allora/alloraActionProvider.test.d.ts +1 -0
  29. package/dist/action-providers/allora/alloraActionProvider.test.js +109 -0
  30. package/dist/action-providers/allora/index.d.ts +2 -0
  31. package/dist/action-providers/allora/index.js +18 -0
  32. package/dist/action-providers/allora/schemas.d.ts +28 -0
  33. package/dist/action-providers/allora/schemas.js +30 -0
  34. package/dist/action-providers/basename/basenameActionProvider.d.ts +30 -0
  35. package/dist/action-providers/basename/basenameActionProvider.js +109 -0
  36. package/dist/action-providers/basename/basenameActionProvider.test.d.ts +1 -0
  37. package/dist/action-providers/basename/basenameActionProvider.test.js +146 -0
  38. package/dist/action-providers/basename/constants.d.ts +52 -0
  39. package/dist/action-providers/basename/constants.js +81 -0
  40. package/dist/action-providers/basename/index.d.ts +2 -0
  41. package/dist/action-providers/basename/index.js +18 -0
  42. package/dist/action-providers/basename/schemas.d.ts +14 -0
  43. package/dist/action-providers/basename/schemas.js +14 -0
  44. package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +43 -0
  45. package/dist/action-providers/cdp/cdpApiActionProvider.js +128 -0
  46. package/dist/action-providers/cdp/cdpApiActionProvider.test.d.ts +1 -0
  47. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +146 -0
  48. package/dist/action-providers/cdp/cdpWalletActionProvider.d.ts +58 -0
  49. package/dist/action-providers/cdp/cdpWalletActionProvider.js +224 -0
  50. package/dist/action-providers/cdp/cdpWalletActionProvider.test.d.ts +1 -0
  51. package/dist/action-providers/cdp/cdpWalletActionProvider.test.js +267 -0
  52. package/dist/action-providers/cdp/constants.d.ts +31 -0
  53. package/dist/action-providers/cdp/constants.js +34 -0
  54. package/dist/action-providers/cdp/index.d.ts +3 -0
  55. package/dist/action-providers/cdp/index.js +19 -0
  56. package/dist/action-providers/cdp/schemas.d.ts +91 -0
  57. package/dist/action-providers/cdp/schemas.js +77 -0
  58. package/dist/action-providers/compound/compoundActionProvider.d.ts +67 -0
  59. package/dist/action-providers/compound/compoundActionProvider.js +365 -0
  60. package/dist/action-providers/compound/compoundActionProvider.test.d.ts +1 -0
  61. package/dist/action-providers/compound/compoundActionProvider.test.js +353 -0
  62. package/dist/action-providers/compound/constants.d.ts +180 -0
  63. package/dist/action-providers/compound/constants.js +129 -0
  64. package/dist/action-providers/compound/index.d.ts +1 -0
  65. package/dist/action-providers/compound/index.js +17 -0
  66. package/dist/action-providers/compound/schemas.d.ts +57 -0
  67. package/dist/action-providers/compound/schemas.js +58 -0
  68. package/dist/action-providers/compound/utils.d.ts +95 -0
  69. package/dist/action-providers/compound/utils.js +353 -0
  70. package/dist/action-providers/customActionProvider.d.ts +30 -0
  71. package/dist/action-providers/customActionProvider.js +66 -0
  72. package/dist/action-providers/defillama/constants.d.ts +8 -0
  73. package/dist/action-providers/defillama/constants.js +11 -0
  74. package/dist/action-providers/defillama/defillamaActionProvider.d.ts +54 -0
  75. package/dist/action-providers/defillama/defillamaActionProvider.js +180 -0
  76. package/dist/action-providers/defillama/defillamaActionProvider.test.d.ts +1 -0
  77. package/dist/action-providers/defillama/defillamaActionProvider.test.js +114 -0
  78. package/dist/action-providers/defillama/index.d.ts +1 -0
  79. package/dist/action-providers/defillama/index.js +17 -0
  80. package/dist/action-providers/defillama/schemas.d.ts +34 -0
  81. package/dist/action-providers/defillama/schemas.js +34 -0
  82. package/dist/action-providers/defillama/types.d.ts +73 -0
  83. package/dist/action-providers/defillama/types.js +2 -0
  84. package/dist/action-providers/defillama/utils.d.ts +10 -0
  85. package/dist/action-providers/defillama/utils.js +87 -0
  86. package/dist/action-providers/defillama/utils.test.d.ts +1 -0
  87. package/dist/action-providers/defillama/utils.test.js +124 -0
  88. package/dist/action-providers/erc20/constants.d.ts +137 -0
  89. package/dist/action-providers/erc20/constants.js +202 -0
  90. package/dist/action-providers/erc20/erc20ActionProvider.d.ts +38 -0
  91. package/dist/action-providers/erc20/erc20ActionProvider.js +142 -0
  92. package/dist/action-providers/erc20/erc20ActionProvider.test.d.ts +1 -0
  93. package/dist/action-providers/erc20/erc20ActionProvider.test.js +131 -0
  94. package/dist/action-providers/erc20/index.d.ts +1 -0
  95. package/dist/action-providers/erc20/index.js +17 -0
  96. package/dist/action-providers/erc20/schemas.d.ts +27 -0
  97. package/dist/action-providers/erc20/schemas.js +26 -0
  98. package/dist/action-providers/erc721/constants.d.ts +232 -0
  99. package/dist/action-providers/erc721/constants.js +298 -0
  100. package/dist/action-providers/erc721/erc721ActionProvider.d.ts +46 -0
  101. package/dist/action-providers/erc721/erc721ActionProvider.js +164 -0
  102. package/dist/action-providers/erc721/erc721ActionProvider.test.d.ts +1 -0
  103. package/dist/action-providers/erc721/erc721ActionProvider.test.js +137 -0
  104. package/dist/action-providers/erc721/index.d.ts +1 -0
  105. package/dist/action-providers/erc721/index.js +17 -0
  106. package/dist/action-providers/erc721/schemas.d.ts +46 -0
  107. package/dist/action-providers/erc721/schemas.js +44 -0
  108. package/dist/action-providers/farcaster/farcasterActionProvider.d.ts +57 -0
  109. package/dist/action-providers/farcaster/farcasterActionProvider.js +142 -0
  110. package/dist/action-providers/farcaster/farcasterActionProvider.test.d.ts +1 -0
  111. package/dist/action-providers/farcaster/farcasterActionProvider.test.js +151 -0
  112. package/dist/action-providers/farcaster/index.d.ts +2 -0
  113. package/dist/action-providers/farcaster/index.js +18 -0
  114. package/dist/action-providers/farcaster/schemas.d.ts +15 -0
  115. package/dist/action-providers/farcaster/schemas.js +20 -0
  116. package/dist/action-providers/index.d.ts +24 -0
  117. package/dist/action-providers/index.js +40 -0
  118. package/dist/action-providers/jupiter/index.d.ts +1 -0
  119. package/dist/action-providers/jupiter/index.js +17 -0
  120. package/dist/action-providers/jupiter/jupiterActionProvider.d.ts +36 -0
  121. package/dist/action-providers/jupiter/jupiterActionProvider.js +115 -0
  122. package/dist/action-providers/jupiter/jupiterActionProvider.test.d.ts +1 -0
  123. package/dist/action-providers/jupiter/jupiterActionProvider.test.js +146 -0
  124. package/dist/action-providers/jupiter/schemas.d.ts +20 -0
  125. package/dist/action-providers/jupiter/schemas.js +20 -0
  126. package/dist/action-providers/messari/constants.d.ts +17 -0
  127. package/dist/action-providers/messari/constants.js +20 -0
  128. package/dist/action-providers/messari/index.d.ts +5 -0
  129. package/dist/action-providers/messari/index.js +21 -0
  130. package/dist/action-providers/messari/messariActionProvider.d.ts +42 -0
  131. package/dist/action-providers/messari/messariActionProvider.js +128 -0
  132. package/dist/action-providers/messari/messariActionProvider.test.d.ts +1 -0
  133. package/dist/action-providers/messari/messariActionProvider.test.js +152 -0
  134. package/dist/action-providers/messari/schemas.d.ts +11 -0
  135. package/dist/action-providers/messari/schemas.js +16 -0
  136. package/dist/action-providers/messari/types.d.ts +40 -0
  137. package/dist/action-providers/messari/types.js +2 -0
  138. package/dist/action-providers/messari/utils.d.ts +22 -0
  139. package/dist/action-providers/messari/utils.js +65 -0
  140. package/dist/action-providers/moonwell/constants.d.ts +78 -0
  141. package/dist/action-providers/moonwell/constants.js +111 -0
  142. package/dist/action-providers/moonwell/index.d.ts +1 -0
  143. package/dist/action-providers/moonwell/index.js +5 -0
  144. package/dist/action-providers/moonwell/moonwellActionProvider.d.ts +39 -0
  145. package/dist/action-providers/moonwell/moonwellActionProvider.js +249 -0
  146. package/dist/action-providers/moonwell/moonwellActionProvider.test.d.ts +1 -0
  147. package/dist/action-providers/moonwell/moonwellActionProvider.test.js +455 -0
  148. package/dist/action-providers/moonwell/schemas.d.ts +30 -0
  149. package/dist/action-providers/moonwell/schemas.js +39 -0
  150. package/dist/action-providers/morpho/constants.d.ts +16 -0
  151. package/dist/action-providers/morpho/constants.js +27 -0
  152. package/dist/action-providers/morpho/index.d.ts +2 -0
  153. package/dist/action-providers/morpho/index.js +18 -0
  154. package/dist/action-providers/morpho/morphoActionProvider.d.ts +39 -0
  155. package/dist/action-providers/morpho/morphoActionProvider.js +154 -0
  156. package/dist/action-providers/morpho/morphoActionProvider.test.d.ts +1 -0
  157. package/dist/action-providers/morpho/morphoActionProvider.test.js +128 -0
  158. package/dist/action-providers/morpho/schemas.d.ts +36 -0
  159. package/dist/action-providers/morpho/schemas.js +47 -0
  160. package/dist/action-providers/opensea/index.d.ts +1 -0
  161. package/dist/action-providers/opensea/index.js +17 -0
  162. package/dist/action-providers/opensea/openseaActionProvider.d.ts +59 -0
  163. package/dist/action-providers/opensea/openseaActionProvider.js +146 -0
  164. package/dist/action-providers/opensea/openseaActionProvider.test.d.ts +1 -0
  165. package/dist/action-providers/opensea/openseaActionProvider.test.js +201 -0
  166. package/dist/action-providers/opensea/schemas.d.ts +30 -0
  167. package/dist/action-providers/opensea/schemas.js +33 -0
  168. package/dist/action-providers/opensea/utils.d.ts +12 -0
  169. package/dist/action-providers/opensea/utils.js +47 -0
  170. package/dist/action-providers/pyth/index.d.ts +2 -0
  171. package/dist/action-providers/pyth/index.js +18 -0
  172. package/dist/action-providers/pyth/pythActionProvider.d.ts +33 -0
  173. package/dist/action-providers/pyth/pythActionProvider.js +121 -0
  174. package/dist/action-providers/pyth/pythActionProvider.test.d.ts +1 -0
  175. package/dist/action-providers/pyth/pythActionProvider.test.js +113 -0
  176. package/dist/action-providers/pyth/schemas.d.ts +21 -0
  177. package/dist/action-providers/pyth/schemas.js +20 -0
  178. package/dist/action-providers/spl/index.d.ts +1 -0
  179. package/dist/action-providers/spl/index.js +17 -0
  180. package/dist/action-providers/spl/schemas.d.ts +30 -0
  181. package/dist/action-providers/spl/schemas.js +26 -0
  182. package/dist/action-providers/spl/splActionProvider.d.ts +45 -0
  183. package/dist/action-providers/spl/splActionProvider.js +173 -0
  184. package/dist/action-providers/spl/splActionProvider.test.d.ts +1 -0
  185. package/dist/action-providers/spl/splActionProvider.test.js +300 -0
  186. package/dist/action-providers/twitter/index.d.ts +2 -0
  187. package/dist/action-providers/twitter/index.js +18 -0
  188. package/dist/action-providers/twitter/schemas.d.ts +38 -0
  189. package/dist/action-providers/twitter/schemas.js +44 -0
  190. package/dist/action-providers/twitter/twitterActionProvider.d.ts +82 -0
  191. package/dist/action-providers/twitter/twitterActionProvider.js +204 -0
  192. package/dist/action-providers/twitter/twitterActionProvider.test.d.ts +1 -0
  193. package/dist/action-providers/twitter/twitterActionProvider.test.js +185 -0
  194. package/dist/action-providers/wallet/index.d.ts +1 -0
  195. package/dist/action-providers/wallet/index.js +17 -0
  196. package/dist/action-providers/wallet/schemas.d.ts +19 -0
  197. package/dist/action-providers/wallet/schemas.js +19 -0
  198. package/dist/action-providers/wallet/walletActionProvider.d.ts +44 -0
  199. package/dist/action-providers/wallet/walletActionProvider.js +140 -0
  200. package/dist/action-providers/wallet/walletActionProvider.test.d.ts +1 -0
  201. package/dist/action-providers/wallet/walletActionProvider.test.js +194 -0
  202. package/dist/action-providers/weth/constants.d.ts +19 -0
  203. package/dist/action-providers/weth/constants.js +29 -0
  204. package/dist/action-providers/weth/index.d.ts +1 -0
  205. package/dist/action-providers/weth/index.js +17 -0
  206. package/dist/action-providers/weth/schemas.d.ts +8 -0
  207. package/dist/action-providers/weth/schemas.js +10 -0
  208. package/dist/action-providers/weth/wethActionProvider.d.ts +30 -0
  209. package/dist/action-providers/weth/wethActionProvider.js +89 -0
  210. package/dist/action-providers/weth/wethActionProvider.test.d.ts +1 -0
  211. package/dist/action-providers/weth/wethActionProvider.test.js +92 -0
  212. package/dist/action-providers/wow/constants.d.ts +15 -0
  213. package/dist/action-providers/wow/constants.js +844 -0
  214. package/dist/action-providers/wow/index.d.ts +2 -0
  215. package/dist/action-providers/wow/index.js +18 -0
  216. package/dist/action-providers/wow/schemas.d.ts +43 -0
  217. package/dist/action-providers/wow/schemas.js +47 -0
  218. package/dist/action-providers/wow/uniswap/constants.d.ts +3 -0
  219. package/dist/action-providers/wow/uniswap/constants.js +100 -0
  220. package/dist/action-providers/wow/uniswap/utils.d.ts +82 -0
  221. package/dist/action-providers/wow/uniswap/utils.js +226 -0
  222. package/dist/action-providers/wow/utils.d.ts +27 -0
  223. package/dist/action-providers/wow/utils.js +63 -0
  224. package/dist/action-providers/wow/wowActionProvider.d.ts +46 -0
  225. package/dist/action-providers/wow/wowActionProvider.js +223 -0
  226. package/dist/action-providers/wow/wowActionProvider.test.d.ts +1 -0
  227. package/dist/action-providers/wow/wowActionProvider.test.js +291 -0
  228. package/dist/agentkit.d.ts +44 -0
  229. package/dist/agentkit.js +68 -0
  230. package/dist/analytics/index.d.ts +1 -0
  231. package/dist/analytics/index.js +17 -0
  232. package/dist/analytics/sendAnalyticsEvent.d.ts +31 -0
  233. package/dist/analytics/sendAnalyticsEvent.js +52 -0
  234. package/dist/index.d.ts +4 -0
  235. package/dist/index.js +20 -0
  236. package/dist/network/index.d.ts +3 -0
  237. package/dist/network/index.js +19 -0
  238. package/dist/network/network.d.ts +20 -0
  239. package/dist/network/network.js +86 -0
  240. package/dist/network/svm.d.ts +15 -0
  241. package/dist/network/svm.js +38 -0
  242. package/dist/network/types.d.ts +17 -0
  243. package/dist/network/types.js +2 -0
  244. package/dist/utils.d.ts +22 -0
  245. package/dist/utils.js +57 -0
  246. package/dist/utils.test.d.ts +1 -0
  247. package/dist/utils.test.js +50 -0
  248. package/dist/wallet-providers/cdpWalletProvider.d.ts +246 -0
  249. package/dist/wallet-providers/cdpWalletProvider.js +421 -0
  250. package/dist/wallet-providers/cdpWalletProvider.test.d.ts +1 -0
  251. package/dist/wallet-providers/cdpWalletProvider.test.js +701 -0
  252. package/dist/wallet-providers/evmWalletProvider.d.ts +51 -0
  253. package/dist/wallet-providers/evmWalletProvider.js +14 -0
  254. package/dist/wallet-providers/evmWalletProvider.test.d.ts +1 -0
  255. package/dist/wallet-providers/evmWalletProvider.test.js +56 -0
  256. package/dist/wallet-providers/index.d.ts +10 -0
  257. package/dist/wallet-providers/index.js +26 -0
  258. package/dist/wallet-providers/privyEvmWalletProvider.d.ts +55 -0
  259. package/dist/wallet-providers/privyEvmWalletProvider.js +140 -0
  260. package/dist/wallet-providers/privyEvmWalletProvider.test.d.ts +1 -0
  261. package/dist/wallet-providers/privyEvmWalletProvider.test.js +331 -0
  262. package/dist/wallet-providers/privyShared.d.ts +40 -0
  263. package/dist/wallet-providers/privyShared.js +49 -0
  264. package/dist/wallet-providers/privySvmWalletProvider.d.ts +128 -0
  265. package/dist/wallet-providers/privySvmWalletProvider.js +212 -0
  266. package/dist/wallet-providers/privySvmWalletProvider.test.d.ts +1 -0
  267. package/dist/wallet-providers/privySvmWalletProvider.test.js +310 -0
  268. package/dist/wallet-providers/privyWalletProvider.d.ts +35 -0
  269. package/dist/wallet-providers/privyWalletProvider.js +39 -0
  270. package/dist/wallet-providers/privyWalletProvider.test.d.ts +1 -0
  271. package/dist/wallet-providers/privyWalletProvider.test.js +124 -0
  272. package/dist/wallet-providers/smartWalletProvider.d.ts +177 -0
  273. package/dist/wallet-providers/smartWalletProvider.js +303 -0
  274. package/dist/wallet-providers/smartWalletProvider.test.d.ts +1 -0
  275. package/dist/wallet-providers/smartWalletProvider.test.js +388 -0
  276. package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +143 -0
  277. package/dist/wallet-providers/solanaKeypairWalletProvider.js +280 -0
  278. package/dist/wallet-providers/solanaKeypairWalletProvider.test.d.ts +1 -0
  279. package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +218 -0
  280. package/dist/wallet-providers/svmWalletProvider.d.ts +56 -0
  281. package/dist/wallet-providers/svmWalletProvider.js +13 -0
  282. package/dist/wallet-providers/svmWalletProvider.test.d.ts +1 -0
  283. package/dist/wallet-providers/svmWalletProvider.test.js +55 -0
  284. package/dist/wallet-providers/viemWalletProvider.d.ts +103 -0
  285. package/dist/wallet-providers/viemWalletProvider.js +206 -0
  286. package/dist/wallet-providers/viemWalletProvider.test.d.ts +1 -0
  287. package/dist/wallet-providers/viemWalletProvider.test.js +338 -0
  288. package/dist/wallet-providers/walletProvider.d.ts +48 -0
  289. package/dist/wallet-providers/walletProvider.js +41 -0
  290. package/dist/wallet-providers/walletProvider.test.d.ts +1 -0
  291. package/dist/wallet-providers/walletProvider.test.js +103 -0
  292. package/package.json +83 -0
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERC721_ABI = void 0;
4
+ exports.ERC721_ABI = [
5
+ {
6
+ inputs: [{ internalType: "address", name: "to", type: "address" }],
7
+ name: "mint",
8
+ outputs: [],
9
+ payable: false,
10
+ stateMutability: "nonpayable",
11
+ type: "function",
12
+ },
13
+ {
14
+ inputs: [
15
+ {
16
+ internalType: "bytes4",
17
+ name: "interfaceId",
18
+ type: "bytes4",
19
+ },
20
+ ],
21
+ name: "supportsInterface",
22
+ outputs: [
23
+ {
24
+ internalType: "bool",
25
+ name: "",
26
+ type: "bool",
27
+ },
28
+ ],
29
+ stateMutability: "view",
30
+ type: "function",
31
+ },
32
+ {
33
+ anonymous: false,
34
+ inputs: [
35
+ {
36
+ indexed: true,
37
+ internalType: "address",
38
+ name: "from",
39
+ type: "address",
40
+ },
41
+ {
42
+ indexed: true,
43
+ internalType: "address",
44
+ name: "to",
45
+ type: "address",
46
+ },
47
+ {
48
+ indexed: true,
49
+ internalType: "uint256",
50
+ name: "tokenId",
51
+ type: "uint256",
52
+ },
53
+ ],
54
+ name: "Transfer",
55
+ type: "event",
56
+ },
57
+ {
58
+ anonymous: false,
59
+ inputs: [
60
+ {
61
+ indexed: true,
62
+ internalType: "address",
63
+ name: "owner",
64
+ type: "address",
65
+ },
66
+ {
67
+ indexed: true,
68
+ internalType: "address",
69
+ name: "approved",
70
+ type: "address",
71
+ },
72
+ {
73
+ indexed: true,
74
+ internalType: "uint256",
75
+ name: "tokenId",
76
+ type: "uint256",
77
+ },
78
+ ],
79
+ name: "Approval",
80
+ type: "event",
81
+ },
82
+ {
83
+ anonymous: false,
84
+ inputs: [
85
+ {
86
+ indexed: true,
87
+ internalType: "address",
88
+ name: "owner",
89
+ type: "address",
90
+ },
91
+ {
92
+ indexed: true,
93
+ internalType: "address",
94
+ name: "operator",
95
+ type: "address",
96
+ },
97
+ {
98
+ indexed: false,
99
+ internalType: "bool",
100
+ name: "approved",
101
+ type: "bool",
102
+ },
103
+ ],
104
+ name: "ApprovalForAll",
105
+ type: "event",
106
+ },
107
+ {
108
+ inputs: [
109
+ {
110
+ internalType: "address",
111
+ name: "owner",
112
+ type: "address",
113
+ },
114
+ ],
115
+ name: "balanceOf",
116
+ outputs: [
117
+ {
118
+ internalType: "uint256",
119
+ name: "balance",
120
+ type: "uint256",
121
+ },
122
+ ],
123
+ stateMutability: "view",
124
+ type: "function",
125
+ },
126
+ {
127
+ inputs: [
128
+ {
129
+ internalType: "uint256",
130
+ name: "tokenId",
131
+ type: "uint256",
132
+ },
133
+ ],
134
+ name: "ownerOf",
135
+ outputs: [
136
+ {
137
+ internalType: "address",
138
+ name: "owner",
139
+ type: "address",
140
+ },
141
+ ],
142
+ stateMutability: "view",
143
+ type: "function",
144
+ },
145
+ {
146
+ inputs: [
147
+ {
148
+ internalType: "address",
149
+ name: "from",
150
+ type: "address",
151
+ },
152
+ {
153
+ internalType: "address",
154
+ name: "to",
155
+ type: "address",
156
+ },
157
+ {
158
+ internalType: "uint256",
159
+ name: "tokenId",
160
+ type: "uint256",
161
+ },
162
+ {
163
+ internalType: "bytes",
164
+ name: "data",
165
+ type: "bytes",
166
+ },
167
+ ],
168
+ name: "safeTransferFrom",
169
+ outputs: [],
170
+ stateMutability: "nonpayable",
171
+ type: "function",
172
+ },
173
+ {
174
+ inputs: [
175
+ {
176
+ internalType: "address",
177
+ name: "from",
178
+ type: "address",
179
+ },
180
+ {
181
+ internalType: "address",
182
+ name: "to",
183
+ type: "address",
184
+ },
185
+ {
186
+ internalType: "uint256",
187
+ name: "tokenId",
188
+ type: "uint256",
189
+ },
190
+ ],
191
+ name: "safeTransferFrom",
192
+ outputs: [],
193
+ stateMutability: "nonpayable",
194
+ type: "function",
195
+ },
196
+ {
197
+ inputs: [
198
+ {
199
+ internalType: "address",
200
+ name: "from",
201
+ type: "address",
202
+ },
203
+ {
204
+ internalType: "address",
205
+ name: "to",
206
+ type: "address",
207
+ },
208
+ {
209
+ internalType: "uint256",
210
+ name: "tokenId",
211
+ type: "uint256",
212
+ },
213
+ ],
214
+ name: "transferFrom",
215
+ outputs: [],
216
+ stateMutability: "nonpayable",
217
+ type: "function",
218
+ },
219
+ {
220
+ inputs: [
221
+ {
222
+ internalType: "address",
223
+ name: "to",
224
+ type: "address",
225
+ },
226
+ {
227
+ internalType: "uint256",
228
+ name: "tokenId",
229
+ type: "uint256",
230
+ },
231
+ ],
232
+ name: "approve",
233
+ outputs: [],
234
+ stateMutability: "nonpayable",
235
+ type: "function",
236
+ },
237
+ {
238
+ inputs: [
239
+ {
240
+ internalType: "address",
241
+ name: "operator",
242
+ type: "address",
243
+ },
244
+ {
245
+ internalType: "bool",
246
+ name: "approved",
247
+ type: "bool",
248
+ },
249
+ ],
250
+ name: "setApprovalForAll",
251
+ outputs: [],
252
+ stateMutability: "nonpayable",
253
+ type: "function",
254
+ },
255
+ {
256
+ inputs: [
257
+ {
258
+ internalType: "uint256",
259
+ name: "tokenId",
260
+ type: "uint256",
261
+ },
262
+ ],
263
+ name: "getApproved",
264
+ outputs: [
265
+ {
266
+ internalType: "address",
267
+ name: "operator",
268
+ type: "address",
269
+ },
270
+ ],
271
+ stateMutability: "view",
272
+ type: "function",
273
+ },
274
+ {
275
+ inputs: [
276
+ {
277
+ internalType: "address",
278
+ name: "owner",
279
+ type: "address",
280
+ },
281
+ {
282
+ internalType: "address",
283
+ name: "operator",
284
+ type: "address",
285
+ },
286
+ ],
287
+ name: "isApprovedForAll",
288
+ outputs: [
289
+ {
290
+ internalType: "bool",
291
+ name: "",
292
+ type: "bool",
293
+ },
294
+ ],
295
+ stateMutability: "view",
296
+ type: "function",
297
+ },
298
+ ];
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { ActionProvider } from "../actionProvider";
3
+ import { EvmWalletProvider } from "../../wallet-providers";
4
+ import { GetBalanceSchema, MintSchema, TransferSchema } from "./schemas";
5
+ import { Network } from "../../network";
6
+ /**
7
+ * Erc721ActionProvider is an action provider for Erc721 contract interactions.
8
+ */
9
+ export declare class Erc721ActionProvider extends ActionProvider<EvmWalletProvider> {
10
+ /**
11
+ * Constructor for the Erc721ActionProvider class.
12
+ */
13
+ constructor();
14
+ /**
15
+ * Mints an NFT (ERC-721) to a specified destination address onchain.
16
+ *
17
+ * @param walletProvider - The wallet provider to mint the NFT from.
18
+ * @param args - The input arguments for the action.
19
+ * @returns A message containing the NFT mint details.
20
+ */
21
+ mint(walletProvider: EvmWalletProvider, args: z.infer<typeof MintSchema>): Promise<string>;
22
+ /**
23
+ * Transfers an NFT (ERC721 token) to a destination address.
24
+ *
25
+ * @param walletProvider - The wallet provider to transfer the NFT from.
26
+ * @param args - The input arguments for the action.
27
+ * @returns A message containing the transfer details.
28
+ */
29
+ transfer(walletProvider: EvmWalletProvider, args: z.infer<typeof TransferSchema>): Promise<string>;
30
+ /**
31
+ * Gets the NFT balance for a given address and contract.
32
+ *
33
+ * @param walletProvider - The wallet provider to check the balance with.
34
+ * @param args - The input arguments for the action.
35
+ * @returns A message containing the NFT balance details.
36
+ */
37
+ getBalance(walletProvider: EvmWalletProvider, args: z.infer<typeof GetBalanceSchema>): Promise<string>;
38
+ /**
39
+ * Checks if the Erc721 action provider supports the given network.
40
+ *
41
+ * @param network - The network to check.
42
+ * @returns True if the Erc721 action provider supports the network, false otherwise.
43
+ */
44
+ supportsNetwork: (network: Network) => boolean;
45
+ }
46
+ export declare const erc721ActionProvider: () => Erc721ActionProvider;
@@ -0,0 +1,164 @@
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.erc721ActionProvider = exports.Erc721ActionProvider = void 0;
13
+ const zod_1 = require("zod");
14
+ const actionProvider_1 = require("../actionProvider");
15
+ const wallet_providers_1 = require("../../wallet-providers");
16
+ const actionDecorator_1 = require("../actionDecorator");
17
+ const schemas_1 = require("./schemas");
18
+ const constants_1 = require("./constants");
19
+ const viem_1 = require("viem");
20
+ /**
21
+ * Erc721ActionProvider is an action provider for Erc721 contract interactions.
22
+ */
23
+ class Erc721ActionProvider extends actionProvider_1.ActionProvider {
24
+ /**
25
+ * Constructor for the Erc721ActionProvider class.
26
+ */
27
+ constructor() {
28
+ super("erc721", []);
29
+ /**
30
+ * Checks if the Erc721 action provider supports the given network.
31
+ *
32
+ * @param network - The network to check.
33
+ * @returns True if the Erc721 action provider supports the network, false otherwise.
34
+ */
35
+ this.supportsNetwork = (network) => network.protocolFamily === "evm";
36
+ }
37
+ /**
38
+ * Mints an NFT (ERC-721) to a specified destination address onchain.
39
+ *
40
+ * @param walletProvider - The wallet provider to mint the NFT from.
41
+ * @param args - The input arguments for the action.
42
+ * @returns A message containing the NFT mint details.
43
+ */
44
+ async mint(walletProvider, args) {
45
+ try {
46
+ const data = (0, viem_1.encodeFunctionData)({
47
+ abi: constants_1.ERC721_ABI,
48
+ functionName: "mint",
49
+ args: [args.destination],
50
+ });
51
+ const hash = await walletProvider.sendTransaction({
52
+ to: args.contractAddress,
53
+ data,
54
+ });
55
+ await walletProvider.waitForTransactionReceipt(hash);
56
+ return `Successfully minted NFT ${args.contractAddress} to ${args.destination}`;
57
+ }
58
+ catch (error) {
59
+ return `Error minting NFT ${args.contractAddress} to ${args.destination}: ${error}`;
60
+ }
61
+ }
62
+ /**
63
+ * Transfers an NFT (ERC721 token) to a destination address.
64
+ *
65
+ * @param walletProvider - The wallet provider to transfer the NFT from.
66
+ * @param args - The input arguments for the action.
67
+ * @returns A message containing the transfer details.
68
+ */
69
+ async transfer(walletProvider, args) {
70
+ try {
71
+ const data = (0, viem_1.encodeFunctionData)({
72
+ abi: constants_1.ERC721_ABI,
73
+ functionName: "transferFrom",
74
+ args: [args.fromAddress, args.destination, BigInt(args.tokenId)],
75
+ });
76
+ const hash = await walletProvider.sendTransaction({
77
+ to: args.contractAddress,
78
+ data,
79
+ });
80
+ await walletProvider.waitForTransactionReceipt(hash);
81
+ return `Successfully transferred NFT ${args.contractAddress} with tokenId ${args.tokenId} to ${args.destination}`;
82
+ }
83
+ catch (error) {
84
+ return `Error transferring NFT ${args.contractAddress} with tokenId ${args.tokenId} to ${args.destination}: ${error}`;
85
+ }
86
+ }
87
+ /**
88
+ * Gets the NFT balance for a given address and contract.
89
+ *
90
+ * @param walletProvider - The wallet provider to check the balance with.
91
+ * @param args - The input arguments for the action.
92
+ * @returns A message containing the NFT balance details.
93
+ */
94
+ async getBalance(walletProvider, args) {
95
+ try {
96
+ const address = args.address || walletProvider.getAddress();
97
+ const balance = await walletProvider.readContract({
98
+ address: args.contractAddress,
99
+ abi: constants_1.ERC721_ABI,
100
+ functionName: "balanceOf",
101
+ args: [address],
102
+ });
103
+ return `Balance of NFTs for contract ${args.contractAddress} at address ${address} is ${balance}`;
104
+ }
105
+ catch (error) {
106
+ return `Error getting NFT balance for contract ${args.contractAddress}: ${error}`;
107
+ }
108
+ }
109
+ }
110
+ exports.Erc721ActionProvider = Erc721ActionProvider;
111
+ __decorate([
112
+ (0, actionDecorator_1.CreateAction)({
113
+ name: "mint",
114
+ description: `
115
+ This tool will mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation.
116
+ It takes the contract address of the NFT onchain and the destination address onchain that will receive the NFT as inputs.
117
+ Do not use the contract address as the destination address. If you are unsure of the destination address, please ask the user before proceeding.
118
+ `,
119
+ schema: schemas_1.MintSchema,
120
+ }),
121
+ __metadata("design:type", Function),
122
+ __metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
123
+ __metadata("design:returntype", Promise)
124
+ ], Erc721ActionProvider.prototype, "mint", null);
125
+ __decorate([
126
+ (0, actionDecorator_1.CreateAction)({
127
+ name: "transfer",
128
+ description: `
129
+ This tool will transfer an NFT (ERC721 token) from the wallet to another onchain address.
130
+
131
+ It takes the following inputs:
132
+ - contractAddress: The NFT contract address
133
+ - tokenId: The ID of the specific NFT to transfer
134
+ - destination: Onchain address to send the NFT
135
+
136
+ Important notes:
137
+ - Ensure you have ownership of the NFT before attempting transfer
138
+ - Ensure there is sufficient native token balance for gas fees
139
+ - The wallet must either own the NFT or have approval to transfer it
140
+ `,
141
+ schema: schemas_1.TransferSchema,
142
+ }),
143
+ __metadata("design:type", Function),
144
+ __metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
145
+ __metadata("design:returntype", Promise)
146
+ ], Erc721ActionProvider.prototype, "transfer", null);
147
+ __decorate([
148
+ (0, actionDecorator_1.CreateAction)({
149
+ name: "get_balance",
150
+ description: `
151
+ This tool will check the NFT (ERC721 token) balance for a given address.
152
+
153
+ It takes the following inputs:
154
+ - contractAddress: The NFT contract address to check balance for
155
+ - address: (Optional) The address to check NFT balance for. If not provided, uses the wallet's address
156
+ `,
157
+ schema: schemas_1.GetBalanceSchema,
158
+ }),
159
+ __metadata("design:type", Function),
160
+ __metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
161
+ __metadata("design:returntype", Promise)
162
+ ], Erc721ActionProvider.prototype, "getBalance", null);
163
+ const erc721ActionProvider = () => new Erc721ActionProvider();
164
+ exports.erc721ActionProvider = erc721ActionProvider;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const viem_1 = require("viem");
4
+ const erc721ActionProvider_1 = require("./erc721ActionProvider");
5
+ const constants_1 = require("./constants");
6
+ describe("ERC721 Action Provider", () => {
7
+ const MOCK_ADDRESS = "0xe6b2af36b3bb8d47206a129ff11d5a2de2a63c83";
8
+ const MOCK_CONTRACT = "0x1234567890123456789012345678901234567890";
9
+ const MOCK_DESTINATION = "0x9876543210987654321098765432109876543210";
10
+ const MOCK_TOKEN_ID = "123";
11
+ let mockWallet;
12
+ const actionProvider = (0, erc721ActionProvider_1.erc721ActionProvider)();
13
+ beforeEach(() => {
14
+ mockWallet = {
15
+ getAddress: jest.fn().mockReturnValue(MOCK_ADDRESS),
16
+ getNetwork: jest.fn().mockReturnValue({ protocolFamily: "evm" }),
17
+ sendTransaction: jest.fn(),
18
+ waitForTransactionReceipt: jest.fn(),
19
+ readContract: jest.fn(),
20
+ call: jest.fn(),
21
+ };
22
+ mockWallet.sendTransaction.mockResolvedValue("0xmockhash");
23
+ mockWallet.waitForTransactionReceipt.mockResolvedValue({});
24
+ });
25
+ describe("mint", () => {
26
+ it("should successfully mint an NFT", async () => {
27
+ const args = {
28
+ contractAddress: MOCK_CONTRACT,
29
+ destination: MOCK_DESTINATION,
30
+ };
31
+ const response = await actionProvider.mint(mockWallet, args);
32
+ expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
33
+ to: MOCK_CONTRACT,
34
+ data: (0, viem_1.encodeFunctionData)({
35
+ abi: constants_1.ERC721_ABI,
36
+ functionName: "mint",
37
+ args: [MOCK_DESTINATION],
38
+ }),
39
+ });
40
+ expect(mockWallet.waitForTransactionReceipt).toHaveBeenCalledWith("0xmockhash");
41
+ expect(response).toBe(`Successfully minted NFT ${MOCK_CONTRACT} to ${MOCK_DESTINATION}`);
42
+ });
43
+ it("should handle mint errors", async () => {
44
+ const error = new Error("Mint failed");
45
+ mockWallet.sendTransaction.mockRejectedValue(error);
46
+ const args = {
47
+ contractAddress: MOCK_CONTRACT,
48
+ destination: MOCK_DESTINATION,
49
+ };
50
+ const response = await actionProvider.mint(mockWallet, args);
51
+ expect(response).toBe(`Error minting NFT ${MOCK_CONTRACT} to ${MOCK_DESTINATION}: ${error}`);
52
+ });
53
+ });
54
+ describe("transfer", () => {
55
+ it("should successfully transfer an NFT", async () => {
56
+ const args = {
57
+ contractAddress: MOCK_CONTRACT,
58
+ destination: MOCK_DESTINATION,
59
+ tokenId: MOCK_TOKEN_ID,
60
+ fromAddress: MOCK_ADDRESS,
61
+ };
62
+ const response = await actionProvider.transfer(mockWallet, args);
63
+ expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
64
+ to: MOCK_CONTRACT,
65
+ data: (0, viem_1.encodeFunctionData)({
66
+ abi: constants_1.ERC721_ABI,
67
+ functionName: "transferFrom",
68
+ args: [MOCK_ADDRESS, MOCK_DESTINATION, BigInt(MOCK_TOKEN_ID)],
69
+ }),
70
+ });
71
+ expect(mockWallet.waitForTransactionReceipt).toHaveBeenCalledWith("0xmockhash");
72
+ expect(response).toBe(`Successfully transferred NFT ${MOCK_CONTRACT} with tokenId ${MOCK_TOKEN_ID} to ${MOCK_DESTINATION}`);
73
+ });
74
+ it("should handle transfer errors", async () => {
75
+ const error = new Error("Transfer failed");
76
+ mockWallet.sendTransaction.mockRejectedValue(error);
77
+ const args = {
78
+ contractAddress: MOCK_CONTRACT,
79
+ destination: MOCK_DESTINATION,
80
+ tokenId: MOCK_TOKEN_ID,
81
+ fromAddress: MOCK_ADDRESS,
82
+ };
83
+ const response = await actionProvider.transfer(mockWallet, args);
84
+ expect(response).toBe(`Error transferring NFT ${MOCK_CONTRACT} with tokenId ${MOCK_TOKEN_ID} to ${MOCK_DESTINATION}: ${error}`);
85
+ });
86
+ });
87
+ describe("getBalance", () => {
88
+ const MOCK_BALANCE = 1;
89
+ beforeEach(() => {
90
+ mockWallet.readContract.mockResolvedValue(MOCK_BALANCE);
91
+ mockWallet.getAddress.mockReturnValue(MOCK_ADDRESS);
92
+ });
93
+ it("should successfully get the NFT balance", async () => {
94
+ const args = {
95
+ contractAddress: MOCK_CONTRACT,
96
+ address: MOCK_ADDRESS,
97
+ };
98
+ const response = await actionProvider.getBalance(mockWallet, args);
99
+ expect(mockWallet.readContract).toHaveBeenCalledWith({
100
+ address: MOCK_CONTRACT,
101
+ abi: constants_1.ERC721_ABI,
102
+ functionName: "balanceOf",
103
+ args: [MOCK_ADDRESS],
104
+ });
105
+ expect(response).toBe(`Balance of NFTs for contract ${MOCK_CONTRACT} at address ${MOCK_ADDRESS} is 1`);
106
+ });
107
+ it("should handle get balance errors", async () => {
108
+ const error = new Error("Get balance failed");
109
+ mockWallet.readContract.mockRejectedValue(error);
110
+ const args = {
111
+ contractAddress: MOCK_CONTRACT,
112
+ address: MOCK_ADDRESS,
113
+ };
114
+ const response = await actionProvider.getBalance(mockWallet, args);
115
+ expect(mockWallet.readContract).toHaveBeenCalledWith({
116
+ address: MOCK_CONTRACT,
117
+ abi: constants_1.ERC721_ABI,
118
+ functionName: "balanceOf",
119
+ args: [MOCK_ADDRESS],
120
+ });
121
+ expect(response).toBe(`Error getting NFT balance for contract ${MOCK_CONTRACT}: ${error}`);
122
+ });
123
+ });
124
+ describe("supportsNetwork", () => {
125
+ it("should return true for EVM networks", () => {
126
+ const result = actionProvider.supportsNetwork({ protocolFamily: "evm", networkId: "any" });
127
+ expect(result).toBe(true);
128
+ });
129
+ it("should return false for non-EVM networks", () => {
130
+ const result = actionProvider.supportsNetwork({
131
+ protocolFamily: "bitcoin",
132
+ networkId: "any",
133
+ });
134
+ expect(result).toBe(false);
135
+ });
136
+ });
137
+ });
@@ -0,0 +1 @@
1
+ export * from "./erc721ActionProvider";
@@ -0,0 +1,17 @@
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("./erc721ActionProvider"), exports);