@bsv/expo-wallet-toolbox 0.1.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/LICENSE.txt +28 -0
- package/README.md +512 -0
- package/assets/sounds/payment-receive.wav +0 -0
- package/assets/sounds/payment-send.wav +0 -0
- package/assets/sounds/vault-close.wav +0 -0
- package/assets/sounds/vault-open.wav +0 -0
- package/core/amountFormatHelpers.ts +330 -0
- package/core/backup/RemoteSyncReader.ts +94 -0
- package/core/backup/client.ts +111 -0
- package/core/backup/codec.ts +218 -0
- package/core/backup/constants.ts +88 -0
- package/core/backup/cursor.ts +138 -0
- package/core/backup/derive.ts +46 -0
- package/core/backup/deviceId.ts +33 -0
- package/core/backup/erase.ts +67 -0
- package/core/backup/preference.ts +33 -0
- package/core/backup/push.ts +295 -0
- package/core/backup/restore.ts +152 -0
- package/core/backup/restoreOnImport.ts +119 -0
- package/core/backup/status.ts +46 -0
- package/core/config.tsx +47 -0
- package/core/constants.ts +35 -0
- package/core/context/ExchangeRateContext.tsx +69 -0
- package/core/context/LocalStorageProvider.tsx +225 -0
- package/core/context/UserContext.tsx +129 -0
- package/core/context/VaultContext.tsx +79 -0
- package/core/context/WalletConnectionContext.tsx +454 -0
- package/core/context/WalletContext.tsx +2938 -0
- package/core/context/buildGeneration.ts +37 -0
- package/core/deviceTier.ts +89 -0
- package/core/diskSpace.ts +62 -0
- package/core/displayCurrencies.ts +56 -0
- package/core/headers/OfflineFirstChaintracks.ts +176 -0
- package/core/headers/checkpoints.ts +39 -0
- package/core/headers/fs.ts +119 -0
- package/core/headers/headerStore.ts +333 -0
- package/core/headers/prewarm.ts +36 -0
- package/core/headers/syncHeaders.ts +73 -0
- package/core/hooks/useConfirmationSound.ts +135 -0
- package/core/hooks/useHaptics.ts +51 -0
- package/core/hooks/usePermissionQueue.ts +69 -0
- package/core/i18n/translations.tsx +6692 -0
- package/core/index.ts +295 -0
- package/core/localpay/blePermissions.ts +32 -0
- package/core/localpay/build.ts +392 -0
- package/core/localpay/codec.ts +338 -0
- package/core/localpay/deviceCaps.ts +175 -0
- package/core/localpay/nearbyAdvisory.ts +32 -0
- package/core/localpay/nearbyPermissions.ts +34 -0
- package/core/localpay/pending.ts +385 -0
- package/core/localpay/pendingAborts.ts +67 -0
- package/core/localpay/qr.ts +16 -0
- package/core/localpay/session.ts +277 -0
- package/core/localpay/sessionPolicy.ts +5 -0
- package/core/localpay/transport/awdl.ts +11 -0
- package/core/localpay/transport/ble.ts +159 -0
- package/core/localpay/transport/nearby.ts +12 -0
- package/core/localpay/transport/race.ts +110 -0
- package/core/localpay/transport/select.ts +128 -0
- package/core/localpay/transport/socket.ts +244 -0
- package/core/localpay/types.ts +82 -0
- package/core/localpay/verify.ts +204 -0
- package/core/logging.config.ts +10 -0
- package/core/logging.ts +77 -0
- package/core/mnemonicWallet.ts +180 -0
- package/core/monitor/TaskBackupPush.ts +168 -0
- package/core/monitor/TaskCreditInbox.ts +116 -0
- package/core/monitor/TaskDrainOutbox.ts +122 -0
- package/core/monitor/TaskSendOffline.ts +123 -0
- package/core/monitor/unfailRetry.ts +116 -0
- package/core/net/chainMatch.ts +34 -0
- package/core/net/online.ts +34 -0
- package/core/offline/cancelParked.ts +56 -0
- package/core/offline/hold.ts +127 -0
- package/core/offline/order.ts +109 -0
- package/core/offline/payerHold.ts +144 -0
- package/core/offline/plan.ts +264 -0
- package/core/offline/queueGrace.ts +52 -0
- package/core/parsePeerPayURI.ts +119 -0
- package/core/pay/beefRepair.ts +106 -0
- package/core/pay/creditErrors.ts +46 -0
- package/core/pay/creditInbox.ts +202 -0
- package/core/pay/damagedInbox.ts +64 -0
- package/core/pay/proofNudge.ts +23 -0
- package/core/pay/provenTxFromBump.ts +31 -0
- package/core/pay/rails/address.ts +329 -0
- package/core/pay/rails/handle.ts +617 -0
- package/core/pay/rails/index.ts +197 -0
- package/core/pay/rails/nearby.ts +79 -0
- package/core/pay/receiveFocus.ts +13 -0
- package/core/pay/recordProof.ts +91 -0
- package/core/pay/refreshProofGuard.ts +34 -0
- package/core/pay/sweeper.ts +75 -0
- package/core/pay/tokenAmount.ts +18 -0
- package/core/pay/userError.ts +18 -0
- package/core/pay/watchlist.ts +126 -0
- package/core/peerpay/control.ts +122 -0
- package/core/peerpay/handleResendRequests.ts +475 -0
- package/core/peerpay/inboxAttempts.ts +33 -0
- package/core/peerpay/metadataDecryptor.ts +42 -0
- package/core/peerpay/offlineNacks.ts +96 -0
- package/core/peerpay/outbox.ts +209 -0
- package/core/peerpay/rebuildToken.ts +76 -0
- package/core/peerpay/resendBeef.ts +115 -0
- package/core/services/arcadeBroadcastProvider.ts +214 -0
- package/core/services/capWalletArgs.ts +99 -0
- package/core/services/exchangeRate.ts +63 -0
- package/core/services/secrets/envelope.ts +102 -0
- package/core/services/secrets/hkdf.ts +37 -0
- package/core/services/secrets/index.ts +63 -0
- package/core/services/secrets/kek.ts +274 -0
- package/core/services/secrets/migration.ts +188 -0
- package/core/services/secrets/policy.ts +120 -0
- package/core/services/secrets/storage.ts +54 -0
- package/core/services/secrets/store.ts +125 -0
- package/core/services/secrets/types.ts +85 -0
- package/core/services/usdFxRates.ts +101 -0
- package/core/services/vault/VaultKeyService.ts +312 -0
- package/core/services/vault/backupAttestation.ts +136 -0
- package/core/services/vault/ceremony.ts +972 -0
- package/core/services/vault/ceremonyHost.ts +46 -0
- package/core/services/vault/devMock.ts +22 -0
- package/core/services/vault/driver.ts +197 -0
- package/core/services/vault/guard.ts +90 -0
- package/core/services/vault/k1.ts +75 -0
- package/core/services/vault/mockYubiKey.ts +217 -0
- package/core/services/vault/random.ts +20 -0
- package/core/services/vault/sealing.ts +84 -0
- package/core/services/vault/session.ts +59 -0
- package/core/services/vault/transfers.ts +1151 -0
- package/core/services/vault/types.ts +109 -0
- package/core/services/vault/vaultDerivation.ts +152 -0
- package/core/services/vault/vaultPassphrase.ts +287 -0
- package/core/services/vault/vaultStore.ts +104 -0
- package/core/services/walletArgLimits.ts +234 -0
- package/core/services/walletServiceConfig.ts +170 -0
- package/core/storage/LocalStorageAdapter.ts +58 -0
- package/core/storage/README.md +391 -0
- package/core/storage/StorageExpoSQLite.ts +2008 -0
- package/core/storage/errors.ts +73 -0
- package/core/storage/index.ts +3 -0
- package/core/storage/methods/findSql.ts +286 -0
- package/core/storage/methods/historyNotes.ts +61 -0
- package/core/storage/methods/listActionsSql.ts +212 -0
- package/core/storage/methods/listOutputsSql.ts +211 -0
- package/core/storage/methods/offlineActions.ts +156 -0
- package/core/storage/methods/processOfflineActions.ts +503 -0
- package/core/storage/methods/reclaim.ts +135 -0
- package/core/storage/methods/reviewStatusSql.ts +167 -0
- package/core/storage/methods/unprovenWithoutReqSql.ts +26 -0
- package/core/storage/methods/walletBalanceSql.ts +55 -0
- package/core/storage/schema/createTables.ts +385 -0
- package/core/storage/skipQueuedAncestors.ts +29 -0
- package/core/storage/sqlUpdateValue.ts +12 -0
- package/core/stores/ConnectionStore.ts +71 -0
- package/core/theme/ThemeContext.tsx +182 -0
- package/core/theme/assertThemeContrast.ts +109 -0
- package/core/theme/motion.ts +50 -0
- package/core/theme/tokens.ts +232 -0
- package/core/theme/useThemeStyles.tsx +156 -0
- package/core/walletDbRegistry.ts +110 -0
- package/core/walletMonitor.ts +149 -0
- package/core/walletRepair/runWalletCheck.ts +195 -0
- package/core/walletRepair/shouldReleaseUtxo.ts +18 -0
- package/package.json +86 -0
- package/ui/backupShares.ts +367 -0
- package/ui/components/QRScanner.tsx +353 -0
- package/ui/components/pay/AddressReceive.tsx +507 -0
- package/ui/components/pay/AvailableBalance.tsx +61 -0
- package/ui/components/pay/HandleReceive.tsx +896 -0
- package/ui/components/pay/MessageBoxConfig.tsx +256 -0
- package/ui/components/pay/NearbyAdvisoryModal.tsx +111 -0
- package/ui/components/pay/NearbyFlow.tsx +2542 -0
- package/ui/components/pay/OfflineNotice.tsx +337 -0
- package/ui/components/pay/PayCellRow.tsx +101 -0
- package/ui/components/pay/PayForm.tsx +223 -0
- package/ui/components/pay/PaymentQrDisplay.tsx +105 -0
- package/ui/components/pay/PaymentSuccessOverlay.tsx +266 -0
- package/ui/components/pay/RecipientField.tsx +308 -0
- package/ui/components/pay/RequestHub.tsx +75 -0
- package/ui/components/pay/ResultBanner.tsx +69 -0
- package/ui/components/pay/UniversalSend.tsx +687 -0
- package/ui/components/pay/useRecipientInput.ts +270 -0
- package/ui/components/security/WalletLockNotice.tsx +138 -0
- package/ui/components/ui/AlertCard.tsx +223 -0
- package/ui/components/ui/AppLogo.tsx +166 -0
- package/ui/components/ui/BlurChrome.tsx +72 -0
- package/ui/components/ui/Celebration.tsx +84 -0
- package/ui/components/ui/ChoiceSheet.ts +69 -0
- package/ui/components/ui/CustomSafeArea.tsx +74 -0
- package/ui/components/ui/ErrorBoundary.tsx +154 -0
- package/ui/components/ui/GroupedList.tsx +125 -0
- package/ui/components/ui/IconButton.tsx +105 -0
- package/ui/components/ui/ListRow.tsx +197 -0
- package/ui/components/ui/PermissionSheet.tsx +920 -0
- package/ui/components/ui/PresenceRow.tsx +215 -0
- package/ui/components/ui/PressableScale.tsx +105 -0
- package/ui/components/ui/ScreenGradient.tsx +47 -0
- package/ui/components/ui/ScrollFade.tsx +76 -0
- package/ui/components/ui/Sheet.tsx +342 -0
- package/ui/components/ui/Toast.tsx +142 -0
- package/ui/components/ui/index.ts +8 -0
- package/ui/components/vault/EnrollWizard.tsx +627 -0
- package/ui/components/vault/PassphraseField.tsx +306 -0
- package/ui/components/vault/PhraseBackupSheet.tsx +227 -0
- package/ui/components/vault/VaultBackdrop.tsx +354 -0
- package/ui/components/vault/VaultCeremonySheet.tsx +327 -0
- package/ui/components/wallet/ActivityRow.tsx +408 -0
- package/ui/components/wallet/AmountDisplay.tsx +48 -0
- package/ui/components/wallet/AmountInput.tsx +256 -0
- package/ui/components/wallet/BackupReminderSheet.tsx +168 -0
- package/ui/components/wallet/Balance.tsx +144 -0
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +133 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +93 -0
- package/ui/exportDatabases.ts +122 -0
- package/ui/exportTransactions.ts +129 -0
- package/ui/hooks/useOfflineNoticeActions.ts +136 -0
- package/ui/hooks/useOnline.ts +70 -0
- package/ui/hooks/useSpendableBalance.ts +58 -0
- package/ui/hooks/useVaultBalance.ts +50 -0
- package/ui/importDatabases.ts +170 -0
- package/ui/index.ts +136 -0
- package/ui/isImageUrl.ts +10 -0
- package/ui/printRecoveryShares.ts +93 -0
- package/ui/resolveIdentity.ts +125 -0
- package/ui/screens/ConnectionsScreen.tsx +438 -0
- package/ui/screens/LogsScreen.tsx +432 -0
- package/ui/screens/PairScreen.tsx +288 -0
- package/ui/screens/PayScreen.tsx +479 -0
- package/ui/screens/SettingsScreen.tsx +180 -0
- package/ui/screens/TrustScreen.tsx +831 -0
- package/ui/screens/VaultRecoverScreen.tsx +226 -0
- package/ui/screens/VaultScreen.tsx +423 -0
- package/ui/screens/VaultTransferScreen.tsx +293 -0
- package/ui/screens/WalletCheckScreen.tsx +539 -0
- package/ui/screens/WalletConfigScreen.tsx +1095 -0
- package/ui/screens/WalletHomeScreen.tsx +1597 -0
- package/ui/screens/homeBadges.ts +18 -0
- package/ui/txStatus.ts +79 -0
- package/ui/validateTrust.ts +44 -0
|
@@ -0,0 +1,1095 @@
|
|
|
1
|
+
import React, { useState, useEffect, useContext, useRef, useCallback, useMemo } from 'react'
|
|
2
|
+
import { ActivityIndicator, View, Text, TextInput, TouchableOpacity, ScrollView, StyleSheet } from 'react-native'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_AUTO_APPROVE_THRESHOLD,
|
|
7
|
+
AUTO_APPROVE_STORAGE_KEY,
|
|
8
|
+
ADVANCED_SETTINGS_EXPANDED_KEY,
|
|
9
|
+
KNOWN_ARC_URLS,
|
|
10
|
+
DEFAULT_ARC_URLS,
|
|
11
|
+
arcUrlStorageKey,
|
|
12
|
+
arcApiTokenStorageKey,
|
|
13
|
+
useTheme,
|
|
14
|
+
spacing,
|
|
15
|
+
typography,
|
|
16
|
+
useWallet,
|
|
17
|
+
type AppChain,
|
|
18
|
+
useLocalStorage,
|
|
19
|
+
formatAmount,
|
|
20
|
+
parseDisplayToSatoshis,
|
|
21
|
+
getUnitLabel,
|
|
22
|
+
isFiatCurrency,
|
|
23
|
+
fiatFractionDigits,
|
|
24
|
+
satoshisPerFiatUnit,
|
|
25
|
+
ExchangeRateContext,
|
|
26
|
+
DISPLAY_CURRENCY_OPTIONS,
|
|
27
|
+
recordBackupAttestation,
|
|
28
|
+
isBackupPushEnabled,
|
|
29
|
+
setBackupPushEnabled,
|
|
30
|
+
BACKUP_CHAINS,
|
|
31
|
+
eraseRemoteBackup,
|
|
32
|
+
recoverMnemonicWallet,
|
|
33
|
+
TaskBackupPush,
|
|
34
|
+
DEFAULT_BACKUP_URL,
|
|
35
|
+
setMockDriverEnabled,
|
|
36
|
+
UserContext,
|
|
37
|
+
NO_MESSAGE_BOX
|
|
38
|
+
} from '@bsv/expo-wallet-toolbox'
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* expo-constants reaches native config; required lazily so a consumer of the
|
|
42
|
+
* `ui` barrel that never renders this screen does not pull it in, matching the
|
|
43
|
+
* pattern used for expo-router and the icon sets here.
|
|
44
|
+
*/
|
|
45
|
+
function appVersionLabel(): string {
|
|
46
|
+
try {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
48
|
+
const Constants = require('expo-constants').default
|
|
49
|
+
const version = Constants?.expoConfig?.version ?? Constants?.nativeAppVersion
|
|
50
|
+
const build =
|
|
51
|
+
Constants?.expoConfig?.ios?.buildNumber ??
|
|
52
|
+
Constants?.expoConfig?.android?.versionCode ??
|
|
53
|
+
Constants?.nativeBuildVersion
|
|
54
|
+
if (!version) return ''
|
|
55
|
+
return build ? `${version} (${build})` : `${version}`
|
|
56
|
+
} catch {
|
|
57
|
+
// A missing native module must not take the settings screen down; the
|
|
58
|
+
// footer is a support aid, not a control.
|
|
59
|
+
return ''
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
import { ConfigPanel, useMessageBoxConfig } from '../components/pay/MessageBoxConfig'
|
|
64
|
+
import { GroupedSection } from '../components/ui/GroupedList'
|
|
65
|
+
import { ListRow } from '../components/ui/ListRow'
|
|
66
|
+
import { showAlert } from '../components/ui/AlertCard'
|
|
67
|
+
import { showToast } from '../components/ui/Toast'
|
|
68
|
+
import { PrivateKey } from '@bsv/sdk'
|
|
69
|
+
import { exportAllWalletDatabases } from '../exportDatabases'
|
|
70
|
+
import { importWalletDatabase } from '../importDatabases'
|
|
71
|
+
import { printRecoveryShares } from '../printRecoveryShares'
|
|
72
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
76
|
+
* etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
|
|
77
|
+
* that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
|
|
78
|
+
* Loaded lazily, only when actually rendering, same pattern as this
|
|
79
|
+
* package's other native-module-boundary fixes (expo-router, expo-blur,
|
|
80
|
+
* WalletHomeScreen.tsx/ListRow.tsx's lazy icon loads).
|
|
81
|
+
*/
|
|
82
|
+
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
83
|
+
let ioniconsComponent: IoniconsComponent | undefined
|
|
84
|
+
function loadIonicons(): IoniconsComponent {
|
|
85
|
+
if (!ioniconsComponent) {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
87
|
+
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
88
|
+
}
|
|
89
|
+
return ioniconsComponent
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* expo-router is required lazily rather than imported at module scope: this
|
|
94
|
+
* file is barrel-exported from the package's `ui` entry point, and a static
|
|
95
|
+
* top-level `import` of expo-router pulls in its own untransformed JSX
|
|
96
|
+
* source (Navigator.js etc.), which Jest cannot parse for any consumer of the
|
|
97
|
+
* barrel, even one that never navigates. Same pattern as
|
|
98
|
+
* WalletHomeScreen.tsx's/PayScreen.tsx's/SettingsScreen.tsx's lazy
|
|
99
|
+
* expo-router load.
|
|
100
|
+
*/
|
|
101
|
+
type ExpoRouterModule = typeof import('expo-router')
|
|
102
|
+
let expoRouterMod: ExpoRouterModule | undefined
|
|
103
|
+
function loadExpoRouter(): ExpoRouterModule {
|
|
104
|
+
if (!expoRouterMod) {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
106
|
+
expoRouterMod = require('expo-router') as ExpoRouterModule
|
|
107
|
+
}
|
|
108
|
+
return expoRouterMod
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @react-native-clipboard/clipboard reaches for its native TurboModule at
|
|
113
|
+
* import time (`TurboModuleRegistry.getEnforcing`), which throws under Jest
|
|
114
|
+
* (no native binary registered there) even though the module itself
|
|
115
|
+
* transforms fine. Required lazily, only when a handler actually copies
|
|
116
|
+
* something, so importing the `ui` barrel never touches the native module.
|
|
117
|
+
* Same pattern as WalletHomeScreen.tsx's lazy clipboard load.
|
|
118
|
+
*/
|
|
119
|
+
type ClipboardModule = typeof import('@react-native-clipboard/clipboard').default
|
|
120
|
+
let clipboardModule: ClipboardModule | undefined
|
|
121
|
+
function loadClipboard(): ClipboardModule {
|
|
122
|
+
if (!clipboardModule) {
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
124
|
+
clipboardModule = require('@react-native-clipboard/clipboard').default as ClipboardModule
|
|
125
|
+
}
|
|
126
|
+
return clipboardModule
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function WalletConfigScreen() {
|
|
130
|
+
const versionLabel = useMemo(() => appVersionLabel(), [])
|
|
131
|
+
const { t } = useTranslation()
|
|
132
|
+
const { colors } = useTheme()
|
|
133
|
+
const { router } = loadExpoRouter()
|
|
134
|
+
const Ionicons = loadIonicons()
|
|
135
|
+
const {
|
|
136
|
+
managers,
|
|
137
|
+
adminOriginator,
|
|
138
|
+
logout,
|
|
139
|
+
selectedNetwork,
|
|
140
|
+
switchNetwork,
|
|
141
|
+
rebuildWallet,
|
|
142
|
+
storage,
|
|
143
|
+
settings,
|
|
144
|
+
updateSettings
|
|
145
|
+
} = useWallet()
|
|
146
|
+
const { getMnemonic, getRecoveredKey } = useLocalStorage()
|
|
147
|
+
const insets = useSafeAreaInsets()
|
|
148
|
+
|
|
149
|
+
const [isPrinting, setIsPrinting] = useState(false)
|
|
150
|
+
const [copiedMnemonic, setCopiedMnemonic] = useState(false)
|
|
151
|
+
const [switchingNetwork, setSwitchingNetwork] = useState(false)
|
|
152
|
+
const [networkExpanded, setNetworkExpanded] = useState(false)
|
|
153
|
+
const [isExporting, setIsExporting] = useState(false)
|
|
154
|
+
const [isImporting, setIsImporting] = useState(false)
|
|
155
|
+
const [vaultMockOn, setVaultMockOn] = useState(false)
|
|
156
|
+
const [backupPushOn, setBackupPushOn] = useState(true)
|
|
157
|
+
const [erasingBackup, setErasingBackup] = useState(false)
|
|
158
|
+
const [loggingOut, setLoggingOut] = useState(false)
|
|
159
|
+
const [storageBusy, setStorageBusy] = useState(false)
|
|
160
|
+
const [currencyExpanded, setCurrencyExpanded] = useState(false)
|
|
161
|
+
const [advancedExpanded, setAdvancedExpanded] = useState(false)
|
|
162
|
+
const [thresholdExpanded, setThresholdExpanded] = useState(false)
|
|
163
|
+
const [thresholdSats, setThresholdSats] = useState(DEFAULT_AUTO_APPROVE_THRESHOLD)
|
|
164
|
+
const [thresholdInput, setThresholdInput] = useState('')
|
|
165
|
+
const [arcExpanded, setArcExpanded] = useState(false)
|
|
166
|
+
const [arcUrlInput, setArcUrlInput] = useState('')
|
|
167
|
+
const [arcTokenInput, setArcTokenInput] = useState('')
|
|
168
|
+
const [arcSaving, setArcSaving] = useState(false)
|
|
169
|
+
const { satoshisPerUSD, usdToFiat = {} } = useContext(ExchangeRateContext)
|
|
170
|
+
const { appName } = useContext(UserContext)
|
|
171
|
+
|
|
172
|
+
const currentCurrency = settings?.currency || 'BSV'
|
|
173
|
+
const messageBox = useMessageBoxConfig(t)
|
|
174
|
+
|
|
175
|
+
// Load persisted auto-approve threshold
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
AsyncStorage.getItem(AUTO_APPROVE_STORAGE_KEY).then(v => {
|
|
178
|
+
if (v !== null) setThresholdSats(Number(v) || 0)
|
|
179
|
+
})
|
|
180
|
+
}, [])
|
|
181
|
+
|
|
182
|
+
// Restore whether Advanced was left open. Deliberately not awaited before the
|
|
183
|
+
// first paint: the screen renders collapsed and expands a frame later, which
|
|
184
|
+
// is the right way round — a holder never sees the advanced rows flash past.
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
AsyncStorage.getItem(ADVANCED_SETTINGS_EXPANDED_KEY).then(v => {
|
|
187
|
+
if (v === 'true') setAdvancedExpanded(true)
|
|
188
|
+
})
|
|
189
|
+
}, [])
|
|
190
|
+
|
|
191
|
+
// Load the backup-push opt-out. Defaults to on, so a slow read shows the true default
|
|
192
|
+
// rather than flashing "Off".
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
isBackupPushEnabled().then(setBackupPushOn)
|
|
195
|
+
}, [])
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Toggle pushing to the backup server.
|
|
199
|
+
*
|
|
200
|
+
* Turning it OFF is confirmed, because the cost is not obvious: the recovery phrase alone
|
|
201
|
+
* cannot rebuild change-output derivation data, so a wallet with no log cannot be fully
|
|
202
|
+
* restored on a new device. Turning it back ON resumes from where the log stopped (the
|
|
203
|
+
* cursor is never advanced while opted out) and asks the monitor for an immediate pass.
|
|
204
|
+
*/
|
|
205
|
+
const handleToggleBackupPush = useCallback(async () => {
|
|
206
|
+
const next = !backupPushOn
|
|
207
|
+
if (!next) {
|
|
208
|
+
const choice = await showAlert({
|
|
209
|
+
title: t('backup_push_off_title'),
|
|
210
|
+
message: t('backup_push_off_message'),
|
|
211
|
+
buttons: [
|
|
212
|
+
{ text: t('backup_push_off_confirm'), key: 'confirm', style: 'destructive' },
|
|
213
|
+
{ text: t('cancel'), key: 'cancel', style: 'cancel' }
|
|
214
|
+
]
|
|
215
|
+
})
|
|
216
|
+
if (choice !== 'confirm') return
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
await setBackupPushEnabled(next)
|
|
220
|
+
setBackupPushOn(next)
|
|
221
|
+
if (next) TaskBackupPush.requestNow()
|
|
222
|
+
showToast(next ? t('backup_push_on_toast') : t('backup_push_off_toast'), { type: 'info' })
|
|
223
|
+
}, [backupPushOn, t])
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Erase the server's copy of this wallet's backup, on request (GDPR Article 17).
|
|
227
|
+
*
|
|
228
|
+
* The primary key is derived here, at the moment of use, from whichever secret this wallet
|
|
229
|
+
* has — the mnemonic, or the WIF for a wallet recovered from legacy shares. Both mirror
|
|
230
|
+
* what WalletContext derives for the push path, so both address the same pseudonym. It is
|
|
231
|
+
* deliberately not kept in a longer-lived place just to serve this button.
|
|
232
|
+
*
|
|
233
|
+
* eraseRemoteBackup turns pushing off before it deletes; see its module doc for why that
|
|
234
|
+
* order matters. The switch below therefore reads Off afterwards.
|
|
235
|
+
*/
|
|
236
|
+
const handleEraseBackup = useCallback(async () => {
|
|
237
|
+
if (erasingBackup) return
|
|
238
|
+
|
|
239
|
+
const choice = await showAlert({
|
|
240
|
+
title: t('backup_erase_title'),
|
|
241
|
+
message: t('backup_erase_message'),
|
|
242
|
+
buttons: [
|
|
243
|
+
{ text: t('backup_erase_confirm'), key: 'confirm', style: 'destructive' },
|
|
244
|
+
{ text: t('cancel'), key: 'cancel', style: 'cancel' }
|
|
245
|
+
]
|
|
246
|
+
})
|
|
247
|
+
if (choice !== 'confirm') return
|
|
248
|
+
|
|
249
|
+
setErasingBackup(true)
|
|
250
|
+
try {
|
|
251
|
+
const mnemonic = await getMnemonic()
|
|
252
|
+
const wif = mnemonic ? null : await getRecoveredKey()
|
|
253
|
+
const primaryKey = mnemonic
|
|
254
|
+
? recoverMnemonicWallet(mnemonic).primaryKey
|
|
255
|
+
: wif
|
|
256
|
+
? PrivateKey.fromWif(wif).toArray()
|
|
257
|
+
: null
|
|
258
|
+
if (primaryKey == null) {
|
|
259
|
+
showToast(t('backup_erase_no_key'), { type: 'error' })
|
|
260
|
+
return
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Every network's account: each chain derives its own pseudonym, so one seed holds
|
|
264
|
+
// up to three separate server accounts. Erasure means all of them. A failure on any
|
|
265
|
+
// chain propagates — a partial erasure must never be reported as done.
|
|
266
|
+
let deleted = 0
|
|
267
|
+
for (const chain of BACKUP_CHAINS) {
|
|
268
|
+
deleted += (await eraseRemoteBackup({ primaryKey, chain, baseUrl: DEFAULT_BACKUP_URL })).deleted
|
|
269
|
+
}
|
|
270
|
+
setBackupPushOn(false)
|
|
271
|
+
showToast(t('backup_erase_done', { count: deleted }), { type: 'success' })
|
|
272
|
+
} catch (e) {
|
|
273
|
+
// Never report an erasure that did not happen. The server's copy is still there and
|
|
274
|
+
// the user has to be told, not reassured.
|
|
275
|
+
console.error('[wallet-config] backup erase failed:', e)
|
|
276
|
+
showToast(t('backup_erase_failed'), { type: 'error' })
|
|
277
|
+
// Pushing is off either way — eraseRemoteBackup wrote that before it tried the
|
|
278
|
+
// delete, and a failed erasure is no reason to start uploading again.
|
|
279
|
+
setBackupPushOn(false)
|
|
280
|
+
} finally {
|
|
281
|
+
setErasingBackup(false)
|
|
282
|
+
}
|
|
283
|
+
}, [erasingBackup, t, getMnemonic, getRecoveredKey])
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Show what the wallet database is using, and offer the one safe reclaim.
|
|
287
|
+
*
|
|
288
|
+
* Deliberately an explicit user action rather than something the low-disk gate
|
|
289
|
+
* triggers: on a nearly full volume the UPDATE's own rollback journal can fail
|
|
290
|
+
* with SQLITE_FULL, and with no WAL and no auto_vacuum the file does not shrink
|
|
291
|
+
* afterwards — so the copy promises bytes freed inside the database, never
|
|
292
|
+
* recovered disk space.
|
|
293
|
+
*/
|
|
294
|
+
const handleStorage = useCallback(async () => {
|
|
295
|
+
if (storageBusy) return
|
|
296
|
+
setStorageBusy(true)
|
|
297
|
+
try {
|
|
298
|
+
if (!storage) {
|
|
299
|
+
showToast(t('storage_unavailable'), { type: 'error' })
|
|
300
|
+
return
|
|
301
|
+
}
|
|
302
|
+
const pm = managers?.permissionsManager
|
|
303
|
+
// The reorg horizon is measured in confirmations, so the report needs the
|
|
304
|
+
// current tip. Without it, nothing is eligible — which is the safe
|
|
305
|
+
// direction to fail in.
|
|
306
|
+
const height = pm ? ((await pm.getHeight({}, adminOriginator)) as { height?: number })?.height ?? 0 : 0
|
|
307
|
+
const cutoff = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString()
|
|
308
|
+
const report = await storage.reclaimReport(height, cutoff)
|
|
309
|
+
|
|
310
|
+
const mb = (bytes: number | null) => (bytes == null ? '—' : `${(bytes / 1024 / 1024).toFixed(1)} MB`)
|
|
311
|
+
const held = report.excluded.reduce((sum, e) => sum + e.rows, 0)
|
|
312
|
+
const lines = [
|
|
313
|
+
t('storage_db_size', { size: mb(report.dbBytes) }),
|
|
314
|
+
t('storage_free_space', { size: mb(report.freeBytes) }),
|
|
315
|
+
t('storage_reclaimable', { size: mb(report.reclaimable.bytes), count: report.reclaimable.rows }),
|
|
316
|
+
...(held > 0 ? [t('storage_held_back', { count: held })] : [])
|
|
317
|
+
]
|
|
318
|
+
|
|
319
|
+
if (report.reclaimable.rows === 0) {
|
|
320
|
+
await showAlert({
|
|
321
|
+
title: t('storage_title'),
|
|
322
|
+
message: lines.join('\n'),
|
|
323
|
+
buttons: [{ text: t('vault_ok'), key: 'ok' }]
|
|
324
|
+
})
|
|
325
|
+
return
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const choice = await showAlert({
|
|
329
|
+
title: t('storage_title'),
|
|
330
|
+
message: `${lines.join('\n')}\n\n${t('storage_reclaim_explain')}`,
|
|
331
|
+
buttons: [
|
|
332
|
+
{ text: t('storage_reclaim_confirm'), key: 'confirm' },
|
|
333
|
+
{ text: t('cancel'), key: 'cancel', style: 'cancel' }
|
|
334
|
+
]
|
|
335
|
+
})
|
|
336
|
+
if (choice !== 'confirm') return
|
|
337
|
+
|
|
338
|
+
const { rows } = await storage.reclaimInputBeef(height, cutoff)
|
|
339
|
+
showToast(t('storage_reclaimed', { count: rows }), { type: 'success' })
|
|
340
|
+
} catch (e) {
|
|
341
|
+
console.error('[wallet-config] storage report failed:', e)
|
|
342
|
+
showToast(t('storage_failed'), { type: 'error' })
|
|
343
|
+
} finally {
|
|
344
|
+
setStorageBusy(false)
|
|
345
|
+
}
|
|
346
|
+
}, [storageBusy, storage, managers, adminOriginator, t])
|
|
347
|
+
|
|
348
|
+
// Load persisted ARC URL + token for current network
|
|
349
|
+
useEffect(() => {
|
|
350
|
+
Promise.all([
|
|
351
|
+
AsyncStorage.getItem(arcUrlStorageKey(selectedNetwork)),
|
|
352
|
+
AsyncStorage.getItem(arcApiTokenStorageKey(selectedNetwork))
|
|
353
|
+
]).then(([url, token]) => {
|
|
354
|
+
setArcUrlInput(url ?? DEFAULT_ARC_URLS[selectedNetwork] ?? '')
|
|
355
|
+
setArcTokenInput(token ?? '')
|
|
356
|
+
})
|
|
357
|
+
}, [selectedNetwork])
|
|
358
|
+
|
|
359
|
+
const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
360
|
+
const handleThresholdInput = useCallback((text: string) => {
|
|
361
|
+
setThresholdInput(text)
|
|
362
|
+
if (debounceRef.current) clearTimeout(debounceRef.current)
|
|
363
|
+
debounceRef.current = setTimeout(() => {
|
|
364
|
+
const sats = parseDisplayToSatoshis(text, currentCurrency, satoshisPerUSD, usdToFiat)
|
|
365
|
+
const clamped = Math.max(0, Math.round(sats))
|
|
366
|
+
setThresholdSats(clamped)
|
|
367
|
+
AsyncStorage.setItem(AUTO_APPROVE_STORAGE_KEY, String(clamped))
|
|
368
|
+
}, 600)
|
|
369
|
+
}, [currentCurrency, satoshisPerUSD, usdToFiat])
|
|
370
|
+
|
|
371
|
+
const handleToggleAdvanced = useCallback(() => {
|
|
372
|
+
setAdvancedExpanded(prev => {
|
|
373
|
+
const next = !prev
|
|
374
|
+
AsyncStorage.setItem(ADVANCED_SETTINGS_EXPANDED_KEY, String(next)).catch(err => {
|
|
375
|
+
console.warn('[advancedExpanded persist]', err)
|
|
376
|
+
})
|
|
377
|
+
return next
|
|
378
|
+
})
|
|
379
|
+
}, [])
|
|
380
|
+
|
|
381
|
+
const handleCopyMnemonic = async () => {
|
|
382
|
+
try {
|
|
383
|
+
// Copy mnemonic if available, otherwise fall back to primary key hex
|
|
384
|
+
const mnemonic = await getMnemonic()
|
|
385
|
+
if (mnemonic) {
|
|
386
|
+
loadClipboard().setString(mnemonic)
|
|
387
|
+
} else {
|
|
388
|
+
const wif = await getRecoveredKey()
|
|
389
|
+
if (!wif) return
|
|
390
|
+
loadClipboard().setString(PrivateKey.fromWif(wif).toHex())
|
|
391
|
+
}
|
|
392
|
+
setCopiedMnemonic(true)
|
|
393
|
+
setTimeout(() => setCopiedMnemonic(false), 2000)
|
|
394
|
+
} catch (error) {
|
|
395
|
+
console.error('Error retrieving recovery key:', error)
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const handlePrintRecoveryShares = async () => {
|
|
400
|
+
if (isPrinting) return
|
|
401
|
+
setIsPrinting(true)
|
|
402
|
+
try {
|
|
403
|
+
const result = await printRecoveryShares({
|
|
404
|
+
mnemonic: await getMnemonic(),
|
|
405
|
+
recoveredKeyWif: await getRecoveredKey(),
|
|
406
|
+
appName
|
|
407
|
+
})
|
|
408
|
+
if (result.ok) {
|
|
409
|
+
// A resolved print sheet from Settings is the same genuine backup
|
|
410
|
+
// EnrollWizard records — the other route to satisfying the vault's
|
|
411
|
+
// backup prerequisite — so it records the same attestation, through
|
|
412
|
+
// the same writer.
|
|
413
|
+
//
|
|
414
|
+
// A failure here must be visible. The paper is real and correct; only
|
|
415
|
+
// the record is missing. Staying silent would send the user away
|
|
416
|
+
// believing they are covered, and the vault would refuse every deposit
|
|
417
|
+
// later with nothing on screen connecting the two.
|
|
418
|
+
if (!(await recordBackupAttestation(managers?.permissionsManager, adminOriginator, 'shares'))) {
|
|
419
|
+
showToast(t('vault_backup_attest_failed_printed'), { type: 'error' })
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
showToast(
|
|
423
|
+
result.reason === 'unsupported-word-count'
|
|
424
|
+
? t('vault_shares_word_count')
|
|
425
|
+
: 'Unable to access wallet key. Please authenticate and try again.',
|
|
426
|
+
{ type: 'error' }
|
|
427
|
+
)
|
|
428
|
+
}
|
|
429
|
+
} catch (error: any) {
|
|
430
|
+
console.info('[WalletConfig] Print recovery shares did not complete:', error?.message)
|
|
431
|
+
} finally {
|
|
432
|
+
setIsPrinting(false)
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const handleExportData = async () => {
|
|
437
|
+
if (isExporting) return
|
|
438
|
+
setIsExporting(true)
|
|
439
|
+
try {
|
|
440
|
+
await exportAllWalletDatabases(storage)
|
|
441
|
+
} catch (e) {
|
|
442
|
+
console.warn('[WalletConfig] Export failed:', e)
|
|
443
|
+
} finally {
|
|
444
|
+
setIsExporting(false)
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const handleImportData = async () => {
|
|
449
|
+
if (isImporting) return
|
|
450
|
+
setIsImporting(true)
|
|
451
|
+
try {
|
|
452
|
+
const result = await importWalletDatabase(storage)
|
|
453
|
+
if (result.imported) {
|
|
454
|
+
showToast(t('import_success'), { type: 'success' })
|
|
455
|
+
await rebuildWallet()
|
|
456
|
+
}
|
|
457
|
+
} catch (e) {
|
|
458
|
+
console.warn('[WalletConfig] Import failed:', e)
|
|
459
|
+
} finally {
|
|
460
|
+
setIsImporting(false)
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const CURRENCIES = DISPLAY_CURRENCY_OPTIONS
|
|
465
|
+
|
|
466
|
+
const handleSelectCurrency = async (target: string) => {
|
|
467
|
+
if (target === currentCurrency) {
|
|
468
|
+
setCurrencyExpanded(false)
|
|
469
|
+
return
|
|
470
|
+
}
|
|
471
|
+
setCurrencyExpanded(false)
|
|
472
|
+
try {
|
|
473
|
+
await updateSettings({ ...settings!, currency: target })
|
|
474
|
+
} catch (e) {
|
|
475
|
+
console.error('Currency switch failed:', e)
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const handleApplyArc = async () => {
|
|
480
|
+
if (arcSaving) return
|
|
481
|
+
setArcSaving(true)
|
|
482
|
+
try {
|
|
483
|
+
const url = arcUrlInput.trim()
|
|
484
|
+
const token = arcTokenInput.trim()
|
|
485
|
+
const defaultUrl = DEFAULT_ARC_URLS[selectedNetwork] ?? ''
|
|
486
|
+
if (url && url !== defaultUrl) {
|
|
487
|
+
await AsyncStorage.setItem(arcUrlStorageKey(selectedNetwork), url)
|
|
488
|
+
} else {
|
|
489
|
+
await AsyncStorage.removeItem(arcUrlStorageKey(selectedNetwork))
|
|
490
|
+
}
|
|
491
|
+
if (token) {
|
|
492
|
+
await AsyncStorage.setItem(arcApiTokenStorageKey(selectedNetwork), token)
|
|
493
|
+
} else {
|
|
494
|
+
await AsyncStorage.removeItem(arcApiTokenStorageKey(selectedNetwork))
|
|
495
|
+
}
|
|
496
|
+
setArcExpanded(false)
|
|
497
|
+
await rebuildWallet()
|
|
498
|
+
} catch (e) {
|
|
499
|
+
console.error('[WalletConfig] ARC settings save failed:', e)
|
|
500
|
+
} finally {
|
|
501
|
+
setArcSaving(false)
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const handleResetArc = async () => {
|
|
506
|
+
await Promise.all([
|
|
507
|
+
AsyncStorage.removeItem(arcUrlStorageKey(selectedNetwork)),
|
|
508
|
+
AsyncStorage.removeItem(arcApiTokenStorageKey(selectedNetwork))
|
|
509
|
+
])
|
|
510
|
+
setArcUrlInput(DEFAULT_ARC_URLS[selectedNetwork] ?? '')
|
|
511
|
+
setArcTokenInput('')
|
|
512
|
+
setArcExpanded(false)
|
|
513
|
+
await rebuildWallet()
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const NETWORKS: { id: AppChain; label: string; color: string }[] = [
|
|
517
|
+
{ id: 'main', label: t('mainnet'), color: colors.success },
|
|
518
|
+
{ id: 'test', label: t('testnet'), color: colors.warning },
|
|
519
|
+
{ id: 'teratest', label: t('teratest'), color: colors.info }
|
|
520
|
+
]
|
|
521
|
+
|
|
522
|
+
const handleSelectNetwork = async (target: AppChain) => {
|
|
523
|
+
if (target === selectedNetwork) {
|
|
524
|
+
setNetworkExpanded(false)
|
|
525
|
+
return
|
|
526
|
+
}
|
|
527
|
+
setNetworkExpanded(false)
|
|
528
|
+
setSwitchingNetwork(true)
|
|
529
|
+
try {
|
|
530
|
+
await switchNetwork(target)
|
|
531
|
+
} catch (e) {
|
|
532
|
+
console.error('Network switch failed:', e)
|
|
533
|
+
} finally {
|
|
534
|
+
setSwitchingNetwork(false)
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
return (
|
|
539
|
+
<View style={{ flex: 1, backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }}>
|
|
540
|
+
{/* Header */}
|
|
541
|
+
<View style={[localStyles.header, { borderBottomColor: colors.separator }]}>
|
|
542
|
+
<TouchableOpacity onPress={() => router.back()} style={localStyles.headerBack}>
|
|
543
|
+
<Ionicons name="chevron-back" size={24} color={colors.textSecondary} />
|
|
544
|
+
</TouchableOpacity>
|
|
545
|
+
<Text style={[localStyles.headerTitle, { color: colors.textPrimary }]}>{t('settings')}</Text>
|
|
546
|
+
<View style={localStyles.headerBack} />
|
|
547
|
+
</View>
|
|
548
|
+
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingTop: spacing.lg, paddingBottom: spacing.xxxl }}>
|
|
549
|
+
{/* ── Essentials ──
|
|
550
|
+
The rows a holder reaches for without being told to: what their money
|
|
551
|
+
is denominated in, how to hand an app access, and the two ways out of
|
|
552
|
+
a lost phone. Everything else is engine-room detail and sits behind
|
|
553
|
+
Advanced, collapsed, so this screen opens as four choices not twenty. */}
|
|
554
|
+
<GroupedSection>
|
|
555
|
+
<ListRow
|
|
556
|
+
label={t('display_currency')}
|
|
557
|
+
value={CURRENCIES.find(c => c.id === currentCurrency)?.label ?? currentCurrency}
|
|
558
|
+
icon="cash-outline"
|
|
559
|
+
iconColor="#F5B300"
|
|
560
|
+
onPress={() => setCurrencyExpanded(e => !e)}
|
|
561
|
+
showChevron={currencyExpanded}
|
|
562
|
+
chevronDown={currencyExpanded}
|
|
563
|
+
/>
|
|
564
|
+
{currencyExpanded && (
|
|
565
|
+
<View style={localStyles.networkList}>
|
|
566
|
+
{CURRENCIES.map(cur => {
|
|
567
|
+
const isActive = cur.id === currentCurrency
|
|
568
|
+
return (
|
|
569
|
+
<TouchableOpacity
|
|
570
|
+
key={cur.id}
|
|
571
|
+
style={localStyles.networkOption}
|
|
572
|
+
onPress={() => handleSelectCurrency(cur.id)}
|
|
573
|
+
activeOpacity={0.6}
|
|
574
|
+
>
|
|
575
|
+
<Ionicons
|
|
576
|
+
name={cur.icon as any}
|
|
577
|
+
size={16}
|
|
578
|
+
color={colors.textSecondary}
|
|
579
|
+
style={{ marginRight: spacing.md }}
|
|
580
|
+
/>
|
|
581
|
+
<Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>{cur.label}</Text>
|
|
582
|
+
{isActive && (
|
|
583
|
+
<Ionicons name="checkmark" size={20} color={colors.accent} style={{ marginLeft: 'auto' }} />
|
|
584
|
+
)}
|
|
585
|
+
</TouchableOpacity>
|
|
586
|
+
)
|
|
587
|
+
})}
|
|
588
|
+
</View>
|
|
589
|
+
)}
|
|
590
|
+
<ListRow
|
|
591
|
+
label={t('connect_to_app')}
|
|
592
|
+
icon="qr-code-outline"
|
|
593
|
+
iconColor="#0A84FF"
|
|
594
|
+
onPress={() => router.push('/connections' as any)}
|
|
595
|
+
/>
|
|
596
|
+
{/* In the main group, not behind Advanced: this is the row a user
|
|
597
|
+
reaches for when something looks wrong, and they must not have to
|
|
598
|
+
open a section labelled "Advanced" to find it. */}
|
|
599
|
+
<ListRow
|
|
600
|
+
label={t('check_wallet')}
|
|
601
|
+
icon="checkmark-done-circle-outline"
|
|
602
|
+
iconColor="#30D158"
|
|
603
|
+
onPress={() => router.push('/wallet-check' as any)}
|
|
604
|
+
isLast
|
|
605
|
+
/>
|
|
606
|
+
</GroupedSection>
|
|
607
|
+
|
|
608
|
+
{/* ── Advanced ── */}
|
|
609
|
+
<GroupedSection>
|
|
610
|
+
<ListRow
|
|
611
|
+
label={t('advanced')}
|
|
612
|
+
icon="construct-outline"
|
|
613
|
+
iconColor="#8E8E93"
|
|
614
|
+
onPress={handleToggleAdvanced}
|
|
615
|
+
chevronDown={advancedExpanded}
|
|
616
|
+
isLast
|
|
617
|
+
/>
|
|
618
|
+
</GroupedSection>
|
|
619
|
+
|
|
620
|
+
{advancedExpanded && (
|
|
621
|
+
<>
|
|
622
|
+
{/* ── Configuration ── */}
|
|
623
|
+
<GroupedSection header={t('configuration')}>
|
|
624
|
+
<ListRow
|
|
625
|
+
label={t('bsv_network')}
|
|
626
|
+
value={
|
|
627
|
+
switchingNetwork
|
|
628
|
+
? t('switching')
|
|
629
|
+
: (NETWORKS.find(n => n.id === selectedNetwork)?.label ?? selectedNetwork)
|
|
630
|
+
}
|
|
631
|
+
icon="globe-outline"
|
|
632
|
+
iconColor={NETWORKS.find(n => n.id === selectedNetwork)?.color ?? colors.success}
|
|
633
|
+
onPress={() => setNetworkExpanded(e => !e)}
|
|
634
|
+
showChevron={networkExpanded}
|
|
635
|
+
chevronDown={networkExpanded}
|
|
636
|
+
/>
|
|
637
|
+
{networkExpanded && (
|
|
638
|
+
<View style={localStyles.networkList}>
|
|
639
|
+
{NETWORKS.map(net => {
|
|
640
|
+
const isActive = net.id === selectedNetwork
|
|
641
|
+
return (
|
|
642
|
+
<TouchableOpacity
|
|
643
|
+
key={net.id}
|
|
644
|
+
style={localStyles.networkOption}
|
|
645
|
+
onPress={() => handleSelectNetwork(net.id)}
|
|
646
|
+
activeOpacity={0.6}
|
|
647
|
+
>
|
|
648
|
+
<View style={[localStyles.networkDot, { backgroundColor: net.color }]} />
|
|
649
|
+
<Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>{net.label}</Text>
|
|
650
|
+
{isActive && (
|
|
651
|
+
<Ionicons name="checkmark" size={20} color={colors.accent} style={{ marginLeft: 'auto' }} />
|
|
652
|
+
)}
|
|
653
|
+
</TouchableOpacity>
|
|
654
|
+
)
|
|
655
|
+
})}
|
|
656
|
+
</View>
|
|
657
|
+
)}
|
|
658
|
+
<ListRow
|
|
659
|
+
label={t('arc_endpoint')}
|
|
660
|
+
value={(() => {
|
|
661
|
+
const known = KNOWN_ARC_URLS.find(k => arcUrlInput.startsWith(k.url))
|
|
662
|
+
return known ? known.label : arcUrlInput.replace('https://', '')
|
|
663
|
+
})()}
|
|
664
|
+
icon="radio-outline"
|
|
665
|
+
iconColor="#6E56CF"
|
|
666
|
+
onPress={() => setArcExpanded(e => !e)}
|
|
667
|
+
showChevron={arcExpanded}
|
|
668
|
+
chevronDown={arcExpanded}
|
|
669
|
+
isLast={arcExpanded}
|
|
670
|
+
/>
|
|
671
|
+
{arcExpanded && (
|
|
672
|
+
<View style={[localStyles.networkList, { paddingTop: spacing.sm, borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: colors.separator }]}>
|
|
673
|
+
{KNOWN_ARC_URLS.map(preset => {
|
|
674
|
+
const isSelected = arcUrlInput.startsWith(preset.url)
|
|
675
|
+
return (
|
|
676
|
+
<TouchableOpacity
|
|
677
|
+
key={preset.url}
|
|
678
|
+
style={localStyles.networkOption}
|
|
679
|
+
onPress={() => setArcUrlInput(preset.url)}
|
|
680
|
+
activeOpacity={0.6}
|
|
681
|
+
>
|
|
682
|
+
<View
|
|
683
|
+
style={[
|
|
684
|
+
localStyles.networkDot,
|
|
685
|
+
{ backgroundColor: isSelected ? colors.accent : colors.separator }
|
|
686
|
+
]}
|
|
687
|
+
/>
|
|
688
|
+
<View style={{ flex: 1 }}>
|
|
689
|
+
<Text style={[localStyles.networkLabel, { color: colors.textPrimary }]}>
|
|
690
|
+
{preset.label}
|
|
691
|
+
</Text>
|
|
692
|
+
<Text style={{ ...typography.caption1, color: colors.textSecondary }} numberOfLines={1}>
|
|
693
|
+
{preset.url.replace('https://', '')}
|
|
694
|
+
</Text>
|
|
695
|
+
</View>
|
|
696
|
+
{preset.requiresToken && (
|
|
697
|
+
<Text style={{ ...typography.caption1, color: colors.warning, marginLeft: spacing.sm }}>
|
|
698
|
+
{t('arc_requires_token')}
|
|
699
|
+
</Text>
|
|
700
|
+
)}
|
|
701
|
+
{isSelected && (
|
|
702
|
+
<Ionicons name="checkmark" size={18} color={colors.accent} style={{ marginLeft: spacing.sm }} />
|
|
703
|
+
)}
|
|
704
|
+
</TouchableOpacity>
|
|
705
|
+
)
|
|
706
|
+
})}
|
|
707
|
+
<View style={localStyles.arcInputRow}>
|
|
708
|
+
<Text style={[localStyles.arcLabel, { color: colors.textSecondary }]}>{t('arc_custom_url')}</Text>
|
|
709
|
+
<TextInput
|
|
710
|
+
style={[localStyles.arcInput, { color: colors.textPrimary, borderColor: colors.separator }]}
|
|
711
|
+
value={arcUrlInput}
|
|
712
|
+
onChangeText={setArcUrlInput}
|
|
713
|
+
placeholder="https://..."
|
|
714
|
+
placeholderTextColor={colors.textSecondary}
|
|
715
|
+
autoCapitalize="none"
|
|
716
|
+
autoCorrect={false}
|
|
717
|
+
keyboardType="url"
|
|
718
|
+
returnKeyType="next"
|
|
719
|
+
/>
|
|
720
|
+
</View>
|
|
721
|
+
<View style={localStyles.arcInputRow}>
|
|
722
|
+
<Text style={[localStyles.arcLabel, { color: colors.textSecondary }]}>{t('arc_api_token')}</Text>
|
|
723
|
+
<TextInput
|
|
724
|
+
style={[localStyles.arcInput, { color: colors.textPrimary, borderColor: colors.separator }]}
|
|
725
|
+
value={arcTokenInput}
|
|
726
|
+
onChangeText={setArcTokenInput}
|
|
727
|
+
placeholder="Optional"
|
|
728
|
+
placeholderTextColor={colors.textSecondary}
|
|
729
|
+
autoCapitalize="none"
|
|
730
|
+
autoCorrect={false}
|
|
731
|
+
returnKeyType="done"
|
|
732
|
+
secureTextEntry={false}
|
|
733
|
+
/>
|
|
734
|
+
</View>
|
|
735
|
+
<View style={localStyles.arcButtonRow}>
|
|
736
|
+
<TouchableOpacity
|
|
737
|
+
style={[localStyles.arcButton, { backgroundColor: colors.backgroundTertiary }]}
|
|
738
|
+
onPress={handleResetArc}
|
|
739
|
+
activeOpacity={0.7}
|
|
740
|
+
>
|
|
741
|
+
<Text style={{ ...typography.body, color: colors.textSecondary }}>{t('arc_reset_default')}</Text>
|
|
742
|
+
</TouchableOpacity>
|
|
743
|
+
<TouchableOpacity
|
|
744
|
+
style={[localStyles.arcButton, { backgroundColor: colors.accent }]}
|
|
745
|
+
onPress={handleApplyArc}
|
|
746
|
+
activeOpacity={0.7}
|
|
747
|
+
>
|
|
748
|
+
{arcSaving
|
|
749
|
+
? <ActivityIndicator size="small" color={colors.textOnAccent} />
|
|
750
|
+
: <Text style={{ ...typography.body, color: colors.textOnAccent, fontWeight: '600' }}>{t('arc_apply')}</Text>
|
|
751
|
+
}
|
|
752
|
+
</TouchableOpacity>
|
|
753
|
+
</View>
|
|
754
|
+
</View>
|
|
755
|
+
)}
|
|
756
|
+
{/* The one home of the message-box setting. Save / Default / Use no
|
|
757
|
+
server live in ConfigPanel, unchanged from when it sat on the
|
|
758
|
+
pay screens; the row's value says which server handle payments
|
|
759
|
+
go through, or that none does. */}
|
|
760
|
+
<ListRow
|
|
761
|
+
label={t('message_box_server')}
|
|
762
|
+
value={
|
|
763
|
+
messageBox.messageBoxUrl === NO_MESSAGE_BOX
|
|
764
|
+
? t('message_box_off')
|
|
765
|
+
: messageBox.messageBoxUrl.replace(/^https:\/\//, '')
|
|
766
|
+
}
|
|
767
|
+
icon="mail-outline"
|
|
768
|
+
iconColor="#5E5CE6"
|
|
769
|
+
onPress={() => messageBox.setShowConfig(v => !v)}
|
|
770
|
+
showChevron={messageBox.showConfig}
|
|
771
|
+
chevronDown={messageBox.showConfig}
|
|
772
|
+
/>
|
|
773
|
+
{messageBox.showConfig && (
|
|
774
|
+
<View style={{ paddingHorizontal: spacing.lg, paddingBottom: spacing.md }}>
|
|
775
|
+
<ConfigPanel
|
|
776
|
+
urlInput={messageBox.urlInput}
|
|
777
|
+
isSaving={messageBox.isSaving}
|
|
778
|
+
colors={colors}
|
|
779
|
+
t={t}
|
|
780
|
+
onChangeUrl={messageBox.setUrlInput}
|
|
781
|
+
onSave={() => {
|
|
782
|
+
void messageBox.handleSave(messageBox.urlInput)
|
|
783
|
+
}}
|
|
784
|
+
onReset={messageBox.handleReset}
|
|
785
|
+
onNone={messageBox.handleNone}
|
|
786
|
+
/>
|
|
787
|
+
</View>
|
|
788
|
+
)}
|
|
789
|
+
<ListRow
|
|
790
|
+
label="Auto Spend Up To"
|
|
791
|
+
value={thresholdSats === 0 ? 'Off'
|
|
792
|
+
: formatAmount(thresholdSats, currentCurrency, satoshisPerUSD, { usdToFiat })}
|
|
793
|
+
icon="flash-outline"
|
|
794
|
+
iconColor="#FF9F0A"
|
|
795
|
+
onPress={() => {
|
|
796
|
+
setThresholdExpanded(e => !e)
|
|
797
|
+
if (!thresholdExpanded) {
|
|
798
|
+
// Pre-fill input with current value in display currency
|
|
799
|
+
if (thresholdSats === 0) {
|
|
800
|
+
setThresholdInput('0')
|
|
801
|
+
} else if (isFiatCurrency(currentCurrency)) {
|
|
802
|
+
const per = satoshisPerFiatUnit(currentCurrency, satoshisPerUSD, usdToFiat)
|
|
803
|
+
if (per > 0) {
|
|
804
|
+
setThresholdInput((thresholdSats / per).toFixed(fiatFractionDigits(currentCurrency)))
|
|
805
|
+
} else {
|
|
806
|
+
setThresholdInput(String(thresholdSats))
|
|
807
|
+
}
|
|
808
|
+
} else {
|
|
809
|
+
setThresholdInput(String(thresholdSats))
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}}
|
|
813
|
+
showChevron={thresholdExpanded}
|
|
814
|
+
chevronDown={thresholdExpanded}
|
|
815
|
+
/>
|
|
816
|
+
{thresholdExpanded && (
|
|
817
|
+
<View style={localStyles.networkList}>
|
|
818
|
+
<View style={localStyles.thresholdRow}>
|
|
819
|
+
<TextInput
|
|
820
|
+
style={[localStyles.thresholdInput, { color: colors.textPrimary, borderColor: colors.separator }]}
|
|
821
|
+
value={thresholdInput}
|
|
822
|
+
onChangeText={handleThresholdInput}
|
|
823
|
+
keyboardType={
|
|
824
|
+
isFiatCurrency(currentCurrency) && fiatFractionDigits(currentCurrency) > 0
|
|
825
|
+
? 'decimal-pad'
|
|
826
|
+
: 'numeric'
|
|
827
|
+
}
|
|
828
|
+
placeholder={`0 ${getUnitLabel(currentCurrency)}`}
|
|
829
|
+
placeholderTextColor={colors.textSecondary}
|
|
830
|
+
returnKeyType="done"
|
|
831
|
+
/>
|
|
832
|
+
<Text style={[localStyles.thresholdUnit, { color: colors.textSecondary }]}>
|
|
833
|
+
{getUnitLabel(currentCurrency)}
|
|
834
|
+
</Text>
|
|
835
|
+
</View>
|
|
836
|
+
</View>
|
|
837
|
+
)}
|
|
838
|
+
<ListRow
|
|
839
|
+
label={t('trust_network')}
|
|
840
|
+
icon="shield-checkmark-outline"
|
|
841
|
+
iconColor="#BF5AF2"
|
|
842
|
+
onPress={() => router.push('/trust' as any)}
|
|
843
|
+
isLast
|
|
844
|
+
/>
|
|
845
|
+
</GroupedSection>
|
|
846
|
+
|
|
847
|
+
{/* ── Data & Security ── */}
|
|
848
|
+
<GroupedSection header={t('data_and_security')}>
|
|
849
|
+
{/* Vault's primary entry lives on the wallet menu (below Payments).
|
|
850
|
+
The DEV mock toggle stays here. */}
|
|
851
|
+
{__DEV__ && (
|
|
852
|
+
<ListRow
|
|
853
|
+
label={t('vault_mock_toggle')}
|
|
854
|
+
icon="bug-outline"
|
|
855
|
+
iconColor="#8E8E93"
|
|
856
|
+
showChevron={false}
|
|
857
|
+
value={vaultMockOn ? t('vault_on') : t('vault_off')}
|
|
858
|
+
onPress={() => {
|
|
859
|
+
const next = !vaultMockOn
|
|
860
|
+
setVaultMockOn(next)
|
|
861
|
+
setMockDriverEnabled(next)
|
|
862
|
+
}}
|
|
863
|
+
/>
|
|
864
|
+
)}
|
|
865
|
+
{/* Both are recovery material rather than everyday controls, so
|
|
866
|
+
they sit with the rest of the data-and-security rows. */}
|
|
867
|
+
<ListRow
|
|
868
|
+
label={t('copy_secret_words')}
|
|
869
|
+
icon="key-outline"
|
|
870
|
+
iconColor="#CC8400"
|
|
871
|
+
onPress={handleCopyMnemonic}
|
|
872
|
+
showChevron={false}
|
|
873
|
+
trailing={
|
|
874
|
+
<TouchableOpacity onPress={handleCopyMnemonic} style={{ padding: spacing.xs }}>
|
|
875
|
+
<Ionicons
|
|
876
|
+
name={copiedMnemonic ? 'checkmark' : 'copy-outline'}
|
|
877
|
+
size={18}
|
|
878
|
+
color={copiedMnemonic ? colors.success : colors.textSecondary}
|
|
879
|
+
/>
|
|
880
|
+
</TouchableOpacity>
|
|
881
|
+
}
|
|
882
|
+
/>
|
|
883
|
+
<ListRow
|
|
884
|
+
label={t('print_recovery_keys')}
|
|
885
|
+
icon="print-outline"
|
|
886
|
+
iconColor="#5856D6"
|
|
887
|
+
onPress={handlePrintRecoveryShares}
|
|
888
|
+
showChevron={false}
|
|
889
|
+
trailing={isPrinting ? <ActivityIndicator size="small" /> : undefined}
|
|
890
|
+
/>
|
|
891
|
+
<ListRow
|
|
892
|
+
label={t('storage_row')}
|
|
893
|
+
icon="server-outline"
|
|
894
|
+
iconColor="#8E8E93"
|
|
895
|
+
showChevron={false}
|
|
896
|
+
onPress={handleStorage}
|
|
897
|
+
trailing={storageBusy ? <ActivityIndicator size="small" /> : undefined}
|
|
898
|
+
/>
|
|
899
|
+
<ListRow
|
|
900
|
+
label={t('export_wallet_data')}
|
|
901
|
+
icon="share-outline"
|
|
902
|
+
iconColor="#32ADE6"
|
|
903
|
+
onPress={handleExportData}
|
|
904
|
+
showChevron={false}
|
|
905
|
+
trailing={isExporting ? <ActivityIndicator size="small" /> : undefined}
|
|
906
|
+
/>
|
|
907
|
+
<ListRow
|
|
908
|
+
label={t('import_wallet_data')}
|
|
909
|
+
icon="download-outline"
|
|
910
|
+
iconColor="#30D158"
|
|
911
|
+
onPress={handleImportData}
|
|
912
|
+
showChevron={false}
|
|
913
|
+
trailing={isImporting ? <ActivityIndicator size="small" /> : undefined}
|
|
914
|
+
/>
|
|
915
|
+
<ListRow
|
|
916
|
+
label="Debugging"
|
|
917
|
+
icon="terminal-outline"
|
|
918
|
+
iconColor="#8E8E93"
|
|
919
|
+
onPress={() => router.push('/logs' as any)}
|
|
920
|
+
isLast
|
|
921
|
+
/>
|
|
922
|
+
</GroupedSection>
|
|
923
|
+
|
|
924
|
+
{/* ── Private backup ──
|
|
925
|
+
Its own section purely so the footer can carry the disclosure: the app sends an
|
|
926
|
+
encrypted copy of the wallet database to a BSVA-operated server by default, and
|
|
927
|
+
that deserves saying out loud rather than burying in a row label. */}
|
|
928
|
+
{DEFAULT_BACKUP_URL !== '' && (
|
|
929
|
+
<GroupedSection header={t('backup_push_section')} footer={t('backup_push_disclosure')}>
|
|
930
|
+
<ListRow
|
|
931
|
+
label={t('backup_push_toggle')}
|
|
932
|
+
icon="cloud-upload-outline"
|
|
933
|
+
iconColor="#0A84FF"
|
|
934
|
+
showChevron={false}
|
|
935
|
+
value={backupPushOn ? t('vault_on') : t('vault_off')}
|
|
936
|
+
onPress={handleToggleBackupPush}
|
|
937
|
+
/>
|
|
938
|
+
{/* Erasure on request. Separate from the toggle because they are different
|
|
939
|
+
asks: the toggle stops sending anything new, this removes what is already
|
|
940
|
+
there. Turning the toggle off deliberately deletes nothing. */}
|
|
941
|
+
<ListRow
|
|
942
|
+
label={t('backup_erase_row')}
|
|
943
|
+
icon="trash-outline"
|
|
944
|
+
iconColor={colors.error}
|
|
945
|
+
destructive
|
|
946
|
+
showChevron={false}
|
|
947
|
+
onPress={handleEraseBackup}
|
|
948
|
+
trailing={erasingBackup ? <ActivityIndicator size="small" /> : undefined}
|
|
949
|
+
isLast
|
|
950
|
+
/>
|
|
951
|
+
</GroupedSection>
|
|
952
|
+
)}
|
|
953
|
+
</>
|
|
954
|
+
)}
|
|
955
|
+
|
|
956
|
+
{/* ── Account ── */}
|
|
957
|
+
<GroupedSection>
|
|
958
|
+
<ListRow
|
|
959
|
+
label={t('log_out')}
|
|
960
|
+
icon="log-out-outline"
|
|
961
|
+
iconColor={colors.error}
|
|
962
|
+
onPress={async () => {
|
|
963
|
+
if (loggingOut) return
|
|
964
|
+
const choice = await showAlert({
|
|
965
|
+
title: t('delete_wallet_warning_title'),
|
|
966
|
+
message: t('delete_wallet_warning_body'),
|
|
967
|
+
buttons: [
|
|
968
|
+
{ text: t('cancel'), style: 'cancel', key: 'cancel' },
|
|
969
|
+
{ text: t('delete_wallet_confirm'), style: 'destructive', key: 'delete' },
|
|
970
|
+
],
|
|
971
|
+
})
|
|
972
|
+
if (choice !== 'delete') return
|
|
973
|
+
setLoggingOut(true)
|
|
974
|
+
// No artificial yield before this call, unlike the wallet-creation
|
|
975
|
+
// spinner: logout() itself is a fire-and-forget kickoff (its first
|
|
976
|
+
// real work is behind an await inside its own async IIFE), so it
|
|
977
|
+
// returns to let React paint the spinner on its own. Deliberately
|
|
978
|
+
// NOT delayed further — logout's very first synchronous step stops
|
|
979
|
+
// the background monitor's task loop, and a gap here let the
|
|
980
|
+
// monitor's own pending tick sneak in a fresh task run against
|
|
981
|
+
// storage that was about to be torn down (WERR_UNKNOWN "Database
|
|
982
|
+
// not initialized" from a task caught mid-flight).
|
|
983
|
+
logout()
|
|
984
|
+
}}
|
|
985
|
+
destructive
|
|
986
|
+
showChevron={false}
|
|
987
|
+
trailing={loggingOut ? <ActivityIndicator size="small" color={colors.error} /> : undefined}
|
|
988
|
+
isLast
|
|
989
|
+
/>
|
|
990
|
+
</GroupedSection>
|
|
991
|
+
|
|
992
|
+
{/* The number we ask people to quote when something goes wrong, so it is
|
|
993
|
+
always to hand without being something to read. Quiet on purpose:
|
|
994
|
+
selectable, because the point is that it can be copied out. */}
|
|
995
|
+
{versionLabel ? (
|
|
996
|
+
<Text selectable style={[localStyles.version, { color: colors.textTertiary }]}>
|
|
997
|
+
{t('settings_version', { version: versionLabel })}
|
|
998
|
+
</Text>
|
|
999
|
+
) : null}
|
|
1000
|
+
</ScrollView>
|
|
1001
|
+
</View>
|
|
1002
|
+
)
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
const localStyles = StyleSheet.create({
|
|
1006
|
+
version: {
|
|
1007
|
+
...typography.caption1,
|
|
1008
|
+
textAlign: 'center',
|
|
1009
|
+
paddingTop: spacing.xl,
|
|
1010
|
+
paddingBottom: spacing.lg
|
|
1011
|
+
},
|
|
1012
|
+
header: {
|
|
1013
|
+
flexDirection: 'row',
|
|
1014
|
+
alignItems: 'center',
|
|
1015
|
+
justifyContent: 'space-between',
|
|
1016
|
+
paddingHorizontal: spacing.sm,
|
|
1017
|
+
paddingVertical: spacing.md,
|
|
1018
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
1019
|
+
},
|
|
1020
|
+
headerBack: {
|
|
1021
|
+
width: 44,
|
|
1022
|
+
height: 44,
|
|
1023
|
+
alignItems: 'center',
|
|
1024
|
+
justifyContent: 'center'
|
|
1025
|
+
},
|
|
1026
|
+
headerTitle: {
|
|
1027
|
+
...typography.headline,
|
|
1028
|
+
fontWeight: '600'
|
|
1029
|
+
},
|
|
1030
|
+
networkList: {
|
|
1031
|
+
paddingHorizontal: spacing.lg,
|
|
1032
|
+
paddingBottom: spacing.sm
|
|
1033
|
+
},
|
|
1034
|
+
networkOption: {
|
|
1035
|
+
flexDirection: 'row',
|
|
1036
|
+
alignItems: 'center',
|
|
1037
|
+
paddingVertical: spacing.md,
|
|
1038
|
+
paddingHorizontal: spacing.sm
|
|
1039
|
+
},
|
|
1040
|
+
networkDot: {
|
|
1041
|
+
width: 10,
|
|
1042
|
+
height: 10,
|
|
1043
|
+
borderRadius: 5,
|
|
1044
|
+
marginRight: spacing.md
|
|
1045
|
+
},
|
|
1046
|
+
networkLabel: {
|
|
1047
|
+
...typography.body
|
|
1048
|
+
},
|
|
1049
|
+
thresholdRow: {
|
|
1050
|
+
flexDirection: 'row',
|
|
1051
|
+
alignItems: 'center',
|
|
1052
|
+
paddingTop: spacing.lg,
|
|
1053
|
+
paddingBottom: spacing.sm
|
|
1054
|
+
},
|
|
1055
|
+
thresholdInput: {
|
|
1056
|
+
flex: 1,
|
|
1057
|
+
...typography.body,
|
|
1058
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
1059
|
+
borderRadius: 8,
|
|
1060
|
+
paddingHorizontal: spacing.md,
|
|
1061
|
+
paddingVertical: spacing.sm
|
|
1062
|
+
},
|
|
1063
|
+
thresholdUnit: {
|
|
1064
|
+
...typography.body,
|
|
1065
|
+
marginLeft: spacing.sm
|
|
1066
|
+
},
|
|
1067
|
+
arcInputRow: {
|
|
1068
|
+
paddingTop: spacing.md,
|
|
1069
|
+
gap: spacing.xs
|
|
1070
|
+
},
|
|
1071
|
+
arcLabel: {
|
|
1072
|
+
...typography.caption1,
|
|
1073
|
+
marginBottom: spacing.xs
|
|
1074
|
+
},
|
|
1075
|
+
arcInput: {
|
|
1076
|
+
...typography.body,
|
|
1077
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
1078
|
+
borderRadius: 8,
|
|
1079
|
+
paddingHorizontal: spacing.md,
|
|
1080
|
+
paddingVertical: spacing.sm
|
|
1081
|
+
},
|
|
1082
|
+
arcButtonRow: {
|
|
1083
|
+
flexDirection: 'row',
|
|
1084
|
+
gap: spacing.sm,
|
|
1085
|
+
paddingTop: spacing.lg,
|
|
1086
|
+
paddingBottom: spacing.sm
|
|
1087
|
+
},
|
|
1088
|
+
arcButton: {
|
|
1089
|
+
flex: 1,
|
|
1090
|
+
borderRadius: 8,
|
|
1091
|
+
paddingVertical: spacing.sm,
|
|
1092
|
+
alignItems: 'center',
|
|
1093
|
+
justifyContent: 'center'
|
|
1094
|
+
}
|
|
1095
|
+
})
|