@bsv/expo-wallet-toolbox 0.25.0 → 0.26.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 +43 -0
- package/core/context/WalletContext.tsx +11 -15
- package/core/i18n/translations.tsx +221 -36
- package/core/identity/handleRegistry/client.ts +110 -16
- package/core/identity/handleRegistry/registration.ts +115 -17
- package/core/index.ts +8 -0
- package/core/net/wocLimiter.ts +133 -0
- package/core/pay/beefRepair.ts +3 -1
- package/core/pay/rails/address.ts +2 -2
- package/core/profiles/profileStore.ts +4 -1
- package/core/services/arcadeBroadcastProvider.ts +6 -0
- package/core/services/exchangeRate.ts +8 -1
- package/core/services/groupSpendingLimit.ts +26 -0
- package/core/services/signingPermissionPolicy.ts +14 -8
- package/core/services/vault/ceremony.ts +13 -0
- package/core/services/vault/ceremonyHost.ts +58 -0
- package/core/services/vault/failedVaultSpend.ts +40 -0
- package/core/services/vault/outputAuthority.ts +13 -6
- package/core/services/vault/transfers.ts +56 -12
- package/core/services/vault/wocLookup.ts +5 -2
- package/core/storage/encryptedDbImage.ts +11 -2
- package/core/theme/tokens.ts +26 -12
- package/package.json +2 -1
- package/ui/components/QRScanner.tsx +24 -22
- package/ui/components/pay/MessageBoxConfig.tsx +10 -16
- package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
- package/ui/components/pay/NearbyFlow.tsx +72 -35
- package/ui/components/pay/PayForm.tsx +27 -19
- package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
- package/ui/components/pay/UniversalSend.tsx +4 -1
- package/ui/components/ui/AlertCard.tsx +3 -2
- package/ui/components/ui/BalancedText.tsx +117 -0
- package/ui/components/ui/ErrorBoundary.tsx +31 -14
- package/ui/components/ui/GroupedList.tsx +28 -22
- package/ui/components/ui/ListRow.tsx +126 -35
- package/ui/components/ui/PermissionSheet.tsx +31 -24
- package/ui/components/ui/PresenceRow.tsx +15 -23
- package/ui/components/ui/Sheet.tsx +11 -17
- package/ui/components/ui/Toast.tsx +13 -17
- package/ui/components/vault/EnrollWizard.tsx +446 -196
- package/ui/components/vault/KeyChooser.tsx +7 -20
- package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
- package/ui/components/wallet/AmountInput.tsx +11 -17
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
- package/ui/index.ts +1 -1
- package/ui/screens/TrustScreen.tsx +49 -61
- package/ui/screens/VaultScreen.tsx +99 -60
- package/ui/screens/VaultTransferScreen.tsx +34 -27
- package/ui/screens/WalletCheckScreen.tsx +25 -24
- package/ui/screens/WalletConfigScreen.tsx +66 -72
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.26.0
|
|
6
|
+
|
|
7
|
+
The BSV Wallet app's launch changes, upstreamed from its patch of 0.25.1: one key tap for a Vault spend, a key removal that can finish, a monthly limit for group spending grants, and a new icon set. No native change: hosts do not rebuild.
|
|
8
|
+
|
|
9
|
+
### Breaking / host action
|
|
10
|
+
|
|
11
|
+
- **`lucide-react-native` ^1.27.0 is a new peer.** The UI draws its glyphs with lucide instead of `@expo/vector-icons`. Install it next to `react-native-svg`. A Jest host maps `^lucide-react-native$` to `lucide-react-native/dist/cjs/lucide-react-native.js`, because Jest resolves its ESM entry otherwise.
|
|
12
|
+
- **The typography tokens name a font family, `Nunito`.** Every ramp in `typography` now sets `fontFamily: 'Nunito'`, so the toolbox screens match a host that embeds Nunito 400, 600 and 700 (for example with the `expo-font` config plugin). A host that does not embed it gets the platform fallback face, and must embed Nunito or override `fontFamily`.
|
|
13
|
+
- **`HandleRegistryClient` has two new required methods, `resolveHandle` and `acceptKey`.** A host with its own client implementation adds them. `createHandleRegistryClient` already has them.
|
|
14
|
+
- **`search()` can return a row with `changedFrom`.** For a complete address (`handle@domain`) whose certificate is valid but whose key is not the one pinned on this device (XR-071), the row comes back flagged with the pinned key instead of being dropped, so the caller can warn. The pin does not move until `acceptKey`. A partial query still drops such a row. A host that shows search rows must check `changedFrom` before it pays. `UniversalSend` drops these rows, as before.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`openVaultSignerSession` and `VaultSignerSession`.** One key session for a spend that also creates a Vault output: a withdrawal with a re-vaulted remainder, or a re-lock. One PIN entry and one tap now cover the new output's possession proof and the input signatures. Before, the person entered the PIN and tapped twice. If the session ends between the two steps (a timeout or a detach), the spend asks for a second tap and does not fail. A cancelled session stays cancelled. A deposit keeps its own ceremony.
|
|
19
|
+
- **`failedVaultSpendBlocksRemoval`.** A failed Vault spend now holds a pending key removal open only when it has a transaction ID and began at or after the removal started. Before, any failed spend in the history blocked the removal for good. A spend with no readable time still blocks.
|
|
20
|
+
- **`groupSpendingLimit` and `clampGroupSpending`.** A site's one-time group grant may spend at most the auto-approve threshold each month. A threshold of 0 removes the spending part of the grant.
|
|
21
|
+
- **`resolveHandle` (`found`, `changed`, `none`, `failed`) and `acceptKey`** on the handle registry client. A one-character handle is now looked up as a complete address (`r@domain`).
|
|
22
|
+
- **`HardwareKeyArtComponent`** type, exported with `EnrollWizard`.
|
|
23
|
+
- **Paid handle claims.** `putCertificate` takes an App Store or Google Play purchase (`StorePurchase`) and a fallback certificate. A refused claim whose reclaim is also refused returns `notRestored` with the handle that did not come back.
|
|
24
|
+
- **15 strings** for the Vault card check and the spending limit, in all 12 locales.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Add-key copy.** A new key is saved but not active until another key confirms it.
|
|
29
|
+
- **Enrollment.** The PIN is confirmed on a page of its own (4 steps per key). Replace and reset of a card first check the blockchain for a vault the card opens, and need an extra acknowledgement.
|
|
30
|
+
- **E2E builds** start a fresh install on testnet when `globalThis.__BSV_E2E_CHAIN` is `test`.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **The encrypted database image** no longer crashes the app when written. The crypto helper returned a `Buffer`, which expo-file-system's `writeBytes` does not accept; it now returns a plain `Uint8Array`.
|
|
35
|
+
|
|
36
|
+
## 0.25.1
|
|
37
|
+
|
|
38
|
+
WhatsOnChain rate limit. No native change: hosts do not rebuild.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- **WhatsOnChain requests no longer exceed the anonymous rate limit.** WhatsOnChain answers more than 3 requests per second with no API key with HTTP 429. The Vault chain scan sent 3 history requests per index back to back, so an empty gap of 20 indexes was 60 requests in one burst, and indexes failed as `rate-limited`. All WhatsOnChain calls now go through one shared limiter: the Vault lookup, address sweeps, BEEF repair, proof refresh, the merkle-path service, the spendability check, broadcast and the exchange rate. It sends at most 2.5 requests per second per API origin, pauses a lane for 1.5 s after a 429, and sends a GET or HEAD once more after a 429. Requests with a `woc-api-key` header use a lane of their own with the same spacing. An empty Vault scan of 20 indexes now takes about 25 s.
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- **`configureWocLimiter`, `resetWocLimiter` and `wocLimitedFetch`.** A host with a paid WhatsOnChain key can lower `keyedIntervalMs`.
|
|
47
|
+
|
|
5
48
|
## 0.25.0
|
|
6
49
|
|
|
7
50
|
Vault hardening: a planted key, a stale scan or a reset on a new phone can no longer cost funds or add a key. No native change: hosts do not rebuild.
|
|
@@ -303,8 +303,10 @@ import { HeaderStore } from '../headers/headerStore'
|
|
|
303
303
|
import { OfflineFirstChaintracks } from '../headers/OfflineFirstChaintracks'
|
|
304
304
|
import { prewarmOwnRoots } from '../headers/prewarm'
|
|
305
305
|
import { syncHeaders } from '../headers/syncHeaders'
|
|
306
|
+
import { groupSpendingLimit, clampGroupSpending } from '../services/groupSpendingLimit'
|
|
306
307
|
import type { HeaderSource } from '../headers/syncHeaders'
|
|
307
308
|
import { startHeaderSyncTriggers } from '../headers/headerSyncTriggers'
|
|
309
|
+
import { wocLimitedFetch } from '../net/wocLimiter'
|
|
308
310
|
|
|
309
311
|
// Auto-approve accounting (misc-p2-04). Previously a single global cooldown
|
|
310
312
|
// timer let multiple paired origins accidentally throttle each other while
|
|
@@ -1396,7 +1398,8 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1396
1398
|
async (args: GroupPermissionRequest, manager?: SigningPolicyPermissionsManager): Promise<void> => {
|
|
1397
1399
|
const { requestID, originator, permissions } = args ?? ({} as GroupPermissionRequest)
|
|
1398
1400
|
if (!requestID || !permissions) return
|
|
1399
|
-
|
|
1401
|
+
const limit = await groupSpendingLimit()
|
|
1402
|
+
groupQueue.enqueue({ requestID, originator, permissions: clampGroupSpending(permissions, limit), manager })
|
|
1400
1403
|
},
|
|
1401
1404
|
[groupQueue.enqueue]
|
|
1402
1405
|
)
|
|
@@ -1681,7 +1684,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1681
1684
|
try {
|
|
1682
1685
|
const headers: Record<string, string> = {}
|
|
1683
1686
|
if (wocApiKey) headers['woc-api-key'] = wocApiKey
|
|
1684
|
-
const res = await
|
|
1687
|
+
const res = await wocLimitedFetch(`${wocBumpBase}/tx/${txid}/proof/bump`, { headers })
|
|
1685
1688
|
if (res.status === 404) {
|
|
1686
1689
|
r.notes.push({ what: 'getMerklePathNoData', when: new Date().toISOString() })
|
|
1687
1690
|
return r
|
|
@@ -4248,7 +4251,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4248
4251
|
const woc = NETWORKS[selectedNetwork].woc
|
|
4249
4252
|
if (!woc) return 'pending'
|
|
4250
4253
|
|
|
4251
|
-
const res = await
|
|
4254
|
+
const res = await wocLimitedFetch(`${woc.apiBase}/v1/bsv/${woc.segment}/tx/${txid}/proof/bump`)
|
|
4252
4255
|
|
|
4253
4256
|
if (res.ok) {
|
|
4254
4257
|
// XR-059 remainder: a compromised/misbehaving configured indexer must
|
|
@@ -4288,7 +4291,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4288
4291
|
txid,
|
|
4289
4292
|
proof,
|
|
4290
4293
|
fetchRawTx: async () => {
|
|
4291
|
-
const r = await
|
|
4294
|
+
const r = await wocLimitedFetch(`${woc.apiBase}/v1/bsv/${woc.segment}/tx/${txid}/hex`)
|
|
4292
4295
|
if (!r.ok) throw new Error(`raw tx fetch failed: ${r.status}`)
|
|
4293
4296
|
// XR-059 remainder: same unbounded-hex-decode gap as the BUMP
|
|
4294
4297
|
// fetch above, on the raw-tx body this time. Throwing here (like
|
|
@@ -4308,7 +4311,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4308
4311
|
// unconfirmed but perfectly healthy tx also has no proof.
|
|
4309
4312
|
let onChain = false
|
|
4310
4313
|
try {
|
|
4311
|
-
const head = await
|
|
4314
|
+
const head = await wocLimitedFetch(`${woc.apiBase}/v1/bsv/${woc.segment}/tx/hash/${txid}`)
|
|
4312
4315
|
onChain = head.ok
|
|
4313
4316
|
// XR-030: any other non-OK (429/500/401/403/...) is a service
|
|
4314
4317
|
// problem, not proof of absence — only a 404 is authoritative.
|
|
@@ -4448,16 +4451,9 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
4448
4451
|
if (!woc) return releasedNote + 'Spendability check needs WhatsOnChain, which this network does not have.'
|
|
4449
4452
|
const wocBase = `${woc.apiBase}/v1/bsv/${woc.segment}`
|
|
4450
4453
|
|
|
4451
|
-
//
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
const throttledFetch = async (url: string, init?: RequestInit): Promise<Response> => {
|
|
4455
|
-
const now = Date.now()
|
|
4456
|
-
const wait = WOC_INTERVAL - (now - lastRequest)
|
|
4457
|
-
if (wait > 0) await new Promise(r => setTimeout(r, wait))
|
|
4458
|
-
lastRequest = Date.now()
|
|
4459
|
-
return fetch(url, init)
|
|
4460
|
-
}
|
|
4454
|
+
// The shared WhatsOnChain limiter paces these, together with every other
|
|
4455
|
+
// WhatsOnChain request the app sends at the same time.
|
|
4456
|
+
const throttledFetch = wocLimitedFetch
|
|
4461
4457
|
|
|
4462
4458
|
try {
|
|
4463
4459
|
const outputs = await storage.findOutputs({
|