keyring-agent-core 0.2.0 → 0.2.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 (417) hide show
  1. package/dist/index.d.ts +6692 -27
  2. package/dist/index.js +877 -70
  3. package/package.json +4 -3
  4. package/dist/agent/AgentCore.d.ts +0 -256
  5. package/dist/agent/AgentCore.d.ts.map +0 -1
  6. package/dist/agent/AgentCore.js +0 -1093
  7. package/dist/agent/AgentCore.js.map +0 -1
  8. package/dist/agent/QueryRewriter.d.ts +0 -84
  9. package/dist/agent/QueryRewriter.d.ts.map +0 -1
  10. package/dist/agent/QueryRewriter.js +0 -306
  11. package/dist/agent/QueryRewriter.js.map +0 -1
  12. package/dist/agent/Router.d.ts +0 -33
  13. package/dist/agent/Router.d.ts.map +0 -1
  14. package/dist/agent/Router.js +0 -229
  15. package/dist/agent/Router.js.map +0 -1
  16. package/dist/agent/Subagent.d.ts +0 -80
  17. package/dist/agent/Subagent.d.ts.map +0 -1
  18. package/dist/agent/Subagent.js +0 -272
  19. package/dist/agent/Subagent.js.map +0 -1
  20. package/dist/agent/Synthesizer.d.ts +0 -11
  21. package/dist/agent/Synthesizer.d.ts.map +0 -1
  22. package/dist/agent/Synthesizer.js +0 -86
  23. package/dist/agent/Synthesizer.js.map +0 -1
  24. package/dist/agent/chatGraph.d.ts +0 -364
  25. package/dist/agent/chatGraph.d.ts.map +0 -1
  26. package/dist/agent/chatGraph.js +0 -184
  27. package/dist/agent/chatGraph.js.map +0 -1
  28. package/dist/agent/index.d.ts +0 -10
  29. package/dist/agent/index.d.ts.map +0 -1
  30. package/dist/agent/index.js +0 -24
  31. package/dist/agent/index.js.map +0 -1
  32. package/dist/agent/subagents/AiAgent.d.ts +0 -6
  33. package/dist/agent/subagents/AiAgent.d.ts.map +0 -1
  34. package/dist/agent/subagents/AiAgent.js +0 -52
  35. package/dist/agent/subagents/AiAgent.js.map +0 -1
  36. package/dist/agent/subagents/NftAgent.d.ts +0 -6
  37. package/dist/agent/subagents/NftAgent.d.ts.map +0 -1
  38. package/dist/agent/subagents/NftAgent.js +0 -79
  39. package/dist/agent/subagents/NftAgent.js.map +0 -1
  40. package/dist/agent/subagents/PoolAgent.d.ts +0 -6
  41. package/dist/agent/subagents/PoolAgent.d.ts.map +0 -1
  42. package/dist/agent/subagents/PoolAgent.js +0 -184
  43. package/dist/agent/subagents/PoolAgent.js.map +0 -1
  44. package/dist/agent/subagents/PoolSubgraphAgent.d.ts +0 -6
  45. package/dist/agent/subagents/PoolSubgraphAgent.d.ts.map +0 -1
  46. package/dist/agent/subagents/PoolSubgraphAgent.js +0 -117
  47. package/dist/agent/subagents/PoolSubgraphAgent.js.map +0 -1
  48. package/dist/agent/subagents/TokenAgent.d.ts +0 -6
  49. package/dist/agent/subagents/TokenAgent.d.ts.map +0 -1
  50. package/dist/agent/subagents/TokenAgent.js +0 -76
  51. package/dist/agent/subagents/TokenAgent.js.map +0 -1
  52. package/dist/agent/subagents/WalletActionAgent.d.ts +0 -6
  53. package/dist/agent/subagents/WalletActionAgent.d.ts.map +0 -1
  54. package/dist/agent/subagents/WalletActionAgent.js +0 -55
  55. package/dist/agent/subagents/WalletActionAgent.js.map +0 -1
  56. package/dist/agent/subagents/WalletAgent.d.ts +0 -6
  57. package/dist/agent/subagents/WalletAgent.d.ts.map +0 -1
  58. package/dist/agent/subagents/WalletAgent.js +0 -93
  59. package/dist/agent/subagents/WalletAgent.js.map +0 -1
  60. package/dist/agent/subagents/index.d.ts +0 -34
  61. package/dist/agent/subagents/index.d.ts.map +0 -1
  62. package/dist/agent/subagents/index.js +0 -69
  63. package/dist/agent/subagents/index.js.map +0 -1
  64. package/dist/constants/abi.d.ts +0 -551
  65. package/dist/constants/abi.d.ts.map +0 -1
  66. package/dist/constants/abi.js +0 -690
  67. package/dist/constants/abi.js.map +0 -1
  68. package/dist/functions/pool.d.ts +0 -25
  69. package/dist/functions/pool.d.ts.map +0 -1
  70. package/dist/functions/pool.js +0 -151
  71. package/dist/functions/pool.js.map +0 -1
  72. package/dist/functions/web3.d.ts +0 -31
  73. package/dist/functions/web3.d.ts.map +0 -1
  74. package/dist/functions/web3.js +0 -232
  75. package/dist/functions/web3.js.map +0 -1
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/llm/GeminiProvider.d.ts +0 -16
  79. package/dist/llm/GeminiProvider.d.ts.map +0 -1
  80. package/dist/llm/GeminiProvider.js +0 -329
  81. package/dist/llm/GeminiProvider.js.map +0 -1
  82. package/dist/llm/index.d.ts +0 -2
  83. package/dist/llm/index.d.ts.map +0 -1
  84. package/dist/llm/index.js +0 -6
  85. package/dist/llm/index.js.map +0 -1
  86. package/dist/memory/ChatHistory.d.ts +0 -83
  87. package/dist/memory/ChatHistory.d.ts.map +0 -1
  88. package/dist/memory/ChatHistory.js +0 -143
  89. package/dist/memory/ChatHistory.js.map +0 -1
  90. package/dist/memory/KnowledgeBase.d.ts +0 -38
  91. package/dist/memory/KnowledgeBase.d.ts.map +0 -1
  92. package/dist/memory/KnowledgeBase.js +0 -139
  93. package/dist/memory/KnowledgeBase.js.map +0 -1
  94. package/dist/memory/Summarizer.d.ts +0 -12
  95. package/dist/memory/Summarizer.d.ts.map +0 -1
  96. package/dist/memory/Summarizer.js +0 -39
  97. package/dist/memory/Summarizer.js.map +0 -1
  98. package/dist/memory/UpstashKnowledgeBase.d.ts +0 -124
  99. package/dist/memory/UpstashKnowledgeBase.d.ts.map +0 -1
  100. package/dist/memory/UpstashKnowledgeBase.js +0 -152
  101. package/dist/memory/UpstashKnowledgeBase.js.map +0 -1
  102. package/dist/memory/historyUtils.d.ts +0 -58
  103. package/dist/memory/historyUtils.d.ts.map +0 -1
  104. package/dist/memory/historyUtils.js +0 -190
  105. package/dist/memory/historyUtils.js.map +0 -1
  106. package/dist/memory/index.d.ts +0 -7
  107. package/dist/memory/index.d.ts.map +0 -1
  108. package/dist/memory/index.js +0 -12
  109. package/dist/memory/index.js.map +0 -1
  110. package/dist/memory/ingestKnowledgeBase.d.ts +0 -17
  111. package/dist/memory/ingestKnowledgeBase.d.ts.map +0 -1
  112. package/dist/memory/ingestKnowledgeBase.js +0 -35
  113. package/dist/memory/ingestKnowledgeBase.js.map +0 -1
  114. package/dist/services/MoralisService.d.ts +0 -1328
  115. package/dist/services/MoralisService.d.ts.map +0 -1
  116. package/dist/services/MoralisService.js +0 -1239
  117. package/dist/services/MoralisService.js.map +0 -1
  118. package/dist/services/PantographService.d.ts +0 -98
  119. package/dist/services/PantographService.d.ts.map +0 -1
  120. package/dist/services/PantographService.js +0 -451
  121. package/dist/services/PantographService.js.map +0 -1
  122. package/dist/services/PoolService.d.ts +0 -238
  123. package/dist/services/PoolService.d.ts.map +0 -1
  124. package/dist/services/PoolService.js +0 -485
  125. package/dist/services/PoolService.js.map +0 -1
  126. package/dist/services/UniswapService.d.ts +0 -289
  127. package/dist/services/UniswapService.d.ts.map +0 -1
  128. package/dist/services/UniswapService.js +0 -585
  129. package/dist/services/UniswapService.js.map +0 -1
  130. package/dist/services/UniswapSubgraphService.d.ts +0 -144
  131. package/dist/services/UniswapSubgraphService.d.ts.map +0 -1
  132. package/dist/services/UniswapSubgraphService.js +0 -606
  133. package/dist/services/UniswapSubgraphService.js.map +0 -1
  134. package/dist/services/rpc.d.ts +0 -35
  135. package/dist/services/rpc.d.ts.map +0 -1
  136. package/dist/services/rpc.js +0 -110
  137. package/dist/services/rpc.js.map +0 -1
  138. package/dist/services/swap/BaseSwapService.d.ts +0 -17
  139. package/dist/services/swap/BaseSwapService.d.ts.map +0 -1
  140. package/dist/services/swap/BaseSwapService.js +0 -19
  141. package/dist/services/swap/BaseSwapService.js.map +0 -1
  142. package/dist/services/swap/DebridgeAdapter.d.ts +0 -37
  143. package/dist/services/swap/DebridgeAdapter.d.ts.map +0 -1
  144. package/dist/services/swap/DebridgeAdapter.js +0 -243
  145. package/dist/services/swap/DebridgeAdapter.js.map +0 -1
  146. package/dist/services/swap/RelayAdapter.d.ts +0 -19
  147. package/dist/services/swap/RelayAdapter.d.ts.map +0 -1
  148. package/dist/services/swap/RelayAdapter.js +0 -189
  149. package/dist/services/swap/RelayAdapter.js.map +0 -1
  150. package/dist/services/swap/SwapServiceFactory.d.ts +0 -25
  151. package/dist/services/swap/SwapServiceFactory.d.ts.map +0 -1
  152. package/dist/services/swap/SwapServiceFactory.js +0 -79
  153. package/dist/services/swap/SwapServiceFactory.js.map +0 -1
  154. package/dist/services/swap/addresses.d.ts +0 -3
  155. package/dist/services/swap/addresses.d.ts.map +0 -1
  156. package/dist/services/swap/addresses.js +0 -68
  157. package/dist/services/swap/addresses.js.map +0 -1
  158. package/dist/services/swap/affiliate.d.ts +0 -17
  159. package/dist/services/swap/affiliate.d.ts.map +0 -1
  160. package/dist/services/swap/affiliate.js +0 -126
  161. package/dist/services/swap/affiliate.js.map +0 -1
  162. package/dist/services/swap/config.d.ts +0 -9
  163. package/dist/services/swap/config.d.ts.map +0 -1
  164. package/dist/services/swap/config.js +0 -19
  165. package/dist/services/swap/config.js.map +0 -1
  166. package/dist/services/swap/index.d.ts +0 -10
  167. package/dist/services/swap/index.d.ts.map +0 -1
  168. package/dist/services/swap/index.js +0 -22
  169. package/dist/services/swap/index.js.map +0 -1
  170. package/dist/services/swap/types.d.ts +0 -89
  171. package/dist/services/swap/types.d.ts.map +0 -1
  172. package/dist/services/swap/types.js +0 -6
  173. package/dist/services/swap/types.js.map +0 -1
  174. package/dist/tools/BaseTool.d.ts +0 -15
  175. package/dist/tools/BaseTool.d.ts.map +0 -1
  176. package/dist/tools/BaseTool.js +0 -35
  177. package/dist/tools/BaseTool.js.map +0 -1
  178. package/dist/tools/ToolRegistry.d.ts +0 -27
  179. package/dist/tools/ToolRegistry.d.ts.map +0 -1
  180. package/dist/tools/ToolRegistry.js +0 -80
  181. package/dist/tools/ToolRegistry.js.map +0 -1
  182. package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts +0 -36
  183. package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts.map +0 -1
  184. package/dist/tools/builtin/ai/GeminiSearchAiTool.js +0 -91
  185. package/dist/tools/builtin/ai/GeminiSearchAiTool.js.map +0 -1
  186. package/dist/tools/builtin/ai/index.d.ts +0 -3
  187. package/dist/tools/builtin/ai/index.d.ts.map +0 -1
  188. package/dist/tools/builtin/ai/index.js +0 -6
  189. package/dist/tools/builtin/ai/index.js.map +0 -1
  190. package/dist/tools/builtin/index.d.ts +0 -8
  191. package/dist/tools/builtin/index.d.ts.map +0 -1
  192. package/dist/tools/builtin/index.js +0 -24
  193. package/dist/tools/builtin/index.js.map +0 -1
  194. package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts +0 -35
  195. package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts.map +0 -1
  196. package/dist/tools/builtin/nft/BaseNftMessageTool.js +0 -45
  197. package/dist/tools/builtin/nft/BaseNftMessageTool.js.map +0 -1
  198. package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts +0 -15
  199. package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts.map +0 -1
  200. package/dist/tools/builtin/nft/NFTContractInfoTool.js +0 -19
  201. package/dist/tools/builtin/nft/NFTContractInfoTool.js.map +0 -1
  202. package/dist/tools/builtin/nft/NFTMetadataTool.d.ts +0 -15
  203. package/dist/tools/builtin/nft/NFTMetadataTool.d.ts.map +0 -1
  204. package/dist/tools/builtin/nft/NFTMetadataTool.js +0 -20
  205. package/dist/tools/builtin/nft/NFTMetadataTool.js.map +0 -1
  206. package/dist/tools/builtin/nft/SendNftTool.d.ts +0 -14
  207. package/dist/tools/builtin/nft/SendNftTool.d.ts.map +0 -1
  208. package/dist/tools/builtin/nft/SendNftTool.js +0 -20
  209. package/dist/tools/builtin/nft/SendNftTool.js.map +0 -1
  210. package/dist/tools/builtin/nft/WalletNFTsTool.d.ts +0 -15
  211. package/dist/tools/builtin/nft/WalletNFTsTool.d.ts.map +0 -1
  212. package/dist/tools/builtin/nft/WalletNFTsTool.js +0 -20
  213. package/dist/tools/builtin/nft/WalletNFTsTool.js.map +0 -1
  214. package/dist/tools/builtin/nft/index.d.ts +0 -7
  215. package/dist/tools/builtin/nft/index.d.ts.map +0 -1
  216. package/dist/tools/builtin/nft/index.js +0 -10
  217. package/dist/tools/builtin/nft/index.js.map +0 -1
  218. package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts +0 -124
  219. package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts.map +0 -1
  220. package/dist/tools/builtin/pool/EstimatePoolYieldTool.js +0 -236
  221. package/dist/tools/builtin/pool/EstimatePoolYieldTool.js.map +0 -1
  222. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts +0 -128
  223. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts.map +0 -1
  224. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js +0 -520
  225. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js.map +0 -1
  226. package/dist/tools/builtin/pool/PoolByAddressTool.d.ts +0 -127
  227. package/dist/tools/builtin/pool/PoolByAddressTool.d.ts.map +0 -1
  228. package/dist/tools/builtin/pool/PoolByAddressTool.js +0 -238
  229. package/dist/tools/builtin/pool/PoolByAddressTool.js.map +0 -1
  230. package/dist/tools/builtin/pool/PoolDetailTool.d.ts +0 -127
  231. package/dist/tools/builtin/pool/PoolDetailTool.d.ts.map +0 -1
  232. package/dist/tools/builtin/pool/PoolDetailTool.js +0 -273
  233. package/dist/tools/builtin/pool/PoolDetailTool.js.map +0 -1
  234. package/dist/tools/builtin/pool/PoolSearchTool.d.ts +0 -50
  235. package/dist/tools/builtin/pool/PoolSearchTool.d.ts.map +0 -1
  236. package/dist/tools/builtin/pool/PoolSearchTool.js +0 -160
  237. package/dist/tools/builtin/pool/PoolSearchTool.js.map +0 -1
  238. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts +0 -124
  239. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts.map +0 -1
  240. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js +0 -382
  241. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js.map +0 -1
  242. package/dist/tools/builtin/pool/TopPoolsTool.d.ts +0 -68
  243. package/dist/tools/builtin/pool/TopPoolsTool.d.ts.map +0 -1
  244. package/dist/tools/builtin/pool/TopPoolsTool.js +0 -159
  245. package/dist/tools/builtin/pool/TopPoolsTool.js.map +0 -1
  246. package/dist/tools/builtin/pool/index.d.ts +0 -15
  247. package/dist/tools/builtin/pool/index.d.ts.map +0 -1
  248. package/dist/tools/builtin/pool/index.js +0 -18
  249. package/dist/tools/builtin/pool/index.js.map +0 -1
  250. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts +0 -54
  251. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts.map +0 -1
  252. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js +0 -98
  253. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js.map +0 -1
  254. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts +0 -63
  255. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts.map +0 -1
  256. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js +0 -82
  257. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js.map +0 -1
  258. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts +0 -79
  259. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts.map +0 -1
  260. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js +0 -97
  261. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js.map +0 -1
  262. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts +0 -77
  263. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts.map +0 -1
  264. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js +0 -190
  265. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js.map +0 -1
  266. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts +0 -107
  267. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts.map +0 -1
  268. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js +0 -92
  269. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js.map +0 -1
  270. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts +0 -56
  271. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts.map +0 -1
  272. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js +0 -94
  273. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js.map +0 -1
  274. package/dist/tools/builtin/pool-subgraph/index.d.ts +0 -13
  275. package/dist/tools/builtin/pool-subgraph/index.d.ts.map +0 -1
  276. package/dist/tools/builtin/pool-subgraph/index.js +0 -18
  277. package/dist/tools/builtin/pool-subgraph/index.js.map +0 -1
  278. package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts +0 -71
  279. package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts.map +0 -1
  280. package/dist/tools/builtin/token/TokenAnalyticsTool.js +0 -147
  281. package/dist/tools/builtin/token/TokenAnalyticsTool.js.map +0 -1
  282. package/dist/tools/builtin/token/TokenHoldersTool.d.ts +0 -81
  283. package/dist/tools/builtin/token/TokenHoldersTool.d.ts.map +0 -1
  284. package/dist/tools/builtin/token/TokenHoldersTool.js +0 -139
  285. package/dist/tools/builtin/token/TokenHoldersTool.js.map +0 -1
  286. package/dist/tools/builtin/token/TokenInfoTool.d.ts +0 -40
  287. package/dist/tools/builtin/token/TokenInfoTool.d.ts.map +0 -1
  288. package/dist/tools/builtin/token/TokenInfoTool.js +0 -221
  289. package/dist/tools/builtin/token/TokenInfoTool.js.map +0 -1
  290. package/dist/tools/builtin/token/TokenScoreTool.d.ts +0 -63
  291. package/dist/tools/builtin/token/TokenScoreTool.d.ts.map +0 -1
  292. package/dist/tools/builtin/token/TokenScoreTool.js +0 -148
  293. package/dist/tools/builtin/token/TokenScoreTool.js.map +0 -1
  294. package/dist/tools/builtin/token/TopGainersTool.d.ts +0 -37
  295. package/dist/tools/builtin/token/TopGainersTool.d.ts.map +0 -1
  296. package/dist/tools/builtin/token/TopGainersTool.js +0 -100
  297. package/dist/tools/builtin/token/TopGainersTool.js.map +0 -1
  298. package/dist/tools/builtin/token/TopLosersTool.d.ts +0 -66
  299. package/dist/tools/builtin/token/TopLosersTool.d.ts.map +0 -1
  300. package/dist/tools/builtin/token/TopLosersTool.js +0 -129
  301. package/dist/tools/builtin/token/TopLosersTool.js.map +0 -1
  302. package/dist/tools/builtin/token/TrendingTokensTool.d.ts +0 -39
  303. package/dist/tools/builtin/token/TrendingTokensTool.d.ts.map +0 -1
  304. package/dist/tools/builtin/token/TrendingTokensTool.js +0 -83
  305. package/dist/tools/builtin/token/TrendingTokensTool.js.map +0 -1
  306. package/dist/tools/builtin/token/index.d.ts +0 -13
  307. package/dist/tools/builtin/token/index.d.ts.map +0 -1
  308. package/dist/tools/builtin/token/index.js +0 -16
  309. package/dist/tools/builtin/token/index.js.map +0 -1
  310. package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts +0 -70
  311. package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts.map +0 -1
  312. package/dist/tools/builtin/wallet/TransactionByHashTool.js +0 -111
  313. package/dist/tools/builtin/wallet/TransactionByHashTool.js.map +0 -1
  314. package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts +0 -107
  315. package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts.map +0 -1
  316. package/dist/tools/builtin/wallet/WalletApprovalsTool.js +0 -164
  317. package/dist/tools/builtin/wallet/WalletApprovalsTool.js.map +0 -1
  318. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts +0 -61
  319. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts.map +0 -1
  320. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js +0 -100
  321. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js.map +0 -1
  322. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts +0 -68
  323. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts.map +0 -1
  324. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js +0 -115
  325. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js.map +0 -1
  326. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts +0 -50
  327. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts.map +0 -1
  328. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js +0 -80
  329. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js.map +0 -1
  330. package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts +0 -31
  331. package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts.map +0 -1
  332. package/dist/tools/builtin/wallet/WalletHistoryTool.js +0 -154
  333. package/dist/tools/builtin/wallet/WalletHistoryTool.js.map +0 -1
  334. package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts +0 -44
  335. package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts.map +0 -1
  336. package/dist/tools/builtin/wallet/WalletNetWorthTool.js +0 -122
  337. package/dist/tools/builtin/wallet/WalletNetWorthTool.js.map +0 -1
  338. package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts +0 -86
  339. package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts.map +0 -1
  340. package/dist/tools/builtin/wallet/WalletNftTransfersTool.js +0 -265
  341. package/dist/tools/builtin/wallet/WalletNftTransfersTool.js.map +0 -1
  342. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts +0 -43
  343. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts.map +0 -1
  344. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js +0 -89
  345. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js.map +0 -1
  346. package/dist/tools/builtin/wallet/WalletPnlTool.d.ts +0 -43
  347. package/dist/tools/builtin/wallet/WalletPnlTool.d.ts.map +0 -1
  348. package/dist/tools/builtin/wallet/WalletPnlTool.js +0 -175
  349. package/dist/tools/builtin/wallet/WalletPnlTool.js.map +0 -1
  350. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts +0 -35
  351. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts.map +0 -1
  352. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js +0 -68
  353. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js.map +0 -1
  354. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts +0 -109
  355. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts.map +0 -1
  356. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js +0 -354
  357. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js.map +0 -1
  358. package/dist/tools/builtin/wallet/index.d.ts +0 -28
  359. package/dist/tools/builtin/wallet/index.d.ts.map +0 -1
  360. package/dist/tools/builtin/wallet/index.js +0 -32
  361. package/dist/tools/builtin/wallet/index.js.map +0 -1
  362. package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts +0 -25
  363. package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts.map +0 -1
  364. package/dist/tools/builtin/wallet-action/ApproveTokenTool.js +0 -98
  365. package/dist/tools/builtin/wallet-action/ApproveTokenTool.js.map +0 -1
  366. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts +0 -211
  367. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts.map +0 -1
  368. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js +0 -499
  369. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js.map +0 -1
  370. package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts +0 -240
  371. package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts.map +0 -1
  372. package/dist/tools/builtin/wallet-action/BuyTokenTool.js +0 -1257
  373. package/dist/tools/builtin/wallet-action/BuyTokenTool.js.map +0 -1
  374. package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts +0 -41
  375. package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts.map +0 -1
  376. package/dist/tools/builtin/wallet-action/SendNativeTool.js +0 -127
  377. package/dist/tools/builtin/wallet-action/SendNativeTool.js.map +0 -1
  378. package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts +0 -63
  379. package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts.map +0 -1
  380. package/dist/tools/builtin/wallet-action/SendTokenTool.js +0 -294
  381. package/dist/tools/builtin/wallet-action/SendTokenTool.js.map +0 -1
  382. package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts +0 -247
  383. package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts.map +0 -1
  384. package/dist/tools/builtin/wallet-action/SwapTokenTool.js +0 -1258
  385. package/dist/tools/builtin/wallet-action/SwapTokenTool.js.map +0 -1
  386. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts +0 -20
  387. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts.map +0 -1
  388. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js +0 -36
  389. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js.map +0 -1
  390. package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts +0 -23
  391. package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts.map +0 -1
  392. package/dist/tools/builtin/wallet-action/WrapNativeTool.js +0 -54
  393. package/dist/tools/builtin/wallet-action/WrapNativeTool.js.map +0 -1
  394. package/dist/tools/builtin/wallet-action/amountSpec.d.ts +0 -62
  395. package/dist/tools/builtin/wallet-action/amountSpec.d.ts.map +0 -1
  396. package/dist/tools/builtin/wallet-action/amountSpec.js +0 -93
  397. package/dist/tools/builtin/wallet-action/amountSpec.js.map +0 -1
  398. package/dist/tools/builtin/wallet-action/gasReserve.d.ts +0 -42
  399. package/dist/tools/builtin/wallet-action/gasReserve.d.ts.map +0 -1
  400. package/dist/tools/builtin/wallet-action/gasReserve.js +0 -103
  401. package/dist/tools/builtin/wallet-action/gasReserve.js.map +0 -1
  402. package/dist/tools/builtin/wallet-action/index.d.ts +0 -9
  403. package/dist/tools/builtin/wallet-action/index.d.ts.map +0 -1
  404. package/dist/tools/builtin/wallet-action/index.js +0 -20
  405. package/dist/tools/builtin/wallet-action/index.js.map +0 -1
  406. package/dist/tools/chainResolver.d.ts +0 -98
  407. package/dist/tools/chainResolver.d.ts.map +0 -1
  408. package/dist/tools/chainResolver.js +0 -302
  409. package/dist/tools/chainResolver.js.map +0 -1
  410. package/dist/tools/index.d.ts +0 -4
  411. package/dist/tools/index.d.ts.map +0 -1
  412. package/dist/tools/index.js +0 -23
  413. package/dist/tools/index.js.map +0 -1
  414. package/dist/types/index.d.ts +0 -777
  415. package/dist/types/index.d.ts.map +0 -1
  416. package/dist/types/index.js +0 -6
  417. package/dist/types/index.js.map +0 -1
@@ -1,98 +0,0 @@
1
- import type { UserContext } from '../types';
2
- /**
3
- * Default chain used only when neither the tool call nor the connected wallet
4
- * specifies one. Base (`0x2105`) — matches the prior Moralis default so this
5
- * change is behaviour-preserving for the no-context case.
6
- */
7
- export declare const DEFAULT_CHAIN = "0x2105";
8
- /** Canonical hex ids of every chain this core supports (EVM only). */
9
- export declare const SUPPORTED_CHAINS: readonly ["0x1", "0xa", "0x38", "0x89", "0x2105", "0xa4b1", "0xa86a", "0xe708"];
10
- /** Human-readable list of supported chains, for user-facing error messages. */
11
- export declare const SUPPORTED_CHAINS_LABEL = "Ethereum (0x1), Optimism (0xa), BSC (0x38), Polygon (0x89), Base (0x2105), Arbitrum (0xa4b1), Avalanche (0xa86a), Linea (0xe708)";
12
- /**
13
- * Normalize a chain identifier (name, decimal, or hex) to its canonical hex id
14
- * — but ONLY for chains this core supports. Returns `null` for empty /
15
- * non-string / unsupported / unknown input (including non-EVM chains such as
16
- * Solana, which this core does not support).
17
- */
18
- export declare function normalizeChain(input: unknown): string | null;
19
- /** True when `input` resolves to a supported chain. */
20
- export declare function isSupportedChain(input: unknown): boolean;
21
- /**
22
- * Heuristic: does the free-text query explicitly name one of the supported
23
- * chains? Used so that a user connected to an UNsupported chain can still ask
24
- * about a supported one ("USDC on Polygon") without being blocked.
25
- */
26
- export declare function mentionsSupportedChain(text: unknown): boolean;
27
- /**
28
- * Thrown when a chain is explicitly specified (by the tool call or the
29
- * connected wallet) but is not one this core supports. Tool `run()` bodies let
30
- * this propagate; `BaseTool.execute` turns it into a failed ToolResult whose
31
- * message the synthesizer relays to the user ("Chain X is not supported …").
32
- */
33
- export declare class UnsupportedChainError extends Error {
34
- readonly requested: string;
35
- readonly code = "unsupported_chain";
36
- constructor(requested: string);
37
- }
38
- /**
39
- * Resolve the chain a tool should query, in strict priority order:
40
- * 1. `argChain` — explicit tool argument (set only when the user named a chain)
41
- * 2. `userContext.chain` — the connected wallet's chain
42
- * 3. `fallback` — last-resort default ({@link DEFAULT_CHAIN})
43
- *
44
- * Throws {@link UnsupportedChainError} when a chain IS specified (arg or
45
- * connected wallet) but is not supported — so the user is told "chain X is not
46
- * supported" instead of being silently switched to a different chain.
47
- *
48
- * NOTE: tool `chain` parameters must be `required: false` with a description
49
- * telling the model to OMIT the arg unless the user explicitly names a chain.
50
- */
51
- export declare function resolveChain(argChain: unknown, userContext?: UserContext, fallback?: string): string;
52
- /**
53
- * Like {@link resolveChain} but returns `null` (instead of a default) when NO
54
- * chain is specified at all — for tools that must ask the user when no chain is
55
- * available (e.g. wallet-action forms). Still throws {@link UnsupportedChainError}
56
- * for a specified-but-unsupported chain.
57
- */
58
- export declare function resolveChainOptional(argChain: unknown, userContext?: UserContext): string | null;
59
- /**
60
- * Variant for tools where `chain` is an OPTIONAL scope filter (e.g. trending
61
- * lists): returns `undefined` — "all networks / cross-chain" — when neither the
62
- * arg nor the connected chain resolves to a supported chain. Never throws, so a
63
- * user connected to an unsupported chain can still get cross-chain results.
64
- */
65
- export declare function resolveChainScope(argChain: unknown, userContext?: UserContext): string | undefined;
66
- /** Display name for a chain id/alias (e.g. "0xa" → "Optimism"); falls back to the raw input. */
67
- export declare function chainLabel(input: unknown): string;
68
- /**
69
- * Map a native-coin symbol to the supported chain it UNIQUELY belongs to, or
70
- * `null` when the symbol is ambiguous (e.g. "ETH" spans several chains) or not a
71
- * recognized native coin. Used by the send-native flow so that naming a coin
72
- * tied to one specific chain ("send bnb") selects that chain — which then
73
- * triggers the wrong-chain prompt when the wallet is connected elsewhere.
74
- */
75
- export declare function chainForNativeSymbol(symbol: unknown): string | null;
76
- /**
77
- * Detect a wallet-action chain mismatch: the user EXPLICITLY named a chain
78
- * (`argChain`) that differs from the chain their wallet is connected to
79
- * (`userContext.chain`). A wallet can only sign on the chain it's connected to,
80
- * so an action targeting another chain must prompt the user to switch first.
81
- *
82
- * Returns `null` when there is no mismatch — i.e. no chain was named, the
83
- * connected chain is unknown, or both resolve to the same canonical hex id.
84
- * Unsupported chains are surfaced elsewhere (see {@link resolveChain}); this
85
- * only compares two chains the wallet could plausibly be on.
86
- */
87
- export declare function detectChainMismatch(argChain: unknown, userContext?: UserContext): {
88
- requested: string;
89
- connected: string;
90
- requestedLabel: string;
91
- connectedLabel: string;
92
- } | null;
93
- /**
94
- * Shared description for a tool's optional `chain` parameter — keeps the "omit
95
- * unless the user names a chain" instruction consistent across every tool.
96
- */
97
- export declare const CHAIN_PARAM_DESCRIPTION: string;
98
- //# sourceMappingURL=chainResolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chainResolver.d.ts","sourceRoot":"","sources":["../../src/tools/chainResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,E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AAE,WAAW,GACxB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAajG;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAEoG,CAAC"}
@@ -1,302 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CHAIN_PARAM_DESCRIPTION = exports.UnsupportedChainError = exports.SUPPORTED_CHAINS_LABEL = exports.SUPPORTED_CHAINS = exports.DEFAULT_CHAIN = void 0;
4
- exports.normalizeChain = normalizeChain;
5
- exports.isSupportedChain = isSupportedChain;
6
- exports.mentionsSupportedChain = mentionsSupportedChain;
7
- exports.resolveChain = resolveChain;
8
- exports.resolveChainOptional = resolveChainOptional;
9
- exports.resolveChainScope = resolveChainScope;
10
- exports.chainLabel = chainLabel;
11
- exports.chainForNativeSymbol = chainForNativeSymbol;
12
- exports.detectChainMismatch = detectChainMismatch;
13
- /**
14
- * Default chain used only when neither the tool call nor the connected wallet
15
- * specifies one. Base (`0x2105`) — matches the prior Moralis default so this
16
- * change is behaviour-preserving for the no-context case.
17
- */
18
- exports.DEFAULT_CHAIN = '0x2105';
19
- /** Canonical hex ids of every chain this core supports (EVM only). */
20
- exports.SUPPORTED_CHAINS = [
21
- '0x1', // Ethereum
22
- '0xa', // Optimism
23
- '0x38', // BSC
24
- '0x89', // Polygon
25
- '0x2105', // Base
26
- '0xa4b1', // Arbitrum
27
- '0xa86a', // Avalanche
28
- '0xe708', // Linea
29
- ];
30
- const SUPPORTED_SET = new Set(exports.SUPPORTED_CHAINS);
31
- /** Human-readable list of supported chains, for user-facing error messages. */
32
- exports.SUPPORTED_CHAINS_LABEL = 'Ethereum (0x1), Optimism (0xa), BSC (0x38), Polygon (0x89), Base (0x2105), Arbitrum (0xa4b1), Avalanche (0xa86a), Linea (0xe708)';
33
- /**
34
- * Accepted aliases (chain NAME or DECIMAL id) → canonical hex id, for the
35
- * supported chains only. Lets the host set `userContext.chain` as either
36
- * "optimism", "10", or "0xa" and still resolve correctly.
37
- */
38
- const CHAIN_ALIASES = {
39
- // Ethereum
40
- '0x1': '0x1',
41
- '1': '0x1',
42
- eth: '0x1',
43
- ether: '0x1',
44
- ethereum: '0x1',
45
- mainnet: '0x1',
46
- // Optimism
47
- '0xa': '0xa',
48
- '10': '0xa',
49
- op: '0xa',
50
- optimism: '0xa',
51
- // BSC
52
- '0x38': '0x38',
53
- '56': '0x38',
54
- bsc: '0x38',
55
- bnb: '0x38',
56
- binance: '0x38',
57
- // Polygon
58
- '0x89': '0x89',
59
- '137': '0x89',
60
- matic: '0x89',
61
- polygon: '0x89',
62
- // Base
63
- '0x2105': '0x2105',
64
- '8453': '0x2105',
65
- base: '0x2105',
66
- // Arbitrum
67
- '0xa4b1': '0xa4b1',
68
- '42161': '0xa4b1',
69
- arb: '0xa4b1',
70
- arbitrum: '0xa4b1',
71
- // Avalanche
72
- '0xa86a': '0xa86a',
73
- '43114': '0xa86a',
74
- avax: '0xa86a',
75
- avalanche: '0xa86a',
76
- // Linea
77
- '0xe708': '0xe708',
78
- '59144': '0xe708',
79
- linea: '0xe708',
80
- };
81
- /**
82
- * Normalize a chain identifier (name, decimal, or hex) to its canonical hex id
83
- * — but ONLY for chains this core supports. Returns `null` for empty /
84
- * non-string / unsupported / unknown input (including non-EVM chains such as
85
- * Solana, which this core does not support).
86
- */
87
- function normalizeChain(input) {
88
- if (typeof input !== 'string')
89
- return null;
90
- const key = input.trim().toLowerCase();
91
- if (!key)
92
- return null;
93
- const aliased = CHAIN_ALIASES[key];
94
- if (aliased)
95
- return aliased;
96
- // Bare hex or decimal id that lands on a supported chain.
97
- let hex = null;
98
- if (/^0x[0-9a-f]+$/.test(key))
99
- hex = key;
100
- else if (/^[0-9]+$/.test(key))
101
- hex = '0x' + Number(key).toString(16);
102
- return hex && SUPPORTED_SET.has(hex) ? hex : null;
103
- }
104
- /** True when `input` resolves to a supported chain. */
105
- function isSupportedChain(input) {
106
- return normalizeChain(input) !== null;
107
- }
108
- /**
109
- * Unambiguous chain tokens (full names + explicit hex ids) used to detect when
110
- * a user's free-text query EXPLICITLY names a supported chain — e.g. "USDC on
111
- * Polygon". Bare decimals ("10") and very short aliases ("op") are excluded to
112
- * avoid false positives in ordinary prose.
113
- */
114
- const CHAIN_NAME_TOKENS = [
115
- 'ethereum',
116
- 'optimism',
117
- 'polygon',
118
- 'base',
119
- 'arbitrum',
120
- 'avalanche',
121
- 'linea',
122
- 'bsc',
123
- 'bnb',
124
- 'binance',
125
- 'matic',
126
- 'avax',
127
- 'mainnet',
128
- '0x1',
129
- '0xa',
130
- '0x38',
131
- '0x89',
132
- '0x2105',
133
- '0xa4b1',
134
- '0xa86a',
135
- '0xe708',
136
- ];
137
- /**
138
- * Heuristic: does the free-text query explicitly name one of the supported
139
- * chains? Used so that a user connected to an UNsupported chain can still ask
140
- * about a supported one ("USDC on Polygon") without being blocked.
141
- */
142
- function mentionsSupportedChain(text) {
143
- if (typeof text !== 'string' || !text.trim())
144
- return false;
145
- const lower = text.toLowerCase();
146
- return CHAIN_NAME_TOKENS.some((tok) => new RegExp(`(^|[^a-z0-9])${tok}([^a-z0-9]|$)`).test(lower));
147
- }
148
- /**
149
- * Thrown when a chain is explicitly specified (by the tool call or the
150
- * connected wallet) but is not one this core supports. Tool `run()` bodies let
151
- * this propagate; `BaseTool.execute` turns it into a failed ToolResult whose
152
- * message the synthesizer relays to the user ("Chain X is not supported …").
153
- */
154
- class UnsupportedChainError extends Error {
155
- requested;
156
- code = 'unsupported_chain';
157
- constructor(requested) {
158
- super(`Chain "${requested}" is not supported. Supported chains: ${exports.SUPPORTED_CHAINS_LABEL}.`);
159
- this.requested = requested;
160
- this.name = 'UnsupportedChainError';
161
- }
162
- }
163
- exports.UnsupportedChainError = UnsupportedChainError;
164
- const isPresent = (v) => typeof v === 'string' && v.trim() !== '';
165
- /**
166
- * Resolve the chain a tool should query, in strict priority order:
167
- * 1. `argChain` — explicit tool argument (set only when the user named a chain)
168
- * 2. `userContext.chain` — the connected wallet's chain
169
- * 3. `fallback` — last-resort default ({@link DEFAULT_CHAIN})
170
- *
171
- * Throws {@link UnsupportedChainError} when a chain IS specified (arg or
172
- * connected wallet) but is not supported — so the user is told "chain X is not
173
- * supported" instead of being silently switched to a different chain.
174
- *
175
- * NOTE: tool `chain` parameters must be `required: false` with a description
176
- * telling the model to OMIT the arg unless the user explicitly names a chain.
177
- */
178
- function resolveChain(argChain, userContext, fallback = exports.DEFAULT_CHAIN) {
179
- if (isPresent(argChain)) {
180
- const n = normalizeChain(argChain);
181
- if (n)
182
- return n;
183
- throw new UnsupportedChainError(argChain.trim());
184
- }
185
- if (isPresent(userContext?.chain)) {
186
- const n = normalizeChain(userContext.chain);
187
- if (n)
188
- return n;
189
- throw new UnsupportedChainError(userContext.chain.trim());
190
- }
191
- return fallback;
192
- }
193
- /**
194
- * Like {@link resolveChain} but returns `null` (instead of a default) when NO
195
- * chain is specified at all — for tools that must ask the user when no chain is
196
- * available (e.g. wallet-action forms). Still throws {@link UnsupportedChainError}
197
- * for a specified-but-unsupported chain.
198
- */
199
- function resolveChainOptional(argChain, userContext) {
200
- if (isPresent(argChain)) {
201
- const n = normalizeChain(argChain);
202
- if (n)
203
- return n;
204
- throw new UnsupportedChainError(argChain.trim());
205
- }
206
- if (isPresent(userContext?.chain)) {
207
- const n = normalizeChain(userContext.chain);
208
- if (n)
209
- return n;
210
- throw new UnsupportedChainError(userContext.chain.trim());
211
- }
212
- return null;
213
- }
214
- /**
215
- * Variant for tools where `chain` is an OPTIONAL scope filter (e.g. trending
216
- * lists): returns `undefined` — "all networks / cross-chain" — when neither the
217
- * arg nor the connected chain resolves to a supported chain. Never throws, so a
218
- * user connected to an unsupported chain can still get cross-chain results.
219
- */
220
- function resolveChainScope(argChain, userContext) {
221
- return normalizeChain(argChain) ?? normalizeChain(userContext?.chain) ?? undefined;
222
- }
223
- /** Human-readable label for a supported chain's canonical hex id (for messages). */
224
- const CHAIN_LABELS = {
225
- '0x1': 'Ethereum',
226
- '0xa': 'Optimism',
227
- '0x38': 'BSC',
228
- '0x89': 'Polygon',
229
- '0x2105': 'Base',
230
- '0xa4b1': 'Arbitrum',
231
- '0xa86a': 'Avalanche',
232
- '0xe708': 'Linea',
233
- };
234
- /** Display name for a chain id/alias (e.g. "0xa" → "Optimism"); falls back to the raw input. */
235
- function chainLabel(input) {
236
- const hex = normalizeChain(input);
237
- if (hex && CHAIN_LABELS[hex])
238
- return CHAIN_LABELS[hex];
239
- return typeof input === 'string' && input.trim() ? input.trim() : 'the requested chain';
240
- }
241
- /**
242
- * Native-coin symbols that UNIQUELY identify a supported chain. Only coins that
243
- * belong to exactly one supported chain are listed: BNB→BSC, MATIC→Polygon,
244
- * AVAX→Avalanche. ETH is deliberately omitted — it is the native coin of five
245
- * supported chains (Ethereum, Optimism, Base, Arbitrum, Linea), so naming "ETH"
246
- * does NOT identify a single chain and must NOT override the connected one.
247
- */
248
- const UNIQUE_NATIVE_SYMBOL_CHAIN = {
249
- bnb: '0x38',
250
- matic: '0x89',
251
- pol: '0x89', // Polygon's native coin was renamed MATIC → POL
252
- avax: '0xa86a',
253
- };
254
- /**
255
- * Map a native-coin symbol to the supported chain it UNIQUELY belongs to, or
256
- * `null` when the symbol is ambiguous (e.g. "ETH" spans several chains) or not a
257
- * recognized native coin. Used by the send-native flow so that naming a coin
258
- * tied to one specific chain ("send bnb") selects that chain — which then
259
- * triggers the wrong-chain prompt when the wallet is connected elsewhere.
260
- */
261
- function chainForNativeSymbol(symbol) {
262
- if (typeof symbol !== 'string')
263
- return null;
264
- const key = symbol.trim().toLowerCase();
265
- if (!key)
266
- return null;
267
- return UNIQUE_NATIVE_SYMBOL_CHAIN[key] ?? null;
268
- }
269
- /**
270
- * Detect a wallet-action chain mismatch: the user EXPLICITLY named a chain
271
- * (`argChain`) that differs from the chain their wallet is connected to
272
- * (`userContext.chain`). A wallet can only sign on the chain it's connected to,
273
- * so an action targeting another chain must prompt the user to switch first.
274
- *
275
- * Returns `null` when there is no mismatch — i.e. no chain was named, the
276
- * connected chain is unknown, or both resolve to the same canonical hex id.
277
- * Unsupported chains are surfaced elsewhere (see {@link resolveChain}); this
278
- * only compares two chains the wallet could plausibly be on.
279
- */
280
- function detectChainMismatch(argChain, userContext) {
281
- if (!isPresent(argChain))
282
- return null;
283
- const requested = normalizeChain(argChain);
284
- const connected = normalizeChain(userContext?.chain);
285
- // Only a mismatch when BOTH resolve and differ. If either side is unknown we
286
- // can't assert a mismatch (unsupported-chain handling lives in resolveChain).
287
- if (!requested || !connected || requested === connected)
288
- return null;
289
- return {
290
- requested,
291
- connected,
292
- requestedLabel: CHAIN_LABELS[requested] ?? requested,
293
- connectedLabel: CHAIN_LABELS[connected] ?? connected,
294
- };
295
- }
296
- /**
297
- * Shared description for a tool's optional `chain` parameter — keeps the "omit
298
- * unless the user names a chain" instruction consistent across every tool.
299
- */
300
- exports.CHAIN_PARAM_DESCRIPTION = 'Hex chain ID — e.g. "0xa" Optimism, "0x89" Polygon, "0x2105" Base, "0xa4b1" Arbitrum, "0x38" BSC, "0x1" Ethereum. ' +
301
- 'ONLY set this when the user EXPLICITLY names a chain. Otherwise OMIT it entirely — the connected wallet chain is used automatically.';
302
- //# sourceMappingURL=chainResolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chainResolver.js","sourceRoot":"","sources":["../../src/tools/chainResolver.ts"],"names":[],"mappings":";;;AAkFA,wCAWC;AAGD,4CAEC;AAqCD,wDAIC;AA+BD,oCAYC;AAQD,oDAYC;AAQD,8CAEC;AAeD,gCAIC;AAuBD,oDAKC;AAaD,kDAgBC;AA9RD;;;;GAIG;AACU,QAAA,aAAa,GAAG,QAAQ,CAAC;AAEtC,sEAAsE;AACzD,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,MAAM;IACd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@@
1
- export { ToolRegistry } from './ToolRegistry';
2
- export { BaseTool } from './BaseTool';
3
- export * from './builtin';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,WAAW,CAAC"}
@@ -1,23 +0,0 @@
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
- exports.BaseTool = exports.ToolRegistry = void 0;
18
- var ToolRegistry_1 = require("./ToolRegistry");
19
- Object.defineProperty(exports, "ToolRegistry", { enumerable: true, get: function () { return ToolRegistry_1.ToolRegistry; } });
20
- var BaseTool_1 = require("./BaseTool");
21
- Object.defineProperty(exports, "BaseTool", { enumerable: true, get: function () { return BaseTool_1.BaseTool; } });
22
- __exportStar(require("./builtin"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,4CAA0B"}