x402-proxy 0.5.0 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.2] - 2026-03-19
11
+
12
+ ### Fixed
13
+ - Package exports missing top-level `types` condition - TypeScript with `moduleResolution: "bundler"` could not resolve type declarations
14
+
15
+ ## [0.5.1] - 2026-03-19
16
+
17
+ ### Fixed
18
+ - Solana USDC balance showing 0.0000 instead of actual balance due to `getTokenAccountsByOwner` being rate-limited (429) on public Solana RPC
19
+ - Replaced with offline ATA derivation via `@solana/kit` + lightweight `getTokenAccountBalance` call that works reliably on any public RPC
20
+ - RPC errors now show `?` instead of silently displaying `0.0000`
21
+
10
22
  ## [0.5.0] - 2026-03-16
11
23
 
12
24
  ### Changed
@@ -140,7 +152,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
140
152
  - `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
141
153
  - Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
142
154
 
143
- [Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.0...HEAD
155
+ [Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.2...HEAD
156
+ [0.5.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.1...v0.5.2
157
+ [0.5.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.0...v0.5.1
144
158
  [0.5.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.2...v0.5.0
145
159
  [0.4.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.1...v0.4.2
146
160
  [0.4.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.0...v0.4.1
package/dist/bin/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as buildX402Client, c as error, d as warn, f as appendHistory, g as readHistory, h as formatTxLine, i as walletInfoCommand, l as info, m as displayNetwork, o as resolveWallet, p as calcSpend, s as dim, u as isTTY } from "../wallet-BHywTzdN.js";
2
+ import { a as buildX402Client, c as error, d as warn, f as appendHistory, g as readHistory, h as formatTxLine, i as walletInfoCommand, l as info, m as displayNetwork, o as resolveWallet, p as calcSpend, s as dim, u as isTTY } from "../wallet-BMYYtAP6.js";
3
3
  import { c as isConfigured, i as ensureConfigDir, l as loadConfig, o as getHistoryPath, u as loadWalletFile } from "../derive-CISr_ond.js";
4
4
  import { n as setupCommand } from "../setup-gla-Qyqi.js";
5
- import { n as statusCommand } from "../status-DxW72Hx6.js";
5
+ import { n as statusCommand } from "../status-BoH_1kIH.js";
6
6
  import { buildApplication, buildCommand, buildRouteMap, run } from "@stricli/core";
7
7
  import pc from "picocolors";
8
8
  import { decodePaymentResponseHeader, wrapFetchWithPayment } from "@x402/fetch";
@@ -118,7 +118,7 @@ Examples:
118
118
  async func(flags, url) {
119
119
  if (!url) {
120
120
  if (isConfigured()) {
121
- const { displayStatus } = await import("../status-DrC0uxCS.js");
121
+ const { displayStatus } = await import("../status-BVIU3-b6.js");
122
122
  await displayStatus();
123
123
  console.log();
124
124
  console.log(pc.dim(" Commands:"));
@@ -179,7 +179,7 @@ Examples:
179
179
  const config = loadConfig();
180
180
  let preferredNetwork = config?.defaultNetwork;
181
181
  if (!preferredNetwork && wallet.evmAddress && wallet.solanaAddress) {
182
- const { fetchEvmBalances, fetchSolanaBalances } = await import("../wallet-DFhJWn3o.js");
182
+ const { fetchEvmBalances, fetchSolanaBalances } = await import("../wallet-BoY0fgX7.js");
183
183
  const [evmBal, solBal] = await Promise.allSettled([fetchEvmBalances(wallet.evmAddress), fetchSolanaBalances(wallet.solanaAddress)]);
184
184
  const evmUsdc = evmBal.status === "fulfilled" ? Number(evmBal.value?.usdc ?? 0) : 0;
185
185
  const solUsdc = solBal.status === "fulfilled" ? Number(solBal.value?.usdc ?? 0) : 0;
@@ -231,7 +231,7 @@ Examples:
231
231
  const hasEvm = accepts.some((a) => a.network.startsWith("eip155:"));
232
232
  const hasSolana = accepts.some((a) => a.network.startsWith("solana:"));
233
233
  const hasOther = accepts.some((a) => !a.network.startsWith("eip155:") && !a.network.startsWith("solana:"));
234
- const { fetchEvmBalances, fetchSolanaBalances } = await import("../wallet-DFhJWn3o.js");
234
+ const { fetchEvmBalances, fetchSolanaBalances } = await import("../wallet-BoY0fgX7.js");
235
235
  let evmUsdc = 0;
236
236
  let solUsdc = 0;
237
237
  if (hasEvm && wallet.evmAddress) try {
@@ -382,7 +382,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
382
382
  const config = loadConfig();
383
383
  let preferredNetwork = config?.defaultNetwork;
384
384
  if (!preferredNetwork && wallet.evmAddress && wallet.solanaAddress) {
385
- const { fetchEvmBalances, fetchSolanaBalances } = await import("../wallet-DFhJWn3o.js");
385
+ const { fetchEvmBalances, fetchSolanaBalances } = await import("../wallet-BoY0fgX7.js");
386
386
  const [evmBal, solBal] = await Promise.allSettled([fetchEvmBalances(wallet.evmAddress), fetchSolanaBalances(wallet.solanaAddress)]);
387
387
  const evmUsdc = evmBal.status === "fulfilled" ? Number(evmBal.value?.usdc ?? 0) : 0;
388
388
  const solUsdc = solBal.status === "fulfilled" ? Number(solBal.value?.usdc ?? 0) : 0;
@@ -403,7 +403,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
403
403
  const { x402MCPClient } = await import("@x402/mcp");
404
404
  const remoteClient = new Client({
405
405
  name: "x402-proxy",
406
- version: "0.5.0"
406
+ version: "0.5.2"
407
407
  });
408
408
  const x402Mcp = new x402MCPClient(remoteClient, x402PaymentClient, {
409
409
  autoPayment: true,
@@ -458,7 +458,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
458
458
  }
459
459
  const localServer = new Server({
460
460
  name: "x402-proxy",
461
- version: "0.5.0"
461
+ version: "0.5.2"
462
462
  }, { capabilities: {
463
463
  tools: tools.length > 0 ? {} : void 0,
464
464
  resources: remoteResources.length > 0 ? {} : void 0
@@ -635,7 +635,7 @@ const routes = buildRouteMap({
635
635
  });
636
636
  const app = buildApplication(routes, {
637
637
  name: "x402-proxy",
638
- versionInfo: { currentVersion: "0.5.0" },
638
+ versionInfo: { currentVersion: "0.5.2" },
639
639
  scanner: { caseStyle: "allow-kebab-for-camel" }
640
640
  });
641
641
 
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { n as statusCommand, t as displayStatus } from "./status-DxW72Hx6.js";
2
+ import { n as statusCommand, t as displayStatus } from "./status-BoH_1kIH.js";
3
3
 
4
4
  export { displayStatus };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { g as readHistory, h as formatTxLine, n as fetchEvmBalances, o as resolveWallet, p as calcSpend, r as fetchSolanaBalances, s as dim, t as balanceLine } from "./wallet-BHywTzdN.js";
2
+ import { g as readHistory, h as formatTxLine, n as fetchEvmBalances, o as resolveWallet, p as calcSpend, r as fetchSolanaBalances, s as dim, t as balanceLine } from "./wallet-BMYYtAP6.js";
3
3
  import { a as getConfigDirShort, l as loadConfig, o as getHistoryPath } from "./derive-CISr_ond.js";
4
4
  import { buildCommand } from "@stricli/core";
5
5
  import pc from "picocolors";
@@ -12,6 +12,7 @@ import { registerExactSvmScheme } from "@x402/svm/exact/client";
12
12
  import { createPublicClient, http } from "viem";
13
13
  import { privateKeyToAccount } from "viem/accounts";
14
14
  import { base } from "viem/chains";
15
+ import { address, getAddressEncoder, getProgramDerivedAddress } from "@solana/kit";
15
16
 
16
17
  //#region src/history.ts
17
18
  const HISTORY_MAX_LINES = 1e3;
@@ -285,6 +286,8 @@ const BASE_RPC = "https://mainnet.base.org";
285
286
  const SOLANA_RPC = "https://api.mainnet-beta.solana.com";
286
287
  const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
287
288
  const USDC_SOLANA_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
289
+ const TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
290
+ const ATA_PROGRAM = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
288
291
  async function rpcCall(url, method, params) {
289
292
  return (await fetch(url, {
290
293
  method: "POST",
@@ -308,17 +311,26 @@ async function fetchEvmBalances(address) {
308
311
  usdc: usdcRes.result ? (Number(BigInt(usdcRes.result)) / 1e6).toFixed(4) : "?"
309
312
  };
310
313
  }
311
- async function fetchSolanaBalances(address) {
312
- const [solRes, usdcRes] = await Promise.all([rpcCall(SOLANA_RPC, "getBalance", [address]), rpcCall(SOLANA_RPC, "getTokenAccountsByOwner", [
313
- address,
314
- { mint: USDC_SOLANA_MINT },
315
- { encoding: "jsonParsed" }
316
- ])]);
314
+ async function getUsdcAta(owner) {
315
+ const encoder = getAddressEncoder();
316
+ const [ata] = await getProgramDerivedAddress({
317
+ programAddress: address(ATA_PROGRAM),
318
+ seeds: [
319
+ encoder.encode(address(owner)),
320
+ encoder.encode(address(TOKEN_PROGRAM)),
321
+ encoder.encode(address(USDC_SOLANA_MINT))
322
+ ]
323
+ });
324
+ return ata;
325
+ }
326
+ async function fetchSolanaBalances(ownerAddress) {
327
+ const ata = await getUsdcAta(ownerAddress);
328
+ const [solRes, usdcRes] = await Promise.all([rpcCall(SOLANA_RPC, "getBalance", [ownerAddress]), rpcCall(SOLANA_RPC, "getTokenAccountBalance", [ata])]);
317
329
  const sol = solRes.result?.value != null ? (solRes.result.value / 1e9).toFixed(6) : "?";
318
- const accounts = usdcRes.result?.value;
330
+ const usdcVal = usdcRes.result?.value;
319
331
  return {
320
332
  sol,
321
- usdc: accounts?.length ? Number(accounts[0].account.data.parsed.info.tokenAmount.uiAmountString).toFixed(4) : "0.0000"
333
+ usdc: usdcVal ? Number(usdcVal.uiAmountString).toFixed(4) : usdcVal === void 0 ? "?" : "0.0000"
322
334
  };
323
335
  }
324
336
  function balanceLine(usdc, native, nativeSymbol) {
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { i as walletInfoCommand, n as fetchEvmBalances, r as fetchSolanaBalances, t as balanceLine } from "./wallet-BMYYtAP6.js";
3
+
4
+ export { fetchEvmBalances, fetchSolanaBalances };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402-proxy",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "curl for x402 paid APIs. Auto-pays any endpoint on Base and Solana.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -8,10 +8,8 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
14
- }
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
15
13
  },
16
14
  "./package.json": "./package.json"
17
15
  },
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { i as walletInfoCommand, n as fetchEvmBalances, r as fetchSolanaBalances, t as balanceLine } from "./wallet-BHywTzdN.js";
3
-
4
- export { fetchEvmBalances, fetchSolanaBalances };