@1sat/cli 0.0.121 → 0.0.123
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/dist/cli.js +26 -33
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
res = fn(fn = 0);
|
|
6
|
-
} catch (e) {
|
|
7
|
-
err = [e];
|
|
8
|
-
}
|
|
9
|
-
if (err)
|
|
10
|
-
throw err[0];
|
|
11
|
-
return res;
|
|
12
|
-
};
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
4
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
13
5
|
|
|
14
6
|
// src/args.ts
|
|
15
7
|
function parseGlobalFlags(args) {
|
|
@@ -630,11 +622,11 @@ async function handleActionCommand(args, opts) {
|
|
|
630
622
|
Registered actions:
|
|
631
623
|
`);
|
|
632
624
|
const grouped = new Map;
|
|
633
|
-
for (const
|
|
634
|
-
const cat =
|
|
625
|
+
for (const action2 of actions) {
|
|
626
|
+
const cat = action2.meta.category;
|
|
635
627
|
if (!grouped.has(cat))
|
|
636
628
|
grouped.set(cat, []);
|
|
637
|
-
grouped.get(cat).push(
|
|
629
|
+
grouped.get(cat).push(action2);
|
|
638
630
|
}
|
|
639
631
|
for (const [category, categoryActions] of grouped) {
|
|
640
632
|
console.log(` ${category}:`);
|
|
@@ -1668,7 +1660,7 @@ function createApprovalAuth(wallet) {
|
|
|
1668
1660
|
get(target, property) {
|
|
1669
1661
|
if (property === "createAction")
|
|
1670
1662
|
return async (...args) => {
|
|
1671
|
-
const satoshis = args[0].outputs?.reduce((sum,
|
|
1663
|
+
const satoshis = args[0].outputs?.reduce((sum, output2) => sum + output2.satoshis, 0) ?? 0;
|
|
1672
1664
|
if (!Number.isSafeInteger(satoshis) || satoshis <= 0)
|
|
1673
1665
|
throw new Error("Invalid HTTP payment amount");
|
|
1674
1666
|
if (approved === false)
|
|
@@ -2192,15 +2184,15 @@ async function handleInitCommand(_args, opts) {
|
|
|
2192
2184
|
}
|
|
2193
2185
|
let wif;
|
|
2194
2186
|
if (keySource === "generate") {
|
|
2195
|
-
const
|
|
2196
|
-
wif =
|
|
2197
|
-
const
|
|
2187
|
+
const pk2 = PrivateKey2.fromRandom();
|
|
2188
|
+
wif = pk2.toWif();
|
|
2189
|
+
const address2 = pk2.toPublicKey().toAddress();
|
|
2198
2190
|
console.log();
|
|
2199
2191
|
console.log(formatWarning(" IMPORTANT: Back up your private key!"));
|
|
2200
2192
|
console.log(formatWarning(" If you lose it, your funds are gone forever."));
|
|
2201
2193
|
console.log();
|
|
2202
2194
|
console.log(` ${formatValue("WIF:")} ${wif}`);
|
|
2203
|
-
console.log(` ${formatValue("Address:")} ${
|
|
2195
|
+
console.log(` ${formatValue("Address:")} ${address2}`);
|
|
2204
2196
|
console.log();
|
|
2205
2197
|
const confirmed = await confirm2({
|
|
2206
2198
|
message: "Have you saved your private key somewhere safe?"
|
|
@@ -3516,12 +3508,12 @@ async function permissionsRevoke(args, opts) {
|
|
|
3516
3508
|
const originator = normalizeOriginator2(origin);
|
|
3517
3509
|
const { store, path } = openStore(opts);
|
|
3518
3510
|
if (hasFlag(args, "--all")) {
|
|
3519
|
-
const
|
|
3511
|
+
const removed2 = await store.deleteAllForOriginator(originator);
|
|
3520
3512
|
if (opts.json) {
|
|
3521
|
-
output({ originator, removed, store: path }, opts);
|
|
3513
|
+
output({ originator, removed: removed2, store: path }, opts);
|
|
3522
3514
|
return;
|
|
3523
3515
|
}
|
|
3524
|
-
output(`revoked ${
|
|
3516
|
+
output(`revoked ${removed2} grant(s) for ${originator}`, opts);
|
|
3525
3517
|
return;
|
|
3526
3518
|
}
|
|
3527
3519
|
let specs;
|
|
@@ -4392,7 +4384,7 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
|
|
|
4392
4384
|
ttlSeconds: sessionStoreCfg.ttlSeconds
|
|
4393
4385
|
} : undefined;
|
|
4394
4386
|
if (mode === "wallet") {
|
|
4395
|
-
const
|
|
4387
|
+
const handle2 = createWalletServer({
|
|
4396
4388
|
wallet: walletResult.wallet,
|
|
4397
4389
|
storage: walletResult.getActiveStorage(),
|
|
4398
4390
|
serverIdentityKey: walletResult.wallet.identityKey,
|
|
@@ -4402,10 +4394,10 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
|
|
|
4402
4394
|
accounts: accounts?.walletServerAccounts,
|
|
4403
4395
|
sessionStore
|
|
4404
4396
|
});
|
|
4405
|
-
const
|
|
4406
|
-
const
|
|
4407
|
-
console.log(`[wallet] listening on ${resolved.host}:${
|
|
4408
|
-
return { stop: () =>
|
|
4397
|
+
const port2 = await handle2.start();
|
|
4398
|
+
const notes2 = [resolved.accounts.enabled ? "accounts: on" : ""].filter(Boolean).join(", ");
|
|
4399
|
+
console.log(`[wallet] listening on ${resolved.host}:${port2}${notes2 ? ` (${notes2})` : ""}`);
|
|
4400
|
+
return { stop: () => handle2.stop() };
|
|
4409
4401
|
}
|
|
4410
4402
|
const serverCfg = config.server ?? {};
|
|
4411
4403
|
const paymailCfg = serverCfg.paymail;
|
|
@@ -4705,11 +4697,11 @@ function selectedSweepClasses(only, skip) {
|
|
|
4705
4697
|
throw new Error("--only and --skip are mutually exclusive");
|
|
4706
4698
|
}
|
|
4707
4699
|
if (only) {
|
|
4708
|
-
const
|
|
4709
|
-
if (
|
|
4700
|
+
const selected2 = parseSweepClasses(only, "--only");
|
|
4701
|
+
if (selected2.size === 0) {
|
|
4710
4702
|
throw new Error("--only requires at least one class");
|
|
4711
4703
|
}
|
|
4712
|
-
return
|
|
4704
|
+
return selected2;
|
|
4713
4705
|
}
|
|
4714
4706
|
const selected = new Set(SWEEP_CLASSES);
|
|
4715
4707
|
if (skip) {
|
|
@@ -5812,8 +5804,8 @@ async function walletListOutputs(args, opts) {
|
|
|
5812
5804
|
${result.totalOutputs} total outputs in basket '${basket}':
|
|
5813
5805
|
`);
|
|
5814
5806
|
for (const out of result.outputs) {
|
|
5815
|
-
const
|
|
5816
|
-
console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${
|
|
5807
|
+
const tags2 = out.tags?.join(", ") || "none";
|
|
5808
|
+
console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags2}`);
|
|
5817
5809
|
}
|
|
5818
5810
|
console.log();
|
|
5819
5811
|
}
|
|
@@ -6071,6 +6063,7 @@ var init_wallet = __esm(() => {
|
|
|
6071
6063
|
});
|
|
6072
6064
|
|
|
6073
6065
|
// src/main.ts
|
|
6066
|
+
var exports_main = {};
|
|
6074
6067
|
import { existsSync as existsSync5 } from "node:fs";
|
|
6075
6068
|
import { resolve } from "node:path";
|
|
6076
6069
|
import { config as loadEnv } from "dotenv";
|
|
@@ -6214,4 +6207,4 @@ var init_main = __esm(() => {
|
|
|
6214
6207
|
|
|
6215
6208
|
// src/cli.ts
|
|
6216
6209
|
process.env.DOTENV_CONFIG_QUIET = "true";
|
|
6217
|
-
await Promise.resolve().then(() => (init_main(),
|
|
6210
|
+
await Promise.resolve().then(() => (init_main(), exports_main));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.123",
|
|
4
4
|
"description": "CLI for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@1sat/actions": "0.0.
|
|
31
|
-
"@1sat/client": "0.0.
|
|
30
|
+
"@1sat/actions": "0.0.227",
|
|
31
|
+
"@1sat/client": "0.0.56",
|
|
32
32
|
"@1sat/types": "0.0.48",
|
|
33
|
-
"@1sat/wallet": "0.0.
|
|
34
|
-
"@1sat/wallet-node": "0.0.
|
|
35
|
-
"@1sat/wallet-server": "0.0.
|
|
33
|
+
"@1sat/wallet": "0.0.113",
|
|
34
|
+
"@1sat/wallet-node": "0.0.80",
|
|
35
|
+
"@1sat/wallet-server": "0.0.57",
|
|
36
36
|
"@bopen-io/messagebox-server": "^1.3.2",
|
|
37
37
|
"@bsv/sdk": "^2.6.0",
|
|
38
|
-
"@bsv/wallet-toolbox": "
|
|
38
|
+
"@bsv/wallet-toolbox": "^2.14.4",
|
|
39
39
|
"@clack/prompts": "^0.8.0",
|
|
40
40
|
"bitcoin-backup": "^0.0.11",
|
|
41
41
|
"chalk": "^5.0.0",
|