@bsv/expo-wallet-toolbox 0.25.1 → 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.
- package/CHANGELOG.md +31 -0
- package/core/context/WalletContext.tsx +3 -1
- package/core/i18n/translations.tsx +221 -36
- package/core/identity/handleRegistry/client.ts +110 -16
- package/core/identity/handleRegistry/registration.ts +115 -17
- package/core/profiles/profileStore.ts +4 -1
- package/core/services/groupSpendingLimit.ts +26 -0
- package/core/services/signingPermissionPolicy.ts +14 -8
- package/core/services/vault/ceremony.ts +13 -0
- package/core/services/vault/ceremonyHost.ts +58 -0
- package/core/services/vault/failedVaultSpend.ts +40 -0
- package/core/services/vault/outputAuthority.ts +13 -6
- package/core/services/vault/transfers.ts +56 -12
- package/core/storage/encryptedDbImage.ts +11 -2
- package/core/theme/tokens.ts +26 -12
- package/package.json +2 -1
- package/ui/components/QRScanner.tsx +24 -22
- package/ui/components/pay/MessageBoxConfig.tsx +10 -16
- package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
- package/ui/components/pay/NearbyFlow.tsx +72 -35
- package/ui/components/pay/PayForm.tsx +27 -19
- package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
- package/ui/components/pay/UniversalSend.tsx +4 -1
- package/ui/components/ui/AlertCard.tsx +3 -2
- package/ui/components/ui/BalancedText.tsx +117 -0
- package/ui/components/ui/ErrorBoundary.tsx +31 -14
- package/ui/components/ui/GroupedList.tsx +28 -22
- package/ui/components/ui/ListRow.tsx +126 -35
- package/ui/components/ui/PermissionSheet.tsx +31 -24
- package/ui/components/ui/PresenceRow.tsx +15 -23
- package/ui/components/ui/Sheet.tsx +11 -17
- package/ui/components/ui/Toast.tsx +13 -17
- package/ui/components/vault/EnrollWizard.tsx +446 -196
- package/ui/components/vault/KeyChooser.tsx +7 -20
- package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
- package/ui/components/wallet/AmountInput.tsx +11 -17
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
- package/ui/index.ts +1 -1
- package/ui/screens/TrustScreen.tsx +49 -61
- package/ui/screens/VaultScreen.tsx +99 -60
- package/ui/screens/VaultTransferScreen.tsx +34 -27
- package/ui/screens/WalletCheckScreen.tsx +25 -24
- package/ui/screens/WalletConfigScreen.tsx +66 -72
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
AppState
|
|
32
32
|
} from 'react-native'
|
|
33
33
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
34
|
+
import { ArrowDownToLine, ArrowLeft, ArrowUpFromLine, CircleAlert, Lock } from 'lucide-react-native'
|
|
34
35
|
import { GroupedSection } from '../components/ui/GroupedList'
|
|
35
36
|
import { ListRow } from '../components/ui/ListRow'
|
|
36
37
|
import PressableScale from '../components/ui/PressableScale'
|
|
@@ -39,9 +40,10 @@ import AmountDisplay from '../components/wallet/AmountDisplay'
|
|
|
39
40
|
import { BiometricAdvisoryModal } from '../components/wallet/BiometricAdvisoryModal'
|
|
40
41
|
import { showAlert, type AlertButton } from '../components/ui/AlertCard'
|
|
41
42
|
import { showToast } from '../components/ui/Toast'
|
|
42
|
-
import { EnrollWizard } from '../components/vault/EnrollWizard'
|
|
43
|
+
import { EnrollWizard, type HardwareKeyArtComponent } from '../components/vault/EnrollWizard'
|
|
43
44
|
import { KeyChooser, vaultKeyLabel, formatVaultSerial } from '../components/vault/KeyChooser'
|
|
44
45
|
import { VaultBackdrop } from '../components/vault/VaultBackdrop'
|
|
46
|
+
import { BalancedText } from '../components/ui/BalancedText'
|
|
45
47
|
import { vaultErrorCopy } from '../components/vault/vaultErrorCopy'
|
|
46
48
|
import { profileLabel } from '../../core/profiles/profileLabel'
|
|
47
49
|
import { useVaultBalance } from '../hooks/useVaultBalance'
|
|
@@ -103,21 +105,12 @@ const t = (k: string, o?: Record<string, unknown>) => i18n.t(k, o) as string
|
|
|
103
105
|
const REMOVAL_RECHECK_MS = 30_000
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* package's
|
|
108
|
+
* lucide, the family this app draws every other glyph from (its settings rows,
|
|
109
|
+
* its headers, its sheets). Imported at module scope, unlike
|
|
110
|
+
* @expo/vector-icons: lucide-react-native ships a CJS entry for `require`, so
|
|
111
|
+
* it needs no transform and reaches no native module at import time, which is
|
|
112
|
+
* what this package's lazy icon loads exist to avoid.
|
|
111
113
|
*/
|
|
112
|
-
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
113
|
-
let ioniconsComponent: IoniconsComponent | undefined
|
|
114
|
-
function loadIonicons(): IoniconsComponent {
|
|
115
|
-
if (!ioniconsComponent) {
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
117
|
-
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
118
|
-
}
|
|
119
|
-
return ioniconsComponent
|
|
120
|
-
}
|
|
121
114
|
|
|
122
115
|
/**
|
|
123
116
|
* expo-router is required lazily rather than imported at module scope: this
|
|
@@ -152,11 +145,10 @@ interface RelockRequest {
|
|
|
152
145
|
revoke?: VaultKeyRecord
|
|
153
146
|
}
|
|
154
147
|
|
|
155
|
-
export function VaultScreen() {
|
|
148
|
+
export function VaultScreen({ keyArt: KeyArt }: { keyArt?: HardwareKeyArtComponent } = {}) {
|
|
156
149
|
const { colors } = useTheme()
|
|
157
150
|
const insets = useSafeAreaInsets()
|
|
158
151
|
const { router } = loadExpoRouter()
|
|
159
|
-
const Ionicons = loadIonicons()
|
|
160
152
|
const { balance, loading, refresh } = useVaultBalance()
|
|
161
153
|
const { coverage, refresh: refreshCoverage } = useVaultCoverage()
|
|
162
154
|
const { exportData, exporting } = useExportWalletData()
|
|
@@ -176,6 +168,11 @@ export function VaultScreen() {
|
|
|
176
168
|
const [meta, setMeta] = useState<VaultMeta | null | undefined>(undefined)
|
|
177
169
|
const metaRef = useRef<VaultMeta | null>(null)
|
|
178
170
|
const [wizard, setWizard] = useState<'enroll' | 'add-key' | null>(null)
|
|
171
|
+
/** What back does while the wizard is up: it says so itself (onBackChange),
|
|
172
|
+
* because only it knows which of its pages is showing. */
|
|
173
|
+
const [wizardBack, setWizardBack] = useState<(() => void) | null>(null)
|
|
174
|
+
// The setter would take a function as an updater, so it is wrapped in one.
|
|
175
|
+
const takeWizardBack = useCallback((back: () => void) => setWizardBack(() => back), [])
|
|
179
176
|
const serialsBeforeAdd = useRef<Set<string>>(new Set())
|
|
180
177
|
const [renaming, setRenaming] = useState<VaultKeyRecord | null>(null)
|
|
181
178
|
const [renameText, setRenameText] = useState('')
|
|
@@ -304,6 +301,9 @@ export function VaultScreen() {
|
|
|
304
301
|
haptics.success()
|
|
305
302
|
setRestoreNotice(t('vault_restore_found', { count: result.found }) + skipped)
|
|
306
303
|
await reload()
|
|
304
|
+
} else if (result.needsKey) {
|
|
305
|
+
// a vault was seen and nothing was restored: the next step is a tap, never "none found"
|
|
306
|
+
setRestoreNotice(t('vault_restore_needs_key') + skipped)
|
|
307
307
|
} else if (result.pendingConfirmation > 0) {
|
|
308
308
|
setRestoreNotice(t('vault_restore_pending', { count: result.pendingConfirmation }) + skipped)
|
|
309
309
|
} else {
|
|
@@ -1091,17 +1091,21 @@ export function VaultScreen() {
|
|
|
1091
1091
|
}, [ensureWalletExists, requireBackupAttested, router, walletCreationIntent])
|
|
1092
1092
|
|
|
1093
1093
|
// ── header ──────────────────────────────────────────────────────────
|
|
1094
|
-
// While the wizard is up
|
|
1095
|
-
//
|
|
1096
|
-
//
|
|
1094
|
+
// While the wizard is up this chevron is the wizard's own back: a page back
|
|
1095
|
+
// inside a key, and otherwise its leave-confirm (it owns the pending keys).
|
|
1096
|
+
// Its pages carry no Back button -- the keyboard covers that corner -- so
|
|
1097
|
+
// until it has said what back means, there is nothing here to press.
|
|
1098
|
+
const headerBack = wizard ? wizardBack : () => router.back()
|
|
1097
1099
|
const Header = (
|
|
1098
1100
|
<View style={[styles.header, { borderBottomColor: colors.separator }]}>
|
|
1099
|
-
{
|
|
1100
|
-
<
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1101
|
+
{headerBack ? (
|
|
1102
|
+
<TouchableOpacity onPress={headerBack} style={styles.iconBtn}>
|
|
1103
|
+
<View style={[styles.headerBackWell, { backgroundColor: colors.surfaceSunken }]}>
|
|
1104
|
+
<ArrowLeft size={16} color={colors.textPrimary} />
|
|
1105
|
+
</View>
|
|
1104
1106
|
</TouchableOpacity>
|
|
1107
|
+
) : (
|
|
1108
|
+
<View style={styles.iconBtn} />
|
|
1105
1109
|
)}
|
|
1106
1110
|
<Text style={[styles.headerTitle, { color: colors.textPrimary }]}>{t('vault_title')}</Text>
|
|
1107
1111
|
<View style={styles.iconBtn} />
|
|
@@ -1116,12 +1120,12 @@ export function VaultScreen() {
|
|
|
1116
1120
|
<View style={[styles.container, { backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }]}>
|
|
1117
1121
|
{Header}
|
|
1118
1122
|
<View style={styles.centered}>
|
|
1119
|
-
<
|
|
1120
|
-
<
|
|
1123
|
+
<Lock size={44} color={colors.textSecondary} />
|
|
1124
|
+
<BalancedText style={[styles.p, { color: colors.textPrimary }]}>
|
|
1121
1125
|
{t('vault_profile_only_default', {
|
|
1122
1126
|
profile: profileLabel(profiles.find(p => p.index === 0) ?? { index: 0 }, t)
|
|
1123
1127
|
})}
|
|
1124
|
-
</
|
|
1128
|
+
</BalancedText>
|
|
1125
1129
|
</View>
|
|
1126
1130
|
</View>
|
|
1127
1131
|
)
|
|
@@ -1132,8 +1136,8 @@ export function VaultScreen() {
|
|
|
1132
1136
|
<View style={[styles.container, { backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }]}>
|
|
1133
1137
|
{Header}
|
|
1134
1138
|
<View style={styles.centered}>
|
|
1135
|
-
<
|
|
1136
|
-
<
|
|
1139
|
+
<CircleAlert size={44} color={colors.error} />
|
|
1140
|
+
<BalancedText style={[styles.p, { color: colors.textPrimary }]}>{recoveryError}</BalancedText>
|
|
1137
1141
|
<PressableScale
|
|
1138
1142
|
haptic="tap"
|
|
1139
1143
|
onPress={retryRecovery}
|
|
@@ -1166,6 +1170,8 @@ export function VaultScreen() {
|
|
|
1166
1170
|
mode={wizard}
|
|
1167
1171
|
onDone={wizard === 'enroll' ? onEnrolled : onKeyAdded}
|
|
1168
1172
|
onCancel={() => void closeWizard()}
|
|
1173
|
+
onBackChange={takeWizardBack}
|
|
1174
|
+
keyArt={KeyArt}
|
|
1169
1175
|
/>
|
|
1170
1176
|
</View>
|
|
1171
1177
|
)
|
|
@@ -1177,11 +1183,14 @@ export function VaultScreen() {
|
|
|
1177
1183
|
return (
|
|
1178
1184
|
<View style={[styles.container, { backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }]}>
|
|
1179
1185
|
{Header}
|
|
1180
|
-
{/*
|
|
1181
|
-
the whole screen, so
|
|
1186
|
+
{/* Art is clipped to the area below the header rather than laid over
|
|
1187
|
+
the whole screen, so it never crosses the title bar. The host's own
|
|
1188
|
+
key drawing when it supplies one — the same key the enrolment
|
|
1189
|
+
wizard's touch step shows, so the vault is one object throughout —
|
|
1190
|
+
and the package's line-art backdrop otherwise. */}
|
|
1182
1191
|
<View style={styles.heroArea}>
|
|
1183
|
-
<View style={styles.heroArt}>
|
|
1184
|
-
<VaultBackdrop color={colors.textPrimary} />
|
|
1192
|
+
<View style={[styles.heroArt, !!KeyArt && styles.heroArtObject]}>
|
|
1193
|
+
{KeyArt ? <KeyArt size={288} /> : <VaultBackdrop color={colors.textPrimary} />}
|
|
1185
1194
|
</View>
|
|
1186
1195
|
<ScrollView contentContainerStyle={styles.heroScroll}>
|
|
1187
1196
|
{/* 1:4 spacers sit the copy block high, just under the header,
|
|
@@ -1189,7 +1198,7 @@ export function VaultScreen() {
|
|
|
1189
1198
|
<View style={styles.heroSpacerTop} />
|
|
1190
1199
|
<View style={styles.heroCopy}>
|
|
1191
1200
|
<Text style={[styles.h1, { color: colors.textPrimary }]}>{t('vault_hero_title')}</Text>
|
|
1192
|
-
<
|
|
1201
|
+
<BalancedText style={[styles.p, { color: colors.textSecondary }]}>{t('vault_hero_body')}</BalancedText>
|
|
1193
1202
|
<PressableScale
|
|
1194
1203
|
haptic="confirm"
|
|
1195
1204
|
onPress={canEnroll ? () => void onBeginEnrollment() : undefined}
|
|
@@ -1214,15 +1223,19 @@ export function VaultScreen() {
|
|
|
1214
1223
|
hardware. */}
|
|
1215
1224
|
{!enabled && (
|
|
1216
1225
|
<View style={styles.heroNotice}>
|
|
1217
|
-
<
|
|
1226
|
+
<BalancedText style={[styles.heroNoticeBody, { color: colors.textSecondary }]}>
|
|
1227
|
+
{t(unavailableCopy)}
|
|
1228
|
+
</BalancedText>
|
|
1218
1229
|
</View>
|
|
1219
1230
|
)}
|
|
1220
1231
|
{enabled && !supported && (
|
|
1221
1232
|
<View style={styles.heroNotice}>
|
|
1222
|
-
<
|
|
1223
|
-
|
|
1233
|
+
<BalancedText style={[styles.heroNoticeTitle, { color: colors.error }]}>
|
|
1234
|
+
{t('vault_unsupported_title')}
|
|
1235
|
+
</BalancedText>
|
|
1236
|
+
<BalancedText style={[styles.heroNoticeBody, { color: colors.textSecondary }]}>
|
|
1224
1237
|
{t('vault_unsupported_body')}
|
|
1225
|
-
</
|
|
1238
|
+
</BalancedText>
|
|
1226
1239
|
</View>
|
|
1227
1240
|
)}
|
|
1228
1241
|
{/* No local vault meta at all: a wiped device / reinstall with
|
|
@@ -1258,7 +1271,9 @@ export function VaultScreen() {
|
|
|
1258
1271
|
)}
|
|
1259
1272
|
</PressableScale>
|
|
1260
1273
|
{restoreNotice && (
|
|
1261
|
-
<
|
|
1274
|
+
<BalancedText style={[styles.heroNoticeBody, { color: colors.textSecondary }]}>
|
|
1275
|
+
{restoreNotice}
|
|
1276
|
+
</BalancedText>
|
|
1262
1277
|
)}
|
|
1263
1278
|
</View>
|
|
1264
1279
|
)}
|
|
@@ -1273,7 +1288,9 @@ export function VaultScreen() {
|
|
|
1273
1288
|
fitContent
|
|
1274
1289
|
>
|
|
1275
1290
|
<View style={styles.sheetBody}>
|
|
1276
|
-
<
|
|
1291
|
+
<BalancedText style={[styles.p, { color: colors.textSecondary }]}>
|
|
1292
|
+
{t('vault_restore_with_key_body')}
|
|
1293
|
+
</BalancedText>
|
|
1277
1294
|
<Text style={[styles.sheetLabel, { color: colors.textPrimary }]}>{t('vault_enter_pin')}</Text>
|
|
1278
1295
|
<TextInput
|
|
1279
1296
|
accessibilityLabel={t('vault_enter_pin')}
|
|
@@ -1294,16 +1311,18 @@ export function VaultScreen() {
|
|
|
1294
1311
|
{keyRestoreBusy && (
|
|
1295
1312
|
<View style={styles.adoptionProgress}>
|
|
1296
1313
|
<ActivityIndicator color={colors.accent} />
|
|
1297
|
-
<
|
|
1314
|
+
<BalancedText style={[styles.p, { color: colors.textSecondary }]}>
|
|
1298
1315
|
{keyRestorePhase === 'scanning'
|
|
1299
1316
|
? t('vault_restore_scanning')
|
|
1300
1317
|
: keyRestorePhase === 'challenging'
|
|
1301
1318
|
? t('vault_touch_when_blinks')
|
|
1302
1319
|
: t('vault_reading_key')}
|
|
1303
|
-
</
|
|
1320
|
+
</BalancedText>
|
|
1304
1321
|
</View>
|
|
1305
1322
|
)}
|
|
1306
|
-
{keyRestoreError &&
|
|
1323
|
+
{keyRestoreError && (
|
|
1324
|
+
<BalancedText style={[styles.err, { color: colors.error }]}>{keyRestoreError}</BalancedText>
|
|
1325
|
+
)}
|
|
1307
1326
|
<PressableScale
|
|
1308
1327
|
haptic="confirm"
|
|
1309
1328
|
onPress={!keyRestoreBusy && /^[0-9]{6,8}$/.test(keyRestorePin) ? () => void runKeyRestore() : undefined}
|
|
@@ -1401,7 +1420,7 @@ export function VaultScreen() {
|
|
|
1401
1420
|
accessibilityState={{ disabled: !canDeposit }}
|
|
1402
1421
|
style={[styles.actionBtn, { backgroundColor: canDeposit ? colors.accent : colors.backgroundElevated }]}
|
|
1403
1422
|
>
|
|
1404
|
-
<
|
|
1423
|
+
<ArrowDownToLine size={16} color={canDeposit ? colors.textOnAccent : colors.textTertiary} />
|
|
1405
1424
|
<Text style={[styles.actionLabel, { color: canDeposit ? colors.textOnAccent : colors.textTertiary }]}>
|
|
1406
1425
|
{t('vault_deposit_cta')}
|
|
1407
1426
|
</Text>
|
|
@@ -1422,27 +1441,35 @@ export function VaultScreen() {
|
|
|
1422
1441
|
}
|
|
1423
1442
|
]}
|
|
1424
1443
|
>
|
|
1425
|
-
<
|
|
1444
|
+
<ArrowUpFromLine size={16} color={canWithdraw ? colors.accent : colors.textTertiary} />
|
|
1426
1445
|
<Text style={[styles.actionLabel, { color: canWithdraw ? colors.accent : colors.textTertiary }]}>
|
|
1427
1446
|
{t('vault_withdraw_cta')}
|
|
1428
1447
|
</Text>
|
|
1429
1448
|
</PressableScale>
|
|
1430
1449
|
</View>
|
|
1431
|
-
{!enabled &&
|
|
1450
|
+
{!enabled && (
|
|
1451
|
+
<BalancedText style={[styles.notice, { color: colors.textSecondary }]}>{t(unavailableCopy)}</BalancedText>
|
|
1452
|
+
)}
|
|
1432
1453
|
{transfersBlocked && (
|
|
1433
|
-
<
|
|
1454
|
+
<BalancedText style={[styles.notice, { color: colors.warning }]}>
|
|
1434
1455
|
{t(removalAwaitingNetwork ? 'vault_removal_awaiting_network' : 'vault_err_relock_required')}
|
|
1435
|
-
</
|
|
1456
|
+
</BalancedText>
|
|
1436
1457
|
)}
|
|
1437
1458
|
{overLockLimit && !transfersBlocked && (
|
|
1438
|
-
<
|
|
1459
|
+
<BalancedText style={[styles.notice, { color: colors.warning }]}>
|
|
1460
|
+
{t('vault_err_too_many_active_keys')}
|
|
1461
|
+
</BalancedText>
|
|
1439
1462
|
)}
|
|
1440
1463
|
{recoveryRequired && !hasRecoveryRedundancy && (
|
|
1441
|
-
<
|
|
1464
|
+
<BalancedText style={[styles.notice, { color: colors.warning }]}>
|
|
1465
|
+
{t('vault_err_key_not_adopted')}
|
|
1466
|
+
</BalancedText>
|
|
1442
1467
|
)}
|
|
1443
1468
|
{actionPendingNotice && (
|
|
1444
1469
|
<View style={[styles.notice, styles.actionPendingBlock]}>
|
|
1445
|
-
<
|
|
1470
|
+
<BalancedText style={[styles.heroNoticeBody, { color: colors.warning }]}>
|
|
1471
|
+
{vaultErrorCopy('action-pending')}
|
|
1472
|
+
</BalancedText>
|
|
1446
1473
|
<PressableScale
|
|
1447
1474
|
haptic="confirm"
|
|
1448
1475
|
onPress={resolvingDeposit ? undefined : () => void onResolveHeldDeposit()}
|
|
@@ -1502,7 +1529,7 @@ export function VaultScreen() {
|
|
|
1502
1529
|
label={`${rec.nickname} · ${formatVaultSerial(rec.serial)}`}
|
|
1503
1530
|
subtitle={adopted ? new Date(rec.enrolledAt).toLocaleDateString() : t('vault_err_key_not_adopted')}
|
|
1504
1531
|
icon={adopted ? 'key-outline' : 'shield-checkmark-outline'}
|
|
1505
|
-
iconColor={adopted ?
|
|
1532
|
+
iconColor={adopted ? undefined : colors.warning}
|
|
1506
1533
|
showChevron={false}
|
|
1507
1534
|
onPress={adopted ? () => void keyActions(rec) : () => openAdoption(rec)}
|
|
1508
1535
|
isLast={i === meta.keys.length - 1 && !canAdd}
|
|
@@ -1544,7 +1571,6 @@ export function VaultScreen() {
|
|
|
1544
1571
|
<ListRow
|
|
1545
1572
|
label={t('export_wallet_data')}
|
|
1546
1573
|
icon="share-outline"
|
|
1547
|
-
iconColor="#32ADE6"
|
|
1548
1574
|
showChevron={false}
|
|
1549
1575
|
onPress={exporting ? undefined : () => void exportData()}
|
|
1550
1576
|
trailing={exporting ? <ActivityIndicator size="small" /> : undefined}
|
|
@@ -1607,7 +1633,9 @@ export function VaultScreen() {
|
|
|
1607
1633
|
fitContent
|
|
1608
1634
|
>
|
|
1609
1635
|
<View style={styles.sheetBody}>
|
|
1610
|
-
<
|
|
1636
|
+
<BalancedText style={[styles.p, { color: colors.textSecondary }]}>
|
|
1637
|
+
{t('vault_err_key_not_adopted')}
|
|
1638
|
+
</BalancedText>
|
|
1611
1639
|
<Text style={[styles.sheetLabel, { color: colors.textPrimary }]}>{t('vault_enter_pin')}</Text>
|
|
1612
1640
|
<TextInput
|
|
1613
1641
|
accessibilityLabel={t('vault_enter_pin')}
|
|
@@ -1628,12 +1656,12 @@ export function VaultScreen() {
|
|
|
1628
1656
|
{adoptionBusy && (
|
|
1629
1657
|
<View style={styles.adoptionProgress}>
|
|
1630
1658
|
<ActivityIndicator color={colors.accent} />
|
|
1631
|
-
<
|
|
1659
|
+
<BalancedText style={[styles.p, { color: colors.textSecondary }]}>
|
|
1632
1660
|
{adoptionPhase === 'challenging' ? t('vault_touch_when_blinks') : t('vault_reading_key')}
|
|
1633
|
-
</
|
|
1661
|
+
</BalancedText>
|
|
1634
1662
|
</View>
|
|
1635
1663
|
)}
|
|
1636
|
-
{adoptionError && <
|
|
1664
|
+
{adoptionError && <BalancedText style={[styles.err, { color: colors.error }]}>{adoptionError}</BalancedText>}
|
|
1637
1665
|
<PressableScale
|
|
1638
1666
|
haptic="confirm"
|
|
1639
1667
|
onPress={!adoptionBusy && /^[0-9]{6,8}$/.test(adoptionPin) ? () => void runAdoption() : undefined}
|
|
@@ -1663,10 +1691,12 @@ export function VaultScreen() {
|
|
|
1663
1691
|
fitContent
|
|
1664
1692
|
>
|
|
1665
1693
|
<View style={styles.sheetBody}>
|
|
1666
|
-
{relock?.reason ?
|
|
1694
|
+
{relock?.reason ? (
|
|
1695
|
+
<BalancedText style={[styles.p, { color: colors.textSecondary }]}>{relock.reason}</BalancedText>
|
|
1696
|
+
) : null}
|
|
1667
1697
|
<Text style={[styles.sheetLabel, { color: colors.textPrimary }]}>{t('vault_relock_choose')}</Text>
|
|
1668
1698
|
<KeyChooser keys={relockCandidates} selected={relockSerial} onSelect={setRelockSerial} />
|
|
1669
|
-
{relockError && <
|
|
1699
|
+
{relockError && <BalancedText style={[styles.err, { color: colors.error }]}>{relockError}</BalancedText>}
|
|
1670
1700
|
<PressableScale
|
|
1671
1701
|
haptic="confirm"
|
|
1672
1702
|
onPress={relockSerial && !relocking ? () => void runRelock() : undefined}
|
|
@@ -1697,6 +1727,13 @@ export function VaultScreen() {
|
|
|
1697
1727
|
}
|
|
1698
1728
|
|
|
1699
1729
|
const styles = StyleSheet.create({
|
|
1730
|
+
headerBackWell: {
|
|
1731
|
+
width: 32,
|
|
1732
|
+
height: 32,
|
|
1733
|
+
borderRadius: 16,
|
|
1734
|
+
alignItems: 'center',
|
|
1735
|
+
justifyContent: 'center'
|
|
1736
|
+
},
|
|
1700
1737
|
container: { flex: 1 },
|
|
1701
1738
|
header: {
|
|
1702
1739
|
flexDirection: 'row',
|
|
@@ -1716,6 +1753,8 @@ const styles = StyleSheet.create({
|
|
|
1716
1753
|
content: { paddingTop: spacing.lg, paddingBottom: spacing.xxxl },
|
|
1717
1754
|
heroArea: { flex: 1, overflow: 'hidden' },
|
|
1718
1755
|
heroArt: { position: 'absolute', bottom: '7%', left: 0, right: 0, height: '56%' },
|
|
1756
|
+
// a backdrop fills its slot; a drawn object sits in the middle of it
|
|
1757
|
+
heroArtObject: { alignItems: 'center', justifyContent: 'center' },
|
|
1719
1758
|
heroScroll: { flexGrow: 1 },
|
|
1720
1759
|
heroNotice: { alignItems: 'center', gap: spacing.xs },
|
|
1721
1760
|
heroNoticeTitle: { ...typography.subhead, fontWeight: '600', textAlign: 'center' },
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'
|
|
25
25
|
import { View, Text, StyleSheet, ActivityIndicator, ScrollView, TouchableOpacity } from 'react-native'
|
|
26
26
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
27
|
+
import { ArrowLeft } from 'lucide-react-native'
|
|
27
28
|
import { AmountInput, SEND_MAX_VALUE } from '../components/wallet/AmountInput'
|
|
28
29
|
import PressableScale from '../components/ui/PressableScale'
|
|
29
30
|
import AmountDisplay from '../components/wallet/AmountDisplay'
|
|
@@ -64,25 +65,17 @@ import {
|
|
|
64
65
|
sounds,
|
|
65
66
|
i18n
|
|
66
67
|
} from '@bsv/expo-wallet-toolbox'
|
|
68
|
+
import { BalancedText } from '../components/ui/BalancedText'
|
|
67
69
|
|
|
68
70
|
const t = (k: string, o?: Record<string, unknown>) => i18n.t(k, o) as string
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* this package's
|
|
73
|
+
* lucide, the family this app draws every other glyph from (its settings rows,
|
|
74
|
+
* its headers, its sheets). Imported at module scope, unlike
|
|
75
|
+
* @expo/vector-icons: lucide-react-native ships a CJS entry for `require`, so
|
|
76
|
+
* it needs no transform and reaches no native module at import time, which is
|
|
77
|
+
* what this package's lazy icon loads exist to avoid.
|
|
76
78
|
*/
|
|
77
|
-
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
78
|
-
let ioniconsComponent: IoniconsComponent | undefined
|
|
79
|
-
function loadIonicons(): IoniconsComponent {
|
|
80
|
-
if (!ioniconsComponent) {
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
82
|
-
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
83
|
-
}
|
|
84
|
-
return ioniconsComponent
|
|
85
|
-
}
|
|
86
79
|
|
|
87
80
|
/**
|
|
88
81
|
* expo-router is required lazily rather than imported at module scope: this
|
|
@@ -128,7 +121,6 @@ export function VaultTransferScreen() {
|
|
|
128
121
|
const { colors } = useTheme()
|
|
129
122
|
const insets = useSafeAreaInsets()
|
|
130
123
|
const { router, useLocalSearchParams } = loadExpoRouter()
|
|
131
|
-
const Ionicons = loadIonicons()
|
|
132
124
|
const { direction } = useLocalSearchParams<{ direction?: string }>()
|
|
133
125
|
const { managers, adminOriginator, selectedNetwork, storage, settings, activeProfile, profiles } = useWallet()
|
|
134
126
|
const { satoshisPerUSD, usdToFiat = {} } = useContext(ExchangeRateContext)
|
|
@@ -484,7 +476,9 @@ export function VaultTransferScreen() {
|
|
|
484
476
|
<View style={[styles.container, { backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }]}>
|
|
485
477
|
<View style={[styles.header, { borderBottomColor: colors.separator }]}>
|
|
486
478
|
<TouchableOpacity onPress={() => router.back()} style={styles.iconBtn}>
|
|
487
|
-
<
|
|
479
|
+
<View style={[styles.headerBackWell, { backgroundColor: colors.surfaceSunken }]}>
|
|
480
|
+
<ArrowLeft size={16} color={colors.textPrimary} />
|
|
481
|
+
</View>
|
|
488
482
|
</TouchableOpacity>
|
|
489
483
|
<Text style={[styles.headerTitle, { color: colors.textPrimary }]}>{t('vault_title')}</Text>
|
|
490
484
|
<View style={styles.iconBtn} />
|
|
@@ -504,7 +498,9 @@ export function VaultTransferScreen() {
|
|
|
504
498
|
<View style={[styles.container, { backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }]}>
|
|
505
499
|
<View style={[styles.header, { borderBottomColor: colors.separator }]}>
|
|
506
500
|
<TouchableOpacity onPress={() => router.back()} style={styles.iconBtn}>
|
|
507
|
-
<
|
|
501
|
+
<View style={[styles.headerBackWell, { backgroundColor: colors.surfaceSunken }]}>
|
|
502
|
+
<ArrowLeft size={16} color={colors.textPrimary} />
|
|
503
|
+
</View>
|
|
508
504
|
</TouchableOpacity>
|
|
509
505
|
<Text style={[styles.headerTitle, { color: colors.textPrimary }]}>
|
|
510
506
|
{isDeposit ? t('vault_deposit_title') : t('vault_withdraw_title')}
|
|
@@ -525,9 +521,9 @@ export function VaultTransferScreen() {
|
|
|
525
521
|
)}
|
|
526
522
|
</View>
|
|
527
523
|
|
|
528
|
-
<
|
|
524
|
+
<BalancedText style={[styles.sub, { color: colors.textSecondary }]}>
|
|
529
525
|
{isDeposit ? t('vault_deposit_sub') : t('vault_withdraw_sub')}
|
|
530
|
-
</
|
|
526
|
+
</BalancedText>
|
|
531
527
|
|
|
532
528
|
{keys.length > 0 && (
|
|
533
529
|
<View style={styles.chooser}>
|
|
@@ -547,38 +543,42 @@ export function VaultTransferScreen() {
|
|
|
547
543
|
{isDeposit && <AvailableBalance />}
|
|
548
544
|
|
|
549
545
|
{isDeposit && (
|
|
550
|
-
<
|
|
546
|
+
<BalancedText style={[styles.floor, { color: colors.textSecondary }]}>
|
|
551
547
|
{t('vault_floor_line', {
|
|
552
548
|
floorDisplay: fmt(VAULT_DEPOSIT_MIN),
|
|
553
549
|
floorSats: VAULT_DEPOSIT_MIN.toLocaleString('en-US'),
|
|
554
550
|
feeDisplay: fmt(depositFee)
|
|
555
551
|
})}
|
|
556
|
-
</
|
|
552
|
+
</BalancedText>
|
|
557
553
|
)}
|
|
558
554
|
|
|
559
555
|
{isDeposit && !released && (
|
|
560
|
-
<
|
|
556
|
+
<BalancedText style={[styles.floor, { color: colors.textSecondary }]}>{t(unavailableCopy)}</BalancedText>
|
|
561
557
|
)}
|
|
562
558
|
|
|
563
559
|
{transfersBlocked && (
|
|
564
|
-
<
|
|
560
|
+
<BalancedText style={[styles.floor, { color: colors.warning }]}>
|
|
565
561
|
{t(
|
|
566
562
|
meta?.pendingRemoval?.state === 'broadcast'
|
|
567
563
|
? 'vault_removal_awaiting_network'
|
|
568
564
|
: 'vault_err_relock_required'
|
|
569
565
|
)}
|
|
570
|
-
</
|
|
566
|
+
</BalancedText>
|
|
571
567
|
)}
|
|
572
568
|
|
|
573
569
|
{isDeposit && overLockLimit && !transfersBlocked && (
|
|
574
|
-
<
|
|
570
|
+
<BalancedText style={[styles.floor, { color: colors.warning }]}>
|
|
571
|
+
{t('vault_err_too_many_active_keys')}
|
|
572
|
+
</BalancedText>
|
|
575
573
|
)}
|
|
576
574
|
|
|
577
575
|
{!isDeposit && meta?.recovery?.required && keys.length === 0 && (
|
|
578
|
-
<
|
|
576
|
+
<BalancedText style={[styles.floor, { color: colors.warning }]}>
|
|
577
|
+
{t('vault_err_key_not_adopted')}
|
|
578
|
+
</BalancedText>
|
|
579
579
|
)}
|
|
580
580
|
|
|
581
|
-
{error && <
|
|
581
|
+
{error && <BalancedText style={[styles.err, { color: colors.error }]}>{error}</BalancedText>}
|
|
582
582
|
|
|
583
583
|
<PressableScale
|
|
584
584
|
haptic="confirm"
|
|
@@ -603,6 +603,13 @@ export function VaultTransferScreen() {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
const styles = StyleSheet.create({
|
|
606
|
+
headerBackWell: {
|
|
607
|
+
width: 32,
|
|
608
|
+
height: 32,
|
|
609
|
+
borderRadius: 16,
|
|
610
|
+
alignItems: 'center',
|
|
611
|
+
justifyContent: 'center'
|
|
612
|
+
},
|
|
606
613
|
container: { flex: 1 },
|
|
607
614
|
header: {
|
|
608
615
|
flexDirection: 'row',
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
13
13
|
import { ActivityIndicator, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
14
14
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
15
|
+
import { ArrowLeft, Circle, CircleCheck, CircleMinus, TriangleAlert } from 'lucide-react-native'
|
|
15
16
|
import { useTranslation } from 'react-i18next'
|
|
16
17
|
import { PeerPayClient } from '@bsv/message-box-client'
|
|
17
18
|
import { showAlert } from '../components/ui/AlertCard'
|
|
@@ -44,23 +45,15 @@ import { userFacingPayError } from '../../core/pay/userError'
|
|
|
44
45
|
import { backupAttestation } from '../../core/services/vault/backupAttestation'
|
|
45
46
|
import { getBackupUploadState } from '../../core/backup/status'
|
|
46
47
|
import { getOnline, haptics, spacing, typography, useTheme, useWallet } from '@bsv/expo-wallet-toolbox'
|
|
48
|
+
import { BalancedText } from '../components/ui/BalancedText'
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* this package's
|
|
51
|
+
* lucide, the family this app draws every other glyph from (its settings rows,
|
|
52
|
+
* its headers, its sheets). Imported at module scope, unlike
|
|
53
|
+
* @expo/vector-icons: lucide-react-native ships a CJS entry for `require`, so
|
|
54
|
+
* it needs no transform and reaches no native module at import time, which is
|
|
55
|
+
* what this package's lazy icon loads exist to avoid.
|
|
54
56
|
*/
|
|
55
|
-
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
56
|
-
let ioniconsComponent: IoniconsComponent | undefined
|
|
57
|
-
function loadIonicons(): IoniconsComponent {
|
|
58
|
-
if (!ioniconsComponent) {
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
60
|
-
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
61
|
-
}
|
|
62
|
-
return ioniconsComponent
|
|
63
|
-
}
|
|
64
57
|
|
|
65
58
|
/**
|
|
66
59
|
* expo-router is required lazily rather than imported at module scope: this
|
|
@@ -270,7 +263,6 @@ export function WalletCheckScreen(props?: { ports?: WalletCheckPorts }) {
|
|
|
270
263
|
const { colors } = useTheme()
|
|
271
264
|
const insets = useSafeAreaInsets()
|
|
272
265
|
const { router } = loadExpoRouter()
|
|
273
|
-
const Ionicons = loadIonicons()
|
|
274
266
|
const contextPorts = useWalletCheckPorts()
|
|
275
267
|
const ports = props?.ports ?? contextPorts
|
|
276
268
|
const portsRef = useRef(ports)
|
|
@@ -375,7 +367,9 @@ export function WalletCheckScreen(props?: { ports?: WalletCheckPorts }) {
|
|
|
375
367
|
<View style={{ flex: 1, backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }}>
|
|
376
368
|
<View style={[styles.header, { borderBottomColor: colors.separator }]}>
|
|
377
369
|
<TouchableOpacity onPress={() => router.back()} style={styles.headerBack} accessibilityRole="button">
|
|
378
|
-
<
|
|
370
|
+
<View style={[styles.headerBackWell, { backgroundColor: colors.surfaceSunken }]}>
|
|
371
|
+
<ArrowLeft size={16} color={colors.textPrimary} />
|
|
372
|
+
</View>
|
|
379
373
|
</TouchableOpacity>
|
|
380
374
|
<View style={styles.headerBack} />
|
|
381
375
|
</View>
|
|
@@ -397,13 +391,13 @@ export function WalletCheckScreen(props?: { ports?: WalletCheckPorts }) {
|
|
|
397
391
|
{active ? (
|
|
398
392
|
<ActivityIndicator size="small" color={colors.textSecondary} />
|
|
399
393
|
) : status === 'ok' ? (
|
|
400
|
-
<
|
|
394
|
+
<CircleCheck size={20} color={colors.success} />
|
|
401
395
|
) : status === 'attention' || status === 'error' ? (
|
|
402
|
-
<
|
|
396
|
+
<TriangleAlert size={20} color={colors.warning} />
|
|
403
397
|
) : status === 'skipped' ? (
|
|
404
|
-
<
|
|
398
|
+
<CircleMinus size={20} color={colors.textTertiary} />
|
|
405
399
|
) : (
|
|
406
|
-
<
|
|
400
|
+
<Circle size={20} color={colors.textQuaternary} />
|
|
407
401
|
)}
|
|
408
402
|
</View>
|
|
409
403
|
<Text
|
|
@@ -445,13 +439,13 @@ export function WalletCheckScreen(props?: { ports?: WalletCheckPorts }) {
|
|
|
445
439
|
checklist is the evidence, and this is what it adds up to. */}
|
|
446
440
|
{!running && (doneCopy || couldntCheck || error) && (
|
|
447
441
|
<View style={styles.resultBlock}>
|
|
448
|
-
<
|
|
442
|
+
<BalancedText style={[styles.done, styles.centered, { color: colors.textPrimary }]}>
|
|
449
443
|
{couldntCheck ? t('wallet_check_couldnt') : error ? error : doneCopy}
|
|
450
|
-
</
|
|
444
|
+
</BalancedText>
|
|
451
445
|
{couldntCheck && (
|
|
452
|
-
<
|
|
446
|
+
<BalancedText style={[styles.body, styles.centered, { color: colors.textSecondary }]}>
|
|
453
447
|
{t('wallet_check_couldnt_body')}
|
|
454
|
-
</
|
|
448
|
+
</BalancedText>
|
|
455
449
|
)}
|
|
456
450
|
{(couldntCheck || error) && (
|
|
457
451
|
// Outlined, because Done below is filled: two accent-filled
|
|
@@ -483,6 +477,13 @@ export function WalletCheckScreen(props?: { ports?: WalletCheckPorts }) {
|
|
|
483
477
|
}
|
|
484
478
|
|
|
485
479
|
const styles = StyleSheet.create({
|
|
480
|
+
headerBackWell: {
|
|
481
|
+
width: 32,
|
|
482
|
+
height: 32,
|
|
483
|
+
borderRadius: 16,
|
|
484
|
+
alignItems: 'center',
|
|
485
|
+
justifyContent: 'center'
|
|
486
|
+
},
|
|
486
487
|
header: {
|
|
487
488
|
flexDirection: 'row',
|
|
488
489
|
alignItems: 'center',
|