@needmoretruth/nmts-cli 0.59.1 → 0.61.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/AGENTS.md +49 -49
- package/CHANGELOG.md +128 -99
- package/LICENSING.md +8 -8
- package/README.ko.md +156 -156
- package/README.md +111 -111
- package/dist/api-advice.js +34 -34
- package/dist/api-key.js +2 -2
- package/dist/artifact-about.d.ts +1 -1
- package/dist/autonomy.js +12 -12
- package/dist/code-access.js +3 -3
- package/dist/code-vault.js +1 -1
- package/dist/commands/accept-terms.js +4 -4
- package/dist/commands/ai-account.js +10 -10
- package/dist/commands/balance.js +7 -7
- package/dist/commands/create-code-file.js +3 -3
- package/dist/commands/create-link.js +36 -41
- package/dist/commands/create-pass.js +3 -3
- package/dist/commands/create.js +4 -4
- package/dist/commands/credits.js +2 -2
- package/dist/commands/delete-account.js +3 -3
- package/dist/commands/deposit.js +3 -3
- package/dist/commands/devices.js +3 -3
- package/dist/commands/documents.js +1 -1
- package/dist/commands/env.js +13 -13
- package/dist/commands/erase.js +5 -5
- package/dist/commands/expiring.js +4 -4
- package/dist/commands/extend.js +8 -8
- package/dist/commands/get.js +2 -2
- package/dist/commands/handover.js +2 -2
- package/dist/commands/key-manage.js +2 -2
- package/dist/commands/key.js +5 -5
- package/dist/commands/link.js +2 -2
- package/dist/commands/links.js +1 -1
- package/dist/commands/listfile.js +3 -3
- package/dist/commands/login-passphrase.js +4 -4
- package/dist/commands/login.js +9 -9
- package/dist/commands/logout.js +1 -1
- package/dist/commands/losses.js +7 -7
- package/dist/commands/ls.js +7 -7
- package/dist/commands/marks.js +1 -1
- package/dist/commands/mcp.js +4 -4
- package/dist/commands/mode.js +8 -8
- package/dist/commands/on-collision.js +4 -4
- package/dist/commands/openers-attach.js +1 -1
- package/dist/commands/organise.js +1 -1
- package/dist/commands/padding.js +3 -3
- package/dist/commands/platform.js +2 -2
- package/dist/commands/public-code-manage.js +4 -4
- package/dist/commands/public-code.js +4 -4
- package/dist/commands/pull.js +1 -1
- package/dist/commands/push-heavy.js +1 -1
- package/dist/commands/push-wallet.js +1 -1
- package/dist/commands/push.js +2 -2
- package/dist/commands/put-heavy.js +2 -2
- package/dist/commands/put-payer.js +1 -1
- package/dist/commands/put-wallet.js +5 -5
- package/dist/commands/put.js +3 -3
- package/dist/commands/rebuild.js +13 -13
- package/dist/commands/receive.js +2 -2
- package/dist/commands/recovery-list.js +1 -1
- package/dist/commands/recovery.js +7 -7
- package/dist/commands/rollback.js +2 -2
- package/dist/commands/s3.js +3 -3
- package/dist/commands/share.js +7 -7
- package/dist/commands/shares-sent.js +2 -2
- package/dist/commands/support.js +1 -1
- package/dist/commands/sweep.js +3 -3
- package/dist/commands/tip.js +2 -2
- package/dist/commands/trial.js +8 -8
- package/dist/commands/unlock.js +6 -6
- package/dist/commands/update.js +3 -3
- package/dist/commands/usage.js +4 -4
- package/dist/commands/verify.js +1 -1
- package/dist/commands/wallet-activity.js +3 -3
- package/dist/commands/wallet-donate.js +4 -4
- package/dist/commands/wallet-hall.js +5 -5
- package/dist/commands/wallet-list.js +2 -2
- package/dist/commands/wallet-send.js +5 -5
- package/dist/commands/wallet-storage-buy.js +1 -1
- package/dist/commands/wallet-storage-extend.js +1 -1
- package/dist/commands/wallet-storage-ops.js +5 -5
- package/dist/commands/wallet-storage.js +1 -1
- package/dist/commands/wallet-swap.js +14 -14
- package/dist/commands/wallet-use.js +2 -2
- package/dist/commands/wallet.js +6 -6
- package/dist/consent.js +7 -7
- package/dist/credentials.js +1 -1
- package/dist/deposit.js +1 -1
- package/dist/download-part.js +1 -1
- package/dist/download-sink-node.js +3 -3
- package/dist/download.js +1 -1
- package/dist/drive-edit/errors.js +1 -1
- package/dist/drive-edit/folders.js +1 -1
- package/dist/drive-edit/trash.js +2 -2
- package/dist/drive-erase.js +1 -1
- package/dist/environment.js +5 -5
- package/dist/errors.js +1 -1
- package/dist/extend-budget.js +5 -5
- package/dist/extend-chain.js +1 -1
- package/dist/extend-plan.js +4 -4
- package/dist/gate.js +1 -1
- package/dist/handover.js +2 -2
- package/dist/heavy-copy.d.ts +1 -1
- package/dist/heavy-copy.js +7 -7
- package/dist/help-options.js +13 -13
- package/dist/help.js +54 -40
- package/dist/human-check.js +2 -2
- package/dist/kit-file.js +6 -6
- package/dist/list-file.js +1 -1
- package/dist/manifest-chunk-flow.js +1 -1
- package/dist/manifest-create.js +2 -2
- package/dist/manifest-write.js +1 -1
- package/dist/manifest.js +6 -3
- package/dist/mcp-args.js +1 -1
- package/dist/mcp-tools/credits.js +5 -5
- package/dist/mcp-tools/files.js +6 -6
- package/dist/mcp-tools/organise.js +7 -7
- package/dist/mcp-tools/reads.js +17 -17
- package/dist/mcp-tools/share.js +6 -6
- package/dist/mcp-tools/support.js +3 -3
- package/dist/mcp-tools/tiers.js +4 -4
- package/dist/notice.js +1 -1
- package/dist/openers/wallet.js +1 -1
- package/dist/platform-sign.js +2 -2
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/public-codes.js +2 -2
- package/dist/recovery-assemble.js +1 -1
- package/dist/recovery-map-file.js +1 -1
- package/dist/recovery-map.js +1 -1
- package/dist/recovery-source.js +1 -1
- package/dist/recovery.js +1 -1
- package/dist/risk.d.ts +4 -4
- package/dist/risk.js +4 -4
- package/dist/s3/call.js +1 -1
- package/dist/s3/same-file.js +1 -1
- package/dist/setup-questions.js +1 -1
- package/dist/shared/lib/drive/manifest-index.d.ts +9 -0
- package/dist/shared/lib/drive/manifest-index.js +11 -0
- package/dist/shared/lib/heavy/order-plan.js +4 -4
- package/dist/shared/lib/heavy/sp-upload.js +1 -1
- package/dist/shared/lib/upload/relay-limit.d.ts +30 -0
- package/dist/shared/lib/upload/relay-limit.js +74 -0
- package/dist/shared/lib/vendor/nmt-pow.d.ts +21 -0
- package/dist/shared/lib/vendor/nmt-pow.js +56 -0
- package/dist/shared/lib/walrus/node-certificate.js +1 -1
- package/dist/shared/lib/walrus/node-quorum.js +1 -1
- package/dist/sharing-inbox.js +1 -1
- package/dist/sharing.js +4 -4
- package/dist/standing-tip.js +1 -1
- package/dist/storage-control/extend.js +2 -2
- package/dist/storage-control/reshape.js +3 -3
- package/dist/support-copy.js +4 -4
- package/dist/support-wire.js +4 -4
- package/dist/update-source.js +1 -1
- package/dist/upload-price.d.ts +10 -0
- package/dist/upload-price.js +21 -0
- package/dist/upload-quote.js +2 -2
- package/dist/upload-run.js +1 -1
- package/dist/upload-steps.js +1 -1
- package/dist/upload-store.js +1 -1
- package/dist/upload-wallet-chain.js +1 -1
- package/dist/upload-wallet-plan.js +12 -12
- package/dist/upload-wallet-put.js +1 -1
- package/dist/upload-wallet.js +2 -2
- package/dist/upload.js +2 -2
- package/dist/wallet-grant.js +3 -3
- package/dist/wallet-pay-index.js +1 -1
- package/dist/wallet-sign-external.js +5 -5
- package/dist/wallet-sign.js +6 -6
- package/dist/wallet-swap-words.js +3 -3
- package/dist/walrus.js +2 -2
- package/docs/commands/accept-terms.md +3 -3
- package/docs/commands/ai-account.md +4 -4
- package/docs/commands/create.md +8 -8
- package/docs/commands/credits.md +9 -9
- package/docs/commands/delete-account.md +4 -4
- package/docs/commands/deposit.md +7 -7
- package/docs/commands/devices.md +4 -4
- package/docs/commands/documents.md +5 -5
- package/docs/commands/env.md +10 -10
- package/docs/commands/extend.md +4 -4
- package/docs/commands/folders.md +3 -3
- package/docs/commands/get.md +4 -4
- package/docs/commands/handover.md +12 -12
- package/docs/commands/heavy.md +4 -4
- package/docs/commands/key.md +8 -8
- package/docs/commands/link.md +9 -9
- package/docs/commands/login.md +4 -4
- package/docs/commands/logout.md +2 -2
- package/docs/commands/losses.md +3 -3
- package/docs/commands/ls.md +5 -5
- package/docs/commands/marks.md +5 -5
- package/docs/commands/mcp.md +9 -9
- package/docs/commands/mode.md +6 -6
- package/docs/commands/on-collision.md +4 -4
- package/docs/commands/openers.md +5 -5
- package/docs/commands/padding.md +7 -7
- package/docs/commands/platform.md +2 -2
- package/docs/commands/public-code.md +8 -8
- package/docs/commands/pull.md +2 -2
- package/docs/commands/push.md +3 -3
- package/docs/commands/put.md +11 -11
- package/docs/commands/rebuild.md +5 -5
- package/docs/commands/recovery.md +4 -4
- package/docs/commands/s3.md +6 -6
- package/docs/commands/share.md +8 -8
- package/docs/commands/support.md +7 -7
- package/docs/commands/tip.md +7 -7
- package/docs/commands/trash.md +8 -8
- package/docs/commands/trial.md +5 -5
- package/docs/commands/unlock.md +4 -4
- package/docs/commands/update.md +3 -3
- package/docs/commands/usage.md +4 -4
- package/docs/commands/verify.md +5 -5
- package/docs/commands/wallet.md +25 -25
- package/docs/commands/whoami.md +5 -5
- package/examples/podman.sh +3 -3
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// How large one part may be, from the one thing that carries it: the storage network's upload relay.
|
|
2
|
+
//
|
|
3
|
+
// ⛔ THE RELAY REFUSES A BODY OVER 1 GiB, AND IT DOES SO AFTER THE MONEY HAS MOVED. Every Walrus
|
|
4
|
+
// upload on every rail goes through a relay as one PUT whose body is the sealed part. The relay
|
|
5
|
+
// hardcodes `DefaultBodyLimit::max(1024 * 1024 * 1024)` (walrus-upload-relay, `controller.rs`,
|
|
6
|
+
// read 2026-11-11; not a config value), and the PUT comes after the register transaction that
|
|
7
|
+
// buys the storage. Measured on the testnet relay on 2026-11-11: a 1 GiB plaintext part seals to
|
|
8
|
+
// 1,073,745,992 bytes, the full body was sent, and the relay answered 413 "length limit
|
|
9
|
+
// exceeded" with the register already paid (docs/research/2026-11-11-part-size-measured.md).
|
|
10
|
+
// For two months the browser's default part was exactly that 1 GiB.
|
|
11
|
+
//
|
|
12
|
+
// ⛔ SO THE LIMIT IS CHECKED ON THE SEALED PART, PADDING INCLUDED, BEFORE ANYTHING IS SIGNED. Sealing
|
|
13
|
+
// adds a header and a tag per 4 MiB chunk, and the final part is rounded up by the padding rule
|
|
14
|
+
// the account chose — `pow2` takes a 600 MiB final part to 1 GiB. A part size is allowed only if
|
|
15
|
+
// the largest part it can produce, under every rule, still fits.
|
|
16
|
+
//
|
|
17
|
+
// It is copied verbatim into the command-line tool (`deploy/gen-cli-shared.mjs`), so the browser,
|
|
18
|
+
// the command and the SDK refuse the same sizes. Its only import is the padding arithmetic, which
|
|
19
|
+
// is copied with it.
|
|
20
|
+
import { paddedPlaintextLen, sealedLenFor } from "../crypto/size-padding.js";
|
|
21
|
+
/** Largest request body the Walrus upload relay accepts, in bytes (hardcoded in the relay). */
|
|
22
|
+
export const RELAY_BODY_LIMIT_BYTES = 2 ** 30;
|
|
23
|
+
/**
|
|
24
|
+
* What NCF-3 adds to one part: a 72-byte header, and a 16-byte tag per 4 MiB chunk
|
|
25
|
+
* (CRYPTO-FORMAT-NCF3.md §4.1). Each program's own sealing constants are tested equal to this.
|
|
26
|
+
*/
|
|
27
|
+
export const NCF3_PART_SHAPE = { headerLen: 72, tagLen: 16, chunkSize: 4 * 2 ** 20 };
|
|
28
|
+
/**
|
|
29
|
+
* The billing unit the free padding floor fills up to (one credit's worth of bytes). Each
|
|
30
|
+
* program's own `CREDIT_BYTES` is tested equal to this.
|
|
31
|
+
*/
|
|
32
|
+
export const PADDING_UNIT_BYTES = 2 ** 20;
|
|
33
|
+
const RULES = ["padme", "pow2", "none"];
|
|
34
|
+
/**
|
|
35
|
+
* The largest relay body a part size can produce: a full part, or a final part padded by any rule.
|
|
36
|
+
* Padding only ever grows with the length, so the full-size final part is the worst case.
|
|
37
|
+
*/
|
|
38
|
+
export function largestSealedPartBytes(partSizeBytes) {
|
|
39
|
+
if (!Number.isSafeInteger(partSizeBytes) || partSizeBytes <= 0) {
|
|
40
|
+
throw new RangeError(`a part size must be a positive whole number of bytes, got ${String(partSizeBytes)}`);
|
|
41
|
+
}
|
|
42
|
+
let largest = sealedLenFor(partSizeBytes, NCF3_PART_SHAPE);
|
|
43
|
+
for (const rule of RULES) {
|
|
44
|
+
const padded = paddedPlaintextLen(partSizeBytes, rule, { unitBytes: PADDING_UNIT_BYTES, shape: NCF3_PART_SHAPE });
|
|
45
|
+
largest = Math.max(largest, sealedLenFor(padded, NCF3_PART_SHAPE));
|
|
46
|
+
}
|
|
47
|
+
return largest;
|
|
48
|
+
}
|
|
49
|
+
/** True when every part this size can produce goes through the relay. */
|
|
50
|
+
export function partFitsRelay(partSizeBytes) {
|
|
51
|
+
return largestSealedPartBytes(partSizeBytes) <= RELAY_BODY_LIMIT_BYTES;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The largest whole-MiB part size that fits, derived from the two numbers above: 512 MiB, because
|
|
55
|
+
* `pow2` pads anything larger to 1 GiB and 1 GiB plus its envelope is over the limit.
|
|
56
|
+
*/
|
|
57
|
+
export const MAX_PART_SIZE_BYTES = (() => {
|
|
58
|
+
for (let mib = RELAY_BODY_LIMIT_BYTES / 2 ** 20; mib > 0; mib -= 1) {
|
|
59
|
+
if (partFitsRelay(mib * 2 ** 20))
|
|
60
|
+
return mib * 2 ** 20;
|
|
61
|
+
}
|
|
62
|
+
throw new RangeError("no part size fits the relay");
|
|
63
|
+
})();
|
|
64
|
+
/**
|
|
65
|
+
* Throw before anything is priced or signed when a part size could produce a part the relay will
|
|
66
|
+
* refuse. The message names both numbers so a caller sees what to choose instead.
|
|
67
|
+
*/
|
|
68
|
+
export function requirePartFitsRelay(partSizeBytes) {
|
|
69
|
+
if (!partFitsRelay(partSizeBytes)) {
|
|
70
|
+
throw new RangeError(`A part of ${partSizeBytes} bytes can seal to ${largestSealedPartBytes(partSizeBytes)} bytes, ` +
|
|
71
|
+
`over the upload relay's ${RELAY_BODY_LIMIT_BYTES}-byte limit. ` +
|
|
72
|
+
`Choose ${MAX_PART_SIZE_BYTES} bytes (${MAX_PART_SIZE_BYTES / 2 ** 20} MiB) or less.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** What a server hands out: the challenge text, zero bits per sub-puzzle, sub-puzzles. */
|
|
2
|
+
export interface Work {
|
|
3
|
+
readonly challenge: string;
|
|
4
|
+
readonly bits: number;
|
|
5
|
+
readonly k: number;
|
|
6
|
+
}
|
|
7
|
+
export type Sha256 = (data: Uint8Array) => Uint8Array;
|
|
8
|
+
export declare function leadingZeroBits(digest: Uint8Array): number;
|
|
9
|
+
/** Solve without stopping. For programs where blocking is fine (a command-line tool). */
|
|
10
|
+
export declare function solveSync(work: Work, sha256: Sha256): string;
|
|
11
|
+
export interface SolveOptions {
|
|
12
|
+
/** Unix milliseconds after which the challenge no longer checks; the solver gives up then. */
|
|
13
|
+
readonly deadline?: number;
|
|
14
|
+
readonly now?: () => number;
|
|
15
|
+
/** Attempts between yields to the event loop, so a page keeps painting. */
|
|
16
|
+
readonly yieldEvery?: number;
|
|
17
|
+
/** Called after each solved sub-puzzle with how many are done, for a progress display. */
|
|
18
|
+
readonly progress?: (done: number, of: number) => void;
|
|
19
|
+
}
|
|
20
|
+
/** Solve, yielding now and then. `null` when the deadline passed first: ask for a new challenge. */
|
|
21
|
+
export declare function solve(work: Work, sha256: Sha256, options?: SolveOptions): Promise<string | null>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// The NMT proof of work for TypeScript clients: the same puzzle as the `nmt-pow` crate (`~/nmt/kit`).
|
|
2
|
+
//
|
|
3
|
+
// Products carry a byte-identical copy written by `node ~/nmt/kit/bin/kit.mjs sync`; edit it in ~/nmt/kit only.
|
|
4
|
+
//
|
|
5
|
+
// The rule: for each index i in 0..k, find the smallest nonce n such that SHA-256 of the UTF-8 bytes of
|
|
6
|
+
// `${challenge}:${i}:${n}` (n in decimal) starts with `bits` zero bits. The answer is the k nonces joined by spaces.
|
|
7
|
+
// Searching from 0 upward makes every solver give the same answer (the kit's vectors.json pins it).
|
|
8
|
+
//
|
|
9
|
+
// The digest is passed in, so a browser can use a synchronous library digest (WebCrypto's async digest costs about
|
|
10
|
+
// ten times more per attempt) and Node can use node:crypto.
|
|
11
|
+
const encoder = new TextEncoder();
|
|
12
|
+
export function leadingZeroBits(digest) {
|
|
13
|
+
let seen = 0;
|
|
14
|
+
for (const byte of digest) {
|
|
15
|
+
seen += Math.clz32(byte) - 24;
|
|
16
|
+
if (byte !== 0)
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
return seen;
|
|
20
|
+
}
|
|
21
|
+
function found(sha256, work, index, nonce) {
|
|
22
|
+
return leadingZeroBits(sha256(encoder.encode(`${work.challenge}:${index}:${nonce}`))) >= work.bits;
|
|
23
|
+
}
|
|
24
|
+
/** Solve without stopping. For programs where blocking is fine (a command-line tool). */
|
|
25
|
+
export function solveSync(work, sha256) {
|
|
26
|
+
const nonces = [];
|
|
27
|
+
for (let i = 0; i < work.k; i += 1) {
|
|
28
|
+
let n = 0;
|
|
29
|
+
while (!found(sha256, work, i, n))
|
|
30
|
+
n += 1;
|
|
31
|
+
nonces.push(n);
|
|
32
|
+
}
|
|
33
|
+
return nonces.join(" ");
|
|
34
|
+
}
|
|
35
|
+
/** Solve, yielding now and then. `null` when the deadline passed first: ask for a new challenge. */
|
|
36
|
+
export async function solve(work, sha256, options = {}) {
|
|
37
|
+
const now = options.now ?? Date.now;
|
|
38
|
+
const every = options.yieldEvery ?? 20_000;
|
|
39
|
+
const deadline = options.deadline ?? Number.POSITIVE_INFINITY;
|
|
40
|
+
const nonces = [];
|
|
41
|
+
for (let i = 0; i < work.k; i += 1) {
|
|
42
|
+
for (let n = 0;; n += 1) {
|
|
43
|
+
if (found(sha256, work, i, n)) {
|
|
44
|
+
nonces.push(n);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
if (n % every === every - 1) {
|
|
48
|
+
if (now() >= deadline)
|
|
49
|
+
return null;
|
|
50
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
options.progress?.(i + 1, work.k);
|
|
54
|
+
}
|
|
55
|
+
return nonces.join(" ");
|
|
56
|
+
}
|
|
@@ -55,7 +55,7 @@ export function certificateByShardWeight(confirmations, members, nShards, expect
|
|
|
55
55
|
const valid = aggregateHolds(signed) ? signed : signed.filter((s) => sigs.verify(s.signature, hashed, s.key));
|
|
56
56
|
const weight = valid.reduce((sum, s) => sum + s.weight, 0);
|
|
57
57
|
if (!chainQuorum(weight, nShards)) {
|
|
58
|
-
throw new NotEnoughBlobConfirmationsError(`Too few confirmed shards for blob (${weight} of ${nShards} from ${valid.length} nodes
|
|
58
|
+
throw new NotEnoughBlobConfirmationsError(`Too few confirmed shards for blob (${weight} of ${nShards} from ${valid.length} nodes. The chain needs more than two thirds)`);
|
|
59
59
|
}
|
|
60
60
|
return {
|
|
61
61
|
signers: valid.map((s) => s.index),
|
|
@@ -57,7 +57,7 @@ export function stopAtQuorum(walrus, timing = {}) {
|
|
|
57
57
|
clearTimeout(graceTimer);
|
|
58
58
|
if (stallTimer !== null)
|
|
59
59
|
clearTimeout(stallTimer);
|
|
60
|
-
controller.abort(error ?? new Error("quorum reached
|
|
60
|
+
controller.abort(error ?? new Error("quorum reached. The remaining node writes were stopped"));
|
|
61
61
|
if (error)
|
|
62
62
|
reject(error);
|
|
63
63
|
else
|
package/dist/sharing-inbox.js
CHANGED
|
@@ -97,7 +97,7 @@ export async function receiveShare(account, id, sinkFor, read) {
|
|
|
97
97
|
opened.dek.fill(0);
|
|
98
98
|
throw new NmtsError("The sender did not record this file's real length.", {
|
|
99
99
|
exitCode: 1,
|
|
100
|
-
nextStep: "Nothing was written. It was shared by an older client
|
|
100
|
+
nextStep: "Nothing was written. It was shared by an older client. Ask them to share it again from " +
|
|
101
101
|
"a current one, which seals the length beside the name.",
|
|
102
102
|
});
|
|
103
103
|
}
|
package/dist/sharing.js
CHANGED
|
@@ -41,14 +41,14 @@ export async function shareableFileAt(account, target) {
|
|
|
41
41
|
if (entry.kind !== KIND_FILE) {
|
|
42
42
|
throw new NmtsError(`No file at "${fullPathOf(index, entry)}".`, {
|
|
43
43
|
exitCode: 4,
|
|
44
|
-
nextStep: "That is a folder. Nothing was shared
|
|
44
|
+
nextStep: "That is a folder. Nothing was shared. This version shares one file at a time.",
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
const { dekWrapped, contentHashCt } = entry;
|
|
48
48
|
if (dekWrapped === undefined || contentHashCt === undefined) {
|
|
49
49
|
throw new NmtsError(`The file list holds no ${dekWrapped === undefined ? "key" : "hash"} for "${entry.name}".`, {
|
|
50
50
|
exitCode: 4,
|
|
51
|
-
nextStep: "A share carries both
|
|
51
|
+
nextStep: "A share carries both: the key that opens the file and the hash the recipient checks the " +
|
|
52
52
|
"bytes against. Nothing was shared.",
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -108,7 +108,7 @@ export async function sendShare(account, file, recipientAddress, options = {}) {
|
|
|
108
108
|
if (typeof identityB64 !== "string") {
|
|
109
109
|
throw new NmtsError("That public code has never published an identity to share to.", {
|
|
110
110
|
exitCode: 4,
|
|
111
|
-
nextStep: "Nothing was shared. The code may be right and unused
|
|
111
|
+
nextStep: "Nothing was shared. The code may be right and unused: somebody has to open " +
|
|
112
112
|
"their account once before anything can be encrypted to them.",
|
|
113
113
|
});
|
|
114
114
|
}
|
|
@@ -179,7 +179,7 @@ export async function sentShares(account, target) {
|
|
|
179
179
|
const rows = typeof answer === "object" && answer !== null ? Reflect.get(answer, "shares") : null;
|
|
180
180
|
if (!Array.isArray(rows)) {
|
|
181
181
|
throw new NmtsError("The server's answer did not carry a list of shares.", {
|
|
182
|
-
nextStep: "Nothing was changed. Report it
|
|
182
|
+
nextStep: "Nothing was changed. Report it instead of retrying: the shape of the answer is wrong, and the network is fine.",
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
return { path: fullPathOf(index, entry), itemId: entry.id, rows };
|
package/dist/standing-tip.js
CHANGED
|
@@ -71,7 +71,7 @@ export async function standingTipAfter(input) {
|
|
|
71
71
|
wallet: input.wallet,
|
|
72
72
|
shape: { coin: "WAL", amountBaseUnits: amount, destination: config.devAddress, walType: walCoinType(input.network) },
|
|
73
73
|
});
|
|
74
|
-
input.say(` Your standing ${percentText(tenths)} % gift
|
|
74
|
+
input.say(` Your standing ${percentText(tenths)} % gift (${coinAmount(amount)} WAL) went to the developer. Transaction ${digest}`);
|
|
75
75
|
input.say(` ${THANKS_EN}`);
|
|
76
76
|
input.say(` ${THANKS_KO}`);
|
|
77
77
|
return "sent";
|
|
@@ -48,7 +48,7 @@ export async function planExtension(input, target, seams) {
|
|
|
48
48
|
if (entry.kind !== KIND_FILE) {
|
|
49
49
|
throw new NmtsError(`No file at "${fullPathOf(buildIndex(entries), entry)}".`, {
|
|
50
50
|
exitCode: 4,
|
|
51
|
-
nextStep: "That is a folder. Nothing was signed and nothing was charged
|
|
51
|
+
nextStep: "That is a folder. Nothing was signed and nothing was charged. Storage is bought per " +
|
|
52
52
|
"file, so this takes one file at a time.",
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -106,7 +106,7 @@ export async function planItemExtension(where, item, seams) {
|
|
|
106
106
|
throw new NmtsError(`EXTEND_LAPSED: the storage term for "${path}" has already ended.`, {
|
|
107
107
|
exitCode: 4,
|
|
108
108
|
nextStep: seams.hints?.lapsed ??
|
|
109
|
-
`Nothing was signed and nothing was charged. A lease is extended before it ends
|
|
109
|
+
`Nothing was signed and nothing was charged. A lease is extended before it ends. Once it ` +
|
|
110
110
|
`is over there is no storage object left to extend, and the bytes may already be gone. ` +
|
|
111
111
|
`Fetching the file is what says whether they can still be read.`,
|
|
112
112
|
});
|
|
@@ -27,9 +27,9 @@ import { formatBytes, readOrRefuse } from "./list.js";
|
|
|
27
27
|
/** Why two resources cannot be joined, in the contract's own terms. */
|
|
28
28
|
const FUSE_WHY = {
|
|
29
29
|
same: "those are the same resource.",
|
|
30
|
-
differentSize: "their periods differ and so do their sizes
|
|
30
|
+
differentSize: "their periods differ and so do their sizes. The contract joins sizes only over an identical period, and periods only at an identical size.",
|
|
31
31
|
differentPeriod: "their periods differ.",
|
|
32
|
-
notAdjacent: "their sizes are equal but their periods do not touch
|
|
32
|
+
notAdjacent: "their sizes are equal but their periods do not touch. One has to end where the other starts.",
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* Judge one request against the resources this wallet actually holds.
|
|
@@ -45,7 +45,7 @@ export function planStorageOp(held, ask, hints = {}) {
|
|
|
45
45
|
throw new NmtsError(`This wallet holds no free storage resource ${id}.`, {
|
|
46
46
|
exitCode: 4,
|
|
47
47
|
nextStep: hints.notHeld ??
|
|
48
|
-
"Nothing was signed. A storage listing shows the free ones it holds
|
|
48
|
+
"Nothing was signed. A storage listing shows the free ones it holds. A resource bound " +
|
|
49
49
|
"inside a file is not free.",
|
|
50
50
|
});
|
|
51
51
|
}
|
package/dist/support-copy.js
CHANGED
|
@@ -26,11 +26,11 @@ export const SUPPORT_LONG = [
|
|
|
26
26
|
"that is nowhere near enough. The tiniest report counts, and so does anything you are not",
|
|
27
27
|
"sure is a bug. Every message is read, seriously.",
|
|
28
28
|
"",
|
|
29
|
-
"Write in English if you can. Korean is read too
|
|
29
|
+
"Write in English if you can. Korean is read too. If Korean is not your own language,",
|
|
30
30
|
"English is the better choice.",
|
|
31
31
|
"",
|
|
32
32
|
"Keep personal details out. Your NMTS key, API key, passphrase and file contents are",
|
|
33
|
-
"removed on this machine before anything is sent
|
|
33
|
+
"removed on this machine before anything is sent. File names and your public code may go.",
|
|
34
34
|
"Please do not type your name, address, health or anything else about yourself. The form",
|
|
35
35
|
"does not need it, and this inbox is the wrong place for it.",
|
|
36
36
|
];
|
|
@@ -79,7 +79,7 @@ export function categoryCodes() {
|
|
|
79
79
|
}
|
|
80
80
|
/** The categories and their narrowings, one line each, for the help text. */
|
|
81
81
|
export function categoryLines() {
|
|
82
|
-
return SUPPORT_CATEGORIES.map((c) => ` ${c.code.padEnd(10)}${c.subs.join("
|
|
82
|
+
return SUPPORT_CATEGORIES.map((c) => ` ${c.code.padEnd(10)}${c.subs.join(", ")}`);
|
|
83
83
|
}
|
|
84
84
|
/** The usage lines. Kept beside the copy because the two are read together. */
|
|
85
85
|
export const SUPPORT_USAGE = [
|
|
@@ -92,7 +92,7 @@ export const SUPPORT_USAGE = [
|
|
|
92
92
|
/** What `nmts support --help` and `nmts support send --help` print. */
|
|
93
93
|
export function supportHelpText() {
|
|
94
94
|
return [
|
|
95
|
-
"nmts support
|
|
95
|
+
"nmts support: write to the developer of NMTS.",
|
|
96
96
|
"",
|
|
97
97
|
"USAGE",
|
|
98
98
|
...SUPPORT_USAGE,
|
package/dist/support-wire.js
CHANGED
|
@@ -63,7 +63,7 @@ function translate(error) {
|
|
|
63
63
|
return new NmtsError(error.message, {
|
|
64
64
|
exitCode: 2,
|
|
65
65
|
...(error.message.startsWith("category")
|
|
66
|
-
? { nextStep: `The categories are ${categoryCodes().join("
|
|
66
|
+
? { nextStep: `The categories are ${categoryCodes().join(", ")}.` }
|
|
67
67
|
: {}),
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -138,13 +138,13 @@ export function requireCategory(given) {
|
|
|
138
138
|
if (given === undefined) {
|
|
139
139
|
throw new NmtsError("`support send` needs --category.", {
|
|
140
140
|
exitCode: 2,
|
|
141
|
-
nextStep: `The categories are ${codes.join("
|
|
141
|
+
nextStep: `The categories are ${codes.join(", ")}.`,
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
if (!codes.includes(given)) {
|
|
145
145
|
throw new NmtsError(`There is no support category called ${given}.`, {
|
|
146
146
|
exitCode: 2,
|
|
147
|
-
nextStep: `The categories are ${codes.join("
|
|
147
|
+
nextStep: `The categories are ${codes.join(", ")}.`,
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
return given;
|
|
@@ -162,7 +162,7 @@ export function checkSub(category, given) {
|
|
|
162
162
|
if (!subs.includes(given)) {
|
|
163
163
|
throw new NmtsError(`${category} has no part called ${given}.`, {
|
|
164
164
|
exitCode: 2,
|
|
165
|
-
nextStep: `Its parts are ${subs.join("
|
|
165
|
+
nextStep: `Its parts are ${subs.join(", ")}.`,
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
return given;
|
package/dist/update-source.js
CHANGED
|
@@ -139,5 +139,5 @@ export function installCommandLine(version) {
|
|
|
139
139
|
* would be inventing a reason to act.
|
|
140
140
|
*/
|
|
141
141
|
export function newerVersionLine(latest, running, binary) {
|
|
142
|
-
return `${binary} ${latest} is published
|
|
142
|
+
return `${binary} ${latest} is published. This is ${running}. \`${binary} update\` installs it.`;
|
|
143
143
|
}
|
package/dist/upload-price.d.ts
CHANGED
|
@@ -27,6 +27,16 @@ export declare function creditsFor(sealedBytes: number, epochs?: number): number
|
|
|
27
27
|
* that rather than doing it, and this is where the number comes from.
|
|
28
28
|
*/
|
|
29
29
|
export declare function partSizeFor(chosen: string | number | undefined): number;
|
|
30
|
+
/**
|
|
31
|
+
* Stop when a part this size could seal to more than the storage network's relay carries.
|
|
32
|
+
*
|
|
33
|
+
* ⛔ BEFORE ANY PRICE, RESERVATION OR SIGNATURE. The relay refuses a body over 1 GiB, and it does so
|
|
34
|
+
* after the bytes are sent, when the storage is already bought (measured 2026-11-11: a 1 GiB part
|
|
35
|
+
* sealed to 1,073,745,992 bytes and the testnet relay answered 413 with the register paid).
|
|
36
|
+
* `planFor` calls this too, so every rail that cuts a file (the price, the quote, the SDK and the
|
|
37
|
+
* file driver `uploadFile`) refuses the same way, whoever handed it the number.
|
|
38
|
+
*/
|
|
39
|
+
export declare function refuseOversizedPart(partSize: number): void;
|
|
30
40
|
/**
|
|
31
41
|
* Where the cuts fall — and for an EMPTY file, one part that carries nothing.
|
|
32
42
|
*
|
package/dist/upload-price.js
CHANGED
|
@@ -9,6 +9,7 @@ import { NmtsError } from "./errors.js";
|
|
|
9
9
|
import { DEFAULT_PART_BYTES, NCF3_SHAPE, sealedLenFor } from "./seal.js";
|
|
10
10
|
import { paddedPlaintextLen } from "./shared/lib/crypto/size-padding.js";
|
|
11
11
|
import { planParts } from "./shared/lib/upload/part-plan.js";
|
|
12
|
+
import { largestSealedPartBytes, MAX_PART_SIZE_BYTES, partFitsRelay, RELAY_BODY_LIMIT_BYTES, } from "./shared/lib/upload/relay-limit.js";
|
|
12
13
|
/**
|
|
13
14
|
* Storage term, in storage-network epochs.
|
|
14
15
|
*
|
|
@@ -48,8 +49,27 @@ export function partSizeFor(chosen) {
|
|
|
48
49
|
nextStep: "Nothing was sent. Give a number of bytes, or a number with KiB, MiB or GiB.",
|
|
49
50
|
});
|
|
50
51
|
}
|
|
52
|
+
refuseOversizedPart(bytes);
|
|
51
53
|
return bytes;
|
|
52
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Stop when a part this size could seal to more than the storage network's relay carries.
|
|
57
|
+
*
|
|
58
|
+
* ⛔ BEFORE ANY PRICE, RESERVATION OR SIGNATURE. The relay refuses a body over 1 GiB, and it does so
|
|
59
|
+
* after the bytes are sent, when the storage is already bought (measured 2026-11-11: a 1 GiB part
|
|
60
|
+
* sealed to 1,073,745,992 bytes and the testnet relay answered 413 with the register paid).
|
|
61
|
+
* `planFor` calls this too, so every rail that cuts a file (the price, the quote, the SDK and the
|
|
62
|
+
* file driver `uploadFile`) refuses the same way, whoever handed it the number.
|
|
63
|
+
*/
|
|
64
|
+
export function refuseOversizedPart(partSize) {
|
|
65
|
+
if (partFitsRelay(partSize))
|
|
66
|
+
return;
|
|
67
|
+
throw new NmtsError(`A part of ${partSize} bytes is too large for the storage network's upload relay.`, {
|
|
68
|
+
exitCode: 2,
|
|
69
|
+
nextStep: `Nothing was sent and nothing was signed. Sealed and padded, it can reach ${largestSealedPartBytes(partSize)} bytes, ` +
|
|
70
|
+
`and the relay takes at most ${RELAY_BODY_LIMIT_BYTES}. Use --part-size ${MAX_PART_SIZE_BYTES / 2 ** 20}MiB or less.`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
53
73
|
/**
|
|
54
74
|
* A byte count, plainly or with a unit.
|
|
55
75
|
*
|
|
@@ -77,6 +97,7 @@ function parseSize(text) {
|
|
|
77
97
|
* and the sealing read the plan from.
|
|
78
98
|
*/
|
|
79
99
|
export function planFor(size, partSize) {
|
|
100
|
+
refuseOversizedPart(partSize);
|
|
80
101
|
return size === 0 ? [{ partIndex: 0, offset: 0, length: 0 }] : planParts(size, partSize);
|
|
81
102
|
}
|
|
82
103
|
/**
|
package/dist/upload-quote.js
CHANGED
|
@@ -93,7 +93,7 @@ export async function quoteUpload(network, ask, seams = {}) {
|
|
|
93
93
|
if (window === null) {
|
|
94
94
|
throw new NmtsError(`The ${network} storage network could not be read.`, {
|
|
95
95
|
exitCode: 1,
|
|
96
|
-
nextStep: "Nothing was spent. Which epoch it is and how far ahead the network sells are facts only the chain has
|
|
96
|
+
nextStep: "Nothing was spent. Which epoch it is and how far ahead the network sells are facts only the chain has. Ask again.",
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
// ⛔ THE SAME REFUSAL AS THE UPLOAD: a term the network will not sell is refused, never clamped.
|
|
@@ -106,7 +106,7 @@ export async function quoteUpload(network, ask, seams = {}) {
|
|
|
106
106
|
if (price === null) {
|
|
107
107
|
throw new NmtsError(`The ${network} reference gas price could not be read.`, {
|
|
108
108
|
exitCode: 1,
|
|
109
|
-
nextStep: "Nothing was spent. The fee estimate scales with that price, so it is not guessed
|
|
109
|
+
nextStep: "Nothing was spent. The fee estimate scales with that price, so it is not guessed. Ask again.",
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
const sum = (pick) => quotes.reduce((total, q) => total + pick(q), 0n);
|
package/dist/upload-run.js
CHANGED
|
@@ -92,7 +92,7 @@ function conflict(paid) {
|
|
|
92
92
|
message: "Another run is uploading this same file to the same place.",
|
|
93
93
|
paid,
|
|
94
94
|
nextStep: "This run stopped before committing anything. Let the other run finish, then run this " +
|
|
95
|
-
"again
|
|
95
|
+
"again. It finds that upload's records, or starts one of its own.",
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
/**
|
package/dist/upload-steps.js
CHANGED
|
@@ -108,7 +108,7 @@ export async function commitItem(input, fileKey, parts) {
|
|
|
108
108
|
paid: true,
|
|
109
109
|
from: error,
|
|
110
110
|
nextStep: "Nothing more will be spent. Running the same command again commits the same stored " +
|
|
111
|
-
"bytes
|
|
111
|
+
"bytes. The retry is recognised and does not make a second file.",
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
// ⛔ Written down before returning: from here on the file EXISTS and is paid for, and the only
|
package/dist/upload-store.js
CHANGED
|
@@ -149,7 +149,7 @@ export async function readReservationBytes(key) {
|
|
|
149
149
|
const held = await host().state.read(bin);
|
|
150
150
|
if (held === undefined) {
|
|
151
151
|
throw new NmtsError(`The sealed bytes of ${bin} are gone.`, {
|
|
152
|
-
nextStep: "Nothing was sent. The storage they bought cannot be filled by re-sealing
|
|
152
|
+
nextStep: "Nothing was sent. The storage they bought cannot be filled by re-sealing. Run the " +
|
|
153
153
|
"upload again to buy storage for a fresh sealing of the same file.",
|
|
154
154
|
});
|
|
155
155
|
}
|
|
@@ -171,7 +171,7 @@ export async function encodedLength(client, sender, sealedLen) {
|
|
|
171
171
|
if (value === undefined || value.length !== 8) {
|
|
172
172
|
throw new NmtsError("The chain did not say how large this part is once encoded.", {
|
|
173
173
|
exitCode: 1,
|
|
174
|
-
nextStep: "Nothing was signed. A held resource cannot be cut to fit without that number
|
|
174
|
+
nextStep: "Nothing was signed. A held resource cannot be cut to fit without that number. Buy new storage instead, or try again.",
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
return Number(u64FromLe(value));
|
|
@@ -29,7 +29,7 @@ export function chooseUploadEpochs(asked, window) {
|
|
|
29
29
|
if (!Number.isSafeInteger(epochs) || epochs <= 0) {
|
|
30
30
|
throw new NmtsError(`A storage term is a whole number of epochs: ${String(asked)}.`, {
|
|
31
31
|
exitCode: 2,
|
|
32
|
-
nextStep: `Nothing was signed. \`--epochs 4\` buys four of the storage network's epochs
|
|
32
|
+
nextStep: `Nothing was signed. \`--epochs 4\` buys four of the storage network's epochs, ${daysOf(window, 1)} each.`,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
if (epochs > window.maxAhead) {
|
|
@@ -80,7 +80,7 @@ export function pickResource(ask, resources, encodedBytes, currentEpoch, needUnt
|
|
|
80
80
|
throw new NmtsError(`Resource ${ask.objectId} cannot hold this part until epoch ${needUntilEpoch}.`, {
|
|
81
81
|
exitCode: 4,
|
|
82
82
|
nextStep: `Nothing was signed. It holds ${chosen.sizeBytes} bytes from epoch ${chosen.startEpoch} to ` +
|
|
83
|
-
`${chosen.endEpoch}
|
|
83
|
+
`${chosen.endEpoch}. This part is ${encodedBytes} bytes once encoded. Leave --storage off to buy new storage.`,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -90,7 +90,7 @@ export function pickResource(ask, resources, encodedBytes, currentEpoch, needUnt
|
|
|
90
90
|
if (chosen === undefined) {
|
|
91
91
|
throw new NmtsError(`No free storage resource in this wallet holds ${encodedBytes} encoded bytes until epoch ${needUntilEpoch}.`, {
|
|
92
92
|
exitCode: 4,
|
|
93
|
-
nextStep: `Nothing was signed. \`${BINARY_NAME} wallet storage\` lists what it holds
|
|
93
|
+
nextStep: `Nothing was signed. \`${BINARY_NAME} wallet storage\` lists what it holds. Leave --storage off ` +
|
|
94
94
|
`to buy new storage, or ask for fewer epochs.`,
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -138,28 +138,28 @@ export function walPrice(quotes, storage) {
|
|
|
138
138
|
/** The next step when the wallet is short: where to send what, said once. */
|
|
139
139
|
export function uploadShortfallNextStep(b) {
|
|
140
140
|
const coin = b.walFrost !== null && b.walFrost < b.walNeededFrost ? "WAL" : "SUI";
|
|
141
|
-
return (`Nothing was signed and nothing was sent. Send ${coin} to ${b.address}
|
|
142
|
-
|
|
141
|
+
return (`Nothing was signed and nothing was sent. Send ${coin} to ${b.address} ` +
|
|
142
|
+
`(\`${BINARY_NAME} wallet\` shows the address and both balances) and run this again.`);
|
|
143
143
|
}
|
|
144
144
|
/** The numbers, for a person, in the order somebody deciding needs them. */
|
|
145
145
|
export function describeUploadReview(say, facts, budget) {
|
|
146
146
|
say(`${facts.name} ${facts.bytes} bytes → ${coinAmount(facts.walNeeded)} WAL from the wallet`);
|
|
147
147
|
if (facts.parts > 1)
|
|
148
|
-
say(` in ${facts.parts} parts
|
|
149
|
-
say(` Stored for ${facts.epochs} epoch${facts.epochs === 1 ? "" : "s"}
|
|
148
|
+
say(` in ${facts.parts} parts. Each one is registered and certified with its own signatures`);
|
|
149
|
+
say(` Stored for ${facts.epochs} epoch${facts.epochs === 1 ? "" : "s"} (${facts.days}), until epoch ${facts.endEpoch}.`);
|
|
150
150
|
if (facts.storage.kind === "reuse") {
|
|
151
151
|
const r = facts.storage.resource;
|
|
152
|
-
say(` Storage comes from resource ${r.objectId} (${r.sizeBytes} bytes, until epoch ${r.endEpoch})
|
|
152
|
+
say(` Storage comes from resource ${r.objectId} (${r.sizeBytes} bytes, until epoch ${r.endEpoch}). The WAL above is the write alone.`);
|
|
153
153
|
say(facts.storage.cutToBytes === null
|
|
154
154
|
? ` Used whole: ${facts.storage.leftoverBytes} bytes beyond this file are bound with it and cannot be taken back.`
|
|
155
155
|
: ` Cut to fit: ${facts.storage.leftoverBytes} bytes stay free as a resource of their own.`);
|
|
156
156
|
}
|
|
157
157
|
else if (facts.heldResources !== null && facts.heldResources > 0) {
|
|
158
|
-
say(` This wallet also holds ${facts.heldResources} free storage resource${facts.heldResources === 1 ? "" : "s"}
|
|
158
|
+
say(` This wallet also holds ${facts.heldResources} free storage resource${facts.heldResources === 1 ? "" : "s"}. \`${BINARY_NAME} wallet storage\` lists them; --storage fit or whole tries one.`);
|
|
159
159
|
}
|
|
160
160
|
say(` Relay tip ${coinAmount(facts.tipMist)} SUI, paid inside the register signature${facts.parts > 1 ? "s" : ""}.`);
|
|
161
161
|
if (budget.feeMist === null) {
|
|
162
|
-
say(` The chain fee (SUI) of a register signature could not be measured just now
|
|
162
|
+
say(` The chain fee (SUI) of a register signature could not be measured just now. It is charged with each signature.`);
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
165
|
say(` Chain fee about ${coinAmount(budget.feeMist)} SUI per register signature, measured by a dry run just now; ` +
|
|
@@ -174,10 +174,10 @@ export function describeUploadReview(say, facts, budget) {
|
|
|
174
174
|
say(` Afterwards it holds about ${coinAmount(walAfter < 0n ? 0n : walAfter)} WAL and ${coinAmount(suiAfter < 0n ? 0n : suiAfter)} SUI.`);
|
|
175
175
|
}
|
|
176
176
|
for (const why of budget.unread) {
|
|
177
|
-
say(` A balance could not be read
|
|
177
|
+
say(` A balance could not be read: ${why}. That is not zero: the chain decides at signing.`);
|
|
178
178
|
}
|
|
179
179
|
say(``);
|
|
180
|
-
say(` This is paid in WAL and SUI from the wallet this NMTS key derives
|
|
180
|
+
say(` This is paid in WAL and SUI from the wallet this NMTS key derives, not from credits, which`);
|
|
181
181
|
say(` is what \`${BINARY_NAME} put\` spends without --pay wallet. Nobody, NMTS included, can reverse it.`);
|
|
182
182
|
say(` The storage is the wallet's own: NMTS records the file and does not hold it.`);
|
|
183
183
|
// ⛔ SAID WHERE IT CHANGES WHAT SOMEBODY GETS, AND NOWHERE ELSE. An account that never asked for
|
|
@@ -71,7 +71,7 @@ export async function walletPut(ctx, file, seams = {}) {
|
|
|
71
71
|
if (window === null) {
|
|
72
72
|
throw new NmtsError(`The ${ctx.network} storage network could not be read.`, {
|
|
73
73
|
exitCode: 1,
|
|
74
|
-
nextStep: `Nothing was signed and nothing was sent. Which epoch the network is in, and how far ahead it will sell, are facts only the chain has
|
|
74
|
+
nextStep: `Nothing was signed and nothing was sent. Which epoch the network is in, and how far ahead it will sell, are facts only the chain has, and this will not spend against a guess.`,
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
const epochs = chooseUploadEpochs(seams.epochs, window);
|
package/dist/upload-wallet.js
CHANGED
|
@@ -52,7 +52,7 @@ async function buyAndPushPartWithWallet(ctx, input) {
|
|
|
52
52
|
message: `This upload was started with ${started} paying, and this run would pay from ${ctx.payer?.address ?? "the wallet this NMTS key derives"}.`,
|
|
53
53
|
paid: existing.registerTxDigest !== undefined,
|
|
54
54
|
nextStep: "Nothing was sent. Run it again with the wallet that started it, or clear the unfinished " +
|
|
55
|
-
"upload records to start over
|
|
55
|
+
"upload records to start over. The storage the first wallet bought stays that wallet's.",
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
if (existing !== null && (existing.partIndex !== input.part.index || existing.partTotal !== input.part.total)) {
|
|
@@ -152,7 +152,7 @@ async function buyAndPushPartWithWallet(ctx, input) {
|
|
|
152
152
|
paid: false,
|
|
153
153
|
nextStep: error instanceof NmtsError && error.nextStep !== null
|
|
154
154
|
? error.nextStep
|
|
155
|
-
: "If the transaction reached the chain the storage may be bought
|
|
155
|
+
: "If the transaction reached the chain the storage may be bought. Running the same " +
|
|
156
156
|
"command again finds the record and does not sign a second registration for a part " +
|
|
157
157
|
"that has one.",
|
|
158
158
|
});
|
package/dist/upload.js
CHANGED
|
@@ -103,7 +103,7 @@ export async function buyAndPushPart(input) {
|
|
|
103
103
|
message: `Could not ask about the paid reservation ${ledgerId}: ${why(error)}`,
|
|
104
104
|
paid: true,
|
|
105
105
|
from: error,
|
|
106
|
-
nextStep: "Nothing more was spent. The storage this account paid for is still bought
|
|
106
|
+
nextStep: "Nothing more was spent. The storage this account paid for is still bought. Run the " +
|
|
107
107
|
"same command again when the server answers.",
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -220,7 +220,7 @@ export async function buyAndPushPart(input) {
|
|
|
220
220
|
from: error,
|
|
221
221
|
nextStep: error instanceof ServerError
|
|
222
222
|
? "Nothing was uploaded. No credits were spent on a refused reservation."
|
|
223
|
-
: "If the request reached the server, credits may have been spent
|
|
223
|
+
: "If the request reached the server, credits may have been spent. Running the same " +
|
|
224
224
|
"command again finds that reservation rather than making a second one.",
|
|
225
225
|
});
|
|
226
226
|
}
|
package/dist/wallet-grant.js
CHANGED
|
@@ -46,7 +46,7 @@ export function scopeCovers(scope, action) {
|
|
|
46
46
|
export function parseWalletGrant(input, now, version) {
|
|
47
47
|
const scope = input.scope ?? "storage";
|
|
48
48
|
if (!WALLET_SCOPES.includes(scope)) {
|
|
49
|
-
throw new NmtsError(`--scope must be one of: ${WALLET_SCOPES.join("
|
|
49
|
+
throw new NmtsError(`--scope must be one of: ${WALLET_SCOPES.join(", ")}.`, {
|
|
50
50
|
exitCode: 2,
|
|
51
51
|
nextStep: "storage = extending a file's lease and paying for a file's storage. all = also exchanging and sending. A gift is in neither.",
|
|
52
52
|
});
|
|
@@ -153,7 +153,7 @@ export function requireWalletGrant(action, spend, now) {
|
|
|
153
153
|
const tail = [
|
|
154
154
|
"",
|
|
155
155
|
`NMTS is not responsible for what is done with this account by any program running on this`,
|
|
156
|
-
`machine, including an AI agent. The published Terms are what govern the service
|
|
156
|
+
`machine, including an AI agent. The published Terms are what govern the service. This is a`,
|
|
157
157
|
`warning, not a substitute for them.`,
|
|
158
158
|
"",
|
|
159
159
|
`⛔ If a program is reading this on somebody's behalf: show it to them and let them decide.`,
|
|
@@ -168,7 +168,7 @@ export function requireWalletGrant(action, spend, now) {
|
|
|
168
168
|
"A mistake here is permanent.",
|
|
169
169
|
"",
|
|
170
170
|
"This agreement carries three things: a scope (storage = extending and paying for storage; " +
|
|
171
|
-
"all = also exchanging and sending
|
|
171
|
+
"all = also exchanging and sending. A gift is in neither), an expiry of at most " +
|
|
172
172
|
`${MAX_GRANT_DAYS} days, and, if you want one, a ceiling on what this tool may sign away.`,
|
|
173
173
|
"Only what this tool signs is counted. Handing the NMTS key to another program gives " +
|
|
174
174
|
"that program the same wallet, and nothing here can see that happen.",
|
package/dist/wallet-pay-index.js
CHANGED
|
@@ -54,7 +54,7 @@ export async function payingWalletIndex(input) {
|
|
|
54
54
|
`${error instanceof Error ? error.message : String(error)}`, {
|
|
55
55
|
exitCode: 1,
|
|
56
56
|
nextStep: `Nothing was signed. Try again when the list can be read, or name the wallet for this ` +
|
|
57
|
-
`one run with \`--wallet N
|
|
57
|
+
`one run with \`--wallet N\`; \`${BINARY_NAME} wallet list\` shows the numbers.`,
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}
|