@ninsei-labs/sdk 0.50.0 → 0.51.1
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 +33 -0
- package/README.md +28 -0
- package/assets/vendors/atomic/atomic-browser.js +24 -0
- package/assets/vendors/monero/monero-js-browser.js +58 -0
- package/assets/vendors/monero-js/LICENSE +9 -0
- package/assets/vendors/sdk/sdk-browser.js +14 -0
- package/assets/vendors/walletconnect/wc-browser.js +6202 -0
- package/engine/atomic/order-worker.js +129 -0
- package/engine/core/config.js +3 -1
- package/engine/sdk/bridge.js +3 -3
- package/index.d.ts +85 -4
- package/package.json +4 -2
- package/src/adapters/monero-wallet.mjs +26 -0
- package/src/config.mjs +9 -0
- package/src/index.mjs +2 -0
- package/src/public/networks.d.ts +2 -0
- package/src/public/recovery.d.ts +28 -1
- package/src/public/recovery.mjs +1 -0
- package/src/quotes.mjs +67 -1
- package/src/recovery-key.mjs +124 -23
- package/src/swaps.mjs +26 -4
- package/src/sweep-half.mjs +14 -0
- package/src/sweep-restore.mjs +78 -15
- package/src/sweep.mjs +85 -5
- package/src/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## 0.51.1 — 2026-10-22
|
|
2
|
+
|
|
3
|
+
A BUSY NODE NO LONGER ENDS A WITHDRAWAL, AND MISSING HEIGHT DATA HAS A NAME.
|
|
4
|
+
|
|
5
|
+
- `windowTxHashes` retries a `429`, a timeout and a `5xx` with `Retry-After` or exponential backoff; only a read that
|
|
6
|
+
still fails reaches the fallback.
|
|
7
|
+
- `restoreWallet` runs the full scan when the window cannot be read and reports `window.fallback: true`,
|
|
8
|
+
`fallbackWhy: "window-read"` and the node's status. A malformed window is still a caller error, not a fallback.
|
|
9
|
+
- A null settlement block time is `no-block-time`, not timestamp 0. An unreachable Monero node
|
|
10
|
+
(`monero-nodes-unreachable`) and a reachable node on another network (`monero-network-mismatch`) no longer share
|
|
11
|
+
`no-height-readers`.
|
|
12
|
+
- `recoveryIndexTaken` is exported from `@ninsei-labs/sdk/recovery`.
|
|
13
|
+
- The on-chain recovery-number check starts at the registry's escrow deployment block, not block 0; an explicit
|
|
14
|
+
`fromBlock` still wins.
|
|
15
|
+
|
|
16
|
+
## 0.51.0 — 2026-10-22
|
|
17
|
+
|
|
18
|
+
THE WITHDRAWAL AND THE ON-CHAIN SEARCH NOW CARRY EVERYTHING THE KEY CAN KNOW.
|
|
19
|
+
|
|
20
|
+
- `sweep` keeps all 32 bytes of the revealed half; the old slice to 20 bytes made every real withdrawal fail.
|
|
21
|
+
- The Monero node readers return the top block (`height - 1`) and accept the genesis timestamp, so `findSwaps` can
|
|
22
|
+
derive a start height instead of asking for a block that does not exist.
|
|
23
|
+
- `quotes.firm` sends the taker's maker view half and requires the quote to echo it; without it a buy from the one
|
|
24
|
+
key could not be restored from the twelve words.
|
|
25
|
+
- `quotes.sale` checks the signed claim tip with base plus priority fee, and `rankOffers` ranks a sale by
|
|
26
|
+
`amount × rate − claimTip`.
|
|
27
|
+
- `sweep.restore` reports `window.fallback`; `findSwaps` returns `blockTime`, reads `xmrAmount` from the clone with
|
|
28
|
+
an `evmCode` reader, uses the factory's `deploymentBlock`, and names the native settlement while leaving the
|
|
29
|
+
paying token off-chain (`payToken: null`, `payTokenReason: "not-on-chain"`).
|
|
30
|
+
- `sweep.fromOrder({ mnemonic, order })` builds the payload without a recovery file, and one wallet adapter now
|
|
31
|
+
serves both `sweep.restore` and `sweep.sign`.
|
|
32
|
+
- The npm package ships the assets and `order-worker.js` its own code imports; Node floor is `>=24.22.1`.
|
|
33
|
+
|
|
1
34
|
## 0.50.0 — 2026-10-21
|
|
2
35
|
|
|
3
36
|
A CLAIM IS SENT BY ITS CLAIMER, AND A SALE IS RANKED AFTER THE TIP.
|
package/README.md
CHANGED
|
@@ -155,6 +155,34 @@ the size is computed from the person's amount and is snapped to the node's grid
|
|
|
155
155
|
range is not aligned: it is the provider's refusal, and it arrives as a code. Indicative quotes commit to nothing;
|
|
156
156
|
`quotes.firm` commits (stage 2).
|
|
157
157
|
|
|
158
|
+
## Found orders and the paying token
|
|
159
|
+
|
|
160
|
+
`findSwaps` returns the orders whose commitment came from the recovery key. Each found order reports:
|
|
161
|
+
|
|
162
|
+
- `amount` — the escrow's **native** amount in wei;
|
|
163
|
+
- `settlementToken: "native"` — what the escrow receives;
|
|
164
|
+
- `xmrAmount` — the XMR side, read from the clone's condition word 18 when an `evmCode` reader is passed;
|
|
165
|
+
- `payToken: null` and `payTokenReason: "not-on-chain"` — the asset the person actually paid before the DEX leg.
|
|
166
|
+
|
|
167
|
+
The reason is structural, not an omission. `OrderCreated` and the clone carry no token field, and the current escrow is
|
|
168
|
+
native-only. A user may have paid USDC, USDT or DAI, but that happened in the DEX leg and lives in the quote/order
|
|
169
|
+
record, not in the settlement contract. Inventing a token from the pair or the UI would be a claim the chain cannot
|
|
170
|
+
support.
|
|
171
|
+
|
|
172
|
+
When a token is needed, the order can be joined with an off-chain quote record by the caller. A future ERC-20 escrow
|
|
173
|
+
would have to put the token into the signed quote and the clone (and therefore a new order format and factory); only
|
|
174
|
+
then can `findSwaps` return it from the chain and set `payTokenReason` to something other than `not-on-chain`.
|
|
175
|
+
|
|
176
|
+
The found order also carries the Monero start height and the reason it is absent. `no-block-time`,
|
|
177
|
+
`monero-nodes-unreachable` and `monero-network-mismatch` are different answers: a missing settlement timestamp is not
|
|
178
|
+
a dead node, and a node on another network is not an absent reader. A page that starts swaps without the SDK's start
|
|
179
|
+
path can call `recoveryIndexTaken` from `./recovery` before using a number; it checks the factory's `OrderCreated`
|
|
180
|
+
logs from the registry's deployment block.
|
|
181
|
+
|
|
182
|
+
The withdrawal window retries a `429`, a timeout or a `5xx` before it gives up. If the window still cannot be read,
|
|
183
|
+
`restoreWallet` falls back to the full scan and reports `window.fallback: true` with `fallbackWhy: "window-read"` and
|
|
184
|
+
the node's status; a withdrawal is not refused because the node was busy.
|
|
185
|
+
|
|
158
186
|
## Extending to other networks (Tron, Solana and beyond)
|
|
159
187
|
|
|
160
188
|
The package name is deliberately common: the shared part — the quote client, the Monero leg, the state machine,
|