@ninsei-labs/sdk 0.54.0 → 0.55.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 CHANGED
@@ -1,3 +1,23 @@
1
+ ## 0.55.1 — 2026-10-30
2
+
3
+ - Restore the relay wire revision 13 public features type: it has no `capabilities` field. 0.55.0 added the
4
+ old revision 12 list back, so `verifyNodeFeatures` refused every features string the deployed relay serves.
5
+ The fixture is the relay's own revision 13 vector.
6
+ - `@ninsei-labs/sdk/relay` keeps the digests, the verifier, the firm terms digest and the HPKE envelope.
7
+
8
+ ## 0.55.0 — 2026-10-30
9
+
10
+ - `order.escrowNativeWei` reads the quote's own native amount (`payNative`) for a token-funded order and returns
11
+ its wei value. A quote without that figure is refused by name (`native-amount-unread`) instead of rescaling the
12
+ payment-token amount.
13
+ - Relay public features now carry the `capabilities` list from relay wire revision 13, so a maker's signed
14
+ `node_features` has the type the relay verifies. A node without `firm/1` carries no HPKE key and no windows.
15
+ - `@ninsei-labs/sdk/relay` exposes the relay digests, the node features verifier, the firm terms digest and the
16
+ HPKE view envelope for a node that embeds the SDK.
17
+ - `swaps.start` keeps the exact atomic XMR amount from the signed order in the record's `escrow.expectedAtomic`.
18
+ The arrival check and a recovery file rebuilt from the chain compare that integer instead of the rounded
19
+ display number. A malformed or non-positive value is refused before the record is saved.
20
+
1
21
  ## 0.54.0 — 2026-10-29
2
22
 
3
23
  - `findSwaps` no longer walks the allocator's 100,000 v1 indices in one synchronous call. One call scans at most
@@ -0,0 +1,46 @@
1
+ # Dependency license policy
2
+
3
+ The SDK is published as a public package under MIT. Its production dependency tree must stay compatible with
4
+ that promise: a dependency with a copyleft, source-available, unknown or missing licence is a decision for a
5
+ person, not something that enters a release by accident.
6
+
7
+ ## Allowed licences
8
+
9
+ A production dependency may use one of these licences:
10
+
11
+ - MIT
12
+ - MIT-0
13
+ - ISC
14
+ - Apache-2.0
15
+ - BSD-2-Clause
16
+ - BSD-3-Clause
17
+ - Unlicense
18
+ - 0BSD
19
+ - CC0-1.0
20
+ - BlueOak-1.0.0
21
+
22
+ An SPDX expression is read as written: `MIT OR Apache-2.0` is allowed when one branch is allowed, and
23
+ `MIT AND ISC` is allowed when every branch is allowed. A `WITH` exception keeps the base licence's decision.
24
+ `SEE LICENSE IN ...`, `UNLICENSED`, `UNKNOWN`, and every licence outside the list are refused.
25
+
26
+ ## How the check runs
27
+
28
+ `pnpm licenses list --prod --json` reads the installed production tree, including transitive packages. The
29
+ check is implemented in `tools/check-licenses.mjs`; CI runs it in the **License Compliance** workflow on every
30
+ pull request and every push to `main`.
31
+
32
+ ```sh
33
+ pnpm run check:licenses
34
+ ```
35
+
36
+ The command prints the packages grouped by licence. If any package is outside the allowlist, it prints each
37
+ package and its licence, then exits non-zero.
38
+
39
+ ## Notices travel with the package
40
+
41
+ `pnpm run notices` regenerates `THIRD_PARTY_NOTICES.md` from the production tree, including the licence text and
42
+ the `NOTICE` files each package ships. The file is published with the package and the same CI workflow checks that
43
+ it is current. A dependency change that edits the lockfile but not the notices fails the check; run `pnpm run
44
+ notices` and review the result with the dependency change.
45
+
46
+ Development dependencies are not part of the published package and are not covered by these checks.
package/README.md CHANGED
@@ -316,7 +316,10 @@ trigger where those exist; on another VM they simply do not appear, rather than
316
316
  5. **Workers and WASM are separate files** from `assetsBase`, so the interface's bundler (Astro/Vite) does not
317
317
  touch them: `atomic/order-worker.js`, the Monero bundles.
318
318
  6. **Strict CSP.** The package is designed for a policy without `eval` and inline.
319
- 7. **Zero dependencies.**
319
+ 7. **Few dependencies, all permissive.** Every production dependency is checked in CI against an allowlist: MIT, MIT-0,
320
+ ISC, Apache-2.0, BSD-2-Clause, BSD-3-Clause, Unlicense, 0BSD, CC0-1.0 and BlueOak-1.0.0. Copyleft,
321
+ source-available, unknown or missing licences fail `pnpm run check:licenses`; the licence texts travel in
322
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), and the policy is in [LICENSE-POLICY.md](LICENSE-POLICY.md).
320
323
 
321
324
  ## Releases and prereleases
322
325
 
@@ -0,0 +1,656 @@
1
+ # Third-party notices
2
+
3
+ This file lists the production dependencies of `@ninsei-labs/sdk` and the licence text each package ships.
4
+ It is generated from the installed production tree; do not edit it by hand.
5
+
6
+ Generated by `tools/third-party-notices.mjs`. Licences accepted by the project are listed in
7
+ [LICENSE-POLICY.md](LICENSE-POLICY.md).
8
+
9
+ ## @hpke/chacha20poly1305 1.8.0
10
+
11
+ License: MIT
12
+ Source: git+https://github.com/dajiaji/hpke-js.git
13
+
14
+ ### LICENSE
15
+
16
+ ```text
17
+ MIT License
18
+
19
+ Copyright (c) 2023 Ajitomi Daisuke
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+ ```
39
+
40
+ ## @hpke/common 1.10.1
41
+
42
+ License: MIT
43
+ Source: git+https://github.com/dajiaji/hpke-js.git
44
+
45
+ ### LICENSE
46
+
47
+ ```text
48
+ MIT License
49
+
50
+ Copyright (c) 2024 Ajitomi Daisuke
51
+
52
+ Permission is hereby granted, free of charge, to any person obtaining a copy
53
+ of this software and associated documentation files (the "Software"), to deal
54
+ in the Software without restriction, including without limitation the rights
55
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56
+ copies of the Software, and to permit persons to whom the Software is
57
+ furnished to do so, subject to the following conditions:
58
+
59
+ The above copyright notice and this permission notice shall be included in all
60
+ copies or substantial portions of the Software.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68
+ SOFTWARE.
69
+ ```
70
+
71
+ ## @hpke/core 1.9.0
72
+
73
+ License: MIT
74
+ Source: git+https://github.com/dajiaji/hpke-js.git
75
+
76
+ ### LICENSE
77
+
78
+ ```text
79
+ MIT License
80
+
81
+ Copyright (c) 2023 Ajitomi Daisuke
82
+
83
+ Permission is hereby granted, free of charge, to any person obtaining a copy
84
+ of this software and associated documentation files (the "Software"), to deal
85
+ in the Software without restriction, including without limitation the rights
86
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
87
+ copies of the Software, and to permit persons to whom the Software is
88
+ furnished to do so, subject to the following conditions:
89
+
90
+ The above copyright notice and this permission notice shall be included in all
91
+ copies or substantial portions of the Software.
92
+
93
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
94
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
95
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
96
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
97
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
98
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
99
+ SOFTWARE.
100
+ ```
101
+
102
+ ## @hpke/dhkem-x25519 1.8.0
103
+
104
+ License: MIT
105
+ Source: git+https://github.com/dajiaji/hpke-js.git
106
+
107
+ ### LICENSE
108
+
109
+ ```text
110
+ MIT License
111
+
112
+ Copyright (c) 2023 Ajitomi Daisuke
113
+
114
+ Permission is hereby granted, free of charge, to any person obtaining a copy
115
+ of this software and associated documentation files (the "Software"), to deal
116
+ in the Software without restriction, including without limitation the rights
117
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
118
+ copies of the Software, and to permit persons to whom the Software is
119
+ furnished to do so, subject to the following conditions:
120
+
121
+ The above copyright notice and this permission notice shall be included in all
122
+ copies or substantial portions of the Software.
123
+
124
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
125
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
126
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
127
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
128
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
129
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
130
+ SOFTWARE.
131
+ ```
132
+
133
+ ## @noble/curves 2.4.0
134
+
135
+ License: MIT
136
+ Source: git+https://github.com/paulmillr/noble-curves.git
137
+
138
+ ### LICENSE
139
+
140
+ ```text
141
+ The MIT License (MIT)
142
+
143
+ Copyright (c) 2022 Paul Miller (https://paulmillr.com)
144
+
145
+ Permission is hereby granted, free of charge, to any person obtaining a copy
146
+ of this software and associated documentation files (the “Software”), to deal
147
+ in the Software without restriction, including without limitation the rights
148
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
149
+ copies of the Software, and to permit persons to whom the Software is
150
+ furnished to do so, subject to the following conditions:
151
+
152
+ The above copyright notice and this permission notice shall be included in
153
+ all copies or substantial portions of the Software.
154
+
155
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
157
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
158
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
159
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
160
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
161
+ THE SOFTWARE.
162
+ ```
163
+
164
+ ## @noble/hashes 2.4.0
165
+
166
+ License: MIT
167
+ Source: git+https://github.com/paulmillr/noble-hashes.git
168
+
169
+ ### LICENSE
170
+
171
+ ```text
172
+ The MIT License (MIT)
173
+
174
+ Copyright (c) 2022 Paul Miller (https://paulmillr.com)
175
+
176
+ Permission is hereby granted, free of charge, to any person obtaining a copy
177
+ of this software and associated documentation files (the “Software”), to deal
178
+ in the Software without restriction, including without limitation the rights
179
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
180
+ copies of the Software, and to permit persons to whom the Software is
181
+ furnished to do so, subject to the following conditions:
182
+
183
+ The above copyright notice and this permission notice shall be included in
184
+ all copies or substantial portions of the Software.
185
+
186
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
187
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
188
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
189
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
190
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
191
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
192
+ THE SOFTWARE.
193
+ ```
194
+
195
+ ## @scure/bip39 2.4.0
196
+
197
+ License: MIT
198
+ Source: git+https://github.com/paulmillr/scure-bip39.git
199
+
200
+ ### LICENSE
201
+
202
+ ```text
203
+ The MIT License (MIT)
204
+
205
+ Copyright (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com)
206
+
207
+ Permission is hereby granted, free of charge, to any person obtaining a copy
208
+ of this software and associated documentation files (the “Software”), to deal
209
+ in the Software without restriction, including without limitation the rights
210
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
211
+ copies of the Software, and to permit persons to whom the Software is
212
+ furnished to do so, subject to the following conditions:
213
+
214
+ The above copyright notice and this permission notice shall be included in
215
+ all copies or substantial portions of the Software.
216
+
217
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
218
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
219
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
220
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
221
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
222
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
223
+ THE SOFTWARE.
224
+ ```
225
+
226
+ ## base64-js 1.5.1
227
+
228
+ License: MIT
229
+ Source: git://github.com/beatgammit/base64-js.git
230
+
231
+ ### LICENSE
232
+
233
+ ```text
234
+ The MIT License (MIT)
235
+
236
+ Copyright (c) 2014 Jameson Little
237
+
238
+ Permission is hereby granted, free of charge, to any person obtaining a copy
239
+ of this software and associated documentation files (the "Software"), to deal
240
+ in the Software without restriction, including without limitation the rights
241
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
242
+ copies of the Software, and to permit persons to whom the Software is
243
+ furnished to do so, subject to the following conditions:
244
+
245
+ The above copyright notice and this permission notice shall be included in
246
+ all copies or substantial portions of the Software.
247
+
248
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
249
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
250
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
251
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
252
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
253
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
254
+ THE SOFTWARE.
255
+ ```
256
+
257
+ ## bn.js 5.2.5
258
+
259
+ License: MIT
260
+ Source: git@github.com:indutny/bn.js
261
+
262
+ ### LICENSE
263
+
264
+ ```text
265
+ Copyright Fedor Indutny, 2015.
266
+
267
+ Permission is hereby granted, free of charge, to any person obtaining a copy
268
+ of this software and associated documentation files (the "Software"), to deal
269
+ in the Software without restriction, including without limitation the rights
270
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
271
+ copies of the Software, and to permit persons to whom the Software is
272
+ furnished to do so, subject to the following conditions:
273
+
274
+ The above copyright notice and this permission notice shall be included in all
275
+ copies or substantial portions of the Software.
276
+
277
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
278
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
279
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
280
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
281
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
282
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
283
+ SOFTWARE.
284
+ ```
285
+
286
+ ## buffer 6.0.3
287
+
288
+ License: MIT
289
+ Source: git://github.com/feross/buffer.git
290
+
291
+ ### LICENSE
292
+
293
+ ```text
294
+ The MIT License (MIT)
295
+
296
+ Copyright (c) Feross Aboukhadijeh, and other contributors.
297
+
298
+ Permission is hereby granted, free of charge, to any person obtaining a copy
299
+ of this software and associated documentation files (the "Software"), to deal
300
+ in the Software without restriction, including without limitation the rights
301
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
302
+ copies of the Software, and to permit persons to whom the Software is
303
+ furnished to do so, subject to the following conditions:
304
+
305
+ The above copyright notice and this permission notice shall be included in
306
+ all copies or substantial portions of the Software.
307
+
308
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
309
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
310
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
311
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
312
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
313
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
314
+ THE SOFTWARE.
315
+ ```
316
+
317
+ ## ieee754 1.2.1
318
+
319
+ License: BSD-3-Clause
320
+ Source: git://github.com/feross/ieee754.git
321
+
322
+ ### LICENSE
323
+
324
+ ```text
325
+ Copyright 2008 Fair Oaks Labs, Inc.
326
+
327
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
328
+
329
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
330
+
331
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
332
+
333
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
334
+
335
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
336
+ ```
337
+
338
+ ## inherits 2.0.4
339
+
340
+ License: ISC
341
+ Source: git://github.com/isaacs/inherits
342
+
343
+ ### LICENSE
344
+
345
+ ```text
346
+ The ISC License
347
+
348
+ Copyright (c) Isaac Z. Schlueter
349
+
350
+ Permission to use, copy, modify, and/or distribute this software for any
351
+ purpose with or without fee is hereby granted, provided that the above
352
+ copyright notice and this permission notice appear in all copies.
353
+
354
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
355
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
356
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
357
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
358
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
359
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
360
+ PERFORMANCE OF THIS SOFTWARE.
361
+ ```
362
+
363
+ ## keccak 3.0.4
364
+
365
+ License: MIT
366
+ Source: https://github.com/cryptocoinjs/keccak.git
367
+
368
+ ### LICENSE
369
+
370
+ ```text
371
+ The MIT License (MIT)
372
+
373
+ Copyright (c) 2016-2019 https://github.com/cryptocoinjs/keccak contributors
374
+
375
+ Permission is hereby granted, free of charge, to any person obtaining a copy
376
+ of this software and associated documentation files (the "Software"), to deal
377
+ in the Software without restriction, including without limitation the rights
378
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
379
+ copies of the Software, and to permit persons to whom the Software is
380
+ furnished to do so, subject to the following conditions:
381
+
382
+ The above copyright notice and this permission notice shall be included in
383
+ all copies or substantial portions of the Software.
384
+
385
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
386
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
387
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
388
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
389
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
390
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
391
+ THE SOFTWARE.
392
+ ```
393
+
394
+ ## keccak256 1.0.6
395
+
396
+ License: MIT
397
+ Source: https://github.com/miguelmota/keccak256
398
+
399
+ ### LICENSE.md
400
+
401
+ ```text
402
+ MIT license
403
+
404
+ Copyright (C) 2015 Miguel Mota
405
+
406
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
407
+ this software and associated documentation files (the "Software"), to deal in
408
+ the Software without restriction, including without limitation the rights to
409
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
410
+ of the Software, and to permit persons to whom the Software is furnished to do
411
+ so, subject to the following conditions:
412
+
413
+ The above copyright notice and this permission notice shall be included in all
414
+ copies or substantial portions of the Software.
415
+
416
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
417
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
418
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
419
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
420
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
421
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
422
+ SOFTWARE.
423
+ ```
424
+
425
+ ## node-addon-api 2.0.2
426
+
427
+ License: MIT
428
+ Source: git://github.com/nodejs/node-addon-api.git
429
+
430
+ ### LICENSE.md
431
+
432
+ ```text
433
+ The MIT License (MIT)
434
+ =====================
435
+
436
+ Copyright (c) 2017 Node.js API collaborators
437
+ -----------------------------------
438
+
439
+ *Node.js API collaborators listed at <https://github.com/nodejs/node-addon-api#collaborators>*
440
+
441
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
442
+
443
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
444
+
445
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
446
+ ```
447
+
448
+ ## node-gyp-build 4.8.4
449
+
450
+ License: MIT
451
+ Source: https://github.com/prebuild/node-gyp-build.git
452
+
453
+ ### LICENSE
454
+
455
+ ```text
456
+ The MIT License (MIT)
457
+
458
+ Copyright (c) 2017 Mathias Buus
459
+
460
+ Permission is hereby granted, free of charge, to any person obtaining a copy
461
+ of this software and associated documentation files (the "Software"), to deal
462
+ in the Software without restriction, including without limitation the rights
463
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
464
+ copies of the Software, and to permit persons to whom the Software is
465
+ furnished to do so, subject to the following conditions:
466
+
467
+ The above copyright notice and this permission notice shall be included in
468
+ all copies or substantial portions of the Software.
469
+
470
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
471
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
472
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
473
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
474
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
475
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
476
+ THE SOFTWARE.
477
+ ```
478
+
479
+ ## readable-stream 3.6.2
480
+
481
+ License: MIT
482
+ Source: git://github.com/nodejs/readable-stream
483
+
484
+ ### LICENSE
485
+
486
+ ```text
487
+ Node.js is licensed for use as follows:
488
+
489
+ """
490
+ Copyright Node.js contributors. All rights reserved.
491
+
492
+ Permission is hereby granted, free of charge, to any person obtaining a copy
493
+ of this software and associated documentation files (the "Software"), to
494
+ deal in the Software without restriction, including without limitation the
495
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
496
+ sell copies of the Software, and to permit persons to whom the Software is
497
+ furnished to do so, subject to the following conditions:
498
+
499
+ The above copyright notice and this permission notice shall be included in
500
+ all copies or substantial portions of the Software.
501
+
502
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
503
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
504
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
505
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
506
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
507
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
508
+ IN THE SOFTWARE.
509
+ """
510
+
511
+ This license applies to parts of Node.js originating from the
512
+ https://github.com/joyent/node repository:
513
+
514
+ """
515
+ Copyright Joyent, Inc. and other Node contributors. All rights reserved.
516
+ Permission is hereby granted, free of charge, to any person obtaining a copy
517
+ of this software and associated documentation files (the "Software"), to
518
+ deal in the Software without restriction, including without limitation the
519
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
520
+ sell copies of the Software, and to permit persons to whom the Software is
521
+ furnished to do so, subject to the following conditions:
522
+
523
+ The above copyright notice and this permission notice shall be included in
524
+ all copies or substantial portions of the Software.
525
+
526
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
527
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
528
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
529
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
530
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
531
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
532
+ IN THE SOFTWARE.
533
+ """
534
+ ```
535
+
536
+ ## safe-buffer 5.2.1
537
+
538
+ License: MIT
539
+ Source: git://github.com/feross/safe-buffer.git
540
+
541
+ ### LICENSE
542
+
543
+ ```text
544
+ The MIT License (MIT)
545
+
546
+ Copyright (c) Feross Aboukhadijeh
547
+
548
+ Permission is hereby granted, free of charge, to any person obtaining a copy
549
+ of this software and associated documentation files (the "Software"), to deal
550
+ in the Software without restriction, including without limitation the rights
551
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
552
+ copies of the Software, and to permit persons to whom the Software is
553
+ furnished to do so, subject to the following conditions:
554
+
555
+ The above copyright notice and this permission notice shall be included in
556
+ all copies or substantial portions of the Software.
557
+
558
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
559
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
560
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
561
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
562
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
563
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
564
+ THE SOFTWARE.
565
+ ```
566
+
567
+ ## string_decoder 1.3.0
568
+
569
+ License: MIT
570
+ Source: git://github.com/nodejs/string_decoder.git
571
+
572
+ ### LICENSE
573
+
574
+ ```text
575
+ Node.js is licensed for use as follows:
576
+
577
+ """
578
+ Copyright Node.js contributors. All rights reserved.
579
+
580
+ Permission is hereby granted, free of charge, to any person obtaining a copy
581
+ of this software and associated documentation files (the "Software"), to
582
+ deal in the Software without restriction, including without limitation the
583
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
584
+ sell copies of the Software, and to permit persons to whom the Software is
585
+ furnished to do so, subject to the following conditions:
586
+
587
+ The above copyright notice and this permission notice shall be included in
588
+ all copies or substantial portions of the Software.
589
+
590
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
591
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
592
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
593
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
594
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
595
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
596
+ IN THE SOFTWARE.
597
+ """
598
+
599
+ This license applies to parts of Node.js originating from the
600
+ https://github.com/joyent/node repository:
601
+
602
+ """
603
+ Copyright Joyent, Inc. and other Node contributors. All rights reserved.
604
+ Permission is hereby granted, free of charge, to any person obtaining a copy
605
+ of this software and associated documentation files (the "Software"), to
606
+ deal in the Software without restriction, including without limitation the
607
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
608
+ sell copies of the Software, and to permit persons to whom the Software is
609
+ furnished to do so, subject to the following conditions:
610
+
611
+ The above copyright notice and this permission notice shall be included in
612
+ all copies or substantial portions of the Software.
613
+
614
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
615
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
616
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
617
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
618
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
619
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
620
+ IN THE SOFTWARE.
621
+ """
622
+ ```
623
+
624
+ ## util-deprecate 1.0.2
625
+
626
+ License: MIT
627
+ Source: git://github.com/TooTallNate/util-deprecate.git
628
+
629
+ ### LICENSE
630
+
631
+ ```text
632
+ (The MIT License)
633
+
634
+ Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
635
+
636
+ Permission is hereby granted, free of charge, to any person
637
+ obtaining a copy of this software and associated documentation
638
+ files (the "Software"), to deal in the Software without
639
+ restriction, including without limitation the rights to use,
640
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
641
+ copies of the Software, and to permit persons to whom the
642
+ Software is furnished to do so, subject to the following
643
+ conditions:
644
+
645
+ The above copyright notice and this permission notice shall be
646
+ included in all copies or substantial portions of the Software.
647
+
648
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
649
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
650
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
651
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
652
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
653
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
654
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
655
+ OTHER DEALINGS IN THE SOFTWARE.
656
+ ```
@@ -99,6 +99,43 @@ export function toWei(human, decimals = 18) {
99
99
  return BigInt(intPart || "0") * 10n ** BigInt(decimals) + BigInt(frac || "0");
100
100
  }
101
101
 
102
+ // THE ONE NATIVE AMOUNT OF A TOKEN-FUNDED ORDER.
103
+ //
104
+ // The escrow holds the network's NATIVE coin; a quote paid in USDC/USDT carries a different number in the token.
105
+ // The native figure is the quote's own `payNative`, in the network's native decimals. A quote without that figure
106
+ // is a NAMED refusal, never a fallback to the payment amount: rescaling the payment amount is a known wrong answer
107
+ // (10^12 on a 6-decimal token), not a smaller error. This is the rule both the intent target and the escrow order
108
+ // read, so the two cannot diverge.
109
+ export function escrowNativeWei({ quote = null, nativeDecimals = 18 } = {}) {
110
+ const raw = quote ? quote.payNative : null;
111
+ if (raw === null || raw === undefined || raw === "") {
112
+ return { ok: false, code: "native-amount-unread", reason: "the quote carries no native amount" };
113
+ }
114
+ const n = Number(raw);
115
+ if (!Number.isFinite(n) || n <= 0) {
116
+ return { ok: false, code: "native-amount-unread", reason: "the quote's native amount is not a positive number" };
117
+ }
118
+ const dec = Number(nativeDecimals);
119
+ if (!Number.isInteger(dec) || dec < 0) {
120
+ return { ok: false, code: "native-amount-unread", reason: "the native decimals are not a whole number" };
121
+ }
122
+ // THE QUOTE'S OWN DIGITS, NOT A RE-ROUNDED COPY. An exponent form falls back to toFixed(18), as the rest of the
123
+ // page does; everything else keeps exactly the digits it was typed with.
124
+ const text = /e/i.test(String(raw)) ? n.toFixed(18) : String(raw);
125
+ // DECIMAL DIGITS ONLY. BigInt accepts "0x10", and a native amount read as a hex literal would silently become
126
+ // sixteen times the token amount; a quote carries decimal text.
127
+ if (!/^(?:0|[1-9]\d*)(?:\.\d+)?$/.test(text)) {
128
+ return { ok: false, code: "native-amount-unread", reason: "the native amount is not a decimal number" };
129
+ }
130
+ let wei;
131
+ try { wei = toWei(text, dec); }
132
+ catch { return { ok: false, code: "native-amount-unread", reason: "the native amount is not a decimal number" }; }
133
+ if (wei <= 0n) {
134
+ return { ok: false, code: "native-amount-unread", reason: "the native amount rounds to zero wei" };
135
+ }
136
+ return { ok: true, wei: wei.toString(), source: "native" };
137
+ }
138
+
102
139
  // WE SET THE GAS OURSELVES, WITH A MARGIN - A CURE FOR A REAL BUG, NOT CAUTION.
103
140
  // createOrderAndFund goes as ONE transaction, but the wallet estimates it at an address where the escrow does NOT
104
141
  // exist yet: instead of cloning and recording the deposit it counts a plain transfer (21000 plus data). The wallet
package/index.d.ts CHANGED
@@ -1699,7 +1699,11 @@ export interface SweepRunResult {
1699
1699
 
1700
1700
  // --- Recovery// --- Recovery ------------------------------------------------------------------------------
1701
1701
 
1702
- /** Order checks. Both are BEFORE the signature: after it there is nothing to fix. */
1702
+ /** Order checks and pure order helpers. Checks are BEFORE the signature: after it there is nothing to fix. */
1703
+ export type EscrowNativeAmount =
1704
+ | { readonly ok: true; readonly wei: string; readonly source: "native" }
1705
+ | { readonly ok: false; readonly code: "native-amount-unread"; readonly reason: string };
1706
+
1703
1707
  export interface OrderApi {
1704
1708
  /** The order context string the proof and the quote signature are bound to. */
1705
1709
  context(terms: Readonly<Record<string, unknown>>): string;
@@ -1707,6 +1711,13 @@ export interface OrderApi {
1707
1711
  verifyCounterparty(request: { readonly side: unknown; readonly order: Readonly<Record<string, unknown>>; readonly sealed?: unknown; readonly ownEncPriv?: unknown }): unknown;
1708
1712
  /** The joint Monero address from your own spend half and the other's point. */
1709
1713
  jointAddress(request: { readonly ownSpendHalf: string; readonly ownViewHalf: string; readonly otherSpendPoint: string; readonly otherViewPoint: string; readonly network?: string }): unknown;
1714
+ /**
1715
+ * The ONE native amount of a token-funded order: the quote's `payNative` in the network's native decimals.
1716
+ * The escrow holds native coin, so the token amount is never used as the escrow amount (a 6-decimal token
1717
+ * would be off by 10^12). A quote without a native figure answers `{ ok: false, code: "native-amount-unread" }`;
1718
+ * it is never replaced by the payment amount.
1719
+ */
1720
+ escrowNativeWei(request?: { readonly quote?: Readonly<Record<string, unknown>> | null; readonly nativeDecimals?: number }): EscrowNativeAmount;
1710
1721
  /**
1711
1722
  * The order state, READ FROM THE CHAIN (escrow status()): which of the four states the order is in. The state is
1712
1723
  * read by a call, not guessed from logs. It is read by the same chain-read seam as the actions (`evmCall`), so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninsei-labs/sdk",
3
- "version": "0.54.0",
3
+ "version": "0.55.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,6 +55,9 @@
55
55
  "check:order-proof": "node tools/check-order-proof.mjs",
56
56
  "check:daemon-address": "node tools/check-daemon-address.mjs",
57
57
  "check:ci-scripts": "node tools/check-ci-scripts.mjs",
58
+ "check:licenses": "node tools/check-licenses.mjs",
59
+ "notices": "node tools/third-party-notices.mjs",
60
+ "check:notices": "node tools/third-party-notices.mjs --check",
58
61
  "check:factory-selectors": "node tools/check-factory-selectors.mjs",
59
62
  "check:fee-estimate": "node tools/check-fee-estimate.mjs",
60
63
  "check:deadline-scale": "node tools/check-deadline-scale.mjs",
@@ -70,7 +73,8 @@
70
73
  "check:packed-consumer": "node tools/check-packed-consumer.mjs",
71
74
  "check:quote-binding": "node tools/check-quote-binding.mjs",
72
75
  "check:types-consumer": "node node_modules/typescript/bin/tsc -p tools/ts-consumer/tsconfig.json",
73
- "check:monero-live": "node tools/check-monero-live.mjs"
76
+ "check:monero-live": "node tools/check-monero-live.mjs",
77
+ "check:native-amount": "node tools/check-native-amount.mjs"
74
78
  },
75
79
  "types": "./index.d.ts",
76
80
  "exports": {
@@ -109,6 +113,10 @@
109
113
  "./provider": {
110
114
  "types": "./src/public/provider.d.ts",
111
115
  "default": "./src/public/provider.mjs"
116
+ },
117
+ "./relay": {
118
+ "types": "./src/public/relay.d.ts",
119
+ "default": "./src/public/relay.mjs"
112
120
  }
113
121
  },
114
122
  "files": [
@@ -118,7 +126,9 @@
118
126
  "index.d.ts",
119
127
  "README.md",
120
128
  "CHANGELOG.md",
121
- "LICENSE"
129
+ "LICENSE",
130
+ "LICENSE-POLICY.md",
131
+ "THIRD_PARTY_NOTICES.md"
122
132
  ],
123
133
  "engines": {
124
134
  "node": ">=24.22.1"
package/src/index.mjs CHANGED
@@ -249,6 +249,10 @@ export function createNinsei(options) {
249
249
  context: (terms) => contextOf(terms),
250
250
  verifyCounterparty: (request) => verifyCounterparty(request),
251
251
  jointAddress: (request) => jointAddress(request),
252
+ // THE ONE NATIVE AMOUNT OF A TOKEN-FUNDED ORDER. The escrow holds native coin, while a stablecoin quote
253
+ // carries a different number in the token; this reads the quote's native figure. A quote without it is a
254
+ // named refusal (`native-amount-unread`), never a rescale of the payment amount.
255
+ escrowNativeWei: (request) => engine.evm.escrowNativeWei(request),
252
256
  // ORDER STATE FROM THE CHAIN (escrow slot 3): which of the four states the order is in. Read, not guessed
253
257
  // from logs - the very call the engine used to make from www/js/core/swap-flow.js.
254
258
  status: (escrow) => orderFlow.orderStatus(escrow, orderDeps),
@@ -0,0 +1,77 @@
1
+ export declare const RELAY_FEATURES_TYPE_NAME: "NodeFeatures";
2
+ export declare const RELAY_DOMAIN_NAME: "Ninsei Relay";
3
+ export declare const RELAY_DOMAIN_VERSION: "1";
4
+ export declare const FIRM_WINDOW_TYPE: string;
5
+ export declare const NODE_FEATURES_TYPE: string;
6
+ export declare const FIRM_WINDOW_FIELDS: ReadonlyArray<readonly [string, string]>;
7
+ export declare const NODE_FEATURES_FIELDS: ReadonlyArray<readonly [string, string]>;
8
+
9
+ export interface RelayFirmWindow {
10
+ market: string;
11
+ side: "ask" | "bid";
12
+ xmrNetwork: string;
13
+ readyMinSeconds: number;
14
+ readyMaxSeconds: number;
15
+ settlementMinSeconds: number;
16
+ settlementMaxSeconds: number;
17
+ quoteTtlSeconds: number;
18
+ }
19
+
20
+ export interface RelayNodeFeatures {
21
+ type: "node_features";
22
+ version: 1;
23
+ relayId: string;
24
+ provider: string;
25
+ quoteKey: string;
26
+ registry: string;
27
+ capabilities: string[];
28
+ hpkeKey: string;
29
+ firmWindows: RelayFirmWindow[];
30
+ time: number;
31
+ nonce: string;
32
+ signature: string;
33
+ }
34
+
35
+ export interface RelayVerifyTerms {
36
+ market: string;
37
+ side: "ask" | "bid";
38
+ maker: string;
39
+ registry: string;
40
+ xmrNetwork: string;
41
+ }
42
+
43
+ export declare function nodeFeaturesStructHash(features: RelayNodeFeatures): Uint8Array;
44
+ export declare function nodeFeaturesDomainSeparator(): Uint8Array;
45
+ export declare function nodeFeaturesDigest(features: RelayNodeFeatures): Uint8Array;
46
+ export declare function verifyNodeFeatures(input: { features: RelayNodeFeatures; terms?: RelayVerifyTerms | null }): {
47
+ featuresHash: string;
48
+ hpkeKey: string;
49
+ window: RelayFirmWindow | null;
50
+ };
51
+ export declare function nodeFeaturesMissingFields(features: Partial<RelayNodeFeatures>): string[];
52
+
53
+ export declare function firmTermsDigest(input: { crypto: { keccak256(bytes: Uint8Array): Uint8Array }; terms: Record<string, unknown> }): Uint8Array;
54
+ export declare function firmTermsMissingFields(terms: Record<string, unknown>): string[];
55
+
56
+ export declare const RELAY_VIEW_INFO_PREFIX: string;
57
+ export declare function relayViewInfo(input: {
58
+ termsDigest: string;
59
+ commitHalf: string;
60
+ edPoint: string;
61
+ edViewPointClient: string;
62
+ edViewPointNode: string;
63
+ }): Uint8Array;
64
+ export declare function sealViewEnvelope(input: { hpkeKey: string; info: Uint8Array; plaintext: Uint8Array }): Promise<{ enc: string; ciphertext: string }>;
65
+ export declare function openViewEnvelope(input: { privateKey: string; enc: string; ciphertext: string; info: Uint8Array }): Promise<Uint8Array>;
66
+
67
+ export declare const RELAY_QUOTE_TYPE: string;
68
+ export declare function relayQuoteStructHash(answer: Record<string, unknown>): Uint8Array;
69
+ export declare function relayQuoteDomainSeparator(): Uint8Array;
70
+ export declare function relayQuoteDigest(answer: Record<string, unknown>): Uint8Array;
71
+ export declare function verifyRelayQuoteFrame(answer: Record<string, unknown>, quoteKey: string): Record<string, unknown>;
72
+ export declare function verifyFirmAnswer(input: {
73
+ answer: Record<string, unknown>;
74
+ features: RelayNodeFeatures;
75
+ request: { terms: Record<string, unknown>; edViewPointClient: string; edViewPointNode: string };
76
+ now?: number | null;
77
+ }): Record<string, unknown>;
@@ -0,0 +1,37 @@
1
+ // THE RELAY EXCHANGE FOR A NODE THAT EMBEDS THE SDK.
2
+ //
3
+ // A maker needs the other half of the same rules a client uses: the public features digest it signs, the terms
4
+ // digest, the HPKE view envelope it opens, and the answer verifier. Names only; no second implementation.
5
+
6
+ export {
7
+ RELAY_FEATURES_TYPE_NAME,
8
+ RELAY_DOMAIN_NAME,
9
+ RELAY_DOMAIN_VERSION,
10
+ FIRM_WINDOW_TYPE,
11
+ NODE_FEATURES_TYPE,
12
+ FIRM_WINDOW_FIELDS,
13
+ NODE_FEATURES_FIELDS,
14
+ nodeFeaturesStructHash,
15
+ nodeFeaturesDomainSeparator,
16
+ nodeFeaturesDigest,
17
+ verifyNodeFeatures,
18
+ nodeFeaturesMissingFields,
19
+ } from "../relayFeatures.mjs";
20
+
21
+ export { firmTermsDigest, firmTermsMissingFields } from "../relayTerms.mjs";
22
+
23
+ export {
24
+ RELAY_VIEW_INFO_PREFIX,
25
+ relayViewInfo,
26
+ sealViewEnvelope,
27
+ openViewEnvelope,
28
+ } from "../relayView.mjs";
29
+
30
+ export {
31
+ RELAY_QUOTE_TYPE,
32
+ relayQuoteStructHash,
33
+ relayQuoteDomainSeparator,
34
+ relayQuoteDigest,
35
+ verifyRelayQuoteFrame,
36
+ verifyFirmAnswer,
37
+ } from "../relayQuote.mjs";
package/src/record.mjs CHANGED
@@ -54,6 +54,16 @@ export function createRecord(input, { order = null, side: knownSide = null } = {
54
54
  // both the slot check against the chain and the address check read them.
55
55
  half: halfHex(side.half), viewHalf: halfHex(side.viewHalf),
56
56
  edPointLocker: norm(side.pub.ed), edViewPointLocker: norm(side.viewPub) };
57
+ // THE XMR AMOUNT THE PROVIDER SIGNED, IN ATOMIC UNITS. The record's `xmrAmount` is a display number rounded
58
+ // from the quote; the signed order carries the exact integer. The arrival check compares against the signed
59
+ // figure, so it must survive the record and the recovery file unchanged (never re-derived from the display
60
+ // number). A malformed value is a refusal before anything is saved.
61
+ if (input.expectedAtomic !== undefined && input.expectedAtomic !== null) {
62
+ let atomic;
63
+ try { atomic = BigInt(String(input.expectedAtomic)); } catch { throw new SdkError("bad-input", { field: "expectedAtomic" }); }
64
+ if (atomic <= 0n) throw new SdkError("bad-input", { field: "expectedAtomic" });
65
+ escrow.expectedAtomic = atomic.toString();
66
+ }
57
67
  // THE SIDE'S ENCRYPTION KEY - only the public one: the private one stays with the side and never enters the record.
58
68
  if (side.enc && side.enc.pub) escrow.encPub = norm(side.enc.pub);
59
69
  const record = { ...swap, escrow };
package/src/swaps.mjs CHANGED
@@ -295,6 +295,10 @@ const recordInputOf = (request) => {
295
295
  payToken: quote.asset ? String(quote.asset).toLowerCase() : undefined,
296
296
  payAmount: quote.amount !== undefined ? quote.amount : undefined,
297
297
  xmrAmount: quote.size !== undefined ? quote.size : undefined,
298
+ // THE SIGNED INTEGER, NOT THE DISPLAY NUMBER. `quote.size` is a rounded view of the XMR amount; the signed
299
+ // order's `xmrAmount` is the exact atomic value the maker will pay, and the arrival check compares that one.
300
+ expectedAtomic: request.order && request.order.xmrAmount !== undefined && request.order.xmrAmount !== null
301
+ ? request.order.xmrAmount : undefined,
298
302
  // THE ORDER-QUOTE ID IS PART OF THE RECORD, NOT A DETAIL OF THE SCREEN (a defect found): our service uses it to
299
303
  // tie the created escrow to the provider node's record, and without it the node cannot take the ETH
300
304
  // (sdk/src/swap-flow.mjs: quoteId: quote.id -> swap.orderQuoteId; markBodyOf reads exactly this field).
package/src/sweep.mjs CHANGED
@@ -85,7 +85,16 @@ const payloadFromOrder = async (request) => {
85
85
  ownSpendHalf: halves.spendHalf, ownViewHalf: halves.viewHalf,
86
86
  otherSpendPoint, otherViewPoint, network: moneroNetwork,
87
87
  });
88
- const escrow = { address: order.escrow, readyBy: order.readyBy, t1: order.t1 };
88
+ // THE SIGNED XMR AMOUNT TRAVELS WITH THE ESCROW. A recovery file rebuilt from the chain must compare the
89
+ // arrival against the exact integer the order carries, not against the rounded display number.
90
+ const signedAtomic = (() => {
91
+ try {
92
+ const atomic = BigInt(String(order.xmrAmount));
93
+ return atomic > 0n ? atomic.toString() : null;
94
+ } catch { return null; }
95
+ })();
96
+ const escrow = { address: order.escrow, readyBy: order.readyBy, t1: order.t1,
97
+ ...(signedAtomic ? { expectedAtomic: signedAtomic } : {}) };
89
98
  const payload = engine.recoveryFile.buildPayload({
90
99
  swap: {
91
100
  id: order.escrow, side, network, moneroNetwork,
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.54.0";
9
+ export const SDK_VERSION = "0.55.1";