@bsv/expo-wallet-toolbox 0.25.0 → 0.26.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 (50) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/core/context/WalletContext.tsx +11 -15
  3. package/core/i18n/translations.tsx +221 -36
  4. package/core/identity/handleRegistry/client.ts +110 -16
  5. package/core/identity/handleRegistry/registration.ts +115 -17
  6. package/core/index.ts +8 -0
  7. package/core/net/wocLimiter.ts +133 -0
  8. package/core/pay/beefRepair.ts +3 -1
  9. package/core/pay/rails/address.ts +2 -2
  10. package/core/profiles/profileStore.ts +4 -1
  11. package/core/services/arcadeBroadcastProvider.ts +6 -0
  12. package/core/services/exchangeRate.ts +8 -1
  13. package/core/services/groupSpendingLimit.ts +26 -0
  14. package/core/services/signingPermissionPolicy.ts +14 -8
  15. package/core/services/vault/ceremony.ts +13 -0
  16. package/core/services/vault/ceremonyHost.ts +58 -0
  17. package/core/services/vault/failedVaultSpend.ts +40 -0
  18. package/core/services/vault/outputAuthority.ts +13 -6
  19. package/core/services/vault/transfers.ts +56 -12
  20. package/core/services/vault/wocLookup.ts +5 -2
  21. package/core/storage/encryptedDbImage.ts +11 -2
  22. package/core/theme/tokens.ts +26 -12
  23. package/package.json +2 -1
  24. package/ui/components/QRScanner.tsx +24 -22
  25. package/ui/components/pay/MessageBoxConfig.tsx +10 -16
  26. package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
  27. package/ui/components/pay/NearbyFlow.tsx +72 -35
  28. package/ui/components/pay/PayForm.tsx +27 -19
  29. package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
  30. package/ui/components/pay/UniversalSend.tsx +4 -1
  31. package/ui/components/ui/AlertCard.tsx +3 -2
  32. package/ui/components/ui/BalancedText.tsx +117 -0
  33. package/ui/components/ui/ErrorBoundary.tsx +31 -14
  34. package/ui/components/ui/GroupedList.tsx +28 -22
  35. package/ui/components/ui/ListRow.tsx +126 -35
  36. package/ui/components/ui/PermissionSheet.tsx +31 -24
  37. package/ui/components/ui/PresenceRow.tsx +15 -23
  38. package/ui/components/ui/Sheet.tsx +11 -17
  39. package/ui/components/ui/Toast.tsx +13 -17
  40. package/ui/components/vault/EnrollWizard.tsx +446 -196
  41. package/ui/components/vault/KeyChooser.tsx +7 -20
  42. package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
  43. package/ui/components/wallet/AmountInput.tsx +11 -17
  44. package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
  45. package/ui/index.ts +1 -1
  46. package/ui/screens/TrustScreen.tsx +49 -61
  47. package/ui/screens/VaultScreen.tsx +99 -60
  48. package/ui/screens/VaultTransferScreen.tsx +34 -27
  49. package/ui/screens/WalletCheckScreen.tsx +25 -24
  50. package/ui/screens/WalletConfigScreen.tsx +66 -72
@@ -51,21 +51,17 @@ function managerToken(manager: unknown): string {
51
51
  const TAP_PROTECTION_MS = 700
52
52
 
53
53
  // ---------------------------------------------------------------------------
54
- // @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
55
- // etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
56
- // that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
57
- // Loaded lazily, only when actually rendering, same pattern as this
58
- // package's other native-module-boundary fixes (expo-router, expo-blur).
54
+ // lucide, like every other glyph this app draws. Imported at module scope
55
+ // rather than behind a lazy loader. What had to be deferred is
56
+ // @expo/vector-icons' index barrel, which re-exports every icon set and so
57
+ // reaches expo-font -> expo-asset as untransformed ESM; nothing here pulls
58
+ // that barrel in any more. lucide publishes both module formats and Jest
59
+ // resolves the ESM one, so the app pins this name to lucide's CJS entry in
60
+ // jest.moduleNameMapper (package.json), as it already does for its other
61
+ // ESM-only dependencies.
59
62
  // ---------------------------------------------------------------------------
60
- type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
61
- let ioniconsComponent: IoniconsComponent | undefined
62
- function loadIonicons(): IoniconsComponent {
63
- if (!ioniconsComponent) {
64
- // eslint-disable-next-line @typescript-eslint/no-require-imports
65
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
66
- }
67
- return ioniconsComponent
68
- }
63
+ import { Check, ChevronDown, ChevronUp } from 'lucide-react-native'
64
+ import { BalancedText } from './BalancedText'
69
65
 
70
66
  // ---------------------------------------------------------------------------
71
67
  // Types
@@ -503,7 +499,7 @@ function GroupPermissionSections({ group, unverified }: { group: GroupPermission
503
499
  <Text style={[styles.groupSectionTitle, { color: colors.textSecondary }]}>{t('spending_section')}</Text>
504
500
  <View style={styles.groupRow}>
505
501
  <Text style={[styles.groupRowLabel, { color: colors.textPrimary }]}>
506
- <AmountDisplay>{group.spendingAuthorization.amount}</AmountDisplay>
502
+ {t('spending_up_to')} <AmountDisplay>{group.spendingAuthorization.amount}</AmountDisplay> {t('spending_each_month')}
507
503
  </Text>
508
504
  {group.spendingAuthorization.description && (
509
505
  <Text style={[styles.groupRowDesc, { color: colors.textSecondary }]}>
@@ -606,7 +602,6 @@ interface PermissionSheetProps {
606
602
  const PermissionSheet: React.FC<PermissionSheetProps> = ({ backdropDismisses = true }) => {
607
603
  const { t } = useTranslation()
608
604
  const { colors } = useTheme()
609
- const Ionicons = loadIonicons()
610
605
 
611
606
  const {
612
607
  protocolRequests,
@@ -1097,12 +1092,11 @@ const PermissionSheet: React.FC<PermissionSheetProps> = ({ backdropDismisses = t
1097
1092
  <Text style={[styles.detailsToggleText, { color: colors.textSecondary }]}>
1098
1093
  {detailsExpanded ? t('hide_details') : t('details')}
1099
1094
  </Text>
1100
- <Ionicons
1101
- name={detailsExpanded ? 'chevron-up' : 'chevron-down'}
1102
- size={12}
1103
- color={colors.textSecondary}
1104
- style={styles.chevron}
1105
- />
1095
+ {React.createElement(detailsExpanded ? ChevronUp : ChevronDown, {
1096
+ size: 12,
1097
+ color: colors.textSecondary,
1098
+ style: styles.chevron
1099
+ })}
1106
1100
  </TouchableOpacity>
1107
1101
 
1108
1102
  {detailsExpanded && (
@@ -1154,7 +1148,9 @@ const PermissionSheet: React.FC<PermissionSheetProps> = ({ backdropDismisses = t
1154
1148
  {/* -------- The ask, then the figure. The sentence is the quiet
1155
1149
  half: it says what for, the amount says how much. -------- */}
1156
1150
  <View style={styles.askBlock}>
1157
- <Text style={[styles.description, { color: colors.textSecondary }]}>{active.description}</Text>
1151
+ <BalancedText style={[styles.description, { color: colors.textSecondary }]}>
1152
+ {active.description}
1153
+ </BalancedText>
1158
1154
 
1159
1155
  {active.siteSays ? (
1160
1156
  <View style={[styles.siteSays, { borderColor: colors.separator }]}>
@@ -1204,7 +1200,7 @@ const PermissionSheet: React.FC<PermissionSheetProps> = ({ backdropDismisses = t
1204
1200
  testID="bridge-approve"
1205
1201
  >
1206
1202
  {granted ? (
1207
- <Ionicons name="checkmark" size={22} color={colors.textOnAccent} />
1203
+ <Check size={22} color={colors.textOnAccent} />
1208
1204
  ) : (
1209
1205
  <Text style={[styles.buttonAllowText, { color: colors.textOnAccent }]}>
1210
1206
  {t(active.kind === 'connection' ? 'bridge_connect' : 'authorize')}
@@ -1245,6 +1241,7 @@ const styles = StyleSheet.create({
1245
1241
  marginRight: spacing.md
1246
1242
  },
1247
1243
  faviconLetter: {
1244
+ fontFamily: 'Nunito',
1248
1245
  fontSize: 17,
1249
1246
  fontWeight: '700'
1250
1247
  },
@@ -1252,6 +1249,7 @@ const styles = StyleSheet.create({
1252
1249
  flex: 1
1253
1250
  },
1254
1251
  originator: {
1252
+ fontFamily: 'Nunito',
1255
1253
  fontSize: 15,
1256
1254
  fontWeight: '600',
1257
1255
  letterSpacing: -0.1
@@ -1331,11 +1329,13 @@ const styles = StyleSheet.create({
1331
1329
  paddingTop: spacing.xxl
1332
1330
  },
1333
1331
  description: {
1332
+ fontFamily: 'Nunito',
1334
1333
  fontSize: 13.5,
1335
1334
  lineHeight: 18,
1336
1335
  textAlign: 'center'
1337
1336
  },
1338
1337
  amountValue: {
1338
+ fontFamily: 'Nunito',
1339
1339
  fontSize: 42,
1340
1340
  fontWeight: '700',
1341
1341
  lineHeight: 44,
@@ -1344,6 +1344,7 @@ const styles = StyleSheet.create({
1344
1344
  fontVariant: ['tabular-nums']
1345
1345
  },
1346
1346
  amountUnit: {
1347
+ fontFamily: 'Nunito',
1347
1348
  fontSize: 19,
1348
1349
  fontWeight: '600',
1349
1350
  letterSpacing: 0
@@ -1360,6 +1361,7 @@ const styles = StyleSheet.create({
1360
1361
  paddingVertical: spacing.xs
1361
1362
  },
1362
1363
  detailsToggleText: {
1364
+ fontFamily: 'Nunito',
1363
1365
  fontSize: 12.5,
1364
1366
  fontWeight: '600'
1365
1367
  },
@@ -1382,10 +1384,12 @@ const styles = StyleSheet.create({
1382
1384
  paddingVertical: 10
1383
1385
  },
1384
1386
  detailLabel: {
1387
+ fontFamily: 'Nunito',
1385
1388
  fontSize: 13,
1386
1389
  flexShrink: 1
1387
1390
  },
1388
1391
  detailValue: {
1392
+ fontFamily: 'Nunito',
1389
1393
  fontSize: 13.5,
1390
1394
  fontWeight: '600',
1391
1395
  textAlign: 'right',
@@ -1395,6 +1399,7 @@ const styles = StyleSheet.create({
1395
1399
  flexShrink: 1
1396
1400
  },
1397
1401
  detailUnit: {
1402
+ fontFamily: 'Nunito',
1398
1403
  fontSize: 11.5,
1399
1404
  fontWeight: '500'
1400
1405
  },
@@ -1453,6 +1458,7 @@ const styles = StyleSheet.create({
1453
1458
  justifyContent: 'center'
1454
1459
  },
1455
1460
  buttonDenyText: {
1461
+ fontFamily: 'Nunito',
1456
1462
  fontSize: 15,
1457
1463
  fontWeight: '600'
1458
1464
  },
@@ -1469,6 +1475,7 @@ const styles = StyleSheet.create({
1469
1475
  elevation: 4
1470
1476
  },
1471
1477
  buttonAllowText: {
1478
+ fontFamily: 'Nunito',
1472
1479
  fontSize: 15,
1473
1480
  fontWeight: '700'
1474
1481
  }
@@ -50,21 +50,16 @@ import Animated, {
50
50
  import { useTheme, spacing, typography, durations, easings, springs } from '@bsv/expo-wallet-toolbox'
51
51
 
52
52
  /**
53
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
54
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
55
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
56
- * Loaded lazily, only when actually rendering, same pattern as this
57
- * package's other native-module-boundary fixes (expo-router, expo-blur).
53
+ * lucide, like every other glyph this app draws. Imported at module scope
54
+ * rather than behind a lazy loader: what had to be deferred is
55
+ * @expo/vector-icons' index barrel, which re-exports every icon set and so
56
+ * reaches expo-font -> expo-asset as untransformed ESM; nothing here pulls
57
+ * that barrel in any more. lucide publishes both module formats and Jest
58
+ * resolves the ESM one, so the app pins this name to lucide's CJS entry in
59
+ * jest.moduleNameMapper (package.json), as it already does for its other
60
+ * ESM-only dependencies.
58
61
  */
59
- type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
60
- let ioniconsComponent: IoniconsComponent | undefined
61
- function loadIonicons(): IoniconsComponent {
62
- if (!ioniconsComponent) {
63
- // eslint-disable-next-line @typescript-eslint/no-require-imports
64
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
65
- }
66
- return ioniconsComponent
67
- }
62
+ import { BluetoothIcon, CircleCheck, Lock, QrCode, Wifi, type LucideIcon } from 'lucide-react-native'
68
63
 
69
64
  export type PresenceState =
70
65
  /** No live link on this path. The QR hand-off. */
@@ -94,25 +89,22 @@ interface PresenceRowProps {
94
89
  medium?: 'wifi' | 'bluetooth'
95
90
  }
96
91
 
97
- type IconName = keyof IoniconsComponent['glyphMap']
98
-
99
- function iconFor(state: PresenceState, medium: 'wifi' | 'bluetooth'): IconName {
92
+ function iconFor(state: PresenceState, medium: 'wifi' | 'bluetooth'): LucideIcon {
100
93
  switch (state) {
101
94
  case 'qr':
102
- return 'qr-code-outline'
95
+ return QrCode
103
96
  case 'ready':
104
97
  case 'waiting':
105
- return medium === 'bluetooth' ? 'bluetooth' : 'wifi'
98
+ return medium === 'bluetooth' ? BluetoothIcon : Wifi
106
99
  case 'linked':
107
- return 'lock-closed'
100
+ return Lock
108
101
  case 'paid':
109
- return 'checkmark-circle'
102
+ return CircleCheck
110
103
  }
111
104
  }
112
105
 
113
106
  export default function PresenceRow({ state, label, peer, medium = 'wifi' }: PresenceRowProps) {
114
107
  const { colors } = useTheme()
115
- const Ionicons = loadIonicons()
116
108
  const reducedMotion = useReducedMotion()
117
109
 
118
110
  // 0 → 1 on every state change. Re-run rather than cross-faded: the row is one
@@ -180,7 +172,7 @@ export default function PresenceRow({ state, label, peer, medium = 'wifi' }: Pre
180
172
  reach the one state where naming the radio matters most: the payee
181
173
  waiting on a link that may be Bluetooth. */}
182
174
  <Animated.View style={dotStyle}>
183
- <Ionicons name={iconFor(state, medium)} size={13} color={dotColor} />
175
+ {React.createElement(iconFor(state, medium), { size: 13, color: dotColor })}
184
176
  </Animated.View>
185
177
  <Text style={[styles.label, { color: labelColor }, strong && styles.labelStrong]} numberOfLines={1}>
186
178
  {label}
@@ -18,21 +18,16 @@ import ScreenGradient from './ScreenGradient'
18
18
  import { onSheetResumed } from './sheetResumeSignal'
19
19
 
20
20
  /**
21
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
22
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
23
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
24
- * Loaded lazily, only when actually rendering, same pattern as this
25
- * package's other native-module-boundary fixes (expo-router, expo-blur).
21
+ * lucide, like every other glyph this app draws. Imported at module scope
22
+ * rather than behind a lazy loader: what had to be deferred is
23
+ * @expo/vector-icons' index barrel, which re-exports every icon set and so
24
+ * reaches expo-font -> expo-asset as untransformed ESM; nothing here pulls
25
+ * that barrel in any more. lucide publishes both module formats and Jest
26
+ * resolves the ESM one, so the app pins this name to lucide's CJS entry in
27
+ * jest.moduleNameMapper (package.json), as it already does for its other
28
+ * ESM-only dependencies.
26
29
  */
27
- type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
28
- let ioniconsComponent: IoniconsComponent | undefined
29
- function loadIonicons(): IoniconsComponent {
30
- if (!ioniconsComponent) {
31
- // eslint-disable-next-line @typescript-eslint/no-require-imports
32
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
33
- }
34
- return ioniconsComponent
35
- }
30
+ import { ChevronLeft } from 'lucide-react-native'
36
31
 
37
32
  interface SheetProps {
38
33
  visible: boolean
@@ -78,7 +73,6 @@ const Sheet: React.FC<SheetProps> = ({
78
73
  children
79
74
  }) => {
80
75
  const { colors } = useTheme()
81
- const Ionicons = loadIonicons()
82
76
  const insets = useSafeAreaInsets()
83
77
  const { height: windowHeight } = Dimensions.get('window')
84
78
  const maxSheetHeight = fullPage ? windowHeight : Math.max(0, Math.min(1, heightPercent)) * windowHeight
@@ -222,7 +216,7 @@ const Sheet: React.FC<SheetProps> = ({
222
216
  <View style={[styles.fullPageHeader, { borderBottomColor: colors.separator }]}>
223
217
  {onBack ? (
224
218
  <TouchableOpacity style={styles.fullPageBack} onPress={onBack} activeOpacity={0.6}>
225
- <Ionicons name="chevron-back" size={24} color={colors.textSecondary} />
219
+ <ChevronLeft size={24} color={colors.textSecondary} />
226
220
  </TouchableOpacity>
227
221
  ) : (
228
222
  <View style={styles.fullPageBack} />
@@ -288,7 +282,7 @@ const Sheet: React.FC<SheetProps> = ({
288
282
  <View style={styles.headerRow}>
289
283
  {onBack ? (
290
284
  <TouchableOpacity style={styles.backButton} onPress={onBack} activeOpacity={0.6}>
291
- <Ionicons name="chevron-back" size={22} color={colors.textSecondary} />
285
+ <ChevronLeft size={22} color={colors.textSecondary} />
292
286
  </TouchableOpacity>
293
287
  ) : (
294
288
  <View style={styles.backButton} />
@@ -19,23 +19,20 @@ import Animated, {
19
19
  useReducedMotion
20
20
  } from 'react-native-reanimated'
21
21
  import { useTheme, spacing, radii, typography, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
22
+ import { CircleAlert, CircleCheck } from 'lucide-react-native'
22
23
 
23
24
  /**
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
- * Loaded lazily, only when actually rendering, same pattern as this
28
- * package's other native-module-boundary fixes (expo-router, expo-blur).
25
+ * lucide, like every other glyph this app draws (src/settings/Rows.tsx, the
26
+ * headers, the sheets).
27
+ *
28
+ * Imported at module scope rather than behind a lazy loader. What had to be
29
+ * deferred is @expo/vector-icons' index barrel, which re-exports every icon
30
+ * set and so reaches expo-font -> expo-asset as untransformed ESM; nothing
31
+ * here pulls that barrel in any more. lucide publishes both module formats
32
+ * and Jest resolves the ESM one, so the app pins this name to lucide's CJS
33
+ * entry in jest.moduleNameMapper (package.json), as it already does for its
34
+ * other ESM-only dependencies.
29
35
  */
30
- 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
36
 
40
37
  export type ToastType = 'info' | 'success' | 'error'
41
38
  interface ToastData {
@@ -62,7 +59,6 @@ export function showToast(message: string, opts?: { type?: ToastType }) {
62
59
 
63
60
  export function ToastHost() {
64
61
  const { colors } = useTheme()
65
- const Ionicons = loadIonicons()
66
62
  const insets = useSafeAreaInsets()
67
63
  const reducedMotion = useReducedMotion()
68
64
  const [toast, setToast] = useState<ToastData | null>(null)
@@ -100,7 +96,7 @@ export function ToastHost() {
100
96
 
101
97
  if (!toast) return null
102
98
 
103
- const icon = toast.type === 'success' ? 'checkmark-circle' : toast.type === 'error' ? 'alert-circle' : null
99
+ const Glyph = toast.type === 'success' ? CircleCheck : toast.type === 'error' ? CircleAlert : null
104
100
  const iconColor = toast.type === 'success' ? colors.success : colors.error
105
101
 
106
102
  return (
@@ -113,7 +109,7 @@ export function ToastHost() {
113
109
  animatedStyle
114
110
  ]}
115
111
  >
116
- {icon && <Ionicons name={icon} size={18} color={iconColor} style={styles.icon} />}
112
+ {Glyph && <Glyph size={18} color={iconColor} style={styles.icon} />}
117
113
  <Text numberOfLines={2} style={[styles.text, { color: colors.textPrimary }]}>
118
114
  {toast.message}
119
115
  </Text>