@xona-labs/xpay 0.2.23 → 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 (134) hide show
  1. package/CHANGELOG.md +133 -76
  2. package/README.md +95 -71
  3. package/SKILL.md +29 -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.d.ts.map +1 -1
  18. package/dist/cli/balance.js +11 -10
  19. package/dist/cli/balance.js.map +1 -1
  20. package/dist/cli/bento.d.ts +3 -3
  21. package/dist/cli/bento.js +8 -8
  22. package/dist/cli/bento.js.map +1 -1
  23. package/dist/cli/biometric.d.ts +1 -1
  24. package/dist/cli/biometric.js +8 -8
  25. package/dist/cli/common.js +6 -6
  26. package/dist/cli/common.js.map +1 -1
  27. package/dist/cli/discover.d.ts +2 -2
  28. package/dist/cli/discover.js +10 -4
  29. package/dist/cli/discover.js.map +1 -1
  30. package/dist/cli/guardrail.d.ts +1 -1
  31. package/dist/cli/guardrail.js +3 -3
  32. package/dist/cli/index.d.ts +2 -2
  33. package/dist/cli/index.js +12 -12
  34. package/dist/cli/init.d.ts +1 -1
  35. package/dist/cli/init.js +2 -2
  36. package/dist/cli/magicblock.d.ts +1 -1
  37. package/dist/cli/magicblock.js +4 -4
  38. package/dist/cli/mcp-server.d.ts +2 -2
  39. package/dist/cli/mcp-server.js +21 -21
  40. package/dist/cli/pay.d.ts +1 -1
  41. package/dist/cli/pay.js +1 -1
  42. package/dist/cli/report.d.ts +2 -2
  43. package/dist/cli/report.js +4 -4
  44. package/dist/cli/report.js.map +1 -1
  45. package/dist/cli/sana.d.ts +1 -1
  46. package/dist/cli/sana.js +3 -3
  47. package/dist/cli/shop.d.ts +1 -1
  48. package/dist/cli/shop.js +1 -1
  49. package/dist/cli/swap.d.ts +1 -1
  50. package/dist/cli/swap.js +3 -3
  51. package/dist/cli/token.d.ts +2 -2
  52. package/dist/cli/token.js +2 -2
  53. package/dist/cli/trade.d.ts +2 -2
  54. package/dist/cli/trade.js +8 -8
  55. package/dist/cli/trade.js.map +1 -1
  56. package/dist/cli/transfer.d.ts +1 -1
  57. package/dist/cli/transfer.js +1 -1
  58. package/dist/cli/x.d.ts +1 -1
  59. package/dist/cli/x.js +1 -1
  60. package/dist/cli/zauth.d.ts +1 -1
  61. package/dist/cli/zauth.js +5 -5
  62. package/dist/discover/cache.js +1 -1
  63. package/dist/discover/index.d.ts +2 -2
  64. package/dist/discover/index.d.ts.map +1 -1
  65. package/dist/discover/index.js +21 -7
  66. package/dist/discover/index.js.map +1 -1
  67. package/dist/discover/orbitx402.d.ts +2 -2
  68. package/dist/discover/orbitx402.js +1 -1
  69. package/dist/discover/payai.js +1 -1
  70. package/dist/do/index.d.ts +2 -2
  71. package/dist/do/index.js +1 -1
  72. package/dist/guardrail/index.d.ts +4 -4
  73. package/dist/guardrail/index.js +14 -14
  74. package/dist/guardrail/index.js.map +1 -1
  75. package/dist/index.d.ts +7 -7
  76. package/dist/index.js +2 -2
  77. package/dist/magicblock/client.d.ts +2 -2
  78. package/dist/magicblock/client.js +4 -4
  79. package/dist/profile/index.d.ts +3 -3
  80. package/dist/profile/index.d.ts.map +1 -1
  81. package/dist/profile/index.js +13 -4
  82. package/dist/profile/index.js.map +1 -1
  83. package/dist/profile/storage.d.ts +1 -1
  84. package/dist/profile/storage.js +4 -4
  85. package/dist/profile/types.d.ts +6 -6
  86. package/dist/profile/types.js +1 -1
  87. package/dist/report/index.d.ts +1 -1
  88. package/dist/report/index.js +2 -2
  89. package/dist/sana/tools.js +8 -8
  90. package/dist/signers/raw-evm.d.ts +1 -1
  91. package/dist/signers/raw-evm.d.ts.map +1 -1
  92. package/dist/signers/raw-evm.js +22 -7
  93. package/dist/signers/raw-evm.js.map +1 -1
  94. package/dist/signers/raw-solana.d.ts +1 -1
  95. package/dist/signers/raw-solana.js +4 -4
  96. package/dist/swap/index.d.ts +6 -6
  97. package/dist/swap/index.js +12 -12
  98. package/dist/token/index.d.ts +8 -8
  99. package/dist/token/index.js +14 -14
  100. package/dist/token/rwa.d.ts +3 -3
  101. package/dist/token/rwa.js +3 -3
  102. package/dist/tools/index.d.ts +1 -1
  103. package/dist/tools/index.d.ts.map +1 -1
  104. package/dist/tools/index.js +46 -41
  105. package/dist/tools/index.js.map +1 -1
  106. package/dist/trading/discovery.d.ts +6 -6
  107. package/dist/trading/discovery.js +7 -7
  108. package/dist/trading/index.d.ts +6 -6
  109. package/dist/trading/index.js +13 -13
  110. package/dist/transfer/index.d.ts +6 -5
  111. package/dist/transfer/index.d.ts.map +1 -1
  112. package/dist/transfer/index.js +41 -21
  113. package/dist/transfer/index.js.map +1 -1
  114. package/dist/types.d.ts +10 -6
  115. package/dist/types.d.ts.map +1 -1
  116. package/dist/types.js.map +1 -1
  117. package/dist/use/index.d.ts +5 -5
  118. package/dist/use/index.js +24 -20
  119. package/dist/use/index.js.map +1 -1
  120. package/dist/wallet/index.d.ts +2 -2
  121. package/dist/wallet/index.d.ts.map +1 -1
  122. package/dist/wallet/index.js +5 -3
  123. package/dist/wallet/index.js.map +1 -1
  124. package/dist/x402/evm-payment.d.ts +4 -4
  125. package/dist/x402/evm-payment.d.ts.map +1 -1
  126. package/dist/x402/evm-payment.js +7 -6
  127. package/dist/x402/evm-payment.js.map +1 -1
  128. package/dist/x402/extract.d.ts +1 -1
  129. package/dist/x402/extract.js +1 -1
  130. package/dist/x402/svm-payment.d.ts +2 -2
  131. package/dist/x402/svm-payment.js +2 -2
  132. package/dist/zauth/index.d.ts +4 -4
  133. package/dist/zauth/index.js +5 -5
  134. package/package.json +6 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Raw EVM signer works for Base, Ethereum, Arbitrum, Optimism, and other
2
+ * Raw EVM signer - works for Base, Ethereum, Arbitrum, Optimism, and other
3
3
  * EIP-155 chains. Holds a hex private key via `ethers.Wallet`.
4
4
  */
5
5
  import { Contract, JsonRpcProvider, Wallet, getBytes, hashMessage } from "ethers";
@@ -9,6 +9,10 @@ const NATIVE_TOKEN = {
9
9
  arbitrum: { symbol: "ETH", name: "Ether" },
10
10
  optimism: { symbol: "ETH", name: "Ether" },
11
11
  robinhood: { symbol: "ETH", name: "Ether" },
12
+ // Stable's gas coin is USDT itself, at 18 decimals - the ERC-20 USDT0 below
13
+ // is a different token with 6 decimals. Distinct symbols keep them apart in
14
+ // the balance view.
15
+ stable: { symbol: "USDT", name: "Tether USD (gas)" },
12
16
  };
13
17
  const KNOWN_ERC20S = {
14
18
  base: [
@@ -36,17 +40,27 @@ const KNOWN_ERC20S = {
36
40
  { symbol: "OP", name: "Optimism", contract: "0x4200000000000000000000000000000000000042", decimals: 18 },
37
41
  ],
38
42
  // Robinhood Chain (Arbitrum Orbit L2, chain 4663) is ETH-native; no canonical
39
- // USDC exists there yet, so no USDC entry `balance()` reports 0 by design.
43
+ // USDC exists there yet, so no USDC entry - `balance()` reports 0 by design.
40
44
  robinhood: [
41
45
  { symbol: "WETH", name: "Wrapped Ether", contract: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", decimals: 18 },
42
46
  ],
47
+ // Stable (chain 988). USDT0 is the LayerZero OFT that x402 settles in - 6
48
+ // decimals as an ERC-20, verified on-chain via decimals()/symbol().
49
+ stable: [
50
+ { symbol: "USDT0", name: "USDT0", contract: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", decimals: 6 },
51
+ ],
43
52
  };
44
- /** Per-network USDC contract addresses. */
45
- const USDC_CONTRACTS = {
53
+ /**
54
+ * The stablecoin x402 settles in on each network - what `balance()` reports and
55
+ * what payment routing compares a price against. USDC everywhere except Stable,
56
+ * which settles USDT0. All are 6 decimals, so the `/ 1_000_000` below holds.
57
+ */
58
+ const SETTLEMENT_STABLECOIN = {
46
59
  base: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
47
60
  ethereum: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
48
61
  arbitrum: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
49
62
  optimism: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
63
+ stable: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
50
64
  };
51
65
  const DEFAULT_RPCS = {
52
66
  base: "https://base-mainnet.g.alchemy.com/v2/Ug5mqBVIbSHoa8ZHgTUSJ",
@@ -54,6 +68,7 @@ const DEFAULT_RPCS = {
54
68
  arbitrum: "https://arb-mainnet.g.alchemy.com/v2/Ug5mqBVIbSHoa8ZHgTUSJ",
55
69
  optimism: "https://opt-mainnet.g.alchemy.com/v2/Ug5mqBVIbSHoa8ZHgTUSJ",
56
70
  robinhood: "https://rpc.mainnet.chain.robinhood.com",
71
+ stable: "https://rpc.stable.xyz",
57
72
  };
58
73
  const ERC20_ABI = [
59
74
  "function transfer(address to, uint256 amount) returns (bool)",
@@ -83,11 +98,11 @@ export function rawEvmSigner(opts) {
83
98
  return wallet;
84
99
  },
85
100
  async balance() {
86
- const usdc = USDC_CONTRACTS[opts.network];
87
- if (!usdc)
101
+ const asset = SETTLEMENT_STABLECOIN[opts.network];
102
+ if (!asset)
88
103
  return 0;
89
104
  try {
90
- const erc20 = new Contract(usdc, ERC20_ABI, provider);
105
+ const erc20 = new Contract(asset, ERC20_ABI, provider);
91
106
  const raw = (await erc20.balanceOf(wallet.address));
92
107
  return Number(raw) / 1_000_000;
93
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"raw-evm.js","sourceRoot":"","sources":["../../src/signers/raw-evm.ts"],"names":[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,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;gBAChC,OAAO,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC;YAClC,CAAC;YAED,mBAAmB;YACnB,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YACzD,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,QAAS,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC;YACvE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;YAChC,OAAO,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Raw Solana signer for tests, server-side agents, and other scenarios where
2
+ * Raw Solana signer - for tests, server-side agents, and other scenarios where
3
3
  * you hold a Solana keypair directly.
4
4
  *
5
5
  * Production wallets should prefer Privy or Phantom signers.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Raw Solana signer for tests, server-side agents, and other scenarios where
2
+ * Raw Solana signer - for tests, server-side agents, and other scenarios where
3
3
  * you hold a Solana keypair directly.
4
4
  *
5
5
  * Production wallets should prefer Privy or Phantom signers.
@@ -39,7 +39,7 @@ export function rawSolanaSigner(opts) {
39
39
  * `useByUrl()` can use `@x402/svm` for canonical x402 SVM v2 payloads.
40
40
  */
41
41
  async getKitSigner() {
42
- // Dynamic import keeps @solana/signers off the hot path for users
42
+ // Dynamic import - keeps @solana/signers off the hot path for users
43
43
  // who never call useByUrl against an SVM endpoint.
44
44
  const { createKeyPairSignerFromBytes } = await import("@solana/signers");
45
45
  return createKeyPairSignerFromBytes(keypair.secretKey);
@@ -71,7 +71,7 @@ export function rawSolanaSigner(opts) {
71
71
  }
72
72
  }
73
73
  catch { /* skip */ }
74
- // All SPL token accounts both the classic token program AND
74
+ // All SPL token accounts - both the classic token program AND
75
75
  // Token-2022 (newer mints, e.g. pump.fun tokens, live there and were
76
76
  // previously invisible to balance).
77
77
  for (const programId of [TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID]) {
@@ -119,7 +119,7 @@ export function rawSolanaSigner(opts) {
119
119
  },
120
120
  };
121
121
  }
122
- /** Minimal Base58 decode avoids pulling in bs58 just for this. */
122
+ /** Minimal Base58 decode - avoids pulling in bs58 just for this. */
123
123
  function decodeBase58(s) {
124
124
  const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
125
125
  const map = new Map();
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Native Solana token swap Jupiter Swap API v2 (order → sign → execute).
2
+ * Native Solana token swap - Jupiter Swap API v2 (order → sign → execute).
3
3
  *
4
4
  * Swaps happen inside the user's own xpay wallet (funds never leave it), but
5
5
  * a swap is irreversible and puts wallet value at risk, so it runs through
6
- * the same guardrail as payments and transfers enforced *before* signing.
6
+ * the same guardrail as payments and transfers - enforced *before* signing.
7
7
  *
8
8
  * Jupiter's meta-aggregator picks the router (metis / jupiterz / dflow /
9
- * okx), returns an unsigned v0 transaction, and lands it via POST /execute
9
+ * okx), returns an unsigned v0 transaction, and lands it via POST /execute -
10
10
  * no RPC broadcast on our side.
11
11
  *
12
12
  * Complements the Sana-hosted `sana_swap` (API-key wallet): this path is
@@ -15,7 +15,7 @@
15
15
  import type { Wallet } from "../wallet/index.js";
16
16
  import type { Guardrail } from "../guardrail/index.js";
17
17
  import { type TokenInfo } from "../token/index.js";
18
- /** Swap settings profile `config.swap`, overridable per call / via env. */
18
+ /** Swap settings - profile `config.swap`, overridable per call / via env. */
19
19
  export interface SwapConfig {
20
20
  /** Max slippage in bps (50 = 0.5%). Unset → Jupiter dynamic slippage. */
21
21
  slippageBps?: number;
@@ -52,7 +52,7 @@ export interface SwapQuote {
52
52
  router: string;
53
53
  /** Effective slippage for this order (Jupiter dynamic unless overridden). */
54
54
  slippageBps?: number;
55
- /** True when the output token is not Jupiter-verified relay this warning. */
55
+ /** True when the output token is not Jupiter-verified - relay this warning. */
56
56
  outputUnverified: boolean;
57
57
  }
58
58
  export interface SwapResult extends SwapQuote {
@@ -62,7 +62,7 @@ export interface SwapResult extends SwapQuote {
62
62
  totalInAmount?: number;
63
63
  totalOutAmount?: number;
64
64
  }
65
- /** Quote a swap without executing no guardrail, no signing, no funds moved. */
65
+ /** Quote a swap without executing - no guardrail, no signing, no funds moved. */
66
66
  export declare function swapQuote(args: Omit<SwapArgs, "guardrail">): Promise<SwapQuote>;
67
67
  /** Execute a swap inside the wallet. Guardrail runs before signing. */
68
68
  export declare function swap(args: SwapArgs): Promise<SwapResult>;
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Native Solana token swap Jupiter Swap API v2 (order → sign → execute).
2
+ * Native Solana token swap - Jupiter Swap API v2 (order → sign → execute).
3
3
  *
4
4
  * Swaps happen inside the user's own xpay wallet (funds never leave it), but
5
5
  * a swap is irreversible and puts wallet value at risk, so it runs through
6
- * the same guardrail as payments and transfers enforced *before* signing.
6
+ * the same guardrail as payments and transfers - enforced *before* signing.
7
7
  *
8
8
  * Jupiter's meta-aggregator picks the router (metis / jupiterz / dflow /
9
- * okx), returns an unsigned v0 transaction, and lands it via POST /execute
9
+ * okx), returns an unsigned v0 transaction, and lands it via POST /execute -
10
10
  * no RPC broadcast on our side.
11
11
  *
12
12
  * Complements the Sana-hosted `sana_swap` (API-key wallet): this path is
@@ -16,7 +16,7 @@ import { PublicKey, VersionedTransaction } from "@solana/web3.js";
16
16
  import { jupiterFetch, resolveTradeToken, NATIVE_SOL_MINT, } from "../token/index.js";
17
17
  import { solUsdPrice } from "../agenc/price.js";
18
18
  const DEFAULT_ENDPOINT = "https://api.jup.ag";
19
- /** Quote a swap without executing no guardrail, no signing, no funds moved. */
19
+ /** Quote a swap without executing - no guardrail, no signing, no funds moved. */
20
20
  export async function swapQuote(args) {
21
21
  const prepared = await prepare(args);
22
22
  return prepared.quote;
@@ -26,7 +26,7 @@ export async function swap(args) {
26
26
  // A quote's transaction embeds a recent blockhash, so always build a fresh
27
27
  // order here rather than reusing one from an earlier swapQuote() display.
28
28
  const { quote, order, signer, apiOpts } = await prepare(args);
29
- // Guardrail *before* signing same security boundary as pay/transfer.
29
+ // Guardrail *before* signing - same security boundary as pay/transfer.
30
30
  const requirement = {
31
31
  asset: quote.from.mint,
32
32
  payTo: quote.to.mint,
@@ -46,7 +46,7 @@ export async function swap(args) {
46
46
  accepts: [requirement],
47
47
  };
48
48
  await args.guardrail.check({ resource, requirement });
49
- // Partial-sign the v0 transaction. The signer never exposes its Keypair
49
+ // Partial-sign the v0 transaction. The signer never exposes its Keypair -
50
50
  // sign the serialized message and attach the signature (same pattern as
51
51
  // the native-SOL transfer). Do NOT use tx.sign(): it needs a Keypair, and
52
52
  // JupiterZ orders may get a market-maker co-signature at /execute, so only
@@ -64,9 +64,9 @@ export async function swap(args) {
64
64
  }));
65
65
  if (exec.status !== "Success") {
66
66
  const landed = exec.signature
67
- ? ` The transaction may have landed and reverted check https://solscan.io/tx/${exec.signature}`
67
+ ? ` The transaction may have landed and reverted - check https://solscan.io/tx/${exec.signature}`
68
68
  : "";
69
- throw new Error(`xpay.swap: execution failed (code ${exec.code ?? "?"}) ${exec.error ?? "unknown error"}.${landed}`);
69
+ throw new Error(`xpay.swap: execution failed (code ${exec.code ?? "?"}) - ${exec.error ?? "unknown error"}.${landed}`);
70
70
  }
71
71
  return {
72
72
  ...quote,
@@ -81,7 +81,7 @@ async function prepare(args) {
81
81
  throw new Error("xpay.swap: amount must be a positive number");
82
82
  }
83
83
  if (!args.wallet.has("solana")) {
84
- throw new Error("xpay.swap: swaps are Solana-only no Solana signer is configured");
84
+ throw new Error("xpay.swap: swaps are Solana-only - no Solana signer is configured");
85
85
  }
86
86
  const signer = args.wallet.signer("solana");
87
87
  const apiOpts = {
@@ -115,7 +115,7 @@ async function prepare(args) {
115
115
  // 2 = wallet lacks SOL for fees; 3 = wallet lacked SOL so Jupiter tried
116
116
  // the gasless route, which has a ~$5 minimum. A top-level `error` with no
117
117
  // code ("Failed to get quotes") notably happens when slippageBps is set
118
- // on the keyless tier dynamic slippage (omitting it) works.
118
+ // on the keyless tier - dynamic slippage (omitting it) works.
119
119
  let reason;
120
120
  if (order.errorCode === 1) {
121
121
  reason = `insufficient ${from.symbol} balance in the wallet`;
@@ -126,10 +126,10 @@ async function prepare(args) {
126
126
  else if (order.errorCode === 3) {
127
127
  reason =
128
128
  "swap is below the gasless route's ~$5 minimum. Jupiter routes gasless when the " +
129
- "wallet lacks SOL for fees fund the wallet with SOL, or swap a larger amount";
129
+ "wallet lacks SOL for fees - fund the wallet with SOL, or swap a larger amount";
130
130
  }
131
131
  else if (order.error && slippageBps !== undefined) {
132
- reason = `${order.error} try again without an explicit slippage (Jupiter picks dynamic slippage)`;
132
+ reason = `${order.error} - try again without an explicit slippage (Jupiter picks dynamic slippage)`;
133
133
  }
134
134
  else {
135
135
  reason = order.errorMessage ?? order.error ?? "Jupiter could not build a swap transaction";
@@ -1,19 +1,19 @@
1
1
  /**
2
- * Solana token discovery Jupiter Token API v2.
2
+ * Solana token discovery - Jupiter Token API v2.
3
3
  *
4
4
  * Keyless read-only search by ticker, name, or mint address. Returns live
5
- * market data (price, mcap, liquidity) plus Jupiter's verification flag
5
+ * market data (price, mcap, liquidity) plus Jupiter's verification flag -
6
6
  * the main scam signal agents must check before swapping (anyone can mint a
7
7
  * token reusing a real project's ticker).
8
8
  */
9
- /** Wrapped-SOL mint Jupiter's sentinel for native SOL (wraps/unwraps automatically). */
9
+ /** Wrapped-SOL mint - Jupiter's sentinel for native SOL (wraps/unwraps automatically). */
10
10
  export declare const NATIVE_SOL_MINT = "So11111111111111111111111111111111111111112";
11
11
  export interface TokenInfo {
12
12
  mint: string;
13
13
  symbol: string;
14
14
  name: string;
15
15
  decimals: number;
16
- /** Jupiter verification unverified tokens can be scams reusing a real ticker. */
16
+ /** Jupiter verification - unverified tokens can be scams reusing a real ticker. */
17
17
  verified: boolean;
18
18
  usdPrice?: number;
19
19
  mcap?: number;
@@ -32,21 +32,21 @@ export interface TokenApiOptions {
32
32
  /** Optional Jupiter API key for higher rate limits (env: JUPITER_API_KEY). */
33
33
  apiKey?: string;
34
34
  }
35
- /** Thrown when a bare ticker matches several plausible tokens retry with the exact mint. */
35
+ /** Thrown when a bare ticker matches several plausible tokens - retry with the exact mint. */
36
36
  export declare class AmbiguousTokenError extends Error {
37
37
  readonly candidates: TokenInfo[];
38
38
  constructor(input: string, candidates: TokenInfo[]);
39
39
  }
40
40
  /**
41
41
  * Search tokens by ticker, name, or mint. Ranked verified-first, then by
42
- * liquidity. Read-only no wallet, no signing.
42
+ * liquidity. Read-only - no wallet, no signing.
43
43
  */
44
44
  export declare function findTokens(query: string, opts?: TokenApiOptions & {
45
45
  limit?: number;
46
46
  }): Promise<TokenInfo[]>;
47
47
  /**
48
48
  * Deterministic single-token resolution for trading. Accepts a symbol or a
49
- * mint address; never silently picks between plausible candidates throws
49
+ * mint address; never silently picks between plausible candidates - throws
50
50
  * {@link AmbiguousTokenError} instead so the caller can pass the exact mint.
51
51
  */
52
52
  export declare function resolveTradeToken(input: string, opts?: TokenApiOptions): Promise<TokenInfo>;
@@ -65,7 +65,7 @@ export interface EnrichedTokenBalance {
65
65
  /**
66
66
  * Label and price wallet balances via one batched Jupiter lookup (comma-
67
67
  * separated mints, max 100). Unknown mints get their real symbol/name; every
68
- * priceable token gets `usdPrice`/`usdValue`. Never throws on any Jupiter
68
+ * priceable token gets `usdPrice`/`usdValue`. Never throws - on any Jupiter
69
69
  * failure the input balances are returned unchanged (a balance display must
70
70
  * not break because a market-data API hiccuped).
71
71
  */
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Solana token discovery Jupiter Token API v2.
2
+ * Solana token discovery - Jupiter Token API v2.
3
3
  *
4
4
  * Keyless read-only search by ticker, name, or mint address. Returns live
5
- * market data (price, mcap, liquidity) plus Jupiter's verification flag
5
+ * market data (price, mcap, liquidity) plus Jupiter's verification flag -
6
6
  * the main scam signal agents must check before swapping (anyone can mint a
7
7
  * token reusing a real project's ticker).
8
8
  */
@@ -10,23 +10,23 @@ import { Connection, PublicKey } from "@solana/web3.js";
10
10
  import { getMint } from "@solana/spl-token";
11
11
  import { SOLANA_TOKENS } from "../transfer/index.js";
12
12
  const DEFAULT_ENDPOINT = "https://api.jup.ag";
13
- /** Wrapped-SOL mint Jupiter's sentinel for native SOL (wraps/unwraps automatically). */
13
+ /** Wrapped-SOL mint - Jupiter's sentinel for native SOL (wraps/unwraps automatically). */
14
14
  export const NATIVE_SOL_MINT = "So11111111111111111111111111111111111111112";
15
- /** Thrown when a bare ticker matches several plausible tokens retry with the exact mint. */
15
+ /** Thrown when a bare ticker matches several plausible tokens - retry with the exact mint. */
16
16
  export class AmbiguousTokenError extends Error {
17
17
  candidates;
18
18
  constructor(input, candidates) {
19
19
  const list = candidates
20
20
  .map((c) => ` ${c.symbol} (${c.name}) mint ${c.mint}${c.verified ? " [verified]" : " [UNVERIFIED]"} liquidity $${Math.round(c.liquidity ?? 0).toLocaleString()}`)
21
21
  .join("\n");
22
- super(`Token "${input}" is ambiguous pass the exact mint address of the one you mean:\n${list}`);
22
+ super(`Token "${input}" is ambiguous - pass the exact mint address of the one you mean:\n${list}`);
23
23
  this.name = "AmbiguousTokenError";
24
24
  this.candidates = candidates;
25
25
  }
26
26
  }
27
27
  /**
28
28
  * Search tokens by ticker, name, or mint. Ranked verified-first, then by
29
- * liquidity. Read-only no wallet, no signing.
29
+ * liquidity. Read-only - no wallet, no signing.
30
30
  */
31
31
  export async function findTokens(query, opts = {}) {
32
32
  const raw = await searchJupiter(query, opts);
@@ -46,7 +46,7 @@ export async function findTokens(query, opts = {}) {
46
46
  }
47
47
  /**
48
48
  * Deterministic single-token resolution for trading. Accepts a symbol or a
49
- * mint address; never silently picks between plausible candidates throws
49
+ * mint address; never silently picks between plausible candidates - throws
50
50
  * {@link AmbiguousTokenError} instead so the caller can pass the exact mint.
51
51
  */
52
52
  export async function resolveTradeToken(input, opts = {}) {
@@ -57,7 +57,7 @@ export async function resolveTradeToken(input, opts = {}) {
57
57
  return { ...(info ?? fallbackToken(NATIVE_SOL_MINT, 9)), symbol: "SOL", verified: true };
58
58
  }
59
59
  // Well-known symbols pin to a canonical mint (avoids the ~20 lookalike
60
- // "BONK"s Jupiter returns) then still fetch live data by that mint.
60
+ // "BONK"s Jupiter returns) - then still fetch live data by that mint.
61
61
  const pinned = SOLANA_TOKENS[key] ?? Object.values(SOLANA_TOKENS).find((t) => t.symbol.toUpperCase() === key);
62
62
  if (pinned) {
63
63
  const [info] = await searchJupiter(pinned.mint, opts);
@@ -87,16 +87,16 @@ export async function resolveTradeToken(input, opts = {}) {
87
87
  throw new AmbiguousTokenError(input, sorted.slice(0, 5));
88
88
  }
89
89
  if (symbolMatches.length > 0) {
90
- // Only unverified candidates never auto-trade those by ticker.
90
+ // Only unverified candidates - never auto-trade those by ticker.
91
91
  throw new AmbiguousTokenError(input, symbolMatches.sort((a, b) => (b.liquidity ?? 0) - (a.liquidity ?? 0)).slice(0, 5));
92
92
  }
93
- throw new Error(`Unknown token "${input}" no exact ticker match on Jupiter. ` +
93
+ throw new Error(`Unknown token "${input}" - no exact ticker match on Jupiter. ` +
94
94
  `Try \`xpay token find ${input}\` to search, or pass the mint address directly.`);
95
95
  }
96
96
  /**
97
97
  * Label and price wallet balances via one batched Jupiter lookup (comma-
98
98
  * separated mints, max 100). Unknown mints get their real symbol/name; every
99
- * priceable token gets `usdPrice`/`usdValue`. Never throws on any Jupiter
99
+ * priceable token gets `usdPrice`/`usdValue`. Never throws - on any Jupiter
100
100
  * failure the input balances are returned unchanged (a balance display must
101
101
  * not break because a market-data API hiccuped).
102
102
  */
@@ -186,7 +186,7 @@ export async function jupiterFetch(url, apiKey, init) {
186
186
  reason = body?.error ?? body?.errorMessage ?? "";
187
187
  }
188
188
  catch { /* no body */ }
189
- throw new Error(`Jupiter API ${res.status} ${res.statusText}${reason ? ` ${reason}` : ""}` +
189
+ throw new Error(`Jupiter API ${res.status} ${res.statusText}${reason ? ` - ${reason}` : ""}` +
190
190
  (res.status === 429 ? " (rate-limited; set JUPITER_API_KEY for higher limits)" : ""));
191
191
  }
192
192
  return res.json();
@@ -198,7 +198,7 @@ function numOrUndef(v) {
198
198
  function fallbackToken(mint, decimals) {
199
199
  return { mint, symbol: mint.slice(0, 6) + "…", name: "", decimals, verified: false };
200
200
  }
201
- /** Last resort for mints Jupiter has never indexed decimals from chain, no price. */
201
+ /** Last resort for mints Jupiter has never indexed - decimals from chain, no price. */
202
202
  async function onChainToken(mint) {
203
203
  const rpc = process.env.XPAY_SOLANA_RPC ?? "https://solana-mainnet.g.alchemy.com/v2/Ug5mqBVIbSHoa8ZHgTUSJ";
204
204
  try {
@@ -207,7 +207,7 @@ async function onChainToken(mint) {
207
207
  return fallbackToken(mint, info.decimals);
208
208
  }
209
209
  catch {
210
- throw new Error(`Token mint ${mint} not found on Jupiter or on-chain check the address.`);
210
+ throw new Error(`Token mint ${mint} not found on Jupiter or on-chain - check the address.`);
211
211
  }
212
212
  }
213
213
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * RWA (real-world asset) discovery on Solana Jupiter Token API v2.
2
+ * RWA (real-world asset) discovery on Solana - Jupiter Token API v2.
3
3
  *
4
4
  * "RWA" covers every tokenized off-chain asset: equities, ETFs, treasuries,
5
5
  * commodities, private credit. What is actually TRADABLE on Solana DEXes
@@ -12,7 +12,7 @@
12
12
  * so it is pinned here explicitly).
13
13
  *
14
14
  * Permissioned funds (BlackRock BUIDL, Ondo OUSG) exist on Solana but are
15
- * KYC-gated: unverified on Jupiter, zero DEX liquidity, not swappable they
15
+ * KYC-gated: unverified on Jupiter, zero DEX liquidity, not swappable - they
16
16
  * are deliberately excluded.
17
17
  *
18
18
  * Jupiter's tag ENDPOINT rejects `rwa`/`stocks`/`xstocks` as queries (only
@@ -34,7 +34,7 @@ export interface RwaFindOptions extends TokenApiOptions {
34
34
  category?: RwaCategory;
35
35
  /** Max results. Default 20. */
36
36
  limit?: number;
37
- /** Include unverified tokens (excluded by default same scam caveat as any ticker). */
37
+ /** Include unverified tokens (excluded by default - same scam caveat as any ticker). */
38
38
  includeUnverified?: boolean;
39
39
  }
40
40
  /**
package/dist/token/rwa.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * RWA (real-world asset) discovery on Solana Jupiter Token API v2.
2
+ * RWA (real-world asset) discovery on Solana - Jupiter Token API v2.
3
3
  *
4
4
  * "RWA" covers every tokenized off-chain asset: equities, ETFs, treasuries,
5
5
  * commodities, private credit. What is actually TRADABLE on Solana DEXes
@@ -12,7 +12,7 @@
12
12
  * so it is pinned here explicitly).
13
13
  *
14
14
  * Permissioned funds (BlackRock BUIDL, Ondo OUSG) exist on Solana but are
15
- * KYC-gated: unverified on Jupiter, zero DEX liquidity, not swappable they
15
+ * KYC-gated: unverified on Jupiter, zero DEX liquidity, not swappable - they
16
16
  * are deliberately excluded.
17
17
  *
18
18
  * Jupiter's tag ENDPOINT rejects `rwa`/`stocks`/`xstocks` as queries (only
@@ -28,7 +28,7 @@ import { searchTokens } from "./index.js";
28
28
  * its top-100 between runs.
29
29
  */
30
30
  const SWEEP_QUERIES = ["xstock", "Ondo Tokenized", "tokenized", "treasury", "remora"];
31
- /** Ondo USDY treasury-backed yieldcoin, tagged yield/yb on Jupiter rather than rwa. */
31
+ /** Ondo USDY - treasury-backed yieldcoin, tagged yield/yb on Jupiter rather than rwa. */
32
32
  const USDY_MINT = "A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6";
33
33
  const CACHE_TTL_MS = 5 * 60_000;
34
34
  let sweepCache;
@@ -21,7 +21,7 @@ export interface ClaudeToolDef {
21
21
  input_schema: Record<string, unknown>;
22
22
  }
23
23
  export interface ToolOptions {
24
- /** Sana API key when present, registers sana_* tools alongside xpay_* tools. */
24
+ /** Sana API key - when present, registers sana_* tools alongside xpay_* tools. */
25
25
  sanaApiKey?: string;
26
26
  }
27
27
  /** Anthropic Claude tool definitions. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AA4BxC,MAAM,WAAW,UAAU,CAAC,IAAI;IAC9B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAE,WAAgB,GAAG,UAAU,CAAC,aAAa,CAAC,CA0vBvF;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI;;;;;;;;;qCA5wBD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC;EAyxB9E;AAED,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI;;;;;;;;qCA5xBD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC;EA0yB9E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;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