@bsv/expo-wallet-toolbox 0.4.0 → 0.7.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 (182) hide show
  1. package/CHANGELOG.md +547 -0
  2. package/README.md +19 -1
  3. package/assets/sounds/vault-deposit.wav +0 -0
  4. package/assets/sounds/vault-withdraw.wav +0 -0
  5. package/core/amountFormatHelpers.ts +238 -34
  6. package/core/backup/RemoteSyncReader.ts +2 -5
  7. package/core/backup/codec.ts +2 -2
  8. package/core/backup/push.ts +1 -1
  9. package/core/config.tsx +16 -1
  10. package/core/contacts/contactActivity.ts +153 -0
  11. package/core/contacts/contactCache.ts +41 -0
  12. package/core/contacts/contactsStore.ts +183 -0
  13. package/core/context/VaultContext.tsx +8 -11
  14. package/core/context/WalletConnectionContext.tsx +137 -52
  15. package/core/context/WalletContext.tsx +464 -30
  16. package/core/demo/demoAssets.ts +60 -0
  17. package/core/demo/demoLedger.ts +240 -0
  18. package/core/demo/demoMandalaRuntime.ts +96 -0
  19. package/core/demo/demoMode.ts +38 -0
  20. package/core/demo/demoWallet.ts +25 -0
  21. package/core/demo/index.ts +26 -0
  22. package/core/demo/useDemo.ts +59 -0
  23. package/core/headers/OfflineFirstChaintracks.ts +52 -14
  24. package/core/headers/headerStore.ts +7 -10
  25. package/core/hooks/useConfirmationSound.ts +14 -8
  26. package/core/i18n/translations.tsx +4562 -986
  27. package/core/identity/contactLink.ts +36 -0
  28. package/core/identity/handleRegistry/client.ts +285 -0
  29. package/core/identity/handleRegistry/profileCert.ts +254 -0
  30. package/core/identity/handleRegistry/registration.ts +559 -0
  31. package/core/identity/handleRegistry/resolver.ts +247 -0
  32. package/core/identity/handleRegistry/rules.ts +104 -0
  33. package/core/index.ts +116 -15
  34. package/core/localpay/build.ts +674 -37
  35. package/core/localpay/codec.ts +68 -5
  36. package/core/localpay/pending.ts +240 -22
  37. package/core/localpay/pendingAborts.ts +5 -1
  38. package/core/localpay/settlementAck.ts +149 -0
  39. package/core/localpay/types.ts +14 -1
  40. package/core/localpay/verify.ts +118 -69
  41. package/core/mandala/abortGuard.ts +134 -0
  42. package/core/mandala/basketMigration.ts +166 -0
  43. package/core/mandala/bundle.ts +244 -0
  44. package/core/mandala/createRuntime.ts +2437 -0
  45. package/core/mandala/drain.ts +670 -0
  46. package/core/mandala/permissionModule.ts +642 -0
  47. package/core/mandala/resendTransfer.ts +175 -0
  48. package/core/mandala/runtime.ts +357 -0
  49. package/core/mandala/settlementStore.ts +412 -0
  50. package/core/mandala/types.ts +290 -0
  51. package/core/monitor/MonitorSupervisor.ts +121 -0
  52. package/core/monitor/TaskBackupPush.ts +1 -1
  53. package/core/monitor/TaskCreditInbox.ts +1 -1
  54. package/core/monitor/TaskDrainOutbox.ts +1 -1
  55. package/core/monitor/TaskSendOffline.ts +1 -1
  56. package/core/net/online.ts +49 -0
  57. package/core/numberFormat.ts +19 -0
  58. package/core/offline/cancelParked.ts +94 -1
  59. package/core/offline/payerHold.ts +152 -12
  60. package/core/offline/plan.ts +1 -1
  61. package/core/offline/tokenFrames.ts +197 -0
  62. package/core/parsePeerPayURI.ts +70 -17
  63. package/core/pay/rails/address.ts +51 -3
  64. package/core/pay/rails/handle.ts +88 -9
  65. package/core/pay/rails/index.ts +16 -6
  66. package/core/pay/rails/nearby.ts +114 -4
  67. package/core/pay/recordProof.ts +2 -6
  68. package/core/services/arcadeBroadcastProvider.ts +1 -4
  69. package/core/services/capWalletArgs.ts +8 -9
  70. package/core/services/exchangeRate.ts +1 -1
  71. package/core/services/externalOrigin.ts +42 -0
  72. package/core/services/vault/VaultKeyService.ts +912 -251
  73. package/core/services/vault/ceremony.ts +435 -367
  74. package/core/services/vault/ceremonyHost.ts +27 -21
  75. package/core/services/vault/devMock.ts +30 -7
  76. package/core/services/vault/driver.ts +95 -41
  77. package/core/services/vault/guard.ts +514 -56
  78. package/core/services/vault/hardwareLease.ts +22 -0
  79. package/core/services/vault/mockYubiKey.ts +258 -90
  80. package/core/services/vault/pivReset.ts +145 -0
  81. package/core/services/vault/r1comb.ts +976 -0
  82. package/core/services/vault/session.ts +93 -26
  83. package/core/services/vault/transfers.ts +2617 -747
  84. package/core/services/vault/types.ts +100 -43
  85. package/core/services/vault/vaultStore.ts +991 -74
  86. package/core/services/walletConnectionValidation.ts +293 -0
  87. package/core/services/walletServiceConfig.ts +31 -20
  88. package/core/storage/StorageExpoSQLite.ts +420 -87
  89. package/core/storage/dbImage.ts +48 -0
  90. package/core/storage/methods/findSql.ts +3 -54
  91. package/core/storage/methods/listActionsSql.ts +8 -5
  92. package/core/storage/methods/listOutputsSql.ts +9 -5
  93. package/core/storage/methods/offlineActions.ts +15 -0
  94. package/core/storage/methods/processOfflineActions.ts +265 -9
  95. package/core/storage/methods/reviewStatusSql.ts +7 -2
  96. package/core/storage/methods/walletBalanceSql.ts +16 -4
  97. package/core/storage/schema/createTables.ts +152 -0
  98. package/core/storage/sqlUpdateValue.ts +24 -0
  99. package/core/toolboxConfig.ts +182 -1
  100. package/core/toolboxTypes.ts +40 -0
  101. package/core/userAvatar.ts +79 -0
  102. package/core/walletMonitor.ts +8 -3
  103. package/core/walletRepair/runWalletCheck.ts +19 -2
  104. package/package.json +31 -30
  105. package/ui/activityFilter.ts +115 -0
  106. package/ui/components/QRScanner.tsx +1 -1
  107. package/ui/components/pay/AdmissionNotice.tsx +99 -0
  108. package/ui/components/pay/AssetPicker.tsx +184 -0
  109. package/ui/components/pay/AvailableBalance.tsx +33 -2
  110. package/ui/components/pay/HandleReceive.tsx +213 -50
  111. package/ui/components/pay/NearbyFlow.tsx +616 -69
  112. package/ui/components/pay/PayForm.tsx +73 -8
  113. package/ui/components/pay/PaymentSuccessOverlay.tsx +89 -8
  114. package/ui/components/pay/RecipientField.tsx +132 -73
  115. package/ui/components/pay/RequestHub.tsx +68 -8
  116. package/ui/components/pay/ResultBanner.tsx +41 -4
  117. package/ui/components/pay/StepBar.tsx +32 -0
  118. package/ui/components/pay/UniversalSend.tsx +1118 -86
  119. package/ui/components/pay/tokenSendCopy.ts +116 -0
  120. package/ui/components/pay/useRecipientInput.ts +36 -7
  121. package/ui/components/ui/PencilEditField.tsx +109 -0
  122. package/ui/components/ui/PermissionSheet.tsx +65 -4
  123. package/ui/components/ui/Sheet.tsx +9 -2
  124. package/ui/components/ui/SlideOverFromRight.tsx +86 -0
  125. package/ui/components/vault/EnrollWizard.tsx +1432 -488
  126. package/ui/components/vault/KeyChooser.tsx +96 -0
  127. package/ui/components/vault/VaultCeremonySheet.tsx +107 -43
  128. package/ui/components/vault/vaultErrorCopy.ts +145 -0
  129. package/ui/components/wallet/ActivityRow.tsx +283 -97
  130. package/ui/components/wallet/AmountInput.tsx +92 -28
  131. package/ui/components/wallet/AssetAmount.tsx +95 -0
  132. package/ui/components/wallet/AssetSwitcherDropdown.tsx +261 -0
  133. package/ui/components/wallet/ContactActivityList.tsx +149 -0
  134. package/ui/components/wallet/ContactSigil.tsx +49 -0
  135. package/ui/components/wallet/EditPictureSheet.tsx +99 -0
  136. package/ui/components/wallet/FitAmount.tsx +148 -0
  137. package/ui/components/wallet/IconPickerSheet.tsx +168 -0
  138. package/ui/components/wallet/IdentifierRow.tsx +69 -0
  139. package/ui/components/wallet/ImportFromBackupPrompt.tsx +35 -13
  140. package/ui/components/wallet/ProfileButton.tsx +62 -0
  141. package/ui/components/wallet/UserAvatar.tsx +85 -0
  142. package/ui/components/wallet/avatarIcons.ts +122 -0
  143. package/ui/components/wallet/tokenEviction.ts +65 -0
  144. package/ui/hooks/useContactsStore.ts +10 -0
  145. package/ui/hooks/useExportWalletData.ts +39 -0
  146. package/ui/hooks/useMandala.ts +320 -0
  147. package/ui/hooks/useOnline.ts +65 -20
  148. package/ui/hooks/useVaultBalance.ts +105 -7
  149. package/ui/hooks/useVaultCoverage.ts +52 -0
  150. package/ui/importDatabases.ts +7 -3
  151. package/ui/index.ts +75 -7
  152. package/ui/screens/ConnectionsScreen.tsx +46 -29
  153. package/ui/screens/ContactScreen.tsx +289 -0
  154. package/ui/screens/ContactsScreen.tsx +373 -0
  155. package/ui/screens/IdentifierScreen.tsx +234 -0
  156. package/ui/screens/NewContactScreen.tsx +362 -0
  157. package/ui/screens/PairScreen.tsx +12 -12
  158. package/ui/screens/PayScreen.tsx +145 -12
  159. package/ui/screens/ProfileScreen.tsx +783 -0
  160. package/ui/screens/SettingsScreen.tsx +18 -9
  161. package/ui/screens/TransactionDetailScreen.tsx +419 -0
  162. package/ui/screens/TrustScreen.tsx +1 -1
  163. package/ui/screens/VaultScreen.tsx +925 -171
  164. package/ui/screens/VaultTransferScreen.tsx +376 -123
  165. package/ui/screens/WalletCheckScreen.tsx +10 -1
  166. package/ui/screens/WalletConfigScreen.tsx +80 -16
  167. package/ui/screens/WalletHomeScreen.tsx +915 -139
  168. package/ui/screens/homeBadges.ts +9 -1
  169. package/ui/screens/tokenRowTitle.ts +68 -0
  170. package/ui/tokenFormat.ts +108 -0
  171. package/ui/tokenSeen.ts +75 -0
  172. package/ui/tokenStatus.ts +100 -0
  173. package/ui/txStatus.ts +43 -5
  174. package/assets/sounds/vault-close.wav +0 -0
  175. package/assets/sounds/vault-open.wav +0 -0
  176. package/core/services/vault/k1.ts +0 -75
  177. package/core/services/vault/sealing.ts +0 -84
  178. package/core/services/vault/vaultDerivation.ts +0 -152
  179. package/core/services/vault/vaultPassphrase.ts +0 -287
  180. package/ui/components/vault/PassphraseField.tsx +0 -306
  181. package/ui/components/vault/PhraseBackupSheet.tsx +0 -227
  182. package/ui/screens/VaultRecoverScreen.tsx +0 -226
@@ -30,6 +30,11 @@ import { PeerPayClient, type IncomingPayment } from '@bsv/message-box-client'
30
30
  import { type DisplayableIdentity } from '@bsv/sdk'
31
31
 
32
32
  import ResultBanner from './ResultBanner'
33
+ import AdmissionNotice from './AdmissionNotice'
34
+ import { ConsequenceNote } from './PayForm'
35
+ import { useMandala } from '../../hooks/useMandala'
36
+ import { formatTokenAmountWithUnit } from '../../tokenFormat'
37
+ import { SEEN_ASSETS_KEY, markSeen, readSeen } from '../../tokenSeen'
33
38
  import ReceivedOverlay from './PaymentSuccessOverlay'
34
39
  import { useMessageBoxConfig } from './MessageBoxConfig'
35
40
  import AmountDisplay from '../wallet/AmountDisplay'
@@ -347,10 +352,52 @@ function AttentionRow({
347
352
  )
348
353
  }
349
354
 
355
+ export interface HandleReceiveProps {
356
+ /** Satoshis the code asks for. Never set while an asset is selected. */
357
+ initialSats?: number
358
+ /**
359
+ * The asset this request is denominated in, when one is selected. The link
360
+ * then names it — `asset=<genesis outpoint>` — and carries the figure, if
361
+ * any, as `amount=` in that asset's base units, never as `sats=`: a satoshi
362
+ * figure emitted while the payee was thinking in USDX would be read by the
363
+ * payer's wallet as satoshis, a unit-confusion money lie.
364
+ */
365
+ asset?: { assetId: string; ticker: string; issuerName?: string } | null
366
+ /** The figure the code asks for, in the asset's base units. Absent for an open request. */
367
+ requestedBaseUnits?: number
368
+ /** The same figure, in the asset's own units, already formatted for the screen. */
369
+ requestedAmountText?: string
370
+ /**
371
+ * The runtime's plain reason this wallet cannot be paid in the selected
372
+ * asset, or null. When present the payment code is withheld entirely — see
373
+ * AdmissionNotice: a code that manufactures a refusal inside someone else's
374
+ * app, attributed to nothing, is the error-prevention failure this avoids.
375
+ */
376
+ admissionRefusal?: string | null
377
+ /**
378
+ * The selected asset's own registered MessageBox host (`useAssetStatus`,
379
+ * asked by the caller — this screen stays prop-driven for the same reason
380
+ * `RequestHub` is). Compared against this device's OWN configured host
381
+ * (`useMessageBoxConfig`, read locally): a mismatch means a payer sending
382
+ * this asset over the handle rail may deliver to a box this wallet is not
383
+ * listening on.
384
+ */
385
+ assetMessageBoxUrl?: string | null
386
+ /** Switch the request back to BSV, from inside the admission notice. */
387
+ onBsvInstead?: () => void
388
+ dismissTo?: DismissTarget
389
+ }
390
+
350
391
  export default function HandleReceive({
351
392
  initialSats,
393
+ asset = null,
394
+ requestedBaseUnits,
395
+ requestedAmountText,
396
+ admissionRefusal,
397
+ assetMessageBoxUrl = null,
398
+ onBsvInstead,
352
399
  dismissTo = '/'
353
- }: { initialSats?: number; dismissTo?: DismissTarget } = {}) {
400
+ }: HandleReceiveProps = {}) {
354
401
  const { t } = useTranslation()
355
402
  const { colors } = useTheme()
356
403
  const Ionicons = loadIonicons()
@@ -361,6 +408,7 @@ export default function HandleReceive({
361
408
  const online = useOnline()
362
409
 
363
410
  const [identityKey, setIdentityKey] = useState('')
411
+ const mandala = useMandala()
364
412
  const [identityError, setIdentityError] = useState(false)
365
413
  const [copied, setCopied] = useState(false)
366
414
  const { messageBoxUrl } = useMessageBoxConfig(t)
@@ -377,6 +425,17 @@ export default function HandleReceive({
377
425
  * pass; cleared only by the overlay's Done.
378
426
  */
379
427
  const [received, setReceived] = useState<{ amount: number; count: number } | null>(null)
428
+ /**
429
+ * A token payment that arrived while this screen was in front. Money arriving
430
+ * gets a screen, never a toast — the one thing a payee must not be unsure
431
+ * about is whether it landed — and the screen says, in the same breath, that
432
+ * the issuer has not confirmed it yet when that is true.
433
+ */
434
+ const [tokenReceived, setTokenReceived] = useState<{
435
+ amountText: string
436
+ statusNote?: string
437
+ firstHoldNote?: string
438
+ } | null>(null)
380
439
 
381
440
  /** Payments the wallet has failed to credit, keyed by message id. */
382
441
  const [attempts, setAttempts] = useState<Record<string, InboxAttempt>>({})
@@ -439,7 +498,17 @@ export default function HandleReceive({
439
498
  // BRC-125 with this app's url extension: the payer learns where to deliver
440
499
  // without an overlay lookup. Omitted when no server is configured, since
441
500
  // there is then nowhere to point them.
442
- const link = identityKey ? peerPayLinkFor(identityKey, initialSats, isConfigured ? messageBoxUrl : undefined) : ''
501
+ // In asset mode the link names the asset and its base-unit figure (or no
502
+ // figure, for an open request); `peerPayLinkFor` never emits `sats` beside
503
+ // them, and omits any non-positive figure in either mode.
504
+ const link = identityKey
505
+ ? peerPayLinkFor(
506
+ identityKey,
507
+ asset ? undefined : initialSats,
508
+ isConfigured ? messageBoxUrl : undefined,
509
+ asset ? { assetId: asset.assetId, baseUnits: requestedBaseUnits } : undefined
510
+ )
511
+ : ''
443
512
 
444
513
  const handleCopy = useCallback(() => {
445
514
  if (!identityKey) return
@@ -561,6 +630,44 @@ export default function HandleReceive({
561
630
  fetchRef.current = fetchPayments
562
631
  }, [fetchPayments])
563
632
 
633
+ /**
634
+ * One pass over the Mandala inbox, and the arrival screen if it credited
635
+ * anything. The figure comes from the runtime's own activity — never from the
636
+ * message body — so what is shown is what was actually written to the wallet.
637
+ */
638
+ const tokenTick = useCallback(async () => {
639
+ const runtime = mandala.runtime
640
+ if (!runtime) return
641
+ try {
642
+ const { credited } = await runtime.receiveFromInbox()
643
+ if (credited <= 0) return
644
+ const rows = await runtime.activity(credited)
645
+ const arrival = rows.find(r => r.role === 'received')
646
+ if (!arrival) return
647
+ const issuer = arrival.asset.issuerName || t('token_issuer_fallback')
648
+ const seen = await readSeen(SEEN_ASSETS_KEY)
649
+ const firstHold = !seen.includes(arrival.asset.assetId)
650
+ if (firstHold) await markSeen(SEEN_ASSETS_KEY, arrival.asset.assetId)
651
+ setTokenReceived({
652
+ amountText: formatTokenAmountWithUnit(arrival.baseUnits, arrival.asset, { showPlus: true }) ?? '',
653
+ // Credited and spendable, and not yet confirmed — both true, and the
654
+ // receipt says both rather than claiming a settlement nobody has.
655
+ statusNote: arrival.status === 'settled' ? undefined : t('local_pay_token_not_cleared', { issuer }),
656
+ // Disclosure at the one moment the user is definitely looking.
657
+ firstHoldNote: firstHold
658
+ ? t('token_first_hold', { ticker: arrival.asset.ticker, issuer })
659
+ : undefined
660
+ })
661
+ } catch {
662
+ // A drain that could not run is not news on this screen: the monitor task
663
+ // and the next tick both retry, and the inbox rows below still render.
664
+ }
665
+ }, [mandala.runtime, t])
666
+ const tokenTickRef = useRef(tokenTick)
667
+ useEffect(() => {
668
+ tokenTickRef.current = tokenTick
669
+ }, [tokenTick])
670
+
564
671
  // ── Poll the inbox ──
565
672
  //
566
673
  // A payment arrives whenever the sender's wallet delivers it and MessageBox has
@@ -577,6 +684,11 @@ export default function HandleReceive({
577
684
  if (cancelled || !focusedRef.current) return
578
685
  if (AppState.currentState !== 'active') return
579
686
  void fetchRef.current({ silent: true })
687
+ // The token inbox is a SIBLING drain, not a widened one: Mandala delivers
688
+ // to its own message box and the two never meet. Same 5s focused tick,
689
+ // because a payee standing in front of this screen expects both kinds of
690
+ // money to appear on their own.
691
+ void tokenTickRef.current()
580
692
  }
581
693
 
582
694
  const interval = setInterval(tick, INBOX_POLL_MS)
@@ -665,6 +777,21 @@ export default function HandleReceive({
665
777
 
666
778
  const damagedIds = useMemo(() => new Set(damaged.map(d => d.messageId)), [damaged])
667
779
 
780
+ /**
781
+ * Can this wallet actually be paid in the selected asset?
782
+ *
783
+ * Asked with this wallet's OWN identity key, because that is what a payer
784
+ * would be paying: the answer the payer's wallet would give, computed here,
785
+ * before a code that could never work is shown. `undefined` from the caller
786
+ * means "ask the runtime"; an explicit `null` means "already checked, fine".
787
+ */
788
+ const admission =
789
+ admissionRefusal !== undefined
790
+ ? admissionRefusal
791
+ : asset && mandala.runtime && identityKey
792
+ ? mandala.runtime.recipientRefusal(identityKey)
793
+ : null
794
+
668
795
  /**
669
796
  * The rows worth showing: payments the wallet has given up on, environmental
670
797
  * failures still waiting on the network, plus inbox bodies that never parsed
@@ -686,58 +813,83 @@ export default function HandleReceive({
686
813
  {/* Your handle. The QR is the focal element — it is the thing physically
687
814
  held up to another device. */}
688
815
  {/* The figure the code asks for, as its price. Only when one was named. */}
689
- {initialSats !== undefined && initialSats > 0 && (
690
- <Text style={[styles.requestedAmount, { color: colors.textPrimary }]}>
691
- <AmountDisplay>{initialSats}</AmountDisplay>
692
- </Text>
816
+ {requestedAmountText ? (
817
+ <Text style={[styles.requestedAmount, { color: colors.textPrimary }]}>{requestedAmountText}</Text>
818
+ ) : (
819
+ initialSats !== undefined &&
820
+ initialSats > 0 && (
821
+ <Text style={[styles.requestedAmount, { color: colors.textPrimary }]}>
822
+ <AmountDisplay>{initialSats}</AmountDisplay>
823
+ </Text>
824
+ )
693
825
  )}
694
- <View style={styles.qrHero}>
695
- {identityKey ? (
696
- <View style={styles.qrPlate}>
697
- <QRCode value={link} size={240} color="#000" backgroundColor="#fff" />
698
- </View>
699
- ) : identityError ? (
700
- <View style={styles.identityError}>
701
- <Text style={[styles.identityErrorText, { color: colors.error }]}>{t('unknown_error')}</Text>
702
- <PressableScale
703
- onPress={() => void loadIdentityKey()}
704
- haptic="tap"
705
- style={styles.identityRetry}
706
- accessibilityRole="button"
707
- accessibilityLabel={t('activity_load_retry')}
708
- >
709
- <Text style={[styles.identityRetryLabel, { color: colors.accent }]}>{t('activity_load_retry')}</Text>
710
- </PressableScale>
826
+ {/* This device may not be listening where a payer's handle-rail send
827
+ would actually deliver. Advisory: the code below still works for
828
+ every OTHER rail, and the mismatch may resolve itself (a Settings
829
+ change, a fresh registry read) before anyone acts on it. */}
830
+ {asset &&
831
+ !admission &&
832
+ !!assetMessageBoxUrl &&
833
+ isConfigured &&
834
+ assetMessageBoxUrl !== messageBoxUrl && <ConsequenceNote textKey="token_messagebox_mismatch" />}
835
+ {admission && asset ? (
836
+ <AdmissionNotice
837
+ ticker={asset.ticker}
838
+ issuerName={asset.issuerName}
839
+ reason={admission}
840
+ onBsvInstead={() => onBsvInstead?.()}
841
+ />
842
+ ) : (
843
+ <>
844
+ <View style={styles.qrHero}>
845
+ {identityKey ? (
846
+ <View style={styles.qrPlate}>
847
+ <QRCode value={link} size={240} color="#000" backgroundColor="#fff" />
848
+ </View>
849
+ ) : identityError ? (
850
+ <View style={styles.identityError}>
851
+ <Text style={[styles.identityErrorText, { color: colors.error }]}>{t('unknown_error')}</Text>
852
+ <PressableScale
853
+ onPress={() => void loadIdentityKey()}
854
+ haptic="tap"
855
+ style={styles.identityRetry}
856
+ accessibilityRole="button"
857
+ accessibilityLabel={t('activity_load_retry')}
858
+ >
859
+ <Text style={[styles.identityRetryLabel, { color: colors.accent }]}>{t('activity_load_retry')}</Text>
860
+ </PressableScale>
861
+ </View>
862
+ ) : (
863
+ <ActivityIndicator size="large" color={colors.textSecondary} />
864
+ )}
711
865
  </View>
712
- ) : (
713
- <ActivityIndicator size="large" color={colors.textSecondary} />
714
- )}
715
- </View>
716
866
 
717
- <Text style={[styles.keyText, { color: colors.textSecondary }]} numberOfLines={1} ellipsizeMode="middle">
718
- {identityKey}
719
- </Text>
720
-
721
- <View style={styles.actionRow}>
722
- <TouchableOpacity onPress={handleCopy} style={[styles.action, { backgroundColor: colors.fillTertiary }]}>
723
- <Ionicons
724
- name={copied ? 'checkmark' : 'copy-outline'}
725
- size={18}
726
- color={copied ? colors.success : colors.textSecondary}
727
- />
728
- <Text style={[styles.actionText, { color: copied ? colors.success : colors.textSecondary }]}>
729
- {copied ? t('copied') : t('pay_copy')}
867
+ <Text style={[styles.keyText, { color: colors.textSecondary }]} numberOfLines={1} ellipsizeMode="middle">
868
+ {identityKey}
730
869
  </Text>
731
- </TouchableOpacity>
732
- <TouchableOpacity
733
- onPress={handleShare}
734
- disabled={!link}
735
- style={[styles.action, { backgroundColor: colors.fillTertiary, opacity: link ? 1 : 0.5 }]}
736
- >
737
- <Ionicons name="share-outline" size={18} color={colors.textSecondary} />
738
- <Text style={[styles.actionText, { color: colors.textSecondary }]}>{t('pay_share_link')}</Text>
739
- </TouchableOpacity>
740
- </View>
870
+
871
+ <View style={styles.actionRow}>
872
+ <TouchableOpacity onPress={handleCopy} style={[styles.action, { backgroundColor: colors.fillTertiary }]}>
873
+ <Ionicons
874
+ name={copied ? 'checkmark' : 'copy-outline'}
875
+ size={18}
876
+ color={copied ? colors.success : colors.textSecondary}
877
+ />
878
+ <Text style={[styles.actionText, { color: copied ? colors.success : colors.textSecondary }]}>
879
+ {copied ? t('copied') : t('pay_copy')}
880
+ </Text>
881
+ </TouchableOpacity>
882
+ <TouchableOpacity
883
+ onPress={handleShare}
884
+ disabled={!link}
885
+ style={[styles.action, { backgroundColor: colors.fillTertiary, opacity: link ? 1 : 0.5 }]}
886
+ >
887
+ <Ionicons name="share-outline" size={18} color={colors.textSecondary} />
888
+ <Text style={[styles.actionText, { color: colors.textSecondary }]}>{t('pay_share_link')}</Text>
889
+ </TouchableOpacity>
890
+ </View>
891
+ </>
892
+ )}
741
893
 
742
894
  {/* Only the payments the wallet gave up on. Everything else was credited
743
895
  the moment it was seen, so there is nothing here to accept. */}
@@ -765,6 +917,17 @@ export default function HandleReceive({
765
917
  dismissTo={dismissTo}
766
918
  />
767
919
  )}
920
+
921
+ {tokenReceived && (
922
+ <ReceivedOverlay
923
+ amount={0}
924
+ amountText={tokenReceived.amountText}
925
+ statusNote={tokenReceived.statusNote}
926
+ firstHoldNote={tokenReceived.firstHoldNote}
927
+ onDismiss={() => setTokenReceived(null)}
928
+ dismissTo={dismissTo}
929
+ />
930
+ )}
768
931
  </ScrollView>
769
932
  )
770
933
  }