@bsv/expo-wallet-toolbox 0.5.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 (90) hide show
  1. package/CHANGELOG.md +255 -0
  2. package/README.md +19 -0
  3. package/core/amountFormatHelpers.ts +238 -34
  4. package/core/backup/RemoteSyncReader.ts +2 -5
  5. package/core/backup/codec.ts +2 -2
  6. package/core/backup/push.ts +1 -1
  7. package/core/config.tsx +12 -5
  8. package/core/contacts/contactActivity.ts +153 -0
  9. package/core/contacts/contactCache.ts +41 -0
  10. package/core/contacts/contactsStore.ts +183 -0
  11. package/core/context/WalletContext.tsx +55 -10
  12. package/core/demo/demoAssets.ts +60 -0
  13. package/core/demo/demoLedger.ts +240 -0
  14. package/core/demo/demoMandalaRuntime.ts +96 -0
  15. package/core/demo/demoMode.ts +38 -0
  16. package/core/demo/demoWallet.ts +25 -0
  17. package/core/demo/index.ts +26 -0
  18. package/core/demo/useDemo.ts +59 -0
  19. package/core/headers/OfflineFirstChaintracks.ts +52 -14
  20. package/core/headers/headerStore.ts +7 -10
  21. package/core/i18n/translations.tsx +1234 -74
  22. package/core/identity/contactLink.ts +36 -0
  23. package/core/identity/handleRegistry/client.ts +285 -0
  24. package/core/identity/handleRegistry/profileCert.ts +254 -0
  25. package/core/identity/handleRegistry/registration.ts +559 -0
  26. package/core/identity/handleRegistry/resolver.ts +247 -0
  27. package/core/identity/handleRegistry/rules.ts +104 -0
  28. package/core/index.ts +20 -2
  29. package/core/localpay/pendingAborts.ts +5 -1
  30. package/core/monitor/MonitorSupervisor.ts +121 -0
  31. package/core/monitor/TaskBackupPush.ts +1 -1
  32. package/core/monitor/TaskCreditInbox.ts +1 -1
  33. package/core/monitor/TaskDrainOutbox.ts +1 -1
  34. package/core/monitor/TaskSendOffline.ts +1 -1
  35. package/core/net/online.ts +49 -0
  36. package/core/numberFormat.ts +19 -0
  37. package/core/offline/plan.ts +1 -1
  38. package/core/pay/recordProof.ts +2 -6
  39. package/core/services/arcadeBroadcastProvider.ts +1 -4
  40. package/core/services/exchangeRate.ts +1 -1
  41. package/core/services/externalOrigin.ts +5 -2
  42. package/core/services/vault/transfers.ts +2 -2
  43. package/core/services/walletServiceConfig.ts +31 -20
  44. package/core/storage/StorageExpoSQLite.ts +41 -34
  45. package/core/storage/methods/findSql.ts +3 -0
  46. package/core/storage/methods/listActionsSql.ts +8 -5
  47. package/core/storage/methods/listOutputsSql.ts +2 -2
  48. package/core/storage/methods/processOfflineActions.ts +2 -3
  49. package/core/storage/methods/reviewStatusSql.ts +7 -2
  50. package/core/storage/schema/createTables.ts +29 -0
  51. package/core/toolboxConfig.ts +70 -0
  52. package/core/toolboxTypes.ts +40 -0
  53. package/core/userAvatar.ts +79 -0
  54. package/core/walletMonitor.ts +8 -3
  55. package/package.json +7 -7
  56. package/ui/activityFilter.ts +115 -0
  57. package/ui/components/pay/PaymentSuccessOverlay.tsx +46 -6
  58. package/ui/components/pay/RecipientField.tsx +84 -70
  59. package/ui/components/pay/StepBar.tsx +32 -0
  60. package/ui/components/pay/UniversalSend.tsx +677 -149
  61. package/ui/components/ui/PencilEditField.tsx +109 -0
  62. package/ui/components/ui/SlideOverFromRight.tsx +86 -0
  63. package/ui/components/wallet/ActivityRow.tsx +222 -120
  64. package/ui/components/wallet/AmountInput.tsx +18 -6
  65. package/ui/components/wallet/ContactActivityList.tsx +149 -0
  66. package/ui/components/wallet/ContactSigil.tsx +49 -0
  67. package/ui/components/wallet/EditPictureSheet.tsx +99 -0
  68. package/ui/components/wallet/FitAmount.tsx +148 -0
  69. package/ui/components/wallet/IconPickerSheet.tsx +168 -0
  70. package/ui/components/wallet/IdentifierRow.tsx +69 -0
  71. package/ui/components/wallet/ImportFromBackupPrompt.tsx +35 -13
  72. package/ui/components/wallet/ProfileButton.tsx +62 -0
  73. package/ui/components/wallet/UserAvatar.tsx +85 -0
  74. package/ui/components/wallet/avatarIcons.ts +122 -0
  75. package/ui/hooks/useContactsStore.ts +10 -0
  76. package/ui/hooks/useMandala.ts +18 -1
  77. package/ui/hooks/useOnline.ts +65 -20
  78. package/ui/index.ts +26 -1
  79. package/ui/screens/ContactScreen.tsx +289 -0
  80. package/ui/screens/ContactsScreen.tsx +373 -0
  81. package/ui/screens/IdentifierScreen.tsx +234 -0
  82. package/ui/screens/NewContactScreen.tsx +362 -0
  83. package/ui/screens/PayScreen.tsx +20 -7
  84. package/ui/screens/ProfileScreen.tsx +783 -0
  85. package/ui/screens/TransactionDetailScreen.tsx +419 -0
  86. package/ui/screens/TrustScreen.tsx +1 -1
  87. package/ui/screens/WalletConfigScreen.tsx +42 -0
  88. package/ui/screens/WalletHomeScreen.tsx +528 -83
  89. package/ui/tokenStatus.ts +21 -0
  90. package/ui/txStatus.ts +43 -5
@@ -16,7 +16,7 @@
16
16
  * shown only for addresses, where it is load-bearing — a user who pastes an
17
17
  * address expecting messaging-style delivery has effectively posted cash.
18
18
  */
19
- import React, { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react'
19
+ import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useState, useRef } from 'react'
20
20
  import { ActivityIndicator, Modal, ScrollView, StyleSheet, Text, TextInput, View } from 'react-native'
21
21
  import { useTranslation } from 'react-i18next'
22
22
 
@@ -31,24 +31,35 @@ import { showToast } from '../ui/Toast'
31
31
  import { ConsequenceNote, PayAmountField, PayCta, PayField } from './PayForm'
32
32
  import PaymentSuccessOverlay from './PaymentSuccessOverlay'
33
33
  import ResultBanner from './ResultBanner'
34
- import RecipientField from './RecipientField'
34
+ import RecipientField, { type RecipientRow } from './RecipientField'
35
+ import StepBar, { type PayStep } from './StepBar'
35
36
  import { useMessageBoxConfig } from './MessageBoxConfig'
36
37
  import { useRecipientInput, type RecipientTarget, type PeerPayRequest } from './useRecipientInput'
37
38
  import { tokenSendCopy, tokenThrowCopy, type TokenSendCopy } from './tokenSendCopy'
38
39
  import { useAssetStatus, useMandala } from '../../hooks/useMandala'
39
40
  import { useSpendableBalance } from '../../hooks/useSpendableBalance'
41
+ import { useContactsStore } from '../../hooks/useContactsStore'
42
+ import ContactSigil from '../wallet/ContactSigil'
40
43
  import { formatTokenAmount, formatTokenAmountWithUnit } from '../../tokenFormat'
44
+ import { abbreviateKey } from '../../../core/pay/counterparty'
45
+ import type { ContactRow } from '../../../core/contacts/contactsStore'
46
+ import { createHandleRegistryClient } from '../../../core/identity/handleRegistry/client'
47
+ import type { RegistryProfile } from '../../../core/identity/handleRegistry/profileCert'
41
48
  import {
42
49
  useTheme,
43
50
  spacing,
44
51
  typography,
45
52
  radii,
46
53
  hitTargets,
54
+ formatSatoshisAsBsvDecimal,
55
+ useWallet,
47
56
  useWalletManagers,
48
57
  useWalletStatus,
49
58
  CONSEQUENCE_KEYS,
50
59
  NO_MESSAGE_BOX,
51
60
  cancelOutboxPayment,
61
+ classifyRecipientInput,
62
+ getHandleRegistryConfig,
52
63
  isMessageBoxNetworkError,
53
64
  makePeerPayClient,
54
65
  retryDelivery,
@@ -64,6 +75,23 @@ import {
64
75
  } from '@bsv/expo-wallet-toolbox'
65
76
  import type { DismissTarget } from '../../dismissTarget'
66
77
 
78
+ /**
79
+ * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
80
+ * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
81
+ * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
82
+ * Ionicons is loaded lazily, only when actually rendering, same pattern as
83
+ * this package's other native-module-boundary fixes.
84
+ */
85
+ type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
86
+ let ioniconsComponent: IoniconsComponent | undefined
87
+ function loadIonicons(): IoniconsComponent {
88
+ if (!ioniconsComponent) {
89
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
90
+ ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
91
+ }
92
+ return ioniconsComponent
93
+ }
94
+
67
95
  /**
68
96
  * expo-status-bar's package.json `main` points straight at its raw
69
97
  * TypeScript source (no compiled build output ships), and the unscoped,
@@ -99,6 +127,11 @@ function loadExpoRouter(): ExpoRouterModule {
99
127
  return expoRouterMod
100
128
  }
101
129
 
130
+ /** The registry's own debounce. Deliberately a third constant rather than a
131
+ * shared one: `useRecipientInput`'s overlay timer and `ProfileScreen`'s
132
+ * availability timer are separate decisions that happen to agree today. */
133
+ const REGISTRY_SEARCH_DEBOUNCE_MS = 400
134
+
102
135
  // ── Outgoing Section ─────────────────────────────────────────────────────────
103
136
 
104
137
  interface OutgoingSectionProps {
@@ -186,6 +219,16 @@ function OutgoingSection({ entries, retryingId, colors, t, onRetry, onCancel }:
186
219
  )
187
220
  }
188
221
 
222
+ /**
223
+ * What the host screen can ask of the form: walk back one step. Returns false
224
+ * when already on the first step, so the host knows to leave the screen
225
+ * instead — the header's one back chevron serves both (2026-09-18 design: no
226
+ * second back control inside the form).
227
+ */
228
+ export interface UniversalSendHandle {
229
+ back(): boolean
230
+ }
231
+
189
232
  export interface UniversalSendProps {
190
233
  /** A recipient known before the form opened: a peerpay deep link or `?identityKey=`. */
191
234
  initialTarget?: Extract<RecipientTarget, { kind: 'handle' }>
@@ -214,6 +257,8 @@ export interface UniversalSendProps {
214
257
  onNearbySession: (session: Session) => void
215
258
  /** Where the post-payment overlay sends the user. Defaults to `/`. */
216
259
  dismissTo?: DismissTarget
260
+ /** Which of the three steps is on screen — the host names its header by it. */
261
+ onStepChange?: (step: PayStep) => void
217
262
  }
218
263
 
219
264
  /**
@@ -233,24 +278,67 @@ function seedFigure(sats?: number, token?: { assetId: string; baseUnits: number
233
278
  return { text: '', unit: null }
234
279
  }
235
280
 
236
- function UniversalSend({
237
- initialTarget,
238
- initialSats,
239
- initialTokenAmount,
240
- initialNotice,
241
- openScannerOnMount = false,
242
- onNearbySession,
243
- selectedAssetId,
244
- onSelectAsset,
245
- dismissTo = '/'
246
- }: UniversalSendProps) {
281
+ function UniversalSendInner(
282
+ {
283
+ initialTarget,
284
+ initialSats,
285
+ initialTokenAmount,
286
+ initialNotice,
287
+ openScannerOnMount = false,
288
+ onNearbySession,
289
+ selectedAssetId,
290
+ onSelectAsset,
291
+ dismissTo = '/',
292
+ onStepChange
293
+ }: UniversalSendProps,
294
+ ref: React.ForwardedRef<UniversalSendHandle>
295
+ ) {
247
296
  const { t } = useTranslation()
248
297
  const { colors } = useTheme()
249
298
  const StatusBar = loadStatusBar()
299
+ const Ionicons = loadIonicons()
250
300
  const { managers, adminOriginator, storage } = useWalletManagers()
251
301
  const { walletBuilt } = useWalletStatus()
302
+ const { walletUserId, selectedNetwork } = useWallet()
252
303
  const wallet = managers?.permissionsManager || null
253
304
 
305
+ // ── the three-step flow (who / amount / review, 2026-09-18 design) ──────
306
+ // A recipient known before the form opened (a deep link, a scan on the way
307
+ // in) starts on 'amount' — the identity is already decided. Everything
308
+ // else about this form is unchanged; `step` only decides which of the
309
+ // sections below is on screen.
310
+ const [step, setStep] = useState<PayStep>(initialTarget ? 'amount' : 'who')
311
+ // A second deep link while this form is mounted re-adopts the recipient
312
+ // (see useRecipientInput's own initialTarget effect) and must jump the
313
+ // step forward the same way the initial mount does — a link naming a
314
+ // payee is a stronger signal than whatever step the user was on.
315
+ useEffect(() => {
316
+ if (initialTarget) setStep('amount')
317
+ }, [initialTarget?.identityKey])
318
+ const contactsStore = useContactsStore()
319
+ const [contactMatches, setContactMatches] = useState<ContactRow[]>([])
320
+ const [registryMatches, setRegistryMatches] = useState<RegistryProfile[]>([])
321
+ const [registrySearching, setRegistrySearching] = useState(false)
322
+ const [registryError, setRegistryError] = useState(false)
323
+ /**
324
+ * Two strings, not the config object. `getHandleRegistryConfig` builds a
325
+ * fresh `{ domain, url }` on every call, so memoising on the object gives the
326
+ * client a new identity every render, which gives the registry effect below a
327
+ * changed dependency every render — and its own `setState` then schedules the
328
+ * next render. That is an unbreakable loop ("Maximum update depth exceeded")
329
+ * in which the 400 ms debounce is also cleared before it can ever fire.
330
+ */
331
+ const registry = getHandleRegistryConfig(selectedNetwork)
332
+ const registryDomain = registry?.domain
333
+ const registryUrl = registry?.url
334
+ const registryClient = useMemo(
335
+ () =>
336
+ registryDomain && registryUrl
337
+ ? createHandleRegistryClient({ pinned: { domain: registryDomain, url: registryUrl } })
338
+ : null,
339
+ [registryDomain, registryUrl]
340
+ )
341
+
254
342
  // ── the asset axis ──────────────────────────────────────────────────
255
343
  // Every line below is gated on `asset`: with no token held, `balances` is
256
344
  // empty, `asset` is null, the picker renders nothing and this form is
@@ -304,11 +392,20 @@ function UniversalSend({
304
392
  const [sent, setSent] = useState<{
305
393
  amount: number
306
394
  recipient?: string
395
+ /** Set only for a handle/token send — offers "Add to contacts" on the success screen. */
396
+ recipientIdentityKey?: string
307
397
  /** Token mode: the figure in the asset's own units. */
308
398
  amountText?: string
309
399
  /** Whether the issuer has confirmed it yet — never claimed, only reported. */
310
400
  statusNote?: string
311
401
  } | null>(null)
402
+ /** Set once `sent` names a handle recipient who is not already a saved
403
+ * contact — null while that check is pending or once it comes back "already saved". */
404
+ const [offerAddContact, setOfferAddContact] = useState<{
405
+ identityKey: string
406
+ name?: string
407
+ handle?: string
408
+ } | null>(null)
312
409
  const [outbox, setOutbox] = useState<OutboxEntry[]>([])
313
410
  const [retryingId, setRetryingId] = useState<string | null>(null)
314
411
 
@@ -365,6 +462,13 @@ function UniversalSend({
365
462
  * held), otherwise parked until they are — see the effect below `recipient`.
366
463
  */
367
464
  const onPeerPayRequest = (request: PeerPayRequest) => {
465
+ // A request that names money (a link's `sats=`/`amount=`, typed, pasted or
466
+ // scanned) is "amount pre-populated by QR/deep link" whichever way it
467
+ // arrived — so it jumps the same way a deep-linked `initialTarget` does.
468
+ // A bare handle/key with no figure never reaches this function at all
469
+ // (see useRecipientInput's `requestOf`), so Continue still decides step
470
+ // for every ordinary "who" entry.
471
+ setStep('amount')
368
472
  if (request.asset !== undefined) {
369
473
  if (tokensNever) {
370
474
  applyTokenRequest(request, [], { deferred: false })
@@ -393,6 +497,216 @@ function UniversalSend({
393
497
  onNearbySession
394
498
  })
395
499
  const target = recipient.target
500
+
501
+ // Local contacts, searched ahead of the 400ms overlay debounce (instant —
502
+ // this is a local SQLite read) and merged into the same dropdown. Contacts
503
+ // come first; an overlay hit for an identity key already in the merged list
504
+ // is dropped rather than shown twice. An empty query shows every contact as
505
+ // "Recent" (RecipientField's `recentLabel`) rather than nothing.
506
+ useEffect(() => {
507
+ if (!contactsStore || walletUserId === null || recipient.selectedIdentity || target) {
508
+ setContactMatches([])
509
+ return
510
+ }
511
+ let cancelled = false
512
+ void contactsStore.searchContacts(walletUserId, recipient.inputText).then(rows => {
513
+ if (!cancelled) setContactMatches(rows)
514
+ })
515
+ return () => {
516
+ cancelled = true
517
+ }
518
+ }, [contactsStore, walletUserId, recipient.inputText, recipient.selectedIdentity, target])
519
+
520
+ /**
521
+ * The registry tier: people who can be paid by name. Its own timer — the
522
+ * contacts effect above has none, which is right for a local SQLite read and
523
+ * would be one request per keystroke here — and its own notice, so a
524
+ * registry outage never takes the contacts already on screen with it.
525
+ *
526
+ * It never fires for text that already resolved to a key or an address
527
+ * (`classifyRecipientInput`), for fewer than two characters (shorter than
528
+ * the registry's own minimum), with no registry configured, or before the
529
+ * wallet user is known.
530
+ */
531
+ useEffect(() => {
532
+ const query = recipient.inputText.trim()
533
+ const routable =
534
+ !!registryClient &&
535
+ typeof walletUserId === 'number' &&
536
+ !recipient.selectedIdentity &&
537
+ !target &&
538
+ classifyRecipientInput(query).kind === 'search' &&
539
+ query.length >= 2
540
+ if (!routable) {
541
+ // Only here, and only when there is something to clear: an unconditional
542
+ // `setRegistryMatches([])` hands React a new array reference on every
543
+ // run, which it can never bail out of.
544
+ setRegistryMatches(rows => (rows.length === 0 ? rows : []))
545
+ setRegistrySearching(false)
546
+ return
547
+ }
548
+ let cancelled = false
549
+ setRegistrySearching(true)
550
+ const timer = setTimeout(async () => {
551
+ try {
552
+ const rows = await registryClient.search(query)
553
+ if (cancelled) return
554
+ setRegistryMatches(rows)
555
+ setRegistryError(false)
556
+ } catch (error) {
557
+ console.error('Handle registry search error:', error)
558
+ if (cancelled) return
559
+ setRegistryMatches([])
560
+ setRegistryError(true)
561
+ } finally {
562
+ if (!cancelled) setRegistrySearching(false)
563
+ }
564
+ }, REGISTRY_SEARCH_DEBOUNCE_MS)
565
+ return () => {
566
+ cancelled = true
567
+ clearTimeout(timer)
568
+ }
569
+ }, [registryClient, walletUserId, recipient.inputText, recipient.selectedIdentity, target])
570
+
571
+ const mergedSearchResults = useMemo((): RecipientRow[] => {
572
+ const contactIdentities: RecipientRow[] = contactMatches.map(c => ({
573
+ identityKey: c.identityKey,
574
+ name: c.name,
575
+ avatarURL: c.cachedAvatarUrl ?? '',
576
+ abbreviatedKey: abbreviateKey(c.identityKey),
577
+ badgeIconURL: '',
578
+ badgeLabel: '',
579
+ badgeClickURL: '',
580
+ ...(c.cachedHandle ? { secondaryLine: c.cachedHandle } : {})
581
+ }))
582
+ const seen = new Set(contactIdentities.map(c => c.identityKey))
583
+ // Contacts, then the registry, then the overlay. A person the user has
584
+ // already labelled is shown with that label; a registry row states the
585
+ // name the owner published and the handle it belongs to.
586
+ //
587
+ // One key, one row, across the WHOLE list — so `seen` is consulted and
588
+ // added to in the same pass. Filtering first would let two certificates
589
+ // for one subject through together, which the pinned registry cannot
590
+ // produce but a foreign host answering `search` can.
591
+ const registryIdentities: RecipientRow[] = []
592
+ for (const p of registryMatches) {
593
+ if (seen.has(p.identityKey)) continue
594
+ seen.add(p.identityKey)
595
+ registryIdentities.push({
596
+ identityKey: p.identityKey,
597
+ // A display name is the owner's own unvalidated plaintext, and this row
598
+ // is the one place it is drawn ABOVE the handle it belongs to. A name
599
+ // shaped like an address therefore reads as somebody else's
600
+ // `handle@domain` — and it is the name, not the handle, that the field
601
+ // and the review card carry from here on. A name that can be mistaken
602
+ // for an address is no name.
603
+ name: (p.displayName?.includes('@') ? '' : p.displayName) || p.handle,
604
+ avatarURL: '',
605
+ abbreviatedKey: abbreviateKey(p.identityKey),
606
+ badgeIconURL: '',
607
+ badgeLabel: t('pay_trust_handle_attested'),
608
+ badgeClickURL: '',
609
+ secondaryLine: p.paymail
610
+ })
611
+ }
612
+ return [
613
+ ...contactIdentities,
614
+ ...registryIdentities,
615
+ ...recipient.searchResults.filter(r => !seen.has(r.identityKey))
616
+ ]
617
+ }, [contactMatches, registryMatches, recipient.searchResults, t])
618
+
619
+ /**
620
+ * The handle of the row the user picked, so the success screen's "Save as
621
+ * contact" can carry it into the new contact — held against the KEY it
622
+ * belongs to, not as a bare string.
623
+ *
624
+ * `handleSend` clears the field through the hook's own `clearRecipient`
625
+ * rather than the wrapper below, deliberately, so this survives the send and
626
+ * the overlay can still read it. A bare string would therefore also outlive
627
+ * its owner: pay someone with a handle, then pay a pasted key from the same
628
+ * mounted form, and the second person would be offered for saving with the
629
+ * first person's `handle@domain`.
630
+ */
631
+ const selectedHandleRef = useRef<{ identityKey: string; handle: string } | undefined>(undefined)
632
+ /**
633
+ * The same fact, as state, for the review card — which is the one screen
634
+ * whose whole job is the last check before money moves, and which otherwise
635
+ * draws a name over an abbreviated key and never shows the `handle@domain`
636
+ * being paid at all. State rather than the ref above because the card is
637
+ * rendered, and a ref does not re-render; both rather than one because the
638
+ * ref must outlive the send and this must not survive a new recipient.
639
+ */
640
+ const [pickedHandle, setPickedHandle] = useState<{ identityKey: string; handle: string } | null>(null)
641
+ const onSelectIdentity = (identity: RecipientRow) => {
642
+ const picked = identity.secondaryLine?.includes('@')
643
+ ? { identityKey: identity.identityKey, handle: identity.secondaryLine }
644
+ : undefined
645
+ selectedHandleRef.current = picked
646
+ setPickedHandle(picked ?? null)
647
+ recipient.selectIdentity(identity)
648
+ }
649
+ const onClearRecipient = () => {
650
+ selectedHandleRef.current = undefined
651
+ setPickedHandle(null)
652
+ recipient.clearRecipient()
653
+ }
654
+ // Whether the resolved recipient is already a saved contact — the review
655
+ // step's trust tag names this before "registered"/"unverified".
656
+ const [targetIsContact, setTargetIsContact] = useState(false)
657
+ useEffect(() => {
658
+ if (!contactsStore || walletUserId === null || target?.kind !== 'handle') {
659
+ setTargetIsContact(false)
660
+ return
661
+ }
662
+ let cancelled = false
663
+ void contactsStore.getContact(walletUserId, target.identityKey).then(c => {
664
+ if (!cancelled) setTargetIsContact(!!c)
665
+ })
666
+ return () => {
667
+ cancelled = true
668
+ }
669
+ }, [contactsStore, walletUserId, target])
670
+
671
+ // The success screen's "Add to contacts" offer: only for a handle send, and
672
+ // only once confirmed absent from contacts (checked fresh here rather than
673
+ // reusing `targetIsContact` — `target` may already be cleared by the time
674
+ // this runs, and a check against the stale ONE this send actually used is
675
+ // what the button must reflect).
676
+ useEffect(() => {
677
+ setOfferAddContact(null)
678
+ if (!sent?.recipientIdentityKey || !contactsStore || walletUserId === null) return
679
+ let cancelled = false
680
+ const identityKey = sent.recipientIdentityKey
681
+ void contactsStore.getContact(walletUserId, identityKey).then(c => {
682
+ if (cancelled || c) return
683
+ // Only the handle of the person actually paid: see selectedHandleRef.
684
+ const picked = selectedHandleRef.current
685
+ setOfferAddContact({
686
+ identityKey,
687
+ name: sent.recipient,
688
+ ...(picked?.identityKey === identityKey ? { handle: picked.handle } : {})
689
+ })
690
+ })
691
+ return () => {
692
+ cancelled = true
693
+ }
694
+ }, [sent, contactsStore, walletUserId])
695
+
696
+ const onAddContact = useCallback(() => {
697
+ if (!offerAddContact) return
698
+ setSent(null)
699
+ loadExpoRouter().router.push({
700
+ pathname: '/contact/add',
701
+ params: {
702
+ identityKey: offerAddContact.identityKey,
703
+ name: offerAddContact.name ?? '',
704
+ handle: offerAddContact.handle ?? '',
705
+ source: 'pay'
706
+ }
707
+ } as never)
708
+ }, [offerAddContact])
709
+
396
710
  /**
397
711
  * A token link that arrived before the holdings were known. `null` balances
398
712
  * mean UNKNOWN, never "holds nothing" (useMandala's contract), and a
@@ -538,6 +852,7 @@ function UniversalSend({
538
852
  setSent({
539
853
  amount: paidSats,
540
854
  recipient: recipient.selectedIdentity?.name,
855
+ recipientIdentityKey: to.identityKey,
541
856
  // The handle rail always drops the payment in the recipient's message
542
857
  // box rather than handing it over in person — worth saying explicitly
543
858
  // here, since it is the one thing an in-person (Nearby) payer never
@@ -571,7 +886,7 @@ function UniversalSend({
571
886
  * allowed to promise "nothing was sent".
572
887
  */
573
888
  const sendToken = useCallback(
574
- async (to: Extract<RecipientTarget, { kind: 'handle' }>, baseUnits: number) => {
889
+ async (to: Extract<RecipientTarget, { kind: 'handle' }>, baseUnits: number): Promise<boolean> => {
575
890
  const runtime = mandala.runtime
576
891
  if (!runtime || !asset) throw new Error(t('wallet_not_ready'))
577
892
  const ctx = {
@@ -593,11 +908,15 @@ function UniversalSend({
593
908
  // that could not sign) and is the only place it survives.
594
909
  console.warn('[pay] token send failed:', result.kind, result.message ?? (result as { code?: string }).code)
595
910
  setTokenFailure(tokenSendCopy(result, ctx))
596
- return
911
+ // A refusal must leave the review step exactly as it is — the banner
912
+ // that explains it lives there, and stepping back to "who" (as a
913
+ // successful send does) would carry the user straight past it.
914
+ return false
597
915
  }
598
916
  setSent({
599
917
  amount: 0,
600
918
  recipient: recipient.selectedIdentity?.name,
919
+ recipientIdentityKey: to.identityKey,
601
920
  // Never falls back to the satoshi renderer: a token figure it could not
602
921
  // format would print as satoshis, which is a wrong number rather than a
603
922
  // missing one.
@@ -624,6 +943,7 @@ function UniversalSend({
624
943
  : t('token_sent_settling_unnamed', { issuer })
625
944
  })
626
945
  mandala.refresh()
946
+ return true
627
947
  },
628
948
  [mandala, asset, issuer, recipient.selectedIdentity, note, t]
629
949
  )
@@ -653,12 +973,14 @@ function UniversalSend({
653
973
  // D4: a token has no address rail, and `canSend` has already refused
654
974
  // one. This is the second gate, because the first is a render.
655
975
  if (target.kind !== 'handle') return
656
- await sendToken(target, amount)
976
+ const sent = await sendToken(target, amount)
977
+ if (!sent) return
657
978
  } else if (target.kind === 'handle') await sendHandle(target, amount)
658
979
  else await sendAddress(target, amount)
659
980
  setFigure(current => ({ ...current, text: '' }))
660
981
  setNote('')
661
982
  recipient.clearRecipient()
983
+ setStep('who')
662
984
  } catch (error: any) {
663
985
  if (await handleWalletCheck(error)) return
664
986
  if (asset) {
@@ -723,7 +1045,7 @@ function UniversalSend({
723
1045
  setRetryingId(entry.id)
724
1046
  try {
725
1047
  await retryDelivery({ wallet: wallet as any, adminOriginator, client, storage, entry })
726
- setSent({ amount: entry.token.amount })
1048
+ setSent({ amount: entry.token.amount, recipientIdentityKey: entry.recipient })
727
1049
  } catch (e: any) {
728
1050
  if (await handleWalletCheck(e)) return
729
1051
  const reason = isMessageBoxNetworkError(e) ? t('message_box_unreachable') : e?.message || t('unknown_error')
@@ -902,159 +1224,314 @@ function UniversalSend({
902
1224
  : null
903
1225
  : null
904
1226
 
905
- const ctaLabel =
906
- asset && amountOk
907
- ? t('pay_asset_cta', {
908
- amount: formatTokenAmount(baseUnits, asset.decimals) ?? '',
909
- ticker: asset.ticker
910
- })
1227
+ const backStep = useCallback(() => {
1228
+ setStep(prev => (prev === 'review' ? 'amount' : 'who'))
1229
+ }, [])
1230
+ useImperativeHandle(
1231
+ ref,
1232
+ () => ({
1233
+ back: () => {
1234
+ if (step === 'who') return false
1235
+ backStep()
1236
+ return true
1237
+ }
1238
+ }),
1239
+ [step, backStep]
1240
+ )
1241
+ // Taken off `recipient` here rather than called through it below: calling it
1242
+ // as a method would make the whole (rebuilt every render) `recipient` object
1243
+ // a dependency of the effect, and an effect that reran every render would
1244
+ // clear the overlay's own search notice the instant it was raised.
1245
+ const clearSearchError = recipient.clearSearchError
1246
+ useEffect(() => {
1247
+ onStepChange?.(step)
1248
+ // Neither search notice belongs on the amount or review screen: both are
1249
+ // about a recipient field that is no longer on screen.
1250
+ setRegistryError(false)
1251
+ clearSearchError()
1252
+ }, [step, onStepChange, clearSearchError])
1253
+
1254
+ // ── the review card's facts ──────────────────────────────────────────
1255
+ // Once money is moving, the figure is ALWAYS the asset that actually moves
1256
+ // (BSV or the token), never the display currency (2026-09-17 ruling):
1257
+ // "12.00 USD" on a BSV send reads as a stablecoin.
1258
+ const sendSats = Math.round(Number(sendAmount)) || 0
1259
+ const reviewAmount = asset
1260
+ ? { value: formatTokenAmount(baseUnits, asset.decimals) ?? '', unit: asset.ticker }
1261
+ : { value: formatSatoshisAsBsvDecimal(sendSats), unit: 'BSV' }
1262
+ const reviewPrimary =
1263
+ recipient.selectedIdentity?.name ||
1264
+ (target?.kind === 'handle' ? abbreviateKey(target.identityKey) : target?.kind === 'address' ? target.address : '')
1265
+ // The handle the picked row carried, when it is still the row being paid —
1266
+ // the name above it may be anything its owner published, this is the address
1267
+ // the money is going to. An abbreviated key only when there is no handle.
1268
+ const reviewSecondary =
1269
+ recipient.selectedIdentity?.name && target?.kind === 'handle'
1270
+ ? pickedHandle?.identityKey === target.identityKey
1271
+ ? pickedHandle.handle
1272
+ : abbreviateKey(target.identityKey)
911
1273
  : undefined
1274
+ const reviewTrust = targetIsContact
1275
+ ? { icon: 'person-circle-outline', color: colors.textSecondary, text: t('pay_trust_contact') }
1276
+ : recipient.selectedIdentity
1277
+ ? { icon: 'shield-checkmark-outline', color: colors.textSecondary, text: t('pay_trust_handle_attested') }
1278
+ : { icon: 'alert-circle-outline', color: colors.warning, text: t('pay_trust_unverified') }
1279
+ const showNoteRow = isHandle || (isAddress && !asset)
912
1280
 
913
1281
  return (
914
1282
  <ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
1283
+ <StepBar step={step} />
915
1284
  {notice && <ResultBanner result={notice} onDismiss={() => setNotice(null)} colors={colors} />}
916
- {recipient.searchError && (
1285
+ {/* One notice for both remote tiers. Offline they fail on the same
1286
+ keystroke, and two banners carrying the identical sentence read as the
1287
+ error re-appearing when the first is dismissed. */}
1288
+ {(recipient.searchError || registryError) && (
917
1289
  <ResultBanner
918
1290
  result={{ type: 'error', message: t('identity_search_unavailable') }}
919
- onDismiss={recipient.clearSearchError}
1291
+ onDismiss={() => {
1292
+ recipient.clearSearchError()
1293
+ setRegistryError(false)
1294
+ }}
920
1295
  colors={colors}
921
1296
  />
922
1297
  )}
923
1298
 
924
- <PayField labelKey="recipient">
925
- <RecipientField
926
- selectedIdentity={recipient.selectedIdentity}
927
- inputText={recipient.inputText}
928
- target={recipient.target}
929
- inlineError={recipient.inlineError}
930
- isSearching={recipient.isSearching}
931
- searchResults={recipient.searchResults}
932
- colors={colors}
933
- t={t}
934
- onChangeText={recipient.onChangeText}
935
- onSelectIdentity={recipient.selectIdentity}
936
- onClear={recipient.clearRecipient}
937
- onOpenScanner={recipient.openScanner}
938
- assetTicker={asset?.ticker}
939
- statusOverride={
940
- recipientRefusal && !tokenAddressRefused
941
- ? { text: recipientRefusal, tone: 'warning' }
942
- : recipientRegistryRefused
943
- ? {
944
- text: t(
945
- assetStatus?.accessMode === 'denylist' ? 'pay_asset_recipient_blocked' : 'pay_asset_recipient_unregistered',
946
- { issuer, ticker: asset?.ticker }
947
- ),
948
- tone: 'warning'
949
- }
950
- : undefined
951
- }
952
- />
953
- </PayField>
954
-
955
- {/* No "Paying with" picker here (design 1b, 2026-09-15): the coin is
956
- chosen once, on Home's switcher, and arrives as `selectedAssetId`.
957
- It still decides the unit of the figure, the available balance under
958
- it, and which recipient shapes are legal for a token (D4, above) —
959
- and a peerpay link naming an asset still moves it. */}
960
-
961
- <PayAmountField
962
- value={sendAmount}
963
- onChangeText={setSendAmount}
964
- asset={asset ? { ticker: asset.ticker, decimals: asset.decimals } : undefined}
965
- maxValue={holding ? String(holding.baseUnits) : undefined}
966
- availableText={
967
- holding ? (formatTokenAmount(holding.baseUnits, holding.asset.decimals) ?? undefined) : undefined
968
- }
969
- />
970
-
971
- {(isHandle || (isAddress && !asset)) && (
972
- <PayField labelKey="note">
973
- <TextInput
974
- value={note}
975
- onChangeText={setNote}
976
- placeholder={t('note_placeholder')}
977
- placeholderTextColor={colors.textQuaternary}
978
- maxLength={280}
979
- style={[
980
- styles.noteInput,
981
- { backgroundColor: colors.backgroundSecondary, borderColor: colors.separator, color: colors.textPrimary }
982
- ]}
983
- />
984
- </PayField>
985
- )}
1299
+ {step === 'who' && (
1300
+ <>
1301
+ <PayField labelKey="pay_review_to">
1302
+ <RecipientField
1303
+ selectedIdentity={recipient.selectedIdentity}
1304
+ inputText={recipient.inputText}
1305
+ target={recipient.target}
1306
+ inlineError={recipient.inlineError}
1307
+ isSearching={recipient.isSearching || registrySearching}
1308
+ searchResults={mergedSearchResults}
1309
+ colors={colors}
1310
+ t={t}
1311
+ onChangeText={recipient.onChangeText}
1312
+ onSelectIdentity={onSelectIdentity}
1313
+ onClear={onClearRecipient}
1314
+ onOpenScanner={recipient.openScanner}
1315
+ assetTicker={asset?.ticker}
1316
+ recentLabel={t('contacts_recent')}
1317
+ statusOverride={
1318
+ recipientRefusal && !tokenAddressRefused
1319
+ ? { text: recipientRefusal, tone: 'warning' }
1320
+ : recipientRegistryRefused
1321
+ ? {
1322
+ text: t(
1323
+ assetStatus?.accessMode === 'denylist'
1324
+ ? 'pay_asset_recipient_blocked'
1325
+ : 'pay_asset_recipient_unregistered',
1326
+ { issuer, ticker: asset?.ticker }
1327
+ ),
1328
+ tone: 'warning'
1329
+ }
1330
+ : undefined
1331
+ }
1332
+ />
1333
+ </PayField>
986
1334
 
987
- {/* Load-bearing for an address: this rail cannot notify the payee. Nothing
988
- for a handle, and nothing at all in token mode, where an address is
989
- refused rather than warned about. */}
990
- {isAddress && !asset && <ConsequenceNote textKey={CONSEQUENCE_KEYS.address} />}
991
-
992
- {tokenNote && (
993
- <ConsequenceNote
994
- textKey={tokenNote.key}
995
- values={tokenNote.values}
996
- text={tokenNote.text}
997
- action={
998
- tokenNote.action === 'get-bsv'
999
- ? {
1000
- label: t('pay_asset_get_bsv'),
1001
- onPress: () => loadExpoRouter().router.push('/pay?direction=get' as never)
1002
- }
1003
- : undefined
1004
- }
1005
- />
1006
- )}
1335
+ {/* No "Paying with" picker here (design 1b, 2026-09-15): the coin is
1336
+ chosen once, on Home's switcher, and arrives as `selectedAssetId`. */}
1007
1337
 
1008
- {isHandle && !isConfigured && !asset && (
1009
- <Text style={[styles.consequence, { color: colors.textSecondary }]}>{t('message_box_off_hint')}</Text>
1010
- )}
1011
- {handleFormValid && handleBlockedByOutbox && !asset && (
1012
- <Text style={[styles.consequence, { color: colors.textSecondary }]}>{t('finish_or_cancel_outgoing')}</Text>
1338
+ {target ? (
1339
+ <PayCta
1340
+ onPress={() => setStep('amount')}
1341
+ disabled={false}
1342
+ busy={false}
1343
+ label={t('pay_step_continue')}
1344
+ icon="arrow-forward"
1345
+ />
1346
+ ) : (
1347
+ <PressableScale
1348
+ onPress={() => loadExpoRouter().router.push('/contacts' as never)}
1349
+ haptic="tap"
1350
+ style={[
1351
+ styles.outlineBtn,
1352
+ { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }
1353
+ ]}
1354
+ accessibilityRole="button"
1355
+ >
1356
+ <Ionicons name="people-outline" size={18} color={colors.textPrimary} />
1357
+ <Text style={[styles.outlineBtnText, { color: colors.textPrimary }]}>{t('pay_step_contacts')}</Text>
1358
+ </PressableScale>
1359
+ )}
1360
+
1361
+ {outbox.length > 0 && (
1362
+ <OutgoingSection
1363
+ entries={outbox}
1364
+ retryingId={retryingId}
1365
+ colors={colors}
1366
+ t={t}
1367
+ onRetry={handleRetry}
1368
+ onCancel={handleCancel}
1369
+ />
1370
+ )}
1371
+ </>
1013
1372
  )}
1014
1373
 
1015
- <PayCta onPress={handleSend} disabled={!canSend} busy={isSending} label={ctaLabel} />
1374
+ {step === 'amount' && (
1375
+ <>
1376
+ <PayAmountField
1377
+ value={sendAmount}
1378
+ onChangeText={setSendAmount}
1379
+ asset={asset ? { ticker: asset.ticker, decimals: asset.decimals } : undefined}
1380
+ maxValue={holding ? String(holding.baseUnits) : undefined}
1381
+ availableText={
1382
+ holding ? (formatTokenAmount(holding.baseUnits, holding.asset.decimals) ?? undefined) : undefined
1383
+ }
1384
+ />
1016
1385
 
1017
- {/* A failed token send, in the app's own failure channel: error tone,
1018
- dismissible, and carrying at most one affordance. "Check again"
1019
- refreshes the balance rather than re-sending, because a retry after a
1020
- lost response builds a second spend of the same coins. */}
1021
- {tokenFailure && (
1022
- <ResultBanner
1023
- result={{ type: 'error', message: t(tokenFailure.key, tokenFailure.values) }}
1024
- onDismiss={() => setTokenFailure(null)}
1025
- colors={colors}
1026
- action={
1027
- tokenFailure.action === 'check-again'
1028
- ? {
1029
- label: t('token_err_check_again'),
1030
- onPress: () => {
1031
- mandala.refresh()
1032
- setTokenFailure(null)
1033
- }
1034
- }
1035
- : tokenFailure.action === 'get-bsv'
1036
- ? {
1037
- label: t('pay_asset_get_bsv'),
1038
- onPress: () => loadExpoRouter().router.push('/pay?direction=get' as never)
1039
- }
1040
- : undefined
1041
- }
1042
- />
1386
+ <PayCta
1387
+ onPress={() => setStep('review')}
1388
+ disabled={!amountOk}
1389
+ busy={false}
1390
+ label={t('pay_step_continue')}
1391
+ icon="arrow-forward"
1392
+ />
1393
+ </>
1043
1394
  )}
1044
1395
 
1045
- {sendResult && <ResultBanner result={sendResult} onDismiss={() => setSendResult(null)} colors={colors} />}
1396
+ {step === 'review' && target && (
1397
+ <>
1398
+ <View
1399
+ style={[styles.reviewCard, { backgroundColor: colors.backgroundElevated, borderColor: colors.separator }]}
1400
+ >
1401
+ <View style={[styles.reviewRow, { borderBottomColor: colors.separator }]}>
1402
+ <Text style={[styles.reviewLabel, { color: colors.textTertiary }]}>{t('pay_review_to')}</Text>
1403
+ {target.kind === 'handle' ? (
1404
+ <ContactSigil
1405
+ identityKey={target.identityKey}
1406
+ avatarUrl={recipient.selectedIdentity?.avatarURL || undefined}
1407
+ size={32}
1408
+ radius={16}
1409
+ />
1410
+ ) : (
1411
+ <View style={[styles.reviewAddressIcon, { backgroundColor: colors.fillTertiary }]}>
1412
+ <Ionicons name="wallet-outline" size={16} color={colors.textSecondary} />
1413
+ </View>
1414
+ )}
1415
+ <View style={styles.reviewToText}>
1416
+ <View style={styles.reviewNameRow}>
1417
+ <Text style={[styles.reviewName, { color: colors.textPrimary }]} numberOfLines={1}>
1418
+ {reviewPrimary}
1419
+ </Text>
1420
+ {!!reviewSecondary && (
1421
+ <Text
1422
+ style={[styles.reviewNameSub, { color: colors.textSecondary }]}
1423
+ numberOfLines={1}
1424
+ ellipsizeMode="middle"
1425
+ >
1426
+ {reviewSecondary}
1427
+ </Text>
1428
+ )}
1429
+ </View>
1430
+ {target.kind === 'handle' && (
1431
+ <View style={styles.reviewTrustRow}>
1432
+ <Ionicons name={reviewTrust.icon as never} size={12} color={reviewTrust.color} />
1433
+ <Text style={[styles.reviewTrust, { color: reviewTrust.color }]} numberOfLines={1}>
1434
+ {reviewTrust.text}
1435
+ </Text>
1436
+ </View>
1437
+ )}
1438
+ </View>
1439
+ </View>
1046
1440
 
1047
- {outbox.length > 0 && (
1048
- <OutgoingSection
1049
- entries={outbox}
1050
- retryingId={retryingId}
1051
- colors={colors}
1052
- t={t}
1053
- onRetry={handleRetry}
1054
- onCancel={handleCancel}
1055
- />
1441
+ <View
1442
+ style={[styles.reviewRow, !showNoteRow && styles.reviewRowLast, { borderBottomColor: colors.separator }]}
1443
+ >
1444
+ <Text style={[styles.reviewLabel, { color: colors.textTertiary }]}>{t('pay_review_amount')}</Text>
1445
+ {/* No adjustsFontSizeToFit / numberOfLines: iOS's shrink floor is a fixed 4pt and in this
1446
+ flex row it collapsed the amount to illegible. A long amount wraps instead, so no digit
1447
+ is ever hidden on the screen that confirms it. */}
1448
+ <Text
1449
+ style={[styles.reviewAmount, { color: colors.textPrimary }]}
1450
+ accessibilityLabel={`${reviewAmount.value} ${reviewAmount.unit}`}
1451
+ >
1452
+ {reviewAmount.value}{' '}
1453
+ <Text style={[styles.reviewUnit, { color: colors.textSecondary }]}>{reviewAmount.unit}</Text>
1454
+ </Text>
1455
+ </View>
1456
+
1457
+ {showNoteRow && (
1458
+ <View style={[styles.reviewRow, styles.reviewRowLast]}>
1459
+ <Text style={[styles.reviewLabel, { color: colors.textTertiary }]}>{t('pay_review_note')}</Text>
1460
+ <TextInput
1461
+ value={note}
1462
+ onChangeText={setNote}
1463
+ placeholder={t('pay_review_note_edit')}
1464
+ placeholderTextColor={colors.textQuaternary}
1465
+ maxLength={280}
1466
+ style={[styles.reviewNoteInput, { color: colors.textPrimary }]}
1467
+ />
1468
+ <Ionicons name="pencil-outline" size={16} color={colors.textTertiary} />
1469
+ </View>
1470
+ )}
1471
+ </View>
1472
+
1473
+ {/* Load-bearing for an address: this rail cannot notify the payee. Nothing
1474
+ for a handle, and nothing at all in token mode, where an address is
1475
+ refused rather than warned about. */}
1476
+ {isAddress && !asset && <ConsequenceNote textKey={CONSEQUENCE_KEYS.address} />}
1477
+
1478
+ {tokenNote && (
1479
+ <ConsequenceNote
1480
+ textKey={tokenNote.key}
1481
+ values={tokenNote.values}
1482
+ text={tokenNote.text}
1483
+ action={
1484
+ tokenNote.action === 'get-bsv'
1485
+ ? {
1486
+ label: t('pay_asset_get_bsv'),
1487
+ onPress: () => loadExpoRouter().router.push('/pay?direction=get' as never)
1488
+ }
1489
+ : undefined
1490
+ }
1491
+ />
1492
+ )}
1493
+
1494
+ {isHandle && !isConfigured && !asset && (
1495
+ <Text style={[styles.consequence, { color: colors.textSecondary }]}>{t('message_box_off_hint')}</Text>
1496
+ )}
1497
+ {handleFormValid && handleBlockedByOutbox && !asset && (
1498
+ <Text style={[styles.consequence, { color: colors.textSecondary }]}>{t('finish_or_cancel_outgoing')}</Text>
1499
+ )}
1500
+
1501
+ <PayCta onPress={handleSend} disabled={!canSend} busy={isSending} labelKey="send" />
1502
+
1503
+ {/* A failed token send, in the app's own failure channel: error tone,
1504
+ dismissible, and carrying at most one affordance. "Check again"
1505
+ refreshes the balance rather than re-sending, because a retry after a
1506
+ lost response builds a second spend of the same coins. */}
1507
+ {tokenFailure && (
1508
+ <ResultBanner
1509
+ result={{ type: 'error', message: t(tokenFailure.key, tokenFailure.values) }}
1510
+ onDismiss={() => setTokenFailure(null)}
1511
+ colors={colors}
1512
+ action={
1513
+ tokenFailure.action === 'check-again'
1514
+ ? {
1515
+ label: t('token_err_check_again'),
1516
+ onPress: () => {
1517
+ mandala.refresh()
1518
+ setTokenFailure(null)
1519
+ }
1520
+ }
1521
+ : tokenFailure.action === 'get-bsv'
1522
+ ? {
1523
+ label: t('pay_asset_get_bsv'),
1524
+ onPress: () => loadExpoRouter().router.push('/pay?direction=get' as never)
1525
+ }
1526
+ : undefined
1527
+ }
1528
+ />
1529
+ )}
1530
+ </>
1056
1531
  )}
1057
1532
 
1533
+ {sendResult && <ResultBanner result={sendResult} onDismiss={() => setSendResult(null)} colors={colors} />}
1534
+
1058
1535
  <Modal
1059
1536
  visible={recipient.scannerVisible}
1060
1537
  animationType="slide"
@@ -1077,6 +1554,7 @@ function UniversalSend({
1077
1554
  amountText={sent.amountText}
1078
1555
  statusNote={sent.statusNote}
1079
1556
  recipientName={sent.recipient}
1557
+ onAddContact={offerAddContact ? onAddContact : undefined}
1080
1558
  onDismiss={() => setSent(null)}
1081
1559
  dismissTo={dismissTo}
1082
1560
  />
@@ -1096,6 +1574,54 @@ const styles = StyleSheet.create({
1096
1574
  marginBottom: spacing.lg
1097
1575
  },
1098
1576
 
1577
+ // Step 1's quiet second door: Contacts, on the chrome surface.
1578
+ outlineBtn: {
1579
+ flexDirection: 'row',
1580
+ alignItems: 'center',
1581
+ justifyContent: 'center',
1582
+ gap: spacing.sm,
1583
+ minHeight: 48,
1584
+ borderWidth: StyleSheet.hairlineWidth,
1585
+ borderRadius: radii.md,
1586
+ paddingVertical: spacing.md
1587
+ },
1588
+ outlineBtnText: { ...typography.subhead, fontWeight: '600' },
1589
+
1590
+ // Review card (step "review"): label-left rows, hairlines between them.
1591
+ reviewCard: {
1592
+ borderRadius: radii.lg,
1593
+ borderWidth: StyleSheet.hairlineWidth,
1594
+ marginBottom: spacing.lg,
1595
+ overflow: 'hidden'
1596
+ },
1597
+ reviewRow: {
1598
+ flexDirection: 'row',
1599
+ alignItems: 'center',
1600
+ gap: spacing.md,
1601
+ minHeight: 56,
1602
+ paddingVertical: spacing.md,
1603
+ paddingHorizontal: spacing.lg,
1604
+ borderBottomWidth: StyleSheet.hairlineWidth
1605
+ },
1606
+ reviewRowLast: { borderBottomWidth: 0 },
1607
+ reviewLabel: {
1608
+ width: 64,
1609
+ ...typography.caption2,
1610
+ fontWeight: '600',
1611
+ letterSpacing: 0.8,
1612
+ textTransform: 'uppercase'
1613
+ },
1614
+ reviewAddressIcon: { width: 32, height: 32, borderRadius: 16, alignItems: 'center', justifyContent: 'center' },
1615
+ reviewToText: { flex: 1, minWidth: 0, gap: 2 },
1616
+ reviewNameRow: { flexDirection: 'row', alignItems: 'baseline', gap: spacing.sm, minWidth: 0 },
1617
+ reviewName: { ...typography.body, fontWeight: '600', flexShrink: 1 },
1618
+ reviewNameSub: { ...typography.subhead, flexShrink: 1 },
1619
+ reviewTrustRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.xs },
1620
+ reviewTrust: { ...typography.caption1 },
1621
+ reviewAmount: { ...typography.title2, fontWeight: '700', fontVariant: ['tabular-nums'], flex: 1 },
1622
+ reviewUnit: { ...typography.headline, fontWeight: '600' },
1623
+ reviewNoteInput: { ...typography.body, flex: 1, minWidth: 0, paddingVertical: 0 },
1624
+
1099
1625
  // Consequence line + call to action
1100
1626
  consequence: {
1101
1627
  ...typography.footnote,
@@ -1195,5 +1721,7 @@ const styles = StyleSheet.create({
1195
1721
  }
1196
1722
  })
1197
1723
 
1724
+ const UniversalSend = forwardRef<UniversalSendHandle, UniversalSendProps>(UniversalSendInner)
1725
+
1198
1726
  // Wallet status updates in the parent do not change this form's inputs.
1199
1727
  export default memo(UniversalSend)