@needmoretruth/nmts-cli 0.54.2 → 0.56.0

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.ko.md +9 -1
  3. package/README.md +9 -1
  4. package/dist/artifact-about.d.ts +1 -1
  5. package/dist/commands/push.js +1 -1
  6. package/dist/commands/put-wallet.js +12 -12
  7. package/dist/commands/put.js +1 -1
  8. package/dist/commands/recovery-list.js +3 -2
  9. package/dist/crypto-surface.d.ts +2 -0
  10. package/dist/crypto-surface.js +4 -7
  11. package/dist/manifest.js +3 -0
  12. package/dist/node-read.d.ts +2 -0
  13. package/dist/node-read.js +24 -0
  14. package/dist/portable.d.ts +2 -0
  15. package/dist/portable.js +3 -0
  16. package/dist/product.d.ts +1 -1
  17. package/dist/product.js +1 -1
  18. package/dist/read-race.d.ts +35 -0
  19. package/dist/read-race.js +91 -0
  20. package/dist/recovery-assemble.d.ts +4 -11
  21. package/dist/recovery-assemble.js +25 -106
  22. package/dist/recovery-build.d.ts +7 -1
  23. package/dist/recovery-build.js +15 -11
  24. package/dist/recovery-seq.d.ts +2 -2
  25. package/dist/recovery-seq.js +30 -23
  26. package/dist/recovery.d.ts +92 -0
  27. package/dist/recovery.js +202 -0
  28. package/dist/road-hosts.generated.d.ts +4 -0
  29. package/dist/road-hosts.generated.js +284 -0
  30. package/dist/shared/lib/upload/wallet-storage-estimate.d.ts +16 -0
  31. package/dist/shared/lib/upload/wallet-storage-estimate.js +44 -0
  32. package/dist/shared/lib/wallet/graphql-history.d.ts +7 -2
  33. package/dist/shared/lib/wallet/graphql-history.js +7 -2
  34. package/dist/shared/lib/walrus/credit-tip.d.ts +24 -0
  35. package/dist/shared/lib/walrus/credit-tip.js +61 -0
  36. package/dist/shared/lib/walrus/node-certificate.d.ts +18 -0
  37. package/dist/shared/lib/walrus/node-certificate.js +77 -0
  38. package/dist/shared/lib/walrus/node-quorum.d.ts +17 -0
  39. package/dist/shared/lib/walrus/node-quorum.js +103 -0
  40. package/dist/shared/lib/walrus/tip-config.d.ts +33 -0
  41. package/dist/shared/lib/walrus/tip-config.js +68 -0
  42. package/dist/upload-file.d.ts +2 -0
  43. package/dist/upload-file.js +6 -0
  44. package/dist/upload-recovery-patch.d.ts +65 -0
  45. package/dist/upload-recovery-patch.js +250 -0
  46. package/dist/upload-road.d.ts +26 -4
  47. package/dist/upload-road.js +79 -17
  48. package/dist/upload-steps.js +5 -1
  49. package/dist/upload-wallet-chain.d.ts +1 -1
  50. package/dist/upload-wallet-chain.js +11 -4
  51. package/dist/upload-wallet-plan.d.ts +4 -0
  52. package/dist/upload-wallet-plan.js +18 -8
  53. package/dist/upload-wallet-put.d.ts +6 -2
  54. package/dist/upload-wallet-put.js +30 -17
  55. package/dist/upload-wallet.d.ts +4 -1
  56. package/dist/upload-wallet.js +12 -3
  57. package/dist/upload-wire.d.ts +27 -0
  58. package/dist/upload-wire.js +2 -0
  59. package/dist/upload.js +3 -3
  60. package/dist/walrus-write.js +80 -3
  61. package/dist/walrus.d.ts +20 -4
  62. package/dist/walrus.js +115 -36
  63. package/docs/commands/put.md +5 -1
  64. package/package.json +5 -1
  65. package/server.json +2 -2
@@ -0,0 +1,284 @@
1
+ // GENERATED by deploy/gen-roads.mjs on 2026-11-09 — do not edit by hand; run `node deploy/gen-roads.mjs --write`.
2
+ // The browser, its CSP (web/next.config.ts) and the command line read these same rows; the probe that
3
+ // chose them is deploy/roads/probe.json, and `node deploy/gen-roads.mjs --check` says when they drift.
4
+ /** Aggregators from Walrus's operator registry that served the probe blob to https://nmts.me, pinned first rows first, then fastest first. */
5
+ export const REGISTRY_AGGREGATORS = {
6
+ testnet: [
7
+ "https://aggregator.walrus-testnet.walrus.space",
8
+ "https://walrus-testnet-aggregator.nodeinfra.com",
9
+ "https://testnet-aggregator-walrus.kiliglab.io",
10
+ "https://aggregator.testnet.walrus.mirai.cloud",
11
+ "https://suiftly-testnet-agg.mhax.io",
12
+ "https://walrus-test-aggregator.thepassivetrust.com",
13
+ "https://aggregator.walrus.banansen.dev",
14
+ "https://walrus-testnet-aggregator.stakely.io",
15
+ "https://aggregator.walrus-testnet.h2o-nodes.com",
16
+ "https://walrus-aggregator-testnet.cetus.zone",
17
+ "https://aggregator.walrus-01.tududes.com",
18
+ "https://walrus-aggregator-testnet.haedal.xyz",
19
+ "https://walrus-testnet-aggregator.stakingdefenseleague.com",
20
+ "https://testnet.aggregator.walrus.silentvalidator.com",
21
+ "https://sui-walrus-tn-aggregator.bwarelabs.com",
22
+ "https://walrus-testnet-aggregator.chainbase.online",
23
+ "https://walrus-aggregator-testnet.staking4all.org",
24
+ "https://walrus-aggregator-testnet.n1stake.com",
25
+ "https://testnet-aggregator.walrus.graphyte.dev",
26
+ "https://walrus-testnet-aggregator.dzdaic.com",
27
+ "https://walrus-testnet-aggregator-1.zkv.xyz",
28
+ "https://walrus-agg-testnet.chainode.tech:9002",
29
+ "https://walrus-testnet-aggregator.redundex.com",
30
+ "https://walrus-testnet-aggregator.stakecraft.com",
31
+ "https://walrus-agg.testnet.obelisk.sh",
32
+ "https://walrus-testnet-aggregator.rpc101.org",
33
+ "https://walrus-testnet-aggregator.starduststaking.com",
34
+ "https://walrus-testnet-aggregator.nodes.guru",
35
+ "https://walrus-testnet.veera.com",
36
+ "https://walrus-tn.juicystake.io:9443",
37
+ "https://walrus-testnet.blockscope.net",
38
+ "https://walrus-testnet-aggregator.talentum.id",
39
+ "https://walrus-agg-test.bucketprotocol.io",
40
+ "https://walrus.testnet.aggregator.stakepool.dev.br",
41
+ "https://walrus-testnet-aggregator.luckyresearch.org",
42
+ "https://walrus-aggregator.thcloud.dev",
43
+ "https://walrusagg.testnet.pops.one",
44
+ ],
45
+ mainnet: [
46
+ "https://aggregator.walrus-mainnet.walrus.space",
47
+ "https://sui-walrus-mainnet-aggregator.bwarelabs.com",
48
+ "https://suiftly.mhax.io",
49
+ "https://mainnet-walrus-aggregator.kiliglab.io",
50
+ "https://aggregator.mainnet.walrus.mirai.cloud",
51
+ "https://walrus-aggregator.stakely.io",
52
+ "https://walrus-aggregator.thepassivetrust.com",
53
+ "https://walrus-main-aggregator.4everland.org",
54
+ "https://walrus-aggregator.natsai.xyz",
55
+ "https://aggregator.walrus.silentvalidator.com",
56
+ "https://aggregator.suicore.com",
57
+ "https://walrus-mainnet-aggregator.stakingdefenseleague.com",
58
+ "https://aggregator.walrus-mainnet.h2o-nodes.com",
59
+ "https://walrus-aggregator.chainbase.online",
60
+ "https://walmain.agg.chainflow.io",
61
+ "https://walrus-aggregator.n1stake.com",
62
+ "https://walrus-aggregator.starduststaking.com",
63
+ "https://walrus-aggregator-mainnet.chainode.tech:9002",
64
+ "https://mainnet-aggregator.walrus.graphyte.dev",
65
+ "https://aggregator.walrus-mainnet.tududes.com",
66
+ "https://walrus-aggregator.talentum.id",
67
+ "https://walrus-aggregator.staking4all.org",
68
+ "https://walrus-mainnet-aggregator.nami.cloud",
69
+ "https://walrus-mainnet-aggregator.dzdaic.com",
70
+ "https://walrus.prostaking.com:9443",
71
+ "https://walrus-mainnet-aggregator-1.zkv.xyz",
72
+ "https://walrus-mainnet-aggregator.stakecraft.com",
73
+ "https://walrus-mainnet-aggregator.imperator.co",
74
+ "https://walrus-mainnet-aggregator.crouton.digital",
75
+ "https://walrus-mainnet-aggregator.nodeinfra.com",
76
+ "https://walrus.aggregator.stakepool.dev.br",
77
+ "https://walrus-mainnet-aggregator.redundex.com",
78
+ "https://walrus-agg.mainnet.obelisk.sh",
79
+ "https://walrus.blockscope.net",
80
+ "https://walrus.globalstake.io",
81
+ "https://walrus-mainnet-aggregator.trusted-point.com",
82
+ "https://walrus.veera.com",
83
+ "https://walrus-mainnet-aggregator.rpc101.org",
84
+ "https://walrusagg.pops.one",
85
+ ],
86
+ };
87
+ /** The live Walrus committee's storage nodes a https page can call — the last road for uploads and downloads. */
88
+ export const STORAGE_NODE_ORIGINS = {
89
+ testnet: [
90
+ "https://walrus-01.tududes.com:9185",
91
+ "https://walrus-node.thcloud.dev:9185",
92
+ "https://lhr-tnt-sto-00.walrus-testnet.walrus.space:9185",
93
+ "https://walrus-testnet-storage.talentum.id:9185",
94
+ "https://testnet.walrus.node.interestlabs.io:9185",
95
+ "https://storage.testnet.walrus.mirai.cloud:9185",
96
+ "https://waltest.chainflow.io:9185",
97
+ "https://walrus-testnet.n1stake.com:9185",
98
+ "https://testnet-walrus.rockfin.io:9185",
99
+ "https://suiftly-testnet-node.mhax.io:9185",
100
+ "https://walrus-testnet-operator1.lithiumdigital.com:9185",
101
+ "https://chartreuse-ljubljana-3b884.walrus.bdnodes.net:9002",
102
+ "https://wal-t01.solsticestaking.net:9185",
103
+ "https://walrus-testnet.luckyresearch.org:9185",
104
+ "https://walrus-testnet-validator-md002.blockpi.me:9185",
105
+ "https://storage.testnet.sui.rpcpool.com:9185",
106
+ "https://walrus-testnet-storage-node-1.zkv.xyz:9285",
107
+ "https://walrus-node-testnet.haedal.xyz:9185",
108
+ "https://walrus01.validator.karrier.one:9185",
109
+ "https://walrus-testnet.imperator.co:9185",
110
+ "https://sn01.walrus.testnet.republiccrypto-runtime.com:9185",
111
+ "https://walrus-testnet.contributiondao.com:9185",
112
+ "https://walrus-storage-testnet.hashedpotatoes-sui.com:9185",
113
+ "https://walrus-storage-testnet.overclock.run:9185",
114
+ "https://ewr-tnt-sto-00.walrus-testnet.walrus.space:9185",
115
+ "https://walrus-testnet-storage.stakeme.pro:9185",
116
+ "https://walrus-testnet.citadel.one:9195",
117
+ "https://walrus-testnet-storage.stakecraft.com:9185",
118
+ "https://walrus-testnet.brightlystake.com:9185",
119
+ "https://walrus-node-testnet.cetus.zone:9185",
120
+ "https://walrus-testnet.h2o-nodes.com:9185",
121
+ "https://suilend-walrus-testnet.hanabi.so:9185",
122
+ "https://walrus-testnet.typus.finance:9185",
123
+ "https://storage.walrus.testnet.nodz.io:9185",
124
+ "https://dev-walrus.vol-047f616210f55794d.dev.stake.capital:9185",
125
+ "https://walrus-testnet.rpc101.org:9185",
126
+ "https://walrus-testnet-node.nami.cloud:9185",
127
+ "https://testnet-walrus.hoh.zone:9185",
128
+ "https://walrus-testnet-storage.stakin-nodes.com:9185",
129
+ "https://walrus-testnet-node.stakeengine.co.uk:9185",
130
+ "https://walrus-testnet.thepassivetrust.com:9185",
131
+ "https://testnet.walrus.piconbello.com:9185",
132
+ "https://walrus-testnet.senseinode.com:9185",
133
+ "https://walrus-testnet-storage.nodeinfra.com:9185",
134
+ "https://walrus-storage-testnet.scallop.io:9185",
135
+ "https://walrus-testnet.starduststaking.com:9185",
136
+ "https://walrus-testnet-node.stakely.io:9185",
137
+ "https://walrus1.dcentnetworks.nl:9185",
138
+ "https://walrus-test.astrostakers.com:9185",
139
+ "https://walrus-testnet.cosmostation.io:9185",
140
+ "https://walrus-testnet.redundex.com:9185",
141
+ "https://testnet-storage-walrus.kiliglab.io:9185",
142
+ "https://storage-node-walrus-1.test.piertwo.io.:9185",
143
+ "https://walrus-tn.juicystake.io:9185",
144
+ "https://walrus-testnet.crouton.digital:9185",
145
+ "https://walrus-testnet.lgns.xyz:9185",
146
+ "https://walrus-testnet.blockscope.net:9185",
147
+ "https://testnet.stakepool.dev.br:9185",
148
+ "https://walrus.nonprod.scw.chirpwireless.io:9185",
149
+ "https://testnet.storage.walrus.silentvalidator.com:9185",
150
+ "https://walrus-testnet.nodes.guru:9185",
151
+ "https://walrus-testnet.4pillars.info:9185",
152
+ "https://walrus-testnet-node.chainbase.online:9185",
153
+ "https://walrus.testnet.pops.one:9185",
154
+ "https://wal-storage-node-testnet.staketab.org:9185",
155
+ "https://walrus-storage-testnet.latitude-sui.com:9185",
156
+ "https://walrus-testnet.delightlabs.sh:9185",
157
+ "https://testnet-storage.walrus.graphyte.dev:9185",
158
+ "https://walrus-testnet.staking4all.org:9185",
159
+ "https://walrus-testnet-storage-node.rubynodes.io:9185",
160
+ "https://walrus-testnet-storage.trusted-point.com:9185",
161
+ "https://walrus-testnet.ntt-dg.com:9185",
162
+ "https://walrus.testnet.obelisk.sh:9185",
163
+ "https://walrus-storage.testnet.nelrann.org:9185",
164
+ "https://test-storage-node-walrus.inf-node.xyz:9185",
165
+ "https://sui-walrus-testnet.bwarelabs.com:9185",
166
+ "https://walrus-testnet.bucketprotocol.io:9185",
167
+ "https://storage.walrus.banansen.dev:9185",
168
+ "https://walrus-testnet-node.natsai.xyz:9185",
169
+ "https://testnet-walrus-storage.szns.solutions:9185",
170
+ "https://walrus-testnet.stakingdefenseleague.com:9185",
171
+ "https://walrus-testnet.auranode.xyz:9185",
172
+ "https://walrus-testnet.dzdaic.com:9185",
173
+ "https://testnet-walrus.globalstake.io:9185",
174
+ "https://eyl1-testnet.walrus.zeroservices.eu:9185",
175
+ "https://mia-tnt-sto-00.walrus-testnet.walrus.space:9185",
176
+ "https://uc1-tnt-sto-00.walrus-testnet.walrus.space:9185",
177
+ "https://walrus-testnet.proofgp.com:30000",
178
+ "https://walrus-testnet.sentio.xyz:9185",
179
+ "https://walrus-testnet.veera.com:9185",
180
+ "https://walrus-testnet.aftermath.finance:9185",
181
+ "https://walrus-testnet.suicore.com:9185",
182
+ "https://testnet-walrus01.tradeport.xyz:9185",
183
+ "https://walrus-testnet.cosmicvalidator.com:9185",
184
+ "https://walrus-storage.4everland.org:9185",
185
+ "https://walrus-testnet.chainode.tech:9185",
186
+ "https://walrus-testnet.equinoxdao.xyz:9185",
187
+ ],
188
+ mainnet: [
189
+ "https://walrus.blockscope.net:9185",
190
+ "https://walrus-mainnet.stakingdefenseleague.com:9185",
191
+ "https://walrus-mainnet-storage.stakeme.pro:9185",
192
+ "https://walmain.chainflow.io:9185",
193
+ "https://sn01.walrus.mainnet.republiccrypto-runtime.com:9185",
194
+ "https://storage-001.walrus.rockfinlabs.com:9185",
195
+ "https://walrus.suicore.com:9185",
196
+ "https://walrus-storage-node.rubynodes.io:9185",
197
+ "https://walrus-mainnet.aftermath.finance:9185",
198
+ "https://walrus.nodes.guru:9185",
199
+ "https://wal-storage-node-mainnet.staketab.org:9185",
200
+ "https://walrus.delightlabs.sh:9185",
201
+ "https://walrus.typus.finance:9185",
202
+ "https://walrus-main.astrostakers.com:9185",
203
+ "https://walrus-validator-md001.blockpi.me:9185",
204
+ "https://walrus.staking4all.org:9185",
205
+ "https://walrus-mainnet-operator1.lithiumdigital.com:9185",
206
+ "https://walrus-node-mainnet.ankr.com:9185",
207
+ "https://walrus-mainnet.tududes.com:9185",
208
+ "https://walrus01.validator.karrier.one:9185",
209
+ "https://suiftly-node.mhax.io:9185",
210
+ "https://storage.mainnet.sui.rpcpool.com:9185",
211
+ "https://walrus.brightlystake.com:9185",
212
+ "https://walrus-node.natsai.xyz:9185",
213
+ "https://walrus-mainnet.h2o-nodes.com:9185",
214
+ "https://walrus-node.stakely.io:9185",
215
+ "https://walrus.sentio.xyz:9185",
216
+ "https://walrus.globalstake.io:9185",
217
+ "https://walrus-mainnet-node.piertwo.io:9185",
218
+ "https://eyl1.walrus.zeroservices.eu:9185",
219
+ "https://walrus.vol-0e0c175f9734fdf77.prod.stake.capital:9185",
220
+ "https://walrus-mainnet.dzdaic.com:9185",
221
+ "https://walrus-mainnet.4pillars.info:9185",
222
+ "https://walrus-main.dcentnetworks.nl:9185",
223
+ "https://storage.walrus.mainnet.nodz.io:9185",
224
+ "https://walrus-storage.n1stake.com:9185",
225
+ "https://walrus.stakin-nodes.com:9185",
226
+ "https://walrus-main.bucketprotocol.io:9185",
227
+ "https://walrus.chainbase.online:9185",
228
+ "https://walrus-mainnet.luckyresearch.org:9185",
229
+ "https://walrus.piconbello.com:9185",
230
+ "https://walrus.prostaking.com:9185",
231
+ "https://walrus-mainnet-storage-node-1.zkv.xyz:9185",
232
+ "https://walrus.starduststaking.com:9185",
233
+ "https://walrus.thepassivetrust.com:9185",
234
+ "https://storage.walrus.nansen.ai:9185",
235
+ "https://walrus-mainnet.senseinode.com:9185",
236
+ "https://walrus-mainnet-storage.nodeinfra.com:9185",
237
+ "https://walrus-mainnet.citadel.one:9185",
238
+ "https://walrus-mainnet.redundex.com:9185",
239
+ "https://walrus.contributiondao.com:9185",
240
+ "https://walrus.mainnet.obelisk.sh:9185",
241
+ "https://wal-m01.solsticestaking.net:9185",
242
+ "https://ash-mnt-sto-01.walrus-mainnet.walrus.space:9185",
243
+ "https://walrus-mainnet.crouton.digital:9185",
244
+ "https://walrus-mainnet.imperator.co:9185",
245
+ "https://main-storage-node-walrus.inf-node.xyz:9185",
246
+ "https://walrus-storage.ntt.nodeops.ninja:9185",
247
+ "https://walrus-storage-mainnet.scallop.io:9185",
248
+ "https://walrus-mainnet.proofgp.com:31000",
249
+ "https://mainnet-walrus-storage.szns.solutions:9185",
250
+ "https://walrus-mainnet-node.stakeengine.co.uk:9185",
251
+ "https://walrus-mainnet.chainode.tech:9185",
252
+ "https://walrus-main-storage.4everland.org:9185",
253
+ "https://walrus.stakepool.dev.br:9185",
254
+ "https://walrus-node-mainnet.cetus.zone:9185",
255
+ "https://mainnet-storage.walrus.graphyte.dev:9185",
256
+ "https://walrus-mainnet-storage.stakecraft.com:9185",
257
+ "https://walrus-node-mainnet.haedal.xyz:9185",
258
+ "https://walrus-storage-mainnet.hashedpotatoes-sui.com:9185",
259
+ "https://storage.mainnet.walrus.mirai.cloud:9185",
260
+ "https://walrus-mainnet.rpc101.org:9185",
261
+ "https://walrus.pops.one:9185",
262
+ "https://sui-walrus-mainnet.bwarelabs.com:9185",
263
+ "https://walrus.prod.scw.chirpwireless.io:9185",
264
+ "https://walrus.auranode.xyz:9185",
265
+ "https://walrus-node.thcloud.ai:9185",
266
+ "https://walrus.equinoxdao.xyz:9185",
267
+ "https://walrus-storage-mainnet.overclock.run:9185",
268
+ "https://walrus-storage.talentum.id:9185",
269
+ "https://walrus.veera.com:9185",
270
+ "https://walrus-mainnet.cosmicvalidator.com:9185",
271
+ "https://walrus-storage-mainnet.latitude-sui.com:9195",
272
+ "https://walrus01.tradeport.xyz:9185",
273
+ "https://walrus.node.interestlabs.io:9185",
274
+ "https://suilend-walrus-mainnet.hanabi.so:9185",
275
+ "https://walrus-store.lgns.net:9185",
276
+ "https://storage.walrus.silentvalidator.com:9185",
277
+ "https://walrus-mainnet-storage.trusted-point.com:9185",
278
+ "https://mainnet-walrus.hoh.zone:9185",
279
+ "https://ash-mnt-sto-00.walrus-mainnet.walrus.space:9185",
280
+ "https://mainnet-walrus-storage.kiliglab.io:9185",
281
+ "https://walrus-storage.nelrann.org:9185",
282
+ "https://walrus-mainnet-node.nami.cloud:9185",
283
+ ],
284
+ };
@@ -0,0 +1,16 @@
1
+ /** Shards on the Walrus networks NMTS uses (mainnet and testnet both, measured 2026-09-03). */
2
+ export declare const N_SHARDS = 1000;
3
+ /** `encodedBlobLength` as the SDK computes it for RS2 encoding. */
4
+ export declare function encodedBlobLength(unencodedLength: number, nShards?: number): number;
5
+ export interface WalletStorageEstimate {
6
+ /** Raw bytes of the files in the batch. */
7
+ rawBytes: number;
8
+ /** What an empty blob already costs — the part every batch carries whatever is in it. */
9
+ fixedBytes: number;
10
+ /** Bytes the batch buys in total, coding and fixed part included. */
11
+ boughtBytes: number;
12
+ /** How much of what is bought is the fixed part — near 1 for one small file. */
13
+ fixedShare: number;
14
+ }
15
+ /** What one batch (one blob) buys for `rawBytes` of files. */
16
+ export declare function estimateWalletStorage(rawBytes: number): WalletStorageEstimate;
@@ -0,0 +1,44 @@
1
+ // What a small-file batch actually BUYS on the storage network when the person's own wallet pays
2
+ // for it: a file uploaded alone pays the fixed part of a blob by itself.
3
+ //
4
+ // THE PHYSICS, FROM THE SDK'S OWN ARITHMETIC. `@mysten/walrus` computes a blob's encoded length as
5
+ // metadata (n_shards × (n_shards × 32 × 2 + 32)) plus the slivers (RS2: (primary + secondary
6
+ // symbols) × symbol size × n_shards), and that function is not exported from the package index, so
7
+ // the same arithmetic is written here and pinned by test to the SDK's numbers at 1,000 shards:
8
+ // 0 B → 66,034,000 · 500 KiB → 68,036,000 · 1 MiB → 70,038,000 · 1 GiB → 4,888,852,000.
9
+ // So an empty blob already costs 63.0 MiB, a 500 KiB file alone 64.9 MiB, and 400 such files in
10
+ // one batch about 2.3 MiB each. The batch on the pending panel is ONE blob (a quilt), so the fixed
11
+ // part is paid once per press of the upload button, however many files are in it.
12
+ //
13
+ // ⛔ WALLET RAIL ONLY. On the credit rail the person pays for encrypted bytes at 1 credit per
14
+ // MiB·28 days and the treasury carries the coding and the fixed part, so this number
15
+ // would be false there. The panel shows this line only when the wallet is the chosen purse.
16
+ //
17
+ // ⚠ AN ESTIMATE, NOT THE QUOTE. The signed quote at register time is the price; this is the same
18
+ // arithmetic ahead of it so the person can change their mind before pressing. Both networks run
19
+ // 1,000 shards today; the count is a parameter so a move shows up as one number, not a rewrite.
20
+ const DIGEST_LEN = 32;
21
+ const BLOB_ID_LEN = 32;
22
+ /** Shards on the Walrus networks NMTS uses (mainnet and testnet both, measured 2026-09-03). */
23
+ export const N_SHARDS = 1_000;
24
+ /** `encodedBlobLength` as the SDK computes it for RS2 encoding. */
25
+ export function encodedBlobLength(unencodedLength, nShards = N_SHARDS) {
26
+ if (!Number.isFinite(unencodedLength) || unencodedLength < 0) {
27
+ throw new RangeError(`unencodedLength must be a non-negative finite number, got ${String(unencodedLength)}`);
28
+ }
29
+ const maxFaulty = Math.floor((nShards - 1) / 3);
30
+ const minCorrect = nShards - maxFaulty;
31
+ const primary = minCorrect - maxFaulty;
32
+ const secondary = minCorrect;
33
+ let symbolSize = Math.floor((Math.max(unencodedLength, 1) - 1) / (primary * secondary)) + 1;
34
+ if (symbolSize % 2 === 1)
35
+ symbolSize += 1;
36
+ const slivers = (primary + secondary) * symbolSize * nShards;
37
+ return nShards * (nShards * DIGEST_LEN * 2 + BLOB_ID_LEN) + slivers;
38
+ }
39
+ /** What one batch (one blob) buys for `rawBytes` of files. */
40
+ export function estimateWalletStorage(rawBytes) {
41
+ const fixedBytes = encodedBlobLength(0);
42
+ const boughtBytes = encodedBlobLength(rawBytes);
43
+ return { rawBytes, fixedBytes, boughtBytes, fixedShare: fixedBytes / boughtBytes };
44
+ }
@@ -8,9 +8,14 @@ import type { DeeperHistory } from "./address-history.ts";
8
8
  * failure there left every wallet's older history unread. 01NODE Funding SRL (Bucharest, Romania,
9
9
  * its own network) runs a public mainnet GraphQL at `sui.01.ro`; measured that day from this machine:
10
10
  * the same query and the same rows as Mysten's (the treasury's oldest transaction, 2026-08-02),
11
- * checkpoints back to 2023, `access-control-allow-origin: *`, 1.3 s. Triton One's `rpcpool` answered
12
- * too; it is not used because its company is not one the Privacy Policy names. Testnet keeps one
11
+ * checkpoints back to 2023, `access-control-allow-origin: *`, 1.3 s. Testnet keeps one
13
12
  * operator: development has no second public GraphQL and no one's activity depends on it.
13
+ * ⭐ NO THIRD (2026-11-10, D51). Triton One Limited's `mainnet.sui.rpcpool.com/graphql` answered this
14
+ * file's exact query from real Chromium on an `https://nmts.me` page, with CORS and the same first
15
+ * rows, but Triton's documentation calls that endpoint "for development and evaluation only, not
16
+ * production traffic" and strictly rate limited: the day Mysten and 01NODE fail it would carry
17
+ * every wallet and refuse them. Suiscan, SuiVision, PublicNode, Ankr, Tatum, Pocket, BlockPI and
18
+ * Nodeinfra did not answer it (no service, no CORS, 403, an error body, 500, 404, nothing in 15 s).
14
19
  * Still the second tier and never the only one: when every service fails the answer is
15
20
  * `complete: false`, never "nothing there".
16
21
  */
@@ -15,9 +15,14 @@ import { GrpcTypes, parseGrpcTransactionResponse } from "@mysten/sui/grpc";
15
15
  * failure there left every wallet's older history unread. 01NODE Funding SRL (Bucharest, Romania,
16
16
  * its own network) runs a public mainnet GraphQL at `sui.01.ro`; measured that day from this machine:
17
17
  * the same query and the same rows as Mysten's (the treasury's oldest transaction, 2026-08-02),
18
- * checkpoints back to 2023, `access-control-allow-origin: *`, 1.3 s. Triton One's `rpcpool` answered
19
- * too; it is not used because its company is not one the Privacy Policy names. Testnet keeps one
18
+ * checkpoints back to 2023, `access-control-allow-origin: *`, 1.3 s. Testnet keeps one
20
19
  * operator: development has no second public GraphQL and no one's activity depends on it.
20
+ * ⭐ NO THIRD (2026-11-10, D51). Triton One Limited's `mainnet.sui.rpcpool.com/graphql` answered this
21
+ * file's exact query from real Chromium on an `https://nmts.me` page, with CORS and the same first
22
+ * rows, but Triton's documentation calls that endpoint "for development and evaluation only, not
23
+ * production traffic" and strictly rate limited: the day Mysten and 01NODE fail it would carry
24
+ * every wallet and refuse them. Suiscan, SuiVision, PublicNode, Ankr, Tatum, Pocket, BlockPI and
25
+ * Nodeinfra did not answer it (no service, no CORS, 403, an error body, 500, 404, nothing in 15 s).
21
26
  * Still the second tier and never the only one: when every service fails the answer is
22
27
  * `complete: false`, never "nothing there".
23
28
  */
@@ -0,0 +1,24 @@
1
+ import type { RelayTip } from "./tip-config.ts";
2
+ /** Mysten Labs' relay tip per KiB of encoded size, MIST (base 0). ⚠ MUST match `chain/src/limits.ts::REFERENCE_TIP_PER_KIB_MIST`. */
3
+ export declare const REFERENCE_TIP_PER_KIB_MIST = 40;
4
+ /** How many times Mysten's formula a credit upload may tip. ⚠ MUST match `chain/src/limits.ts::CREDIT_TIP_RATIO`. */
5
+ export declare const CREDIT_TIP_RATIO = 3;
6
+ /** The largest blob the credit rail registers: 2,048 credits of 1 MiB (`chain/src/limits.ts` says why). */
7
+ export declare const LARGEST_CREDIT_BLOB_BYTES: number;
8
+ /** A relay's tip as a line: `baseMist + mulPerKibMist × encoded KiB` (a constant tip has no slope). */
9
+ export interface TipLine {
10
+ baseMist: bigint;
11
+ mulPerKibMist: bigint;
12
+ }
13
+ /** What Mysten's formula charges for a blob of `blobBytes` unencoded bytes, MIST. */
14
+ export declare function referenceTipMist(blobBytes: number): bigint;
15
+ /** True when this tip for a blob of `blobBytes` is one the treasury pays. */
16
+ export declare function creditTipFits(tip: TipLine, blobBytes: number): boolean;
17
+ /**
18
+ * True when the tip fits at every blob size the credit rail registers. Both tips are straight lines in
19
+ * the encoded size, so their ratio only rises or falls between the ends: checking the two ends is
20
+ * checking every size. For a caller that chooses its road before it knows the size.
21
+ */
22
+ export declare function creditTipFitsEverySize(tip: TipLine): boolean;
23
+ /** A tip as a line in the encoded size, or null when the relay's price could not be read. */
24
+ export declare function tipLine(tip: RelayTip): TipLine | null;
@@ -0,0 +1,61 @@
1
+ // Which company relay the treasury may tip on a credit upload (2026-11-10).
2
+ //
3
+ // WHY. Until this day a credit upload went through Mysten Labs' relay or, when it did not answer,
4
+ // straight to the storage nodes: the treasury tipped only Mysten. The owner asked for every company
5
+ // that answers on every road, so that a second closure still leaves a road, and Studio
6
+ // Mirai's relay now carries credit uploads too, after Mysten and before the storage nodes.
7
+ //
8
+ // ⛔ BUT ANOTHER COMPANY NAMES THE PRICE THE TREASURY PAYS. So a relay is a credit road only while its
9
+ // tip for THIS upload is at most `CREDIT_TIP_RATIO` times what Mysten's formula would charge for it;
10
+ // above that the upload goes on to the next road (the storage nodes, no tip). Mysten's formula is
11
+ // pinned, not read live: the relay is needed exactly when Mysten does not answer, and a reference
12
+ // that has to be fetched from the company that is down is no reference.
13
+ //
14
+ // MEASURED 2026-11-10, `GET /v1/tip-config` on mainnet:
15
+ // Mysten Labs {"linear":{"base":0,"encoded_size_mul_per_kib":40}}
16
+ // Studio Mirai {"linear":{"base":3000000,"encoded_size_mul_per_kib":60}}
17
+ // Every blob carries 66,034,000 encoded bytes even when empty (1,000 shards), so Mirai's tip is
18
+ // 2.7 times Mysten's for an empty blob and falls toward 1.5 times as the blob grows: it fits.
19
+ //
20
+ // ⚠ The chain service holds the same rule (`chain/src/limits.ts::referenceTipCeilingMist`) and refuses a
21
+ // tip above it with 403, so a relay the browser picks and the chain refuses is a repricing between
22
+ // the two reads, not a disagreement between two programs.
23
+ import { encodedBlobLength } from "../upload/wallet-storage-estimate.js";
24
+ /** Mysten Labs' relay tip per KiB of encoded size, MIST (base 0). ⚠ MUST match `chain/src/limits.ts::REFERENCE_TIP_PER_KIB_MIST`. */
25
+ export const REFERENCE_TIP_PER_KIB_MIST = 40;
26
+ /** How many times Mysten's formula a credit upload may tip. ⚠ MUST match `chain/src/limits.ts::CREDIT_TIP_RATIO`. */
27
+ export const CREDIT_TIP_RATIO = 3;
28
+ /** The largest blob the credit rail registers: 2,048 credits of 1 MiB (`chain/src/limits.ts` says why). */
29
+ export const LARGEST_CREDIT_BLOB_BYTES = 2 * 1024 * 1024 * 1024;
30
+ function encodedKib(blobBytes) {
31
+ return (BigInt(encodedBlobLength(blobBytes)) + 1023n) / 1024n;
32
+ }
33
+ /** What Mysten's formula charges for a blob of `blobBytes` unencoded bytes, MIST. */
34
+ export function referenceTipMist(blobBytes) {
35
+ return BigInt(REFERENCE_TIP_PER_KIB_MIST) * encodedKib(blobBytes);
36
+ }
37
+ /** True when this tip for a blob of `blobBytes` is one the treasury pays. */
38
+ export function creditTipFits(tip, blobBytes) {
39
+ return tip.baseMist + tip.mulPerKibMist * encodedKib(blobBytes) <= BigInt(CREDIT_TIP_RATIO) * referenceTipMist(blobBytes);
40
+ }
41
+ /**
42
+ * True when the tip fits at every blob size the credit rail registers. Both tips are straight lines in
43
+ * the encoded size, so their ratio only rises or falls between the ends: checking the two ends is
44
+ * checking every size. For a caller that chooses its road before it knows the size.
45
+ */
46
+ export function creditTipFitsEverySize(tip) {
47
+ return creditTipFits(tip, 0) && creditTipFits(tip, LARGEST_CREDIT_BLOB_BYTES);
48
+ }
49
+ /** A tip as a line in the encoded size, or null when the relay's price could not be read. */
50
+ export function tipLine(tip) {
51
+ switch (tip.kind) {
52
+ case "none":
53
+ return { baseMist: 0n, mulPerKibMist: 0n };
54
+ case "const":
55
+ return { baseMist: tip.baseMist, mulPerKibMist: 0n };
56
+ case "linear":
57
+ return { baseMist: tip.baseMist, mulPerKibMist: tip.mulPerKibMist };
58
+ case "unknown":
59
+ return null;
60
+ }
61
+ }
@@ -0,0 +1,18 @@
1
+ import { type WalrusClient } from "@mysten/walrus";
2
+ type CertArgs = Parameters<WalrusClient["certificateFromConfirmations"]>[0];
3
+ type Certificate = Awaited<ReturnType<WalrusClient["certificateFromConfirmations"]>>;
4
+ type SystemState = Awaited<ReturnType<WalrusClient["systemState"]>>;
5
+ type Member = SystemState["committee"]["members"][number];
6
+ /** The chain's quorum (`walrus::bls_aggregate::is_quorum`). */
7
+ export declare const chainQuorum: (weight: number, nShards: number) => boolean;
8
+ /** The message every confirming node signs for this blob in this epoch. */
9
+ export declare function confirmationMessage(epoch: number, blobId: string, deletable: boolean, blobObjectId: string): Uint8Array;
10
+ /**
11
+ * Combine the confirmations whose message and signature hold into a certificate, or throw when their
12
+ * shard weight is short of the chain's quorum. `members` is the BLS committee in signer-index order.
13
+ */
14
+ export declare function certificateByShardWeight(confirmations: CertArgs["confirmations"], members: readonly Pick<Member, "public_key" | "weight">[], nShards: number, expected: Uint8Array): Certificate;
15
+ type Certifier = Pick<WalrusClient, "certificateFromConfirmations" | "systemState">;
16
+ /** Replace the client's node-count certificate with the chain's shard-weight one. */
17
+ export declare function certifyByShardWeight<T extends Certifier>(walrus: T): T;
18
+ export {};
@@ -0,0 +1,77 @@
1
+ // The certificate from node confirmations, by the rule the chain applies (D51, 2026-11-10).
2
+ // ⛔ WHY NOT THE SDK'S. `WalrusClient.certificateFromConfirmations` (1.2.36) refuses unless more than two
3
+ // thirds of the committee's NODES confirmed. The chain counts no nodes: `bls_aggregate::
4
+ // verify_certificate_and_weight` sums the signers' weight (each member's shard count) and asserts
5
+ // `is_quorum`, `3 * weight >= 2 * n_shards + 1`. Members hold uneven shard counts (mainnet and testnet),
6
+ // so a node count waits for confirmations the chain does not need, and on testnet on 2026-11-10 it
7
+ // refused certificates the chain would have taken (63 of 97 nodes confirmed). The writes stop on the
8
+ // same shard rule (node-quorum.ts), so the stop and the certificate cannot disagree.
9
+ // ⛔ WHAT IS CHECKED. Each confirmation must carry the exact message the chain will rebuild (intent,
10
+ // epoch, blob id, persistence) and verify under its member's key; one aggregate check covers the honest
11
+ // case, and only when it fails is each signature checked alone to drop the bad ones.
12
+ import { bls12_381 } from "@noble/curves/bls12-381.js";
13
+ import { bcs } from "@mysten/sui/bcs";
14
+ import { fromBase64 } from "@mysten/sui/utils";
15
+ import { blobIdToInt, NotEnoughBlobConfirmationsError } from "@mysten/walrus";
16
+ /** The chain's quorum (`walrus::bls_aggregate::is_quorum`). */
17
+ export const chainQuorum = (weight, nShards) => 3 * weight >= 2 * nShards + 1;
18
+ const BLOB_CERT_MSG = 1;
19
+ const WALRUS_APP_ID = 3;
20
+ const StorageConfirmation = bcs.struct("ProtocolMessage<StorageConfirmationBody>", {
21
+ intent: bcs.struct("Intent", { type: bcs.u8(), version: bcs.u8(), appId: bcs.u8() }),
22
+ epoch: bcs.u32(),
23
+ messageContents: bcs.struct("StorageConfirmationBody", {
24
+ blobId: bcs.u256(),
25
+ blobType: bcs.enum("BlobPersistenceType", { Permanent: null, Deletable: bcs.struct("Deletable", { objectId: bcs.Address }) }),
26
+ }),
27
+ });
28
+ /** The message every confirming node signs for this blob in this epoch. */
29
+ export function confirmationMessage(epoch, blobId, deletable, blobObjectId) {
30
+ return StorageConfirmation.serialize({
31
+ intent: { type: BLOB_CERT_MSG, version: 0, appId: WALRUS_APP_ID },
32
+ epoch,
33
+ messageContents: {
34
+ blobId: blobIdToInt(blobId),
35
+ blobType: deletable ? { Deletable: { objectId: blobObjectId } } : { Permanent: null },
36
+ },
37
+ }).toBytes();
38
+ }
39
+ const sameBytes = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
40
+ /**
41
+ * Combine the confirmations whose message and signature hold into a certificate, or throw when their
42
+ * shard weight is short of the chain's quorum. `members` is the BLS committee in signer-index order.
43
+ */
44
+ export function certificateByShardWeight(confirmations, members, nShards, expected) {
45
+ const sigs = bls12_381.longSignatures;
46
+ const hashed = sigs.hash(expected);
47
+ const signed = confirmations.flatMap((confirmation, index) => {
48
+ const member = members[index];
49
+ if (!confirmation || !member || !sameBytes(fromBase64(confirmation.serializedMessage), expected))
50
+ return [];
51
+ return [{ index, weight: member.weight, key: new Uint8Array(member.public_key.bytes), signature: fromBase64(confirmation.signature) }];
52
+ });
53
+ const aggregateHolds = (set) => set.length > 0 &&
54
+ sigs.verify(sigs.aggregateSignatures(set.map((s) => s.signature)), hashed, sigs.aggregatePublicKeys(set.map((s) => s.key)));
55
+ const valid = aggregateHolds(signed) ? signed : signed.filter((s) => sigs.verify(s.signature, hashed, s.key));
56
+ const weight = valid.reduce((sum, s) => sum + s.weight, 0);
57
+ if (!chainQuorum(weight, nShards)) {
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
+ }
60
+ return {
61
+ signers: valid.map((s) => s.index),
62
+ serializedMessage: expected,
63
+ signature: sigs.Signature.toBytes(sigs.aggregateSignatures(valid.map((s) => s.signature))),
64
+ };
65
+ }
66
+ /** Replace the client's node-count certificate with the chain's shard-weight one. */
67
+ export function certifyByShardWeight(walrus) {
68
+ walrus.certificateFromConfirmations = async ({ confirmations, blobId, deletable, blobObjectId }) => {
69
+ const { committee } = await walrus.systemState();
70
+ if (confirmations.length !== committee.members.length) {
71
+ throw new NotEnoughBlobConfirmationsError("Invalid number of confirmations. Confirmations array must contain an entry for each node");
72
+ }
73
+ const expected = confirmationMessage(committee.epoch, blobId, deletable, blobObjectId);
74
+ return certificateByShardWeight(confirmations, committee.members, committee.n_shards, expected);
75
+ };
76
+ return walrus;
77
+ }
@@ -0,0 +1,17 @@
1
+ import type { WalrusClient } from "@mysten/walrus";
2
+ type WriteAll = WalrusClient["writeEncodedBlobToNodes"];
3
+ type Writer = Pick<WalrusClient, "writeEncodedBlobToNode" | "systemState"> & {
4
+ writeEncodedBlobToNodes: WriteAll;
5
+ };
6
+ export declare const QUORUM_GRACE_MIN_MS = 2000;
7
+ export declare const QUORUM_GRACE_MAX_MS = 20000;
8
+ export declare const STALL_FLOOR_MS = 90000;
9
+ export declare const RETRY_WAITS_MS: readonly number[];
10
+ export interface QuorumTiming {
11
+ now?: () => number;
12
+ stallFloorMs?: number;
13
+ retryWaitsMs?: readonly number[];
14
+ }
15
+ /** Replace the client's all-nodes wait with quorum-then-grace. Returns the same client. */
16
+ export declare function stopAtQuorum<T extends Writer>(walrus: T, timing?: QuorumTiming): T;
17
+ export {};