@ninsei-labs/sdk 0.44.0 → 0.44.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 +12 -0
- package/package.json +5 -1
- package/src/public/core.d.ts +6 -0
- package/src/public/core.mjs +1 -1
- package/src/public/networks.d.ts +50 -0
- package/src/public/networks.mjs +9 -0
- package/src/public/xmr.d.ts +22 -0
- package/src/public/xmr.mjs +3 -0
- package/src/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 0.44.1 — 2026-10-20
|
|
2
|
+
|
|
3
|
+
TWO ENTRIES A BACKEND NEEDS WHEN IT STOPS READING THE PAGE'S SOURCE.
|
|
4
|
+
|
|
5
|
+
- `./networks` names the registry the engine already holds: `CHAINS`, `DEX_CHAINS`, `DEFAULT_CHAIN` and
|
|
6
|
+
`ASYNC_ROUTE_PROVIDERS`. A service that validates a chain id or a token against the same data the page
|
|
7
|
+
reads cannot drift from it. Nothing is re-implemented; the entry only re-exports `engine/core/config.js`.
|
|
8
|
+
- `./core` now also exports `normalizeAmountInput`, the text a person typed reduced to a decimal string, so a
|
|
9
|
+
backend does not carry a second reader of the same field.
|
|
10
|
+
- `./xmr` now names the block walk a watcher runs: `scanRange`, `viewKeyFormForAddress` and `laterBoundary`, all
|
|
11
|
+
from `engine/monero/scan.js`. A backend watching a deposit no longer reaches into the page's source.
|
|
12
|
+
|
|
1
13
|
## 0.44.0 — 2026-10-19
|
|
2
14
|
|
|
3
15
|
THE WITHDRAWAL AND THE NODE NOW ASK THE PACKAGE INSTEAD OF CARRYING THEIR OWN COPIES. Every rule below was
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninsei-labs/sdk",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"types": "./src/public/core.d.ts",
|
|
70
70
|
"default": "./src/public/core.mjs"
|
|
71
71
|
},
|
|
72
|
+
"./networks": {
|
|
73
|
+
"types": "./src/public/networks.d.ts",
|
|
74
|
+
"default": "./src/public/networks.mjs"
|
|
75
|
+
},
|
|
72
76
|
"./recovery": {
|
|
73
77
|
"types": "./src/public/recovery.d.ts",
|
|
74
78
|
"default": "./src/public/recovery.mjs"
|
package/src/public/core.d.ts
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function parseAmount(raw: string | number | null | undefined): number | null;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The same field text reduced to something a decimal parser can read: thousands separators removed, a lone comma
|
|
17
|
+
* read as the decimal separator, anything after a second separator dropped. Empty when the text carries no digit.
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeAmountInput(raw: string | number | null | undefined): string;
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* ATOMIC UNITS -> A DECIMAL STRING. One XMR is 10^12 atomic units; the conversion uses BigInt, so a value above
|
|
17
23
|
* 2^53 (about 9007 XMR in piconero) is not rounded. Dust does not vanish: 1 unit is "0.000000000001". `trim`
|
package/src/public/core.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// One function today. It is a separate entry because it belongs to neither the XMR side nor the EVM side, and a
|
|
4
4
|
// consumer forced to import it from either would learn a false lesson about where it lives.
|
|
5
5
|
|
|
6
|
-
export { parseAmount } from "../../engine/core/format.js";
|
|
6
|
+
export { normalizeAmountInput, parseAmount } from "../../engine/core/format.js";
|
|
7
7
|
|
|
8
8
|
// XMR AMOUNTS IN ATOMIC UNITS: 12 decimals, bigint, no rounding. `formatXmr` for display and for a field,
|
|
9
9
|
// `parseXmr` for what a person typed.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// DECLARATIONS FOR THE `./networks` ENTRY.
|
|
2
|
+
//
|
|
3
|
+
// src/public/networks.mjs only NAMES what engine/core/config.js already exports. The declarations cover the fields
|
|
4
|
+
// a consumer of the registry reads; the engine's objects carry more (explorers, price feeds, gas hints) and a
|
|
5
|
+
// consumer is free to read them, but nothing here invents a field the engine does not have.
|
|
6
|
+
|
|
7
|
+
/** A token the network accepts. `address` is a 20-byte hex string; `decimals` is what its own contract reports. */
|
|
8
|
+
export interface ChainToken {
|
|
9
|
+
symbol: string;
|
|
10
|
+
address: string;
|
|
11
|
+
decimals: number;
|
|
12
|
+
hidden?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The DEX deployment on a network, when there is one. */
|
|
16
|
+
export interface ChainUniswap {
|
|
17
|
+
factory?: string;
|
|
18
|
+
quoter?: string;
|
|
19
|
+
/** WETH: the wrapped form of the native coin, used when a route needs an ERC-20. */
|
|
20
|
+
wrapped?: { address: string; decimals: number };
|
|
21
|
+
[field: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Chain {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
vm: string;
|
|
28
|
+
chainId: number;
|
|
29
|
+
caip2?: string;
|
|
30
|
+
testnet?: boolean;
|
|
31
|
+
native: { symbol: string; decimals: number };
|
|
32
|
+
rpcUrl?: string;
|
|
33
|
+
tokens?: ChainToken[];
|
|
34
|
+
uniswap?: ChainUniswap;
|
|
35
|
+
[field: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** One entry per async route provider (CoWSwap, UniswapX, ...): what it settles and the networks it serves. */
|
|
39
|
+
export interface AsyncRouteProvider {
|
|
40
|
+
venue?: string;
|
|
41
|
+
shape?: string;
|
|
42
|
+
settles?: string;
|
|
43
|
+
networks?: Record<string, unknown>;
|
|
44
|
+
[field: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare const CHAINS: readonly Chain[];
|
|
48
|
+
export declare const DEX_CHAINS: readonly string[];
|
|
49
|
+
export declare const DEFAULT_CHAIN: string;
|
|
50
|
+
export declare const ASYNC_ROUTE_PROVIDERS: Readonly<Record<string, AsyncRouteProvider>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// THE NETWORK REGISTRY, FOR A CONSUMER THAT IS NOT THE BROWSER.
|
|
2
|
+
//
|
|
3
|
+
// The registry is one structure: each network names its chain id, its native coin, the tokens it accepts and,
|
|
4
|
+
// where it exists, the DEX deployment. A backend that validates a chain id and a token against it must read the
|
|
5
|
+
// same data the page reads, or the two drift apart silently.
|
|
6
|
+
//
|
|
7
|
+
// Names only: the engine owns the values. Nothing here is re-implemented.
|
|
8
|
+
|
|
9
|
+
export { ASYNC_ROUTE_PROVIDERS, CHAINS, DEFAULT_CHAIN, DEX_CHAINS } from "../../engine/core/config.js";
|
package/src/public/xmr.d.ts
CHANGED
|
@@ -471,3 +471,25 @@ export declare function probeMoneroNode(options: {
|
|
|
471
471
|
fetchImpl?: typeof fetch;
|
|
472
472
|
timeoutMs?: number;
|
|
473
473
|
}): Promise<NodeProbeOk | NodeProbeRefusal>;
|
|
474
|
+
|
|
475
|
+
/** The watch key form that matches the address's view public key, or null when none does. */
|
|
476
|
+
export declare function viewKeyFormForAddress(viewSecret: string, expectedViewPubHex: string): string | null;
|
|
477
|
+
|
|
478
|
+
/** A boundary height derived from a later unlock_time, or null when the time names no height. */
|
|
479
|
+
export declare function laterBoundary(...args: unknown[]): unknown;
|
|
480
|
+
|
|
481
|
+
/** One transaction that carries an output for a watched address. */
|
|
482
|
+
export interface ScannedMatch {
|
|
483
|
+
[field: string]: unknown;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** Walk a block range and return the transactions that pay a watched address. */
|
|
487
|
+
export declare function scanRange(options: {
|
|
488
|
+
daemonUrl: string;
|
|
489
|
+
fromHeight: number;
|
|
490
|
+
toHeight: number;
|
|
491
|
+
watched: unknown;
|
|
492
|
+
log?: (event: unknown) => void;
|
|
493
|
+
concurrency?: number;
|
|
494
|
+
nowSec?: number | null;
|
|
495
|
+
}): Promise<ScannedMatch[]>;
|
package/src/public/xmr.mjs
CHANGED
|
@@ -20,6 +20,9 @@ export {
|
|
|
20
20
|
prefixFor,
|
|
21
21
|
} from "../../engine/monero/address.js";
|
|
22
22
|
|
|
23
|
+
// THE BLOCK WALK A WATCHER RUNS: the same scanner the page uses, without a wallet.
|
|
24
|
+
export { laterBoundary, scanRange, viewKeyFormForAddress } from "../../engine/monero/scan.js";
|
|
25
|
+
|
|
23
26
|
export { createHalves } from "../../engine/atomic/halves.js";
|
|
24
27
|
export { createDleq2 } from "../../engine/atomic/dleq2.js";
|
|
25
28
|
|
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.44.
|
|
9
|
+
export const SDK_VERSION = "0.44.1";
|