@bsv/expo-wallet-toolbox 0.4.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 +547 -0
- package/README.md +19 -1
- package/assets/sounds/vault-deposit.wav +0 -0
- package/assets/sounds/vault-withdraw.wav +0 -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 +16 -1
- package/core/contacts/contactActivity.ts +153 -0
- package/core/contacts/contactCache.ts +41 -0
- package/core/contacts/contactsStore.ts +183 -0
- package/core/context/VaultContext.tsx +8 -11
- package/core/context/WalletConnectionContext.tsx +137 -52
- package/core/context/WalletContext.tsx +464 -30
- 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/hooks/useConfirmationSound.ts +14 -8
- package/core/i18n/translations.tsx +4562 -986
- 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 +116 -15
- package/core/localpay/build.ts +674 -37
- package/core/localpay/codec.ts +68 -5
- package/core/localpay/pending.ts +240 -22
- package/core/localpay/pendingAborts.ts +5 -1
- package/core/localpay/settlementAck.ts +149 -0
- package/core/localpay/types.ts +14 -1
- package/core/localpay/verify.ts +118 -69
- package/core/mandala/abortGuard.ts +134 -0
- package/core/mandala/basketMigration.ts +166 -0
- package/core/mandala/bundle.ts +244 -0
- package/core/mandala/createRuntime.ts +2437 -0
- package/core/mandala/drain.ts +670 -0
- package/core/mandala/permissionModule.ts +642 -0
- package/core/mandala/resendTransfer.ts +175 -0
- package/core/mandala/runtime.ts +357 -0
- package/core/mandala/settlementStore.ts +412 -0
- package/core/mandala/types.ts +290 -0
- 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/cancelParked.ts +94 -1
- package/core/offline/payerHold.ts +152 -12
- package/core/offline/plan.ts +1 -1
- package/core/offline/tokenFrames.ts +197 -0
- package/core/parsePeerPayURI.ts +70 -17
- package/core/pay/rails/address.ts +51 -3
- package/core/pay/rails/handle.ts +88 -9
- package/core/pay/rails/index.ts +16 -6
- package/core/pay/rails/nearby.ts +114 -4
- package/core/pay/recordProof.ts +2 -6
- package/core/services/arcadeBroadcastProvider.ts +1 -4
- package/core/services/capWalletArgs.ts +8 -9
- package/core/services/exchangeRate.ts +1 -1
- package/core/services/externalOrigin.ts +42 -0
- package/core/services/vault/VaultKeyService.ts +912 -251
- package/core/services/vault/ceremony.ts +435 -367
- package/core/services/vault/ceremonyHost.ts +27 -21
- package/core/services/vault/devMock.ts +30 -7
- package/core/services/vault/driver.ts +95 -41
- package/core/services/vault/guard.ts +514 -56
- package/core/services/vault/hardwareLease.ts +22 -0
- package/core/services/vault/mockYubiKey.ts +258 -90
- package/core/services/vault/pivReset.ts +145 -0
- package/core/services/vault/r1comb.ts +976 -0
- package/core/services/vault/session.ts +93 -26
- package/core/services/vault/transfers.ts +2617 -747
- package/core/services/vault/types.ts +100 -43
- package/core/services/vault/vaultStore.ts +991 -74
- package/core/services/walletConnectionValidation.ts +293 -0
- package/core/services/walletServiceConfig.ts +31 -20
- package/core/storage/StorageExpoSQLite.ts +420 -87
- package/core/storage/dbImage.ts +48 -0
- package/core/storage/methods/findSql.ts +3 -54
- package/core/storage/methods/listActionsSql.ts +8 -5
- package/core/storage/methods/listOutputsSql.ts +9 -5
- package/core/storage/methods/offlineActions.ts +15 -0
- package/core/storage/methods/processOfflineActions.ts +265 -9
- package/core/storage/methods/reviewStatusSql.ts +7 -2
- package/core/storage/methods/walletBalanceSql.ts +16 -4
- package/core/storage/schema/createTables.ts +152 -0
- package/core/storage/sqlUpdateValue.ts +24 -0
- package/core/toolboxConfig.ts +182 -1
- package/core/toolboxTypes.ts +40 -0
- package/core/userAvatar.ts +79 -0
- package/core/walletMonitor.ts +8 -3
- package/core/walletRepair/runWalletCheck.ts +19 -2
- package/package.json +31 -30
- package/ui/activityFilter.ts +115 -0
- package/ui/components/QRScanner.tsx +1 -1
- package/ui/components/pay/AdmissionNotice.tsx +99 -0
- package/ui/components/pay/AssetPicker.tsx +184 -0
- package/ui/components/pay/AvailableBalance.tsx +33 -2
- package/ui/components/pay/HandleReceive.tsx +213 -50
- package/ui/components/pay/NearbyFlow.tsx +616 -69
- package/ui/components/pay/PayForm.tsx +73 -8
- package/ui/components/pay/PaymentSuccessOverlay.tsx +89 -8
- package/ui/components/pay/RecipientField.tsx +132 -73
- package/ui/components/pay/RequestHub.tsx +68 -8
- package/ui/components/pay/ResultBanner.tsx +41 -4
- package/ui/components/pay/StepBar.tsx +32 -0
- package/ui/components/pay/UniversalSend.tsx +1118 -86
- package/ui/components/pay/tokenSendCopy.ts +116 -0
- package/ui/components/pay/useRecipientInput.ts +36 -7
- package/ui/components/ui/PencilEditField.tsx +109 -0
- package/ui/components/ui/PermissionSheet.tsx +65 -4
- package/ui/components/ui/Sheet.tsx +9 -2
- package/ui/components/ui/SlideOverFromRight.tsx +86 -0
- package/ui/components/vault/EnrollWizard.tsx +1432 -488
- package/ui/components/vault/KeyChooser.tsx +96 -0
- package/ui/components/vault/VaultCeremonySheet.tsx +107 -43
- package/ui/components/vault/vaultErrorCopy.ts +145 -0
- package/ui/components/wallet/ActivityRow.tsx +283 -97
- package/ui/components/wallet/AmountInput.tsx +92 -28
- package/ui/components/wallet/AssetAmount.tsx +95 -0
- package/ui/components/wallet/AssetSwitcherDropdown.tsx +261 -0
- 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/components/wallet/tokenEviction.ts +65 -0
- package/ui/hooks/useContactsStore.ts +10 -0
- package/ui/hooks/useExportWalletData.ts +39 -0
- package/ui/hooks/useMandala.ts +320 -0
- package/ui/hooks/useOnline.ts +65 -20
- package/ui/hooks/useVaultBalance.ts +105 -7
- package/ui/hooks/useVaultCoverage.ts +52 -0
- package/ui/importDatabases.ts +7 -3
- package/ui/index.ts +75 -7
- package/ui/screens/ConnectionsScreen.tsx +46 -29
- 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/PairScreen.tsx +12 -12
- package/ui/screens/PayScreen.tsx +145 -12
- package/ui/screens/ProfileScreen.tsx +783 -0
- package/ui/screens/SettingsScreen.tsx +18 -9
- package/ui/screens/TransactionDetailScreen.tsx +419 -0
- package/ui/screens/TrustScreen.tsx +1 -1
- package/ui/screens/VaultScreen.tsx +925 -171
- package/ui/screens/VaultTransferScreen.tsx +376 -123
- package/ui/screens/WalletCheckScreen.tsx +10 -1
- package/ui/screens/WalletConfigScreen.tsx +80 -16
- package/ui/screens/WalletHomeScreen.tsx +915 -139
- package/ui/screens/homeBadges.ts +9 -1
- package/ui/screens/tokenRowTitle.ts +68 -0
- package/ui/tokenFormat.ts +108 -0
- package/ui/tokenSeen.ts +75 -0
- package/ui/tokenStatus.ts +100 -0
- package/ui/txStatus.ts +43 -5
- package/assets/sounds/vault-close.wav +0 -0
- package/assets/sounds/vault-open.wav +0 -0
- package/core/services/vault/k1.ts +0 -75
- package/core/services/vault/sealing.ts +0 -84
- package/core/services/vault/vaultDerivation.ts +0 -152
- package/core/services/vault/vaultPassphrase.ts +0 -287
- package/ui/components/vault/PassphraseField.tsx +0 -306
- package/ui/components/vault/PhraseBackupSheet.tsx +0 -227
- package/ui/screens/VaultRecoverScreen.tsx +0 -226
|
@@ -12,17 +12,36 @@ import { ScrollView, StyleSheet, View } from 'react-native'
|
|
|
12
12
|
import { useTranslation } from 'react-i18next'
|
|
13
13
|
|
|
14
14
|
import PayCellRow from './PayCellRow'
|
|
15
|
-
import { PayAmountField, PayField } from './PayForm'
|
|
15
|
+
import { ConsequenceNote, PayAmountField, PayField } from './PayForm'
|
|
16
16
|
import { spacing } from '@bsv/expo-wallet-toolbox'
|
|
17
|
+
import type { TokenAssetStatus, TokenBalance } from '../../../core/mandala/runtime'
|
|
17
18
|
|
|
18
19
|
export type RequestMethod = 'get-nearby' | 'get-handle' | 'get-address'
|
|
19
20
|
|
|
20
21
|
export interface RequestHubProps {
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Raw figure from the amount field. '' is an open request. Satoshis when no
|
|
24
|
+
* asset is selected, base units of that asset when one is — which is exactly
|
|
25
|
+
* why the screen above must not hand this to a satoshi-shaped prop.
|
|
26
|
+
*/
|
|
22
27
|
requestSats: string
|
|
23
28
|
onChangeRequestSats: (v: string) => void
|
|
24
29
|
onPick: (method: RequestMethod) => void
|
|
25
30
|
online: boolean
|
|
31
|
+
/** Held assets; empty means no picker and today's screen. */
|
|
32
|
+
balances?: TokenBalance[]
|
|
33
|
+
/** `null` is BSV. Chosen upstream (Home's coin switcher, or a deep link). */
|
|
34
|
+
selectedAssetId?: string | null
|
|
35
|
+
/** Kept for callers that still pass it; the hub no longer offers a picker. */
|
|
36
|
+
onSelectAsset?: (assetId: string | null) => void
|
|
37
|
+
/**
|
|
38
|
+
* Regulatory/registry facts for `selectedAssetId`, from the caller's own
|
|
39
|
+
* `useAssetStatus` — this component stays a plain prop-driven view (like
|
|
40
|
+
* `balances` above) rather than reaching for the runtime itself. `null`
|
|
41
|
+
* (unknown/no asset) shows no note; advisory only, since a paused issuer
|
|
42
|
+
* can still resume before the payer ever acts on this request.
|
|
43
|
+
*/
|
|
44
|
+
assetStatus?: TokenAssetStatus | null
|
|
26
45
|
}
|
|
27
46
|
|
|
28
47
|
/** Satoshis from the hub's raw field, or undefined for an open request. */
|
|
@@ -31,13 +50,42 @@ export function requestSatsFrom(text: string): number | undefined {
|
|
|
31
50
|
return Number.isFinite(n) && n > 0 ? n : undefined
|
|
32
51
|
}
|
|
33
52
|
|
|
34
|
-
export default function RequestHub({
|
|
53
|
+
export default function RequestHub({
|
|
54
|
+
requestSats,
|
|
55
|
+
onChangeRequestSats,
|
|
56
|
+
onPick,
|
|
57
|
+
online,
|
|
58
|
+
balances = [],
|
|
59
|
+
selectedAssetId = null,
|
|
60
|
+
assetStatus = null
|
|
61
|
+
}: RequestHubProps) {
|
|
35
62
|
const { t } = useTranslation()
|
|
63
|
+
const holding = balances.find(b => b.asset.assetId === selectedAssetId) ?? null
|
|
64
|
+
const asset = holding?.asset ?? null
|
|
36
65
|
return (
|
|
37
66
|
<ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
|
|
67
|
+
{/* No "Getting paid in" picker here (design 1b, 2026-09-15): the coin
|
|
68
|
+
was chosen on Home's switcher and arrives as `selectedAssetId`; the
|
|
69
|
+
amount field's unit is what says which money is being asked for. */}
|
|
70
|
+
|
|
38
71
|
{/* No max button and no balance line: this asks the PAYER for money, so
|
|
39
72
|
the requester's own balance is meaningless here. */}
|
|
40
|
-
<PayAmountField
|
|
73
|
+
<PayAmountField
|
|
74
|
+
value={requestSats}
|
|
75
|
+
onChangeText={onChangeRequestSats}
|
|
76
|
+
showMax={false}
|
|
77
|
+
showBalance={false}
|
|
78
|
+
asset={asset ? { ticker: asset.ticker, decimals: asset.decimals } : undefined}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
{/* Advisory only: a paused issuer can resume before the payer ever acts
|
|
82
|
+
on this request, so this never blocks picking a method. */}
|
|
83
|
+
{asset && assetStatus?.paused && (
|
|
84
|
+
<ConsequenceNote
|
|
85
|
+
textKey="pay_asset_request_paused"
|
|
86
|
+
values={{ issuer: asset.issuerName || t('token_issuer_fallback'), ticker: asset.ticker }}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
41
89
|
|
|
42
90
|
<PayField labelKey="pay_method">
|
|
43
91
|
<View style={styles.rows}>
|
|
@@ -48,19 +96,31 @@ export default function RequestHub({ requestSats, onChangeRequestSats, onPick, o
|
|
|
48
96
|
onPress={() => onPick('get-nearby')}
|
|
49
97
|
/>
|
|
50
98
|
{/* Remote and address both need the network: a message-box round-trip
|
|
51
|
-
and an overlay lookup respectively. Nearby is the offline rail.
|
|
99
|
+
and an overlay lookup respectively. Nearby is the offline rail.
|
|
100
|
+
With an asset selected the link names it and carries the figure
|
|
101
|
+
in its base units (`asset=`/`amount=`), so the row reads the same
|
|
102
|
+
in either money. */}
|
|
52
103
|
<PayCellRow
|
|
53
104
|
title={t('pay_method_remote_link')}
|
|
54
|
-
subtitle={online ? t('
|
|
105
|
+
subtitle={!online ? t('pay_offline_needs_internet') : t('pay_cell_handle_get_sub')}
|
|
55
106
|
icon="share-outline"
|
|
56
107
|
disabled={!online}
|
|
57
108
|
onPress={() => onPick('get-handle')}
|
|
58
109
|
/>
|
|
110
|
+
{/* D4: disabled with a plain reason, never removed. Deleting one of
|
|
111
|
+
three rows the user has learned would be a silent answer to a
|
|
112
|
+
question they are entitled to have answered. */}
|
|
59
113
|
<PayCellRow
|
|
60
114
|
title={t('pay_method_address')}
|
|
61
|
-
subtitle={
|
|
115
|
+
subtitle={
|
|
116
|
+
asset
|
|
117
|
+
? t('pay_asset_address_status', { ticker: asset.ticker })
|
|
118
|
+
: online
|
|
119
|
+
? t('pay_cell_address_get_sub')
|
|
120
|
+
: t('pay_offline_needs_internet')
|
|
121
|
+
}
|
|
62
122
|
icon="wallet-outline"
|
|
63
|
-
disabled={!online}
|
|
123
|
+
disabled={!online || !!asset}
|
|
64
124
|
onPress={() => onPick('get-address')}
|
|
65
125
|
/>
|
|
66
126
|
</View>
|
|
@@ -29,16 +29,42 @@ interface ResultBannerProps {
|
|
|
29
29
|
readonly result: { type: 'success' | 'error'; message: string }
|
|
30
30
|
readonly onDismiss: () => void
|
|
31
31
|
readonly colors: ReturnType<typeof import('@bsv/expo-wallet-toolbox').useTheme>['colors']
|
|
32
|
+
/**
|
|
33
|
+
* The one thing a failed money message may offer to DO — "Check again" after
|
|
34
|
+
* an overlay this wallet could not reach, "Get BSV" after a funding refusal.
|
|
35
|
+
*
|
|
36
|
+
* Deliberately not a retry. When a submit fails without a verdict, the
|
|
37
|
+
* transaction may have been admitted and the response lost; a retry would
|
|
38
|
+
* build a second spend of the same coins and be refused for conservation
|
|
39
|
+
* forever. So the action offered is always one that reads state, never one
|
|
40
|
+
* that moves money.
|
|
41
|
+
*/
|
|
42
|
+
readonly action?: { readonly label: string; readonly onPress: () => void }
|
|
32
43
|
}
|
|
33
44
|
|
|
34
|
-
export default function ResultBanner({ result, onDismiss, colors }: ResultBannerProps) {
|
|
45
|
+
export default function ResultBanner({ result, onDismiss, colors, action }: ResultBannerProps) {
|
|
35
46
|
const Ionicons = loadIonicons()
|
|
36
47
|
const isSuccess = result.type === 'success'
|
|
37
48
|
const color = isSuccess ? colors.success : colors.error
|
|
38
49
|
return (
|
|
39
50
|
<View style={[styles.resultBanner, { backgroundColor: color + '15', borderColor: color }]}>
|
|
40
51
|
<Ionicons name={isSuccess ? 'checkmark-circle' : 'alert-circle'} size={20} color={color} />
|
|
41
|
-
<
|
|
52
|
+
<View style={styles.resultBody}>
|
|
53
|
+
<Text style={[styles.resultText, { color }]}>{result.message}</Text>
|
|
54
|
+
{action && (
|
|
55
|
+
<TouchableOpacity
|
|
56
|
+
onPress={action.onPress}
|
|
57
|
+
// A footnote-sized target is not a target: padded to the 44pt
|
|
58
|
+
// minimum in the direction it can grow.
|
|
59
|
+
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
|
60
|
+
style={styles.resultAction}
|
|
61
|
+
accessibilityRole="button"
|
|
62
|
+
accessibilityLabel={action.label}
|
|
63
|
+
>
|
|
64
|
+
<Text style={[styles.resultActionText, { color }]}>{action.label}</Text>
|
|
65
|
+
</TouchableOpacity>
|
|
66
|
+
)}
|
|
67
|
+
</View>
|
|
42
68
|
<TouchableOpacity onPress={onDismiss} style={styles.resultDismiss}>
|
|
43
69
|
<Ionicons name="close" size={18} color={color} />
|
|
44
70
|
</TouchableOpacity>
|
|
@@ -58,10 +84,21 @@ const styles = StyleSheet.create({
|
|
|
58
84
|
marginTop: spacing.lg,
|
|
59
85
|
marginBottom: spacing.lg
|
|
60
86
|
},
|
|
87
|
+
resultBody: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
gap: spacing.xs
|
|
90
|
+
},
|
|
61
91
|
resultText: {
|
|
62
92
|
...typography.subhead,
|
|
63
|
-
fontWeight: '500'
|
|
64
|
-
|
|
93
|
+
fontWeight: '500'
|
|
94
|
+
},
|
|
95
|
+
resultAction: {
|
|
96
|
+
alignSelf: 'flex-start',
|
|
97
|
+
paddingVertical: spacing.xs
|
|
98
|
+
},
|
|
99
|
+
resultActionText: {
|
|
100
|
+
...typography.subhead,
|
|
101
|
+
fontWeight: '700'
|
|
65
102
|
},
|
|
66
103
|
resultDismiss: {
|
|
67
104
|
padding: spacing.xs
|
|
@@ -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
|
+
})
|