@bsv/expo-wallet-toolbox 0.18.0 → 0.20.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 +139 -30
- package/README.md +79 -79
- package/core/backup/RemoteSyncReader.ts +26 -24
- package/core/backup/appData.ts +9 -8
- package/core/backup/codec.ts +21 -18
- package/core/backup/constants.ts +5 -5
- package/core/backup/contactsBackup.ts +8 -8
- package/core/backup/cursor.ts +12 -7
- package/core/backup/derive.ts +3 -3
- package/core/backup/deviceId.ts +2 -2
- package/core/backup/erase.ts +2 -2
- package/core/backup/preference.ts +2 -2
- package/core/backup/push.ts +10 -12
- package/core/backup/restore.ts +22 -14
- package/core/backup/restoreOnImport.ts +3 -2
- package/core/config.tsx +17 -13
- package/core/constants.ts +34 -11
- package/core/contacts/contactsStore.ts +4 -3
- package/core/context/WalletConnectionContext.tsx +294 -212
- package/core/context/WalletContext.tsx +132 -97
- package/core/context/defaultWalletSettings.ts +4 -2
- package/core/demo/demoLedger.ts +1 -5
- package/core/directpay/DirectPayProvider.tsx +15 -24
- package/core/directpay/receive.ts +2 -1
- package/core/headers/checkpoints.ts +10 -1
- package/core/headers/headerStore.ts +13 -2
- package/core/hooks/useConfirmationSound.ts +3 -3
- package/core/hooks/useHaptics.ts +23 -6
- package/core/i18n/translations.tsx +303 -123
- package/core/index.ts +2 -0
- package/core/localpay/codec.ts +12 -6
- package/core/localpay/deviceCaps.ts +4 -14
- package/core/localpay/pending.ts +2 -1
- package/core/localpay/qr.ts +1 -1
- package/core/localpay/settlementAck.ts +1 -4
- package/core/localpay/transport/ble.ts +2 -2
- package/core/localpay/transport/socket.ts +1 -1
- package/core/mandala/abortGuard.ts +1 -1
- package/core/mandala/drain.ts +3 -0
- package/core/mandala/permissionModule.ts +3 -2
- package/core/mandala/resendTransfer.ts +4 -1
- package/core/mandala/runtime.ts +4 -4
- package/core/monitor/TaskBackupPush.ts +10 -13
- package/core/net/chainMatch.ts +8 -5
- package/core/networks.ts +145 -0
- package/core/parsePeerPayURI.ts +4 -1
- package/core/pay/beefRepair.ts +6 -3
- package/core/pay/creditErrors.ts +37 -1
- package/core/pay/rails/address.ts +10 -6
- package/core/pay/rails/handle.ts +84 -11
- package/core/pay/rails/index.ts +18 -2
- package/core/pay/receiveHistory.ts +8 -8
- package/core/peerpay/handleResendRequests.ts +11 -18
- package/core/peerpay/inboxAttempts.ts +1 -4
- package/core/peerpay/rebuildToken.ts +12 -9
- package/core/profiles/profileStore.ts +2 -1
- package/core/profiles/removalProblems.ts +3 -1
- package/core/services/arcTokenStorage.ts +2 -1
- package/core/services/arcadeBroadcastProvider.ts +7 -17
- package/core/services/secrets/envelope.ts +1 -6
- package/core/services/secrets/hkdf.ts +1 -6
- package/core/services/secrets/index.ts +3 -22
- package/core/services/usdFxRates.ts +1 -4
- package/core/services/vault/VaultKeyService.ts +2 -1
- package/core/services/vault/chainRecovery.ts +48 -21
- package/core/services/vault/metaAuthority.ts +4 -1
- package/core/services/vault/r1comb.ts +113 -51
- package/core/services/vault/session.ts +5 -1
- package/core/services/vault/transfers.ts +699 -576
- package/core/services/vault/vaultStore.ts +12 -10
- package/core/services/walletArgLimits.ts +1 -2
- package/core/services/walletConnectionValidation.ts +44 -28
- package/core/services/walletServiceConfig.ts +9 -40
- package/core/storage/StorageExpoSQLite.ts +7 -21
- package/core/storage/methods/listActionsSql.ts +81 -67
- package/core/storage/methods/listOutputsSql.ts +21 -16
- package/core/storage/methods/reviewStatusSql.ts +1 -4
- package/core/stores/ConnectionStore.ts +1 -1
- package/core/theme/ThemeContext.tsx +12 -16
- package/core/theme/motion.ts +3 -3
- package/core/theme/tokens.ts +6 -6
- package/core/toolboxConfig.ts +23 -0
- package/core/walletDbRegistry.ts +7 -5
- package/core/walletRepair/runWalletCheck.ts +1 -4
- package/package.json +2 -2
- package/ui/components/pay/AddressReceive.tsx +3 -3
- package/ui/components/pay/HandleReceive.tsx +58 -15
- package/ui/components/pay/MessageBoxConfig.tsx +46 -20
- package/ui/components/pay/NearbyFlow.tsx +575 -507
- package/ui/components/pay/OfflineNotice.tsx +1 -3
- package/ui/components/pay/PayCellRow.tsx +1 -4
- package/ui/components/pay/PayForm.tsx +1 -3
- package/ui/components/pay/RequestHub.tsx +14 -6
- package/ui/components/pay/UniversalSend.tsx +137 -40
- package/ui/components/pay/tokenSendCopy.ts +1 -2
- package/ui/components/pay/useRecipientInput.ts +2 -2
- package/ui/components/security/WalletLockNotice.tsx +1 -3
- package/ui/components/ui/AlertCard.tsx +44 -45
- package/ui/components/ui/BlurChrome.tsx +4 -15
- package/ui/components/ui/Celebration.tsx +3 -3
- package/ui/components/ui/ChoiceSheet.ts +1 -3
- package/ui/components/ui/ErrorBoundary.tsx +2 -6
- package/ui/components/ui/GroupedList.tsx +13 -31
- package/ui/components/ui/IconButton.tsx +6 -9
- package/ui/components/ui/ListRow.tsx +19 -25
- package/ui/components/ui/PresenceRow.tsx +4 -4
- package/ui/components/ui/PressableScale.tsx +24 -20
- package/ui/components/ui/Toast.tsx +23 -16
- package/ui/components/vault/KeyChooser.tsx +9 -6
- package/ui/components/vault/VaultBackdrop.tsx +1 -8
- package/ui/components/vault/VaultCeremonySheet.tsx +5 -5
- package/ui/components/wallet/ActivityRow.tsx +3 -2
- package/ui/components/wallet/BackupReminderSheet.tsx +1 -5
- package/ui/components/wallet/Balance.tsx +4 -1
- package/ui/components/wallet/ContactActivityList.tsx +7 -7
- package/ui/components/wallet/IconPickerSheet.tsx +1 -5
- package/ui/components/wallet/ProfileSwitcherPopover.tsx +6 -1
- package/ui/components/wallet/tokenEviction.ts +4 -1
- package/ui/hooks/useMandala.ts +1 -7
- package/ui/hooks/useOfflineNoticeActions.ts +21 -27
- package/ui/hooks/useSpendableBalance.ts +2 -2
- package/ui/hooks/useVaultCoverage.ts +7 -1
- package/ui/index.ts +9 -1
- package/ui/resolveIdentity.ts +20 -8
- package/ui/screens/ConnectionsScreen.tsx +44 -18
- package/ui/screens/LogsScreen.tsx +24 -22
- package/ui/screens/PairScreen.tsx +85 -54
- package/ui/screens/PayScreen.tsx +5 -1
- package/ui/screens/ProfileScreen.tsx +0 -3
- package/ui/screens/TrustScreen.tsx +125 -80
- package/ui/screens/VaultScreen.tsx +19 -7
- package/ui/screens/VaultTransferScreen.tsx +5 -1
- package/ui/screens/WalletCheckScreen.tsx +14 -17
- package/ui/screens/WalletConfigScreen.tsx +414 -376
- package/ui/screens/WalletHomeScreen.tsx +47 -42
|
@@ -140,6 +140,7 @@ const MANDALA_OUTPOINT_LIST_MAX_PAGES = 1000
|
|
|
140
140
|
|
|
141
141
|
import type { AppChain } from '../config'
|
|
142
142
|
import { DEFAULT_STORAGE_URL, DEFAULT_CHAIN, ADMIN_ORIGINATOR, toWalletChain } from '../config'
|
|
143
|
+
import { NETWORKS, isAppChain } from '../networks'
|
|
143
144
|
import { getBackupUrl, getHandleRegistryConfig, getMandalaEndpoints, getPushAdapter } from '../toolboxConfig'
|
|
144
145
|
import { inboxSeenStore } from '../directpay/receive'
|
|
145
146
|
import {
|
|
@@ -293,11 +294,9 @@ import { spenderConsumesOutpoint } from '../walletRepair/spenderConsumesOutpoint
|
|
|
293
294
|
import { releaseStuckReservationsOnDb } from '../walletRepair/releaseStuckReservations'
|
|
294
295
|
import {
|
|
295
296
|
acceptWithRetry,
|
|
296
|
-
|
|
297
|
+
bindMessageBoxNetwork,
|
|
297
298
|
internalizeIncoming,
|
|
298
|
-
|
|
299
|
-
MESSAGE_BOX_URL_KEY,
|
|
300
|
-
NO_MESSAGE_BOX,
|
|
299
|
+
readMessageBoxUrl,
|
|
301
300
|
retryDelivery
|
|
302
301
|
} from '../pay/rails/handle'
|
|
303
302
|
import { getOutboxEntries, pruneExpiredSent, unsentEntries } from '../peerpay/outbox'
|
|
@@ -354,7 +353,10 @@ async function reloadAutoApproveLedger(): Promise<void> {
|
|
|
354
353
|
autoApprovePolicy.loadLedger(Array.isArray(entries) ? entries : [])
|
|
355
354
|
}
|
|
356
355
|
function persistAutoApproveLedger(): void {
|
|
357
|
-
AsyncStorage.setItem(
|
|
356
|
+
AsyncStorage.setItem(
|
|
357
|
+
profileScopedKey(AUTO_APPROVE_LEDGER_STORAGE_KEY),
|
|
358
|
+
JSON.stringify(autoApprovePolicy.getLedger())
|
|
359
|
+
).catch(() => {})
|
|
358
360
|
}
|
|
359
361
|
|
|
360
362
|
/**
|
|
@@ -790,7 +792,12 @@ async function probeForLegacyDb(legacyName: string): Promise<boolean> {
|
|
|
790
792
|
}
|
|
791
793
|
|
|
792
794
|
/** The i18n key naming each network to the user. */
|
|
793
|
-
const NETWORK_LABEL_KEYS: Record<AppChain, string> = {
|
|
795
|
+
const NETWORK_LABEL_KEYS: Record<AppChain, string> = {
|
|
796
|
+
main: 'mainnet',
|
|
797
|
+
test: 'testnet',
|
|
798
|
+
teratest: 'teratest',
|
|
799
|
+
scaletest: 'scaletest'
|
|
800
|
+
}
|
|
794
801
|
|
|
795
802
|
/**
|
|
796
803
|
* Minimal shape of the app's toast function. `core` must never import a `ui`
|
|
@@ -936,7 +943,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
936
943
|
* its own; `getBackupPseudonym` also refuses to answer for any OTHER chain, so a stale
|
|
937
944
|
* entry from a network switch can never be misread as the current one's.
|
|
938
945
|
*/
|
|
939
|
-
const backupIdentityRef = useRef<{ chain: BackupChain
|
|
946
|
+
const backupIdentityRef = useRef<{ chain: BackupChain; pseudonym: string } | null>(null)
|
|
940
947
|
const getBackupPseudonym = useCallback(
|
|
941
948
|
(chain: BackupChain): string | undefined =>
|
|
942
949
|
backupIdentityRef.current?.chain === chain ? backupIdentityRef.current.pseudonym : undefined,
|
|
@@ -1362,7 +1369,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1362
1369
|
|
|
1363
1370
|
const finalizeConfig = useCallback((wabConfig: WABConfig): boolean => {
|
|
1364
1371
|
const { method, network, storageUrl } = wabConfig
|
|
1365
|
-
if (!network) {
|
|
1372
|
+
if (!isAppChain(network)) {
|
|
1366
1373
|
console.error('Network selection is required')
|
|
1367
1374
|
return false
|
|
1368
1375
|
}
|
|
@@ -1414,7 +1421,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1414
1421
|
// The network lives on the active profile, not in finalConfig.
|
|
1415
1422
|
finalizeConfig({ ...config, network: getActiveProfile().network })
|
|
1416
1423
|
} catch {
|
|
1417
|
-
finalizeConfig({
|
|
1424
|
+
finalizeConfig({
|
|
1425
|
+
wabUrl: 'noWAB',
|
|
1426
|
+
method: 'mnemonic',
|
|
1427
|
+
network: getActiveProfile().network,
|
|
1428
|
+
storageUrl: 'local'
|
|
1429
|
+
})
|
|
1418
1430
|
await setItem(
|
|
1419
1431
|
'finalConfig',
|
|
1420
1432
|
JSON.stringify({ wabUrl: 'noWAB', method: 'mnemonic', network: DEFAULT_CHAIN, storageUrl: 'local' })
|
|
@@ -1422,7 +1434,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1422
1434
|
}
|
|
1423
1435
|
} else {
|
|
1424
1436
|
// First launch: auto-configure with defaults
|
|
1425
|
-
finalizeConfig({
|
|
1437
|
+
finalizeConfig({
|
|
1438
|
+
wabUrl: 'noWAB',
|
|
1439
|
+
method: 'mnemonic',
|
|
1440
|
+
network: getActiveProfile().network,
|
|
1441
|
+
storageUrl: 'local'
|
|
1442
|
+
})
|
|
1426
1443
|
await setItem(
|
|
1427
1444
|
'finalConfig',
|
|
1428
1445
|
JSON.stringify({ wabUrl: 'noWAB', method: 'mnemonic', network: DEFAULT_CHAIN, storageUrl: 'local' })
|
|
@@ -1476,10 +1493,10 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1476
1493
|
const mandalaEndpoints = getMandalaEndpoints(chain)
|
|
1477
1494
|
// Toolbox chain id ('teratest' -> 'ttn'). App keeps 'teratest' for AsyncStorage keys / env / UI.
|
|
1478
1495
|
const walletChain = toWalletChain(chain)
|
|
1496
|
+
const network = NETWORKS[chain]
|
|
1479
1497
|
// The backup log's network name. Distinct from walletChain ('ttn' for teratest):
|
|
1480
1498
|
// the backup derivation is frozen on the app-level names.
|
|
1481
|
-
const backupChain =
|
|
1482
|
-
chain === 'main' ? ('main' as const) : chain === 'test' ? ('test' as const) : ('teratest' as const)
|
|
1499
|
+
const backupChain: BackupChain = chain
|
|
1483
1500
|
// See getBackupPseudonym's own docs: this is what lets Wallet Check scope its
|
|
1484
1501
|
// cursor lookup to THIS identity without the primary key itself leaving this scope.
|
|
1485
1502
|
backupIdentityRef.current = { chain: backupChain, pseudonym: backupPseudonym(primaryKey, backupChain) }
|
|
@@ -1531,7 +1548,9 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1531
1548
|
|
|
1532
1549
|
// Replace all default broadcast providers with EF/rawtx-only services.
|
|
1533
1550
|
// Order: Arcade → Taal → GorillaPool → WoC → Bitails. UntilSuccess stops at first success.
|
|
1534
|
-
//
|
|
1551
|
+
// Each fallback is registered only where NETWORKS says it serves the
|
|
1552
|
+
// network: Taal on main + test, GorillaPool on main, WhatsOnChain where
|
|
1553
|
+
// one exists, Bitails on main + test.
|
|
1535
1554
|
// 'ArcadeBeef' is the toolbox's own Arcade broadcaster, registered
|
|
1536
1555
|
// because serviceOptions now carries arcadeUrl (needed for Arcade-first
|
|
1537
1556
|
// proofs and SSE). Our createArcadeBroadcastService replaces it here so
|
|
@@ -1543,15 +1562,16 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1543
1562
|
services.postBeefServices.remove('Bitails')
|
|
1544
1563
|
services.postBeefServices.remove('WhatsOnChain')
|
|
1545
1564
|
services.postBeefServices.add(createArcadeBroadcastService(serviceOptions.arcUrl!, callbackToken))
|
|
1546
|
-
if (
|
|
1547
|
-
|
|
1548
|
-
services.postBeefServices.add(createTaalBroadcastService(taalArcUrl, serviceOptions.taalApiKey))
|
|
1565
|
+
if (network.taalArcUrl) {
|
|
1566
|
+
services.postBeefServices.add(createTaalBroadcastService(network.taalArcUrl, serviceOptions.taalApiKey))
|
|
1549
1567
|
}
|
|
1550
|
-
if (
|
|
1551
|
-
services.postBeefServices.add(createGorillaPoolBroadcastService(
|
|
1568
|
+
if (network.gorillaPoolArcUrl) {
|
|
1569
|
+
services.postBeefServices.add(createGorillaPoolBroadcastService(network.gorillaPoolArcUrl))
|
|
1552
1570
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1571
|
+
if (network.woc) {
|
|
1572
|
+
services.postBeefServices.add(createWocBroadcastService(network.woc, serviceOptions.whatsOnChainApiKey))
|
|
1573
|
+
}
|
|
1574
|
+
if (bitailsService && network.bitails) {
|
|
1555
1575
|
services.postBeefServices.add({ name: 'Bitails', service: bitailsService.postBeef.bind(bitailsService) })
|
|
1556
1576
|
}
|
|
1557
1577
|
|
|
@@ -1560,48 +1580,49 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1560
1580
|
// Every tx this wallet sends goes through Arcade, so GET /tx/{txid}
|
|
1561
1581
|
// there is the one lookup that can answer as soon as it is mined. WoC
|
|
1562
1582
|
// BUMP and Bitails are re-added after it as fallbacks, in that order.
|
|
1563
|
-
const wocBumpBase =
|
|
1564
|
-
chain === 'main'
|
|
1565
|
-
? 'https://api.whatsonchain.com/v1/bsv/main'
|
|
1566
|
-
: chain === 'test'
|
|
1567
|
-
? 'https://api.whatsonchain.com/v1/bsv/test'
|
|
1568
|
-
: 'https://api.woc-ttn.bsvblockchain.tech/v1/bsv/test'
|
|
1569
1583
|
const wocApiKey = serviceOptions.whatsOnChainApiKey
|
|
1570
1584
|
const chaintracksClient = serviceOptions.chaintracks as any
|
|
1571
1585
|
const getMerklePathSvc = (services as any).getMerklePathServices
|
|
1572
1586
|
const bitailsGetMerklePath = (services as any).bitails?.getMerklePath?.bind((services as any).bitails)
|
|
1573
1587
|
getMerklePathSvc.remove('WhatsOnChain')
|
|
1574
1588
|
getMerklePathSvc.remove('Bitails')
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1589
|
+
const wocBumpBase = network.woc ? `${network.woc.apiBase}/v1/bsv/${network.woc.segment}` : undefined
|
|
1590
|
+
if (wocBumpBase) {
|
|
1591
|
+
getMerklePathSvc.add({
|
|
1592
|
+
name: 'WhatsOnChain',
|
|
1593
|
+
service: async (txid: string): Promise<any> => {
|
|
1594
|
+
const r: any = { name: 'WhatsOnChain', notes: [] }
|
|
1595
|
+
try {
|
|
1596
|
+
const headers: Record<string, string> = {}
|
|
1597
|
+
if (wocApiKey) headers['woc-api-key'] = wocApiKey
|
|
1598
|
+
const res = await fetch(`${wocBumpBase}/tx/${txid}/proof/bump`, { headers })
|
|
1599
|
+
if (res.status === 404) {
|
|
1600
|
+
r.notes.push({ what: 'getMerklePathNoData', when: new Date().toISOString() })
|
|
1601
|
+
return r
|
|
1602
|
+
}
|
|
1603
|
+
if (!res.ok) {
|
|
1604
|
+
r.notes.push({
|
|
1605
|
+
what: 'getMerklePathBadStatus',
|
|
1606
|
+
httpStatus: res.status,
|
|
1607
|
+
when: new Date().toISOString()
|
|
1608
|
+
})
|
|
1609
|
+
return r
|
|
1610
|
+
}
|
|
1611
|
+
const bumpHex = (await res.text()).trim()
|
|
1612
|
+
r.merklePath = MerklePath.fromHex(bumpHex)
|
|
1613
|
+
const height = r.merklePath.blockHeight
|
|
1614
|
+
const header = await chaintracksClient.findHeaderForHeight(height)
|
|
1615
|
+
if (header) r.header = { ...header, height }
|
|
1616
|
+
r.notes.push({ what: 'getMerklePathSuccess', when: new Date().toISOString() })
|
|
1617
|
+
} catch (eu: any) {
|
|
1618
|
+
r.error = eu
|
|
1619
|
+
r.notes.push({ what: 'getMerklePathError', description: eu?.message, when: new Date().toISOString() })
|
|
1590
1620
|
}
|
|
1591
|
-
|
|
1592
|
-
r.merklePath = MerklePath.fromHex(bumpHex)
|
|
1593
|
-
const height = r.merklePath.blockHeight
|
|
1594
|
-
const header = await chaintracksClient.findHeaderForHeight(height)
|
|
1595
|
-
if (header) r.header = { ...header, height }
|
|
1596
|
-
r.notes.push({ what: 'getMerklePathSuccess', when: new Date().toISOString() })
|
|
1597
|
-
} catch (eu: any) {
|
|
1598
|
-
r.error = eu
|
|
1599
|
-
r.notes.push({ what: 'getMerklePathError', description: eu?.message, when: new Date().toISOString() })
|
|
1621
|
+
return r
|
|
1600
1622
|
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
if (bitailsGetMerklePath) {
|
|
1623
|
+
})
|
|
1624
|
+
}
|
|
1625
|
+
if (bitailsGetMerklePath && network.bitails) {
|
|
1605
1626
|
getMerklePathSvc.add({ name: 'Bitails', service: bitailsGetMerklePath })
|
|
1606
1627
|
}
|
|
1607
1628
|
|
|
@@ -2139,14 +2160,20 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2139
2160
|
// never touches stablecoins never opens a MessageBox connection.
|
|
2140
2161
|
messageBox: mandalaEndpoints
|
|
2141
2162
|
? async () =>
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2163
|
+
bindMessageBoxNetwork(
|
|
2164
|
+
new MessageBoxClient({
|
|
2165
|
+
host: mandalaEndpoints.messageBoxUrl,
|
|
2166
|
+
// The client calls getPublicKey / createSignature itself;
|
|
2167
|
+
// those must carry the admin originator or the vault guard
|
|
2168
|
+
// refuses them ("Originator is required for permission checks").
|
|
2169
|
+
walletClient: bindOriginator(
|
|
2170
|
+
newManagers.permissionsManager as object,
|
|
2171
|
+
adminOriginator
|
|
2172
|
+
) as never,
|
|
2173
|
+
enableLogging: false
|
|
2174
|
+
}),
|
|
2175
|
+
chain
|
|
2176
|
+
) as unknown as MandalaMessageBox
|
|
2150
2177
|
: undefined,
|
|
2151
2178
|
// The payer's own frames are sealed with a nearby session PSK the
|
|
2152
2179
|
// drain never persists; this opens the ones whose session this
|
|
@@ -2206,15 +2233,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2206
2233
|
// and the push registration below, so a device token is always
|
|
2207
2234
|
// registered on exactly the host the inbox reads. The push
|
|
2208
2235
|
// registration names the profile it is asking about; the inbox task
|
|
2209
|
-
// reads the open profile's.
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
? DEFAULT_MESSAGE_BOX_URL
|
|
2216
|
-
: saved
|
|
2217
|
-
}
|
|
2236
|
+
// reads the open profile's. Each network has its own server, so a
|
|
2237
|
+
// profile's host follows that profile's network, not this build's.
|
|
2238
|
+
const networkOfProfile = (index?: number): AppChain =>
|
|
2239
|
+
index === undefined ? chain : (getProfilesState().profiles[index]?.network ?? chain)
|
|
2240
|
+
const readMessageBoxHost = async (index?: number): Promise<string | undefined> =>
|
|
2241
|
+
readMessageBoxUrl(networkOfProfile(index), index)
|
|
2218
2242
|
|
|
2219
2243
|
// Release held offline transactions when signal returns — registered
|
|
2220
2244
|
// BEFORE the defaults, and the order matters. Monitor.runOnce collects
|
|
@@ -2307,11 +2331,14 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2307
2331
|
if (!messageBoxUrl) return { accepted: 0, attention: 0, pending: false }
|
|
2308
2332
|
let client: PeerPayClient
|
|
2309
2333
|
try {
|
|
2310
|
-
client =
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2334
|
+
client = bindMessageBoxNetwork(
|
|
2335
|
+
new PeerPayClient({
|
|
2336
|
+
messageBoxHost: messageBoxUrl,
|
|
2337
|
+
walletClient: permissionsManager as never,
|
|
2338
|
+
originator: adminOriginator
|
|
2339
|
+
}),
|
|
2340
|
+
chain
|
|
2341
|
+
)
|
|
2315
2342
|
} catch {
|
|
2316
2343
|
return { accepted: 0, attention: 0, pending: false }
|
|
2317
2344
|
}
|
|
@@ -2366,11 +2393,14 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2366
2393
|
return drainUnsentEntries({
|
|
2367
2394
|
entries,
|
|
2368
2395
|
retry: async entry => {
|
|
2369
|
-
const client =
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2396
|
+
const client = bindMessageBoxNetwork(
|
|
2397
|
+
new PeerPayClient({
|
|
2398
|
+
messageBoxHost: entry.messageBoxUrl,
|
|
2399
|
+
walletClient: permissionsManager as never,
|
|
2400
|
+
originator: adminOriginator
|
|
2401
|
+
}),
|
|
2402
|
+
chain
|
|
2403
|
+
)
|
|
2374
2404
|
await retryDelivery({
|
|
2375
2405
|
wallet: permissionsManager as never,
|
|
2376
2406
|
adminOriginator,
|
|
@@ -2651,12 +2681,16 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2651
2681
|
profiles,
|
|
2652
2682
|
retired,
|
|
2653
2683
|
activeIndex: profileIndex,
|
|
2654
|
-
|
|
2684
|
+
// Only a server that sends push notifications can take a
|
|
2685
|
+
// registration (mainnet's, today): a profile on any other
|
|
2686
|
+
// network has no host to register at.
|
|
2687
|
+
readHost: async index => (NETWORKS[networkOfProfile(index)].push ? readMessageBoxHost(index) : undefined),
|
|
2655
2688
|
// Still this build's, and not removed: a removal tombstones its profile
|
|
2656
2689
|
// right after the switch to profile 0, whose build holds the key.
|
|
2657
2690
|
isCurrent: index => stillWanted() && !isRemoved(index),
|
|
2658
2691
|
isRemoved,
|
|
2659
|
-
makeClient: (wallet, host) =>
|
|
2692
|
+
makeClient: (wallet, host) =>
|
|
2693
|
+
bindMessageBoxNetwork(new MessageBoxClient({ host, walletClient: wallet as never }), chain),
|
|
2660
2694
|
makePost: authPostFor
|
|
2661
2695
|
})
|
|
2662
2696
|
profilePushRef.current = profilePush
|
|
@@ -2709,7 +2743,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2709
2743
|
// a store) that belongs to a different build.
|
|
2710
2744
|
const stillCurrent = () => offlineChaintracksRef.current === offlineChaintracks
|
|
2711
2745
|
try {
|
|
2712
|
-
const anchor = HEADER_CHECKPOINTS[walletChain
|
|
2746
|
+
const anchor = HEADER_CHECKPOINTS[network.walletChain]
|
|
2713
2747
|
if (!anchor) return
|
|
2714
2748
|
|
|
2715
2749
|
const openStart = Date.now()
|
|
@@ -3672,13 +3706,16 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
3672
3706
|
useEffect(() => {
|
|
3673
3707
|
const wallet = managers.permissionsManager
|
|
3674
3708
|
if (!walletBuilt || !wallet || !storage) return
|
|
3709
|
+
// Watching an address means asking WhatsOnChain about it; a network with
|
|
3710
|
+
// no WhatsOnChain has no address rail to sweep.
|
|
3711
|
+
const woc = wocConfigFor(selectedNetwork)
|
|
3712
|
+
if (!woc) return
|
|
3675
3713
|
|
|
3676
3714
|
let cancelled = false
|
|
3677
3715
|
// Assume online until NetInfo says otherwise: a first pass that fails on a
|
|
3678
3716
|
// dead network is harmless (every address stays watched), while waiting for
|
|
3679
3717
|
// the first NetInfo event would delay the common case.
|
|
3680
3718
|
let online = true
|
|
3681
|
-
const woc = wocConfigFor(selectedNetwork)
|
|
3682
3719
|
// Ticks still to sit out after a WhatsOnChain 429. Every tick spends one,
|
|
3683
3720
|
// including the app-active and back-online ones, so none of them can reach
|
|
3684
3721
|
// WhatsOnChain while the backoff is pending.
|
|
@@ -4140,11 +4177,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4140
4177
|
async (txid: string, opts?: { neverFail?: boolean }): Promise<'confirmed' | 'pending' | 'failed'> => {
|
|
4141
4178
|
if (!storage) throw new Error('Storage not available')
|
|
4142
4179
|
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
const
|
|
4180
|
+
// With no WhatsOnChain there is no second opinion to ask: leave the
|
|
4181
|
+
// transaction to the monitor's own (Arcade) proof checks.
|
|
4182
|
+
const woc = NETWORKS[selectedNetwork].woc
|
|
4183
|
+
if (!woc) return 'pending'
|
|
4146
4184
|
|
|
4147
|
-
const res = await fetch(`${
|
|
4185
|
+
const res = await fetch(`${woc.apiBase}/v1/bsv/${woc.segment}/tx/${txid}/proof/bump`)
|
|
4148
4186
|
|
|
4149
4187
|
if (res.ok) {
|
|
4150
4188
|
// XR-059 remainder: a compromised/misbehaving configured indexer must
|
|
@@ -4184,7 +4222,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4184
4222
|
txid,
|
|
4185
4223
|
proof,
|
|
4186
4224
|
fetchRawTx: async () => {
|
|
4187
|
-
const r = await fetch(`${
|
|
4225
|
+
const r = await fetch(`${woc.apiBase}/v1/bsv/${woc.segment}/tx/${txid}/hex`)
|
|
4188
4226
|
if (!r.ok) throw new Error(`raw tx fetch failed: ${r.status}`)
|
|
4189
4227
|
// XR-059 remainder: same unbounded-hex-decode gap as the BUMP
|
|
4190
4228
|
// fetch above, on the raw-tx body this time. Throwing here (like
|
|
@@ -4204,7 +4242,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4204
4242
|
// unconfirmed but perfectly healthy tx also has no proof.
|
|
4205
4243
|
let onChain = false
|
|
4206
4244
|
try {
|
|
4207
|
-
const head = await fetch(`${
|
|
4245
|
+
const head = await fetch(`${woc.apiBase}/v1/bsv/${woc.segment}/tx/hash/${txid}`)
|
|
4208
4246
|
onChain = head.ok
|
|
4209
4247
|
// XR-030: any other non-OK (429/500/401/403/...) is a service
|
|
4210
4248
|
// problem, not proof of absence — only a 404 is authoritative.
|
|
@@ -4340,12 +4378,9 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4340
4378
|
const releaseResult = await releaseStuckReservations()
|
|
4341
4379
|
const releasedNote = releaseResult === 'No stuck reservations found.' ? '' : releaseResult + '\n\n'
|
|
4342
4380
|
|
|
4343
|
-
const
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
: selectedNetwork === 'test'
|
|
4347
|
-
? 'https://api.whatsonchain.com/v1/bsv/test'
|
|
4348
|
-
: 'https://api.woc-ttn.bsvblockchain.tech/v1/bsv/test'
|
|
4381
|
+
const woc = NETWORKS[selectedNetwork].woc
|
|
4382
|
+
if (!woc) return releasedNote + 'Spendability check needs WhatsOnChain, which this network does not have.'
|
|
4383
|
+
const wocBase = `${woc.apiBase}/v1/bsv/${woc.segment}`
|
|
4349
4384
|
|
|
4350
4385
|
// Rate limit: max 3 requests/sec (WoC limit ~1 per 0.34s)
|
|
4351
4386
|
const WOC_INTERVAL = 340
|
|
@@ -7,8 +7,10 @@ import { DEFAULT_SETTINGS as LIB_DEFAULT_SETTINGS, WalletSettings } from '@bsv/w
|
|
|
7
7
|
// their certificates threw in the dApp. Same wording as ts-stack#665, which
|
|
8
8
|
// fixes the library; drop this once @bsv/wallet-toolbox-mobile ships it.
|
|
9
9
|
const LIB_CERTIFIER_DESCRIPTIONS: Record<string, string> = {
|
|
10
|
-
'03daf815fe38f83da0ad83b5bedc520aa488aef5cbc93a93c67a7fe60406cbffe8':
|
|
11
|
-
|
|
10
|
+
'03daf815fe38f83da0ad83b5bedc520aa488aef5cbc93a93c67a7fe60406cbffe8':
|
|
11
|
+
'Registry of protocols, baskets, certificate types',
|
|
12
|
+
'02cf6cdf466951d8dfc9e7c9367511d0007ed6fba35ed42d425cc412fd6cfd4a17':
|
|
13
|
+
'Certifies social media handles, phones and emails'
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export const DEFAULT_SETTINGS: WalletSettings = {
|
package/core/demo/demoLedger.ts
CHANGED
|
@@ -194,11 +194,7 @@ export function demoReceiveBsv(satoshis: number, description: string): DemoActio
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
/** Spend a token. Returns the new row, or null when the balance cannot cover it. */
|
|
197
|
-
export function demoSendToken(
|
|
198
|
-
assetId: string,
|
|
199
|
-
baseUnits: number,
|
|
200
|
-
counterpartyKey?: string
|
|
201
|
-
): TokenActivityRow | null {
|
|
197
|
+
export function demoSendToken(assetId: string, baseUnits: number, counterpartyKey?: string): TokenActivityRow | null {
|
|
202
198
|
if (!demoAssetById(assetId)) return null
|
|
203
199
|
if (!Number.isFinite(baseUnits) || baseUnits <= 0) return null
|
|
204
200
|
const held = demoTokenBaseUnits(assetId)
|
|
@@ -26,20 +26,13 @@ import React, {
|
|
|
26
26
|
useSyncExternalStore
|
|
27
27
|
} from 'react'
|
|
28
28
|
import { AppState } from 'react-native'
|
|
29
|
-
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
30
29
|
import { useWallet, useWalletManagers, useWalletStatus } from '../context/WalletContext'
|
|
31
30
|
import { getDirectPayConfig } from '../toolboxConfig'
|
|
32
31
|
import { getOnline, subscribeOnline } from '../net/online'
|
|
33
32
|
import { makeCreditClassifier } from '../pay/creditErrors'
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
LEGACY_MESSAGE_BOX_URL,
|
|
37
|
-
MESSAGE_BOX_URL_KEY,
|
|
38
|
-
NO_MESSAGE_BOX,
|
|
39
|
-
makePeerPayClient
|
|
40
|
-
} from '../pay/rails/handle'
|
|
33
|
+
import type { AppChain } from '../networks'
|
|
34
|
+
import { makePeerPayClient, readMessageBoxUrl } from '../pay/rails/handle'
|
|
41
35
|
import { sendViaDirect, type DirectSendResult } from '../pay/rails/direct'
|
|
42
|
-
import { profileScopedKey } from '../profiles/profileStore'
|
|
43
36
|
import { deviceKVStorage } from './deviceStore'
|
|
44
37
|
import { DirectPayManager, type DirectPaySnapshot, type DirectPayToast } from './DirectPayManager'
|
|
45
38
|
import { NotSentError } from './payFlow'
|
|
@@ -108,20 +101,17 @@ const DirectPayContext = createContext<DirectPayContextValue>({
|
|
|
108
101
|
|
|
109
102
|
export const useDirectPay = (): DirectPayContextValue => useContext(DirectPayContext)
|
|
110
103
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return !saved || saved === LEGACY_MESSAGE_BOX_URL ? DEFAULT_MESSAGE_BOX_URL : saved
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** The device settings (user's, else the host's, else built-in) and this profile's message box. */
|
|
104
|
+
/**
|
|
105
|
+
* The device settings (user's, else the host's, else built-in) and this
|
|
106
|
+
* profile's message box on `network` (undefined when the user turned it off).
|
|
107
|
+
*/
|
|
119
108
|
async function readInputs(
|
|
120
|
-
hostDefaults: DirectPayHostDefaults
|
|
109
|
+
hostDefaults: DirectPayHostDefaults,
|
|
110
|
+
network: AppChain
|
|
121
111
|
): Promise<{ settings: DirectPaySettings; messageBoxUrl: string | undefined }> {
|
|
122
112
|
const [settings, messageBoxUrl] = await Promise.all([
|
|
123
113
|
loadDirectPaySettings(deviceKVStorage, hostDefaults),
|
|
124
|
-
|
|
114
|
+
readMessageBoxUrl(network).catch(() => undefined)
|
|
125
115
|
])
|
|
126
116
|
return { settings, messageBoxUrl }
|
|
127
117
|
}
|
|
@@ -178,7 +168,7 @@ export const DirectPayProvider: React.FC<{ children: React.ReactNode; onToast?:
|
|
|
178
168
|
useEffect(() => {
|
|
179
169
|
if (!manager) return
|
|
180
170
|
let current = true
|
|
181
|
-
void readInputs(hostDefaults).then(inputs => {
|
|
171
|
+
void readInputs(hostDefaults, selectedNetwork).then(inputs => {
|
|
182
172
|
if (!current) return
|
|
183
173
|
setSettings(inputs.settings)
|
|
184
174
|
setMessageBoxUrl(inputs.messageBoxUrl)
|
|
@@ -186,14 +176,14 @@ export const DirectPayProvider: React.FC<{ children: React.ReactNode; onToast?:
|
|
|
186
176
|
return () => {
|
|
187
177
|
current = false
|
|
188
178
|
}
|
|
189
|
-
}, [manager, hostDefaults])
|
|
179
|
+
}, [manager, hostDefaults, selectedNetwork])
|
|
190
180
|
|
|
191
181
|
const reload = useCallback(async () => {
|
|
192
182
|
if (!manager) return
|
|
193
|
-
const inputs = await readInputs(hostDefaults)
|
|
183
|
+
const inputs = await readInputs(hostDefaults, selectedNetwork)
|
|
194
184
|
setSettings(inputs.settings)
|
|
195
185
|
setMessageBoxUrl(inputs.messageBoxUrl)
|
|
196
|
-
}, [manager, hostDefaults])
|
|
186
|
+
}, [manager, hostDefaults, selectedNetwork])
|
|
197
187
|
|
|
198
188
|
const wallet = managers.permissionsManager as unknown as WebRTPayWallet | undefined
|
|
199
189
|
// The identity key of the wallet it was read from, so a rebuilt wallet never runs on the last one's.
|
|
@@ -219,10 +209,11 @@ export const DirectPayProvider: React.FC<{ children: React.ReactNode; onToast?:
|
|
|
219
209
|
? (makePeerPayClient({
|
|
220
210
|
wallet: wallet as never,
|
|
221
211
|
messageBoxUrl,
|
|
212
|
+
network: selectedNetwork,
|
|
222
213
|
originator: adminOriginator
|
|
223
214
|
}) as MessageBoxLike | null)
|
|
224
215
|
: null,
|
|
225
|
-
[wallet, messageBoxUrl, adminOriginator]
|
|
216
|
+
[wallet, messageBoxUrl, selectedNetwork, adminOriginator]
|
|
226
217
|
)
|
|
227
218
|
|
|
228
219
|
// Start with the wallet, follow its inputs, stop when it goes.
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* dropped before the ack, so it sent the same token there) is credited, and announced, once.
|
|
13
13
|
*
|
|
14
14
|
* Kept. A failure `classifyCreditError` calls environmental (offline, headers behind, a locked
|
|
15
|
-
* database
|
|
15
|
+
* database, or no broadcaster could take the payment when internalizeAction posted it) keeps
|
|
16
|
+
* the payment on this device and answers `received`: by then the payer may
|
|
16
17
|
* broadcast it, so it is better kept than refused. Anything else is refused (`rejected`), which
|
|
17
18
|
* is safe at that point because the payer still has the payment and sends it through the
|
|
18
19
|
* message box instead. A kept payment was acknowledged, so its payer will not send it again,
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
* · test — height 1,697,402, about 52,560 blocks behind its 1,749,962 tip.
|
|
16
16
|
* · ttn — height 0. The whole teratest chain was 27,502 blocks (~2.2 MB), so
|
|
17
17
|
* windowing it buys nothing and starting from genesis costs nothing.
|
|
18
|
+
* · regtest (scaletest) — height 0, the canonical regtest genesis. The chain is
|
|
19
|
+
* short-lived and reset often, and the genesis is the one header every
|
|
20
|
+
* reset keeps.
|
|
18
21
|
*/
|
|
22
|
+
import type { WalletChain } from '../networks'
|
|
23
|
+
|
|
19
24
|
export interface HeaderCheckpoint {
|
|
20
25
|
/** Height of the last a-priori-trusted header. The window starts above it. */
|
|
21
26
|
height: number
|
|
@@ -23,7 +28,7 @@ export interface HeaderCheckpoint {
|
|
|
23
28
|
hash: string
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
export const HEADER_CHECKPOINTS: Record<
|
|
31
|
+
export const HEADER_CHECKPOINTS: Record<WalletChain, HeaderCheckpoint | undefined> = {
|
|
27
32
|
main: {
|
|
28
33
|
height: 907324,
|
|
29
34
|
hash: '00000000000000000ccc802efeef429acb6b670a6b2bac373ece30f7d2df3e26'
|
|
@@ -35,5 +40,9 @@ export const HEADER_CHECKPOINTS: Record<'main' | 'test' | 'ttn', HeaderCheckpoin
|
|
|
35
40
|
ttn: {
|
|
36
41
|
height: 0,
|
|
37
42
|
hash: '000000000499eabba0a88f5b3747231c74b9191c1a4a04b2c2ea817976b7776d'
|
|
43
|
+
},
|
|
44
|
+
regtest: {
|
|
45
|
+
height: 0,
|
|
46
|
+
hash: '0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206'
|
|
38
47
|
}
|
|
39
48
|
}
|
|
@@ -24,7 +24,18 @@ import { utils as chaintracksUtils } from '@bsv/wallet-toolbox-mobile'
|
|
|
24
24
|
import type { HeaderCheckpoint } from './checkpoints'
|
|
25
25
|
import type { HeaderFs } from './fs'
|
|
26
26
|
|
|
27
|
-
const { blockHash, deserializeBaseBlockHeader
|
|
27
|
+
const { blockHash, deserializeBaseBlockHeader } = chaintracksUtils
|
|
28
|
+
/**
|
|
29
|
+
* The toolbox's proof-of-work check, given this store's chain. From
|
|
30
|
+
* @bsv/wallet-toolbox 2.15.0 (bsv-blockchain/ts-stack#819) the chain selects
|
|
31
|
+
* the proof-of-work limit — regtest's is far higher than mainnet's — and an
|
|
32
|
+
* omitted chain keeps mainnet's. Older releases take one argument and ignore
|
|
33
|
+
* the second, which changes nothing for the chains they support.
|
|
34
|
+
*/
|
|
35
|
+
const validateHeaderProofOfWork = chaintracksUtils.validateHeaderProofOfWork as (
|
|
36
|
+
header: Parameters<typeof chaintracksUtils.validateHeaderProofOfWork>[0],
|
|
37
|
+
chain?: string
|
|
38
|
+
) => true
|
|
28
39
|
|
|
29
40
|
const HEADER_BYTES = 80
|
|
30
41
|
const ROOT_BYTES = 32
|
|
@@ -218,7 +229,7 @@ export class HeaderStore {
|
|
|
218
229
|
// header, and accepting it would let anyone mint merkle roots. Takes the
|
|
219
230
|
// display-order hex hash blockHash returns, validates the compact target
|
|
220
231
|
// encoding, and honours the toolbox's consensus proof-of-work exceptions.
|
|
221
|
-
validateHeaderProofOfWork({ ...parsed, height: firstHeight + i, hash })
|
|
232
|
+
validateHeaderProofOfWork({ ...parsed, height: firstHeight + i, hash }, this.chain)
|
|
222
233
|
newRoots.set(new Uint8Array(Utils.toArray(parsed.merkleRoot, 'hex')), i * ROOT_BYTES)
|
|
223
234
|
prev = hash
|
|
224
235
|
}
|
|
@@ -43,7 +43,7 @@ const TONES = {
|
|
|
43
43
|
paymentReceive: require('../../assets/sounds/payment-receive.wav'),
|
|
44
44
|
paymentSend: require('../../assets/sounds/payment-send.wav'),
|
|
45
45
|
vaultDeposit: require('../../assets/sounds/vault-deposit.wav'),
|
|
46
|
-
vaultWithdraw: require('../../assets/sounds/vault-withdraw.wav')
|
|
46
|
+
vaultWithdraw: require('../../assets/sounds/vault-withdraw.wav')
|
|
47
47
|
} as const
|
|
48
48
|
|
|
49
49
|
type ToneName = keyof typeof TONES
|
|
@@ -97,7 +97,7 @@ function playTone(name: ToneName): void {
|
|
|
97
97
|
playsInSilentMode: false,
|
|
98
98
|
interruptionMode: 'mixWithOthers',
|
|
99
99
|
shouldPlayInBackground: false,
|
|
100
|
-
allowsRecording: false
|
|
100
|
+
allowsRecording: false
|
|
101
101
|
})
|
|
102
102
|
modeSet = true
|
|
103
103
|
}
|
|
@@ -142,7 +142,7 @@ export const sounds = {
|
|
|
142
142
|
/** A host's sounds setting: off silences every tone until it's turned on again. */
|
|
143
143
|
setEnabled: (on: boolean) => {
|
|
144
144
|
enabled = on
|
|
145
|
-
}
|
|
145
|
+
}
|
|
146
146
|
} as const
|
|
147
147
|
|
|
148
148
|
export const useConfirmationSound = () => useMemo(() => sounds, [])
|