@xona-labs/xpay 0.2.24 → 0.2.25

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 (114) hide show
  1. package/CHANGELOG.md +101 -78
  2. package/README.md +71 -69
  3. package/SKILL.md +22 -22
  4. package/dist/agenc/api.d.ts +8 -8
  5. package/dist/agenc/api.js +11 -11
  6. package/dist/agenc/hire.d.ts +4 -4
  7. package/dist/agenc/hire.js +17 -17
  8. package/dist/agenc/price.d.ts +1 -1
  9. package/dist/agenc/price.js +1 -1
  10. package/dist/biometric/index.d.ts +3 -3
  11. package/dist/biometric/index.js +6 -6
  12. package/dist/cli/accounts.d.ts +1 -1
  13. package/dist/cli/accounts.js +1 -1
  14. package/dist/cli/agenc.d.ts +2 -2
  15. package/dist/cli/agenc.js +4 -4
  16. package/dist/cli/balance.d.ts +1 -1
  17. package/dist/cli/balance.js +4 -4
  18. package/dist/cli/bento.d.ts +3 -3
  19. package/dist/cli/bento.js +8 -8
  20. package/dist/cli/bento.js.map +1 -1
  21. package/dist/cli/biometric.d.ts +1 -1
  22. package/dist/cli/biometric.js +8 -8
  23. package/dist/cli/common.js +6 -6
  24. package/dist/cli/common.js.map +1 -1
  25. package/dist/cli/discover.d.ts +2 -2
  26. package/dist/cli/discover.js +4 -4
  27. package/dist/cli/guardrail.d.ts +1 -1
  28. package/dist/cli/guardrail.js +3 -3
  29. package/dist/cli/index.d.ts +2 -2
  30. package/dist/cli/index.js +12 -12
  31. package/dist/cli/init.d.ts +1 -1
  32. package/dist/cli/init.js +2 -2
  33. package/dist/cli/magicblock.d.ts +1 -1
  34. package/dist/cli/magicblock.js +4 -4
  35. package/dist/cli/mcp-server.d.ts +2 -2
  36. package/dist/cli/mcp-server.js +21 -21
  37. package/dist/cli/pay.d.ts +1 -1
  38. package/dist/cli/pay.js +1 -1
  39. package/dist/cli/report.d.ts +2 -2
  40. package/dist/cli/report.js +4 -4
  41. package/dist/cli/report.js.map +1 -1
  42. package/dist/cli/sana.d.ts +1 -1
  43. package/dist/cli/sana.js +3 -3
  44. package/dist/cli/shop.d.ts +1 -1
  45. package/dist/cli/shop.js +1 -1
  46. package/dist/cli/swap.d.ts +1 -1
  47. package/dist/cli/swap.js +3 -3
  48. package/dist/cli/token.d.ts +2 -2
  49. package/dist/cli/token.js +2 -2
  50. package/dist/cli/trade.d.ts +2 -2
  51. package/dist/cli/trade.js +8 -8
  52. package/dist/cli/trade.js.map +1 -1
  53. package/dist/cli/transfer.d.ts +1 -1
  54. package/dist/cli/transfer.js +1 -1
  55. package/dist/cli/x.d.ts +1 -1
  56. package/dist/cli/x.js +1 -1
  57. package/dist/cli/zauth.d.ts +1 -1
  58. package/dist/cli/zauth.js +5 -5
  59. package/dist/discover/cache.js +1 -1
  60. package/dist/discover/index.d.ts +2 -2
  61. package/dist/discover/index.js +6 -6
  62. package/dist/discover/orbitx402.d.ts +2 -2
  63. package/dist/discover/orbitx402.js +1 -1
  64. package/dist/discover/payai.js +1 -1
  65. package/dist/do/index.d.ts +2 -2
  66. package/dist/do/index.js +1 -1
  67. package/dist/guardrail/index.d.ts +4 -4
  68. package/dist/guardrail/index.js +14 -14
  69. package/dist/guardrail/index.js.map +1 -1
  70. package/dist/index.d.ts +7 -7
  71. package/dist/index.js +2 -2
  72. package/dist/magicblock/client.d.ts +2 -2
  73. package/dist/magicblock/client.js +4 -4
  74. package/dist/profile/index.d.ts +3 -3
  75. package/dist/profile/index.js +3 -3
  76. package/dist/profile/storage.d.ts +1 -1
  77. package/dist/profile/storage.js +4 -4
  78. package/dist/profile/types.d.ts +6 -6
  79. package/dist/profile/types.js +1 -1
  80. package/dist/report/index.d.ts +1 -1
  81. package/dist/report/index.js +2 -2
  82. package/dist/sana/tools.js +8 -8
  83. package/dist/signers/raw-evm.d.ts +1 -1
  84. package/dist/signers/raw-evm.js +5 -5
  85. package/dist/signers/raw-solana.d.ts +1 -1
  86. package/dist/signers/raw-solana.js +4 -4
  87. package/dist/swap/index.d.ts +6 -6
  88. package/dist/swap/index.js +12 -12
  89. package/dist/token/index.d.ts +8 -8
  90. package/dist/token/index.js +14 -14
  91. package/dist/token/rwa.d.ts +3 -3
  92. package/dist/token/rwa.js +3 -3
  93. package/dist/tools/index.d.ts +1 -1
  94. package/dist/tools/index.js +31 -31
  95. package/dist/trading/discovery.d.ts +6 -6
  96. package/dist/trading/discovery.js +7 -7
  97. package/dist/trading/index.d.ts +6 -6
  98. package/dist/trading/index.js +13 -13
  99. package/dist/transfer/index.d.ts +4 -4
  100. package/dist/transfer/index.js +8 -8
  101. package/dist/types.d.ts +7 -7
  102. package/dist/use/index.d.ts +5 -5
  103. package/dist/use/index.js +20 -20
  104. package/dist/wallet/index.d.ts +2 -2
  105. package/dist/wallet/index.js +3 -3
  106. package/dist/x402/evm-payment.d.ts +4 -4
  107. package/dist/x402/evm-payment.js +6 -6
  108. package/dist/x402/extract.d.ts +1 -1
  109. package/dist/x402/extract.js +1 -1
  110. package/dist/x402/svm-payment.d.ts +2 -2
  111. package/dist/x402/svm-payment.js +2 -2
  112. package/dist/zauth/index.d.ts +4 -4
  113. package/dist/zauth/index.js +5 -5
  114. package/package.json +4 -3
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Direct SPL / ERC-20 transfer no x402, no provider, just send funds.
2
+ * Direct SPL / ERC-20 transfer - no x402, no provider, just send funds.
3
3
  *
4
4
  * Goes through the same guardrail as `use()` so a compromised CLI / agent
5
5
  * can't drain the wallet past the configured caps.
6
6
  *
7
7
  * Solana: any SPL token by symbol (USDC, BONK, JUP, …) or raw mint address.
8
- * EVM: the network's stablecoin only USDC, or USDT0 on Stable (other
8
+ * EVM: the network's stablecoin only - USDC, or USDT0 on Stable (other
9
9
  * ERC-20 addresses can be added to EVM_STABLECOIN as needed).
10
10
  */
11
11
  import type { Network } from "../types.js";
@@ -17,7 +17,7 @@ export interface SplTokenInfo {
17
17
  decimals: number;
18
18
  symbol: string;
19
19
  }
20
- /** Well-known Solana SPL tokens symbol (uppercase) → info. */
20
+ /** Well-known Solana SPL tokens - symbol (uppercase) → info. */
21
21
  export declare const SOLANA_TOKENS: Record<string, SplTokenInfo>;
22
22
  /** Symbols users can name in CLI / MCP. */
23
23
  export declare const KNOWN_SOLANA_SYMBOLS: string[];
@@ -31,7 +31,7 @@ export interface TransferArgs {
31
31
  /**
32
32
  * Token to transfer.
33
33
  * - Solana: symbol ("USDC", "BONK", "JUP", …) or raw mint address.
34
- * - EVM: only the network's stablecoin "USDC", or "USDT0" on Stable.
34
+ * - EVM: only the network's stablecoin - "USDC", or "USDT0" on Stable.
35
35
  * Defaults to the network's stablecoin.
36
36
  */
37
37
  token?: string;
@@ -1,17 +1,17 @@
1
1
  /**
2
- * Direct SPL / ERC-20 transfer no x402, no provider, just send funds.
2
+ * Direct SPL / ERC-20 transfer - no x402, no provider, just send funds.
3
3
  *
4
4
  * Goes through the same guardrail as `use()` so a compromised CLI / agent
5
5
  * can't drain the wallet past the configured caps.
6
6
  *
7
7
  * Solana: any SPL token by symbol (USDC, BONK, JUP, …) or raw mint address.
8
- * EVM: the network's stablecoin only USDC, or USDT0 on Stable (other
8
+ * EVM: the network's stablecoin only - USDC, or USDT0 on Stable (other
9
9
  * ERC-20 addresses can be added to EVM_STABLECOIN as needed).
10
10
  */
11
11
  import { Connection, PublicKey, SystemProgram, Transaction, LAMPORTS_PER_SOL, } from "@solana/web3.js";
12
12
  import { getMint } from "@solana/spl-token";
13
13
  import { magicBlockPrivateTransfer } from "../magicblock/client.js";
14
- /** Well-known Solana SPL tokens symbol (uppercase) → info. */
14
+ /** Well-known Solana SPL tokens - symbol (uppercase) → info. */
15
15
  export const SOLANA_TOKENS = {
16
16
  USDC: { mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", decimals: 6, symbol: "USDC" },
17
17
  USDT: { mint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", decimals: 6, symbol: "USDT" },
@@ -58,7 +58,7 @@ export async function transfer(args) {
58
58
  throw new Error(`transfer: no stablecoin registered for EVM network "${network}"`);
59
59
  }
60
60
  // Accept the network's own symbol, plus the generic "USDC"/"USDT" the
61
- // caller may default to on Stable they all mean USDT0.
61
+ // caller may default to - on Stable they all mean USDT0.
62
62
  const tokenSymbol = (args.token ?? stablecoin.symbol).toUpperCase();
63
63
  const aliases = network === "stable" ? ["USDT0", "USDT", "USDC"] : ["USDC"];
64
64
  if (!aliases.includes(tokenSymbol)) {
@@ -83,7 +83,7 @@ export async function transfer(args) {
83
83
  if (tokenKey === "SOL") {
84
84
  if (args.private) {
85
85
  throw new Error(`transfer: native SOL is not supported by MagicBlock PER (SPL tokens only). ` +
86
- `Use "wSOL" instead it goes through the PER and settles as wrapped SOL on the other end.`);
86
+ `Use "wSOL" instead - it goes through the PER and settles as wrapped SOL on the other end.`);
87
87
  }
88
88
  return transferNativeSol(args);
89
89
  }
@@ -134,7 +134,7 @@ async function transferNativeSol(args) {
134
134
  const rpc = process.env.XPAY_SOLANA_RPC ?? "https://solana-mainnet.g.alchemy.com/v2/Ug5mqBVIbSHoa8ZHgTUSJ";
135
135
  const connection = new Connection(rpc, "confirmed");
136
136
  // Reconstruct keypair from the signer's signMessage so we can sign the tx.
137
- // rawSolanaSigner keeps the keypair internally we access it by signing a
137
+ // rawSolanaSigner keeps the keypair internally - we access it by signing a
138
138
  // known message and rebuilding. Instead, we use a lower-level approach:
139
139
  // delegate to signer.pay() with a synthetic SOL "requirement" if it supports
140
140
  // it, otherwise build the SystemProgram.transfer tx ourselves.
@@ -173,7 +173,7 @@ async function resolveSolanaToken(token) {
173
173
  // Reverse lookup by mint address.
174
174
  if (BY_MINT[token])
175
175
  return BY_MINT[token];
176
- // Looks like a base58 mint address fetch from chain.
176
+ // Looks like a base58 mint address - fetch from chain.
177
177
  if (/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(token)) {
178
178
  const rpc = process.env.XPAY_SOLANA_RPC ?? "https://solana-mainnet.g.alchemy.com/v2/Ug5mqBVIbSHoa8ZHgTUSJ";
179
179
  try {
@@ -203,7 +203,7 @@ function resolveNetwork(args) {
203
203
  // Auto-detect only across networks the profile actually opted into.
204
204
  // Robinhood and Stable signers are always registered (see
205
205
  // signersFromProfile), so keying off `wallet.has()` alone would make every
206
- // EVM transfer ambiguous reach those two with an explicit --network
206
+ // EVM transfer ambiguous - reach those two with an explicit --network
207
207
  // unless they're in the profile's `networks`.
208
208
  const evm = args.wallet.networks.filter((n) => EVM_NETWORKS.includes(n) && args.wallet.has(n));
209
209
  if (evm.length === 0)
package/dist/types.d.ts CHANGED
@@ -8,9 +8,9 @@
8
8
  import { z } from "zod";
9
9
  /** A network slug. Keep this open-ended so new chains can be added without an SDK release. */
10
10
  export type Network = "solana" | "base" | "ethereum" | "arbitrum" | "optimism"
11
- /** Robinhood Chain (Arbitrum Orbit L2, eip155:4663) ETH-native. */
11
+ /** Robinhood Chain (Arbitrum Orbit L2, eip155:4663) - ETH-native. */
12
12
  | "robinhood"
13
- /** Stable (eip155:988) Tether/Bitfinex payments L1, settles USDT0. */
13
+ /** Stable (eip155:988) - Tether/Bitfinex payments L1, settles USDT0. */
14
14
  | "stable" | (string & {});
15
15
  /**
16
16
  * One payment option attached to a {@link Resource}.
@@ -189,7 +189,7 @@ export interface PlatformFeeResult {
189
189
  txSig?: string;
190
190
  /** Whether the fee was successfully charged. */
191
191
  success: boolean;
192
- /** Error message if the fee charge failed (non-fatal the use result is still returned). */
192
+ /** Error message if the fee charge failed (non-fatal - the use result is still returned). */
193
193
  error?: string;
194
194
  }
195
195
  /** Result returned by {@link XPay.use}. */
@@ -218,7 +218,7 @@ export interface UseResult {
218
218
  }
219
219
  /** Options passed to {@link XPay.discover}. */
220
220
  export interface DiscoverOptions {
221
- /** Free-text query matched against resource URL, metadata, and category. */
221
+ /** Free-text query - matched against resource URL, metadata, and category. */
222
222
  query?: string;
223
223
  /** Restrict to specific networks. Defaults to all configured. */
224
224
  networks?: Network[];
@@ -246,7 +246,7 @@ export interface Signer {
246
246
  address: string;
247
247
  /**
248
248
  * Sign an arbitrary message (used for x402 payment authorization payloads).
249
- * The exact bytes signed depend on the network see implementations.
249
+ * The exact bytes signed depend on the network - see implementations.
250
250
  */
251
251
  signMessage(message: Uint8Array): Promise<Uint8Array>;
252
252
  /**
@@ -280,7 +280,7 @@ export interface Signer {
280
280
  * Optional (EVM signers): sign an EIP-712 typed-data payload and return the
281
281
  * hex signature. When present, `use()` pays eip155 endpoints gaslessly via
282
282
  * a signed EIP-3009 `transferWithAuthorization` (the facilitator broadcasts
283
- * and covers gas no native ETH needed); when absent, it falls back to the
283
+ * and covers gas - no native ETH needed); when absent, it falls back to the
284
284
  * legacy `pay()` (broadcasts an ERC-20 transfer, wallet pays its own gas).
285
285
  */
286
286
  signEvmTypedData?(typedData: {
@@ -295,7 +295,7 @@ export interface Signer {
295
295
  * Optional (EVM signers): return the underlying ethers `Wallet` (connected to
296
296
  * a provider) so higher-level flows like on-chain DEX trades can read chain
297
297
  * state and broadcast arbitrary contract calls (swaps, approvals). Typed
298
- * `unknown` to keep ethers out of the core type surface callers cast it.
298
+ * `unknown` to keep ethers out of the core type surface - callers cast it.
299
299
  * Mirrors {@link Signer.getKitSigner}. Implemented by `rawEvmSigner`.
300
300
  */
301
301
  getEvmWallet?(): unknown;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Use call a paid resource, handling x402 payment end-to-end.
2
+ * Use - call a paid resource, handling x402 payment end-to-end.
3
3
  *
4
4
  * Two modes:
5
5
  * - **Catalog mode** (`resource` has `accepts[]`): we pick a requirement up
@@ -21,13 +21,13 @@ export interface UseArgs {
21
21
  guardrail: Guardrail;
22
22
  body?: unknown;
23
23
  headers?: Record<string, string>;
24
- /** AgenC hire settings (RPC, review window) used only for AgenC resources. */
24
+ /** AgenC hire settings (RPC, review window) - used only for AgenC resources. */
25
25
  agenc?: AgencHireConfig;
26
26
  }
27
27
  export declare function use(args: UseArgs): Promise<UseResult>;
28
28
  /**
29
29
  * Convenience: call any URL with x402 support. Agents can use this when they
30
- * have a URL but no catalog entry e.g. crawled from the web.
30
+ * have a URL but no catalog entry - e.g. crawled from the web.
31
31
  */
32
32
  export interface UseByUrlArgs {
33
33
  url: string;
@@ -40,8 +40,8 @@ export interface UseByUrlArgs {
40
40
  export declare function useByUrl(args: UseByUrlArgs): Promise<UseResult>;
41
41
  /**
42
42
  * Charge the xPay platform fee ($0.01 USDC) via the x402 endpoint.
43
- * Fires after every successful `use` call (including AgenC hires exported
44
- * for the agenc module). Non-fatal a failure is reported in
43
+ * Fires after every successful `use` call (including AgenC hires - exported
44
+ * for the agenc module). Non-fatal - a failure is reported in
45
45
  * `platformFee.error` rather than throwing.
46
46
  */
47
47
  export declare function chargePlatformFee(wallet: Wallet): Promise<PlatformFeeResult>;
package/dist/use/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Use call a paid resource, handling x402 payment end-to-end.
2
+ * Use - call a paid resource, handling x402 payment end-to-end.
3
3
  *
4
4
  * Two modes:
5
5
  * - **Catalog mode** (`resource` has `accepts[]`): we pick a requirement up
@@ -16,21 +16,21 @@ import { buildSvmPaymentHeader, isSvmNetwork } from "../x402/svm-payment.js";
16
16
  import { buildEvmPaymentHeader, hasEvmDomainParams, isEvmNetwork } from "../x402/evm-payment.js";
17
17
  import { isAgencResource } from "../agenc/api.js";
18
18
  export async function use(args) {
19
- // AgenC listings are not HTTP resources payment is an on-chain escrow
19
+ // AgenC listings are not HTTP resources - payment is an on-chain escrow
20
20
  // hire, so branch before any x402 catalog / live-challenge logic.
21
21
  if (isAgencResource(args.resource)) {
22
22
  const { useAgencHire } = await import("../agenc/hire.js");
23
23
  return useAgencHire(args);
24
24
  }
25
25
  // If we have accepts up front, pick the network we can actually pay on
26
- // (balance-aware) and take the fast path unless the chosen option is
26
+ // (balance-aware) and take the fast path - unless the chosen option is
27
27
  // missing fields that only a live 402 challenge carries.
28
28
  if (args.resource.accepts.length > 0) {
29
29
  const req = await args.wallet.pickRequirementByBalance(args.resource.accepts);
30
30
  if (req) {
31
31
  if (!reqNeedsLiveChallenge(args, req))
32
32
  return useWithRequirements(args, req);
33
- // Chosen option needs a live 402 (SVM v2 missing feePayer) fall through.
33
+ // Chosen option needs a live 402 (SVM v2 missing feePayer) - fall through.
34
34
  }
35
35
  else if (args.wallet.pickRequirement(args.resource.accepts)) {
36
36
  // We can sign for an option but no payable network has the funds.
@@ -41,7 +41,7 @@ export async function use(args) {
41
41
  return useWithLiveChallenge(args);
42
42
  }
43
43
  /**
44
- * Catalog entries are snapshots they carry payTo/asset/amount but not the
44
+ * Catalog entries are snapshots - they carry payTo/asset/amount but not the
45
45
  * per-facilitator settlement fields that only a fresh 402 challenge provides.
46
46
  * SVM v2 settlement needs `extra.feePayer` (the facilitator's fee-payer
47
47
  * pubkey); gasless EVM settlement needs the asset's EIP-712 domain params
@@ -75,7 +75,7 @@ export async function useByUrl(args) {
75
75
  });
76
76
  }
77
77
  async function useWithRequirements(args, req) {
78
- // Guardrail runs *before* signing this is the security boundary.
78
+ // Guardrail runs *before* signing - this is the security boundary.
79
79
  await args.guardrail.check({ resource: args.resource, requirement: req });
80
80
  const settled = await settle(args, req, args.resource.x402Version ?? 1);
81
81
  const res = await callResource(args, settled.header);
@@ -87,11 +87,11 @@ async function useWithLiveChallenge(args) {
87
87
  // Step 1: probe without payment.
88
88
  const probe = await callResource(args, undefined);
89
89
  if (probe.res.status !== 402) {
90
- // No payment required return the probe response as-is. (Useful when a
90
+ // No payment required - return the probe response as-is. (Useful when a
91
91
  // resource later becomes free or for sanity checks.)
92
92
  return finalize(probe, "unknown", "0");
93
93
  }
94
- // Step 2: parse the 402 challenge may live in the body OR a response header.
94
+ // Step 2: parse the 402 challenge - may live in the body OR a response header.
95
95
  const { accepts: reqs } = extractRequirements(probe.res.headers, probe.data);
96
96
  if (reqs.length === 0) {
97
97
  throw new Error(`xpay.use: ${args.resource.resource} returned 402 but no parseable accepts[] in body or headers`);
@@ -117,13 +117,13 @@ async function useWithLiveChallenge(args) {
117
117
  * value plus accounting fields. Picks the right encoding by network:
118
118
  *
119
119
  * SVM (solana / solana:*) + signer has getKitSigner →
120
- * canonical x402 v2 sign-but-don't-broadcast, header carries the
120
+ * canonical x402 v2 - sign-but-don't-broadcast, header carries the
121
121
  * signed tx, facilitator settles. Returns header only (no txSig until
122
122
  * the upstream call comes back).
123
123
  *
124
124
  * EVM (eip155:* / base / ethereum / …) + signer has signEvmTypedData +
125
125
  * requirement carries EIP-712 domain params →
126
- * canonical x402 v2 gasless EIP-3009 transferWithAuthorization
126
+ * canonical x402 v2 - gasless EIP-3009 transferWithAuthorization
127
127
  * signature in the header, facilitator broadcasts and pays gas.
128
128
  *
129
129
  * Anything else (legacy v1) →
@@ -142,7 +142,7 @@ async function settle(args, req, x402Version) {
142
142
  });
143
143
  return { header, network };
144
144
  }
145
- // Gasless EVM v2 sign an EIP-3009 transferWithAuthorization, facilitator
145
+ // Gasless EVM v2 - sign an EIP-3009 transferWithAuthorization, facilitator
146
146
  // broadcasts and pays gas. Needs the EIP-712 domain params from the 402
147
147
  // challenge; catalog snapshots without them were already routed through the
148
148
  // live flow by reqNeedsLiveChallenge().
@@ -157,7 +157,7 @@ async function settle(args, req, x402Version) {
157
157
  });
158
158
  return { header, network };
159
159
  }
160
- // Legacy path sign + broadcast on our side, send txSig in the header.
160
+ // Legacy path - sign + broadcast on our side, send txSig in the header.
161
161
  const txSig = await signer.pay(req);
162
162
  return { header: paymentHeader(req, txSig, x402Version), network, txSig };
163
163
  }
@@ -168,7 +168,7 @@ async function callResource(args, paymentHeader) {
168
168
  };
169
169
  if (paymentHeader) {
170
170
  // Most x402 servers read `X-PAYMENT`; some (e.g. Nansen) read
171
- // `Payment-Signature`. The payload is identical, so send both servers
171
+ // `Payment-Signature`. The payload is identical, so send both - servers
172
172
  // ignore the header name they don't recognise.
173
173
  headers["x-payment"] = paymentHeader;
174
174
  headers["payment-signature"] = paymentHeader;
@@ -195,7 +195,7 @@ async function callResource(args, paymentHeader) {
195
195
  }
196
196
  function finalize(raw, network, amountPaid, txSig) {
197
197
  if (!raw.res.ok) {
198
- throw new Error(`xpay.use: ${raw.res.status} ${raw.res.statusText} ${typeof raw.data === "string" ? raw.data : JSON.stringify(raw.data)}`);
198
+ throw new Error(`xpay.use: ${raw.res.status} ${raw.res.statusText} - ${typeof raw.data === "string" ? raw.data : JSON.stringify(raw.data)}`);
199
199
  }
200
200
  // For SVM v2 calls the facilitator broadcasts and echoes settlement details
201
201
  // in the `PAYMENT-RESPONSE` header. If present, prefer its signature over
@@ -233,8 +233,8 @@ const PLATFORM_FEE_URL = "https://api.xona-agent.com/platform-fee";
233
233
  const PLATFORM_FEE_AMOUNT = 0.01;
234
234
  /**
235
235
  * Charge the xPay platform fee ($0.01 USDC) via the x402 endpoint.
236
- * Fires after every successful `use` call (including AgenC hires exported
237
- * for the agenc module). Non-fatal a failure is reported in
236
+ * Fires after every successful `use` call (including AgenC hires - exported
237
+ * for the agenc module). Non-fatal - a failure is reported in
238
238
  * `platformFee.error` rather than throwing.
239
239
  */
240
240
  export async function chargePlatformFee(wallet) {
@@ -262,7 +262,7 @@ export async function chargePlatformFee(wallet) {
262
262
  if (!req) {
263
263
  return { amount: PLATFORM_FEE_AMOUNT, success: false, error: `platform-fee: wallet has no signer for ${reqs.map(r => r.network).join(", ")}` };
264
264
  }
265
- // Pay and retry use a minimal UseArgs stub (no guardrail needed for our own fee).
265
+ // Pay and retry - use a minimal UseArgs stub (no guardrail needed for our own fee).
266
266
  const network = normalizeNetwork(req.network);
267
267
  const signer = wallet.signer(network);
268
268
  let header;
@@ -302,13 +302,13 @@ export async function chargePlatformFee(wallet) {
302
302
  /**
303
303
  * Build a clear "you can't afford this" error listing the USDC balance on each
304
304
  * network the wallet could have paid on. Raised only when every payable option
305
- * is underfunded better than attempting a doomed payment and surfacing a raw
305
+ * is underfunded - better than attempting a doomed payment and surfacing a raw
306
306
  * 402 from the upstream provider.
307
307
  */
308
308
  async function insufficientBalanceError(reqs, wallet) {
309
309
  const nets = [...new Set(reqs.map((r) => normalizeNetwork(r.network)).filter((n) => wallet.has(n)))];
310
310
  const parts = await Promise.all(nets.map(async (n) => `${n} $${(await wallet.balance(n).catch(() => 0)).toFixed(2)}`));
311
- return new Error(`xpay.use: insufficient USDC balance to pay on any funded network ${parts.join(", ")}. ` +
311
+ return new Error(`xpay.use: insufficient USDC balance to pay on any funded network - ${parts.join(", ")}. ` +
312
312
  `Fund one of these and retry.`);
313
313
  }
314
314
  function normalizeNetwork(raw) {
@@ -324,7 +324,7 @@ function normalizeNetwork(raw) {
324
324
  return "robinhood";
325
325
  if (raw === "eip155:988")
326
326
  return "stable";
327
- // Solana CAIP any `solana:<genesis>` form collapses to our "solana" slug.
327
+ // Solana CAIP - any `solana:<genesis>` form collapses to our "solana" slug.
328
328
  if (raw === "solana" || raw.startsWith("solana:") || raw.startsWith("solana-"))
329
329
  return "solana";
330
330
  return raw;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Multi-network wallet. Thin facade over per-network {@link Signer}s.
3
3
  *
4
- * The wallet doesn't hold keys signers do. This module just exposes a
4
+ * The wallet doesn't hold keys - signers do. This module just exposes a
5
5
  * unified view (addresses, balances) and lets callers pick which network to
6
6
  * use for a given payment.
7
7
  */
@@ -28,7 +28,7 @@ export interface Wallet {
28
28
  pickRequirement(reqs: PaymentRequirement[]): PaymentRequirement | undefined;
29
29
  /**
30
30
  * Balance-aware picker. Among requirements we have a signer for, prefer the
31
- * first (in listed order) whose wallet balance covers the cost so a $0
31
+ * first (in listed order) whose wallet balance covers the cost - so a $0
32
32
  * Base wallet falls through to a funded Solana one. When there are multiple
33
33
  * payable networks but none can cover the cost, returns `undefined` so the
34
34
  * caller can raise a clear "insufficient balance" error instead of attempting
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Multi-network wallet. Thin facade over per-network {@link Signer}s.
3
3
  *
4
- * The wallet doesn't hold keys signers do. This module just exposes a
4
+ * The wallet doesn't hold keys - signers do. This module just exposes a
5
5
  * unified view (addresses, balances) and lets callers pick which network to
6
6
  * use for a given payment.
7
7
  */
@@ -18,7 +18,7 @@ export function createWallet(opts) {
18
18
  function matchNetwork(raw) {
19
19
  if (signers[raw])
20
20
  return raw;
21
- // Solana CAIP `solana:<genesis-hash>` (mainnet/devnet/testnet) → "solana".
21
+ // Solana CAIP - `solana:<genesis-hash>` (mainnet/devnet/testnet) → "solana".
22
22
  if ((raw === "solana" || raw.startsWith("solana:") || raw.startsWith("solana-")) && signers["solana"]) {
23
23
  return "solana";
24
24
  }
@@ -71,7 +71,7 @@ export function createWallet(opts) {
71
71
  return candidates[0];
72
72
  // Multiple payable networks: read each balance in parallel and pick the
73
73
  // first (listed order) that covers the cost. Compare assumes USDC
74
- // (6 decimals) the asset for virtually all x402 calls.
74
+ // (6 decimals) - the asset for virtually all x402 calls.
75
75
  const scored = await Promise.all(candidates.map(async (req) => {
76
76
  const net = matchNetwork(req.network);
77
77
  const bal = await balanceOf(net);
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Spec flow (`exact` scheme on eip155 networks):
5
5
  * client signs an EIP-3009 `TransferWithAuthorization` typed-data payload
6
- * (an off-chain signature USDC supports it natively) → header carries
6
+ * (an off-chain signature - USDC supports it natively) → header carries
7
7
  * the authorization + signature → facilitator submits the transfer
8
8
  * on-chain and pays the gas.
9
9
  *
@@ -19,7 +19,7 @@ import type { PaymentRequirement } from "../types.js";
19
19
  export interface BuildEvmPaymentArgs {
20
20
  /** Payer address (the EVM signer's wallet address). */
21
21
  address: string;
22
- /** EIP-712 typed-data signer from `signer.signEvmTypedData`. */
22
+ /** EIP-712 typed-data signer - from `signer.signEvmTypedData`. */
23
23
  signTypedData: (typedData: {
24
24
  domain: Record<string, unknown>;
25
25
  types: Record<string, Array<{
@@ -39,12 +39,12 @@ export declare function isEvmNetwork(network: string): boolean;
39
39
  /**
40
40
  * True when this requirement carries the EIP-712 domain params (`extra.name`
41
41
  * + `extra.version`) the gasless signature needs. Catalog snapshots usually
42
- * strip `extra` a fresh 402 challenge always has it.
42
+ * strip `extra` - a fresh 402 challenge always has it.
43
43
  */
44
44
  export declare function hasEvmDomainParams(req: PaymentRequirement): boolean;
45
45
  /**
46
46
  * Returns the value of the `X-Payment` header (base64 of canonical JSON
47
- * envelope), ready to attach to the retry request. Nothing is broadcast
47
+ * envelope), ready to attach to the retry request. Nothing is broadcast -
48
48
  * the facilitator settles server-side.
49
49
  */
50
50
  export declare function buildEvmPaymentHeader(args: BuildEvmPaymentArgs): Promise<string>;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Spec flow (`exact` scheme on eip155 networks):
5
5
  * client signs an EIP-3009 `TransferWithAuthorization` typed-data payload
6
- * (an off-chain signature USDC supports it natively) → header carries
6
+ * (an off-chain signature - USDC supports it natively) → header carries
7
7
  * the authorization + signature → facilitator submits the transfer
8
8
  * on-chain and pays the gas.
9
9
  *
@@ -54,29 +54,29 @@ export function isEvmNetwork(network) {
54
54
  /**
55
55
  * True when this requirement carries the EIP-712 domain params (`extra.name`
56
56
  * + `extra.version`) the gasless signature needs. Catalog snapshots usually
57
- * strip `extra` a fresh 402 challenge always has it.
57
+ * strip `extra` - a fresh 402 challenge always has it.
58
58
  */
59
59
  export function hasEvmDomainParams(req) {
60
60
  return Boolean(req.extra?.name && req.extra?.version);
61
61
  }
62
62
  /**
63
63
  * Returns the value of the `X-Payment` header (base64 of canonical JSON
64
- * envelope), ready to attach to the retry request. Nothing is broadcast
64
+ * envelope), ready to attach to the retry request. Nothing is broadcast -
65
65
  * the facilitator settles server-side.
66
66
  */
67
67
  export async function buildEvmPaymentHeader(args) {
68
68
  const req = args.requirement;
69
- // The EIP-3009 payload shape only exists in x402 v2 never emit a v1
69
+ // The EIP-3009 payload shape only exists in x402 v2 - never emit a v1
70
70
  // envelope here (v1 catalog entries without a version reach us as 1).
71
71
  const version = Math.max(args.x402Version ?? 2, 2);
72
72
  if (!hasEvmDomainParams(req)) {
73
- throw new Error(`buildEvmPaymentHeader: EIP-712 domain params (extra.name/extra.version) missing for asset ${req.asset} re-fetch the live 402 challenge`);
73
+ throw new Error(`buildEvmPaymentHeader: EIP-712 domain params (extra.name/extra.version) missing for asset ${req.asset} - re-fetch the live 402 challenge`);
74
74
  }
75
75
  const now = Math.floor(Date.now() / 1000);
76
76
  const nonceBytes = globalThis.crypto.getRandomValues(new Uint8Array(32));
77
77
  const nonce = "0x" + Buffer.from(nonceBytes).toString("hex");
78
78
  // Authorization values travel as decimal strings in the header payload but
79
- // are signed as uint256 same split @x402/evm's client makes.
79
+ // are signed as uint256 - same split @x402/evm's client makes.
80
80
  const authorization = {
81
81
  from: args.address,
82
82
  to: req.payTo,
@@ -9,7 +9,7 @@
9
9
  * envelope, or a SINGLE bare requirement object
10
10
  * encoding: raw JSON, base64-JSON, url-encoded JSON, or "<scheme> <payload>"
11
11
  * fields: PayAI uses `amount`/`payTo`; the x402 spec uses
12
- * `maxAmountRequired`/`payTo`; others use `recipient`/`token`
12
+ * `maxAmountRequired`/`payTo`; others use `recipient`/`token` -
13
13
  * we alias them all into our PaymentRequirement.
14
14
  *
15
15
  * Shared by `probe()` and `useByUrl()`.
@@ -9,7 +9,7 @@
9
9
  * envelope, or a SINGLE bare requirement object
10
10
  * encoding: raw JSON, base64-JSON, url-encoded JSON, or "<scheme> <payload>"
11
11
  * fields: PayAI uses `amount`/`payTo`; the x402 spec uses
12
- * `maxAmountRequired`/`payTo`; others use `recipient`/`token`
12
+ * `maxAmountRequired`/`payTo`; others use `recipient`/`token` -
13
13
  * we alias them all into our PaymentRequirement.
14
14
  *
15
15
  * Shared by `probe()` and `useByUrl()`.
@@ -8,14 +8,14 @@
8
8
  * This is the path xPay 0.1.4+ takes for Solana endpoints reporting
9
9
  * `x402Version >= 2` (CAIP networks like `solana:5eykt4…`). Legacy 0.1.x
10
10
  * sent a sign-and-broadcast `txSig` header which is *not* what the
11
- * canonical x402 servers expect your endpoint would 4xx on the retry.
11
+ * canonical x402 servers expect - your endpoint would 4xx on the retry.
12
12
  *
13
13
  * Inputs (the `PaymentRequirement` xPay parsed from the 402 challenge) are
14
14
  * normalized into `@x402/core/types`'s `PaymentRequirements` shape.
15
15
  */
16
16
  import type { PaymentRequirement } from "../types.js";
17
17
  export interface BuildSvmPaymentArgs {
18
- /** A `@solana/kit` TransactionSigner from `signer.getKitSigner()`. */
18
+ /** A `@solana/kit` TransactionSigner - from `signer.getKitSigner()`. */
19
19
  kitSigner: unknown;
20
20
  /** What the server's 402 told us we owe. */
21
21
  requirement: PaymentRequirement;
@@ -8,7 +8,7 @@
8
8
  * This is the path xPay 0.1.4+ takes for Solana endpoints reporting
9
9
  * `x402Version >= 2` (CAIP networks like `solana:5eykt4…`). Legacy 0.1.x
10
10
  * sent a sign-and-broadcast `txSig` header which is *not* what the
11
- * canonical x402 servers expect your endpoint would 4xx on the retry.
11
+ * canonical x402 servers expect - your endpoint would 4xx on the retry.
12
12
  *
13
13
  * Inputs (the `PaymentRequirement` xPay parsed from the 402 challenge) are
14
14
  * normalized into `@x402/core/types`'s `PaymentRequirements` shape.
@@ -43,7 +43,7 @@ export async function buildSvmPaymentHeader(args) {
43
43
  // partial = { x402Version, payload: { transaction: <base64 signed tx> } }
44
44
  // Assemble the FULL canonical PaymentPayloadV2 envelope:
45
45
  // { x402Version, accepted: <the requirement we're paying>, payload }
46
- // The `accepted` field is REQUIRED in v2 it tells the facilitator which
46
+ // The `accepted` field is REQUIRED in v2 - it tells the facilitator which
47
47
  // of its advertised `accepts[]` items we picked. (Loose top-level
48
48
  // scheme/network is v1; v2 nests them inside `accepted`.)
49
49
  const envelope = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * zauth partner integration repository security scans behind zauth's
2
+ * zauth partner integration - repository security scans behind zauth's
3
3
  * x402-paywalled endpoint. The scan POST is paid (normal x402 flow); results
4
4
  * are polled from an unpaid status URL keyed by sessionToken. A repo that
5
5
  * zauth has scanned recently may return its cached report on the POST
@@ -13,7 +13,7 @@ export interface ScanPending {
13
13
  }
14
14
  /**
15
15
  * Kickoff response from the paid POST: `{ status, scanId, sessionToken }`.
16
- * Only this response carries the sessionToken (a ~1h JWT) poll responses
16
+ * Only this response carries the sessionToken (a ~1h JWT) - poll responses
17
17
  * echo just `{ status, scanId, progress }`, so callers must hold on to the
18
18
  * token themselves.
19
19
  */
@@ -23,7 +23,7 @@ export declare function isScanning(data: unknown): boolean;
23
23
  /** One unpaid GET against the scan-status endpoint. */
24
24
  export declare function fetchScanStatus(sessionToken: string): Promise<unknown>;
25
25
  /**
26
- * Completed reports embed every provenance match with full file contents
26
+ * Completed reports embed every provenance match with full file contents -
27
27
  * tens of KB the caller rarely needs (analysisMarkdown already summarizes
28
28
  * them). Swap the array for a count; use the raw payload when full detail
29
29
  * matters (CLI --json).
@@ -38,7 +38,7 @@ export interface PollOptions {
38
38
  /**
39
39
  * Poll the unpaid status endpoint until the scan leaves "scanning" or the
40
40
  * timeout elapses. On timeout the last payload (still pending) is returned
41
- * rather than throwing callers surface the sessionToken for a later check.
41
+ * rather than throwing - callers surface the sessionToken for a later check.
42
42
  */
43
43
  export declare function pollRepoScan(sessionToken: string, opts?: PollOptions): Promise<unknown>;
44
44
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * zauth partner integration repository security scans behind zauth's
2
+ * zauth partner integration - repository security scans behind zauth's
3
3
  * x402-paywalled endpoint. The scan POST is paid (normal x402 flow); results
4
4
  * are polled from an unpaid status URL keyed by sessionToken. A repo that
5
5
  * zauth has scanned recently may return its cached report on the POST
@@ -8,7 +8,7 @@
8
8
  export const ZAUTH_BASE = process.env.XPAY_ZAUTH_ENDPOINT ?? "https://api.zauth.inc";
9
9
  /**
10
10
  * Kickoff response from the paid POST: `{ status, scanId, sessionToken }`.
11
- * Only this response carries the sessionToken (a ~1h JWT) poll responses
11
+ * Only this response carries the sessionToken (a ~1h JWT) - poll responses
12
12
  * echo just `{ status, scanId, progress }`, so callers must hold on to the
13
13
  * token themselves.
14
14
  */
@@ -26,7 +26,7 @@ export async function fetchScanStatus(sessionToken) {
26
26
  // The kickoff response carries both a short scanId and a JWT sessionToken;
27
27
  // only the JWT works here. Catch the mixup before it becomes an opaque 401.
28
28
  if (!sessionToken.includes(".")) {
29
- throw new Error(`zauth: "${sessionToken}" looks like a scanId pass the sessionToken (the long JWT from the scan kickoff) instead`);
29
+ throw new Error(`zauth: "${sessionToken}" looks like a scanId - pass the sessionToken (the long JWT from the scan kickoff) instead`);
30
30
  }
31
31
  const res = await fetch(`${ZAUTH_BASE}/x402/reposcan/${encodeURIComponent(sessionToken)}`);
32
32
  const text = await res.text();
@@ -46,7 +46,7 @@ export async function fetchScanStatus(sessionToken) {
46
46
  return data;
47
47
  }
48
48
  /**
49
- * Completed reports embed every provenance match with full file contents
49
+ * Completed reports embed every provenance match with full file contents -
50
50
  * tens of KB the caller rarely needs (analysisMarkdown already summarizes
51
51
  * them). Swap the array for a count; use the raw payload when full detail
52
52
  * matters (CLI --json).
@@ -62,7 +62,7 @@ export function compactScanReport(data) {
62
62
  /**
63
63
  * Poll the unpaid status endpoint until the scan leaves "scanning" or the
64
64
  * timeout elapses. On timeout the last payload (still pending) is returned
65
- * rather than throwing callers surface the sessionToken for a later check.
65
+ * rather than throwing - callers surface the sessionToken for a later check.
66
66
  */
67
67
  export async function pollRepoScan(sessionToken, opts = {}) {
68
68
  const timeoutMs = opts.timeoutMs ?? 90_000;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@xona-labs/xpay",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "mcpName": "io.github.xona-labs/xpay",
5
- "description": "Discovery and usage layer for agentic commerce — multi-network wallet, x402 payments, AgenC marketplace hires, 20k+ services via PayAI and other catalogs",
5
+ "description": "Xona Wallet: agent wallet and payment rail for agentic commerce. Multi-network wallet, x402 payments, AgenC marketplace hires, 20k+ services via PayAI and other catalogs",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -27,8 +27,9 @@
27
27
  "type": "git",
28
28
  "url": "https://github.com/xona-labs/xpay"
29
29
  },
30
- "homepage": "https://xpay.xona-agent.com",
30
+ "homepage": "https://wallet.xona-agent.com",
31
31
  "keywords": [
32
+ "xona-wallet",
32
33
  "x402",
33
34
  "agentic-commerce",
34
35
  "agenc",