@bsv/expo-wallet-toolbox 0.23.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.md +1 -4
  3. package/android/build.gradle +15 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/org/bsv/boundedfetch/BoundedBody.java +19 -0
  6. package/android/src/main/java/org/bsv/boundedfetch/BoundedConnection.java +28 -0
  7. package/android/src/main/java/org/bsv/boundedfetch/BsvBoundedFetchModule.kt +114 -0
  8. package/core/backup/RemoteSyncReader.ts +71 -46
  9. package/core/backup/client.ts +6 -15
  10. package/core/backup/codec.ts +78 -13
  11. package/core/backup/constants.ts +3 -9
  12. package/core/backup/cursor.ts +8 -0
  13. package/core/backup/push.ts +26 -16
  14. package/core/backup/restore.ts +6 -5
  15. package/core/bridge/inbox.ts +169 -64
  16. package/core/bridge/memoryInboxStore.ts +10 -1
  17. package/core/constants.ts +7 -11
  18. package/core/context/WalletConnectionContext.tsx +85 -48
  19. package/core/context/WalletContext.tsx +30 -32
  20. package/core/context/usePairingAttempt.ts +31 -0
  21. package/core/e2e/broadcaster.ts +25 -0
  22. package/core/e2e/consentFixture.ts +46 -0
  23. package/core/e2e/mode.ts +42 -0
  24. package/core/headers/OfflineFirstChaintracks.ts +57 -107
  25. package/core/headers/headerConsensus.ts +230 -0
  26. package/core/headers/headerStore.ts +344 -122
  27. package/core/headers/prewarm.ts +4 -7
  28. package/core/headers/syncHeaders.ts +82 -12
  29. package/core/i18n/translations.tsx +47 -12
  30. package/core/identity/handleRegistry/client.ts +4 -2
  31. package/core/identity/handleRegistry/resolver.ts +7 -11
  32. package/core/index.ts +2 -0
  33. package/core/localpay/pending.ts +39 -4
  34. package/core/network/boundedFetch.ts +101 -0
  35. package/core/networks.ts +11 -13
  36. package/core/pay/rails/address.ts +5 -4
  37. package/core/pay/rails/handle.ts +3 -1
  38. package/core/pay/rails/sweep.ts +791 -0
  39. package/core/peerpay/brc29.ts +4 -0
  40. package/core/peerpay/handleResendRequests.ts +15 -2
  41. package/core/peerpay/outbox.ts +115 -2
  42. package/core/profiles/assertProfileEmpty.ts +2 -2
  43. package/core/profiles/profileStore.ts +3 -2
  44. package/core/services/arcadeBroadcastProvider.ts +260 -114
  45. package/core/services/secrets/kek.ts +5 -0
  46. package/core/services/secrets/migration.ts +27 -2
  47. package/core/services/secrets/policy.ts +6 -0
  48. package/core/services/vault/VaultKeyService.ts +5 -2
  49. package/core/services/vault/ceremony.ts +2 -2
  50. package/core/services/vault/ceremonyHost.ts +1 -1
  51. package/core/services/vault/guard.ts +10 -0
  52. package/core/services/vault/outputAuthority.ts +76 -0
  53. package/core/services/vault/transfers.ts +52 -28
  54. package/core/services/vault/vaultStore.ts +60 -14
  55. package/core/services/walletConnectionValidation.ts +13 -1
  56. package/core/services/walletServiceConfig.ts +8 -7
  57. package/core/stores/ConnectionStore.ts +17 -0
  58. package/core/toolboxConfig.ts +60 -1
  59. package/expo-module.config.json +5 -0
  60. package/ios/BoundedBody.swift +15 -0
  61. package/ios/BsvBoundedFetch.podspec +17 -0
  62. package/ios/BsvBoundedFetchModule.swift +121 -0
  63. package/package.json +7 -3
  64. package/ui/components/pay/AddressReceive.tsx +6 -2
  65. package/ui/components/pay/ImportedOutboxApproval.tsx +142 -0
  66. package/ui/components/pay/PayCellRow.tsx +3 -1
  67. package/ui/components/pay/PayForm.tsx +12 -2
  68. package/ui/components/pay/RecipientField.tsx +1 -0
  69. package/ui/components/pay/RequestHub.tsx +1 -0
  70. package/ui/components/pay/UniversalSend.tsx +110 -42
  71. package/ui/components/ui/ListRow.tsx +10 -2
  72. package/ui/components/vault/KeyChooser.tsx +1 -1
  73. package/ui/components/wallet/AmountInput.tsx +4 -1
  74. package/ui/components/wallet/BackupReminderSheet.tsx +8 -1
  75. package/ui/components/wallet/BiometricAdvisoryModal.tsx +2 -0
  76. package/ui/components/wallet/ImportFromBackupPrompt.tsx +6 -1
  77. package/ui/components/wallet/ProfileButton.tsx +1 -0
  78. package/ui/importDatabases.ts +31 -6
  79. package/ui/screens/ConnectionsScreen.tsx +12 -3
  80. package/ui/screens/PairScreen.tsx +10 -3
  81. package/ui/screens/PayScreen.tsx +1 -0
  82. package/ui/screens/TrustScreen.tsx +6 -3
  83. package/ui/screens/VaultScreen.tsx +13 -3
  84. package/ui/screens/VaultTransferScreen.tsx +6 -3
  85. package/ui/screens/WalletConfigScreen.tsx +17 -2
  86. package/ui/screens/WalletHomeScreen.tsx +7 -1
@@ -3,6 +3,7 @@ import type { PushAdapter } from './push/types'
3
3
  import { trimTrailingSlashes } from './net/trimTrailingSlashes'
4
4
  import { isRelayUrl, isStunUrl } from './directpay/settings'
5
5
  import type { PermissionPolicyOverride } from './bridge/permissionPolicy'
6
+ import { resetE2eMode, setE2eMode } from './e2e/mode'
6
7
 
7
8
  /**
8
9
  * Service endpoints and API keys for one chain.
@@ -16,7 +17,6 @@ export interface ToolboxServiceConfig {
16
17
  arcApiKey?: string
17
18
  chaintracksUrl?: string
18
19
  whatsOnChainApiKey?: string
19
- taalApiKey?: string
20
20
  /**
21
21
  * The chain's default MessageBox origin. A user's own choice in Settings
22
22
  * still wins; this only replaces the built-in default in `NETWORKS`.
@@ -173,6 +173,17 @@ export interface ToolboxConfig {
173
173
  * unverified origins; the user's own stored policy wins over it.
174
174
  */
175
175
  browserBridge?: { allowLocalhostHttp?: boolean; permissionPolicy?: PermissionPolicyOverride }
176
+ /**
177
+ * End-to-end harness. Omit it in every build that can hold funds.
178
+ *
179
+ * Presence locks the wallet off mainnet, stores new keys without a biometric
180
+ * prompt, and points Pay's confirm button at `broadcasterUrl` instead of a
181
+ * real broadcaster. The host sets it only when `EXPO_PUBLIC_E2E` is the
182
+ * string `"true"`. A harness build also has to disable backup, the vault
183
+ * and push, and must not pass mainnet service endpoints — `configureToolbox`
184
+ * throws otherwise, so a copied production profile cannot boot as E2E.
185
+ */
186
+ e2e?: { broadcasterUrl: string }
176
187
  }
177
188
 
178
189
  export type BrowserBridgeHostConfig = NonNullable<ToolboxConfig['browserBridge']>
@@ -249,6 +260,51 @@ function normalizeBackupUrl(raw: string): string {
249
260
  return trimmed
250
261
  }
251
262
 
263
+ /**
264
+ * The mock broadcaster has to be a local or private origin. `10.0.2.2` is the
265
+ * Android emulator's alias for its host and is not an RFC 1918 address, so it
266
+ * is named here. It is not added to the general service-origin policy.
267
+ * Public hosts are refused even over https: the harness must not post a
268
+ * payment description off the machine running the tests.
269
+ */
270
+ function isE2eBroadcasterUrl(raw: string): boolean {
271
+ let parsed: URL
272
+ try {
273
+ parsed = new URL(raw)
274
+ } catch {
275
+ return false
276
+ }
277
+ if (parsed.username || parsed.password) return false
278
+ if (parsed.pathname !== '' && parsed.pathname !== '/') return false
279
+ if (parsed.search !== '' || parsed.hash !== '') return false
280
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false
281
+ const host = parsed.hostname
282
+ return host === '10.0.2.2' || host === 'localhost' || host === '127.0.0.1' || PRIVATE_HOST.test(host)
283
+ }
284
+
285
+ function checkE2eConfig(config: ToolboxConfig): string | undefined {
286
+ if (config.e2e === undefined) return undefined
287
+ const url = config.e2e.broadcasterUrl?.trim() ?? ''
288
+ if (!isE2eBroadcasterUrl(url)) {
289
+ throw new Error(
290
+ `configureToolbox: e2e.broadcasterUrl must be a loopback, 10.0.2.2, or private-network origin: ${config.e2e.broadcasterUrl}`
291
+ )
292
+ }
293
+ if (config.backupUrl != null) {
294
+ throw new Error('configureToolbox: an E2E build must pass backupUrl: null')
295
+ }
296
+ if (config.vaultEnabled === true) {
297
+ throw new Error('configureToolbox: an E2E build must not enable the vault')
298
+ }
299
+ if (config.push !== undefined) {
300
+ throw new Error('configureToolbox: an E2E build must not install a push adapter')
301
+ }
302
+ if (config.services?.main !== undefined) {
303
+ throw new Error('configureToolbox: an E2E build must not configure mainnet services')
304
+ }
305
+ return url.replace(/\/$/, '')
306
+ }
307
+
252
308
  /** Throws unless the host's direct pay addresses are acceptable; unset fields are fine. */
253
309
  function checkDirectPayHostConfig(directPay: DirectPayHostConfig | undefined): void {
254
310
  if (directPay === undefined) return
@@ -273,6 +329,7 @@ export function configureToolbox(config: ToolboxConfig): void {
273
329
  if (config == null || !('backupUrl' in config)) {
274
330
  throw new Error('configureToolbox: backupUrl is required. Pass null to disable backup.')
275
331
  }
332
+ const e2eBroadcasterUrl = checkE2eConfig(config)
276
333
  checkDirectPayHostConfig(config.directPay)
277
334
  current = {
278
335
  backupUrl: config.backupUrl == null ? '' : normalizeBackupUrl(config.backupUrl),
@@ -285,6 +342,7 @@ export function configureToolbox(config: ToolboxConfig): void {
285
342
  directPay: config.directPay,
286
343
  browserBridge: config.browserBridge
287
344
  }
345
+ setE2eMode(e2eBroadcasterUrl)
288
346
  }
289
347
 
290
348
  /**
@@ -488,4 +546,5 @@ export function isVaultAvailable(chain: AppChain, profileIndex: number): boolean
488
546
  /** Test-only: drop the installed configuration. */
489
547
  export function resetToolboxConfig(): void {
490
548
  current = null
549
+ resetE2eMode()
491
550
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "platforms": ["apple", "android"],
3
+ "apple": { "modules": ["BsvBoundedFetchModule"] },
4
+ "android": { "modules": ["org.bsv.boundedfetch.BsvBoundedFetchModule"] }
5
+ }
@@ -0,0 +1,15 @@
1
+ import Foundation
2
+
3
+ /// Counts decoded response bytes before they enter the accumulated body.
4
+ final class BoundedBody {
5
+ enum Error: Swift.Error { case tooLarge }
6
+ let limit: Int
7
+ private(set) var data = Data()
8
+
9
+ init(limit: Int) { self.limit = limit }
10
+
11
+ func append(_ chunk: Data) throws {
12
+ guard chunk.count <= limit - data.count else { throw Error.tooLarge }
13
+ data.append(chunk)
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+ package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
3
+ Pod::Spec.new do |s|
4
+ s.name = 'BsvBoundedFetch'
5
+ s.version = package['version']
6
+ s.summary = 'Native receive-time byte limits for wallet HTTP responses'
7
+ s.description = s.summary
8
+ s.license = package['license']
9
+ s.author = 'BSV Association'
10
+ s.homepage = 'https://github.com/bsv-blockchain/bsv-wallet'
11
+ s.platforms = { :ios => '15.1' }
12
+ s.swift_version = '5.9'
13
+ s.source = { :git => 'https://github.com/bsv-blockchain/bsv-wallet.git' }
14
+ s.static_framework = true
15
+ s.dependency 'ExpoModulesCore'
16
+ s.source_files = '*.swift'
17
+ end
@@ -0,0 +1,121 @@
1
+ import ExpoModulesCore
2
+ import Foundation
3
+
4
+ public final class BsvBoundedFetchModule: Module {
5
+ private let lock = NSLock()
6
+ private var requests: [String: BoundedRequest] = [:]
7
+
8
+ public func definition() -> ModuleDefinition {
9
+ Name("BsvBoundedFetch")
10
+
11
+ AsyncFunction("request") { (options: [String: Any], promise: Promise) in
12
+ guard let id = options["id"] as? String,
13
+ let address = options["url"] as? String,
14
+ let url = URL(string: address), url.scheme == "https",
15
+ let limit = options["maxBytes"] as? Int, (0...67108864).contains(limit) else {
16
+ promise.reject("ERR_INVALID_REQUEST", "Invalid bounded HTTPS request")
17
+ return
18
+ }
19
+ var request = URLRequest(url: url)
20
+ request.httpMethod = options["method"] as? String ?? "GET"
21
+ for header in options["headers"] as? [[String]] ?? [] where header.count == 2 {
22
+ request.setValue(header[1], forHTTPHeaderField: header[0])
23
+ }
24
+ if let encoded = options["body"] as? String { request.httpBody = Data(base64Encoded: encoded) }
25
+ let receiver = BoundedRequest(limit: limit) { result in
26
+ self.lock.lock()
27
+ self.requests.removeValue(forKey: id)
28
+ self.lock.unlock()
29
+ switch result {
30
+ case .success(let reply): promise.resolve(reply)
31
+ case .failure(let error): promise.reject("ERR_BOUNDED_FETCH", error.localizedDescription)
32
+ }
33
+ }
34
+ self.lock.lock()
35
+ self.requests[id] = receiver
36
+ self.lock.unlock()
37
+ receiver.start(request)
38
+ }
39
+
40
+ AsyncFunction("cancel") { (id: String) in
41
+ self.lock.lock()
42
+ let receiver = self.requests[id]
43
+ self.lock.unlock()
44
+ receiver?.cancel()
45
+ }
46
+
47
+ OnDestroy {
48
+ self.lock.lock()
49
+ let active = Array(self.requests.values)
50
+ self.requests.removeAll()
51
+ self.lock.unlock()
52
+ active.forEach { $0.cancel() }
53
+ }
54
+ }
55
+ }
56
+
57
+ /// URLSession supplies decoded chunks; the only accumulating buffer is capped
58
+ /// synchronously on its serial delegate queue, before bytes can cross to JS.
59
+ private final class BoundedRequest: NSObject, URLSessionDataDelegate {
60
+ private let body: BoundedBody
61
+ private let completion: (Result<[String: Any], Swift.Error>) -> Void
62
+ private var session: URLSession?
63
+ private var response: HTTPURLResponse?
64
+ private var failure: Swift.Error?
65
+
66
+ init(limit: Int, completion: @escaping (Result<[String: Any], Swift.Error>) -> Void) {
67
+ self.body = BoundedBody(limit: limit)
68
+ self.completion = completion
69
+ }
70
+
71
+ func start(_ request: URLRequest) {
72
+ let config = URLSessionConfiguration.ephemeral
73
+ config.timeoutIntervalForRequest = 30
74
+ config.timeoutIntervalForResource = 30
75
+ config.httpCookieStorage = nil
76
+ config.urlCache = nil
77
+ let session = URLSession(configuration: config, delegate: self, delegateQueue: nil)
78
+ self.session = session
79
+ session.dataTask(with: request).resume()
80
+ }
81
+
82
+ func cancel() { session?.invalidateAndCancel() }
83
+
84
+ func urlSession(_ session: URLSession, dataTask: URLSessionDataTask,
85
+ didReceive response: URLResponse,
86
+ completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) {
87
+ self.response = response as? HTTPURLResponse
88
+ if response.expectedContentLength > Int64(body.limit) {
89
+ failure = NSError(domain: "ERR_RESPONSE_TOO_LARGE", code: 1,
90
+ userInfo: [NSLocalizedDescriptionKey: "ERR_RESPONSE_TOO_LARGE"])
91
+ completionHandler(.cancel)
92
+ } else {
93
+ completionHandler(.allow)
94
+ }
95
+ }
96
+
97
+ func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
98
+ do { try body.append(data) } catch {
99
+ failure = NSError(domain: "ERR_RESPONSE_TOO_LARGE", code: 1,
100
+ userInfo: [NSLocalizedDescriptionKey: "ERR_RESPONSE_TOO_LARGE"])
101
+ dataTask.cancel()
102
+ }
103
+ }
104
+
105
+ func urlSession(_ session: URLSession, task: URLSessionTask,
106
+ willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest,
107
+ completionHandler: @escaping (URLRequest?) -> Void) {
108
+ completionHandler(nil)
109
+ }
110
+
111
+ func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Swift.Error?) {
112
+ defer { session.finishTasksAndInvalidate() }
113
+ if let error = failure ?? error { completion(.failure(error)); return }
114
+ guard let response = response else {
115
+ completion(.failure(URLError(.badServerResponse)))
116
+ return
117
+ }
118
+ let headers = response.allHeaderFields.map { [String(describing: $0.key), String(describing: $0.value)] }
119
+ completion(.success(["status": response.statusCode, "headers": headers, "body": body.data.base64EncodedString()]))
120
+ }
121
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/expo-wallet-toolbox",
3
- "version": "0.23.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,7 +26,10 @@
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",
@@ -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": {
@@ -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 onPress={handleCopy} style={[styles.addressChip, { backgroundColor: colors.fillTertiary }]}>
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 value={value} onChangeText={onChangeText} showMax={showMax} asset={asset} maxValue={maxValue} />
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