@elizaos/plugin-wallet 2.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +64 -0
- package/auto-enable.ts +76 -0
- package/dist/LpManagementService-BWrQ5-cO.mjs +353 -0
- package/dist/MockLpService-D_Apn4Fd.mjs +99 -0
- package/dist/aerodrome-CfnESC32.mjs +890 -0
- package/dist/chunk-hT5z_Zn9.mjs +35 -0
- package/dist/index.d.mts +34727 -0
- package/dist/index.mjs +21590 -0
- package/dist/lib/server-wallet-trade.d.mts +34 -0
- package/dist/lib/server-wallet-trade.mjs +306 -0
- package/dist/meteora-BPX39hZo.mjs +22640 -0
- package/dist/orca-Bybp1HXO.mjs +249 -0
- package/dist/pancakeswp-CkEXlXti.mjs +604 -0
- package/dist/plugin-ZO_MTyd0.mjs +529 -0
- package/dist/raydium-rfaM9yEf.mjs +539 -0
- package/dist/sdk/index.d.mts +32492 -0
- package/dist/sdk/index.mjs +6415 -0
- package/dist/types-D5252NZk.mjs +487 -0
- package/dist/uniswap-CReXgXVN.mjs +573 -0
- package/dist/wallet-action.d.mts +6 -0
- package/dist/wallet-action.mjs +820 -0
- package/package.json +152 -0
- package/src/actions/failure-codes.ts +79 -0
- package/src/actions/index.ts +1 -0
- package/src/analytics/birdeye/actions/wallet-search-address.ts +9 -0
- package/src/analytics/birdeye/birdeye-task.ts +175 -0
- package/src/analytics/birdeye/birdeye.ts +813 -0
- package/src/analytics/birdeye/constants.ts +74 -0
- package/src/analytics/birdeye/providers/agent-portfolio-provider.ts +18 -0
- package/src/analytics/birdeye/providers/market.ts +227 -0
- package/src/analytics/birdeye/providers/portfolio-factory.test.ts +138 -0
- package/src/analytics/birdeye/providers/portfolio-factory.ts +252 -0
- package/src/analytics/birdeye/providers/trending.ts +365 -0
- package/src/analytics/birdeye/providers/wallet.ts +14 -0
- package/src/analytics/birdeye/search-category.test.ts +207 -0
- package/src/analytics/birdeye/search-category.ts +506 -0
- package/src/analytics/birdeye/service.ts +992 -0
- package/src/analytics/birdeye/tasks/birdeye.ts +232 -0
- package/src/analytics/birdeye/types/api/common.ts +305 -0
- package/src/analytics/birdeye/types/api/defi.ts +220 -0
- package/src/analytics/birdeye/types/api/pair.ts +200 -0
- package/src/analytics/birdeye/types/api/search.ts +86 -0
- package/src/analytics/birdeye/types/api/token.ts +635 -0
- package/src/analytics/birdeye/types/api/trader.ts +76 -0
- package/src/analytics/birdeye/types/api/wallet.ts +181 -0
- package/src/analytics/birdeye/types/shared.ts +106 -0
- package/src/analytics/birdeye/utils.ts +700 -0
- package/src/analytics/dexscreener/errors.ts +28 -0
- package/src/analytics/dexscreener/index.ts +3 -0
- package/src/analytics/dexscreener/search-category.test.ts +49 -0
- package/src/analytics/dexscreener/search-category.ts +42 -0
- package/src/analytics/dexscreener/service.ts +595 -0
- package/src/analytics/dexscreener/types.ts +128 -0
- package/src/analytics/lpinfo/index.d.ts +7 -0
- package/src/analytics/lpinfo/index.ts +52 -0
- package/src/analytics/lpinfo/kamino/README.md +102 -0
- package/src/analytics/lpinfo/kamino/index.ts +24 -0
- package/src/analytics/lpinfo/kamino/providers/kaminoLiquidityProvider.ts +422 -0
- package/src/analytics/lpinfo/kamino/providers/kaminoPoolProvider.ts +365 -0
- package/src/analytics/lpinfo/kamino/providers/kaminoProvider.ts +496 -0
- package/src/analytics/lpinfo/kamino/services/kaminoLiquidityService.ts +1123 -0
- package/src/analytics/lpinfo/kamino/services/kaminoService.ts +758 -0
- package/src/analytics/lpinfo/steer/README.md +169 -0
- package/src/analytics/lpinfo/steer/index.ts +23 -0
- package/src/analytics/lpinfo/steer/providers/steerLiquidityProvider.ts +544 -0
- package/src/analytics/lpinfo/steer/services/steerLiquidityService.ts +1690 -0
- package/src/analytics/lpinfo/steer/steer-display-types.ts +99 -0
- package/src/analytics/news/index.ts +52 -0
- package/src/analytics/news/interfaces/types.ts +222 -0
- package/src/analytics/news/providers/defiNewsProvider.ts +734 -0
- package/src/analytics/news/services/newsDataService.ts +332 -0
- package/src/analytics/news/utils/formatters.ts +151 -0
- package/src/analytics/token-info/action.ts +240 -0
- package/src/analytics/token-info/index.ts +3 -0
- package/src/analytics/token-info/params.ts +215 -0
- package/src/analytics/token-info/providers.ts +681 -0
- package/src/analytics/token-info/service.ts +168 -0
- package/src/analytics/token-info/types.ts +74 -0
- package/src/audit/audit-log.ts +45 -0
- package/src/browser-shim/build-shim.ts +123 -0
- package/src/browser-shim/index.ts +5 -0
- package/src/browser-shim/shim.template.js +563 -0
- package/src/chains/evm/.github/workflows/npm-deploy.yml +112 -0
- package/src/chains/evm/LICENSE +21 -0
- package/src/chains/evm/README.md +106 -0
- package/src/chains/evm/actions/helpers.ts +147 -0
- package/src/chains/evm/actions/swap.ts +839 -0
- package/src/chains/evm/actions/transfer.ts +254 -0
- package/src/chains/evm/biome.json +61 -0
- package/src/chains/evm/bridge-router.ts +660 -0
- package/src/chains/evm/build.ts +89 -0
- package/src/chains/evm/chain-handler.ts +416 -0
- package/src/chains/evm/constants.ts +23 -0
- package/src/chains/evm/contracts/artifacts/OZGovernor.json +1707 -0
- package/src/chains/evm/contracts/artifacts/TimelockController.json +1007 -0
- package/src/chains/evm/contracts/artifacts/VoteToken.json +895 -0
- package/src/chains/evm/dex/aerodrome/index.ts +34 -0
- package/src/chains/evm/dex/aerodrome/services/AerodromeLpService.ts +558 -0
- package/src/chains/evm/dex/aerodrome/types.ts +318 -0
- package/src/chains/evm/dex/pancakeswp/index.ts +35 -0
- package/src/chains/evm/dex/pancakeswp/services/PancakeSwapV3LpService.ts +743 -0
- package/src/chains/evm/dex/pancakeswp/types.ts +65 -0
- package/src/chains/evm/dex/uniswap/index.ts +35 -0
- package/src/chains/evm/dex/uniswap/services/UniswapV3LpService.ts +759 -0
- package/src/chains/evm/dex/uniswap/types.ts +390 -0
- package/src/chains/evm/generated/specs/spec-helpers.ts +73 -0
- package/src/chains/evm/generated/specs/specs.ts +151 -0
- package/src/chains/evm/gov-router.ts +250 -0
- package/src/chains/evm/index.browser.ts +16 -0
- package/src/chains/evm/index.ts +31 -0
- package/src/chains/evm/prompts.ts +193 -0
- package/src/chains/evm/providers/get-balance.ts +123 -0
- package/src/chains/evm/providers/wallet.ts +715 -0
- package/src/chains/evm/routes/sign.ts +333 -0
- package/src/chains/evm/rpc-providers.ts +410 -0
- package/src/chains/evm/service.ts +140 -0
- package/src/chains/evm/templates/index.ts +10 -0
- package/src/chains/evm/types/index.ts +432 -0
- package/src/chains/evm/vitest.config.ts +18 -0
- package/src/chains/registry.ts +668 -0
- package/src/chains/solana/README.md +367 -0
- package/src/chains/wallet-action.ts +533 -0
- package/src/chains/wallet-router.test.ts +296 -0
- package/src/contracts.ts +65 -0
- package/src/core-augmentation.ts +10 -0
- package/src/index.ts +71 -0
- package/src/lib/server-wallet-trade.ts +192 -0
- package/src/lib/wallet-export-guard.ts +330 -0
- package/src/lp/actions/liquidity.ts +827 -0
- package/src/lp/e2e/real-token-tests.ts +428 -0
- package/src/lp/e2e/scenarios.ts +470 -0
- package/src/lp/e2e/test-utils.ts +145 -0
- package/src/lp/lp-manager-entry.ts +303 -0
- package/src/lp/services/ConcentratedLiquidityService.ts +120 -0
- package/src/lp/services/DexInteractionService.ts +226 -0
- package/src/lp/services/LpManagementService.test.ts +148 -0
- package/src/lp/services/LpManagementService.ts +632 -0
- package/src/lp/services/UserLpProfileService.ts +163 -0
- package/src/lp/services/VaultService.ts +153 -0
- package/src/lp/services/YieldOptimizationService.ts +344 -0
- package/src/lp/services/__tests__/MockLpService.ts +146 -0
- package/src/lp/tasks/LpAutoRebalanceTask.ts +117 -0
- package/src/lp/tasks/__tests__/LpAutoRebalanceTask.test.ts +370 -0
- package/src/lp/types.ts +582 -0
- package/src/lp/utils/solanaClient.ts +143 -0
- package/src/plugin.ts +125 -0
- package/src/policy/policy.ts +19 -0
- package/src/providers/canonical-provider.ts +27 -0
- package/src/providers/unified-wallet-provider.ts +79 -0
- package/src/register-routes.ts +11 -0
- package/src/routes/plugin.ts +47 -0
- package/src/routes/wallet-market-overview-route.ts +869 -0
- package/src/sdk/abi.ts +258 -0
- package/src/sdk/bridge/abis.ts +126 -0
- package/src/sdk/bridge/client.ts +518 -0
- package/src/sdk/bridge/index.ts +56 -0
- package/src/sdk/bridge/solana.ts +604 -0
- package/src/sdk/bridge/types.ts +202 -0
- package/src/sdk/convenience.ts +347 -0
- package/src/sdk/escrow/MutualStakeEscrow.ts +480 -0
- package/src/sdk/escrow/types.ts +64 -0
- package/src/sdk/escrow/verifiers.ts +73 -0
- package/src/sdk/identity/erc8004.ts +692 -0
- package/src/sdk/identity/reputation.ts +449 -0
- package/src/sdk/identity/uaid.ts +497 -0
- package/src/sdk/identity/validation.ts +372 -0
- package/src/sdk/index.ts +763 -0
- package/src/sdk/policy/SpendingPolicy.ts +260 -0
- package/src/sdk/policy/UptoBillingPolicy.ts +320 -0
- package/src/sdk/router/PaymentRouter.ts +215 -0
- package/src/sdk/router/index.ts +8 -0
- package/src/sdk/swap/SwapModule.ts +310 -0
- package/src/sdk/swap/abi.ts +117 -0
- package/src/sdk/swap/index.ts +34 -0
- package/src/sdk/swap/types.ts +135 -0
- package/src/sdk/tokens/decimals.ts +140 -0
- package/src/sdk/tokens/registry.ts +911 -0
- package/src/sdk/tokens/solana.ts +419 -0
- package/src/sdk/tokens/transfers.ts +327 -0
- package/src/sdk/types.ts +158 -0
- package/src/sdk/wallet-core.ts +115 -0
- package/src/sdk/x402/budget.ts +168 -0
- package/src/sdk/x402/chains/abstract/index.ts +280 -0
- package/src/sdk/x402/client.ts +320 -0
- package/src/sdk/x402/index.ts +46 -0
- package/src/sdk/x402/middleware.ts +92 -0
- package/src/sdk/x402/multi-asset.ts +144 -0
- package/src/sdk/x402/types.ts +156 -0
- package/src/services/wallet-backend-service.ts +328 -0
- package/src/types/wallet-router.ts +227 -0
- package/src/utils/intent-trajectory.ts +106 -0
- package/src/wallet/backend.ts +62 -0
- package/src/wallet/errors.ts +49 -0
- package/src/wallet/index.ts +27 -0
- package/src/wallet/local-eoa-backend.ts +201 -0
- package/src/wallet/pending.ts +60 -0
- package/src/wallet/select-backend.ts +47 -0
- package/src/wallet/steward-backend.ts +161 -0
- package/src/wallet-action.ts +1 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
// @ts-nocheck — legacy code from absorbed plugins (lp-manager, lpinfo, dexscreener, defi-news, birdeye); strict types pending cleanup
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Uniswap V3 specific types
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const UNISWAP_V3_FEE_TIERS = {
|
|
9
|
+
LOWEST: 100, // 0.01%
|
|
10
|
+
LOW: 500, // 0.05%
|
|
11
|
+
MEDIUM: 3000, // 0.3%
|
|
12
|
+
HIGH: 10000, // 1%
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type UniswapV3FeeTier = (typeof UNISWAP_V3_FEE_TIERS)[keyof typeof UNISWAP_V3_FEE_TIERS];
|
|
16
|
+
|
|
17
|
+
export interface UniswapV3Pool {
|
|
18
|
+
address: Address;
|
|
19
|
+
token0: Address;
|
|
20
|
+
token1: Address;
|
|
21
|
+
fee: UniswapV3FeeTier;
|
|
22
|
+
tickSpacing: number;
|
|
23
|
+
liquidity: bigint;
|
|
24
|
+
sqrtPriceX96: bigint;
|
|
25
|
+
tick: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UniswapV3Position {
|
|
29
|
+
tokenId: bigint;
|
|
30
|
+
nonce: bigint;
|
|
31
|
+
operator: Address;
|
|
32
|
+
token0: Address;
|
|
33
|
+
token1: Address;
|
|
34
|
+
fee: UniswapV3FeeTier;
|
|
35
|
+
tickLower: number;
|
|
36
|
+
tickUpper: number;
|
|
37
|
+
liquidity: bigint;
|
|
38
|
+
feeGrowthInside0LastX128: bigint;
|
|
39
|
+
feeGrowthInside1LastX128: bigint;
|
|
40
|
+
tokensOwed0: bigint;
|
|
41
|
+
tokensOwed1: bigint;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface UniswapV3MintParams {
|
|
45
|
+
token0: Address;
|
|
46
|
+
token1: Address;
|
|
47
|
+
fee: UniswapV3FeeTier;
|
|
48
|
+
tickLower: number;
|
|
49
|
+
tickUpper: number;
|
|
50
|
+
amount0Desired: bigint;
|
|
51
|
+
amount1Desired: bigint;
|
|
52
|
+
amount0Min: bigint;
|
|
53
|
+
amount1Min: bigint;
|
|
54
|
+
recipient: Address;
|
|
55
|
+
deadline: bigint;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface UniswapV3IncreaseLiquidityParams {
|
|
59
|
+
tokenId: bigint;
|
|
60
|
+
amount0Desired: bigint;
|
|
61
|
+
amount1Desired: bigint;
|
|
62
|
+
amount0Min: bigint;
|
|
63
|
+
amount1Min: bigint;
|
|
64
|
+
deadline: bigint;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface UniswapV3DecreaseLiquidityParams {
|
|
68
|
+
tokenId: bigint;
|
|
69
|
+
liquidity: bigint;
|
|
70
|
+
amount0Min: bigint;
|
|
71
|
+
amount1Min: bigint;
|
|
72
|
+
deadline: bigint;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface UniswapV3CollectParams {
|
|
76
|
+
tokenId: bigint;
|
|
77
|
+
recipient: Address;
|
|
78
|
+
amount0Max: bigint;
|
|
79
|
+
amount1Max: bigint;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Contract addresses by chain
|
|
83
|
+
export const UNISWAP_V3_ADDRESSES: Record<
|
|
84
|
+
number,
|
|
85
|
+
{
|
|
86
|
+
factory: Address;
|
|
87
|
+
nonfungiblePositionManager: Address;
|
|
88
|
+
swapRouter: Address;
|
|
89
|
+
quoter: Address;
|
|
90
|
+
}
|
|
91
|
+
> = {
|
|
92
|
+
// Ethereum Mainnet
|
|
93
|
+
1: {
|
|
94
|
+
factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
95
|
+
nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
|
|
96
|
+
swapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
97
|
+
quoter: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
|
|
98
|
+
},
|
|
99
|
+
// Base
|
|
100
|
+
8453: {
|
|
101
|
+
factory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
102
|
+
nonfungiblePositionManager: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
|
|
103
|
+
swapRouter: "0x2626664c2603336E57B271c5C0b26F421741e481",
|
|
104
|
+
quoter: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
|
|
105
|
+
},
|
|
106
|
+
// Arbitrum One
|
|
107
|
+
42161: {
|
|
108
|
+
factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
109
|
+
nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
|
|
110
|
+
swapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
111
|
+
quoter: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
|
|
112
|
+
},
|
|
113
|
+
// Polygon
|
|
114
|
+
137: {
|
|
115
|
+
factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
116
|
+
nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
|
|
117
|
+
swapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
118
|
+
quoter: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
|
|
119
|
+
},
|
|
120
|
+
// Optimism
|
|
121
|
+
10: {
|
|
122
|
+
factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
123
|
+
nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
|
|
124
|
+
swapRouter: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
125
|
+
quoter: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// ABI fragments for Uniswap V3 contracts
|
|
130
|
+
export const UNISWAP_V3_FACTORY_ABI = [
|
|
131
|
+
{
|
|
132
|
+
inputs: [
|
|
133
|
+
{ name: "tokenA", type: "address" },
|
|
134
|
+
{ name: "tokenB", type: "address" },
|
|
135
|
+
{ name: "fee", type: "uint24" },
|
|
136
|
+
],
|
|
137
|
+
name: "getPool",
|
|
138
|
+
outputs: [{ name: "pool", type: "address" }],
|
|
139
|
+
stateMutability: "view",
|
|
140
|
+
type: "function",
|
|
141
|
+
},
|
|
142
|
+
] as const;
|
|
143
|
+
|
|
144
|
+
export const UNISWAP_V3_POOL_ABI = [
|
|
145
|
+
{
|
|
146
|
+
inputs: [],
|
|
147
|
+
name: "token0",
|
|
148
|
+
outputs: [{ type: "address" }],
|
|
149
|
+
stateMutability: "view",
|
|
150
|
+
type: "function",
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
inputs: [],
|
|
154
|
+
name: "token1",
|
|
155
|
+
outputs: [{ type: "address" }],
|
|
156
|
+
stateMutability: "view",
|
|
157
|
+
type: "function",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
inputs: [],
|
|
161
|
+
name: "fee",
|
|
162
|
+
outputs: [{ type: "uint24" }],
|
|
163
|
+
stateMutability: "view",
|
|
164
|
+
type: "function",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
inputs: [],
|
|
168
|
+
name: "tickSpacing",
|
|
169
|
+
outputs: [{ type: "int24" }],
|
|
170
|
+
stateMutability: "view",
|
|
171
|
+
type: "function",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
inputs: [],
|
|
175
|
+
name: "liquidity",
|
|
176
|
+
outputs: [{ type: "uint128" }],
|
|
177
|
+
stateMutability: "view",
|
|
178
|
+
type: "function",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
inputs: [],
|
|
182
|
+
name: "slot0",
|
|
183
|
+
outputs: [
|
|
184
|
+
{ name: "sqrtPriceX96", type: "uint160" },
|
|
185
|
+
{ name: "tick", type: "int24" },
|
|
186
|
+
{ name: "observationIndex", type: "uint16" },
|
|
187
|
+
{ name: "observationCardinality", type: "uint16" },
|
|
188
|
+
{ name: "observationCardinalityNext", type: "uint16" },
|
|
189
|
+
{ name: "feeProtocol", type: "uint8" },
|
|
190
|
+
{ name: "unlocked", type: "bool" },
|
|
191
|
+
],
|
|
192
|
+
stateMutability: "view",
|
|
193
|
+
type: "function",
|
|
194
|
+
},
|
|
195
|
+
] as const;
|
|
196
|
+
|
|
197
|
+
export const UNISWAP_V3_POSITION_MANAGER_ABI = [
|
|
198
|
+
{
|
|
199
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
200
|
+
name: "positions",
|
|
201
|
+
outputs: [
|
|
202
|
+
{ name: "nonce", type: "uint96" },
|
|
203
|
+
{ name: "operator", type: "address" },
|
|
204
|
+
{ name: "token0", type: "address" },
|
|
205
|
+
{ name: "token1", type: "address" },
|
|
206
|
+
{ name: "fee", type: "uint24" },
|
|
207
|
+
{ name: "tickLower", type: "int24" },
|
|
208
|
+
{ name: "tickUpper", type: "int24" },
|
|
209
|
+
{ name: "liquidity", type: "uint128" },
|
|
210
|
+
{ name: "feeGrowthInside0LastX128", type: "uint256" },
|
|
211
|
+
{ name: "feeGrowthInside1LastX128", type: "uint256" },
|
|
212
|
+
{ name: "tokensOwed0", type: "uint128" },
|
|
213
|
+
{ name: "tokensOwed1", type: "uint128" },
|
|
214
|
+
],
|
|
215
|
+
stateMutability: "view",
|
|
216
|
+
type: "function",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
inputs: [{ name: "owner", type: "address" }],
|
|
220
|
+
name: "balanceOf",
|
|
221
|
+
outputs: [{ type: "uint256" }],
|
|
222
|
+
stateMutability: "view",
|
|
223
|
+
type: "function",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
inputs: [
|
|
227
|
+
{ name: "owner", type: "address" },
|
|
228
|
+
{ name: "index", type: "uint256" },
|
|
229
|
+
],
|
|
230
|
+
name: "tokenOfOwnerByIndex",
|
|
231
|
+
outputs: [{ type: "uint256" }],
|
|
232
|
+
stateMutability: "view",
|
|
233
|
+
type: "function",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
inputs: [
|
|
237
|
+
{
|
|
238
|
+
components: [
|
|
239
|
+
{ name: "token0", type: "address" },
|
|
240
|
+
{ name: "token1", type: "address" },
|
|
241
|
+
{ name: "fee", type: "uint24" },
|
|
242
|
+
{ name: "tickLower", type: "int24" },
|
|
243
|
+
{ name: "tickUpper", type: "int24" },
|
|
244
|
+
{ name: "amount0Desired", type: "uint256" },
|
|
245
|
+
{ name: "amount1Desired", type: "uint256" },
|
|
246
|
+
{ name: "amount0Min", type: "uint256" },
|
|
247
|
+
{ name: "amount1Min", type: "uint256" },
|
|
248
|
+
{ name: "recipient", type: "address" },
|
|
249
|
+
{ name: "deadline", type: "uint256" },
|
|
250
|
+
],
|
|
251
|
+
name: "params",
|
|
252
|
+
type: "tuple",
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
name: "mint",
|
|
256
|
+
outputs: [
|
|
257
|
+
{ name: "tokenId", type: "uint256" },
|
|
258
|
+
{ name: "liquidity", type: "uint128" },
|
|
259
|
+
{ name: "amount0", type: "uint256" },
|
|
260
|
+
{ name: "amount1", type: "uint256" },
|
|
261
|
+
],
|
|
262
|
+
stateMutability: "payable",
|
|
263
|
+
type: "function",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
inputs: [
|
|
267
|
+
{
|
|
268
|
+
components: [
|
|
269
|
+
{ name: "tokenId", type: "uint256" },
|
|
270
|
+
{ name: "amount0Desired", type: "uint256" },
|
|
271
|
+
{ name: "amount1Desired", type: "uint256" },
|
|
272
|
+
{ name: "amount0Min", type: "uint256" },
|
|
273
|
+
{ name: "amount1Min", type: "uint256" },
|
|
274
|
+
{ name: "deadline", type: "uint256" },
|
|
275
|
+
],
|
|
276
|
+
name: "params",
|
|
277
|
+
type: "tuple",
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
name: "increaseLiquidity",
|
|
281
|
+
outputs: [
|
|
282
|
+
{ name: "liquidity", type: "uint128" },
|
|
283
|
+
{ name: "amount0", type: "uint256" },
|
|
284
|
+
{ name: "amount1", type: "uint256" },
|
|
285
|
+
],
|
|
286
|
+
stateMutability: "payable",
|
|
287
|
+
type: "function",
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
inputs: [
|
|
291
|
+
{
|
|
292
|
+
components: [
|
|
293
|
+
{ name: "tokenId", type: "uint256" },
|
|
294
|
+
{ name: "liquidity", type: "uint128" },
|
|
295
|
+
{ name: "amount0Min", type: "uint256" },
|
|
296
|
+
{ name: "amount1Min", type: "uint256" },
|
|
297
|
+
{ name: "deadline", type: "uint256" },
|
|
298
|
+
],
|
|
299
|
+
name: "params",
|
|
300
|
+
type: "tuple",
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
name: "decreaseLiquidity",
|
|
304
|
+
outputs: [
|
|
305
|
+
{ name: "amount0", type: "uint256" },
|
|
306
|
+
{ name: "amount1", type: "uint256" },
|
|
307
|
+
],
|
|
308
|
+
stateMutability: "payable",
|
|
309
|
+
type: "function",
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
inputs: [
|
|
313
|
+
{
|
|
314
|
+
components: [
|
|
315
|
+
{ name: "tokenId", type: "uint256" },
|
|
316
|
+
{ name: "recipient", type: "address" },
|
|
317
|
+
{ name: "amount0Max", type: "uint128" },
|
|
318
|
+
{ name: "amount1Max", type: "uint128" },
|
|
319
|
+
],
|
|
320
|
+
name: "params",
|
|
321
|
+
type: "tuple",
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
name: "collect",
|
|
325
|
+
outputs: [
|
|
326
|
+
{ name: "amount0", type: "uint256" },
|
|
327
|
+
{ name: "amount1", type: "uint256" },
|
|
328
|
+
],
|
|
329
|
+
stateMutability: "payable",
|
|
330
|
+
type: "function",
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
334
|
+
name: "burn",
|
|
335
|
+
outputs: [],
|
|
336
|
+
stateMutability: "payable",
|
|
337
|
+
type: "function",
|
|
338
|
+
},
|
|
339
|
+
] as const;
|
|
340
|
+
|
|
341
|
+
export const ERC20_ABI = [
|
|
342
|
+
{
|
|
343
|
+
inputs: [],
|
|
344
|
+
name: "symbol",
|
|
345
|
+
outputs: [{ type: "string" }],
|
|
346
|
+
stateMutability: "view",
|
|
347
|
+
type: "function",
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
inputs: [],
|
|
351
|
+
name: "decimals",
|
|
352
|
+
outputs: [{ type: "uint8" }],
|
|
353
|
+
stateMutability: "view",
|
|
354
|
+
type: "function",
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
inputs: [],
|
|
358
|
+
name: "name",
|
|
359
|
+
outputs: [{ type: "string" }],
|
|
360
|
+
stateMutability: "view",
|
|
361
|
+
type: "function",
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
inputs: [{ name: "account", type: "address" }],
|
|
365
|
+
name: "balanceOf",
|
|
366
|
+
outputs: [{ type: "uint256" }],
|
|
367
|
+
stateMutability: "view",
|
|
368
|
+
type: "function",
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
inputs: [
|
|
372
|
+
{ name: "spender", type: "address" },
|
|
373
|
+
{ name: "amount", type: "uint256" },
|
|
374
|
+
],
|
|
375
|
+
name: "approve",
|
|
376
|
+
outputs: [{ type: "bool" }],
|
|
377
|
+
stateMutability: "nonpayable",
|
|
378
|
+
type: "function",
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
inputs: [
|
|
382
|
+
{ name: "owner", type: "address" },
|
|
383
|
+
{ name: "spender", type: "address" },
|
|
384
|
+
],
|
|
385
|
+
name: "allowance",
|
|
386
|
+
outputs: [{ type: "uint256" }],
|
|
387
|
+
stateMutability: "view",
|
|
388
|
+
type: "function",
|
|
389
|
+
},
|
|
390
|
+
] as const;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions to lookup action/provider specs by name.
|
|
3
|
+
* These allow language-specific implementations to import their text content
|
|
4
|
+
* (description, similes, examples) from the centralized specs.
|
|
5
|
+
*
|
|
6
|
+
* DO NOT EDIT the spec data - update prompts/actions.json, prompts/providers.json and regenerate.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type ActionDoc,
|
|
11
|
+
allActionDocs,
|
|
12
|
+
allProviderDocs,
|
|
13
|
+
coreActionDocs,
|
|
14
|
+
coreProviderDocs,
|
|
15
|
+
type ProviderDoc,
|
|
16
|
+
} from "./specs";
|
|
17
|
+
|
|
18
|
+
// Build lookup maps for O(1) access
|
|
19
|
+
const coreActionMap = new Map<string, ActionDoc>(coreActionDocs.map((doc) => [doc.name, doc]));
|
|
20
|
+
const allActionMap = new Map<string, ActionDoc>(allActionDocs.map((doc) => [doc.name, doc]));
|
|
21
|
+
const coreProviderMap = new Map<string, ProviderDoc>(
|
|
22
|
+
coreProviderDocs.map((doc) => [doc.name, doc])
|
|
23
|
+
);
|
|
24
|
+
const allProviderMap = new Map<string, ProviderDoc>(allProviderDocs.map((doc) => [doc.name, doc]));
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get an action spec by name from the core specs.
|
|
28
|
+
* @param name - The action name
|
|
29
|
+
* @returns The action spec or undefined if not found
|
|
30
|
+
*/
|
|
31
|
+
export function getActionSpec(name: string): ActionDoc | undefined {
|
|
32
|
+
return coreActionMap.get(name) ?? allActionMap.get(name);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get an action spec by name, throwing if not found.
|
|
37
|
+
* @param name - The action name
|
|
38
|
+
* @returns The action spec
|
|
39
|
+
* @throws Error if the action is not found
|
|
40
|
+
*/
|
|
41
|
+
export function requireActionSpec(name: string): ActionDoc {
|
|
42
|
+
const spec = getActionSpec(name);
|
|
43
|
+
if (!spec) {
|
|
44
|
+
throw new Error(`Action spec not found: ${name}`);
|
|
45
|
+
}
|
|
46
|
+
return spec;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get a provider spec by name from the core specs.
|
|
51
|
+
* @param name - The provider name
|
|
52
|
+
* @returns The provider spec or undefined if not found
|
|
53
|
+
*/
|
|
54
|
+
export function getProviderSpec(name: string): ProviderDoc | undefined {
|
|
55
|
+
return coreProviderMap.get(name) ?? allProviderMap.get(name);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get a provider spec by name, throwing if not found.
|
|
60
|
+
* @param name - The provider name
|
|
61
|
+
* @returns The provider spec
|
|
62
|
+
* @throws Error if the provider is not found
|
|
63
|
+
*/
|
|
64
|
+
export function requireProviderSpec(name: string): ProviderDoc {
|
|
65
|
+
const spec = getProviderSpec(name);
|
|
66
|
+
if (!spec) {
|
|
67
|
+
throw new Error(`Provider spec not found: ${name}`);
|
|
68
|
+
}
|
|
69
|
+
return spec;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Re-export types for convenience
|
|
73
|
+
export type { ActionDoc, ProviderDoc };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated canonical action/provider docs for plugin-wallet evm chain.
|
|
3
|
+
* DO NOT EDIT - Generated from prompts/specs/**.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type ActionDoc = {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
descriptionCompressed?: string;
|
|
10
|
+
similes?: readonly string[];
|
|
11
|
+
parameters?: readonly unknown[];
|
|
12
|
+
examples?: readonly (readonly unknown[])[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ProviderDoc = {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
descriptionCompressed?: string;
|
|
19
|
+
position?: number;
|
|
20
|
+
dynamic?: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const coreActionsSpec = {
|
|
24
|
+
version: "1.0.0",
|
|
25
|
+
actions: [
|
|
26
|
+
{
|
|
27
|
+
name: "EVM_TRANSFER",
|
|
28
|
+
description: "Transfer tokens from the agent's EVM wallet to another address",
|
|
29
|
+
descriptionCompressed: "EVM transfer: send native or ERC-20 tokens to another address.",
|
|
30
|
+
similes: [
|
|
31
|
+
"TRANSFER",
|
|
32
|
+
"SEND_TOKENS",
|
|
33
|
+
"SEND_TOKEN",
|
|
34
|
+
"TRANSFER_TOKEN",
|
|
35
|
+
"TRANSFER_TOKENS",
|
|
36
|
+
"EVM_SEND_TOKENS",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "EVM_SWAP",
|
|
41
|
+
description: "Swap tokens on a decentralized exchange",
|
|
42
|
+
descriptionCompressed: "EVM token swap on a DEX (Lifi/Bebop routing).",
|
|
43
|
+
similes: ["SWAP_TOKENS", "SWAP_TOKEN"],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "CROSS_CHAIN_TRANSFER",
|
|
47
|
+
description: "Bridge tokens to another chain",
|
|
48
|
+
descriptionCompressed: "Bridge ERC-20 tokens between EVM chains via Lifi.",
|
|
49
|
+
similes: ["BRIDGE", "BRIDGE_TOKENS"],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "WALLET_GOV",
|
|
53
|
+
description: "OZ-Governor governance op: { op: 'propose' | 'vote' | 'queue' | 'execute' }",
|
|
54
|
+
descriptionCompressed: "OZ-Governor op: propose, vote, queue, or execute (op switch).",
|
|
55
|
+
similes: [
|
|
56
|
+
"GOV_PROPOSE",
|
|
57
|
+
"GOV_VOTE",
|
|
58
|
+
"GOV_QUEUE",
|
|
59
|
+
"GOV_EXECUTE",
|
|
60
|
+
"GOVERNANCE_VOTE",
|
|
61
|
+
"QUEUE_PROPOSAL",
|
|
62
|
+
"EXECUTE_PROPOSAL",
|
|
63
|
+
"PROPOSE",
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
} as const;
|
|
68
|
+
export const allActionsSpec = {
|
|
69
|
+
version: "1.0.0",
|
|
70
|
+
actions: [
|
|
71
|
+
{
|
|
72
|
+
name: "EVM_TRANSFER",
|
|
73
|
+
description: "Transfer tokens from the agent's EVM wallet to another address",
|
|
74
|
+
descriptionCompressed: "EVM transfer: send native or ERC-20 tokens to another address.",
|
|
75
|
+
similes: [
|
|
76
|
+
"TRANSFER",
|
|
77
|
+
"SEND_TOKENS",
|
|
78
|
+
"SEND_TOKEN",
|
|
79
|
+
"TRANSFER_TOKEN",
|
|
80
|
+
"TRANSFER_TOKENS",
|
|
81
|
+
"EVM_SEND_TOKENS",
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "EVM_SWAP",
|
|
86
|
+
description: "Swap tokens on a decentralized exchange",
|
|
87
|
+
descriptionCompressed: "EVM token swap on a DEX (Lifi/Bebop routing).",
|
|
88
|
+
similes: ["SWAP_TOKENS", "SWAP_TOKEN"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "CROSS_CHAIN_TRANSFER",
|
|
92
|
+
description: "Bridge tokens to another chain",
|
|
93
|
+
descriptionCompressed: "Bridge ERC-20 tokens between EVM chains via Lifi.",
|
|
94
|
+
similes: ["BRIDGE", "BRIDGE_TOKENS"],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "WALLET_GOV",
|
|
98
|
+
description: "OZ-Governor governance op: { op: 'propose' | 'vote' | 'queue' | 'execute' }",
|
|
99
|
+
descriptionCompressed: "OZ-Governor op: propose, vote, queue, or execute (op switch).",
|
|
100
|
+
similes: [
|
|
101
|
+
"GOV_PROPOSE",
|
|
102
|
+
"GOV_VOTE",
|
|
103
|
+
"GOV_QUEUE",
|
|
104
|
+
"GOV_EXECUTE",
|
|
105
|
+
"GOVERNANCE_VOTE",
|
|
106
|
+
"QUEUE_PROPOSAL",
|
|
107
|
+
"EXECUTE_PROPOSAL",
|
|
108
|
+
"PROPOSE",
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
} as const;
|
|
113
|
+
export const coreProvidersSpec = {
|
|
114
|
+
version: "1.0.0",
|
|
115
|
+
providers: [
|
|
116
|
+
{
|
|
117
|
+
name: "wallet",
|
|
118
|
+
description: "EVM wallet address and balances",
|
|
119
|
+
descriptionCompressed: "EVM wallet address and balances.",
|
|
120
|
+
dynamic: true,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "get-balance",
|
|
124
|
+
description: "Token balance for ERC20 tokens when onchain actions are requested",
|
|
125
|
+
descriptionCompressed: "ERC20 token balance for onchain actions.",
|
|
126
|
+
dynamic: true,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
} as const;
|
|
130
|
+
export const allProvidersSpec = {
|
|
131
|
+
version: "1.0.0",
|
|
132
|
+
providers: [
|
|
133
|
+
{
|
|
134
|
+
name: "wallet",
|
|
135
|
+
description: "EVM wallet address and balances",
|
|
136
|
+
descriptionCompressed: "EVM wallet address and balances.",
|
|
137
|
+
dynamic: true,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "get-balance",
|
|
141
|
+
description: "Token balance for ERC20 tokens when onchain actions are requested",
|
|
142
|
+
descriptionCompressed: "ERC20 token balance for onchain actions.",
|
|
143
|
+
dynamic: true,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
} as const;
|
|
147
|
+
|
|
148
|
+
export const coreActionDocs: readonly ActionDoc[] = coreActionsSpec.actions;
|
|
149
|
+
export const allActionDocs: readonly ActionDoc[] = allActionsSpec.actions;
|
|
150
|
+
export const coreProviderDocs: readonly ProviderDoc[] = coreProvidersSpec.providers;
|
|
151
|
+
export const allProviderDocs: readonly ProviderDoc[] = allProvidersSpec.providers;
|