@bsv/expo-wallet-toolbox 0.19.0 → 0.21.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 +154 -30
- package/README.md +79 -79
- package/core/backup/RemoteSyncReader.ts +26 -24
- package/core/backup/appData.ts +9 -8
- package/core/backup/codec.ts +21 -18
- package/core/backup/constants.ts +5 -5
- package/core/backup/contactsBackup.ts +8 -8
- package/core/backup/cursor.ts +12 -7
- package/core/backup/derive.ts +3 -3
- package/core/backup/deviceId.ts +2 -2
- package/core/backup/erase.ts +2 -2
- package/core/backup/preference.ts +2 -2
- package/core/backup/push.ts +10 -12
- package/core/backup/restore.ts +22 -14
- package/core/backup/restoreOnImport.ts +3 -2
- package/core/config.tsx +17 -13
- package/core/constants.ts +34 -11
- package/core/contacts/contactsStore.ts +4 -3
- package/core/context/WalletConnectionContext.tsx +294 -212
- package/core/context/WalletContext.tsx +132 -97
- package/core/context/defaultWalletSettings.ts +4 -2
- package/core/demo/demoLedger.ts +1 -5
- package/core/directpay/DirectPayManager.ts +148 -29
- package/core/directpay/DirectPayProvider.tsx +26 -26
- package/core/directpay/payFlow.ts +10 -1
- package/core/directpay/receive.ts +2 -1
- package/core/directpay/settings.ts +56 -9
- package/core/directpay/types.ts +11 -2
- package/core/directpay/webrtpay.ts +4 -0
- package/core/headers/checkpoints.ts +10 -1
- package/core/headers/headerStore.ts +13 -2
- package/core/hooks/useConfirmationSound.ts +3 -3
- package/core/hooks/useHaptics.ts +23 -6
- package/core/i18n/translations.tsx +382 -209
- package/core/index.ts +2 -0
- package/core/localpay/codec.ts +12 -6
- package/core/localpay/deviceCaps.ts +4 -14
- package/core/localpay/pending.ts +2 -1
- package/core/localpay/qr.ts +1 -1
- package/core/localpay/settlementAck.ts +1 -4
- package/core/localpay/transport/ble.ts +2 -2
- package/core/localpay/transport/socket.ts +1 -1
- package/core/mandala/abortGuard.ts +1 -1
- package/core/mandala/drain.ts +3 -0
- package/core/mandala/permissionModule.ts +3 -2
- package/core/mandala/resendTransfer.ts +4 -1
- package/core/mandala/runtime.ts +4 -4
- package/core/monitor/TaskBackupPush.ts +10 -13
- package/core/net/chainMatch.ts +8 -5
- package/core/networks.ts +145 -0
- package/core/parsePeerPayURI.ts +4 -1
- package/core/pay/beefRepair.ts +6 -3
- package/core/pay/creditErrors.ts +37 -1
- package/core/pay/rails/address.ts +10 -6
- package/core/pay/rails/direct.ts +6 -2
- package/core/pay/rails/handle.ts +84 -11
- package/core/pay/rails/index.ts +18 -2
- package/core/pay/receiveHistory.ts +8 -8
- package/core/peerpay/handleResendRequests.ts +11 -18
- package/core/peerpay/inboxAttempts.ts +1 -4
- package/core/peerpay/rebuildToken.ts +12 -9
- package/core/profiles/profileStore.ts +2 -1
- package/core/profiles/removalProblems.ts +3 -1
- package/core/services/arcTokenStorage.ts +2 -1
- package/core/services/arcadeBroadcastProvider.ts +7 -17
- package/core/services/secrets/envelope.ts +1 -6
- package/core/services/secrets/hkdf.ts +1 -6
- package/core/services/secrets/index.ts +3 -22
- package/core/services/usdFxRates.ts +1 -4
- package/core/services/vault/VaultKeyService.ts +2 -1
- package/core/services/vault/chainRecovery.ts +48 -21
- package/core/services/vault/metaAuthority.ts +4 -1
- package/core/services/vault/r1comb.ts +113 -51
- package/core/services/vault/session.ts +5 -1
- package/core/services/vault/transfers.ts +699 -576
- package/core/services/vault/vaultStore.ts +12 -10
- package/core/services/walletArgLimits.ts +1 -2
- package/core/services/walletConnectionValidation.ts +44 -28
- package/core/services/walletServiceConfig.ts +9 -40
- package/core/storage/StorageExpoSQLite.ts +7 -21
- package/core/storage/methods/listActionsSql.ts +81 -67
- package/core/storage/methods/listOutputsSql.ts +21 -16
- package/core/storage/methods/reviewStatusSql.ts +1 -4
- package/core/stores/ConnectionStore.ts +1 -1
- package/core/theme/ThemeContext.tsx +12 -16
- package/core/theme/motion.ts +3 -3
- package/core/theme/tokens.ts +6 -6
- package/core/toolboxConfig.ts +23 -0
- package/core/walletDbRegistry.ts +7 -5
- package/core/walletRepair/runWalletCheck.ts +1 -4
- package/package.json +2 -2
- package/ui/components/pay/AddressReceive.tsx +3 -3
- package/ui/components/pay/HandleReceive.tsx +21 -15
- package/ui/components/pay/MessageBoxConfig.tsx +46 -20
- package/ui/components/pay/NearbyFlow.tsx +575 -507
- package/ui/components/pay/OfflineNotice.tsx +1 -3
- package/ui/components/pay/PayCellRow.tsx +1 -4
- package/ui/components/pay/PayForm.tsx +1 -3
- package/ui/components/pay/RequestHub.tsx +14 -6
- package/ui/components/pay/UniversalSend.tsx +79 -27
- package/ui/components/pay/tokenSendCopy.ts +1 -2
- package/ui/components/pay/useRecipientInput.ts +2 -2
- package/ui/components/security/WalletLockNotice.tsx +1 -3
- package/ui/components/ui/AlertCard.tsx +44 -45
- package/ui/components/ui/BlurChrome.tsx +4 -15
- package/ui/components/ui/Celebration.tsx +3 -3
- package/ui/components/ui/ChoiceSheet.ts +1 -3
- package/ui/components/ui/ErrorBoundary.tsx +2 -6
- package/ui/components/ui/GroupedList.tsx +13 -31
- package/ui/components/ui/IconButton.tsx +6 -9
- package/ui/components/ui/ListRow.tsx +19 -25
- package/ui/components/ui/PresenceRow.tsx +4 -4
- package/ui/components/ui/PressableScale.tsx +24 -20
- package/ui/components/ui/Toast.tsx +23 -16
- package/ui/components/vault/KeyChooser.tsx +9 -6
- package/ui/components/vault/VaultBackdrop.tsx +1 -8
- package/ui/components/vault/VaultCeremonySheet.tsx +5 -5
- package/ui/components/wallet/ActivityRow.tsx +3 -2
- package/ui/components/wallet/BackupReminderSheet.tsx +1 -5
- package/ui/components/wallet/Balance.tsx +4 -1
- package/ui/components/wallet/ContactActivityList.tsx +7 -7
- package/ui/components/wallet/IconPickerSheet.tsx +1 -5
- package/ui/components/wallet/ProfileSwitcherPopover.tsx +6 -1
- package/ui/components/wallet/tokenEviction.ts +4 -1
- package/ui/hooks/useMandala.ts +1 -7
- package/ui/hooks/useOfflineNoticeActions.ts +21 -27
- package/ui/hooks/useSpendableBalance.ts +2 -2
- package/ui/hooks/useVaultCoverage.ts +7 -1
- package/ui/index.ts +9 -1
- package/ui/resolveIdentity.ts +20 -8
- package/ui/screens/ConnectionsScreen.tsx +44 -18
- package/ui/screens/LogsScreen.tsx +24 -22
- package/ui/screens/PairScreen.tsx +85 -54
- package/ui/screens/PayScreen.tsx +5 -1
- package/ui/screens/ProfileScreen.tsx +0 -3
- package/ui/screens/TrustScreen.tsx +125 -80
- package/ui/screens/VaultScreen.tsx +19 -7
- package/ui/screens/VaultTransferScreen.tsx +5 -1
- package/ui/screens/WalletCheckScreen.tsx +14 -17
- package/ui/screens/WalletConfigScreen.tsx +414 -376
- package/ui/screens/WalletHomeScreen.tsx +47 -42
|
@@ -25,26 +25,20 @@ export const GroupedList: React.FC<GroupedListProps> = ({ sections }) => {
|
|
|
25
25
|
{sections.map((section, idx) => (
|
|
26
26
|
<View key={idx} style={styles.section}>
|
|
27
27
|
{section.header && (
|
|
28
|
-
<Text style={[styles.header, { color: colors.textTertiary }]}>
|
|
29
|
-
{section.header.toUpperCase()}
|
|
30
|
-
</Text>
|
|
28
|
+
<Text style={[styles.header, { color: colors.textTertiary }]}>{section.header.toUpperCase()}</Text>
|
|
31
29
|
)}
|
|
32
30
|
<View
|
|
33
31
|
style={[
|
|
34
32
|
styles.group,
|
|
35
33
|
{
|
|
36
34
|
backgroundColor: colors.backgroundElevated,
|
|
37
|
-
borderColor: colors.separator
|
|
35
|
+
borderColor: colors.separator
|
|
38
36
|
}
|
|
39
37
|
]}
|
|
40
38
|
>
|
|
41
39
|
{section.children}
|
|
42
40
|
</View>
|
|
43
|
-
{section.footer &&
|
|
44
|
-
<Text style={[styles.footer, { color: colors.textTertiary }]}>
|
|
45
|
-
{section.footer}
|
|
46
|
-
</Text>
|
|
47
|
-
)}
|
|
41
|
+
{section.footer && <Text style={[styles.footer, { color: colors.textTertiary }]}>{section.footer}</Text>}
|
|
48
42
|
</View>
|
|
49
43
|
))}
|
|
50
44
|
</View>
|
|
@@ -54,46 +48,34 @@ export const GroupedList: React.FC<GroupedListProps> = ({ sections }) => {
|
|
|
54
48
|
/**
|
|
55
49
|
* Standalone section for inline use without the GroupedList wrapper.
|
|
56
50
|
*/
|
|
57
|
-
export const GroupedSection: React.FC<GroupedListSection> = ({
|
|
58
|
-
header,
|
|
59
|
-
footer,
|
|
60
|
-
children
|
|
61
|
-
}) => {
|
|
51
|
+
export const GroupedSection: React.FC<GroupedListSection> = ({ header, footer, children }) => {
|
|
62
52
|
const { colors } = useTheme()
|
|
63
53
|
|
|
64
54
|
return (
|
|
65
55
|
<View style={styles.section}>
|
|
66
|
-
{header && (
|
|
67
|
-
<Text style={[styles.header, { color: colors.textTertiary }]}>
|
|
68
|
-
{header.toUpperCase()}
|
|
69
|
-
</Text>
|
|
70
|
-
)}
|
|
56
|
+
{header && <Text style={[styles.header, { color: colors.textTertiary }]}>{header.toUpperCase()}</Text>}
|
|
71
57
|
<View
|
|
72
58
|
style={[
|
|
73
59
|
styles.group,
|
|
74
60
|
{
|
|
75
61
|
backgroundColor: colors.backgroundElevated,
|
|
76
|
-
borderColor: colors.separator
|
|
62
|
+
borderColor: colors.separator
|
|
77
63
|
}
|
|
78
64
|
]}
|
|
79
65
|
>
|
|
80
66
|
{children}
|
|
81
67
|
</View>
|
|
82
|
-
{footer &&
|
|
83
|
-
<Text style={[styles.footer, { color: colors.textTertiary }]}>
|
|
84
|
-
{footer}
|
|
85
|
-
</Text>
|
|
86
|
-
)}
|
|
68
|
+
{footer && <Text style={[styles.footer, { color: colors.textTertiary }]}>{footer}</Text>}
|
|
87
69
|
</View>
|
|
88
70
|
)
|
|
89
71
|
}
|
|
90
72
|
|
|
91
73
|
const styles = StyleSheet.create({
|
|
92
74
|
container: {
|
|
93
|
-
flex: 1
|
|
75
|
+
flex: 1
|
|
94
76
|
},
|
|
95
77
|
section: {
|
|
96
|
-
marginBottom: spacing.xxl
|
|
78
|
+
marginBottom: spacing.xxl
|
|
97
79
|
},
|
|
98
80
|
// Tracked small caps, matching the day headings in the activity list — a
|
|
99
81
|
// section header is a label for the block under it, not a line of prose.
|
|
@@ -102,7 +84,7 @@ const styles = StyleSheet.create({
|
|
|
102
84
|
fontWeight: '700',
|
|
103
85
|
letterSpacing: 1.3,
|
|
104
86
|
paddingHorizontal: spacing.xl,
|
|
105
|
-
paddingBottom: spacing.sm
|
|
87
|
+
paddingBottom: spacing.sm
|
|
106
88
|
},
|
|
107
89
|
// A card lifted off the canvas: the border does the work in dark, the shadow
|
|
108
90
|
// in light, and the radius says "object" in both.
|
|
@@ -115,11 +97,11 @@ const styles = StyleSheet.create({
|
|
|
115
97
|
shadowOpacity: 0.05,
|
|
116
98
|
shadowRadius: 3,
|
|
117
99
|
shadowOffset: { width: 0, height: 1 },
|
|
118
|
-
elevation: 1
|
|
100
|
+
elevation: 1
|
|
119
101
|
},
|
|
120
102
|
footer: {
|
|
121
103
|
...typography.footnote,
|
|
122
104
|
paddingHorizontal: spacing.xl,
|
|
123
|
-
paddingTop: spacing.sm
|
|
124
|
-
}
|
|
105
|
+
paddingTop: spacing.sm
|
|
106
|
+
}
|
|
125
107
|
})
|
|
@@ -55,10 +55,7 @@ export const IconButton: React.FC<IconButtonProps> = ({
|
|
|
55
55
|
onLongPress={onLongPress}
|
|
56
56
|
disabled={disabled}
|
|
57
57
|
scaleTo={0.92}
|
|
58
|
-
style={[
|
|
59
|
-
styles.container,
|
|
60
|
-
disabled && styles.disabled
|
|
61
|
-
]}
|
|
58
|
+
style={[styles.container, disabled && styles.disabled]}
|
|
62
59
|
accessibilityLabel={accessibilityLabel}
|
|
63
60
|
accessibilityRole="button"
|
|
64
61
|
hitSlop={4}
|
|
@@ -82,10 +79,10 @@ const styles = StyleSheet.create({
|
|
|
82
79
|
width: hitTargets.minimum,
|
|
83
80
|
height: hitTargets.minimum,
|
|
84
81
|
alignItems: 'center',
|
|
85
|
-
justifyContent: 'center'
|
|
82
|
+
justifyContent: 'center'
|
|
86
83
|
},
|
|
87
84
|
disabled: {
|
|
88
|
-
opacity: 0.3
|
|
85
|
+
opacity: 0.3
|
|
89
86
|
},
|
|
90
87
|
badge: {
|
|
91
88
|
position: 'absolute',
|
|
@@ -96,10 +93,10 @@ const styles = StyleSheet.create({
|
|
|
96
93
|
borderRadius: 8,
|
|
97
94
|
alignItems: 'center',
|
|
98
95
|
justifyContent: 'center',
|
|
99
|
-
paddingHorizontal: 4
|
|
96
|
+
paddingHorizontal: 4
|
|
100
97
|
},
|
|
101
98
|
badgeText: {
|
|
102
99
|
fontSize: 10,
|
|
103
|
-
fontWeight: '700'
|
|
104
|
-
}
|
|
100
|
+
fontWeight: '700'
|
|
101
|
+
}
|
|
105
102
|
})
|
|
@@ -24,9 +24,8 @@ function loadIonicons(): IoniconsComponent {
|
|
|
24
24
|
}
|
|
25
25
|
function loadMaterialCommunityIcons(): MaterialCommunityIconsComponent {
|
|
26
26
|
if (!materialCommunityIconsComponent) {
|
|
27
|
-
materialCommunityIconsComponent =
|
|
28
|
-
|
|
29
|
-
.MaterialCommunityIcons as MaterialCommunityIconsComponent
|
|
27
|
+
materialCommunityIconsComponent = // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
28
|
+
require('@expo/vector-icons').MaterialCommunityIcons as MaterialCommunityIconsComponent
|
|
30
29
|
}
|
|
31
30
|
return materialCommunityIconsComponent
|
|
32
31
|
}
|
|
@@ -75,7 +74,12 @@ export const ListRow: React.FC<ListRowProps> = ({
|
|
|
75
74
|
const MaterialCommunityIcons = loadMaterialCommunityIcons()
|
|
76
75
|
|
|
77
76
|
const content = (
|
|
78
|
-
<View
|
|
77
|
+
<View
|
|
78
|
+
style={[
|
|
79
|
+
styles.container,
|
|
80
|
+
!isLast && { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: colors.separator }
|
|
81
|
+
]}
|
|
82
|
+
>
|
|
79
83
|
{icon && (
|
|
80
84
|
<View
|
|
81
85
|
style={[
|
|
@@ -101,13 +105,7 @@ export const ListRow: React.FC<ListRowProps> = ({
|
|
|
101
105
|
</View>
|
|
102
106
|
)}
|
|
103
107
|
<View style={styles.textColumn}>
|
|
104
|
-
<Text
|
|
105
|
-
style={[
|
|
106
|
-
styles.label,
|
|
107
|
-
{ color: destructive ? colors.error : colors.textPrimary }
|
|
108
|
-
]}
|
|
109
|
-
numberOfLines={1}
|
|
110
|
-
>
|
|
108
|
+
<Text style={[styles.label, { color: destructive ? colors.error : colors.textPrimary }]} numberOfLines={1}>
|
|
111
109
|
{label}
|
|
112
110
|
</Text>
|
|
113
111
|
{subtitle ? (
|
|
@@ -137,11 +135,7 @@ export const ListRow: React.FC<ListRowProps> = ({
|
|
|
137
135
|
|
|
138
136
|
if (onPress) {
|
|
139
137
|
return (
|
|
140
|
-
<PressableScale
|
|
141
|
-
onPress={onPress}
|
|
142
|
-
scaleTo={0.98}
|
|
143
|
-
haptic="tap"
|
|
144
|
-
>
|
|
138
|
+
<PressableScale onPress={onPress} scaleTo={0.98} haptic="tap">
|
|
145
139
|
{content}
|
|
146
140
|
</PressableScale>
|
|
147
141
|
)
|
|
@@ -156,7 +150,7 @@ const styles = StyleSheet.create({
|
|
|
156
150
|
alignItems: 'center',
|
|
157
151
|
minHeight: 44,
|
|
158
152
|
paddingVertical: spacing.md,
|
|
159
|
-
paddingHorizontal: spacing.lg
|
|
153
|
+
paddingHorizontal: spacing.lg
|
|
160
154
|
},
|
|
161
155
|
// A well the glyph sits in, tinted by the row's own colour rather than
|
|
162
156
|
// flooded with it. A grid of saturated tiles reads as decoration and makes
|
|
@@ -169,29 +163,29 @@ const styles = StyleSheet.create({
|
|
|
169
163
|
borderWidth: StyleSheet.hairlineWidth,
|
|
170
164
|
alignItems: 'center',
|
|
171
165
|
justifyContent: 'center',
|
|
172
|
-
marginRight: spacing.md
|
|
166
|
+
marginRight: spacing.md
|
|
173
167
|
},
|
|
174
168
|
textColumn: {
|
|
175
|
-
flex: 1
|
|
169
|
+
flex: 1
|
|
176
170
|
},
|
|
177
171
|
label: {
|
|
178
|
-
...typography.body
|
|
172
|
+
...typography.body
|
|
179
173
|
},
|
|
180
174
|
subtitle: {
|
|
181
175
|
...typography.footnote,
|
|
182
|
-
marginTop: 1
|
|
176
|
+
marginTop: 1
|
|
183
177
|
},
|
|
184
178
|
trailing: {
|
|
185
179
|
flexDirection: 'row',
|
|
186
180
|
alignItems: 'center',
|
|
187
181
|
flexShrink: 0,
|
|
188
|
-
marginLeft: spacing.sm
|
|
182
|
+
marginLeft: spacing.sm
|
|
189
183
|
},
|
|
190
184
|
value: {
|
|
191
185
|
...typography.body,
|
|
192
|
-
maxWidth: 200
|
|
186
|
+
maxWidth: 200
|
|
193
187
|
},
|
|
194
188
|
chevron: {
|
|
195
|
-
marginLeft: spacing.xs
|
|
196
|
-
}
|
|
189
|
+
marginLeft: spacing.xs
|
|
190
|
+
}
|
|
197
191
|
})
|
|
@@ -45,7 +45,7 @@ import Animated, {
|
|
|
45
45
|
withRepeat,
|
|
46
46
|
withSequence,
|
|
47
47
|
withSpring,
|
|
48
|
-
withTiming
|
|
48
|
+
withTiming
|
|
49
49
|
} from 'react-native-reanimated'
|
|
50
50
|
import { useTheme, spacing, typography, durations, easings, springs } from '@bsv/expo-wallet-toolbox'
|
|
51
51
|
|
|
@@ -155,7 +155,7 @@ export default function PresenceRow({ state, label, peer, medium = 'wifi' }: Pre
|
|
|
155
155
|
if (reducedMotion) return { opacity: enter.value }
|
|
156
156
|
return {
|
|
157
157
|
opacity: enter.value,
|
|
158
|
-
transform: [{ translateY: (1 - enter.value) * 6 }]
|
|
158
|
+
transform: [{ translateY: (1 - enter.value) * 6 }]
|
|
159
159
|
}
|
|
160
160
|
}, [reducedMotion])
|
|
161
161
|
|
|
@@ -206,10 +206,10 @@ const styles = StyleSheet.create({
|
|
|
206
206
|
// Held constant across every state so the content beneath never shifts as
|
|
207
207
|
// the status changes.
|
|
208
208
|
minHeight: 20,
|
|
209
|
-
paddingHorizontal: spacing.sm
|
|
209
|
+
paddingHorizontal: spacing.sm
|
|
210
210
|
},
|
|
211
211
|
label: { ...typography.footnote, flexShrink: 1 },
|
|
212
212
|
labelStrong: { fontWeight: '600' },
|
|
213
213
|
sep: { ...typography.footnote },
|
|
214
|
-
peer: { ...typography.footnote, flexShrink: 1 }
|
|
214
|
+
peer: { ...typography.footnote, flexShrink: 1 }
|
|
215
215
|
})
|
|
@@ -20,12 +20,7 @@
|
|
|
20
20
|
import React, { useCallback } from 'react'
|
|
21
21
|
import { Pressable, StyleProp, ViewStyle, GestureResponderEvent } from 'react-native'
|
|
22
22
|
import type { PressableProps } from 'react-native'
|
|
23
|
-
import Animated, {
|
|
24
|
-
useSharedValue,
|
|
25
|
-
useAnimatedStyle,
|
|
26
|
-
withSpring,
|
|
27
|
-
useReducedMotion,
|
|
28
|
-
} from 'react-native-reanimated'
|
|
23
|
+
import Animated, { useSharedValue, useAnimatedStyle, withSpring, useReducedMotion } from 'react-native-reanimated'
|
|
29
24
|
import { springs, haptics, type HapticName } from '@bsv/expo-wallet-toolbox'
|
|
30
25
|
|
|
31
26
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable)
|
|
@@ -67,28 +62,37 @@ export default function PressableScale({
|
|
|
67
62
|
if (animateOpacity) {
|
|
68
63
|
return {
|
|
69
64
|
transform: [{ scale: 1 - (1 - scaleTo) * pressed.value }],
|
|
70
|
-
opacity: 1 - 0.15 * pressed.value
|
|
65
|
+
opacity: 1 - 0.15 * pressed.value
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
68
|
return {
|
|
74
|
-
transform: [{ scale: 1 - (1 - scaleTo) * pressed.value }]
|
|
69
|
+
transform: [{ scale: 1 - (1 - scaleTo) * pressed.value }]
|
|
75
70
|
}
|
|
76
71
|
}, [scaleTo, animateOpacity, reducedMotion])
|
|
77
72
|
|
|
78
|
-
const handlePressIn = useCallback(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
const handlePressIn = useCallback(
|
|
74
|
+
(e: GestureResponderEvent) => {
|
|
75
|
+
pressed.value = withSpring(1, springs.snappy)
|
|
76
|
+
onPressIn?.(e)
|
|
77
|
+
},
|
|
78
|
+
[onPressIn, pressed]
|
|
79
|
+
)
|
|
82
80
|
|
|
83
|
-
const handlePressOut = useCallback(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
const handlePressOut = useCallback(
|
|
82
|
+
(e: GestureResponderEvent) => {
|
|
83
|
+
pressed.value = withSpring(0, springs.snappy)
|
|
84
|
+
onPressOut?.(e)
|
|
85
|
+
},
|
|
86
|
+
[onPressOut, pressed]
|
|
87
|
+
)
|
|
87
88
|
|
|
88
|
-
const handlePress = useCallback(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
const handlePress = useCallback(
|
|
90
|
+
(e: GestureResponderEvent) => {
|
|
91
|
+
if (haptic) haptics[haptic]()
|
|
92
|
+
onPress?.(e)
|
|
93
|
+
},
|
|
94
|
+
[haptic, onPress]
|
|
95
|
+
)
|
|
92
96
|
|
|
93
97
|
return (
|
|
94
98
|
<AnimatedPressable
|
|
@@ -16,7 +16,7 @@ import Animated, {
|
|
|
16
16
|
useAnimatedStyle,
|
|
17
17
|
withSpring,
|
|
18
18
|
withTiming,
|
|
19
|
-
useReducedMotion
|
|
19
|
+
useReducedMotion
|
|
20
20
|
} from 'react-native-reanimated'
|
|
21
21
|
import { useTheme, spacing, radii, typography, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
|
|
22
22
|
|
|
@@ -38,7 +38,11 @@ function loadIonicons(): IoniconsComponent {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export type ToastType = 'info' | 'success' | 'error'
|
|
41
|
-
interface ToastData {
|
|
41
|
+
interface ToastData {
|
|
42
|
+
id: number
|
|
43
|
+
message: string
|
|
44
|
+
type: ToastType
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
const TOAST_MS = 2000
|
|
44
48
|
|
|
@@ -49,7 +53,10 @@ export function showToast(message: string, opts?: { type?: ToastType }) {
|
|
|
49
53
|
const type = opts?.type ?? 'info'
|
|
50
54
|
if (type === 'success') haptics.success()
|
|
51
55
|
if (type === 'error') haptics.error()
|
|
52
|
-
if (!push) {
|
|
56
|
+
if (!push) {
|
|
57
|
+
console.warn('[Toast] ToastHost not mounted:', message)
|
|
58
|
+
return
|
|
59
|
+
}
|
|
53
60
|
push(message, type)
|
|
54
61
|
}
|
|
55
62
|
|
|
@@ -68,32 +75,32 @@ export function ToastHost() {
|
|
|
68
75
|
progress.value = 0
|
|
69
76
|
setToast({ id: nextId++, message, type })
|
|
70
77
|
}
|
|
71
|
-
return () => {
|
|
78
|
+
return () => {
|
|
79
|
+
push = null
|
|
80
|
+
}
|
|
72
81
|
}, [])
|
|
73
82
|
|
|
74
83
|
useEffect(() => {
|
|
75
84
|
if (!toast) return
|
|
76
85
|
progress.value = 0
|
|
77
|
-
progress.value = reducedMotion
|
|
78
|
-
? withTiming(1, { duration: durations.instant })
|
|
79
|
-
: withSpring(1, springs.snappy)
|
|
86
|
+
progress.value = reducedMotion ? withTiming(1, { duration: durations.instant }) : withSpring(1, springs.snappy)
|
|
80
87
|
hideTimer.current = setTimeout(() => {
|
|
81
88
|
progress.value = withTiming(0, { duration: durations.quick })
|
|
82
89
|
hideTimer.current = setTimeout(() => setToast(null), durations.quick)
|
|
83
90
|
}, TOAST_MS)
|
|
84
|
-
return () => {
|
|
91
|
+
return () => {
|
|
92
|
+
if (hideTimer.current) clearTimeout(hideTimer.current)
|
|
93
|
+
}
|
|
85
94
|
}, [toast, progress, reducedMotion])
|
|
86
95
|
|
|
87
96
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
88
97
|
opacity: progress.value,
|
|
89
|
-
transform: [{ translateY: -12 * (1 - progress.value) }]
|
|
98
|
+
transform: [{ translateY: -12 * (1 - progress.value) }]
|
|
90
99
|
}))
|
|
91
100
|
|
|
92
101
|
if (!toast) return null
|
|
93
102
|
|
|
94
|
-
const icon = toast.type === 'success' ? 'checkmark-circle'
|
|
95
|
-
: toast.type === 'error' ? 'alert-circle'
|
|
96
|
-
: null
|
|
103
|
+
const icon = toast.type === 'success' ? 'checkmark-circle' : toast.type === 'error' ? 'alert-circle' : null
|
|
97
104
|
const iconColor = toast.type === 'success' ? colors.success : colors.error
|
|
98
105
|
|
|
99
106
|
return (
|
|
@@ -103,7 +110,7 @@ export function ToastHost() {
|
|
|
103
110
|
style={[
|
|
104
111
|
styles.capsule,
|
|
105
112
|
{ backgroundColor: colors.sheetBackground, borderColor: colors.separator },
|
|
106
|
-
animatedStyle
|
|
113
|
+
animatedStyle
|
|
107
114
|
]}
|
|
108
115
|
>
|
|
109
116
|
{icon && <Ionicons name={icon} size={18} color={iconColor} style={styles.icon} />}
|
|
@@ -121,7 +128,7 @@ const styles = StyleSheet.create({
|
|
|
121
128
|
left: 0,
|
|
122
129
|
right: 0,
|
|
123
130
|
alignItems: 'center',
|
|
124
|
-
zIndex: 10000
|
|
131
|
+
zIndex: 10000
|
|
125
132
|
},
|
|
126
133
|
capsule: {
|
|
127
134
|
flexDirection: 'row',
|
|
@@ -135,8 +142,8 @@ const styles = StyleSheet.create({
|
|
|
135
142
|
shadowOpacity: 0.15,
|
|
136
143
|
shadowRadius: 12,
|
|
137
144
|
shadowOffset: { width: 0, height: 4 },
|
|
138
|
-
elevation: 6
|
|
145
|
+
elevation: 6
|
|
139
146
|
},
|
|
140
147
|
icon: { marginRight: spacing.sm },
|
|
141
|
-
text: { ...typography.subhead, flexShrink: 1 }
|
|
148
|
+
text: { ...typography.subhead, flexShrink: 1 }
|
|
142
149
|
})
|
|
@@ -43,11 +43,11 @@ export function formatVaultSerial(serial: string): string {
|
|
|
43
43
|
return serial.replace(/\B(?=(\d{3})+(?!\d))/g, ' ')
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export const KeyChooser: React.FC<{
|
|
47
|
-
keys
|
|
48
|
-
selected
|
|
49
|
-
onSelect
|
|
50
|
-
}) => {
|
|
46
|
+
export const KeyChooser: React.FC<{
|
|
47
|
+
keys: VaultKeyRecord[]
|
|
48
|
+
selected?: string
|
|
49
|
+
onSelect: (serial: string) => void
|
|
50
|
+
}> = ({ keys, selected, onSelect }) => {
|
|
51
51
|
const { colors } = useTheme()
|
|
52
52
|
const Ionicons = loadIonicons()
|
|
53
53
|
return (
|
|
@@ -64,7 +64,10 @@ export const KeyChooser: React.FC<{ keys: VaultKeyRecord[]; selected?: string; o
|
|
|
64
64
|
onPress={() => onSelect(k.serial)}
|
|
65
65
|
style={[
|
|
66
66
|
styles.row,
|
|
67
|
-
i < keys.length - 1 && {
|
|
67
|
+
i < keys.length - 1 && {
|
|
68
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
69
|
+
borderBottomColor: colors.separator
|
|
70
|
+
}
|
|
68
71
|
]}
|
|
69
72
|
>
|
|
70
73
|
<Ionicons
|
|
@@ -60,14 +60,7 @@ function ringY(atY: number, r: number, ox = 0, oz = 0): P3[] {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/** Rounded rectangle lying flat — the key's body, its contact pad, its plug. */
|
|
63
|
-
function roundedRectY(
|
|
64
|
-
atY: number,
|
|
65
|
-
x0: number,
|
|
66
|
-
x1: number,
|
|
67
|
-
z0: number,
|
|
68
|
-
z1: number,
|
|
69
|
-
r: number
|
|
70
|
-
): P3[] {
|
|
63
|
+
function roundedRectY(atY: number, x0: number, x1: number, z0: number, z1: number, r: number): P3[] {
|
|
71
64
|
const STEP = 8
|
|
72
65
|
const corners: [number, number, number][] = [
|
|
73
66
|
[x1 - r, z1 - r, 0],
|
|
@@ -107,10 +107,7 @@ export const VaultCeremonySheet: React.FC = () => {
|
|
|
107
107
|
const pulse = useSharedValue(1)
|
|
108
108
|
useEffect(() => {
|
|
109
109
|
const active =
|
|
110
|
-
phase === 'waiting-for-key' ||
|
|
111
|
-
phase === 'awaiting-touch' ||
|
|
112
|
-
phase === 'preparing' ||
|
|
113
|
-
phase === 'broadcasting'
|
|
110
|
+
phase === 'waiting-for-key' || phase === 'awaiting-touch' || phase === 'preparing' || phase === 'broadcasting'
|
|
114
111
|
if (active && !reducedMotion) {
|
|
115
112
|
pulse.value = withRepeat(
|
|
116
113
|
withSequence(
|
|
@@ -295,7 +292,10 @@ export const VaultCeremonySheet: React.FC = () => {
|
|
|
295
292
|
setPin('')
|
|
296
293
|
}}
|
|
297
294
|
accessibilityState={{ disabled: !/^[0-9]{6,8}$/.test(pin) }}
|
|
298
|
-
style={[
|
|
295
|
+
style={[
|
|
296
|
+
styles.primaryBtn,
|
|
297
|
+
{ backgroundColor: colors.accent, opacity: /^[0-9]{6,8}$/.test(pin) ? 1 : 0.4 }
|
|
298
|
+
]}
|
|
299
299
|
>
|
|
300
300
|
<Text style={[styles.primaryLabel, { color: colors.textOnAccent }]}>{t('vault_unlock_cta')}</Text>
|
|
301
301
|
</PressableScale>
|
|
@@ -128,7 +128,8 @@ interface Props {
|
|
|
128
128
|
* underneath it are the detail screen's overflow menu.
|
|
129
129
|
*/
|
|
130
130
|
onOpen?: (action: ActivityAction) => void
|
|
131
|
-
|
|
131
|
+
/** Absent on a network with no block explorer: the row offers no link. */
|
|
132
|
+
onExplorer?: (txid: string) => void
|
|
132
133
|
onRefreshTx: (txid: string) => void
|
|
133
134
|
onAbort: (reference: string, action?: ActivityAction) => void
|
|
134
135
|
/** Rebuild and re-deliver a PeerPay token without waiting for a NACK. */
|
|
@@ -503,7 +504,7 @@ function ActivityRowBase({
|
|
|
503
504
|
onPress={() => onRefreshTx(action.txid)}
|
|
504
505
|
/>
|
|
505
506
|
) : null}
|
|
506
|
-
{action.txid && !parked ? (
|
|
507
|
+
{action.txid && !parked && onExplorer ? (
|
|
507
508
|
<Chip
|
|
508
509
|
icon="link-outline"
|
|
509
510
|
label="Explorer"
|
|
@@ -81,11 +81,7 @@ export const BackupReminderSheet: React.FC<{
|
|
|
81
81
|
// intercepts touches, so the screen behind stays fully interactive.
|
|
82
82
|
<View style={[styles.wrapper, { paddingBottom: insets.bottom + spacing.md }]} pointerEvents="box-none">
|
|
83
83
|
<Animated.View
|
|
84
|
-
style={[
|
|
85
|
-
styles.card,
|
|
86
|
-
{ backgroundColor: colors.sheetBackground, borderColor: colors.warning },
|
|
87
|
-
cardStyle
|
|
88
|
-
]}
|
|
84
|
+
style={[styles.card, { backgroundColor: colors.sheetBackground, borderColor: colors.warning }, cardStyle]}
|
|
89
85
|
>
|
|
90
86
|
<PressableScale haptic="tap" onPress={onClose} style={styles.closeButton}>
|
|
91
87
|
<Ionicons name="close" size={20} color={colors.textSecondary} />
|
|
@@ -56,7 +56,10 @@ export default function Balance() {
|
|
|
56
56
|
setAccountBalance({ key: cacheKey, value: total })
|
|
57
57
|
|
|
58
58
|
// Cache the new balance
|
|
59
|
-
await Promise.all([
|
|
59
|
+
await Promise.all([
|
|
60
|
+
AsyncStorage.setItem(cacheKey, String(total)),
|
|
61
|
+
AsyncStorage.setItem(timestampKey, String(Date.now()))
|
|
62
|
+
])
|
|
60
63
|
|
|
61
64
|
setBalanceLoading(false)
|
|
62
65
|
} catch (e) {
|
|
@@ -13,6 +13,7 @@ import React, { useCallback, useMemo, useState } from 'react'
|
|
|
13
13
|
import { Linking, StyleSheet, Text, View } from 'react-native'
|
|
14
14
|
import { useTranslation } from 'react-i18next'
|
|
15
15
|
import { useTheme, spacing, typography, useWallet } from '@bsv/expo-wallet-toolbox'
|
|
16
|
+
import { NETWORKS } from '../../../core/networks'
|
|
16
17
|
import ActivityRow, { type ActivityAction } from './ActivityRow'
|
|
17
18
|
import { showToast } from '../ui/Toast'
|
|
18
19
|
import { useMandala } from '../../hooks/useMandala'
|
|
@@ -56,18 +57,17 @@ export default function ContactActivityList({
|
|
|
56
57
|
const [expanded, setExpanded] = useState<string | null>(null)
|
|
57
58
|
const onToggle = useCallback((key: string) => setExpanded(prev => (prev === key ? null : key)), [])
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
/** A network with no block explorer (the scaling teratestnet) offers no link. */
|
|
61
|
+
const hasExplorer = NETWORKS[selectedNetwork].woc?.explorerBase !== undefined
|
|
62
|
+
const openExplorer = useCallback(
|
|
60
63
|
(txid: string) => {
|
|
61
|
-
const base =
|
|
62
|
-
|
|
63
|
-
? 'https://whatsonchain.com'
|
|
64
|
-
: selectedNetwork === 'teratest'
|
|
65
|
-
? 'https://woc-ttn.bsvblockchain.tech'
|
|
66
|
-
: 'https://test.whatsonchain.com'
|
|
64
|
+
const base = NETWORKS[selectedNetwork].woc?.explorerBase
|
|
65
|
+
if (!base) return
|
|
67
66
|
Linking.openURL(`${base}/tx/${txid}`).catch(() => showToast(t('explorer_open_failed'), { type: 'error' }))
|
|
68
67
|
},
|
|
69
68
|
[selectedNetwork, t]
|
|
70
69
|
)
|
|
70
|
+
const onExplorer = hasExplorer ? openExplorer : undefined
|
|
71
71
|
|
|
72
72
|
const rows = useMemo(
|
|
73
73
|
() =>
|
|
@@ -67,11 +67,7 @@ export default function IconPickerSheet({ visible, onClose }: { visible: boolean
|
|
|
67
67
|
<Pressable style={[StyleSheet.absoluteFill, { backgroundColor: colors.scrim }]} onPress={onClose} />
|
|
68
68
|
</Animated.View>
|
|
69
69
|
<Animated.View
|
|
70
|
-
style={[
|
|
71
|
-
styles.sheet,
|
|
72
|
-
{ backgroundColor: colors.sheetBackground, maxHeight: height * 0.75 },
|
|
73
|
-
sheetStyle
|
|
74
|
-
]}
|
|
70
|
+
style={[styles.sheet, { backgroundColor: colors.sheetBackground, maxHeight: height * 0.75 }, sheetStyle]}
|
|
75
71
|
>
|
|
76
72
|
<View style={[styles.grabber, { backgroundColor: colors.separator }]} />
|
|
77
73
|
<Text style={[styles.title, { color: colors.textPrimary }]}>
|
|
@@ -45,7 +45,12 @@ function loadIonicons(): IoniconsComponent {
|
|
|
45
45
|
return ioniconsComponent
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const NETWORK_LABEL_KEY: Record<AppChain, string> = {
|
|
48
|
+
const NETWORK_LABEL_KEY: Record<AppChain, string> = {
|
|
49
|
+
main: 'mainnet',
|
|
50
|
+
test: 'testnet',
|
|
51
|
+
teratest: 'teratest',
|
|
52
|
+
scaletest: 'scaletest'
|
|
53
|
+
}
|
|
49
54
|
|
|
50
55
|
export interface ProfileSwitcherPopoverProps {
|
|
51
56
|
visible: boolean
|
|
@@ -35,7 +35,10 @@ export interface EvictionNotice {
|
|
|
35
35
|
* announce; a `refused` RECEIVED payment is the settlement spec's row 1
|
|
36
36
|
* (reversed credit) and belongs here too.
|
|
37
37
|
*/
|
|
38
|
-
export function evictionsFrom(
|
|
38
|
+
export function evictionsFrom(
|
|
39
|
+
rows: readonly TokenActivityRow[] | null,
|
|
40
|
+
alreadySeen: readonly string[]
|
|
41
|
+
): EvictionNotice[] {
|
|
39
42
|
if (!rows) return []
|
|
40
43
|
return rows
|
|
41
44
|
.filter(r => r.role === 'received' && (r.status === 'reversed' || r.status === 'refused'))
|
package/ui/hooks/useMandala.ts
CHANGED
|
@@ -72,13 +72,7 @@ const useDemoRuntime: () => MandalaRuntime | null = __DEV__
|
|
|
72
72
|
/** Injected runtime. `undefined` means "ask the wallet context"; `null` means "none". */
|
|
73
73
|
const MandalaRuntimeContext = createContext<MandalaRuntime | null | undefined>(undefined)
|
|
74
74
|
|
|
75
|
-
export function MandalaProvider({
|
|
76
|
-
runtime,
|
|
77
|
-
children
|
|
78
|
-
}: {
|
|
79
|
-
runtime: MandalaRuntime | null
|
|
80
|
-
children: React.ReactNode
|
|
81
|
-
}) {
|
|
75
|
+
export function MandalaProvider({ runtime, children }: { runtime: MandalaRuntime | null; children: React.ReactNode }) {
|
|
82
76
|
return React.createElement(MandalaRuntimeContext.Provider, { value: runtime }, children)
|
|
83
77
|
}
|
|
84
78
|
|