@bsv/expo-wallet-toolbox 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +154 -30
- package/README.md +79 -79
- package/core/backup/RemoteSyncReader.ts +26 -24
- package/core/backup/appData.ts +9 -8
- package/core/backup/codec.ts +21 -18
- package/core/backup/constants.ts +5 -5
- package/core/backup/contactsBackup.ts +8 -8
- package/core/backup/cursor.ts +12 -7
- package/core/backup/derive.ts +3 -3
- package/core/backup/deviceId.ts +2 -2
- package/core/backup/erase.ts +2 -2
- package/core/backup/preference.ts +2 -2
- package/core/backup/push.ts +10 -12
- package/core/backup/restore.ts +22 -14
- package/core/backup/restoreOnImport.ts +3 -2
- package/core/config.tsx +17 -13
- package/core/constants.ts +34 -11
- package/core/contacts/contactsStore.ts +4 -3
- package/core/context/WalletConnectionContext.tsx +294 -212
- package/core/context/WalletContext.tsx +132 -97
- package/core/context/defaultWalletSettings.ts +4 -2
- package/core/demo/demoLedger.ts +1 -5
- package/core/directpay/DirectPayManager.ts +148 -29
- package/core/directpay/DirectPayProvider.tsx +26 -26
- package/core/directpay/payFlow.ts +10 -1
- package/core/directpay/receive.ts +2 -1
- package/core/directpay/settings.ts +56 -9
- package/core/directpay/types.ts +11 -2
- package/core/directpay/webrtpay.ts +4 -0
- package/core/headers/checkpoints.ts +10 -1
- package/core/headers/headerStore.ts +13 -2
- package/core/hooks/useConfirmationSound.ts +3 -3
- package/core/hooks/useHaptics.ts +23 -6
- package/core/i18n/translations.tsx +382 -209
- package/core/index.ts +2 -0
- package/core/localpay/codec.ts +12 -6
- package/core/localpay/deviceCaps.ts +4 -14
- package/core/localpay/pending.ts +2 -1
- package/core/localpay/qr.ts +1 -1
- package/core/localpay/settlementAck.ts +1 -4
- package/core/localpay/transport/ble.ts +2 -2
- package/core/localpay/transport/socket.ts +1 -1
- package/core/mandala/abortGuard.ts +1 -1
- package/core/mandala/drain.ts +3 -0
- package/core/mandala/permissionModule.ts +3 -2
- package/core/mandala/resendTransfer.ts +4 -1
- package/core/mandala/runtime.ts +4 -4
- package/core/monitor/TaskBackupPush.ts +10 -13
- package/core/net/chainMatch.ts +8 -5
- package/core/networks.ts +145 -0
- package/core/parsePeerPayURI.ts +4 -1
- package/core/pay/beefRepair.ts +6 -3
- package/core/pay/creditErrors.ts +37 -1
- package/core/pay/rails/address.ts +10 -6
- package/core/pay/rails/direct.ts +6 -2
- package/core/pay/rails/handle.ts +84 -11
- package/core/pay/rails/index.ts +18 -2
- package/core/pay/receiveHistory.ts +8 -8
- package/core/peerpay/handleResendRequests.ts +11 -18
- package/core/peerpay/inboxAttempts.ts +1 -4
- package/core/peerpay/rebuildToken.ts +12 -9
- package/core/profiles/profileStore.ts +2 -1
- package/core/profiles/removalProblems.ts +3 -1
- package/core/services/arcTokenStorage.ts +2 -1
- package/core/services/arcadeBroadcastProvider.ts +7 -17
- package/core/services/secrets/envelope.ts +1 -6
- package/core/services/secrets/hkdf.ts +1 -6
- package/core/services/secrets/index.ts +3 -22
- package/core/services/usdFxRates.ts +1 -4
- package/core/services/vault/VaultKeyService.ts +2 -1
- package/core/services/vault/chainRecovery.ts +48 -21
- package/core/services/vault/metaAuthority.ts +4 -1
- package/core/services/vault/r1comb.ts +113 -51
- package/core/services/vault/session.ts +5 -1
- package/core/services/vault/transfers.ts +699 -576
- package/core/services/vault/vaultStore.ts +12 -10
- package/core/services/walletArgLimits.ts +1 -2
- package/core/services/walletConnectionValidation.ts +44 -28
- package/core/services/walletServiceConfig.ts +9 -40
- package/core/storage/StorageExpoSQLite.ts +7 -21
- package/core/storage/methods/listActionsSql.ts +81 -67
- package/core/storage/methods/listOutputsSql.ts +21 -16
- package/core/storage/methods/reviewStatusSql.ts +1 -4
- package/core/stores/ConnectionStore.ts +1 -1
- package/core/theme/ThemeContext.tsx +12 -16
- package/core/theme/motion.ts +3 -3
- package/core/theme/tokens.ts +6 -6
- package/core/toolboxConfig.ts +23 -0
- package/core/walletDbRegistry.ts +7 -5
- package/core/walletRepair/runWalletCheck.ts +1 -4
- package/package.json +2 -2
- package/ui/components/pay/AddressReceive.tsx +3 -3
- package/ui/components/pay/HandleReceive.tsx +21 -15
- package/ui/components/pay/MessageBoxConfig.tsx +46 -20
- package/ui/components/pay/NearbyFlow.tsx +575 -507
- package/ui/components/pay/OfflineNotice.tsx +1 -3
- package/ui/components/pay/PayCellRow.tsx +1 -4
- package/ui/components/pay/PayForm.tsx +1 -3
- package/ui/components/pay/RequestHub.tsx +14 -6
- package/ui/components/pay/UniversalSend.tsx +79 -27
- package/ui/components/pay/tokenSendCopy.ts +1 -2
- package/ui/components/pay/useRecipientInput.ts +2 -2
- package/ui/components/security/WalletLockNotice.tsx +1 -3
- package/ui/components/ui/AlertCard.tsx +44 -45
- package/ui/components/ui/BlurChrome.tsx +4 -15
- package/ui/components/ui/Celebration.tsx +3 -3
- package/ui/components/ui/ChoiceSheet.ts +1 -3
- package/ui/components/ui/ErrorBoundary.tsx +2 -6
- package/ui/components/ui/GroupedList.tsx +13 -31
- package/ui/components/ui/IconButton.tsx +6 -9
- package/ui/components/ui/ListRow.tsx +19 -25
- package/ui/components/ui/PresenceRow.tsx +4 -4
- package/ui/components/ui/PressableScale.tsx +24 -20
- package/ui/components/ui/Toast.tsx +23 -16
- package/ui/components/vault/KeyChooser.tsx +9 -6
- package/ui/components/vault/VaultBackdrop.tsx +1 -8
- package/ui/components/vault/VaultCeremonySheet.tsx +5 -5
- package/ui/components/wallet/ActivityRow.tsx +3 -2
- package/ui/components/wallet/BackupReminderSheet.tsx +1 -5
- package/ui/components/wallet/Balance.tsx +4 -1
- package/ui/components/wallet/ContactActivityList.tsx +7 -7
- package/ui/components/wallet/IconPickerSheet.tsx +1 -5
- package/ui/components/wallet/ProfileSwitcherPopover.tsx +6 -1
- package/ui/components/wallet/tokenEviction.ts +4 -1
- package/ui/hooks/useMandala.ts +1 -7
- package/ui/hooks/useOfflineNoticeActions.ts +21 -27
- package/ui/hooks/useSpendableBalance.ts +2 -2
- package/ui/hooks/useVaultCoverage.ts +7 -1
- package/ui/index.ts +9 -1
- package/ui/resolveIdentity.ts +20 -8
- package/ui/screens/ConnectionsScreen.tsx +44 -18
- package/ui/screens/LogsScreen.tsx +24 -22
- package/ui/screens/PairScreen.tsx +85 -54
- package/ui/screens/PayScreen.tsx +5 -1
- package/ui/screens/ProfileScreen.tsx +0 -3
- package/ui/screens/TrustScreen.tsx +125 -80
- package/ui/screens/VaultScreen.tsx +19 -7
- package/ui/screens/VaultTransferScreen.tsx +5 -1
- package/ui/screens/WalletCheckScreen.tsx +14 -17
- package/ui/screens/WalletConfigScreen.tsx +414 -376
- package/ui/screens/WalletHomeScreen.tsx +47 -42
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react'
|
|
2
|
-
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
3
2
|
import { PeerPayClient } from '@bsv/message-box-client'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
LEGACY_MESSAGE_BOX_URL,
|
|
7
|
-
MESSAGE_BOX_URL_KEY,
|
|
8
|
-
NO_MESSAGE_BOX
|
|
9
|
-
} from '@bsv/expo-wallet-toolbox'
|
|
3
|
+
import { bindMessageBoxNetwork, readMessageBoxUrl } from '../../core/pay/rails/handle'
|
|
4
|
+
import type { AppChain } from '../../core/networks'
|
|
10
5
|
import { nackRejectedReceived, sendBouncedOfflineNack } from '../../core/peerpay/offlineNacks'
|
|
11
6
|
import { updateOfflineAction, type OfflineActionRow } from '../../core/storage/methods/offlineActions'
|
|
12
7
|
import type { StorageExpoSQLite } from '../../core/storage/StorageExpoSQLite'
|
|
13
8
|
import { showToast } from '../components/ui/Toast'
|
|
14
9
|
import { offlineActionDetails } from '../components/pay/OfflineNotice'
|
|
15
|
-
import { profileScopedKey } from '../../core/profiles/profileStore'
|
|
16
|
-
|
|
17
|
-
async function readMessageBoxUrl(): Promise<string | undefined> {
|
|
18
|
-
const saved = await AsyncStorage.getItem(profileScopedKey(MESSAGE_BOX_URL_KEY))
|
|
19
|
-
if (saved === NO_MESSAGE_BOX) return undefined
|
|
20
|
-
if (!saved || saved === LEGACY_MESSAGE_BOX_URL) return DEFAULT_MESSAGE_BOX_URL
|
|
21
|
-
return saved
|
|
22
|
-
}
|
|
23
10
|
|
|
24
11
|
type ClipboardModule = typeof import('@react-native-clipboard/clipboard').default
|
|
25
12
|
let clipboardModule: ClipboardModule | undefined
|
|
@@ -37,27 +24,31 @@ export function useOfflineNoticeActions(args: {
|
|
|
37
24
|
storage: StorageExpoSQLite | null | undefined
|
|
38
25
|
permissionsManager: unknown
|
|
39
26
|
adminOriginator: string
|
|
27
|
+
network: AppChain
|
|
40
28
|
online: boolean
|
|
41
29
|
rejected: OfflineActionRow[]
|
|
42
30
|
t: (key: string, options?: Record<string, unknown>) => string
|
|
43
31
|
reload: () => void
|
|
44
32
|
pushPay: (sats?: number) => void
|
|
45
33
|
}) {
|
|
46
|
-
const { storage, permissionsManager, adminOriginator, online, rejected, t, reload, pushPay } = args
|
|
34
|
+
const { storage, permissionsManager, adminOriginator, network, online, rejected, t, reload, pushPay } = args
|
|
47
35
|
const rejectedRef = useRef(rejected)
|
|
48
36
|
rejectedRef.current = rejected
|
|
49
37
|
|
|
50
38
|
const makeClient = useCallback(async () => {
|
|
51
39
|
const pm = permissionsManager
|
|
52
40
|
if (!pm) return undefined
|
|
53
|
-
const url = await readMessageBoxUrl()
|
|
41
|
+
const url = await readMessageBoxUrl(network)
|
|
54
42
|
if (!url) return undefined
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
return bindMessageBoxNetwork(
|
|
44
|
+
new PeerPayClient({
|
|
45
|
+
messageBoxHost: url,
|
|
46
|
+
walletClient: pm as WalletClient,
|
|
47
|
+
originator: adminOriginator
|
|
48
|
+
}),
|
|
49
|
+
network
|
|
50
|
+
)
|
|
51
|
+
}, [permissionsManager, adminOriginator, network])
|
|
61
52
|
|
|
62
53
|
useEffect(() => {
|
|
63
54
|
if (!online || !storage || rejected.length === 0) return
|
|
@@ -97,10 +88,13 @@ export function useOfflineNoticeActions(args: {
|
|
|
97
88
|
[makeClient, storage, t]
|
|
98
89
|
)
|
|
99
90
|
|
|
100
|
-
const onCopyDetails = useCallback(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
const onCopyDetails = useCallback(
|
|
92
|
+
(row: OfflineActionRow) => {
|
|
93
|
+
loadClipboard().setString(offlineActionDetails(row))
|
|
94
|
+
showToast(t('copied'), { type: 'success' })
|
|
95
|
+
},
|
|
96
|
+
[t]
|
|
97
|
+
)
|
|
104
98
|
|
|
105
99
|
const onDismiss = useCallback(
|
|
106
100
|
async (row: OfflineActionRow) => {
|
|
@@ -32,7 +32,7 @@ export function useSpendableBalance(): number | null {
|
|
|
32
32
|
const cached = await AsyncStorage.getItem(cacheKey)
|
|
33
33
|
const value = cached == null ? NaN : Number(cached)
|
|
34
34
|
if (!cancelled && Number.isFinite(value)) {
|
|
35
|
-
setBalance(prev => prev?.key === cacheKey ? prev : { key: cacheKey, value })
|
|
35
|
+
setBalance(prev => (prev?.key === cacheKey ? prev : { key: cacheKey, value }))
|
|
36
36
|
}
|
|
37
37
|
} catch {
|
|
38
38
|
// A broken cache must not prevent the live read below.
|
|
@@ -54,7 +54,7 @@ export function useSpendableBalance(): number | null {
|
|
|
54
54
|
total = totalOutputs ?? 0
|
|
55
55
|
}
|
|
56
56
|
if (cancelled) return
|
|
57
|
-
setBalance(prev => prev?.key === cacheKey && prev.value === total ? prev : { key: cacheKey, value: total })
|
|
57
|
+
setBalance(prev => (prev?.key === cacheKey && prev.value === total ? prev : { key: cacheKey, value: total }))
|
|
58
58
|
await AsyncStorage.setItem(cacheKey, String(total))
|
|
59
59
|
} catch {
|
|
60
60
|
// Keep the last known figure: a failed read is not "zero satoshis".
|
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
* must not mistake "could not look" for "looked and saw nothing".
|
|
16
16
|
*/
|
|
17
17
|
import { useCallback, useEffect, useState } from 'react'
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
useWallet,
|
|
20
|
+
useVault,
|
|
21
|
+
getVaultKeyCoverage,
|
|
22
|
+
type VaultKeyCoverage,
|
|
23
|
+
type VaultWallet
|
|
24
|
+
} from '@bsv/expo-wallet-toolbox'
|
|
19
25
|
|
|
20
26
|
export function useVaultCoverage(): { coverage: VaultKeyCoverage | null; refresh: () => void } {
|
|
21
27
|
const { managers, adminOriginator, txStatusVersion } = useWallet()
|
package/ui/index.ts
CHANGED
|
@@ -57,7 +57,15 @@ export { default as AddressReceive } from './components/pay/AddressReceive'
|
|
|
57
57
|
export { default as AvailableBalance } from './components/pay/AvailableBalance'
|
|
58
58
|
export { default as HandleReceive } from './components/pay/HandleReceive'
|
|
59
59
|
export { useMessageBoxConfig, ConfigPanel } from './components/pay/MessageBoxConfig'
|
|
60
|
-
export {
|
|
60
|
+
export {
|
|
61
|
+
default as NearbyFlow,
|
|
62
|
+
type NearbyConfirm,
|
|
63
|
+
type NearbyDone,
|
|
64
|
+
type NearbyFlowProps,
|
|
65
|
+
type NearbyReceived,
|
|
66
|
+
type NearbySending,
|
|
67
|
+
type NearbyShowCode
|
|
68
|
+
} from './components/pay/NearbyFlow'
|
|
61
69
|
export { NearbyAdvisoryModal } from './components/pay/NearbyAdvisoryModal'
|
|
62
70
|
export { NotificationAdvisoryModal } from './components/pay/NotificationAdvisoryModal'
|
|
63
71
|
export { default as OfflineNotice, offlineActionDetails, type OfflineNoticeProps } from './components/pay/OfflineNotice'
|
package/ui/resolveIdentity.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
import { IdentityClient, StorageDownloader } from '@bsv/sdk'
|
|
16
16
|
import type { DisplayableIdentity, WalletInterface } from '@bsv/sdk'
|
|
17
17
|
import { isPublicHttpsUrl } from '../core/net/publicDestination'
|
|
18
|
+
import { NETWORKS, type OverlayPreset } from '../core/networks'
|
|
19
|
+
import { getActiveProfile } from '../core/profiles/profileStore'
|
|
18
20
|
|
|
19
21
|
/** Drops repeats by identityKey, keeping the first occurrence. */
|
|
20
22
|
export const uniqueIdentities = (results: DisplayableIdentity[]) => {
|
|
@@ -50,9 +52,7 @@ export async function resolveAvatarURL(urls: (string | undefined)[]): Promise<st
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/** Folds several certificates into one record, first non-empty value winning. */
|
|
53
|
-
export async function mergeIdentityRecords(
|
|
54
|
-
records: DisplayableIdentity[]
|
|
55
|
-
): Promise<DisplayableIdentity | null> {
|
|
55
|
+
export async function mergeIdentityRecords(records: DisplayableIdentity[]): Promise<DisplayableIdentity | null> {
|
|
56
56
|
const merged = records.reduce<DisplayableIdentity | null>((acc, cur) => {
|
|
57
57
|
if (!acc) return cur
|
|
58
58
|
return {
|
|
@@ -97,10 +97,7 @@ export async function resolveIdentity(
|
|
|
97
97
|
* without going through `resolveAvatarURL` first — gate it the same way here
|
|
98
98
|
* (XR-073 / SEC2-057, SEC2-076).
|
|
99
99
|
*/
|
|
100
|
-
export async function searchIdentities(
|
|
101
|
-
idClient: IdentityClient,
|
|
102
|
-
text: string
|
|
103
|
-
): Promise<DisplayableIdentity[]> {
|
|
100
|
+
export async function searchIdentities(idClient: IdentityClient, text: string): Promise<DisplayableIdentity[]> {
|
|
104
101
|
const results = await idClient.resolveByAttributes({
|
|
105
102
|
attributes: { any: text.trim() },
|
|
106
103
|
limit: 5,
|
|
@@ -115,12 +112,27 @@ export async function searchIdentities(
|
|
|
115
112
|
)
|
|
116
113
|
}
|
|
117
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The options that point an IdentityClient at the open network's overlay.
|
|
117
|
+
*
|
|
118
|
+
* Read from the active profile, which always carries the open network (a
|
|
119
|
+
* network switch rewrites it), so every screen that builds a client gets the
|
|
120
|
+
* same answer without threading the network through.
|
|
121
|
+
*/
|
|
122
|
+
export function identityClientOptions(): { networkPreset: OverlayPreset } {
|
|
123
|
+
return { networkPreset: NETWORKS[getActiveProfile().network].overlayPreset }
|
|
124
|
+
}
|
|
125
|
+
|
|
118
126
|
/**
|
|
119
127
|
* An IdentityClient for this wallet, or null if one cannot be constructed.
|
|
120
128
|
*
|
|
121
129
|
* Swallowing the throw is deliberate and matches the original call site: every
|
|
122
130
|
* identity feature is decorative relative to the payment itself, so a client
|
|
123
131
|
* that will not build must leave the screen fully usable.
|
|
132
|
+
*
|
|
133
|
+
* Lookups go to the open network's overlay. Left to itself the client asks the
|
|
134
|
+
* wallet, which reports every test chain as `testnet` — so teratest identities
|
|
135
|
+
* were looked up in testnet's overlay.
|
|
124
136
|
*/
|
|
125
137
|
export function makeIdentityClient(
|
|
126
138
|
wallet: WalletInterface | null | undefined,
|
|
@@ -128,7 +140,7 @@ export function makeIdentityClient(
|
|
|
128
140
|
): IdentityClient | null {
|
|
129
141
|
if (!wallet) return null
|
|
130
142
|
try {
|
|
131
|
-
return new IdentityClient(wallet,
|
|
143
|
+
return new IdentityClient(wallet, identityClientOptions(), adminOriginator)
|
|
132
144
|
} catch {
|
|
133
145
|
return null
|
|
134
146
|
}
|
|
@@ -144,7 +144,11 @@ function parsePairingUri(raw: string): ParseResult {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
function displayDomain(origin: string): string {
|
|
147
|
-
try {
|
|
147
|
+
try {
|
|
148
|
+
return parseExternalOrigin(origin).originator
|
|
149
|
+
} catch {
|
|
150
|
+
return 'Invalid origin'
|
|
151
|
+
}
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
@@ -194,7 +198,7 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
194
198
|
origin: external.origin,
|
|
195
199
|
topic: result.params.topic,
|
|
196
200
|
protocolID: result.params.protocolID,
|
|
197
|
-
backendIdentityKey: result.params.backendIdentityKey
|
|
201
|
+
backendIdentityKey: result.params.backendIdentityKey
|
|
198
202
|
})
|
|
199
203
|
connectionStore.stageAuthorityTag(result.params.topic, tag)
|
|
200
204
|
} catch (err) {
|
|
@@ -203,7 +207,9 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
203
207
|
}
|
|
204
208
|
await connect({ ...result.params, origin: external.origin }, wallet)
|
|
205
209
|
} catch (err) {
|
|
206
|
-
showToast(`${t('connection_failed')}: ${err instanceof Error ? err.message : t('unknown_error')}`, {
|
|
210
|
+
showToast(`${t('connection_failed')}: ${err instanceof Error ? err.message : t('unknown_error')}`, {
|
|
211
|
+
type: 'error'
|
|
212
|
+
})
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
215
|
|
|
@@ -212,7 +218,13 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
212
218
|
conn,
|
|
213
219
|
managers.permissionsManager,
|
|
214
220
|
{ liveTopic: sessionMeta?.topic, disconnect },
|
|
215
|
-
{
|
|
221
|
+
{
|
|
222
|
+
store: connectionStore,
|
|
223
|
+
guard: guardVaultAccess,
|
|
224
|
+
cap: capWalletArgs,
|
|
225
|
+
adminOriginator: ADMIN_ORIGINATOR,
|
|
226
|
+
seqKey: lastSeqKey
|
|
227
|
+
}
|
|
216
228
|
)
|
|
217
229
|
}
|
|
218
230
|
|
|
@@ -222,7 +234,9 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
222
234
|
try {
|
|
223
235
|
external = parseExternalOrigin(conn.origin)
|
|
224
236
|
} catch (err) {
|
|
225
|
-
showToast(`${t('reconnect_failed')}: ${err instanceof Error ? err.message : t('unknown_error')}`, {
|
|
237
|
+
showToast(`${t('reconnect_failed')}: ${err instanceof Error ? err.message : t('unknown_error')}`, {
|
|
238
|
+
type: 'error'
|
|
239
|
+
})
|
|
226
240
|
return
|
|
227
241
|
}
|
|
228
242
|
// XR-027: reconnect() itself authenticates only that the wallet's own
|
|
@@ -243,12 +257,17 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
243
257
|
} catch {
|
|
244
258
|
storedTag = undefined // malformed tag on disk — treat exactly like a missing one
|
|
245
259
|
}
|
|
246
|
-
const authentic = await verifyConnectionAuthorityTag(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
260
|
+
const authentic = await verifyConnectionAuthorityTag(
|
|
261
|
+
adminWallet,
|
|
262
|
+
ADMIN_ORIGINATOR,
|
|
263
|
+
{
|
|
264
|
+
origin: external.origin,
|
|
265
|
+
topic: conn.sessionId,
|
|
266
|
+
protocolID: conn.protocolID,
|
|
267
|
+
backendIdentityKey: conn.backendIdentityKey
|
|
268
|
+
},
|
|
269
|
+
storedTag
|
|
270
|
+
)
|
|
252
271
|
if (!authentic) {
|
|
253
272
|
showToast(t('reconnect_needs_reapproval'), { type: 'error' })
|
|
254
273
|
return
|
|
@@ -274,7 +293,9 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
274
293
|
conn = { ...conn, origin: external.origin }
|
|
275
294
|
await reconnect(conn, wallet)
|
|
276
295
|
} catch (err) {
|
|
277
|
-
showToast(`${t('reconnect_failed')}: ${err instanceof Error ? err.message : t('unknown_error')}`, {
|
|
296
|
+
showToast(`${t('reconnect_failed')}: ${err instanceof Error ? err.message : t('unknown_error')}`, {
|
|
297
|
+
type: 'error'
|
|
298
|
+
})
|
|
278
299
|
}
|
|
279
300
|
}
|
|
280
301
|
|
|
@@ -297,9 +318,7 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
297
318
|
<View style={styles.empty}>
|
|
298
319
|
<Ionicons name="wifi-outline" size={48} color={colors.textSecondary} style={{ marginBottom: spacing.md }} />
|
|
299
320
|
<Text style={[styles.emptyTitle, { color: colors.textPrimary }]}>{t('no_connections_yet')}</Text>
|
|
300
|
-
<Text style={[styles.emptySubtitle, { color: colors.textSecondary }]}>
|
|
301
|
-
{t('no_connections_subtitle')}
|
|
302
|
-
</Text>
|
|
321
|
+
<Text style={[styles.emptySubtitle, { color: colors.textSecondary }]}>{t('no_connections_subtitle')}</Text>
|
|
303
322
|
</View>
|
|
304
323
|
) : (
|
|
305
324
|
<>
|
|
@@ -364,11 +383,13 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
364
383
|
)}
|
|
365
384
|
</>
|
|
366
385
|
)}
|
|
367
|
-
|
|
368
386
|
</ScrollView>
|
|
369
387
|
|
|
370
388
|
<View style={[styles.footer, { borderTopColor: colors.separator }]}>
|
|
371
|
-
<TouchableOpacity
|
|
389
|
+
<TouchableOpacity
|
|
390
|
+
style={[styles.scanBtn, { backgroundColor: colors.accent }]}
|
|
391
|
+
onPress={() => setScanning(true)}
|
|
392
|
+
>
|
|
372
393
|
<Ionicons name="qr-code-outline" size={20} color={colors.textOnAccent} style={{ marginRight: spacing.sm }} />
|
|
373
394
|
<Text style={[styles.scanBtnText, { color: colors.textOnAccent }]}>{t('scan_qr_code')}</Text>
|
|
374
395
|
</TouchableOpacity>
|
|
@@ -379,7 +400,12 @@ export const ConnectionsScreen = observer(function ConnectionsScreen() {
|
|
|
379
400
|
if (text) handleScan(text.trim())
|
|
380
401
|
}}
|
|
381
402
|
>
|
|
382
|
-
<Ionicons
|
|
403
|
+
<Ionicons
|
|
404
|
+
name="clipboard-outline"
|
|
405
|
+
size={18}
|
|
406
|
+
color={colors.textSecondary}
|
|
407
|
+
style={{ marginRight: spacing.xs }}
|
|
408
|
+
/>
|
|
383
409
|
<Text style={[styles.pasteBtnText, { color: colors.textSecondary }]}>{t('paste_uri')}</Text>
|
|
384
410
|
</TouchableOpacity>
|
|
385
411
|
</View>
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, useRef } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
ScrollView,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
ActivityIndicator,
|
|
9
|
-
Platform
|
|
10
|
-
} from 'react-native'
|
|
2
|
+
import { View, Text, TouchableOpacity, ScrollView, StyleSheet, ActivityIndicator, Platform } from 'react-native'
|
|
11
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
12
4
|
import { showToast } from '../components/ui/Toast'
|
|
13
5
|
import { useTheme, spacing, typography, radii, useWallet } from '@bsv/expo-wallet-toolbox'
|
|
@@ -149,13 +141,23 @@ export function LogsScreen() {
|
|
|
149
141
|
const output = await releaseStuckReservations()
|
|
150
142
|
setLogs(prev => [
|
|
151
143
|
...prev,
|
|
152
|
-
{
|
|
144
|
+
{
|
|
145
|
+
id: `${Date.now()}_${name}`,
|
|
146
|
+
taskName: name,
|
|
147
|
+
timestamp: new Date().toISOString(),
|
|
148
|
+
output: output || '(no output)'
|
|
149
|
+
}
|
|
153
150
|
])
|
|
154
151
|
setTimeout(() => scrollRef.current?.scrollToEnd({ animated: true }), 100)
|
|
155
152
|
} catch (e: any) {
|
|
156
153
|
setLogs(prev => [
|
|
157
154
|
...prev,
|
|
158
|
-
{
|
|
155
|
+
{
|
|
156
|
+
id: `${Date.now()}_${name}`,
|
|
157
|
+
taskName: name,
|
|
158
|
+
timestamp: new Date().toISOString(),
|
|
159
|
+
output: `Error: ${e.message || 'unknown'}`
|
|
160
|
+
}
|
|
159
161
|
])
|
|
160
162
|
} finally {
|
|
161
163
|
setRunning(null)
|
|
@@ -175,9 +177,7 @@ export function LogsScreen() {
|
|
|
175
177
|
}, [])
|
|
176
178
|
|
|
177
179
|
const copyAll = useCallback(() => {
|
|
178
|
-
const text = logs
|
|
179
|
-
.map(e => `[${e.timestamp}] ${e.taskName}\n${e.output}`)
|
|
180
|
-
.join('\n\n')
|
|
180
|
+
const text = logs.map(e => `[${e.timestamp}] ${e.taskName}\n${e.output}`).join('\n\n')
|
|
181
181
|
loadClipboard().setString(text)
|
|
182
182
|
showToast('Copied all logs', { type: 'success' })
|
|
183
183
|
}, [logs])
|
|
@@ -266,7 +266,10 @@ export function LogsScreen() {
|
|
|
266
266
|
<ActivityIndicator size="small" color={colors.background} />
|
|
267
267
|
) : (
|
|
268
268
|
<Text
|
|
269
|
-
style={[
|
|
269
|
+
style={[
|
|
270
|
+
styles.taskPillText,
|
|
271
|
+
{ color: running === 'CheckUTXOs' ? colors.background : colors.textPrimary }
|
|
272
|
+
]}
|
|
270
273
|
numberOfLines={1}
|
|
271
274
|
>
|
|
272
275
|
CheckUTXOs
|
|
@@ -290,7 +293,10 @@ export function LogsScreen() {
|
|
|
290
293
|
<ActivityIndicator size="small" color={colors.background} />
|
|
291
294
|
) : (
|
|
292
295
|
<Text
|
|
293
|
-
style={[
|
|
296
|
+
style={[
|
|
297
|
+
styles.taskPillText,
|
|
298
|
+
{ color: running === 'ReleaseStuck' ? colors.background : colors.textPrimary }
|
|
299
|
+
]}
|
|
294
300
|
numberOfLines={1}
|
|
295
301
|
>
|
|
296
302
|
Release stuck
|
|
@@ -306,9 +312,7 @@ export function LogsScreen() {
|
|
|
306
312
|
style={[styles.terminal, { backgroundColor: '#12161D' }]}
|
|
307
313
|
contentContainerStyle={styles.terminalContent}
|
|
308
314
|
>
|
|
309
|
-
{logs.length === 0 &&
|
|
310
|
-
<Text style={styles.emptyText}>Tap a task above to run it and see output here.</Text>
|
|
311
|
-
)}
|
|
315
|
+
{logs.length === 0 && <Text style={styles.emptyText}>Tap a task above to run it and see output here.</Text>}
|
|
312
316
|
{logs.map(entry => {
|
|
313
317
|
const isCopied = copiedId === entry.id
|
|
314
318
|
return (
|
|
@@ -320,9 +324,7 @@ export function LogsScreen() {
|
|
|
320
324
|
>
|
|
321
325
|
<View style={styles.logHeader}>
|
|
322
326
|
<Text style={styles.logTaskName}>{entry.taskName}</Text>
|
|
323
|
-
<Text style={styles.logTimestamp}>
|
|
324
|
-
{new Date(entry.timestamp).toLocaleTimeString()}
|
|
325
|
-
</Text>
|
|
327
|
+
<Text style={styles.logTimestamp}>{new Date(entry.timestamp).toLocaleTimeString()}</Text>
|
|
326
328
|
<Ionicons
|
|
327
329
|
name={isCopied ? 'checkmark' : 'copy-outline'}
|
|
328
330
|
size={14}
|