@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/ui/tokenStatus.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* and painting it amber would make the normal case look like a fault.
|
|
12
12
|
*/
|
|
13
13
|
import type { TokenActivityStatus } from '../core/mandala/runtime'
|
|
14
|
+
import type { TxStatusView } from './txStatus'
|
|
14
15
|
|
|
15
16
|
export type TokenStatusTone = 'neutral' | 'positive' | 'warning' | 'error'
|
|
16
17
|
|
|
@@ -34,6 +35,26 @@ export function tokenStatusKey(status: TokenActivityStatus): string {
|
|
|
34
35
|
return KEYS[status] ?? KEYS.settling
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
/**
|
|
39
|
+
* A token row's status in an activity list, in the same words and tones a BSV
|
|
40
|
+
* row uses: a finished transfer says what it did (Sent / Received), one still
|
|
41
|
+
* on its way to the issuer is plain "Pending", and only the states the holder
|
|
42
|
+
* may have to act on keep their own word and get colour.
|
|
43
|
+
*/
|
|
44
|
+
export function tokenRowStatusView(status: TokenActivityStatus, incoming: boolean): TxStatusView {
|
|
45
|
+
switch (status) {
|
|
46
|
+
case 'settled':
|
|
47
|
+
return { key: incoming ? 'tx_status_received' : 'tx_status_sent', tone: 'settled' }
|
|
48
|
+
case 'refused':
|
|
49
|
+
case 'reversed':
|
|
50
|
+
return { key: KEYS[status], tone: 'failed' }
|
|
51
|
+
case 'stuck':
|
|
52
|
+
return { key: KEYS.stuck, tone: 'attention' }
|
|
53
|
+
default:
|
|
54
|
+
return { key: 'tx_status_pending', tone: 'settled' }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
37
58
|
export function tokenStatusTone(status: TokenActivityStatus): TokenStatusTone {
|
|
38
59
|
return TONES[status] ?? 'neutral'
|
|
39
60
|
}
|
package/ui/txStatus.ts
CHANGED
|
@@ -22,11 +22,44 @@ export interface TxStatusView {
|
|
|
22
22
|
* Map a raw action status (and any live offline-queue state) to a tone.
|
|
23
23
|
*
|
|
24
24
|
* The offline queue row outranks the raw status: a held transaction sits at
|
|
25
|
-
* 'unproven' (which would read as a
|
|
25
|
+
* 'unproven' (which would read as a quiet "Pending") or at 'nosend' when
|
|
26
26
|
* payer-side promotion failed, so without this the user would see a confirmed
|
|
27
27
|
* payment that has not actually gone anywhere.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Labels the Pay / Get paid rails write on their actions: handle and nearby
|
|
31
|
+
* payments, address payments, and stablecoin transfers. An outgoing action
|
|
32
|
+
* without one was made by a connected app or the wallet itself (an identity
|
|
33
|
+
* certificate, say), so it reads "Spent", not "Sent".
|
|
34
|
+
*/
|
|
35
|
+
const PAYMENT_LABELS = new Set(['peerpay', 'localpay', 'legacy', 'mandala'])
|
|
36
|
+
|
|
37
|
+
export function isPaymentAction(labels?: readonly string[]): boolean {
|
|
38
|
+
return Boolean(labels?.some(l => PAYMENT_LABELS.has(l)))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** What a row says it did once it settles. Its i18n key is `tx_status_<kind>`. */
|
|
42
|
+
export type ActivityKind = 'sent' | 'received' | 'spent' | 'transferred'
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The one place a row's word is decided, so the status line and the activity
|
|
46
|
+
* filter can never disagree about which word a row says.
|
|
47
|
+
*/
|
|
48
|
+
export function activityKind(incoming: boolean | undefined, labels?: readonly string[]): ActivityKind {
|
|
49
|
+
// A vault move stays the holder's money whichever way it goes.
|
|
50
|
+
if (labels?.includes('vault')) return 'transferred'
|
|
51
|
+
if (incoming) return 'received'
|
|
52
|
+
return isPaymentAction(labels) ? 'sent' : 'spent'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function txStatusView(
|
|
56
|
+
status: string,
|
|
57
|
+
offlineStatus?: string,
|
|
58
|
+
incoming?: boolean,
|
|
59
|
+
labels?: readonly string[]
|
|
60
|
+
): TxStatusView {
|
|
61
|
+
const done = `tx_status_${activityKind(incoming, labels)}`
|
|
62
|
+
|
|
30
63
|
switch (offlineStatus) {
|
|
31
64
|
case 'queued':
|
|
32
65
|
return { key: 'tx_status_offline_queued', tone: 'inflight' }
|
|
@@ -42,12 +75,17 @@ export function txStatusView(status: string, offlineStatus?: string): TxStatusVi
|
|
|
42
75
|
}
|
|
43
76
|
|
|
44
77
|
switch (status) {
|
|
78
|
+
// The chain words ("Confirmed", "Accepted") answered a question about the
|
|
79
|
+
// ledger; the user's question is what happened to their money. A settled
|
|
80
|
+
// row therefore says what it DID — Received or Sent — from the moment it is
|
|
81
|
+
// handed to the network: the block proof that follows changes nothing the
|
|
82
|
+
// holder can act on. The states below that DO need action keep their own words.
|
|
45
83
|
case 'completed':
|
|
46
|
-
return { key: 'tx_status_confirmed', tone: 'settled' }
|
|
47
84
|
case 'unproven':
|
|
48
|
-
return { key:
|
|
85
|
+
return { key: done, tone: 'settled' }
|
|
86
|
+
// Already handed to the network: say what it does, Sent or Received.
|
|
49
87
|
case 'sending':
|
|
50
|
-
return { key:
|
|
88
|
+
return { key: done, tone: 'inflight' }
|
|
51
89
|
case 'nosend':
|
|
52
90
|
return { key: 'tx_status_not_sent', tone: 'attention' }
|
|
53
91
|
case 'unsigned':
|