@1sat/cli 0.0.102 → 0.0.104

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/src/config.ts CHANGED
@@ -29,8 +29,7 @@ export type ServerStorageConfig =
29
29
  * Shared repricer engine (`server.repricer`). When enabled, a monitor task
30
30
  * fetches the BSV/USD rate on the interval and rewrites each service's sats
31
31
  * price toward its own `targetUsd` (`server.accounts.targetUsd` →
32
- * `satsPerUnit`, `server.hosting.targetUsd` `priceSats`). Services with no
33
- * `targetUsd` set are left alone.
32
+ * `satsPerUnit`). Services with no `targetUsd` set are left alone.
34
33
  */
35
34
  export interface RepricerConfig {
36
35
  /** Master toggle. Defaults to false. */
@@ -112,30 +111,13 @@ export interface ServerPaymailConfig {
112
111
  */
113
112
  messageboxUrl?: string
114
113
  /**
115
- * When true, open host wallet storage and require active HOSTING_BASKET
116
- * receipt for the bound identity. Default false until subscribe path ships.
114
+ * Domain served from the host accounts table (e.g. "1sat.app").
115
+ * Aliases on this domain resolve username→identity key via registered
116
+ * accounts; every other domain (e.g. "1sat.name") keeps resolving through
117
+ * on-chain OpNS binds. Unset = OpNS for all domains. Either way an alias
118
+ * only resolves when its identity holds an account on this host.
117
119
  */
118
- requireEntitlement?: boolean
119
- /**
120
- * Wallet storage URL for entitlement listOutputs (and optional later
121
- * subscribe). Defaults to local wallet serve URL like messagebox.
122
- */
123
- walletStorageUrl?: string
124
- }
125
-
126
- export interface ServerHostingConfig {
127
- /** Master toggle. Defaults to false. */
128
- enabled?: boolean
129
- /** Sats per subscription period. */
130
- priceSats?: number
131
- /**
132
- * USD price per subscription period. Returned as `priceUsd` on the
133
- * pricing API for display, and maintained as the repricing target for
134
- * `priceSats` when `server.repricer` is enabled.
135
- */
136
- targetUsd?: number
137
- /** Period length in seconds (e.g. 2592000 ≈ 30 days). */
138
- periodSeconds?: number
120
+ userDomain?: string
139
121
  }
140
122
 
141
123
  export interface ServerSessionStoreConfig {
@@ -167,11 +149,9 @@ export interface ServerConfig {
167
149
  accounts?: ServerAccountsConfig
168
150
  /** Messagebox subcommand settings. */
169
151
  messagebox?: ServerMessageboxConfig
170
- /** Paymail subcommand settings. */
152
+ /** Paymail settings for the unified host. */
171
153
  paymail?: ServerPaymailConfig
172
- /** Hosted paymail subscription (wallet serve /hosting/*). */
173
- hosting?: ServerHostingConfig
174
- /** Shared BSV/USD repricer engine for accounts + hosting prices. */
154
+ /** Shared BSV/USD repricer engine for the accounts storage price. */
175
155
  repricer?: RepricerConfig
176
156
  /**
177
157
  * Redis-shared BRC-104 sessions. Required when multiple serve instances
package/src/context.ts CHANGED
@@ -10,8 +10,8 @@
10
10
  import { type OneSatContext, createContext } from '@1sat/actions'
11
11
  import { type NodeWalletResult, createNodeWallet } from '@1sat/wallet-node'
12
12
  import type { PrivateKey } from '@bsv/sdk'
13
- import { ensureDataDir, loadConfig } from './config'
14
- import { spawnDetachedMonitorOnce } from './monitor-once'
13
+ import { ensureDataDir, loadConfig } from './config.js'
14
+ import { spawnDetachedMonitorOnce } from './monitor-once.js'
15
15
 
16
16
  /** Extended context that includes cleanup */
17
17
  export interface CliContext {
package/src/help.ts CHANGED
@@ -714,7 +714,7 @@ export const COMMANDS: CommandSpec[] = [
714
714
  group: 'Server',
715
715
  name: 'serve',
716
716
  description:
717
- 'Run unified host server (storage + hosting + paymail + messagebox) and/or monitor (config under server.* in config.json)',
717
+ 'Run unified host server (storage + accounts + paymail + messagebox) and/or monitor (config under server.* in config.json)',
718
718
  subcommands: [
719
719
  {
720
720
  name: '(no subcommand)',
@@ -778,7 +778,7 @@ export const COMMANDS: CommandSpec[] = [
778
778
  },
779
779
  ],
780
780
  notes:
781
- "Examples:\n 1sat authfetch GET https://wallet.1sat.app/hosting/status\n 1sat authfetch GET https://wallet.1sat.app/hosting/price\n 1sat authfetch POST https://wallet.1sat.app/hosting/subscribe --body '{}' --yes",
781
+ 'Examples:\n 1sat authfetch GET https://wallet.1sat.app/account/status\n 1sat authfetch POST https://wallet.1sat.app/account/register --body \'{"username":"alice"}\' --yes\n 1sat authfetch PUT https://wallet.1sat.app/account/profile --body \'{"displayName":"Alice"}\' --yes',
782
782
  },
783
783
  {
784
784
  group: 'Advanced',
package/src/keys.ts CHANGED
@@ -17,7 +17,7 @@ import { join } from 'node:path'
17
17
  import { PrivateKey } from '@bsv/sdk'
18
18
  import { isCancel, password as promptPassword } from '@clack/prompts'
19
19
  import { type WifBackup, decryptBackup, encryptBackup } from 'bitcoin-backup'
20
- import { ensureConfigDir, getConfigDir } from './config'
20
+ import { ensureConfigDir, getConfigDir } from './config.js'
21
21
 
22
22
  const KEYS_FILE = 'keys.bep'
23
23
 
package/src/main.ts CHANGED
@@ -10,28 +10,33 @@
10
10
  import { existsSync } from 'node:fs'
11
11
  import { resolve } from 'node:path'
12
12
  import { config as loadEnv } from 'dotenv'
13
- import { parseGlobalFlags } from './args'
14
- import { handleActionCommand } from './commands/action'
15
- import { handleAuthfetchCommand } from './commands/authfetch'
16
- import { handleConfigCommand } from './commands/config'
17
- import { handleIdentityCommand } from './commands/identity'
18
- import { handleInitCommand } from './commands/init'
19
- import { handleLocksCommand } from './commands/locks'
20
- import { handleMcpProxyCommand } from './commands/mcp-proxy'
21
- import { handleMessageboxCommand } from './commands/messagebox'
22
- import { handleOpnsCommand } from './commands/opns'
23
- import { handleOrdinalsCommand } from './commands/ordinals'
24
- import { handleRemoteCommand } from './commands/remote'
25
- import { handleServeCommand } from './commands/serve'
26
- import { handleSocialCommand } from './commands/social'
27
- import { handleStorageCommand } from './commands/storage'
28
- import { handleSweepCommand } from './commands/sweep'
29
- import { handleTokensCommand } from './commands/tokens'
30
- import { handleTxCommand } from './commands/tx'
31
- import { handleWalletCommand } from './commands/wallet'
32
- import { getCommand, printCommandHelp, printHelp, printVersion } from './help'
33
- import { runMonitorOnce } from './monitor-once'
34
- import { formatError } from './output'
13
+ import { parseGlobalFlags } from './args.js'
14
+ import { handleActionCommand } from './commands/action.js'
15
+ import { handleAuthfetchCommand } from './commands/authfetch.js'
16
+ import { handleConfigCommand } from './commands/config.js'
17
+ import { handleIdentityCommand } from './commands/identity.js'
18
+ import { handleInitCommand } from './commands/init.js'
19
+ import { handleLocksCommand } from './commands/locks.js'
20
+ import { handleMcpProxyCommand } from './commands/mcp-proxy.js'
21
+ import { handleMessageboxCommand } from './commands/messagebox.js'
22
+ import { handleOpnsCommand } from './commands/opns.js'
23
+ import { handleOrdinalsCommand } from './commands/ordinals.js'
24
+ import { handleRemoteCommand } from './commands/remote.js'
25
+ import { handleServeCommand } from './commands/serve.js'
26
+ import { handleSocialCommand } from './commands/social.js'
27
+ import { handleStorageCommand } from './commands/storage.js'
28
+ import { handleSweepCommand } from './commands/sweep.js'
29
+ import { handleTokensCommand } from './commands/tokens.js'
30
+ import { handleTxCommand } from './commands/tx.js'
31
+ import { handleWalletCommand } from './commands/wallet.js'
32
+ import {
33
+ getCommand,
34
+ printCommandHelp,
35
+ printHelp,
36
+ printVersion,
37
+ } from './help.js'
38
+ import { runMonitorOnce } from './monitor-once.js'
39
+ import { formatError } from './output.js'
35
40
 
36
41
  const rawArgs = process.argv.slice(2)
37
42
 
@@ -29,10 +29,7 @@ export function writeMonitorPid(
29
29
  * contains that pid (avoids a short once-run clearing a serve owner that
30
30
  * started while the once-run was shutting down).
31
31
  */
32
- export function clearMonitorPid(
33
- dataDir: string,
34
- onlyPid?: number,
35
- ): void {
32
+ export function clearMonitorPid(dataDir: string, onlyPid?: number): void {
36
33
  const path = monitorPidPath(dataDir)
37
34
  try {
38
35
  if (onlyPid !== undefined) {
@@ -10,13 +10,13 @@ import { type SpawnOptions, spawn } from 'node:child_process'
10
10
  import { appendFileSync, closeSync, openSync } from 'node:fs'
11
11
  import { join } from 'node:path'
12
12
  import { createNodeWallet } from '@1sat/wallet-node'
13
- import { ensureDataDir, loadConfig } from './config'
14
- import { loadKey } from './keys'
13
+ import { ensureDataDir, loadConfig } from './config.js'
14
+ import { loadKey } from './keys.js'
15
15
  import {
16
16
  clearMonitorPid,
17
17
  readLiveMonitorPid,
18
18
  writeMonitorPid,
19
- } from './monitor-lock'
19
+ } from './monitor-lock.js'
20
20
 
21
21
  export const MONITOR_LOG_FILENAME = 'monitor.log'
22
22
 
@@ -1,5 +1,5 @@
1
- import { computeReprice } from './computeReprice'
2
- import type { RateProvider, RepricerBounds } from './types'
1
+ import { computeReprice } from './computeReprice.js'
2
+ import type { RateProvider, RepricerBounds } from './types.js'
3
3
 
4
4
  /** One price the repricer maintains from the shared BSV/USD quote. */
5
5
  export interface RepriceTarget {
@@ -1,4 +1,4 @@
1
- import type { ComputeRepriceInput, ComputeRepriceResult } from './types'
1
+ import type { ComputeRepriceInput, ComputeRepriceResult } from './types.js'
2
2
 
3
3
  const SATS_PER_BSV = 100_000_000
4
4
 
@@ -1,17 +1,17 @@
1
- export { buildPriceUpdateTask } from './buildPriceUpdateTask'
1
+ export { buildPriceUpdateTask } from './buildPriceUpdateTask.js'
2
2
  export type {
3
3
  PriceUpdateTaskOptions,
4
4
  RepriceTarget,
5
- } from './buildPriceUpdateTask'
6
- export { computeReprice } from './computeReprice'
7
- export { createAccountsConfigLoader } from './configLoader'
8
- export type { AccountsConfigLoaderOptions } from './configLoader'
9
- export { resolveRateProvider } from './providers'
10
- export { createWhatsOnChainProvider } from './whatsOnChain'
5
+ } from './buildPriceUpdateTask.js'
6
+ export { computeReprice } from './computeReprice.js'
7
+ export { createAccountsConfigLoader } from './configLoader.js'
8
+ export type { AccountsConfigLoaderOptions } from './configLoader.js'
9
+ export { resolveRateProvider } from './providers.js'
10
+ export { createWhatsOnChainProvider } from './whatsOnChain.js'
11
11
  export type {
12
12
  BsvUsdQuote,
13
13
  ComputeRepriceInput,
14
14
  ComputeRepriceResult,
15
15
  RateProvider,
16
16
  RepricerBounds,
17
- } from './types'
17
+ } from './types.js'
@@ -1,5 +1,5 @@
1
- import type { RateProvider } from './types'
2
- import { createWhatsOnChainProvider } from './whatsOnChain'
1
+ import type { RateProvider } from './types.js'
2
+ import { createWhatsOnChainProvider } from './whatsOnChain.js'
3
3
 
4
4
  export interface ResolveProviderOptions {
5
5
  chain: 'main' | 'test'
@@ -1,4 +1,4 @@
1
- import type { BsvUsdQuote, RateProvider } from './types'
1
+ import type { BsvUsdQuote, RateProvider } from './types.js'
2
2
 
3
3
  export interface WhatsOnChainOptions {
4
4
  chain: 'main' | 'test'
@@ -1,17 +0,0 @@
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
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * One-off recovery script: re-submit a BSV21 deploy tx to the discovery
3
- * overlay topic (tm_bsv21).
4
- *
5
- * Use when a deploy was broadcast on-chain but didn't reach the overlay
6
- * (e.g. previous URL bug, network blip, server downtime).
7
- *
8
- * Usage: bun run scripts/resubmit-bsv21-discovery.ts <txid>
9
- */
10
-
11
- import { OneSatServices } from '@1sat/client'
12
-
13
- const txid = process.argv[2]
14
- if (!txid || !/^[0-9a-f]{64}$/i.test(txid)) {
15
- console.error(
16
- 'Usage: bun run scripts/resubmit-bsv21-discovery.ts <txid>\n' +
17
- ' txid must be a 64-char hex string',
18
- )
19
- process.exit(1)
20
- }
21
-
22
- const services = new OneSatServices('main')
23
-
24
- console.log(`Fetching BEEF for ${txid}...`)
25
- const beef = await services.getBeefForTxid(txid)
26
- console.log(` beef has ${beef.txs.length} txs and ${beef.bumps.length} bumps`)
27
-
28
- const atomicBeef = beef.toBinaryAtomic(txid)
29
- console.log(` atomic BEEF size: ${atomicBeef.length} bytes`)
30
-
31
- console.log('Submitting to tm_bsv21 discovery topic...')
32
- const result = await services.overlay.submitBsv21Discovery(atomicBeef)
33
- console.log('Result:', result)