@bsv/expo-wallet-toolbox 0.11.8 → 0.12.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 +88 -0
- package/core/config.tsx +1 -1
- package/core/context/WalletContext.tsx +126 -11
- package/core/i18n/translations.tsx +120 -12
- package/core/index.ts +2 -0
- package/core/pay/beefRepair.ts +8 -3
- package/core/pay/rails/address.ts +43 -3
- package/core/pay/rails/handle.ts +1 -1
- package/core/pay/sweeper.ts +39 -4
- package/core/push/events.ts +142 -0
- package/core/push/pushAdvisory.ts +33 -0
- package/core/push/registration.ts +53 -0
- package/core/push/types.ts +31 -0
- package/core/toolboxConfig.ts +24 -1
- package/package.json +1 -1
- package/ui/components/pay/HandleReceive.tsx +141 -16
- package/ui/components/pay/NotificationAdvisoryModal.tsx +124 -0
- package/ui/index.ts +1 -0
- package/ui/screens/PayScreen.tsx +53 -0
- package/ui/screens/SettingsScreen.tsx +72 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Payment push notifications
|
|
6
|
+
|
|
7
|
+
A payment to the user's MessageBox handle can now wake the phone, through a
|
|
8
|
+
push adapter the host supplies. The package never imports a push SDK (its
|
|
9
|
+
native module would have to be linked by every host that merely installs the
|
|
10
|
+
package); the host wraps whichever one it ships and passes it in:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
configureToolbox({ push: myPushAdapter })
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- New exports: `getPushAdapter` and the types `PushAdapter`, `PushPermission`
|
|
17
|
+
and `PushOpenedEvent`. A host that passes no adapter keeps every push
|
|
18
|
+
feature off (no registration, no advisory, no Settings row), and
|
|
19
|
+
`getPushAdapter()` returns `undefined` rather than throwing when the toolbox
|
|
20
|
+
is unconfigured.
|
|
21
|
+
- Members added to `PushAdapter` later will be optional, so an adapter written
|
|
22
|
+
against this version keeps compiling and working.
|
|
23
|
+
- Device registration: once the wallet is up, and again on foreground and on
|
|
24
|
+
token refresh, the FCM token is registered (`registerDevice`) with the
|
|
25
|
+
MessageBox host the inbox reads, bound to the identity the inbox reads for.
|
|
26
|
+
A cached marker of the last registered host, identity and token makes the
|
|
27
|
+
common case no network call at all. Nothing happens without an adapter or
|
|
28
|
+
without notification permission, and a failure is logged (the error message
|
|
29
|
+
only, never the token or identity key) and contained. A sync that hangs is
|
|
30
|
+
given up on after 30 s so it cannot block the ones after it.
|
|
31
|
+
- A tap on a payment notification opens Activity and runs an inbox pass. A push
|
|
32
|
+
that arrives while the app is in the foreground only triggers an inbox pass,
|
|
33
|
+
so the existing credit toast shows and no system banner does. A push never
|
|
34
|
+
credits anything itself.
|
|
35
|
+
|
|
36
|
+
### Notification advisory and Settings row
|
|
37
|
+
|
|
38
|
+
- The first time the user picks Share remote link on Get paid, an in-app modal
|
|
39
|
+
(`NotificationAdvisoryModal`, new export) explains the OS prompt that
|
|
40
|
+
follows: it lets BSV Wallet tell them about a payment while the app is in the
|
|
41
|
+
background. Continue asks the OS; Not now does not. It is shown once, and
|
|
42
|
+
only while the permission is still undetermined.
|
|
43
|
+
- Settings has a Payment notifications row, On or Off. Pressing it turns
|
|
44
|
+
notifications on (the OS prompt) or, once the OS has been asked, opens the OS
|
|
45
|
+
settings. A denial is not forgotten when the screen re-reads the permission.
|
|
46
|
+
The advisory and the row appear only when the host passed a push adapter.
|
|
47
|
+
|
|
48
|
+
### Receive screen: live payments
|
|
49
|
+
|
|
50
|
+
The Receive (handle) screen now listens for payments on a live MessageBox
|
|
51
|
+
connection and keeps polling as a fallback.
|
|
52
|
+
|
|
53
|
+
- While the connection is up, the satoshi inbox is re-read every 15 s and
|
|
54
|
+
immediately when a live payment arrives; the token inbox stays on its 5 s
|
|
55
|
+
tick. Without a live connection both poll every 5 s as before.
|
|
56
|
+
- Each listening session uses a fresh client. A `MessageBoxClient` remembers
|
|
57
|
+
the rooms it joined across a disconnect, so reusing one would reconnect the
|
|
58
|
+
socket without re-joining the room and slow the poll for nothing.
|
|
59
|
+
- The listener runs only while the screen is focused and the app is active.
|
|
60
|
+
|
|
61
|
+
### Address payments: faster sweep
|
|
62
|
+
|
|
63
|
+
An address payment reaches no one, so there is nothing to push; the wallet
|
|
64
|
+
finds it by looking.
|
|
65
|
+
|
|
66
|
+
- The address sweep now runs every 5 s instead of every 30 s (foreground
|
|
67
|
+
only, as before).
|
|
68
|
+
- `WocConfig` gains an optional `apiKey`, and the new `wocRequestInit(woc)`
|
|
69
|
+
export turns it into the `woc-api-key` request header. The header is sent
|
|
70
|
+
only when a caller sets `apiKey`; the key is never logged. `wocConfigFor`
|
|
71
|
+
does not set it, so the address sweep, BEEF repair, recovery and the other
|
|
72
|
+
address-rail calls stay on WhatsOnChain's unauthenticated limit: the host's
|
|
73
|
+
app-wide key is shared with broadcast, and a 5 s poll across every install
|
|
74
|
+
would drain it.
|
|
75
|
+
- HTTP 429 from WhatsOnChain throws the new `WocRateLimited` error (exported
|
|
76
|
+
from the address rail), which stops the pass and makes the sweep sit out the
|
|
77
|
+
next 30 s instead of retrying on every tick.
|
|
78
|
+
- New sweeper exports: `SWEEP_BACKOFF_TICKS`, `consumeBackoff` and
|
|
79
|
+
`backoffAfterSweepError`.
|
|
80
|
+
|
|
81
|
+
### Translations
|
|
82
|
+
|
|
83
|
+
New strings in all 12 locales: the advisory title, body and buttons, and the
|
|
84
|
+
Settings row and its On and Off values.
|
|
85
|
+
|
|
86
|
+
### Default MessageBox host
|
|
87
|
+
|
|
88
|
+
- The default MessageBox host is now https://messagebox.bsvblockchain.tech
|
|
89
|
+
(was gmb.bsvblockchain.tech). A saved custom host is unchanged.
|
|
90
|
+
|
|
3
91
|
## 0.11.8
|
|
4
92
|
|
|
5
93
|
### Grouped permission prompt
|
package/core/config.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export function toWalletChain(chain: AppChain): WalletChain {
|
|
|
19
19
|
|
|
20
20
|
export const DEFAULT_WAB_URL = 'noWAB'
|
|
21
21
|
export const DEFAULT_STORAGE_URL = 'local'
|
|
22
|
-
export const DEFAULT_MESSAGEBOX_URL = 'https://
|
|
22
|
+
export const DEFAULT_MESSAGEBOX_URL = 'https://messagebox.bsvblockchain.tech'
|
|
23
23
|
/**
|
|
24
24
|
* Encrypted wallet-backup log.
|
|
25
25
|
*
|
|
@@ -136,7 +136,7 @@ const MANDALA_OUTPOINT_LIST_MAX_PAGES = 1000
|
|
|
136
136
|
|
|
137
137
|
import type { AppChain } from '../config'
|
|
138
138
|
import { DEFAULT_STORAGE_URL, DEFAULT_CHAIN, ADMIN_ORIGINATOR, toWalletChain } from '../config'
|
|
139
|
-
import { getBackupUrl, getMandalaEndpoints } from '../toolboxConfig'
|
|
139
|
+
import { getBackupUrl, getMandalaEndpoints, getPushAdapter } from '../toolboxConfig'
|
|
140
140
|
import {
|
|
141
141
|
DEFAULT_AUTO_APPROVE_THRESHOLD,
|
|
142
142
|
AUTO_APPROVE_COOLDOWN_MS,
|
|
@@ -211,6 +211,8 @@ import { replayPendingAborts, verifyDeclinedAborts } from '../localpay/pendingAb
|
|
|
211
211
|
import { TaskSendOffline } from '../monitor/TaskSendOffline'
|
|
212
212
|
import { MONITOR_STALL_MS, MonitorSupervisor } from '../monitor/MonitorSupervisor'
|
|
213
213
|
import { TaskCreditInbox } from '../monitor/TaskCreditInbox'
|
|
214
|
+
import { attachPushHandlers, coalesceRuns } from '../push/events'
|
|
215
|
+
import { syncPushRegistration } from '../push/registration'
|
|
214
216
|
import { drainUnsentEntries, TaskDrainOutbox } from '../monitor/TaskDrainOutbox'
|
|
215
217
|
import { TaskBackupPush } from '../monitor/TaskBackupPush'
|
|
216
218
|
import { pushOnce } from '../backup/push'
|
|
@@ -245,7 +247,14 @@ import {
|
|
|
245
247
|
import { getOutboxEntries, pruneExpiredSent, unsentEntries } from '../peerpay/outbox'
|
|
246
248
|
import { MAX_HEX_RESPONSE_CHARS, wocConfigFor } from '../pay/rails/address'
|
|
247
249
|
import { PeerPayClient } from '@bsv/message-box-client'
|
|
248
|
-
import {
|
|
250
|
+
import {
|
|
251
|
+
SWEEP_INTERVAL_MS,
|
|
252
|
+
backoffAfterSweepError,
|
|
253
|
+
consumeBackoff,
|
|
254
|
+
runSweep,
|
|
255
|
+
shouldSweepNow,
|
|
256
|
+
sweptTotal
|
|
257
|
+
} from '../pay/sweeper'
|
|
249
258
|
import { formatAmount } from '../amountFormatHelpers'
|
|
250
259
|
import { useTranslation } from 'react-i18next'
|
|
251
260
|
import { HEADER_CHECKPOINTS } from '../headers/checkpoints'
|
|
@@ -706,6 +715,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
706
715
|
const appStateRef = useRef<AppStateStatus>(AppState.currentState)
|
|
707
716
|
const monitorSupervisorRef = useRef<MonitorSupervisor | null>(null)
|
|
708
717
|
const monitorRef = useRef<Monitor | null>(null)
|
|
718
|
+
// Push notifications. `pushDetachRef` removes the adapter listeners the
|
|
719
|
+
// current build attached; `pushSyncRef` is that build's registration sync,
|
|
720
|
+
// which the foreground handler calls so a permission granted from OS Settings
|
|
721
|
+
// registers on return. Both are cleared wherever the monitor is torn down.
|
|
722
|
+
const pushDetachRef = useRef<(() => void) | undefined>(undefined)
|
|
723
|
+
const pushSyncRef = useRef<(() => Promise<void>) | undefined>(undefined)
|
|
709
724
|
// The offline-first chain tracker and the header store it wraps. Populated
|
|
710
725
|
// in buildWallet (tracker synchronously, store once the background open
|
|
711
726
|
// finishes); the reconnect top-up effect below reuses both rather than
|
|
@@ -1899,6 +1914,18 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1899
1914
|
monitorOptions.saveLastSSEEventId = (id: string) => phoneStorage!.setKeyValue(SSE_KEY, id)
|
|
1900
1915
|
}
|
|
1901
1916
|
const monitor = await createWalletMonitor(monitorOptions)
|
|
1917
|
+
// The MessageBox host this wallet talks to, or undefined when the
|
|
1918
|
+
// user turned MessageBox off. One definition for the CreditInbox task
|
|
1919
|
+
// and the push registration below, so a device token is always
|
|
1920
|
+
// registered on exactly the host the inbox reads.
|
|
1921
|
+
const readMessageBoxHost = async (): Promise<string | undefined> => {
|
|
1922
|
+
const saved = await AsyncStorage.getItem(MESSAGE_BOX_URL_KEY)
|
|
1923
|
+
return saved === NO_MESSAGE_BOX
|
|
1924
|
+
? undefined
|
|
1925
|
+
: !saved || saved === LEGACY_MESSAGE_BOX_URL
|
|
1926
|
+
? DEFAULT_MESSAGE_BOX_URL
|
|
1927
|
+
: saved
|
|
1928
|
+
}
|
|
1902
1929
|
|
|
1903
1930
|
// Release held offline transactions when signal returns — registered
|
|
1904
1931
|
// BEFORE the defaults, and the order matters. Monitor.runOnce collects
|
|
@@ -1990,13 +2017,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
1990
2017
|
new TaskCreditInbox(
|
|
1991
2018
|
monitor,
|
|
1992
2019
|
async () => {
|
|
1993
|
-
const
|
|
1994
|
-
const messageBoxUrl =
|
|
1995
|
-
saved === NO_MESSAGE_BOX
|
|
1996
|
-
? undefined
|
|
1997
|
-
: !saved || saved === LEGACY_MESSAGE_BOX_URL
|
|
1998
|
-
? DEFAULT_MESSAGE_BOX_URL
|
|
1999
|
-
: saved
|
|
2020
|
+
const messageBoxUrl = await readMessageBoxHost()
|
|
2000
2021
|
if (!messageBoxUrl) return { accepted: 0, attention: 0, pending: false }
|
|
2001
2022
|
let client: PeerPayClient
|
|
2002
2023
|
try {
|
|
@@ -2296,6 +2317,67 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2296
2317
|
return null
|
|
2297
2318
|
}
|
|
2298
2319
|
monitorRef.current = monitor
|
|
2320
|
+
|
|
2321
|
+
// Push: a payment for this identity wakes the phone (the MessageBox
|
|
2322
|
+
// host sends the FCM message), and a push only ever means "look at
|
|
2323
|
+
// the inbox now" — the credit, sound and toast come from the
|
|
2324
|
+
// CreditInbox pass registered above, so nothing is shown or credited
|
|
2325
|
+
// twice.
|
|
2326
|
+
//
|
|
2327
|
+
// Wired HERE, after the supersession check and with no await between
|
|
2328
|
+
// the two, on purpose. A build that was replaced mid-flight never
|
|
2329
|
+
// reaches this line, so it can neither register a token against a
|
|
2330
|
+
// wallet being torn down nor detach the listeners a newer build wired.
|
|
2331
|
+
// Every teardown clears the refs before it yields, so a build that is
|
|
2332
|
+
// superseded after this line is cleaned up by whoever superseded it.
|
|
2333
|
+
//
|
|
2334
|
+
// Registration reads the same host as the CreditInbox task and derives
|
|
2335
|
+
// the identity key and the client's wallet from the SAME
|
|
2336
|
+
// permissionsManager, so the token is bound to the identity the inbox
|
|
2337
|
+
// is actually reading. Startup, token refresh and foreground can all
|
|
2338
|
+
// fire it at once; coalesceRuns never runs two at a time and folds an
|
|
2339
|
+
// overlapping burst into one rerun. Push is an enhancement: nothing
|
|
2340
|
+
// here may throw into the build.
|
|
2341
|
+
if (phoneStorage) {
|
|
2342
|
+
const syncPush = coalesceRuns(async () => {
|
|
2343
|
+
const adapter = getPushAdapter()
|
|
2344
|
+
if (!adapter) return
|
|
2345
|
+
const host = await readMessageBoxHost()
|
|
2346
|
+
let identityKey: string
|
|
2347
|
+
try {
|
|
2348
|
+
identityKey = (await permissionsManager.getPublicKey({ identityKey: true }, adminOriginator)).publicKey
|
|
2349
|
+
} catch (e) {
|
|
2350
|
+
console.warn(
|
|
2351
|
+
`[push] could not read the identity key; skipping registration: ${e instanceof Error ? e.message : String(e)}`
|
|
2352
|
+
)
|
|
2353
|
+
return
|
|
2354
|
+
}
|
|
2355
|
+
const result = await syncPushRegistration({
|
|
2356
|
+
adapter,
|
|
2357
|
+
host,
|
|
2358
|
+
identityKey,
|
|
2359
|
+
makeClient: h =>
|
|
2360
|
+
new MessageBoxClient({
|
|
2361
|
+
host: h,
|
|
2362
|
+
walletClient: permissionsManager as never,
|
|
2363
|
+
originator: adminOriginator
|
|
2364
|
+
})
|
|
2365
|
+
})
|
|
2366
|
+
if (result === 'failed') console.warn('[push] device registration with the MessageBox host failed')
|
|
2367
|
+
})
|
|
2368
|
+
pushSyncRef.current = syncPush
|
|
2369
|
+
void syncPush()
|
|
2370
|
+
const pushAdapter = getPushAdapter()
|
|
2371
|
+
pushDetachRef.current?.()
|
|
2372
|
+
pushDetachRef.current = pushAdapter
|
|
2373
|
+
? attachPushHandlers({
|
|
2374
|
+
adapter: pushAdapter,
|
|
2375
|
+
requestInboxPass: () => TaskCreditInbox.requestNow(),
|
|
2376
|
+
openActivity: () => loadExpoRouter().router.push('/transactions'),
|
|
2377
|
+
onTokenRefresh: () => void syncPush()
|
|
2378
|
+
})
|
|
2379
|
+
: undefined
|
|
2380
|
+
}
|
|
2299
2381
|
InteractionManager.runAfterInteractions(() => {
|
|
2300
2382
|
// Re-check identity: stopTasks() before startTasks() is a no-op
|
|
2301
2383
|
// (it only clears a flag the loop hasn't set yet), so a rebuild/
|
|
@@ -2584,6 +2666,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2584
2666
|
vaultStore.clearScope()
|
|
2585
2667
|
vaultCeremony.cancel()
|
|
2586
2668
|
|
|
2669
|
+
// Push listeners and the registration sync belong to the wallet being
|
|
2670
|
+
// torn down; nothing may fire them against it from here on.
|
|
2671
|
+
pushDetachRef.current?.()
|
|
2672
|
+
pushDetachRef.current = undefined
|
|
2673
|
+
pushSyncRef.current = undefined
|
|
2674
|
+
|
|
2587
2675
|
// Stop any running monitor and let its current pass drain before the
|
|
2588
2676
|
// storage teardown below closes the connection under it.
|
|
2589
2677
|
{
|
|
@@ -2650,6 +2738,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2650
2738
|
vaultStore.clearScope()
|
|
2651
2739
|
vaultCeremony.cancel()
|
|
2652
2740
|
|
|
2741
|
+
// Push listeners and the registration sync belong to the wallet being
|
|
2742
|
+
// torn down; nothing may fire them against it from here on.
|
|
2743
|
+
pushDetachRef.current?.()
|
|
2744
|
+
pushDetachRef.current = undefined
|
|
2745
|
+
pushSyncRef.current = undefined
|
|
2746
|
+
|
|
2653
2747
|
// Stop any running monitor and let its current pass drain before the
|
|
2654
2748
|
// storage teardown below closes the connection under it.
|
|
2655
2749
|
{
|
|
@@ -2861,9 +2955,16 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2861
2955
|
// the first NetInfo event would delay the common case.
|
|
2862
2956
|
let online = true
|
|
2863
2957
|
const woc = wocConfigFor(selectedNetwork)
|
|
2958
|
+
// Ticks still to sit out after a WhatsOnChain 429. Every tick spends one,
|
|
2959
|
+
// including the app-active and back-online ones, so none of them can reach
|
|
2960
|
+
// WhatsOnChain while the backoff is pending.
|
|
2961
|
+
let backoffTicks = 0
|
|
2864
2962
|
|
|
2865
2963
|
const tick = async () => {
|
|
2866
2964
|
if (cancelled) return
|
|
2965
|
+
const backoff = consumeBackoff(backoffTicks)
|
|
2966
|
+
backoffTicks = backoff.remaining
|
|
2967
|
+
if (backoff.skip) return
|
|
2867
2968
|
if (
|
|
2868
2969
|
!shouldSweepNow({
|
|
2869
2970
|
walletBuilt: true,
|
|
@@ -2895,8 +2996,10 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
2895
2996
|
type: 'success'
|
|
2896
2997
|
})
|
|
2897
2998
|
}
|
|
2898
|
-
} catch {
|
|
2899
|
-
// Best-effort. Every address stays watched and the next tick retries
|
|
2999
|
+
} catch (error) {
|
|
3000
|
+
// Best-effort. Every address stays watched and the next tick retries —
|
|
3001
|
+
// except after a rate limit, which sits out SWEEP_BACKOFF_TICKS first.
|
|
3002
|
+
backoffTicks = backoffAfterSweepError(error, backoffTicks)
|
|
2900
3003
|
} finally {
|
|
2901
3004
|
addressSweepingRef.current = false
|
|
2902
3005
|
}
|
|
@@ -3032,6 +3135,9 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
3032
3135
|
if (TaskSendOffline.hasPending) TaskSendOffline.requestNow()
|
|
3033
3136
|
TaskCreditInbox.requestNow()
|
|
3034
3137
|
if (TaskDrainOutbox.hasPending) TaskDrainOutbox.requestNow()
|
|
3138
|
+
// A notification permission granted from OS Settings, or a token the OS
|
|
3139
|
+
// rotated while away, registers on return. No-ops when already current.
|
|
3140
|
+
void pushSyncRef.current?.()
|
|
3035
3141
|
}
|
|
3036
3142
|
|
|
3037
3143
|
appStateRef.current = nextAppState
|
|
@@ -3075,6 +3181,9 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
3075
3181
|
try {
|
|
3076
3182
|
monitorRef.current?.stopTasks()
|
|
3077
3183
|
} catch {}
|
|
3184
|
+
pushDetachRef.current?.()
|
|
3185
|
+
pushDetachRef.current = undefined
|
|
3186
|
+
pushSyncRef.current = undefined
|
|
3078
3187
|
if (ledgerBumpTimerRef.current) {
|
|
3079
3188
|
clearTimeout(ledgerBumpTimerRef.current)
|
|
3080
3189
|
ledgerBumpTimerRef.current = null
|
|
@@ -3104,6 +3213,12 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
|
|
|
3104
3213
|
// comment warned about — everything above this point already ran
|
|
3105
3214
|
// synchronously before any promise existed to await.
|
|
3106
3215
|
return (async () => {
|
|
3216
|
+
// Push listeners and the registration sync belong to the wallet being
|
|
3217
|
+
// torn down; nothing may fire them against it from here on.
|
|
3218
|
+
pushDetachRef.current?.()
|
|
3219
|
+
pushDetachRef.current = undefined
|
|
3220
|
+
pushSyncRef.current = undefined
|
|
3221
|
+
|
|
3107
3222
|
// Tear the wallet down the same way rebuildWallet does. Logout used to
|
|
3108
3223
|
// skip this, which orphaned a running monitor AND left the SQLite
|
|
3109
3224
|
// connection open: a re-import of the same phrase then opened a second
|
|
@@ -951,10 +951,19 @@ const resources = {
|
|
|
951
951
|
home_payments_unsent: '{{count}} payments not delivered',
|
|
952
952
|
pay_copy: 'Copy',
|
|
953
953
|
pay_share_link: 'Share link',
|
|
954
|
-
pay_address_watching: 'Money sent here is added to your wallet automatically.',
|
|
954
|
+
pay_address_watching: 'Money sent here is added to your wallet automatically, but only while the app is open.',
|
|
955
955
|
pay_address_earlier_day: 'Reach an earlier day',
|
|
956
956
|
pay_address_sweep_now: 'Check this BSV address now',
|
|
957
957
|
pay_address_swept: 'Received {{amount}}',
|
|
958
|
+
push_advisory_title: "Get notified when you're paid",
|
|
959
|
+
push_advisory_body:
|
|
960
|
+
'Next, your phone will ask to allow notifications. This lets BSV Wallet tell you when a payment arrives, even while the app is in the background.',
|
|
961
|
+
push_advisory_continue: 'Continue',
|
|
962
|
+
push_advisory_not_now: 'Not now',
|
|
963
|
+
notifications: 'Notifications',
|
|
964
|
+
push_settings_row: 'Payment notifications',
|
|
965
|
+
push_settings_on: 'On',
|
|
966
|
+
push_settings_off: 'Off',
|
|
958
967
|
|
|
959
968
|
check_wallet: 'Troubleshooting',
|
|
960
969
|
settings_version: 'v{{version}}',
|
|
@@ -1952,10 +1961,19 @@ const resources = {
|
|
|
1952
1961
|
home_payments_unsent: '{{count}} 笔付款未送达',
|
|
1953
1962
|
pay_copy: '复制',
|
|
1954
1963
|
pay_share_link: '分享链接',
|
|
1955
|
-
pay_address_watching: '
|
|
1964
|
+
pay_address_watching: '发送到此地址的款项会自动添加到您的钱包,但仅限应用打开时。',
|
|
1956
1965
|
pay_address_earlier_day: '回到更早的日期',
|
|
1957
1966
|
pay_address_sweep_now: '立即检查此 BSV 地址',
|
|
1958
1967
|
pay_address_swept: '已收到 {{amount}}',
|
|
1968
|
+
push_advisory_title: '收款时收到通知',
|
|
1969
|
+
push_advisory_body:
|
|
1970
|
+
'接下来,您的手机会请求允许发送通知。这样即使应用在后台运行,BSV Wallet 也能在款项到账时通知您。',
|
|
1971
|
+
push_advisory_continue: '继续',
|
|
1972
|
+
push_advisory_not_now: '暂不',
|
|
1973
|
+
notifications: '通知',
|
|
1974
|
+
push_settings_row: '支付通知',
|
|
1975
|
+
push_settings_on: '开',
|
|
1976
|
+
push_settings_off: '关',
|
|
1959
1977
|
|
|
1960
1978
|
check_wallet: '疑难解答',
|
|
1961
1979
|
settings_version: 'v{{version}}',
|
|
@@ -2990,10 +3008,19 @@ const resources = {
|
|
|
2990
3008
|
home_payments_unsent: '{{count}} भुगतान डिलीवर नहीं हुए',
|
|
2991
3009
|
pay_copy: 'कॉपी',
|
|
2992
3010
|
pay_share_link: 'लिंक साझा करें',
|
|
2993
|
-
pay_address_watching: 'यहां भेजा गया पैसा अपने आप आपके वॉलेट में जुड़ जाता
|
|
3011
|
+
pay_address_watching: 'यहां भेजा गया पैसा अपने आप आपके वॉलेट में जुड़ जाता है, लेकिन केवल तब जब ऐप खुला हो।',
|
|
2994
3012
|
pay_address_earlier_day: 'किसी पिछले दिन तक जाएं',
|
|
2995
3013
|
pay_address_sweep_now: 'यह BSV पता अभी जांचें',
|
|
2996
3014
|
pay_address_swept: '{{amount}} प्राप्त हुआ',
|
|
3015
|
+
push_advisory_title: 'भुगतान मिलने पर सूचना पाएं',
|
|
3016
|
+
push_advisory_body:
|
|
3017
|
+
'आगे, आपका फ़ोन सूचनाओं की अनुमति माँगेगा। इससे ऐप बैकग्राउंड में होने पर भी BSV Wallet आपको बता सकेगा कि भुगतान आ गया है।',
|
|
3018
|
+
push_advisory_continue: 'जारी रखें',
|
|
3019
|
+
push_advisory_not_now: 'अभी नहीं',
|
|
3020
|
+
notifications: 'सूचनाएं',
|
|
3021
|
+
push_settings_row: 'भुगतान सूचनाएं',
|
|
3022
|
+
push_settings_on: 'चालू',
|
|
3023
|
+
push_settings_off: 'बंद',
|
|
2997
3024
|
|
|
2998
3025
|
check_wallet: 'समस्या निवारण',
|
|
2999
3026
|
settings_version: 'v{{version}}',
|
|
@@ -4052,10 +4079,19 @@ const resources = {
|
|
|
4052
4079
|
home_payments_unsent: '{{count}} pagos sin entregar',
|
|
4053
4080
|
pay_copy: 'Copiar',
|
|
4054
4081
|
pay_share_link: 'Compartir enlace',
|
|
4055
|
-
pay_address_watching: 'El dinero enviado aquí se añade a tu billetera automáticamente.',
|
|
4082
|
+
pay_address_watching: 'El dinero enviado aquí se añade a tu billetera automáticamente, pero solo mientras la app está abierta.',
|
|
4056
4083
|
pay_address_earlier_day: 'Ir a un día anterior',
|
|
4057
4084
|
pay_address_sweep_now: 'Comprobar esta dirección BSV ahora',
|
|
4058
4085
|
pay_address_swept: 'Recibido {{amount}}',
|
|
4086
|
+
push_advisory_title: 'Recibe un aviso cuando te paguen',
|
|
4087
|
+
push_advisory_body:
|
|
4088
|
+
'A continuación, tu teléfono te pedirá permiso para enviar notificaciones. Así BSV Wallet podrá avisarte cuando llegue un pago, incluso con la app en segundo plano.',
|
|
4089
|
+
push_advisory_continue: 'Continuar',
|
|
4090
|
+
push_advisory_not_now: 'Ahora no',
|
|
4091
|
+
notifications: 'Notificaciones',
|
|
4092
|
+
push_settings_row: 'Notificaciones de pago',
|
|
4093
|
+
push_settings_on: 'Activadas',
|
|
4094
|
+
push_settings_off: 'Desactivadas',
|
|
4059
4095
|
|
|
4060
4096
|
check_wallet: 'Solución de problemas',
|
|
4061
4097
|
settings_version: 'v{{version}}',
|
|
@@ -5127,10 +5163,19 @@ const resources = {
|
|
|
5127
5163
|
home_payments_unsent: '{{count}} paiements non remis',
|
|
5128
5164
|
pay_copy: 'Copier',
|
|
5129
5165
|
pay_share_link: 'Partager le lien',
|
|
5130
|
-
pay_address_watching: 'L’argent envoyé ici est ajouté automatiquement à votre portefeuille.',
|
|
5166
|
+
pay_address_watching: 'L’argent envoyé ici est ajouté automatiquement à votre portefeuille, mais uniquement lorsque l’app est ouverte.',
|
|
5131
5167
|
pay_address_earlier_day: 'Revenir à un jour précédent',
|
|
5132
5168
|
pay_address_sweep_now: 'Vérifier cette adresse BSV maintenant',
|
|
5133
5169
|
pay_address_swept: '{{amount}} reçu',
|
|
5170
|
+
push_advisory_title: 'Soyez prévenu quand vous êtes payé',
|
|
5171
|
+
push_advisory_body:
|
|
5172
|
+
'Votre téléphone va maintenant demander l’autorisation d’envoyer des notifications. Ainsi, BSV Wallet pourra vous prévenir dès qu’un paiement arrive, même lorsque l’application est en arrière-plan.',
|
|
5173
|
+
push_advisory_continue: 'Continuer',
|
|
5174
|
+
push_advisory_not_now: 'Plus tard',
|
|
5175
|
+
notifications: 'Notifications',
|
|
5176
|
+
push_settings_row: 'Notifications de paiement',
|
|
5177
|
+
push_settings_on: 'Activées',
|
|
5178
|
+
push_settings_off: 'Désactivées',
|
|
5134
5179
|
|
|
5135
5180
|
check_wallet: 'Dépannage',
|
|
5136
5181
|
settings_version: 'v{{version}}',
|
|
@@ -6154,10 +6199,19 @@ const resources = {
|
|
|
6154
6199
|
home_payments_unsent: '{{count}} دفعات لم تُسلَّم',
|
|
6155
6200
|
pay_copy: 'نسخ',
|
|
6156
6201
|
pay_share_link: 'مشاركة الرابط',
|
|
6157
|
-
pay_address_watching: 'الأموال المرسلة إلى هذا العنوان تُضاف إلى محفظتك
|
|
6202
|
+
pay_address_watching: 'الأموال المرسلة إلى هذا العنوان تُضاف إلى محفظتك تلقائيًا، ولكن فقط أثناء فتح التطبيق.',
|
|
6158
6203
|
pay_address_earlier_day: 'الانتقال إلى يوم أسبق',
|
|
6159
6204
|
pay_address_sweep_now: 'تحقق من عنوان BSV هذا الآن',
|
|
6160
6205
|
pay_address_swept: 'تم استلام {{amount}}',
|
|
6206
|
+
push_advisory_title: 'اعرف فورًا عندما تتلقى دفعة',
|
|
6207
|
+
push_advisory_body:
|
|
6208
|
+
'بعد ذلك، سيطلب هاتفك السماح بالإشعارات. يتيح ذلك لـ BSV Wallet إخبارك عند وصول دفعة، حتى عندما يكون التطبيق في الخلفية.',
|
|
6209
|
+
push_advisory_continue: 'استمرار',
|
|
6210
|
+
push_advisory_not_now: 'ليس الآن',
|
|
6211
|
+
notifications: 'الإشعارات',
|
|
6212
|
+
push_settings_row: 'إشعارات الدفع',
|
|
6213
|
+
push_settings_on: 'تشغيل',
|
|
6214
|
+
push_settings_off: 'إيقاف',
|
|
6161
6215
|
|
|
6162
6216
|
check_wallet: 'استكشاف الأخطاء',
|
|
6163
6217
|
settings_version: 'v{{version}}',
|
|
@@ -7205,10 +7259,19 @@ const resources = {
|
|
|
7205
7259
|
home_payments_unsent: '{{count}} pagamentos não entregues',
|
|
7206
7260
|
pay_copy: 'Copiar',
|
|
7207
7261
|
pay_share_link: 'Compartilhar link',
|
|
7208
|
-
pay_address_watching: 'O dinheiro enviado para cá é adicionado à sua carteira automaticamente.',
|
|
7262
|
+
pay_address_watching: 'O dinheiro enviado para cá é adicionado à sua carteira automaticamente, mas só enquanto o app estiver aberto.',
|
|
7209
7263
|
pay_address_earlier_day: 'Voltar para um dia anterior',
|
|
7210
7264
|
pay_address_sweep_now: 'Verificar este endereço BSV agora',
|
|
7211
7265
|
pay_address_swept: '{{amount}} recebido',
|
|
7266
|
+
push_advisory_title: 'Receba um aviso quando você for pago',
|
|
7267
|
+
push_advisory_body:
|
|
7268
|
+
'Em seguida, seu celular vai pedir permissão para enviar notificações. Assim, a BSV Wallet pode avisar você quando um pagamento chegar, mesmo com o app em segundo plano.',
|
|
7269
|
+
push_advisory_continue: 'Continuar',
|
|
7270
|
+
push_advisory_not_now: 'Agora não',
|
|
7271
|
+
notifications: 'Notificações',
|
|
7272
|
+
push_settings_row: 'Notificações de pagamento',
|
|
7273
|
+
push_settings_on: 'Ativadas',
|
|
7274
|
+
push_settings_off: 'Desativadas',
|
|
7212
7275
|
|
|
7213
7276
|
check_wallet: 'Solução de problemas',
|
|
7214
7277
|
settings_version: 'v{{version}}',
|
|
@@ -8255,10 +8318,19 @@ const resources = {
|
|
|
8255
8318
|
home_payments_unsent: '{{count}}টি পেমেন্ট পৌঁছায়নি',
|
|
8256
8319
|
pay_copy: 'কপি',
|
|
8257
8320
|
pay_share_link: 'লিঙ্ক শেয়ার করুন',
|
|
8258
|
-
pay_address_watching: 'এই ঠিকানায় পাঠানো অর্থ স্বয়ংক্রিয়ভাবে আপনার ওয়ালেটে যোগ
|
|
8321
|
+
pay_address_watching: 'এই ঠিকানায় পাঠানো অর্থ স্বয়ংক্রিয়ভাবে আপনার ওয়ালেটে যোগ হয়, তবে শুধু অ্যাপ খোলা থাকলে।',
|
|
8259
8322
|
pay_address_earlier_day: 'আগের কোনো দিনে যান',
|
|
8260
8323
|
pay_address_sweep_now: 'এই BSV ঠিকানাটি এখনই যাচাই করুন',
|
|
8261
8324
|
pay_address_swept: '{{amount}} পাওয়া গেছে',
|
|
8325
|
+
push_advisory_title: 'পেমেন্ট পেলে নোটিফিকেশন পান',
|
|
8326
|
+
push_advisory_body:
|
|
8327
|
+
'এরপর আপনার ফোন নোটিফিকেশনের অনুমতি চাইবে। এতে অ্যাপ ব্যাকগ্রাউন্ডে থাকলেও পেমেন্ট এলে BSV Wallet আপনাকে জানাতে পারবে।',
|
|
8328
|
+
push_advisory_continue: 'চালিয়ে যান',
|
|
8329
|
+
push_advisory_not_now: 'এখন নয়',
|
|
8330
|
+
notifications: 'নোটিফিকেশন',
|
|
8331
|
+
push_settings_row: 'পেমেন্ট নোটিফিকেশন',
|
|
8332
|
+
push_settings_on: 'চালু',
|
|
8333
|
+
push_settings_off: 'বন্ধ',
|
|
8262
8334
|
|
|
8263
8335
|
check_wallet: 'সমস্যা সমাধান',
|
|
8264
8336
|
settings_version: 'v{{version}}',
|
|
@@ -9312,10 +9384,19 @@ const resources = {
|
|
|
9312
9384
|
home_payments_unsent: 'Недоставленных платежей: {{count}}',
|
|
9313
9385
|
pay_copy: 'Копировать',
|
|
9314
9386
|
pay_share_link: 'Поделиться ссылкой',
|
|
9315
|
-
pay_address_watching: 'Деньги, отправленные на этот адрес, добавляются в ваш кошелёк
|
|
9387
|
+
pay_address_watching: 'Деньги, отправленные на этот адрес, добавляются в ваш кошелёк автоматически, но только пока приложение открыто.',
|
|
9316
9388
|
pay_address_earlier_day: 'Перейти к более раннему дню',
|
|
9317
9389
|
pay_address_sweep_now: 'Проверить этот BSV-адрес сейчас',
|
|
9318
9390
|
pay_address_swept: 'Получено {{amount}}',
|
|
9391
|
+
push_advisory_title: 'Узнавайте о поступлении платежа',
|
|
9392
|
+
push_advisory_body:
|
|
9393
|
+
'Далее телефон запросит разрешение на уведомления. Благодаря этому BSV Wallet сообщит вам о поступлении платежа, даже если приложение работает в фоновом режиме.',
|
|
9394
|
+
push_advisory_continue: 'Продолжить',
|
|
9395
|
+
push_advisory_not_now: 'Не сейчас',
|
|
9396
|
+
notifications: 'Уведомления',
|
|
9397
|
+
push_settings_row: 'Уведомления о платежах',
|
|
9398
|
+
push_settings_on: 'Вкл.',
|
|
9399
|
+
push_settings_off: 'Выкл.',
|
|
9319
9400
|
|
|
9320
9401
|
check_wallet: 'Диагностика',
|
|
9321
9402
|
settings_version: 'v{{version}}',
|
|
@@ -10369,10 +10450,19 @@ const resources = {
|
|
|
10369
10450
|
home_payments_unsent: '{{count}} pembayaran belum terkirim',
|
|
10370
10451
|
pay_copy: 'Salin',
|
|
10371
10452
|
pay_share_link: 'Bagikan tautan',
|
|
10372
|
-
pay_address_watching: 'Uang yang dikirim ke sini otomatis ditambahkan ke dompet Anda.',
|
|
10453
|
+
pay_address_watching: 'Uang yang dikirim ke sini otomatis ditambahkan ke dompet Anda, tetapi hanya saat aplikasi terbuka.',
|
|
10373
10454
|
pay_address_earlier_day: 'Buka hari sebelumnya',
|
|
10374
10455
|
pay_address_sweep_now: 'Periksa alamat BSV ini sekarang',
|
|
10375
10456
|
pay_address_swept: 'Diterima {{amount}}',
|
|
10457
|
+
push_advisory_title: 'Dapatkan pemberitahuan saat Anda dibayar',
|
|
10458
|
+
push_advisory_body:
|
|
10459
|
+
'Selanjutnya, ponsel Anda akan meminta izin untuk mengirim notifikasi. Dengan begitu, BSV Wallet dapat memberi tahu Anda saat pembayaran masuk, bahkan ketika aplikasi berjalan di latar belakang.',
|
|
10460
|
+
push_advisory_continue: 'Lanjutkan',
|
|
10461
|
+
push_advisory_not_now: 'Nanti saja',
|
|
10462
|
+
notifications: 'Pemberitahuan',
|
|
10463
|
+
push_settings_row: 'Pemberitahuan pembayaran',
|
|
10464
|
+
push_settings_on: 'Aktif',
|
|
10465
|
+
push_settings_off: 'Nonaktif',
|
|
10376
10466
|
|
|
10377
10467
|
check_wallet: 'Pemecahan masalah',
|
|
10378
10468
|
settings_version: 'v{{version}}',
|
|
@@ -11440,10 +11530,19 @@ const resources = {
|
|
|
11440
11530
|
home_payments_unsent: '{{count}} 件の支払いが未送達です',
|
|
11441
11531
|
pay_copy: 'コピー',
|
|
11442
11532
|
pay_share_link: 'リンクを共有',
|
|
11443
|
-
pay_address_watching: '
|
|
11533
|
+
pay_address_watching: 'このアドレスに送られた資金は、アプリを開いている間だけ自動でウォレットに追加されます。',
|
|
11444
11534
|
pay_address_earlier_day: 'それ以前の日にさかのぼる',
|
|
11445
11535
|
pay_address_sweep_now: 'このBSVアドレスを今すぐ確認',
|
|
11446
11536
|
pay_address_swept: '{{amount}} を受け取りました',
|
|
11537
|
+
push_advisory_title: '支払いを受け取ったら通知でお知らせ',
|
|
11538
|
+
push_advisory_body:
|
|
11539
|
+
'次に、スマートフォンが通知の許可を求めます。許可すると、アプリがバックグラウンドにあるときでも、支払いが届いたことを BSV Wallet がお知らせします。',
|
|
11540
|
+
push_advisory_continue: '続行',
|
|
11541
|
+
push_advisory_not_now: 'あとで',
|
|
11542
|
+
notifications: '通知',
|
|
11543
|
+
push_settings_row: '支払いの通知',
|
|
11544
|
+
push_settings_on: 'オン',
|
|
11545
|
+
push_settings_off: 'オフ',
|
|
11447
11546
|
|
|
11448
11547
|
check_wallet: 'トラブルシューティング',
|
|
11449
11548
|
settings_version: 'v{{version}}',
|
|
@@ -12517,10 +12616,19 @@ const resources = {
|
|
|
12517
12616
|
home_payments_unsent: 'Niedostarczone płatności: {{count}}',
|
|
12518
12617
|
pay_copy: 'Kopiuj',
|
|
12519
12618
|
pay_share_link: 'Udostępnij link',
|
|
12520
|
-
pay_address_watching: 'Pieniądze wysłane na ten adres są automatycznie dodawane do Twojego portfela.',
|
|
12619
|
+
pay_address_watching: 'Pieniądze wysłane na ten adres są automatycznie dodawane do Twojego portfela, ale tylko gdy aplikacja jest otwarta.',
|
|
12521
12620
|
pay_address_earlier_day: 'Wróć do wcześniejszego dnia',
|
|
12522
12621
|
pay_address_sweep_now: 'Sprawdź teraz ten adres BSV',
|
|
12523
12622
|
pay_address_swept: 'Otrzymano {{amount}}',
|
|
12623
|
+
push_advisory_title: 'Powiadomimy Cię, gdy dostaniesz zapłatę',
|
|
12624
|
+
push_advisory_body:
|
|
12625
|
+
'Za chwilę telefon poprosi o zgodę na powiadomienia. Dzięki temu BSV Wallet poinformuje Cię o nadejściu płatności, nawet gdy aplikacja działa w tle.',
|
|
12626
|
+
push_advisory_continue: 'Kontynuuj',
|
|
12627
|
+
push_advisory_not_now: 'Nie teraz',
|
|
12628
|
+
notifications: 'Powiadomienia',
|
|
12629
|
+
push_settings_row: 'Powiadomienia o płatnościach',
|
|
12630
|
+
push_settings_on: 'Wł.',
|
|
12631
|
+
push_settings_off: 'Wył.',
|
|
12524
12632
|
|
|
12525
12633
|
check_wallet: 'Rozwiązywanie problemów',
|
|
12526
12634
|
settings_version: 'v{{version}}',
|
package/core/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ export {
|
|
|
35
35
|
getServiceConfig,
|
|
36
36
|
getMandalaEndpoints,
|
|
37
37
|
getHandleRegistryConfig,
|
|
38
|
+
getPushAdapter,
|
|
38
39
|
isAllowedServiceOrigin,
|
|
39
40
|
isMandalaAvailable,
|
|
40
41
|
isVaultEnabled,
|
|
@@ -42,6 +43,7 @@ export {
|
|
|
42
43
|
resetToolboxConfig
|
|
43
44
|
} from './toolboxConfig'
|
|
44
45
|
export type { ToolboxConfig, ToolboxServiceConfig, MandalaEndpointConfig, HandleRegistryConfig } from './toolboxConfig'
|
|
46
|
+
export type { PushAdapter, PushPermission, PushOpenedEvent } from './push/types'
|
|
45
47
|
|
|
46
48
|
// Theme tokens and providers
|
|
47
49
|
export { ThemeProvider, useTheme } from './theme/ThemeContext'
|
package/core/pay/beefRepair.ts
CHANGED
|
@@ -23,10 +23,13 @@
|
|
|
23
23
|
* and `makeBeefRepair` declines rather than burning an attempt on it.
|
|
24
24
|
*/
|
|
25
25
|
import { Beef, Utils } from '@bsv/sdk'
|
|
26
|
-
import { MAX_HEX_RESPONSE_CHARS, type WocConfig } from './rails/address'
|
|
26
|
+
import { MAX_HEX_RESPONSE_CHARS, wocRequestInit, type WocConfig } from './rails/address'
|
|
27
27
|
|
|
28
28
|
/** Injectable for tests; production uses global fetch. */
|
|
29
|
-
export type FetchLike = (
|
|
29
|
+
export type FetchLike = (
|
|
30
|
+
url: string,
|
|
31
|
+
init?: { headers?: Record<string, string> }
|
|
32
|
+
) => Promise<{ ok: boolean; status: number; text: () => Promise<string> }>
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
35
|
* The current AtomicBEEF for `txid`, or undefined if the network cannot supply
|
|
@@ -46,7 +49,9 @@ export async function refetchAtomicBeef(args: {
|
|
|
46
49
|
|
|
47
50
|
let bytes: number[]
|
|
48
51
|
try {
|
|
49
|
-
const
|
|
52
|
+
const url = `${woc.apiBase}/v1/bsv/${woc.segment}/tx/${txid}/beef`
|
|
53
|
+
const init = wocRequestInit(woc)
|
|
54
|
+
const resp = init ? await doFetch(url, init) : await doFetch(url)
|
|
50
55
|
// Checked, because the body of a 404 is prose. `Utils.toArray(prose, 'hex')`
|
|
51
56
|
// throws "Invalid hex string", and an empty body parses to a Beef whose
|
|
52
57
|
// magic check fails — both of which would surface as a confusing error from
|