@bsv/expo-wallet-toolbox 0.22.0 → 0.24.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 +241 -0
- package/README.md +10 -9
- package/android/build.gradle +15 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/org/bsv/boundedfetch/BoundedBody.java +19 -0
- package/android/src/main/java/org/bsv/boundedfetch/BoundedConnection.java +28 -0
- package/android/src/main/java/org/bsv/boundedfetch/BsvBoundedFetchModule.kt +114 -0
- package/core/backup/RemoteSyncReader.ts +71 -46
- package/core/backup/client.ts +6 -15
- package/core/backup/codec.ts +78 -13
- package/core/backup/constants.ts +3 -9
- package/core/backup/cursor.ts +8 -0
- package/core/backup/push.ts +26 -16
- package/core/backup/restore.ts +6 -5
- package/core/bridge/BrowserBridgeProvider.tsx +273 -0
- package/core/bridge/bindings.ts +459 -0
- package/core/bridge/conformance.ts +222 -0
- package/core/bridge/consent.ts +494 -0
- package/core/bridge/consentSheetSource.ts +98 -0
- package/core/bridge/dispatcher.ts +621 -0
- package/core/bridge/inbox.ts +569 -0
- package/core/bridge/index.ts +48 -0
- package/core/bridge/loopback/cors.ts +57 -0
- package/core/bridge/loopback/endpoints.ts +11 -0
- package/core/bridge/loopback/hostCheck.ts +25 -0
- package/core/bridge/loopback/index.ts +7 -0
- package/core/bridge/loopback/launchProof.ts +166 -0
- package/core/bridge/loopback/router.ts +770 -0
- package/core/bridge/loopback/routerTypes.ts +115 -0
- package/core/bridge/loopback/status.ts +52 -0
- package/core/bridge/memoryInboxStore.ts +231 -0
- package/core/bridge/permissionPolicy.ts +247 -0
- package/core/bridge/policy.ts +72 -0
- package/core/bridge/protocol/base64url.ts +64 -0
- package/core/bridge/protocol/connectionError.ts +79 -0
- package/core/bridge/protocol/constants.ts +21 -0
- package/core/bridge/protocol/continuity.ts +21 -0
- package/core/bridge/protocol/descriptor.ts +395 -0
- package/core/bridge/protocol/envelopes.ts +188 -0
- package/core/bridge/protocol/errorCodec.ts +164 -0
- package/core/bridge/protocol/json.ts +237 -0
- package/core/bridge/protocol/limits.ts +43 -0
- package/core/bridge/protocol/methods.ts +55 -0
- package/core/bridge/protocol/origin.ts +130 -0
- package/core/bridge/runtime.ts +642 -0
- package/core/bridge/runtimeFlags.ts +34 -0
- package/core/bridge/testing/conformanceCases.ts +149 -0
- package/core/bridge/testing/pageClient.ts +44 -0
- package/core/bridge/unverifiedManager.ts +97 -0
- package/core/bridge/unverifiedOriginator.ts +79 -0
- package/core/config.tsx +1 -16
- package/core/constants.ts +7 -11
- package/core/context/WalletConnectionContext.tsx +92 -49
- package/core/context/WalletContext.tsx +288 -165
- package/core/context/sessionTeardown.ts +46 -0
- package/core/context/usePairingAttempt.ts +31 -0
- package/core/e2e/broadcaster.ts +25 -0
- package/core/e2e/consentFixture.ts +46 -0
- package/core/e2e/mode.ts +42 -0
- package/core/headers/OfflineFirstChaintracks.ts +57 -107
- package/core/headers/headerConsensus.ts +230 -0
- package/core/headers/headerStore.ts +344 -122
- package/core/headers/prewarm.ts +4 -7
- package/core/headers/syncHeaders.ts +82 -12
- package/core/hooks/usePermissionQueue.ts +89 -34
- package/core/i18n/translations.tsx +958 -24
- package/core/identity/handleRegistry/client.ts +4 -2
- package/core/identity/handleRegistry/resolver.ts +7 -11
- package/core/index.ts +17 -0
- package/core/localpay/pending.ts +39 -4
- package/core/network/boundedFetch.ts +101 -0
- package/core/networks.ts +11 -13
- package/core/pay/rails/address.ts +5 -4
- package/core/pay/rails/handle.ts +3 -1
- package/core/pay/rails/sweep.ts +791 -0
- package/core/peerpay/brc29.ts +4 -0
- package/core/peerpay/handleResendRequests.ts +15 -2
- package/core/peerpay/outbox.ts +115 -2
- package/core/profiles/assertProfileEmpty.ts +2 -2
- package/core/profiles/profileStore.ts +3 -2
- package/core/services/arcadeBroadcastProvider.ts +260 -114
- package/core/services/autoApprovePolicy.ts +7 -1
- package/core/services/capWalletArgs.ts +2 -1
- package/core/services/permissionPrompts.ts +132 -0
- package/core/services/secrets/kek.ts +5 -0
- package/core/services/secrets/migration.ts +27 -2
- package/core/services/secrets/policy.ts +6 -0
- package/core/services/signingPermissionPolicy.ts +230 -2
- package/core/services/vault/VaultKeyService.ts +5 -2
- package/core/services/vault/ceremony.ts +2 -2
- package/core/services/vault/ceremonyHost.ts +1 -1
- package/core/services/vault/guard.ts +20 -0
- package/core/services/vault/outputAuthority.ts +76 -0
- package/core/services/vault/transfers.ts +52 -28
- package/core/services/vault/vaultStore.ts +60 -14
- package/core/services/walletArgLimits.ts +17 -2
- package/core/services/walletConnectionValidation.ts +13 -1
- package/core/services/walletServiceConfig.ts +8 -7
- package/core/storage/encryptedDbImage.ts +325 -0
- package/core/stores/ConnectionStore.ts +17 -0
- package/core/toolboxConfig.ts +78 -2
- package/expo-module.config.json +5 -0
- package/ios/BoundedBody.swift +15 -0
- package/ios/BsvBoundedFetch.podspec +17 -0
- package/ios/BsvBoundedFetchModule.swift +121 -0
- package/package.json +12 -8
- package/ui/bridgeSheet/ContextRelay.tsx +86 -0
- package/ui/bridgeSheet/relayedContexts.ts +21 -0
- package/ui/components/pay/AddressReceive.tsx +6 -2
- package/ui/components/pay/ImportedOutboxApproval.tsx +142 -0
- package/ui/components/pay/PayCellRow.tsx +3 -1
- package/ui/components/pay/PayForm.tsx +12 -2
- package/ui/components/pay/RecipientField.tsx +1 -0
- package/ui/components/pay/RequestHub.tsx +1 -0
- package/ui/components/pay/UniversalSend.tsx +110 -42
- package/ui/components/ui/ListRow.tsx +10 -2
- package/ui/components/ui/PermissionSheet.tsx +534 -158
- package/ui/components/ui/Sheet.tsx +59 -7
- package/ui/components/ui/sheetResumeSignal.ts +19 -0
- package/ui/components/vault/KeyChooser.tsx +1 -1
- package/ui/components/wallet/AmountInput.tsx +4 -1
- package/ui/components/wallet/BackupReminderSheet.tsx +8 -1
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +2 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +6 -1
- package/ui/components/wallet/ProfileButton.tsx +1 -0
- package/ui/exportDatabases.ts +94 -5
- package/ui/hooks/useExportWalletData.ts +37 -24
- package/ui/importDatabases.ts +154 -34
- package/ui/index.ts +4 -0
- package/ui/screens/ConnectionsScreen.tsx +12 -3
- package/ui/screens/PairScreen.tsx +10 -3
- package/ui/screens/PayScreen.tsx +1 -0
- package/ui/screens/TrustScreen.tsx +6 -3
- package/ui/screens/VaultScreen.tsx +13 -3
- package/ui/screens/VaultTransferScreen.tsx +6 -3
- package/ui/screens/WalletConfigScreen.tsx +30 -3
- package/ui/screens/WalletHomeScreen.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsv/expo-wallet-toolbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Wallet screens and P2P local-payment backend for Expo/React Native apps, extracted from BSV Wallet.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -26,20 +26,23 @@
|
|
|
26
26
|
"core",
|
|
27
27
|
"ui",
|
|
28
28
|
"assets",
|
|
29
|
-
"CHANGELOG.md"
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"android",
|
|
31
|
+
"ios",
|
|
32
|
+
"expo-module.config.json"
|
|
30
33
|
],
|
|
31
34
|
"peerDependencies": {
|
|
32
35
|
"@bsv/air-gap": "^0.1.3",
|
|
33
36
|
"@bsv/backup-cache-client": "^0.1.0",
|
|
34
|
-
"@bsv/btms-permission-module": "^1.2.
|
|
37
|
+
"@bsv/btms-permission-module": "^1.2.4",
|
|
35
38
|
"@bsv/color-permission-module": "^0.2.0",
|
|
36
39
|
"@bsv/mandala": "^0.5.0",
|
|
37
|
-
"@bsv/message-box-client": "^2.
|
|
40
|
+
"@bsv/message-box-client": "^2.7.0",
|
|
38
41
|
"@bsv/react-native-localpay-transport": "*",
|
|
39
|
-
"@bsv/sdk": "^4.0.
|
|
42
|
+
"@bsv/sdk": "^4.0.1",
|
|
40
43
|
"@bsv/templates": "^2.2.0",
|
|
41
|
-
"@bsv/wallet-toolbox-mobile": "^2.15.
|
|
42
|
-
"@bsv/webrtpay": "^0.2.
|
|
44
|
+
"@bsv/wallet-toolbox-mobile": "^2.15.1",
|
|
45
|
+
"@bsv/webrtpay": "^0.2.3",
|
|
43
46
|
"@expo/vector-icons": "^15.0.3",
|
|
44
47
|
"@noble/curves": "^2.3.0",
|
|
45
48
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
@@ -82,7 +85,8 @@
|
|
|
82
85
|
"react-native-secp-native": "*",
|
|
83
86
|
"react-native-sse": "^1.2.1",
|
|
84
87
|
"react-native-svg": "^15.15.3",
|
|
85
|
-
"react-native-yubikey": "*"
|
|
88
|
+
"react-native-yubikey": "*",
|
|
89
|
+
"expo-modules-core": "~57.0.0"
|
|
86
90
|
},
|
|
87
91
|
"peerDependenciesMeta": {
|
|
88
92
|
"@bsv/webrtpay": {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useContext, useLayoutEffect, useSyncExternalStore } from 'react'
|
|
2
|
+
import { RELAYED_CONTEXTS } from './relayedContexts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Feeds a second React root the contexts of the first (spec 7.4, 10). `ContextRelayPublisher` is rendered inside
|
|
6
|
+
* the first root's providers and writes each relayed context's current value into a module-level store;
|
|
7
|
+
* `ContextRelaySubscriber` is the second root's top and re-provides those values to its children. Both roots live
|
|
8
|
+
* in one JS runtime, so the store is shared by module identity and a value change (a theme switch, a wallet state
|
|
9
|
+
* update) reaches the subscriber without remounting it.
|
|
10
|
+
*
|
|
11
|
+
* The subscriber renders nothing until every entry has been published once: a child must never read a context
|
|
12
|
+
* default (the default of `WalletContext` is a wallet that is not there).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type Snapshot = { readonly values: ReadonlyArray<unknown>; readonly published: ReadonlyArray<boolean> }
|
|
16
|
+
|
|
17
|
+
const EMPTY: Snapshot = {
|
|
18
|
+
values: RELAYED_CONTEXTS.map(() => undefined),
|
|
19
|
+
published: RELAYED_CONTEXTS.map(() => false)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let snapshot: Snapshot = EMPTY
|
|
23
|
+
const listeners = new Set<() => void>()
|
|
24
|
+
|
|
25
|
+
function emit(): void {
|
|
26
|
+
for (const fn of [...listeners]) fn()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function subscribe(fn: () => void): () => void {
|
|
30
|
+
listeners.add(fn)
|
|
31
|
+
return () => {
|
|
32
|
+
listeners.delete(fn)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getSnapshot(): Snapshot {
|
|
37
|
+
return snapshot
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function publish(values: ReadonlyArray<unknown>): void {
|
|
41
|
+
const changed = values.some((v, i) => !snapshot.published[i] || !Object.is(v, snapshot.values[i]))
|
|
42
|
+
if (!changed) return
|
|
43
|
+
snapshot = { values: [...values], published: values.map(() => true) }
|
|
44
|
+
emit()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Publishes one entry only; tests use it to prove the subscriber waits for every entry. Not exported from the barrel. */
|
|
48
|
+
export function publishRelayedContextForTest(name: string, value: unknown): void {
|
|
49
|
+
const i = RELAYED_CONTEXTS.findIndex(e => e.name === name)
|
|
50
|
+
if (i < 0) throw new Error(`not a relayed context: ${name}`)
|
|
51
|
+
const values = [...snapshot.values]
|
|
52
|
+
const published = [...snapshot.published]
|
|
53
|
+
values[i] = value
|
|
54
|
+
published[i] = true
|
|
55
|
+
snapshot = { values, published }
|
|
56
|
+
emit()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Clears the store: tests, and sign-out (a later sheet must not render a signed-out wallet's values). */
|
|
60
|
+
export function resetContextRelay(): void {
|
|
61
|
+
snapshot = EMPTY
|
|
62
|
+
emit()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Rendered once inside the first root's providers. Renders nothing. */
|
|
66
|
+
export const ContextRelayPublisher: React.FC = () => {
|
|
67
|
+
// The list is a module constant, so the number of hooks never changes between renders.
|
|
68
|
+
const values = RELAYED_CONTEXTS.map(entry => useContext(entry.context)) // eslint-disable-line react-hooks/rules-of-hooks
|
|
69
|
+
// Layout effect: the second root learns the value before the next paint, so a theme switch never shows one frame
|
|
70
|
+
// of mixed colours across the two roots.
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
|
+
publish(values)
|
|
73
|
+
})
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The second root's top: re-provides each relayed context with the live value. */
|
|
78
|
+
export const ContextRelaySubscriber: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
79
|
+
const snap = useSyncExternalStore(subscribe, getSnapshot, getSnapshot)
|
|
80
|
+
if (!snap.published.every(Boolean)) return null
|
|
81
|
+
// The nesting is stable (same order, same types), so a value change updates providers in place and never remounts.
|
|
82
|
+
return RELAYED_CONTEXTS.reduceRight<React.ReactNode>(
|
|
83
|
+
(inner, entry, i) => <entry.context.Provider value={snap.values[i]}>{inner}</entry.context.Provider>,
|
|
84
|
+
children
|
|
85
|
+
) as React.ReactElement
|
|
86
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
import { ThemeContext } from '../../core/theme/ThemeContext'
|
|
3
|
+
import { WalletContext } from '../../core/context/WalletContext'
|
|
4
|
+
import { ExchangeRateContext } from '../../core/context/ExchangeRateContext'
|
|
5
|
+
import { UserContext } from '../../core/context/UserContext'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The React contexts `PermissionSheet` (and the cards it renders) read. The Android bridge sheet runs on a second
|
|
9
|
+
* React root of the same React host (spec 7.4), and a second root does not see the first root's providers, so each
|
|
10
|
+
* context listed here is copied across by `ContextRelay`. A context the sheet reads that is not listed here would
|
|
11
|
+
* silently fall back to its default value on the second root: `relayedContexts.test.tsx` scans the sheet's import
|
|
12
|
+
* closure and fails until the new context is added.
|
|
13
|
+
*
|
|
14
|
+
* Language is intentionally not listed: i18n is a module singleton and `useTranslation` reads it without a provider.
|
|
15
|
+
*/
|
|
16
|
+
export const RELAYED_CONTEXTS: ReadonlyArray<{ name: string; context: React.Context<any> }> = [
|
|
17
|
+
{ name: 'ThemeContext', context: ThemeContext },
|
|
18
|
+
{ name: 'WalletContext', context: WalletContext },
|
|
19
|
+
{ name: 'ExchangeRateContext', context: ExchangeRateContext },
|
|
20
|
+
{ name: 'UserContext', context: UserContext }
|
|
21
|
+
]
|
|
@@ -319,13 +319,17 @@ export default function AddressReceive({
|
|
|
319
319
|
<AmountDisplay>{initialSats}</AmountDisplay>
|
|
320
320
|
</Text>
|
|
321
321
|
)}
|
|
322
|
-
<View style={styles.qrHero}>
|
|
322
|
+
<View style={styles.qrHero} testID="receive-qr">
|
|
323
323
|
<View style={styles.qrPlate}>
|
|
324
324
|
<QRCode value={address} size={240} color="#000" backgroundColor="#fff" />
|
|
325
325
|
</View>
|
|
326
326
|
</View>
|
|
327
327
|
|
|
328
|
-
<TouchableOpacity
|
|
328
|
+
<TouchableOpacity
|
|
329
|
+
onPress={handleCopy}
|
|
330
|
+
testID="receive-address"
|
|
331
|
+
style={[styles.addressChip, { backgroundColor: colors.fillTertiary }]}
|
|
332
|
+
>
|
|
329
333
|
<Text
|
|
330
334
|
style={[styles.addressText, { color: colors.textSecondary }]}
|
|
331
335
|
numberOfLines={1}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'
|
|
3
|
+
import type { WalletInterface } from '@bsv/sdk'
|
|
4
|
+
import type { ThemeColors } from '../../../core/theme/ThemeContext'
|
|
5
|
+
import { hitTargets, spacing, typography } from '../../../core/theme/tokens'
|
|
6
|
+
import { releaseImportedOutboxEntry, validateImportedOutboxEntry, type OutboxEntry } from '../../../core/peerpay/outbox'
|
|
7
|
+
import { TaskDrainOutbox } from '../../../core/monitor/TaskDrainOutbox'
|
|
8
|
+
import PressableScale from '../ui/PressableScale'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
entry: OutboxEntry
|
|
12
|
+
storage: Parameters<typeof releaseImportedOutboxEntry>[0] | null | undefined
|
|
13
|
+
wallet: Pick<WalletInterface, 'getPublicKey'> | null
|
|
14
|
+
adminOriginator: string
|
|
15
|
+
colors: Pick<ThemeColors, 'textPrimary' | 'textSecondary' | 'accent' | 'separator'>
|
|
16
|
+
t: (key: string, values?: Record<string, string | number>) => string
|
|
17
|
+
disabled: boolean
|
|
18
|
+
onApproved: (entry: OutboxEntry) => void | Promise<void>
|
|
19
|
+
onCancel: () => void
|
|
20
|
+
onError: (error: unknown) => void | Promise<void>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Inline approval stays in the Activity window protected by obscured-touch
|
|
24
|
+
* filtering. Never offer imported display fields before signed-output validation. */
|
|
25
|
+
export default function ImportedOutboxApproval({
|
|
26
|
+
entry,
|
|
27
|
+
storage,
|
|
28
|
+
wallet,
|
|
29
|
+
adminOriginator,
|
|
30
|
+
colors,
|
|
31
|
+
t,
|
|
32
|
+
disabled,
|
|
33
|
+
onApproved,
|
|
34
|
+
onCancel,
|
|
35
|
+
onError
|
|
36
|
+
}: Props) {
|
|
37
|
+
const [reviewed, setReviewed] = useState<OutboxEntry | null>(null)
|
|
38
|
+
const [busy, setBusy] = useState(false)
|
|
39
|
+
const epoch = useRef(0)
|
|
40
|
+
const inFlight = useRef<object | null>(null)
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
epoch.current++
|
|
43
|
+
inFlight.current = null
|
|
44
|
+
setReviewed(null)
|
|
45
|
+
setBusy(false)
|
|
46
|
+
return () => {
|
|
47
|
+
epoch.current++
|
|
48
|
+
inFlight.current = null
|
|
49
|
+
}
|
|
50
|
+
}, [entry.id, wallet, storage, adminOriginator])
|
|
51
|
+
|
|
52
|
+
const proceed = async () => {
|
|
53
|
+
if (disabled || !wallet || !storage || inFlight.current) return
|
|
54
|
+
const attempt = {}
|
|
55
|
+
const version = epoch.current
|
|
56
|
+
const current = () => version === epoch.current
|
|
57
|
+
inFlight.current = attempt
|
|
58
|
+
setBusy(true)
|
|
59
|
+
try {
|
|
60
|
+
if (!reviewed) {
|
|
61
|
+
const checked = await validateImportedOutboxEntry(entry, wallet, adminOriginator)
|
|
62
|
+
if (current()) setReviewed(checked)
|
|
63
|
+
} else {
|
|
64
|
+
const approved = await releaseImportedOutboxEntry(storage, reviewed, wallet, adminOriginator)
|
|
65
|
+
try {
|
|
66
|
+
if (!current()) return
|
|
67
|
+
setReviewed(null)
|
|
68
|
+
await onApproved(approved)
|
|
69
|
+
} finally {
|
|
70
|
+
// A clean drain ignored this row while it was held. Wake it only
|
|
71
|
+
// after the immediate attempt settles, so this notification cannot
|
|
72
|
+
// start an overlapping attempt. Also covers a retired screen after
|
|
73
|
+
// release: the approved row is still durable pending work.
|
|
74
|
+
TaskDrainOutbox.noteEnqueued()
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (current()) {
|
|
79
|
+
setReviewed(null)
|
|
80
|
+
await onError(error)
|
|
81
|
+
}
|
|
82
|
+
} finally {
|
|
83
|
+
if (inFlight.current === attempt) {
|
|
84
|
+
inFlight.current = null
|
|
85
|
+
setBusy(false)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const cancel = () => {
|
|
90
|
+
if (disabled || !wallet || !storage || inFlight.current) return
|
|
91
|
+
if (reviewed) setReviewed(null)
|
|
92
|
+
else onCancel()
|
|
93
|
+
}
|
|
94
|
+
const inactive = disabled || busy || !wallet || !storage
|
|
95
|
+
return (
|
|
96
|
+
<View>
|
|
97
|
+
{reviewed && (
|
|
98
|
+
<Text style={[styles.detail, { color: colors.textPrimary }]}>
|
|
99
|
+
{t('review_imported_payment_detail', { amount: reviewed.token.amount, recipient: reviewed.recipient })}
|
|
100
|
+
</Text>
|
|
101
|
+
)}
|
|
102
|
+
<View style={[styles.buttons, { borderTopColor: colors.separator }]}>
|
|
103
|
+
<PressableScale
|
|
104
|
+
onPress={cancel}
|
|
105
|
+
disabled={inactive}
|
|
106
|
+
haptic="tap"
|
|
107
|
+
style={[styles.button, { borderRightWidth: StyleSheet.hairlineWidth, borderRightColor: colors.separator }]}
|
|
108
|
+
>
|
|
109
|
+
<Text style={[styles.label, { color: colors.textSecondary }]}>{t('cancel')}</Text>
|
|
110
|
+
</PressableScale>
|
|
111
|
+
<PressableScale onPress={() => void proceed()} disabled={inactive} haptic="tap" style={styles.button}>
|
|
112
|
+
{busy ? (
|
|
113
|
+
<ActivityIndicator size="small" color={colors.accent} />
|
|
114
|
+
) : (
|
|
115
|
+
<Text style={[styles.label, { color: colors.accent }]}>
|
|
116
|
+
{t(reviewed ? 'send' : 'review_imported_payment')}
|
|
117
|
+
</Text>
|
|
118
|
+
)}
|
|
119
|
+
</PressableScale>
|
|
120
|
+
</View>
|
|
121
|
+
</View>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const styles = StyleSheet.create({
|
|
126
|
+
detail: { ...typography.caption1, marginBottom: spacing.sm },
|
|
127
|
+
buttons: {
|
|
128
|
+
flexDirection: 'row',
|
|
129
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
130
|
+
marginHorizontal: -spacing.lg,
|
|
131
|
+
marginBottom: -spacing.md
|
|
132
|
+
},
|
|
133
|
+
button: {
|
|
134
|
+
flex: 1,
|
|
135
|
+
minHeight: hitTargets.minimum,
|
|
136
|
+
minWidth: hitTargets.minimum,
|
|
137
|
+
paddingVertical: 13,
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
justifyContent: 'center'
|
|
140
|
+
},
|
|
141
|
+
label: { ...typography.subhead, fontWeight: '600' }
|
|
142
|
+
})
|
|
@@ -33,9 +33,10 @@ export interface PayCellRowProps {
|
|
|
33
33
|
onPress: () => void
|
|
34
34
|
/** Dimmed and unpressable — used for rails that need internet. */
|
|
35
35
|
disabled?: boolean
|
|
36
|
+
testID?: string
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
export default function PayCellRow({ title, subtitle, icon, onPress, disabled = false }: PayCellRowProps) {
|
|
39
|
+
export default function PayCellRow({ title, subtitle, icon, onPress, disabled = false, testID }: PayCellRowProps) {
|
|
39
40
|
const { colors } = useTheme()
|
|
40
41
|
const Ionicons = loadIonicons()
|
|
41
42
|
return (
|
|
@@ -52,6 +53,7 @@ export default function PayCellRow({ title, subtitle, icon, onPress, disabled =
|
|
|
52
53
|
accessibilityRole="button"
|
|
53
54
|
accessibilityState={{ disabled }}
|
|
54
55
|
accessibilityLabel={`${title}. ${subtitle}`}
|
|
56
|
+
testID={testID}
|
|
55
57
|
>
|
|
56
58
|
<View
|
|
57
59
|
style={[styles.iconWrap, { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }]}
|
|
@@ -84,7 +84,14 @@ export function PayAmountField({
|
|
|
84
84
|
}) {
|
|
85
85
|
return (
|
|
86
86
|
<PayField labelKey="amount">
|
|
87
|
-
<AmountInput
|
|
87
|
+
<AmountInput
|
|
88
|
+
value={value}
|
|
89
|
+
onChangeText={onChangeText}
|
|
90
|
+
showMax={showMax}
|
|
91
|
+
asset={asset}
|
|
92
|
+
maxValue={maxValue}
|
|
93
|
+
testID="pay-amount"
|
|
94
|
+
/>
|
|
88
95
|
{showBalance && <AvailableBalance text={availableText} note={availableNote} />}
|
|
89
96
|
</PayField>
|
|
90
97
|
)
|
|
@@ -149,7 +156,8 @@ export function PayCta({
|
|
|
149
156
|
busy,
|
|
150
157
|
labelKey = 'pay',
|
|
151
158
|
label,
|
|
152
|
-
icon = 'arrow-up'
|
|
159
|
+
icon = 'arrow-up',
|
|
160
|
+
testID
|
|
153
161
|
}: {
|
|
154
162
|
onPress: () => void
|
|
155
163
|
disabled: boolean
|
|
@@ -163,6 +171,7 @@ export function PayCta({
|
|
|
163
171
|
*/
|
|
164
172
|
label?: string
|
|
165
173
|
icon?: keyof IoniconsComponent['glyphMap']
|
|
174
|
+
testID?: string
|
|
166
175
|
}) {
|
|
167
176
|
const { t } = useTranslation()
|
|
168
177
|
const { colors } = useTheme()
|
|
@@ -174,6 +183,7 @@ export function PayCta({
|
|
|
174
183
|
onPress={onPress}
|
|
175
184
|
disabled={disabled}
|
|
176
185
|
haptic="confirm"
|
|
186
|
+
testID={testID}
|
|
177
187
|
style={[styles.cta, { backgroundColor: enabled ? colors.accent : colors.fill }]}
|
|
178
188
|
accessibilityRole="button"
|
|
179
189
|
accessibilityLabel={text}
|
|
@@ -157,6 +157,7 @@ export default function RecipientField({
|
|
|
157
157
|
placeholderTextColor={colors.textTertiary}
|
|
158
158
|
autoCapitalize="none"
|
|
159
159
|
autoCorrect={false}
|
|
160
|
+
testID="pay-recipient"
|
|
160
161
|
style={[styles.recipientInput, { color: colors.textPrimary }]}
|
|
161
162
|
/>
|
|
162
163
|
<TouchableOpacity onPress={onOpenScanner} style={styles.inputAction} accessibilityLabel={t('scan_qr_code')}>
|
|
@@ -127,6 +127,7 @@ export default function RequestHub({
|
|
|
127
127
|
three rows the user has learned would be a silent answer to a
|
|
128
128
|
question they are entitled to have answered. */}
|
|
129
129
|
<PayCellRow
|
|
130
|
+
testID="receive-bsv-address"
|
|
130
131
|
title={t('pay_method_address')}
|
|
131
132
|
subtitle={
|
|
132
133
|
!addressAvailable
|