@x402-api/elizaos-plugin 1.0.0

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 (50) hide show
  1. package/README.md +346 -0
  2. package/dist/actions/dexQuotes.d.ts +4 -0
  3. package/dist/actions/dexQuotes.d.ts.map +1 -0
  4. package/dist/actions/dexQuotes.js +80 -0
  5. package/dist/actions/dexQuotes.js.map +1 -0
  6. package/dist/actions/fundingRates.d.ts +4 -0
  7. package/dist/actions/fundingRates.d.ts.map +1 -0
  8. package/dist/actions/fundingRates.js +85 -0
  9. package/dist/actions/fundingRates.js.map +1 -0
  10. package/dist/actions/gasTracker.d.ts +4 -0
  11. package/dist/actions/gasTracker.d.ts.map +1 -0
  12. package/dist/actions/gasTracker.js +60 -0
  13. package/dist/actions/gasTracker.js.map +1 -0
  14. package/dist/actions/priceFeed.d.ts +4 -0
  15. package/dist/actions/priceFeed.d.ts.map +1 -0
  16. package/dist/actions/priceFeed.js +75 -0
  17. package/dist/actions/priceFeed.js.map +1 -0
  18. package/dist/actions/tokenScanner.d.ts +4 -0
  19. package/dist/actions/tokenScanner.d.ts.map +1 -0
  20. package/dist/actions/tokenScanner.js +83 -0
  21. package/dist/actions/tokenScanner.js.map +1 -0
  22. package/dist/actions/walletProfiler.d.ts +4 -0
  23. package/dist/actions/walletProfiler.d.ts.map +1 -0
  24. package/dist/actions/walletProfiler.js +92 -0
  25. package/dist/actions/walletProfiler.js.map +1 -0
  26. package/dist/actions/whaleTracker.d.ts +4 -0
  27. package/dist/actions/whaleTracker.d.ts.map +1 -0
  28. package/dist/actions/whaleTracker.js +71 -0
  29. package/dist/actions/whaleTracker.js.map +1 -0
  30. package/dist/actions/yieldScanner.d.ts +4 -0
  31. package/dist/actions/yieldScanner.d.ts.map +1 -0
  32. package/dist/actions/yieldScanner.js +93 -0
  33. package/dist/actions/yieldScanner.js.map +1 -0
  34. package/dist/client.d.ts +66 -0
  35. package/dist/client.d.ts.map +1 -0
  36. package/dist/client.js +154 -0
  37. package/dist/client.js.map +1 -0
  38. package/dist/index.d.ts +24 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +24 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/plugin.d.ts +63 -0
  43. package/dist/plugin.d.ts.map +1 -0
  44. package/dist/plugin.js +108 -0
  45. package/dist/plugin.js.map +1 -0
  46. package/dist/types.d.ts +280 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +8 -0
  49. package/dist/types.js.map +1 -0
  50. package/package.json +66 -0
package/README.md ADDED
@@ -0,0 +1,346 @@
1
+ # @x402-api/elizaos-plugin
2
+
3
+ > ElizaOS plugin for **pay-per-call DeFi intelligence** — powered by [x402](https://x402.org) micropayments (USDC on Base)
4
+
5
+ Give your ElizaOS agent real-time access to 8 DeFi data endpoints for as little as **$0.001 per query**. No API keys, no subscriptions — just pay per call in USDC.
6
+
7
+ ## Endpoints
8
+
9
+ | Action | Endpoint | Cost |
10
+ |--------|----------|------|
11
+ | `GET_CRYPTO_PRICES` | `/api/price-feed` | $0.001 |
12
+ | `GET_GAS_PRICES` | `/api/gas-tracker` | $0.001 |
13
+ | `GET_DEX_QUOTES` | `/api/dex-quotes` | $0.002 |
14
+ | `SCAN_TOKEN` | `/api/token-scanner` | $0.003 |
15
+ | `TRACK_WHALES` | `/api/whale-tracker` | $0.005 |
16
+ | `SCAN_YIELDS` | `/api/yield-scanner` | $0.005 |
17
+ | `GET_FUNDING_RATES` | `/api/funding-rates` | $0.008 |
18
+ | `PROFILE_WALLET` | `/api/wallet-profiler` | $0.008 |
19
+
20
+ **API Base URL:** `https://x402-api.fly.dev`
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install @x402-api/elizaos-plugin
28
+ # or
29
+ bun add @x402-api/elizaos-plugin
30
+ ```
31
+
32
+ ### For automatic payments (required for production)
33
+
34
+ ```bash
35
+ npm install x402-fetch viem
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Quick Start
41
+
42
+ ### 1. Add to your character file
43
+
44
+ ```typescript
45
+ // src/character.ts
46
+ import { x402DeFiPlugin } from '@x402-api/elizaos-plugin';
47
+
48
+ export const character: Character = {
49
+ name: 'DeFi Agent',
50
+ plugins: [
51
+ '@elizaos/plugin-bootstrap',
52
+ '@elizaos/plugin-sql',
53
+ x402DeFiPlugin, // ← add this
54
+ ],
55
+ };
56
+ ```
57
+
58
+ ### 2. Configure your wallet
59
+
60
+ The plugin needs a wallet with USDC on Base to pay for API calls.
61
+
62
+ ```bash
63
+ # .env
64
+ X402_WALLET_PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE
65
+ ```
66
+
67
+ > **āš ļø Security:** Never commit your private key. Use `.env` files and add them to `.gitignore`.
68
+
69
+ ### 3. Fund your wallet
70
+
71
+ Your wallet needs USDC on Base. Get some from:
72
+ - [Coinbase](https://coinbase.com) → withdraw USDC to Base
73
+ - [Uniswap on Base](https://app.uniswap.org) → swap ETH for USDC
74
+ - [bridge.base.org](https://bridge.base.org) → bridge from Ethereum
75
+
76
+ Costs are tiny — $1 of USDC covers **125–1000 queries** depending on the endpoint.
77
+
78
+ ---
79
+
80
+ ## Configuration
81
+
82
+ ### Environment Variables
83
+
84
+ | Variable | Description | Default |
85
+ |----------|-------------|---------|
86
+ | `X402_WALLET_PRIVATE_KEY` | Your wallet's private key (hex) | — |
87
+ | `X402_WALLET_ADDRESS` | Your wallet address (for logging) | — |
88
+ | `X402_API_BASE_URL` | API base URL override | `https://x402-api.fly.dev` |
89
+
90
+ ### Programmatic Config
91
+
92
+ ```typescript
93
+ import { createX402Plugin } from '@x402-api/elizaos-plugin';
94
+
95
+ const plugin = createX402Plugin({
96
+ walletPrivateKey: process.env.MY_KEY,
97
+ baseUrl: 'https://x402-api.fly.dev', // or your own instance
98
+ timeoutMs: 15000,
99
+ });
100
+
101
+ export const character: Character = {
102
+ plugins: [plugin],
103
+ };
104
+ ```
105
+
106
+ ---
107
+
108
+ ## What Each Action Does
109
+
110
+ ### šŸ’° GET_CRYPTO_PRICES
111
+ Fetches live prices for BTC, ETH, SOL + top 5 gainers/losers by 24h change. Data from CoinGecko.
112
+
113
+ **Triggers when you say:**
114
+ - "What are the current crypto prices?"
115
+ - "How is the market doing?"
116
+ - "Price feed"
117
+
118
+ ---
119
+
120
+ ### ⛽ GET_GAS_PRICES
121
+ Current gas prices across Ethereum, Base, Polygon, and Arbitrum. Returns slow/normal/fast tiers with USD cost estimates for transfers, swaps, and NFT mints.
122
+
123
+ **Triggers when you say:**
124
+ - "What are the gas fees right now?"
125
+ - "How much does an ETH swap cost?"
126
+ - "Check gas prices on Arbitrum"
127
+
128
+ ---
129
+
130
+ ### šŸ”„ GET_DEX_QUOTES
131
+ Compare swap quotes across Uniswap V3, SushiSwap, and 1inch for any token pair. Shows price impact, fees, gas costs, and best route.
132
+
133
+ **Triggers when you say:**
134
+ - "What's the best rate to swap 1 ETH for USDC?"
135
+ - "Compare DEX quotes for BTC/USDC on Base"
136
+ - "How much USDT do I get for 500 USDC?"
137
+
138
+ **Params extracted from message:** from/to tokens, amount, chain
139
+
140
+ ---
141
+
142
+ ### šŸ” SCAN_TOKEN
143
+ Security scan for any ERC-20 token. Checks: contract verification, proxy/upgradeable, mint function, liquidity lock, honeypot detection, buy/sell tax, holder count, risk score.
144
+
145
+ **Triggers when you say:**
146
+ - "Is PEPE safe? Check for rug"
147
+ - "Scan this token: 0x6982..."
148
+ - "Is this a honeypot?"
149
+
150
+ **Params:** token symbol or address, chain
151
+
152
+ ---
153
+
154
+ ### šŸ‹ TRACK_WHALES
155
+ Top holder distribution analysis. Returns concentration metrics (Gini coefficient, Herfindahl index), distribution buckets, top 20 holders with labels, and recent large transfers.
156
+
157
+ **Triggers when you say:**
158
+ - "Are whales accumulating ETH?"
159
+ - "Show whale activity for PEPE"
160
+ - "Who are the top holders of SOL?"
161
+
162
+ ---
163
+
164
+ ### 🌾 SCAN_YIELDS
165
+ Find the best DeFi yield opportunities across 10+ protocols: Aave, Compound, Morpho, Lido, Rocket Pool, Pendle, Ethena, Maker DSR, Convex, Yearn, Aerodrome, and more. Filter by chain, asset, TVL, and risk tier.
166
+
167
+ **Triggers when you say:**
168
+ - "What are the best DeFi yields right now?"
169
+ - "Find safe USDC yields on Base"
170
+ - "Best ETH staking rates?"
171
+
172
+ ---
173
+
174
+ ### šŸ“Š GET_FUNDING_RATES
175
+ Perpetual futures funding rates across Hyperliquid, dYdX v4, Aevo, GMX, Drift, and Vertex. Automatically identifies arbitrage opportunities (long on lowest-rate venue, short on highest).
176
+
177
+ **Triggers when you say:**
178
+ - "What are the current perp funding rates?"
179
+ - "Is there a funding rate arb for ETH?"
180
+ - "Compare funding rates across venues"
181
+
182
+ ---
183
+
184
+ ### šŸ‘› PROFILE_WALLET
185
+ Full wallet analysis: portfolio breakdown, DeFi positions, activity metrics, risk classification. Supports ENS and known wallet labels.
186
+
187
+ **Triggers when you say:**
188
+ - "Analyze wallet 0xd8dA..."
189
+ - "What's in vitalik's wallet?"
190
+ - "Profile this address: 0x..."
191
+
192
+ ---
193
+
194
+ ## How x402 Payments Work
195
+
196
+ The [x402 protocol](https://x402.org) is a standard for HTTP micropayments:
197
+
198
+ ```
199
+ 1. Agent → GET /api/price-feed
200
+ 2. Server → 402 Payment Required + payment details
201
+ 3. x402-fetch → sign & broadcast USDC transfer on Base
202
+ 4. Agent → GET /api/price-feed + X-PAYMENT header
203
+ 5. Server → validate payment → 200 OK + data
204
+ ```
205
+
206
+ This happens **automatically** when you install `x402-fetch` and provide a wallet key. From your agent's perspective, it's just a normal API call.
207
+
208
+ ### Without x402-fetch
209
+
210
+ If `x402-fetch` is not installed, the plugin will:
211
+ 1. Make the request
212
+ 2. Receive a 402 response
213
+ 3. Throw a helpful error explaining how to configure payment
214
+
215
+ This is useful for **testing** the plugin structure without spending USDC.
216
+
217
+ ---
218
+
219
+ ## TypeScript Types
220
+
221
+ All API response types are exported:
222
+
223
+ ```typescript
224
+ import type {
225
+ PriceFeedResponse,
226
+ GasTrackerResponse,
227
+ DexQuotesData,
228
+ TokenScanData,
229
+ WhaleTrackerData,
230
+ YieldPool,
231
+ ArbOpportunity,
232
+ WalletProfileData,
233
+ } from '@x402-api/elizaos-plugin';
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Advanced: Custom Action Composition
239
+
240
+ Use only the actions you need:
241
+
242
+ ```typescript
243
+ import {
244
+ createPriceFeedAction,
245
+ createTokenScannerAction,
246
+ type X402ClientConfig,
247
+ } from '@x402-api/elizaos-plugin';
248
+ import type { Plugin } from '@elizaos/core';
249
+
250
+ const config: X402ClientConfig = {
251
+ baseUrl: 'https://x402-api.fly.dev',
252
+ walletPrivateKey: process.env.X402_WALLET_PRIVATE_KEY,
253
+ };
254
+
255
+ const myPlugin: Plugin = {
256
+ name: 'my-defi-plugin',
257
+ description: 'Selected DeFi actions',
258
+ actions: [
259
+ createPriceFeedAction(config),
260
+ createTokenScannerAction(config),
261
+ ],
262
+ };
263
+ ```
264
+
265
+ ---
266
+
267
+ ## Running Your Own API Instance
268
+
269
+ The API server is open source. Deploy your own:
270
+
271
+ ```bash
272
+ git clone https://github.com/sugi/x402-api-server
273
+ cd x402-api-server
274
+ fly deploy
275
+ ```
276
+
277
+ Then point the plugin at your instance:
278
+
279
+ ```bash
280
+ X402_API_BASE_URL=https://your-api.fly.dev
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Development & Testing
286
+
287
+ ```bash
288
+ # Install deps
289
+ npm install
290
+
291
+ # Build TypeScript
292
+ npm run build
293
+
294
+ # Watch mode
295
+ npm run dev
296
+ ```
297
+
298
+ ### Testing without real payments
299
+
300
+ Set a dummy private key to test plugin loading (calls will fail at payment step):
301
+
302
+ ```bash
303
+ X402_WALLET_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000001
304
+ ```
305
+
306
+ Or mock `x402-fetch` in your tests.
307
+
308
+ ---
309
+
310
+ ## Publishing to npm
311
+
312
+ ```bash
313
+ npm run build
314
+ npm publish --access public
315
+ ```
316
+
317
+ Or with Bun:
318
+
319
+ ```bash
320
+ bun run build
321
+ bun publish
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Compatibility
327
+
328
+ | ElizaOS Version | Plugin Version | Notes |
329
+ |----------------|----------------|-------|
330
+ | `>=1.0.0` | `1.x` | Full support |
331
+ | `0.x` | Not supported | Use the raw API client instead |
332
+
333
+ ---
334
+
335
+ ## License
336
+
337
+ MIT Ā© Sugi
338
+
339
+ ---
340
+
341
+ ## Links
342
+
343
+ - **API Server:** https://x402-api.fly.dev
344
+ - **x402 Protocol:** https://x402.org
345
+ - **ElizaOS Docs:** https://docs.elizaos.ai
346
+ - **Source Code:** https://github.com/sugi/x402-api-server
@@ -0,0 +1,4 @@
1
+ import type { Action } from '@elizaos/core';
2
+ import { type X402ClientConfig } from '../client.js';
3
+ export declare function createDexQuotesAction(config: X402ClientConfig): Action;
4
+ //# sourceMappingURL=dexQuotes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dexQuotes.d.ts","sourceRoot":"","sources":["../../src/actions/dexQuotes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+E,MAAM,eAAe,CAAC;AACzH,OAAO,EAAiC,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGpF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAoGtE"}
@@ -0,0 +1,80 @@
1
+ import { x402ApiRequest } from '../client.js';
2
+ export function createDexQuotesAction(config) {
3
+ return {
4
+ name: 'GET_DEX_QUOTES',
5
+ similes: [
6
+ 'DEX_QUOTES',
7
+ 'SWAP_QUOTES',
8
+ 'GET_SWAP_RATE',
9
+ 'COMPARE_DEXS',
10
+ 'UNISWAP_QUOTE',
11
+ 'SWAP_PRICE',
12
+ 'BEST_SWAP',
13
+ 'TOKEN_SWAP_QUOTE',
14
+ 'DEX_COMPARISON',
15
+ ],
16
+ description: 'Get DEX swap quotes for any token pair across Uniswap V3, SushiSwap, and 1inch. ' +
17
+ 'Compares rates, price impact, fees, and gas costs. ' +
18
+ 'Query with from/to tokens, amount, and chain. Costs $0.002 USDC via x402.',
19
+ validate: async (_runtime, _message, _state) => {
20
+ return true;
21
+ },
22
+ handler: async (_runtime, message, _state, options, callback) => {
23
+ try {
24
+ const text = message.content.text || '';
25
+ // Extract swap parameters from message
26
+ // Patterns: "swap 1 ETH to USDC", "ETH/USDC quote", "0.5 BTC for USDT on base"
27
+ const fromMatch = text.match(/\b(from|swap|sell|exchange)\s+[\d.]+\s+([A-Z]{2,6})/i) ||
28
+ text.match(/\b([\d.]+)\s+([A-Z]{2,6})\s+(?:to|for|→)/i);
29
+ const toMatch = text.match(/\b(?:to|for|into)\s+([A-Z]{2,6})\b/i);
30
+ const amountMatch = text.match(/\b([\d.]+(?:\.\d+)?)\b/);
31
+ const chainMatch = text.match(/\b(ethereum|base|arbitrum|polygon)\b/i);
32
+ const from = options?.from || fromMatch?.[2]?.toUpperCase() || 'ETH';
33
+ const to = options?.to || toMatch?.[1]?.toUpperCase() || 'USDC';
34
+ const amount = options?.amount || parseFloat(amountMatch?.[1] || '1') || 1;
35
+ const chain = options?.chain || chainMatch?.[1]?.toLowerCase() || 'ethereum';
36
+ const data = await x402ApiRequest('/api/dex-quotes', { from, to, amount: amount.toString(), chain }, config);
37
+ const q = data.data;
38
+ const best = q.quotes[0];
39
+ const quoteLines = q.quotes
40
+ .map((quote, i) => {
41
+ const medal = i === 0 ? 'šŸ„‡' : i === 1 ? '🄈' : 'šŸ„‰';
42
+ return (`${medal} **${quote.dex_name}**: ${quote.output_amount} ${to} ` +
43
+ `(impact: ${quote.price_impact_pct}%, gas: $${quote.estimated_gas_usd})`);
44
+ })
45
+ .join('\n');
46
+ const response = `## šŸ”„ DEX Quotes: ${amount} ${from} → ${to} on ${chain}\n\n` +
47
+ `${quoteLines}\n\n` +
48
+ `**Best:** ${q.recommendation.dex} — ${q.recommendation.reason}\n` +
49
+ `**Output:** ${best.output_amount} ${to} ($${(best.output_amount * (q.input_value_usd / amount)).toFixed(2)})\n` +
50
+ `**Total cost:** $${q.recommendation.total_cost_usd} (fees + gas)\n\n` +
51
+ `*Quotes valid for ${best.expires_in_seconds}s • ${data.timestamp}*`;
52
+ if (callback) {
53
+ await callback({ text: response, source: message.content.source });
54
+ }
55
+ return { success: true, text: response, data: data.data };
56
+ }
57
+ catch (error) {
58
+ const errMsg = `Failed to get DEX quotes: ${error.message}`;
59
+ if (callback)
60
+ await callback({ text: errMsg });
61
+ return { success: false, text: errMsg };
62
+ }
63
+ },
64
+ examples: [
65
+ [
66
+ { name: '{{user}}', content: { text: 'What\'s the best rate to swap 1 ETH to USDC?' } },
67
+ { name: '{{agent}}', content: { text: '## šŸ”„ DEX Quotes: 1 ETH → USDC on ethereum\n\nšŸ„‡ 1inch Aggregator: 2749.5 USDC\n🄈 Uniswap V3: 2747.2 USDC\nšŸ„‰ SushiSwap: 2744.8 USDC', actions: ['GET_DEX_QUOTES'] } },
68
+ ],
69
+ [
70
+ { name: '{{user}}', content: { text: 'Compare DEX rates for ETH/USDC on Base' } },
71
+ { name: '{{agent}}', content: { text: 'Getting swap quotes across Uniswap, SushiSwap, and 1inch on Base...', actions: ['GET_DEX_QUOTES'] } },
72
+ ],
73
+ [
74
+ { name: '{{user}}', content: { text: 'How much USDC do I get for 0.5 BTC?' } },
75
+ { name: '{{agent}}', content: { text: 'Fetching DEX quotes for 0.5 BTC → USDC...', actions: ['GET_DEX_QUOTES'] } },
76
+ ],
77
+ ],
78
+ };
79
+ }
80
+ //# sourceMappingURL=dexQuotes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dexQuotes.js","sourceRoot":"","sources":["../../src/actions/dexQuotes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAwC,MAAM,cAAc,CAAC;AAGpF,MAAM,UAAU,qBAAqB,CAAC,MAAwB;IAC5D,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAA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BAC9E,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,2CAA2C,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE;aACnH;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Action } from '@elizaos/core';
2
+ import { type X402ClientConfig } from '../client.js';
3
+ export declare function createFundingRatesAction(config: X402ClientConfig): Action;
4
+ //# sourceMappingURL=fundingRates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fundingRates.d.ts","sourceRoot":"","sources":["../../src/actions/fundingRates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+E,MAAM,eAAe,CAAC;AACzH,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAqBrE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAmGzE"}
@@ -0,0 +1,85 @@
1
+ import { x402ApiRequest } from '../client.js';
2
+ const SIGNAL_EMOJIS = { STRONG: 'šŸš€', MODERATE: 'šŸ“ˆ', WEAK: 'šŸ’¤' };
3
+ export function createFundingRatesAction(config) {
4
+ return {
5
+ name: 'GET_FUNDING_RATES',
6
+ similes: [
7
+ 'FUNDING_RATES',
8
+ 'PERP_FUNDING',
9
+ 'PERPETUAL_RATES',
10
+ 'FUNDING_ARBITRAGE',
11
+ 'PERP_RATES',
12
+ 'FUNDING_ANALYSIS',
13
+ 'HYPERLIQUID_FUNDING',
14
+ 'DYDX_FUNDING',
15
+ ],
16
+ description: 'Get perpetual futures funding rates across Hyperliquid, dYdX v4, Aevo, GMX, Drift, and Vertex. ' +
17
+ 'Identifies funding rate arbitrage opportunities (long/short spread capture). ' +
18
+ 'Costs $0.008 USDC via x402.',
19
+ validate: async (_runtime, _message, _state) => {
20
+ return true;
21
+ },
22
+ handler: async (_runtime, message, _state, options, callback) => {
23
+ try {
24
+ const text = message.content.text || '';
25
+ // Extract asset and min spread from message
26
+ const assetMatch = text.match(/\b(BTC|ETH|SOL|SUI|AVAX|ARB|OP|DOGE|LINK|UNI)\b/i);
27
+ const spreadMatch = text.match(/(?:spread|bps|basis points)[:\s]+(\d+)/i);
28
+ const asset = options?.asset || assetMatch?.[1]?.toUpperCase();
29
+ const minSpread = options?.min_spread || (spreadMatch ? parseInt(spreadMatch[1]) : 0);
30
+ const params = {};
31
+ if (asset)
32
+ params.asset = asset;
33
+ if (minSpread > 0)
34
+ params.min_spread = minSpread;
35
+ const data = await x402ApiRequest('/api/funding-rates', params, config);
36
+ // Show top arb opportunities
37
+ const arbs = data.arb_opportunities.slice(0, 5);
38
+ const arbLines = arbs.length > 0
39
+ ? arbs.map(arb => {
40
+ const signal = SIGNAL_EMOJIS[arb.signal];
41
+ return (`${signal} **${arb.asset}**: ${arb.spread_bps} bps spread — ` +
42
+ `Long ${arb.long_venue}, Short ${arb.short_venue} → **${arb.annualized_arb_pct}% APR**`);
43
+ }).join('\n')
44
+ : ' No significant arb opportunities found';
45
+ // Show rates for specific asset if requested
46
+ let assetSection = '';
47
+ if (asset && data.data[asset]) {
48
+ const rates = Object.entries(data.data[asset])
49
+ .sort((a, b) => a[1].funding_rate - b[1].funding_rate)
50
+ .map(([protocol, r]) => {
51
+ const sign = r.funding_rate >= 0 ? '+' : '';
52
+ return ` • ${protocol}: ${sign}${(r.funding_rate * 100).toFixed(4)}% (${sign}${r.annualized_pct}% APR)`;
53
+ })
54
+ .join('\n');
55
+ assetSection = `\n\n### ${asset} Funding Rates\n${rates}`;
56
+ }
57
+ const response = `## šŸ“Š Funding Rates — ${asset || 'All Assets'}\n\n` +
58
+ `### Top Arbitrage Opportunities\n${arbLines}` +
59
+ assetSection +
60
+ `\n\n*Funding interval: ${data.funding_interval_hours}h | Protocols: ${data.protocols.join(', ')} | ${data.timestamp}*`;
61
+ if (callback) {
62
+ await callback({ text: response, source: message.content.source });
63
+ }
64
+ return { success: true, text: response, data: { rates: data.data, arb: data.arb_opportunities } };
65
+ }
66
+ catch (error) {
67
+ const errMsg = `Failed to get funding rates: ${error.message}`;
68
+ if (callback)
69
+ await callback({ text: errMsg });
70
+ return { success: false, text: errMsg };
71
+ }
72
+ },
73
+ examples: [
74
+ [
75
+ { name: '{{user}}', content: { text: 'What are the current perp funding rates?' } },
76
+ { name: '{{agent}}', content: { text: '## šŸ“Š Funding Rates\n\n### Top Arb Opportunities\nšŸš€ BTC: 12 bps spread — Long dYdX, Short Drift → 24.5% APR\nšŸ“ˆ ETH: 8 bps — Long GMX, Short Aevo → 14.2% APR', actions: ['GET_FUNDING_RATES'] } },
77
+ ],
78
+ [
79
+ { name: '{{user}}', content: { text: 'Is there a funding rate arb for ETH?' } },
80
+ { name: '{{agent}}', content: { text: 'Checking ETH funding rates across all perp venues...', actions: ['GET_FUNDING_RATES'] } },
81
+ ],
82
+ ],
83
+ };
84
+ }
85
+ //# sourceMappingURL=fundingRates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fundingRates.js","sourceRoot":"","sources":["../../src/actions/fundingRates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAyB,MAAM,cAAc,CAAC;AAmBrE,MAAM,aAAa,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAW,CAAC;AAE5E,MAAM,UAAU,wBAAwB,CAAC,MAAwB;IAC/D,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE;YACP,eAAe;YACf,cAAc;YACd,iBAAiB;YACjB,mBAAmB;YACnB,YAAY;YACZ,kBAAkB;YAClB,qBAAqB;YACrB,cAAc;SACf;QACD,WAAW,EACT,iGAAiG;YACjG,+EAA+E;YAC/E,6BAA6B;QAE/B,QAAQ,EAAE,KAAK,EAAE,QAAuB,EAAE,QAAgB,EAAE,MAAc,EAAE,EAAE;YAC5E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAE,KAAK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';
3
+ export declare function createGasTrackerAction(config: X402ClientConfig): Action;
4
+ //# sourceMappingURL=gasTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gasTracker.d.ts","sourceRoot":"","sources":["../../src/actions/gasTracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+E,MAAM,eAAe,CAAC;AACzH,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAyEvE"}
@@ -0,0 +1,60 @@
1
+ import { x402ApiRequest } from '../client.js';
2
+ export function createGasTrackerAction(config) {
3
+ return {
4
+ name: 'GET_GAS_PRICES',
5
+ similes: [
6
+ 'GAS_TRACKER',
7
+ 'GAS_PRICES',
8
+ 'CHECK_GAS',
9
+ 'CURRENT_GAS',
10
+ 'TRANSACTION_FEES',
11
+ 'GAS_FEES',
12
+ 'NETWORK_FEES',
13
+ 'ETH_GAS',
14
+ ],
15
+ description: 'Fetch current gas prices across Ethereum, Base, Polygon, and Arbitrum. ' +
16
+ 'Returns slow/normal/fast tiers with USD cost estimates for transfers, swaps, and NFT mints. ' +
17
+ 'Costs $0.001 USDC via x402.',
18
+ validate: async (_runtime, _message, _state) => {
19
+ return true;
20
+ },
21
+ handler: async (_runtime, message, _state, _options, callback) => {
22
+ try {
23
+ const data = await x402ApiRequest('/api/gas-tracker', {}, config);
24
+ const chains = data.data;
25
+ const chainLines = Object.entries(chains)
26
+ .map(([key, chain]) => {
27
+ const gwei = chain.gas_price_gwei;
28
+ const cost = chain.estimated_cost_usd;
29
+ return (`### ${chain.chain} (Chain ID: ${chain.chain_id})\n` +
30
+ `Gas: slow ${gwei.slow} / normal ${gwei.normal} / fast ${gwei.fast} gwei\n` +
31
+ `Transfer: $${cost.transfer.normal} | Swap: $${cost.swap.normal} | NFT mint: $${cost.nft_mint.normal}`);
32
+ })
33
+ .join('\n\n');
34
+ const text = `## ⛽ Gas Tracker\n\n${chainLines}\n\n` +
35
+ `*Source: ${data.source} • Updated: ${data.timestamp}*`;
36
+ if (callback) {
37
+ await callback({ text, source: message.content.source });
38
+ }
39
+ return { success: true, text, data: data.data };
40
+ }
41
+ catch (error) {
42
+ const errMsg = `Failed to fetch gas prices: ${error.message}`;
43
+ if (callback)
44
+ await callback({ text: errMsg });
45
+ return { success: false, text: errMsg };
46
+ }
47
+ },
48
+ examples: [
49
+ [
50
+ { name: '{{user}}', content: { text: 'What are the current gas prices?' } },
51
+ { name: '{{agent}}', content: { text: '## ⛽ Gas Tracker\n\n### Ethereum\nGas: slow 20 / normal 28 / fast 39 gwei\nTransfer: $1.62 | Swap: $11.55 | NFT mint: $6.54', actions: ['GET_GAS_PRICES'] } },
52
+ ],
53
+ [
54
+ { name: '{{user}}', content: { text: 'How much does an ETH transfer cost right now?' } },
55
+ { name: '{{agent}}', content: { text: 'Checking gas prices across all chains...', actions: ['GET_GAS_PRICES'] } },
56
+ ],
57
+ ],
58
+ };
59
+ }
60
+ //# sourceMappingURL=gasTracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gasTracker.js","sourceRoot":"","sources":["../../src/actions/gasTracker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAyB,MAAM,cAAc,CAAC;AAGrE,MAAM,UAAU,sBAAsB,CAAC,MAAwB;IAC7D,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;YACP,aAAa;YACb,YAAY;YACZ,WAAW;YACX,aAAa;YACb,kBAAkB;YAClB,UAAU;YACV,cAAc;YACd,SAAS;SACV;QACD,WAAW,EACT,yEAAyE;YACzE,8FAA8F;YAC9F,6BAA6B;QAE/B,QAAQ,EAAE,KAAK,EAAE,QAAuB,EAAE,QAAgB,EAAE,MAAc,EAAE,EAAE;YAC5E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAE,KAAK,EACZ,QAAuB,EACvB,OAAe,EACf,MAA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AO,EAAE,CAAC;gBACzE,IAAI,QAAQ;oBAAE,MAAM,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC/C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,QAAQ,EAAE;YACR;gBACE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,kCAAkC,EAAE,EAAE;gBAC3E,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,6HAA6H,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE;aACrM;YACD;gBACE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,+CAA+C,EAAE,EAAE;gBACxF,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,0CAA0C,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE;aAClH;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Action } from '@elizaos/core';
2
+ import { type X402ClientConfig } from '../client.js';
3
+ export declare function createPriceFeedAction(config: X402ClientConfig): Action;
4
+ //# sourceMappingURL=priceFeed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceFeed.d.ts","sourceRoot":"","sources":["../../src/actions/priceFeed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+E,MAAM,eAAe,CAAC;AACzH,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAwFtE"}