@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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One payment code, whatever its size: air-gap fountain parts, always. A frame
|
|
3
|
+
* that fits one source block — every ordinary single-input payment — is a still
|
|
4
|
+
* QR, because one part carries the whole message and this renderer holds `seq`
|
|
5
|
+
* at 0 for it. Anything larger animates: parts at 5/s, endlessly — the receiver
|
|
6
|
+
* needs any ~K distinct parts, so there is no "start", no "end", and nothing to
|
|
7
|
+
* coordinate. The decision is made from the payload alone so every caller (send
|
|
8
|
+
* screen, re-show modal) behaves identically.
|
|
9
|
+
*/
|
|
10
|
+
import React, { useEffect, useMemo, useState } from 'react'
|
|
11
|
+
import { AirGapEncoder, FRAME_BLOCK_BYTES, frameBytesFromQr } from '@bsv/expo-wallet-toolbox'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* react-native-qrcode-svg ships an untransformed ESM build that Jest cannot
|
|
15
|
+
* parse when eagerly pulled in via the `ui` package barrel, even for a
|
|
16
|
+
* consumer that never renders one (this repo's own tests mock it wholesale
|
|
17
|
+
* with `jest.mock('react-native-qrcode-svg', () => 'QRCode')` whenever they
|
|
18
|
+
* DO render one, precisely because the real module cannot load under Jest).
|
|
19
|
+
* Loaded lazily, only when actually rendering, same pattern as this
|
|
20
|
+
* package's other native/ESM-boundary fixes (expo-router, expo-blur).
|
|
21
|
+
*
|
|
22
|
+
* `mod?.default ?? mod` mirrors Babel's default-interop rather than a plain
|
|
23
|
+
* `.default` access: the existing bare-string test mock above has no
|
|
24
|
+
* `__esModule`/`default` shape, so a naked `require(...).default` would
|
|
25
|
+
* resolve to `undefined` against it.
|
|
26
|
+
*/
|
|
27
|
+
type QRCodeComponent = typeof import('react-native-qrcode-svg').default
|
|
28
|
+
let qrCodeComponent: QRCodeComponent | undefined
|
|
29
|
+
function loadQRCode(): QRCodeComponent {
|
|
30
|
+
if (!qrCodeComponent) {
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
32
|
+
const mod = require('react-native-qrcode-svg')
|
|
33
|
+
qrCodeComponent = (mod?.default ?? mod) as QRCodeComponent
|
|
34
|
+
}
|
|
35
|
+
return qrCodeComponent
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sender cadence: five parts a second. Lives here, not in `@bsv/air-gap` —
|
|
40
|
+
* the library encodes and stops at the byte array, leaving display rate to
|
|
41
|
+
* whoever is holding the phone up.
|
|
42
|
+
*/
|
|
43
|
+
const FRAME_MS = 200
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Where `seq` wraps. The library's own guidance: keep looping rather than
|
|
47
|
+
* counting up forever, since recovery is probabilistic and the repeating
|
|
48
|
+
* systematic prefix is what guarantees every receiver eventually finishes.
|
|
49
|
+
* Sixty-four passes over the block set is far more than any hand-held scan
|
|
50
|
+
* needs and keeps `seq` nowhere near its u32 ceiling.
|
|
51
|
+
*/
|
|
52
|
+
const SEQ_WRAP_CYCLES = 64
|
|
53
|
+
|
|
54
|
+
export default function PaymentQrDisplay({
|
|
55
|
+
frameQr,
|
|
56
|
+
size = 288,
|
|
57
|
+
onError
|
|
58
|
+
}: {
|
|
59
|
+
/** The stored bsvpayf1: frame envelope. */
|
|
60
|
+
frameQr: string
|
|
61
|
+
size?: number
|
|
62
|
+
/** Backstop for an unrenderable payload — pass the screen's handler. */
|
|
63
|
+
onError?: () => void
|
|
64
|
+
}) {
|
|
65
|
+
const encoder = useMemo(() => {
|
|
66
|
+
try {
|
|
67
|
+
return new AirGapEncoder(frameBytesFromQr(frameQr), { blockBytes: FRAME_BLOCK_BYTES })
|
|
68
|
+
} catch {
|
|
69
|
+
return null // >64 KB, or a malformed envelope out of storage
|
|
70
|
+
}
|
|
71
|
+
}, [frameQr])
|
|
72
|
+
|
|
73
|
+
const [part, setPart] = useState<string | null>(null)
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!encoder) {
|
|
77
|
+
setPart(null)
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
setPart(encoder.partAt(0))
|
|
81
|
+
// One block IS the whole message, so a second part could add nothing and
|
|
82
|
+
// there is no timer to run: the code sits still and scans on the first read.
|
|
83
|
+
if (encoder.blockCount === 1) return
|
|
84
|
+
const wrapAt = encoder.blockCount * SEQ_WRAP_CYCLES
|
|
85
|
+
let seq = 0
|
|
86
|
+
const id = setInterval(() => {
|
|
87
|
+
seq = (seq + 1) % wrapAt
|
|
88
|
+
setPart(encoder.partAt(seq))
|
|
89
|
+
}, FRAME_MS)
|
|
90
|
+
return () => clearInterval(id)
|
|
91
|
+
}, [encoder])
|
|
92
|
+
|
|
93
|
+
// An unrenderable payload used to reach the caller through <QRCode onError>.
|
|
94
|
+
// It cannot any more — the failure now happens in the encoder, before there is
|
|
95
|
+
// anything to render — so report it on the same channel, from an effect rather
|
|
96
|
+
// than inline, since flipping caller state from a child's render is what
|
|
97
|
+
// React's cross-component update warning is about.
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!encoder) onError?.()
|
|
100
|
+
}, [encoder, onError])
|
|
101
|
+
|
|
102
|
+
const QRCode = loadQRCode()
|
|
103
|
+
if (!part) return null
|
|
104
|
+
return <QRCode value={part} size={size} ecl="M" color="#000" backgroundColor="#fff" onError={onError} />
|
|
105
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The moment money arrives.
|
|
3
|
+
*
|
|
4
|
+
* Full screen, and it stays until the person receiving taps Done. That is the
|
|
5
|
+
* whole point: a toast is the right weight for "your settings were saved" and
|
|
6
|
+
* the wrong weight for "someone just paid you" — it can be missed entirely if
|
|
7
|
+
* the phone is face down, in a pocket, or simply not being looked at when it
|
|
8
|
+
* fires, and the one thing a payee must never be unsure about is whether the
|
|
9
|
+
* money arrived. Requiring an acknowledgement means the event cannot be missed,
|
|
10
|
+
* only dismissed.
|
|
11
|
+
*
|
|
12
|
+
* Presentational only. It reports nothing and decides nothing — by the time it
|
|
13
|
+
* mounts the payment is already credited, so dismissing it cannot affect money.
|
|
14
|
+
*
|
|
15
|
+
* Staged in three beats, as the nearby flow's success screen is: the amount is
|
|
16
|
+
* already on screen when the mark begins drawing, the mark fires the success
|
|
17
|
+
* haptic from inside Celebration, then the tone sounds. Firing them together
|
|
18
|
+
* reads as one blunt event and buries the figure, which is the thing that
|
|
19
|
+
* actually matters.
|
|
20
|
+
*/
|
|
21
|
+
import React, { useCallback, useEffect, useState } from 'react'
|
|
22
|
+
import { Modal, StyleSheet, Text, View } from 'react-native'
|
|
23
|
+
import Animated, { FadeIn, FadeInDown, useReducedMotion } from 'react-native-reanimated'
|
|
24
|
+
import { useTranslation } from 'react-i18next'
|
|
25
|
+
|
|
26
|
+
import { useTheme, durations, springs, spacing, typography, radii, sounds } from '@bsv/expo-wallet-toolbox'
|
|
27
|
+
import AmountDisplay from '../wallet/AmountDisplay'
|
|
28
|
+
import Celebration from '../ui/Celebration'
|
|
29
|
+
import PressableScale from '../ui/PressableScale'
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* expo-router is required lazily rather than imported at module scope: this
|
|
33
|
+
* file is barrel-exported from the package's `ui` entry point, and a static
|
|
34
|
+
* top-level `import` of expo-router pulls in its own untransformed JSX
|
|
35
|
+
* source (Navigator.js etc.), which Jest cannot parse for any consumer of the
|
|
36
|
+
* barrel, even one that never navigates. Same pattern as
|
|
37
|
+
* core/context/WalletContext.tsx's and WalletHomeScreen.tsx's lazy
|
|
38
|
+
* expo-router load.
|
|
39
|
+
*/
|
|
40
|
+
type ExpoRouterModule = typeof import('expo-router')
|
|
41
|
+
let expoRouterMod: ExpoRouterModule | undefined
|
|
42
|
+
function loadExpoRouter(): ExpoRouterModule {
|
|
43
|
+
if (!expoRouterMod) {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
45
|
+
expoRouterMod = require('expo-router') as ExpoRouterModule
|
|
46
|
+
}
|
|
47
|
+
return expoRouterMod
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Beat two: the tone, just behind the mark. Sequencing, not animation. */
|
|
51
|
+
const TONE_DELAY_MS = 120
|
|
52
|
+
|
|
53
|
+
export interface ReceivedOverlayProps {
|
|
54
|
+
/** Total satoshis credited (received) or paid (sent) in this event. */
|
|
55
|
+
amount: number
|
|
56
|
+
/** How many payments made up that total. Only shown when it is more than one. */
|
|
57
|
+
count?: number
|
|
58
|
+
/**
|
|
59
|
+
* False when the payment was accepted with no network and has not reached a
|
|
60
|
+
* broadcaster yet. The money is credited and spendable either way; what is
|
|
61
|
+
* unsettled is whether anyone but these two devices has seen it, and the
|
|
62
|
+
* payee is entitled to know that before treating it as final.
|
|
63
|
+
*/
|
|
64
|
+
broadcast?: boolean
|
|
65
|
+
/**
|
|
66
|
+
* Which way the money moved. The staging is identical — that is the point of
|
|
67
|
+
* sharing this screen across every rail — only the words change: 'received'
|
|
68
|
+
* says the money is in the wallet; 'sent' names who it went to.
|
|
69
|
+
*/
|
|
70
|
+
direction?: 'received' | 'sent'
|
|
71
|
+
/** Sent only: the resolved counterparty (name, handle, or abbreviated address). */
|
|
72
|
+
recipientName?: string
|
|
73
|
+
/**
|
|
74
|
+
* Acknowledged. The only way this screen closes. Clean up local state here —
|
|
75
|
+
* the overlay itself then returns the user to the wallet, so the updated
|
|
76
|
+
* balance is the next thing they see.
|
|
77
|
+
*/
|
|
78
|
+
onDismiss: () => void
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default function PaymentSuccessOverlay({
|
|
82
|
+
amount,
|
|
83
|
+
count = 1,
|
|
84
|
+
broadcast = true,
|
|
85
|
+
direction = 'received',
|
|
86
|
+
recipientName,
|
|
87
|
+
onDismiss
|
|
88
|
+
}: ReceivedOverlayProps) {
|
|
89
|
+
const sent = direction === 'sent'
|
|
90
|
+
const { t } = useTranslation()
|
|
91
|
+
const { colors } = useTheme()
|
|
92
|
+
const { router } = loadExpoRouter()
|
|
93
|
+
const reducedMotion = useReducedMotion()
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The button appears once the mark has landed. It is not a gate — nothing is
|
|
97
|
+
* pending — but a Done button already on screen while a checkmark is still
|
|
98
|
+
* drawing invites a tap through the moment it exists to deliver.
|
|
99
|
+
*/
|
|
100
|
+
const [ready, setReady] = useState(false)
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
// Returns immediately and cannot throw, so a device with no audio session
|
|
104
|
+
// simply gets the payment quietly.
|
|
105
|
+
const tone = setTimeout(() => (sent ? sounds.paymentSend() : sounds.paymentReceive()), TONE_DELAY_MS)
|
|
106
|
+
return () => clearTimeout(tone)
|
|
107
|
+
}, [])
|
|
108
|
+
|
|
109
|
+
// Hand the shared player back; a payee may leave this screen up on a counter.
|
|
110
|
+
useEffect(() => () => sounds.release(), [])
|
|
111
|
+
|
|
112
|
+
const onMarkDone = useCallback(() => setReady(true), [])
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Done means "back to the wallet", uniformly: a completed payment in either
|
|
116
|
+
* direction ends on the balance it changed, and the wallet refetches balance
|
|
117
|
+
* and activity on focus.
|
|
118
|
+
*
|
|
119
|
+
* `dismissTo`, NOT `navigate`. Both land on the wallet, but only one of them
|
|
120
|
+
* clears the flow behind it. A bare NAVIGATE onto a route already in the
|
|
121
|
+
* stack does not walk back to it — StackRouter filters that route out and
|
|
122
|
+
* re-pushes it on top, so `[wallet, pay, address-send]` becomes
|
|
123
|
+
* `[pay, address-send, wallet]` and the finished payment is still sitting
|
|
124
|
+
* under the user's thumb: one edge-swipe back into a flow they completed.
|
|
125
|
+
* POP_TO (`dismissTo`) truncates at the target instead, leaving just
|
|
126
|
+
* `[wallet]`, so back from here is the wallet screen and nothing else.
|
|
127
|
+
*/
|
|
128
|
+
const acknowledge = useCallback(() => {
|
|
129
|
+
onDismiss()
|
|
130
|
+
router.dismissTo('/')
|
|
131
|
+
}, [onDismiss])
|
|
132
|
+
|
|
133
|
+
const settleIn = reducedMotion
|
|
134
|
+
? undefined
|
|
135
|
+
: FadeInDown.springify()
|
|
136
|
+
.mass(springs.snappy.mass)
|
|
137
|
+
.damping(springs.snappy.damping)
|
|
138
|
+
.stiffness(springs.snappy.stiffness)
|
|
139
|
+
const fadeIn = reducedMotion ? undefined : FadeIn.duration(durations.quick)
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Modal
|
|
143
|
+
visible
|
|
144
|
+
animationType="fade"
|
|
145
|
+
statusBarTranslucent
|
|
146
|
+
// No onRequestClose handler that dismisses: Android's back button must not
|
|
147
|
+
// be able to clear this without the acknowledgement being deliberate.
|
|
148
|
+
onRequestClose={() => {}}
|
|
149
|
+
>
|
|
150
|
+
<View
|
|
151
|
+
style={[styles.container, { backgroundColor: colors.background }]}
|
|
152
|
+
accessibilityViewIsModal
|
|
153
|
+
accessibilityRole="alert"
|
|
154
|
+
accessibilityLabel={sent ? t('local_pay_sent') : `${t('local_pay_received')}. ${t('local_pay_added')}`}
|
|
155
|
+
>
|
|
156
|
+
<View style={styles.stage}>
|
|
157
|
+
<Celebration onDone={onMarkDone} />
|
|
158
|
+
<View style={styles.gapXl} />
|
|
159
|
+
|
|
160
|
+
<Text style={[styles.title, { color: colors.textPrimary }]} textBreakStrategy="balanced">
|
|
161
|
+
{t(sent ? 'local_pay_sent' : 'local_pay_received')}
|
|
162
|
+
</Text>
|
|
163
|
+
|
|
164
|
+
{/* The focal element. Everything else on this screen is a label. */}
|
|
165
|
+
<Animated.View entering={settleIn} style={styles.amountBlock}>
|
|
166
|
+
<Text
|
|
167
|
+
style={[styles.amount, { color: colors.textPrimary }]}
|
|
168
|
+
maxFontSizeMultiplier={1.3}
|
|
169
|
+
numberOfLines={1}
|
|
170
|
+
adjustsFontSizeToFit
|
|
171
|
+
accessibilityRole="text"
|
|
172
|
+
>
|
|
173
|
+
<AmountDisplay>{amount}</AmountDisplay>
|
|
174
|
+
</Text>
|
|
175
|
+
</Animated.View>
|
|
176
|
+
|
|
177
|
+
{sent ? (
|
|
178
|
+
!!recipientName && (
|
|
179
|
+
<Text style={[styles.support, { color: colors.textSecondary }]} numberOfLines={1} ellipsizeMode="middle">
|
|
180
|
+
{recipientName}
|
|
181
|
+
</Text>
|
|
182
|
+
)
|
|
183
|
+
) : (
|
|
184
|
+
<Text style={[styles.support, { color: colors.success }]} textBreakStrategy="balanced">
|
|
185
|
+
{count > 1 ? t('local_pay_added_multiple', { count }) : t('local_pay_added')}
|
|
186
|
+
</Text>
|
|
187
|
+
)}
|
|
188
|
+
|
|
189
|
+
{!broadcast && (
|
|
190
|
+
<Text style={[styles.pending, { color: colors.textSecondary }]}>{t('pay_received_not_broadcast')}</Text>
|
|
191
|
+
)}
|
|
192
|
+
</View>
|
|
193
|
+
|
|
194
|
+
{ready && (
|
|
195
|
+
<Animated.View entering={fadeIn} style={styles.footer}>
|
|
196
|
+
<PressableScale
|
|
197
|
+
onPress={acknowledge}
|
|
198
|
+
haptic="tap"
|
|
199
|
+
style={[styles.button, { backgroundColor: colors.accent }]}
|
|
200
|
+
accessibilityRole="button"
|
|
201
|
+
accessibilityLabel={t('done')}
|
|
202
|
+
>
|
|
203
|
+
<Text style={[styles.buttonText, { color: colors.textOnAccent }]}>{t('done')}</Text>
|
|
204
|
+
</PressableScale>
|
|
205
|
+
</Animated.View>
|
|
206
|
+
)}
|
|
207
|
+
</View>
|
|
208
|
+
</Modal>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const styles = StyleSheet.create({
|
|
213
|
+
container: {
|
|
214
|
+
flex: 1,
|
|
215
|
+
paddingHorizontal: spacing.lg,
|
|
216
|
+
paddingVertical: spacing.xxxl
|
|
217
|
+
},
|
|
218
|
+
stage: {
|
|
219
|
+
flex: 1,
|
|
220
|
+
alignItems: 'center',
|
|
221
|
+
justifyContent: 'center'
|
|
222
|
+
},
|
|
223
|
+
gapXl: {
|
|
224
|
+
height: spacing.xl
|
|
225
|
+
},
|
|
226
|
+
title: {
|
|
227
|
+
...typography.title2,
|
|
228
|
+
fontWeight: '700',
|
|
229
|
+
textAlign: 'center'
|
|
230
|
+
},
|
|
231
|
+
amountBlock: {
|
|
232
|
+
marginTop: spacing.sm,
|
|
233
|
+
marginBottom: spacing.sm,
|
|
234
|
+
alignSelf: 'stretch',
|
|
235
|
+
alignItems: 'center'
|
|
236
|
+
},
|
|
237
|
+
amount: {
|
|
238
|
+
fontSize: 44,
|
|
239
|
+
lineHeight: 52,
|
|
240
|
+
fontWeight: '700',
|
|
241
|
+
textAlign: 'center'
|
|
242
|
+
},
|
|
243
|
+
support: {
|
|
244
|
+
...typography.subhead,
|
|
245
|
+
textAlign: 'center'
|
|
246
|
+
},
|
|
247
|
+
pending: {
|
|
248
|
+
...typography.footnote,
|
|
249
|
+
textAlign: 'center',
|
|
250
|
+
marginTop: spacing.xs
|
|
251
|
+
},
|
|
252
|
+
footer: {
|
|
253
|
+
paddingBottom: spacing.md
|
|
254
|
+
},
|
|
255
|
+
button: {
|
|
256
|
+
flexDirection: 'row',
|
|
257
|
+
alignItems: 'center',
|
|
258
|
+
justifyContent: 'center',
|
|
259
|
+
paddingVertical: spacing.md + 2,
|
|
260
|
+
borderRadius: radii.md
|
|
261
|
+
},
|
|
262
|
+
buttonText: {
|
|
263
|
+
...typography.headline,
|
|
264
|
+
fontWeight: '600'
|
|
265
|
+
}
|
|
266
|
+
})
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The universal recipient field: one input that takes a handle, a public key,
|
|
3
|
+
* an address or a peerpay link, plus the QR button that scans the same set. It
|
|
4
|
+
* shows the search dropdown for free text, a status row for a resolved target
|
|
5
|
+
* or a checksum failure, and collapses to an identity card once a search hit
|
|
6
|
+
* is chosen. What the text MEANS is decided in core/pay/rails and held by
|
|
7
|
+
* useRecipientInput; this file only renders that state.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react'
|
|
10
|
+
import { ActivityIndicator, Image, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native'
|
|
11
|
+
import type { DisplayableIdentity } from '@bsv/sdk'
|
|
12
|
+
import Animated, { FadeInDown, useReducedMotion } from 'react-native-reanimated'
|
|
13
|
+
import { spacing, typography, radii, springs } from '@bsv/expo-wallet-toolbox'
|
|
14
|
+
import type { RecipientInlineError, RecipientTarget } from './useRecipientInput'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
18
|
+
* etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
|
|
19
|
+
* that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
|
|
20
|
+
* Ionicons is loaded lazily, only when actually rendering, same pattern as
|
|
21
|
+
* this package's other native-module-boundary fixes (expo-router, expo-blur).
|
|
22
|
+
*/
|
|
23
|
+
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
24
|
+
let ioniconsComponent: IoniconsComponent | undefined
|
|
25
|
+
function loadIonicons(): IoniconsComponent {
|
|
26
|
+
if (!ioniconsComponent) {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
28
|
+
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
29
|
+
}
|
|
30
|
+
return ioniconsComponent
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface RecipientFieldProps {
|
|
34
|
+
readonly selectedIdentity: DisplayableIdentity | null
|
|
35
|
+
readonly inputText: string
|
|
36
|
+
readonly target: RecipientTarget | null
|
|
37
|
+
readonly inlineError: RecipientInlineError | null
|
|
38
|
+
readonly isSearching: boolean
|
|
39
|
+
readonly searchResults: DisplayableIdentity[]
|
|
40
|
+
readonly colors: ReturnType<typeof import('@bsv/expo-wallet-toolbox').useTheme>['colors']
|
|
41
|
+
readonly t: ReturnType<typeof import('react-i18next').useTranslation>['t']
|
|
42
|
+
readonly onChangeText: (v: string) => void
|
|
43
|
+
readonly onSelectIdentity: (i: DisplayableIdentity) => void
|
|
44
|
+
readonly onClear: () => void
|
|
45
|
+
readonly onOpenScanner: () => void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function RecipientField({
|
|
49
|
+
selectedIdentity,
|
|
50
|
+
inputText,
|
|
51
|
+
target,
|
|
52
|
+
inlineError,
|
|
53
|
+
isSearching,
|
|
54
|
+
searchResults,
|
|
55
|
+
colors,
|
|
56
|
+
t,
|
|
57
|
+
onChangeText,
|
|
58
|
+
onSelectIdentity,
|
|
59
|
+
onClear,
|
|
60
|
+
onOpenScanner
|
|
61
|
+
}: RecipientFieldProps) {
|
|
62
|
+
const Ionicons = loadIonicons()
|
|
63
|
+
const reducedMotion = useReducedMotion()
|
|
64
|
+
if (selectedIdentity) {
|
|
65
|
+
const identityEntering = reducedMotion
|
|
66
|
+
? undefined
|
|
67
|
+
: FadeInDown.springify().stiffness(springs.snappy.stiffness).damping(springs.snappy.damping)
|
|
68
|
+
return (
|
|
69
|
+
<Animated.View
|
|
70
|
+
entering={identityEntering}
|
|
71
|
+
style={[styles.selectedRecipient, { backgroundColor: colors.backgroundSecondary }]}
|
|
72
|
+
>
|
|
73
|
+
{selectedIdentity.avatarURL ? (
|
|
74
|
+
<Image source={{ uri: selectedIdentity.avatarURL }} style={styles.avatar} />
|
|
75
|
+
) : (
|
|
76
|
+
<View style={[styles.avatarPlaceholder, { backgroundColor: colors.accent }]}>
|
|
77
|
+
<Ionicons name="person" size={20} color={colors.background} />
|
|
78
|
+
</View>
|
|
79
|
+
)}
|
|
80
|
+
<View style={styles.selectedInfo}>
|
|
81
|
+
<Text style={[styles.selectedName, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
82
|
+
{selectedIdentity.name || t('unknown')}
|
|
83
|
+
</Text>
|
|
84
|
+
<Text style={[styles.selectedKey, { color: colors.textSecondary }]} numberOfLines={1}>
|
|
85
|
+
{selectedIdentity.abbreviatedKey || `${selectedIdentity.identityKey.slice(0, 10)}...`}
|
|
86
|
+
</Text>
|
|
87
|
+
</View>
|
|
88
|
+
<TouchableOpacity onPress={onClear} style={styles.clearButton}>
|
|
89
|
+
<Ionicons name="close-circle" size={20} color={colors.textTertiary} />
|
|
90
|
+
</TouchableOpacity>
|
|
91
|
+
</Animated.View>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
const showDropdown = (isSearching || searchResults.length > 0) && !target && !inlineError
|
|
95
|
+
const borderColor = inlineError ? colors.error : target ? colors.success : colors.separator
|
|
96
|
+
const borderWidth = inlineError || target ? 1 : StyleSheet.hairlineWidth
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<View style={[styles.inputRow, { backgroundColor: colors.backgroundSecondary, borderColor, borderWidth }]}>
|
|
100
|
+
<TextInput
|
|
101
|
+
value={inputText}
|
|
102
|
+
onChangeText={onChangeText}
|
|
103
|
+
placeholder={t('recipient_placeholder')}
|
|
104
|
+
placeholderTextColor={colors.textTertiary}
|
|
105
|
+
autoCapitalize="none"
|
|
106
|
+
autoCorrect={false}
|
|
107
|
+
style={[styles.recipientInput, { color: colors.textPrimary }]}
|
|
108
|
+
/>
|
|
109
|
+
<TouchableOpacity onPress={onOpenScanner} style={styles.inputAction} accessibilityLabel={t('scan_qr_code')}>
|
|
110
|
+
<Ionicons name="qr-code-outline" size={20} color={colors.accent} />
|
|
111
|
+
</TouchableOpacity>
|
|
112
|
+
</View>
|
|
113
|
+
{inlineError ? (
|
|
114
|
+
<View style={styles.statusRow}>
|
|
115
|
+
<Ionicons name="close-circle-outline" size={14} color={colors.error} />
|
|
116
|
+
<Text style={[styles.statusText, { color: colors.error }]}>{t(inlineError)}</Text>
|
|
117
|
+
</View>
|
|
118
|
+
) : target?.kind === 'handle' ? (
|
|
119
|
+
<View style={styles.statusRow}>
|
|
120
|
+
<Ionicons name="key-outline" size={14} color={colors.success} />
|
|
121
|
+
<Text style={[styles.statusText, { color: colors.success }]}>{t('valid_identity_key')}</Text>
|
|
122
|
+
</View>
|
|
123
|
+
) : target?.kind === 'address' ? (
|
|
124
|
+
<View style={styles.statusRow}>
|
|
125
|
+
<Ionicons name="wallet-outline" size={14} color={colors.success} />
|
|
126
|
+
<Text style={[styles.statusText, { color: colors.success }]}>{t('valid_bsv_address')}</Text>
|
|
127
|
+
</View>
|
|
128
|
+
) : null}
|
|
129
|
+
{showDropdown && (
|
|
130
|
+
<View
|
|
131
|
+
style={[styles.searchResults, { backgroundColor: colors.backgroundSecondary, borderColor: colors.separator }]}
|
|
132
|
+
>
|
|
133
|
+
{isSearching ? (
|
|
134
|
+
<View style={styles.searchLoading}>
|
|
135
|
+
<ActivityIndicator size="small" color={colors.accent} />
|
|
136
|
+
<Text style={[styles.searchLoadingText, { color: colors.textSecondary }]}>{t('searching')}</Text>
|
|
137
|
+
</View>
|
|
138
|
+
) : (
|
|
139
|
+
searchResults.map((identity, idx) => (
|
|
140
|
+
<TouchableOpacity
|
|
141
|
+
key={identity.identityKey + idx}
|
|
142
|
+
onPress={() => onSelectIdentity(identity)}
|
|
143
|
+
style={[
|
|
144
|
+
styles.searchResultRow,
|
|
145
|
+
idx < searchResults.length - 1 && {
|
|
146
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
147
|
+
borderBottomColor: colors.separator
|
|
148
|
+
}
|
|
149
|
+
]}
|
|
150
|
+
>
|
|
151
|
+
{identity.avatarURL ? (
|
|
152
|
+
<Image source={{ uri: identity.avatarURL }} style={styles.searchAvatar} />
|
|
153
|
+
) : (
|
|
154
|
+
<View style={[styles.searchAvatarPlaceholder, { backgroundColor: colors.accent }]}>
|
|
155
|
+
<Ionicons name="person" size={18} color={colors.background} />
|
|
156
|
+
</View>
|
|
157
|
+
)}
|
|
158
|
+
<View style={styles.searchResultInfo}>
|
|
159
|
+
<Text style={[styles.searchResultName, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
160
|
+
{identity.name || t('unknown')}
|
|
161
|
+
</Text>
|
|
162
|
+
<Text style={[styles.searchResultKey, { color: colors.textSecondary }]} numberOfLines={1}>
|
|
163
|
+
{identity.abbreviatedKey || `${identity.identityKey.slice(0, 20)}...`}
|
|
164
|
+
</Text>
|
|
165
|
+
</View>
|
|
166
|
+
{identity.badgeLabel ? (
|
|
167
|
+
<View style={[styles.badge, { backgroundColor: colors.fill }]}>
|
|
168
|
+
<Text style={[styles.badgeText, { color: colors.accent }]}>{identity.badgeLabel}</Text>
|
|
169
|
+
</View>
|
|
170
|
+
) : null}
|
|
171
|
+
</TouchableOpacity>
|
|
172
|
+
))
|
|
173
|
+
)}
|
|
174
|
+
</View>
|
|
175
|
+
)}
|
|
176
|
+
</>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const styles = StyleSheet.create({
|
|
181
|
+
// Selected recipient
|
|
182
|
+
selectedRecipient: {
|
|
183
|
+
flexDirection: 'row',
|
|
184
|
+
alignItems: 'center',
|
|
185
|
+
padding: spacing.md,
|
|
186
|
+
borderRadius: radii.md
|
|
187
|
+
},
|
|
188
|
+
avatar: {
|
|
189
|
+
width: 36,
|
|
190
|
+
height: 36,
|
|
191
|
+
borderRadius: 18
|
|
192
|
+
},
|
|
193
|
+
avatarPlaceholder: {
|
|
194
|
+
width: 36,
|
|
195
|
+
height: 36,
|
|
196
|
+
borderRadius: 18,
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
justifyContent: 'center'
|
|
199
|
+
},
|
|
200
|
+
selectedInfo: {
|
|
201
|
+
flex: 1,
|
|
202
|
+
marginLeft: spacing.md
|
|
203
|
+
},
|
|
204
|
+
selectedName: {
|
|
205
|
+
...typography.subhead,
|
|
206
|
+
fontWeight: '600'
|
|
207
|
+
},
|
|
208
|
+
selectedKey: {
|
|
209
|
+
...typography.caption1,
|
|
210
|
+
fontFamily: 'monospace'
|
|
211
|
+
},
|
|
212
|
+
clearButton: {
|
|
213
|
+
padding: spacing.xs
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
// Status row (resolved target or inline error)
|
|
217
|
+
statusRow: {
|
|
218
|
+
flexDirection: 'row',
|
|
219
|
+
alignItems: 'center',
|
|
220
|
+
gap: spacing.xs,
|
|
221
|
+
marginTop: spacing.sm
|
|
222
|
+
},
|
|
223
|
+
statusText: {
|
|
224
|
+
...typography.caption1,
|
|
225
|
+
fontWeight: '500'
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
// Search results
|
|
229
|
+
searchResults: {
|
|
230
|
+
borderRadius: radii.md,
|
|
231
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
232
|
+
marginTop: spacing.sm,
|
|
233
|
+
overflow: 'hidden'
|
|
234
|
+
},
|
|
235
|
+
searchLoading: {
|
|
236
|
+
flexDirection: 'row',
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
justifyContent: 'center',
|
|
239
|
+
padding: spacing.md,
|
|
240
|
+
gap: spacing.sm
|
|
241
|
+
},
|
|
242
|
+
searchLoadingText: {
|
|
243
|
+
...typography.subhead
|
|
244
|
+
},
|
|
245
|
+
searchResultRow: {
|
|
246
|
+
flexDirection: 'row',
|
|
247
|
+
alignItems: 'center',
|
|
248
|
+
padding: spacing.md
|
|
249
|
+
},
|
|
250
|
+
searchAvatar: {
|
|
251
|
+
width: 32,
|
|
252
|
+
height: 32,
|
|
253
|
+
borderRadius: 16,
|
|
254
|
+
marginRight: spacing.md
|
|
255
|
+
},
|
|
256
|
+
searchAvatarPlaceholder: {
|
|
257
|
+
width: 32,
|
|
258
|
+
height: 32,
|
|
259
|
+
borderRadius: 16,
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
justifyContent: 'center',
|
|
262
|
+
marginRight: spacing.md
|
|
263
|
+
},
|
|
264
|
+
searchResultInfo: {
|
|
265
|
+
flex: 1
|
|
266
|
+
},
|
|
267
|
+
searchResultName: {
|
|
268
|
+
...typography.subhead,
|
|
269
|
+
fontWeight: '500'
|
|
270
|
+
},
|
|
271
|
+
searchResultKey: {
|
|
272
|
+
...typography.caption1,
|
|
273
|
+
fontFamily: 'monospace'
|
|
274
|
+
},
|
|
275
|
+
badge: {
|
|
276
|
+
paddingHorizontal: spacing.xs,
|
|
277
|
+
paddingVertical: 1,
|
|
278
|
+
borderRadius: 3,
|
|
279
|
+
marginLeft: spacing.sm,
|
|
280
|
+
flexShrink: 1
|
|
281
|
+
},
|
|
282
|
+
badgeText: {
|
|
283
|
+
...typography.caption2,
|
|
284
|
+
fontWeight: '600',
|
|
285
|
+
fontSize: 10
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
// Recipient input row (text field + QR scan button)
|
|
289
|
+
inputRow: {
|
|
290
|
+
flexDirection: 'row',
|
|
291
|
+
alignItems: 'center',
|
|
292
|
+
borderRadius: radii.md,
|
|
293
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
294
|
+
overflow: 'hidden'
|
|
295
|
+
},
|
|
296
|
+
recipientInput: {
|
|
297
|
+
...typography.body,
|
|
298
|
+
flex: 1,
|
|
299
|
+
paddingHorizontal: spacing.md,
|
|
300
|
+
paddingVertical: spacing.md
|
|
301
|
+
},
|
|
302
|
+
inputAction: {
|
|
303
|
+
width: 44,
|
|
304
|
+
height: 44,
|
|
305
|
+
alignItems: 'center',
|
|
306
|
+
justifyContent: 'center'
|
|
307
|
+
}
|
|
308
|
+
})
|