@elizaos/plugin-wallet 2.0.0-beta.1 → 2.0.3-beta.5
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.
- package/README.md +70 -45
- package/auto-enable.ts +1 -1
- package/dist/actions/failure-codes.d.ts +12 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/analytics/birdeye/actions/wallet-search-address.d.ts +7 -0
- package/dist/analytics/birdeye/birdeye-task.d.ts +27 -0
- package/dist/analytics/birdeye/birdeye.d.ts +140 -0
- package/dist/analytics/birdeye/constants.d.ts +68 -0
- package/dist/analytics/birdeye/providers/agent-portfolio-provider.d.ts +8 -0
- package/dist/analytics/birdeye/providers/market.d.ts +18 -0
- package/dist/analytics/birdeye/providers/portfolio-factory.d.ts +10 -0
- package/dist/analytics/birdeye/providers/trending.d.ts +19 -0
- package/dist/analytics/birdeye/providers/wallet.d.ts +5 -0
- package/dist/analytics/birdeye/search-category.d.ts +52 -0
- package/dist/analytics/birdeye/service.d.ts +94 -0
- package/dist/analytics/birdeye/types/api/common.d.ts +199 -0
- package/dist/analytics/birdeye/types/api/defi.d.ts +187 -0
- package/dist/analytics/birdeye/types/api/pair.d.ts +182 -0
- package/dist/analytics/birdeye/types/api/search.d.ts +64 -0
- package/dist/analytics/birdeye/types/api/token.d.ts +580 -0
- package/dist/analytics/birdeye/types/api/trader.d.ts +70 -0
- package/dist/analytics/birdeye/types/api/wallet.d.ts +161 -0
- package/dist/analytics/birdeye/types/shared.d.ts +83 -0
- package/dist/analytics/birdeye/utils.d.ts +74 -0
- package/dist/analytics/dexscreener/errors.d.ts +2 -0
- package/dist/analytics/dexscreener/index.d.ts +3 -0
- package/dist/analytics/dexscreener/search-category.d.ts +3 -0
- package/dist/analytics/dexscreener/service.d.ts +34 -0
- package/dist/analytics/dexscreener/types.d.ts +131 -0
- package/dist/analytics/lpinfo/index.d.ts +31 -0
- package/dist/analytics/lpinfo/kamino/index.d.ts +7 -0
- package/dist/analytics/lpinfo/kamino/providers/kaminoLiquidityProvider.d.ts +6 -0
- package/dist/analytics/lpinfo/kamino/providers/kaminoPoolProvider.d.ts +6 -0
- package/dist/analytics/lpinfo/kamino/providers/kaminoProvider.d.ts +6 -0
- package/dist/analytics/lpinfo/kamino/services/kaminoLiquidityService.d.ts +203 -0
- package/dist/analytics/lpinfo/kamino/services/kaminoService.d.ts +171 -0
- package/dist/analytics/lpinfo/steer/index.d.ts +7 -0
- package/dist/analytics/lpinfo/steer/providers/steerLiquidityProvider.d.ts +6 -0
- package/dist/analytics/lpinfo/steer/services/steerLiquidityService.d.ts +208 -0
- package/dist/analytics/lpinfo/steer/steer-display-types.d.ts +97 -0
- package/dist/analytics/news/index.d.ts +32 -0
- package/dist/analytics/news/interfaces/types.d.ts +177 -0
- package/dist/analytics/news/providers/defiNewsProvider.d.ts +106 -0
- package/dist/analytics/news/services/newsDataService.d.ts +72 -0
- package/dist/analytics/news/utils/formatters.d.ts +54 -0
- package/dist/analytics/token-info/action.d.ts +6 -0
- package/dist/analytics/token-info/index.d.ts +3 -0
- package/dist/analytics/token-info/params.d.ts +10 -0
- package/dist/analytics/token-info/providers.d.ts +4 -0
- package/dist/analytics/token-info/service.d.ts +19 -0
- package/dist/analytics/token-info/types.d.ts +45 -0
- package/dist/api/wallet-routes.d.ts +100 -0
- package/dist/audit/audit-log.d.ts +29 -0
- package/dist/browser-shim/build-shim.d.ts +31 -0
- package/dist/browser-shim/index.d.ts +1 -0
- package/dist/chains/evm/actions/helpers.d.ts +31 -0
- package/dist/chains/evm/actions/swap.d.ts +53 -0
- package/dist/chains/evm/actions/transfer.d.ts +10 -0
- package/dist/chains/evm/bridge-router.d.ts +44 -0
- package/dist/chains/evm/build.d.ts +2 -0
- package/dist/chains/evm/chain-handler.d.ts +37 -0
- package/dist/chains/evm/constants.d.ts +16 -0
- package/dist/chains/evm/dex/aerodrome/index.d.ts +6 -0
- package/dist/chains/evm/dex/aerodrome/services/AerodromeLpService.d.ts +27 -0
- package/dist/chains/evm/dex/aerodrome/types.d.ts +435 -0
- package/dist/chains/evm/dex/pancakeswp/index.d.ts +6 -0
- package/dist/chains/evm/dex/pancakeswp/services/PancakeSwapV3LpService.d.ts +28 -0
- package/dist/chains/evm/dex/pancakeswp/types.d.ts +19 -0
- package/dist/chains/evm/dex/uniswap/index.d.ts +6 -0
- package/dist/chains/evm/dex/uniswap/services/UniswapV3LpService.d.ts +28 -0
- package/dist/chains/evm/dex/uniswap/types.d.ts +458 -0
- package/dist/chains/evm/generated/specs/spec-helpers.d.ts +35 -0
- package/dist/chains/evm/generated/specs/specs.d.ts +99 -0
- package/dist/chains/evm/gov-router.d.ts +6 -0
- package/dist/chains/evm/index.browser.d.ts +3 -0
- package/dist/chains/evm/index.d.ts +6 -0
- package/dist/chains/evm/prompts.d.ts +24 -0
- package/dist/chains/evm/providers/get-balance.d.ts +2 -0
- package/dist/chains/evm/providers/wallet.d.ts +35 -0
- package/dist/chains/evm/routes/sign.d.ts +13 -0
- package/dist/chains/evm/rpc-providers.d.ts +26 -0
- package/dist/chains/evm/service.d.ts +26 -0
- package/dist/chains/evm/templates/index.d.ts +1 -0
- package/dist/chains/evm/types/index.d.ts +296 -0
- package/dist/chains/evm/vitest.config.d.ts +2 -0
- package/dist/chains/registry.d.ts +3 -0
- package/dist/chains/solana/actions/confirmation.d.ts +9 -0
- package/dist/chains/solana/bn.d.ts +6 -0
- package/dist/chains/solana/build.d.ts +2 -0
- package/dist/chains/solana/constants.d.ts +2 -0
- package/dist/chains/solana/dex/meteora/e2e/scenarios.d.ts +10 -0
- package/dist/chains/solana/dex/meteora/e2e/test-utils.d.ts +28 -0
- package/dist/chains/solana/dex/meteora/index.d.ts +3 -0
- package/dist/chains/solana/dex/meteora/providers/positionProvider.d.ts +9 -0
- package/dist/chains/solana/dex/meteora/services/MeteoraLpService.d.ts +37 -0
- package/dist/chains/solana/dex/meteora/utils/dlmm.d.ts +6 -0
- package/dist/chains/solana/dex/meteora/utils/loadWallet.d.ts +14 -0
- package/dist/chains/solana/dex/meteora/utils/sendTransaction.d.ts +2 -0
- package/dist/chains/solana/dex/orca/index.d.ts +6 -0
- package/dist/chains/solana/dex/orca/providers/positionProvider.d.ts +10 -0
- package/dist/chains/solana/dex/orca/services/srv_orca.d.ts +10 -0
- package/dist/chains/solana/dex/orca/types.d.ts +61 -0
- package/dist/chains/solana/dex/orca/utils/loadWallet.d.ts +1 -0
- package/dist/chains/solana/dex/orca/utils/sendTransaction.d.ts +2 -0
- package/dist/chains/solana/dex/raydium/index.d.ts +6 -0
- package/dist/chains/solana/dex/raydium/providers/positionProvider.d.ts +10 -0
- package/dist/chains/solana/dex/raydium/services/srv_raydium.d.ts +104 -0
- package/dist/chains/solana/dex/raydium/types.d.ts +42 -0
- package/dist/chains/solana/environment.d.ts +15 -0
- package/dist/chains/solana/generated/specs/spec-helpers.d.ts +35 -0
- package/dist/chains/solana/generated/specs/specs.d.ts +73 -0
- package/dist/chains/solana/index.browser.d.ts +3 -0
- package/dist/chains/solana/index.d.ts +7 -0
- package/dist/chains/solana/keypairUtils.d.ts +7 -0
- package/dist/chains/solana/prompts.d.ts +12 -0
- package/dist/chains/solana/providers/wallet.d.ts +2 -0
- package/dist/chains/solana/routes/index.d.ts +2 -0
- package/dist/chains/solana/routes/sign.d.ts +16 -0
- package/dist/chains/solana/service.d.ts +237 -0
- package/dist/chains/solana/types.d.ts +377 -0
- package/dist/chains/solana/vitest.config.d.ts +2 -0
- package/dist/chains/wallet-action.d.ts +3 -0
- package/dist/contracts.d.ts +58 -0
- package/dist/core-augmentation.d.ts +9 -0
- package/dist/index.d.mts +27 -34727
- package/dist/index.d.ts +27 -0
- package/dist/index.mjs +28246 -21186
- package/dist/index.mjs.map +153 -0
- package/dist/lib/server-wallet-trade.d.ts +22 -0
- package/dist/lib/server-wallet-trade.js +333 -0
- package/dist/lib/server-wallet-trade.js.map +11 -0
- package/dist/lib/wallet-export-guard.d.ts +45 -0
- package/dist/lp/actions/liquidity.d.ts +2 -0
- package/dist/lp/e2e/real-token-tests.d.ts +6 -0
- package/dist/lp/e2e/scenarios.d.ts +9 -0
- package/dist/lp/e2e/test-utils.d.ts +28 -0
- package/dist/lp/lp-manager-entry.d.ts +18 -0
- package/dist/lp/services/ConcentratedLiquidityService.d.ts +32 -0
- package/dist/lp/services/DexInteractionService.d.ts +34 -0
- package/dist/lp/services/LpManagementService.d.ts +116 -0
- package/dist/lp/services/UserLpProfileService.d.ts +18 -0
- package/dist/lp/services/VaultService.d.ts +21 -0
- package/dist/lp/services/YieldOptimizationService.d.ts +59 -0
- package/dist/lp/services/__tests__/MockLpService.d.ts +17 -0
- package/dist/lp/types.d.ts +439 -0
- package/dist/lp/utils/solanaClient.d.ts +26 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/policy/policy.d.ts +14 -0
- package/dist/providers/canonical-provider.d.ts +19 -0
- package/dist/providers/wallet-provider.d.ts +5 -0
- package/dist/register-routes.d.ts +1 -0
- package/dist/routes/plugin.d.ts +14 -0
- package/dist/routes/wallet-market-overview-route.d.ts +7 -0
- package/dist/sdk/abi.d.ts +396 -0
- package/dist/sdk/bridge/abis.d.ts +63 -0
- package/dist/sdk/bridge/client.d.ts +48 -0
- package/dist/sdk/bridge/index.d.ts +14 -0
- package/dist/sdk/bridge/solana.d.ts +131 -0
- package/dist/sdk/bridge/types.d.ts +92 -0
- package/dist/sdk/convenience.d.ts +104 -0
- package/dist/sdk/escrow/MutualStakeEscrow.d.ts +75 -0
- package/dist/sdk/escrow/types.d.ts +58 -0
- package/dist/sdk/escrow/verifiers.d.ts +25 -0
- package/dist/sdk/identity/erc8004.d.ts +304 -0
- package/dist/sdk/identity/reputation.d.ts +317 -0
- package/dist/sdk/identity/uaid.d.ts +192 -0
- package/dist/sdk/identity/validation.d.ts +282 -0
- package/dist/sdk/index.d.ts +133 -0
- package/dist/sdk/index.js +5284 -0
- package/dist/sdk/index.js.map +40 -0
- package/dist/sdk/policy/SpendingPolicy.d.ts +105 -0
- package/dist/sdk/policy/UptoBillingPolicy.d.ts +87 -0
- package/dist/sdk/router/PaymentRouter.d.ts +77 -0
- package/dist/sdk/router/index.d.ts +2 -0
- package/dist/sdk/swap/SwapModule.d.ts +47 -0
- package/dist/sdk/swap/abi.d.ts +50 -0
- package/dist/sdk/swap/index.d.ts +11 -0
- package/dist/sdk/swap/types.d.ts +101 -0
- package/dist/sdk/tokens/decimals.d.ts +64 -0
- package/dist/sdk/tokens/registry.d.ts +81 -0
- package/dist/sdk/tokens/solana.d.ts +107 -0
- package/dist/sdk/tokens/transfers.d.ts +94 -0
- package/dist/sdk/types.d.ts +129 -0
- package/dist/sdk/wallet-core.d.ts +29450 -0
- package/dist/sdk/x402/budget.d.ts +51 -0
- package/dist/sdk/x402/chains/abstract/index.d.ts +134 -0
- package/dist/sdk/x402/client.d.ts +66 -0
- package/dist/sdk/x402/index.d.ts +8 -0
- package/dist/sdk/x402/middleware.d.ts +37 -0
- package/dist/sdk/x402/multi-asset.d.ts +53 -0
- package/dist/sdk/x402/types.d.ts +109 -0
- package/dist/security/wallet-context-safety.d.ts +7 -0
- package/dist/security/wallet-financial-confirmation.d.ts +23 -0
- package/dist/services/wallet-backend-service.d.ts +39 -0
- package/dist/types/wallet-router.d.ts +130 -0
- package/dist/utils/intent-trajectory.d.ts +34 -0
- package/dist/wallet/backend.d.ts +41 -0
- package/dist/wallet/errors.d.ts +17 -0
- package/dist/wallet/index.d.ts +6 -0
- package/dist/wallet/local-eoa-backend.d.ts +37 -0
- package/dist/wallet/pending.d.ts +47 -0
- package/dist/wallet/select-backend.d.ts +11 -0
- package/dist/wallet/steward-backend.d.ts +22 -0
- package/dist/wallet-action.d.ts +1 -0
- package/dist/wallet-action.js +6292 -0
- package/dist/wallet-action.js.map +44 -0
- package/package.json +35 -21
- package/registry-entry.json +134 -0
- package/src/analytics/birdeye/actions/wallet-search-address.ts +85 -5
- package/src/analytics/birdeye/birdeye-task.ts +25 -9
- package/src/analytics/birdeye/birdeye.ts +6 -7
- package/src/analytics/birdeye/constants.ts +0 -1
- package/src/analytics/birdeye/providers/agent-portfolio-provider.ts +0 -1
- package/src/analytics/birdeye/providers/market.ts +51 -45
- package/src/analytics/birdeye/providers/portfolio-factory.ts +79 -38
- package/src/analytics/birdeye/providers/trending.ts +43 -46
- package/src/analytics/birdeye/providers/wallet.ts +0 -1
- package/src/analytics/birdeye/search-category.test.ts +1 -1
- package/src/analytics/birdeye/search-category.ts +77 -12
- package/src/analytics/birdeye/service.test.ts +146 -0
- package/src/analytics/birdeye/service.ts +220 -105
- package/src/analytics/birdeye/types/api/common.ts +0 -1
- package/src/analytics/birdeye/types/api/defi.ts +0 -1
- package/src/analytics/birdeye/types/api/pair.ts +0 -1
- package/src/analytics/birdeye/types/api/search.ts +0 -1
- package/src/analytics/birdeye/types/api/token.ts +0 -1
- package/src/analytics/birdeye/types/api/trader.ts +0 -1
- package/src/analytics/birdeye/types/api/wallet.ts +0 -1
- package/src/analytics/birdeye/types/shared.ts +0 -11
- package/src/analytics/birdeye/utils.test.ts +69 -0
- package/src/analytics/birdeye/utils.ts +11 -8
- package/src/analytics/dexscreener/search-category.ts +0 -1
- package/src/analytics/dexscreener/service.ts +7 -12
- package/src/analytics/dexscreener/types.ts +0 -1
- package/src/analytics/lpinfo/index.ts +5 -2
- package/src/analytics/lpinfo/kamino/README.md +2 -2
- package/src/analytics/lpinfo/kamino/index.ts +9 -2
- package/src/analytics/lpinfo/kamino/providers/kaminoLiquidityProvider.ts +6 -26
- package/src/analytics/lpinfo/kamino/providers/kaminoPoolProvider.ts +11 -12
- package/src/analytics/lpinfo/kamino/providers/kaminoProvider.ts +76 -32
- package/src/analytics/lpinfo/kamino/services/kaminoLiquidityService.ts +78 -38
- package/src/analytics/lpinfo/kamino/services/kaminoService.ts +71 -31
- package/src/analytics/lpinfo/steer/index.ts +7 -2
- package/src/analytics/lpinfo/steer/providers/steerLiquidityProvider.ts +25 -26
- package/src/analytics/lpinfo/steer/services/steerLiquidityService.ts +367 -149
- package/src/analytics/news/index.ts +7 -2
- package/src/analytics/news/interfaces/types.ts +0 -1
- package/src/analytics/news/providers/defiNewsProvider.ts +17 -44
- package/src/analytics/news/services/newsDataService.ts +1 -22
- package/src/analytics/news/utils/formatters.test.ts +60 -0
- package/src/analytics/news/utils/formatters.ts +0 -1
- package/src/analytics/token-info/action.ts +52 -212
- package/src/analytics/token-info/index.ts +1 -1
- package/src/analytics/token-info/params.test.ts +69 -0
- package/src/analytics/token-info/params.ts +13 -11
- package/src/analytics/token-info/providers.ts +46 -17
- package/src/analytics/token-info/service.ts +3 -3
- package/src/analytics/token-info/types.ts +2 -2
- package/src/api/wallet-routes.test.ts +56 -0
- package/src/api/wallet-routes.ts +1728 -0
- package/src/audit/audit-log.ts +57 -2
- package/src/browser-shim/build-shim.ts +1 -1
- package/src/browser-shim/shim.template.js +107 -117
- package/src/chains/{wallet-router.test.ts → __tests__/wallet-router.test.ts} +57 -10
- package/src/chains/evm/actions/helpers.ts +9 -7
- package/src/chains/evm/actions/swap.ts +176 -22
- package/src/chains/evm/actions/transfer.ts +29 -22
- package/src/chains/evm/biome.json +1 -1
- package/src/chains/evm/build.ts +6 -1
- package/src/chains/evm/constants.ts +19 -0
- package/src/chains/evm/contracts/artifacts/OZGovernor.json +25 -1682
- package/src/chains/evm/dex/aerodrome/index.ts +6 -1
- package/src/chains/evm/dex/aerodrome/services/AerodromeLpService.ts +41 -15
- package/src/chains/evm/dex/aerodrome/types.ts +1 -2
- package/src/chains/evm/dex/pancakeswp/index.ts +6 -1
- package/src/chains/evm/dex/pancakeswp/services/PancakeSwapV3LpService.ts +54 -17
- package/src/chains/evm/dex/pancakeswp/types.ts +1 -2
- package/src/chains/evm/dex/uniswap/index.ts +6 -1
- package/src/chains/evm/dex/uniswap/services/UniswapV3LpService.ts +20 -9
- package/src/chains/evm/dex/uniswap/types.ts +1 -2
- package/src/chains/evm/gov-router.ts +3 -1
- package/src/chains/evm/index.browser.ts +1 -1
- package/src/chains/evm/index.ts +5 -1
- package/src/chains/evm/prompts.ts +5 -0
- package/src/chains/evm/providers/get-balance.ts +1 -1
- package/src/chains/evm/providers/wallet.ts +80 -9
- package/src/chains/evm/routes/sign.ts +35 -26
- package/src/chains/evm/rpc-providers.ts +1 -1
- package/src/chains/evm/types/index.ts +22 -2
- package/src/chains/registry.ts +1 -1
- package/src/chains/wallet-action.ts +301 -91
- package/src/index.ts +9 -5
- package/src/lib/wallet-export-guard.test.ts +233 -0
- package/src/lib/wallet-export-guard.ts +1 -1
- package/src/lp/actions/liquidity.ts +53 -26
- package/src/lp/e2e/real-token-tests.ts +0 -1
- package/src/lp/e2e/scenarios.ts +1 -2
- package/src/lp/e2e/test-utils.ts +20 -7
- package/src/lp/lp-manager-entry.ts +2 -5
- package/src/lp/services/ConcentratedLiquidityService.ts +3 -10
- package/src/lp/services/DexInteractionService.ts +1 -2
- package/src/lp/services/LpManagementService.test.ts +0 -1
- package/src/lp/services/LpManagementService.ts +75 -35
- package/src/lp/services/UserLpProfileService.ts +2 -3
- package/src/lp/services/VaultService.ts +10 -4
- package/src/lp/services/YieldOptimizationService.ts +29 -13
- package/src/lp/services/__tests__/MockLpService.ts +1 -2
- package/src/lp/types.ts +9 -13
- package/src/lp/utils/solanaClient.ts +4 -2
- package/src/plugin.routes.test.ts +24 -0
- package/src/plugin.ts +30 -13
- package/src/providers/canonical-provider.ts +1 -1
- package/src/providers/{unified-wallet-provider.ts → wallet-provider.ts} +3 -3
- package/src/routes/__fixtures__/coingecko-markets.recorded.json +97 -0
- package/src/routes/wallet-market-overview-route.ts +1 -1
- package/src/routes/wallet-market-overview.contract.test.ts +139 -0
- package/src/routes/wallet-market-overview.real.test.ts +83 -0
- package/src/sdk/escrow/MutualStakeEscrow.ts +1 -2
- package/src/sdk/identity/erc8004.ts +1 -1
- package/src/sdk/identity/validation.ts +3 -4
- package/src/sdk/index.ts +2 -2
- package/src/sdk/policy/SpendingPolicy.ts +1 -1
- package/src/sdk/router/PaymentRouter.ts +8 -11
- package/src/sdk/swap/SwapModule.ts +1 -1
- package/src/sdk/tokens/registry.ts +1 -1
- package/src/sdk/x402/middleware.ts +2 -8
- package/src/security/__tests__/wallet-context-safety.test.ts +79 -0
- package/src/security/__tests__/wallet-financial-confirmation.test.ts +88 -0
- package/src/security/wallet-context-safety.ts +128 -0
- package/src/security/wallet-financial-confirmation.ts +150 -0
- package/src/services/wallet-backend-service.ts +15 -1
- package/src/utils/intent-trajectory.ts +2 -2
- package/src/wallet/steward-backend.ts +4 -4
- package/dist/LpManagementService-BWrQ5-cO.mjs +0 -353
- package/dist/MockLpService-D_Apn4Fd.mjs +0 -99
- package/dist/aerodrome-CfnESC32.mjs +0 -890
- package/dist/chunk-hT5z_Zn9.mjs +0 -35
- package/dist/lib/server-wallet-trade.d.mts +0 -34
- package/dist/lib/server-wallet-trade.mjs +0 -306
- package/dist/meteora-BPX39hZo.mjs +0 -22640
- package/dist/orca-Bybp1HXO.mjs +0 -249
- package/dist/pancakeswp-CkEXlXti.mjs +0 -604
- package/dist/plugin-ZO_MTyd0.mjs +0 -529
- package/dist/raydium-rfaM9yEf.mjs +0 -539
- package/dist/sdk/index.d.mts +0 -32492
- package/dist/sdk/index.mjs +0 -6415
- package/dist/types-D5252NZk.mjs +0 -487
- package/dist/uniswap-CReXgXVN.mjs +0 -573
- package/dist/wallet-action.d.mts +0 -6
- package/dist/wallet-action.mjs +0 -820
- package/src/analytics/birdeye/tasks/birdeye.ts +0 -232
- package/src/analytics/lpinfo/index.d.ts +0 -7
- package/src/chains/evm/contracts/artifacts/TimelockController.json +0 -1007
- package/src/chains/evm/contracts/artifacts/VoteToken.json +0 -895
- package/src/lp/tasks/LpAutoRebalanceTask.ts +0 -117
- package/src/lp/tasks/__tests__/LpAutoRebalanceTask.test.ts +0 -370
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Plugin } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* DeFi News Plugin
|
|
4
|
+
*
|
|
5
|
+
* A comprehensive plugin that automatically provides DeFi and crypto market context to conversations through providers.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Global DeFi market statistics (market cap, volume, dominance) - requires CoinGecko service
|
|
9
|
+
* - Global crypto market data (active cryptocurrencies, total market cap, dominance) - requires CoinGecko service
|
|
10
|
+
* - Latest crypto news from Brave New Coin RSS feed (always available)
|
|
11
|
+
* - Token information (price, market cap, community stats, developer activity) - requires CoinGecko service
|
|
12
|
+
*
|
|
13
|
+
* Optional Dependencies:
|
|
14
|
+
* - COINGECKO_SERVICE: Provided by analytics plugin or similar for market data
|
|
15
|
+
* - birdeye: For Solana token lookups
|
|
16
|
+
* - chain_solana: For Solana blockchain interactions
|
|
17
|
+
*
|
|
18
|
+
* Required Services:
|
|
19
|
+
* - NEWS_DATA_SERVICE: Provided by this plugin for news data
|
|
20
|
+
*
|
|
21
|
+
* Note: This plugin works standalone with news data only. For full functionality,
|
|
22
|
+
* ensure the analytics plugin (or similar) is loaded to provide the COINGECKO_SERVICE.
|
|
23
|
+
*
|
|
24
|
+
* @author ElizaOS
|
|
25
|
+
* @version 2.0.0
|
|
26
|
+
*/
|
|
27
|
+
export declare const defiNewsPlugin: Plugin;
|
|
28
|
+
export default defiNewsPlugin;
|
|
29
|
+
export * from "./interfaces/types";
|
|
30
|
+
export { defiNewsProvider } from "./providers/defiNewsProvider";
|
|
31
|
+
export { NewsDataService } from "./services/newsDataService";
|
|
32
|
+
export * from "./utils/formatters";
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { IAgentRuntime, Memory, State } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* DeFi News data types
|
|
4
|
+
*/
|
|
5
|
+
export interface GlobalDefiData {
|
|
6
|
+
defi_market_cap: string;
|
|
7
|
+
eth_market_cap: string;
|
|
8
|
+
defi_to_eth_ratio: string;
|
|
9
|
+
trading_volume_24h: string;
|
|
10
|
+
defi_dominance: string;
|
|
11
|
+
top_coin_name: string;
|
|
12
|
+
top_coin_defi_dominance: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GlobalCryptoData {
|
|
15
|
+
active_cryptocurrencies: number;
|
|
16
|
+
upcoming_icos: number;
|
|
17
|
+
ongoing_icos: number;
|
|
18
|
+
ended_icos: number;
|
|
19
|
+
markets: number;
|
|
20
|
+
total_market_cap: Record<string, number>;
|
|
21
|
+
total_volume: Record<string, number>;
|
|
22
|
+
market_cap_percentage: Record<string, number>;
|
|
23
|
+
market_cap_change_percentage_24h_usd: number;
|
|
24
|
+
updated_at: number;
|
|
25
|
+
}
|
|
26
|
+
export interface TokenNewsData {
|
|
27
|
+
tokenId: string;
|
|
28
|
+
tokenName: string;
|
|
29
|
+
symbol: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
market_data?: {
|
|
32
|
+
current_price?: Record<string, number>;
|
|
33
|
+
market_cap?: Record<string, number>;
|
|
34
|
+
total_volume?: Record<string, number>;
|
|
35
|
+
price_change_percentage_24h?: number;
|
|
36
|
+
price_change_percentage_7d?: number;
|
|
37
|
+
price_change_percentage_30d?: number;
|
|
38
|
+
};
|
|
39
|
+
community_data?: {
|
|
40
|
+
twitter_followers?: number;
|
|
41
|
+
reddit_subscribers?: number;
|
|
42
|
+
telegram_channel_user_count?: number;
|
|
43
|
+
};
|
|
44
|
+
developer_data?: {
|
|
45
|
+
forks?: number;
|
|
46
|
+
stars?: number;
|
|
47
|
+
subscribers?: number;
|
|
48
|
+
total_issues?: number;
|
|
49
|
+
closed_issues?: number;
|
|
50
|
+
pull_requests_merged?: number;
|
|
51
|
+
pull_request_contributors?: number;
|
|
52
|
+
};
|
|
53
|
+
last_updated?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DexPairData {
|
|
56
|
+
base: string;
|
|
57
|
+
target: string;
|
|
58
|
+
market: {
|
|
59
|
+
name: string;
|
|
60
|
+
identifier: string;
|
|
61
|
+
has_trading_incentive: boolean;
|
|
62
|
+
};
|
|
63
|
+
last: number;
|
|
64
|
+
volume: number;
|
|
65
|
+
converted_last: Record<string, number>;
|
|
66
|
+
converted_volume: Record<string, number>;
|
|
67
|
+
trust_score: string;
|
|
68
|
+
bid_ask_spread_percentage: number;
|
|
69
|
+
timestamp: string;
|
|
70
|
+
last_traded_at: string;
|
|
71
|
+
last_fetch_at: string;
|
|
72
|
+
is_anomaly: boolean;
|
|
73
|
+
is_stale: boolean;
|
|
74
|
+
trade_url: string;
|
|
75
|
+
token_info_url: string | null;
|
|
76
|
+
coin_id: string;
|
|
77
|
+
target_coin_id?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface OHLCVData {
|
|
80
|
+
timestamp: number;
|
|
81
|
+
open: number;
|
|
82
|
+
high: number;
|
|
83
|
+
low: number;
|
|
84
|
+
close: number;
|
|
85
|
+
volume?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface RealWorldNewsArticle {
|
|
88
|
+
article_id: string;
|
|
89
|
+
title: string;
|
|
90
|
+
link: string;
|
|
91
|
+
keywords?: string[];
|
|
92
|
+
creator?: string[];
|
|
93
|
+
video_url?: string | null;
|
|
94
|
+
description?: string;
|
|
95
|
+
content?: string;
|
|
96
|
+
pubDate: string;
|
|
97
|
+
image_url?: string;
|
|
98
|
+
source_id: string;
|
|
99
|
+
source_priority: number;
|
|
100
|
+
source_url?: string;
|
|
101
|
+
source_icon?: string;
|
|
102
|
+
language: string;
|
|
103
|
+
country?: string[];
|
|
104
|
+
category?: string[];
|
|
105
|
+
ai_tag?: string;
|
|
106
|
+
sentiment?: string;
|
|
107
|
+
sentiment_stats?: string;
|
|
108
|
+
ai_region?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface RealWorldNewsResponse {
|
|
111
|
+
status: string;
|
|
112
|
+
totalResults: number;
|
|
113
|
+
results: RealWorldNewsArticle[];
|
|
114
|
+
nextPage?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface DefiNewsRequest {
|
|
117
|
+
tokenId?: string;
|
|
118
|
+
tokenAddress?: string;
|
|
119
|
+
chain?: string;
|
|
120
|
+
includeMarketData?: boolean;
|
|
121
|
+
includeCommunityData?: boolean;
|
|
122
|
+
includeDeveloperData?: boolean;
|
|
123
|
+
includeRealWorldNews?: boolean;
|
|
124
|
+
newsQuery?: string;
|
|
125
|
+
newsLanguage?: string;
|
|
126
|
+
newsCategory?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface DexLiquidityRequest {
|
|
129
|
+
tokenId: string;
|
|
130
|
+
includePairs?: boolean;
|
|
131
|
+
includeOHLCV?: boolean;
|
|
132
|
+
ohlcvDays?: number;
|
|
133
|
+
timeframe?: "1h" | "4h" | "1d" | "1w";
|
|
134
|
+
}
|
|
135
|
+
export interface GlobalDefiRequest {
|
|
136
|
+
includeCryptoData?: boolean;
|
|
137
|
+
}
|
|
138
|
+
export interface DefiNewsResponse {
|
|
139
|
+
success: boolean;
|
|
140
|
+
data: {
|
|
141
|
+
tokenNews?: TokenNewsData;
|
|
142
|
+
globalDefi?: GlobalDefiData;
|
|
143
|
+
globalCrypto?: GlobalCryptoData;
|
|
144
|
+
dexPairs?: DexPairData[];
|
|
145
|
+
ohlcvData?: OHLCVData[];
|
|
146
|
+
realWorldNews?: RealWorldNewsArticle[];
|
|
147
|
+
};
|
|
148
|
+
timestamp: number;
|
|
149
|
+
error?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface DefiNewsService {
|
|
152
|
+
getGlobalDefiData(): Promise<GlobalDefiData>;
|
|
153
|
+
getGlobalCryptoData(): Promise<GlobalCryptoData>;
|
|
154
|
+
getTokenData(tokenId: string, options?: {
|
|
155
|
+
includeMarketData?: boolean;
|
|
156
|
+
includeCommunityData?: boolean;
|
|
157
|
+
includeDeveloperData?: boolean;
|
|
158
|
+
}): Promise<TokenNewsData>;
|
|
159
|
+
getDexPairs(tokenId: string): Promise<DexPairData[]>;
|
|
160
|
+
getOHLCVData(tokenId: string, days: number): Promise<OHLCVData[]>;
|
|
161
|
+
getRealWorldNews(query: string, options?: {
|
|
162
|
+
language?: string;
|
|
163
|
+
category?: string;
|
|
164
|
+
limit?: number;
|
|
165
|
+
}): Promise<RealWorldNewsArticle[]>;
|
|
166
|
+
}
|
|
167
|
+
export interface ActionRequest {
|
|
168
|
+
runtime: IAgentRuntime;
|
|
169
|
+
message: Memory;
|
|
170
|
+
state?: State;
|
|
171
|
+
}
|
|
172
|
+
export interface ActionResponse {
|
|
173
|
+
success: boolean;
|
|
174
|
+
text: string;
|
|
175
|
+
data?: Record<string, unknown>;
|
|
176
|
+
error?: string;
|
|
177
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Provider } from "@elizaos/core";
|
|
2
|
+
interface CoinGeckoDefiData {
|
|
3
|
+
defi_market_cap: string;
|
|
4
|
+
eth_market_cap: string;
|
|
5
|
+
defi_to_eth_ratio: string;
|
|
6
|
+
trading_volume_24h: string;
|
|
7
|
+
defi_dominance: string;
|
|
8
|
+
top_coin_name: string;
|
|
9
|
+
top_coin_defi_dominance: number;
|
|
10
|
+
}
|
|
11
|
+
interface CoinGeckoGlobalCryptoData {
|
|
12
|
+
active_cryptocurrencies: number;
|
|
13
|
+
markets: number;
|
|
14
|
+
total_market_cap: {
|
|
15
|
+
usd: number;
|
|
16
|
+
};
|
|
17
|
+
total_volume: {
|
|
18
|
+
usd: number;
|
|
19
|
+
};
|
|
20
|
+
market_cap_change_percentage_24h_usd: number;
|
|
21
|
+
market_cap_percentage?: Record<string, number>;
|
|
22
|
+
}
|
|
23
|
+
interface CoinGeckoSearchResult {
|
|
24
|
+
id: string;
|
|
25
|
+
platforms?: {
|
|
26
|
+
solana?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface CoinGeckoCoinData {
|
|
30
|
+
name: string;
|
|
31
|
+
symbol: string;
|
|
32
|
+
market_cap_rank?: number;
|
|
33
|
+
market_data?: {
|
|
34
|
+
current_price?: {
|
|
35
|
+
usd?: number;
|
|
36
|
+
};
|
|
37
|
+
market_cap?: {
|
|
38
|
+
usd?: number;
|
|
39
|
+
};
|
|
40
|
+
total_volume?: {
|
|
41
|
+
usd?: number;
|
|
42
|
+
};
|
|
43
|
+
high_24h?: {
|
|
44
|
+
usd?: number;
|
|
45
|
+
};
|
|
46
|
+
low_24h?: {
|
|
47
|
+
usd?: number;
|
|
48
|
+
};
|
|
49
|
+
price_change_percentage_24h?: number;
|
|
50
|
+
price_change_percentage_7d?: number;
|
|
51
|
+
price_change_percentage_30d?: number;
|
|
52
|
+
};
|
|
53
|
+
community_data?: {
|
|
54
|
+
twitter_followers?: number;
|
|
55
|
+
reddit_subscribers?: number;
|
|
56
|
+
telegram_channel_user_count?: number;
|
|
57
|
+
};
|
|
58
|
+
developer_data?: {
|
|
59
|
+
forks?: number;
|
|
60
|
+
stars?: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface CoinGeckoService {
|
|
64
|
+
getGlobalDefiData(): Promise<CoinGeckoDefiData>;
|
|
65
|
+
getGlobalCryptoData(): Promise<CoinGeckoGlobalCryptoData>;
|
|
66
|
+
searchCoin(symbol: string): Promise<CoinGeckoSearchResult[]>;
|
|
67
|
+
getCoinData(tokenId: string): Promise<CoinGeckoCoinData>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* DeFi News Provider
|
|
71
|
+
*
|
|
72
|
+
* Automatically provides comprehensive DeFi and crypto market context to conversations.
|
|
73
|
+
* This provider is dynamic and fetches fresh data on each request.
|
|
74
|
+
*
|
|
75
|
+
* The provider aggregates data from:
|
|
76
|
+
* - Global DeFi market statistics (market cap, volume, dominance) - requires CoinGecko service
|
|
77
|
+
* - Global crypto market data (total market cap, active cryptocurrencies, dominance) - requires CoinGecko service
|
|
78
|
+
* - Latest crypto news from Brave New Coin RSS feed (top 5 articles) - always available
|
|
79
|
+
* - Token-specific data when mentioned - requires CoinGecko and optional Birdeye services
|
|
80
|
+
*
|
|
81
|
+
* The data is formatted as a comprehensive market report that can be used
|
|
82
|
+
* by the agent to provide informed responses about DeFi and crypto markets.
|
|
83
|
+
*
|
|
84
|
+
* Note: The CoinGecko service should be provided by the analytics plugin or similar.
|
|
85
|
+
* If not available, the provider will still work with news data only.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // The provider is automatically called by the framework
|
|
89
|
+
* // No manual invocation needed - just add to plugin.providers array
|
|
90
|
+
*/
|
|
91
|
+
export declare const defiNewsProvider: Provider;
|
|
92
|
+
/**
|
|
93
|
+
* Extract symbols from text
|
|
94
|
+
* Dynamically extracts token symbols from natural language
|
|
95
|
+
*
|
|
96
|
+
* @param text - The text to extract symbols from
|
|
97
|
+
* @param mode - "strict" only matches $SYMBOL format, "loose" matches various patterns
|
|
98
|
+
* @returns Array of detected symbols
|
|
99
|
+
*/
|
|
100
|
+
export declare const extractSymbols: (text: string, mode?: "strict" | "loose") => string[];
|
|
101
|
+
/**
|
|
102
|
+
* Get token information
|
|
103
|
+
* This is a helper function that can be used for specific token queries
|
|
104
|
+
*/
|
|
105
|
+
export declare function getTokenInfo(coinGeckoService: CoinGeckoService, tokenId: string): Promise<string>;
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
import { Service } from "@elizaos/core";
|
|
3
|
+
import type { RealWorldNewsArticle } from "../interfaces/types";
|
|
4
|
+
/**
|
|
5
|
+
* Brave New Coin RSS Service for Real-World Crypto Events
|
|
6
|
+
*
|
|
7
|
+
* This service fetches real-world news and events related to cryptocurrency
|
|
8
|
+
* from Brave New Coin RSS feed.
|
|
9
|
+
*/
|
|
10
|
+
export declare class NewsDataService extends Service {
|
|
11
|
+
static serviceType: string;
|
|
12
|
+
private rssUrl;
|
|
13
|
+
get capabilityDescription(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Start the NewsData service (static method for framework)
|
|
16
|
+
*/
|
|
17
|
+
static start(runtime: IAgentRuntime): Promise<NewsDataService>;
|
|
18
|
+
/**
|
|
19
|
+
* Stop the NewsData service (static method for framework)
|
|
20
|
+
*/
|
|
21
|
+
static stop(runtime: IAgentRuntime): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Stop the service instance
|
|
24
|
+
*/
|
|
25
|
+
stop(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Parse RSS XML to extract news items
|
|
28
|
+
*/
|
|
29
|
+
private parseRSS;
|
|
30
|
+
/**
|
|
31
|
+
* Extract content from XML tag
|
|
32
|
+
*/
|
|
33
|
+
private extractTag;
|
|
34
|
+
/**
|
|
35
|
+
* Strip HTML tags from text
|
|
36
|
+
*/
|
|
37
|
+
private stripHtml;
|
|
38
|
+
/**
|
|
39
|
+
* Decode HTML entities (e.g., ’ to ')
|
|
40
|
+
*/
|
|
41
|
+
private decodeHtmlEntities;
|
|
42
|
+
/**
|
|
43
|
+
* Fetch latest crypto news from Brave New Coin RSS feed
|
|
44
|
+
*/
|
|
45
|
+
getLatestNews(options?: {
|
|
46
|
+
query?: string;
|
|
47
|
+
language?: string;
|
|
48
|
+
category?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
}): Promise<RealWorldNewsArticle[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Fetch news about a specific token
|
|
53
|
+
*/
|
|
54
|
+
getTokenNews(tokenSymbol: string, options?: {
|
|
55
|
+
language?: string;
|
|
56
|
+
limit?: number;
|
|
57
|
+
}): Promise<RealWorldNewsArticle[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Fetch DeFi-specific news
|
|
60
|
+
*/
|
|
61
|
+
getDefiNews(options?: {
|
|
62
|
+
language?: string;
|
|
63
|
+
limit?: number;
|
|
64
|
+
}): Promise<RealWorldNewsArticle[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Fetch blockchain and crypto market news
|
|
67
|
+
*/
|
|
68
|
+
getCryptoMarketNews(options?: {
|
|
69
|
+
language?: string;
|
|
70
|
+
limit?: number;
|
|
71
|
+
}): Promise<RealWorldNewsArticle[]>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for formatting DeFi news data
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format a number as currency (USD)
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatCurrency(value: number, decimals?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Format a percentage with appropriate emoji
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatPercentage(value: number, decimals?: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Format a timestamp as a human-readable date
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatDate(timestamp: number | string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Format a relative time (e.g., "2 hours ago")
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatRelativeTime(timestamp: number | string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Truncate text to a maximum length
|
|
22
|
+
*/
|
|
23
|
+
export declare function truncateText(text: string, maxLength?: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get sentiment emoji
|
|
26
|
+
*/
|
|
27
|
+
export declare function getSentimentEmoji(sentiment?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Format large numbers with commas
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatNumber(value: number, decimals?: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Extract token symbol from text
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractTokenSymbol(text: string): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Format OHLCV data for display
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatOHLCV(candle: {
|
|
40
|
+
timestamp: number;
|
|
41
|
+
open: number;
|
|
42
|
+
high: number;
|
|
43
|
+
low: number;
|
|
44
|
+
close: number;
|
|
45
|
+
volume?: number;
|
|
46
|
+
}): string;
|
|
47
|
+
/**
|
|
48
|
+
* Clean HTML tags from text
|
|
49
|
+
*/
|
|
50
|
+
export declare function stripHtml(html: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Validate if a string is a valid token address
|
|
53
|
+
*/
|
|
54
|
+
export declare function isValidTokenAddress(address: string): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ActionResult, HandlerCallback, HandlerOptions, IAgentRuntime, Memory, State } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Folded into WALLET as `action=token_info`. Routes token-info queries through
|
|
4
|
+
* the registered TokenInfoService providers (DexScreener, Birdeye, CoinGecko).
|
|
5
|
+
*/
|
|
6
|
+
export declare function tokenInfoHandler(runtime: IAgentRuntime, message: Memory, state?: State, options?: HandlerOptions | Record<string, unknown>, callback?: HandlerCallback): Promise<ActionResult>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HandlerOptions, Memory, State } from "@elizaos/core";
|
|
2
|
+
import { type TokenInfoParams, type TokenInfoSubaction } from "./types";
|
|
3
|
+
export declare function readParams(options?: unknown): Record<string, unknown>;
|
|
4
|
+
export declare function readStringParam(options: unknown, ...keys: string[]): string | undefined;
|
|
5
|
+
export declare function readNumberParam(options: unknown, key: string, fallback?: number): number | undefined;
|
|
6
|
+
export declare function readBooleanParam(options: unknown, key: string): boolean | undefined;
|
|
7
|
+
export declare function normalizeTokenInfoSubaction(value: unknown): TokenInfoSubaction | undefined;
|
|
8
|
+
export declare function inferTokenInfoSubaction(message: Memory, state?: State): TokenInfoSubaction;
|
|
9
|
+
export declare function parseTokenInfoParams(message: Memory, state?: State, options?: HandlerOptions | Record<string, unknown>): TokenInfoParams;
|
|
10
|
+
export declare function selectedContextMatches(state: State | undefined, contexts: readonly string[]): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TokenInfoProvider } from "./types";
|
|
2
|
+
export declare function createDexScreenerTokenInfoProvider(): TokenInfoProvider;
|
|
3
|
+
export declare function createBirdeyeTokenInfoProvider(): TokenInfoProvider;
|
|
4
|
+
export declare function createCoinGeckoTokenInfoProvider(): TokenInfoProvider;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type IAgentRuntime, Service } from "@elizaos/core";
|
|
2
|
+
import type { TokenInfoDispatchContext, TokenInfoProvider, TokenInfoProviderMetadata, TokenInfoRouteResult } from "./types";
|
|
3
|
+
export declare const TOKEN_INFO_SERVICE_TYPE: "token-info";
|
|
4
|
+
export declare class TokenInfoService extends Service {
|
|
5
|
+
static serviceType: "token-info";
|
|
6
|
+
capabilityDescription: string;
|
|
7
|
+
private readonly providers;
|
|
8
|
+
private readonly aliases;
|
|
9
|
+
static start(runtime: IAgentRuntime): Promise<TokenInfoService>;
|
|
10
|
+
registerProvider(provider: TokenInfoProvider): void;
|
|
11
|
+
listProviders(): TokenInfoProviderMetadata[];
|
|
12
|
+
getCapabilities(): {
|
|
13
|
+
readonly providers: readonly TokenInfoProviderMetadata[];
|
|
14
|
+
};
|
|
15
|
+
route(context: TokenInfoDispatchContext): Promise<TokenInfoRouteResult>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
private resolveProvider;
|
|
18
|
+
private toMetadata;
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ActionResult, HandlerCallback, HandlerOptions, IAgentRuntime, Memory, State } from "@elizaos/core";
|
|
2
|
+
export declare const TOKEN_INFO_SUBACTIONS: readonly ["search", "token", "trending", "new_pairs", "chain_pairs", "boosted", "profiles", "wallet"];
|
|
3
|
+
export type TokenInfoSubaction = (typeof TOKEN_INFO_SUBACTIONS)[number];
|
|
4
|
+
export interface TokenInfoParams {
|
|
5
|
+
readonly target?: string;
|
|
6
|
+
readonly subaction: TokenInfoSubaction;
|
|
7
|
+
readonly query?: string;
|
|
8
|
+
readonly address?: string;
|
|
9
|
+
readonly tokenAddress?: string;
|
|
10
|
+
readonly chain?: string;
|
|
11
|
+
readonly timeframe?: "1h" | "6h" | "24h";
|
|
12
|
+
readonly limit?: number;
|
|
13
|
+
readonly offset?: number;
|
|
14
|
+
readonly sortBy?: "volume" | "liquidity" | "priceChange" | "txns";
|
|
15
|
+
readonly top?: boolean;
|
|
16
|
+
readonly kind?: "wallet-address" | "token-address" | "token-symbol";
|
|
17
|
+
readonly id?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface TokenInfoProviderMetadata {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly aliases: readonly string[];
|
|
22
|
+
readonly supportedSubactions: readonly TokenInfoSubaction[];
|
|
23
|
+
readonly description?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface TokenInfoProvider extends TokenInfoProviderMetadata {
|
|
26
|
+
execute(context: TokenInfoDispatchContext): Promise<ActionResult>;
|
|
27
|
+
}
|
|
28
|
+
export interface TokenInfoDispatchContext {
|
|
29
|
+
readonly runtime: IAgentRuntime;
|
|
30
|
+
readonly message: Memory;
|
|
31
|
+
readonly state?: State;
|
|
32
|
+
readonly options?: HandlerOptions | Record<string, unknown>;
|
|
33
|
+
readonly params: TokenInfoParams;
|
|
34
|
+
readonly callback?: HandlerCallback;
|
|
35
|
+
}
|
|
36
|
+
export type TokenInfoRouteResult = {
|
|
37
|
+
readonly ok: true;
|
|
38
|
+
readonly provider: TokenInfoProviderMetadata;
|
|
39
|
+
readonly result: ActionResult;
|
|
40
|
+
} | {
|
|
41
|
+
readonly ok: false;
|
|
42
|
+
readonly error: "UNSUPPORTED_PROVIDER" | "UNSUPPORTED_SUBACTION" | "INVALID_PARAMS" | "EXECUTION_FAILED";
|
|
43
|
+
readonly detail: string;
|
|
44
|
+
readonly providers?: readonly TokenInfoProviderMetadata[];
|
|
45
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type http from "node:http";
|
|
2
|
+
import type { AgentRuntime, RouteRequestMeta } from "@elizaos/core";
|
|
3
|
+
import type { ElizaConfig, RouteHelpers, WalletBalancesResponse, WalletChain, WalletConfigStatus, WalletExportRejection as WalletExportRejectionLike, WalletExportRequestBody, WalletRpcChain } from "@elizaos/shared";
|
|
4
|
+
export interface WalletRpcReadinessSnapshot {
|
|
5
|
+
walletNetwork: "mainnet" | "testnet";
|
|
6
|
+
cloudManagedAccess: boolean;
|
|
7
|
+
managedBscRpcReady: boolean;
|
|
8
|
+
evmBalanceReady: boolean;
|
|
9
|
+
solanaBalanceReady: boolean;
|
|
10
|
+
selectedRpcProviders: WalletRpcSelections;
|
|
11
|
+
legacyCustomChains: WalletRpcChain[];
|
|
12
|
+
bscRpcUrls: string[];
|
|
13
|
+
ethereumRpcUrls: string[];
|
|
14
|
+
baseRpcUrls: string[];
|
|
15
|
+
avalancheRpcUrls: string[];
|
|
16
|
+
solanaRpcUrls: string[];
|
|
17
|
+
}
|
|
18
|
+
import { type WalletConfigUpdateRequest, type WalletRpcSelections } from "@elizaos/shared";
|
|
19
|
+
export interface WalletAddressesSnapshot {
|
|
20
|
+
evmAddress: string | null;
|
|
21
|
+
solanaAddress: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface FetchEvmBalancesOptions {
|
|
24
|
+
alchemyKey?: string | null;
|
|
25
|
+
ankrKey?: string | null;
|
|
26
|
+
cloudManagedAccess?: boolean;
|
|
27
|
+
bscRpcUrls?: string[];
|
|
28
|
+
ethereumRpcUrls?: string[];
|
|
29
|
+
baseRpcUrls?: string[];
|
|
30
|
+
avaxRpcUrls?: string[];
|
|
31
|
+
nodeRealBscRpcUrl?: string;
|
|
32
|
+
quickNodeBscRpcUrl?: string;
|
|
33
|
+
bscRpcUrl?: string;
|
|
34
|
+
ethereumRpcUrl?: string;
|
|
35
|
+
baseRpcUrl?: string;
|
|
36
|
+
avaxRpcUrl?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IntegrationTelemetrySpan {
|
|
39
|
+
success: (attributes?: Record<string, unknown>) => void;
|
|
40
|
+
failure: (attributes: {
|
|
41
|
+
error: unknown;
|
|
42
|
+
} & Record<string, unknown>) => void;
|
|
43
|
+
}
|
|
44
|
+
export interface CreateIntegrationTelemetrySpanArgs {
|
|
45
|
+
boundary: string;
|
|
46
|
+
operation: string;
|
|
47
|
+
}
|
|
48
|
+
export interface WalletRouteDependencies {
|
|
49
|
+
getWalletAddresses: () => WalletAddressesSnapshot;
|
|
50
|
+
fetchEvmBalances: (address: string, options: FetchEvmBalancesOptions) => Promise<NonNullable<WalletBalancesResponse["evm"]>["chains"]>;
|
|
51
|
+
fetchSolanaBalances: (address: string, heliusKey: string) => Promise<Omit<NonNullable<WalletBalancesResponse["solana"]>, "address">>;
|
|
52
|
+
fetchSolanaNativeBalanceViaRpc: (address: string, rpcUrls: string[]) => Promise<Omit<NonNullable<WalletBalancesResponse["solana"]>, "address">>;
|
|
53
|
+
validatePrivateKey: (privateKey: string) => {
|
|
54
|
+
chain: WalletChain;
|
|
55
|
+
};
|
|
56
|
+
importWallet: (chain: WalletChain, privateKey: string) => {
|
|
57
|
+
success: boolean;
|
|
58
|
+
chain: WalletChain;
|
|
59
|
+
address: string | null;
|
|
60
|
+
error: string | null;
|
|
61
|
+
};
|
|
62
|
+
generateWalletForChain: (chain: WalletChain) => {
|
|
63
|
+
privateKey: string;
|
|
64
|
+
address: string;
|
|
65
|
+
};
|
|
66
|
+
deriveSolanaAddress: (privateKey: string) => string;
|
|
67
|
+
setSolanaWalletEnv: (privateKey: string) => void;
|
|
68
|
+
resolveWalletRpcReadiness: (config: ElizaConfig) => WalletRpcReadinessSnapshot;
|
|
69
|
+
resolveWalletNetworkMode: (config: ElizaConfig) => "mainnet" | "testnet";
|
|
70
|
+
getStoredWalletRpcSelections: (config: ElizaConfig) => WalletRpcSelections;
|
|
71
|
+
applyWalletRpcConfigUpdate: (config: ElizaConfig, update: WalletConfigUpdateRequest) => void;
|
|
72
|
+
resolveWalletCapabilityStatus: (args: {
|
|
73
|
+
config: ElizaConfig;
|
|
74
|
+
runtime: AgentRuntime | null;
|
|
75
|
+
getWalletAddresses: () => WalletAddressesSnapshot;
|
|
76
|
+
}) => {
|
|
77
|
+
walletSource: WalletConfigStatus["walletSource"];
|
|
78
|
+
automationMode: WalletConfigStatus["automationMode"];
|
|
79
|
+
pluginEvmLoaded: WalletConfigStatus["pluginEvmLoaded"];
|
|
80
|
+
pluginEvmRequired: WalletConfigStatus["pluginEvmRequired"];
|
|
81
|
+
executionReady: WalletConfigStatus["executionReady"];
|
|
82
|
+
executionBlockedReason: WalletConfigStatus["executionBlockedReason"];
|
|
83
|
+
evmSigningCapability: WalletConfigStatus["evmSigningCapability"];
|
|
84
|
+
evmSigningReason: WalletConfigStatus["evmSigningReason"];
|
|
85
|
+
};
|
|
86
|
+
isCloudWalletEnabled: () => boolean;
|
|
87
|
+
persistConfigEnv: (key: string, value: string) => Promise<void>;
|
|
88
|
+
createIntegrationTelemetrySpan: (args: CreateIntegrationTelemetrySpanArgs) => IntegrationTelemetrySpan;
|
|
89
|
+
}
|
|
90
|
+
export interface WalletRouteContext extends RouteRequestMeta, Pick<RouteHelpers, "readJsonBody" | "json" | "error"> {
|
|
91
|
+
config: ElizaConfig;
|
|
92
|
+
saveConfig: (config: ElizaConfig) => void;
|
|
93
|
+
ensureWalletKeysInEnvAndConfig: (config: ElizaConfig) => boolean;
|
|
94
|
+
resolveWalletExportRejection: (req: http.IncomingMessage, body: WalletExportRequestBody) => WalletExportRejectionLike | null;
|
|
95
|
+
restartRuntime?: (reason: string) => Promise<boolean>;
|
|
96
|
+
scheduleRuntimeRestart?: (reason: string) => void;
|
|
97
|
+
deps: WalletRouteDependencies;
|
|
98
|
+
runtime?: AgentRuntime | null;
|
|
99
|
+
}
|
|
100
|
+
export declare function handleWalletRoutes(ctx: WalletRouteContext): Promise<boolean>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ActionFailureCode, ValidateFailureCode } from "../actions/failure-codes.js";
|
|
2
|
+
import type { SignScope } from "../wallet/pending.js";
|
|
3
|
+
export type AuditKind = "action_validate_start" | "action_validate_end" | "action_handler_start" | "action_handler_end" | "wallet_sign_request" | "wallet_sign_result" | "approval_requested" | "approval_resolved" | "automation_trigger_fired" | "automation_trigger_skipped";
|
|
4
|
+
export type AuditOutcome = "ok" | "validate_fail" | "handler_fail" | "pending_approval" | "approved" | "rejected";
|
|
5
|
+
/**
|
|
6
|
+
* Row shape for the append-only audit log.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuditLogRow {
|
|
9
|
+
readonly id: bigint;
|
|
10
|
+
readonly ts: number;
|
|
11
|
+
readonly actor: "agent" | "user" | "automation";
|
|
12
|
+
readonly kind: AuditKind;
|
|
13
|
+
readonly scope: SignScope | null;
|
|
14
|
+
readonly actionName: string | null;
|
|
15
|
+
readonly paramsHash: string;
|
|
16
|
+
readonly approvalId: string | null;
|
|
17
|
+
readonly outcome: AuditOutcome;
|
|
18
|
+
readonly failureCode: ValidateFailureCode | ActionFailureCode | null;
|
|
19
|
+
readonly detail: string | null;
|
|
20
|
+
readonly prevHash: string;
|
|
21
|
+
readonly rowHash: string;
|
|
22
|
+
}
|
|
23
|
+
export type AuditLogRowInput = Omit<AuditLogRow, "id" | "ts" | "prevHash" | "rowHash"> & {
|
|
24
|
+
readonly id?: bigint;
|
|
25
|
+
readonly ts?: number;
|
|
26
|
+
readonly prevHash?: string | null;
|
|
27
|
+
};
|
|
28
|
+
export declare function createAuditLogRow(input: AuditLogRowInput): AuditLogRow;
|
|
29
|
+
export declare function verifyAuditLogRow(row: AuditLogRow): boolean;
|