nirium-pollar-adapter 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -27,12 +27,12 @@ const nirium = createNiriumAdapter({
27
27
 
28
28
  // A normal fetch. The 402, the signature and the retry happen underneath.
29
29
  const res = await nirium.x402Fetch(
30
- "https://nirium-agent-mainnet.fly.dev/api/v1/premium/signals",
30
+ "https://nirium-agent-mainnet.fly.dev/api/v1/premium/market",
31
31
  );
32
32
  const data = await res.json();
33
33
  ```
34
34
 
35
- The user pays **$0.02 USDC** and signs nothing else — network fees are sponsored by the x402 facilitator, so the wallet does not need XLM for gas.
35
+ The user pays **$0.05 USDC** and signs nothing else — network fees are sponsored by the x402 facilitator, so the wallet does not need XLM for gas.
36
36
 
37
37
  ### Requires @pollar/core 0.11+
38
38
 
@@ -78,6 +78,13 @@ with Google paid $0.02 USDC on mainnet —
78
78
  trustline; the x402 facilitator sponsors the network fee and is the transaction
79
79
  source. The user never saw a key, a seed phrase or a gas prompt.
80
80
 
81
+ Both proofs above paid `/premium/signals` ($0.02). Since 6-Aug-2026 that
82
+ endpoint is **testnet only** — the mainnet agent box runs no autonomous loop,
83
+ so a capability guard now returns 501 before any charge. The example above
84
+ pays `/premium/market` ($0.05) instead, which has no such guard and still
85
+ settles on mainnet today; the two linked transactions remain real, they are
86
+ just no longer reproducible verbatim with the current example.
87
+
81
88
  ## API
82
89
 
83
90
  ### `createNiriumAdapter(config)`
@@ -93,7 +100,8 @@ source. The user never saw a key, a seed phrase or a gas prompt.
93
100
  Returns:
94
101
 
95
102
  - **`x402Fetch(url, init?)`** — fetch that pays on `402` and retries. Passes through untouched on `200`.
96
- - **`getPremiumSignals()`** — typed shortcut to the agent's paid signals endpoint.
103
+ - **`getPremiumSignals()`** — typed shortcut to the agent's paid signals endpoint. **Testnet only**: signals come from the autonomous loop, which does not run on the mainnet box; there the endpoint returns 501 without charging.
104
+ - **`getPremiumMarket()`** — typed shortcut to the agent's paid market-state endpoint ($0.05). Works and charges on **both** networks — no autonomous loop dependency.
97
105
  - **`anchorAuditRecord({ hash?, record?, txHash?, tag? })`** — anchors evidence to IPFS, returns the CID. No signature, no payment. Anchor **hashes, not personal data** — IPFS cannot be deleted.
98
106
  - **`getCetesRate()`** — public reference rate, no key required.
99
107
 
@@ -153,7 +161,8 @@ request is rejected.
153
161
  |---|---|
154
162
  | x402 Settlement | ✅ mainnet |
155
163
  | Audit Trail (IPFS) | ✅ mainnet |
156
- | Treasury / rebalance vault | audit-gated — testnet only |
164
+ | Treasury vault (DeFindex, client-owned) | ✅ mainnet — invite-only during legal review |
165
+ | Nirium's own NiriumVault | audit-gated — testnet only |
157
166
  | MPP session channels | audit-gated — testnet only |
158
167
 
159
168
  Nirium never holds customer funds. The user's signature is the authorization; regulated partners execute any financial settlement.
package/dist/index.d.ts CHANGED
@@ -90,6 +90,7 @@ export declare function createNiriumAdapter(config: NiriumAdapterConfig): {
90
90
  address: string;
91
91
  x402Fetch: (url: string, init?: RequestInit) => Promise<Response>;
92
92
  getPremiumSignals: () => Promise<unknown>;
93
+ getPremiumMarket: () => Promise<unknown>;
93
94
  anchorAuditRecord: (input: AuditAnchorInput) => Promise<{
94
95
  cid: string;
95
96
  } & Record<string, unknown>>;
package/dist/index.js CHANGED
@@ -241,13 +241,32 @@ export function createNiriumAdapter(config) {
241
241
  throw e;
242
242
  }
243
243
  }
244
- /** Atajo tipado a los endpoints premium del agente. */
244
+ /**
245
+ * Atajo tipado a los endpoints premium del agente.
246
+ *
247
+ * TESTNET ONLY: las señales las produce el loop autónomo, que no corre en
248
+ * el box de mainnet — ahí un guard de capacidad responde 501 ANTES del
249
+ * cobro (agregado el 6-ago-2026, ver `capabilityGuard` en el agente), así
250
+ * que no se cobra, pero tampoco hay señales. Para verificar el pago en
251
+ * mainnet usa getPremiumMarket().
252
+ */
245
253
  async function getPremiumSignals() {
246
254
  const res = await x402Fetch(`${agentBaseUrl}/api/v1/premium/signals`);
247
255
  if (!res.ok)
248
256
  throw new Error(`premium/signals respondió HTTP ${res.status}`);
249
257
  return res.json();
250
258
  }
259
+ /**
260
+ * Atajo tipado al estado de mercado premium. A diferencia de
261
+ * getPremiumSignals(), no depende del loop autónomo — funciona y cobra
262
+ * igual en testnet y en mainnet.
263
+ */
264
+ async function getPremiumMarket() {
265
+ const res = await x402Fetch(`${agentBaseUrl}/api/v1/premium/market`);
266
+ if (!res.ok)
267
+ throw new Error(`premium/market respondió HTTP ${res.status}`);
268
+ return res.json();
269
+ }
251
270
  /**
252
271
  * Ancla evidencia en IPFS (Audit Trail Node). Software-only: no firma, no
253
272
  * mueve fondos, funciona en mainnet hoy. Se anclan HASHES, no PII.
@@ -289,6 +308,7 @@ export function createNiriumAdapter(config) {
289
308
  // Settlement (x402) — mainnet
290
309
  x402Fetch,
291
310
  getPremiumSignals,
311
+ getPremiumMarket,
292
312
  // Audit Trail — mainnet
293
313
  anchorAuditRecord,
294
314
  // Lecturas públicas
@@ -12,7 +12,12 @@
12
12
  // NIRIUM_DEMO_SECRET=S... node examples/pay-with-keypair.mjs
13
13
  // NIRIUM_DEMO_SECRET=S... NIRIUM_NETWORK=stellar:testnet node examples/pay-with-keypair.mjs
14
14
  //
15
- // OJO: contra stellar:pubnet esto gasta USDC REAL (0.02 por llamada a signals).
15
+ // OJO: contra stellar:pubnet esto gasta USDC REAL (0.05 por llamada a market).
16
+ //
17
+ // Usa getPremiumMarket(), no getPremiumSignals(): desde el 6-ago-2026 el box
18
+ // de mainnet responde 501 a /premium/signals ANTES de cobrar (no hay loop
19
+ // autónomo ahí que produzca señales) — con signals este ejemplo fallaría en
20
+ // el paso 1/2 usando su propio default de red.
16
21
  // ───────────────────────────────────────────────────────────────────────────
17
22
 
18
23
  import { createEd25519Signer } from "@x402/stellar";
@@ -33,14 +38,14 @@ console.log(`pagador : ${signer.address}`);
33
38
  console.log(`agente : ${nirium.agentBaseUrl}`);
34
39
 
35
40
  // 1) x402 — el 402, la firma del auth entry y el reintento pasan por debajo.
36
- console.log("\n[1/2] pagando /api/v1/premium/signals (0.02 USDC)…");
37
- const signals = await nirium.getPremiumSignals();
38
- console.log(" OK — respuesta:", JSON.stringify(signals).slice(0, 220));
41
+ console.log("\n[1/2] pagando /api/v1/premium/market (0.05 USDC)…");
42
+ const market = await nirium.getPremiumMarket();
43
+ console.log(" OK — respuesta:", JSON.stringify(market).slice(0, 220));
39
44
 
40
45
  // 2) Audit Trail — software-only, sin firma ni pago.
41
46
  console.log("\n[2/2] anclando evidencia en IPFS…");
42
47
  const anchor = await nirium.anchorAuditRecord({
43
- record: { source: "pollar-adapter-example", paidResource: "premium/signals", at: new Date().toISOString() },
48
+ record: { source: "pollar-adapter-example", paidResource: "premium/market", at: new Date().toISOString() },
44
49
  tag: "adapter-e2e",
45
50
  });
46
51
  console.log(" OK — CID:", anchor.cid ?? JSON.stringify(anchor).slice(0, 200));
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "nirium-pollar-adapter",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Nirium adapter for the Pollar SDK — x402 pay-per-request and IPFS audit anchoring using the wallet a user onboarded through Pollar. Signs SEP-43 auth entries; the facilitator sponsors network fees.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
- "files": ["dist", "examples"],
8
+ "files": [
9
+ "dist",
10
+ "examples"
11
+ ],
9
12
  "scripts": {
10
13
  "build": "tsc -p tsconfig.json",
11
14
  "typecheck": "tsc -p tsconfig.json --noEmit"
@@ -20,9 +23,18 @@
20
23
  "@pollar/core": ">=0.11.0"
21
24
  },
22
25
  "peerDependenciesMeta": {
23
- "@pollar/core": { "optional": true }
26
+ "@pollar/core": {
27
+ "optional": true
28
+ }
24
29
  },
25
- "keywords": ["nirium", "pollar", "stellar", "soroban", "x402", "adapter"],
30
+ "keywords": [
31
+ "nirium",
32
+ "pollar",
33
+ "stellar",
34
+ "soroban",
35
+ "x402",
36
+ "adapter"
37
+ ],
26
38
  "homepage": "https://nirium.xyz",
27
39
  "license": "MIT"
28
40
  }