@bsv/expo-wallet-toolbox 0.5.0 → 0.7.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 +255 -0
- package/README.md +19 -0
- package/core/amountFormatHelpers.ts +238 -34
- package/core/backup/RemoteSyncReader.ts +2 -5
- package/core/backup/codec.ts +2 -2
- package/core/backup/push.ts +1 -1
- package/core/config.tsx +12 -5
- package/core/contacts/contactActivity.ts +153 -0
- package/core/contacts/contactCache.ts +41 -0
- package/core/contacts/contactsStore.ts +183 -0
- package/core/context/WalletContext.tsx +55 -10
- package/core/demo/demoAssets.ts +60 -0
- package/core/demo/demoLedger.ts +240 -0
- package/core/demo/demoMandalaRuntime.ts +96 -0
- package/core/demo/demoMode.ts +38 -0
- package/core/demo/demoWallet.ts +25 -0
- package/core/demo/index.ts +26 -0
- package/core/demo/useDemo.ts +59 -0
- package/core/headers/OfflineFirstChaintracks.ts +52 -14
- package/core/headers/headerStore.ts +7 -10
- package/core/i18n/translations.tsx +1234 -74
- package/core/identity/contactLink.ts +36 -0
- package/core/identity/handleRegistry/client.ts +285 -0
- package/core/identity/handleRegistry/profileCert.ts +254 -0
- package/core/identity/handleRegistry/registration.ts +559 -0
- package/core/identity/handleRegistry/resolver.ts +247 -0
- package/core/identity/handleRegistry/rules.ts +104 -0
- package/core/index.ts +20 -2
- package/core/localpay/pendingAborts.ts +5 -1
- package/core/monitor/MonitorSupervisor.ts +121 -0
- package/core/monitor/TaskBackupPush.ts +1 -1
- package/core/monitor/TaskCreditInbox.ts +1 -1
- package/core/monitor/TaskDrainOutbox.ts +1 -1
- package/core/monitor/TaskSendOffline.ts +1 -1
- package/core/net/online.ts +49 -0
- package/core/numberFormat.ts +19 -0
- package/core/offline/plan.ts +1 -1
- package/core/pay/recordProof.ts +2 -6
- package/core/services/arcadeBroadcastProvider.ts +1 -4
- package/core/services/exchangeRate.ts +1 -1
- package/core/services/externalOrigin.ts +5 -2
- package/core/services/vault/transfers.ts +2 -2
- package/core/services/walletServiceConfig.ts +31 -20
- package/core/storage/StorageExpoSQLite.ts +41 -34
- package/core/storage/methods/findSql.ts +3 -0
- package/core/storage/methods/listActionsSql.ts +8 -5
- package/core/storage/methods/listOutputsSql.ts +2 -2
- package/core/storage/methods/processOfflineActions.ts +2 -3
- package/core/storage/methods/reviewStatusSql.ts +7 -2
- package/core/storage/schema/createTables.ts +29 -0
- package/core/toolboxConfig.ts +70 -0
- package/core/toolboxTypes.ts +40 -0
- package/core/userAvatar.ts +79 -0
- package/core/walletMonitor.ts +8 -3
- package/package.json +7 -7
- package/ui/activityFilter.ts +115 -0
- package/ui/components/pay/PaymentSuccessOverlay.tsx +46 -6
- package/ui/components/pay/RecipientField.tsx +84 -70
- package/ui/components/pay/StepBar.tsx +32 -0
- package/ui/components/pay/UniversalSend.tsx +677 -149
- package/ui/components/ui/PencilEditField.tsx +109 -0
- package/ui/components/ui/SlideOverFromRight.tsx +86 -0
- package/ui/components/wallet/ActivityRow.tsx +222 -120
- package/ui/components/wallet/AmountInput.tsx +18 -6
- package/ui/components/wallet/ContactActivityList.tsx +149 -0
- package/ui/components/wallet/ContactSigil.tsx +49 -0
- package/ui/components/wallet/EditPictureSheet.tsx +99 -0
- package/ui/components/wallet/FitAmount.tsx +148 -0
- package/ui/components/wallet/IconPickerSheet.tsx +168 -0
- package/ui/components/wallet/IdentifierRow.tsx +69 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +35 -13
- package/ui/components/wallet/ProfileButton.tsx +62 -0
- package/ui/components/wallet/UserAvatar.tsx +85 -0
- package/ui/components/wallet/avatarIcons.ts +122 -0
- package/ui/hooks/useContactsStore.ts +10 -0
- package/ui/hooks/useMandala.ts +18 -1
- package/ui/hooks/useOnline.ts +65 -20
- package/ui/index.ts +26 -1
- package/ui/screens/ContactScreen.tsx +289 -0
- package/ui/screens/ContactsScreen.tsx +373 -0
- package/ui/screens/IdentifierScreen.tsx +234 -0
- package/ui/screens/NewContactScreen.tsx +362 -0
- package/ui/screens/PayScreen.tsx +20 -7
- package/ui/screens/ProfileScreen.tsx +783 -0
- package/ui/screens/TransactionDetailScreen.tsx +419 -0
- package/ui/screens/TrustScreen.tsx +1 -1
- package/ui/screens/WalletConfigScreen.tsx +42 -0
- package/ui/screens/WalletHomeScreen.tsx +528 -83
- package/ui/tokenStatus.ts +21 -0
- package/ui/txStatus.ts +43 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsv/expo-wallet-toolbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"CHANGELOG.md"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@bsv/air-gap": "^0.1.
|
|
32
|
+
"@bsv/air-gap": "^0.1.3",
|
|
33
33
|
"@bsv/backup-cache-client": "^0.1.0",
|
|
34
|
-
"@bsv/btms-permission-module": "^1.1
|
|
34
|
+
"@bsv/btms-permission-module": "^1.2.1",
|
|
35
35
|
"@bsv/mandala": "^0.2.0",
|
|
36
|
-
"@bsv/message-box-client": "^2.
|
|
36
|
+
"@bsv/message-box-client": "^2.5.3",
|
|
37
37
|
"@bsv/react-native-localpay-transport": "*",
|
|
38
|
-
"@bsv/sdk": "^2.
|
|
39
|
-
"@bsv/templates": "^1.10.
|
|
40
|
-
"@bsv/wallet-toolbox-mobile": "^2.
|
|
38
|
+
"@bsv/sdk": "^2.8.2",
|
|
39
|
+
"@bsv/templates": "^1.10.3",
|
|
40
|
+
"@bsv/wallet-toolbox-mobile": "^2.14.0",
|
|
41
41
|
"@expo/vector-icons": "^15.0.3",
|
|
42
42
|
"@noble/curves": "^2.3.0",
|
|
43
43
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrowing the activity list: by the word a row says (Sent, Received, Spent,
|
|
3
|
+
* Transferred) and by a search over what the row shows plus who it was with.
|
|
4
|
+
*
|
|
5
|
+
* The search only ever reads what this device already holds: the row's own
|
|
6
|
+
* title (the sender's note, or the name recorded when the payment was made)
|
|
7
|
+
* and, when the counterparty is a saved contact, that contact's name and
|
|
8
|
+
* handle. It never asks the network who a key belongs to.
|
|
9
|
+
*
|
|
10
|
+
* Every typed word has to appear somewhere, in any order, ignoring case and
|
|
11
|
+
* accents. That is "fuzzy" in the forgiving sense, not a ranked or
|
|
12
|
+
* typo-tolerant one: a row either says what was typed or it does not.
|
|
13
|
+
*/
|
|
14
|
+
import { counterpartyOf } from '../core/pay/counterparty'
|
|
15
|
+
import type { ContactRow } from '../core/contacts/contactsStore'
|
|
16
|
+
import type { ActivityAction } from './components/wallet/ActivityRow'
|
|
17
|
+
import { activityKind, type ActivityKind } from './txStatus'
|
|
18
|
+
|
|
19
|
+
export type ActivityKindFilter = 'all' | ActivityKind
|
|
20
|
+
|
|
21
|
+
/** The chips, in the order they are drawn. */
|
|
22
|
+
export const ACTIVITY_KIND_FILTERS: readonly ActivityKindFilter[] = ['all', 'sent', 'received', 'spent', 'transferred']
|
|
23
|
+
|
|
24
|
+
/** A chip names its kind with the row's own status key, so the two always read the same word. */
|
|
25
|
+
export function kindFilterLabelKey(kind: ActivityKindFilter): string {
|
|
26
|
+
return kind === 'all' ? 'activity_filter_all' : `tx_status_${kind}`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ActivityFilter {
|
|
30
|
+
kind: ActivityKindFilter
|
|
31
|
+
/** Already normalised by `searchTerms`. */
|
|
32
|
+
terms: readonly string[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isActivityFilterActive(filter: ActivityFilter): boolean {
|
|
36
|
+
return filter.kind !== 'all' || filter.terms.length > 0
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Only the Latin combining marks: Indic vowel signs are letters, not accents. */
|
|
40
|
+
const COMBINING_DIACRITICS = /[̀-ͯ]/g
|
|
41
|
+
|
|
42
|
+
function normalise(text: string): string {
|
|
43
|
+
let folded = text
|
|
44
|
+
try {
|
|
45
|
+
folded = text.normalize('NFKD').replace(COMBINING_DIACRITICS, '')
|
|
46
|
+
} catch {
|
|
47
|
+
// An engine without normalisation still gets a case-insensitive search.
|
|
48
|
+
}
|
|
49
|
+
return folded.toLowerCase()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The words to look for. A leading `@` is dropped because handles are stored
|
|
54
|
+
* without one; an `@` further in (a paymail) is part of what was typed.
|
|
55
|
+
*/
|
|
56
|
+
export function searchTerms(query: string): string[] {
|
|
57
|
+
return normalise(query)
|
|
58
|
+
.split(/\s+/)
|
|
59
|
+
.map(word => word.replace(/^@+/, ''))
|
|
60
|
+
.filter(word => word.length > 0)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ContactNames {
|
|
64
|
+
name: string
|
|
65
|
+
cachedHandle?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Contacts keyed by lower-cased identity key: the wallet lower-cases every label it stores. */
|
|
69
|
+
export function contactNamesByKey(
|
|
70
|
+
contacts: readonly Pick<ContactRow, 'identityKey' | 'name' | 'cachedHandle'>[]
|
|
71
|
+
): Map<string, ContactNames> {
|
|
72
|
+
return new Map(contacts.map(c => [c.identityKey.toLowerCase(), { name: c.name, cachedHandle: c.cachedHandle }]))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The part of a token row this cares about: see `ActivityRow`'s `token` prop. */
|
|
76
|
+
export interface ActivityRowToken {
|
|
77
|
+
title: string
|
|
78
|
+
incoming: boolean
|
|
79
|
+
counterpartyKey?: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Whether a row survives the filter.
|
|
84
|
+
*
|
|
85
|
+
* `token` is the row's token half when it has one, exactly as the list draws
|
|
86
|
+
* it: a token row is read by its own title and direction, never by the wallet
|
|
87
|
+
* action underneath (whose description is a library string carrying a raw
|
|
88
|
+
* token id, and whose satoshis are the BSV the transfer cost).
|
|
89
|
+
*/
|
|
90
|
+
export function matchesActivity(
|
|
91
|
+
action: ActivityAction,
|
|
92
|
+
token: ActivityRowToken | undefined,
|
|
93
|
+
filter: ActivityFilter,
|
|
94
|
+
contacts: ReadonlyMap<string, ContactNames>
|
|
95
|
+
): boolean {
|
|
96
|
+
if (filter.kind !== 'all') {
|
|
97
|
+
// Same direction rule the row itself uses to pick its word.
|
|
98
|
+
const incoming = token ? token.incoming : action.satoshis >= 0
|
|
99
|
+
if (activityKind(incoming, action.labels) !== filter.kind) return false
|
|
100
|
+
}
|
|
101
|
+
if (filter.terms.length === 0) return true
|
|
102
|
+
|
|
103
|
+
const counterpartyKey = token
|
|
104
|
+
? token.counterpartyKey
|
|
105
|
+
: (() => {
|
|
106
|
+
const cp = counterpartyOf(action)
|
|
107
|
+
return cp?.kind === 'identityKey' ? cp.value : undefined
|
|
108
|
+
})()
|
|
109
|
+
const contact = counterpartyKey ? contacts.get(counterpartyKey.toLowerCase()) : undefined
|
|
110
|
+
// One field per line, so no word can match across the seam of two fields.
|
|
111
|
+
const haystack = normalise(
|
|
112
|
+
[token ? token.title : action.description, contact?.name, contact?.cachedHandle].filter(Boolean).join('\n')
|
|
113
|
+
)
|
|
114
|
+
return filter.terms.every(term => haystack.includes(term))
|
|
115
|
+
}
|
|
@@ -95,6 +95,14 @@ export interface ReceivedOverlayProps {
|
|
|
95
95
|
* (rather than as the app root) should pass its own wallet-home route here.
|
|
96
96
|
*/
|
|
97
97
|
dismissTo?: DismissTarget
|
|
98
|
+
/**
|
|
99
|
+
* Sent only, and only when the recipient resolved to an identity key that
|
|
100
|
+
* is not already a saved contact: offers a "Save as a contact" text
|
|
101
|
+
* action under the recipient's name. The caller owns the whole action (cleanup and
|
|
102
|
+
* navigation both) — this component stays presentational and only decides
|
|
103
|
+
* whether to show the button at all.
|
|
104
|
+
*/
|
|
105
|
+
onAddContact?: () => void
|
|
98
106
|
/**
|
|
99
107
|
* Acknowledged. The only way this screen closes. Clean up local state here —
|
|
100
108
|
* the overlay itself then returns the user to the wallet, so the updated
|
|
@@ -113,6 +121,7 @@ export default function PaymentSuccessOverlay({
|
|
|
113
121
|
statusNote,
|
|
114
122
|
firstHoldNote,
|
|
115
123
|
dismissTo = '/',
|
|
124
|
+
onAddContact,
|
|
116
125
|
onDismiss
|
|
117
126
|
}: ReceivedOverlayProps) {
|
|
118
127
|
const sent = direction === 'sent'
|
|
@@ -204,11 +213,30 @@ export default function PaymentSuccessOverlay({
|
|
|
204
213
|
</Animated.View>
|
|
205
214
|
|
|
206
215
|
{sent ? (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
216
|
+
<>
|
|
217
|
+
{!!recipientName && (
|
|
218
|
+
<Text
|
|
219
|
+
style={[styles.support, { color: colors.textSecondary }]}
|
|
220
|
+
numberOfLines={1}
|
|
221
|
+
ellipsizeMode="middle"
|
|
222
|
+
>
|
|
223
|
+
{t('pay_sent_to', { name: recipientName })}
|
|
224
|
+
</Text>
|
|
225
|
+
)}
|
|
226
|
+
{/* A text button under the name, not a second filled control: Done
|
|
227
|
+
stays the one accent-filled control on this screen. */}
|
|
228
|
+
{!!onAddContact && (
|
|
229
|
+
<PressableScale
|
|
230
|
+
onPress={onAddContact}
|
|
231
|
+
haptic="tap"
|
|
232
|
+
style={styles.saveContact}
|
|
233
|
+
accessibilityRole="button"
|
|
234
|
+
accessibilityLabel={t('pay_save_as_contact')}
|
|
235
|
+
>
|
|
236
|
+
<Text style={[styles.saveContactText, { color: colors.accent }]}>{t('pay_save_as_contact')}</Text>
|
|
237
|
+
</PressableScale>
|
|
238
|
+
)}
|
|
239
|
+
</>
|
|
212
240
|
) : (
|
|
213
241
|
<Text style={[styles.support, { color: colors.success }]} textBreakStrategy="balanced">
|
|
214
242
|
{count > 1 ? t('local_pay_added_multiple', { count }) : t('local_pay_added')}
|
|
@@ -299,7 +327,8 @@ const styles = StyleSheet.create({
|
|
|
299
327
|
maxWidth: 300
|
|
300
328
|
},
|
|
301
329
|
footer: {
|
|
302
|
-
paddingBottom: spacing.md
|
|
330
|
+
paddingBottom: spacing.md,
|
|
331
|
+
gap: spacing.sm
|
|
303
332
|
},
|
|
304
333
|
button: {
|
|
305
334
|
flexDirection: 'row',
|
|
@@ -311,5 +340,16 @@ const styles = StyleSheet.create({
|
|
|
311
340
|
buttonText: {
|
|
312
341
|
...typography.headline,
|
|
313
342
|
fontWeight: '600'
|
|
343
|
+
},
|
|
344
|
+
saveContact: {
|
|
345
|
+
minHeight: 44,
|
|
346
|
+
paddingHorizontal: spacing.lg,
|
|
347
|
+
paddingVertical: spacing.md,
|
|
348
|
+
alignItems: 'center',
|
|
349
|
+
justifyContent: 'center'
|
|
350
|
+
},
|
|
351
|
+
saveContactText: {
|
|
352
|
+
...typography.footnote,
|
|
353
|
+
fontWeight: '600'
|
|
314
354
|
}
|
|
315
355
|
})
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* useRecipientInput; this file only renders that state.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react'
|
|
10
|
-
import { ActivityIndicator,
|
|
10
|
+
import { ActivityIndicator, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native'
|
|
11
11
|
import type { DisplayableIdentity } from '@bsv/sdk'
|
|
12
12
|
import Animated, { FadeInDown, useReducedMotion } from 'react-native-reanimated'
|
|
13
13
|
import { spacing, typography, radii, springs } from '@bsv/expo-wallet-toolbox'
|
|
14
|
+
import ContactSigil from '../wallet/ContactSigil'
|
|
14
15
|
import type { RecipientInlineError, RecipientTarget } from './useRecipientInput'
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -30,17 +31,29 @@ function loadIonicons(): IoniconsComponent {
|
|
|
30
31
|
return ioniconsComponent
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* A dropdown row. `DisplayableIdentity` is a fixed seven-string SDK interface
|
|
36
|
+
* with nowhere to put a handle, so the one line this list needs that it does
|
|
37
|
+
* not carry is added here — supplied by the caller, because only the caller
|
|
38
|
+
* knows whether a row came from a contact, the registry or the overlay.
|
|
39
|
+
*/
|
|
40
|
+
export interface RecipientRow extends DisplayableIdentity {
|
|
41
|
+
/** Drawn under the name: a registry row's full `handle@domain`, a contact's
|
|
42
|
+
* `cachedHandle`. Falls back to the abbreviated identity key. */
|
|
43
|
+
readonly secondaryLine?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
33
46
|
interface RecipientFieldProps {
|
|
34
47
|
readonly selectedIdentity: DisplayableIdentity | null
|
|
35
48
|
readonly inputText: string
|
|
36
49
|
readonly target: RecipientTarget | null
|
|
37
50
|
readonly inlineError: RecipientInlineError | null
|
|
38
51
|
readonly isSearching: boolean
|
|
39
|
-
readonly searchResults:
|
|
52
|
+
readonly searchResults: RecipientRow[]
|
|
40
53
|
readonly colors: ReturnType<typeof import('@bsv/expo-wallet-toolbox').useTheme>['colors']
|
|
41
54
|
readonly t: ReturnType<typeof import('react-i18next').useTranslation>['t']
|
|
42
55
|
readonly onChangeText: (v: string) => void
|
|
43
|
-
readonly onSelectIdentity: (i:
|
|
56
|
+
readonly onSelectIdentity: (i: RecipientRow) => void
|
|
44
57
|
readonly onClear: () => void
|
|
45
58
|
readonly onOpenScanner: () => void
|
|
46
59
|
/**
|
|
@@ -61,6 +74,13 @@ interface RecipientFieldProps {
|
|
|
61
74
|
* Rendered in place of the resolved-target line.
|
|
62
75
|
*/
|
|
63
76
|
readonly statusOverride?: { readonly text: string; readonly tone: 'warning' | 'error' }
|
|
77
|
+
/**
|
|
78
|
+
* A heading shown above the dropdown when it is showing local contacts on
|
|
79
|
+
* an empty query rather than overlay search hits (Pay's "Recent" tier,
|
|
80
|
+
* 2026-09 design). The caller merges local contacts into `searchResults`
|
|
81
|
+
* itself — this component only draws the label they ask for.
|
|
82
|
+
*/
|
|
83
|
+
readonly recentLabel?: string
|
|
64
84
|
}
|
|
65
85
|
|
|
66
86
|
export default function RecipientField({
|
|
@@ -77,7 +97,8 @@ export default function RecipientField({
|
|
|
77
97
|
onClear,
|
|
78
98
|
onOpenScanner,
|
|
79
99
|
assetTicker,
|
|
80
|
-
statusOverride
|
|
100
|
+
statusOverride,
|
|
101
|
+
recentLabel
|
|
81
102
|
}: RecipientFieldProps) {
|
|
82
103
|
const Ionicons = loadIonicons()
|
|
83
104
|
const reducedMotion = useReducedMotion()
|
|
@@ -92,13 +113,14 @@ export default function RecipientField({
|
|
|
92
113
|
entering={identityEntering}
|
|
93
114
|
style={[styles.selectedRecipient, { backgroundColor: colors.backgroundSecondary }]}
|
|
94
115
|
>
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
{/* Their avatar, else their sigil — never an initials/person placeholder
|
|
117
|
+
(2026-09-18 ruling): the same face Contacts and the review card draw. */}
|
|
118
|
+
<ContactSigil
|
|
119
|
+
identityKey={selectedIdentity.identityKey}
|
|
120
|
+
avatarUrl={selectedIdentity.avatarURL || undefined}
|
|
121
|
+
size={36}
|
|
122
|
+
radius={18}
|
|
123
|
+
/>
|
|
102
124
|
<View style={styles.selectedInfo}>
|
|
103
125
|
<Text style={[styles.selectedName, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
104
126
|
{selectedIdentity.name || t('unknown')}
|
|
@@ -175,46 +197,52 @@ export default function RecipientField({
|
|
|
175
197
|
<View
|
|
176
198
|
style={[styles.searchResults, { backgroundColor: colors.backgroundSecondary, borderColor: colors.separator }]}
|
|
177
199
|
>
|
|
178
|
-
{
|
|
200
|
+
{!!recentLabel && inputText.trim() === '' && (
|
|
201
|
+
<Text style={[styles.recentLabel, { color: colors.textTertiary }]}>{recentLabel}</Text>
|
|
202
|
+
)}
|
|
203
|
+
{searchResults.map((identity, idx) => (
|
|
204
|
+
<TouchableOpacity
|
|
205
|
+
key={identity.identityKey + idx}
|
|
206
|
+
onPress={() => onSelectIdentity(identity)}
|
|
207
|
+
style={[
|
|
208
|
+
styles.searchResultRow,
|
|
209
|
+
(idx < searchResults.length - 1 || isSearching) && {
|
|
210
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
211
|
+
borderBottomColor: colors.separator
|
|
212
|
+
}
|
|
213
|
+
]}
|
|
214
|
+
>
|
|
215
|
+
<View style={styles.searchAvatar}>
|
|
216
|
+
<ContactSigil
|
|
217
|
+
identityKey={identity.identityKey}
|
|
218
|
+
avatarUrl={identity.avatarURL || undefined}
|
|
219
|
+
size={32}
|
|
220
|
+
radius={16}
|
|
221
|
+
/>
|
|
222
|
+
</View>
|
|
223
|
+
<View style={styles.searchResultInfo}>
|
|
224
|
+
<Text style={[styles.searchResultName, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
225
|
+
{identity.name || t('unknown')}
|
|
226
|
+
</Text>
|
|
227
|
+
<Text style={[styles.searchResultKey, { color: colors.textSecondary }]} numberOfLines={1}>
|
|
228
|
+
{identity.secondaryLine || identity.abbreviatedKey || `${identity.identityKey.slice(0, 20)}...`}
|
|
229
|
+
</Text>
|
|
230
|
+
</View>
|
|
231
|
+
{identity.badgeLabel ? (
|
|
232
|
+
<View style={[styles.badge, { backgroundColor: colors.fill }]}>
|
|
233
|
+
<Text style={[styles.badgeText, { color: colors.accent }]}>{identity.badgeLabel}</Text>
|
|
234
|
+
</View>
|
|
235
|
+
) : null}
|
|
236
|
+
</TouchableOpacity>
|
|
237
|
+
))}
|
|
238
|
+
{/* A footer, not a replacement: the instant tier is already on screen
|
|
239
|
+
and hiding it for the remote tier's whole debounce made "instant"
|
|
240
|
+
a claim the user never saw. */}
|
|
241
|
+
{isSearching && (
|
|
179
242
|
<View style={styles.searchLoading}>
|
|
180
243
|
<ActivityIndicator size="small" color={colors.accent} />
|
|
181
244
|
<Text style={[styles.searchLoadingText, { color: colors.textSecondary }]}>{t('searching')}</Text>
|
|
182
245
|
</View>
|
|
183
|
-
) : (
|
|
184
|
-
searchResults.map((identity, idx) => (
|
|
185
|
-
<TouchableOpacity
|
|
186
|
-
key={identity.identityKey + idx}
|
|
187
|
-
onPress={() => onSelectIdentity(identity)}
|
|
188
|
-
style={[
|
|
189
|
-
styles.searchResultRow,
|
|
190
|
-
idx < searchResults.length - 1 && {
|
|
191
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
192
|
-
borderBottomColor: colors.separator
|
|
193
|
-
}
|
|
194
|
-
]}
|
|
195
|
-
>
|
|
196
|
-
{identity.avatarURL ? (
|
|
197
|
-
<Image source={{ uri: identity.avatarURL }} style={styles.searchAvatar} />
|
|
198
|
-
) : (
|
|
199
|
-
<View style={[styles.searchAvatarPlaceholder, { backgroundColor: colors.accent }]}>
|
|
200
|
-
<Ionicons name="person" size={18} color={colors.background} />
|
|
201
|
-
</View>
|
|
202
|
-
)}
|
|
203
|
-
<View style={styles.searchResultInfo}>
|
|
204
|
-
<Text style={[styles.searchResultName, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
205
|
-
{identity.name || t('unknown')}
|
|
206
|
-
</Text>
|
|
207
|
-
<Text style={[styles.searchResultKey, { color: colors.textSecondary }]} numberOfLines={1}>
|
|
208
|
-
{identity.abbreviatedKey || `${identity.identityKey.slice(0, 20)}...`}
|
|
209
|
-
</Text>
|
|
210
|
-
</View>
|
|
211
|
-
{identity.badgeLabel ? (
|
|
212
|
-
<View style={[styles.badge, { backgroundColor: colors.fill }]}>
|
|
213
|
-
<Text style={[styles.badgeText, { color: colors.accent }]}>{identity.badgeLabel}</Text>
|
|
214
|
-
</View>
|
|
215
|
-
) : null}
|
|
216
|
-
</TouchableOpacity>
|
|
217
|
-
))
|
|
218
246
|
)}
|
|
219
247
|
</View>
|
|
220
248
|
)}
|
|
@@ -230,18 +258,6 @@ const styles = StyleSheet.create({
|
|
|
230
258
|
padding: spacing.md,
|
|
231
259
|
borderRadius: radii.md
|
|
232
260
|
},
|
|
233
|
-
avatar: {
|
|
234
|
-
width: 36,
|
|
235
|
-
height: 36,
|
|
236
|
-
borderRadius: 18
|
|
237
|
-
},
|
|
238
|
-
avatarPlaceholder: {
|
|
239
|
-
width: 36,
|
|
240
|
-
height: 36,
|
|
241
|
-
borderRadius: 18,
|
|
242
|
-
alignItems: 'center',
|
|
243
|
-
justifyContent: 'center'
|
|
244
|
-
},
|
|
245
261
|
selectedInfo: {
|
|
246
262
|
flex: 1,
|
|
247
263
|
marginLeft: spacing.md
|
|
@@ -287,23 +303,21 @@ const styles = StyleSheet.create({
|
|
|
287
303
|
searchLoadingText: {
|
|
288
304
|
...typography.subhead
|
|
289
305
|
},
|
|
306
|
+
recentLabel: {
|
|
307
|
+
...typography.caption2,
|
|
308
|
+
fontWeight: '700',
|
|
309
|
+
letterSpacing: 0.8,
|
|
310
|
+
textTransform: 'uppercase',
|
|
311
|
+
paddingHorizontal: spacing.md,
|
|
312
|
+
paddingTop: spacing.sm,
|
|
313
|
+
paddingBottom: spacing.xs
|
|
314
|
+
},
|
|
290
315
|
searchResultRow: {
|
|
291
316
|
flexDirection: 'row',
|
|
292
317
|
alignItems: 'center',
|
|
293
318
|
padding: spacing.md
|
|
294
319
|
},
|
|
295
320
|
searchAvatar: {
|
|
296
|
-
width: 32,
|
|
297
|
-
height: 32,
|
|
298
|
-
borderRadius: 16,
|
|
299
|
-
marginRight: spacing.md
|
|
300
|
-
},
|
|
301
|
-
searchAvatarPlaceholder: {
|
|
302
|
-
width: 32,
|
|
303
|
-
height: 32,
|
|
304
|
-
borderRadius: 16,
|
|
305
|
-
alignItems: 'center',
|
|
306
|
-
justifyContent: 'center',
|
|
307
321
|
marginRight: spacing.md
|
|
308
322
|
},
|
|
309
323
|
searchResultInfo: {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The thin progress bar across the top of Pay's three steps (who / amount /
|
|
3
|
+
* review). No "Step n of 3" caption (2026-09-18 design ruling) — just the
|
|
4
|
+
* track. Same visual weight as `EnrollWizard`'s `StepProgress`, which this is
|
|
5
|
+
* lifted from, minus the label.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react'
|
|
8
|
+
import { StyleSheet, View } from 'react-native'
|
|
9
|
+
import { useTheme, radii, spacing } from '@bsv/expo-wallet-toolbox'
|
|
10
|
+
|
|
11
|
+
export type PayStep = 'who' | 'amount' | 'review'
|
|
12
|
+
|
|
13
|
+
const STEPS: PayStep[] = ['who', 'amount', 'review']
|
|
14
|
+
|
|
15
|
+
export default function StepBar({ step }: { step: PayStep }) {
|
|
16
|
+
const { colors } = useTheme()
|
|
17
|
+
const n = STEPS.indexOf(step) + 1
|
|
18
|
+
const total = STEPS.length
|
|
19
|
+
return (
|
|
20
|
+
<View style={styles.wrap} accessibilityRole="progressbar" accessibilityValue={{ min: 1, max: total, now: n }}>
|
|
21
|
+
<View style={[styles.track, { backgroundColor: colors.backgroundSecondary }]}>
|
|
22
|
+
<View style={[styles.fill, { backgroundColor: colors.accent, width: `${(n / total) * 100}%` }]} />
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
wrap: { paddingHorizontal: spacing.lg, paddingTop: spacing.sm, paddingBottom: spacing.md },
|
|
30
|
+
track: { height: 4, borderRadius: radii.sm, overflow: 'hidden' },
|
|
31
|
+
fill: { height: 4, borderRadius: radii.sm }
|
|
32
|
+
})
|