@seekdaseek/plugin-agentfeed 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50,8 +50,14 @@ var AgentFeedService = class _AgentFeedService extends Service {
50
50
  const keypair = await createKeyPairSignerFromBytes(bytes);
51
51
  this.payerAddress = keypair.address;
52
52
  const signer = toClientSvmSigner(keypair);
53
+ const capBaseUnits = Math.round(this.maxSpendUsd * 10 ** USDC_DECIMALS);
54
+ const maxSpendPolicy = (_v, reqs) => reqs.filter((r) => {
55
+ const raw = Number(r?.maxAmountRequired ?? r?.amount ?? r?.maxAmount);
56
+ return Number.isFinite(raw) && raw > 0 && raw <= capBaseUnits;
57
+ });
53
58
  this.payFetch = wrapFetchWithPaymentFromConfig(fetch, {
54
- schemes: [{ network: "solana:*", client: new ExactSvmScheme(signer) }]
59
+ schemes: [{ network: "solana:*", client: new ExactSvmScheme(signer) }],
60
+ policies: [maxSpendPolicy]
55
61
  });
56
62
  logger.info(
57
63
  `[agentfeed] ready \u2014 payer ${this.payerAddress.slice(0, 4)}\u2026${this.payerAddress.slice(-4)}, base ${this.baseUrl}, cap $${this.maxSpendUsd}/call`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seekdaseek/plugin-agentfeed",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "elizaOS plugin for AgentFeed — paid crypto market data (liquidations, positioning, funding, token risk) over x402 micropayments on Solana. $0.001–$0.01 per call in USDC, no API keys, no subscriptions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",