@1sat/cli 0.0.116 → 0.0.117
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 +30 -23
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __esm = (fn, res, err) => () => {
|
|
3
|
+
if (fn)
|
|
4
|
+
try {
|
|
5
|
+
res = fn(fn = 0);
|
|
6
|
+
} catch (e) {
|
|
7
|
+
err = [e];
|
|
8
|
+
}
|
|
9
|
+
if (err)
|
|
10
|
+
throw err[0];
|
|
11
|
+
return res;
|
|
12
|
+
};
|
|
5
13
|
|
|
6
14
|
// src/args.ts
|
|
7
15
|
function parseGlobalFlags(args) {
|
|
@@ -505,11 +513,11 @@ async function handleActionCommand(args, opts) {
|
|
|
505
513
|
Registered actions:
|
|
506
514
|
`);
|
|
507
515
|
const grouped = new Map;
|
|
508
|
-
for (const
|
|
509
|
-
const cat =
|
|
516
|
+
for (const action of actions) {
|
|
517
|
+
const cat = action.meta.category;
|
|
510
518
|
if (!grouped.has(cat))
|
|
511
519
|
grouped.set(cat, []);
|
|
512
|
-
grouped.get(cat).push(
|
|
520
|
+
grouped.get(cat).push(action);
|
|
513
521
|
}
|
|
514
522
|
for (const [category, categoryActions] of grouped) {
|
|
515
523
|
console.log(` ${category}:`);
|
|
@@ -1464,7 +1472,7 @@ function createApprovalAuth(wallet) {
|
|
|
1464
1472
|
get(target, property) {
|
|
1465
1473
|
if (property === "createAction")
|
|
1466
1474
|
return async (...args) => {
|
|
1467
|
-
const satoshis = args[0].outputs?.reduce((sum,
|
|
1475
|
+
const satoshis = args[0].outputs?.reduce((sum, output) => sum + output.satoshis, 0) ?? 0;
|
|
1468
1476
|
if (!Number.isSafeInteger(satoshis) || satoshis <= 0)
|
|
1469
1477
|
throw new Error("Invalid HTTP payment amount");
|
|
1470
1478
|
if (approved === false)
|
|
@@ -1988,15 +1996,15 @@ async function handleInitCommand(_args, opts) {
|
|
|
1988
1996
|
}
|
|
1989
1997
|
let wif;
|
|
1990
1998
|
if (keySource === "generate") {
|
|
1991
|
-
const
|
|
1992
|
-
wif =
|
|
1993
|
-
const
|
|
1999
|
+
const pk = PrivateKey2.fromRandom();
|
|
2000
|
+
wif = pk.toWif();
|
|
2001
|
+
const address = pk.toPublicKey().toAddress();
|
|
1994
2002
|
console.log();
|
|
1995
2003
|
console.log(formatWarning(" IMPORTANT: Back up your private key!"));
|
|
1996
2004
|
console.log(formatWarning(" If you lose it, your funds are gone forever."));
|
|
1997
2005
|
console.log();
|
|
1998
2006
|
console.log(` ${formatValue("WIF:")} ${wif}`);
|
|
1999
|
-
console.log(` ${formatValue("Address:")} ${
|
|
2007
|
+
console.log(` ${formatValue("Address:")} ${address}`);
|
|
2000
2008
|
console.log();
|
|
2001
2009
|
const confirmed = await confirm2({
|
|
2002
2010
|
message: "Have you saved your private key somewhere safe?"
|
|
@@ -3722,7 +3730,7 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
|
|
|
3722
3730
|
ttlSeconds: sessionStoreCfg.ttlSeconds
|
|
3723
3731
|
} : undefined;
|
|
3724
3732
|
if (mode === "wallet") {
|
|
3725
|
-
const
|
|
3733
|
+
const handle = createWalletServer({
|
|
3726
3734
|
wallet: walletResult.wallet,
|
|
3727
3735
|
storage: walletResult.getActiveStorage(),
|
|
3728
3736
|
serverIdentityKey: walletResult.wallet.identityKey,
|
|
@@ -3732,10 +3740,10 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
|
|
|
3732
3740
|
accounts: accounts?.walletServerAccounts,
|
|
3733
3741
|
sessionStore
|
|
3734
3742
|
});
|
|
3735
|
-
const
|
|
3736
|
-
const
|
|
3737
|
-
console.log(`[wallet] listening on ${resolved.host}:${
|
|
3738
|
-
return { stop: () =>
|
|
3743
|
+
const port = await handle.start();
|
|
3744
|
+
const notes = [resolved.accounts.enabled ? "accounts: on" : ""].filter(Boolean).join(", ");
|
|
3745
|
+
console.log(`[wallet] listening on ${resolved.host}:${port}${notes ? ` (${notes})` : ""}`);
|
|
3746
|
+
return { stop: () => handle.stop() };
|
|
3739
3747
|
}
|
|
3740
3748
|
const serverCfg = config.server ?? {};
|
|
3741
3749
|
const paymailCfg = serverCfg.paymail;
|
|
@@ -4013,11 +4021,11 @@ function selectedSweepClasses(only, skip) {
|
|
|
4013
4021
|
throw new Error("--only and --skip are mutually exclusive");
|
|
4014
4022
|
}
|
|
4015
4023
|
if (only) {
|
|
4016
|
-
const
|
|
4017
|
-
if (
|
|
4024
|
+
const selected = parseSweepClasses(only, "--only");
|
|
4025
|
+
if (selected.size === 0) {
|
|
4018
4026
|
throw new Error("--only requires at least one class");
|
|
4019
4027
|
}
|
|
4020
|
-
return
|
|
4028
|
+
return selected;
|
|
4021
4029
|
}
|
|
4022
4030
|
const selected = new Set(SWEEP_CLASSES);
|
|
4023
4031
|
if (skip) {
|
|
@@ -5120,8 +5128,8 @@ async function walletListOutputs(args, opts) {
|
|
|
5120
5128
|
${result.totalOutputs} total outputs in basket '${basket}':
|
|
5121
5129
|
`);
|
|
5122
5130
|
for (const out of result.outputs) {
|
|
5123
|
-
const
|
|
5124
|
-
console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${
|
|
5131
|
+
const tags = out.tags?.join(", ") || "none";
|
|
5132
|
+
console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags}`);
|
|
5125
5133
|
}
|
|
5126
5134
|
console.log();
|
|
5127
5135
|
}
|
|
@@ -5379,7 +5387,6 @@ var init_wallet = __esm(() => {
|
|
|
5379
5387
|
});
|
|
5380
5388
|
|
|
5381
5389
|
// src/main.ts
|
|
5382
|
-
var exports_main = {};
|
|
5383
5390
|
import { existsSync as existsSync4 } from "node:fs";
|
|
5384
5391
|
import { resolve } from "node:path";
|
|
5385
5392
|
import { config as loadEnv } from "dotenv";
|
|
@@ -5519,4 +5526,4 @@ var init_main = __esm(() => {
|
|
|
5519
5526
|
|
|
5520
5527
|
// src/cli.ts
|
|
5521
5528
|
process.env.DOTENV_CONFIG_QUIET = "true";
|
|
5522
|
-
await Promise.resolve().then(() => (init_main(),
|
|
5529
|
+
await Promise.resolve().then(() => (init_main(), {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.117",
|
|
4
4
|
"description": "CLI for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@1sat/actions": "0.0.
|
|
31
|
-
"@1sat/client": "0.0.
|
|
32
|
-
"@1sat/types": "0.0.
|
|
33
|
-
"@1sat/wallet-node": "0.0.
|
|
34
|
-
"@1sat/wallet-server": "0.0.
|
|
30
|
+
"@1sat/actions": "0.0.221",
|
|
31
|
+
"@1sat/client": "0.0.55",
|
|
32
|
+
"@1sat/types": "0.0.48",
|
|
33
|
+
"@1sat/wallet-node": "0.0.77",
|
|
34
|
+
"@1sat/wallet-server": "0.0.53",
|
|
35
35
|
"@bopen-io/messagebox-server": "^1.3.2",
|
|
36
36
|
"@bsv/sdk": "^2.6.0",
|
|
37
37
|
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.6.2-brc153.5",
|