vapi-network 0.2.2 → 0.2.3
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 +21 -2
- package/dist/cli.js +196 -26
- package/dist/cli.js.map +2 -2
- package/dist/index.js +202 -26
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ vapi pay <listing-ref> --max 0.02
|
|
|
29
29
|
vapi balance
|
|
30
30
|
vapi accounts # balances plus network-specific deposit guidance
|
|
31
31
|
vapi receipts # one line per paid call: quote, settlement, latency
|
|
32
|
+
vapi export-key # print the private key for this wallet, on stdout only
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
`vapi search` tags each listing with its group — `[vapi]`, `[added]`,
|
|
@@ -117,6 +118,21 @@ faucet URL or instructions to that network's `config.json` entry:
|
|
|
117
118
|
Account lookup dispatches by CAIP namespace: the EVM and Solana adapters use their corresponding
|
|
118
119
|
local address and guarded RPC balance calls without coupling one wallet family to the other.
|
|
119
120
|
|
|
121
|
+
## Exporting the key
|
|
122
|
+
|
|
123
|
+
The wallet is yours, so the key can leave on demand:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
vapi export-key # EVM key (eip155:8453) as 0x-prefixed hex
|
|
127
|
+
vapi export-key --network solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d
|
|
128
|
+
vapi export-key --json # { "network", "address", "privateKey" }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The command asks for the keystore passphrase, prints a one-line warning on
|
|
132
|
+
stderr, and writes the key alone on stdout so it can be piped into a password
|
|
133
|
+
manager. Anyone holding that key can spend the wallet: never paste it into a
|
|
134
|
+
website or a chat. Nothing else in vAPI ever logs it.
|
|
135
|
+
|
|
120
136
|
## Reporting a bug
|
|
121
137
|
|
|
122
138
|
```bash
|
|
@@ -179,8 +195,11 @@ provenance:
|
|
|
179
195
|
`https://api.vapinetwork.ai/api/call/discovery` for discovery and
|
|
180
196
|
`https://api.vapinetwork.ai/api/call/services` for service details. If the
|
|
181
197
|
primary returns HTTP 404 or cannot be resolved, the client logs one notice
|
|
182
|
-
and tries the
|
|
183
|
-
the
|
|
198
|
+
and tries the fallbacks in `registryFallbacks`, using the same canonical
|
|
199
|
+
paths; the default distribution no longer ships a distinct fallback host,
|
|
200
|
+
because the `console.vapinetwork.ai` and `console-staging.vapinetwork.ai`
|
|
201
|
+
hosts are retired. A `config.json` that still names them is repaired in
|
|
202
|
+
memory on load and rewritten on disk by `vapi init`. The registry's historical `/api/marketplace/discovery`
|
|
184
203
|
and `/api/network/services` paths still answer for one release and reply with
|
|
185
204
|
`Deprecation: true` plus a `Link` header naming the successor; a base URL
|
|
186
205
|
supplied on either of them is normalized to the canonical pair.
|
package/dist/cli.js
CHANGED
|
@@ -45330,8 +45330,8 @@ var DEFAULT_DISCOVERY_URL = `${DEFAULT_REGISTRY_URL}/api/call/services`;
|
|
|
45330
45330
|
var DEFAULT_MARKETPLACE_DISCOVERY_URL = `${DEFAULT_REGISTRY_URL}/api/call/discovery`;
|
|
45331
45331
|
var DEFAULT_REGISTRY_FALLBACKS = [
|
|
45332
45332
|
{
|
|
45333
|
-
discoveryUrl:
|
|
45334
|
-
marketplaceDiscoveryUrl:
|
|
45333
|
+
discoveryUrl: DEFAULT_DISCOVERY_URL,
|
|
45334
|
+
marketplaceDiscoveryUrl: DEFAULT_MARKETPLACE_DISCOVERY_URL
|
|
45335
45335
|
}
|
|
45336
45336
|
];
|
|
45337
45337
|
var DEFAULT_SPEND_CAPS = {
|
|
@@ -45436,6 +45436,83 @@ async function migrateLegacyVapiHome(options = {}) {
|
|
|
45436
45436
|
}
|
|
45437
45437
|
return copied;
|
|
45438
45438
|
}
|
|
45439
|
+
var LEGACY_REGISTRY_HOSTS = /* @__PURE__ */ new Map([
|
|
45440
|
+
["console.vapinetwork.ai", "api.vapinetwork.ai"],
|
|
45441
|
+
["console-staging.vapinetwork.ai", "api-staging.vapinetwork.ai"]
|
|
45442
|
+
]);
|
|
45443
|
+
var LEGACY_REGISTRY_PATHS = /* @__PURE__ */ new Map([
|
|
45444
|
+
["/api/network/services", "/api/call/services"],
|
|
45445
|
+
["/api/marketplace/discovery", "/api/call/discovery"]
|
|
45446
|
+
]);
|
|
45447
|
+
var REGISTRY_DOMAIN = "vapinetwork.ai";
|
|
45448
|
+
function rewriteLegacyRegistryUrl(value) {
|
|
45449
|
+
let url2;
|
|
45450
|
+
try {
|
|
45451
|
+
url2 = new URL(value);
|
|
45452
|
+
} catch {
|
|
45453
|
+
return value;
|
|
45454
|
+
}
|
|
45455
|
+
let rewritten = false;
|
|
45456
|
+
const host = LEGACY_REGISTRY_HOSTS.get(url2.hostname.toLowerCase());
|
|
45457
|
+
if (host) {
|
|
45458
|
+
url2.hostname = host;
|
|
45459
|
+
rewritten = true;
|
|
45460
|
+
}
|
|
45461
|
+
const hostname3 = url2.hostname.toLowerCase();
|
|
45462
|
+
if (hostname3 === REGISTRY_DOMAIN || hostname3.endsWith(`.${REGISTRY_DOMAIN}`)) {
|
|
45463
|
+
const path = LEGACY_REGISTRY_PATHS.get(url2.pathname.replace(/\/+$/, ""));
|
|
45464
|
+
if (path) {
|
|
45465
|
+
url2.pathname = path;
|
|
45466
|
+
rewritten = true;
|
|
45467
|
+
}
|
|
45468
|
+
}
|
|
45469
|
+
return rewritten ? url2.href : value;
|
|
45470
|
+
}
|
|
45471
|
+
function rewriteLegacyRegistryUrls(config2) {
|
|
45472
|
+
const changes = [];
|
|
45473
|
+
const rewrite = (field, from16) => {
|
|
45474
|
+
const to = rewriteLegacyRegistryUrl(from16);
|
|
45475
|
+
if (to !== from16) changes.push({ field, from: from16, to });
|
|
45476
|
+
return to;
|
|
45477
|
+
};
|
|
45478
|
+
const next = {
|
|
45479
|
+
...config2,
|
|
45480
|
+
discoveryUrl: rewrite("discoveryUrl", config2.discoveryUrl),
|
|
45481
|
+
marketplaceDiscoveryUrl: rewrite("marketplaceDiscoveryUrl", config2.marketplaceDiscoveryUrl),
|
|
45482
|
+
...config2.registryFallbacks ? {
|
|
45483
|
+
registryFallbacks: config2.registryFallbacks.map((fallback, index2) => ({
|
|
45484
|
+
discoveryUrl: rewrite(
|
|
45485
|
+
`registryFallbacks[${index2}].discoveryUrl`,
|
|
45486
|
+
fallback.discoveryUrl
|
|
45487
|
+
),
|
|
45488
|
+
marketplaceDiscoveryUrl: rewrite(
|
|
45489
|
+
`registryFallbacks[${index2}].marketplaceDiscoveryUrl`,
|
|
45490
|
+
fallback.marketplaceDiscoveryUrl
|
|
45491
|
+
)
|
|
45492
|
+
}))
|
|
45493
|
+
} : {}
|
|
45494
|
+
};
|
|
45495
|
+
return changes.length === 0 ? { config: config2, changes } : { config: next, changes };
|
|
45496
|
+
}
|
|
45497
|
+
function formatLegacyRegistryRewrites(changes) {
|
|
45498
|
+
return [
|
|
45499
|
+
"Rewrote retired vAPI registry URLs in the local config:",
|
|
45500
|
+
...changes.map((change) => ` ${change.field}: ${change.from} -> ${change.to}`)
|
|
45501
|
+
].join("\n");
|
|
45502
|
+
}
|
|
45503
|
+
async function migrateLegacyRegistryConfig(path = getVapiPaths().config) {
|
|
45504
|
+
let raw;
|
|
45505
|
+
try {
|
|
45506
|
+
raw = await readFile(path, "utf8");
|
|
45507
|
+
} catch (error61) {
|
|
45508
|
+
if (isMissingFile(error61)) return [];
|
|
45509
|
+
throw error61;
|
|
45510
|
+
}
|
|
45511
|
+
const { config: config2, changes } = rewriteLegacyRegistryUrls(configSchema.parse(JSON.parse(raw)));
|
|
45512
|
+
if (changes.length === 0) return [];
|
|
45513
|
+
await writeConfigFile(path, config2);
|
|
45514
|
+
return changes;
|
|
45515
|
+
}
|
|
45439
45516
|
function getDefaultConfig(source = process.env, options = {}) {
|
|
45440
45517
|
const registry2 = registryEndpoints(source.VAPI_REGISTRY_URL?.trim() || DEFAULT_REGISTRY_URL);
|
|
45441
45518
|
const requested = new Set(options.networks ?? ["base"]);
|
|
@@ -45474,7 +45551,7 @@ function getDefaultConfig(source = process.env, options = {}) {
|
|
|
45474
45551
|
spendCaps: { ...DEFAULT_SPEND_CAPS }
|
|
45475
45552
|
};
|
|
45476
45553
|
}
|
|
45477
|
-
async function loadConfig(path = getVapiPaths().config, source = process.env) {
|
|
45554
|
+
async function loadConfig(path = getVapiPaths().config, source = process.env, options = {}) {
|
|
45478
45555
|
if (!process.env.VAPI_HOME?.trim() && path === getVapiPaths(join(homedir(), ".vapi")).config) {
|
|
45479
45556
|
await migrateLegacyVapiHome({ targetDirectory: join(homedir(), ".vapi") });
|
|
45480
45557
|
}
|
|
@@ -45485,8 +45562,16 @@ async function loadConfig(path = getVapiPaths().config, source = process.env) {
|
|
|
45485
45562
|
if (isMissingFile(error61)) return getDefaultConfig(source);
|
|
45486
45563
|
throw error61;
|
|
45487
45564
|
}
|
|
45488
|
-
const
|
|
45489
|
-
|
|
45565
|
+
const parsed = configSchema.parse(JSON.parse(raw));
|
|
45566
|
+
parsed.registryFallbacks ??= DEFAULT_REGISTRY_FALLBACKS.map((fallback) => ({ ...fallback }));
|
|
45567
|
+
const migrated = rewriteLegacyRegistryUrls(parsed);
|
|
45568
|
+
const config2 = migrated.config;
|
|
45569
|
+
if (migrated.changes.length > 0 && options.notice) {
|
|
45570
|
+
options.notice(
|
|
45571
|
+
`${formatLegacyRegistryRewrites(migrated.changes)}
|
|
45572
|
+
Run vapi init to write the new URLs to ${path}.`
|
|
45573
|
+
);
|
|
45574
|
+
}
|
|
45490
45575
|
const baseRpcUrl = source.BASE_RPC_URL?.trim();
|
|
45491
45576
|
const arcRpcUrl = source.ARC_TESTNET_RPC_URL?.trim();
|
|
45492
45577
|
const solanaRpcUrl = source.SOLANA_RPC_URL?.trim();
|
|
@@ -45542,15 +45627,7 @@ async function writeDefaultConfig(path = getVapiPaths().config, source = process
|
|
|
45542
45627
|
if (copied.includes(path)) return await loadConfig(path, source);
|
|
45543
45628
|
}
|
|
45544
45629
|
const config2 = getDefaultConfig(source, options);
|
|
45545
|
-
await
|
|
45546
|
-
const temporaryPath = `${path}.${process.pid}.tmp`;
|
|
45547
|
-
await writeFile(temporaryPath, `${JSON.stringify(config2, null, 2)}
|
|
45548
|
-
`, {
|
|
45549
|
-
encoding: "utf8",
|
|
45550
|
-
mode: 384,
|
|
45551
|
-
flag: "wx"
|
|
45552
|
-
});
|
|
45553
|
-
await rename(temporaryPath, path);
|
|
45630
|
+
await writeConfigFile(path, config2);
|
|
45554
45631
|
return config2;
|
|
45555
45632
|
}
|
|
45556
45633
|
async function enableDefaultNetwork(network, path = getVapiPaths().config, source = process.env) {
|
|
@@ -45561,6 +45638,10 @@ async function enableDefaultNetwork(network, path = getVapiPaths().config, sourc
|
|
|
45561
45638
|
usdc: NETWORKS[SOLANA_MAINNET_CAIP2].usdc
|
|
45562
45639
|
};
|
|
45563
45640
|
}
|
|
45641
|
+
await writeConfigFile(path, config2);
|
|
45642
|
+
return config2;
|
|
45643
|
+
}
|
|
45644
|
+
async function writeConfigFile(path, config2) {
|
|
45564
45645
|
await mkdir(dirname(path), { recursive: true, mode: 448 });
|
|
45565
45646
|
const temporaryPath = `${path}.${process.pid}.tmp`;
|
|
45566
45647
|
await writeFile(temporaryPath, `${JSON.stringify(config2, null, 2)}
|
|
@@ -45570,7 +45651,6 @@ async function enableDefaultNetwork(network, path = getVapiPaths().config, sourc
|
|
|
45570
45651
|
flag: "wx"
|
|
45571
45652
|
});
|
|
45572
45653
|
await rename(temporaryPath, path);
|
|
45573
|
-
return config2;
|
|
45574
45654
|
}
|
|
45575
45655
|
async function pathExists(path) {
|
|
45576
45656
|
try {
|
|
@@ -45991,6 +46071,49 @@ async function unlockKeystore(passphrase, path = getVapiPaths().keystore) {
|
|
|
45991
46071
|
}
|
|
45992
46072
|
return await paymentAccountFromKeys(keys);
|
|
45993
46073
|
}
|
|
46074
|
+
async function readKeystoreAddress(path = getVapiPaths().keystore) {
|
|
46075
|
+
let raw;
|
|
46076
|
+
try {
|
|
46077
|
+
raw = await readFile3(path, "utf8");
|
|
46078
|
+
} catch {
|
|
46079
|
+
return void 0;
|
|
46080
|
+
}
|
|
46081
|
+
let parsed;
|
|
46082
|
+
try {
|
|
46083
|
+
parsed = JSON.parse(raw);
|
|
46084
|
+
} catch {
|
|
46085
|
+
return void 0;
|
|
46086
|
+
}
|
|
46087
|
+
const address2 = typeof parsed === "object" && parsed !== null ? Reflect.get(parsed, "address") : void 0;
|
|
46088
|
+
return typeof address2 === "string" ? address2 : void 0;
|
|
46089
|
+
}
|
|
46090
|
+
async function exportKeystoreKeys(passphrase, path = getVapiPaths().keystore) {
|
|
46091
|
+
let raw;
|
|
46092
|
+
try {
|
|
46093
|
+
raw = await readFile3(path, "utf8");
|
|
46094
|
+
} catch (error61) {
|
|
46095
|
+
if (isMissingFile(error61)) {
|
|
46096
|
+
throw new KeystoreError(`No vAPI keystore found at ${path}. Run vapi init.`);
|
|
46097
|
+
}
|
|
46098
|
+
throw error61;
|
|
46099
|
+
}
|
|
46100
|
+
const keys = await decryptKeys(parseAnyKeystore(JSON.parse(raw)), passphrase);
|
|
46101
|
+
const evmPrivateKey = keys.evm;
|
|
46102
|
+
const exported = {
|
|
46103
|
+
evm: { address: privateKeyToAccount(evmPrivateKey).address, privateKey: evmPrivateKey }
|
|
46104
|
+
};
|
|
46105
|
+
if (!keys.solana) return exported;
|
|
46106
|
+
const seed = Uint8Array.from(Buffer.from(keys.solana, "base64"));
|
|
46107
|
+
const signer = await createSolanaSigner(Uint8Array.from(seed));
|
|
46108
|
+
const publicKey = Uint8Array.from(getBase58Encoder().encode(signer.address));
|
|
46109
|
+
const secretKey = new Uint8Array(seed.length + publicKey.length);
|
|
46110
|
+
secretKey.set(seed);
|
|
46111
|
+
secretKey.set(publicKey, seed.length);
|
|
46112
|
+
const encoded = getBase58Decoder().decode(secretKey);
|
|
46113
|
+
seed.fill(0);
|
|
46114
|
+
secretKey.fill(0);
|
|
46115
|
+
return { ...exported, solana: { address: signer.address, secretKey: encoded } };
|
|
46116
|
+
}
|
|
45994
46117
|
async function enableSolanaKey(passphrase, path = getVapiPaths().keystore) {
|
|
45995
46118
|
let raw;
|
|
45996
46119
|
try {
|
|
@@ -46670,7 +46793,7 @@ function csvCell(value) {
|
|
|
46670
46793
|
import { mkdir as mkdir6, writeFile as writeFile4 } from "node:fs/promises";
|
|
46671
46794
|
import { arch, platform, release } from "node:os";
|
|
46672
46795
|
import { join as join2 } from "node:path";
|
|
46673
|
-
var VAPI_CLIENT_VERSION = "0.2.
|
|
46796
|
+
var VAPI_CLIENT_VERSION = "0.2.3";
|
|
46674
46797
|
async function createSupportReport(options) {
|
|
46675
46798
|
const message = options.message.trim();
|
|
46676
46799
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -48963,7 +49086,7 @@ function rgbToAnsi256(red, green, blue) {
|
|
|
48963
49086
|
}
|
|
48964
49087
|
|
|
48965
49088
|
// ../cli/src/version.ts
|
|
48966
|
-
var CLI_VERSION = "0.2.
|
|
49089
|
+
var CLI_VERSION = "0.2.3";
|
|
48967
49090
|
|
|
48968
49091
|
// ../cli/src/cli.ts
|
|
48969
49092
|
var HELP_HEADING = "vAPI Network";
|
|
@@ -48981,6 +49104,7 @@ Usage:
|
|
|
48981
49104
|
vapi receipts export --format <json|csv> [--range <24h|7d|30d>]
|
|
48982
49105
|
vapi stats [--range <24h|7d|30d>] [--json]
|
|
48983
49106
|
vapi sweep <address> [--network <caip2>] [--json]
|
|
49107
|
+
vapi export-key [--network <caip2>] [--json]
|
|
48984
49108
|
vapi report "<what happened>" [--include-addresses] [--send] [--json]
|
|
48985
49109
|
vapi mcp [--json]
|
|
48986
49110
|
vapi serve [--json]
|
|
@@ -49049,6 +49173,9 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
|
|
|
49049
49173
|
case "sweep":
|
|
49050
49174
|
await sweepCommand(args.slice(1), json2, io);
|
|
49051
49175
|
return 0;
|
|
49176
|
+
case "export-key":
|
|
49177
|
+
await exportKeyCommand(args.slice(1), json2, io);
|
|
49178
|
+
return 0;
|
|
49052
49179
|
case "report":
|
|
49053
49180
|
await reportCommand(args.slice(1), json2, io, dependencies);
|
|
49054
49181
|
return 0;
|
|
@@ -49088,8 +49215,18 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
49088
49215
|
if (!process.env.VAPI_HOME?.trim()) {
|
|
49089
49216
|
migrated = await migrateLegacyVapiHome({ targetDirectory: paths.directory, notice: io.stderr });
|
|
49090
49217
|
}
|
|
49218
|
+
const adopted = migrated.includes(paths.keystore);
|
|
49219
|
+
if (!adopted && await fileExists(paths.keystore)) {
|
|
49220
|
+
const address2 = await readKeystoreAddress(paths.keystore);
|
|
49221
|
+
throw new Error(
|
|
49222
|
+
[
|
|
49223
|
+
`Keystore already exists at ${paths.keystore}. Refusing to replace the local payment key.`,
|
|
49224
|
+
...address2 ? [`Address: ${address2}`] : []
|
|
49225
|
+
].join("\n")
|
|
49226
|
+
);
|
|
49227
|
+
}
|
|
49091
49228
|
const passphrase = await getKeystorePassphrase({ confirm: true });
|
|
49092
|
-
let account =
|
|
49229
|
+
let account = adopted ? await unlockKeystore(passphrase, paths.keystore) : await createKeystore(passphrase, paths.keystore, { enableSolana });
|
|
49093
49230
|
if (enableSolana && !account.solana) {
|
|
49094
49231
|
account = await enableSolanaKey(passphrase, paths.keystore);
|
|
49095
49232
|
}
|
|
@@ -49098,7 +49235,8 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
49098
49235
|
} else if (enableSolana) {
|
|
49099
49236
|
await enableDefaultNetwork("solana", paths.config);
|
|
49100
49237
|
}
|
|
49101
|
-
const
|
|
49238
|
+
const configRewrites = await migrateLegacyRegistryConfig(paths.config);
|
|
49239
|
+
const config2 = await readConfig(paths.config, io);
|
|
49102
49240
|
const accounts = await listAccounts({
|
|
49103
49241
|
address: account.address,
|
|
49104
49242
|
...account.solana ? { solanaAddress: account.solana.address } : {},
|
|
@@ -49110,6 +49248,7 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
49110
49248
|
accounts,
|
|
49111
49249
|
config: paths.config,
|
|
49112
49250
|
keystore: paths.keystore,
|
|
49251
|
+
...configRewrites.length > 0 ? { configRewrites } : {},
|
|
49113
49252
|
message: "vAPI wallet created. Its encrypted key stays on this machine.",
|
|
49114
49253
|
nextSteps: buildNextSteps(account.address)
|
|
49115
49254
|
};
|
|
@@ -49117,6 +49256,7 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
49117
49256
|
io.stdout(JSON.stringify(result));
|
|
49118
49257
|
return;
|
|
49119
49258
|
}
|
|
49259
|
+
if (configRewrites.length > 0) io.stdout(formatLegacyRegistryRewrites(configRewrites));
|
|
49120
49260
|
io.stdout(result.message);
|
|
49121
49261
|
io.stdout(`Address: ${result.address}`);
|
|
49122
49262
|
io.stdout(
|
|
@@ -49141,7 +49281,7 @@ async function fundCommand(argv, json2, io, dependencies) {
|
|
|
49141
49281
|
});
|
|
49142
49282
|
const fiatAmount = optionalUsdAmount(parsed.one("--amount"), "--amount");
|
|
49143
49283
|
const paths = getVapiPaths();
|
|
49144
|
-
const config2 = await
|
|
49284
|
+
const config2 = await readConfig(paths.config, io);
|
|
49145
49285
|
const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
|
|
49146
49286
|
const session = await createOnrampSession({
|
|
49147
49287
|
address: account.address,
|
|
@@ -49161,7 +49301,7 @@ async function searchCommand(argv, json2, io, dependencies) {
|
|
|
49161
49301
|
maximumPositionals: 1
|
|
49162
49302
|
});
|
|
49163
49303
|
const limit = optionalPositiveInteger(parsed.one("--limit"), "--limit");
|
|
49164
|
-
const config2 = await
|
|
49304
|
+
const config2 = await readConfig(getVapiPaths().config, io);
|
|
49165
49305
|
const page = await searchMarketplace(
|
|
49166
49306
|
{
|
|
49167
49307
|
...parsed.positionals[0] ? { query: parsed.positionals[0] } : {},
|
|
@@ -49185,7 +49325,7 @@ async function inspectCommand(argv, json2, io, dependencies) {
|
|
|
49185
49325
|
parsed.positionals[0],
|
|
49186
49326
|
"Usage: vapi inspect <id> [--endpoint <name>]"
|
|
49187
49327
|
);
|
|
49188
|
-
const config2 = await
|
|
49328
|
+
const config2 = await readConfig(getVapiPaths().config, io);
|
|
49189
49329
|
const result = await inspectService(
|
|
49190
49330
|
{ id, ...parsed.one("--endpoint") ? { endpoint: parsed.one("--endpoint") } : {} },
|
|
49191
49331
|
config2,
|
|
@@ -49209,7 +49349,7 @@ async function payCommand(argv, json2, io) {
|
|
|
49209
49349
|
});
|
|
49210
49350
|
const target = requiredPositional(parsed.positionals[0], "Usage: vapi pay <id-or-url> [options]");
|
|
49211
49351
|
const paths = getVapiPaths();
|
|
49212
|
-
const config2 = await
|
|
49352
|
+
const config2 = await readConfig(paths.config, io);
|
|
49213
49353
|
const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
|
|
49214
49354
|
const bodyText = parsed.one("--body");
|
|
49215
49355
|
const maxPriceUsd = aliasedOption(parsed, "--max", "--max-price-usd");
|
|
@@ -49235,7 +49375,7 @@ async function payCommand(argv, json2, io) {
|
|
|
49235
49375
|
async function balanceCommand(argv, json2, io, dependencies) {
|
|
49236
49376
|
requireNoArguments(argv, "balance");
|
|
49237
49377
|
const paths = getVapiPaths();
|
|
49238
|
-
const config2 = await
|
|
49378
|
+
const config2 = await readConfig(paths.config, io);
|
|
49239
49379
|
const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
|
|
49240
49380
|
const wallet = await getWallet(account, config2, dependencies);
|
|
49241
49381
|
output2(io, json2, wallet, formatWallet(wallet));
|
|
@@ -49253,7 +49393,7 @@ async function accountsCommand(argv, json2, io, dependencies) {
|
|
|
49253
49393
|
const passphrase = await getKeystorePassphrase();
|
|
49254
49394
|
const account = enable ? await enableSolanaKey(passphrase, paths.keystore) : await unlockKeystore(passphrase, paths.keystore);
|
|
49255
49395
|
if (enable) await enableDefaultNetwork("solana", paths.config);
|
|
49256
|
-
const config2 = await
|
|
49396
|
+
const config2 = await readConfig(paths.config, io);
|
|
49257
49397
|
const accounts = await listAccounts({
|
|
49258
49398
|
address: account.address,
|
|
49259
49399
|
...account.solana ? { solanaAddress: account.solana.address } : {},
|
|
@@ -49322,7 +49462,7 @@ async function sweepCommand(argv, json2, io) {
|
|
|
49322
49462
|
);
|
|
49323
49463
|
const requestedNetwork = parsed.one("--network");
|
|
49324
49464
|
const paths = getVapiPaths();
|
|
49325
|
-
const config2 = await
|
|
49465
|
+
const config2 = await readConfig(paths.config, io);
|
|
49326
49466
|
const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
|
|
49327
49467
|
if (requestedNetwork && !isNetworkConfigured(config2.networks, requestedNetwork)) {
|
|
49328
49468
|
throw new Error(`Network ${requestedNetwork} is not configured.`);
|
|
@@ -49366,6 +49506,33 @@ async function reportCommand(argv, json2, io, dependencies) {
|
|
|
49366
49506
|
});
|
|
49367
49507
|
output2(io, json2, result, formatSupportReport(result));
|
|
49368
49508
|
}
|
|
49509
|
+
var EXPORT_KEY_WARNING = "Anyone with this key can spend the wallet. Never paste it into a website or chat.";
|
|
49510
|
+
async function exportKeyCommand(argv, json2, io) {
|
|
49511
|
+
const parsed = parseArguments(argv, {
|
|
49512
|
+
valueOptions: /* @__PURE__ */ new Set(["--network"]),
|
|
49513
|
+
maximumPositionals: 0
|
|
49514
|
+
});
|
|
49515
|
+
const network = parsed.one("--network") ?? BASE_MAINNET_CAIP2;
|
|
49516
|
+
const solana = isSolanaNetwork(network);
|
|
49517
|
+
if (!solana && !network.startsWith("eip155:")) {
|
|
49518
|
+
throw new UsageError("--network must be an eip155:<chainId> or Solana network identifier.");
|
|
49519
|
+
}
|
|
49520
|
+
const paths = getVapiPaths();
|
|
49521
|
+
const keys = await exportKeystoreKeys(await getKeystorePassphrase(), paths.keystore);
|
|
49522
|
+
if (solana && !keys.solana) {
|
|
49523
|
+
throw new Error(
|
|
49524
|
+
`No Solana key is enabled in ${paths.keystore}. Run vapi accounts --enable solana first.`
|
|
49525
|
+
);
|
|
49526
|
+
}
|
|
49527
|
+
const selected = solana && keys.solana ? keys.solana : keys.evm;
|
|
49528
|
+
const result = {
|
|
49529
|
+
network,
|
|
49530
|
+
address: selected.address,
|
|
49531
|
+
privateKey: "secretKey" in selected ? selected.secretKey : selected.privateKey
|
|
49532
|
+
};
|
|
49533
|
+
io.stderr(EXPORT_KEY_WARNING);
|
|
49534
|
+
io.stdout(json2 ? JSON.stringify(result) : result.privateKey);
|
|
49535
|
+
}
|
|
49369
49536
|
async function mcpCommand(argv) {
|
|
49370
49537
|
requireNoArguments(argv, "mcp");
|
|
49371
49538
|
const paths = getVapiPaths();
|
|
@@ -49379,6 +49546,9 @@ async function mcpCommand(argv) {
|
|
|
49379
49546
|
searchesPath: paths.searches
|
|
49380
49547
|
});
|
|
49381
49548
|
}
|
|
49549
|
+
async function readConfig(path, io) {
|
|
49550
|
+
return await loadConfig(path, process.env, { notice: io.stderr });
|
|
49551
|
+
}
|
|
49382
49552
|
function output2(io, json2, value, human) {
|
|
49383
49553
|
io.stdout(json2 ? JSON.stringify(value) : human);
|
|
49384
49554
|
}
|