@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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An editable label row for a grouped card (contact name, profile display
|
|
3
|
+
* name): the field is always a live text input, a pencil sits at rest in the
|
|
4
|
+
* leading slot, and once the text has actually changed that slot becomes a
|
|
5
|
+
* filled confirm button (2026-09-17 design ruling). Tapping the pencil only
|
|
6
|
+
* focuses the field; nothing is saved until the check is tapped or the
|
|
7
|
+
* keyboard's return key is pressed with a real change.
|
|
8
|
+
*/
|
|
9
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
10
|
+
import { StyleSheet, TextInput, View, type StyleProp, type TextStyle } from 'react-native'
|
|
11
|
+
import { useTheme, spacing, typography } from '@bsv/expo-wallet-toolbox'
|
|
12
|
+
import PressableScale from './PressableScale'
|
|
13
|
+
|
|
14
|
+
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
15
|
+
let ioniconsComponent: IoniconsComponent | undefined
|
|
16
|
+
function loadIonicons(): IoniconsComponent {
|
|
17
|
+
if (!ioniconsComponent) {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
19
|
+
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
20
|
+
}
|
|
21
|
+
return ioniconsComponent
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface PencilEditFieldProps {
|
|
25
|
+
value: string
|
|
26
|
+
onSave: (next: string) => void | Promise<void>
|
|
27
|
+
placeholder?: string
|
|
28
|
+
textStyle?: StyleProp<TextStyle>
|
|
29
|
+
editAccessibilityLabel: string
|
|
30
|
+
saveAccessibilityLabel: string
|
|
31
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'
|
|
32
|
+
maxLength?: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function PencilEditField({
|
|
36
|
+
value,
|
|
37
|
+
onSave,
|
|
38
|
+
placeholder,
|
|
39
|
+
textStyle,
|
|
40
|
+
editAccessibilityLabel,
|
|
41
|
+
saveAccessibilityLabel,
|
|
42
|
+
autoCapitalize = 'words',
|
|
43
|
+
maxLength
|
|
44
|
+
}: PencilEditFieldProps) {
|
|
45
|
+
const { colors } = useTheme()
|
|
46
|
+
const Ionicons = loadIonicons()
|
|
47
|
+
const inputRef = useRef<TextInput>(null)
|
|
48
|
+
const [text, setText] = useState(value)
|
|
49
|
+
// A save that lands from outside (a cache refresh, the parent reloading)
|
|
50
|
+
// re-seeds the field; an in-progress edit is never clobbered, because the
|
|
51
|
+
// parent's value only changes once our own save has gone through.
|
|
52
|
+
useEffect(() => setText(value), [value])
|
|
53
|
+
const changed = text.trim() !== '' && text.trim() !== value.trim()
|
|
54
|
+
|
|
55
|
+
const save = async () => {
|
|
56
|
+
if (!changed) return
|
|
57
|
+
await onSave(text.trim())
|
|
58
|
+
inputRef.current?.blur()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<View style={styles.row}>
|
|
63
|
+
{changed ? (
|
|
64
|
+
<PressableScale
|
|
65
|
+
onPress={save}
|
|
66
|
+
haptic="confirm"
|
|
67
|
+
style={styles.leading}
|
|
68
|
+
accessibilityRole="button"
|
|
69
|
+
accessibilityLabel={saveAccessibilityLabel}
|
|
70
|
+
>
|
|
71
|
+
<View style={[styles.confirmDisc, { backgroundColor: colors.accent }]}>
|
|
72
|
+
<Ionicons name="checkmark" size={16} color={colors.textOnAccent} />
|
|
73
|
+
</View>
|
|
74
|
+
</PressableScale>
|
|
75
|
+
) : (
|
|
76
|
+
<PressableScale
|
|
77
|
+
onPress={() => inputRef.current?.focus()}
|
|
78
|
+
style={styles.leading}
|
|
79
|
+
accessibilityRole="button"
|
|
80
|
+
accessibilityLabel={editAccessibilityLabel}
|
|
81
|
+
>
|
|
82
|
+
<Ionicons name="pencil-outline" size={17} color={colors.textSecondary} />
|
|
83
|
+
</PressableScale>
|
|
84
|
+
)}
|
|
85
|
+
<TextInput
|
|
86
|
+
ref={inputRef}
|
|
87
|
+
value={text}
|
|
88
|
+
onChangeText={setText}
|
|
89
|
+
placeholder={placeholder}
|
|
90
|
+
placeholderTextColor={colors.textTertiary}
|
|
91
|
+
autoCapitalize={autoCapitalize}
|
|
92
|
+
autoCorrect={false}
|
|
93
|
+
maxLength={maxLength}
|
|
94
|
+
returnKeyType="done"
|
|
95
|
+
onSubmitEditing={save}
|
|
96
|
+
style={[styles.input, { color: colors.textPrimary }, textStyle]}
|
|
97
|
+
/>
|
|
98
|
+
</View>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const styles = StyleSheet.create({
|
|
103
|
+
row: { flexDirection: 'row', alignItems: 'center', minHeight: 52, paddingLeft: spacing.xs, paddingRight: spacing.lg },
|
|
104
|
+
// A 44pt target around a 17pt glyph / 28pt disc, flush with the card's
|
|
105
|
+
// left padding once the disc's own inset is counted.
|
|
106
|
+
leading: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' },
|
|
107
|
+
confirmDisc: { width: 28, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center' },
|
|
108
|
+
input: { ...typography.body, flex: 1, minWidth: 0, paddingVertical: spacing.md, paddingHorizontal: 0 }
|
|
109
|
+
})
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A full-screen surface that arrives from the right and leaves to the right —
|
|
3
|
+
* the push/pop a native stack gives you, for a view presented inside a screen
|
|
4
|
+
* rather than routed to.
|
|
5
|
+
*
|
|
6
|
+
* React Native's `Modal` animates only vertically (`animationType="slide"`
|
|
7
|
+
* comes up from the bottom), which reads as a sheet, not a push. So the
|
|
8
|
+
* transform is ours, and per the motion rules it runs on the UI thread via
|
|
9
|
+
* Reanimated and decelerates on `easings.out` — never a JS timer.
|
|
10
|
+
*
|
|
11
|
+
* Reduced motion collapses the translation to a crossfade rather than removing
|
|
12
|
+
* the transition: the surface still needs to read as arriving.
|
|
13
|
+
*/
|
|
14
|
+
import React, { useEffect, useState } from 'react'
|
|
15
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
16
|
+
import Animated, {
|
|
17
|
+
runOnJS,
|
|
18
|
+
useAnimatedStyle,
|
|
19
|
+
useReducedMotion,
|
|
20
|
+
useSharedValue,
|
|
21
|
+
withTiming
|
|
22
|
+
} from 'react-native-reanimated'
|
|
23
|
+
import { durations, easings } from '@bsv/expo-wallet-toolbox'
|
|
24
|
+
|
|
25
|
+
export default function SlideOverFromRight({
|
|
26
|
+
visible,
|
|
27
|
+
onClosed,
|
|
28
|
+
children
|
|
29
|
+
}: {
|
|
30
|
+
visible: boolean
|
|
31
|
+
/** Fired once the surface has finished leaving, so the caller can drop its content. */
|
|
32
|
+
onClosed?: () => void
|
|
33
|
+
children: React.ReactNode
|
|
34
|
+
}) {
|
|
35
|
+
const { width } = useWindowDimensions()
|
|
36
|
+
const reduced = useReducedMotion()
|
|
37
|
+
// Mounted for as long as anything is on screen — through the close animation,
|
|
38
|
+
// not just while `visible` is true.
|
|
39
|
+
const [mounted, setMounted] = useState(visible)
|
|
40
|
+
const progress = useSharedValue(visible ? 1 : 0)
|
|
41
|
+
|
|
42
|
+
// Adjusting own state during render, which React sanctions for "derive from
|
|
43
|
+
// a prop that just changed" — an effect would mount one frame late and the
|
|
44
|
+
// surface would jump in already half-arrived.
|
|
45
|
+
if (visible && !mounted) setMounted(true)
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const done = (finished?: boolean) => {
|
|
49
|
+
'worklet'
|
|
50
|
+
if (finished && !visible) {
|
|
51
|
+
runOnJS(setMounted)(false)
|
|
52
|
+
if (onClosed) runOnJS(onClosed)()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
progress.value = withTiming(
|
|
56
|
+
visible ? 1 : 0,
|
|
57
|
+
{ duration: visible ? durations.moderate : durations.quick, easing: easings.out },
|
|
58
|
+
done
|
|
59
|
+
)
|
|
60
|
+
// `onClosed` is deliberately absent: an inline callback from the caller
|
|
61
|
+
// would re-run this effect on every render and restart the animation.
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
}, [visible, progress])
|
|
64
|
+
|
|
65
|
+
const style = useAnimatedStyle(() =>
|
|
66
|
+
reduced
|
|
67
|
+
? { opacity: progress.value, transform: [{ translateX: 0 }] }
|
|
68
|
+
: { opacity: 1, transform: [{ translateX: (1 - progress.value) * width }] }
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
if (!mounted) return null
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<View style={[StyleSheet.absoluteFill, styles.above]} pointerEvents="box-none">
|
|
75
|
+
<Animated.View style={[StyleSheet.absoluteFill, style]}>{children}</Animated.View>
|
|
76
|
+
</View>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
// A full-screen surface has to cover the screen it arrives over, including
|
|
82
|
+
// that screen's own lifted chrome. The list's top ScrollFade carries
|
|
83
|
+
// zIndex 1, and being a later sibling is not enough to beat it — without
|
|
84
|
+
// this the fade's 24pt band paints straight across the arriving surface.
|
|
85
|
+
above: { zIndex: 10 }
|
|
86
|
+
})
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* txid to a clipboard is not that — it is debugging, and it used to crowd out
|
|
14
14
|
* the two chips that actually resolve a stuck payment.
|
|
15
15
|
*/
|
|
16
|
-
import React, { memo, useContext, useMemo } from 'react'
|
|
16
|
+
import React, { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
|
17
17
|
import { View, Text, StyleSheet, ActivityIndicator } from 'react-native'
|
|
18
18
|
import { useTranslation } from 'react-i18next'
|
|
19
19
|
import type { WalletAction } from '@bsv/sdk'
|
|
@@ -32,9 +32,28 @@ import {
|
|
|
32
32
|
sigilPalette,
|
|
33
33
|
type Counterparty
|
|
34
34
|
} from '@bsv/expo-wallet-toolbox'
|
|
35
|
-
import { txStatusView, toneColor } from '../../txStatus'
|
|
35
|
+
import { txStatusView, toneColor, type TxStatusView } from '../../txStatus'
|
|
36
36
|
import PressableScale from '../ui/PressableScale'
|
|
37
37
|
import Sigil from '../ui/Sigil'
|
|
38
|
+
import type { ContactsStore } from '../../../core/contacts/contactsStore'
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* expo-router is required lazily rather than imported at module scope: this
|
|
42
|
+
* file is barrel-exported from the package's `ui` entry point, and a static
|
|
43
|
+
* top-level `import` of expo-router pulls in its own untransformed JSX
|
|
44
|
+
* source, which Jest cannot parse for any consumer of the barrel, even one
|
|
45
|
+
* that never navigates. Same pattern as every other screen/component in this
|
|
46
|
+
* package that needs the router.
|
|
47
|
+
*/
|
|
48
|
+
type ExpoRouterModule = typeof import('expo-router')
|
|
49
|
+
let expoRouterMod: ExpoRouterModule | undefined
|
|
50
|
+
function loadExpoRouter(): ExpoRouterModule {
|
|
51
|
+
if (!expoRouterMod) {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
53
|
+
expoRouterMod = require('expo-router') as ExpoRouterModule
|
|
54
|
+
}
|
|
55
|
+
return expoRouterMod
|
|
56
|
+
}
|
|
38
57
|
|
|
39
58
|
/**
|
|
40
59
|
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
@@ -57,9 +76,8 @@ function loadIonicons(): IoniconsComponent {
|
|
|
57
76
|
}
|
|
58
77
|
function loadMaterialCommunityIcons(): MaterialCommunityIconsComponent {
|
|
59
78
|
if (!materialCommunityIconsComponent) {
|
|
60
|
-
materialCommunityIconsComponent =
|
|
61
|
-
|
|
62
|
-
.MaterialCommunityIcons as MaterialCommunityIconsComponent
|
|
79
|
+
materialCommunityIconsComponent = // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
80
|
+
require('@expo/vector-icons').MaterialCommunityIcons as MaterialCommunityIconsComponent
|
|
63
81
|
}
|
|
64
82
|
return materialCommunityIconsComponent
|
|
65
83
|
}
|
|
@@ -77,6 +95,20 @@ export type ActivityAction = WalletAction & {
|
|
|
77
95
|
interface Props {
|
|
78
96
|
/** Pass the screen currency to avoid subscribing every row to wallet updates. */
|
|
79
97
|
currency?: string
|
|
98
|
+
/**
|
|
99
|
+
* Pass this alongside `currency` for the same reason: without it the row
|
|
100
|
+
* would call `useWallet()` itself just to scope the contact lookup below,
|
|
101
|
+
* subscribing every row to wallet updates again. `undefined`/`null` simply
|
|
102
|
+
* means the tappable-contact-face feature never activates for this row.
|
|
103
|
+
*/
|
|
104
|
+
walletUserId?: number | null
|
|
105
|
+
/**
|
|
106
|
+
* Same reason as `walletUserId`: built once at the screen and passed down
|
|
107
|
+
* rather than resolved per row via `useContactsStore()`, which reaches
|
|
108
|
+
* `useWallet()` internally — exactly the subscription `currency` above
|
|
109
|
+
* already exists to avoid.
|
|
110
|
+
*/
|
|
111
|
+
contactsStore?: ContactsStore | null
|
|
80
112
|
action: ActivityAction
|
|
81
113
|
/** Identity of this row in the list's expanded/busy bookkeeping. Passed back
|
|
82
114
|
* to `onToggle` so the handler can stay referentially stable across renders —
|
|
@@ -90,6 +122,12 @@ interface Props {
|
|
|
90
122
|
* question ("is it sending? cancelling?") the row can answer. */
|
|
91
123
|
busyLabel?: string
|
|
92
124
|
onToggle: (rowKey: string) => void
|
|
125
|
+
/**
|
|
126
|
+
* Open this row's detail view. When present it REPLACES the expand-in-place
|
|
127
|
+
* tap: a row means one thing, and the utilities that used to unfold
|
|
128
|
+
* underneath it are the detail screen's overflow menu.
|
|
129
|
+
*/
|
|
130
|
+
onOpen?: (action: ActivityAction) => void
|
|
93
131
|
onExplorer: (txid: string) => void
|
|
94
132
|
onRefreshTx: (txid: string) => void
|
|
95
133
|
onAbort: (reference: string) => void
|
|
@@ -132,6 +170,8 @@ interface Props {
|
|
|
132
170
|
counterpartyKey?: string
|
|
133
171
|
/** Settlement status line, in place of the chain-status words. */
|
|
134
172
|
statusText?: string
|
|
173
|
+
/** Settlement status as a tone + label; drives the dot as a BSV row's does. */
|
|
174
|
+
status?: TxStatusView
|
|
135
175
|
}
|
|
136
176
|
}
|
|
137
177
|
|
|
@@ -155,6 +195,8 @@ export function formatRowTime(value?: string | number | Date): string {
|
|
|
155
195
|
|
|
156
196
|
function ActivityRowBase({
|
|
157
197
|
currency,
|
|
198
|
+
walletUserId,
|
|
199
|
+
contactsStore,
|
|
158
200
|
action,
|
|
159
201
|
rowKey,
|
|
160
202
|
offlineStatus,
|
|
@@ -162,6 +204,7 @@ function ActivityRowBase({
|
|
|
162
204
|
busy,
|
|
163
205
|
busyLabel,
|
|
164
206
|
onToggle,
|
|
207
|
+
onOpen,
|
|
165
208
|
onExplorer,
|
|
166
209
|
onRefreshTx,
|
|
167
210
|
onAbort,
|
|
@@ -175,13 +218,16 @@ function ActivityRowBase({
|
|
|
175
218
|
const { satoshisPerUSD, usdToFiat = {} } = useContext(ExchangeRateContext)
|
|
176
219
|
const MaterialCommunityIcons = loadMaterialCommunityIcons()
|
|
177
220
|
|
|
178
|
-
const
|
|
221
|
+
const incoming = token ? token.incoming : action.satoshis >= 0
|
|
222
|
+
// Direction decides the settled wording ("Received" vs "Sent"), so it has to
|
|
223
|
+
// be known before the status view is built.
|
|
224
|
+
const view = token?.status ?? txStatusView(action.status, offlineStatus, incoming, action.labels)
|
|
179
225
|
const settled = view.tone === 'settled'
|
|
180
226
|
const tone = toneColor(view.tone, colors as unknown as Record<string, string>)
|
|
181
|
-
const incoming = token ? token.incoming : action.satoshis >= 0
|
|
182
227
|
|
|
183
228
|
const { value, unit } = formatAmountParts(action.satoshis, currency, satoshisPerUSD, {
|
|
184
229
|
abbreviate: true,
|
|
230
|
+
compact: true,
|
|
185
231
|
showPlus: true,
|
|
186
232
|
usdToFiat
|
|
187
233
|
})
|
|
@@ -190,6 +236,7 @@ function ActivityRowBase({
|
|
|
190
236
|
// reason a sats-denominated wallet needs a fiat line at all.
|
|
191
237
|
const secondary = formatAmount(action.satoshis, currency === 'BSV' ? 'USD' : 'BSV', satoshisPerUSD, {
|
|
192
238
|
abbreviate: true,
|
|
239
|
+
compact: true,
|
|
193
240
|
showPlus: true,
|
|
194
241
|
usdToFiat
|
|
195
242
|
})
|
|
@@ -228,6 +275,41 @@ function ActivityRowBase({
|
|
|
228
275
|
// under a mounted row. Two HSL conversions per render are not worth a dep.
|
|
229
276
|
const palette = face ? sigilPalette(face.hue, !!isDark) : null
|
|
230
277
|
|
|
278
|
+
// The counterparty's own identity key, when the row can name one at all —
|
|
279
|
+
// an address or a bare txid (the other two `counterpartyOf` kinds) can
|
|
280
|
+
// never be a saved contact. Recomputed independently of `face` above: that
|
|
281
|
+
// memo only keeps what the sigil needs (point/hue), and duplicating the
|
|
282
|
+
// (pure, cheap) `counterpartyOf` call here is simpler than threading a
|
|
283
|
+
// second value out of it.
|
|
284
|
+
const counterpartyIdentityKey = useMemo(() => {
|
|
285
|
+
if (isTokenRow) return tokenCounterpartyKey
|
|
286
|
+
const cp = counterpartyOf({ labels: labelsKey === '' ? undefined : labelsKey.split('\n'), senderIdentityKey, txid })
|
|
287
|
+
return cp?.kind === 'identityKey' ? cp.value : undefined
|
|
288
|
+
}, [labelsKey, senderIdentityKey, txid, isTokenRow, tokenCounterpartyKey])
|
|
289
|
+
|
|
290
|
+
// Whether the face is tappable, expanded or not (2026-09-18) — only for a
|
|
291
|
+
// counterparty already saved as a contact; nobody this row cannot name a
|
|
292
|
+
// saved contact for gets a tap that opens nothing.
|
|
293
|
+
const [isContact, setIsContact] = useState(false)
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
if (!counterpartyIdentityKey || !contactsStore || walletUserId == null) {
|
|
296
|
+
setIsContact(false)
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
let cancelled = false
|
|
300
|
+
void contactsStore.getContact(walletUserId, counterpartyIdentityKey).then(c => {
|
|
301
|
+
if (!cancelled) setIsContact(!!c)
|
|
302
|
+
})
|
|
303
|
+
return () => {
|
|
304
|
+
cancelled = true
|
|
305
|
+
}
|
|
306
|
+
}, [counterpartyIdentityKey, contactsStore, walletUserId])
|
|
307
|
+
const faceTappable = isContact && !!counterpartyIdentityKey
|
|
308
|
+
const onPressFace = useCallback(() => {
|
|
309
|
+
if (!counterpartyIdentityKey) return
|
|
310
|
+
loadExpoRouter().router.push({ pathname: '/contact', params: { identityKey: counterpartyIdentityKey } } as never)
|
|
311
|
+
}, [counterpartyIdentityKey])
|
|
312
|
+
|
|
231
313
|
// A parked payment was built and shown as a code, but never released: it is
|
|
232
314
|
// not on chain and no task will put it there. An explorer link would 404 and
|
|
233
315
|
// a Refresh would ask the network about a transaction it has never seen, so
|
|
@@ -265,121 +347,140 @@ function ActivityRowBase({
|
|
|
265
347
|
}
|
|
266
348
|
]}
|
|
267
349
|
>
|
|
268
|
-
<
|
|
269
|
-
scaleTo={0.99}
|
|
270
|
-
onPress={hasUtilities ? () => onToggle(rowKey) : undefined}
|
|
271
|
-
style={styles.row}
|
|
272
|
-
accessibilityRole="button"
|
|
273
|
-
accessibilityState={{ expanded }}
|
|
274
|
-
accessibilityLabel={
|
|
275
|
-
token
|
|
276
|
-
? // Never the lib's developer description, which carries a raw
|
|
277
|
-
// 36-byte token id, and never silence for a figure we could not
|
|
278
|
-
// recover: "Sent USDX, amount unavailable" is the honest read.
|
|
279
|
-
`${token.title}, ${
|
|
280
|
-
token.amount ? `${token.amount.value} ${token.amount.unit}` : t('token_row_amount_pending')
|
|
281
|
-
}`
|
|
282
|
-
: action.description || t('transactions')
|
|
283
|
-
}
|
|
284
|
-
>
|
|
350
|
+
<View style={styles.row}>
|
|
285
351
|
{/* The sigil fills the tile, so direction moves to the border tint
|
|
286
352
|
alone: the same tints as the arrow tile, so a mixed list still
|
|
287
353
|
reads consistently down the left edge. The tile takes the
|
|
288
354
|
counterparty's own colour, and the sigil is drawn in exactly that
|
|
289
355
|
pair: sigil-js cuts its glyph lines in the background colour, so
|
|
290
|
-
the fill must be the same solid or the cuts show as a halo.
|
|
291
|
-
{face !== null && palette !== null ? (
|
|
292
|
-
<View
|
|
293
|
-
style={[
|
|
294
|
-
styles.glyph,
|
|
295
|
-
styles.avatar,
|
|
296
|
-
{
|
|
297
|
-
backgroundColor: palette.background,
|
|
298
|
-
borderColor: incoming ? colors.successStrong + '2E' : colors.surfaceSunkenBorder
|
|
299
|
-
}
|
|
300
|
-
]}
|
|
301
|
-
>
|
|
302
|
-
<Sigil
|
|
303
|
-
point={face.point}
|
|
304
|
-
size={38}
|
|
305
|
-
foreground={palette.foreground}
|
|
306
|
-
background={palette.background}
|
|
307
|
-
detail="default"
|
|
308
|
-
/>
|
|
309
|
-
</View>
|
|
310
|
-
) : (
|
|
311
|
-
<View
|
|
312
|
-
style={[
|
|
313
|
-
styles.glyph,
|
|
314
|
-
incoming
|
|
315
|
-
? {
|
|
316
|
-
backgroundColor: colors.successStrong + '1A',
|
|
317
|
-
borderColor: colors.successStrong + '2E'
|
|
318
|
-
}
|
|
319
|
-
: { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
|
|
320
|
-
]}
|
|
321
|
-
>
|
|
322
|
-
<MaterialCommunityIcons
|
|
323
|
-
name={incoming ? 'arrow-bottom-left' : 'arrow-top-right'}
|
|
324
|
-
size={16}
|
|
325
|
-
color={incoming ? colors.successStrong : colors.textSecondary}
|
|
326
|
-
/>
|
|
327
|
-
</View>
|
|
328
|
-
)}
|
|
356
|
+
the fill must be the same solid or the cuts show as a halo.
|
|
329
357
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
})()}
|
|
349
|
-
</Text>
|
|
350
|
-
</View>
|
|
351
|
-
</View>
|
|
352
|
-
|
|
353
|
-
<View style={styles.amounts}>
|
|
354
|
-
{token ? (
|
|
355
|
-
token.amount ? (
|
|
356
|
-
// No secondary denomination line: this wallet has no price for a
|
|
357
|
-
// token, and a converted figure would be invented.
|
|
358
|
-
<Text
|
|
359
|
-
style={[styles.amount, { color: amountColor }]}
|
|
360
|
-
accessibilityLabel={`${token.amount.value} ${token.amount.unit}`}
|
|
358
|
+
A separate pressable from the row below it (2026-09-18), expanded
|
|
359
|
+
or not: tapping a face that names a saved contact opens their
|
|
360
|
+
contact page, while tapping the rest of the row still toggles the
|
|
361
|
+
chips — two touch targets, not one nested inside the other. No
|
|
362
|
+
visual affordance on the tile itself (a highlight ring was tried
|
|
363
|
+
and dropped) — the row already reads as tappable as a whole. */}
|
|
364
|
+
{(() => {
|
|
365
|
+
const tile =
|
|
366
|
+
face !== null && palette !== null ? (
|
|
367
|
+
<View
|
|
368
|
+
style={[
|
|
369
|
+
styles.glyph,
|
|
370
|
+
styles.avatar,
|
|
371
|
+
{
|
|
372
|
+
backgroundColor: palette.background,
|
|
373
|
+
borderColor: incoming ? colors.successStrong + '2E' : colors.surfaceSunkenBorder
|
|
374
|
+
}
|
|
375
|
+
]}
|
|
361
376
|
>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
377
|
+
<Sigil
|
|
378
|
+
point={face.point}
|
|
379
|
+
size={38}
|
|
380
|
+
foreground={palette.foreground}
|
|
381
|
+
background={palette.background}
|
|
382
|
+
detail="default"
|
|
383
|
+
/>
|
|
384
|
+
</View>
|
|
365
385
|
) : (
|
|
366
|
-
<
|
|
367
|
-
{
|
|
368
|
-
|
|
386
|
+
<View
|
|
387
|
+
style={[
|
|
388
|
+
styles.glyph,
|
|
389
|
+
incoming
|
|
390
|
+
? {
|
|
391
|
+
backgroundColor: colors.successStrong + '1A',
|
|
392
|
+
borderColor: colors.successStrong + '2E'
|
|
393
|
+
}
|
|
394
|
+
: { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
|
|
395
|
+
]}
|
|
396
|
+
>
|
|
397
|
+
<MaterialCommunityIcons
|
|
398
|
+
name={incoming ? 'arrow-bottom-left' : 'arrow-top-right'}
|
|
399
|
+
size={16}
|
|
400
|
+
color={incoming ? colors.successStrong : colors.textSecondary}
|
|
401
|
+
/>
|
|
402
|
+
</View>
|
|
369
403
|
)
|
|
404
|
+
return faceTappable ? (
|
|
405
|
+
<PressableScale
|
|
406
|
+
onPress={onPressFace}
|
|
407
|
+
scaleTo={0.92}
|
|
408
|
+
accessibilityRole="button"
|
|
409
|
+
accessibilityLabel={t('activity_view_contact')}
|
|
410
|
+
>
|
|
411
|
+
{tile}
|
|
412
|
+
</PressableScale>
|
|
370
413
|
) : (
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
414
|
+
tile
|
|
415
|
+
)
|
|
416
|
+
})()}
|
|
417
|
+
|
|
418
|
+
<PressableScale
|
|
419
|
+
scaleTo={0.99}
|
|
420
|
+
onPress={onOpen ? () => onOpen(action) : hasUtilities ? () => onToggle(rowKey) : undefined}
|
|
421
|
+
style={styles.rowRest}
|
|
422
|
+
accessibilityRole="button"
|
|
423
|
+
accessibilityState={onOpen ? undefined : { expanded }}
|
|
424
|
+
accessibilityLabel={
|
|
425
|
+
token
|
|
426
|
+
? // Never the lib's developer description, which carries a raw
|
|
427
|
+
// 36-byte token id, and never silence for a figure we could not
|
|
428
|
+
// recover: "Sent USDX, amount unavailable" is the honest read.
|
|
429
|
+
`${token.title}, ${
|
|
430
|
+
token.amount ? `${token.amount.value} ${token.amount.unit}` : t('token_row_amount_pending')
|
|
431
|
+
}`
|
|
432
|
+
: action.description || t('transactions')
|
|
433
|
+
}
|
|
434
|
+
>
|
|
435
|
+
<View style={styles.middle}>
|
|
436
|
+
<Text style={[styles.description, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
437
|
+
{token ? token.title : action.description || t('transactions')}
|
|
438
|
+
</Text>
|
|
439
|
+
<View style={styles.statusLine}>
|
|
440
|
+
{/* A dot only where the tone carries a warning. A settled row is
|
|
441
|
+
the normal case, and marking every normal row green made the
|
|
442
|
+
list a wall of confirmation the eye had to read past. */}
|
|
443
|
+
{settled ? null : <View style={[styles.dot, { backgroundColor: tone }]} />}
|
|
444
|
+
<Text style={[styles.statusText, { color: settled ? colors.textSecondary : tone }]} numberOfLines={1}>
|
|
445
|
+
{(() => {
|
|
446
|
+
const words = token?.status ? t(view.key) : (token?.statusText ?? t(view.key))
|
|
447
|
+
return time ? `${words} · ${time}` : words
|
|
448
|
+
})()}
|
|
375
449
|
</Text>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
)}
|
|
379
|
-
</View>
|
|
380
|
-
</PressableScale>
|
|
450
|
+
</View>
|
|
451
|
+
</View>
|
|
381
452
|
|
|
382
|
-
|
|
453
|
+
<View style={styles.amounts}>
|
|
454
|
+
{token ? (
|
|
455
|
+
token.amount ? (
|
|
456
|
+
// No secondary denomination line: this wallet has no price for a
|
|
457
|
+
// token, and a converted figure would be invented.
|
|
458
|
+
<Text
|
|
459
|
+
style={[styles.amount, { color: amountColor }]}
|
|
460
|
+
accessibilityLabel={`${token.amount.value} ${token.amount.unit}`}
|
|
461
|
+
>
|
|
462
|
+
{token.amount.value}
|
|
463
|
+
<Text style={[styles.amountUnit, { color: unitColor }]}> {token.amount.unit}</Text>
|
|
464
|
+
</Text>
|
|
465
|
+
) : (
|
|
466
|
+
<Text style={[styles.amountSecondary, { color: colors.textTertiary }]}>
|
|
467
|
+
{t('token_row_amount_pending')}
|
|
468
|
+
</Text>
|
|
469
|
+
)
|
|
470
|
+
) : (
|
|
471
|
+
<>
|
|
472
|
+
<Text style={[styles.amount, { color: amountColor }]}>
|
|
473
|
+
{value}
|
|
474
|
+
{unit ? <Text style={[styles.amountUnit, { color: unitColor }]}> {unit}</Text> : null}
|
|
475
|
+
</Text>
|
|
476
|
+
<Text style={[styles.amountSecondary, { color: colors.textTertiary }]}>{secondary}</Text>
|
|
477
|
+
</>
|
|
478
|
+
)}
|
|
479
|
+
</View>
|
|
480
|
+
</PressableScale>
|
|
481
|
+
</View>
|
|
482
|
+
|
|
483
|
+
{!onOpen && expanded && hasUtilities ? (
|
|
383
484
|
<View style={styles.chips}>
|
|
384
485
|
{busy ? (
|
|
385
486
|
<View style={styles.busyRow}>
|
|
@@ -450,9 +551,7 @@ function ActivityRowBase({
|
|
|
450
551
|
{/* Inset to the description, not the screen edge: the rule separates the
|
|
451
552
|
text columns, and the glyph tiles already read as separate objects. An
|
|
452
553
|
expanded row is bounded by its own surface, so it needs no rule. */}
|
|
453
|
-
{expanded ? null :
|
|
454
|
-
<View style={[styles.separator, { backgroundColor: colors.hairline }]} />
|
|
455
|
-
)}
|
|
554
|
+
{expanded ? null : <View style={[styles.separator, { backgroundColor: colors.hairline }]} />}
|
|
456
555
|
</View>
|
|
457
556
|
)
|
|
458
557
|
}
|
|
@@ -477,10 +576,7 @@ function Chip({
|
|
|
477
576
|
<PressableScale
|
|
478
577
|
onPress={onPress}
|
|
479
578
|
haptic="tap"
|
|
480
|
-
style={[
|
|
481
|
-
styles.chip,
|
|
482
|
-
{ backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }
|
|
483
|
-
]}
|
|
579
|
+
style={[styles.chip, { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }]}
|
|
484
580
|
accessibilityRole="button"
|
|
485
581
|
accessibilityLabel={accessibilityLabel}
|
|
486
582
|
>
|
|
@@ -499,6 +595,10 @@ const styles = StyleSheet.create({
|
|
|
499
595
|
paddingTop: 13,
|
|
500
596
|
paddingBottom: 11
|
|
501
597
|
},
|
|
598
|
+
// The face's touch target and the rest of the row's are two separate
|
|
599
|
+
// pressables side by side; `rowRest` reproduces `row`'s own inner spacing
|
|
600
|
+
// for the middle/amounts pair so splitting them changes no spacing.
|
|
601
|
+
rowRest: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: spacing.md },
|
|
502
602
|
glyph: {
|
|
503
603
|
width: 38,
|
|
504
604
|
height: 38,
|
|
@@ -556,7 +656,9 @@ function ConnectedActivityRow(props: Props) {
|
|
|
556
656
|
/** Preserve the existing package API for hosts that omit currency; the home
|
|
557
657
|
* screen supplies it so background wallet updates cannot invalidate each row. */
|
|
558
658
|
export default function ActivityRow(props: Props) {
|
|
559
|
-
return props.currency === undefined
|
|
560
|
-
|
|
561
|
-
|
|
659
|
+
return props.currency === undefined ? (
|
|
660
|
+
<ConnectedActivityRow {...props} />
|
|
661
|
+
) : (
|
|
662
|
+
<MemoActivityRow {...props} currency={props.currency} />
|
|
663
|
+
)
|
|
562
664
|
}
|