@bsv/expo-wallet-toolbox 0.25.1 → 0.27.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 (59) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/core/context/WalletContext.tsx +23 -2
  3. package/core/i18n/translations.tsx +245 -36
  4. package/core/identity/handleRegistry/classify.ts +74 -0
  5. package/core/identity/handleRegistry/client.ts +110 -16
  6. package/core/identity/handleRegistry/registration.ts +115 -17
  7. package/core/identity/handleRegistry/resolver.ts +77 -34
  8. package/core/identity/handleRegistry/rules.ts +4 -0
  9. package/core/index.ts +7 -0
  10. package/core/monitor/TaskDrainOutbox.ts +13 -3
  11. package/core/pay/paymail/address.ts +19 -0
  12. package/core/pay/paymail/client.ts +177 -0
  13. package/core/pay/paymail/networkCheck.ts +56 -0
  14. package/core/pay/rails/handle.ts +46 -9
  15. package/core/pay/rails/paymail.ts +542 -0
  16. package/core/peerpay/handleResendRequests.ts +6 -6
  17. package/core/peerpay/outbox.ts +185 -17
  18. package/core/peerpay/rebuildToken.ts +2 -2
  19. package/core/profiles/profileStore.ts +4 -1
  20. package/core/services/groupSpendingLimit.ts +26 -0
  21. package/core/services/signingPermissionPolicy.ts +14 -8
  22. package/core/services/vault/ceremony.ts +13 -0
  23. package/core/services/vault/ceremonyHost.ts +58 -0
  24. package/core/services/vault/failedVaultSpend.ts +40 -0
  25. package/core/services/vault/outputAuthority.ts +13 -6
  26. package/core/services/vault/transfers.ts +56 -12
  27. package/core/storage/encryptedDbImage.ts +11 -2
  28. package/core/theme/tokens.ts +26 -12
  29. package/package.json +2 -1
  30. package/ui/components/QRScanner.tsx +24 -22
  31. package/ui/components/pay/ImportedOutboxApproval.tsx +23 -2
  32. package/ui/components/pay/MessageBoxConfig.tsx +10 -16
  33. package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
  34. package/ui/components/pay/NearbyFlow.tsx +72 -35
  35. package/ui/components/pay/PayForm.tsx +27 -19
  36. package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
  37. package/ui/components/pay/UniversalSend.tsx +79 -5
  38. package/ui/components/ui/AlertCard.tsx +3 -2
  39. package/ui/components/ui/BalancedText.tsx +117 -0
  40. package/ui/components/ui/ErrorBoundary.tsx +31 -14
  41. package/ui/components/ui/GroupedList.tsx +28 -22
  42. package/ui/components/ui/ListRow.tsx +126 -35
  43. package/ui/components/ui/PermissionSheet.tsx +31 -24
  44. package/ui/components/ui/PresenceRow.tsx +15 -23
  45. package/ui/components/ui/Sheet.tsx +11 -17
  46. package/ui/components/ui/Toast.tsx +13 -17
  47. package/ui/components/vault/EnrollWizard.tsx +446 -196
  48. package/ui/components/vault/KeyChooser.tsx +7 -20
  49. package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
  50. package/ui/components/wallet/AmountInput.tsx +11 -17
  51. package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
  52. package/ui/index.ts +1 -1
  53. package/ui/screens/TrustScreen.tsx +49 -61
  54. package/ui/screens/VaultScreen.tsx +99 -60
  55. package/ui/screens/VaultTransferScreen.tsx +34 -27
  56. package/ui/screens/WalletCheckScreen.tsx +25 -24
  57. package/ui/screens/WalletConfigScreen.tsx +66 -72
  58. package/ui/screens/WalletHomeScreen.tsx +104 -4
  59. package/ui/txStatus.ts +1 -1
@@ -196,20 +196,49 @@ import type { AmountInputAsset } from '../wallet/AmountInput'
196
196
  import type { DismissTarget } from '../../dismissTarget'
197
197
 
198
198
  /**
199
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
200
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
201
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
202
- * Ionicons is loaded lazily, only when actually rendering, same pattern as
203
- * this package's other native-module-boundary fixes (expo-router, expo-blur).
199
+ * Every glyph this flow draws comes from lucide, as the rest of this app does
200
+ * (src/settings/Rows.tsx, the headers, the sheets). Two icon families in one
201
+ * flow is visible at a glance: Ionicons' filled-corner, closed shapes next to
202
+ * lucide's open 2px strokes read as two apps.
203
+ *
204
+ * Imported at module scope rather than behind a lazy loader. What had to be
205
+ * deferred is @expo/vector-icons' index barrel, which re-exports every icon
206
+ * set and so reaches expo-font -> expo-asset as untransformed ESM; nothing
207
+ * here pulls that barrel in any more. lucide publishes both module formats
208
+ * and Jest resolves the ESM one, so the app pins this name to lucide's CJS
209
+ * entry in jest.moduleNameMapper (package.json), as it already does for its
210
+ * other ESM-only dependencies. Only the glyph-name type below still refers to
211
+ * @expo/vector-icons, and a `typeof import(...)` type is erased at compile
212
+ * time.
213
+ *
214
+ * The button props stay Ionicons names, because that is what every call site
215
+ * in this file passes; this maps each one to its nearest lucide counterpart.
204
216
  */
217
+ import {
218
+ ArrowUp,
219
+ CircleAlert,
220
+ CircleCheckBig,
221
+ Clock,
222
+ CloudOff,
223
+ Info,
224
+ QrCode,
225
+ RefreshCw,
226
+ ScanLine,
227
+ Settings,
228
+ Wallet,
229
+ Wrench,
230
+ type LucideIcon
231
+ } from 'lucide-react-native'
232
+
205
233
  type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
206
- let ioniconsComponent: IoniconsComponent | undefined
207
- function loadIonicons(): IoniconsComponent {
208
- if (!ioniconsComponent) {
209
- // eslint-disable-next-line @typescript-eslint/no-require-imports
210
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
211
- }
212
- return ioniconsComponent
234
+
235
+ const LUCIDE: Record<string, LucideIcon> = {
236
+ 'arrow-up': ArrowUp,
237
+ construct: Wrench,
238
+ 'qr-code-outline': QrCode,
239
+ refresh: RefreshCw,
240
+ 'scan-outline': ScanLine,
241
+ 'settings-outline': Settings
213
242
  }
214
243
 
215
244
  /**
@@ -364,10 +393,10 @@ const FLOOR_KEYS: Record<Exclude<FloorReason, 'none'>, string> = {
364
393
  cross_os_no_ble: 'local_pay_floor_cross_os'
365
394
  }
366
395
 
367
- const NOTICE_ICONS: Record<NoticeTone, keyof IoniconsComponent['glyphMap']> = {
368
- success: 'wallet',
369
- info: 'time-outline',
370
- warning: 'cloud-offline-outline'
396
+ const NOTICE_ICONS: Record<NoticeTone, LucideIcon> = {
397
+ success: Wallet,
398
+ info: Clock,
399
+ warning: CloudOff
371
400
  }
372
401
 
373
402
  // ── Helpers ──
@@ -635,8 +664,13 @@ export interface NearbyFlowProps {
635
664
  * `onBusy` reports when a payment is in hand (the payer's-code scanner,
636
665
  * saving, the paid overlay, a failure): the host must not remount or
637
666
  * unmount the flow then — no new amount, no switching away.
667
+ *
668
+ * `renderQr` draws the pairing code in the host's own style (its card, a
669
+ * mark in the middle) in place of the built-in one. It is handed the code's
670
+ * text and must render it at `qrSize` with error correction that survives
671
+ * whatever it draws over it.
638
672
  */
639
- embedded?: { qrSize?: number; onBusy?: (busy: boolean) => void }
673
+ embedded?: { qrSize?: number; onBusy?: (busy: boolean) => void; renderQr?: (value: string) => React.ReactNode }
640
674
  /**
641
675
  * Payer only: draw these steps yourself, in the host's own style. Each is
642
676
  * optional; a step without one shows the built-in screen. The logic stays
@@ -668,7 +702,6 @@ function NearbyFlow({
668
702
  }: NearbyFlowProps) {
669
703
  const { t } = useTranslation()
670
704
  const { colors } = useTheme()
671
- const Ionicons = loadIonicons()
672
705
  const QRCode = loadQRCode()
673
706
  const StatusBar = loadStatusBar()
674
707
  const { router, useFocusEffect, useNavigation } = loadExpoRouter()
@@ -2821,7 +2854,7 @@ function NearbyFlow({
2821
2854
  ]}
2822
2855
  accessibilityRole="text"
2823
2856
  >
2824
- <Ionicons name={NOTICE_ICONS[n.tone]} size={16} color={tint} />
2857
+ {React.createElement(NOTICE_ICONS[n.tone], { size: 16, color: tint })}
2825
2858
  <Text style={[styles.noticeText, { color: n.tone === 'info' ? colors.textSecondary : tint }]}>{n.text}</Text>
2826
2859
  </Animated.View>
2827
2860
  )
@@ -2842,7 +2875,7 @@ function NearbyFlow({
2842
2875
  {phase === 'entry' && initialRole === 'payer' && (
2843
2876
  <Animated.View entering={settleIn} style={styles.stage}>
2844
2877
  <View style={[styles.heroCircle, { backgroundColor: colors.fillTertiary }]}>
2845
- <Ionicons name="qr-code-outline" size={44} color={colors.textSecondary} />
2878
+ <QrCode size={44} color={colors.textSecondary} />
2846
2879
  </View>
2847
2880
  <View style={styles.gapLg} />
2848
2881
  {phaseTitle(t('local_pay_scan_qr'))}
@@ -2973,7 +3006,7 @@ function NearbyFlow({
2973
3006
  style={[styles.qrError, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
2974
3007
  accessibilityRole="alert"
2975
3008
  >
2976
- <Ionicons name="alert-circle-outline" size={28} color={colors.error} />
3009
+ <CircleAlert size={28} color={colors.error} />
2977
3010
  <View style={styles.gapSm} />
2978
3011
  <Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_qr_unavailable')}</Text>
2979
3012
  </View>
@@ -3000,7 +3033,7 @@ function NearbyFlow({
3000
3033
  style={[styles.notice, { backgroundColor: colors.error + '15', borderColor: colors.error + '40' }]}
3001
3034
  accessibilityRole="alert"
3002
3035
  >
3003
- <Ionicons name="alert-circle-outline" size={16} color={colors.error} />
3036
+ <CircleAlert size={16} color={colors.error} />
3004
3037
  <Text style={[styles.noticeText, { color: colors.error }]}>{t('local_pay_wrong_session')}</Text>
3005
3038
  </Animated.View>
3006
3039
  )}
@@ -3017,7 +3050,7 @@ function NearbyFlow({
3017
3050
  entering={fadeIn}
3018
3051
  style={[styles.notice, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
3019
3052
  >
3020
- <Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
3053
+ <Info size={16} color={colors.textSecondary} />
3021
3054
  <Text style={[styles.noticeText, { color: colors.textSecondary }]}>
3022
3055
  {err.networkDenied
3023
3056
  ? t('local_pay_network_denied')
@@ -3268,7 +3301,7 @@ function NearbyFlow({
3268
3301
  saw a second payment — so nothing here is at display scale. */}
3269
3302
  {phase === 'already_paid' && (
3270
3303
  <Animated.View entering={settleIn} style={styles.stage}>
3271
- <Ionicons name="checkmark-done-circle-outline" size={56} color={colors.textSecondary} />
3304
+ <CircleCheckBig size={56} color={colors.textSecondary} />
3272
3305
  <View style={styles.gapLg} />
3273
3306
  {phaseTitle(t('local_pay_already_paid'))}
3274
3307
  {supportText(t('local_pay_queued'))}
@@ -3285,7 +3318,7 @@ function NearbyFlow({
3285
3318
  {phase === 'failed' && (
3286
3319
  <Animated.View entering={settleIn} style={styles.stage} accessibilityRole="alert">
3287
3320
  <View style={[styles.heroCircle, { backgroundColor: colors.error + '15' }]}>
3288
- <Ionicons name="alert-circle-outline" size={40} color={colors.error} />
3321
+ <CircleAlert size={40} color={colors.error} />
3289
3322
  </View>
3290
3323
  <View style={styles.gapLg} />
3291
3324
  {phaseTitle(t('local_pay_failed'))}
@@ -3385,7 +3418,9 @@ function NearbyFlow({
3385
3418
 
3386
3419
  const inlineBody = (
3387
3420
  <View style={styles.embedded}>
3388
- {phase === 'receive_wait' && hostedSession && sessionQr && !sessionQrBroken ? (
3421
+ {phase === 'receive_wait' && hostedSession && sessionQr && !sessionQrBroken && embedded?.renderQr ? (
3422
+ embedded.renderQr(sessionQr)
3423
+ ) : phase === 'receive_wait' && hostedSession && sessionQr && !sessionQrBroken ? (
3389
3424
  <View style={[styles.qrCard, { shadowColor: colors.textPrimary }]}>
3390
3425
  <View style={styles.qrPlate}>
3391
3426
  <QRCode
@@ -3411,7 +3446,7 @@ function NearbyFlow({
3411
3446
  ]}
3412
3447
  accessibilityRole="alert"
3413
3448
  >
3414
- <Ionicons name="alert-circle-outline" size={28} color={colors.error} />
3449
+ <CircleAlert size={28} color={colors.error} />
3415
3450
  <View style={styles.gapSm} />
3416
3451
  <Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_qr_unavailable')}</Text>
3417
3452
  </View>
@@ -3442,7 +3477,7 @@ function NearbyFlow({
3442
3477
  style={[styles.notice, { backgroundColor: colors.error + '15', borderColor: colors.error + '40' }]}
3443
3478
  accessibilityRole="alert"
3444
3479
  >
3445
- <Ionicons name="alert-circle-outline" size={16} color={colors.error} />
3480
+ <CircleAlert size={16} color={colors.error} />
3446
3481
  <Text style={[styles.noticeText, { color: colors.error }]}>{t('local_pay_wrong_session')}</Text>
3447
3482
  </View>
3448
3483
  )}
@@ -3453,7 +3488,7 @@ function NearbyFlow({
3453
3488
  <React.Fragment key={kind}>
3454
3489
  <View style={styles.gapMd} />
3455
3490
  <View style={[styles.notice, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
3456
- <Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
3491
+ <Info size={16} color={colors.textSecondary} />
3457
3492
  <Text style={[styles.noticeText, { color: colors.textSecondary }]}>
3458
3493
  {err.networkDenied
3459
3494
  ? t('local_pay_network_denied')
@@ -3487,7 +3522,7 @@ function NearbyFlow({
3487
3522
  accessibilityRole="button"
3488
3523
  accessibilityLabel={t('local_pay_scan_payer_qr')}
3489
3524
  >
3490
- <Ionicons name="scan-outline" size={16} color={colors.textSecondary} />
3525
+ <ScanLine size={16} color={colors.textSecondary} />
3491
3526
  <Text style={[styles.embeddedScanText, { color: colors.textSecondary }]}>
3492
3527
  {t('local_pay_scan_payer_qr')}
3493
3528
  </Text>
@@ -3746,7 +3781,6 @@ function PrimaryButton({
3746
3781
  onPress: () => void
3747
3782
  disabled?: boolean
3748
3783
  }) {
3749
- const Ionicons = loadIonicons()
3750
3784
  return (
3751
3785
  <PressableScale
3752
3786
  onPress={onPress}
@@ -3757,7 +3791,9 @@ function PrimaryButton({
3757
3791
  accessibilityLabel={label}
3758
3792
  accessibilityState={{ disabled: !!disabled }}
3759
3793
  >
3760
- {!!icon && <Ionicons name={icon} size={20} color={disabled ? colors.textTertiary : colors.textOnAccent} />}
3794
+ {!!icon &&
3795
+ !!LUCIDE[icon] &&
3796
+ React.createElement(LUCIDE[icon], { size: 20, color: disabled ? colors.textTertiary : colors.textOnAccent })}
3761
3797
  <Text style={[styles.buttonText, { color: disabled ? colors.textTertiary : colors.textOnAccent }]}>{label}</Text>
3762
3798
  </PressableScale>
3763
3799
  )
@@ -3778,7 +3814,6 @@ function SecondaryButton({
3778
3814
  onPress: () => void
3779
3815
  disabled?: boolean
3780
3816
  }) {
3781
- const Ionicons = loadIonicons()
3782
3817
  return (
3783
3818
  <PressableScale
3784
3819
  onPress={onPress}
@@ -3789,7 +3824,9 @@ function SecondaryButton({
3789
3824
  accessibilityLabel={label}
3790
3825
  accessibilityState={{ disabled: !!disabled }}
3791
3826
  >
3792
- {!!icon && <Ionicons name={icon} size={18} color={disabled ? colors.textTertiary : colors.accent} />}
3827
+ {!!icon &&
3828
+ !!LUCIDE[icon] &&
3829
+ React.createElement(LUCIDE[icon], { size: 18, color: disabled ? colors.textTertiary : colors.accent })}
3793
3830
  <Text style={[styles.buttonText, { color: disabled ? colors.textTertiary : colors.accent }]}>{label}</Text>
3794
3831
  </PressableScale>
3795
3832
  )
@@ -3839,7 +3876,7 @@ function makeStyles() {
3839
3876
  embedded: { alignItems: 'center', alignSelf: 'stretch' },
3840
3877
  embeddedPending: { alignItems: 'center', justifyContent: 'center' },
3841
3878
  embeddedScan: { flexDirection: 'row', alignItems: 'center', gap: 6, paddingVertical: 6, paddingHorizontal: 12 },
3842
- embeddedScanText: { fontSize: 13, lineHeight: 18 },
3879
+ embeddedScanText: { fontFamily: 'Nunito', fontSize: 13, lineHeight: 18 },
3843
3880
  header: {
3844
3881
  flexDirection: 'row',
3845
3882
  alignItems: 'center',
@@ -21,21 +21,19 @@ import { AmountInput, type AmountInputAsset } from '../wallet/AmountInput'
21
21
  import PressableScale from '../ui/PressableScale'
22
22
 
23
23
  /**
24
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
25
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
26
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
27
- * Ionicons is loaded lazily, only when actually rendering, same pattern as
28
- * this package's other native-module-boundary fixes (expo-router, expo-blur).
24
+ * lucide, like every other glyph this app draws. Imported at module scope
25
+ * rather than behind a lazy loader: what had to be deferred is
26
+ * @expo/vector-icons' index barrel, which re-exports every icon set and so
27
+ * reaches expo-font -> expo-asset as untransformed ESM; nothing here pulls
28
+ * that barrel in any more. lucide publishes both module formats and Jest
29
+ * resolves the ESM one, so the app pins this name to lucide's CJS entry in
30
+ * jest.moduleNameMapper (package.json), as it already does for its other
31
+ * ESM-only dependencies.
29
32
  */
33
+ import { ArrowRight, ArrowUp, Info, User, type LucideIcon } from 'lucide-react-native'
34
+
35
+ /** The icon props below stay Ionicons names; LUCIDE draws their twins. */
30
36
  type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
31
- let ioniconsComponent: IoniconsComponent | undefined
32
- function loadIonicons(): IoniconsComponent {
33
- if (!ioniconsComponent) {
34
- // eslint-disable-next-line @typescript-eslint/no-require-imports
35
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
36
- }
37
- return ioniconsComponent
38
- }
39
37
 
40
38
  /** One field section: the uppercase caption, then whatever asks the question. */
41
39
  export function PayField({ labelKey, children }: { labelKey: string; children: React.ReactNode }) {
@@ -126,10 +124,9 @@ export function ConsequenceNote({
126
124
  }) {
127
125
  const { t } = useTranslation()
128
126
  const { colors } = useTheme()
129
- const Ionicons = loadIonicons()
130
127
  return (
131
128
  <View style={[styles.consequence, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
132
- <Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
129
+ <Info size={16} color={colors.textSecondary} />
133
130
  <Text style={[styles.consequenceText, { color: colors.textSecondary }]}>{text ?? t(textKey, values)}</Text>
134
131
  {action && (
135
132
  <PressableScale
@@ -150,6 +147,18 @@ export function ConsequenceNote({
150
147
  }
151
148
 
152
149
  /** The submit button every rail sends with. */
150
+ /**
151
+ * The two icon props below stay Ionicons names, because that is what every
152
+ * call site already passes; this maps each name used in this package to its
153
+ * lucide counterpart. A name with no entry draws nothing rather than a glyph
154
+ * from the wrong family -- the seam this whole change exists to close.
155
+ */
156
+ const LUCIDE: Record<string, LucideIcon> = {
157
+ 'arrow-up': ArrowUp,
158
+ 'arrow-forward': ArrowRight,
159
+ person: User
160
+ }
161
+
153
162
  export function PayCta({
154
163
  onPress,
155
164
  disabled,
@@ -175,7 +184,6 @@ export function PayCta({
175
184
  }) {
176
185
  const { t } = useTranslation()
177
186
  const { colors } = useTheme()
178
- const Ionicons = loadIonicons()
179
187
  const enabled = !disabled
180
188
  const text = label ?? t(labelKey)
181
189
  return (
@@ -193,7 +201,8 @@ export function PayCta({
193
201
  <ActivityIndicator size="small" color={enabled ? colors.background : colors.textTertiary} />
194
202
  ) : (
195
203
  <>
196
- <Ionicons name={icon} size={20} color={enabled ? colors.textOnAccent : colors.textTertiary} />
204
+ {!!LUCIDE[icon] &&
205
+ React.createElement(LUCIDE[icon], { size: 20, color: enabled ? colors.textOnAccent : colors.textTertiary })}
197
206
  <Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>{text}</Text>
198
207
  </>
199
208
  )}
@@ -217,11 +226,10 @@ export function RecipientSummary({
217
226
  }) {
218
227
  const { t } = useTranslation()
219
228
  const { colors } = useTheme()
220
- const Ionicons = loadIonicons()
221
229
  return (
222
230
  <View style={[styles.idCard, { backgroundColor: colors.backgroundElevated, borderColor: colors.separator }]}>
223
231
  <View style={[styles.avatar, { backgroundColor: colors.fillTertiary }]}>
224
- <Ionicons name={icon} size={20} color={colors.textSecondary} />
232
+ {!!LUCIDE[icon] && React.createElement(LUCIDE[icon], { size: 20, color: colors.textSecondary })}
225
233
  </View>
226
234
  <View style={styles.idText}>
227
235
  <Text style={[styles.idLabel, { color: colors.textTertiary }]}>{t('recipient')}</Text>
@@ -28,6 +28,7 @@ import AmountDisplay from '../wallet/AmountDisplay'
28
28
  import Celebration from '../ui/Celebration'
29
29
  import PressableScale from '../ui/PressableScale'
30
30
  import type { DismissTarget } from '../../dismissTarget'
31
+ import { BalancedText } from '../ui/BalancedText'
31
32
 
32
33
  /**
33
34
  * expo-router is required lazily rather than imported at module scope: this
@@ -282,12 +283,14 @@ export default function PaymentSuccessOverlay({
282
283
  rendered ungated by direction; a sent payment gets its own, because
283
284
  "Received offline" over an outgoing payment is simply wrong. */}
284
285
  {!broadcast && (
285
- <Text style={[styles.pending, { color: colors.textSecondary }]}>
286
+ <BalancedText style={[styles.pending, { color: colors.textSecondary }]}>
286
287
  {t(sent ? 'pay_sent_not_broadcast' : 'pay_received_not_broadcast')}
287
- </Text>
288
+ </BalancedText>
288
289
  )}
289
290
 
290
- {!!statusNote && <Text style={[styles.pending, { color: colors.textSecondary }]}>{statusNote}</Text>}
291
+ {!!statusNote && (
292
+ <BalancedText style={[styles.pending, { color: colors.textSecondary }]}>{statusNote}</BalancedText>
293
+ )}
291
294
 
292
295
  {!!firstHoldNote && (
293
296
  <Text
@@ -342,10 +345,9 @@ const styles = StyleSheet.create({
342
345
  alignSelf: 'stretch',
343
346
  alignItems: 'center'
344
347
  },
348
+ // the display ramp exactly, which this used to restate by hand
345
349
  amount: {
346
- fontSize: 44,
347
- lineHeight: 52,
348
- fontWeight: '700',
350
+ ...typography.display,
349
351
  textAlign: 'center'
350
352
  },
351
353
  support: {
@@ -50,6 +50,10 @@ import { formatTokenAmount, formatTokenAmountWithUnit, shortAssetId, tokenUnitsF
50
50
  import { abbreviateKey } from '../../../core/pay/counterparty'
51
51
  import type { ContactRow } from '../../../core/contacts/contactsStore'
52
52
  import { createHandleRegistryClient } from '../../../core/identity/handleRegistry/client'
53
+ import { createRegistryResolver } from '../../../core/identity/handleRegistry/resolver'
54
+ import { cancelPaymailPayment, retryPaymailDelivery } from '../../../core/pay/rails/paymail'
55
+ import { createLegacyPaymailClient } from '../../../core/pay/paymail/client'
56
+ import { statusFnFromStorage } from '../../../core/pay/paymail/networkCheck'
53
57
  import type { RegistryProfile } from '../../../core/identity/handleRegistry/profileCert'
54
58
  import {
55
59
  useTheme,
@@ -74,6 +78,7 @@ import {
74
78
  sendToAddress,
75
79
  getOutboxEntries,
76
80
  pruneExpiredSent,
81
+ isPaymailEntry,
77
82
  type OutboxEntry,
78
83
  type Session,
79
84
  haptics,
@@ -174,7 +179,9 @@ function OutgoingSection({
174
179
  const truncated =
175
180
  entry.status === 'import_hold'
176
181
  ? t('review_imported_payment')
177
- : `${entry.recipient.slice(0, 8)}…${entry.recipient.slice(-4)}`
182
+ : isPaymailEntry(entry)
183
+ ? entry.paymail
184
+ : `${entry.recipient.slice(0, 8)}…${entry.recipient.slice(-4)}`
178
185
  return (
179
186
  <View
180
187
  key={entry.id}
@@ -192,7 +199,7 @@ function OutgoingSection({
192
199
  </Text>
193
200
  {entry.status !== 'import_hold' && (
194
201
  <Text style={[styles.outgoingAmount, { color: accentColor }]}>
195
- <AmountDisplay>{entry.token.amount}</AmountDisplay>
202
+ <AmountDisplay>{isPaymailEntry(entry) ? entry.satoshis : entry.token.amount}</AmountDisplay>
196
203
  </Text>
197
204
  )}
198
205
  </View>
@@ -369,6 +376,17 @@ function UniversalSendInner(
369
376
  [registryDomain, registryUrl]
370
377
  )
371
378
 
379
+ // The paymail rail's resolver and client, one per screen.
380
+ const paymailClient = useMemo(
381
+ () =>
382
+ createLegacyPaymailClient({
383
+ resolver: createRegistryResolver({
384
+ pinned: registryDomain && registryUrl ? { domain: registryDomain, url: registryUrl } : undefined
385
+ })
386
+ }),
387
+ [registryDomain, registryUrl]
388
+ )
389
+
372
390
  // ── the asset axis ──────────────────────────────────────────────────
373
391
  // Every line below is gated on `asset`: with no token held, `balances` is
374
392
  // empty, `asset` is null, the picker renders nothing and this form is
@@ -587,7 +605,10 @@ function UniversalSendInner(
587
605
  setRegistrySearching(true)
588
606
  const timer = setTimeout(async () => {
589
607
  try {
590
- const rows = await registryClient.search(query)
608
+ // A complete address whose key is not the one pinned here comes back
609
+ // flagged `changedFrom` (XR-071). This screen has no key-change
610
+ // warning, so such a row is dropped, as before the flag existed.
611
+ const rows = (await registryClient.search(query)).filter(row => !row.changedFrom)
591
612
  if (cancelled) return
592
613
  setRegistryMatches(rows)
593
614
  setRegistryError(false)
@@ -1181,6 +1202,31 @@ function UniversalSendInner(
1181
1202
  async (entry: OutboxEntry) => {
1182
1203
  // Held rows can become actionable only through the validated inline approval.
1183
1204
  if (entry.status !== 'unsent') return
1205
+ if (isPaymailEntry(entry)) {
1206
+ if (!storage || !wallet) return
1207
+ if (entry.refused === true) {
1208
+ showToast('The receiver refused this payment. Cancel it to free the funds.', { type: 'error' })
1209
+ return
1210
+ }
1211
+ setRetryingId(entry.id)
1212
+ try {
1213
+ await retryPaymailDelivery({
1214
+ wallet: wallet as never,
1215
+ adminOriginator,
1216
+ storage,
1217
+ client: paymailClient,
1218
+ getStatusForTxids: statusFnFromStorage(storage as never),
1219
+ entry
1220
+ })
1221
+ } catch (e: any) {
1222
+ const reason = e?.message || t('unknown_error')
1223
+ showToast(`${t('retry_failed')}: ${reason}`, { type: 'error' })
1224
+ } finally {
1225
+ setRetryingId(null)
1226
+ await loadOutbox()
1227
+ }
1228
+ return
1229
+ }
1184
1230
  // `peerPayClient` is built from the CURRENT setting, so it wins: the
1185
1231
  // configured host may have changed since this entry was minted, and the
1186
1232
  // client re-resolves the recipient's advertised inbox on every send
@@ -1211,12 +1257,40 @@ function UniversalSendInner(
1211
1257
  await loadOutbox()
1212
1258
  }
1213
1259
  },
1214
- [peerPayClient, storage, loadOutbox, wallet, adminOriginator, t, handleRetryError, selectedNetwork]
1260
+ [peerPayClient, paymailClient, storage, loadOutbox, wallet, adminOriginator, t, handleRetryError, selectedNetwork]
1215
1261
  )
1216
1262
 
1217
1263
  const handleCancel = useCallback(
1218
1264
  async (entry: OutboxEntry) => {
1219
1265
  if (!storage || !wallet) return
1266
+ if (isPaymailEntry(entry)) {
1267
+ // No abandon sheet and no delivered branch: the network decides.
1268
+ const choice = await showAlert({
1269
+ title: t('cancel_this_payment'),
1270
+ buttons: [
1271
+ { text: t('cancel'), style: 'cancel', key: 'cancel' },
1272
+ { text: t('cancel_payment'), style: 'destructive', key: 'cancel_payment' }
1273
+ ]
1274
+ })
1275
+ if (choice !== 'cancel_payment') return
1276
+ setRetryingId(entry.id)
1277
+ try {
1278
+ await cancelPaymailPayment({
1279
+ wallet: wallet as never,
1280
+ adminOriginator,
1281
+ storage,
1282
+ client: paymailClient,
1283
+ getStatusForTxids: statusFnFromStorage(storage as never),
1284
+ entry
1285
+ })
1286
+ } catch (e: any) {
1287
+ showToast(e?.message || t('unknown_error'), { type: 'error' })
1288
+ } finally {
1289
+ setRetryingId(null)
1290
+ await loadOutbox()
1291
+ }
1292
+ return
1293
+ }
1220
1294
  const deliveredOrUncertain = entry.delivered === true || entry.delivering === true
1221
1295
  if (deliveredOrUncertain) {
1222
1296
  const key = await showChoiceSheet({
@@ -1267,7 +1341,7 @@ function UniversalSendInner(
1267
1341
  await loadOutbox()
1268
1342
  }
1269
1343
  },
1270
- [storage, wallet, adminOriginator, peerPayClient, handleRetry, loadOutbox, t]
1344
+ [storage, wallet, adminOriginator, peerPayClient, paymailClient, handleRetry, loadOutbox, t]
1271
1345
  )
1272
1346
 
1273
1347
  // Token mode: an exact bigint figure (a number would round past 2^53).
@@ -25,6 +25,7 @@ import Animated, {
25
25
  useReducedMotion
26
26
  } from 'react-native-reanimated'
27
27
  import { useTheme, spacing, radii, typography, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
28
+ import { BalancedText } from './BalancedText'
28
29
 
29
30
  export interface AlertButton {
30
31
  text: string
@@ -167,9 +168,9 @@ export function AlertHost() {
167
168
  <Animated.View
168
169
  style={[styles.card, { backgroundColor: colors.sheetBackground, borderColor: colors.separator }, cardStyle]}
169
170
  >
170
- <Text style={[styles.title, { color: colors.textPrimary }]}>{current.title}</Text>
171
+ <BalancedText style={[styles.title, { color: colors.textPrimary }]}>{current.title}</BalancedText>
171
172
  {!!current.message && (
172
- <Text style={[styles.message, { color: colors.textSecondary }]}>{current.message}</Text>
173
+ <BalancedText style={[styles.message, { color: colors.textSecondary }]}>{current.message}</BalancedText>
173
174
  )}
174
175
  <View
175
176
  style={[styles.buttonGroup, { borderTopColor: colors.separator }, !sideBySide && styles.buttonGroupStacked]}