@needmoretruth/nmts-cli 0.50.0 → 0.50.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 +7 -0
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/dist/artifact-about.d.ts +1 -1
- package/dist/extend-chain.js +5 -2
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/upload-wallet-chain.d.ts +5 -0
- package/dist/upload-wallet-chain.js +19 -7
- package/dist/upload-wallet-plan.d.ts +1 -1
- package/dist/upload-wallet-put.js +1 -1
- package/dist/wallet-sign-external.js +3 -1
- package/dist/wallet-sign.js +3 -1
- package/dist/walrus-fresh.d.ts +8 -0
- package/dist/walrus-fresh.js +15 -0
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.50.1 — 2026-10-20
|
|
7
|
+
|
|
8
|
+
- `nmts put` paying from your wallet into a storage resource the wallet already holds carried the
|
|
9
|
+
write price it read when the upload was reviewed, and paid exactly that at signing. If Walrus
|
|
10
|
+
storage nodes changed the price in between, the chain refused the registration before anything was
|
|
11
|
+
charged. The price is now read when the transaction is signed.
|
|
12
|
+
|
|
6
13
|
## 0.50.0 — 2026-10-01
|
|
7
14
|
|
|
8
15
|
- `nmts create` can spend a one-time pass taken from the environment variable `NMTS_AGENT_PASS`. It
|
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.50.
|
|
53
|
+
npm install -g github:needmoretruth/nmts-cli#v0.50.1 # 버전을 고정할 때
|
|
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.50.
|
|
54
|
+
npm install -g github:needmoretruth/nmts-cli#v0.50.1 # 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.50.
|
|
14
|
+
export declare const WRITTEN_BY = "nmts-cli 0.50.1";
|
|
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/extend-chain.js
CHANGED
|
@@ -22,6 +22,7 @@ import { epochClock } from "./expiry.js";
|
|
|
22
22
|
import { isRecord } from "./guards.js";
|
|
23
23
|
import { epochStartedMs } from "./walrus-write.js";
|
|
24
24
|
import { storageNodesThrough } from "./walrus.js";
|
|
25
|
+
import { freshWalrus } from "./walrus-fresh.js";
|
|
25
26
|
import { suiRpcTransport } from "./sui-rpc.js";
|
|
26
27
|
import { readBalances, walCoinType } from "./wallet.js";
|
|
27
28
|
import { chainReader } from "./wallet-chain.js";
|
|
@@ -134,7 +135,8 @@ export function extendReads(network) {
|
|
|
134
135
|
async quote(leases, epochs) {
|
|
135
136
|
if (epochs <= 0 || leases.length === 0)
|
|
136
137
|
return 0n;
|
|
137
|
-
const
|
|
138
|
+
const fresh = freshWalrus(client);
|
|
139
|
+
const costs = await Promise.all(leases.map((lease) => fresh.storageCost(lease.size, epochs)));
|
|
138
140
|
return costs.reduce((sum, cost) => sum + BigInt(cost.storageCost), 0n);
|
|
139
141
|
},
|
|
140
142
|
async readWallet(address) {
|
|
@@ -148,8 +150,9 @@ export function extendReads(network) {
|
|
|
148
150
|
try {
|
|
149
151
|
const tx = new Transaction();
|
|
150
152
|
tx.setSender(sender);
|
|
153
|
+
const fresh = freshWalrus(client);
|
|
151
154
|
for (const blobObjectId of [...new Set(objectIds)]) {
|
|
152
|
-
tx.add(
|
|
155
|
+
tx.add(fresh.extendBlob({ blobObjectId, epochs }));
|
|
153
156
|
}
|
|
154
157
|
const bytes = await tx.build({ client });
|
|
155
158
|
const { effects } = await client.dryRunTransactionBlock({ transactionBlock: bytes });
|
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.50.
|
|
12
|
+
export declare const VERSION = "0.50.1";
|
|
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.50.
|
|
21
|
+
export const VERSION = "0.50.1";
|
|
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. */
|
|
@@ -27,6 +27,11 @@ export declare function payingClient(network: Network, relayUrl: string): Paying
|
|
|
27
27
|
*
|
|
28
28
|
* ⛔ SENDER FIRST. `coinWithBalance` and the SDK's own coin selection pick WAL and SUI from the
|
|
29
29
|
* sender's address when the fragments resolve; without it the build fails late.
|
|
30
|
+
*
|
|
31
|
+
* ⛔ EVERY PRICE IS READ HERE, ON FRESH STATE — the held resource's write cost included. It used to
|
|
32
|
+
* arrive from the review's quote, and the register transaction pays EXACTLY what it is given:
|
|
33
|
+
* a price vote landing between the review and the signature (a long seal, a resumed upload) made
|
|
34
|
+
* the chain abort the registration in `destroy_zero` or `split` instead of charging the new price.
|
|
30
35
|
*/
|
|
31
36
|
export declare function registerTransaction(client: PayingClient, network: Network, input: RegisterShape & {
|
|
32
37
|
sender: string;
|
|
@@ -28,6 +28,7 @@ import { reachFetch } from "./reach.js";
|
|
|
28
28
|
import { readOwnedStorage, readStorageType } from "./shared/lib/storage-control/chain.js";
|
|
29
29
|
import { registerIntoStorage, splitStorageToFit } from "./shared/lib/storage-control/reuse.js";
|
|
30
30
|
import { storageNodesThrough } from "./walrus.js";
|
|
31
|
+
import { freshWalrus } from "./walrus-fresh.js";
|
|
31
32
|
import { suiRpcTransport } from "./sui-rpc.js";
|
|
32
33
|
import { readBalances, walCoinType } from "./wallet.js";
|
|
33
34
|
import { chainReader } from "./wallet-chain.js";
|
|
@@ -62,14 +63,20 @@ export function payingClient(network, relayUrl) {
|
|
|
62
63
|
*
|
|
63
64
|
* ⛔ SENDER FIRST. `coinWithBalance` and the SDK's own coin selection pick WAL and SUI from the
|
|
64
65
|
* sender's address when the fragments resolve; without it the build fails late.
|
|
66
|
+
*
|
|
67
|
+
* ⛔ EVERY PRICE IS READ HERE, ON FRESH STATE — the held resource's write cost included. It used to
|
|
68
|
+
* arrive from the review's quote, and the register transaction pays EXACTLY what it is given:
|
|
69
|
+
* a price vote landing between the review and the signature (a long seal, a resumed upload) made
|
|
70
|
+
* the chain abort the registration in `destroy_zero` or `split` instead of charging the new price.
|
|
65
71
|
*/
|
|
66
72
|
export async function registerTransaction(client, network, input) {
|
|
67
73
|
const tx = new Transaction();
|
|
68
74
|
tx.setSender(input.sender);
|
|
69
75
|
const { part } = input;
|
|
70
|
-
|
|
76
|
+
const fresh = freshWalrus(client);
|
|
77
|
+
tx.add(fresh.sendUploadRelayTip({ size: part.sealedLen, blobDigest: part.blobDigest, nonce: part.nonce }));
|
|
71
78
|
if (input.storage.kind === "buy") {
|
|
72
|
-
const blob = tx.add(
|
|
79
|
+
const blob = tx.add(fresh.registerBlob({
|
|
73
80
|
size: part.sealedLen,
|
|
74
81
|
epochs: input.epochs,
|
|
75
82
|
blobId: part.blobId,
|
|
@@ -79,7 +86,11 @@ export async function registerTransaction(client, network, input) {
|
|
|
79
86
|
tx.transferObjects([blob], input.sender);
|
|
80
87
|
return tx;
|
|
81
88
|
}
|
|
82
|
-
const
|
|
89
|
+
const [system, { writeCost }] = await Promise.all([
|
|
90
|
+
fresh.systemObject(),
|
|
91
|
+
fresh.storageCost(part.sealedLen, input.epochs),
|
|
92
|
+
]);
|
|
93
|
+
const walrusPackageId = system.package_id;
|
|
83
94
|
if (input.storage.cutToBytes !== null) {
|
|
84
95
|
splitStorageToFit({
|
|
85
96
|
walrusPackageId,
|
|
@@ -96,7 +107,7 @@ export async function registerTransaction(client, network, input) {
|
|
|
96
107
|
blobIdAsInt: blobIdToInt(part.blobId),
|
|
97
108
|
rootHash: part.rootHash,
|
|
98
109
|
rawBytes: part.sealedLen,
|
|
99
|
-
writeCost
|
|
110
|
+
writeCost,
|
|
100
111
|
deletable: true,
|
|
101
112
|
owner: input.sender,
|
|
102
113
|
}, tx);
|
|
@@ -104,7 +115,7 @@ export async function registerTransaction(client, network, input) {
|
|
|
104
115
|
}
|
|
105
116
|
/** The certify transaction of ONE part, from the certificate the relay handed back. */
|
|
106
117
|
export function certifyTransaction(client, input) {
|
|
107
|
-
return client.
|
|
118
|
+
return freshWalrus(client).certifyBlobTransaction({
|
|
108
119
|
blobId: input.blobId,
|
|
109
120
|
blobObjectId: input.blobObjectId,
|
|
110
121
|
deletable: true,
|
|
@@ -176,10 +187,11 @@ export function walletUploadReads(network, relayUrl) {
|
|
|
176
187
|
return {
|
|
177
188
|
readWindow: () => extendReads(network).readWindow(),
|
|
178
189
|
async quoteParts(sealedLens, epochs) {
|
|
190
|
+
const fresh = freshWalrus(client);
|
|
179
191
|
return Promise.all(sealedLens.map(async (sealedLen) => {
|
|
180
192
|
const [cost, tip] = await Promise.all([
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
fresh.storageCost(sealedLen, epochs),
|
|
194
|
+
fresh.calculateUploadRelayTip({ size: sealedLen }),
|
|
183
195
|
]);
|
|
184
196
|
return { sealedLen, storageFrost: cost.storageCost, writeFrost: cost.writeCost, tipMist: BigInt(tip) };
|
|
185
197
|
}));
|
|
@@ -30,13 +30,13 @@ export type StorageChoice = {
|
|
|
30
30
|
/** One part as the register transaction needs it. */
|
|
31
31
|
export interface RegisterShape {
|
|
32
32
|
epochs: number;
|
|
33
|
+
/** ⚠ No write cost here: the register transaction reads it at signing (`registerTransaction`). */
|
|
33
34
|
storage: {
|
|
34
35
|
kind: "buy";
|
|
35
36
|
} | {
|
|
36
37
|
kind: "reuse";
|
|
37
38
|
objectId: string;
|
|
38
39
|
cutToBytes: number | null;
|
|
39
|
-
writeFrost: bigint;
|
|
40
40
|
};
|
|
41
41
|
part: {
|
|
42
42
|
sealedLen: number;
|
|
@@ -112,7 +112,7 @@ export async function walletPut(ctx, file, seams = {}) {
|
|
|
112
112
|
epochs,
|
|
113
113
|
storage: storage.kind === "buy"
|
|
114
114
|
? storage
|
|
115
|
-
: { kind: "reuse", objectId: storage.objectId, cutToBytes: storage.cutToBytes
|
|
115
|
+
: { kind: "reuse", objectId: storage.objectId, cutToBytes: storage.cutToBytes },
|
|
116
116
|
}),
|
|
117
117
|
]);
|
|
118
118
|
const budget = uploadBudget({ address, purse, feeMist, quotes, storage });
|
|
@@ -36,6 +36,7 @@ import { Transaction, TransactionDataBuilder } from "@mysten/sui/transactions";
|
|
|
36
36
|
import { fromBase64 } from "@mysten/sui/utils";
|
|
37
37
|
import { NmtsError } from "./errors.js";
|
|
38
38
|
import { walrusClient } from "./extend-chain.js";
|
|
39
|
+
import { freshWalrus } from "./walrus-fresh.js";
|
|
39
40
|
import { isRecord } from "./guards.js";
|
|
40
41
|
import { isTransient, keepTrying } from "./net-retry.js";
|
|
41
42
|
import { storageOpTransaction } from "./storage-control-chain.js";
|
|
@@ -176,8 +177,9 @@ export function externalExtendSigner(payer) {
|
|
|
176
177
|
const tx = new Transaction();
|
|
177
178
|
// The sender goes first: the fragments below pick this address's WAL when they resolve.
|
|
178
179
|
tx.setSender(payer.address);
|
|
180
|
+
const fresh = freshWalrus(client);
|
|
179
181
|
for (const blobObjectId of unique)
|
|
180
|
-
tx.add(
|
|
182
|
+
tx.add(fresh.extendBlob({ blobObjectId, epochs }));
|
|
181
183
|
const result = await signAndSubmit(client, payer, {
|
|
182
184
|
network,
|
|
183
185
|
bytes: await tx.build({ client }),
|
package/dist/wallet-sign.js
CHANGED
|
@@ -35,6 +35,7 @@ import { assertUsableCode } from "./account.js";
|
|
|
35
35
|
import { DERIVED, loadCrypto } from "./crypto.js";
|
|
36
36
|
import { NmtsError } from "./errors.js";
|
|
37
37
|
import { walrusClient } from "./extend-chain.js";
|
|
38
|
+
import { freshWalrus } from "./walrus-fresh.js";
|
|
38
39
|
import { transferTransaction } from "./wallet-send-chain.js";
|
|
39
40
|
import { storageOpTransaction } from "./storage-control-chain.js";
|
|
40
41
|
import { swapTransaction } from "./wallet-swap-chain.js";
|
|
@@ -120,8 +121,9 @@ export const signExtension = async ({ network, code, wallet, objectIds, epochs }
|
|
|
120
121
|
// The sender must be set before the fragments resolve: paying with the SDK's default coin
|
|
121
122
|
// selection picks the WAL coins from the sender's own address.
|
|
122
123
|
tx.setSender(keypair.toSuiAddress());
|
|
124
|
+
const fresh = freshWalrus(client);
|
|
123
125
|
for (const blobObjectId of unique) {
|
|
124
|
-
tx.add(
|
|
126
|
+
tx.add(fresh.extendBlob({ blobObjectId, epochs }));
|
|
125
127
|
}
|
|
126
128
|
const result = await client.signAndExecuteTransaction({
|
|
127
129
|
transaction: tx,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The SDK's own cache door — the one method of the Walrus namespace this file needs. */
|
|
2
|
+
export interface ResettableWalrus {
|
|
3
|
+
reset(): void;
|
|
4
|
+
}
|
|
5
|
+
/** The client's Walrus namespace with its caches cleared, so what follows reads the chain. */
|
|
6
|
+
export declare function freshWalrus<W extends ResettableWalrus>(client: {
|
|
7
|
+
walrus: W;
|
|
8
|
+
}): W;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The one door to a Walrus build that depends on a price or on the package address.
|
|
2
|
+
//
|
|
3
|
+
// ⛔ WHY (2026-10-20 · Walrus mainnet). `@mysten/walrus` keeps the system object and state
|
|
4
|
+
// — the storage and write prices, the package id — in each client until `reset()`. A transaction
|
|
5
|
+
// priced from that cache splits the old amount, the contract charges the new one, and
|
|
6
|
+
// `balance::destroy_zero` (price fell) or `balance::split` (price rose) aborts; the server's
|
|
7
|
+
// chain service lost every treasury-paid upload for a week that way. This tool builds a client
|
|
8
|
+
// per command and per signature, so today the reset finds nothing to clear and costs nothing —
|
|
9
|
+
// it is here so that a client kept longer (an MCP session, a held review) still pays today's
|
|
10
|
+
// price. `deploy/check-fresh-walrus.mjs` refuses a builder called any other way.
|
|
11
|
+
/** The client's Walrus namespace with its caches cleared, so what follows reads the chain. */
|
|
12
|
+
export function freshWalrus(client) {
|
|
13
|
+
client.walrus.reset();
|
|
14
|
+
return client.walrus;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.1",
|
|
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.50.
|
|
9
|
+
"version": "0.50.1",
|
|
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.50.
|
|
15
|
+
"version": "0.50.1",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|