@bsv/expo-wallet-toolbox 0.28.0 → 0.30.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 +33 -0
- package/core/backup/appData.ts +16 -3
- package/core/backup/codec.ts +15 -2
- package/core/i18n/translations.tsx +2802 -196
- package/package.json +1 -1
- package/ui/components/pay/NearbyFlow.tsx +460 -197
- package/ui/components/vault/EnrollWizard.tsx +84 -10
- package/ui/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.30.0
|
|
6
|
+
|
|
7
|
+
The BSV Wallet app's last patch of the toolbox, upstreamed: a backup carries the wallet's look, and the vault chain check shows its progress and can be skipped. No native change: hosts do not rebuild. Every new prop and option is optional, so no host action is necessary.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`appData.walletLook` and `WALLET_LOOK_KEY`.** The backup carries the host's `wallet_look` row as it is, so a restored wallet looks as it did. The toolbox never reads the value. An empty row is not carried. When two devices merge, the first device's look wins. A `walletLook` that is not a string makes the decode fail, as other malformed `appData` fields do.
|
|
12
|
+
- **Progress and "Skip" for the vault chain check.** `EnrollWizard`'s `cardGate.check` now gets a second argument, `{ onProgress, signal }`. The wizard shows a bar with a percent while the check runs, and a "Skip the check" button. A skip aborts `signal` and gives an `unknown` answer with `reason: 'skipped'`, never `clear`, so a reset still needs the loss sentence. After a skip, "Check the blockchain" runs the check again. An `unknown` answer with another reason shows that reason. A `check` that ignores the second argument works as before.
|
|
13
|
+
- **6 strings in all 14 locales:** `vault_card_progress`, `vault_card_skip`, `vault_card_skipped_title`, `vault_card_skipped_body`, `vault_card_check` and `vault_card_reason`.
|
|
14
|
+
|
|
15
|
+
## 0.29.0
|
|
16
|
+
|
|
17
|
+
The BSV Wallet app's nearby-payment changes, upstreamed from its patch of 0.27.0: a host can draw the failure screen and explain a stopped radio, a failure names its cause as a code, and 16 payment strings are reworded. No native change: hosts do not rebuild. Every new prop is optional, and the new fields are on values that the toolbox gives to the host, so no host action is necessary.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **`NearbyFlowProps.renderFailed` and the `NearbyFailed` type.** A host can draw a nearby payment's failure itself, as `renderPayer` and `renderReceived` let it draw the other steps. The host gets the cause and only the actions that the cause permits: `retrySave` when a payment reached this device and is not saved, `retry` otherwise, and `showCode`, `openSettings` and `checkWallet` when they apply. `cancel` is always there. The built-in screen reads the same actions, and shows the same buttons as before.
|
|
22
|
+
- **`NearbyFailed.cause` and the `NearbyFailureCause` type.** The cause as a code: `insufficient-funds`, `network-permission`, `wrong-network`, `declined`, `unverified`, `unsaved`, `too-large` or `unknown`. The flow sets it where the failure occurs, not from the text. A host that writes its own copy uses `cause`, and does not match the words of `detail`. `detail` is unchanged.
|
|
23
|
+
- **`NearbyFailed.declineReason`.** The payee's own decline code, when the payee refused the payment.
|
|
24
|
+
- **`NearbyFlowProps.explainRadio`, `{ label, onPress(kind) }`.** With it, each "radio stopped" notice has an (i) button that calls `onPress` with the radio that stopped. `label` is the accessibility label of the button. The button is absent when Local Network access is off, because that notice has its own Settings button. Without the prop, the notice is the same as before.
|
|
25
|
+
- **Wallet identity keys on the host values.** `recipient.identityKey` on `NearbyConfirm`, `NearbySending` and `NearbyShowCode`, `recipientKey` on `NearbyDone`, and `payerKey` on `NearbyReceived`. A host can draw the same face for the person that it draws in other screens.
|
|
26
|
+
- **Icelandic (`is`).** A full catalog, and `supportedLanguages` lists it. It merged after this entry was written, and the 0.29.0 package includes it.
|
|
27
|
+
- **14 German strings.** The German catalog lacked 13 keys, and one more value had old wording.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **The embedded "Scan the payer's code" control is now a button.** In the embedded payee flow it was a 13 px line of grey text. It is now the same `SecondaryButton` as in the full-screen flow. Every host that embeds `NearbyFlow` sees this.
|
|
32
|
+
- **16 payment strings are reworded, in all 14 locales.** No key is added, renamed or dropped. Every host sees the new copy.
|
|
33
|
+
- Outside Settings › Advanced, the copy does not name the message box. It says what occurred and what to do: `message_box_off_hint`, `message_box_unreachable`, `resend_sending`, `direct_pay_status_not_set_up_body`, `direct_pay_fallback_title`, `direct_pay_fallback_offline`, `direct_pay_fallback_link_failed`, `direct_pay_fallback_too_large`, `direct_pay_failed_offline` and `direct_pay_failed_no_message_box`.
|
|
34
|
+
- `local_pay_ble_unavailable`, `local_pay_nearby_unavailable` and `local_pay_floor_peer_bt_off` are shorter.
|
|
35
|
+
- `local_pay_root_unverified` and `local_pay_declined_root_unverified` now say what to do: the payee goes online, then the same code is scanned again.
|
|
36
|
+
- `tx_status_parked` reads "Undelivered".
|
|
37
|
+
|
|
5
38
|
## 0.28.0
|
|
6
39
|
|
|
7
40
|
No native change: hosts do not rebuild.
|
package/core/backup/appData.ts
CHANGED
|
@@ -50,6 +50,12 @@ import { getIssuedDates, setIssuedDates } from '../pay/receiveHistory'
|
|
|
50
50
|
import type { AppDataSnapshot } from './codec'
|
|
51
51
|
import { mergeContacts } from './contactsBackup'
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* The app's own row for how it draws this wallet (its avatar). The toolbox never reads its
|
|
55
|
+
* value: it backs the row up and writes it back, so a restored wallet looks as it did.
|
|
56
|
+
*/
|
|
57
|
+
export const WALLET_LOOK_KEY = 'wallet_look'
|
|
58
|
+
|
|
53
59
|
export interface KVStorage {
|
|
54
60
|
getKeyValue(k: string): Promise<string | undefined>
|
|
55
61
|
setKeyValue(k: string, v: string): Promise<void>
|
|
@@ -65,6 +71,7 @@ export function isEmptyAppData(appData: AppDataSnapshot | undefined): boolean {
|
|
|
65
71
|
(appData.localpayPending === undefined &&
|
|
66
72
|
appData.peerpayOutbox === undefined &&
|
|
67
73
|
appData.contacts === undefined &&
|
|
74
|
+
appData.walletLook === undefined &&
|
|
68
75
|
(appData.receiveIssuedDates?.length ?? 0) === 0)
|
|
69
76
|
)
|
|
70
77
|
}
|
|
@@ -76,15 +83,18 @@ export function isEmptyAppData(appData: AppDataSnapshot | undefined): boolean {
|
|
|
76
83
|
* only ever rides an already-non-empty chunk.
|
|
77
84
|
*/
|
|
78
85
|
export async function captureAppDataSnapshot(storage: KVStorage): Promise<AppDataSnapshot> {
|
|
79
|
-
const [localpayPending, peerpayOutbox, receiveIssuedDates] = await Promise.all([
|
|
86
|
+
const [localpayPending, peerpayOutbox, receiveIssuedDates, walletLook] = await Promise.all([
|
|
80
87
|
storage.getKeyValue(PENDING_KEY),
|
|
81
88
|
storage.getKeyValue(OUTBOX_KEY),
|
|
82
|
-
getIssuedDates(storage)
|
|
89
|
+
getIssuedDates(storage),
|
|
90
|
+
storage.getKeyValue(WALLET_LOOK_KEY)
|
|
83
91
|
])
|
|
84
92
|
const snapshot: AppDataSnapshot = {}
|
|
85
93
|
if (localpayPending !== undefined) snapshot.localpayPending = localpayPending
|
|
86
94
|
if (peerpayOutbox !== undefined) snapshot.peerpayOutbox = peerpayOutbox
|
|
87
95
|
if (receiveIssuedDates.length > 0) snapshot.receiveIssuedDates = receiveIssuedDates
|
|
96
|
+
// an empty row is "none set": nothing to carry
|
|
97
|
+
if (walletLook) snapshot.walletLook = walletLook
|
|
88
98
|
return snapshot
|
|
89
99
|
}
|
|
90
100
|
|
|
@@ -101,6 +111,7 @@ export async function applyAppData(storage: KVStorage, snapshot: AppDataSnapshot
|
|
|
101
111
|
if (snapshot.receiveIssuedDates !== undefined && snapshot.receiveIssuedDates.length > 0) {
|
|
102
112
|
await setIssuedDates(storage, snapshot.receiveIssuedDates)
|
|
103
113
|
}
|
|
114
|
+
if (snapshot.walletLook) await storage.setKeyValue(WALLET_LOOK_KEY, snapshot.walletLook)
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
/** Parses a KV row's raw JSON text into an array of plain objects, never throwing — a
|
|
@@ -157,6 +168,8 @@ export function mergeAppData(a: AppDataSnapshot | undefined, b: AppDataSnapshot
|
|
|
157
168
|
? undefined
|
|
158
169
|
: [...new Set([...(a?.receiveIssuedDates ?? []), ...(b?.receiveIssuedDates ?? [])])].sort(),
|
|
159
170
|
// everyone either device knew, each as they were last changed (contactsBackup.ts)
|
|
160
|
-
contacts: mergeContacts(a?.contacts, b?.contacts)
|
|
171
|
+
contacts: mergeContacts(a?.contacts, b?.contacts),
|
|
172
|
+
// one look per wallet, not a list: the first device's (the primary, folded in first) wins
|
|
173
|
+
walletLook: a?.walletLook ?? b?.walletLook
|
|
161
174
|
}
|
|
162
175
|
}
|
package/core/backup/codec.ts
CHANGED
|
@@ -111,7 +111,10 @@ export function estimateEncodedBytes(chunk: SyncChunk): number {
|
|
|
111
111
|
export function estimateAppDataBytes(appData: AppDataSnapshot | undefined): number {
|
|
112
112
|
if (appData == null) return 0
|
|
113
113
|
let bytes =
|
|
114
|
-
(appData.localpayPending?.length ?? 0) +
|
|
114
|
+
(appData.localpayPending?.length ?? 0) +
|
|
115
|
+
(appData.peerpayOutbox?.length ?? 0) +
|
|
116
|
+
(appData.contacts?.length ?? 0) +
|
|
117
|
+
(appData.walletLook?.length ?? 0)
|
|
115
118
|
for (const d of appData.receiveIssuedDates ?? []) bytes += d.length
|
|
116
119
|
return bytes
|
|
117
120
|
}
|
|
@@ -180,6 +183,11 @@ export interface AppDataSnapshot {
|
|
|
180
183
|
receiveIssuedDates?: string[]
|
|
181
184
|
/** The contacts table, as JSON (backup/contactsBackup.ts). */
|
|
182
185
|
contacts?: string
|
|
186
|
+
/**
|
|
187
|
+
* Verbatim value of key_value_store['wallet_look']: how the app draws this wallet (its
|
|
188
|
+
* avatar), as the app's own JSON. The toolbox only carries it.
|
|
189
|
+
*/
|
|
190
|
+
walletLook?: string
|
|
183
191
|
}
|
|
184
192
|
|
|
185
193
|
/**
|
|
@@ -345,6 +353,7 @@ function decodeAppData(raw: unknown): AppDataSnapshot | undefined {
|
|
|
345
353
|
peerpayOutbox?: unknown
|
|
346
354
|
receiveIssuedDates?: unknown
|
|
347
355
|
contacts?: unknown
|
|
356
|
+
walletLook?: unknown
|
|
348
357
|
}
|
|
349
358
|
if (a.localpayPending !== undefined && typeof a.localpayPending !== 'string') {
|
|
350
359
|
throw new Error('backup appData.localpayPending is malformed')
|
|
@@ -361,11 +370,15 @@ function decodeAppData(raw: unknown): AppDataSnapshot | undefined {
|
|
|
361
370
|
if (a.contacts !== undefined && typeof a.contacts !== 'string') {
|
|
362
371
|
throw new Error('backup appData.contacts is malformed')
|
|
363
372
|
}
|
|
373
|
+
if (a.walletLook !== undefined && typeof a.walletLook !== 'string') {
|
|
374
|
+
throw new Error('backup appData.walletLook is malformed')
|
|
375
|
+
}
|
|
364
376
|
return {
|
|
365
377
|
localpayPending: a.localpayPending as string | undefined,
|
|
366
378
|
peerpayOutbox: a.peerpayOutbox as string | undefined,
|
|
367
379
|
receiveIssuedDates: a.receiveIssuedDates as string[] | undefined,
|
|
368
|
-
...(a.contacts !== undefined ? { contacts: a.contacts as string } : {})
|
|
380
|
+
...(a.contacts !== undefined ? { contacts: a.contacts as string } : {}),
|
|
381
|
+
...(a.walletLook !== undefined ? { walletLook: a.walletLook as string } : {})
|
|
369
382
|
}
|
|
370
383
|
}
|
|
371
384
|
|