@bsv/expo-wallet-toolbox 0.19.0 → 0.21.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 +154 -30
- package/README.md +79 -79
- package/core/backup/RemoteSyncReader.ts +26 -24
- package/core/backup/appData.ts +9 -8
- package/core/backup/codec.ts +21 -18
- package/core/backup/constants.ts +5 -5
- package/core/backup/contactsBackup.ts +8 -8
- package/core/backup/cursor.ts +12 -7
- package/core/backup/derive.ts +3 -3
- package/core/backup/deviceId.ts +2 -2
- package/core/backup/erase.ts +2 -2
- package/core/backup/preference.ts +2 -2
- package/core/backup/push.ts +10 -12
- package/core/backup/restore.ts +22 -14
- package/core/backup/restoreOnImport.ts +3 -2
- package/core/config.tsx +17 -13
- package/core/constants.ts +34 -11
- package/core/contacts/contactsStore.ts +4 -3
- package/core/context/WalletConnectionContext.tsx +294 -212
- package/core/context/WalletContext.tsx +132 -97
- package/core/context/defaultWalletSettings.ts +4 -2
- package/core/demo/demoLedger.ts +1 -5
- package/core/directpay/DirectPayManager.ts +148 -29
- package/core/directpay/DirectPayProvider.tsx +26 -26
- package/core/directpay/payFlow.ts +10 -1
- package/core/directpay/receive.ts +2 -1
- package/core/directpay/settings.ts +56 -9
- package/core/directpay/types.ts +11 -2
- package/core/directpay/webrtpay.ts +4 -0
- package/core/headers/checkpoints.ts +10 -1
- package/core/headers/headerStore.ts +13 -2
- package/core/hooks/useConfirmationSound.ts +3 -3
- package/core/hooks/useHaptics.ts +23 -6
- package/core/i18n/translations.tsx +382 -209
- package/core/index.ts +2 -0
- package/core/localpay/codec.ts +12 -6
- package/core/localpay/deviceCaps.ts +4 -14
- package/core/localpay/pending.ts +2 -1
- package/core/localpay/qr.ts +1 -1
- package/core/localpay/settlementAck.ts +1 -4
- package/core/localpay/transport/ble.ts +2 -2
- package/core/localpay/transport/socket.ts +1 -1
- package/core/mandala/abortGuard.ts +1 -1
- package/core/mandala/drain.ts +3 -0
- package/core/mandala/permissionModule.ts +3 -2
- package/core/mandala/resendTransfer.ts +4 -1
- package/core/mandala/runtime.ts +4 -4
- package/core/monitor/TaskBackupPush.ts +10 -13
- package/core/net/chainMatch.ts +8 -5
- package/core/networks.ts +145 -0
- package/core/parsePeerPayURI.ts +4 -1
- package/core/pay/beefRepair.ts +6 -3
- package/core/pay/creditErrors.ts +37 -1
- package/core/pay/rails/address.ts +10 -6
- package/core/pay/rails/direct.ts +6 -2
- package/core/pay/rails/handle.ts +84 -11
- package/core/pay/rails/index.ts +18 -2
- package/core/pay/receiveHistory.ts +8 -8
- package/core/peerpay/handleResendRequests.ts +11 -18
- package/core/peerpay/inboxAttempts.ts +1 -4
- package/core/peerpay/rebuildToken.ts +12 -9
- package/core/profiles/profileStore.ts +2 -1
- package/core/profiles/removalProblems.ts +3 -1
- package/core/services/arcTokenStorage.ts +2 -1
- package/core/services/arcadeBroadcastProvider.ts +7 -17
- package/core/services/secrets/envelope.ts +1 -6
- package/core/services/secrets/hkdf.ts +1 -6
- package/core/services/secrets/index.ts +3 -22
- package/core/services/usdFxRates.ts +1 -4
- package/core/services/vault/VaultKeyService.ts +2 -1
- package/core/services/vault/chainRecovery.ts +48 -21
- package/core/services/vault/metaAuthority.ts +4 -1
- package/core/services/vault/r1comb.ts +113 -51
- package/core/services/vault/session.ts +5 -1
- package/core/services/vault/transfers.ts +699 -576
- package/core/services/vault/vaultStore.ts +12 -10
- package/core/services/walletArgLimits.ts +1 -2
- package/core/services/walletConnectionValidation.ts +44 -28
- package/core/services/walletServiceConfig.ts +9 -40
- package/core/storage/StorageExpoSQLite.ts +7 -21
- package/core/storage/methods/listActionsSql.ts +81 -67
- package/core/storage/methods/listOutputsSql.ts +21 -16
- package/core/storage/methods/reviewStatusSql.ts +1 -4
- package/core/stores/ConnectionStore.ts +1 -1
- package/core/theme/ThemeContext.tsx +12 -16
- package/core/theme/motion.ts +3 -3
- package/core/theme/tokens.ts +6 -6
- package/core/toolboxConfig.ts +23 -0
- package/core/walletDbRegistry.ts +7 -5
- package/core/walletRepair/runWalletCheck.ts +1 -4
- package/package.json +2 -2
- package/ui/components/pay/AddressReceive.tsx +3 -3
- package/ui/components/pay/HandleReceive.tsx +21 -15
- package/ui/components/pay/MessageBoxConfig.tsx +46 -20
- package/ui/components/pay/NearbyFlow.tsx +575 -507
- package/ui/components/pay/OfflineNotice.tsx +1 -3
- package/ui/components/pay/PayCellRow.tsx +1 -4
- package/ui/components/pay/PayForm.tsx +1 -3
- package/ui/components/pay/RequestHub.tsx +14 -6
- package/ui/components/pay/UniversalSend.tsx +79 -27
- package/ui/components/pay/tokenSendCopy.ts +1 -2
- package/ui/components/pay/useRecipientInput.ts +2 -2
- package/ui/components/security/WalletLockNotice.tsx +1 -3
- package/ui/components/ui/AlertCard.tsx +44 -45
- package/ui/components/ui/BlurChrome.tsx +4 -15
- package/ui/components/ui/Celebration.tsx +3 -3
- package/ui/components/ui/ChoiceSheet.ts +1 -3
- package/ui/components/ui/ErrorBoundary.tsx +2 -6
- package/ui/components/ui/GroupedList.tsx +13 -31
- package/ui/components/ui/IconButton.tsx +6 -9
- package/ui/components/ui/ListRow.tsx +19 -25
- package/ui/components/ui/PresenceRow.tsx +4 -4
- package/ui/components/ui/PressableScale.tsx +24 -20
- package/ui/components/ui/Toast.tsx +23 -16
- package/ui/components/vault/KeyChooser.tsx +9 -6
- package/ui/components/vault/VaultBackdrop.tsx +1 -8
- package/ui/components/vault/VaultCeremonySheet.tsx +5 -5
- package/ui/components/wallet/ActivityRow.tsx +3 -2
- package/ui/components/wallet/BackupReminderSheet.tsx +1 -5
- package/ui/components/wallet/Balance.tsx +4 -1
- package/ui/components/wallet/ContactActivityList.tsx +7 -7
- package/ui/components/wallet/IconPickerSheet.tsx +1 -5
- package/ui/components/wallet/ProfileSwitcherPopover.tsx +6 -1
- package/ui/components/wallet/tokenEviction.ts +4 -1
- package/ui/hooks/useMandala.ts +1 -7
- package/ui/hooks/useOfflineNoticeActions.ts +21 -27
- package/ui/hooks/useSpendableBalance.ts +2 -2
- package/ui/hooks/useVaultCoverage.ts +7 -1
- package/ui/index.ts +9 -1
- package/ui/resolveIdentity.ts +20 -8
- package/ui/screens/ConnectionsScreen.tsx +44 -18
- package/ui/screens/LogsScreen.tsx +24 -22
- package/ui/screens/PairScreen.tsx +85 -54
- package/ui/screens/PayScreen.tsx +5 -1
- package/ui/screens/ProfileScreen.tsx +0 -3
- package/ui/screens/TrustScreen.tsx +125 -80
- package/ui/screens/VaultScreen.tsx +19 -7
- package/ui/screens/VaultTransferScreen.tsx +5 -1
- package/ui/screens/WalletCheckScreen.tsx +14 -17
- package/ui/screens/WalletConfigScreen.tsx +414 -376
- package/ui/screens/WalletHomeScreen.tsx +47 -42
|
@@ -239,9 +239,7 @@ export default function OfflineNotice({
|
|
|
239
239
|
incoming money, and a bare "damaged data" title reads as "my queued
|
|
240
240
|
payments vanished". Steer away from blind re-sends — a quarantined entry
|
|
241
241
|
may already have been credited. */}
|
|
242
|
-
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
243
|
-
{t('pay_offline_kv_corrupt_body')}
|
|
244
|
-
</Text>
|
|
242
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>{t('pay_offline_kv_corrupt_body')}</Text>
|
|
245
243
|
</View>
|
|
246
244
|
</View>
|
|
247
245
|
)}
|
|
@@ -54,10 +54,7 @@ export default function PayCellRow({ title, subtitle, icon, onPress, disabled =
|
|
|
54
54
|
accessibilityLabel={`${title}. ${subtitle}`}
|
|
55
55
|
>
|
|
56
56
|
<View
|
|
57
|
-
style={[
|
|
58
|
-
styles.iconWrap,
|
|
59
|
-
{ backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
|
|
60
|
-
]}
|
|
57
|
+
style={[styles.iconWrap, { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }]}
|
|
61
58
|
>
|
|
62
59
|
<Ionicons name={icon} size={20} color={colors.textSecondary} />
|
|
63
60
|
</View>
|
|
@@ -184,9 +184,7 @@ export function PayCta({
|
|
|
184
184
|
) : (
|
|
185
185
|
<>
|
|
186
186
|
<Ionicons name={icon} size={20} color={enabled ? colors.textOnAccent : colors.textTertiary} />
|
|
187
|
-
<Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>
|
|
188
|
-
{text}
|
|
189
|
-
</Text>
|
|
187
|
+
<Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>{text}</Text>
|
|
190
188
|
</>
|
|
191
189
|
)}
|
|
192
190
|
</PressableScale>
|
|
@@ -28,6 +28,11 @@ export interface RequestHubProps {
|
|
|
28
28
|
onChangeRequestSats: (v: string) => void
|
|
29
29
|
onPick: (method: RequestMethod) => void
|
|
30
30
|
online: boolean
|
|
31
|
+
/**
|
|
32
|
+
* Whether this network has an address rail at all. It needs WhatsOnChain to
|
|
33
|
+
* see payments arrive, and the scaling teratestnet has none. Default true.
|
|
34
|
+
*/
|
|
35
|
+
addressAvailable?: boolean
|
|
31
36
|
/** Held assets; empty means no picker and today's screen. */
|
|
32
37
|
balances?: TokenBalance[]
|
|
33
38
|
/** `null` is BSV. Chosen upstream (Home's coin switcher, or a deep link). */
|
|
@@ -55,6 +60,7 @@ export default function RequestHub({
|
|
|
55
60
|
onChangeRequestSats,
|
|
56
61
|
onPick,
|
|
57
62
|
online,
|
|
63
|
+
addressAvailable = true,
|
|
58
64
|
balances = [],
|
|
59
65
|
selectedAssetId = null,
|
|
60
66
|
assetStatus = null
|
|
@@ -113,14 +119,16 @@ export default function RequestHub({
|
|
|
113
119
|
<PayCellRow
|
|
114
120
|
title={t('pay_method_address')}
|
|
115
121
|
subtitle={
|
|
116
|
-
|
|
117
|
-
? t('
|
|
118
|
-
:
|
|
119
|
-
? t('
|
|
120
|
-
:
|
|
122
|
+
!addressAvailable
|
|
123
|
+
? t('pay_address_unavailable_network')
|
|
124
|
+
: asset
|
|
125
|
+
? t('pay_asset_address_status', { ticker: asset.ticker })
|
|
126
|
+
: online
|
|
127
|
+
? t('pay_cell_address_get_sub')
|
|
128
|
+
: t('pay_offline_needs_internet')
|
|
121
129
|
}
|
|
122
130
|
icon="wallet-outline"
|
|
123
|
-
disabled={!online || !!asset}
|
|
131
|
+
disabled={!addressAvailable || !online || !!asset}
|
|
124
132
|
onPress={() => onPick('get-address')}
|
|
125
133
|
/>
|
|
126
134
|
</View>
|
|
@@ -367,7 +367,7 @@ function UniversalSendInner(
|
|
|
367
367
|
const assetStatus = useAssetStatus(asset?.assetId ?? null).status
|
|
368
368
|
|
|
369
369
|
// Read-only here: the server is configured in Settings › Advanced.
|
|
370
|
-
const { messageBoxUrl } = useMessageBoxConfig(t)
|
|
370
|
+
const { messageBoxUrl } = useMessageBoxConfig(t, selectedNetwork)
|
|
371
371
|
const isConfigured = !!messageBoxUrl && messageBoxUrl !== NO_MESSAGE_BOX
|
|
372
372
|
|
|
373
373
|
/**
|
|
@@ -804,8 +804,14 @@ function UniversalSendInner(
|
|
|
804
804
|
}, [])
|
|
805
805
|
|
|
806
806
|
const peerPayClient = useMemo(
|
|
807
|
-
() =>
|
|
808
|
-
|
|
807
|
+
() =>
|
|
808
|
+
makePeerPayClient({
|
|
809
|
+
wallet: wallet as never,
|
|
810
|
+
messageBoxUrl,
|
|
811
|
+
network: selectedNetwork,
|
|
812
|
+
originator: adminOriginator
|
|
813
|
+
}),
|
|
814
|
+
[messageBoxUrl, wallet, adminOriginator, selectedNetwork]
|
|
809
815
|
)
|
|
810
816
|
|
|
811
817
|
const loadOutbox = useCallback(async () => {
|
|
@@ -825,7 +831,11 @@ function UniversalSendInner(
|
|
|
825
831
|
// XR-051: without this, an unauthenticated resend_request could not be
|
|
826
832
|
// told apart from a legitimate one and would be surfaced (and kept
|
|
827
833
|
// being surfaced) as pending forever.
|
|
828
|
-
await listPendingResendRequests({
|
|
834
|
+
await listPendingResendRequests({
|
|
835
|
+
client,
|
|
836
|
+
storage,
|
|
837
|
+
listPeerPayAction: makeListPeerPayAction(wallet, adminOriginator)
|
|
838
|
+
})
|
|
829
839
|
} catch {
|
|
830
840
|
// Home owns the unanswered-resend banner; a failed poll here is retryable.
|
|
831
841
|
}
|
|
@@ -893,9 +903,14 @@ function UniversalSendInner(
|
|
|
893
903
|
let outcome: PayOutcome = await payIdentity({ direct: viaDirect, messageBox: viaMessageBox, name })
|
|
894
904
|
if (outcome.kind === 'ask_fallback') {
|
|
895
905
|
const prompt = fallbackPrompt(outcome.reason, name)
|
|
906
|
+
// XR-053: accepting this is what sends to a link-named host, so the
|
|
907
|
+
// host is named here, where the payer chooses the message box.
|
|
908
|
+
const message = to.messageBoxUrl
|
|
909
|
+
? `${t(prompt.key, prompt.params)}\n\n${t('direct_pay_fallback_host', { host: to.messageBoxUrl })}`
|
|
910
|
+
: t(prompt.key, prompt.params)
|
|
896
911
|
const choice = await showAlert({
|
|
897
912
|
title: t('direct_pay_fallback_title'),
|
|
898
|
-
message
|
|
913
|
+
message,
|
|
899
914
|
buttons: [
|
|
900
915
|
{ text: t('cancel'), key: 'cancel', style: 'cancel' },
|
|
901
916
|
{ text: t('direct_pay_fallback_send'), key: 'send' }
|
|
@@ -924,7 +939,18 @@ function UniversalSendInner(
|
|
|
924
939
|
statusNote: outcome.kind === 'paid_live' ? t('direct_pay_sent_live') : t('pay_sent_handed_to_wallet')
|
|
925
940
|
})
|
|
926
941
|
},
|
|
927
|
-
[
|
|
942
|
+
[
|
|
943
|
+
peerPayClient,
|
|
944
|
+
storage,
|
|
945
|
+
wallet,
|
|
946
|
+
adminOriginator,
|
|
947
|
+
messageBoxUrl,
|
|
948
|
+
note,
|
|
949
|
+
recipient.selectedIdentity,
|
|
950
|
+
loadOutbox,
|
|
951
|
+
t,
|
|
952
|
+
directPay
|
|
953
|
+
]
|
|
928
954
|
)
|
|
929
955
|
|
|
930
956
|
const sendAddress = useCallback(
|
|
@@ -1114,7 +1140,12 @@ function UniversalSendInner(
|
|
|
1114
1140
|
// of which client is used.
|
|
1115
1141
|
const client =
|
|
1116
1142
|
peerPayClient ??
|
|
1117
|
-
makePeerPayClient({
|
|
1143
|
+
makePeerPayClient({
|
|
1144
|
+
wallet: wallet as never,
|
|
1145
|
+
messageBoxUrl: entry.messageBoxUrl,
|
|
1146
|
+
network: selectedNetwork,
|
|
1147
|
+
originator: adminOriginator
|
|
1148
|
+
})
|
|
1118
1149
|
if (!client || !storage) {
|
|
1119
1150
|
showToast(t('message_box_off_hint'), { type: 'error' })
|
|
1120
1151
|
return
|
|
@@ -1364,21 +1395,36 @@ function UniversalSendInner(
|
|
|
1364
1395
|
? pickedHandle.handle
|
|
1365
1396
|
: abbreviateKey(target.identityKey)
|
|
1366
1397
|
: undefined
|
|
1398
|
+
// Only a positive fact earns a line. A key that is neither a contact nor
|
|
1399
|
+
// registered (a scanned or pasted Identifier) gets nothing: there is no
|
|
1400
|
+
// check the payer could run here, so a warning would only cry wolf.
|
|
1367
1401
|
const reviewTrust = targetIsContact
|
|
1368
|
-
? { icon: 'person-circle-outline',
|
|
1402
|
+
? { icon: 'person-circle-outline', text: t('pay_trust_contact') }
|
|
1369
1403
|
: recipient.selectedIdentity
|
|
1370
|
-
? { icon: 'shield-checkmark-outline',
|
|
1371
|
-
:
|
|
1404
|
+
? { icon: 'shield-checkmark-outline', text: t('pay_trust_handle_attested') }
|
|
1405
|
+
: undefined
|
|
1372
1406
|
const showNoteRow = isHandle || (isAddress && !asset)
|
|
1407
|
+
// How a handle payment will travel. Live first whenever this wallet can pay
|
|
1408
|
+
// live (BSV only; a token send always takes its own rail): the dial goes to the recipient's identity key and never uses a
|
|
1409
|
+
// link-named host, so naming that host here would be untrue.
|
|
1410
|
+
//
|
|
1373
1411
|
// XR-053: a `peerpay:` link's `url` extension silently overrides normal
|
|
1374
1412
|
// recipient-host resolution (the overlay/advertisement lookup) with no
|
|
1375
|
-
// binding to the recipient's identity.
|
|
1376
|
-
//
|
|
1377
|
-
// the
|
|
1378
|
-
//
|
|
1379
|
-
// change out of scope here.
|
|
1413
|
+
// binding to the recipient's identity. That host is only used by the
|
|
1414
|
+
// message box, so it is surfaced wherever the message box is chosen: here
|
|
1415
|
+
// when it is the only route, otherwise in the fallback prompt the payer
|
|
1416
|
+
// must accept (sendHandle). Full closure (a recipient-signed delivery
|
|
1417
|
+
// receipt) is a wire-protocol change out of scope here.
|
|
1380
1418
|
const linkHost = target?.kind === 'handle' ? target.messageBoxUrl : undefined
|
|
1381
|
-
const
|
|
1419
|
+
const reviewRoute =
|
|
1420
|
+
target?.kind !== 'handle'
|
|
1421
|
+
? undefined
|
|
1422
|
+
: directPay.canSendDirect && !asset
|
|
1423
|
+
? { icon: 'flash-outline', text: t('pay_review_route_live') }
|
|
1424
|
+
: linkHost
|
|
1425
|
+
? { icon: 'mail-outline', text: t('pay_review_delivery_host'), host: linkHost }
|
|
1426
|
+
: undefined
|
|
1427
|
+
const showRouteRow = !!reviewRoute
|
|
1382
1428
|
|
|
1383
1429
|
return (
|
|
1384
1430
|
<ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
|
|
@@ -1529,10 +1575,10 @@ function UniversalSendInner(
|
|
|
1529
1575
|
</Text>
|
|
1530
1576
|
)}
|
|
1531
1577
|
</View>
|
|
1532
|
-
{target.kind === 'handle' && (
|
|
1578
|
+
{target.kind === 'handle' && reviewTrust && (
|
|
1533
1579
|
<View style={styles.reviewTrustRow}>
|
|
1534
|
-
<Ionicons name={reviewTrust.icon as never} size={12} color={
|
|
1535
|
-
<Text style={[styles.reviewTrust, { color:
|
|
1580
|
+
<Ionicons name={reviewTrust.icon as never} size={12} color={colors.textSecondary} />
|
|
1581
|
+
<Text style={[styles.reviewTrust, { color: colors.textSecondary }]} numberOfLines={1}>
|
|
1536
1582
|
{reviewTrust.text}
|
|
1537
1583
|
</Text>
|
|
1538
1584
|
</View>
|
|
@@ -1543,7 +1589,7 @@ function UniversalSendInner(
|
|
|
1543
1589
|
<View
|
|
1544
1590
|
style={[
|
|
1545
1591
|
styles.reviewRow,
|
|
1546
|
-
!showNoteRow && !
|
|
1592
|
+
!showNoteRow && !showRouteRow && styles.reviewRowLast,
|
|
1547
1593
|
{ borderBottomColor: colors.separator }
|
|
1548
1594
|
]}
|
|
1549
1595
|
>
|
|
@@ -1569,10 +1615,10 @@ function UniversalSendInner(
|
|
|
1569
1615
|
</View>
|
|
1570
1616
|
</View>
|
|
1571
1617
|
|
|
1572
|
-
{/*
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
{
|
|
1618
|
+
{/* Information, not a warning: the route the payment will take. A
|
|
1619
|
+
link-named host shows here only when the message box is the
|
|
1620
|
+
route (XR-053, see reviewRoute). */}
|
|
1621
|
+
{reviewRoute && (
|
|
1576
1622
|
<View
|
|
1577
1623
|
style={[
|
|
1578
1624
|
styles.reviewRow,
|
|
@@ -1580,9 +1626,15 @@ function UniversalSendInner(
|
|
|
1580
1626
|
{ borderBottomColor: colors.separator }
|
|
1581
1627
|
]}
|
|
1582
1628
|
>
|
|
1583
|
-
<Ionicons name=
|
|
1584
|
-
<Text style={[styles.reviewHostText, { color: colors.
|
|
1585
|
-
{
|
|
1629
|
+
<Ionicons name={reviewRoute.icon as never} size={16} color={colors.textSecondary} />
|
|
1630
|
+
<Text style={[styles.reviewHostText, { color: colors.textSecondary }]} numberOfLines={2}>
|
|
1631
|
+
{reviewRoute.text}
|
|
1632
|
+
{!!reviewRoute.host && (
|
|
1633
|
+
<>
|
|
1634
|
+
{' '}
|
|
1635
|
+
<Text style={{ fontWeight: '600' }}>{reviewRoute.host}</Text>
|
|
1636
|
+
</>
|
|
1637
|
+
)}
|
|
1586
1638
|
</Text>
|
|
1587
1639
|
</View>
|
|
1588
1640
|
)}
|
|
@@ -58,8 +58,7 @@ export function tokenRefusalCopy(code: string, ctx: TokenSendContext): TokenSend
|
|
|
58
58
|
if (has(c, 'recipient', 'allowlist', 'not_allowed', 'blocked', 'registry', 'membership', 'sanction'))
|
|
59
59
|
return { key: 'token_err_refused_recipient', values }
|
|
60
60
|
if (has(c, 'insufficient')) return { key: 'token_err_balance_changed', values }
|
|
61
|
-
if (has(c, 'busy', 'already in flight', 'in flight'))
|
|
62
|
-
return { key: 'token_err_busy', values }
|
|
61
|
+
if (has(c, 'busy', 'already in flight', 'in flight')) return { key: 'token_err_busy', values }
|
|
63
62
|
if (has(c, 'fund', 'insufficient funds', 'not enough satoshis'))
|
|
64
63
|
return { key: 'pay_asset_needs_bsv', values, action: 'get-bsv' }
|
|
65
64
|
return { key: 'token_err_refused', values }
|
|
@@ -17,7 +17,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
|
|
|
17
17
|
import { Keyboard } from 'react-native'
|
|
18
18
|
import { IdentityClient } from '@bsv/sdk'
|
|
19
19
|
import type { DisplayableIdentity } from '@bsv/sdk'
|
|
20
|
-
import { searchIdentities } from '../../resolveIdentity'
|
|
20
|
+
import { identityClientOptions, searchIdentities } from '../../resolveIdentity'
|
|
21
21
|
import {
|
|
22
22
|
classifyRecipientInput,
|
|
23
23
|
classifyScan,
|
|
@@ -98,7 +98,7 @@ export function useRecipientInput({
|
|
|
98
98
|
useEffect(() => {
|
|
99
99
|
if (!wallet) return
|
|
100
100
|
try {
|
|
101
|
-
identityClientRef.current = new IdentityClient(wallet as never,
|
|
101
|
+
identityClientRef.current = new IdentityClient(wallet as never, identityClientOptions(), adminOriginator)
|
|
102
102
|
} catch {
|
|
103
103
|
// Identity search is decorative; a client that will not build leaves the form usable.
|
|
104
104
|
}
|
|
@@ -109,9 +109,7 @@ export default function WalletLockNotice() {
|
|
|
109
109
|
onPress={lost ? onRestore : unlock}
|
|
110
110
|
style={[styles.primary, { backgroundColor: colors.accent }]}
|
|
111
111
|
>
|
|
112
|
-
<Text style={styles.primaryText}>
|
|
113
|
-
{lost ? t('wallet_lost_restore') : t('wallet_unlock_retry')}
|
|
114
|
-
</Text>
|
|
112
|
+
<Text style={styles.primaryText}>{lost ? t('wallet_lost_restore') : t('wallet_unlock_retry')}</Text>
|
|
115
113
|
</PressableScale>
|
|
116
114
|
</View>
|
|
117
115
|
)
|
|
@@ -22,7 +22,7 @@ import Animated, {
|
|
|
22
22
|
useAnimatedStyle,
|
|
23
23
|
withSpring,
|
|
24
24
|
withTiming,
|
|
25
|
-
useReducedMotion
|
|
25
|
+
useReducedMotion
|
|
26
26
|
} from 'react-native-reanimated'
|
|
27
27
|
import { useTheme, spacing, radii, typography, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
|
|
28
28
|
|
|
@@ -95,16 +95,11 @@ export function AlertHost() {
|
|
|
95
95
|
// Reset progress to 0 before animating in to avoid stale values.
|
|
96
96
|
progress.value = 0
|
|
97
97
|
// Fire warning haptic at most once per distinct alert object.
|
|
98
|
-
if (
|
|
99
|
-
current.buttons?.some(b => b.style === 'destructive') &&
|
|
100
|
-
lastHapticAlert.current !== current
|
|
101
|
-
) {
|
|
98
|
+
if (current.buttons?.some(b => b.style === 'destructive') && lastHapticAlert.current !== current) {
|
|
102
99
|
lastHapticAlert.current = current
|
|
103
100
|
haptics.warning()
|
|
104
101
|
}
|
|
105
|
-
progress.value = reducedMotion
|
|
106
|
-
? withTiming(1, { duration: durations.instant })
|
|
107
|
-
: withSpring(1, springs.snappy)
|
|
102
|
+
progress.value = reducedMotion ? withTiming(1, { duration: durations.instant }) : withSpring(1, springs.snappy)
|
|
108
103
|
}
|
|
109
104
|
}, [current, progress, reducedMotion])
|
|
110
105
|
|
|
@@ -120,28 +115,34 @@ export function AlertHost() {
|
|
|
120
115
|
done.alert.resolve(done.key)
|
|
121
116
|
}, [])
|
|
122
117
|
|
|
123
|
-
const dismiss = useCallback(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
118
|
+
const dismiss = useCallback(
|
|
119
|
+
(key: string) => {
|
|
120
|
+
if (!current || exiting.current) return
|
|
121
|
+
exiting.current = true
|
|
122
|
+
pending.current = { alert: current, key, fallback: setTimeout(finish, durations.instant + DISMISS_FALLBACK_MS) }
|
|
123
|
+
progress.value = withTiming(0, { duration: durations.instant })
|
|
124
|
+
// After the exit fade, hide the modal. iOS reports the native dismissal
|
|
125
|
+
// through onDismiss; Android has no such event and nothing presented over
|
|
126
|
+
// it to protect, so it finishes here.
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
if (Platform.OS === 'ios') setHiding(true)
|
|
129
|
+
else finish()
|
|
130
|
+
}, durations.instant)
|
|
131
|
+
},
|
|
132
|
+
[current, progress, finish]
|
|
133
|
+
)
|
|
136
134
|
|
|
137
|
-
useEffect(
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
useEffect(
|
|
136
|
+
() => () => {
|
|
137
|
+
if (pending.current) clearTimeout(pending.current.fallback)
|
|
138
|
+
},
|
|
139
|
+
[]
|
|
140
|
+
)
|
|
140
141
|
|
|
141
142
|
const backdropStyle = useAnimatedStyle(() => ({ opacity: progress.value }))
|
|
142
143
|
const cardStyle = useAnimatedStyle(() => ({
|
|
143
144
|
opacity: progress.value,
|
|
144
|
-
transform: [{ scale: 0.95 + 0.05 * progress.value }]
|
|
145
|
+
transform: [{ scale: 0.95 + 0.05 * progress.value }]
|
|
145
146
|
}))
|
|
146
147
|
|
|
147
148
|
if (!current) return null
|
|
@@ -149,9 +150,7 @@ export function AlertHost() {
|
|
|
149
150
|
const sideBySide = buttons.length === 2
|
|
150
151
|
|
|
151
152
|
const buttonColor = (b: AlertButton) =>
|
|
152
|
-
b.style === 'destructive' ? colors.error
|
|
153
|
-
: b.style === 'cancel' ? colors.textSecondary
|
|
154
|
-
: colors.info
|
|
153
|
+
b.style === 'destructive' ? colors.error : b.style === 'cancel' ? colors.textSecondary : colors.info
|
|
155
154
|
|
|
156
155
|
return (
|
|
157
156
|
<Modal
|
|
@@ -166,17 +165,15 @@ export function AlertHost() {
|
|
|
166
165
|
<Animated.View style={[styles.backdrop, { backgroundColor: colors.scrim }, backdropStyle]}>
|
|
167
166
|
<Pressable style={StyleSheet.absoluteFill} onPress={() => dismiss('cancel')} />
|
|
168
167
|
<Animated.View
|
|
169
|
-
style={[
|
|
170
|
-
styles.card,
|
|
171
|
-
{ backgroundColor: colors.sheetBackground, borderColor: colors.separator },
|
|
172
|
-
cardStyle,
|
|
173
|
-
]}
|
|
168
|
+
style={[styles.card, { backgroundColor: colors.sheetBackground, borderColor: colors.separator }, cardStyle]}
|
|
174
169
|
>
|
|
175
170
|
<Text style={[styles.title, { color: colors.textPrimary }]}>{current.title}</Text>
|
|
176
171
|
{!!current.message && (
|
|
177
172
|
<Text style={[styles.message, { color: colors.textSecondary }]}>{current.message}</Text>
|
|
178
173
|
)}
|
|
179
|
-
<View
|
|
174
|
+
<View
|
|
175
|
+
style={[styles.buttonGroup, { borderTopColor: colors.separator }, !sideBySide && styles.buttonGroupStacked]}
|
|
176
|
+
>
|
|
180
177
|
{buttons.map((b, i) => (
|
|
181
178
|
<Pressable
|
|
182
179
|
key={b.key ?? b.text}
|
|
@@ -187,9 +184,11 @@ export function AlertHost() {
|
|
|
187
184
|
// resolves to a zero flex-basis and clips the label against
|
|
188
185
|
// minHeight, so stacked buttons size to their content instead.
|
|
189
186
|
sideBySide && styles.buttonRowItem,
|
|
190
|
-
sideBySide &&
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
sideBySide &&
|
|
188
|
+
i > 0 && { borderLeftWidth: StyleSheet.hairlineWidth, borderLeftColor: colors.separator },
|
|
189
|
+
!sideBySide &&
|
|
190
|
+
i > 0 && { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: colors.separator },
|
|
191
|
+
pressed && { backgroundColor: colors.fillTertiary }
|
|
193
192
|
]}
|
|
194
193
|
accessibilityRole="button"
|
|
195
194
|
>
|
|
@@ -197,7 +196,7 @@ export function AlertHost() {
|
|
|
197
196
|
style={[
|
|
198
197
|
styles.buttonText,
|
|
199
198
|
{ color: buttonColor(b) },
|
|
200
|
-
(b.style === 'destructive' || b.style === 'cancel') && styles.buttonTextBold
|
|
199
|
+
(b.style === 'destructive' || b.style === 'cancel') && styles.buttonTextBold
|
|
201
200
|
]}
|
|
202
201
|
>
|
|
203
202
|
{b.text}
|
|
@@ -215,30 +214,30 @@ const styles = StyleSheet.create({
|
|
|
215
214
|
backdrop: {
|
|
216
215
|
flex: 1,
|
|
217
216
|
alignItems: 'center',
|
|
218
|
-
justifyContent: 'center'
|
|
217
|
+
justifyContent: 'center'
|
|
219
218
|
},
|
|
220
219
|
card: {
|
|
221
220
|
width: 280,
|
|
222
221
|
borderRadius: radii.xl,
|
|
223
222
|
borderWidth: StyleSheet.hairlineWidth,
|
|
224
223
|
overflow: 'hidden',
|
|
225
|
-
paddingTop: spacing.xl
|
|
224
|
+
paddingTop: spacing.xl
|
|
226
225
|
},
|
|
227
226
|
title: {
|
|
228
227
|
...typography.headline,
|
|
229
228
|
textAlign: 'center',
|
|
230
|
-
paddingHorizontal: spacing.xl
|
|
229
|
+
paddingHorizontal: spacing.xl
|
|
231
230
|
},
|
|
232
231
|
message: {
|
|
233
232
|
...typography.footnote,
|
|
234
233
|
textAlign: 'center',
|
|
235
234
|
paddingHorizontal: spacing.xl,
|
|
236
|
-
marginTop: spacing.xs
|
|
235
|
+
marginTop: spacing.xs
|
|
237
236
|
},
|
|
238
237
|
buttonGroup: {
|
|
239
238
|
flexDirection: 'row',
|
|
240
239
|
marginTop: spacing.lg,
|
|
241
|
-
borderTopWidth: StyleSheet.hairlineWidth
|
|
240
|
+
borderTopWidth: StyleSheet.hairlineWidth
|
|
242
241
|
},
|
|
243
242
|
buttonGroupStacked: { flexDirection: 'column' },
|
|
244
243
|
button: {
|
|
@@ -248,9 +247,9 @@ const styles = StyleSheet.create({
|
|
|
248
247
|
paddingVertical: spacing.md,
|
|
249
248
|
// Keep long labels off the card edge / hairline divider so they wrap
|
|
250
249
|
// inside the button instead of touching (or escaping) the border.
|
|
251
|
-
paddingHorizontal: spacing.sm
|
|
250
|
+
paddingHorizontal: spacing.sm
|
|
252
251
|
},
|
|
253
252
|
buttonRowItem: { flex: 1 },
|
|
254
253
|
buttonText: { ...typography.body, textAlign: 'center' },
|
|
255
|
-
buttonTextBold: { fontWeight: '600' }
|
|
254
|
+
buttonTextBold: { fontWeight: '600' }
|
|
256
255
|
})
|
|
@@ -31,12 +31,7 @@ function loadBlurView(): BlurViewComponent {
|
|
|
31
31
|
* Translucent wrapper using expo-blur on iOS, solid fallback on Android.
|
|
32
32
|
* Used for toolbar chrome and floating glass pill fallbacks.
|
|
33
33
|
*/
|
|
34
|
-
export const BlurChrome: React.FC<BlurChromeProps> = ({
|
|
35
|
-
children,
|
|
36
|
-
intensity = 80,
|
|
37
|
-
borderRadius = 0,
|
|
38
|
-
style
|
|
39
|
-
}) => {
|
|
34
|
+
export const BlurChrome: React.FC<BlurChromeProps> = ({ children, intensity = 80, borderRadius = 0, style }) => {
|
|
40
35
|
const { isDark, colors } = useTheme()
|
|
41
36
|
|
|
42
37
|
if (Platform.OS === 'ios') {
|
|
@@ -53,13 +48,7 @@ export const BlurChrome: React.FC<BlurChromeProps> = ({
|
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
return (
|
|
56
|
-
<View
|
|
57
|
-
style={[
|
|
58
|
-
styles.container,
|
|
59
|
-
{ borderRadius, backgroundColor: colors.chromeBackground },
|
|
60
|
-
style
|
|
61
|
-
]}
|
|
62
|
-
>
|
|
51
|
+
<View style={[styles.container, { borderRadius, backgroundColor: colors.chromeBackground }, style]}>
|
|
63
52
|
{children}
|
|
64
53
|
</View>
|
|
65
54
|
)
|
|
@@ -67,6 +56,6 @@ export const BlurChrome: React.FC<BlurChromeProps> = ({
|
|
|
67
56
|
|
|
68
57
|
const styles = StyleSheet.create({
|
|
69
58
|
container: {
|
|
70
|
-
overflow: 'hidden'
|
|
71
|
-
}
|
|
59
|
+
overflow: 'hidden'
|
|
60
|
+
}
|
|
72
61
|
})
|
|
@@ -13,7 +13,7 @@ import Animated, {
|
|
|
13
13
|
withSpring,
|
|
14
14
|
withTiming,
|
|
15
15
|
withDelay,
|
|
16
|
-
useReducedMotion
|
|
16
|
+
useReducedMotion
|
|
17
17
|
} from 'react-native-reanimated'
|
|
18
18
|
import { useTheme, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
|
|
19
19
|
|
|
@@ -54,7 +54,7 @@ export default function Celebration({ size = 88, onDone }: CelebrationProps) {
|
|
|
54
54
|
|
|
55
55
|
const circleStyle = useAnimatedStyle(() => ({
|
|
56
56
|
opacity: opacity.value,
|
|
57
|
-
transform: [{ scale: scale.value }]
|
|
57
|
+
transform: [{ scale: scale.value }]
|
|
58
58
|
}))
|
|
59
59
|
const pathProps = useAnimatedProps(() => ({ strokeDashoffset: draw.value }))
|
|
60
60
|
|
|
@@ -80,5 +80,5 @@ export default function Celebration({ size = 88, onDone }: CelebrationProps) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const styles = StyleSheet.create({
|
|
83
|
-
center: { alignItems: 'center', justifyContent: 'center' }
|
|
83
|
+
center: { alignItems: 'center', justifyContent: 'center' }
|
|
84
84
|
})
|
|
@@ -28,9 +28,7 @@ export async function showChoiceSheet(args: {
|
|
|
28
28
|
const ordered = choiceSheetOrder(args.options, cancelKey)
|
|
29
29
|
const labelFor = (key: string) =>
|
|
30
30
|
key === cancelKey ? cancelLabel : (args.options.find(o => o.key === key)?.label ?? key)
|
|
31
|
-
const destructiveIndexes = ordered.flatMap((o, i) =>
|
|
32
|
-
'destructive' in o && o.destructive ? [i] : []
|
|
33
|
-
)
|
|
31
|
+
const destructiveIndexes = ordered.flatMap((o, i) => ('destructive' in o && o.destructive ? [i] : []))
|
|
34
32
|
|
|
35
33
|
if (Platform.OS === 'ios') {
|
|
36
34
|
return new Promise(resolve => {
|
|
@@ -63,9 +63,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
63
63
|
<ScrollView style={styles.scrollView} contentContainerStyle={styles.contentContainer}>
|
|
64
64
|
<Text style={styles.title}>⚠️ Something went wrong</Text>
|
|
65
65
|
|
|
66
|
-
<Text style={styles.message}>
|
|
67
|
-
The app encountered an unexpected error. Please try restarting.
|
|
68
|
-
</Text>
|
|
66
|
+
<Text style={styles.message}>The app encountered an unexpected error. Please try restarting.</Text>
|
|
69
67
|
|
|
70
68
|
{this.state.error && (
|
|
71
69
|
<View style={styles.errorBox}>
|
|
@@ -77,9 +75,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
77
75
|
{this.state.errorInfo && (
|
|
78
76
|
<View style={styles.errorBox}>
|
|
79
77
|
<Text style={styles.errorTitle}>Stack Trace:</Text>
|
|
80
|
-
<Text style={styles.errorText}>
|
|
81
|
-
{this.state.errorInfo.componentStack}
|
|
82
|
-
</Text>
|
|
78
|
+
<Text style={styles.errorText}>{this.state.errorInfo.componentStack}</Text>
|
|
83
79
|
</View>
|
|
84
80
|
)}
|
|
85
81
|
|