@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
@@ -74,26 +74,9 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
74
74
  import { isE2eBuild } from '../../core/e2e/mode'
75
75
  import { profileScopedKey } from '../../core/profiles/profileStore'
76
76
  import { profileLabel } from '../../core/profiles/profileLabel'
77
+ import { ArrowLeft, Banknote, Bitcoin, Check } from 'lucide-react-native'
77
78
  import { NETWORKS } from '../../core/networks'
78
79
 
79
- /**
80
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
81
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
82
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
83
- * Loaded lazily, only when actually rendering, same pattern as this
84
- * package's other native-module-boundary fixes (expo-router, expo-blur,
85
- * WalletHomeScreen.tsx/ListRow.tsx's lazy icon loads).
86
- */
87
- type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
88
- let ioniconsComponent: IoniconsComponent | undefined
89
- function loadIonicons(): IoniconsComponent {
90
- if (!ioniconsComponent) {
91
- // eslint-disable-next-line @typescript-eslint/no-require-imports
92
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
93
- }
94
- return ioniconsComponent
95
- }
96
-
97
80
  /**
98
81
  * expo-router is required lazily rather than imported at module scope: this
99
82
  * file is barrel-exported from the package's `ui` entry point, and a static
@@ -135,17 +118,21 @@ const NEXT_MOCK_KEY: Record<MockPresentKey, MockPresentKey> = {
135
118
  }
136
119
 
137
120
  /**
121
+ * `title`: what the host calls this screen. The package's own app reaches it
122
+ * as Settings, so that is the default; an app that keeps its own settings
123
+ * elsewhere and mounts this one deeper (here: Settings -> Advanced ->
124
+ * Developer tools) would otherwise show a header naming the wrong screen.
125
+ *
138
126
  * `hideLogout`: for an app that forgets wallets its own way (and shows this
139
127
  * screen only as developer tools), the Log Out row is left out.
140
128
  */
141
- export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolean } = {}) {
129
+ export function WalletConfigScreen({ hideLogout = false, title }: { hideLogout?: boolean; title?: string } = {}) {
142
130
  const versionLabel = useMemo(() => appVersionLabel(), [])
143
131
  const { t } = useTranslation()
144
132
  const { colors } = useTheme()
145
133
  const { router, useLocalSearchParams } = loadExpoRouter()
146
134
  const { section } = useLocalSearchParams<{ section?: string }>()
147
135
  const openBackup = section === 'backup'
148
- const Ionicons = loadIonicons()
149
136
 
150
137
  const {
151
138
  managers,
@@ -567,9 +554,11 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
567
554
  accessibilityLabel={t('go_back')}
568
555
  style={localStyles.headerBack}
569
556
  >
570
- <Ionicons name="chevron-back" size={24} color={colors.textSecondary} />
557
+ <View style={[localStyles.headerBackWell, { backgroundColor: colors.surfaceSunken }]}>
558
+ <ArrowLeft size={16} color={colors.textPrimary} />
559
+ </View>
571
560
  </TouchableOpacity>
572
- <Text style={[localStyles.headerTitle, { color: colors.textPrimary }]}>{t('settings')}</Text>
561
+ <Text style={[localStyles.headerTitle, { color: colors.textPrimary }]}>{title ?? t('settings')}</Text>
573
562
  <View style={localStyles.headerBack} />
574
563
  </View>
575
564
  <ScrollView
@@ -582,12 +571,11 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
582
571
  is denominated in, how to hand an app access, and the two ways out of
583
572
  a lost phone. Everything else is engine-room detail and sits behind
584
573
  Advanced, collapsed, so this screen opens as four choices not twenty. */}
585
- <GroupedSection>
574
+ <GroupedSection card={false}>
586
575
  <ListRow
587
576
  label={t('display_currency')}
588
577
  value={CURRENCIES.find(c => c.id === currentCurrency)?.label ?? currentCurrency}
589
578
  icon="cash-outline"
590
- iconColor="#F5B300"
591
579
  onPress={() => setCurrencyExpanded(e => !e)}
592
580
  showChevron={currencyExpanded}
593
581
  chevronDown={currencyExpanded}
@@ -603,16 +591,13 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
603
591
  onPress={() => handleSelectCurrency(cur.id)}
604
592
  activeOpacity={0.6}
605
593
  >
606
- <Ionicons
607
- name={cur.icon as any}
608
- size={16}
609
- color={colors.textSecondary}
610
- style={{ marginRight: spacing.md }}
611
- />
612
- <Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>{cur.label}</Text>
613
- {isActive && (
614
- <Ionicons name="checkmark" size={20} color={colors.accent} style={{ marginLeft: 'auto' }} />
594
+ {cur.icon === 'logo-bitcoin' ? (
595
+ <Bitcoin size={16} color={colors.textSecondary} style={{ marginRight: spacing.md }} />
596
+ ) : (
597
+ <Banknote size={16} color={colors.textSecondary} style={{ marginRight: spacing.md }} />
615
598
  )}
599
+ <Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>{cur.label}</Text>
600
+ {isActive && <Check size={16} color={colors.accent} style={{ marginLeft: 'auto' }} />}
616
601
  </TouchableOpacity>
617
602
  )
618
603
  })}
@@ -622,7 +607,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
622
607
  testID="settings-connections"
623
608
  label={t('connect_to_app')}
624
609
  icon="qr-code-outline"
625
- iconColor="#0A84FF"
626
610
  onPress={() => router.push('/connections' as any)}
627
611
  />
628
612
  {/* In the main group, not behind Advanced: this is the row a user
@@ -632,19 +616,17 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
632
616
  testID="settings-troubleshooting"
633
617
  label={t('check_wallet')}
634
618
  icon="checkmark-done-circle-outline"
635
- iconColor="#30D158"
636
619
  onPress={() => router.push('/wallet-check' as any)}
637
620
  isLast
638
621
  />
639
622
  </GroupedSection>
640
623
 
641
624
  {/* ── Advanced ── */}
642
- <GroupedSection>
625
+ <GroupedSection card={false}>
643
626
  <ListRow
644
627
  testID="settings-advanced"
645
628
  label={t('advanced')}
646
629
  icon="construct-outline"
647
- iconColor="#8E8E93"
648
630
  onPress={handleToggleAdvanced}
649
631
  chevronDown={advancedExpanded}
650
632
  isLast
@@ -655,6 +637,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
655
637
  <>
656
638
  {/* ── Configuration ── */}
657
639
  <GroupedSection
640
+ card={false}
658
641
  header={t('configuration')}
659
642
  footer={
660
643
  profilesSupported
@@ -676,7 +659,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
676
659
  : (NETWORK_OPTIONS.find(n => n.id === selectedNetwork)?.label ?? selectedNetwork)
677
660
  }
678
661
  icon="globe-outline"
679
- iconColor={NETWORK_OPTIONS.find(n => n.id === selectedNetwork)?.color ?? colors.success}
680
662
  onPress={() => setNetworkExpanded(e => !e)}
681
663
  showChevron={networkExpanded}
682
664
  chevronDown={networkExpanded}
@@ -694,9 +676,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
694
676
  >
695
677
  <View style={[localStyles.networkDot, { backgroundColor: net.color }]} />
696
678
  <Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>{net.label}</Text>
697
- {isActive && (
698
- <Ionicons name="checkmark" size={20} color={colors.accent} style={{ marginLeft: 'auto' }} />
699
- )}
679
+ {isActive && <Check size={16} color={colors.accent} style={{ marginLeft: 'auto' }} />}
700
680
  </TouchableOpacity>
701
681
  )
702
682
  })}
@@ -709,7 +689,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
709
689
  return known ? known.label : arcUrlInput.replace('https://', '')
710
690
  })()}
711
691
  icon="radio-outline"
712
- iconColor="#6E56CF"
713
692
  onPress={() => setArcExpanded(e => !e)}
714
693
  showChevron={arcExpanded}
715
694
  chevronDown={arcExpanded}
@@ -743,23 +722,26 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
743
722
  />
744
723
  <View style={{ flex: 1 }}>
745
724
  <Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>{preset.label}</Text>
746
- <Text style={{ ...typography.caption1, color: colors.textSecondary }} numberOfLines={1}>
725
+ <Text
726
+ style={{ ...typography.caption1, fontFamily: 'Nunito', color: colors.textSecondary }}
727
+ numberOfLines={1}
728
+ >
747
729
  {preset.url.replace('https://', '')}
748
730
  </Text>
749
731
  </View>
750
732
  {preset.requiresToken && (
751
- <Text style={{ ...typography.caption1, color: colors.warning, marginLeft: spacing.sm }}>
733
+ <Text
734
+ style={{
735
+ ...typography.caption1,
736
+ fontFamily: 'Nunito',
737
+ color: colors.warning,
738
+ marginLeft: spacing.sm
739
+ }}
740
+ >
752
741
  {t('arc_requires_token')}
753
742
  </Text>
754
743
  )}
755
- {isSelected && (
756
- <Ionicons
757
- name="checkmark"
758
- size={18}
759
- color={colors.accent}
760
- style={{ marginLeft: spacing.sm }}
761
- />
762
- )}
744
+ {isSelected && <Check size={16} color={colors.accent} style={{ marginLeft: spacing.sm }} />}
763
745
  </TouchableOpacity>
764
746
  )
765
747
  })}
@@ -783,7 +765,9 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
783
765
  returnKeyType="next"
784
766
  />
785
767
  {arcUrlError && (
786
- <Text style={{ ...typography.caption1, color: colors.error }}>{t('arc_url_https_required')}</Text>
768
+ <Text style={{ ...typography.caption1, fontFamily: 'Nunito', color: colors.error }}>
769
+ {t('arc_url_https_required')}
770
+ </Text>
787
771
  )}
788
772
  </View>
789
773
  <View style={localStyles.arcInputRow}>
@@ -808,7 +792,9 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
808
792
  onPress={handleResetArc}
809
793
  activeOpacity={0.7}
810
794
  >
811
- <Text style={{ ...typography.body, color: colors.textSecondary }}>{t('arc_reset_default')}</Text>
795
+ <Text style={{ ...typography.body, fontFamily: 'Nunito', color: colors.textSecondary }}>
796
+ {t('arc_reset_default')}
797
+ </Text>
812
798
  </TouchableOpacity>
813
799
  <TouchableOpacity
814
800
  style={[localStyles.arcButton, { backgroundColor: colors.accent }]}
@@ -818,7 +804,14 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
818
804
  {arcSaving ? (
819
805
  <ActivityIndicator size="small" color={colors.textOnAccent} />
820
806
  ) : (
821
- <Text style={{ ...typography.body, color: colors.textOnAccent, fontWeight: '600' }}>
807
+ <Text
808
+ style={{
809
+ ...typography.body,
810
+ fontFamily: 'Nunito',
811
+ color: colors.textOnAccent,
812
+ fontWeight: '600'
813
+ }}
814
+ >
822
815
  {t('arc_apply')}
823
816
  </Text>
824
817
  )}
@@ -838,7 +831,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
838
831
  : messageBox.messageBoxUrl.replace(/^https:\/\//, '')
839
832
  }
840
833
  icon="mail-outline"
841
- iconColor="#5E5CE6"
842
834
  onPress={() => messageBox.setShowConfig(v => !v)}
843
835
  showChevron={messageBox.showConfig}
844
836
  chevronDown={messageBox.showConfig}
@@ -868,7 +860,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
868
860
  : formatAmount(thresholdSats, currentCurrency, satoshisPerUSD, { usdToFiat })
869
861
  }
870
862
  icon="flash-outline"
871
- iconColor="#FF9F0A"
872
863
  onPress={() => {
873
864
  setThresholdExpanded(e => !e)
874
865
  if (!thresholdExpanded) {
@@ -916,7 +907,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
916
907
  testID="settings-trust"
917
908
  label={t('trust_network')}
918
909
  icon="shield-checkmark-outline"
919
- iconColor="#BF5AF2"
920
910
  onPress={() => router.push('/trust' as any)}
921
911
  isLast
922
912
  />
@@ -924,7 +914,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
924
914
 
925
915
  {/* ── Data & Security ── */}
926
916
  <View onLayout={event => setBackupSectionY(event.nativeEvent.layout.y)}>
927
- <GroupedSection header={t('data_and_security')}>
917
+ <GroupedSection card={false} header={t('data_and_security')}>
928
918
  {/* Demo mode: a wallet full of obviously-fake BSV and stablecoins,
929
919
  for showing the app without an account or a balance. Literal
930
920
  copy rather than i18n — this row renders only under `__DEV__`
@@ -933,7 +923,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
933
923
  <ListRow
934
924
  label="Demo mode (dev)"
935
925
  icon="flask-outline"
936
- iconColor="#8E8E93"
937
926
  showChevron={false}
938
927
  value={demoOn ? 'On' : 'Off'}
939
928
  onPress={() => {
@@ -947,7 +936,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
947
936
  <ListRow
948
937
  label="Reset demo data (dev)"
949
938
  icon="refresh-outline"
950
- iconColor="#8E8E93"
951
939
  showChevron={false}
952
940
  onPress={() => demoMod.resetDemoLedger()}
953
941
  />
@@ -958,7 +946,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
958
946
  <ListRow
959
947
  label={t('vault_mock_toggle')}
960
948
  icon="bug-outline"
961
- iconColor="#8E8E93"
962
949
  showChevron={false}
963
950
  value={vaultMockOn ? t('vault_on') : t('vault_off')}
964
951
  onPress={() => {
@@ -979,7 +966,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
979
966
  <ListRow
980
967
  label="Mock key present (dev)"
981
968
  icon="key-outline"
982
- iconColor="#8E8E93"
983
969
  showChevron={false}
984
970
  value={mockPresent}
985
971
  onPress={() => {
@@ -992,13 +978,11 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
992
978
  <ListRow
993
979
  label={t('backup_wallet_keys', { defaultValue: 'Backup Wallet Keys' })}
994
980
  icon="key-outline"
995
- iconColor="#CC8400"
996
981
  onPress={() => router.push('/auth/mnemonic?flow=backup')}
997
982
  />
998
983
  <ListRow
999
984
  label={t('storage_row')}
1000
985
  icon="server-outline"
1001
- iconColor="#8E8E93"
1002
986
  showChevron={false}
1003
987
  onPress={handleStorage}
1004
988
  trailing={storageBusy ? <ActivityIndicator size="small" /> : undefined}
@@ -1006,7 +990,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
1006
990
  <ListRow
1007
991
  label={t('export_wallet_data')}
1008
992
  icon="share-outline"
1009
- iconColor="#32ADE6"
1010
993
  onPress={() => void exportData()}
1011
994
  showChevron={false}
1012
995
  trailing={exporting ? <ActivityIndicator size="small" /> : undefined}
@@ -1023,7 +1006,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
1023
1006
  <ListRow
1024
1007
  label={t('import_wallet_data')}
1025
1008
  icon="download-outline"
1026
- iconColor="#30D158"
1027
1009
  onPress={handleImportData}
1028
1010
  showChevron={false}
1029
1011
  trailing={isImporting ? <ActivityIndicator size="small" /> : undefined}
@@ -1032,7 +1014,6 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
1032
1014
  testID="settings-logs"
1033
1015
  label="Debugging"
1034
1016
  icon="terminal-outline"
1035
- iconColor="#8E8E93"
1036
1017
  onPress={() => router.push('/logs' as any)}
1037
1018
  isLast
1038
1019
  />
@@ -1044,11 +1025,10 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
1044
1025
  encrypted copy of the wallet database to a BSVA-operated server by default, and
1045
1026
  that deserves saying out loud rather than burying in a row label. */}
1046
1027
  {getBackupUrl() !== '' && (
1047
- <GroupedSection header={t('backup_push_section')} footer={t('backup_push_disclosure')}>
1028
+ <GroupedSection card={false} header={t('backup_push_section')} footer={t('backup_push_disclosure')}>
1048
1029
  <ListRow
1049
1030
  label={t('backup_push_toggle')}
1050
1031
  icon="cloud-upload-outline"
1051
- iconColor="#0A84FF"
1052
1032
  showChevron={false}
1053
1033
  value={backupPushOn ? t('vault_on') : t('vault_off')}
1054
1034
  onPress={handleToggleBackupPush}
@@ -1073,7 +1053,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
1073
1053
 
1074
1054
  {/* ── Account ── */}
1075
1055
  {!hideLogout && (
1076
- <GroupedSection>
1056
+ <GroupedSection card={false}>
1077
1057
  <ListRow
1078
1058
  testID="settings-log-out"
1079
1059
  label={t('log_out')}
@@ -1143,6 +1123,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
1143
1123
  const localStyles = StyleSheet.create({
1144
1124
  version: {
1145
1125
  ...typography.caption1,
1126
+ fontFamily: 'Nunito',
1146
1127
  textAlign: 'center',
1147
1128
  paddingTop: spacing.xl,
1148
1129
  paddingBottom: spacing.lg
@@ -1161,8 +1142,16 @@ const localStyles = StyleSheet.create({
1161
1142
  alignItems: 'center',
1162
1143
  justifyContent: 'center'
1163
1144
  },
1145
+ headerBackWell: {
1146
+ width: 32,
1147
+ height: 32,
1148
+ borderRadius: 16,
1149
+ alignItems: 'center',
1150
+ justifyContent: 'center'
1151
+ },
1164
1152
  headerTitle: {
1165
1153
  ...typography.headline,
1154
+ fontFamily: 'Nunito',
1166
1155
  fontWeight: '600'
1167
1156
  },
1168
1157
  networkList: {
@@ -1182,7 +1171,8 @@ const localStyles = StyleSheet.create({
1182
1171
  marginRight: spacing.md
1183
1172
  },
1184
1173
  networkLabel: {
1185
- ...typography.body
1174
+ ...typography.body,
1175
+ fontFamily: 'Nunito'
1186
1176
  },
1187
1177
  thresholdRow: {
1188
1178
  flexDirection: 'row',
@@ -1193,6 +1183,7 @@ const localStyles = StyleSheet.create({
1193
1183
  thresholdInput: {
1194
1184
  flex: 1,
1195
1185
  ...typography.body,
1186
+ fontFamily: 'Nunito',
1196
1187
  borderWidth: StyleSheet.hairlineWidth,
1197
1188
  borderRadius: 8,
1198
1189
  paddingHorizontal: spacing.md,
@@ -1200,6 +1191,7 @@ const localStyles = StyleSheet.create({
1200
1191
  },
1201
1192
  thresholdUnit: {
1202
1193
  ...typography.body,
1194
+ fontFamily: 'Nunito',
1203
1195
  marginLeft: spacing.sm
1204
1196
  },
1205
1197
  arcInputRow: {
@@ -1208,10 +1200,12 @@ const localStyles = StyleSheet.create({
1208
1200
  },
1209
1201
  arcLabel: {
1210
1202
  ...typography.caption1,
1203
+ fontFamily: 'Nunito',
1211
1204
  marginBottom: spacing.xs
1212
1205
  },
1213
1206
  arcInput: {
1214
1207
  ...typography.body,
1208
+ fontFamily: 'Nunito',
1215
1209
  borderWidth: StyleSheet.hairlineWidth,
1216
1210
  borderRadius: 8,
1217
1211
  paddingHorizontal: spacing.md,
@@ -62,6 +62,7 @@ import {
62
62
  getOnline,
63
63
  haptics,
64
64
  getOutboxEntries,
65
+ isPeerPayEntry,
65
66
  unsentEntries,
66
67
  retryDelivery,
67
68
  makePeerPayClient,
@@ -75,6 +76,12 @@ import {
75
76
  type PendingResend
76
77
  } from '@bsv/expo-wallet-toolbox'
77
78
  import { NETWORKS } from '../../core/networks'
79
+ import { isPaymailEntry } from '../../core/peerpay/outbox'
80
+ import { getHandleRegistryConfig } from '../../core/toolboxConfig'
81
+ import { cancelPaymailPayment, resolveOrphanPaymailAction, retryPaymailDelivery } from '../../core/pay/rails/paymail'
82
+ import { createLegacyPaymailClient } from '../../core/pay/paymail/client'
83
+ import { statusFnFromStorage } from '../../core/pay/paymail/networkCheck'
84
+ import { createRegistryResolver } from '../../core/identity/handleRegistry/resolver'
78
85
  import { bindMessageBoxNetwork, readMessageBoxUrl } from '../../core/pay/rails/handle'
79
86
  import ActivityRow, { type ActivityAction } from '../components/wallet/ActivityRow'
80
87
  import { FitAmount } from '../components/wallet/FitAmount'
@@ -1017,6 +1024,11 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
1017
1024
  [busyRow, refreshProof, t]
1018
1025
  )
1019
1026
 
1027
+ const paymailClient = useMemo(() => {
1028
+ const registry = getHandleRegistryConfig(selectedNetwork)
1029
+ return createLegacyPaymailClient({ resolver: createRegistryResolver({ pinned: registry }) })
1030
+ }, [selectedNetwork])
1031
+
1020
1032
  /**
1021
1033
  * Abort a still-local transaction, releasing the inputs it reserved.
1022
1034
  *
@@ -1032,12 +1044,68 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
1032
1044
  if (!managers.permissionsManager || busyRow) return
1033
1045
  setBusyRow(reference)
1034
1046
  try {
1035
- if (action?.labels?.includes('peerpay')) {
1047
+ if (action?.labels?.some(l => l === 'peerpay' || l === 'paymail')) {
1036
1048
  const entries = storage ? await getOutboxEntries(storage) : []
1049
+ const isPaymail = action.labels?.includes('paymail') === true
1050
+ const hasRow = action.txid != null && entries.some(e => e.txid === action.txid)
1051
+ if (isPaymail && !hasRow) {
1052
+ // A noSend paymail action with no row (a crash or a restore): the
1053
+ // network decides, and abortAction is never called directly.
1054
+ if (!action.txid || !storage) {
1055
+ showToast(t('tx_abort_maybe_delivered'), { type: 'error' })
1056
+ return
1057
+ }
1058
+ try {
1059
+ const r = await resolveOrphanPaymailAction({
1060
+ wallet: managers.permissionsManager as never,
1061
+ adminOriginator,
1062
+ getStatusForTxids: statusFnFromStorage(storage as never),
1063
+ txid: action.txid
1064
+ })
1065
+ if (r.aborted) {
1066
+ showToast(t('tx_abort_success'), { type: 'success' })
1067
+ await onRefresh()
1068
+ } else {
1069
+ showToast(t('tx_abort_maybe_delivered'), { type: 'error' })
1070
+ }
1071
+ } catch (e) {
1072
+ showToast(e instanceof Error ? e.message : t('tx_abort_failed'), { type: 'error' })
1073
+ }
1074
+ return
1075
+ }
1037
1076
  if (!isAbortSafe(action, entries).aborted) {
1038
1077
  showToast(t('tx_abort_maybe_delivered'), { type: 'error' })
1039
1078
  return
1040
1079
  }
1080
+ const paymailRow = isPaymail ? entries.find(e => e.txid === action.txid && isPaymailEntry(e)) : undefined
1081
+ if (paymailRow && isPaymailEntry(paymailRow)) {
1082
+ // A paymail row survives a plain abort and the drain would re-POST
1083
+ // its BEEF over freed inputs. Network decides; abort removes the row.
1084
+ if (!storage) {
1085
+ showToast(t('tx_abort_maybe_delivered'), { type: 'error' })
1086
+ return
1087
+ }
1088
+ try {
1089
+ const r = await cancelPaymailPayment({
1090
+ wallet: managers.permissionsManager as never,
1091
+ adminOriginator,
1092
+ storage,
1093
+ client: paymailClient,
1094
+ getStatusForTxids: statusFnFromStorage(storage as never),
1095
+ entry: paymailRow
1096
+ })
1097
+ if (r.aborted) {
1098
+ showToast(t('tx_abort_success'), { type: 'success' })
1099
+ await onRefresh()
1100
+ } else {
1101
+ showToast(t('tx_abort_maybe_delivered'), { type: 'error' })
1102
+ await onRefresh()
1103
+ }
1104
+ } catch (e) {
1105
+ showToast(e instanceof Error ? e.message : t('tx_abort_failed'), { type: 'error' })
1106
+ }
1107
+ return
1108
+ }
1041
1109
  }
1042
1110
  const r = (await managers.permissionsManager.abortAction({ reference }, adminOriginator)) as
1043
1111
  | { aborted?: boolean }
@@ -1055,7 +1123,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
1055
1123
  setBusyLabel(undefined)
1056
1124
  }
1057
1125
  },
1058
- [managers.permissionsManager, adminOriginator, busyRow, onRefresh, storage, t]
1126
+ [managers.permissionsManager, adminOriginator, busyRow, onRefresh, storage, t, paymailClient]
1059
1127
  )
1060
1128
 
1061
1129
  const onResendPending = useCallback(async () => {
@@ -1202,11 +1270,43 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
1202
1270
  ]
1203
1271
  )
1204
1272
 
1273
+ // The paymail rail's resolver and client, one per screen.
1205
1274
  const onFailedSendAgain = useCallback(
1206
1275
  async (action: ActivityAction) => {
1207
1276
  if (busyRow) return
1208
1277
  if (action.txid && storage && managers.permissionsManager) {
1209
- const entry = unsentEntries(await getOutboxEntries(storage)).find(e => e.txid === action.txid)
1278
+ const paymailRow = unsentEntries(await getOutboxEntries(storage))
1279
+ .filter(isPaymailEntry)
1280
+ .find(e => e.txid === action.txid)
1281
+ if (paymailRow?.refused === true) {
1282
+ // The retry is a no-op for a refused row. Say so, do not fake success.
1283
+ showToast(t('paymail_refused_cancel_hint', { defaultValue: 'The receiver refused this payment. Cancel it to free the funds.' }), { type: 'error' })
1284
+ return
1285
+ }
1286
+ if (paymailRow) {
1287
+ // A paymail row has no message box: never build a PeerPay client for it.
1288
+ setBusyRow(action.txid)
1289
+ try {
1290
+ await retryPaymailDelivery({
1291
+ wallet: managers.permissionsManager as never,
1292
+ adminOriginator,
1293
+ storage,
1294
+ client: paymailClient,
1295
+ getStatusForTxids: statusFnFromStorage(storage as never),
1296
+ entry: paymailRow
1297
+ })
1298
+ haptics.success()
1299
+ await onRefresh()
1300
+ } catch (e: unknown) {
1301
+ showToast(e instanceof Error ? e.message : t('unknown_error'), { type: 'error' })
1302
+ } finally {
1303
+ setBusyRow(null)
1304
+ }
1305
+ return
1306
+ }
1307
+ const entry = unsentEntries(await getOutboxEntries(storage))
1308
+ .filter(isPeerPayEntry)
1309
+ .find(e => e.txid === action.txid)
1210
1310
  if (entry) {
1211
1311
  setBusyRow(action.txid)
1212
1312
  try {
@@ -1252,7 +1352,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
1252
1352
  const sats = Math.abs(action.satoshis)
1253
1353
  router.push(sats > 0 ? `/pay?sats=${sats}` : '/pay')
1254
1354
  },
1255
- [busyRow, storage, managers.permissionsManager, adminOriginator, selectedNetwork, onRefresh, t]
1355
+ [busyRow, storage, managers.permissionsManager, adminOriginator, selectedNetwork, onRefresh, paymailClient, t]
1256
1356
  )
1257
1357
 
1258
1358
  const toggleRow = useCallback((key: string) => {
package/ui/txStatus.ts CHANGED
@@ -32,7 +32,7 @@ export interface TxStatusView {
32
32
  * without one was made by a connected app or the wallet itself (an identity
33
33
  * certificate, say), so it reads "Spent", not "Sent".
34
34
  */
35
- const PAYMENT_LABELS = new Set(['peerpay', 'localpay', 'legacy', 'mandala'])
35
+ const PAYMENT_LABELS = new Set(['peerpay', 'localpay', 'legacy', 'mandala', 'paymail'])
36
36
 
37
37
  export function isPaymentAction(labels?: readonly string[]): boolean {
38
38
  return Boolean(labels?.some(l => PAYMENT_LABELS.has(l)))