@1sat/cli 0.0.128 → 0.0.130
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 +1 -1
- package/dist/cli.js +32 -10
- package/package.json +9 -9
- package/src/commands/messagebox.ts +15 -4
- package/src/commands/opns.ts +11 -2
- package/src/help.ts +10 -4
package/README.md
CHANGED
|
@@ -224,7 +224,7 @@ OpNS (Ordinals Name System) binds your BAP identity to an on-chain name inscript
|
|
|
224
224
|
|
|
225
225
|
```bash
|
|
226
226
|
1sat opns lookup # List OpNS names in your wallet
|
|
227
|
-
1sat opns register --
|
|
227
|
+
1sat opns register --id <id> --domain <host> # Bind your identity to a name
|
|
228
228
|
1sat opns deregister --outpoint <txid.vout> # Remove the identity binding
|
|
229
229
|
```
|
|
230
230
|
|
package/dist/cli.js
CHANGED
|
@@ -1362,7 +1362,12 @@ var init_help = __esm(() => {
|
|
|
1362
1362
|
{
|
|
1363
1363
|
name: "register",
|
|
1364
1364
|
description: "Register identity on an owned OpNS name",
|
|
1365
|
-
args: [
|
|
1365
|
+
args: [
|
|
1366
|
+
{ flag: "--id", values: "<tracking-id>", required: true },
|
|
1367
|
+
{ flag: "--domain", values: "<hostname>", required: true },
|
|
1368
|
+
{ flag: "--name", values: "<display name>" },
|
|
1369
|
+
{ flag: "--avatar", values: "<txid_vout>" }
|
|
1370
|
+
]
|
|
1366
1371
|
},
|
|
1367
1372
|
{
|
|
1368
1373
|
name: "deregister",
|
|
@@ -1418,11 +1423,11 @@ var init_help = __esm(() => {
|
|
|
1418
1423
|
{
|
|
1419
1424
|
group: "Wallet",
|
|
1420
1425
|
name: "messagebox",
|
|
1421
|
-
description: "MessageBox
|
|
1426
|
+
description: "MessageBox inboxes (paymail remittances, BRC-169 handle payments). Not the same as `wallet sync` (address/owner scan).",
|
|
1422
1427
|
subcommands: [
|
|
1423
1428
|
{
|
|
1424
1429
|
name: "sync",
|
|
1425
|
-
description: "Pull payment_inbox (default) and internalize paymail payments",
|
|
1430
|
+
description: "Pull payment_inbox (default) and internalize paymail payments, then metanet_inbox (BRC-169 handle payments)",
|
|
1426
1431
|
args: [
|
|
1427
1432
|
{
|
|
1428
1433
|
flag: "--url",
|
|
@@ -1432,7 +1437,7 @@ var init_help = __esm(() => {
|
|
|
1432
1437
|
{
|
|
1433
1438
|
flag: "--box",
|
|
1434
1439
|
values: "<name>",
|
|
1435
|
-
description: "
|
|
1440
|
+
description: "Paymail inbox name (default payment_inbox); metanet_inbox is always pulled"
|
|
1436
1441
|
}
|
|
1437
1442
|
]
|
|
1438
1443
|
}
|
|
@@ -2609,7 +2614,7 @@ var init_mcp_proxy = __esm(() => {
|
|
|
2609
2614
|
});
|
|
2610
2615
|
|
|
2611
2616
|
// src/commands/messagebox.ts
|
|
2612
|
-
import { syncMessages } from "@1sat/actions";
|
|
2617
|
+
import { syncMessages, syncMetanetInbox } from "@1sat/actions";
|
|
2613
2618
|
async function handleMessageboxCommand(args, opts) {
|
|
2614
2619
|
const [subcommand, ...rest] = args;
|
|
2615
2620
|
switch (subcommand) {
|
|
@@ -2634,13 +2639,20 @@ async function messageboxSync(args, opts) {
|
|
|
2634
2639
|
...url ? { messageboxUrl: url } : {},
|
|
2635
2640
|
...box ? { messageBox: box } : {}
|
|
2636
2641
|
});
|
|
2642
|
+
const metanet = await syncMetanetInbox.execute(ctx, {
|
|
2643
|
+
...url ? { messageboxUrl: url } : {}
|
|
2644
|
+
});
|
|
2637
2645
|
if (opts.json) {
|
|
2638
|
-
output(result, opts);
|
|
2646
|
+
output({ ...result, metanet }, opts);
|
|
2639
2647
|
return;
|
|
2640
2648
|
}
|
|
2641
2649
|
console.log(`
|
|
2642
|
-
processed: ${result.processed} failed: ${result.failed}
|
|
2643
|
-
`);
|
|
2650
|
+
processed: ${result.processed} failed: ${result.failed}`);
|
|
2651
|
+
console.log(`metanet_inbox: received ${metanet.received.length} skipped ${metanet.skipped.length}${metanet.error ? ` error: ${metanet.error}` : ""}`);
|
|
2652
|
+
for (const s of metanet.skipped) {
|
|
2653
|
+
console.log(` skipped ${s.messageId}: ${s.reason}`);
|
|
2654
|
+
}
|
|
2655
|
+
console.log();
|
|
2644
2656
|
} finally {
|
|
2645
2657
|
await destroy();
|
|
2646
2658
|
}
|
|
@@ -2700,9 +2712,19 @@ function requireId(args) {
|
|
|
2700
2712
|
}
|
|
2701
2713
|
async function opnsRegister(args, opts) {
|
|
2702
2714
|
const id = requireId(args);
|
|
2715
|
+
const domain = extractFlag(args, "--domain");
|
|
2716
|
+
if (!domain)
|
|
2717
|
+
fatal("Missing --domain <hostname> (e.g. 1sat.name)");
|
|
2718
|
+
const name = extractFlag(args, "--name");
|
|
2719
|
+
const avatar = extractFlag(args, "--avatar");
|
|
2720
|
+
const profile = {
|
|
2721
|
+
domain,
|
|
2722
|
+
...name ? { name } : {},
|
|
2723
|
+
...avatar ? { avatar } : {}
|
|
2724
|
+
};
|
|
2703
2725
|
if (!opts.yes) {
|
|
2704
2726
|
const ok = await confirm4({
|
|
2705
|
-
message: `Register identity on OpNS id ${id}?`
|
|
2727
|
+
message: `Register identity on OpNS id ${id} at ${domain}?`
|
|
2706
2728
|
});
|
|
2707
2729
|
if (isCancel5(ok) || !ok)
|
|
2708
2730
|
fatal("Registration cancelled.");
|
|
@@ -2710,7 +2732,7 @@ async function opnsRegister(args, opts) {
|
|
|
2710
2732
|
const privateKey = await loadKey();
|
|
2711
2733
|
const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain });
|
|
2712
2734
|
try {
|
|
2713
|
-
const result = await registerOpns.execute(ctx, { id });
|
|
2735
|
+
const result = await registerOpns.execute(ctx, { id, profile });
|
|
2714
2736
|
if (result.error)
|
|
2715
2737
|
fatal(result.error);
|
|
2716
2738
|
output(opts.json ? result : { txid: result.txid }, opts);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.130",
|
|
4
4
|
"description": "CLI for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
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": "0.0.
|
|
34
|
-
"@1sat/wallet-node": "0.0.
|
|
35
|
-
"@1sat/wallet-server": "0.0.
|
|
30
|
+
"@1sat/actions": "0.0.232",
|
|
31
|
+
"@1sat/client": "0.0.61",
|
|
32
|
+
"@1sat/types": "0.0.52",
|
|
33
|
+
"@1sat/wallet": "0.0.118",
|
|
34
|
+
"@1sat/wallet-node": "0.0.85",
|
|
35
|
+
"@1sat/wallet-server": "0.0.63",
|
|
36
36
|
"@bopen-io/messagebox-server": "^1.3.2",
|
|
37
37
|
"@bsv/sdk": "^2.6.0",
|
|
38
|
-
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.14.
|
|
39
|
-
"@bsv/wallet-toolbox-client": "npm:@bopen-io/wallet-toolbox-client@2.14.
|
|
38
|
+
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.14.6",
|
|
39
|
+
"@bsv/wallet-toolbox-client": "npm:@bopen-io/wallet-toolbox-client@2.14.6",
|
|
40
40
|
"@clack/prompts": "^0.8.0",
|
|
41
41
|
"bitcoin-backup": "^0.0.11",
|
|
42
42
|
"chalk": "^5.0.0",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MessageBox commands — pull paymail / P2P inbox
|
|
2
|
+
* MessageBox commands — pull paymail / P2P inbox and BRC-169 handle
|
|
3
|
+
* payments (`metanet_inbox`) into the wallet.
|
|
3
4
|
*
|
|
4
5
|
* 1sat messagebox sync [--url <host>] [--box <name>]
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
|
-
import { syncMessages } from '@1sat/actions'
|
|
8
|
+
import { syncMessages, syncMetanetInbox } from '@1sat/actions'
|
|
8
9
|
import type { GlobalFlags } from '../args.js'
|
|
9
10
|
import { extractFlag } from '../args.js'
|
|
10
11
|
import { loadContext } from '../context.js'
|
|
@@ -46,13 +47,23 @@ async function messageboxSync(
|
|
|
46
47
|
...(url ? { messageboxUrl: url } : {}),
|
|
47
48
|
...(box ? { messageBox: box } : {}),
|
|
48
49
|
})
|
|
50
|
+
const metanet = await syncMetanetInbox.execute(ctx, {
|
|
51
|
+
...(url ? { messageboxUrl: url } : {}),
|
|
52
|
+
})
|
|
49
53
|
|
|
50
54
|
if (opts.json) {
|
|
51
|
-
output(result, opts)
|
|
55
|
+
output({ ...result, metanet }, opts)
|
|
52
56
|
return
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
console.log(`\nprocessed: ${result.processed} failed: ${result.failed}
|
|
59
|
+
console.log(`\nprocessed: ${result.processed} failed: ${result.failed}`)
|
|
60
|
+
console.log(
|
|
61
|
+
`metanet_inbox: received ${metanet.received.length} skipped ${metanet.skipped.length}${metanet.error ? ` error: ${metanet.error}` : ''}`,
|
|
62
|
+
)
|
|
63
|
+
for (const s of metanet.skipped) {
|
|
64
|
+
console.log(` skipped ${s.messageId}: ${s.reason}`)
|
|
65
|
+
}
|
|
66
|
+
console.log()
|
|
56
67
|
} finally {
|
|
57
68
|
await destroy()
|
|
58
69
|
}
|
package/src/commands/opns.ts
CHANGED
|
@@ -62,10 +62,19 @@ function requireId(args: string[]): string {
|
|
|
62
62
|
|
|
63
63
|
async function opnsRegister(args: string[], opts: GlobalFlags): Promise<void> {
|
|
64
64
|
const id = requireId(args)
|
|
65
|
+
const domain = extractFlag(args, '--domain')
|
|
66
|
+
if (!domain) fatal('Missing --domain <hostname> (e.g. 1sat.name)')
|
|
67
|
+
const name = extractFlag(args, '--name')
|
|
68
|
+
const avatar = extractFlag(args, '--avatar')
|
|
69
|
+
const profile = {
|
|
70
|
+
domain,
|
|
71
|
+
...(name ? { name } : {}),
|
|
72
|
+
...(avatar ? { avatar } : {}),
|
|
73
|
+
}
|
|
65
74
|
|
|
66
75
|
if (!opts.yes) {
|
|
67
76
|
const ok = await confirm({
|
|
68
|
-
message: `Register identity on OpNS id ${id}?`,
|
|
77
|
+
message: `Register identity on OpNS id ${id} at ${domain}?`,
|
|
69
78
|
})
|
|
70
79
|
if (isCancel(ok) || !ok) fatal('Registration cancelled.')
|
|
71
80
|
}
|
|
@@ -74,7 +83,7 @@ async function opnsRegister(args: string[], opts: GlobalFlags): Promise<void> {
|
|
|
74
83
|
const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain })
|
|
75
84
|
|
|
76
85
|
try {
|
|
77
|
-
const result = await registerOpns.execute(ctx, { id })
|
|
86
|
+
const result = await registerOpns.execute(ctx, { id, profile })
|
|
78
87
|
if (result.error) fatal(result.error)
|
|
79
88
|
output(opts.json ? result : { txid: result.txid }, opts)
|
|
80
89
|
} finally {
|
package/src/help.ts
CHANGED
|
@@ -607,7 +607,12 @@ export const COMMANDS: CommandSpec[] = [
|
|
|
607
607
|
{
|
|
608
608
|
name: 'register',
|
|
609
609
|
description: 'Register identity on an owned OpNS name',
|
|
610
|
-
args: [
|
|
610
|
+
args: [
|
|
611
|
+
{ flag: '--id', values: '<tracking-id>', required: true },
|
|
612
|
+
{ flag: '--domain', values: '<hostname>', required: true },
|
|
613
|
+
{ flag: '--name', values: '<display name>' },
|
|
614
|
+
{ flag: '--avatar', values: '<txid_vout>' },
|
|
615
|
+
],
|
|
611
616
|
},
|
|
612
617
|
{
|
|
613
618
|
name: 'deregister',
|
|
@@ -666,12 +671,12 @@ export const COMMANDS: CommandSpec[] = [
|
|
|
666
671
|
group: 'Wallet',
|
|
667
672
|
name: 'messagebox',
|
|
668
673
|
description:
|
|
669
|
-
'MessageBox
|
|
674
|
+
'MessageBox inboxes (paymail remittances, BRC-169 handle payments). Not the same as `wallet sync` (address/owner scan).',
|
|
670
675
|
subcommands: [
|
|
671
676
|
{
|
|
672
677
|
name: 'sync',
|
|
673
678
|
description:
|
|
674
|
-
'Pull payment_inbox (default) and internalize paymail payments',
|
|
679
|
+
'Pull payment_inbox (default) and internalize paymail payments, then metanet_inbox (BRC-169 handle payments)',
|
|
675
680
|
args: [
|
|
676
681
|
{
|
|
677
682
|
flag: '--url',
|
|
@@ -682,7 +687,8 @@ export const COMMANDS: CommandSpec[] = [
|
|
|
682
687
|
{
|
|
683
688
|
flag: '--box',
|
|
684
689
|
values: '<name>',
|
|
685
|
-
description:
|
|
690
|
+
description:
|
|
691
|
+
'Paymail inbox name (default payment_inbox); metanet_inbox is always pulled',
|
|
686
692
|
},
|
|
687
693
|
],
|
|
688
694
|
},
|