@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.
Files changed (135) hide show
  1. package/CHANGELOG.md +139 -30
  2. package/README.md +79 -79
  3. package/core/backup/RemoteSyncReader.ts +26 -24
  4. package/core/backup/appData.ts +9 -8
  5. package/core/backup/codec.ts +21 -18
  6. package/core/backup/constants.ts +5 -5
  7. package/core/backup/contactsBackup.ts +8 -8
  8. package/core/backup/cursor.ts +12 -7
  9. package/core/backup/derive.ts +3 -3
  10. package/core/backup/deviceId.ts +2 -2
  11. package/core/backup/erase.ts +2 -2
  12. package/core/backup/preference.ts +2 -2
  13. package/core/backup/push.ts +10 -12
  14. package/core/backup/restore.ts +22 -14
  15. package/core/backup/restoreOnImport.ts +3 -2
  16. package/core/config.tsx +17 -13
  17. package/core/constants.ts +34 -11
  18. package/core/contacts/contactsStore.ts +4 -3
  19. package/core/context/WalletConnectionContext.tsx +294 -212
  20. package/core/context/WalletContext.tsx +132 -97
  21. package/core/context/defaultWalletSettings.ts +4 -2
  22. package/core/demo/demoLedger.ts +1 -5
  23. package/core/directpay/DirectPayProvider.tsx +15 -24
  24. package/core/directpay/receive.ts +2 -1
  25. package/core/headers/checkpoints.ts +10 -1
  26. package/core/headers/headerStore.ts +13 -2
  27. package/core/hooks/useConfirmationSound.ts +3 -3
  28. package/core/hooks/useHaptics.ts +23 -6
  29. package/core/i18n/translations.tsx +303 -123
  30. package/core/index.ts +2 -0
  31. package/core/localpay/codec.ts +12 -6
  32. package/core/localpay/deviceCaps.ts +4 -14
  33. package/core/localpay/pending.ts +2 -1
  34. package/core/localpay/qr.ts +1 -1
  35. package/core/localpay/settlementAck.ts +1 -4
  36. package/core/localpay/transport/ble.ts +2 -2
  37. package/core/localpay/transport/socket.ts +1 -1
  38. package/core/mandala/abortGuard.ts +1 -1
  39. package/core/mandala/drain.ts +3 -0
  40. package/core/mandala/permissionModule.ts +3 -2
  41. package/core/mandala/resendTransfer.ts +4 -1
  42. package/core/mandala/runtime.ts +4 -4
  43. package/core/monitor/TaskBackupPush.ts +10 -13
  44. package/core/net/chainMatch.ts +8 -5
  45. package/core/networks.ts +145 -0
  46. package/core/parsePeerPayURI.ts +4 -1
  47. package/core/pay/beefRepair.ts +6 -3
  48. package/core/pay/creditErrors.ts +37 -1
  49. package/core/pay/rails/address.ts +10 -6
  50. package/core/pay/rails/handle.ts +84 -11
  51. package/core/pay/rails/index.ts +18 -2
  52. package/core/pay/receiveHistory.ts +8 -8
  53. package/core/peerpay/handleResendRequests.ts +11 -18
  54. package/core/peerpay/inboxAttempts.ts +1 -4
  55. package/core/peerpay/rebuildToken.ts +12 -9
  56. package/core/profiles/profileStore.ts +2 -1
  57. package/core/profiles/removalProblems.ts +3 -1
  58. package/core/services/arcTokenStorage.ts +2 -1
  59. package/core/services/arcadeBroadcastProvider.ts +7 -17
  60. package/core/services/secrets/envelope.ts +1 -6
  61. package/core/services/secrets/hkdf.ts +1 -6
  62. package/core/services/secrets/index.ts +3 -22
  63. package/core/services/usdFxRates.ts +1 -4
  64. package/core/services/vault/VaultKeyService.ts +2 -1
  65. package/core/services/vault/chainRecovery.ts +48 -21
  66. package/core/services/vault/metaAuthority.ts +4 -1
  67. package/core/services/vault/r1comb.ts +113 -51
  68. package/core/services/vault/session.ts +5 -1
  69. package/core/services/vault/transfers.ts +699 -576
  70. package/core/services/vault/vaultStore.ts +12 -10
  71. package/core/services/walletArgLimits.ts +1 -2
  72. package/core/services/walletConnectionValidation.ts +44 -28
  73. package/core/services/walletServiceConfig.ts +9 -40
  74. package/core/storage/StorageExpoSQLite.ts +7 -21
  75. package/core/storage/methods/listActionsSql.ts +81 -67
  76. package/core/storage/methods/listOutputsSql.ts +21 -16
  77. package/core/storage/methods/reviewStatusSql.ts +1 -4
  78. package/core/stores/ConnectionStore.ts +1 -1
  79. package/core/theme/ThemeContext.tsx +12 -16
  80. package/core/theme/motion.ts +3 -3
  81. package/core/theme/tokens.ts +6 -6
  82. package/core/toolboxConfig.ts +23 -0
  83. package/core/walletDbRegistry.ts +7 -5
  84. package/core/walletRepair/runWalletCheck.ts +1 -4
  85. package/package.json +2 -2
  86. package/ui/components/pay/AddressReceive.tsx +3 -3
  87. package/ui/components/pay/HandleReceive.tsx +58 -15
  88. package/ui/components/pay/MessageBoxConfig.tsx +46 -20
  89. package/ui/components/pay/NearbyFlow.tsx +575 -507
  90. package/ui/components/pay/OfflineNotice.tsx +1 -3
  91. package/ui/components/pay/PayCellRow.tsx +1 -4
  92. package/ui/components/pay/PayForm.tsx +1 -3
  93. package/ui/components/pay/RequestHub.tsx +14 -6
  94. package/ui/components/pay/UniversalSend.tsx +137 -40
  95. package/ui/components/pay/tokenSendCopy.ts +1 -2
  96. package/ui/components/pay/useRecipientInput.ts +2 -2
  97. package/ui/components/security/WalletLockNotice.tsx +1 -3
  98. package/ui/components/ui/AlertCard.tsx +44 -45
  99. package/ui/components/ui/BlurChrome.tsx +4 -15
  100. package/ui/components/ui/Celebration.tsx +3 -3
  101. package/ui/components/ui/ChoiceSheet.ts +1 -3
  102. package/ui/components/ui/ErrorBoundary.tsx +2 -6
  103. package/ui/components/ui/GroupedList.tsx +13 -31
  104. package/ui/components/ui/IconButton.tsx +6 -9
  105. package/ui/components/ui/ListRow.tsx +19 -25
  106. package/ui/components/ui/PresenceRow.tsx +4 -4
  107. package/ui/components/ui/PressableScale.tsx +24 -20
  108. package/ui/components/ui/Toast.tsx +23 -16
  109. package/ui/components/vault/KeyChooser.tsx +9 -6
  110. package/ui/components/vault/VaultBackdrop.tsx +1 -8
  111. package/ui/components/vault/VaultCeremonySheet.tsx +5 -5
  112. package/ui/components/wallet/ActivityRow.tsx +3 -2
  113. package/ui/components/wallet/BackupReminderSheet.tsx +1 -5
  114. package/ui/components/wallet/Balance.tsx +4 -1
  115. package/ui/components/wallet/ContactActivityList.tsx +7 -7
  116. package/ui/components/wallet/IconPickerSheet.tsx +1 -5
  117. package/ui/components/wallet/ProfileSwitcherPopover.tsx +6 -1
  118. package/ui/components/wallet/tokenEviction.ts +4 -1
  119. package/ui/hooks/useMandala.ts +1 -7
  120. package/ui/hooks/useOfflineNoticeActions.ts +21 -27
  121. package/ui/hooks/useSpendableBalance.ts +2 -2
  122. package/ui/hooks/useVaultCoverage.ts +7 -1
  123. package/ui/index.ts +9 -1
  124. package/ui/resolveIdentity.ts +20 -8
  125. package/ui/screens/ConnectionsScreen.tsx +44 -18
  126. package/ui/screens/LogsScreen.tsx +24 -22
  127. package/ui/screens/PairScreen.tsx +85 -54
  128. package/ui/screens/PayScreen.tsx +5 -1
  129. package/ui/screens/ProfileScreen.tsx +0 -3
  130. package/ui/screens/TrustScreen.tsx +125 -80
  131. package/ui/screens/VaultScreen.tsx +19 -7
  132. package/ui/screens/VaultTransferScreen.tsx +5 -1
  133. package/ui/screens/WalletCheckScreen.tsx +14 -17
  134. package/ui/screens/WalletConfigScreen.tsx +414 -376
  135. package/ui/screens/WalletHomeScreen.tsx +47 -42
@@ -239,9 +239,7 @@ export default function OfflineNotice({
239
239
  incoming money, and a bare "damaged data" title reads as "my queued
240
240
  payments vanished". Steer away from blind re-sends — a quarantined entry
241
241
  may already have been credited. */}
242
- <Text style={[styles.body, { color: colors.textSecondary }]}>
243
- {t('pay_offline_kv_corrupt_body')}
244
- </Text>
242
+ <Text style={[styles.body, { color: colors.textSecondary }]}>{t('pay_offline_kv_corrupt_body')}</Text>
245
243
  </View>
246
244
  </View>
247
245
  )}
@@ -54,10 +54,7 @@ export default function PayCellRow({ title, subtitle, icon, onPress, disabled =
54
54
  accessibilityLabel={`${title}. ${subtitle}`}
55
55
  >
56
56
  <View
57
- style={[
58
- styles.iconWrap,
59
- { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
60
- ]}
57
+ style={[styles.iconWrap, { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }]}
61
58
  >
62
59
  <Ionicons name={icon} size={20} color={colors.textSecondary} />
63
60
  </View>
@@ -184,9 +184,7 @@ export function PayCta({
184
184
  ) : (
185
185
  <>
186
186
  <Ionicons name={icon} size={20} color={enabled ? colors.textOnAccent : colors.textTertiary} />
187
- <Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>
188
- {text}
189
- </Text>
187
+ <Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>{text}</Text>
190
188
  </>
191
189
  )}
192
190
  </PressableScale>
@@ -28,6 +28,11 @@ export interface RequestHubProps {
28
28
  onChangeRequestSats: (v: string) => void
29
29
  onPick: (method: RequestMethod) => void
30
30
  online: boolean
31
+ /**
32
+ * Whether this network has an address rail at all. It needs WhatsOnChain to
33
+ * see payments arrive, and the scaling teratestnet has none. Default true.
34
+ */
35
+ addressAvailable?: boolean
31
36
  /** Held assets; empty means no picker and today's screen. */
32
37
  balances?: TokenBalance[]
33
38
  /** `null` is BSV. Chosen upstream (Home's coin switcher, or a deep link). */
@@ -55,6 +60,7 @@ export default function RequestHub({
55
60
  onChangeRequestSats,
56
61
  onPick,
57
62
  online,
63
+ addressAvailable = true,
58
64
  balances = [],
59
65
  selectedAssetId = null,
60
66
  assetStatus = null
@@ -113,14 +119,16 @@ export default function RequestHub({
113
119
  <PayCellRow
114
120
  title={t('pay_method_address')}
115
121
  subtitle={
116
- asset
117
- ? t('pay_asset_address_status', { ticker: asset.ticker })
118
- : online
119
- ? t('pay_cell_address_get_sub')
120
- : t('pay_offline_needs_internet')
122
+ !addressAvailable
123
+ ? t('pay_address_unavailable_network')
124
+ : asset
125
+ ? t('pay_asset_address_status', { ticker: asset.ticker })
126
+ : online
127
+ ? t('pay_cell_address_get_sub')
128
+ : t('pay_offline_needs_internet')
121
129
  }
122
130
  icon="wallet-outline"
123
- disabled={!online || !!asset}
131
+ disabled={!addressAvailable || !online || !!asset}
124
132
  onPress={() => onPick('get-address')}
125
133
  />
126
134
  </View>
@@ -25,6 +25,9 @@ import AmountDisplay from '../wallet/AmountDisplay'
25
25
  import { showAlert } from '../ui/AlertCard'
26
26
  import { showChoiceSheet } from '../ui/ChoiceSheet'
27
27
  import { promptCheckWallet } from '../../screens/WalletCheckScreen'
28
+ import { useDirectPay } from '../../../core/directpay/DirectPayProvider'
29
+ import { fallbackPrompt, payIdentity } from '../../../core/directpay/payFlow'
30
+ import type { PayOutcome } from '../../../core/directpay/types'
28
31
  import { userFacingPayError } from '../../../core/pay/userError'
29
32
  import PressableScale from '../ui/PressableScale'
30
33
  import { showToast } from '../ui/Toast'
@@ -364,7 +367,7 @@ function UniversalSendInner(
364
367
  const assetStatus = useAssetStatus(asset?.assetId ?? null).status
365
368
 
366
369
  // Read-only here: the server is configured in Settings › Advanced.
367
- const { messageBoxUrl } = useMessageBoxConfig(t)
370
+ const { messageBoxUrl } = useMessageBoxConfig(t, selectedNetwork)
368
371
  const isConfigured = !!messageBoxUrl && messageBoxUrl !== NO_MESSAGE_BOX
369
372
 
370
373
  /**
@@ -801,8 +804,14 @@ function UniversalSendInner(
801
804
  }, [])
802
805
 
803
806
  const peerPayClient = useMemo(
804
- () => makePeerPayClient({ wallet: wallet as never, messageBoxUrl, originator: adminOriginator }),
805
- [messageBoxUrl, wallet, adminOriginator]
807
+ () =>
808
+ makePeerPayClient({
809
+ wallet: wallet as never,
810
+ messageBoxUrl,
811
+ network: selectedNetwork,
812
+ originator: adminOriginator
813
+ }),
814
+ [messageBoxUrl, wallet, adminOriginator, selectedNetwork]
806
815
  )
807
816
 
808
817
  const loadOutbox = useCallback(async () => {
@@ -822,7 +831,11 @@ function UniversalSendInner(
822
831
  // XR-051: without this, an unauthenticated resend_request could not be
823
832
  // told apart from a legitimate one and would be surfaced (and kept
824
833
  // being surfaced) as pending forever.
825
- await listPendingResendRequests({ client, storage, listPeerPayAction: makeListPeerPayAction(wallet, adminOriginator) })
834
+ await listPendingResendRequests({
835
+ client,
836
+ storage,
837
+ listPeerPayAction: makeListPeerPayAction(wallet, adminOriginator)
838
+ })
826
839
  } catch {
827
840
  // Home owns the unanswered-resend banner; a failed poll here is retryable.
828
841
  }
@@ -847,23 +860,69 @@ function UniversalSendInner(
847
860
  [t]
848
861
  )
849
862
 
863
+ const directPay = useDirectPay()
864
+
850
865
  const sendHandle = useCallback(
851
866
  async (to: Extract<RecipientTarget, { kind: 'handle' }>, sats: number) => {
852
867
  const client = peerPayClient
853
868
  if (!client) throw new Error(t('message_box_off_hint'))
854
869
  if (!storage || !wallet) throw new Error(t('wallet_not_ready'))
855
- const { satoshis: paidSats } = await sendViaHandle({
856
- wallet: wallet as any,
857
- adminOriginator,
858
- client,
859
- storage,
860
- recipient: to.identityKey,
861
- recipientHost: to.messageBoxUrl,
862
- satoshis: sats,
863
- messageBoxUrl,
864
- note,
865
- recipientName: recipient.selectedIdentity?.name
866
- })
870
+ const recipientName = recipient.selectedIdentity?.name
871
+ const name = recipientName || abbreviateKey(to.identityKey)
872
+ let paidSats = sats
873
+ const viaMessageBox = async () => {
874
+ const result = await sendViaHandle({
875
+ wallet: wallet as any,
876
+ adminOriginator,
877
+ client,
878
+ storage,
879
+ recipient: to.identityKey,
880
+ recipientHost: to.messageBoxUrl,
881
+ satoshis: sats,
882
+ messageBoxUrl,
883
+ note,
884
+ recipientName
885
+ })
886
+ paidSats = result.satoshis
887
+ }
888
+ // Live first when this build and wallet can pay directly; the message box is the fallback,
889
+ // offered only when the live attempt proved nothing was spent (see payIdentity).
890
+ const viaDirect = directPay.canSendDirect
891
+ ? async () => {
892
+ const result = await directPay.sendDirect({
893
+ recipient: to.identityKey,
894
+ satoshis: sats,
895
+ note,
896
+ recipientName,
897
+ recipientHost: to.messageBoxUrl
898
+ })
899
+ paidSats = result.satoshis
900
+ return result
901
+ }
902
+ : undefined
903
+ let outcome: PayOutcome = await payIdentity({ direct: viaDirect, messageBox: viaMessageBox, name })
904
+ if (outcome.kind === 'ask_fallback') {
905
+ const prompt = fallbackPrompt(outcome.reason, name)
906
+ // XR-053: accepting this is what sends to a link-named host, so the
907
+ // host is named here, where the payer chooses the message box.
908
+ const message = to.messageBoxUrl
909
+ ? `${t(prompt.key, prompt.params)}\n\n${t('direct_pay_fallback_host', { host: to.messageBoxUrl })}`
910
+ : t(prompt.key, prompt.params)
911
+ const choice = await showAlert({
912
+ title: t('direct_pay_fallback_title'),
913
+ message,
914
+ buttons: [
915
+ { text: t('cancel'), key: 'cancel', style: 'cancel' },
916
+ { text: t('direct_pay_fallback_send'), key: 'send' }
917
+ ]
918
+ })
919
+ if (choice !== 'send') throw new Error(t('direct_pay_failed_cancelled'))
920
+ outcome = await payIdentity({ messageBox: viaMessageBox, name })
921
+ }
922
+ if (outcome.kind === 'failed') {
923
+ if (outcome.detail) console.warn('[pay] direct pay failed:', outcome.key, outcome.detail)
924
+ throw new Error(t(outcome.key, outcome.params))
925
+ }
867
926
  await loadOutbox()
868
927
  // The overlay stages its own haptic (inside Celebration) and tone; firing
869
928
  // haptics.success() here would double the beat. Only a human-readable
@@ -875,11 +934,23 @@ function UniversalSendInner(
875
934
  // The handle rail always drops the payment in the recipient's message
876
935
  // box rather than handing it over in person — worth saying explicitly
877
936
  // here, since it is the one thing an in-person (Nearby) payer never
878
- // has to wonder about (ux §4.2/§8 "Success / arrival").
879
- statusNote: t('pay_sent_handed_to_wallet')
937
+ // has to wonder about (ux §4.2/§8 "Success / arrival"). A live payment is already in
938
+ // the recipient's wallet, so it says that instead.
939
+ statusNote: outcome.kind === 'paid_live' ? t('direct_pay_sent_live') : t('pay_sent_handed_to_wallet')
880
940
  })
881
941
  },
882
- [peerPayClient, storage, wallet, adminOriginator, messageBoxUrl, note, recipient.selectedIdentity, loadOutbox, t]
942
+ [
943
+ peerPayClient,
944
+ storage,
945
+ wallet,
946
+ adminOriginator,
947
+ messageBoxUrl,
948
+ note,
949
+ recipient.selectedIdentity,
950
+ loadOutbox,
951
+ t,
952
+ directPay
953
+ ]
883
954
  )
884
955
 
885
956
  const sendAddress = useCallback(
@@ -1069,7 +1140,12 @@ function UniversalSendInner(
1069
1140
  // of which client is used.
1070
1141
  const client =
1071
1142
  peerPayClient ??
1072
- makePeerPayClient({ wallet: wallet as never, messageBoxUrl: entry.messageBoxUrl, originator: adminOriginator })
1143
+ makePeerPayClient({
1144
+ wallet: wallet as never,
1145
+ messageBoxUrl: entry.messageBoxUrl,
1146
+ network: selectedNetwork,
1147
+ originator: adminOriginator
1148
+ })
1073
1149
  if (!client || !storage) {
1074
1150
  showToast(t('message_box_off_hint'), { type: 'error' })
1075
1151
  return
@@ -1319,21 +1395,36 @@ function UniversalSendInner(
1319
1395
  ? pickedHandle.handle
1320
1396
  : abbreviateKey(target.identityKey)
1321
1397
  : undefined
1398
+ // Only a positive fact earns a line. A key that is neither a contact nor
1399
+ // registered (a scanned or pasted Identifier) gets nothing: there is no
1400
+ // check the payer could run here, so a warning would only cry wolf.
1322
1401
  const reviewTrust = targetIsContact
1323
- ? { icon: 'person-circle-outline', color: colors.textSecondary, text: t('pay_trust_contact') }
1402
+ ? { icon: 'person-circle-outline', text: t('pay_trust_contact') }
1324
1403
  : recipient.selectedIdentity
1325
- ? { icon: 'shield-checkmark-outline', color: colors.textSecondary, text: t('pay_trust_handle_attested') }
1326
- : { icon: 'alert-circle-outline', color: colors.warning, text: t('pay_trust_unverified') }
1404
+ ? { icon: 'shield-checkmark-outline', text: t('pay_trust_handle_attested') }
1405
+ : undefined
1327
1406
  const showNoteRow = isHandle || (isAddress && !asset)
1407
+ // How a handle payment will travel. Live first whenever this wallet can pay
1408
+ // live (BSV only; a token send always takes its own rail): the dial goes to the recipient's identity key and never uses a
1409
+ // link-named host, so naming that host here would be untrue.
1410
+ //
1328
1411
  // XR-053: a `peerpay:` link's `url` extension silently overrides normal
1329
1412
  // recipient-host resolution (the overlay/advertisement lookup) with no
1330
- // binding to the recipient's identity. Surfacing the resolved host on the
1331
- // last screen before Send is the local, backwards-compatible hardening —
1332
- // the payer can catch a substituted/unexpected host before committing;
1333
- // full closure (a recipient-signed delivery receipt) is a wire-protocol
1334
- // change out of scope here.
1413
+ // binding to the recipient's identity. That host is only used by the
1414
+ // message box, so it is surfaced wherever the message box is chosen: here
1415
+ // when it is the only route, otherwise in the fallback prompt the payer
1416
+ // must accept (sendHandle). Full closure (a recipient-signed delivery
1417
+ // receipt) is a wire-protocol change out of scope here.
1335
1418
  const linkHost = target?.kind === 'handle' ? target.messageBoxUrl : undefined
1336
- const showHostRow = !!linkHost
1419
+ const reviewRoute =
1420
+ target?.kind !== 'handle'
1421
+ ? undefined
1422
+ : directPay.canSendDirect && !asset
1423
+ ? { icon: 'flash-outline', text: t('pay_review_route_live') }
1424
+ : linkHost
1425
+ ? { icon: 'mail-outline', text: t('pay_review_delivery_host'), host: linkHost }
1426
+ : undefined
1427
+ const showRouteRow = !!reviewRoute
1337
1428
 
1338
1429
  return (
1339
1430
  <ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
@@ -1484,10 +1575,10 @@ function UniversalSendInner(
1484
1575
  </Text>
1485
1576
  )}
1486
1577
  </View>
1487
- {target.kind === 'handle' && (
1578
+ {target.kind === 'handle' && reviewTrust && (
1488
1579
  <View style={styles.reviewTrustRow}>
1489
- <Ionicons name={reviewTrust.icon as never} size={12} color={reviewTrust.color} />
1490
- <Text style={[styles.reviewTrust, { color: reviewTrust.color }]} numberOfLines={1}>
1580
+ <Ionicons name={reviewTrust.icon as never} size={12} color={colors.textSecondary} />
1581
+ <Text style={[styles.reviewTrust, { color: colors.textSecondary }]} numberOfLines={1}>
1491
1582
  {reviewTrust.text}
1492
1583
  </Text>
1493
1584
  </View>
@@ -1498,7 +1589,7 @@ function UniversalSendInner(
1498
1589
  <View
1499
1590
  style={[
1500
1591
  styles.reviewRow,
1501
- !showNoteRow && !showHostRow && styles.reviewRowLast,
1592
+ !showNoteRow && !showRouteRow && styles.reviewRowLast,
1502
1593
  { borderBottomColor: colors.separator }
1503
1594
  ]}
1504
1595
  >
@@ -1524,10 +1615,10 @@ function UniversalSendInner(
1524
1615
  </View>
1525
1616
  </View>
1526
1617
 
1527
- {/* A link-named host is never silent (XR-053): the review screen is the
1528
- last stop before Send, and Send is the only confirmation this
1529
- narrow fix adds — no separate dialog to build or maintain. */}
1530
- {showHostRow && (
1618
+ {/* Information, not a warning: the route the payment will take. A
1619
+ link-named host shows here only when the message box is the
1620
+ route (XR-053, see reviewRoute). */}
1621
+ {reviewRoute && (
1531
1622
  <View
1532
1623
  style={[
1533
1624
  styles.reviewRow,
@@ -1535,9 +1626,15 @@ function UniversalSendInner(
1535
1626
  { borderBottomColor: colors.separator }
1536
1627
  ]}
1537
1628
  >
1538
- <Ionicons name="alert-circle-outline" size={16} color={colors.warning} />
1539
- <Text style={[styles.reviewHostText, { color: colors.warning }]} numberOfLines={2}>
1540
- {t('pay_review_delivery_host')} <Text style={{ fontWeight: '600' }}>{linkHost}</Text>
1629
+ <Ionicons name={reviewRoute.icon as never} size={16} color={colors.textSecondary} />
1630
+ <Text style={[styles.reviewHostText, { color: colors.textSecondary }]} numberOfLines={2}>
1631
+ {reviewRoute.text}
1632
+ {!!reviewRoute.host && (
1633
+ <>
1634
+ {' '}
1635
+ <Text style={{ fontWeight: '600' }}>{reviewRoute.host}</Text>
1636
+ </>
1637
+ )}
1541
1638
  </Text>
1542
1639
  </View>
1543
1640
  )}
@@ -58,8 +58,7 @@ export function tokenRefusalCopy(code: string, ctx: TokenSendContext): TokenSend
58
58
  if (has(c, 'recipient', 'allowlist', 'not_allowed', 'blocked', 'registry', 'membership', 'sanction'))
59
59
  return { key: 'token_err_refused_recipient', values }
60
60
  if (has(c, 'insufficient')) return { key: 'token_err_balance_changed', values }
61
- if (has(c, 'busy', 'already in flight', 'in flight'))
62
- return { key: 'token_err_busy', values }
61
+ if (has(c, 'busy', 'already in flight', 'in flight')) return { key: 'token_err_busy', values }
63
62
  if (has(c, 'fund', 'insufficient funds', 'not enough satoshis'))
64
63
  return { key: 'pay_asset_needs_bsv', values, action: 'get-bsv' }
65
64
  return { key: 'token_err_refused', values }
@@ -17,7 +17,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
17
17
  import { Keyboard } from 'react-native'
18
18
  import { IdentityClient } from '@bsv/sdk'
19
19
  import type { DisplayableIdentity } from '@bsv/sdk'
20
- import { searchIdentities } from '../../resolveIdentity'
20
+ import { identityClientOptions, searchIdentities } from '../../resolveIdentity'
21
21
  import {
22
22
  classifyRecipientInput,
23
23
  classifyScan,
@@ -98,7 +98,7 @@ export function useRecipientInput({
98
98
  useEffect(() => {
99
99
  if (!wallet) return
100
100
  try {
101
- identityClientRef.current = new IdentityClient(wallet as never, undefined, adminOriginator)
101
+ identityClientRef.current = new IdentityClient(wallet as never, identityClientOptions(), adminOriginator)
102
102
  } catch {
103
103
  // Identity search is decorative; a client that will not build leaves the form usable.
104
104
  }
@@ -109,9 +109,7 @@ export default function WalletLockNotice() {
109
109
  onPress={lost ? onRestore : unlock}
110
110
  style={[styles.primary, { backgroundColor: colors.accent }]}
111
111
  >
112
- <Text style={styles.primaryText}>
113
- {lost ? t('wallet_lost_restore') : t('wallet_unlock_retry')}
114
- </Text>
112
+ <Text style={styles.primaryText}>{lost ? t('wallet_lost_restore') : t('wallet_unlock_retry')}</Text>
115
113
  </PressableScale>
116
114
  </View>
117
115
  )
@@ -22,7 +22,7 @@ import Animated, {
22
22
  useAnimatedStyle,
23
23
  withSpring,
24
24
  withTiming,
25
- useReducedMotion,
25
+ useReducedMotion
26
26
  } from 'react-native-reanimated'
27
27
  import { useTheme, spacing, radii, typography, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
28
28
 
@@ -95,16 +95,11 @@ export function AlertHost() {
95
95
  // Reset progress to 0 before animating in to avoid stale values.
96
96
  progress.value = 0
97
97
  // Fire warning haptic at most once per distinct alert object.
98
- if (
99
- current.buttons?.some(b => b.style === 'destructive') &&
100
- lastHapticAlert.current !== current
101
- ) {
98
+ if (current.buttons?.some(b => b.style === 'destructive') && lastHapticAlert.current !== current) {
102
99
  lastHapticAlert.current = current
103
100
  haptics.warning()
104
101
  }
105
- progress.value = reducedMotion
106
- ? withTiming(1, { duration: durations.instant })
107
- : withSpring(1, springs.snappy)
102
+ progress.value = reducedMotion ? withTiming(1, { duration: durations.instant }) : withSpring(1, springs.snappy)
108
103
  }
109
104
  }, [current, progress, reducedMotion])
110
105
 
@@ -120,28 +115,34 @@ export function AlertHost() {
120
115
  done.alert.resolve(done.key)
121
116
  }, [])
122
117
 
123
- const dismiss = useCallback((key: string) => {
124
- if (!current || exiting.current) return
125
- exiting.current = true
126
- pending.current = { alert: current, key, fallback: setTimeout(finish, durations.instant + DISMISS_FALLBACK_MS) }
127
- progress.value = withTiming(0, { duration: durations.instant })
128
- // After the exit fade, hide the modal. iOS reports the native dismissal
129
- // through onDismiss; Android has no such event and nothing presented over
130
- // it to protect, so it finishes here.
131
- setTimeout(() => {
132
- if (Platform.OS === 'ios') setHiding(true)
133
- else finish()
134
- }, durations.instant)
135
- }, [current, progress, finish])
118
+ const dismiss = useCallback(
119
+ (key: string) => {
120
+ if (!current || exiting.current) return
121
+ exiting.current = true
122
+ pending.current = { alert: current, key, fallback: setTimeout(finish, durations.instant + DISMISS_FALLBACK_MS) }
123
+ progress.value = withTiming(0, { duration: durations.instant })
124
+ // After the exit fade, hide the modal. iOS reports the native dismissal
125
+ // through onDismiss; Android has no such event and nothing presented over
126
+ // it to protect, so it finishes here.
127
+ setTimeout(() => {
128
+ if (Platform.OS === 'ios') setHiding(true)
129
+ else finish()
130
+ }, durations.instant)
131
+ },
132
+ [current, progress, finish]
133
+ )
136
134
 
137
- useEffect(() => () => {
138
- if (pending.current) clearTimeout(pending.current.fallback)
139
- }, [])
135
+ useEffect(
136
+ () => () => {
137
+ if (pending.current) clearTimeout(pending.current.fallback)
138
+ },
139
+ []
140
+ )
140
141
 
141
142
  const backdropStyle = useAnimatedStyle(() => ({ opacity: progress.value }))
142
143
  const cardStyle = useAnimatedStyle(() => ({
143
144
  opacity: progress.value,
144
- transform: [{ scale: 0.95 + 0.05 * progress.value }],
145
+ transform: [{ scale: 0.95 + 0.05 * progress.value }]
145
146
  }))
146
147
 
147
148
  if (!current) return null
@@ -149,9 +150,7 @@ export function AlertHost() {
149
150
  const sideBySide = buttons.length === 2
150
151
 
151
152
  const buttonColor = (b: AlertButton) =>
152
- b.style === 'destructive' ? colors.error
153
- : b.style === 'cancel' ? colors.textSecondary
154
- : colors.info
153
+ b.style === 'destructive' ? colors.error : b.style === 'cancel' ? colors.textSecondary : colors.info
155
154
 
156
155
  return (
157
156
  <Modal
@@ -166,17 +165,15 @@ export function AlertHost() {
166
165
  <Animated.View style={[styles.backdrop, { backgroundColor: colors.scrim }, backdropStyle]}>
167
166
  <Pressable style={StyleSheet.absoluteFill} onPress={() => dismiss('cancel')} />
168
167
  <Animated.View
169
- style={[
170
- styles.card,
171
- { backgroundColor: colors.sheetBackground, borderColor: colors.separator },
172
- cardStyle,
173
- ]}
168
+ style={[styles.card, { backgroundColor: colors.sheetBackground, borderColor: colors.separator }, cardStyle]}
174
169
  >
175
170
  <Text style={[styles.title, { color: colors.textPrimary }]}>{current.title}</Text>
176
171
  {!!current.message && (
177
172
  <Text style={[styles.message, { color: colors.textSecondary }]}>{current.message}</Text>
178
173
  )}
179
- <View style={[styles.buttonGroup, { borderTopColor: colors.separator }, !sideBySide && styles.buttonGroupStacked]}>
174
+ <View
175
+ style={[styles.buttonGroup, { borderTopColor: colors.separator }, !sideBySide && styles.buttonGroupStacked]}
176
+ >
180
177
  {buttons.map((b, i) => (
181
178
  <Pressable
182
179
  key={b.key ?? b.text}
@@ -187,9 +184,11 @@ export function AlertHost() {
187
184
  // resolves to a zero flex-basis and clips the label against
188
185
  // minHeight, so stacked buttons size to their content instead.
189
186
  sideBySide && styles.buttonRowItem,
190
- sideBySide && i > 0 && { borderLeftWidth: StyleSheet.hairlineWidth, borderLeftColor: colors.separator },
191
- !sideBySide && i > 0 && { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: colors.separator },
192
- pressed && { backgroundColor: colors.fillTertiary },
187
+ sideBySide &&
188
+ i > 0 && { borderLeftWidth: StyleSheet.hairlineWidth, borderLeftColor: colors.separator },
189
+ !sideBySide &&
190
+ i > 0 && { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: colors.separator },
191
+ pressed && { backgroundColor: colors.fillTertiary }
193
192
  ]}
194
193
  accessibilityRole="button"
195
194
  >
@@ -197,7 +196,7 @@ export function AlertHost() {
197
196
  style={[
198
197
  styles.buttonText,
199
198
  { color: buttonColor(b) },
200
- (b.style === 'destructive' || b.style === 'cancel') && styles.buttonTextBold,
199
+ (b.style === 'destructive' || b.style === 'cancel') && styles.buttonTextBold
201
200
  ]}
202
201
  >
203
202
  {b.text}
@@ -215,30 +214,30 @@ const styles = StyleSheet.create({
215
214
  backdrop: {
216
215
  flex: 1,
217
216
  alignItems: 'center',
218
- justifyContent: 'center',
217
+ justifyContent: 'center'
219
218
  },
220
219
  card: {
221
220
  width: 280,
222
221
  borderRadius: radii.xl,
223
222
  borderWidth: StyleSheet.hairlineWidth,
224
223
  overflow: 'hidden',
225
- paddingTop: spacing.xl,
224
+ paddingTop: spacing.xl
226
225
  },
227
226
  title: {
228
227
  ...typography.headline,
229
228
  textAlign: 'center',
230
- paddingHorizontal: spacing.xl,
229
+ paddingHorizontal: spacing.xl
231
230
  },
232
231
  message: {
233
232
  ...typography.footnote,
234
233
  textAlign: 'center',
235
234
  paddingHorizontal: spacing.xl,
236
- marginTop: spacing.xs,
235
+ marginTop: spacing.xs
237
236
  },
238
237
  buttonGroup: {
239
238
  flexDirection: 'row',
240
239
  marginTop: spacing.lg,
241
- borderTopWidth: StyleSheet.hairlineWidth,
240
+ borderTopWidth: StyleSheet.hairlineWidth
242
241
  },
243
242
  buttonGroupStacked: { flexDirection: 'column' },
244
243
  button: {
@@ -248,9 +247,9 @@ const styles = StyleSheet.create({
248
247
  paddingVertical: spacing.md,
249
248
  // Keep long labels off the card edge / hairline divider so they wrap
250
249
  // inside the button instead of touching (or escaping) the border.
251
- paddingHorizontal: spacing.sm,
250
+ paddingHorizontal: spacing.sm
252
251
  },
253
252
  buttonRowItem: { flex: 1 },
254
253
  buttonText: { ...typography.body, textAlign: 'center' },
255
- buttonTextBold: { fontWeight: '600' },
254
+ buttonTextBold: { fontWeight: '600' }
256
255
  })
@@ -31,12 +31,7 @@ function loadBlurView(): BlurViewComponent {
31
31
  * Translucent wrapper using expo-blur on iOS, solid fallback on Android.
32
32
  * Used for toolbar chrome and floating glass pill fallbacks.
33
33
  */
34
- export const BlurChrome: React.FC<BlurChromeProps> = ({
35
- children,
36
- intensity = 80,
37
- borderRadius = 0,
38
- style
39
- }) => {
34
+ export const BlurChrome: React.FC<BlurChromeProps> = ({ children, intensity = 80, borderRadius = 0, style }) => {
40
35
  const { isDark, colors } = useTheme()
41
36
 
42
37
  if (Platform.OS === 'ios') {
@@ -53,13 +48,7 @@ export const BlurChrome: React.FC<BlurChromeProps> = ({
53
48
  }
54
49
 
55
50
  return (
56
- <View
57
- style={[
58
- styles.container,
59
- { borderRadius, backgroundColor: colors.chromeBackground },
60
- style
61
- ]}
62
- >
51
+ <View style={[styles.container, { borderRadius, backgroundColor: colors.chromeBackground }, style]}>
63
52
  {children}
64
53
  </View>
65
54
  )
@@ -67,6 +56,6 @@ export const BlurChrome: React.FC<BlurChromeProps> = ({
67
56
 
68
57
  const styles = StyleSheet.create({
69
58
  container: {
70
- overflow: 'hidden',
71
- },
59
+ overflow: 'hidden'
60
+ }
72
61
  })
@@ -13,7 +13,7 @@ import Animated, {
13
13
  withSpring,
14
14
  withTiming,
15
15
  withDelay,
16
- useReducedMotion,
16
+ useReducedMotion
17
17
  } from 'react-native-reanimated'
18
18
  import { useTheme, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
19
19
 
@@ -54,7 +54,7 @@ export default function Celebration({ size = 88, onDone }: CelebrationProps) {
54
54
 
55
55
  const circleStyle = useAnimatedStyle(() => ({
56
56
  opacity: opacity.value,
57
- transform: [{ scale: scale.value }],
57
+ transform: [{ scale: scale.value }]
58
58
  }))
59
59
  const pathProps = useAnimatedProps(() => ({ strokeDashoffset: draw.value }))
60
60
 
@@ -80,5 +80,5 @@ export default function Celebration({ size = 88, onDone }: CelebrationProps) {
80
80
  }
81
81
 
82
82
  const styles = StyleSheet.create({
83
- center: { alignItems: 'center', justifyContent: 'center' },
83
+ center: { alignItems: 'center', justifyContent: 'center' }
84
84
  })
@@ -28,9 +28,7 @@ export async function showChoiceSheet(args: {
28
28
  const ordered = choiceSheetOrder(args.options, cancelKey)
29
29
  const labelFor = (key: string) =>
30
30
  key === cancelKey ? cancelLabel : (args.options.find(o => o.key === key)?.label ?? key)
31
- const destructiveIndexes = ordered.flatMap((o, i) =>
32
- 'destructive' in o && o.destructive ? [i] : []
33
- )
31
+ const destructiveIndexes = ordered.flatMap((o, i) => ('destructive' in o && o.destructive ? [i] : []))
34
32
 
35
33
  if (Platform.OS === 'ios') {
36
34
  return new Promise(resolve => {