x402-proxy 0.3.0 → 0.3.1
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/README.md
CHANGED
|
@@ -67,7 +67,7 @@ x402-proxy status # config + wallet + spend summary
|
|
|
67
67
|
x402-proxy wallet # show addresses
|
|
68
68
|
x402-proxy wallet history # payment history
|
|
69
69
|
x402-proxy wallet fund # funding instructions
|
|
70
|
-
x402-proxy wallet export-key <
|
|
70
|
+
x402-proxy wallet export-key <target> # bare key/mnemonic to stdout (evm|solana|mnemonic)
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
All commands support `--help` for details.
|
|
@@ -83,8 +83,9 @@ Config stored at `$XDG_CONFIG_HOME/x402-proxy/` (default `~/.config/x402-proxy/`
|
|
|
83
83
|
### Export keys for other tools
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
|
-
# Pipe-safe - outputs bare key to stdout
|
|
86
|
+
# Pipe-safe - outputs bare key/mnemonic to stdout
|
|
87
87
|
MY_KEY=$(npx x402-proxy wallet export-key evm)
|
|
88
|
+
MY_MNEMONIC=$(npx x402-proxy wallet export-key mnemonic)
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
## Env Vars
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as
|
|
2
|
+
import { C as appendHistory, E as readHistory, S as saveWalletFile, T as formatTxLine, _ as getWalletPath, a as resolveWallet, b as loadWalletFile, c as generateMnemonic, d as info, f as isTTY, g as getHistoryPath, h as getConfigDirShort, i as buildX402Client, l as dim, m as ensureConfigDir, n as statusCommand, o as deriveEvmKeypair, p as warn, r as walletInfoCommand, s as deriveSolanaKeypair, u as error, v as isConfigured, w as calcSpend, x as saveConfig, y as loadConfig } from "../status-BAzavcCj.js";
|
|
3
3
|
import { buildApplication, buildCommand, buildRouteMap, run } from "@stricli/core";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
import { decodePaymentResponseHeader, wrapFetchWithPayment } from "@x402/fetch";
|
|
@@ -109,7 +109,7 @@ Examples:
|
|
|
109
109
|
async func(flags, url) {
|
|
110
110
|
if (!url) {
|
|
111
111
|
if (isConfigured()) {
|
|
112
|
-
const { displayStatus } = await import("../status-
|
|
112
|
+
const { displayStatus } = await import("../status-CeXiUR6L.js");
|
|
113
113
|
await displayStatus();
|
|
114
114
|
console.log();
|
|
115
115
|
console.log(pc.dim(" Commands:"));
|
|
@@ -447,22 +447,35 @@ const setupCommand = buildCommand({
|
|
|
447
447
|
//#endregion
|
|
448
448
|
//#region src/commands/wallet-export.ts
|
|
449
449
|
const walletExportCommand = buildCommand({
|
|
450
|
-
docs: { brief: "Export private key to stdout (pipe-safe)" },
|
|
450
|
+
docs: { brief: "Export private key or mnemonic to stdout (pipe-safe)" },
|
|
451
451
|
parameters: {
|
|
452
452
|
flags: {},
|
|
453
453
|
positional: {
|
|
454
454
|
kind: "tuple",
|
|
455
455
|
parameters: [{
|
|
456
|
-
brief: "
|
|
456
|
+
brief: "What to export: evm, solana, or mnemonic",
|
|
457
457
|
parse: (input) => {
|
|
458
458
|
const v = input.toLowerCase();
|
|
459
|
-
if (v !== "evm" && v !== "solana") throw new Error("Must be 'evm' or '
|
|
459
|
+
if (v !== "evm" && v !== "solana" && v !== "mnemonic") throw new Error("Must be 'evm', 'solana', or 'mnemonic'");
|
|
460
460
|
return v;
|
|
461
461
|
}
|
|
462
462
|
}]
|
|
463
463
|
}
|
|
464
464
|
},
|
|
465
465
|
async func(flags, chain) {
|
|
466
|
+
if (chain === "mnemonic") {
|
|
467
|
+
const mnemonic = process.env.X402_PROXY_WALLET_MNEMONIC || loadWalletFile()?.mnemonic;
|
|
468
|
+
if (!mnemonic) {
|
|
469
|
+
error("No mnemonic available. Wallet may have been configured with individual keys.");
|
|
470
|
+
process.exit(1);
|
|
471
|
+
}
|
|
472
|
+
if (process.stdout.isTTY) {
|
|
473
|
+
const confirmed = await prompts.confirm({ message: "This will print your mnemonic to the terminal. Continue?" });
|
|
474
|
+
if (prompts.isCancel(confirmed) || !confirmed) process.exit(0);
|
|
475
|
+
} else warn("Warning: mnemonic will be printed to stdout.");
|
|
476
|
+
process.stdout.write(mnemonic);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
466
479
|
const wallet = resolveWallet();
|
|
467
480
|
if (wallet.source === "none") {
|
|
468
481
|
error("No wallet configured.");
|
|
@@ -596,7 +609,7 @@ const routes = buildRouteMap({
|
|
|
596
609
|
});
|
|
597
610
|
const app = buildApplication(routes, {
|
|
598
611
|
name: "x402-proxy",
|
|
599
|
-
versionInfo: { currentVersion: "0.3.
|
|
612
|
+
versionInfo: { currentVersion: "0.3.1" },
|
|
600
613
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
601
614
|
});
|
|
602
615
|
|
|
@@ -572,4 +572,4 @@ const statusCommand = buildCommand({
|
|
|
572
572
|
});
|
|
573
573
|
|
|
574
574
|
//#endregion
|
|
575
|
-
export {
|
|
575
|
+
export { appendHistory as C, readHistory as E, saveWalletFile as S, formatTxLine as T, getWalletPath as _, resolveWallet as a, loadWalletFile as b, generateMnemonic$1 as c, info as d, isTTY as f, getHistoryPath as g, getConfigDirShort as h, buildX402Client as i, dim as l, ensureConfigDir as m, statusCommand as n, deriveEvmKeypair as o, warn as p, walletInfoCommand as r, deriveSolanaKeypair as s, displayStatus as t, error as u, isConfigured as v, calcSpend as w, saveConfig as x, loadConfig as y };
|