@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,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACTION_DECORATOR_KEY = void 0;
4
+ exports.CreateAction = CreateAction;
5
+ const wallet_providers_1 = require("../wallet-providers");
6
+ const analytics_1 = require("../analytics");
7
+ require("reflect-metadata");
8
+ /**
9
+ * Metadata key for the action decorator
10
+ */
11
+ exports.ACTION_DECORATOR_KEY = Symbol("agentkit:action");
12
+ /**
13
+ * Decorator to embed metadata on class methods to indicate they are actions accessible to the agent
14
+ *
15
+ * @param params - The parameters for the action decorator
16
+ * @returns A decorator function
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * class MyActionProvider extends ActionProvider {
21
+ * @CreateAction({ name: "my_action", description: "My action", schema: myActionSchema })
22
+ * public myAction(args: z.infer<typeof myActionSchema>) {
23
+ * // ...
24
+ * }
25
+ * }
26
+ * ```
27
+ */
28
+ function CreateAction(params) {
29
+ return (target, propertyKey, descriptor) => {
30
+ const prefixedActionName = `${target.constructor.name}_${params.name}`;
31
+ const originalMethod = descriptor.value;
32
+ const { isWalletProvider } = validateActionMethodArguments(target, propertyKey);
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ descriptor.value = function (...args) {
35
+ let walletMetrics = {};
36
+ if (isWalletProvider) {
37
+ walletMetrics = {
38
+ wallet_provider: args[0].getName(),
39
+ wallet_address: args[0].getAddress(),
40
+ network_id: args[0].getNetwork().networkId,
41
+ chain_id: args[0].getNetwork().chainId,
42
+ protocol_family: args[0].getNetwork().protocolFamily,
43
+ };
44
+ }
45
+ (0, analytics_1.sendAnalyticsEvent)({
46
+ name: "agent_action_invocation",
47
+ action: "invoke_action",
48
+ component: "agent_action",
49
+ action_name: prefixedActionName,
50
+ class_name: target.constructor.name,
51
+ method_name: propertyKey,
52
+ ...walletMetrics,
53
+ });
54
+ return originalMethod.apply(this, args);
55
+ };
56
+ const existingMetadata = Reflect.getMetadata(exports.ACTION_DECORATOR_KEY, target.constructor) || new Map();
57
+ const metaData = {
58
+ name: prefixedActionName,
59
+ description: params.description,
60
+ schema: params.schema,
61
+ invoke: descriptor.value,
62
+ walletProvider: isWalletProvider,
63
+ };
64
+ existingMetadata.set(propertyKey, metaData);
65
+ Reflect.defineMetadata(exports.ACTION_DECORATOR_KEY, existingMetadata, target.constructor);
66
+ return target;
67
+ };
68
+ }
69
+ /**
70
+ * Validates the arguments of an action method
71
+ *
72
+ * @param target - The target object
73
+ * @param propertyKey - The property key
74
+ * @returns An object containing the wallet provider flag
75
+ */
76
+ function validateActionMethodArguments(target, propertyKey) {
77
+ const className = target instanceof Object ? target.constructor.name : undefined;
78
+ const params = Reflect.getMetadata("design:paramtypes", target, propertyKey);
79
+ if (params == null) {
80
+ throw new Error(`Failed to get parameters for action method ${propertyKey} on class ${className}`);
81
+ }
82
+ if (params.length > 2) {
83
+ throw new Error(`Action method ${propertyKey} on class ${className} has more than 2 parameters`);
84
+ }
85
+ const walletProviderParam = params.find(param => {
86
+ if (!param || !param.prototype) {
87
+ return false;
88
+ }
89
+ if (param === wallet_providers_1.WalletProvider)
90
+ return true;
91
+ return param.prototype instanceof wallet_providers_1.WalletProvider;
92
+ });
93
+ return {
94
+ isWalletProvider: !!walletProviderParam,
95
+ };
96
+ }
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ import { WalletProvider } from "../wallet-providers";
3
+ import { Network } from "../network";
4
+ /**
5
+ * Action is the interface for all actions.
6
+ */
7
+ export interface Action<TActionSchema extends z.ZodSchema = z.ZodSchema> {
8
+ name: string;
9
+ description: string;
10
+ schema: TActionSchema;
11
+ invoke: (args: z.infer<TActionSchema>) => Promise<string>;
12
+ }
13
+ /**
14
+ * ActionProvider is the abstract base class for all action providers.
15
+ *
16
+ * @abstract
17
+ */
18
+ export declare abstract class ActionProvider<TWalletProvider extends WalletProvider = WalletProvider> {
19
+ /**
20
+ * The name of the action provider.
21
+ */
22
+ readonly name: string;
23
+ /**
24
+ * The action providers to combine.
25
+ */
26
+ readonly actionProviders: ActionProvider<TWalletProvider>[];
27
+ /**
28
+ * The constructor for the action provider.
29
+ *
30
+ * @param name - The name of the action provider.
31
+ * @param actionProviders - The action providers to combine.
32
+ */
33
+ constructor(name: string, actionProviders: ActionProvider<TWalletProvider>[]);
34
+ /**
35
+ * Gets the actions of the action provider bound to the given wallet provider.
36
+ *
37
+ * @param walletProvider - The wallet provider.
38
+ * @returns The actions of the action provider.
39
+ */
40
+ getActions(walletProvider: TWalletProvider): Action[];
41
+ /**
42
+ * Checks if the action provider supports the given network.
43
+ *
44
+ * @param network - The network to check.
45
+ * @returns True if the action provider supports the network, false otherwise.
46
+ */
47
+ abstract supportsNetwork(network: Network): boolean;
48
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionProvider = void 0;
4
+ const actionDecorator_1 = require("./actionDecorator");
5
+ /**
6
+ * ActionProvider is the abstract base class for all action providers.
7
+ *
8
+ * @abstract
9
+ */
10
+ class ActionProvider {
11
+ /**
12
+ * The constructor for the action provider.
13
+ *
14
+ * @param name - The name of the action provider.
15
+ * @param actionProviders - The action providers to combine.
16
+ */
17
+ constructor(name,
18
+ // Update parameter type to match property type
19
+ actionProviders) {
20
+ this.name = name;
21
+ this.actionProviders = actionProviders;
22
+ }
23
+ /**
24
+ * Gets the actions of the action provider bound to the given wallet provider.
25
+ *
26
+ * @param walletProvider - The wallet provider.
27
+ * @returns The actions of the action provider.
28
+ */
29
+ getActions(walletProvider) {
30
+ const actions = [];
31
+ const actionProviders = [this, ...this.actionProviders];
32
+ for (const actionProvider of actionProviders) {
33
+ const actionsMetadataMap = Reflect.getMetadata(actionDecorator_1.ACTION_DECORATOR_KEY, actionProvider.constructor);
34
+ if (!actionsMetadataMap) {
35
+ if (!(actionProvider instanceof ActionProvider)) {
36
+ console.warn(`Warning: ${actionProvider} is not an instance of ActionProvider.`);
37
+ }
38
+ else {
39
+ console.warn(`Warning: ${actionProvider} has no actions.`);
40
+ }
41
+ continue;
42
+ }
43
+ for (const actionMetadata of actionsMetadataMap.values()) {
44
+ actions.push({
45
+ name: actionMetadata.name,
46
+ description: actionMetadata.description,
47
+ schema: actionMetadata.schema,
48
+ invoke: schemaArgs => {
49
+ const args = [];
50
+ if (actionMetadata.walletProvider) {
51
+ args[0] = walletProvider;
52
+ }
53
+ args.push(schemaArgs);
54
+ return actionMetadata.invoke.apply(actionProvider, args);
55
+ },
56
+ });
57
+ }
58
+ }
59
+ return actions;
60
+ }
61
+ }
62
+ exports.ActionProvider = ActionProvider;
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ import { ActionProvider } from "../actionProvider";
3
+ import { AlchemyTokenPricesBySymbolSchema, AlchemyTokenPricesByAddressSchema } from "./schemas";
4
+ /**
5
+ * Configuration options for the AlchemyTokenPricesActionProvider.
6
+ */
7
+ export interface AlchemyTokenPricesActionProviderConfig {
8
+ /**
9
+ * Alchemy API Key
10
+ */
11
+ apiKey?: string;
12
+ }
13
+ /**
14
+ * AlchemyTokenPricesActionProvider is an action provider for fetching token prices via the Alchemy Prices API.
15
+ * This provider enables querying current and historical token prices using symbols or addresses.
16
+ *
17
+ */
18
+ export declare class AlchemyTokenPricesActionProvider extends ActionProvider {
19
+ private readonly apiKey;
20
+ private readonly baseUrl;
21
+ /**
22
+ * Creates a new instance of AlchemyTokenPricesActionProvider
23
+ *
24
+ * @param config - Configuration options including the API key
25
+ */
26
+ constructor(config?: AlchemyTokenPricesActionProviderConfig);
27
+ /**
28
+ * Fetch current token prices for one or more token symbols.
29
+ *
30
+ * @param args - The arguments containing an array of token symbols.
31
+ * @returns A JSON string with the token prices or an error message.
32
+ */
33
+ tokenPricesBySymbol(args: z.infer<typeof AlchemyTokenPricesBySymbolSchema>): Promise<string>;
34
+ /**
35
+ * Fetch current token prices for one or more tokens identified by network and address pairs.
36
+ *
37
+ * @param args - The arguments containing an array of token network/address pairs.
38
+ * @returns A JSON string with the token prices or an error message.
39
+ */
40
+ tokenPricesByAddress(args: z.infer<typeof AlchemyTokenPricesByAddressSchema>): Promise<string>;
41
+ /**
42
+ * Checks if the Alchemy Prices action provider supports the given network.
43
+ * Since the API works with multiple networks, this always returns true.
44
+ *
45
+ * @returns Always returns true.
46
+ */
47
+ supportsNetwork: () => boolean;
48
+ }
49
+ /**
50
+ * Factory function to create a new AlchemyTokenPricesActionProvider instance.
51
+ *
52
+ * @param config - The configuration options for the provider.
53
+ * @returns A new instance of AlchemyTokenPricesActionProvider.
54
+ */
55
+ export declare const alchemyTokenPricesActionProvider: (config?: AlchemyTokenPricesActionProviderConfig) => AlchemyTokenPricesActionProvider;
@@ -0,0 +1,173 @@
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.alchemyTokenPricesActionProvider = exports.AlchemyTokenPricesActionProvider = void 0;
13
+ const zod_1 = require("zod");
14
+ const actionProvider_1 = require("../actionProvider");
15
+ const actionDecorator_1 = require("../actionDecorator");
16
+ const schemas_1 = require("./schemas");
17
+ /**
18
+ * AlchemyTokenPricesActionProvider is an action provider for fetching token prices via the Alchemy Prices API.
19
+ * This provider enables querying current and historical token prices using symbols or addresses.
20
+ *
21
+ */
22
+ class AlchemyTokenPricesActionProvider extends actionProvider_1.ActionProvider {
23
+ /**
24
+ * Creates a new instance of AlchemyTokenPricesActionProvider
25
+ *
26
+ * @param config - Configuration options including the API key
27
+ */
28
+ constructor(config = {}) {
29
+ super("alchemyTokenPrices", []);
30
+ /**
31
+ * Checks if the Alchemy Prices action provider supports the given network.
32
+ * Since the API works with multiple networks, this always returns true.
33
+ *
34
+ * @returns Always returns true.
35
+ */
36
+ this.supportsNetwork = () => {
37
+ return true;
38
+ };
39
+ config.apiKey || (config.apiKey = process.env.ALCHEMY_API_KEY);
40
+ if (!config.apiKey) {
41
+ throw new Error("ALCHEMY_API_KEY is not configured.");
42
+ }
43
+ this.apiKey = config.apiKey;
44
+ this.baseUrl = "https://api.g.alchemy.com/prices/v1";
45
+ }
46
+ /**
47
+ * Fetch current token prices for one or more token symbols.
48
+ *
49
+ * @param args - The arguments containing an array of token symbols.
50
+ * @returns A JSON string with the token prices or an error message.
51
+ */
52
+ async tokenPricesBySymbol(args) {
53
+ try {
54
+ // Build query parameters: for each symbol add a separate query parameter
55
+ const params = new URLSearchParams();
56
+ for (const symbol of args.symbols) {
57
+ params.append("symbols", symbol);
58
+ }
59
+ const url = `${this.baseUrl}/${this.apiKey}/tokens/by-symbol?${params.toString()}`;
60
+ const response = await fetch(url, {
61
+ method: "GET",
62
+ headers: {
63
+ Accept: "application/json",
64
+ },
65
+ });
66
+ if (!response.ok) {
67
+ throw new Error(`HTTP error! status: ${response.status}`);
68
+ }
69
+ const data = await response.json();
70
+ return `Successfully fetched token prices by symbol:\n${JSON.stringify(data, null, 2)}`;
71
+ }
72
+ catch (error) {
73
+ return `Error fetching token prices by symbol: ${error}`;
74
+ }
75
+ }
76
+ /**
77
+ * Fetch current token prices for one or more tokens identified by network and address pairs.
78
+ *
79
+ * @param args - The arguments containing an array of token network/address pairs.
80
+ * @returns A JSON string with the token prices or an error message.
81
+ */
82
+ async tokenPricesByAddress(args) {
83
+ try {
84
+ const url = `${this.baseUrl}/${this.apiKey}/tokens/by-address`;
85
+ const response = await fetch(url, {
86
+ method: "POST",
87
+ headers: {
88
+ Accept: "application/json",
89
+ "Content-Type": "application/json",
90
+ },
91
+ body: JSON.stringify(args),
92
+ });
93
+ if (!response.ok) {
94
+ throw new Error(`HTTP error! status: ${response.status}`);
95
+ }
96
+ const data = await response.json();
97
+ return `Successfully fetched token prices by address:\n${JSON.stringify(data, null, 2)}`;
98
+ }
99
+ catch (error) {
100
+ return `Error fetching token prices by address: ${error}`;
101
+ }
102
+ }
103
+ }
104
+ exports.AlchemyTokenPricesActionProvider = AlchemyTokenPricesActionProvider;
105
+ __decorate([
106
+ (0, actionDecorator_1.CreateAction)({
107
+ name: "token_prices_by_symbol",
108
+ description: `
109
+ This tool will fetch current prices for one or more tokens using their symbols via the Alchemy Prices API.
110
+
111
+ A successful response will return a JSON payload similar to:
112
+ {
113
+ "data": [
114
+ {
115
+ "symbol": "ETH",
116
+ "prices": [
117
+ {
118
+ "currency": "usd",
119
+ "value": "2873.490923459",
120
+ "lastUpdatedAt": "2025-02-03T23:46:40Z"
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }
126
+
127
+ A failure response will return an error message with details.
128
+ `,
129
+ schema: schemas_1.AlchemyTokenPricesBySymbolSchema,
130
+ }),
131
+ __metadata("design:type", Function),
132
+ __metadata("design:paramtypes", [void 0]),
133
+ __metadata("design:returntype", Promise)
134
+ ], AlchemyTokenPricesActionProvider.prototype, "tokenPricesBySymbol", null);
135
+ __decorate([
136
+ (0, actionDecorator_1.CreateAction)({
137
+ name: "token_prices_by_address",
138
+ description: `
139
+ This tool will fetch current prices for tokens using network and address pairs via the Alchemy Prices API.
140
+
141
+ A successful response will return a JSON payload similar to:
142
+ {
143
+ "data": [
144
+ {
145
+ "network": "eth-mainnet",
146
+ "address": "0xYourTokenAddress",
147
+ "prices": [
148
+ {
149
+ "currency": "usd",
150
+ "value": "1234.56",
151
+ "lastUpdatedAt": "2025-02-03T23:46:40Z"
152
+ }
153
+ ]
154
+ }
155
+ ]
156
+ }
157
+
158
+ A failure response will return an error message with details.
159
+ `,
160
+ schema: schemas_1.AlchemyTokenPricesByAddressSchema,
161
+ }),
162
+ __metadata("design:type", Function),
163
+ __metadata("design:paramtypes", [void 0]),
164
+ __metadata("design:returntype", Promise)
165
+ ], AlchemyTokenPricesActionProvider.prototype, "tokenPricesByAddress", null);
166
+ /**
167
+ * Factory function to create a new AlchemyTokenPricesActionProvider instance.
168
+ *
169
+ * @param config - The configuration options for the provider.
170
+ * @returns A new instance of AlchemyTokenPricesActionProvider.
171
+ */
172
+ const alchemyTokenPricesActionProvider = (config) => new AlchemyTokenPricesActionProvider(config);
173
+ exports.alchemyTokenPricesActionProvider = alchemyTokenPricesActionProvider;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const alchemyTokenPricesActionProvider_1 = require("./alchemyTokenPricesActionProvider");
4
+ const MOCK_API_KEY = "alch-demo";
5
+ // Sample responses for each action
6
+ const MOCK_TOKEN_PRICES_BY_SYMBOL_RESPONSE = {
7
+ data: [
8
+ {
9
+ symbol: "ETH",
10
+ prices: [
11
+ {
12
+ currency: "usd",
13
+ value: "2873.490923459",
14
+ lastUpdatedAt: "2025-02-03T23:46:40Z",
15
+ },
16
+ ],
17
+ },
18
+ ],
19
+ };
20
+ const MOCK_TOKEN_PRICES_BY_ADDRESS_RESPONSE = {
21
+ data: [
22
+ {
23
+ network: "eth-mainnet",
24
+ address: "0x1234567890abcdef",
25
+ prices: [
26
+ {
27
+ currency: "usd",
28
+ value: "1234.56",
29
+ lastUpdatedAt: "2025-02-03T23:46:40Z",
30
+ },
31
+ ],
32
+ },
33
+ ],
34
+ };
35
+ describe("AlchemyTokenPricesActionProvider", () => {
36
+ let provider;
37
+ beforeEach(() => {
38
+ process.env.ALCHEMY_API_KEY = MOCK_API_KEY;
39
+ provider = (0, alchemyTokenPricesActionProvider_1.alchemyTokenPricesActionProvider)({ apiKey: MOCK_API_KEY });
40
+ jest.restoreAllMocks();
41
+ });
42
+ afterEach(() => {
43
+ jest.clearAllMocks();
44
+ });
45
+ describe("tokenPricesBySymbol", () => {
46
+ it("should successfully fetch token prices by symbol", async () => {
47
+ const fetchMock = jest.spyOn(global, "fetch").mockResolvedValue({
48
+ ok: true,
49
+ json: async () => MOCK_TOKEN_PRICES_BY_SYMBOL_RESPONSE,
50
+ });
51
+ const response = await provider.tokenPricesBySymbol({ symbols: ["ETH", "BTC"] });
52
+ // Verify the URL has the correct API key and query parameters.
53
+ const expectedUrlPart = `${provider["baseUrl"]}/${MOCK_API_KEY}/tokens/by-symbol`;
54
+ expect(fetchMock).toHaveBeenCalled();
55
+ const calledUrl = fetchMock.mock.calls[0][0];
56
+ expect(calledUrl).toContain(expectedUrlPart);
57
+ expect(calledUrl).toContain("symbols=ETH");
58
+ expect(calledUrl).toContain("symbols=BTC");
59
+ expect(response).toContain("Successfully fetched token prices by symbol");
60
+ expect(response).toContain(JSON.stringify(MOCK_TOKEN_PRICES_BY_SYMBOL_RESPONSE, null, 2));
61
+ });
62
+ it("should handle non-ok response for token prices by symbol", async () => {
63
+ jest.spyOn(global, "fetch").mockResolvedValue({
64
+ ok: false,
65
+ status: 400,
66
+ });
67
+ const response = await provider.tokenPricesBySymbol({ symbols: ["ETH"] });
68
+ expect(response).toContain("Error fetching token prices by symbol");
69
+ expect(response).toContain("400");
70
+ });
71
+ it("should handle fetch error for token prices by symbol", async () => {
72
+ const error = new Error("Fetch error");
73
+ jest.spyOn(global, "fetch").mockRejectedValue(error);
74
+ const response = await provider.tokenPricesBySymbol({ symbols: ["ETH"] });
75
+ expect(response).toContain("Error fetching token prices by symbol");
76
+ expect(response).toContain(error.message);
77
+ });
78
+ });
79
+ describe("tokenPricesByAddress", () => {
80
+ it("should successfully fetch token prices by address", async () => {
81
+ const fetchMock = jest.spyOn(global, "fetch").mockResolvedValue({
82
+ ok: true,
83
+ json: async () => MOCK_TOKEN_PRICES_BY_ADDRESS_RESPONSE,
84
+ });
85
+ const payload = {
86
+ addresses: [{ network: "eth-mainnet", address: "0x1234567890abcdef" }],
87
+ };
88
+ const response = await provider.tokenPricesByAddress(payload);
89
+ expect(fetchMock).toHaveBeenCalled();
90
+ // Verify that fetch was called with the correct POST URL and options.
91
+ const expectedUrl = `${provider["baseUrl"]}/${MOCK_API_KEY}/tokens/by-address`;
92
+ expect(fetchMock).toHaveBeenCalledWith(expectedUrl, expect.objectContaining({
93
+ method: "POST",
94
+ headers: expect.objectContaining({
95
+ Accept: "application/json",
96
+ "Content-Type": "application/json",
97
+ }),
98
+ body: JSON.stringify(payload),
99
+ }));
100
+ expect(response).toContain("Successfully fetched token prices by address");
101
+ expect(response).toContain(JSON.stringify(MOCK_TOKEN_PRICES_BY_ADDRESS_RESPONSE, null, 2));
102
+ });
103
+ it("should handle non-ok response for token prices by address", async () => {
104
+ jest.spyOn(global, "fetch").mockResolvedValue({
105
+ ok: false,
106
+ status: 429,
107
+ });
108
+ const payload = {
109
+ addresses: [{ network: "eth-mainnet", address: "0x1234567890abcdef" }],
110
+ };
111
+ const response = await provider.tokenPricesByAddress(payload);
112
+ expect(response).toContain("Error fetching token prices by address");
113
+ expect(response).toContain("429");
114
+ });
115
+ it("should handle fetch error for token prices by address", async () => {
116
+ const error = new Error("Fetch error");
117
+ jest.spyOn(global, "fetch").mockRejectedValue(error);
118
+ const payload = {
119
+ addresses: [{ network: "eth-mainnet", address: "0x1234567890abcdef" }],
120
+ };
121
+ const response = await provider.tokenPricesByAddress(payload);
122
+ expect(response).toContain("Error fetching token prices by address");
123
+ expect(response).toContain(error.message);
124
+ });
125
+ });
126
+ describe("supportsNetwork", () => {
127
+ it("should always return true", () => {
128
+ expect(provider.supportsNetwork()).toBe(true);
129
+ });
130
+ });
131
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./alchemyTokenPricesActionProvider";
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("./alchemyTokenPricesActionProvider"), exports);
18
+ __exportStar(require("./schemas"), exports);
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Input schema for fetching token prices by symbol.
4
+ *
5
+ * The API expects a list of token symbols.
6
+ */
7
+ export declare const AlchemyTokenPricesBySymbolSchema: z.ZodObject<{
8
+ symbols: z.ZodArray<z.ZodString, "many">;
9
+ }, "strip", z.ZodTypeAny, {
10
+ symbols: string[];
11
+ }, {
12
+ symbols: string[];
13
+ }>;
14
+ /**
15
+ * Input schema for fetching token prices by address.
16
+ *
17
+ * The API expects an object with an array of addresses, where each address contains
18
+ * a network identifier and a token contract address.
19
+ */
20
+ export declare const AlchemyTokenPricesByAddressSchema: z.ZodObject<{
21
+ addresses: z.ZodArray<z.ZodObject<{
22
+ network: z.ZodString;
23
+ address: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ address: string;
26
+ network: string;
27
+ }, {
28
+ address: string;
29
+ network: string;
30
+ }>, "many">;
31
+ }, "strip", z.ZodTypeAny, {
32
+ addresses: {
33
+ address: string;
34
+ network: string;
35
+ }[];
36
+ }, {
37
+ addresses: {
38
+ address: string;
39
+ network: string;
40
+ }[];
41
+ }>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlchemyTokenPricesByAddressSchema = exports.AlchemyTokenPricesBySymbolSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Input schema for fetching token prices by symbol.
7
+ *
8
+ * The API expects a list of token symbols.
9
+ */
10
+ exports.AlchemyTokenPricesBySymbolSchema = zod_1.z
11
+ .object({
12
+ symbols: zod_1.z
13
+ .array(zod_1.z.string())
14
+ .min(1, "At least one token symbol is required. Example: ETH, BTC, SOL, etc.")
15
+ .max(25, "A maximum of 25 token symbols can be provided."),
16
+ })
17
+ .describe("Input schema for fetching token prices by symbol from Alchemy");
18
+ /**
19
+ * Input schema for fetching token prices by address.
20
+ *
21
+ * The API expects an object with an array of addresses, where each address contains
22
+ * a network identifier and a token contract address.
23
+ */
24
+ exports.AlchemyTokenPricesByAddressSchema = zod_1.z
25
+ .object({
26
+ addresses: zod_1.z
27
+ .array(zod_1.z.object({
28
+ network: zod_1.z.string().describe("Network identifier (e.g., eth-mainnet, base-mainnet etc.)"),
29
+ address: zod_1.z.string().describe("Token contract address"),
30
+ }))
31
+ .min(1, "At least one address is required.")
32
+ .max(25, "A maximum of 25 addresses can be provided."),
33
+ })
34
+ .describe("Input schema for fetching token prices by address from Alchemy");