@elizaos/plugin-wallet 2.0.0-beta.1 → 2.0.3-beta.6

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 (356) hide show
  1. package/README.md +70 -45
  2. package/auto-enable.ts +1 -1
  3. package/dist/actions/failure-codes.d.ts +12 -0
  4. package/dist/actions/index.d.ts +1 -0
  5. package/dist/analytics/birdeye/actions/wallet-search-address.d.ts +7 -0
  6. package/dist/analytics/birdeye/birdeye-task.d.ts +27 -0
  7. package/dist/analytics/birdeye/birdeye.d.ts +140 -0
  8. package/dist/analytics/birdeye/constants.d.ts +68 -0
  9. package/dist/analytics/birdeye/providers/agent-portfolio-provider.d.ts +8 -0
  10. package/dist/analytics/birdeye/providers/market.d.ts +18 -0
  11. package/dist/analytics/birdeye/providers/portfolio-factory.d.ts +10 -0
  12. package/dist/analytics/birdeye/providers/trending.d.ts +19 -0
  13. package/dist/analytics/birdeye/providers/wallet.d.ts +5 -0
  14. package/dist/analytics/birdeye/search-category.d.ts +52 -0
  15. package/dist/analytics/birdeye/service.d.ts +94 -0
  16. package/dist/analytics/birdeye/types/api/common.d.ts +199 -0
  17. package/dist/analytics/birdeye/types/api/defi.d.ts +187 -0
  18. package/dist/analytics/birdeye/types/api/pair.d.ts +182 -0
  19. package/dist/analytics/birdeye/types/api/search.d.ts +64 -0
  20. package/dist/analytics/birdeye/types/api/token.d.ts +580 -0
  21. package/dist/analytics/birdeye/types/api/trader.d.ts +70 -0
  22. package/dist/analytics/birdeye/types/api/wallet.d.ts +161 -0
  23. package/dist/analytics/birdeye/types/shared.d.ts +83 -0
  24. package/dist/analytics/birdeye/utils.d.ts +74 -0
  25. package/dist/analytics/dexscreener/errors.d.ts +2 -0
  26. package/dist/analytics/dexscreener/index.d.ts +3 -0
  27. package/dist/analytics/dexscreener/search-category.d.ts +3 -0
  28. package/dist/analytics/dexscreener/service.d.ts +34 -0
  29. package/dist/analytics/dexscreener/types.d.ts +131 -0
  30. package/dist/analytics/lpinfo/index.d.ts +31 -0
  31. package/dist/analytics/lpinfo/kamino/index.d.ts +7 -0
  32. package/dist/analytics/lpinfo/kamino/providers/kaminoLiquidityProvider.d.ts +6 -0
  33. package/dist/analytics/lpinfo/kamino/providers/kaminoPoolProvider.d.ts +6 -0
  34. package/dist/analytics/lpinfo/kamino/providers/kaminoProvider.d.ts +6 -0
  35. package/dist/analytics/lpinfo/kamino/services/kaminoLiquidityService.d.ts +203 -0
  36. package/dist/analytics/lpinfo/kamino/services/kaminoService.d.ts +171 -0
  37. package/dist/analytics/lpinfo/steer/index.d.ts +7 -0
  38. package/dist/analytics/lpinfo/steer/providers/steerLiquidityProvider.d.ts +6 -0
  39. package/dist/analytics/lpinfo/steer/services/steerLiquidityService.d.ts +208 -0
  40. package/dist/analytics/lpinfo/steer/steer-display-types.d.ts +97 -0
  41. package/dist/analytics/news/index.d.ts +32 -0
  42. package/dist/analytics/news/interfaces/types.d.ts +177 -0
  43. package/dist/analytics/news/providers/defiNewsProvider.d.ts +106 -0
  44. package/dist/analytics/news/services/newsDataService.d.ts +72 -0
  45. package/dist/analytics/news/utils/formatters.d.ts +54 -0
  46. package/dist/analytics/token-info/action.d.ts +6 -0
  47. package/dist/analytics/token-info/index.d.ts +3 -0
  48. package/dist/analytics/token-info/params.d.ts +10 -0
  49. package/dist/analytics/token-info/providers.d.ts +4 -0
  50. package/dist/analytics/token-info/service.d.ts +19 -0
  51. package/dist/analytics/token-info/types.d.ts +45 -0
  52. package/dist/api/wallet-routes.d.ts +100 -0
  53. package/dist/audit/audit-log.d.ts +29 -0
  54. package/dist/browser-shim/build-shim.d.ts +31 -0
  55. package/dist/browser-shim/index.d.ts +1 -0
  56. package/dist/chains/evm/actions/helpers.d.ts +31 -0
  57. package/dist/chains/evm/actions/swap.d.ts +53 -0
  58. package/dist/chains/evm/actions/transfer.d.ts +10 -0
  59. package/dist/chains/evm/bridge-router.d.ts +44 -0
  60. package/dist/chains/evm/build.d.ts +2 -0
  61. package/dist/chains/evm/chain-handler.d.ts +37 -0
  62. package/dist/chains/evm/constants.d.ts +16 -0
  63. package/dist/chains/evm/dex/aerodrome/index.d.ts +6 -0
  64. package/dist/chains/evm/dex/aerodrome/services/AerodromeLpService.d.ts +27 -0
  65. package/dist/chains/evm/dex/aerodrome/types.d.ts +435 -0
  66. package/dist/chains/evm/dex/pancakeswp/index.d.ts +6 -0
  67. package/dist/chains/evm/dex/pancakeswp/services/PancakeSwapV3LpService.d.ts +28 -0
  68. package/dist/chains/evm/dex/pancakeswp/types.d.ts +19 -0
  69. package/dist/chains/evm/dex/uniswap/index.d.ts +6 -0
  70. package/dist/chains/evm/dex/uniswap/services/UniswapV3LpService.d.ts +28 -0
  71. package/dist/chains/evm/dex/uniswap/types.d.ts +458 -0
  72. package/dist/chains/evm/generated/specs/spec-helpers.d.ts +35 -0
  73. package/dist/chains/evm/generated/specs/specs.d.ts +99 -0
  74. package/dist/chains/evm/gov-router.d.ts +6 -0
  75. package/dist/chains/evm/index.browser.d.ts +3 -0
  76. package/dist/chains/evm/index.d.ts +6 -0
  77. package/dist/chains/evm/prompts.d.ts +24 -0
  78. package/dist/chains/evm/providers/get-balance.d.ts +2 -0
  79. package/dist/chains/evm/providers/wallet.d.ts +35 -0
  80. package/dist/chains/evm/routes/sign.d.ts +13 -0
  81. package/dist/chains/evm/rpc-providers.d.ts +26 -0
  82. package/dist/chains/evm/service.d.ts +26 -0
  83. package/dist/chains/evm/templates/index.d.ts +1 -0
  84. package/dist/chains/evm/types/index.d.ts +296 -0
  85. package/dist/chains/evm/vitest.config.d.ts +2 -0
  86. package/dist/chains/registry.d.ts +3 -0
  87. package/dist/chains/solana/actions/confirmation.d.ts +9 -0
  88. package/dist/chains/solana/bn.d.ts +6 -0
  89. package/dist/chains/solana/build.d.ts +2 -0
  90. package/dist/chains/solana/constants.d.ts +2 -0
  91. package/dist/chains/solana/dex/meteora/e2e/scenarios.d.ts +10 -0
  92. package/dist/chains/solana/dex/meteora/e2e/test-utils.d.ts +28 -0
  93. package/dist/chains/solana/dex/meteora/index.d.ts +3 -0
  94. package/dist/chains/solana/dex/meteora/providers/positionProvider.d.ts +9 -0
  95. package/dist/chains/solana/dex/meteora/services/MeteoraLpService.d.ts +37 -0
  96. package/dist/chains/solana/dex/meteora/utils/dlmm.d.ts +6 -0
  97. package/dist/chains/solana/dex/meteora/utils/loadWallet.d.ts +14 -0
  98. package/dist/chains/solana/dex/meteora/utils/sendTransaction.d.ts +2 -0
  99. package/dist/chains/solana/dex/orca/index.d.ts +6 -0
  100. package/dist/chains/solana/dex/orca/providers/positionProvider.d.ts +10 -0
  101. package/dist/chains/solana/dex/orca/services/srv_orca.d.ts +10 -0
  102. package/dist/chains/solana/dex/orca/types.d.ts +61 -0
  103. package/dist/chains/solana/dex/orca/utils/loadWallet.d.ts +1 -0
  104. package/dist/chains/solana/dex/orca/utils/sendTransaction.d.ts +2 -0
  105. package/dist/chains/solana/dex/raydium/index.d.ts +6 -0
  106. package/dist/chains/solana/dex/raydium/providers/positionProvider.d.ts +10 -0
  107. package/dist/chains/solana/dex/raydium/services/srv_raydium.d.ts +104 -0
  108. package/dist/chains/solana/dex/raydium/types.d.ts +42 -0
  109. package/dist/chains/solana/environment.d.ts +15 -0
  110. package/dist/chains/solana/generated/specs/spec-helpers.d.ts +35 -0
  111. package/dist/chains/solana/generated/specs/specs.d.ts +73 -0
  112. package/dist/chains/solana/index.browser.d.ts +3 -0
  113. package/dist/chains/solana/index.d.ts +7 -0
  114. package/dist/chains/solana/keypairUtils.d.ts +7 -0
  115. package/dist/chains/solana/prompts.d.ts +12 -0
  116. package/dist/chains/solana/providers/wallet.d.ts +2 -0
  117. package/dist/chains/solana/routes/index.d.ts +2 -0
  118. package/dist/chains/solana/routes/sign.d.ts +16 -0
  119. package/dist/chains/solana/service.d.ts +237 -0
  120. package/dist/chains/solana/types.d.ts +377 -0
  121. package/dist/chains/solana/vitest.config.d.ts +2 -0
  122. package/dist/chains/wallet-action.d.ts +3 -0
  123. package/dist/contracts.d.ts +58 -0
  124. package/dist/core-augmentation.d.ts +9 -0
  125. package/dist/index.d.mts +27 -34727
  126. package/dist/index.d.ts +27 -0
  127. package/dist/index.mjs +28246 -21186
  128. package/dist/index.mjs.map +153 -0
  129. package/dist/lib/server-wallet-trade.d.ts +22 -0
  130. package/dist/lib/server-wallet-trade.js +333 -0
  131. package/dist/lib/server-wallet-trade.js.map +11 -0
  132. package/dist/lib/wallet-export-guard.d.ts +45 -0
  133. package/dist/lp/actions/liquidity.d.ts +2 -0
  134. package/dist/lp/e2e/real-token-tests.d.ts +6 -0
  135. package/dist/lp/e2e/scenarios.d.ts +9 -0
  136. package/dist/lp/e2e/test-utils.d.ts +28 -0
  137. package/dist/lp/lp-manager-entry.d.ts +18 -0
  138. package/dist/lp/services/ConcentratedLiquidityService.d.ts +32 -0
  139. package/dist/lp/services/DexInteractionService.d.ts +34 -0
  140. package/dist/lp/services/LpManagementService.d.ts +116 -0
  141. package/dist/lp/services/UserLpProfileService.d.ts +18 -0
  142. package/dist/lp/services/VaultService.d.ts +21 -0
  143. package/dist/lp/services/YieldOptimizationService.d.ts +59 -0
  144. package/dist/lp/services/__tests__/MockLpService.d.ts +17 -0
  145. package/dist/lp/types.d.ts +439 -0
  146. package/dist/lp/utils/solanaClient.d.ts +26 -0
  147. package/dist/plugin.d.ts +7 -0
  148. package/dist/policy/policy.d.ts +14 -0
  149. package/dist/providers/canonical-provider.d.ts +19 -0
  150. package/dist/providers/wallet-provider.d.ts +5 -0
  151. package/dist/register-routes.d.ts +1 -0
  152. package/dist/routes/plugin.d.ts +14 -0
  153. package/dist/routes/wallet-market-overview-route.d.ts +7 -0
  154. package/dist/sdk/abi.d.ts +396 -0
  155. package/dist/sdk/bridge/abis.d.ts +63 -0
  156. package/dist/sdk/bridge/client.d.ts +48 -0
  157. package/dist/sdk/bridge/index.d.ts +14 -0
  158. package/dist/sdk/bridge/solana.d.ts +131 -0
  159. package/dist/sdk/bridge/types.d.ts +92 -0
  160. package/dist/sdk/convenience.d.ts +104 -0
  161. package/dist/sdk/escrow/MutualStakeEscrow.d.ts +75 -0
  162. package/dist/sdk/escrow/types.d.ts +58 -0
  163. package/dist/sdk/escrow/verifiers.d.ts +25 -0
  164. package/dist/sdk/identity/erc8004.d.ts +304 -0
  165. package/dist/sdk/identity/reputation.d.ts +317 -0
  166. package/dist/sdk/identity/uaid.d.ts +192 -0
  167. package/dist/sdk/identity/validation.d.ts +282 -0
  168. package/dist/sdk/index.d.ts +133 -0
  169. package/dist/sdk/index.js +5284 -0
  170. package/dist/sdk/index.js.map +40 -0
  171. package/dist/sdk/policy/SpendingPolicy.d.ts +105 -0
  172. package/dist/sdk/policy/UptoBillingPolicy.d.ts +87 -0
  173. package/dist/sdk/router/PaymentRouter.d.ts +77 -0
  174. package/dist/sdk/router/index.d.ts +2 -0
  175. package/dist/sdk/swap/SwapModule.d.ts +47 -0
  176. package/dist/sdk/swap/abi.d.ts +50 -0
  177. package/dist/sdk/swap/index.d.ts +11 -0
  178. package/dist/sdk/swap/types.d.ts +101 -0
  179. package/dist/sdk/tokens/decimals.d.ts +64 -0
  180. package/dist/sdk/tokens/registry.d.ts +81 -0
  181. package/dist/sdk/tokens/solana.d.ts +107 -0
  182. package/dist/sdk/tokens/transfers.d.ts +94 -0
  183. package/dist/sdk/types.d.ts +129 -0
  184. package/dist/sdk/wallet-core.d.ts +29450 -0
  185. package/dist/sdk/x402/budget.d.ts +51 -0
  186. package/dist/sdk/x402/chains/abstract/index.d.ts +134 -0
  187. package/dist/sdk/x402/client.d.ts +66 -0
  188. package/dist/sdk/x402/index.d.ts +8 -0
  189. package/dist/sdk/x402/middleware.d.ts +37 -0
  190. package/dist/sdk/x402/multi-asset.d.ts +53 -0
  191. package/dist/sdk/x402/types.d.ts +109 -0
  192. package/dist/security/wallet-context-safety.d.ts +7 -0
  193. package/dist/security/wallet-financial-confirmation.d.ts +23 -0
  194. package/dist/services/wallet-backend-service.d.ts +39 -0
  195. package/dist/types/wallet-router.d.ts +130 -0
  196. package/dist/utils/intent-trajectory.d.ts +34 -0
  197. package/dist/wallet/backend.d.ts +41 -0
  198. package/dist/wallet/errors.d.ts +17 -0
  199. package/dist/wallet/index.d.ts +6 -0
  200. package/dist/wallet/local-eoa-backend.d.ts +37 -0
  201. package/dist/wallet/pending.d.ts +47 -0
  202. package/dist/wallet/select-backend.d.ts +11 -0
  203. package/dist/wallet/steward-backend.d.ts +22 -0
  204. package/dist/wallet-action.d.ts +1 -0
  205. package/dist/wallet-action.js +6292 -0
  206. package/dist/wallet-action.js.map +44 -0
  207. package/package.json +35 -21
  208. package/registry-entry.json +134 -0
  209. package/src/analytics/birdeye/actions/wallet-search-address.ts +85 -5
  210. package/src/analytics/birdeye/birdeye-task.ts +25 -9
  211. package/src/analytics/birdeye/birdeye.ts +6 -7
  212. package/src/analytics/birdeye/constants.ts +0 -1
  213. package/src/analytics/birdeye/providers/agent-portfolio-provider.ts +0 -1
  214. package/src/analytics/birdeye/providers/market.ts +51 -45
  215. package/src/analytics/birdeye/providers/portfolio-factory.ts +79 -38
  216. package/src/analytics/birdeye/providers/trending.ts +43 -46
  217. package/src/analytics/birdeye/providers/wallet.ts +0 -1
  218. package/src/analytics/birdeye/search-category.test.ts +1 -1
  219. package/src/analytics/birdeye/search-category.ts +77 -12
  220. package/src/analytics/birdeye/service.test.ts +146 -0
  221. package/src/analytics/birdeye/service.ts +220 -105
  222. package/src/analytics/birdeye/types/api/common.ts +0 -1
  223. package/src/analytics/birdeye/types/api/defi.ts +0 -1
  224. package/src/analytics/birdeye/types/api/pair.ts +0 -1
  225. package/src/analytics/birdeye/types/api/search.ts +0 -1
  226. package/src/analytics/birdeye/types/api/token.ts +0 -1
  227. package/src/analytics/birdeye/types/api/trader.ts +0 -1
  228. package/src/analytics/birdeye/types/api/wallet.ts +0 -1
  229. package/src/analytics/birdeye/types/shared.ts +0 -11
  230. package/src/analytics/birdeye/utils.test.ts +69 -0
  231. package/src/analytics/birdeye/utils.ts +11 -8
  232. package/src/analytics/dexscreener/search-category.ts +0 -1
  233. package/src/analytics/dexscreener/service.ts +7 -12
  234. package/src/analytics/dexscreener/types.ts +0 -1
  235. package/src/analytics/lpinfo/index.ts +5 -2
  236. package/src/analytics/lpinfo/kamino/README.md +2 -2
  237. package/src/analytics/lpinfo/kamino/index.ts +9 -2
  238. package/src/analytics/lpinfo/kamino/providers/kaminoLiquidityProvider.ts +6 -26
  239. package/src/analytics/lpinfo/kamino/providers/kaminoPoolProvider.ts +11 -12
  240. package/src/analytics/lpinfo/kamino/providers/kaminoProvider.ts +76 -32
  241. package/src/analytics/lpinfo/kamino/services/kaminoLiquidityService.ts +78 -38
  242. package/src/analytics/lpinfo/kamino/services/kaminoService.ts +71 -31
  243. package/src/analytics/lpinfo/steer/index.ts +7 -2
  244. package/src/analytics/lpinfo/steer/providers/steerLiquidityProvider.ts +25 -26
  245. package/src/analytics/lpinfo/steer/services/steerLiquidityService.ts +367 -149
  246. package/src/analytics/news/index.ts +7 -2
  247. package/src/analytics/news/interfaces/types.ts +0 -1
  248. package/src/analytics/news/providers/defiNewsProvider.ts +17 -44
  249. package/src/analytics/news/services/newsDataService.ts +1 -22
  250. package/src/analytics/news/utils/formatters.test.ts +60 -0
  251. package/src/analytics/news/utils/formatters.ts +0 -1
  252. package/src/analytics/token-info/action.ts +52 -212
  253. package/src/analytics/token-info/index.ts +1 -1
  254. package/src/analytics/token-info/params.test.ts +69 -0
  255. package/src/analytics/token-info/params.ts +13 -11
  256. package/src/analytics/token-info/providers.ts +46 -17
  257. package/src/analytics/token-info/service.ts +3 -3
  258. package/src/analytics/token-info/types.ts +2 -2
  259. package/src/api/wallet-routes.test.ts +56 -0
  260. package/src/api/wallet-routes.ts +1728 -0
  261. package/src/audit/audit-log.ts +57 -2
  262. package/src/browser-shim/build-shim.ts +1 -1
  263. package/src/browser-shim/shim.template.js +107 -117
  264. package/src/chains/{wallet-router.test.ts → __tests__/wallet-router.test.ts} +57 -10
  265. package/src/chains/evm/actions/helpers.ts +9 -7
  266. package/src/chains/evm/actions/swap.ts +176 -22
  267. package/src/chains/evm/actions/transfer.ts +29 -22
  268. package/src/chains/evm/biome.json +1 -1
  269. package/src/chains/evm/build.ts +6 -1
  270. package/src/chains/evm/constants.ts +19 -0
  271. package/src/chains/evm/contracts/artifacts/OZGovernor.json +25 -1682
  272. package/src/chains/evm/dex/aerodrome/index.ts +6 -1
  273. package/src/chains/evm/dex/aerodrome/services/AerodromeLpService.ts +41 -15
  274. package/src/chains/evm/dex/aerodrome/types.ts +1 -2
  275. package/src/chains/evm/dex/pancakeswp/index.ts +6 -1
  276. package/src/chains/evm/dex/pancakeswp/services/PancakeSwapV3LpService.ts +54 -17
  277. package/src/chains/evm/dex/pancakeswp/types.ts +1 -2
  278. package/src/chains/evm/dex/uniswap/index.ts +6 -1
  279. package/src/chains/evm/dex/uniswap/services/UniswapV3LpService.ts +20 -9
  280. package/src/chains/evm/dex/uniswap/types.ts +1 -2
  281. package/src/chains/evm/gov-router.ts +3 -1
  282. package/src/chains/evm/index.browser.ts +1 -1
  283. package/src/chains/evm/index.ts +5 -1
  284. package/src/chains/evm/prompts.ts +5 -0
  285. package/src/chains/evm/providers/get-balance.ts +1 -1
  286. package/src/chains/evm/providers/wallet.ts +80 -9
  287. package/src/chains/evm/routes/sign.ts +35 -26
  288. package/src/chains/evm/rpc-providers.ts +1 -1
  289. package/src/chains/evm/types/index.ts +22 -2
  290. package/src/chains/registry.ts +1 -1
  291. package/src/chains/wallet-action.ts +301 -91
  292. package/src/index.ts +9 -5
  293. package/src/lib/wallet-export-guard.test.ts +233 -0
  294. package/src/lib/wallet-export-guard.ts +1 -1
  295. package/src/lp/actions/liquidity.ts +53 -26
  296. package/src/lp/e2e/real-token-tests.ts +0 -1
  297. package/src/lp/e2e/scenarios.ts +1 -2
  298. package/src/lp/e2e/test-utils.ts +20 -7
  299. package/src/lp/lp-manager-entry.ts +2 -5
  300. package/src/lp/services/ConcentratedLiquidityService.ts +3 -10
  301. package/src/lp/services/DexInteractionService.ts +1 -2
  302. package/src/lp/services/LpManagementService.test.ts +0 -1
  303. package/src/lp/services/LpManagementService.ts +75 -35
  304. package/src/lp/services/UserLpProfileService.ts +2 -3
  305. package/src/lp/services/VaultService.ts +10 -4
  306. package/src/lp/services/YieldOptimizationService.ts +29 -13
  307. package/src/lp/services/__tests__/MockLpService.ts +1 -2
  308. package/src/lp/types.ts +9 -13
  309. package/src/lp/utils/solanaClient.ts +4 -2
  310. package/src/plugin.routes.test.ts +24 -0
  311. package/src/plugin.ts +30 -13
  312. package/src/providers/canonical-provider.ts +1 -1
  313. package/src/providers/{unified-wallet-provider.ts → wallet-provider.ts} +3 -3
  314. package/src/routes/__fixtures__/coingecko-markets.recorded.json +97 -0
  315. package/src/routes/wallet-market-overview-route.ts +1 -1
  316. package/src/routes/wallet-market-overview.contract.test.ts +139 -0
  317. package/src/routes/wallet-market-overview.real.test.ts +83 -0
  318. package/src/sdk/escrow/MutualStakeEscrow.ts +1 -2
  319. package/src/sdk/identity/erc8004.ts +1 -1
  320. package/src/sdk/identity/validation.ts +3 -4
  321. package/src/sdk/index.ts +2 -2
  322. package/src/sdk/policy/SpendingPolicy.ts +1 -1
  323. package/src/sdk/router/PaymentRouter.ts +8 -11
  324. package/src/sdk/swap/SwapModule.ts +1 -1
  325. package/src/sdk/tokens/registry.ts +1 -1
  326. package/src/sdk/x402/middleware.ts +2 -8
  327. package/src/security/__tests__/wallet-context-safety.test.ts +79 -0
  328. package/src/security/__tests__/wallet-financial-confirmation.test.ts +88 -0
  329. package/src/security/wallet-context-safety.ts +128 -0
  330. package/src/security/wallet-financial-confirmation.ts +150 -0
  331. package/src/services/wallet-backend-service.ts +15 -1
  332. package/src/utils/intent-trajectory.ts +2 -2
  333. package/src/wallet/steward-backend.ts +4 -4
  334. package/dist/LpManagementService-BWrQ5-cO.mjs +0 -353
  335. package/dist/MockLpService-D_Apn4Fd.mjs +0 -99
  336. package/dist/aerodrome-CfnESC32.mjs +0 -890
  337. package/dist/chunk-hT5z_Zn9.mjs +0 -35
  338. package/dist/lib/server-wallet-trade.d.mts +0 -34
  339. package/dist/lib/server-wallet-trade.mjs +0 -306
  340. package/dist/meteora-BPX39hZo.mjs +0 -22640
  341. package/dist/orca-Bybp1HXO.mjs +0 -249
  342. package/dist/pancakeswp-CkEXlXti.mjs +0 -604
  343. package/dist/plugin-ZO_MTyd0.mjs +0 -529
  344. package/dist/raydium-rfaM9yEf.mjs +0 -539
  345. package/dist/sdk/index.d.mts +0 -32492
  346. package/dist/sdk/index.mjs +0 -6415
  347. package/dist/types-D5252NZk.mjs +0 -487
  348. package/dist/uniswap-CReXgXVN.mjs +0 -573
  349. package/dist/wallet-action.d.mts +0 -6
  350. package/dist/wallet-action.mjs +0 -820
  351. package/src/analytics/birdeye/tasks/birdeye.ts +0 -232
  352. package/src/analytics/lpinfo/index.d.ts +0 -7
  353. package/src/chains/evm/contracts/artifacts/TimelockController.json +0 -1007
  354. package/src/chains/evm/contracts/artifacts/VoteToken.json +0 -895
  355. package/src/lp/tasks/LpAutoRebalanceTask.ts +0 -117
  356. package/src/lp/tasks/__tests__/LpAutoRebalanceTask.test.ts +0 -370
@@ -1,890 +0,0 @@
1
- import { n as __exportAll } from "./chunk-hT5z_Zn9.mjs";
2
- import { o as registerLpProtocolProvider, r as createEvmLpProtocolProvider } from "./LpManagementService-BWrQ5-cO.mjs";
3
- import { Service, logger } from "@elizaos/core";
4
- import { createPublicClient, createWalletClient, http } from "viem";
5
- import { base } from "viem/chains";
6
- import { privateKeyToAccount } from "viem/accounts";
7
- //#region src/chains/evm/dex/aerodrome/types.ts
8
- const AERODROME_ADDRESSES = { 8453: {
9
- router: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
10
- factory: "0x420DD381b31aEf6683db6B902084cB0FFECe40Da",
11
- voter: "0x16613524e02ad97eDfeF371bC883F2F5d6C480A5",
12
- aero: "0x940181a94A35A4569E4529A3CDfB74e38FD98631"
13
- } };
14
- const AERODROME_ROUTER_ABI = [
15
- {
16
- inputs: [
17
- {
18
- name: "tokenA",
19
- type: "address"
20
- },
21
- {
22
- name: "tokenB",
23
- type: "address"
24
- },
25
- {
26
- name: "stable",
27
- type: "bool"
28
- },
29
- {
30
- name: "amountADesired",
31
- type: "uint256"
32
- },
33
- {
34
- name: "amountBDesired",
35
- type: "uint256"
36
- },
37
- {
38
- name: "amountAMin",
39
- type: "uint256"
40
- },
41
- {
42
- name: "amountBMin",
43
- type: "uint256"
44
- },
45
- {
46
- name: "to",
47
- type: "address"
48
- },
49
- {
50
- name: "deadline",
51
- type: "uint256"
52
- }
53
- ],
54
- name: "addLiquidity",
55
- outputs: [
56
- {
57
- name: "amountA",
58
- type: "uint256"
59
- },
60
- {
61
- name: "amountB",
62
- type: "uint256"
63
- },
64
- {
65
- name: "liquidity",
66
- type: "uint256"
67
- }
68
- ],
69
- stateMutability: "nonpayable",
70
- type: "function"
71
- },
72
- {
73
- inputs: [
74
- {
75
- name: "token",
76
- type: "address"
77
- },
78
- {
79
- name: "stable",
80
- type: "bool"
81
- },
82
- {
83
- name: "amountTokenDesired",
84
- type: "uint256"
85
- },
86
- {
87
- name: "amountTokenMin",
88
- type: "uint256"
89
- },
90
- {
91
- name: "amountETHMin",
92
- type: "uint256"
93
- },
94
- {
95
- name: "to",
96
- type: "address"
97
- },
98
- {
99
- name: "deadline",
100
- type: "uint256"
101
- }
102
- ],
103
- name: "addLiquidityETH",
104
- outputs: [
105
- {
106
- name: "amountToken",
107
- type: "uint256"
108
- },
109
- {
110
- name: "amountETH",
111
- type: "uint256"
112
- },
113
- {
114
- name: "liquidity",
115
- type: "uint256"
116
- }
117
- ],
118
- stateMutability: "payable",
119
- type: "function"
120
- },
121
- {
122
- inputs: [
123
- {
124
- name: "tokenA",
125
- type: "address"
126
- },
127
- {
128
- name: "tokenB",
129
- type: "address"
130
- },
131
- {
132
- name: "stable",
133
- type: "bool"
134
- },
135
- {
136
- name: "liquidity",
137
- type: "uint256"
138
- },
139
- {
140
- name: "amountAMin",
141
- type: "uint256"
142
- },
143
- {
144
- name: "amountBMin",
145
- type: "uint256"
146
- },
147
- {
148
- name: "to",
149
- type: "address"
150
- },
151
- {
152
- name: "deadline",
153
- type: "uint256"
154
- }
155
- ],
156
- name: "removeLiquidity",
157
- outputs: [{
158
- name: "amountA",
159
- type: "uint256"
160
- }, {
161
- name: "amountB",
162
- type: "uint256"
163
- }],
164
- stateMutability: "nonpayable",
165
- type: "function"
166
- },
167
- {
168
- inputs: [
169
- {
170
- name: "token",
171
- type: "address"
172
- },
173
- {
174
- name: "stable",
175
- type: "bool"
176
- },
177
- {
178
- name: "liquidity",
179
- type: "uint256"
180
- },
181
- {
182
- name: "amountTokenMin",
183
- type: "uint256"
184
- },
185
- {
186
- name: "amountETHMin",
187
- type: "uint256"
188
- },
189
- {
190
- name: "to",
191
- type: "address"
192
- },
193
- {
194
- name: "deadline",
195
- type: "uint256"
196
- }
197
- ],
198
- name: "removeLiquidityETH",
199
- outputs: [{
200
- name: "amountToken",
201
- type: "uint256"
202
- }, {
203
- name: "amountETH",
204
- type: "uint256"
205
- }],
206
- stateMutability: "nonpayable",
207
- type: "function"
208
- },
209
- {
210
- inputs: [
211
- {
212
- name: "tokenA",
213
- type: "address"
214
- },
215
- {
216
- name: "tokenB",
217
- type: "address"
218
- },
219
- {
220
- name: "stable",
221
- type: "bool"
222
- }
223
- ],
224
- name: "getReserves",
225
- outputs: [{
226
- name: "reserveA",
227
- type: "uint256"
228
- }, {
229
- name: "reserveB",
230
- type: "uint256"
231
- }],
232
- stateMutability: "view",
233
- type: "function"
234
- },
235
- {
236
- inputs: [
237
- {
238
- name: "amountIn",
239
- type: "uint256"
240
- },
241
- {
242
- name: "tokenIn",
243
- type: "address"
244
- },
245
- {
246
- name: "tokenOut",
247
- type: "address"
248
- }
249
- ],
250
- name: "getAmountOut",
251
- outputs: [{
252
- name: "amount",
253
- type: "uint256"
254
- }, {
255
- name: "stable",
256
- type: "bool"
257
- }],
258
- stateMutability: "view",
259
- type: "function"
260
- }
261
- ];
262
- const AERODROME_FACTORY_ABI = [
263
- {
264
- inputs: [
265
- {
266
- name: "tokenA",
267
- type: "address"
268
- },
269
- {
270
- name: "tokenB",
271
- type: "address"
272
- },
273
- {
274
- name: "stable",
275
- type: "bool"
276
- }
277
- ],
278
- name: "getPool",
279
- outputs: [{
280
- name: "",
281
- type: "address"
282
- }],
283
- stateMutability: "view",
284
- type: "function"
285
- },
286
- {
287
- inputs: [],
288
- name: "allPools",
289
- outputs: [{
290
- name: "",
291
- type: "address[]"
292
- }],
293
- stateMutability: "view",
294
- type: "function"
295
- },
296
- {
297
- inputs: [],
298
- name: "allPoolsLength",
299
- outputs: [{
300
- name: "",
301
- type: "uint256"
302
- }],
303
- stateMutability: "view",
304
- type: "function"
305
- },
306
- {
307
- inputs: [{
308
- name: "index",
309
- type: "uint256"
310
- }],
311
- name: "allPools",
312
- outputs: [{
313
- name: "",
314
- type: "address"
315
- }],
316
- stateMutability: "view",
317
- type: "function"
318
- }
319
- ];
320
- const AERODROME_POOL_ABI = [
321
- {
322
- inputs: [],
323
- name: "token0",
324
- outputs: [{ type: "address" }],
325
- stateMutability: "view",
326
- type: "function"
327
- },
328
- {
329
- inputs: [],
330
- name: "token1",
331
- outputs: [{ type: "address" }],
332
- stateMutability: "view",
333
- type: "function"
334
- },
335
- {
336
- inputs: [],
337
- name: "stable",
338
- outputs: [{ type: "bool" }],
339
- stateMutability: "view",
340
- type: "function"
341
- },
342
- {
343
- inputs: [],
344
- name: "reserve0",
345
- outputs: [{ type: "uint256" }],
346
- stateMutability: "view",
347
- type: "function"
348
- },
349
- {
350
- inputs: [],
351
- name: "reserve1",
352
- outputs: [{ type: "uint256" }],
353
- stateMutability: "view",
354
- type: "function"
355
- },
356
- {
357
- inputs: [],
358
- name: "totalSupply",
359
- outputs: [{ type: "uint256" }],
360
- stateMutability: "view",
361
- type: "function"
362
- },
363
- {
364
- inputs: [{
365
- name: "account",
366
- type: "address"
367
- }],
368
- name: "balanceOf",
369
- outputs: [{ type: "uint256" }],
370
- stateMutability: "view",
371
- type: "function"
372
- },
373
- {
374
- inputs: [],
375
- name: "getReserves",
376
- outputs: [
377
- {
378
- name: "_reserve0",
379
- type: "uint256"
380
- },
381
- {
382
- name: "_reserve1",
383
- type: "uint256"
384
- },
385
- {
386
- name: "_blockTimestampLast",
387
- type: "uint256"
388
- }
389
- ],
390
- stateMutability: "view",
391
- type: "function"
392
- },
393
- {
394
- inputs: [{
395
- name: "spender",
396
- type: "address"
397
- }, {
398
- name: "amount",
399
- type: "uint256"
400
- }],
401
- name: "approve",
402
- outputs: [{ type: "bool" }],
403
- stateMutability: "nonpayable",
404
- type: "function"
405
- },
406
- {
407
- inputs: [{
408
- name: "owner",
409
- type: "address"
410
- }, {
411
- name: "spender",
412
- type: "address"
413
- }],
414
- name: "allowance",
415
- outputs: [{ type: "uint256" }],
416
- stateMutability: "view",
417
- type: "function"
418
- }
419
- ];
420
- const ERC20_ABI = [
421
- {
422
- inputs: [],
423
- name: "symbol",
424
- outputs: [{ type: "string" }],
425
- stateMutability: "view",
426
- type: "function"
427
- },
428
- {
429
- inputs: [],
430
- name: "decimals",
431
- outputs: [{ type: "uint8" }],
432
- stateMutability: "view",
433
- type: "function"
434
- },
435
- {
436
- inputs: [],
437
- name: "name",
438
- outputs: [{ type: "string" }],
439
- stateMutability: "view",
440
- type: "function"
441
- },
442
- {
443
- inputs: [{
444
- name: "account",
445
- type: "address"
446
- }],
447
- name: "balanceOf",
448
- outputs: [{ type: "uint256" }],
449
- stateMutability: "view",
450
- type: "function"
451
- },
452
- {
453
- inputs: [{
454
- name: "spender",
455
- type: "address"
456
- }, {
457
- name: "amount",
458
- type: "uint256"
459
- }],
460
- name: "approve",
461
- outputs: [{ type: "bool" }],
462
- stateMutability: "nonpayable",
463
- type: "function"
464
- },
465
- {
466
- inputs: [{
467
- name: "owner",
468
- type: "address"
469
- }, {
470
- name: "spender",
471
- type: "address"
472
- }],
473
- name: "allowance",
474
- outputs: [{ type: "uint256" }],
475
- stateMutability: "view",
476
- type: "function"
477
- }
478
- ];
479
- //#endregion
480
- //#region src/chains/evm/dex/aerodrome/services/AerodromeLpService.ts
481
- const SUPPORTED_CHAIN_IDS = [8453];
482
- var AerodromeLpService = class AerodromeLpService extends Service {
483
- static serviceType = "aerodrome-lp";
484
- capabilityDescription = "Provides Aerodrome DEX liquidity pool management on Base chain.";
485
- publicClient = null;
486
- walletClients = /* @__PURE__ */ new Map();
487
- rpcUrl = null;
488
- constructor(runtime) {
489
- super(runtime);
490
- if (runtime) this.initializeRpcUrl();
491
- }
492
- initializeRpcUrl() {
493
- for (const key of ["BASE_RPC_URL", "EVM_PROVIDER_BASE"]) {
494
- const rpcUrl = this.runtime.getSetting(key);
495
- if (rpcUrl && typeof rpcUrl === "string") {
496
- this.rpcUrl = rpcUrl;
497
- break;
498
- }
499
- }
500
- }
501
- getPublicClient() {
502
- if (this.publicClient) return this.publicClient;
503
- this.publicClient = createPublicClient({
504
- chain: base,
505
- transport: this.rpcUrl ? http(this.rpcUrl) : http()
506
- });
507
- return this.publicClient;
508
- }
509
- getWalletClient(privateKey) {
510
- const cacheKey = privateKey.slice(0, 10);
511
- let client = this.walletClients.get(cacheKey);
512
- if (client) return client;
513
- const account = privateKeyToAccount(privateKey);
514
- client = createWalletClient({
515
- chain: base,
516
- transport: this.rpcUrl ? http(this.rpcUrl) : http(),
517
- account
518
- });
519
- this.walletClients.set(cacheKey, client);
520
- return client;
521
- }
522
- static async start(runtime) {
523
- const service = new AerodromeLpService(runtime);
524
- logger.info("[AerodromeLpService] started");
525
- return service;
526
- }
527
- async stop() {
528
- this.publicClient = null;
529
- this.walletClients.clear();
530
- logger.info("[AerodromeLpService] stopped");
531
- }
532
- getDexName() {
533
- return "aerodrome";
534
- }
535
- getSupportedChainIds() {
536
- return SUPPORTED_CHAIN_IDS;
537
- }
538
- supportsChain(chainId) {
539
- return chainId === 8453;
540
- }
541
- async getPools(chainId, tokenA, tokenB, _feeTier) {
542
- if (!this.supportsChain(chainId)) {
543
- logger.warn(`[AerodromeLpService] Chain ${chainId} not supported`);
544
- return [];
545
- }
546
- const addresses = AERODROME_ADDRESSES[8453];
547
- const client = this.getPublicClient();
548
- const pools = [];
549
- if (tokenA && tokenB) for (const stable of [false, true]) try {
550
- const poolAddress = await client.readContract({
551
- address: addresses.factory,
552
- abi: AERODROME_FACTORY_ABI,
553
- functionName: "getPool",
554
- args: [
555
- tokenA,
556
- tokenB,
557
- stable
558
- ]
559
- });
560
- if (poolAddress && poolAddress !== "0x0000000000000000000000000000000000000000") {
561
- const poolInfo = await this.getPoolInfo(poolAddress);
562
- if (poolInfo) pools.push(poolInfo);
563
- }
564
- } catch (_error) {
565
- logger.debug(`[AerodromeLpService] No ${stable ? "stable" : "volatile"} pool found for ${tokenA}/${tokenB}`);
566
- }
567
- return pools;
568
- }
569
- async getPoolInfo(poolAddress) {
570
- const client = this.getPublicClient();
571
- try {
572
- const [token0, token1, stable, reserves] = await Promise.all([
573
- client.readContract({
574
- address: poolAddress,
575
- abi: AERODROME_POOL_ABI,
576
- functionName: "token0"
577
- }),
578
- client.readContract({
579
- address: poolAddress,
580
- abi: AERODROME_POOL_ABI,
581
- functionName: "token1"
582
- }),
583
- client.readContract({
584
- address: poolAddress,
585
- abi: AERODROME_POOL_ABI,
586
- functionName: "stable"
587
- }),
588
- client.readContract({
589
- address: poolAddress,
590
- abi: AERODROME_POOL_ABI,
591
- functionName: "getReserves"
592
- })
593
- ]);
594
- const [symbol0, decimals0, symbol1, decimals1] = await Promise.all([
595
- client.readContract({
596
- address: token0,
597
- abi: ERC20_ABI,
598
- functionName: "symbol"
599
- }).catch(() => "UNKNOWN"),
600
- client.readContract({
601
- address: token0,
602
- abi: ERC20_ABI,
603
- functionName: "decimals"
604
- }).catch(() => 18),
605
- client.readContract({
606
- address: token1,
607
- abi: ERC20_ABI,
608
- functionName: "symbol"
609
- }).catch(() => "UNKNOWN"),
610
- client.readContract({
611
- address: token1,
612
- abi: ERC20_ABI,
613
- functionName: "decimals"
614
- }).catch(() => 18)
615
- ]);
616
- const poolType = stable ? "stable" : "volatile";
617
- return {
618
- id: poolAddress,
619
- dex: "aerodrome",
620
- chainId: 8453,
621
- chainName: "Base",
622
- poolAddress,
623
- tokenA: {
624
- address: token0,
625
- symbol: symbol0,
626
- decimals: Number(decimals0),
627
- reserve: reserves[0].toString()
628
- },
629
- tokenB: {
630
- address: token1,
631
- symbol: symbol1,
632
- decimals: Number(decimals1),
633
- reserve: reserves[1].toString()
634
- },
635
- fee: stable ? 4e-4 : .003,
636
- displayName: `${symbol0}/${symbol1} (${poolType})`,
637
- metadata: {
638
- poolType,
639
- stable
640
- }
641
- };
642
- } catch (error) {
643
- logger.error(`[AerodromeLpService] Error fetching pool info for ${poolAddress}:`, error);
644
- return null;
645
- }
646
- }
647
- async addLiquidity(params) {
648
- if (!this.supportsChain(params.chainId)) return {
649
- success: false,
650
- error: `Chain ${params.chainId} not supported. Aerodrome is only on Base (8453).`
651
- };
652
- const addresses = AERODROME_ADDRESSES[8453];
653
- try {
654
- const publicClient = this.getPublicClient();
655
- const walletClient = this.getWalletClient(params.wallet.privateKey);
656
- const poolInfo = await this.getPoolInfo(params.poolAddress);
657
- if (!poolInfo) return {
658
- success: false,
659
- error: "Pool not found"
660
- };
661
- const stable = poolInfo.metadata?.stable === true;
662
- const slippageMultiplier = BigInt(1e4 - params.slippageBps);
663
- const amountAMin = params.tokenAAmount * slippageMultiplier / 10000n;
664
- const amountBMin = (params.tokenBAmount ?? 0n) * slippageMultiplier / 10000n;
665
- await this.approveToken(params.wallet.privateKey, poolInfo.tokenA.address, addresses.router, params.tokenAAmount);
666
- if (params.tokenBAmount && params.tokenBAmount > 0n) await this.approveToken(params.wallet.privateKey, poolInfo.tokenB.address, addresses.router, params.tokenBAmount);
667
- const deadline = params.deadline ?? BigInt(Math.floor(Date.now() / 1e3) + 1800);
668
- const { request } = await publicClient.simulateContract({
669
- address: addresses.router,
670
- abi: AERODROME_ROUTER_ABI,
671
- functionName: "addLiquidity",
672
- args: [
673
- poolInfo.tokenA.address,
674
- poolInfo.tokenB.address,
675
- stable,
676
- params.tokenAAmount,
677
- params.tokenBAmount ?? 0n,
678
- amountAMin,
679
- amountBMin,
680
- params.wallet.address,
681
- deadline
682
- ],
683
- account: walletClient.account
684
- });
685
- const hash = await walletClient.writeContract(request);
686
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
687
- return {
688
- success: receipt.status === "success",
689
- transactionId: hash,
690
- hash,
691
- chainId: params.chainId,
692
- blockNumber: receipt.blockNumber,
693
- gasUsed: receipt.gasUsed,
694
- data: {
695
- poolAddress: params.poolAddress,
696
- stable
697
- }
698
- };
699
- } catch (error) {
700
- logger.error("[AerodromeLpService] Error adding liquidity:", error);
701
- return {
702
- success: false,
703
- error: error instanceof Error ? error.message : "Unknown error adding liquidity"
704
- };
705
- }
706
- }
707
- async removeLiquidity(params) {
708
- if (!this.supportsChain(params.chainId)) return {
709
- success: false,
710
- error: `Chain ${params.chainId} not supported. Aerodrome is only on Base (8453).`
711
- };
712
- const addresses = AERODROME_ADDRESSES[8453];
713
- try {
714
- const publicClient = this.getPublicClient();
715
- const walletClient = this.getWalletClient(params.wallet.privateKey);
716
- const poolInfo = await this.getPoolInfo(params.poolAddress);
717
- if (!poolInfo) return {
718
- success: false,
719
- error: "Pool not found"
720
- };
721
- const stable = poolInfo.metadata?.stable === true;
722
- let lpTokenAmount = params.lpTokenAmount;
723
- if (!lpTokenAmount) {
724
- const balance = await publicClient.readContract({
725
- address: params.poolAddress,
726
- abi: AERODROME_POOL_ABI,
727
- functionName: "balanceOf",
728
- args: [params.wallet.address]
729
- });
730
- if (params.percentageToRemove && params.percentageToRemove < 100) lpTokenAmount = balance * BigInt(params.percentageToRemove) / 100n;
731
- else lpTokenAmount = balance;
732
- }
733
- if (!lpTokenAmount || lpTokenAmount === 0n) return {
734
- success: false,
735
- error: "No LP tokens to remove"
736
- };
737
- await this.approveToken(params.wallet.privateKey, params.poolAddress, addresses.router, lpTokenAmount);
738
- BigInt(1e4 - params.slippageBps);
739
- const deadline = params.deadline ?? BigInt(Math.floor(Date.now() / 1e3) + 1800);
740
- const { request } = await publicClient.simulateContract({
741
- address: addresses.router,
742
- abi: AERODROME_ROUTER_ABI,
743
- functionName: "removeLiquidity",
744
- args: [
745
- poolInfo.tokenA.address,
746
- poolInfo.tokenB.address,
747
- stable,
748
- lpTokenAmount,
749
- 0n,
750
- 0n,
751
- params.wallet.address,
752
- deadline
753
- ],
754
- account: walletClient.account
755
- });
756
- const hash = await walletClient.writeContract(request);
757
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
758
- return {
759
- success: receipt.status === "success",
760
- transactionId: hash,
761
- hash,
762
- chainId: params.chainId,
763
- blockNumber: receipt.blockNumber,
764
- gasUsed: receipt.gasUsed
765
- };
766
- } catch (error) {
767
- logger.error("[AerodromeLpService] Error removing liquidity:", error);
768
- return {
769
- success: false,
770
- error: error instanceof Error ? error.message : "Unknown error removing liquidity"
771
- };
772
- }
773
- }
774
- async getPositionDetails(chainId, owner, poolAddress, _tokenId) {
775
- if (!this.supportsChain(chainId)) return null;
776
- const client = this.getPublicClient();
777
- try {
778
- const poolInfo = await this.getPoolInfo(poolAddress);
779
- if (!poolInfo) return null;
780
- const lpBalance = await client.readContract({
781
- address: poolAddress,
782
- abi: AERODROME_POOL_ABI,
783
- functionName: "balanceOf",
784
- args: [owner]
785
- });
786
- if (lpBalance === 0n) return null;
787
- const totalSupply = await client.readContract({
788
- address: poolAddress,
789
- abi: AERODROME_POOL_ABI,
790
- functionName: "totalSupply"
791
- });
792
- const lpBalanceBigInt = lpBalance;
793
- const totalSupplyBigInt = totalSupply;
794
- const reserve0 = BigInt(poolInfo.tokenA.reserve ?? "0");
795
- const reserve1 = BigInt(poolInfo.tokenB.reserve ?? "0");
796
- const amount0 = totalSupplyBigInt > 0n ? reserve0 * lpBalanceBigInt / totalSupplyBigInt : 0n;
797
- const amount1 = totalSupplyBigInt > 0n ? reserve1 * lpBalanceBigInt / totalSupplyBigInt : 0n;
798
- return {
799
- poolId: poolAddress,
800
- dex: "aerodrome",
801
- chainId: 8453,
802
- owner,
803
- lpTokenBalance: {
804
- address: poolAddress,
805
- balance: lpBalanceBigInt.toString(),
806
- decimals: 18,
807
- symbol: `AERO-LP-${poolInfo.tokenA.symbol}/${poolInfo.tokenB.symbol}`
808
- },
809
- underlyingTokens: [{
810
- address: poolInfo.tokenA.address,
811
- balance: amount0.toString(),
812
- decimals: poolInfo.tokenA.decimals,
813
- symbol: poolInfo.tokenA.symbol
814
- }, {
815
- address: poolInfo.tokenB.address,
816
- balance: amount1.toString(),
817
- decimals: poolInfo.tokenB.decimals,
818
- symbol: poolInfo.tokenB.symbol
819
- }],
820
- metadata: poolInfo.metadata
821
- };
822
- } catch (error) {
823
- logger.error(`[AerodromeLpService] Error getting position details for ${owner}:`, error);
824
- return null;
825
- }
826
- }
827
- async getAllPositions(chainId, _owner) {
828
- if (!this.supportsChain(chainId)) return [];
829
- logger.info(`[AerodromeLpService] getAllPositions not fully implemented - need pool tracking`);
830
- return [];
831
- }
832
- async getMarketData(poolAddresses) {
833
- const result = {};
834
- for (const address of poolAddresses) try {
835
- const poolInfo = await this.getPoolInfo(address);
836
- if (poolInfo) result[address] = poolInfo;
837
- } catch {}
838
- return result;
839
- }
840
- async approveToken(privateKey, tokenAddress, spenderAddress, amount) {
841
- const publicClient = this.getPublicClient();
842
- const walletClient = this.getWalletClient(privateKey);
843
- if (await publicClient.readContract({
844
- address: tokenAddress,
845
- abi: ERC20_ABI,
846
- functionName: "allowance",
847
- args: [walletClient.account?.address, spenderAddress]
848
- }) >= amount) return;
849
- logger.info(`[AerodromeLpService] Approving ${tokenAddress} for ${spenderAddress}`);
850
- const { request } = await publicClient.simulateContract({
851
- address: tokenAddress,
852
- abi: ERC20_ABI,
853
- functionName: "approve",
854
- args: [spenderAddress, amount],
855
- account: walletClient.account
856
- });
857
- const hash = await walletClient.writeContract(request);
858
- await publicClient.waitForTransactionReceipt({ hash });
859
- logger.info(`[AerodromeLpService] Token approved: ${hash}`);
860
- }
861
- };
862
- //#endregion
863
- //#region src/chains/evm/dex/aerodrome/index.ts
864
- var aerodrome_exports = /* @__PURE__ */ __exportAll({
865
- AERODROME_ADDRESSES: () => AERODROME_ADDRESSES,
866
- AERODROME_FACTORY_ABI: () => AERODROME_FACTORY_ABI,
867
- AERODROME_POOL_ABI: () => AERODROME_POOL_ABI,
868
- AERODROME_ROUTER_ABI: () => AERODROME_ROUTER_ABI,
869
- AerodromeLpService: () => AerodromeLpService,
870
- ERC20_ABI: () => ERC20_ABI,
871
- aerodromePlugin: () => aerodromePlugin,
872
- default: () => aerodromePlugin
873
- });
874
- const aerodromePlugin = {
875
- name: "@elizaos/plugin-lp-manager/aerodrome",
876
- description: "Aerodrome DEX liquidity pool management plugin for Base chain",
877
- services: [AerodromeLpService],
878
- actions: [],
879
- providers: [],
880
- init: async (_config, runtime) => {
881
- console.info("Aerodrome Plugin initialized");
882
- await registerLpProtocolProvider(runtime, createEvmLpProtocolProvider({
883
- dex: "aerodrome",
884
- label: "Aerodrome",
885
- service: runtime.getService(AerodromeLpService.serviceType) ?? await AerodromeLpService.start(runtime)
886
- }));
887
- }
888
- };
889
- //#endregion
890
- export { aerodrome_exports as n, AerodromeLpService as r, aerodromePlugin as t };