@ninsei-labs/sdk 0.44.1 → 0.44.3

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,25 @@
1
+ ## 0.44.3 — 2026-10-20
2
+
3
+ A RESCAN THAT THE LIBRARY REFUSES DOES NOT STOP THE RESTORE.
4
+
5
+ - `sweep.restore` still asks for the rescan first. If the wallet library refuses it, the pass continues to the
6
+ sync and the balance, exactly as a failed sync already did. A wallet opened from keys carries its height from
7
+ creation, so a library that cannot rescan a chain can still serve the withdrawal. The spendable balance stays
8
+ the verdict, not the rescan.
9
+
10
+ ## 0.44.2 — 2026-10-20
11
+
12
+ REGTEST HAS A NAME THE PACKAGE KNOWS.
13
+
14
+ - `networkFromNode` accepts `fakechain`, the answer a `monerod` in regtest mode gives. Every stand and the CI
15
+ contour run that mode, and the withdrawal page builds its wallet from the recovery file, so refusing the name
16
+ stopped a run against a node the page is meant to test. The answer is passed through as `fakechain`; an unknown
17
+ word is still `null`, not a guess.
18
+ - The type declaration and the wallet-factory check name the fourth answer.
19
+ - The `Swap` type is gone. Nothing in the package returned one, so a reader could build on `swap.sweep()`
20
+ and find it at runtime. The working surfaces are unchanged: `swaps.get`/`swaps.toState`, `actions.markReady`,
21
+ `actions.claim`, `actions.refund`, and `sweep` for the withdrawal.
22
+
1
23
  ## 0.44.1 — 2026-10-20
2
24
 
3
25
  TWO ENTRIES A BACKEND NEEDS WHEN IT STOPS READING THE PAGE'S SOURCE.
@@ -5,9 +5,13 @@
5
5
  // mapping used to be a private function of the sweep page, which made "what a node may say" knowledge of one
6
6
  // interface.
7
7
  //
8
- // AN UNKNOWN ANSWER IS NULL, NOT A GUESS. Defaulting to a network would build a wallet for a chain the node may not
9
- // serve; the caller can then say which answer it got and stop.
10
- const KNOWN = new Set(["mainnet", "stagenet", "testnet"]);
8
+ // REGTEST JOINS THEM BY ITS OFFICIAL NAME. monerod in regtest mode answers `fakechain`; the CI contour and every
9
+ // local stand run that mode, and the wallet's own network comes from the recovery file, not from this answer. Without
10
+ // the name the page refuses a node it is supposed to test against. It is a KNOWN name, not a wildcard.
11
+ //
12
+ // AN UNKNOWN ANSWER IS STILL NULL, NOT A GUESS. Defaulting to a network would build a wallet for a chain the node may
13
+ // not serve; the caller can then say which answer it got and stop.
14
+ const KNOWN = new Set(["mainnet", "stagenet", "testnet", "fakechain"]);
11
15
 
12
16
  export function networkFromNode(info) {
13
17
  const type = String((info && info.nettype) || "").trim().toLowerCase();
package/index.d.ts CHANGED
@@ -1114,20 +1114,6 @@ export interface RecoveryFile {
1114
1114
  readonly contents: string;
1115
1115
  }
1116
1116
 
1117
- export interface Swap {
1118
- readonly id: string;
1119
- /** The current state. Also arrives in the subscription. */
1120
- state(): SwapState;
1121
- /** Subscribe to changes. Returns an unsubscribe function. */
1122
- on(event: "update", handler: (state: SwapState) => void): () => void;
1123
- /** The "checked by you" mark: opens the claim to the maker. */
1124
- markReady(): Promise<SwapState>;
1125
- /** Withdraw the XMR to the recipient's address. */
1126
- sweep(): Promise<SwapState>;
1127
- /** Refund the ETH when the claim did not happen. */
1128
- refund(): Promise<SwapState>;
1129
- }
1130
-
1131
1117
  export interface SwapState {
1132
1118
  readonly id: string;
1133
1119
  readonly direction: "buy" | "sell";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninsei-labs/sdk",
3
- "version": "0.44.1",
3
+ "version": "0.44.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -322,7 +322,7 @@ export declare function sellWindowSec(request?: {
322
322
  * mainnet wallet against a stagenet node looks like a broken withdrawal. An answer that is none of `mainnet`,
323
323
  * `stagenet`, `testnet` comes back as null - a default would build a wallet for a chain the node may not serve.
324
324
  */
325
- export declare function networkFromNode(info: unknown): "mainnet" | "stagenet" | "testnet" | null;
325
+ export declare function networkFromNode(info: unknown): "mainnet" | "stagenet" | "testnet" | "fakechain" | null;
326
326
 
327
327
  /** An address read as its network and its public keys. An integrated address's payment id is not returned. */
328
328
  export interface AddressKeys {
@@ -92,7 +92,10 @@ export async function restoreWallet(request = {}) {
92
92
  // A RESCAN IS REQUIRED, NOT OPTIONAL: without it the height only applies to a wallet that has not scanned yet,
93
93
  // and a wallet restored from a key has. A driver that cannot rescan is the caller's mistake, named here.
94
94
  if (typeof driver.rescanBlockchain !== "function") throw new SdkError("bad-input", { field: "wallet.driver.rescanBlockchain" });
95
- await step("rescanBlockchain", () => driver.rescanBlockchain());
95
+ // A RESCAN IS BEST-EFFORT, LIKE THE SYNC BELOW. A wallet built from keys already carries the height it was opened
96
+ // with, and a library that cannot rescan a chain (monero-ts against a regtest node answers "failed to get hashes")
97
+ // would otherwise stop a withdrawal the sync can still serve. The balance below is the verdict, not the rescan.
98
+ try { await step("rescanBlockchain", () => driver.rescanBlockchain()); } catch { /* the balance decides */ }
96
99
 
97
100
  // A FAILED SYNC IS BEST-EFFORT, exactly as in the signing step: what blocks a withdrawal is the spendable
98
101
  // remainder, and it is read below. The library throws low-level while scanning a chain it cannot read; that must
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.1";
9
+ export const SDK_VERSION = "0.44.3";