@1sat/cli 0.0.101 → 0.0.103
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 +8 -2
- package/dist/cli.js +5157 -0
- package/package.json +18 -13
- package/src/beef.ts +1 -1
- package/src/cli.ts +0 -2
- package/src/commands/action.ts +4 -4
- package/src/commands/authfetch.ts +5 -5
- package/src/commands/config.ts +4 -4
- package/src/commands/identity.ts +6 -6
- package/src/commands/init.ts +4 -4
- package/src/commands/locks.ts +7 -7
- package/src/commands/mcp-proxy.ts +2 -6
- package/src/commands/messagebox.ts +6 -6
- package/src/commands/opns.ts +7 -7
- package/src/commands/ordinals.ts +7 -7
- package/src/commands/remote.ts +6 -6
- package/src/commands/serve.ts +21 -48
- package/src/commands/social.ts +6 -6
- package/src/commands/storage.ts +11 -12
- package/src/commands/sweep.ts +6 -6
- package/src/commands/tokens.ts +6 -6
- package/src/commands/tx.ts +3 -3
- package/src/commands/wallet.ts +9 -7
- package/src/config.ts +9 -29
- package/src/context.ts +2 -2
- package/src/help.ts +2 -2
- package/src/keys.ts +1 -1
- package/src/main.ts +27 -22
- package/src/monitor-lock.ts +1 -4
- package/src/monitor-once.ts +3 -3
- package/src/repricer/buildPriceUpdateTask.ts +2 -2
- package/src/repricer/computeReprice.ts +1 -1
- package/src/repricer/index.ts +8 -8
- package/src/repricer/providers.ts +2 -2
- package/src/repricer/whatsOnChain.ts +1 -1
- package/scripts/check-bun.cjs +0 -17
- package/scripts/resubmit-bsv21-discovery.ts +0 -33
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"description": "CLI for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./
|
|
6
|
+
"main": "./dist/cli.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"1sat": "./
|
|
8
|
+
"1sat": "./dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"build": "bun build ./src/cli.ts --compile --outfile=bin/1sat --external pg --external pg-native --external pg-query-stream --external tedious --external oracledb --external mysql --external mariadb --external 'mariadb/*'",
|
|
15
|
+
"build": "bun build ./src/cli.ts --target=node --packages=external --outfile=dist/cli.js --banner='#!/usr/bin/env node'",
|
|
16
|
+
"build:bin": "bun build ./src/cli.ts --compile --outfile=bin/1sat --external pg --external pg-native --external pg-query-stream --external tedious --external oracledb --external mysql --external mariadb --external 'mariadb/*'",
|
|
17
17
|
"dev": "bun run src/cli.ts",
|
|
18
18
|
"lint": "biome check src",
|
|
19
|
-
"test": "bun test"
|
|
19
|
+
"test": "bun test",
|
|
20
|
+
"test:node": "node scripts/node-smoke.mjs"
|
|
20
21
|
},
|
|
21
22
|
"keywords": [
|
|
22
23
|
"1sat",
|
|
@@ -26,11 +27,11 @@
|
|
|
26
27
|
],
|
|
27
28
|
"license": "MIT",
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@1sat/actions": "0.0.
|
|
30
|
-
"@1sat/client": "0.0.
|
|
31
|
-
"@1sat/types": "0.0.
|
|
32
|
-
"@1sat/wallet-node": "0.0.
|
|
33
|
-
"@1sat/wallet-server": "0.0.
|
|
30
|
+
"@1sat/actions": "0.0.204",
|
|
31
|
+
"@1sat/client": "0.0.51",
|
|
32
|
+
"@1sat/types": "0.0.41",
|
|
33
|
+
"@1sat/wallet-node": "0.0.71",
|
|
34
|
+
"@1sat/wallet-server": "0.0.47",
|
|
34
35
|
"@bsv/sdk": "^2.1.9",
|
|
35
36
|
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.6.2-brc153.5",
|
|
36
37
|
"chalk": "^5.0.0",
|
|
@@ -46,5 +47,9 @@
|
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/bun": "^1.3.9",
|
|
48
49
|
"typescript": "^5.9.3"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=22.13",
|
|
53
|
+
"bun": ">=1.2"
|
|
49
54
|
}
|
|
50
55
|
}
|
package/src/beef.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { readFileSync } from 'node:fs'
|
|
5
5
|
import { Utils } from '@bsv/sdk'
|
|
6
|
-
import { fatal } from './output'
|
|
6
|
+
import { fatal } from './output.js'
|
|
7
7
|
|
|
8
8
|
export function parseBeefFlag(value: string | undefined): number[] | undefined {
|
|
9
9
|
if (!value) return undefined
|
package/src/cli.ts
CHANGED
package/src/commands/action.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { actionRegistry } from '@1sat/actions'
|
|
9
|
-
import type { GlobalFlags } from '../args'
|
|
10
|
-
import { loadContext } from '../context'
|
|
11
|
-
import { loadKey } from '../keys'
|
|
12
|
-
import { fatal, output } from '../output'
|
|
9
|
+
import type { GlobalFlags } from '../args.js'
|
|
10
|
+
import { loadContext } from '../context.js'
|
|
11
|
+
import { loadKey } from '../keys.js'
|
|
12
|
+
import { fatal, output } from '../output.js'
|
|
13
13
|
|
|
14
14
|
export async function handleActionCommand(
|
|
15
15
|
args: string[],
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
import { readFileSync } from 'node:fs'
|
|
11
11
|
import { AuthFetch } from '@bsv/sdk'
|
|
12
12
|
import { confirm, isCancel } from '@clack/prompts'
|
|
13
|
-
import type { GlobalFlags } from '../args'
|
|
14
|
-
import { loadContext } from '../context'
|
|
15
|
-
import { printCommandHelp } from '../help'
|
|
16
|
-
import { loadKey } from '../keys'
|
|
17
|
-
import { fatal, output } from '../output'
|
|
13
|
+
import type { GlobalFlags } from '../args.js'
|
|
14
|
+
import { loadContext } from '../context.js'
|
|
15
|
+
import { printCommandHelp } from '../help.js'
|
|
16
|
+
import { loadKey } from '../keys.js'
|
|
17
|
+
import { fatal, output } from '../output.js'
|
|
18
18
|
|
|
19
19
|
const METHODS = new Set([
|
|
20
20
|
'GET',
|
package/src/commands/config.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* path - Print config directory path
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { GlobalFlags } from '../args'
|
|
11
|
+
import type { GlobalFlags } from '../args.js'
|
|
12
12
|
import {
|
|
13
13
|
getConfigDir,
|
|
14
14
|
getConfigFile,
|
|
@@ -16,15 +16,15 @@ import {
|
|
|
16
16
|
parseConfigValue,
|
|
17
17
|
setConfigPath,
|
|
18
18
|
unsetConfigPath,
|
|
19
|
-
} from '../config'
|
|
20
|
-
import { printCommandHelp } from '../help'
|
|
19
|
+
} from '../config.js'
|
|
20
|
+
import { printCommandHelp } from '../help.js'
|
|
21
21
|
import {
|
|
22
22
|
fatal,
|
|
23
23
|
formatLabel,
|
|
24
24
|
formatSuccess,
|
|
25
25
|
formatValue,
|
|
26
26
|
output,
|
|
27
|
-
} from '../output'
|
|
27
|
+
} from '../output.js'
|
|
28
28
|
|
|
29
29
|
export async function handleConfigCommand(
|
|
30
30
|
args: string[],
|
package/src/commands/identity.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { publishIdentity, signBsm, updateProfile } from '@1sat/actions'
|
|
8
|
-
import type { GlobalFlags } from '../args'
|
|
9
|
-
import { extractFlag } from '../args'
|
|
10
|
-
import { loadContext } from '../context'
|
|
11
|
-
import { printCommandHelp } from '../help'
|
|
12
|
-
import { loadKey } from '../keys'
|
|
13
|
-
import { fatal, output, printKeyValue } from '../output'
|
|
8
|
+
import type { GlobalFlags } from '../args.js'
|
|
9
|
+
import { extractFlag } from '../args.js'
|
|
10
|
+
import { loadContext } from '../context.js'
|
|
11
|
+
import { printCommandHelp } from '../help.js'
|
|
12
|
+
import { loadKey } from '../keys.js'
|
|
13
|
+
import { fatal, output, printKeyValue } from '../output.js'
|
|
14
14
|
|
|
15
15
|
export async function handleIdentityCommand(
|
|
16
16
|
args: string[],
|
package/src/commands/init.ts
CHANGED
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
select,
|
|
21
21
|
text,
|
|
22
22
|
} from '@clack/prompts'
|
|
23
|
-
import type { GlobalFlags } from '../args'
|
|
24
|
-
import { ensureConfigDir, loadConfig, saveConfig } from '../config'
|
|
25
|
-
import { hasKey, saveKey } from '../keys'
|
|
26
|
-
import { fatal, formatSuccess, formatValue, formatWarning } from '../output'
|
|
23
|
+
import type { GlobalFlags } from '../args.js'
|
|
24
|
+
import { ensureConfigDir, loadConfig, saveConfig } from '../config.js'
|
|
25
|
+
import { hasKey, saveKey } from '../keys.js'
|
|
26
|
+
import { fatal, formatSuccess, formatValue, formatWarning } from '../output.js'
|
|
27
27
|
|
|
28
28
|
export async function handleInitCommand(
|
|
29
29
|
_args: string[],
|
package/src/commands/locks.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { listLocks, lockBsv, unlockBsv } from '@1sat/actions'
|
|
6
6
|
import { confirm, isCancel } from '@clack/prompts'
|
|
7
|
-
import type { GlobalFlags } from '../args'
|
|
8
|
-
import { extractFlag } from '../args'
|
|
9
|
-
import { idFromTags } from '../beef'
|
|
10
|
-
import { loadContext } from '../context'
|
|
11
|
-
import { printCommandHelp } from '../help'
|
|
12
|
-
import { loadKey } from '../keys'
|
|
13
|
-
import { fatal, formatLabel, formatValue, output } from '../output'
|
|
7
|
+
import type { GlobalFlags } from '../args.js'
|
|
8
|
+
import { extractFlag } from '../args.js'
|
|
9
|
+
import { idFromTags } from '../beef.js'
|
|
10
|
+
import { loadContext } from '../context.js'
|
|
11
|
+
import { printCommandHelp } from '../help.js'
|
|
12
|
+
import { loadKey } from '../keys.js'
|
|
13
|
+
import { fatal, formatLabel, formatValue, output } from '../output.js'
|
|
14
14
|
|
|
15
15
|
export async function handleLocksCommand(
|
|
16
16
|
args: string[],
|
|
@@ -145,14 +145,10 @@ export async function handleMcpProxyCommand(): Promise<void> {
|
|
|
145
145
|
let mcpSessionId: string | null = null
|
|
146
146
|
let requestCount = 0
|
|
147
147
|
const decoder = new TextDecoder()
|
|
148
|
-
const reader = Bun.stdin.stream().getReader()
|
|
149
148
|
let buffer = ''
|
|
150
149
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (done) break
|
|
154
|
-
|
|
155
|
-
buffer += decoder.decode(value, { stream: true })
|
|
150
|
+
for await (const value of process.stdin) {
|
|
151
|
+
buffer += decoder.decode(value as Uint8Array, { stream: true })
|
|
156
152
|
|
|
157
153
|
let newlineIdx: number
|
|
158
154
|
while ((newlineIdx = buffer.indexOf('\n')) !== -1) {
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { syncMessages } from '@1sat/actions'
|
|
8
|
-
import type { GlobalFlags } from '../args'
|
|
9
|
-
import { extractFlag } from '../args'
|
|
10
|
-
import { loadContext } from '../context'
|
|
11
|
-
import { printCommandHelp } from '../help'
|
|
12
|
-
import { loadKey } from '../keys'
|
|
13
|
-
import { output } from '../output'
|
|
8
|
+
import type { GlobalFlags } from '../args.js'
|
|
9
|
+
import { extractFlag } from '../args.js'
|
|
10
|
+
import { loadContext } from '../context.js'
|
|
11
|
+
import { printCommandHelp } from '../help.js'
|
|
12
|
+
import { loadKey } from '../keys.js'
|
|
13
|
+
import { output } from '../output.js'
|
|
14
14
|
|
|
15
15
|
export async function handleMessageboxCommand(
|
|
16
16
|
args: string[],
|
package/src/commands/opns.ts
CHANGED
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
} from '@1sat/actions'
|
|
16
16
|
import { P1SAT_PROTOCOL } from '@1sat/types'
|
|
17
17
|
import { confirm, isCancel } from '@clack/prompts'
|
|
18
|
-
import type { GlobalFlags } from '../args'
|
|
19
|
-
import { extractFlag } from '../args'
|
|
20
|
-
import { idFromTags, parseBeefFlag, parseToFlag } from '../beef'
|
|
21
|
-
import { loadContext } from '../context'
|
|
22
|
-
import { printCommandHelp } from '../help'
|
|
23
|
-
import { loadKey } from '../keys'
|
|
24
|
-
import { fatal, formatLabel, formatValue, output } from '../output'
|
|
18
|
+
import type { GlobalFlags } from '../args.js'
|
|
19
|
+
import { extractFlag } from '../args.js'
|
|
20
|
+
import { idFromTags, parseBeefFlag, parseToFlag } from '../beef.js'
|
|
21
|
+
import { loadContext } from '../context.js'
|
|
22
|
+
import { printCommandHelp } from '../help.js'
|
|
23
|
+
import { loadKey } from '../keys.js'
|
|
24
|
+
import { fatal, formatLabel, formatValue, output } from '../output.js'
|
|
25
25
|
|
|
26
26
|
export async function handleOpnsCommand(
|
|
27
27
|
args: string[],
|
package/src/commands/ordinals.ts
CHANGED
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
} from '@1sat/actions'
|
|
17
17
|
import { Utils } from '@bsv/sdk'
|
|
18
18
|
import { confirm, isCancel } from '@clack/prompts'
|
|
19
|
-
import type { GlobalFlags } from '../args'
|
|
20
|
-
import { extractFlag, hasFlag } from '../args'
|
|
21
|
-
import { idFromTags, parseBeefFlag, parseToFlag } from '../beef'
|
|
22
|
-
import { loadContext } from '../context'
|
|
23
|
-
import { printCommandHelp } from '../help'
|
|
24
|
-
import { loadKey } from '../keys'
|
|
25
|
-
import { fatal, formatLabel, formatValue, output } from '../output'
|
|
19
|
+
import type { GlobalFlags } from '../args.js'
|
|
20
|
+
import { extractFlag, hasFlag } from '../args.js'
|
|
21
|
+
import { idFromTags, parseBeefFlag, parseToFlag } from '../beef.js'
|
|
22
|
+
import { loadContext } from '../context.js'
|
|
23
|
+
import { printCommandHelp } from '../help.js'
|
|
24
|
+
import { loadKey } from '../keys.js'
|
|
25
|
+
import { fatal, formatLabel, formatValue, output } from '../output.js'
|
|
26
26
|
|
|
27
27
|
export async function handleOrdinalsCommand(
|
|
28
28
|
args: string[],
|
package/src/commands/remote.ts
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
import { StorageClient } from '@1sat/wallet-node'
|
|
12
12
|
import { WalletServerClient, topUpStorage } from '@1sat/wallet-server'
|
|
13
13
|
import { confirm, isCancel, text } from '@clack/prompts'
|
|
14
|
-
import type { GlobalFlags } from '../args'
|
|
15
|
-
import { loadConfig, saveConfig } from '../config'
|
|
16
|
-
import { loadContext } from '../context'
|
|
17
|
-
import { printCommandHelp } from '../help'
|
|
18
|
-
import { loadKey } from '../keys'
|
|
19
|
-
import { fatal, formatSuccess, formatWarning, output } from '../output'
|
|
14
|
+
import type { GlobalFlags } from '../args.js'
|
|
15
|
+
import { loadConfig, saveConfig } from '../config.js'
|
|
16
|
+
import { loadContext } from '../context.js'
|
|
17
|
+
import { printCommandHelp } from '../help.js'
|
|
18
|
+
import { loadKey } from '../keys.js'
|
|
19
|
+
import { fatal, formatSuccess, formatWarning, output } from '../output.js'
|
|
20
20
|
|
|
21
21
|
export async function handleRemoteCommand(
|
|
22
22
|
args: string[],
|
package/src/commands/serve.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `1sat serve` command — launch the unified host server and/or monitor.
|
|
3
3
|
*
|
|
4
|
-
* 1sat serve Host server (storage +
|
|
4
|
+
* 1sat serve Host server (storage + accounts + paymail + messagebox) + monitor
|
|
5
5
|
* 1sat serve wallet Wallet storage server only
|
|
6
6
|
* 1sat serve monitor Monitor daemon only
|
|
7
7
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* 1sat config set server.port 8100
|
|
14
14
|
* 1sat config set server.host 0.0.0.0
|
|
15
15
|
* 1sat config set server.accounts.enabled true
|
|
16
|
-
* 1sat config set server.
|
|
16
|
+
* 1sat config set server.paymail.userDomain 1sat.app
|
|
17
17
|
* 1sat config set server.paymail.baseUrl https://1sat.app
|
|
18
18
|
* 1sat config set server.monitor.enabled false
|
|
19
19
|
*/
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
createNodeWallet,
|
|
26
26
|
} from '@1sat/wallet-node'
|
|
27
27
|
import {
|
|
28
|
+
KnexAccountStore,
|
|
28
29
|
KnexPendingStore,
|
|
29
30
|
createHostServer,
|
|
30
31
|
createWalletServer,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
import type { PrivateKey } from '@bsv/sdk'
|
|
33
34
|
import { initLogger } from 'evlog'
|
|
34
35
|
import knexLib from 'knex'
|
|
35
|
-
import type { GlobalFlags } from '../args'
|
|
36
|
+
import type { GlobalFlags } from '../args.js'
|
|
36
37
|
import {
|
|
37
38
|
type RepricerConfig,
|
|
38
39
|
type ServerAccountsConfig,
|
|
@@ -40,18 +41,18 @@ import {
|
|
|
40
41
|
type ServerStorageConfig,
|
|
41
42
|
loadConfig,
|
|
42
43
|
setConfigPath,
|
|
43
|
-
} from '../config'
|
|
44
|
-
import { ensureDataDir } from '../config'
|
|
45
|
-
import { printCommandHelp } from '../help'
|
|
46
|
-
import { loadKey } from '../keys'
|
|
47
|
-
import { clearMonitorPid, writeMonitorPid } from '../monitor-lock'
|
|
48
|
-
import { fatal } from '../output'
|
|
44
|
+
} from '../config.js'
|
|
45
|
+
import { ensureDataDir } from '../config.js'
|
|
46
|
+
import { printCommandHelp } from '../help.js'
|
|
47
|
+
import { loadKey } from '../keys.js'
|
|
48
|
+
import { clearMonitorPid, writeMonitorPid } from '../monitor-lock.js'
|
|
49
|
+
import { fatal } from '../output.js'
|
|
49
50
|
import {
|
|
50
51
|
type RepriceTarget,
|
|
51
52
|
buildPriceUpdateTask,
|
|
52
53
|
createAccountsConfigLoader,
|
|
53
54
|
resolveRateProvider,
|
|
54
|
-
} from '../repricer'
|
|
55
|
+
} from '../repricer/index.js'
|
|
55
56
|
|
|
56
57
|
const DEFAULT_HOST = '127.0.0.1'
|
|
57
58
|
const DEFAULT_PORT = 8100
|
|
@@ -59,7 +60,6 @@ const DEFAULT_STACK_URL = 'https://api.1sat.app'
|
|
|
59
60
|
const DEFAULT_BASELINE_BYTES = 1024 * 1024 * 1024 // 1 GB
|
|
60
61
|
const DEFAULT_PURCHASE_UNIT_BYTES = 1_073_741_824 // 1 GB chunks for production
|
|
61
62
|
const DEFAULT_SATS_PER_UNIT = 1_000_000
|
|
62
|
-
const DEFAULT_HOSTING_PRICE_SATS = 10_000
|
|
63
63
|
const DEFAULT_DURATION_BLOCKS = 4383
|
|
64
64
|
const DEFAULT_STORAGE_IDENTITY_KEY = '1sat-cli-default'
|
|
65
65
|
|
|
@@ -298,18 +298,6 @@ async function runWithStorage(
|
|
|
298
298
|
},
|
|
299
299
|
})
|
|
300
300
|
}
|
|
301
|
-
const hostingCfg = loadConfig().server?.hosting
|
|
302
|
-
if (hostingCfg?.enabled === true && (hostingCfg.targetUsd ?? 0) > 0) {
|
|
303
|
-
targets.push({
|
|
304
|
-
name: 'hosting',
|
|
305
|
-
targetUsd: hostingCfg.targetUsd!,
|
|
306
|
-
readCurrentSats: () =>
|
|
307
|
-
loadConfig().server?.hosting?.priceSats ?? DEFAULT_HOSTING_PRICE_SATS,
|
|
308
|
-
onPersist: async (sats) => {
|
|
309
|
-
setConfigPath('server.hosting.priceSats', sats)
|
|
310
|
-
},
|
|
311
|
-
})
|
|
312
|
-
}
|
|
313
301
|
if (r?.enabled && targets.length > 0) {
|
|
314
302
|
walletResult.monitor.addTask(
|
|
315
303
|
buildPriceUpdateTask({
|
|
@@ -367,21 +355,6 @@ async function startWalletServer(
|
|
|
367
355
|
mode: ServeMode,
|
|
368
356
|
): Promise<{ stop(): Promise<void> }> {
|
|
369
357
|
const config = loadConfig()
|
|
370
|
-
const hostingCfg = config.server?.hosting
|
|
371
|
-
const hostingEnabled = hostingCfg?.enabled === true
|
|
372
|
-
const hosting = hostingEnabled
|
|
373
|
-
? {
|
|
374
|
-
getConfig: () => {
|
|
375
|
-
const h = loadConfig().server?.hosting
|
|
376
|
-
return {
|
|
377
|
-
enabled: h?.enabled === true,
|
|
378
|
-
priceSats: h?.priceSats ?? DEFAULT_HOSTING_PRICE_SATS,
|
|
379
|
-
priceUsd: h?.targetUsd,
|
|
380
|
-
periodSeconds: h?.periodSeconds ?? 2_592_000,
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
}
|
|
384
|
-
: undefined
|
|
385
358
|
|
|
386
359
|
const sessionStoreCfg = config.server?.sessionStore
|
|
387
360
|
const sessionStore = sessionStoreCfg?.redisUrl
|
|
@@ -400,14 +373,10 @@ async function startWalletServer(
|
|
|
400
373
|
publicPath: '/',
|
|
401
374
|
internalPath: null,
|
|
402
375
|
accounts: accounts?.walletServerAccounts,
|
|
403
|
-
hosting,
|
|
404
376
|
sessionStore,
|
|
405
377
|
})
|
|
406
378
|
const port = await handle.start()
|
|
407
|
-
const notes = [
|
|
408
|
-
resolved.accounts.enabled ? 'accounts: on' : '',
|
|
409
|
-
hostingEnabled ? 'hosting: on' : '',
|
|
410
|
-
]
|
|
379
|
+
const notes = [resolved.accounts.enabled ? 'accounts: on' : '']
|
|
411
380
|
.filter(Boolean)
|
|
412
381
|
.join(', ')
|
|
413
382
|
console.log(
|
|
@@ -416,7 +385,9 @@ async function startWalletServer(
|
|
|
416
385
|
return { stop: () => handle.stop() }
|
|
417
386
|
}
|
|
418
387
|
|
|
419
|
-
// Unified host: storage +
|
|
388
|
+
// Unified host: storage + accounts + paymail + messagebox. The account
|
|
389
|
+
// registry is always on: it is the paymail user-domain backend and the
|
|
390
|
+
// entitlement gate for paymail resolution and messagebox delivery.
|
|
420
391
|
const serverCfg = config.server ?? {}
|
|
421
392
|
const paymailCfg = serverCfg.paymail
|
|
422
393
|
const messageboxCfg = serverCfg.messagebox
|
|
@@ -428,6 +399,8 @@ async function startWalletServer(
|
|
|
428
399
|
)
|
|
429
400
|
const pendingStore = new KnexPendingStore(knex)
|
|
430
401
|
await pendingStore.init()
|
|
402
|
+
const accountStore = new KnexAccountStore(knex)
|
|
403
|
+
await accountStore.init()
|
|
431
404
|
|
|
432
405
|
const handle = await createHostServer({
|
|
433
406
|
wallet: walletResult.wallet,
|
|
@@ -436,14 +409,14 @@ async function startWalletServer(
|
|
|
436
409
|
serverIdentityKey: walletResult.wallet.identityKey,
|
|
437
410
|
listen: { port: resolved.port, host: resolved.host },
|
|
438
411
|
accounts: accounts?.walletServerAccounts,
|
|
439
|
-
|
|
412
|
+
accountStore,
|
|
440
413
|
paymail: {
|
|
441
414
|
baseUrl:
|
|
442
415
|
paymailCfg?.baseUrl ?? `http://${resolved.host}:${resolved.port}`,
|
|
443
416
|
stackUrl: paymailCfg?.stackUrl ?? resolved.stackUrl,
|
|
444
417
|
pendingStore,
|
|
445
|
-
|
|
446
|
-
|
|
418
|
+
accountStore,
|
|
419
|
+
...(paymailCfg?.userDomain && { userDomain: paymailCfg.userDomain }),
|
|
447
420
|
messageboxUrl: `http://127.0.0.1:${resolved.port}/messagebox`,
|
|
448
421
|
hostPrivateKey: resolved.privateKey,
|
|
449
422
|
},
|
|
@@ -455,7 +428,7 @@ async function startWalletServer(
|
|
|
455
428
|
const port = await handle.start()
|
|
456
429
|
const notes = [
|
|
457
430
|
resolved.accounts.enabled ? 'accounts: on' : '',
|
|
458
|
-
|
|
431
|
+
paymailCfg?.userDomain ? `paymail users: ${paymailCfg.userDomain}` : '',
|
|
459
432
|
]
|
|
460
433
|
.filter(Boolean)
|
|
461
434
|
.join(', ')
|
package/src/commands/social.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { createSocialPost } from '@1sat/actions'
|
|
8
|
-
import type { GlobalFlags } from '../args'
|
|
9
|
-
import { extractFlag, extractFlags } from '../args'
|
|
10
|
-
import { loadContext } from '../context'
|
|
11
|
-
import { printCommandHelp } from '../help'
|
|
12
|
-
import { loadKey } from '../keys'
|
|
13
|
-
import { fatal, output } from '../output'
|
|
8
|
+
import type { GlobalFlags } from '../args.js'
|
|
9
|
+
import { extractFlag, extractFlags } from '../args.js'
|
|
10
|
+
import { loadContext } from '../context.js'
|
|
11
|
+
import { printCommandHelp } from '../help.js'
|
|
12
|
+
import { loadKey } from '../keys.js'
|
|
13
|
+
import { fatal, output } from '../output.js'
|
|
14
14
|
|
|
15
15
|
export async function handleSocialCommand(
|
|
16
16
|
args: string[],
|
package/src/commands/storage.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* storage database (config under server.storage in config.json).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { nominateInvalidReqs, StorageBunSqlite } from '@1sat/wallet-node'
|
|
7
|
-
import { StorageProvider } from '@bsv/wallet-toolbox'
|
|
8
6
|
import { join } from 'node:path'
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
7
|
+
import { StorageBunSqlite, nominateInvalidReqs } from '@1sat/wallet-node'
|
|
8
|
+
import { StorageProvider } from '@bsv/wallet-toolbox'
|
|
9
|
+
import type { GlobalFlags } from '../args.js'
|
|
10
|
+
import { extractFlag } from '../args.js'
|
|
11
|
+
import { ensureDataDir, loadConfig } from '../config.js'
|
|
12
|
+
import { printCommandHelp } from '../help.js'
|
|
13
|
+
import { fatal, output } from '../output.js'
|
|
14
14
|
|
|
15
15
|
export async function handleStorageCommand(
|
|
16
16
|
args: string[],
|
|
@@ -36,10 +36,7 @@ export async function handleStorageCommand(
|
|
|
36
36
|
* to `invalid`. Safe to run against a live serve instance — same
|
|
37
37
|
* single-field status update the monitor's own review tasks perform.
|
|
38
38
|
*/
|
|
39
|
-
async function storageUnfail(
|
|
40
|
-
args: string[],
|
|
41
|
-
opts: GlobalFlags,
|
|
42
|
-
): Promise<void> {
|
|
39
|
+
async function storageUnfail(args: string[], opts: GlobalFlags): Promise<void> {
|
|
43
40
|
const rawWindow = extractFlag(args, '--window')
|
|
44
41
|
if (!rawWindow) {
|
|
45
42
|
fatal(
|
|
@@ -61,7 +58,9 @@ async function storageUnfail(
|
|
|
61
58
|
console.log('No invalid reqs in window — nothing nominated.')
|
|
62
59
|
return
|
|
63
60
|
}
|
|
64
|
-
console.log(
|
|
61
|
+
console.log(
|
|
62
|
+
`Nominated ${nominated.length} invalid req(s) for unfail review:`,
|
|
63
|
+
)
|
|
65
64
|
for (const n of nominated) {
|
|
66
65
|
console.log(` ${n.provenTxReqId} ${n.txid}`)
|
|
67
66
|
}
|
package/src/commands/sweep.ts
CHANGED
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
} from '@1sat/actions'
|
|
14
14
|
import { PrivateKey } from '@bsv/sdk'
|
|
15
15
|
import { confirm, isCancel } from '@clack/prompts'
|
|
16
|
-
import type { GlobalFlags } from '../args'
|
|
17
|
-
import { extractFlag } from '../args'
|
|
18
|
-
import { loadContext } from '../context'
|
|
19
|
-
import { printCommandHelp } from '../help'
|
|
20
|
-
import { loadKey } from '../keys'
|
|
21
|
-
import { fatal, formatLabel, formatValue, output } from '../output'
|
|
16
|
+
import type { GlobalFlags } from '../args.js'
|
|
17
|
+
import { extractFlag } from '../args.js'
|
|
18
|
+
import { loadContext } from '../context.js'
|
|
19
|
+
import { printCommandHelp } from '../help.js'
|
|
20
|
+
import { loadKey } from '../keys.js'
|
|
21
|
+
import { fatal, formatLabel, formatValue, output } from '../output.js'
|
|
22
22
|
|
|
23
23
|
export async function handleSweepCommand(
|
|
24
24
|
args: string[],
|
package/src/commands/tokens.ts
CHANGED
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
} from '@1sat/actions'
|
|
15
15
|
import type { Destination } from '@1sat/types'
|
|
16
16
|
import { confirm, isCancel } from '@clack/prompts'
|
|
17
|
-
import type { GlobalFlags } from '../args'
|
|
18
|
-
import { extractFlag } from '../args'
|
|
19
|
-
import { loadContext } from '../context'
|
|
20
|
-
import { printCommandHelp } from '../help'
|
|
21
|
-
import { loadKey } from '../keys'
|
|
22
|
-
import { fatal, formatLabel, formatValue, output } from '../output'
|
|
17
|
+
import type { GlobalFlags } from '../args.js'
|
|
18
|
+
import { extractFlag } from '../args.js'
|
|
19
|
+
import { loadContext } from '../context.js'
|
|
20
|
+
import { printCommandHelp } from '../help.js'
|
|
21
|
+
import { loadKey } from '../keys.js'
|
|
22
|
+
import { fatal, formatLabel, formatValue, output } from '../output.js'
|
|
23
23
|
|
|
24
24
|
export async function handleBsv21Command(
|
|
25
25
|
args: string[],
|
package/src/commands/tx.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Transaction } from '@bsv/sdk'
|
|
6
|
-
import type { GlobalFlags } from '../args'
|
|
7
|
-
import { printCommandHelp } from '../help'
|
|
8
|
-
import { fatal, output } from '../output'
|
|
6
|
+
import type { GlobalFlags } from '../args.js'
|
|
7
|
+
import { printCommandHelp } from '../help.js'
|
|
8
|
+
import { fatal, output } from '../output.js'
|
|
9
9
|
|
|
10
10
|
export async function handleTxCommand(
|
|
11
11
|
args: string[],
|
package/src/commands/wallet.ts
CHANGED
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
} from '@1sat/actions'
|
|
14
14
|
import type { WalletInterface } from '@bsv/sdk'
|
|
15
15
|
import { confirm, isCancel } from '@clack/prompts'
|
|
16
|
-
import type { GlobalFlags } from '../args'
|
|
17
|
-
import { extractFlag, extractFlags } from '../args'
|
|
18
|
-
import { loadContext } from '../context'
|
|
19
|
-
import { printCommandHelp } from '../help'
|
|
20
|
-
import { loadKey } from '../keys'
|
|
21
|
-
import { fatal, formatValue, output, printKeyValue } from '../output'
|
|
16
|
+
import type { GlobalFlags } from '../args.js'
|
|
17
|
+
import { extractFlag, extractFlags } from '../args.js'
|
|
18
|
+
import { loadContext } from '../context.js'
|
|
19
|
+
import { printCommandHelp } from '../help.js'
|
|
20
|
+
import { loadKey } from '../keys.js'
|
|
21
|
+
import { fatal, formatValue, output, printKeyValue } from '../output.js'
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* BRC-100 methods reached by passing the method's own args as one JSON
|
|
@@ -526,7 +526,9 @@ async function walletMigrateBaskets(
|
|
|
526
526
|
if (opts.json) {
|
|
527
527
|
output(result, opts)
|
|
528
528
|
} else {
|
|
529
|
-
console.log(
|
|
529
|
+
console.log(
|
|
530
|
+
`Moved ${result.totalMoved} output(s) across legacy baskets\n`,
|
|
531
|
+
)
|
|
530
532
|
for (const r of result.results) {
|
|
531
533
|
if (r.moved === 0 && r.errors.length === 0) continue
|
|
532
534
|
console.log(
|