run402 1.13.3 → 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.
- package/lib/paid-fetch.mjs +9 -4
- package/lib/projects.mjs +3 -2
- package/package.json +1 -1
package/lib/paid-fetch.mjs
CHANGED
|
@@ -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
|
-
|
|
23
|
-
const
|
|
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:
|
|
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/lib/projects.mjs
CHANGED
|
@@ -17,8 +17,8 @@ Subcommands:
|
|
|
17
17
|
usage <id> Show compute/storage usage for a project
|
|
18
18
|
schema <id> Inspect the database schema
|
|
19
19
|
rls <id> <template> <tables_json> Apply Row-Level Security policies
|
|
20
|
-
delete <id> Delete a project and remove it from local state
|
|
21
|
-
pin <id>
|
|
20
|
+
delete <id> Delete a project and remove it from local state
|
|
21
|
+
pin <id> Pin a project (prevents expiry/GC)
|
|
22
22
|
|
|
23
23
|
Examples:
|
|
24
24
|
run402 projects quote
|
|
@@ -32,6 +32,7 @@ Examples:
|
|
|
32
32
|
run402 projects usage abc123
|
|
33
33
|
run402 projects schema abc123
|
|
34
34
|
run402 projects rls abc123 public_read '[{"table":"posts"}]'
|
|
35
|
+
run402 projects keys abc123
|
|
35
36
|
run402 projects delete abc123
|
|
36
37
|
|
|
37
38
|
Notes:
|
package/package.json
CHANGED