@1sat/cli 0.0.110 → 0.0.111
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 +27 -20
- package/package.json +2 -2
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}:`);
|
|
@@ -1433,7 +1441,7 @@ function createApprovalAuth(wallet) {
|
|
|
1433
1441
|
get(target, property) {
|
|
1434
1442
|
if (property === "createAction")
|
|
1435
1443
|
return async (...args) => {
|
|
1436
|
-
const satoshis = args[0].outputs?.reduce((sum,
|
|
1444
|
+
const satoshis = args[0].outputs?.reduce((sum, output) => sum + output.satoshis, 0) ?? 0;
|
|
1437
1445
|
if (!Number.isSafeInteger(satoshis) || satoshis <= 0)
|
|
1438
1446
|
throw new Error("Invalid HTTP payment amount");
|
|
1439
1447
|
if (approved === false)
|
|
@@ -1957,15 +1965,15 @@ async function handleInitCommand(_args, opts) {
|
|
|
1957
1965
|
}
|
|
1958
1966
|
let wif;
|
|
1959
1967
|
if (keySource === "generate") {
|
|
1960
|
-
const
|
|
1961
|
-
wif =
|
|
1962
|
-
const
|
|
1968
|
+
const pk = PrivateKey2.fromRandom();
|
|
1969
|
+
wif = pk.toWif();
|
|
1970
|
+
const address = pk.toPublicKey().toAddress();
|
|
1963
1971
|
console.log();
|
|
1964
1972
|
console.log(formatWarning(" IMPORTANT: Back up your private key!"));
|
|
1965
1973
|
console.log(formatWarning(" If you lose it, your funds are gone forever."));
|
|
1966
1974
|
console.log();
|
|
1967
1975
|
console.log(` ${formatValue("WIF:")} ${wif}`);
|
|
1968
|
-
console.log(` ${formatValue("Address:")} ${
|
|
1976
|
+
console.log(` ${formatValue("Address:")} ${address}`);
|
|
1969
1977
|
console.log();
|
|
1970
1978
|
const confirmed = await confirm2({
|
|
1971
1979
|
message: "Have you saved your private key somewhere safe?"
|
|
@@ -3679,7 +3687,7 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
|
|
|
3679
3687
|
ttlSeconds: sessionStoreCfg.ttlSeconds
|
|
3680
3688
|
} : undefined;
|
|
3681
3689
|
if (mode === "wallet") {
|
|
3682
|
-
const
|
|
3690
|
+
const handle = createWalletServer({
|
|
3683
3691
|
wallet: walletResult.wallet,
|
|
3684
3692
|
storage: walletResult.getActiveStorage(),
|
|
3685
3693
|
serverIdentityKey: walletResult.wallet.identityKey,
|
|
@@ -3689,10 +3697,10 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
|
|
|
3689
3697
|
accounts: accounts?.walletServerAccounts,
|
|
3690
3698
|
sessionStore
|
|
3691
3699
|
});
|
|
3692
|
-
const
|
|
3693
|
-
const
|
|
3694
|
-
console.log(`[wallet] listening on ${resolved.host}:${
|
|
3695
|
-
return { stop: () =>
|
|
3700
|
+
const port = await handle.start();
|
|
3701
|
+
const notes = [resolved.accounts.enabled ? "accounts: on" : ""].filter(Boolean).join(", ");
|
|
3702
|
+
console.log(`[wallet] listening on ${resolved.host}:${port}${notes ? ` (${notes})` : ""}`);
|
|
3703
|
+
return { stop: () => handle.stop() };
|
|
3696
3704
|
}
|
|
3697
3705
|
const serverCfg = config.server ?? {};
|
|
3698
3706
|
const paymailCfg = serverCfg.paymail;
|
|
@@ -4859,8 +4867,8 @@ async function walletListOutputs(args, opts) {
|
|
|
4859
4867
|
${result.totalOutputs} total outputs in basket '${basket}':
|
|
4860
4868
|
`);
|
|
4861
4869
|
for (const out of result.outputs) {
|
|
4862
|
-
const
|
|
4863
|
-
console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${
|
|
4870
|
+
const tags = out.tags?.join(", ") || "none";
|
|
4871
|
+
console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags}`);
|
|
4864
4872
|
}
|
|
4865
4873
|
console.log();
|
|
4866
4874
|
}
|
|
@@ -5118,7 +5126,6 @@ var init_wallet = __esm(() => {
|
|
|
5118
5126
|
});
|
|
5119
5127
|
|
|
5120
5128
|
// src/main.ts
|
|
5121
|
-
var exports_main = {};
|
|
5122
5129
|
import { existsSync as existsSync4 } from "node:fs";
|
|
5123
5130
|
import { resolve } from "node:path";
|
|
5124
5131
|
import { config as loadEnv } from "dotenv";
|
|
@@ -5258,4 +5265,4 @@ var init_main = __esm(() => {
|
|
|
5258
5265
|
|
|
5259
5266
|
// src/cli.ts
|
|
5260
5267
|
process.env.DOTENV_CONFIG_QUIET = "true";
|
|
5261
|
-
await Promise.resolve().then(() => (init_main(),
|
|
5268
|
+
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.111",
|
|
4
4
|
"description": "CLI for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@1sat/actions": "0.0.
|
|
30
|
+
"@1sat/actions": "0.0.208",
|
|
31
31
|
"@1sat/client": "0.0.51",
|
|
32
32
|
"@1sat/types": "0.0.41",
|
|
33
33
|
"@1sat/wallet-node": "0.0.73",
|