@bsv/expo-wallet-toolbox 0.5.0 → 0.9.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 +2000 -0
- package/README.md +66 -1
- package/core/amountFormatHelpers.ts +258 -36
- package/core/backup/RemoteSyncReader.ts +133 -24
- package/core/backup/appData.ts +157 -0
- package/core/backup/client.ts +15 -1
- package/core/backup/codec.ts +149 -11
- package/core/backup/constants.ts +30 -1
- package/core/backup/cursor.ts +31 -2
- package/core/backup/push.ts +71 -5
- package/core/backup/restore.ts +104 -16
- package/core/backup/restoreOnImport.ts +94 -30
- package/core/backup/status.ts +13 -8
- package/core/config.tsx +12 -5
- package/core/constants.ts +14 -1
- package/core/contacts/contactActivity.ts +153 -0
- package/core/contacts/contactCache.ts +41 -0
- package/core/contacts/contactsStore.ts +183 -0
- package/core/context/ExchangeRateContext.tsx +34 -27
- package/core/context/LocalStorageProvider.tsx +43 -40
- package/core/context/UserContext.tsx +18 -7
- package/core/context/VaultContext.tsx +49 -2
- package/core/context/WalletConnectionContext.tsx +203 -11
- package/core/context/WalletContext.tsx +685 -171
- package/core/demo/demoAssets.ts +60 -0
- package/core/demo/demoLedger.ts +240 -0
- package/core/demo/demoMandalaRuntime.ts +96 -0
- package/core/demo/demoMode.ts +38 -0
- package/core/demo/demoWallet.ts +25 -0
- package/core/demo/index.ts +26 -0
- package/core/demo/useDemo.ts +59 -0
- package/core/headers/OfflineFirstChaintracks.ts +99 -17
- package/core/headers/headerStore.ts +33 -14
- package/core/headers/syncHeaders.ts +12 -1
- package/core/i18n/translations.tsx +2186 -98
- package/core/identity/contactLink.ts +36 -0
- package/core/identity/handleRegistry/client.ts +314 -0
- package/core/identity/handleRegistry/keyPinStore.ts +70 -0
- package/core/identity/handleRegistry/profileCert.ts +254 -0
- package/core/identity/handleRegistry/registration.ts +559 -0
- package/core/identity/handleRegistry/resolver.ts +315 -0
- package/core/identity/handleRegistry/rules.ts +104 -0
- package/core/index.ts +53 -5
- package/core/localpay/build.ts +225 -24
- package/core/localpay/pending.ts +110 -7
- package/core/localpay/pendingAbortAuthority.ts +95 -0
- package/core/localpay/pendingAborts.ts +266 -26
- package/core/localpay/session.ts +42 -17
- package/core/localpay/settlementAck.ts +10 -1
- package/core/localpay/transport/socket.ts +52 -3
- package/core/localpay/verify.ts +100 -10
- package/core/mandala/abortGuard.ts +96 -20
- package/core/mandala/createRuntime.ts +206 -33
- package/core/mandala/drain.ts +89 -11
- package/core/mandala/inboxPrehold.ts +186 -0
- package/core/mandala/permissionModule.ts +202 -20
- package/core/mandala/settlementStore.ts +24 -2
- package/core/mandala/types.ts +40 -5
- package/core/monitor/MonitorSupervisor.ts +121 -0
- package/core/monitor/TaskBackupPush.ts +15 -1
- package/core/monitor/TaskCreditInbox.ts +1 -1
- package/core/monitor/TaskDrainOutbox.ts +15 -1
- package/core/monitor/TaskSendOffline.ts +15 -1
- package/core/net/online.ts +49 -0
- package/core/net/publicDestination.ts +91 -0
- package/core/net/validateArcUrl.ts +22 -0
- package/core/numberFormat.ts +19 -0
- package/core/offline/cancelParked.ts +134 -13
- package/core/offline/payerHold.ts +100 -24
- package/core/offline/plan.ts +37 -8
- package/core/pay/beefRepair.ts +6 -2
- package/core/pay/damagedInbox.ts +24 -0
- package/core/pay/rails/address.ts +107 -12
- package/core/pay/rails/handle.ts +117 -22
- package/core/pay/rails/index.ts +45 -7
- package/core/pay/rails/nativeIntent.ts +61 -0
- package/core/pay/receiveHistory.ts +93 -0
- package/core/pay/recordProof.ts +21 -7
- package/core/pay/refreshProofGuard.ts +42 -1
- package/core/pay/watchlist.ts +5 -2
- package/core/peerpay/control.ts +17 -18
- package/core/peerpay/handleResendRequests.ts +58 -4
- package/core/peerpay/outbox.ts +3 -1
- package/core/recovery/backupMaterial.ts +61 -0
- package/core/recovery/createWallet.ts +95 -0
- package/core/recovery/recoverWallet.ts +120 -0
- package/core/recovery/restoreWallet.ts +170 -0
- package/core/recovery/secret.ts +92 -0
- package/core/recovery/shareCollector.ts +71 -0
- package/core/recovery/shareParsing.ts +87 -0
- package/core/recovery/shares.ts +116 -0
- package/core/recovery/useRecoveryDeps.ts +70 -0
- package/core/services/arcTokenStorage.ts +52 -0
- package/core/services/arcadeBroadcastProvider.ts +233 -52
- package/core/services/autoApprovePolicy.ts +105 -0
- package/core/services/callbackToken.ts +19 -0
- package/core/services/capWalletArgs.ts +14 -2
- package/core/services/connectionAuthority.ts +98 -0
- package/core/services/exchangeRate.ts +36 -13
- package/core/services/externalOrigin.ts +16 -2
- package/core/services/secrets/kek.ts +126 -29
- package/core/services/secrets/migration.ts +16 -4
- package/core/services/secrets/store.ts +42 -14
- package/core/services/vault/VaultKeyService.ts +228 -45
- package/core/services/vault/chainRecovery.ts +483 -0
- package/core/services/vault/driver.ts +9 -1
- package/core/services/vault/enrolledSerialRegistry.ts +150 -0
- package/core/services/vault/guard.ts +218 -32
- package/core/services/vault/hardwareLease.ts +19 -0
- package/core/services/vault/metaAuthority.ts +210 -0
- package/core/services/vault/pivReset.ts +64 -23
- package/core/services/vault/r1comb.ts +139 -3
- package/core/services/vault/session.ts +25 -4
- package/core/services/vault/transfers.ts +868 -172
- package/core/services/vault/types.ts +19 -4
- package/core/services/vault/vaultStore.ts +256 -29
- package/core/services/walletArgLimits.ts +45 -2
- package/core/services/walletConnectionValidation.ts +76 -6
- package/core/services/walletServiceConfig.ts +40 -27
- package/core/storage/StorageExpoSQLite.ts +88 -47
- package/core/storage/methods/findSql.ts +24 -2
- package/core/storage/methods/listActionsSql.ts +8 -5
- package/core/storage/methods/listOutputsSql.ts +2 -2
- package/core/storage/methods/offlineActions.ts +10 -1
- package/core/storage/methods/processOfflineActions.ts +117 -25
- package/core/storage/methods/reviewStatusSql.ts +7 -2
- package/core/storage/schema/createTables.ts +155 -2
- package/core/stores/ConnectionStore.ts +34 -0
- package/core/toolboxConfig.ts +104 -0
- package/core/toolboxTypes.ts +40 -0
- package/core/userAvatar.ts +79 -0
- package/core/walletDbRegistry.ts +63 -0
- package/core/walletMonitor.ts +25 -4
- package/core/walletRepair/releaseStuckReservations.ts +72 -0
- package/core/walletRepair/shouldMarkUnspendable.ts +20 -0
- package/core/walletRepair/spenderConsumesOutpoint.ts +29 -0
- package/package.json +7 -7
- package/ui/activityFilter.ts +115 -0
- package/ui/backupShares.ts +26 -169
- package/ui/components/pay/AddressReceive.tsx +13 -6
- package/ui/components/pay/AssetPicker.tsx +30 -9
- package/ui/components/pay/MessageBoxConfig.tsx +16 -0
- package/ui/components/pay/NearbyFlow.tsx +480 -243
- package/ui/components/pay/PaymentSuccessOverlay.tsx +85 -10
- package/ui/components/pay/RecipientField.tsx +84 -70
- package/ui/components/pay/StepBar.tsx +32 -0
- package/ui/components/pay/UniversalSend.tsx +827 -205
- package/ui/components/ui/AlertCard.tsx +38 -5
- package/ui/components/ui/PencilEditField.tsx +109 -0
- package/ui/components/ui/PermissionSheet.tsx +197 -66
- package/ui/components/ui/SlideOverFromRight.tsx +86 -0
- package/ui/components/vault/EnrollWizard.tsx +61 -13
- package/ui/components/vault/vaultErrorCopy.ts +3 -1
- package/ui/components/wallet/ActivityRow.tsx +227 -123
- package/ui/components/wallet/AmountInput.tsx +26 -8
- package/ui/components/wallet/AssetSwitcherDropdown.tsx +22 -2
- package/ui/components/wallet/Balance.tsx +42 -23
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +16 -3
- package/ui/components/wallet/ContactActivityList.tsx +149 -0
- package/ui/components/wallet/ContactSigil.tsx +49 -0
- package/ui/components/wallet/EditPictureSheet.tsx +99 -0
- package/ui/components/wallet/FitAmount.tsx +148 -0
- package/ui/components/wallet/IconPickerSheet.tsx +168 -0
- package/ui/components/wallet/IdentifierRow.tsx +69 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +35 -13
- package/ui/components/wallet/ProfileButton.tsx +62 -0
- package/ui/components/wallet/UserAvatar.tsx +85 -0
- package/ui/components/wallet/avatarIcons.ts +122 -0
- package/ui/exportTransactions.ts +36 -4
- package/ui/hooks/useContactsStore.ts +10 -0
- package/ui/hooks/useExportWalletData.ts +25 -2
- package/ui/hooks/useMandala.ts +18 -1
- package/ui/hooks/useOnline.ts +65 -20
- package/ui/importDatabases.ts +339 -24
- package/ui/index.ts +33 -2
- package/ui/isImageUrl.ts +6 -0
- package/ui/printRecoveryShares.ts +9 -10
- package/ui/recoveryPrompts.ts +91 -0
- package/ui/resolveIdentity.ts +31 -9
- package/ui/screens/ConnectionsScreen.tsx +86 -19
- package/ui/screens/ContactScreen.tsx +289 -0
- package/ui/screens/ContactsScreen.tsx +373 -0
- package/ui/screens/IdentifierScreen.tsx +256 -0
- package/ui/screens/NewContactScreen.tsx +362 -0
- package/ui/screens/PairScreen.tsx +74 -2
- package/ui/screens/PayScreen.tsx +20 -7
- package/ui/screens/ProfileScreen.tsx +783 -0
- package/ui/screens/SettingsScreen.tsx +10 -4
- package/ui/screens/TransactionDetailScreen.tsx +419 -0
- package/ui/screens/TrustScreen.tsx +100 -5
- package/ui/screens/VaultScreen.tsx +410 -61
- package/ui/screens/VaultTransferScreen.tsx +59 -7
- package/ui/screens/WalletCheckScreen.tsx +17 -6
- package/ui/screens/WalletConfigScreen.tsx +124 -28
- package/ui/screens/WalletHomeScreen.tsx +640 -104
- package/ui/screens/detailActionKeys.ts +55 -0
- package/ui/tokenFormat.ts +44 -4
- package/ui/tokenStatus.ts +21 -0
- package/ui/txStatus.ts +48 -5
- package/core/storage/LocalStorageAdapter.ts +0 -58
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
* the screen is a shallow gradient with cards lifted off it, which is what makes
|
|
18
18
|
* the balance read as the focal point in both appearances.
|
|
19
19
|
*/
|
|
20
|
-
import React, { useState, useEffect, useCallback, useRef, useMemo, useContext } from 'react'
|
|
20
|
+
import React, { useState, useEffect, useCallback, useRef, useMemo, useContext, useDeferredValue } from 'react'
|
|
21
21
|
import {
|
|
22
22
|
View,
|
|
23
23
|
Text,
|
|
24
24
|
FlatList,
|
|
25
|
+
ScrollView,
|
|
25
26
|
StyleSheet,
|
|
27
|
+
TextInput,
|
|
26
28
|
TouchableOpacity,
|
|
27
29
|
ActivityIndicator,
|
|
28
30
|
Linking,
|
|
@@ -42,8 +44,7 @@ import {
|
|
|
42
44
|
useWallet,
|
|
43
45
|
ExchangeRateContext,
|
|
44
46
|
formatAmountParts,
|
|
45
|
-
|
|
46
|
-
formatSatoshisAsBsvDecimal,
|
|
47
|
+
isFiatCurrency,
|
|
47
48
|
findOfflineActions,
|
|
48
49
|
type OfflineActionRow,
|
|
49
50
|
TaskSendOffline,
|
|
@@ -69,16 +70,27 @@ import {
|
|
|
69
70
|
retryDelivery,
|
|
70
71
|
makePeerPayClient,
|
|
71
72
|
isMessageBoxNetworkError,
|
|
73
|
+
isAbortSafe,
|
|
72
74
|
generateMnemonicWallet,
|
|
73
75
|
backupAttestation,
|
|
74
76
|
isVaultAvailable,
|
|
77
|
+
useVault,
|
|
78
|
+
resolveProvisioningPolicy,
|
|
75
79
|
type PendingResend
|
|
76
80
|
} from '@bsv/expo-wallet-toolbox'
|
|
77
81
|
import ActivityRow, { type ActivityAction } from '../components/wallet/ActivityRow'
|
|
82
|
+
import { FitAmount } from '../components/wallet/FitAmount'
|
|
83
|
+
import SlideOverFromRight from '../components/ui/SlideOverFromRight'
|
|
84
|
+
import TransactionDetailScreen, {
|
|
85
|
+
type TransactionAction,
|
|
86
|
+
type TransactionDetailParams
|
|
87
|
+
} from './TransactionDetailScreen'
|
|
88
|
+
import { useContactsStore } from '../hooks/useContactsStore'
|
|
78
89
|
import { BackupReminderSheet } from '../components/wallet/BackupReminderSheet'
|
|
79
90
|
import { BiometricAdvisoryModal } from '../components/wallet/BiometricAdvisoryModal'
|
|
80
91
|
import { ImportFromBackupPrompt } from '../components/wallet/ImportFromBackupPrompt'
|
|
81
|
-
import { cancelParkedPayment, type CancelParkedWallet } from '../../core/offline/cancelParked'
|
|
92
|
+
import { cancelParkedPayment, runCancelParkedFlow, type CancelParkedWallet } from '../../core/offline/cancelParked'
|
|
93
|
+
import { detailActionKeysFor } from './detailActionKeys'
|
|
82
94
|
import { releaseParkedPayment } from '../../core/offline/payerHold'
|
|
83
95
|
import { partitionQueueByGrace } from '../../core/offline/queueGrace'
|
|
84
96
|
import { storageMatchesNetwork } from '../../core/net/chainMatch'
|
|
@@ -89,14 +101,25 @@ import { tokenRowTitle } from './tokenRowTitle'
|
|
|
89
101
|
import { useMandala, useMandalaRuntime, useTokenActivity, tokenActivityByTxid } from '../hooks/useMandala'
|
|
90
102
|
import { announceEviction, evictionsFrom } from '../components/wallet/tokenEviction'
|
|
91
103
|
import { SEEN_EVICTIONS_KEY, useSeenSet } from '../tokenSeen'
|
|
92
|
-
import {
|
|
104
|
+
import { tokenRowStatusView } from '../tokenStatus'
|
|
93
105
|
import { formatTokenAmount, tokenAmountParts } from '../tokenFormat'
|
|
94
106
|
import AssetSwitcherDropdown, { BSV_LABEL } from '../components/wallet/AssetSwitcherDropdown'
|
|
95
107
|
import { exportTransactionsAsCsv } from '../exportTransactions'
|
|
108
|
+
import {
|
|
109
|
+
ACTIVITY_KIND_FILTERS,
|
|
110
|
+
contactNamesByKey,
|
|
111
|
+
isActivityFilterActive,
|
|
112
|
+
kindFilterLabelKey,
|
|
113
|
+
matchesActivity,
|
|
114
|
+
searchTerms,
|
|
115
|
+
type ActivityKindFilter,
|
|
116
|
+
type ContactNames
|
|
117
|
+
} from '../activityFilter'
|
|
96
118
|
import PressableScale from '../components/ui/PressableScale'
|
|
97
119
|
import ScreenGradient from '../components/ui/ScreenGradient'
|
|
98
120
|
import ScrollFade, { sampleScreenGradient } from '../components/ui/ScrollFade'
|
|
99
121
|
import { showToast } from '../components/ui/Toast'
|
|
122
|
+
import { showAlert } from '../components/ui/AlertCard'
|
|
100
123
|
import { ListRow } from '../components/ui/ListRow'
|
|
101
124
|
import { GroupedSection } from '../components/ui/GroupedList'
|
|
102
125
|
import WalletLockNotice from '../components/security/WalletLockNotice'
|
|
@@ -119,6 +142,22 @@ async function readMessageBoxUrl(): Promise<string | undefined> {
|
|
|
119
142
|
* pattern as this package's other native-module-boundary fixes (expo-router,
|
|
120
143
|
* expo-blur).
|
|
121
144
|
*/
|
|
145
|
+
/**
|
|
146
|
+
* Demo mode, or inert constants in anything but a dev bundle.
|
|
147
|
+
*
|
|
148
|
+
* Required at module scope behind `__DEV__` so the demo folder reaches only a
|
|
149
|
+
* dev bundle — a release build inlines `__DEV__` as false and folds the
|
|
150
|
+
* require and everything under it out. Same pattern as
|
|
151
|
+
* `utils/AgentationGate.tsx`. `useDemoLedgerVersion` is a hook, so it is
|
|
152
|
+
* called unconditionally below and its identity must never change.
|
|
153
|
+
*/
|
|
154
|
+
type DemoModule = typeof import('../../core/demo')
|
|
155
|
+
const demoMod: DemoModule | null = __DEV__
|
|
156
|
+
? // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
157
|
+
(require('../../core/demo') as DemoModule)
|
|
158
|
+
: null
|
|
159
|
+
const useDemoLedgerVersion: () => number = demoMod ? demoMod.useDemoLedgerVersion : () => 0
|
|
160
|
+
|
|
122
161
|
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
123
162
|
type MaterialCommunityIconsComponent = typeof import('@expo/vector-icons').MaterialCommunityIcons
|
|
124
163
|
let ioniconsComponent: IoniconsComponent | undefined
|
|
@@ -236,6 +275,9 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
236
275
|
const insets = useSafeAreaInsets()
|
|
237
276
|
const { router, useFocusEffect } = loadExpoRouter()
|
|
238
277
|
const Ionicons = loadIonicons()
|
|
278
|
+
// Repaints the screen on every demo write; 0 and no-op in a release bundle.
|
|
279
|
+
useDemoLedgerVersion()
|
|
280
|
+
const demoOn = demoMod?.isDemoModeEnabled() ?? false
|
|
239
281
|
const MaterialCommunityIcons = loadMaterialCommunityIcons()
|
|
240
282
|
const {
|
|
241
283
|
managers,
|
|
@@ -251,9 +293,40 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
251
293
|
buildWalletFromMnemonic,
|
|
252
294
|
mandalaSettlement
|
|
253
295
|
} = useWallet()
|
|
296
|
+
// F-07: an existing, already-funded vault stays reachable even when
|
|
297
|
+
// isVaultAvailable is off (flag or off-mainnet) — see the Vault
|
|
298
|
+
// destination's condition below.
|
|
299
|
+
const { hasVaultMeta } = useVault()
|
|
254
300
|
const { createMnemonic, hasStoredIdentity, secretsReady } = useLocalStorage()
|
|
255
301
|
const { satoshisPerUSD, usdToFiat = {} } = useContext(ExchangeRateContext)
|
|
256
302
|
const currency = settings?.currency || 'BSV'
|
|
303
|
+
/**
|
|
304
|
+
* Tapping the balance flips which denomination the hero figure is in.
|
|
305
|
+
*
|
|
306
|
+
* View state, not a setting: the display-currency setting chooses WHICH
|
|
307
|
+
* fiat this wallet speaks, and a tap on the figure should not silently
|
|
308
|
+
* rewrite a stored preference that also governs every activity row. Resets
|
|
309
|
+
* to the setting's own answer on relaunch.
|
|
310
|
+
*/
|
|
311
|
+
const [flipped, setFlipped] = useState(false)
|
|
312
|
+
/** The row whose detail view is open, or null. Holds the ACTION, so the
|
|
313
|
+
* detail view keeps drawing the row it was opened from even if a refresh
|
|
314
|
+
* reorders the list underneath it. */
|
|
315
|
+
const [openTx, setOpenTx] = useState<ActivityAction | null>(null)
|
|
316
|
+
/** The row still being drawn while the detail view slides back out. */
|
|
317
|
+
const [closedTx, setClosedTx] = useState<ActivityAction | null>(null)
|
|
318
|
+
// Render-phase adjustment rather than an effect: the outgoing surface must
|
|
319
|
+
// already have its content on the frame the close starts.
|
|
320
|
+
if (openTx && openTx !== closedTx) setClosedTx(openTx)
|
|
321
|
+
/** The setting's opposite: BSV when it names a fiat, else the default fiat. */
|
|
322
|
+
const displayCurrency = useMemo(() => {
|
|
323
|
+
if (!flipped) return currency
|
|
324
|
+
return isFiatCurrency(currency) ? 'BSV' : 'USD'
|
|
325
|
+
}, [flipped, currency])
|
|
326
|
+
// Built once here and passed down to every row (with `walletUserId`) so an
|
|
327
|
+
// expanded row's tappable-contact check never has to call `useWallet()`
|
|
328
|
+
// itself — the whole reason `ActivityRow` takes `currency` as a prop too.
|
|
329
|
+
const contactsStore = useContactsStore()
|
|
257
330
|
const online = useOnline()
|
|
258
331
|
// For the token Resend below. Read here rather than off `useMandala()` (which
|
|
259
332
|
// mounts further down) so the handler can close over it without a
|
|
@@ -322,6 +395,10 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
322
395
|
const [pendingDestination, setPendingDestination] = useState<string | null>(null)
|
|
323
396
|
const [showBiometricAdvisory, setShowBiometricAdvisory] = useState(false)
|
|
324
397
|
const [creatingWalletFromAdvisory, setCreatingWalletFromAdvisory] = useState(false)
|
|
398
|
+
// XR-114: whether provisioning would actually land on a disclosed
|
|
399
|
+
// (non-biometric) policy for this device/build, so the advisory below
|
|
400
|
+
// never promises Face ID/fingerprint protection it will not deliver.
|
|
401
|
+
const [advisoryDegraded, setAdvisoryDegraded] = useState(false)
|
|
325
402
|
|
|
326
403
|
const destinationPress = useCallback(
|
|
327
404
|
async (destination: string) => {
|
|
@@ -335,6 +412,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
335
412
|
} catch {
|
|
336
413
|
return
|
|
337
414
|
}
|
|
415
|
+
setAdvisoryDegraded((await resolveProvisioningPolicy()).disclose)
|
|
338
416
|
setPendingDestination(destination)
|
|
339
417
|
setShowBiometricAdvisory(true)
|
|
340
418
|
},
|
|
@@ -389,6 +467,46 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
389
467
|
const [loadingMore, setLoadingMore] = useState(false)
|
|
390
468
|
const [refreshing, setRefreshing] = useState(false)
|
|
391
469
|
const [exporting, setExporting] = useState(false)
|
|
470
|
+
// ── activity filter ──────────────────────────────────────────────────
|
|
471
|
+
/**
|
|
472
|
+
* The filter lives only while its panel is open: closing it puts every row
|
|
473
|
+
* back, so a closed panel can never be the reason a payment is missing.
|
|
474
|
+
*/
|
|
475
|
+
const [filterOpen, setFilterOpen] = useState(false)
|
|
476
|
+
const [filterQuery, setFilterQuery] = useState('')
|
|
477
|
+
const [filterKind, setFilterKind] = useState<ActivityKindFilter>('all')
|
|
478
|
+
// Typing stays responsive on a long history: the list catches up a beat
|
|
479
|
+
// behind the keystroke instead of every keystroke waiting on the list.
|
|
480
|
+
const deferredQuery = useDeferredValue(filterQuery)
|
|
481
|
+
const activityFilter = useMemo(
|
|
482
|
+
() => ({ kind: filterKind, terms: searchTerms(deferredQuery) }),
|
|
483
|
+
[filterKind, deferredQuery]
|
|
484
|
+
)
|
|
485
|
+
const filterActive = isActivityFilterActive(activityFilter)
|
|
486
|
+
const toggleFilter = useCallback(() => {
|
|
487
|
+
setFilterOpen(open => !open)
|
|
488
|
+
setFilterQuery('')
|
|
489
|
+
setFilterKind('all')
|
|
490
|
+
}, [])
|
|
491
|
+
/** Saved contacts' names and handles, so a search can name who a row was with. */
|
|
492
|
+
const [contactNames, setContactNames] = useState<ReadonlyMap<string, ContactNames>>(new Map())
|
|
493
|
+
// Re-read on every open: a contact saved or renamed since the last search
|
|
494
|
+
// should be findable by the name it has now.
|
|
495
|
+
useEffect(() => {
|
|
496
|
+
if (!filterOpen || !contactsStore || walletUserId == null) return
|
|
497
|
+
let cancelled = false
|
|
498
|
+
contactsStore.listContacts(walletUserId).then(
|
|
499
|
+
contacts => {
|
|
500
|
+
if (!cancelled) setContactNames(contactNamesByKey(contacts))
|
|
501
|
+
},
|
|
502
|
+
() => {
|
|
503
|
+
// A search that cannot name contacts still searches every note.
|
|
504
|
+
}
|
|
505
|
+
)
|
|
506
|
+
return () => {
|
|
507
|
+
cancelled = true
|
|
508
|
+
}
|
|
509
|
+
}, [filterOpen, contactsStore, walletUserId])
|
|
392
510
|
const [offlineByTxid, setOfflineByTxid] = useState<Map<string, OfflineActionRow>>(new Map())
|
|
393
511
|
/** What the row's spinner is currently waiting on. */
|
|
394
512
|
const [busyLabel, setBusyLabel] = useState<string | undefined>(undefined)
|
|
@@ -418,6 +536,16 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
418
536
|
/** Set once the server has no more rows, so onEndReached stops re-querying at
|
|
419
537
|
* the bottom of the list. Cleared whenever the list is refetched from 0. */
|
|
420
538
|
const exhaustedRef = useRef(false)
|
|
539
|
+
/** The same fact as state, for render: a filtered list that is empty has
|
|
540
|
+
* only found nothing once there is no older history left to search. */
|
|
541
|
+
const [historyExhausted, setHistoryExhausted] = useState(false)
|
|
542
|
+
const markExhausted = useCallback((exhausted: boolean) => {
|
|
543
|
+
exhaustedRef.current = exhausted
|
|
544
|
+
setHistoryExhausted(exhausted)
|
|
545
|
+
}, [])
|
|
546
|
+
/** An older page failed to load. Stops the automatic paging below from
|
|
547
|
+
* retrying in a loop; the next refetch from 0 clears it. */
|
|
548
|
+
const [olderPageFailed, setOlderPageFailed] = useState(false)
|
|
421
549
|
/** Synchronous in-flight latch for loadMore (state updates are async). */
|
|
422
550
|
const inFlightRef = useRef(false)
|
|
423
551
|
|
|
@@ -462,6 +590,14 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
462
590
|
if (inFlightBalanceRef.current) return await inFlightBalanceRef.current
|
|
463
591
|
const read = (async () => {
|
|
464
592
|
try {
|
|
593
|
+
// Demo mode owns the figure outright — no storage, no wallet, and so
|
|
594
|
+
// no dependency on either having been built. Read through `demoOn`
|
|
595
|
+
// rather than calling the gate again, so the dependency below is the
|
|
596
|
+
// real one: it is what re-runs this read when the switch flips.
|
|
597
|
+
if (demoOn && demoMod) {
|
|
598
|
+
setBalance(demoMod.demoWalletBalance())
|
|
599
|
+
return
|
|
600
|
+
}
|
|
465
601
|
// Straight to our own SQLite, deliberately NOT through the wallet's
|
|
466
602
|
// listOutputs: every call through WalletStorageManager queues on one
|
|
467
603
|
// FIFO reader lock, and the monitor holds that lock across network
|
|
@@ -518,7 +654,8 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
518
654
|
adminOriginator,
|
|
519
655
|
balanceCacheKey,
|
|
520
656
|
onThisNetwork,
|
|
521
|
-
knownNoStoredIdentity
|
|
657
|
+
knownNoStoredIdentity,
|
|
658
|
+
demoOn
|
|
522
659
|
])
|
|
523
660
|
|
|
524
661
|
/**
|
|
@@ -536,6 +673,8 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
536
673
|
useEffect(() => {
|
|
537
674
|
refreshBalanceRef.current = refreshBalance
|
|
538
675
|
}, [refreshBalance])
|
|
676
|
+
/** Set once `mandala` exists, below; a no-op until then. */
|
|
677
|
+
const mandalaRefreshRef = useRef<() => void>(() => {})
|
|
539
678
|
// Either route to a figure counts: the direct read needs storage and the user
|
|
540
679
|
// id, the fallback needs the permissions manager.
|
|
541
680
|
const hasWallet = (storage != null && walletUserId != null) || managers.permissionsManager != null
|
|
@@ -548,8 +687,9 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
548
687
|
setActions([])
|
|
549
688
|
setOfflineByTxid(new Map())
|
|
550
689
|
offsetRef.current = 0
|
|
551
|
-
|
|
552
|
-
|
|
690
|
+
markExhausted(false)
|
|
691
|
+
setOlderPageFailed(false)
|
|
692
|
+
}, [selectedNetwork, markExhausted])
|
|
553
693
|
|
|
554
694
|
useEffect(() => {
|
|
555
695
|
let cancelled = false
|
|
@@ -602,7 +742,10 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
602
742
|
walletClient: pm as never,
|
|
603
743
|
originator: adminOriginator
|
|
604
744
|
})
|
|
605
|
-
|
|
745
|
+
// XR-051: without this, an unauthenticated resend_request could not be
|
|
746
|
+
// told apart from a legitimate one and would be surfaced (and kept
|
|
747
|
+
// being surfaced) as pending forever.
|
|
748
|
+
const r = await listPendingResendRequests({ client, storage, listPeerPayAction: makeListPeerPayAction(pm, adminOriginator) })
|
|
606
749
|
setPendingResends(r.pending)
|
|
607
750
|
} catch {
|
|
608
751
|
// Silent: an unreachable box must not alert on focus. The stored
|
|
@@ -650,6 +793,10 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
650
793
|
// ── activity ────────────────────────────────────────────────────────
|
|
651
794
|
const fetchActions = useCallback(
|
|
652
795
|
async (offset: number) => {
|
|
796
|
+
if (demoOn && demoMod) {
|
|
797
|
+
setLoadError(false)
|
|
798
|
+
return demoMod.demoListActions({ limit: PAGE_SIZE, offset })
|
|
799
|
+
}
|
|
653
800
|
if (!managers.permissionsManager) return null
|
|
654
801
|
try {
|
|
655
802
|
const result = await managers.permissionsManager.listActions(
|
|
@@ -663,7 +810,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
663
810
|
throw e
|
|
664
811
|
}
|
|
665
812
|
},
|
|
666
|
-
[managers.permissionsManager, adminOriginator]
|
|
813
|
+
[managers.permissionsManager, adminOriginator, demoOn]
|
|
667
814
|
)
|
|
668
815
|
|
|
669
816
|
const fetchOfflineRows = useCallback(async () => {
|
|
@@ -683,7 +830,18 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
683
830
|
const db = storage?.sqliteDb
|
|
684
831
|
if (!db) return
|
|
685
832
|
const rows = await findOfflineActions(db, {
|
|
686
|
-
|
|
833
|
+
// 'import_hold' included (XR-085 review follow-up) so a raw-import
|
|
834
|
+
// quarantined row reaches offlineByTxid and reads as "Held (imported)"
|
|
835
|
+
// via txStatusView/ActivityRow instead of falling through to its raw,
|
|
836
|
+
// uninformative status. This is safe ONLY because the derived `queued`
|
|
837
|
+
// value below (which feeds OfflineNotice's count/Send-now/Show-code
|
|
838
|
+
// and the queued-count badge) explicitly excludes 'import_hold' too —
|
|
839
|
+
// an earlier version of this comment claimed that filtering was
|
|
840
|
+
// unnecessary ("nothing below acts on the row by this status"), which
|
|
841
|
+
// was false and let a held row render as an ordinary active payment
|
|
842
|
+
// waiting to be broadcast. Do not widen `queued`'s exclusion list
|
|
843
|
+
// without keeping 'import_hold' in it.
|
|
844
|
+
status: ['queued', 'posting', 'rejected', 'parked', 'import_hold'],
|
|
687
845
|
...(walletUserId === null ? {} : { userId: walletUserId })
|
|
688
846
|
})
|
|
689
847
|
setOfflineByTxid(new Map(rows.map(r => [r.txid, r])))
|
|
@@ -702,7 +860,9 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
702
860
|
// storage (no wallet created yet) also fails this gate, and has
|
|
703
861
|
// nothing to load — settle the spinner instead of leaving it spinning
|
|
704
862
|
// until a wallet exists.
|
|
705
|
-
|
|
863
|
+
// Demo mode has no storage and no wallet by design, so it can never
|
|
864
|
+
// satisfy the network gate below — and must not be asked to.
|
|
865
|
+
if (!demoOn && !onThisNetwork) {
|
|
706
866
|
if (!storage) setLoading(false)
|
|
707
867
|
return
|
|
708
868
|
}
|
|
@@ -720,7 +880,8 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
720
880
|
setActions(result.actions as ActivityAction[])
|
|
721
881
|
offsetRef.current = result.actions.length
|
|
722
882
|
// A fresh first page may have more behind it again.
|
|
723
|
-
|
|
883
|
+
markExhausted(result.actions.length < PAGE_SIZE || result.actions.length >= (result.totalActions ?? 0))
|
|
884
|
+
setOlderPageFailed(false)
|
|
724
885
|
setLoading(false)
|
|
725
886
|
} catch {
|
|
726
887
|
if (cancelled) return
|
|
@@ -739,7 +900,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
739
900
|
cancelled = true
|
|
740
901
|
}
|
|
741
902
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
742
|
-
}, [fetchActions, txStatusVersion, focusVersion, fetchOfflineRows, storage, onThisNetwork])
|
|
903
|
+
}, [fetchActions, txStatusVersion, focusVersion, fetchOfflineRows, storage, onThisNetwork, demoOn])
|
|
743
904
|
|
|
744
905
|
const loadMore = useCallback(async () => {
|
|
745
906
|
// Three guards, all load-bearing:
|
|
@@ -762,19 +923,25 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
762
923
|
}
|
|
763
924
|
// A short page means the end; so does reaching the reported total.
|
|
764
925
|
if (page.length < PAGE_SIZE || offsetRef.current >= (result?.totalActions ?? 0)) {
|
|
765
|
-
|
|
926
|
+
markExhausted(true)
|
|
766
927
|
}
|
|
767
928
|
} catch {
|
|
768
929
|
// Keep existing rows; a failed page is not the end of the list.
|
|
930
|
+
setOlderPageFailed(true)
|
|
769
931
|
} finally {
|
|
770
932
|
inFlightRef.current = false
|
|
771
933
|
setLoadingMore(false)
|
|
772
934
|
}
|
|
773
|
-
}, [fetchActions, loading])
|
|
935
|
+
}, [fetchActions, loading, markExhausted])
|
|
774
936
|
|
|
775
937
|
const onRefresh = useCallback(async () => {
|
|
776
938
|
setRefreshing(true)
|
|
777
939
|
try {
|
|
940
|
+
// Rides along because the balance tap no longer refreshes anything —
|
|
941
|
+
// without it, a held token would have no refresh path left. Through a
|
|
942
|
+
// ref because `mandala` is built further down this component than this
|
|
943
|
+
// callback is.
|
|
944
|
+
mandalaRefreshRef.current()
|
|
778
945
|
const [result, , , entries] = await Promise.all([
|
|
779
946
|
fetchActions(0),
|
|
780
947
|
refreshBalance(),
|
|
@@ -784,7 +951,8 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
784
951
|
if (result) {
|
|
785
952
|
setActions(result.actions as ActivityAction[])
|
|
786
953
|
offsetRef.current = result.actions.length
|
|
787
|
-
|
|
954
|
+
markExhausted(result.actions.length < PAGE_SIZE || result.actions.length >= (result.totalActions ?? 0))
|
|
955
|
+
setOlderPageFailed(false)
|
|
788
956
|
}
|
|
789
957
|
setAttentionCount(TaskCreditInbox.lastAttentionCount)
|
|
790
958
|
setUnsentCount(unsentEntries(entries).length)
|
|
@@ -793,7 +961,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
793
961
|
} finally {
|
|
794
962
|
setRefreshing(false)
|
|
795
963
|
}
|
|
796
|
-
}, [fetchActions, refreshBalance, fetchOfflineRows, storage])
|
|
964
|
+
}, [fetchActions, refreshBalance, fetchOfflineRows, storage, markExhausted])
|
|
797
965
|
|
|
798
966
|
const onExport = useCallback(async () => {
|
|
799
967
|
if (exporting || actions.length === 0 || !managers.permissionsManager) return
|
|
@@ -848,12 +1016,28 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
848
1016
|
[busyRow, refreshProof, t]
|
|
849
1017
|
)
|
|
850
1018
|
|
|
851
|
-
/**
|
|
1019
|
+
/**
|
|
1020
|
+
* Abort a still-local transaction, releasing the inputs it reserved.
|
|
1021
|
+
*
|
|
1022
|
+
* `action` is passed by every caller that has it (the row and the detail sheet both
|
|
1023
|
+
* render from a loaded ActivityAction). For a `peerpay` action it is checked against the
|
|
1024
|
+
* live outbox before this ever reaches `abortAction`: that outbox row is the only record
|
|
1025
|
+
* of whether the recipient may already hold this payment's token, and it does not survive
|
|
1026
|
+
* a backup/restore (key_value_store is not currently part of the encrypted backup) — so a
|
|
1027
|
+
* restored wallet must refuse rather than guess "never delivered" from a missing row.
|
|
1028
|
+
*/
|
|
852
1029
|
const onAbort = useCallback(
|
|
853
|
-
async (reference: string) => {
|
|
1030
|
+
async (reference: string, action?: ActivityAction) => {
|
|
854
1031
|
if (!managers.permissionsManager || busyRow) return
|
|
855
1032
|
setBusyRow(reference)
|
|
856
1033
|
try {
|
|
1034
|
+
if (action?.labels?.includes('peerpay')) {
|
|
1035
|
+
const entries = storage ? await getOutboxEntries(storage) : []
|
|
1036
|
+
if (!isAbortSafe(action, entries).aborted) {
|
|
1037
|
+
showToast(t('tx_abort_maybe_delivered'), { type: 'error' })
|
|
1038
|
+
return
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
857
1041
|
const r = (await managers.permissionsManager.abortAction({ reference }, adminOriginator)) as
|
|
858
1042
|
| { aborted?: boolean }
|
|
859
1043
|
| undefined
|
|
@@ -870,7 +1054,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
870
1054
|
setBusyLabel(undefined)
|
|
871
1055
|
}
|
|
872
1056
|
},
|
|
873
|
-
[managers.permissionsManager, adminOriginator, busyRow, onRefresh, t]
|
|
1057
|
+
[managers.permissionsManager, adminOriginator, busyRow, onRefresh, storage, t]
|
|
874
1058
|
)
|
|
875
1059
|
|
|
876
1060
|
const onResendPending = useCallback(async () => {
|
|
@@ -961,7 +1145,11 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
961
1145
|
// too, instead of leaving it looking like it never went anywhere.
|
|
962
1146
|
if (storage && offlineByTxid.get(txid)?.status === 'parked') {
|
|
963
1147
|
try {
|
|
964
|
-
|
|
1148
|
+
// XR-036 review follow-up: `isToken` (derived above from the
|
|
1149
|
+
// action's own 'mandala' label) is the only signal
|
|
1150
|
+
// `releaseParkedPayment` has for whether this txid needs a
|
|
1151
|
+
// durable token_settlements row before it may be promoted.
|
|
1152
|
+
await releaseParkedPayment({ storage, txid, isTokenHold: isToken })
|
|
965
1153
|
} catch (e) {
|
|
966
1154
|
console.warn('[localpay] resent but could not release:', e instanceof Error ? e.message : e)
|
|
967
1155
|
}
|
|
@@ -1066,10 +1254,20 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1066
1254
|
// broadcast them, so folding them into "waiting to be broadcast" would say
|
|
1067
1255
|
// something untrue about both.
|
|
1068
1256
|
//
|
|
1257
|
+
// An import_hold row is excluded for the same reason, more strongly: it is
|
|
1258
|
+
// not merely not-waiting, it is quarantined (XR-085) precisely so nothing
|
|
1259
|
+
// treats it as live. offlineByTxid (above) still carries it for ActivityRow,
|
|
1260
|
+
// so it still reads "Held (imported)" there — but it must never inflate this
|
|
1261
|
+
// screen's queued count, feed OfflineNotice's "Send now" banner, or make a
|
|
1262
|
+
// surviving framePayload reachable via queuedSent's "Show code" affordance.
|
|
1263
|
+
//
|
|
1069
1264
|
// The rest pass through the grace filter: online, a payment the drain is
|
|
1070
1265
|
// about to post says nothing worth reading, and the banner appearing for the
|
|
1071
1266
|
// half second before it lands reads as a fault that is not there.
|
|
1072
|
-
const queued = useMemo(
|
|
1267
|
+
const queued = useMemo(
|
|
1268
|
+
() => offlineRows.filter(r => r.status !== 'rejected' && r.status !== 'parked' && r.status !== 'import_hold'),
|
|
1269
|
+
[offlineRows]
|
|
1270
|
+
)
|
|
1073
1271
|
const { shown: queuedShown, nextCheckMs } = useMemo(
|
|
1074
1272
|
// graceNonce is a dependency only: it carries no value into the call, it
|
|
1075
1273
|
// just re-runs it once a young row has aged past the grace.
|
|
@@ -1091,6 +1289,11 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1091
1289
|
// first fact is "you hold one": with no runtime and no balances this screen
|
|
1092
1290
|
// renders exactly what it rendered before any of this existed.
|
|
1093
1291
|
const mandala = useMandala()
|
|
1292
|
+
// Assigned in an effect, not during render: a render-phase ref mutation is
|
|
1293
|
+
// impure and React is entitled to discard or replay the render around it.
|
|
1294
|
+
useEffect(() => {
|
|
1295
|
+
mandalaRefreshRef.current = mandala.refresh
|
|
1296
|
+
}, [mandala.refresh])
|
|
1094
1297
|
const tokenActivity = useTokenActivity()
|
|
1095
1298
|
const tokenByTxid = useMemo(() => tokenActivityByTxid(tokenActivity.rows), [tokenActivity.rows])
|
|
1096
1299
|
const seenEvictions = useSeenSet(SEEN_EVICTIONS_KEY)
|
|
@@ -1197,16 +1400,6 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1197
1400
|
}
|
|
1198
1401
|
return actions.filter(a => !a.labels?.includes('mandala'))
|
|
1199
1402
|
}, [actions, hasTokens, heldAsset, tokenByTxid])
|
|
1200
|
-
const rows = useMemo(() => withDayHeaders(visibleActions, t), [visibleActions, t])
|
|
1201
|
-
|
|
1202
|
-
// A filtered page can come up short — or empty — while the server still has
|
|
1203
|
-
// more, and a list too short to scroll never fires onEndReached. Keep
|
|
1204
|
-
// paging until the visible list is a page long or the history is spent.
|
|
1205
|
-
useEffect(() => {
|
|
1206
|
-
if (!hasTokens || loading || loadingMore || actions.length === 0) return
|
|
1207
|
-
if (visibleActions.length >= PAGE_SIZE || exhaustedRef.current) return
|
|
1208
|
-
void loadMore()
|
|
1209
|
-
}, [hasTokens, loading, loadingMore, actions.length, visibleActions.length, loadMore])
|
|
1210
1403
|
|
|
1211
1404
|
/** Cancel a parked payment: abort the action so the inputs come back, and
|
|
1212
1405
|
* retire its queue row. Refuses once the counterparty has broadcast. */
|
|
@@ -1224,17 +1417,36 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1224
1417
|
// which leaves a plain BSV cancel exactly as it behaves today.
|
|
1225
1418
|
const isTokenRow = tokenByTxid.has(txid)
|
|
1226
1419
|
try {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1420
|
+
// P1-3-localpay-cancelparked-bsv: `cancelParkedPayment` refuses to
|
|
1421
|
+
// cancel silently while the chain status cannot be verified offline.
|
|
1422
|
+
// `runCancelParkedFlow` shows the destructive confirm exactly once and
|
|
1423
|
+
// retries with the acknowledgement only if the user accepts the risk.
|
|
1424
|
+
const outcome = await runCancelParkedFlow({
|
|
1425
|
+
cancel: acknowledgedUnverifiable =>
|
|
1426
|
+
cancelParkedPayment({
|
|
1427
|
+
storage,
|
|
1428
|
+
wallet: pm as unknown as CancelParkedWallet,
|
|
1429
|
+
originator: adminOriginator,
|
|
1430
|
+
txid,
|
|
1431
|
+
settlement: mandalaSettlement,
|
|
1432
|
+
acknowledgedUnverifiable
|
|
1433
|
+
}),
|
|
1434
|
+
confirmUnverifiable: async () => {
|
|
1435
|
+
const choice = await showAlert({
|
|
1436
|
+
title: t('local_pay_cancel_unverifiable_title'),
|
|
1437
|
+
message: t('local_pay_cancel_unverifiable_body'),
|
|
1438
|
+
buttons: [
|
|
1439
|
+
{ text: t('cancel'), style: 'cancel', key: 'cancel' },
|
|
1440
|
+
{ text: t('local_pay_cancel_unverifiable_confirm'), style: 'destructive', key: 'confirm' }
|
|
1441
|
+
]
|
|
1442
|
+
})
|
|
1443
|
+
return choice === 'confirm'
|
|
1444
|
+
}
|
|
1233
1445
|
})
|
|
1234
1446
|
if (outcome === 'cancelled') showToast(t('tx_abort_success'), { type: 'success' })
|
|
1235
1447
|
else if (outcome === 'already-sent') {
|
|
1236
1448
|
showToast(t(isTokenRow ? 'token_cancel_already_sent' : 'pay_parked_already_sent'), { type: 'info' })
|
|
1237
|
-
} else showToast(t('tx_abort_failed'), { type: 'error' })
|
|
1449
|
+
} else if (outcome !== 'unverifiable-offline') showToast(t('tx_abort_failed'), { type: 'error' })
|
|
1238
1450
|
await onRefresh()
|
|
1239
1451
|
} catch (e: unknown) {
|
|
1240
1452
|
showToast(e instanceof Error ? e.message : t('unknown_error'), { type: 'error' })
|
|
@@ -1281,12 +1493,136 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1281
1493
|
// by design (spec D2): the image differs on every payment from the
|
|
1282
1494
|
// same payer, which is the point of the blinding, not a bug in it.
|
|
1283
1495
|
counterpartyKey: row.counterpartyKey,
|
|
1284
|
-
|
|
1496
|
+
status: tokenRowStatusView(row.status, row.role === 'received'),
|
|
1497
|
+
statusText: t(tokenRowStatusView(row.status, row.role === 'received').key)
|
|
1285
1498
|
})
|
|
1286
1499
|
}
|
|
1287
1500
|
return map
|
|
1288
1501
|
}, [tokenByTxid, actions, t])
|
|
1289
1502
|
|
|
1503
|
+
/** The coin's rows, narrowed further while the activity filter is in use. */
|
|
1504
|
+
const filteredActions = useMemo(() => {
|
|
1505
|
+
if (!filterActive) return visibleActions
|
|
1506
|
+
return visibleActions.filter(action => {
|
|
1507
|
+
// Same token lookup as `renderItem`: the filter reads the row it draws.
|
|
1508
|
+
const key = action.txid || action.reference || ''
|
|
1509
|
+
const token = action.labels?.includes('mandala') ? tokenProps.get(key) : undefined
|
|
1510
|
+
return matchesActivity(action, token, activityFilter, contactNames)
|
|
1511
|
+
})
|
|
1512
|
+
}, [visibleActions, filterActive, activityFilter, contactNames, tokenProps])
|
|
1513
|
+
const rows = useMemo(() => withDayHeaders(filteredActions, t), [filteredActions, t])
|
|
1514
|
+
|
|
1515
|
+
// A filtered page can come up short — or empty — while the server still has
|
|
1516
|
+
// more, and a list too short to scroll never fires onEndReached. Keep
|
|
1517
|
+
// paging until the visible list is a page long or the history is spent.
|
|
1518
|
+
// A search pages the same way, so a note from months back is still found.
|
|
1519
|
+
useEffect(() => {
|
|
1520
|
+
if ((!hasTokens && !filterActive) || loading || loadingMore || actions.length === 0) return
|
|
1521
|
+
if (filteredActions.length >= PAGE_SIZE || historyExhausted || olderPageFailed) return
|
|
1522
|
+
void loadMore()
|
|
1523
|
+
}, [
|
|
1524
|
+
hasTokens,
|
|
1525
|
+
filterActive,
|
|
1526
|
+
loading,
|
|
1527
|
+
loadingMore,
|
|
1528
|
+
actions.length,
|
|
1529
|
+
filteredActions.length,
|
|
1530
|
+
historyExhausted,
|
|
1531
|
+
olderPageFailed,
|
|
1532
|
+
loadMore
|
|
1533
|
+
])
|
|
1534
|
+
|
|
1535
|
+
/** The row's own display fields, in the shape the detail view draws from. */
|
|
1536
|
+
// Plain functions, not `useCallback`: each runs at most once per render (only
|
|
1537
|
+
// when a row is open) and memoizing them buys nothing, while calling a
|
|
1538
|
+
// memoized callback during render trips the compiler's purity rule.
|
|
1539
|
+
const detailParams = (action: ActivityAction): TransactionDetailParams => {
|
|
1540
|
+
const key = action.txid || action.reference || ''
|
|
1541
|
+
const token = action.labels?.includes('mandala') ? tokenProps.get(key) : undefined
|
|
1542
|
+
return {
|
|
1543
|
+
txid: action.txid,
|
|
1544
|
+
satoshis: action.satoshis,
|
|
1545
|
+
status: action.status,
|
|
1546
|
+
description: action.description,
|
|
1547
|
+
isOutgoing: action.isOutgoing,
|
|
1548
|
+
createdAt: action.created_at ? new Date(action.created_at).toISOString() : undefined,
|
|
1549
|
+
counterpartyKey: token?.counterpartyKey ?? action.senderIdentityKey,
|
|
1550
|
+
...(token
|
|
1551
|
+
? {
|
|
1552
|
+
token: {
|
|
1553
|
+
title: token.title,
|
|
1554
|
+
amount: token.amount,
|
|
1555
|
+
incoming: token.incoming,
|
|
1556
|
+
statusText: token.statusText
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
: {})
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* The utilities that used to unfold inside an expanded row, as the detail
|
|
1565
|
+
* view's overflow menu. Same handlers, same guards — only the surface moved.
|
|
1566
|
+
*/
|
|
1567
|
+
const detailActions = (action: ActivityAction): TransactionAction[] => {
|
|
1568
|
+
const out: TransactionAction[] = []
|
|
1569
|
+
const offline = action.txid ? offlineByTxid.get(action.txid) : undefined
|
|
1570
|
+
const keys = detailActionKeysFor({
|
|
1571
|
+
txid: action.txid,
|
|
1572
|
+
reference: action.reference,
|
|
1573
|
+
status: action.status,
|
|
1574
|
+
offlineStatus: offline?.status,
|
|
1575
|
+
isOutgoing: action.isOutgoing ?? action.satoshis < 0,
|
|
1576
|
+
labels: action.labels
|
|
1577
|
+
})
|
|
1578
|
+
if (keys.includes('refresh')) {
|
|
1579
|
+
out.push({
|
|
1580
|
+
key: 'refresh',
|
|
1581
|
+
label: t('tx_action_refresh'),
|
|
1582
|
+
icon: 'refresh-outline',
|
|
1583
|
+
onPress: () => void onRefreshTx(action.txid)
|
|
1584
|
+
})
|
|
1585
|
+
}
|
|
1586
|
+
if (keys.includes('explorer')) {
|
|
1587
|
+
out.push({
|
|
1588
|
+
key: 'explorer',
|
|
1589
|
+
label: t('tx_action_explorer'),
|
|
1590
|
+
icon: 'link-outline',
|
|
1591
|
+
onPress: () => onExplorer(action.txid)
|
|
1592
|
+
})
|
|
1593
|
+
}
|
|
1594
|
+
if (keys.includes('abort')) {
|
|
1595
|
+
out.push({
|
|
1596
|
+
key: 'abort',
|
|
1597
|
+
label: t('tx_action_abort'),
|
|
1598
|
+
icon: 'close-circle-outline',
|
|
1599
|
+
danger: true,
|
|
1600
|
+
// `action` is passed so a peerpay abort gets the same outbox
|
|
1601
|
+
// delivered-check `onAbort` already runs for `ActivityRow`'s own
|
|
1602
|
+
// Cancel chip — this detail-sheet surface must not be a way around it.
|
|
1603
|
+
onPress: () => void onAbort(action.reference!, action)
|
|
1604
|
+
})
|
|
1605
|
+
}
|
|
1606
|
+
if (keys.includes('cancel-parked')) {
|
|
1607
|
+
out.push({
|
|
1608
|
+
key: 'cancel-parked',
|
|
1609
|
+
label: t('pay_parked_cancel'),
|
|
1610
|
+
icon: 'close-circle-outline',
|
|
1611
|
+
danger: true,
|
|
1612
|
+
onPress: () => void onCancelParked(action.txid)
|
|
1613
|
+
})
|
|
1614
|
+
}
|
|
1615
|
+
if (keys.includes('request-confirmation')) {
|
|
1616
|
+
out.push({
|
|
1617
|
+
key: 'request-confirmation',
|
|
1618
|
+
label: t('tx_action_request_confirmation'),
|
|
1619
|
+
icon: 'send-outline',
|
|
1620
|
+
onPress: () => void onSendPaymentDetails(action.txid)
|
|
1621
|
+
})
|
|
1622
|
+
}
|
|
1623
|
+
return out
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1290
1626
|
const renderItem: ListRenderItem<Row> = useCallback(
|
|
1291
1627
|
({ item, index }) => {
|
|
1292
1628
|
if (item.kind === 'day') {
|
|
@@ -1302,6 +1638,8 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1302
1638
|
return (
|
|
1303
1639
|
<ActivityRow
|
|
1304
1640
|
currency={currency}
|
|
1641
|
+
walletUserId={walletUserId}
|
|
1642
|
+
contactsStore={contactsStore}
|
|
1305
1643
|
action={item}
|
|
1306
1644
|
rowKey={key}
|
|
1307
1645
|
token={token}
|
|
@@ -1310,6 +1648,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1310
1648
|
busy={busy}
|
|
1311
1649
|
busyLabel={busyLabel}
|
|
1312
1650
|
onToggle={toggleRow}
|
|
1651
|
+
onOpen={setOpenTx}
|
|
1313
1652
|
onExplorer={onExplorer}
|
|
1314
1653
|
onRefreshTx={onRefreshTx}
|
|
1315
1654
|
onAbort={onAbort}
|
|
@@ -1322,6 +1661,8 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1322
1661
|
[
|
|
1323
1662
|
colors,
|
|
1324
1663
|
currency,
|
|
1664
|
+
walletUserId,
|
|
1665
|
+
contactsStore,
|
|
1325
1666
|
offlineByTxid,
|
|
1326
1667
|
tokenProps,
|
|
1327
1668
|
busyRow,
|
|
@@ -1340,22 +1681,12 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1340
1681
|
// ── header (balance + the three destinations + activity heading) ─────
|
|
1341
1682
|
const balanceParts = useMemo(
|
|
1342
1683
|
() =>
|
|
1343
|
-
balance === null
|
|
1344
|
-
|
|
1684
|
+
balance === null
|
|
1685
|
+
? null
|
|
1686
|
+
: formatAmountParts(balance, displayCurrency, satoshisPerUSD, { abbreviate: true, usdToFiat }),
|
|
1687
|
+
[balance, displayCurrency, satoshisPerUSD, usdToFiat]
|
|
1345
1688
|
)
|
|
1346
1689
|
|
|
1347
|
-
/** The line under the figure: the same money in the denominations the figure
|
|
1348
|
-
* is not using, so the user never has to convert in their head. */
|
|
1349
|
-
const balanceContext = useMemo(() => {
|
|
1350
|
-
if (balance === null) return ''
|
|
1351
|
-
const bsv = `${formatSatoshisAsBsvDecimal(balance)} BSV`
|
|
1352
|
-
const other = formatAmount(balance, currency === 'BSV' ? 'USD' : 'BSV', satoshisPerUSD, {
|
|
1353
|
-
abbreviate: true,
|
|
1354
|
-
usdToFiat
|
|
1355
|
-
})
|
|
1356
|
-
return `${bsv} · ${other}`
|
|
1357
|
-
}, [balance, currency, satoshisPerUSD, usdToFiat])
|
|
1358
|
-
|
|
1359
1690
|
/**
|
|
1360
1691
|
* Pinned above the list, not part of it.
|
|
1361
1692
|
*
|
|
@@ -1372,13 +1703,26 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1372
1703
|
() => (
|
|
1373
1704
|
<View>
|
|
1374
1705
|
<TouchableOpacity
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1706
|
+
/**
|
|
1707
|
+
* Flips the denomination. Refreshing moved to the list's own
|
|
1708
|
+
* pull gesture, so this tap means exactly one thing.
|
|
1709
|
+
*
|
|
1710
|
+
* A token has no price the wallet can stand behind (ux §6.1), so
|
|
1711
|
+
* there is nothing to flip TO while one is on screen — the tap is
|
|
1712
|
+
* inert rather than converting a stablecoin into an invented
|
|
1713
|
+
* fiat figure.
|
|
1714
|
+
*/
|
|
1715
|
+
onPress={heldAsset ? undefined : () => setFlipped(f => !f)}
|
|
1716
|
+
disabled={Boolean(heldAsset)}
|
|
1379
1717
|
activeOpacity={0.7}
|
|
1380
1718
|
style={styles.balanceBlock}
|
|
1381
|
-
accessibilityLabel={
|
|
1719
|
+
accessibilityLabel={
|
|
1720
|
+
heldAsset
|
|
1721
|
+
? undefined
|
|
1722
|
+
: t('wallet_balance_show_in', {
|
|
1723
|
+
unit: displayCurrency === 'BSV' ? (isFiatCurrency(currency) ? currency : 'USD') : 'BSV'
|
|
1724
|
+
})
|
|
1725
|
+
}
|
|
1382
1726
|
accessibilityValue={heroText ? { text: heroText } : undefined}
|
|
1383
1727
|
>
|
|
1384
1728
|
{/* With a token held, the coin switcher pill in the top bar IS the
|
|
@@ -1393,19 +1737,25 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1393
1737
|
<ActivityIndicator color={colors.textSecondary} style={styles.balanceSpinner} />
|
|
1394
1738
|
) : (
|
|
1395
1739
|
<>
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1740
|
+
{/* However long the figure, it stays on one line: the type shrinks
|
|
1741
|
+
to fit (see FitAmount for why this is not adjustsFontSizeToFit). */}
|
|
1742
|
+
<FitAmount
|
|
1743
|
+
value={heroParts.value}
|
|
1744
|
+
unit={heroParts.unit}
|
|
1745
|
+
style={[styles.balance, { color: colors.textPrimary }]}
|
|
1746
|
+
unitStyle={[styles.balanceUnit, { color: colors.textSecondary }]}
|
|
1747
|
+
fractionStyle={[styles.balanceFraction, { color: colors.textPrimary }]}
|
|
1748
|
+
/>
|
|
1749
|
+
{/* A token keeps this line for its full name, so "1,240.00 USDX"
|
|
1750
|
+
is never a ticker the holder has to decode. BSV no longer
|
|
1751
|
+
carries a conversion line: the same money in the other
|
|
1752
|
+
denomination is one tap on the figure away, and printing
|
|
1753
|
+
both at once was two figures competing to be THE balance. */}
|
|
1754
|
+
{heldAsset ? (
|
|
1755
|
+
<Text style={[styles.balanceContext, { color: colors.textSecondary }]}>
|
|
1756
|
+
{heldAsset.asset.label || heldAsset.asset.issuerName || ''}
|
|
1757
|
+
</Text>
|
|
1758
|
+
) : null}
|
|
1409
1759
|
</>
|
|
1410
1760
|
)}
|
|
1411
1761
|
</TouchableOpacity>
|
|
@@ -1435,12 +1785,16 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1435
1785
|
|
|
1436
1786
|
{/* Release- and network-gated (spec §5.5, task 11): no Vault
|
|
1437
1787
|
destination until the host turns vaultEnabled on, and never off
|
|
1438
|
-
mainnet
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1788
|
+
mainnet — UNLESS this device already holds an existing Vault
|
|
1789
|
+
enrollment (F-07): a funded vault must stay reachable even if
|
|
1790
|
+
the flag is later turned off or the wallet switches network,
|
|
1791
|
+
since VaultScreen's withdraw path itself is never gated on this
|
|
1792
|
+
flag. `selectedNetwork`/`hasVaultMeta` are dependencies of this
|
|
1793
|
+
memo, so the destination tracks both live. Plain push, not
|
|
1794
|
+
destinationPress — enrolment needs no wallet, and the Vault
|
|
1795
|
+
screen's own Deposit button runs the lazy wallet-creation path
|
|
1796
|
+
when it comes to that. */}
|
|
1797
|
+
{(isVaultAvailable(selectedNetwork) || hasVaultMeta) && (
|
|
1444
1798
|
<PressableScale
|
|
1445
1799
|
haptic="confirm"
|
|
1446
1800
|
onPress={() => router.push('/vault')}
|
|
@@ -1456,15 +1810,13 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1456
1810
|
[
|
|
1457
1811
|
heroParts,
|
|
1458
1812
|
heroText,
|
|
1459
|
-
balanceContext,
|
|
1460
1813
|
colors,
|
|
1461
1814
|
t,
|
|
1462
|
-
refreshBalance,
|
|
1463
1815
|
router,
|
|
1464
1816
|
selectedNetwork,
|
|
1817
|
+
hasVaultMeta,
|
|
1465
1818
|
hasTokens,
|
|
1466
1819
|
heldAsset,
|
|
1467
|
-
mandala,
|
|
1468
1820
|
payDestination,
|
|
1469
1821
|
destinationPress,
|
|
1470
1822
|
MaterialCommunityIcons
|
|
@@ -1575,30 +1927,133 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1575
1927
|
|
|
1576
1928
|
<View style={styles.activityHead}>
|
|
1577
1929
|
<Text style={[styles.activityTitle, { color: colors.textPrimary }]}>{t('wallet_activity')}</Text>
|
|
1578
|
-
<
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1930
|
+
<View style={styles.activityTools}>
|
|
1931
|
+
{/* Filled while open, like a selected chip below it: the panel it
|
|
1932
|
+
controls is on screen, so the button says it is on. */}
|
|
1933
|
+
<TouchableOpacity
|
|
1934
|
+
onPress={toggleFilter}
|
|
1935
|
+
// Never disabled while open: an emptied list (a network switch)
|
|
1936
|
+
// must not strand the panel with no way to close it.
|
|
1937
|
+
disabled={actions.length === 0 && !filterOpen}
|
|
1938
|
+
hitSlop={8}
|
|
1939
|
+
style={[
|
|
1940
|
+
styles.filterBtn,
|
|
1941
|
+
filterOpen
|
|
1942
|
+
? { backgroundColor: colors.accent, borderColor: colors.accent }
|
|
1943
|
+
: { borderColor: colors.surfaceRaisedBorder }
|
|
1944
|
+
]}
|
|
1945
|
+
accessibilityRole="button"
|
|
1946
|
+
accessibilityLabel={t('activity_filter')}
|
|
1947
|
+
accessibilityState={{ expanded: filterOpen }}
|
|
1948
|
+
>
|
|
1589
1949
|
<Ionicons
|
|
1590
|
-
name="
|
|
1591
|
-
size={
|
|
1592
|
-
color={
|
|
1950
|
+
name="filter-outline"
|
|
1951
|
+
size={14}
|
|
1952
|
+
color={
|
|
1953
|
+
filterOpen ? colors.textOnAccent : actions.length === 0 ? colors.textTertiary : colors.textSecondary
|
|
1954
|
+
}
|
|
1593
1955
|
/>
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1956
|
+
</TouchableOpacity>
|
|
1957
|
+
{/* "Export", not "Export CSV", to leave the filter room beside it;
|
|
1958
|
+
a screen reader still hears the format. */}
|
|
1959
|
+
<TouchableOpacity
|
|
1960
|
+
onPress={onExport}
|
|
1961
|
+
disabled={exporting || actions.length === 0}
|
|
1962
|
+
hitSlop={8}
|
|
1963
|
+
style={[styles.exportBtn, { borderColor: colors.surfaceRaisedBorder }]}
|
|
1964
|
+
accessibilityRole="button"
|
|
1965
|
+
accessibilityLabel={t('tx_export_csv')}
|
|
1597
1966
|
>
|
|
1598
|
-
{
|
|
1599
|
-
|
|
1600
|
-
|
|
1967
|
+
{exporting ? (
|
|
1968
|
+
<ActivityIndicator size="small" color={colors.textSecondary} />
|
|
1969
|
+
) : (
|
|
1970
|
+
<Ionicons
|
|
1971
|
+
name="download-outline"
|
|
1972
|
+
size={12}
|
|
1973
|
+
color={actions.length === 0 ? colors.textTertiary : colors.textSecondary}
|
|
1974
|
+
/>
|
|
1975
|
+
)}
|
|
1976
|
+
<Text
|
|
1977
|
+
style={[
|
|
1978
|
+
styles.exportLabel,
|
|
1979
|
+
{ color: actions.length === 0 ? colors.textTertiary : colors.textSecondary }
|
|
1980
|
+
]}
|
|
1981
|
+
>
|
|
1982
|
+
{t('tx_export')}
|
|
1983
|
+
</Text>
|
|
1984
|
+
</TouchableOpacity>
|
|
1985
|
+
</View>
|
|
1601
1986
|
</View>
|
|
1987
|
+
|
|
1988
|
+
{filterOpen ? (
|
|
1989
|
+
<View style={styles.filterPanel}>
|
|
1990
|
+
<View
|
|
1991
|
+
style={[
|
|
1992
|
+
styles.searchRow,
|
|
1993
|
+
{ backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }
|
|
1994
|
+
]}
|
|
1995
|
+
>
|
|
1996
|
+
<Ionicons name="search" size={16} color={colors.textSecondary} />
|
|
1997
|
+
<TextInput
|
|
1998
|
+
value={filterQuery}
|
|
1999
|
+
onChangeText={setFilterQuery}
|
|
2000
|
+
placeholder={t('activity_search_placeholder')}
|
|
2001
|
+
placeholderTextColor={colors.textTertiary}
|
|
2002
|
+
autoFocus
|
|
2003
|
+
autoCapitalize="none"
|
|
2004
|
+
autoCorrect={false}
|
|
2005
|
+
returnKeyType="search"
|
|
2006
|
+
style={[styles.searchInput, { color: colors.textPrimary }]}
|
|
2007
|
+
/>
|
|
2008
|
+
{filterQuery.length > 0 && (
|
|
2009
|
+
<TouchableOpacity
|
|
2010
|
+
onPress={() => setFilterQuery('')}
|
|
2011
|
+
style={styles.clearBtn}
|
|
2012
|
+
hitSlop={8}
|
|
2013
|
+
accessibilityRole="button"
|
|
2014
|
+
accessibilityLabel={t('activity_search_clear')}
|
|
2015
|
+
>
|
|
2016
|
+
<Ionicons name="close-circle" size={18} color={colors.textTertiary} />
|
|
2017
|
+
</TouchableOpacity>
|
|
2018
|
+
)}
|
|
2019
|
+
</View>
|
|
2020
|
+
{/* Scrolls sideways rather than wrapping: five chips in a longer
|
|
2021
|
+
language run past a phone's width, and a second row of them
|
|
2022
|
+
would push the list down further than the filter is worth. */}
|
|
2023
|
+
<ScrollView
|
|
2024
|
+
horizontal
|
|
2025
|
+
showsHorizontalScrollIndicator={false}
|
|
2026
|
+
keyboardShouldPersistTaps="handled"
|
|
2027
|
+
contentContainerStyle={styles.kindChips}
|
|
2028
|
+
>
|
|
2029
|
+
{ACTIVITY_KIND_FILTERS.map(kind => {
|
|
2030
|
+
const selected = filterKind === kind
|
|
2031
|
+
const label = t(kindFilterLabelKey(kind))
|
|
2032
|
+
return (
|
|
2033
|
+
<TouchableOpacity
|
|
2034
|
+
key={kind}
|
|
2035
|
+
onPress={() => setFilterKind(kind)}
|
|
2036
|
+
style={[
|
|
2037
|
+
styles.kindChip,
|
|
2038
|
+
selected
|
|
2039
|
+
? { backgroundColor: colors.accent, borderColor: colors.accent }
|
|
2040
|
+
: { borderColor: colors.surfaceRaisedBorder }
|
|
2041
|
+
]}
|
|
2042
|
+
accessibilityRole="button"
|
|
2043
|
+
accessibilityLabel={label}
|
|
2044
|
+
accessibilityState={{ selected }}
|
|
2045
|
+
>
|
|
2046
|
+
<Text
|
|
2047
|
+
style={[styles.kindChipLabel, { color: selected ? colors.textOnAccent : colors.textSecondary }]}
|
|
2048
|
+
>
|
|
2049
|
+
{label}
|
|
2050
|
+
</Text>
|
|
2051
|
+
</TouchableOpacity>
|
|
2052
|
+
)
|
|
2053
|
+
})}
|
|
2054
|
+
</ScrollView>
|
|
2055
|
+
</View>
|
|
2056
|
+
) : null}
|
|
1602
2057
|
</View>
|
|
1603
2058
|
),
|
|
1604
2059
|
[
|
|
@@ -1607,6 +2062,10 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1607
2062
|
onExport,
|
|
1608
2063
|
exporting,
|
|
1609
2064
|
actions.length,
|
|
2065
|
+
filterOpen,
|
|
2066
|
+
filterQuery,
|
|
2067
|
+
filterKind,
|
|
2068
|
+
toggleFilter,
|
|
1610
2069
|
pendingResends.length,
|
|
1611
2070
|
stuckBadges,
|
|
1612
2071
|
resending,
|
|
@@ -1712,6 +2171,14 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1712
2171
|
<Text style={[styles.emptyRetryLabel, { color: colors.accent }]}>{t('activity_load_retry')}</Text>
|
|
1713
2172
|
</PressableScale>
|
|
1714
2173
|
</View>
|
|
2174
|
+
) : filterActive ? (
|
|
2175
|
+
// Nothing found YET is not nothing found: until older history
|
|
2176
|
+
// is spent, the search is still paging through it.
|
|
2177
|
+
historyExhausted || olderPageFailed ? (
|
|
2178
|
+
<Text style={[styles.empty, { color: colors.textSecondary }]}>{t('activity_filter_no_match')}</Text>
|
|
2179
|
+
) : (
|
|
2180
|
+
<ActivityIndicator style={styles.pad} color={colors.textSecondary} />
|
|
2181
|
+
)
|
|
1715
2182
|
) : (
|
|
1716
2183
|
<Text style={[styles.empty, { color: colors.textSecondary }]}>
|
|
1717
2184
|
{heldAsset
|
|
@@ -1720,6 +2187,10 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1720
2187
|
</Text>
|
|
1721
2188
|
)
|
|
1722
2189
|
}
|
|
2190
|
+
// The filter's search field lives in the header: a tap on a chip
|
|
2191
|
+
// or a row must land the first time, not just drop the keyboard.
|
|
2192
|
+
keyboardShouldPersistTaps="handled"
|
|
2193
|
+
keyboardDismissMode="on-drag"
|
|
1723
2194
|
onEndReached={loadMore}
|
|
1724
2195
|
onEndReachedThreshold={0.3}
|
|
1725
2196
|
refreshing={refreshing}
|
|
@@ -1748,6 +2219,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1748
2219
|
<BiometricAdvisoryModal
|
|
1749
2220
|
visible={showBiometricAdvisory}
|
|
1750
2221
|
loading={creatingWalletFromAdvisory}
|
|
2222
|
+
degraded={advisoryDegraded}
|
|
1751
2223
|
onCancel={() => {
|
|
1752
2224
|
setShowBiometricAdvisory(false)
|
|
1753
2225
|
setPendingDestination(null)
|
|
@@ -1779,6 +2251,20 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1779
2251
|
}}
|
|
1780
2252
|
/>
|
|
1781
2253
|
|
|
2254
|
+
{/* One transaction, full screen. Rendered here rather than behind its
|
|
2255
|
+
own route so the overflow menu can reach the very handlers the rows
|
|
2256
|
+
use — including the overlay-authoritative cancel — instead of a
|
|
2257
|
+
duplicate of them. */}
|
|
2258
|
+
<SlideOverFromRight visible={openTx !== null} onClosed={() => setClosedTx(null)}>
|
|
2259
|
+
{(openTx ?? closedTx) ? (
|
|
2260
|
+
<TransactionDetailScreen
|
|
2261
|
+
tx={detailParams((openTx ?? closedTx)!)}
|
|
2262
|
+
getActions={() => detailActions((openTx ?? closedTx)!)}
|
|
2263
|
+
onBack={() => setOpenTx(null)}
|
|
2264
|
+
/>
|
|
2265
|
+
) : null}
|
|
2266
|
+
</SlideOverFromRight>
|
|
2267
|
+
|
|
1782
2268
|
<ImportFromBackupPrompt
|
|
1783
2269
|
visible={!hasWallet && secretsReady && !walletBuilding && knownNoStoredIdentity}
|
|
1784
2270
|
onImport={() => router.push('/auth/mnemonic?flow=import')}
|
|
@@ -1865,6 +2351,19 @@ const styles = StyleSheet.create({
|
|
|
1865
2351
|
marginTop: 10,
|
|
1866
2352
|
fontVariant: ['tabular-nums']
|
|
1867
2353
|
},
|
|
2354
|
+
/**
|
|
2355
|
+
* Roughly 55% of the display size — smaller than the major unit, larger than
|
|
2356
|
+
* a true superscript, which at 44pt would be unreadable. `marginTop` matches
|
|
2357
|
+
* the major run's so the two line boxes start together.
|
|
2358
|
+
*/
|
|
2359
|
+
balanceFraction: {
|
|
2360
|
+
fontSize: 24,
|
|
2361
|
+
lineHeight: 28,
|
|
2362
|
+
fontWeight: '700',
|
|
2363
|
+
letterSpacing: -0.4,
|
|
2364
|
+
marginTop: 10,
|
|
2365
|
+
fontVariant: ['tabular-nums']
|
|
2366
|
+
},
|
|
1868
2367
|
balanceUnit: { fontSize: 19, fontWeight: '600', letterSpacing: 0 },
|
|
1869
2368
|
balanceContext: { fontSize: 13, lineHeight: 18, marginTop: 10, fontVariant: ['tabular-nums'] },
|
|
1870
2369
|
|
|
@@ -1879,10 +2378,13 @@ const styles = StyleSheet.create({
|
|
|
1879
2378
|
listWrap: { flex: 1 },
|
|
1880
2379
|
dest: {
|
|
1881
2380
|
flex: 1,
|
|
2381
|
+
// Icon sits beside the label, not above it, so all three destinations read
|
|
2382
|
+
// as one horizontal row of controls.
|
|
2383
|
+
flexDirection: 'row',
|
|
1882
2384
|
alignItems: 'center',
|
|
1883
2385
|
justifyContent: 'center',
|
|
1884
2386
|
gap: spacing.sm,
|
|
1885
|
-
borderRadius:
|
|
2387
|
+
borderRadius: radii.pill,
|
|
1886
2388
|
paddingTop: 15,
|
|
1887
2389
|
paddingBottom: 13,
|
|
1888
2390
|
borderWidth: StyleSheet.hairlineWidth,
|
|
@@ -1913,17 +2415,51 @@ const styles = StyleSheet.create({
|
|
|
1913
2415
|
paddingBottom: 10
|
|
1914
2416
|
},
|
|
1915
2417
|
activityTitle: { fontSize: 15, fontWeight: '700', letterSpacing: -0.2 },
|
|
2418
|
+
activityTools: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
|
|
2419
|
+
// Same height as the Export pill beside it, so the two read as one set.
|
|
2420
|
+
filterBtn: {
|
|
2421
|
+
width: 28,
|
|
2422
|
+
height: 28,
|
|
2423
|
+
borderRadius: radii.pill,
|
|
2424
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2425
|
+
alignItems: 'center',
|
|
2426
|
+
justifyContent: 'center'
|
|
2427
|
+
},
|
|
1916
2428
|
exportBtn: {
|
|
1917
2429
|
flexDirection: 'row',
|
|
1918
2430
|
alignItems: 'center',
|
|
1919
2431
|
gap: 6,
|
|
2432
|
+
height: 28,
|
|
1920
2433
|
paddingHorizontal: 11,
|
|
1921
|
-
paddingVertical: 6,
|
|
1922
2434
|
borderRadius: radii.pill,
|
|
1923
2435
|
borderWidth: StyleSheet.hairlineWidth
|
|
1924
2436
|
},
|
|
1925
2437
|
exportLabel: { fontSize: 12, fontWeight: '600' },
|
|
1926
2438
|
|
|
2439
|
+
// The chip row scrolls edge to edge, so only the search field is inset.
|
|
2440
|
+
filterPanel: { gap: spacing.md, paddingBottom: spacing.sm },
|
|
2441
|
+
searchRow: {
|
|
2442
|
+
flexDirection: 'row',
|
|
2443
|
+
alignItems: 'center',
|
|
2444
|
+
gap: spacing.sm,
|
|
2445
|
+
marginHorizontal: spacing.xl,
|
|
2446
|
+
minHeight: 40,
|
|
2447
|
+
paddingHorizontal: spacing.md,
|
|
2448
|
+
borderRadius: radii.pill,
|
|
2449
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
2450
|
+
},
|
|
2451
|
+
searchInput: { ...typography.subhead, flex: 1, paddingVertical: spacing.sm, paddingHorizontal: 0 },
|
|
2452
|
+
clearBtn: { width: 28, height: 28, alignItems: 'center', justifyContent: 'center' },
|
|
2453
|
+
kindChips: { gap: spacing.sm, paddingHorizontal: spacing.xl },
|
|
2454
|
+
kindChip: {
|
|
2455
|
+
height: 30,
|
|
2456
|
+
paddingHorizontal: spacing.md,
|
|
2457
|
+
borderRadius: radii.pill,
|
|
2458
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
2459
|
+
justifyContent: 'center'
|
|
2460
|
+
},
|
|
2461
|
+
kindChipLabel: { fontSize: 13, fontWeight: '600' },
|
|
2462
|
+
|
|
1927
2463
|
dayHeader: {
|
|
1928
2464
|
fontSize: 10.5,
|
|
1929
2465
|
fontWeight: '700',
|