@1sat/cli 0.0.41 → 0.0.43
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 -0
- package/package.json +6 -4
- package/scripts/check-bun.cjs +17 -0
- package/src/commands/config.ts +2 -2
- package/src/commands/remote.ts +1 -3
- package/src/commands/serve.ts +6 -6
- package/src/commands/wallet.ts +1 -1
- package/src/config.ts +4 -4
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"description": "CLI for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/cli.ts",
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
"1sat": "./src/cli.ts"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"src"
|
|
11
|
+
"src",
|
|
12
|
+
"scripts"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
15
|
+
"preinstall": "node scripts/check-bun.cjs",
|
|
14
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",
|
|
15
17
|
"dev": "bun run src/cli.ts",
|
|
16
18
|
"lint": "biome check src"
|
|
@@ -23,10 +25,10 @@
|
|
|
23
25
|
],
|
|
24
26
|
"license": "MIT",
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"@1sat/actions": "0.0.
|
|
28
|
+
"@1sat/actions": "0.0.109",
|
|
27
29
|
"@1sat/client": "0.0.24",
|
|
28
30
|
"@1sat/types": "0.0.18",
|
|
29
|
-
"@1sat/wallet-node": "0.0.
|
|
31
|
+
"@1sat/wallet-node": "0.0.39",
|
|
30
32
|
"@1sat/wallet-server": "0.0.9",
|
|
31
33
|
"@bsv/sdk": "^2.0.13",
|
|
32
34
|
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.1.21-parity-fix.1",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require('node:child_process')
|
|
3
|
+
|
|
4
|
+
const result = spawnSync('bun', ['--version'], { stdio: 'ignore' })
|
|
5
|
+
if (result.error || result.status !== 0) {
|
|
6
|
+
console.error('')
|
|
7
|
+
console.error('@1sat/cli requires the Bun runtime (https://bun.sh).')
|
|
8
|
+
console.error('')
|
|
9
|
+
console.error('Install Bun:')
|
|
10
|
+
console.error(' curl -fsSL https://bun.sh/install | bash')
|
|
11
|
+
console.error('')
|
|
12
|
+
console.error('Then retry:')
|
|
13
|
+
console.error(' bunx @1sat/cli # run without installing')
|
|
14
|
+
console.error(' bun add -g @1sat/cli # install globally')
|
|
15
|
+
console.error('')
|
|
16
|
+
process.exit(1)
|
|
17
|
+
}
|
package/src/commands/config.ts
CHANGED
|
@@ -133,8 +133,8 @@ function validateKnownPath(key: string, value: unknown): void {
|
|
|
133
133
|
}
|
|
134
134
|
break
|
|
135
135
|
case 'server.storage.provider':
|
|
136
|
-
if (value !== 'bun-sqlite' && value !== '
|
|
137
|
-
fatal("server.storage.provider must be 'bun-sqlite' | '
|
|
136
|
+
if (value !== 'bun-sqlite' && value !== 'pg') {
|
|
137
|
+
fatal("server.storage.provider must be 'bun-sqlite' | 'pg'")
|
|
138
138
|
}
|
|
139
139
|
break
|
|
140
140
|
case 'server.port':
|
package/src/commands/remote.ts
CHANGED
|
@@ -436,7 +436,7 @@ async function remoteTopup(args: string[], opts: GlobalFlags): Promise<void> {
|
|
|
436
436
|
})
|
|
437
437
|
|
|
438
438
|
try {
|
|
439
|
-
const result = await topUpStorage(walletResult.wallet, url
|
|
439
|
+
const result = await topUpStorage(walletResult.wallet, url)
|
|
440
440
|
|
|
441
441
|
if (opts.json) {
|
|
442
442
|
output(result, opts)
|
|
@@ -445,9 +445,7 @@ async function remoteTopup(args: string[], opts: GlobalFlags): Promise<void> {
|
|
|
445
445
|
|
|
446
446
|
console.log()
|
|
447
447
|
console.log(` ${bold('Remote:')} ${url}`)
|
|
448
|
-
console.log(` ${bold('Units bought:')} ${result.unitsBought}`)
|
|
449
448
|
console.log(` ${bold('Sats paid:')} ${result.satsPaid}`)
|
|
450
|
-
console.log(` ${bold('Payment txid:')} ${result.txid}`)
|
|
451
449
|
if (result.status.accountsEnabled) {
|
|
452
450
|
console.log()
|
|
453
451
|
console.log(
|
package/src/commands/serve.ts
CHANGED
|
@@ -126,9 +126,9 @@ async function resolveServe(opts: GlobalFlags): Promise<ResolvedServe> {
|
|
|
126
126
|
const storage: ServerStorageConfig = server.storage ?? {
|
|
127
127
|
provider: 'bun-sqlite',
|
|
128
128
|
}
|
|
129
|
-
if (storage.provider === '
|
|
129
|
+
if (storage.provider === 'pg' && !storage.dbUrl) {
|
|
130
130
|
fatal(
|
|
131
|
-
'server.storage.provider is
|
|
131
|
+
'server.storage.provider is pg but server.storage.dbUrl is not set. ' +
|
|
132
132
|
'Set it with: 1sat config set server.storage.dbUrl postgres://…',
|
|
133
133
|
)
|
|
134
134
|
}
|
|
@@ -171,11 +171,11 @@ function resolveWalletStorageConfig(
|
|
|
171
171
|
if (storage.provider === 'bun-sqlite') {
|
|
172
172
|
return { provider: 'bun-sqlite', filename: resolved.sqliteFilename }
|
|
173
173
|
}
|
|
174
|
-
if (storage.provider === '
|
|
175
|
-
return { provider: '
|
|
174
|
+
if (storage.provider === 'pg') {
|
|
175
|
+
return { provider: 'pg', dbUrl: storage.dbUrl }
|
|
176
176
|
}
|
|
177
177
|
fatal(
|
|
178
|
-
`server.storage.provider '${storage.provider}' is not supported. Use 'bun-sqlite' or '
|
|
178
|
+
`server.storage.provider '${storage.provider}' is not supported. Use 'bun-sqlite' or 'pg'.`,
|
|
179
179
|
)
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -197,7 +197,7 @@ interface Stoppable {
|
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* Construct the wallet via the same `createNodeWallet` factory the CLI
|
|
200
|
-
* uses, with storage provider (bun-sqlite /
|
|
200
|
+
* uses, with storage provider (bun-sqlite / pg) chosen from config.
|
|
201
201
|
* Server + monitor operate on that single wallet instance, so
|
|
202
202
|
* `activeRemote`, `backups`, and `storageIdentityKey` behave identically
|
|
203
203
|
* to `1sat wallet <command>`.
|
package/src/commands/wallet.ts
CHANGED
|
@@ -353,7 +353,7 @@ async function walletListActions(
|
|
|
353
353
|
|
|
354
354
|
try {
|
|
355
355
|
const listArgs: Parameters<typeof ctx.wallet.listActions>[0] = {
|
|
356
|
-
labels: labels.length > 0 ? labels : [
|
|
356
|
+
labels: labels.length > 0 ? labels : [],
|
|
357
357
|
limit,
|
|
358
358
|
}
|
|
359
359
|
|
package/src/config.ts
CHANGED
|
@@ -15,15 +15,15 @@ export interface ServerStorageBunSqliteConfig {
|
|
|
15
15
|
provider: 'bun-sqlite'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export interface
|
|
19
|
-
provider: '
|
|
20
|
-
/** Postgres connection URL (required for
|
|
18
|
+
export interface ServerStoragePgConfig {
|
|
19
|
+
provider: 'pg'
|
|
20
|
+
/** Postgres connection URL (required for pg). */
|
|
21
21
|
dbUrl: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export type ServerStorageConfig =
|
|
25
25
|
| ServerStorageBunSqliteConfig
|
|
26
|
-
|
|
|
26
|
+
| ServerStoragePgConfig
|
|
27
27
|
|
|
28
28
|
export interface ServerAccountsConfig {
|
|
29
29
|
/** Master toggle. Defaults to false when omitted. */
|