run402 1.13.4 → 1.13.5

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.
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Shared x402 payment wrapper for CLI commands that need paid fetch.
3
3
  * Uses viem for allowance signing + @x402/fetch for payment wrapping.
4
+ * Registers both Base mainnet (eip155:8453) and Base Sepolia (eip155:84532)
5
+ * so the x402 client matches whichever network the server offers.
4
6
  */
5
7
 
6
8
  import { readAllowance, ALLOWANCE_FILE } from "./config.mjs";
@@ -14,14 +16,17 @@ export async function setupPaidFetch() {
14
16
  const allowance = readAllowance();
15
17
  const { privateKeyToAccount } = await import("viem/accounts");
16
18
  const { createPublicClient, http } = await import("viem");
17
- const { baseSepolia } = await import("viem/chains");
19
+ const { base, baseSepolia } = await import("viem/chains");
18
20
  const { x402Client, wrapFetchWithPayment } = await import("@x402/fetch");
19
21
  const { ExactEvmScheme } = await import("@x402/evm/exact/client");
20
22
  const { toClientEvmSigner } = await import("@x402/evm");
21
23
  const account = privateKeyToAccount(allowance.privateKey);
22
- const publicClient = createPublicClient({ chain: baseSepolia, transport: http() });
23
- const signer = toClientEvmSigner(account, publicClient);
24
+
25
+ const mainnetClient = createPublicClient({ chain: base, transport: http() });
26
+ const sepoliaClient = createPublicClient({ chain: baseSepolia, transport: http() });
27
+
24
28
  const client = new x402Client();
25
- client.register("eip155:84532", new ExactEvmScheme(signer));
29
+ client.register("eip155:8453", new ExactEvmScheme(toClientEvmSigner(account, mainnetClient)));
30
+ client.register("eip155:84532", new ExactEvmScheme(toClientEvmSigner(account, sepoliaClient)));
26
31
  return wrapFetchWithPayment(fetch, client);
27
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.13.4",
3
+ "version": "1.13.5",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 micropayments.",
5
5
  "type": "module",
6
6
  "bin": {