@liqdlad/plugin-a2a-swap 0.1.3 → 0.1.4

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/dist/index.d.mts CHANGED
@@ -17,8 +17,9 @@ declare const swapTokensAction: Action;
17
17
  declare const provideLiquidityAction: Action;
18
18
  declare const removeLiquidityAction: Action;
19
19
  declare const claimFeesAction: Action;
20
+ declare const activePoolsAction: Action;
20
21
  declare const poolInfoAction: Action;
21
22
  declare const myFeesAction: Action;
22
23
  declare const a2aSwapPlugin: Plugin;
23
24
 
24
- export { a2aSwapPlugin, claimFeesAction, a2aSwapPlugin as default, myFeesAction, poolInfoAction, provideLiquidityAction, removeLiquidityAction, simulateSwapAction, swapTokensAction };
25
+ export { a2aSwapPlugin, activePoolsAction, claimFeesAction, a2aSwapPlugin as default, myFeesAction, poolInfoAction, provideLiquidityAction, removeLiquidityAction, simulateSwapAction, swapTokensAction };
package/dist/index.d.ts CHANGED
@@ -17,8 +17,9 @@ declare const swapTokensAction: Action;
17
17
  declare const provideLiquidityAction: Action;
18
18
  declare const removeLiquidityAction: Action;
19
19
  declare const claimFeesAction: Action;
20
+ declare const activePoolsAction: Action;
20
21
  declare const poolInfoAction: Action;
21
22
  declare const myFeesAction: Action;
22
23
  declare const a2aSwapPlugin: Plugin;
23
24
 
24
- export { a2aSwapPlugin, claimFeesAction, a2aSwapPlugin as default, myFeesAction, poolInfoAction, provideLiquidityAction, removeLiquidityAction, simulateSwapAction, swapTokensAction };
25
+ export { a2aSwapPlugin, activePoolsAction, claimFeesAction, a2aSwapPlugin as default, myFeesAction, poolInfoAction, provideLiquidityAction, removeLiquidityAction, simulateSwapAction, swapTokensAction };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  a2aSwapPlugin: () => a2aSwapPlugin,
24
+ activePoolsAction: () => activePoolsAction,
24
25
  claimFeesAction: () => claimFeesAction,
25
26
  default: () => index_default,
26
27
  myFeesAction: () => myFeesAction,
@@ -333,6 +334,60 @@ var claimFeesAction = {
333
334
  }
334
335
  }
335
336
  };
337
+ var activePoolsAction = {
338
+ name: "A2A_ACTIVE_POOLS",
339
+ description: "List every liquidity pool on A2A-Swap with live reserves, spot price, LP supply, and fee rate. No parameters needed. Use this for discovery \u2014 call it to learn which token pairs are available before deciding what to swap.",
340
+ similes: [
341
+ "list pools",
342
+ "active pools",
343
+ "available pools",
344
+ "what pools exist",
345
+ "show all pools",
346
+ "what can I swap",
347
+ "what tokens are on a2a swap",
348
+ "discover pools"
349
+ ],
350
+ examples: [
351
+ [
352
+ { name: "user", content: { text: "What pools are available on A2A-Swap?" } },
353
+ { name: "agent", content: { text: "Fetching all active pools \u2026", action: "A2A_ACTIVE_POOLS" } }
354
+ ],
355
+ [
356
+ { name: "user", content: { text: "List all A2A-Swap liquidity pools" } },
357
+ { name: "agent", content: { text: "Listing active pools \u2026", action: "A2A_ACTIVE_POOLS" } }
358
+ ]
359
+ ],
360
+ validate: async (_runtime, _message, _state) => true,
361
+ handler: async (_runtime, _message, _state, _options, callback) => {
362
+ try {
363
+ const client = buildClient();
364
+ const pools = await client.activePools();
365
+ if (pools.length === 0) {
366
+ await callback?.({ text: "No active pools found on A2A-Swap." });
367
+ return;
368
+ }
369
+ const lines = [`Active pools on A2A-Swap (${pools.length}):`];
370
+ for (const [i, p] of pools.entries()) {
371
+ lines.push(
372
+ ` [${i + 1}] Pool: ${p.pool.toBase58()}`,
373
+ ` Mint A: ${p.mintA.toBase58()}`,
374
+ ` Mint B: ${p.mintB.toBase58()}`,
375
+ ` Reserve A: ${p.reserveA}`,
376
+ ` Reserve B: ${p.reserveB}`,
377
+ ` LP supply: ${p.lpSupply}`,
378
+ ` Fee rate: ${p.feeRateBps} bps`,
379
+ ` Spot price: ${p.spotPrice.toFixed(6)} (B per A)`
380
+ );
381
+ }
382
+ await callback?.({
383
+ text: lines.join("\n"),
384
+ data: { pools: pools.map((p) => ({ ...p, pool: p.pool.toBase58(), mintA: p.mintA.toBase58(), mintB: p.mintB.toBase58() })) }
385
+ });
386
+ } catch (err) {
387
+ await callback?.({ text: `Active pools failed: ${err.message}` });
388
+ }
389
+ }
390
+ };
336
391
  var poolInfoAction = {
337
392
  name: "A2A_POOL_INFO",
338
393
  description: "Fetch A2A-Swap pool reserves, spot price, LP supply, and fee rate. Accepts: mintA, mintB (the two token mint addresses).",
@@ -434,6 +489,7 @@ var a2aSwapPlugin = {
434
489
  provideLiquidityAction,
435
490
  removeLiquidityAction,
436
491
  claimFeesAction,
492
+ activePoolsAction,
437
493
  poolInfoAction,
438
494
  myFeesAction
439
495
  ]
@@ -442,6 +498,7 @@ var index_default = a2aSwapPlugin;
442
498
  // Annotate the CommonJS export names for ESM import in node:
443
499
  0 && (module.exports = {
444
500
  a2aSwapPlugin,
501
+ activePoolsAction,
445
502
  claimFeesAction,
446
503
  myFeesAction,
447
504
  poolInfoAction,
package/dist/index.mjs CHANGED
@@ -303,6 +303,60 @@ var claimFeesAction = {
303
303
  }
304
304
  }
305
305
  };
306
+ var activePoolsAction = {
307
+ name: "A2A_ACTIVE_POOLS",
308
+ description: "List every liquidity pool on A2A-Swap with live reserves, spot price, LP supply, and fee rate. No parameters needed. Use this for discovery \u2014 call it to learn which token pairs are available before deciding what to swap.",
309
+ similes: [
310
+ "list pools",
311
+ "active pools",
312
+ "available pools",
313
+ "what pools exist",
314
+ "show all pools",
315
+ "what can I swap",
316
+ "what tokens are on a2a swap",
317
+ "discover pools"
318
+ ],
319
+ examples: [
320
+ [
321
+ { name: "user", content: { text: "What pools are available on A2A-Swap?" } },
322
+ { name: "agent", content: { text: "Fetching all active pools \u2026", action: "A2A_ACTIVE_POOLS" } }
323
+ ],
324
+ [
325
+ { name: "user", content: { text: "List all A2A-Swap liquidity pools" } },
326
+ { name: "agent", content: { text: "Listing active pools \u2026", action: "A2A_ACTIVE_POOLS" } }
327
+ ]
328
+ ],
329
+ validate: async (_runtime, _message, _state) => true,
330
+ handler: async (_runtime, _message, _state, _options, callback) => {
331
+ try {
332
+ const client = buildClient();
333
+ const pools = await client.activePools();
334
+ if (pools.length === 0) {
335
+ await callback?.({ text: "No active pools found on A2A-Swap." });
336
+ return;
337
+ }
338
+ const lines = [`Active pools on A2A-Swap (${pools.length}):`];
339
+ for (const [i, p] of pools.entries()) {
340
+ lines.push(
341
+ ` [${i + 1}] Pool: ${p.pool.toBase58()}`,
342
+ ` Mint A: ${p.mintA.toBase58()}`,
343
+ ` Mint B: ${p.mintB.toBase58()}`,
344
+ ` Reserve A: ${p.reserveA}`,
345
+ ` Reserve B: ${p.reserveB}`,
346
+ ` LP supply: ${p.lpSupply}`,
347
+ ` Fee rate: ${p.feeRateBps} bps`,
348
+ ` Spot price: ${p.spotPrice.toFixed(6)} (B per A)`
349
+ );
350
+ }
351
+ await callback?.({
352
+ text: lines.join("\n"),
353
+ data: { pools: pools.map((p) => ({ ...p, pool: p.pool.toBase58(), mintA: p.mintA.toBase58(), mintB: p.mintB.toBase58() })) }
354
+ });
355
+ } catch (err) {
356
+ await callback?.({ text: `Active pools failed: ${err.message}` });
357
+ }
358
+ }
359
+ };
306
360
  var poolInfoAction = {
307
361
  name: "A2A_POOL_INFO",
308
362
  description: "Fetch A2A-Swap pool reserves, spot price, LP supply, and fee rate. Accepts: mintA, mintB (the two token mint addresses).",
@@ -404,6 +458,7 @@ var a2aSwapPlugin = {
404
458
  provideLiquidityAction,
405
459
  removeLiquidityAction,
406
460
  claimFeesAction,
461
+ activePoolsAction,
407
462
  poolInfoAction,
408
463
  myFeesAction
409
464
  ]
@@ -411,6 +466,7 @@ var a2aSwapPlugin = {
411
466
  var index_default = a2aSwapPlugin;
412
467
  export {
413
468
  a2aSwapPlugin,
469
+ activePoolsAction,
414
470
  claimFeesAction,
415
471
  index_default as default,
416
472
  myFeesAction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liqdlad/plugin-a2a-swap",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A2A-Swap plugin for ElizaOS — autonomous token swaps and liquidity management on Solana via a constant-product AMM built for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",