@bsv/expo-wallet-toolbox 0.3.1 → 0.4.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Host-supplied configuration (breaking)
6
+
7
+ - Add `configureToolbox({ backupUrl, services })`, with `getBackupUrl`,
8
+ `getServiceConfig` and `isToolboxConfigured`. The host states its backup
9
+ endpoint and per-chain service URLs and keys once, at app entry.
10
+ - Remove `DEFAULT_BACKUP_URL` and every `process.env` read in the package.
11
+ Expo's Babel preset does not inline `EXPO_PUBLIC_*` for files under
12
+ `node_modules`, so those reads were `undefined` in the production bundle of
13
+ any host that installed this package from npm — disabling backup entirely
14
+ and leaving the WhatsOnChain/Taal key unset, while working in dev and in
15
+ hosts that consume the package from source.
16
+ - `backupUrl` is required and takes `null` to disable backup deliberately.
17
+ Reading configuration before `configureToolbox` runs throws, so an
18
+ unconfigured build fails loudly instead of imitating a disabled one.
19
+ - Backup URLs are validated as bare origins: a path, query or fragment is
20
+ rejected, since the BRC-103/104 handshake posts to the origin root.
21
+
3
22
  ## 0.3.1
4
23
 
5
24
  ### Wallet creation and backup
package/README.md CHANGED
@@ -155,6 +155,49 @@ dependencies.
155
155
  | --- | --- |
156
156
  | `react-native-yubikey` | Vault/hardware-key support. Absence is detected at runtime and vault features degrade gracefully. |
157
157
 
158
+ ## Configuration
159
+
160
+ Call `configureToolbox` once, at your app entry point, before anything from this
161
+ package renders or builds a wallet:
162
+
163
+ ```tsx
164
+ import { configureToolbox } from '@bsv/expo-wallet-toolbox'
165
+
166
+ configureToolbox({
167
+ backupUrl: process.env.EXPO_PUBLIC_BACKUP_URL ?? null,
168
+ services: {
169
+ main: {
170
+ arcUrl: process.env.EXPO_PUBLIC_ARC_URL,
171
+ arcApiKey: process.env.EXPO_PUBLIC_ARC_API_KEY,
172
+ chaintracksUrl: process.env.EXPO_PUBLIC_CHAINTRACKS_URL,
173
+ whatsOnChainApiKey: process.env.EXPO_PUBLIC_WOC_API_KEY,
174
+ taalApiKey: process.env.EXPO_PUBLIC_WOC_API_KEY
175
+ }
176
+ }
177
+ })
178
+ ```
179
+
180
+ **The `EXPO_PUBLIC_*` reads must live in your app source, not in this package.**
181
+ Expo's Babel preset refuses to inline `EXPO_PUBLIC_*` for any file whose path
182
+ contains `node_modules` (`babel-preset-expo/build/common.js`: `!isNodeModule &&
183
+ ...`). A production bundle defines only `NODE_ENV` on `process.env`, so an env
184
+ read inside an installed copy of this package is `undefined` — silently, and
185
+ only in production, since Expo's dev serializer injects the variables at
186
+ runtime. That asymmetry is why this package reads no environment of its own.
187
+
188
+ `backupUrl` is required and accepts `null`, which disables backup entirely: no
189
+ monitor task is registered, nothing is sent, and the backup UI does not render.
190
+ It is not optional and has no default, so every build states its endpoint —
191
+ including stating that it has none. It must be a bare origin: the BRC-103/104
192
+ handshake posts to the origin root, so a path, query or fragment is rejected.
193
+
194
+ Every `services` field is optional and falls back to the built-in public
195
+ endpoint for that chain. Chains are `main`, `test` and `teratest`.
196
+
197
+ Reading configuration before `configureToolbox` has run **throws**. An
198
+ unconfigured build fails loudly rather than behaving like a deliberately
199
+ disabled one.
200
+
158
201
  ## Usage
159
202
 
160
203
  ```tsx
@@ -499,6 +542,15 @@ are required — both hard-won during this package's extraction:
499
542
 
500
543
  ## Breaking changes
501
544
 
545
+ **0.4.0:** the package no longer reads `process.env` at all. `DEFAULT_BACKUP_URL`
546
+ is removed, and the `EXPO_PUBLIC_*` service reads in `walletServiceConfig` are
547
+ gone. The host supplies these through `configureToolbox({ backupUrl, services })`
548
+ at app entry — see [Configuration](#configuration). Removing the export rather
549
+ than deprecating it is deliberate: a host that upgrades gets a build error, not
550
+ another empty string. Hosts that installed this package from npm were silently
551
+ running with backup disabled and WhatsOnChain/Taal unkeyed, because Expo does
552
+ not inline `EXPO_PUBLIC_*` inside `node_modules`.
553
+
502
554
  **0.1.1:** `react-native-localpay-transport` (unscoped, private, hand-synced
503
555
  out of this repo) became `@bsv/react-native-localpay-transport` (published
504
556
  independently). This is a native-module identity change, not just an npm
package/core/config.tsx CHANGED
@@ -23,25 +23,20 @@ export const DEFAULT_MESSAGEBOX_URL = 'https://gmb.bsvblockchain.tech'
23
23
  /**
24
24
  * Encrypted wallet-backup log.
25
25
  *
26
- * Deliberately separate from DEFAULT_STORAGE_URL, which stays 'local': this service is not
27
- * a wallet storage provider. It stores opaque ciphertext it cannot read, addressed by a
28
- * pseudonym derived from the wallet seed.
26
+ * The backup endpoint is no longer a constant here: it is supplied by the host app
27
+ * through `configureToolbox({ backupUrl })` and read back with `getBackupUrl()`.
28
+ * See `toolboxConfig.ts` for why (Expo does not inline `EXPO_PUBLIC_*` inside
29
+ * `node_modules`, so an env read in this package is empty in any host that
30
+ * installs it from npm).
29
31
  *
30
- * Empty disables backup entirely — no monitor task is registered and nothing is sent. That
31
- * is what a build with no EXPO_PUBLIC_BACKUP_URL gets, including a plain local `npm run ios`
32
- * with no .env.local: the value is not defaulted in code, so every build states its endpoint.
32
+ * The design intent is unchanged — the value is still not defaulted in code, so
33
+ * every build states its endpoint. Only the speaker changed, from this package's
34
+ * environment to the host's explicit call. `backupUrl: null` disables backup
35
+ * entirely: no monitor task is registered and nothing is sent.
33
36
  *
34
- * The EAS development, dev-physical and production profiles set it to the shared server at
35
- * https://backup.bsvblockchain.tech (see eas.json). preview-apk carries no env block at all,
36
- * so those builds have backup disabled along with every other EXPO_PUBLIC_* default.
37
- *
38
- * Set EXPO_PUBLIC_BACKUP_URL to point a build at a different server. EXPO_PUBLIC_* values are
39
- * inlined by Metro at bundle time, so changing it needs a Metro restart but not a native rebuild.
40
- * It must be an origin with no trailing slash and no path: the BRC-103/104 handshake is
41
- * posted to the origin root, so a path prefix makes every request fail authentication.
42
- *
43
- * EXPO_PUBLIC_BACKUP_URL=https://backup.example.com npm run ios
37
+ * The endpoint must be an origin with no trailing slash and no path: the
38
+ * BRC-103/104 handshake is posted to the origin root, so a path prefix makes
39
+ * every request fail authentication.
44
40
  */
45
- export const DEFAULT_BACKUP_URL = (process.env.EXPO_PUBLIC_BACKUP_URL ?? '').replace(/\/+$/, '')
46
41
  export const DEFAULT_CHAIN: AppChain = 'main'
47
42
  export const ADMIN_ORIGINATOR = 'admin.com'
@@ -135,7 +135,8 @@ const DEFAULT_SETTINGS: WalletSettings = {
135
135
  }
136
136
  }
137
137
  import type { AppChain } from '../config'
138
- import { DEFAULT_STORAGE_URL, DEFAULT_CHAIN, ADMIN_ORIGINATOR, DEFAULT_BACKUP_URL, toWalletChain } from '../config'
138
+ import { DEFAULT_STORAGE_URL, DEFAULT_CHAIN, ADMIN_ORIGINATOR, toWalletChain } from '../config'
139
+ import { getBackupUrl } from '../toolboxConfig'
139
140
  import { DEFAULT_AUTO_APPROVE_THRESHOLD, AUTO_APPROVE_COOLDOWN_MS, AUTO_APPROVE_STORAGE_KEY } from '../constants'
140
141
  import AsyncStorage from '@react-native-async-storage/async-storage'
141
142
  import { UserContext } from './UserContext'
@@ -1188,7 +1189,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
1188
1189
  primaryKey,
1189
1190
  chain: chainStr,
1190
1191
  identityKey,
1191
- baseUrl: DEFAULT_BACKUP_URL,
1192
+ baseUrl: getBackupUrl(),
1192
1193
  onProgress: (chunks, total) => setBackupRestore({ phase: 'restoring', chunks, total }),
1193
1194
  // reviewSpendableOutputs talks to Services through the Wallet, which
1194
1195
  // needs this storage attached first. Attach here (idempotent with the
@@ -1461,7 +1462,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
1461
1462
  //
1462
1463
  // Reads chunks straight from phoneStorage rather than through
1463
1464
  // WalletStorageManager, whose sync lock would block all storage access.
1464
- if (DEFAULT_BACKUP_URL !== '') {
1465
+ if (getBackupUrl() !== '') {
1465
1466
  monitor.addTask(
1466
1467
  new TaskBackupPush(monitor, async () => {
1467
1468
  return await pushOnce({
@@ -1469,7 +1470,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
1469
1470
  primaryKey,
1470
1471
  chain: backupChain,
1471
1472
  identityKey: keyDeriver.identityKey,
1472
- baseUrl: DEFAULT_BACKUP_URL
1473
+ baseUrl: getBackupUrl()
1473
1474
  })
1474
1475
  })
1475
1476
  )
package/core/index.ts CHANGED
@@ -21,11 +21,21 @@ export {
21
21
  DEFAULT_WAB_URL,
22
22
  DEFAULT_STORAGE_URL,
23
23
  DEFAULT_MESSAGEBOX_URL,
24
- DEFAULT_BACKUP_URL,
25
24
  DEFAULT_CHAIN,
26
25
  ADMIN_ORIGINATOR
27
26
  } from './config'
28
27
 
28
+ // Host-supplied runtime configuration (backup endpoint, service URLs and keys).
29
+ // Must be installed by the host app before anything here renders — see toolboxConfig.ts.
30
+ export {
31
+ configureToolbox,
32
+ isToolboxConfigured,
33
+ getBackupUrl,
34
+ getServiceConfig,
35
+ resetToolboxConfig
36
+ } from './toolboxConfig'
37
+ export type { ToolboxConfig, ToolboxServiceConfig } from './toolboxConfig'
38
+
29
39
  // Theme tokens and providers
30
40
  export { ThemeProvider, useTheme } from './theme/ThemeContext'
31
41
  export { spacing, radii, typography, lightColors, darkColors, hitTargets } from './theme/tokens'
@@ -1,5 +1,6 @@
1
1
  import type { AppChain } from '../config'
2
2
  import { toWalletChain } from '../config'
3
+ import { getServiceConfig } from '../toolboxConfig'
3
4
  import {
4
5
  ChaintracksServiceClient,
5
6
  Services
@@ -18,18 +19,11 @@ import type { ChainTracker } from '@bsv/sdk'
18
19
  * this, rather than each keeping their own copy that could drift.
19
20
  */
20
21
  export function chaintracksUrlFor(network: AppChain): string {
21
- if (network === 'main') {
22
- return process.env?.EXPO_PUBLIC_CHAINTRACKS_URL ?? 'https://arcade-v2-us-1.bsvblockchain.tech/chaintracks/v1'
23
- }
24
- if (network === 'test') {
25
- return (
26
- process.env?.EXPO_PUBLIC_TEST_CHAINTRACKS_URL ??
27
- 'https://arcade-v2-testnet-us-1.bsvblockchain.tech/chaintracks/v1'
28
- )
29
- }
30
- return (
31
- process.env?.EXPO_PUBLIC_TERATEST_CHAINTRACKS_URL ?? 'https://arcade-v2-ttn-us-1.bsvblockchain.tech/chaintracks/v1'
32
- )
22
+ const configured = getServiceConfig(network).chaintracksUrl
23
+ if (configured != null && configured !== '') return configured
24
+ if (network === 'main') return 'https://arcade-v2-us-1.bsvblockchain.tech/chaintracks/v1'
25
+ if (network === 'test') return 'https://arcade-v2-testnet-us-1.bsvblockchain.tech/chaintracks/v1'
26
+ return 'https://arcade-v2-ttn-us-1.bsvblockchain.tech/chaintracks/v1'
33
27
  }
34
28
 
35
29
  /**
@@ -75,6 +69,7 @@ export function createServiceOptions(
75
69
  chaintracksOverride?: ChaintracksClientApi
76
70
  ): WalletServicesOptions {
77
71
  const walletChain = toWalletChain(network)
72
+ const svc = getServiceConfig(network)
78
73
  const base = {
79
74
  chain: walletChain,
80
75
  bsvExchangeRate,
@@ -88,15 +83,15 @@ export function createServiceOptions(
88
83
  if (network === 'main') {
89
84
  return {
90
85
  ...base,
91
- arcUrl: arcUrlOverride ?? process.env?.EXPO_PUBLIC_ARC_URL ?? 'https://arcade-v2-us-1.bsvblockchain.tech',
86
+ arcUrl: arcUrlOverride ?? svc.arcUrl ?? 'https://arcade-v2-us-1.bsvblockchain.tech',
92
87
  arcConfig: {
93
- apiKey: arcApiKeyOverride ?? process.env?.EXPO_PUBLIC_ARC_API_KEY ?? '',
88
+ apiKey: arcApiKeyOverride ?? svc.arcApiKey ?? '',
94
89
  callbackToken
95
90
  },
96
91
  bsvUpdateMsecs: 60 * 60 * 1000,
97
92
  fiatUpdateMsecs: 60 * 60 * 1000,
98
- whatsOnChainApiKey: process.env?.EXPO_PUBLIC_WOC_API_KEY ?? '',
99
- taalApiKey: process.env?.EXPO_PUBLIC_WOC_API_KEY ?? '',
93
+ whatsOnChainApiKey: svc.whatsOnChainApiKey ?? '',
94
+ taalApiKey: svc.taalApiKey ?? svc.whatsOnChainApiKey ?? '',
100
95
  chaintracks: chaintracksOverride ?? new ChaintracksServiceClient(walletChain, chaintracksUrlFor(network))
101
96
  }
102
97
  }
@@ -104,15 +99,15 @@ export function createServiceOptions(
104
99
  if (network === 'test') {
105
100
  return {
106
101
  ...base,
107
- arcUrl: arcUrlOverride ?? process.env?.EXPO_PUBLIC_TEST_ARC_URL ?? 'https://arcade-v2-testnet-us-1.bsvblockchain.tech',
102
+ arcUrl: arcUrlOverride ?? svc.arcUrl ?? 'https://arcade-v2-testnet-us-1.bsvblockchain.tech',
108
103
  arcConfig: {
109
- apiKey: arcApiKeyOverride ?? process.env?.EXPO_PUBLIC_TEST_ARC_API_KEY ?? '',
104
+ apiKey: arcApiKeyOverride ?? svc.arcApiKey ?? '',
110
105
  callbackToken
111
106
  },
112
107
  bsvUpdateMsecs: 60 * 60 * 1000000,
113
108
  fiatUpdateMsecs: 60 * 60 * 1000000,
114
- whatsOnChainApiKey: process.env?.EXPO_PUBLIC_TEST_WOC_API_KEY ?? '',
115
- taalApiKey: process.env?.EXPO_PUBLIC_TEST_TAAL_API_KEY ?? '',
109
+ whatsOnChainApiKey: svc.whatsOnChainApiKey ?? '',
110
+ taalApiKey: svc.taalApiKey ?? svc.whatsOnChainApiKey ?? '',
116
111
  chaintracks: chaintracksOverride ?? new ChaintracksServiceClient(walletChain, chaintracksUrlFor(network))
117
112
  }
118
113
  }
@@ -120,15 +115,15 @@ export function createServiceOptions(
120
115
  // teratest
121
116
  return {
122
117
  ...base,
123
- arcUrl: arcUrlOverride ?? process.env?.EXPO_PUBLIC_TERATEST_ARC_URL ?? 'https://arcade-v2-ttn-us-1.bsvblockchain.tech',
118
+ arcUrl: arcUrlOverride ?? svc.arcUrl ?? 'https://arcade-v2-ttn-us-1.bsvblockchain.tech',
124
119
  arcConfig: {
125
- apiKey: arcApiKeyOverride ?? process.env?.EXPO_PUBLIC_TERATEST_ARC_API_KEY ?? '',
120
+ apiKey: arcApiKeyOverride ?? svc.arcApiKey ?? '',
126
121
  callbackToken
127
122
  },
128
123
  bsvUpdateMsecs: 60 * 60 * 1000000,
129
124
  fiatUpdateMsecs: 60 * 60 * 1000000,
130
- whatsOnChainApiKey: process.env?.EXPO_PUBLIC_TERATEST_WOC_API_KEY ?? '',
131
- taalApiKey: process.env?.EXPO_PUBLIC_TERATEST_WOC_API_KEY ?? '',
125
+ whatsOnChainApiKey: svc.whatsOnChainApiKey ?? '',
126
+ taalApiKey: svc.taalApiKey ?? svc.whatsOnChainApiKey ?? '',
132
127
  chaintracks: chaintracksOverride ?? new ChaintracksServiceClient(walletChain, chaintracksUrlFor(network))
133
128
  }
134
129
  }
@@ -0,0 +1,129 @@
1
+ import type { AppChain } from './config'
2
+
3
+ /**
4
+ * Service endpoints and API keys for one chain.
5
+ *
6
+ * Every field is optional: an omitted field falls back to the built-in public
7
+ * default in `walletServiceConfig.ts`. Omitting the whole chain entry is the
8
+ * same as passing `{}`.
9
+ */
10
+ export interface ToolboxServiceConfig {
11
+ arcUrl?: string
12
+ arcApiKey?: string
13
+ chaintracksUrl?: string
14
+ whatsOnChainApiKey?: string
15
+ taalApiKey?: string
16
+ }
17
+
18
+ /**
19
+ * Runtime configuration supplied by the host app.
20
+ *
21
+ * The toolbox reads no `process.env` of its own. Expo's Babel preset refuses to
22
+ * inline `EXPO_PUBLIC_*` for any file whose path contains `node_modules`
23
+ * (`babel-preset-expo/build/common.js` — `!isNodeModule && ...`), so an env read
24
+ * inside this package is `undefined` in every production bundle of a host that
25
+ * installs it from npm, while working fine in dev and in a host that consumes it
26
+ * from source. That asymmetry is what silently disabled backup for three weeks.
27
+ *
28
+ * So the host reads its own env — where inlining works — and states the values
29
+ * here, once, before rendering:
30
+ *
31
+ * configureToolbox({
32
+ * backupUrl: process.env.EXPO_PUBLIC_BACKUP_URL ?? null,
33
+ * services: { main: { arcUrl: process.env.EXPO_PUBLIC_ARC_URL } }
34
+ * })
35
+ *
36
+ * There is deliberately no env fallback here. A fallback would restore exactly
37
+ * the silent path this seam exists to close.
38
+ */
39
+ export interface ToolboxConfig {
40
+ /**
41
+ * Origin of the encrypted wallet-backup service — no trailing slash, no path.
42
+ * The BRC-103/104 handshake is posted to the origin root, so a path prefix
43
+ * makes every request fail authentication.
44
+ *
45
+ * `null` disables backup entirely: no monitor task is registered, nothing is
46
+ * sent, and the backup UI does not render. It is required rather than
47
+ * optional so that every build states its endpoint — including stating that
48
+ * it has none. An upgrading host that passes nothing gets a type error, not
49
+ * another empty string.
50
+ */
51
+ backupUrl: string | null
52
+ /** Per-chain service endpoints and keys. Omitted chains use built-in defaults. */
53
+ services?: Partial<Record<AppChain, ToolboxServiceConfig>>
54
+ }
55
+
56
+ interface ResolvedConfig {
57
+ backupUrl: string
58
+ services: Partial<Record<AppChain, ToolboxServiceConfig>>
59
+ }
60
+
61
+ let current: ResolvedConfig | null = null
62
+
63
+ const NOT_CONFIGURED =
64
+ 'expo-wallet-toolbox is not configured. Call configureToolbox({ backupUrl, services }) ' +
65
+ 'from the host app entry point, before rendering WalletContextProvider. ' +
66
+ 'Pass backupUrl: null to disable backup deliberately.'
67
+
68
+ function normalizeBackupUrl(raw: string): string {
69
+ const trimmed = raw.trim().replace(/\/+$/, '')
70
+ if (trimmed === '') return ''
71
+ let parsed: URL
72
+ try {
73
+ parsed = new URL(trimmed)
74
+ } catch {
75
+ throw new Error(`configureToolbox: backupUrl is not a valid URL: ${raw}`)
76
+ }
77
+ if (parsed.pathname !== '' && parsed.pathname !== '/') {
78
+ throw new Error(
79
+ `configureToolbox: backupUrl must be an origin with no path (got "${parsed.pathname}"). ` +
80
+ 'The BRC-103/104 handshake posts to the origin root, so a path prefix fails authentication.'
81
+ )
82
+ }
83
+ if (parsed.search !== '' || parsed.hash !== '') {
84
+ throw new Error(`configureToolbox: backupUrl must be a bare origin, with no query or fragment: ${raw}`)
85
+ }
86
+ return trimmed
87
+ }
88
+
89
+ /**
90
+ * Install the host's runtime configuration. Call once, at app entry, before
91
+ * anything from this package renders or builds a wallet.
92
+ *
93
+ * Calling it again replaces the configuration wholesale — it is not merged.
94
+ */
95
+ export function configureToolbox(config: ToolboxConfig): void {
96
+ if (config == null || !('backupUrl' in config)) {
97
+ throw new Error('configureToolbox: backupUrl is required. Pass null to disable backup.')
98
+ }
99
+ current = {
100
+ backupUrl: config.backupUrl == null ? '' : normalizeBackupUrl(config.backupUrl),
101
+ services: config.services ?? {}
102
+ }
103
+ }
104
+
105
+ /** True once `configureToolbox` has run. For hosts that want to assert their own ordering. */
106
+ export function isToolboxConfigured(): boolean {
107
+ return current !== null
108
+ }
109
+
110
+ /**
111
+ * The configured backup origin, or `''` when the host passed `null`.
112
+ * Throws if the host never configured the toolbox at all — an unconfigured
113
+ * build must fail loudly, not quietly behave like a disabled one.
114
+ */
115
+ export function getBackupUrl(): string {
116
+ if (current === null) throw new Error(NOT_CONFIGURED)
117
+ return current.backupUrl
118
+ }
119
+
120
+ /** Service endpoints for a chain. Missing fields are the caller's to default. */
121
+ export function getServiceConfig(chain: AppChain): ToolboxServiceConfig {
122
+ if (current === null) throw new Error(NOT_CONFIGURED)
123
+ return current.services[chain] ?? {}
124
+ }
125
+
126
+ /** Test-only: drop the installed configuration. */
127
+ export function resetToolboxConfig(): void {
128
+ current = null
129
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/expo-wallet-toolbox",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "description": "Wallet screens and P2P local-payment backend for Expo/React Native apps, extracted from BSV Wallet.",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -30,9 +30,9 @@ import {
30
30
  eraseRemoteBackup,
31
31
  recoverMnemonicWallet,
32
32
  TaskBackupPush,
33
- DEFAULT_BACKUP_URL,
34
33
  setMockDriverEnabled,
35
- NO_MESSAGE_BOX
34
+ NO_MESSAGE_BOX,
35
+ getBackupUrl
36
36
  } from '@bsv/expo-wallet-toolbox'
37
37
 
38
38
  /**
@@ -257,7 +257,7 @@ export function WalletConfigScreen() {
257
257
  // chain propagates — a partial erasure must never be reported as done.
258
258
  let deleted = 0
259
259
  for (const chain of BACKUP_CHAINS) {
260
- deleted += (await eraseRemoteBackup({ primaryKey, chain, baseUrl: DEFAULT_BACKUP_URL })).deleted
260
+ deleted += (await eraseRemoteBackup({ primaryKey, chain, baseUrl: getBackupUrl() })).deleted
261
261
  }
262
262
  setBackupPushOn(false)
263
263
  showToast(t('backup_erase_done', { count: deleted }), { type: 'success' })
@@ -844,7 +844,7 @@ export function WalletConfigScreen() {
844
844
  Its own section purely so the footer can carry the disclosure: the app sends an
845
845
  encrypted copy of the wallet database to a BSVA-operated server by default, and
846
846
  that deserves saying out loud rather than burying in a row label. */}
847
- {DEFAULT_BACKUP_URL !== '' && (
847
+ {getBackupUrl() !== '' && (
848
848
  <GroupedSection header={t('backup_push_section')} footer={t('backup_push_disclosure')}>
849
849
  <ListRow
850
850
  label={t('backup_push_toggle')}