@bsv/expo-wallet-toolbox 0.17.0 → 0.18.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,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Added
6
+
7
+ - **Live (WebRTC) push payments.** Hosts can now pay and be paid live, with
8
+ the message box as the fallback.
9
+ - **Opt in.** It turns on when the host installs `@bsv/webrtpay` (an
10
+ optional peer, `^0.2.1`), sets `configureToolbox({ directPay: { enabled:
11
+ true, RTCPeerConnection } })` and mounts `DirectPayProvider` inside
12
+ `WalletContextProvider`. Without all three nothing changes.
13
+ - **`DirectPayManager`.** Wallets find each other through the relay by
14
+ default. If the relay is not online within 5 s, receiving falls back to
15
+ the message box while the relay is retried (5 s doubling to 5 min). It
16
+ uses the relay's TURN servers and gives a dial 10 s. It receives only
17
+ while the app is in the foreground.
18
+ - **Receiving** (`core/directpay/receive.ts`). A live payment is verified
19
+ and taken into the wallet once, labelled `peerpay`. A seen store keyed by
20
+ `paymentKey`, shared with the inbox credit path, stops a payment that
21
+ arrives both live and through the message box from being credited or
22
+ toasted twice. A payment that cannot be added for environmental reasons
23
+ is kept on the device and retried. It is never dropped.
24
+ - **Sending** (`core/pay/rails/direct.ts`, `sendViaDirect`). One
25
+ transaction and one outbox row per payment. The order is dial, mint,
26
+ send, then broadcast after the ack. Once a payment has been sent it is
27
+ never aborted: a refused or unconfirmed live delivery finishes through
28
+ the message box. Every stop before sending throws `NotSentError`, so
29
+ `payIdentity` can offer the message box.
30
+ - **`useDirectPay()`** exposes the snapshot, the Receive card status
31
+ (`live`), settings, `canSendDirect` and `sendDirect`, the `direct` route
32
+ for `payIdentity`.
33
+ - **`withReactNativeDataChannels(RTCPeerConnection)`** makes
34
+ react-native-webrtc data channels acceptable to `@bsv/webrtpay` 0.2.1
35
+ (Android reports -1 and iOS 65535 for an unset limit). Drop it once
36
+ webrtpay ships the fix.
37
+
38
+ ### Changed
39
+
40
+ - **The inbox credit path takes an optional seen store.**
41
+ `internalizeIncoming` returns `'credited' | 'duplicate'`, and
42
+ `autoAcceptInbox` does not count duplicates.
43
+
3
44
  ## 0.17.0
4
45
 
5
46
  ### 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