@ninsei-labs/sdk 0.55.1 → 0.55.2
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 +6 -0
- package/package.json +3 -2
- package/src/quotes.mjs +8 -2
- package/src/swaps.mjs +15 -2
- package/src/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.55.2 — 2026-10-30
|
|
2
|
+
|
|
3
|
+
- `quotes.firmRelay` now carries the signed `orderQuote.xmrAmount` on the order terms it returns, and
|
|
4
|
+
`swaps.start` refuses a start without that exact integer (`expectedAtomic: signed-amount-missing`).
|
|
5
|
+
A relay buy no longer records a swap with no arrival amount or falls back to a rounded display size.
|
|
6
|
+
|
|
1
7
|
## 0.55.1 — 2026-10-30
|
|
2
8
|
|
|
3
9
|
- Restore the relay wire revision 13 public features type: it has no `capabilities` field. 0.55.0 added the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninsei-labs/sdk",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
"check:quote-binding": "node tools/check-quote-binding.mjs",
|
|
75
75
|
"check:types-consumer": "node node_modules/typescript/bin/tsc -p tools/ts-consumer/tsconfig.json",
|
|
76
76
|
"check:monero-live": "node tools/check-monero-live.mjs",
|
|
77
|
-
"check:native-amount": "node tools/check-native-amount.mjs"
|
|
77
|
+
"check:native-amount": "node tools/check-native-amount.mjs",
|
|
78
|
+
"check:ci-boundary": "node tools/check-ci-boundary.mjs"
|
|
78
79
|
},
|
|
79
80
|
"types": "./index.d.ts",
|
|
80
81
|
"exports": {
|
package/src/quotes.mjs
CHANGED
|
@@ -1037,10 +1037,16 @@ export function createQuotes({ config, http, now = () => Date.now(), evmCall = n
|
|
|
1037
1037
|
const verdict = claimTipVerdict({ claimTipWei: quote.claimTip, baseFeeWei });
|
|
1038
1038
|
if (!verdict.ok) fail(verdict.code, { step: "claimTip", ...verdict });
|
|
1039
1039
|
}
|
|
1040
|
+
// THE SIGNED XMR AMOUNT TRAVELS WITH THE ORDER TERMS. `swaps.start` records its order as given, and the
|
|
1041
|
+
// arrival check must compare the exact amount signed in the quote - not the display size, which the relay
|
|
1042
|
+
// answer does not carry at all.
|
|
1043
|
+
const signedAtomic = result.orderQuote && result.orderQuote.xmrAmount !== undefined && result.orderQuote.xmrAmount !== null
|
|
1044
|
+
? String(result.orderQuote.xmrAmount) : null;
|
|
1045
|
+
if (!signedAtomic) fail("quote-field-unbound", { step: "xmrAmount", field: "orderQuote.xmrAmount" });
|
|
1040
1046
|
return {
|
|
1041
1047
|
...result,
|
|
1042
|
-
quote: { ...quote, viewHalfClaimer: derived.makerViewHalf },
|
|
1043
|
-
order,
|
|
1048
|
+
quote: { ...quote, viewHalfClaimer: derived.makerViewHalf, xmrAmount: signedAtomic },
|
|
1049
|
+
order: { ...order, xmrAmount: signedAtomic },
|
|
1044
1050
|
// THE SHAPE `swaps.start` TAKES: the proof and the claimer commitment travel with the view half, so a
|
|
1045
1051
|
// caller can pass this object as `counterparty` without rebuilding the relay fields.
|
|
1046
1052
|
counterparty: {
|
package/src/swaps.mjs
CHANGED
|
@@ -286,7 +286,9 @@ const MIN_PASSPHRASE = 12;
|
|
|
286
286
|
// knew neither the withdrawal address nor the maker, and exporting the recovery file from that screen went out with an
|
|
287
287
|
// empty address. The record fields stay the same as the engine's (core/swap.js, createSwap): the field name is
|
|
288
288
|
// `receiveAddress`.
|
|
289
|
-
|
|
289
|
+
// Exported for the relay/record seam check: the function is the only place that decides which amount reaches
|
|
290
|
+
// the arrival check, and a unit test of createRecord alone cannot see that decision.
|
|
291
|
+
export const recordInputOf = (request) => {
|
|
290
292
|
const quote = request && request.quote && typeof request.quote === "object" ? request.quote : {};
|
|
291
293
|
const pass = (v) => (v === undefined || v === null || v === "" ? undefined : v);
|
|
292
294
|
return {
|
|
@@ -297,8 +299,12 @@ const recordInputOf = (request) => {
|
|
|
297
299
|
xmrAmount: quote.size !== undefined ? quote.size : undefined,
|
|
298
300
|
// THE SIGNED INTEGER, NOT THE DISPLAY NUMBER. `quote.size` is a rounded view of the XMR amount; the signed
|
|
299
301
|
// order's `xmrAmount` is the exact atomic value the maker will pay, and the arrival check compares that one.
|
|
302
|
+
// THE SIGNED FIGURE, NEVER A DISPLAY ONE. The firm path puts the quote's signed `xmrAmount` on the order it
|
|
303
|
+
// returns; a bare `quote.size` is a rounded screen number and must not reach the arrival check.
|
|
300
304
|
expectedAtomic: request.order && request.order.xmrAmount !== undefined && request.order.xmrAmount !== null
|
|
301
|
-
? request.order.xmrAmount
|
|
305
|
+
? String(request.order.xmrAmount)
|
|
306
|
+
: (request.orderQuote && request.orderQuote.xmrAmount !== undefined && request.orderQuote.xmrAmount !== null
|
|
307
|
+
? String(request.orderQuote.xmrAmount) : undefined),
|
|
302
308
|
// THE ORDER-QUOTE ID IS PART OF THE RECORD, NOT A DETAIL OF THE SCREEN (a defect found): our service uses it to
|
|
303
309
|
// tie the created escrow to the provider node's record, and without it the node cannot take the ETH
|
|
304
310
|
// (sdk/src/swap-flow.mjs: quoteId: quote.id -> swap.orderQuoteId; markBodyOf reads exactly this field).
|
|
@@ -811,6 +817,13 @@ export function createSwaps({ preflight, http, createRecord, mode = null, xmrNet
|
|
|
811
817
|
throw new SdkError("bad-input", { field: "recoveryKey", why: "required" });
|
|
812
818
|
}
|
|
813
819
|
if (!request.receiveTo || typeof request.receiveTo !== "string") throw new SdkError("bad-input", { field: "receiveTo" });
|
|
820
|
+
// A START WITHOUT THE SIGNED XMR AMOUNT IS NOT A START. `quote.size` is a rounded display value and the relay
|
|
821
|
+
// answer does not carry it; the arrival check needs the exact integer the order quote signed. Refuse here, before
|
|
822
|
+
// a wallet or a funding send, instead of recording an incomplete swap that later reads "no amount".
|
|
823
|
+
if (!recordInputOf(request).expectedAtomic) {
|
|
824
|
+
throw new SdkError("bad-input", { field: "expectedAtomic", why: "signed-amount-missing" });
|
|
825
|
+
}
|
|
826
|
+
|
|
814
827
|
// RESUME BEFORE ANY NEW SIDE OR SEND. The previous start may have sent the deposit and lost the receipt;
|
|
815
828
|
// reusing its hash is the only way to learn the escrow without a second payment.
|
|
816
829
|
const quoteForResume = (request.orderQuote && request.orderQuote.id) || (request.quote && request.quote.id) || null;
|
package/src/version.mjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
// tools/sync-version.mjs. Do not edit it by hand - set the version in package.json and run `npm run sync:version`.
|
|
7
7
|
// The `version` check in tools/check.mjs refuses a mismatch, and refuses a runtime read of package.json here.
|
|
8
8
|
|
|
9
|
-
export const SDK_VERSION = "0.55.
|
|
9
|
+
export const SDK_VERSION = "0.55.2";
|