@ninsei-labs/sdk 0.60.0 → 0.61.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 +22 -0
- package/README.md +28 -16
- package/assets/vendors/MANIFEST.json +1 -1
- package/assets/vendors/sdk/sdk-browser.js +4 -4
- package/engine/atomic/dleq2.js +0 -4
- package/engine/atomic/halfenc.js +0 -4
- package/engine/atomic/halves.js +0 -4
- package/engine/atomic/order.js +0 -4
- package/engine/atomic/orderContext.js +0 -4
- package/engine/atomic/orderHalfCommit.js +0 -4
- package/engine/core/chainSource.js +0 -4
- package/engine/core/clock.js +0 -4
- package/engine/core/config.js +0 -4
- package/engine/core/finality.js +0 -4
- package/engine/core/format.js +0 -4
- package/engine/core/preSignGuards.js +0 -4
- package/engine/core/rfqSource.js +0 -3
- package/engine/core/sellWindow.js +0 -4
- package/engine/core/store.js +0 -4
- package/engine/core/swap.js +0 -4
- package/engine/evm/amounts.js +0 -4
- package/engine/evm/asyncRoute.js +0 -4
- package/engine/evm/auth.js +0 -4
- package/engine/evm/claimGas.js +2 -6
- package/engine/evm/dex.js +0 -4
- package/engine/evm/escrow.js +0 -4
- package/engine/evm/factory.js +0 -4
- package/engine/evm/fees.js +0 -4
- package/engine/evm/funding.js +2 -5
- package/engine/evm/gasReserve.js +0 -4
- package/engine/evm/index.js +5 -9
- package/engine/evm/injected.js +0 -4
- package/engine/evm/permit.js +0 -4
- package/engine/evm/prices.js +0 -4
- package/engine/evm/session.js +0 -4
- package/engine/mock/chain.js +0 -4
- package/engine/monero/address.js +0 -3
- package/engine/monero/halvesSweep.js +0 -4
- package/engine/monero/node.js +0 -4
- package/engine/monero/swapKeys.js +0 -4
- package/engine/monero/unlock.js +2 -6
- package/engine/monero/wallet.js +0 -3
- package/engine/recovery/recoveryFile.js +0 -4
- package/engine/recovery/restore.js +0 -4
- package/engine/sdk/bridge.js +3 -7
- package/engine/ui/dom.js +0 -4
- package/engine/ui/walletModal.js +0 -4
- package/index.d.ts +24 -23
- package/package.json +3 -2
- package/src/engine.mjs +17 -26
- package/src/public/recovery.d.ts +1 -1
- package/src/relayClaim.mjs +17 -3
- package/src/swap-flow.mjs +7 -10
- package/src/swaps.mjs +157 -70
- package/src/version.mjs +1 -1
- package/src/xmr-arrival.mjs +14 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 0.61.0 — 2026-11-14
|
|
2
|
+
|
|
3
|
+
- **BREAKING:** the scalar `claimSender` is retired from `SellStartRequest`, `RelayClaimRequest` and `RelayClaimed`. `claimSenders` is the only sender source; an explicit list replaces the relay-published sender and is never prepended. Pre-list records are migrated on their first claim.
|
|
4
|
+
- A claim window is read from the escrow one last time before it is reported closed: a claim, refund or defund that landed after the last sender slot wins over the closing state. An unreadable final read still returns the named window state.
|
|
5
|
+
- `swaps.watch` refuses `request.escrow` and `verify.address` that redirect the stored record (`bad-input` / `record-mismatch`) before any chain read.
|
|
6
|
+
- A first unread escrow is `claim-window` / `unreadable` when nothing has been sent; after an earlier attempt it remains `claim-unknown` with `escrow-unread`.
|
|
7
|
+
- Relay-level answers `rate_limited`, `bad_request`, `unsupported_version` and `no_quote` are `claim-unknown` (`relay-<code>`), not a sender refusal; the sender keeps its slot.
|
|
8
|
+
- Funding compares `commitHalfLocker`, `edPointLocker` and `edViewPointLocker` with the signed quote before sending, so a locker-half mismatch is refused before the factory.
|
|
9
|
+
- `engine/**` is now the SDK's own source; the generated-mirror headers and the `www/js` source-of-truth comments are gone.
|
|
10
|
+
- The claim guards have a mutation suite in `tools/check-claim-teeth.mjs`, run in CI after `check:guard-teeth`.
|
|
11
|
+
- CI uses Rust 1.100.0 and pnpm 12.21.0; Cargo resolves registry dependencies with a three-day cooldown.
|
|
12
|
+
- The supported version line is `0.61.x`; `package.json` and the baked-in `SDK_VERSION` move to 0.61.0.
|
|
13
|
+
|
|
14
|
+
## 0.60.1 — 2026-11-13
|
|
15
|
+
|
|
16
|
+
- `claimViaRelay` treats `claimAttempts` as a diagnostic journal, not as a list of senders to skip. A repeated call starts from the first sender again; a previous `sending` or `unknown` entry is waited out for its slot and retried. A legacy future timestamp is capped at one slot, so an old device clock cannot stall recovery. A temporary relay refusal, a process restart or a closed tab no longer removes the seller's no-wallet path.
|
|
17
|
+
- The claim window and `secondsLeft` use the escrow chain's block timestamp (`evmBlock` or the wallet's block provider). A device clock skew can no longer post the half after `t1`, and a missing chain clock returns `claim-window` / `unreadable` instead of falling back to `Date.now()`.
|
|
18
|
+
- `sellWatch` does not report `ready` after `t1`; a ready mark that arrives too late is named as `claim-window-closed`.
|
|
19
|
+
- The witness shadow walks every fixed slice to the common target even after finding a perfect candidate, and `witnessQuorum.ok` requires completed operators with no witness-to-witness disagreement.
|
|
20
|
+
- `sweep.restore` keeps the facade's fetch transport through `createNinsei({ fetch })`, while a per-call `fetchImpl` still wins.
|
|
21
|
+
- The supported version line remains `0.60.x`; `package.json` and the baked-in `SDK_VERSION` move to `0.60.1`.
|
|
22
|
+
|
|
1
23
|
## 0.60.0 — 2026-11-13
|
|
2
24
|
|
|
3
25
|
- `swaps.watch` keeps the joint Monero address apart from the EVM escrow: the result carries the address the client checked, and the automatic ready mark always signs against the escrow. A typed watch no longer returns the escrow as its `address`; the legacy untyped `request.address` is not read. `verify` remains mandatory, so a watch without the client's own check is refused by name instead of falling back to a retired service answer.
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Report suspected vulnerabilities through GitHub's private **Report a vulnerabili
|
|
|
22
22
|
The supported versions, scope, response targets, safe-harbor rules and disclosure process are in
|
|
23
23
|
[`SECURITY.md`](SECURITY.md).
|
|
24
24
|
|
|
25
|
-
## State (0.
|
|
25
|
+
## State (0.61.0)
|
|
26
26
|
|
|
27
27
|
| Surface | State |
|
|
28
28
|
|---|---|
|
|
@@ -225,19 +225,22 @@ if (claimed.state === "claimed") {
|
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
`claimSenders` is the client's ordered list: the relay's own sender first, then other listed makers. `startSell`
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
`
|
|
228
|
+
stores a list only when the caller passes `claimSenders`; otherwise the offer's published `claimSender` becomes a
|
|
229
|
+
one-element list. An explicit list replaces that published sender; it is never prepended. `claimViaRelay({ id })`
|
|
230
|
+
uses the stored list, while a request `claimSenders` replaces it. The old scalar `claimSender` is retired and
|
|
231
|
+
refused by name; the claim result names the sender that landed it as `provider`. The SDK tries one sender at a
|
|
232
|
+
time for a 15-30 s slot. A refusal moves on at once; a txid is not success - the SDK reads the escrow until it
|
|
233
|
+
says `claimed` or the slot ends. The deal's maker and its quote-key owner are refused before the half leaves the
|
|
234
|
+
client. When the list is exhausted the result is `state: "claim-yourself"` with `t1` and `secondsLeft`.
|
|
234
235
|
|
|
235
236
|
The claim window is the escrow's, not the relay's. Before every sender the SDK reads `ready`, `readyBy` and `t1`
|
|
236
237
|
from the chain. Without the ready mark before `readyBy`, at or after `t1`, or inside the 120 s settlement margin
|
|
237
238
|
(plus the sender's slot and time for the seller's own claim), it returns `state: "claim-window"` with a named
|
|
238
|
-
`reason` and posts nothing. An
|
|
239
|
+
`reason` and posts nothing. An escrow read that fails before any send is `claim-window` / `unreadable`; if an earlier
|
|
240
|
+
attempt may already have sent the half, it is `claim-unknown` with `why: "escrow-unread"`. It is never reported as
|
|
239
241
|
`claim-yourself`. A relay answer such as `claim-not-ready` or `claim-window-closed` stops the list instead of
|
|
240
|
-
passing the half to the next sender.
|
|
242
|
+
passing the half to the next sender. Relay-level answers (`rate_limited`, `bad_request`, `unsupported_version`,
|
|
243
|
+
`no_quote`) are `claim-unknown`, not a sender refusal; the sender keeps its slot and the list continues.
|
|
241
244
|
|
|
242
245
|
`claimViaRelay` reads the sell record made by `startSell` and requires a positive `claimTip`, the escrow and the
|
|
243
246
|
half. It posts to the relay origin stored with the record; an optional `relayUrl` may repeat that origin but a
|
|
@@ -245,13 +248,22 @@ different one is refused. A node refusal keeps its code under `quote-refused.par
|
|
|
245
248
|
without a real transaction hash is `claim-unknown`: the claim may have been sent, so the SDK reads the escrow and
|
|
246
249
|
moves on only after the slot. Only an escrow that reads `claimed` is success.
|
|
247
250
|
|
|
248
|
-
Each sender is written to the record before its POST.
|
|
249
|
-
|
|
250
|
-
`
|
|
251
|
-
sender's slot starts when it is entered, not when its POST returns; `pollMs` has a
|
|
252
|
-
120 s ceiling. The relay gate also reserves the settlement margin, so `sellWatch` can
|
|
253
|
-
`claim-open` while `claimViaRelay` has already stopped. A refunded escrow is
|
|
254
|
-
`reason: "escrow-refunded"`, not a request to claim; recovery is the next step.
|
|
251
|
+
Each sender is written to the record before its POST. The log is diagnostic, not a skip list: a later call starts
|
|
252
|
+
at the first sender again. A previous `sending` or `unknown` entry is waited out for its slot and then retried; a
|
|
253
|
+
`refused` or `unconfirmed` entry is retried immediately. This is what makes a temporary relay failure, a restart or
|
|
254
|
+
a closed tab recoverable. A sender's slot starts when it is entered, not when its POST returns; `pollMs` has a
|
|
255
|
+
250 ms floor and `timeoutMs` a 120 s ceiling. The relay gate also reserves the settlement margin, so `sellWatch` can
|
|
256
|
+
still report its own-wallet `claim-open` while `claimViaRelay` has already stopped. A refunded escrow is
|
|
257
|
+
`claim-window` with `reason: "escrow-refunded"`, not a request to claim; recovery is the next step.
|
|
258
|
+
|
|
259
|
+
`claimAttempts` is append-only and the SDK does not prune it: a long-lived record can grow with every retry. The
|
|
260
|
+
journal is diagnostic, not a spendable state. A host may trim older entries, but it must keep the latest
|
|
261
|
+
`sending` or `unknown` entry: that slot is waited out before the sender is tried again. Do not use the journal as
|
|
262
|
+
proof that a sender is finished.
|
|
263
|
+
|
|
264
|
+
The claim window uses the escrow's chain time, read with `evmBlock` (or the wallet's block provider), not the
|
|
265
|
+
device clock. If neither clock is available, the client refuses with `claim-window` / `unreadable` before the half
|
|
266
|
+
leaves; it does not fall back to `Date.now()`. `secondsLeft` is derived from that same chain time.
|
|
255
267
|
|
|
256
268
|
`actions.claim` is unchanged: it still sends only from the claimer's own wallet, because the half is revealed by
|
|
257
269
|
whoever sends the claim.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"note": "Pinned browser bundles. A change to one of these files must be accompanied by a matching SHA-256 here and a rebuild of the page's asset registry.",
|
|
4
4
|
"bundles": {
|
|
5
5
|
"sdk/sdk-browser.js": {
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "b48b18f7a9fe6d3ea28008cba34f28f815697e302279c3274cea96af5696d75c",
|
|
7
7
|
"source": "sdk/src (facade, adapters, recovery)"
|
|
8
8
|
}
|
|
9
9
|
}
|