@bsv/expo-wallet-toolbox 0.17.0 → 0.19.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 CHANGED
@@ -1,5 +1,64 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Added
6
+
7
+ - **The pay and receive screens use live payments.** These changes only
8
+ apply in a host that mounts `DirectPayProvider` with `directPay.enabled`
9
+ and `@bsv/webrtpay` installed. Without it, both screens behave as before.
10
+ - **`UniversalSend` pays live first.** For a handle or identity key, the
11
+ payment is delivered live when `canSendDirect`. When the recipient isn't
12
+ online, or the link can't come up and nothing was spent, it asks "X isn't
13
+ online right now. Send it to their message box?" and then uses the
14
+ message box rail. The success screen says when a payment was delivered
15
+ live.
16
+ - **`HandleReceive` shows a live status card.** "Open to live payments",
17
+ plus connecting, off and error states, for BSV receives.
18
+ - **New strings** `direct_pay_fallback_title`, `direct_pay_fallback_send`
19
+ and `direct_pay_sent_live`, in all 12 locales.
20
+
21
+ ## 0.18.0
22
+
23
+ ### Added
24
+
25
+ - **Live (WebRTC) push payments.** Hosts can now pay and be paid live, with
26
+ the message box as the fallback.
27
+ - **Opt in.** It turns on when the host installs `@bsv/webrtpay` (an
28
+ optional peer, `^0.2.1`), sets `configureToolbox({ directPay: { enabled:
29
+ true, RTCPeerConnection } })` and mounts `DirectPayProvider` inside
30
+ `WalletContextProvider`. Without all three nothing changes.
31
+ - **`DirectPayManager`.** Wallets find each other through the relay by
32
+ default. If the relay is not online within 5 s, receiving falls back to
33
+ the message box while the relay is retried (5 s doubling to 5 min). It
34
+ uses the relay's TURN servers and gives a dial 10 s. It receives only
35
+ while the app is in the foreground.
36
+ - **Receiving** (`core/directpay/receive.ts`). A live payment is verified
37
+ and taken into the wallet once, labelled `peerpay`. A seen store keyed by
38
+ `paymentKey`, shared with the inbox credit path, stops a payment that
39
+ arrives both live and through the message box from being credited or
40
+ toasted twice. A payment that cannot be added for environmental reasons
41
+ is kept on the device and retried. It is never dropped.
42
+ - **Sending** (`core/pay/rails/direct.ts`, `sendViaDirect`). One
43
+ transaction and one outbox row per payment. The order is dial, mint,
44
+ send, then broadcast after the ack. Once a payment has been sent it is
45
+ never aborted: a refused or unconfirmed live delivery finishes through
46
+ the message box. Every stop before sending throws `NotSentError`, so
47
+ `payIdentity` can offer the message box.
48
+ - **`useDirectPay()`** exposes the snapshot, the Receive card status
49
+ (`live`), settings, `canSendDirect` and `sendDirect`, the `direct` route
50
+ for `payIdentity`.
51
+ - **`withReactNativeDataChannels(RTCPeerConnection)`** makes
52
+ react-native-webrtc data channels acceptable to `@bsv/webrtpay` 0.2.1
53
+ (Android reports -1 and iOS 65535 for an unset limit). Drop it once
54
+ webrtpay ships the fix.
55
+
56
+ ### Changed
57
+
58
+ - **The inbox credit path takes an optional seen store.**
59
+ `internalizeIncoming` returns `'credited' | 'duplicate'`, and
60
+ `autoAcceptInbox` does not count duplicates.
61
+
3
62
  ## 0.17.0
4
63
 
5
64
  ### Added
@@ -141,6 +141,7 @@ const MANDALA_OUTPOINT_LIST_MAX_PAGES = 1000
141
141
  import type { AppChain } from '../config'
142
142
  import { DEFAULT_STORAGE_URL, DEFAULT_CHAIN, ADMIN_ORIGINATOR, toWalletChain } from '../config'
143
143
  import { getBackupUrl, getHandleRegistryConfig, getMandalaEndpoints, getPushAdapter } from '../toolboxConfig'
144
+ import { inboxSeenStore } from '../directpay/receive'
144
145
  import {
145
146
  DEFAULT_AUTO_APPROVE_THRESHOLD,
146
147
  AUTO_APPROVE_COOLDOWN_MS,
@@ -2319,6 +2320,9 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
2319
2320
  getOnline,
2320
2321
  peekLastMissHeight: () => offlineChaintracks.peekLastMissHeight()
2321
2322
  })
2323
+ // With direct payments on, a payment that arrived live as well is
2324
+ // credited, and announced, once (see core/directpay/receive.ts).
2325
+ const seen = inboxSeenStore(keyDeriver.identityKey, chain)
2322
2326
  const r = await creditInboxOnce({
2323
2327
  client,
2324
2328
  messageBoxUrl,
@@ -2326,7 +2330,7 @@ export const WalletContextProvider: React.FC<WalletContextProps> = ({ children =
2326
2330
  classify,
2327
2331
  accept: payment =>
2328
2332
  acceptWithRetry(client, messageBoxUrl, payment, p =>
2329
- internalizeIncoming(permissionsManager as never, client, adminOriginator, p, repairBeef)
2333
+ internalizeIncoming(permissionsManager as never, client, adminOriginator, p, repairBeef, seen)
2330
2334
  )
2331
2335
  })
2332
2336
  // The SAME rail, a second box. A handle-rail token payment