@needmoretruth/nmts-cli 0.54.1 → 0.54.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 +8 -0
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/dist/artifact-about.d.ts +1 -1
- package/dist/client-id.d.ts +1 -1
- package/dist/client-id.js +1 -1
- package/dist/commands/push.js +5 -1
- package/dist/commands/put-wallet.js +5 -1
- package/dist/commands/put.js +5 -1
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/upload-road.d.ts +33 -0
- package/dist/upload-road.js +93 -0
- package/dist/upload-wallet-chain.js +7 -1
- package/dist/upload-wire.d.ts +2 -1
- package/dist/upload.js +5 -5
- package/dist/walrus-write.js +6 -4
- package/dist/walrus.d.ts +3 -0
- package/dist/walrus.js +3 -0
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
Each version's entry is what changed for the person or the program using `nmts`. The product's own
|
|
4
4
|
update history, which covers the site and the server too, is at https://nmts.me/updates.
|
|
5
5
|
|
|
6
|
+
## 0.54.2 — 2026-11-09
|
|
7
|
+
|
|
8
|
+
- When Mysten Labs' upload relay does not answer, uploads (`put`, `push`) now go through NMTS's own
|
|
9
|
+
relay on the NMTS server instead of failing. On that road a file is sent in parts of at most
|
|
10
|
+
64 MiB, one at a time. Each part carries Walrus's fixed cost per blob, so a large file costs up to
|
|
11
|
+
about 20% more, and the price the review shows already counts those parts. While the relay carries
|
|
12
|
+
another upload, the next one waits and then goes.
|
|
13
|
+
|
|
6
14
|
## 0.54.1 — 2026-11-09
|
|
7
15
|
|
|
8
16
|
- `nmts wallet activity` and `nmts wallet list` no longer stop with an error when a Sui node refuses
|
package/README.ko.md
CHANGED
|
@@ -50,7 +50,7 @@ nmts --help
|
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
52
|
npm install -g github:needmoretruth/nmts-cli # 기본 브랜치
|
|
53
|
-
npm install -g github:needmoretruth/nmts-cli#v0.54.
|
|
53
|
+
npm install -g github:needmoretruth/nmts-cli#v0.54.2 # 버전을 고정할 때
|
|
54
54
|
npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
|
|
55
55
|
```
|
|
56
56
|
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ default branch, from a pinned version, or from the tarball attached to the
|
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
53
|
npm install -g github:needmoretruth/nmts-cli # the default branch
|
|
54
|
-
npm install -g github:needmoretruth/nmts-cli#v0.54.
|
|
54
|
+
npm install -g github:needmoretruth/nmts-cli#v0.54.2 # a pinned version
|
|
55
55
|
npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
|
|
56
56
|
```
|
|
57
57
|
|
package/dist/artifact-about.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const CRYPTO_SPEC_URL = "https://github.com/needmoretruth/nmts-re
|
|
|
11
11
|
* is the field's own contract — what the writer says about itself — and a person holding two
|
|
12
12
|
* copies of one account's artefacts can then tell which program made each.
|
|
13
13
|
*/
|
|
14
|
-
export declare const WRITTEN_BY = "nmts-cli 0.54.
|
|
14
|
+
export declare const WRITTEN_BY = "nmts-cli 0.54.2";
|
|
15
15
|
/** Which of the three artefacts a wrapper is. A reader holding several can sort them. */
|
|
16
16
|
export type ArtifactKind = "recovery-list" | "file-list" | "recovery-kit";
|
|
17
17
|
/**
|
package/dist/client-id.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type ClientKind = "cli" | "mcp" | "sdk";
|
|
|
7
7
|
* points with `"sdk"` and the SDK's own version.
|
|
8
8
|
*/
|
|
9
9
|
export declare function identifyClient(next: ClientKind, nextVersion?: string): void;
|
|
10
|
-
/** `cli/0.54.
|
|
10
|
+
/** `cli/0.54.2`, `mcp/0.54.1`, `sdk/0.17.0`. */
|
|
11
11
|
export declare function clientHeaderValue(): string;
|
package/dist/client-id.js
CHANGED
|
@@ -24,7 +24,7 @@ export function identifyClient(next, nextVersion = VERSION) {
|
|
|
24
24
|
kind = next;
|
|
25
25
|
version = nextVersion;
|
|
26
26
|
}
|
|
27
|
-
/** `cli/0.54.
|
|
27
|
+
/** `cli/0.54.2`, `mcp/0.54.1`, `sdk/0.17.0`. */
|
|
28
28
|
export function clientHeaderValue() {
|
|
29
29
|
return `${kind}/${version}`;
|
|
30
30
|
}
|
package/dist/commands/push.js
CHANGED
|
@@ -32,6 +32,7 @@ import { fileSource } from "../upload-file-node.js";
|
|
|
32
32
|
import { createUploadApi } from "../upload-api.js";
|
|
33
33
|
import { clearItemRecord, clearReservation } from "../upload-store.js";
|
|
34
34
|
import { CREDIT_BYTES, partSizeFor, planAndPrice, UPLOAD_EPOCHS } from "../upload-price.js";
|
|
35
|
+
import { chooseUploadRoad, partSizeForRoad } from "../upload-road.js";
|
|
35
36
|
import { createBlobProtocol, readCurrentEpoch } from "../walrus-write.js";
|
|
36
37
|
import { ensureFolderPath } from "../drive-edit.js";
|
|
37
38
|
import { payerOf, refuseWalletOnlyOptions } from "./put.js";
|
|
@@ -70,7 +71,10 @@ export async function push(target, options = {}) {
|
|
|
70
71
|
return 0;
|
|
71
72
|
}
|
|
72
73
|
const session = await openSession({ server: options.server, network: options.network });
|
|
73
|
-
|
|
74
|
+
// ⛔ THE ROAD BEFORE THE PRICE (D50): on NMTS's own relay the parts are 64 MiB, and the credits
|
|
75
|
+
// quoted below are the credits of those parts.
|
|
76
|
+
await chooseUploadRoad({ network: session.network, server: session.server, apiKey: session.apiKey });
|
|
77
|
+
const partSize = partSizeForRoad(partSizeFor(options.partSize));
|
|
74
78
|
// ⛔ READ BEFORE ANYTHING IS SEALED OR PAID FOR — a typo must not surface after the money.
|
|
75
79
|
const asked = parseAsked(options.onCollision);
|
|
76
80
|
const list = await readFileList(session.server, session.apiKey, session.code, session.accountId);
|
|
@@ -31,6 +31,7 @@ import { stderrSink } from "../progress-node.js";
|
|
|
31
31
|
import { resolveServer } from "../server.js";
|
|
32
32
|
import { fileSource } from "../upload-file-node.js";
|
|
33
33
|
import { partSizeFor } from "../upload-price.js";
|
|
34
|
+
import { chooseUploadRoad, partSizeForRoad } from "../upload-road.js";
|
|
34
35
|
import { measureLocal } from "../upload-price-node.js";
|
|
35
36
|
import { downloadForRefill, findOriginal, settleRefill } from "../refill-source.js";
|
|
36
37
|
import { describeUploadReview } from "../upload-wallet-plan.js";
|
|
@@ -60,6 +61,9 @@ export async function putWithWallet(target, options) {
|
|
|
60
61
|
const stored = readCredentialsFile();
|
|
61
62
|
const server = resolveServer(options.server ?? stored?.server);
|
|
62
63
|
const network = resolveNetwork(server, options.network ?? stored?.network);
|
|
64
|
+
// ⛔ THE ROAD BEFORE THE PRICE (D50): on NMTS's own relay the parts are 64 MiB, and the credits
|
|
65
|
+
// quoted below are the credits of those parts.
|
|
66
|
+
await chooseUploadRoad({ network, server, apiKey: key.key });
|
|
63
67
|
const identity = await identityOf(resolved.code);
|
|
64
68
|
const crypt = await loadCrypto();
|
|
65
69
|
const asked = parseAsked(options.onCollision);
|
|
@@ -84,7 +88,7 @@ export async function putWithWallet(target, options) {
|
|
|
84
88
|
network,
|
|
85
89
|
accountId: identity.accountId,
|
|
86
90
|
crypt,
|
|
87
|
-
partSize: partSizeFor(options.partSize),
|
|
91
|
+
partSize: partSizeForRoad(partSizeFor(options.partSize)),
|
|
88
92
|
rule,
|
|
89
93
|
onCollision: asked,
|
|
90
94
|
settings: list.manifest?.settings,
|
package/dist/commands/put.js
CHANGED
|
@@ -14,6 +14,7 @@ import { basename, resolve } from "node:path";
|
|
|
14
14
|
import { identityOf } from "../account.js";
|
|
15
15
|
import { requireAccountCode } from "../code-access.js";
|
|
16
16
|
import { API_KEY_ENV_VAR, CODE_ENV_VAR, readCredentialsFile, resolveApiKey } from "../credentials.js";
|
|
17
|
+
import { chooseUploadRoad, partSizeForRoad } from "../upload-road.js";
|
|
17
18
|
import { parseAsked } from "../collision.js";
|
|
18
19
|
import { depositDefaultOf, depositLines, parseDeposit, refuseDepositWithWallet } from "../deposit.js";
|
|
19
20
|
import { DERIVED, loadCrypto } from "../crypto.js";
|
|
@@ -103,10 +104,13 @@ export async function put(target, options = {}) {
|
|
|
103
104
|
}
|
|
104
105
|
const localPath = resolve(target);
|
|
105
106
|
const size = measureLocal(localPath);
|
|
106
|
-
const partSize = partSizeFor(options.partSize);
|
|
107
107
|
const stored = readCredentialsFile();
|
|
108
108
|
const server = resolveServer(options.server ?? stored?.server);
|
|
109
109
|
const network = resolveNetwork(server, options.network ?? stored?.network);
|
|
110
|
+
// ⛔ THE ROAD BEFORE THE PRICE (D50): on NMTS's own relay the parts are 64 MiB, and the credits
|
|
111
|
+
// quoted below are the credits of those parts.
|
|
112
|
+
await chooseUploadRoad({ network, server, apiKey: key.key });
|
|
113
|
+
const partSize = partSizeForRoad(partSizeFor(options.partSize));
|
|
110
114
|
const identity = await identityOf(resolved.code);
|
|
111
115
|
const crypt = await loadCrypto();
|
|
112
116
|
const [from, to] = DERIVED.dataKey;
|
package/dist/product.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const BINARY_NAME = "nmts";
|
|
|
9
9
|
* beside it. Here rather than in `main.ts` because the MCP server has to say it too, and a
|
|
10
10
|
* command importing the entry point is a cycle waiting to bite.
|
|
11
11
|
*/
|
|
12
|
-
export declare const VERSION = "0.54.
|
|
12
|
+
export declare const VERSION = "0.54.2";
|
|
13
13
|
/** Where the product lives, for messages that need to send somebody somewhere real. */
|
|
14
14
|
export declare const HOME_URL = "https://nmts.me";
|
|
15
15
|
/** The source, so a person holding only the built program can find what it was built from. */
|
package/dist/product.js
CHANGED
|
@@ -18,7 +18,7 @@ export const BINARY_NAME = "nmts";
|
|
|
18
18
|
* beside it. Here rather than in `main.ts` because the MCP server has to say it too, and a
|
|
19
19
|
* command importing the entry point is a cycle waiting to bite.
|
|
20
20
|
*/
|
|
21
|
-
export const VERSION = "0.54.
|
|
21
|
+
export const VERSION = "0.54.2";
|
|
22
22
|
/** Where the product lives, for messages that need to send somebody somewhere real. */
|
|
23
23
|
export const HOME_URL = "https://nmts.me";
|
|
24
24
|
/** The source, so a person holding only the built program can find what it was built from. */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Where the own relay answers, after the NMTS server's address. */
|
|
2
|
+
export declare const OWN_RELAY_PATH = "/v1/relay";
|
|
3
|
+
/** The part size on the own road: an existing preset, the size whose relay peak fits the server. */
|
|
4
|
+
export declare const OWN_RELAY_PART_BYTES: number;
|
|
5
|
+
/** How long Mysten's relay gets to answer before this run takes the own road. */
|
|
6
|
+
export declare const ROAD_PROBE_TIMEOUT_MS = 10000;
|
|
7
|
+
/** True for the own relay's address on any NMTS server. */
|
|
8
|
+
export declare function isOwnRelay(relayUrl: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Decide this run's road, once, before anything is priced. True when the own road was taken.
|
|
11
|
+
*
|
|
12
|
+
* `probe` is the request that asks Mysten's relay (tests pass a fake one).
|
|
13
|
+
*/
|
|
14
|
+
export declare function chooseUploadRoad(input: {
|
|
15
|
+
network: string;
|
|
16
|
+
server: string;
|
|
17
|
+
apiKey: string;
|
|
18
|
+
probe?: typeof fetch;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
}): Promise<boolean>;
|
|
21
|
+
/** Forget the choice (tests; a library caller between runs). */
|
|
22
|
+
export declare function resetUploadRoad(): void;
|
|
23
|
+
/** The relay this run writes through: the own one when it was chosen, else the usual one. */
|
|
24
|
+
export declare function uploadRelay(network: string): string;
|
|
25
|
+
/** The part size a fresh upload uses: unchanged on Mysten's road, at most 64 MiB on ours. */
|
|
26
|
+
export declare function partSizeForRoad(partSize: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* The fetch the relay client uses. On the own road it carries this account's key, and while another
|
|
29
|
+
* upload holds the relay (503 with `Retry-After`) it waits and asks again until the SDK's own
|
|
30
|
+
* timeout ends it. On Mysten's road it is `inner` unchanged.
|
|
31
|
+
*/
|
|
32
|
+
export type RelayFetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
33
|
+
export declare function relayFetch(relayUrl: string, inner: RelayFetch, sleep?: (ms: number, signal?: AbortSignal | null) => Promise<void>): RelayFetch;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NMTS's own upload relay — the second road for uploads from this tool (D50, 2026-11-09).
|
|
3
|
+
*
|
|
4
|
+
* ⛔ WHY. Every upload reached Walrus through Mysten Labs' relay alone; the day it stops answering,
|
|
5
|
+
* nobody can upload. NMTS runs the same relay software (Mysten's image, no tip) behind its own
|
|
6
|
+
* api at `/v1/relay`. This tool asks Mysten's relay once, before anything is priced, and takes
|
|
7
|
+
* the own road only when that relay refuses or does not answer. A relay the caller or the
|
|
8
|
+
* environment named is never second-guessed.
|
|
9
|
+
*
|
|
10
|
+
* ⛔ CHOSEN BEFORE THE PRICE. The own relay holds about five times a blob in memory (measured
|
|
11
|
+
* 2026-11-09: 64 MiB → 354 MiB peak), so on that road a file is cut into 64 MiB parts, and the
|
|
12
|
+
* credits quoted are the credits of those parts. A road chosen after a quote would charge a number
|
|
13
|
+
* nobody was shown; this module is asked first and the part size follows from its answer.
|
|
14
|
+
*
|
|
15
|
+
* The same path and part size as the browser's (`web/src/lib/walrus/own-relay.ts`); the route
|
|
16
|
+
* table (`deploy/core-routes.json`) names both.
|
|
17
|
+
*/
|
|
18
|
+
import { reachFetch } from "./reach.js";
|
|
19
|
+
import { RELAY_HOSTS, relayHost } from "./walrus.js";
|
|
20
|
+
/** Where the own relay answers, after the NMTS server's address. */
|
|
21
|
+
export const OWN_RELAY_PATH = "/v1/relay";
|
|
22
|
+
/** The part size on the own road: an existing preset, the size whose relay peak fits the server. */
|
|
23
|
+
export const OWN_RELAY_PART_BYTES = 64 * 2 ** 20;
|
|
24
|
+
/** How long Mysten's relay gets to answer before this run takes the own road. */
|
|
25
|
+
export const ROAD_PROBE_TIMEOUT_MS = 10_000;
|
|
26
|
+
let chosen = null;
|
|
27
|
+
/** True for the own relay's address on any NMTS server. */
|
|
28
|
+
export function isOwnRelay(relayUrl) {
|
|
29
|
+
return relayUrl.replace(/\/+$/, "").endsWith(OWN_RELAY_PATH);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Decide this run's road, once, before anything is priced. True when the own road was taken.
|
|
33
|
+
*
|
|
34
|
+
* `probe` is the request that asks Mysten's relay (tests pass a fake one).
|
|
35
|
+
*/
|
|
36
|
+
export async function chooseUploadRoad(input) {
|
|
37
|
+
chosen = null;
|
|
38
|
+
const known = RELAY_HOSTS[input.network]?.[0];
|
|
39
|
+
// A caller or an environment that named a relay chose it; nothing is asked.
|
|
40
|
+
if (known === undefined || relayHost(input.network) !== known)
|
|
41
|
+
return false;
|
|
42
|
+
const probe = input.probe ?? reachFetch;
|
|
43
|
+
try {
|
|
44
|
+
const res = await probe(`${known}/v1/tip-config`, {
|
|
45
|
+
signal: AbortSignal.timeout(input.timeoutMs ?? ROAD_PROBE_TIMEOUT_MS),
|
|
46
|
+
});
|
|
47
|
+
if (res.ok)
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// No answer: the own road below.
|
|
52
|
+
}
|
|
53
|
+
chosen = { relayUrl: `${input.server.replace(/\/+$/, "")}${OWN_RELAY_PATH}`, apiKey: input.apiKey };
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
/** Forget the choice (tests; a library caller between runs). */
|
|
57
|
+
export function resetUploadRoad() {
|
|
58
|
+
chosen = null;
|
|
59
|
+
}
|
|
60
|
+
/** The relay this run writes through: the own one when it was chosen, else the usual one. */
|
|
61
|
+
export function uploadRelay(network) {
|
|
62
|
+
return chosen?.relayUrl ?? relayHost(network);
|
|
63
|
+
}
|
|
64
|
+
/** The part size a fresh upload uses: unchanged on Mysten's road, at most 64 MiB on ours. */
|
|
65
|
+
export function partSizeForRoad(partSize) {
|
|
66
|
+
return chosen === null ? partSize : Math.min(partSize, OWN_RELAY_PART_BYTES);
|
|
67
|
+
}
|
|
68
|
+
const wait = (ms, signal) => new Promise((resolve, reject) => {
|
|
69
|
+
if (signal?.aborted)
|
|
70
|
+
return reject(signal.reason);
|
|
71
|
+
const timer = setTimeout(resolve, ms);
|
|
72
|
+
signal?.addEventListener("abort", () => {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
reject(signal.reason);
|
|
75
|
+
}, { once: true });
|
|
76
|
+
});
|
|
77
|
+
export function relayFetch(relayUrl, inner, sleep = wait) {
|
|
78
|
+
const road = chosen;
|
|
79
|
+
if (road === null || road.relayUrl !== relayUrl)
|
|
80
|
+
return inner;
|
|
81
|
+
return async (input, init) => {
|
|
82
|
+
const headers = new Headers(init?.headers);
|
|
83
|
+
headers.set("authorization", `Bearer ${road.apiKey}`);
|
|
84
|
+
for (;;) {
|
|
85
|
+
const res = await inner(input, { ...init, headers });
|
|
86
|
+
const after = res.headers.get("retry-after");
|
|
87
|
+
if (res.status !== 503 || after === null)
|
|
88
|
+
return res;
|
|
89
|
+
const seconds = Number(after);
|
|
90
|
+
await sleep(Math.max(1, Number.isFinite(seconds) ? seconds : 15) * 1000, init?.signal);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -26,6 +26,7 @@ import { reachFetch } from "./reach.js";
|
|
|
26
26
|
import { readOwnedStorage, readStorageType } from "./shared/lib/storage-control/chain.js";
|
|
27
27
|
import { registerIntoStorage, splitStorageToFit } from "./shared/lib/storage-control/reuse.js";
|
|
28
28
|
import { dryRun, inspect, u64FromLe } from "./shared/lib/wallet/chain-calls.js";
|
|
29
|
+
import { isOwnRelay, relayFetch } from "./upload-road.js";
|
|
29
30
|
import { storageNodesThrough } from "./walrus.js";
|
|
30
31
|
import { freshWalrus } from "./walrus-fresh.js";
|
|
31
32
|
import { suiClient } from "./sui-rpc.js";
|
|
@@ -50,7 +51,12 @@ export function packageConfig(network) {
|
|
|
50
51
|
function build(network, relayUrl) {
|
|
51
52
|
return suiClient(network).$extend(walrus({
|
|
52
53
|
...storageNodesThrough(),
|
|
53
|
-
uploadRelay: {
|
|
54
|
+
uploadRelay: {
|
|
55
|
+
host: relayUrl,
|
|
56
|
+
// The own relay (D50) takes no tip: no tip is paid and none is announced.
|
|
57
|
+
...(isOwnRelay(relayUrl) ? {} : { sendTip: { max: RELAY_TIP_CEILING_MIST[network] } }),
|
|
58
|
+
fetch: relayFetch(relayUrl, reachFetch),
|
|
59
|
+
},
|
|
54
60
|
}));
|
|
55
61
|
}
|
|
56
62
|
/** A Walrus client bound to ONE relay, able to pay that relay's tip. */
|
package/dist/upload-wire.d.ts
CHANGED
|
@@ -62,11 +62,12 @@ export interface UploadApi {
|
|
|
62
62
|
* already been told, which is how a screen and a ledger come to disagree.
|
|
63
63
|
*/
|
|
64
64
|
deposit_credits: number;
|
|
65
|
+
/** Null on NMTS's own relay, which takes no tip (D50). */
|
|
65
66
|
relay: {
|
|
66
67
|
host: string;
|
|
67
68
|
blob_digest_b64: string;
|
|
68
69
|
nonce_b64: string;
|
|
69
|
-
};
|
|
70
|
+
} | null;
|
|
70
71
|
}): Promise<ReserveReply>;
|
|
71
72
|
status(ledgerId: number): Promise<StatusReply>;
|
|
72
73
|
uploaded(ledgerId: number, certificate: Certificate): Promise<unknown>;
|
package/dist/upload.js
CHANGED
|
@@ -32,6 +32,7 @@ import { ServerError } from "./api.js";
|
|
|
32
32
|
import { readReservationBytes, readReservationRecord, writeReservation, } from "./upload-store.js";
|
|
33
33
|
import { refuseOtherSealing, runIdField } from "./upload-run.js";
|
|
34
34
|
import { pushPart } from "./upload-steps.js";
|
|
35
|
+
import { isOwnRelay } from "./upload-road.js";
|
|
35
36
|
import { UploadError, } from "./upload-wire.js";
|
|
36
37
|
export * from "./upload-wire.js";
|
|
37
38
|
/** A reservation state that can still become storage. Anything else is dead. */
|
|
@@ -201,11 +202,10 @@ export async function buyAndPushPart(input) {
|
|
|
201
202
|
size: sealed.length,
|
|
202
203
|
epochs: input.epochs,
|
|
203
204
|
deposit_credits: input.depositCredits,
|
|
204
|
-
relay
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
nonce_b64: nonceB64,
|
|
208
|
-
},
|
|
205
|
+
// The own relay (D50) takes no tip, so the treasury registers without one.
|
|
206
|
+
relay: isOwnRelay(input.relayUrl)
|
|
207
|
+
? null
|
|
208
|
+
: { host: input.relayUrl, blob_digest_b64: toBase64Url(meta.blobDigest), nonce_b64: nonceB64 },
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
catch (error) {
|
package/dist/walrus-write.js
CHANGED
|
@@ -17,7 +17,8 @@ import { epochStartedMs as readEpochStart } from "./shared/lib/extend/epochs.js"
|
|
|
17
17
|
import { NmtsError } from "./errors.js";
|
|
18
18
|
import { countingFetch } from "./progress.js";
|
|
19
19
|
import { reachFetch } from "./reach.js";
|
|
20
|
-
import {
|
|
20
|
+
import { isOwnRelay, relayFetch, uploadRelay } from "./upload-road.js";
|
|
21
|
+
import { storageNodesThrough } from "./walrus.js";
|
|
21
22
|
import { suiClient } from "./sui-rpc.js";
|
|
22
23
|
/**
|
|
23
24
|
* How long the relay gets for one blob PUT, sized to the body.
|
|
@@ -50,7 +51,8 @@ function extend(network, relayUrl, bodyBytes, onSent) {
|
|
|
50
51
|
...storageNodesThrough(),
|
|
51
52
|
uploadRelay: {
|
|
52
53
|
host: relayUrl,
|
|
53
|
-
|
|
54
|
+
// The own relay (D50) takes no tip, so it is not told which transaction paid one.
|
|
55
|
+
...(isOwnRelay(relayUrl) ? {} : { sendTip: { max: TIP_CEILING_UNUSED_MIST } }),
|
|
54
56
|
timeout: relayTimeoutMs(bodyBytes),
|
|
55
57
|
// ⛔ THE ONLY WAY TO SEE AN UPLOAD MOVE. The SDK does not report progress, and the relay
|
|
56
58
|
// PUT is the one step of an upload that takes real time — a person watching a large
|
|
@@ -59,7 +61,7 @@ function extend(network, relayUrl, bodyBytes, onSent) {
|
|
|
59
61
|
//
|
|
60
62
|
// ⛔ AND EITHER WAY IT IS THE CALLER'S `fetch`: the counting wrapper goes through it too,
|
|
61
63
|
// so the request that carries the file cannot be the one that misses a proxy.
|
|
62
|
-
fetch: onSent ? countingFetch(onSent) : reachFetch,
|
|
64
|
+
fetch: relayFetch(relayUrl, onSent ? countingFetch(onSent) : reachFetch),
|
|
63
65
|
},
|
|
64
66
|
}));
|
|
65
67
|
}
|
|
@@ -73,7 +75,7 @@ function fail(what, error) {
|
|
|
73
75
|
* is the only phase of one that anything can report on.
|
|
74
76
|
*/
|
|
75
77
|
export function createBlobProtocol(network, bodyBytes, onSent) {
|
|
76
|
-
const relayUrl =
|
|
78
|
+
const relayUrl = uploadRelay(network);
|
|
77
79
|
const client = extend(network, relayUrl, bodyBytes, onSent);
|
|
78
80
|
return {
|
|
79
81
|
relayUrl,
|
package/dist/walrus.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export declare const AGGREGATOR_HOSTS: Readonly<Record<string, readonly string[]
|
|
|
15
15
|
* register transaction the server pays a tip in, so the bytes have to go to the SAME host the
|
|
16
16
|
* reservation was made for. That is why a write picks its host BEFORE the storage is bought and
|
|
17
17
|
* then never moves: failing over to a second relay would push bytes nobody paid that relay for.
|
|
18
|
+
*
|
|
19
|
+
* ⭐ THE SECOND ROAD IS NOT A ROW HERE (D50): NMTS's own no-tip relay on the NMTS server, chosen once
|
|
20
|
+
* at the start of a run, before the price, only when this one does not answer (`upload-road.ts`).
|
|
18
21
|
*/
|
|
19
22
|
export declare const RELAY_HOSTS: Readonly<Record<string, readonly string[]>>;
|
|
20
23
|
/**
|
package/dist/walrus.js
CHANGED
|
@@ -40,6 +40,9 @@ export const AGGREGATOR_HOSTS = {
|
|
|
40
40
|
* register transaction the server pays a tip in, so the bytes have to go to the SAME host the
|
|
41
41
|
* reservation was made for. That is why a write picks its host BEFORE the storage is bought and
|
|
42
42
|
* then never moves: failing over to a second relay would push bytes nobody paid that relay for.
|
|
43
|
+
*
|
|
44
|
+
* ⭐ THE SECOND ROAD IS NOT A ROW HERE (D50): NMTS's own no-tip relay on the NMTS server, chosen once
|
|
45
|
+
* at the start of a run, before the price, only when this one does not answer (`upload-road.ts`).
|
|
43
46
|
*/
|
|
44
47
|
export const RELAY_HOSTS = {
|
|
45
48
|
testnet: ["https://upload-relay.testnet.walrus.space"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.2",
|
|
4
4
|
"description": "Command-line and MCP access to NMTS (NeedMoreTruthStorage, https://nmts.me): open-source, end-to-end encrypted storage on the Walrus network. No fee to NMTS; you pay the network from your own wallet. For people and for their agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
package/server.json
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
"url": "https://github.com/needmoretruth/nmts-cli",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.54.
|
|
9
|
+
"version": "0.54.2",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
14
14
|
"identifier": "@needmoretruth/nmts-cli",
|
|
15
|
-
"version": "0.54.
|
|
15
|
+
"version": "0.54.2",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|