@needmoretruth/nmts-cli 0.17.2 → 0.34.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.
Files changed (419) hide show
  1. package/AGENTS.md +124 -516
  2. package/CHANGELOG.md +98 -0
  3. package/README.ko.md +374 -467
  4. package/README.md +384 -465
  5. package/dist/account-proof.d.ts +29 -0
  6. package/dist/account-proof.js +6 -6
  7. package/dist/account.d.ts +18 -0
  8. package/dist/account.js +5 -5
  9. package/dist/agent-host.d.ts +71 -0
  10. package/dist/agent-host.js +169 -0
  11. package/dist/api-advice.d.ts +2 -0
  12. package/dist/api-advice.js +210 -0
  13. package/dist/api-key.d.ts +79 -0
  14. package/dist/api-key.js +7 -7
  15. package/dist/api-refusal.d.ts +14 -0
  16. package/dist/api-refusal.js +8 -0
  17. package/dist/api.d.ts +114 -0
  18. package/dist/api.js +59 -162
  19. package/dist/args.d.ts +160 -0
  20. package/dist/args.js +118 -30
  21. package/dist/artifact-about.d.ts +49 -0
  22. package/dist/autonomy.d.ts +39 -0
  23. package/dist/autonomy.js +110 -32
  24. package/dist/code-access.d.ts +29 -0
  25. package/dist/code-access.js +3 -3
  26. package/dist/code-vault.d.ts +38 -0
  27. package/dist/code-vault.js +8 -8
  28. package/dist/collision.d.ts +67 -0
  29. package/dist/collision.js +1 -1
  30. package/dist/commands/accept-terms.d.ts +11 -0
  31. package/dist/commands/accept-terms.js +106 -0
  32. package/dist/commands/balance.d.ts +7 -0
  33. package/dist/commands/balance.js +54 -1
  34. package/dist/commands/create-code-file.d.ts +24 -0
  35. package/dist/commands/create-code-file.js +93 -0
  36. package/dist/commands/create-link.d.ts +10 -0
  37. package/dist/commands/create-link.js +232 -0
  38. package/dist/commands/create.d.ts +20 -0
  39. package/dist/commands/create.js +43 -102
  40. package/dist/commands/credits.d.ts +9 -0
  41. package/dist/commands/credits.js +110 -0
  42. package/dist/commands/delete-account.d.ts +11 -0
  43. package/dist/commands/delete-account.js +63 -0
  44. package/dist/commands/deposit.d.ts +7 -0
  45. package/dist/commands/deposit.js +85 -0
  46. package/dist/commands/devices.d.ts +12 -0
  47. package/dist/commands/devices.js +144 -0
  48. package/dist/commands/documents.d.ts +35 -0
  49. package/dist/commands/documents.js +212 -0
  50. package/dist/commands/env.d.ts +5 -0
  51. package/dist/commands/env.js +10 -2
  52. package/dist/commands/erase.d.ts +13 -0
  53. package/dist/commands/erase.js +193 -0
  54. package/dist/commands/expiring.d.ts +19 -0
  55. package/dist/commands/extend.d.ts +33 -0
  56. package/dist/commands/extend.js +54 -15
  57. package/dist/commands/get.d.ts +18 -0
  58. package/dist/commands/key-manage.d.ts +11 -0
  59. package/dist/commands/key-manage.js +162 -0
  60. package/dist/commands/key.d.ts +28 -0
  61. package/dist/commands/key.js +249 -0
  62. package/dist/commands/kit.d.ts +11 -0
  63. package/dist/commands/kit.js +7 -7
  64. package/dist/commands/listfile.d.ts +13 -0
  65. package/dist/commands/listfile.js +12 -5
  66. package/dist/commands/login.d.ts +18 -0
  67. package/dist/commands/login.js +19 -19
  68. package/dist/commands/logout.d.ts +1 -0
  69. package/dist/commands/logout.js +1 -1
  70. package/dist/commands/losses.d.ts +12 -0
  71. package/dist/commands/losses.js +180 -0
  72. package/dist/commands/ls.d.ts +23 -0
  73. package/dist/commands/marks-dispatch.d.ts +2 -0
  74. package/dist/commands/marks-dispatch.js +51 -0
  75. package/dist/commands/marks.d.ts +46 -0
  76. package/dist/commands/marks.js +80 -0
  77. package/dist/commands/mcp.d.ts +24 -0
  78. package/dist/commands/mcp.js +70 -5
  79. package/dist/commands/mode.d.ts +8 -0
  80. package/dist/commands/mode.js +60 -24
  81. package/dist/commands/on-collision.d.ts +6 -0
  82. package/dist/commands/organise.d.ts +46 -0
  83. package/dist/commands/padding.d.ts +7 -0
  84. package/dist/commands/padding.js +114 -0
  85. package/dist/commands/public-code.d.ts +9 -0
  86. package/dist/commands/public-code.js +8 -8
  87. package/dist/commands/pull.d.ts +27 -0
  88. package/dist/commands/push-wallet.d.ts +19 -0
  89. package/dist/commands/push-wallet.js +69 -0
  90. package/dist/commands/push.d.ts +47 -0
  91. package/dist/commands/push.js +37 -7
  92. package/dist/commands/put-wallet.d.ts +77 -0
  93. package/dist/commands/put-wallet.js +316 -0
  94. package/dist/commands/put.d.ts +56 -0
  95. package/dist/commands/put.js +53 -6
  96. package/dist/commands/rebuild.d.ts +18 -0
  97. package/dist/commands/rebuild.js +108 -10
  98. package/dist/commands/receive.d.ts +24 -0
  99. package/dist/commands/recovery-dispatch.d.ts +2 -0
  100. package/dist/commands/recovery-dispatch.js +34 -0
  101. package/dist/commands/recovery-list.d.ts +11 -0
  102. package/dist/commands/recovery-list.js +6 -6
  103. package/dist/commands/recovery.d.ts +25 -0
  104. package/dist/commands/recovery.js +2 -2
  105. package/dist/commands/rollback.d.ts +9 -0
  106. package/dist/commands/rollback.js +118 -0
  107. package/dist/commands/s3.d.ts +23 -0
  108. package/dist/commands/s3.js +6 -6
  109. package/dist/commands/settings.d.ts +5 -0
  110. package/dist/commands/settings.js +21 -6
  111. package/dist/commands/share-dispatch.d.ts +2 -0
  112. package/dist/commands/share-dispatch.js +46 -0
  113. package/dist/commands/share.d.ts +14 -0
  114. package/dist/commands/share.js +13 -3
  115. package/dist/commands/shares-sent.d.ts +18 -0
  116. package/dist/commands/shares-sent.js +95 -0
  117. package/dist/commands/support.d.ts +24 -0
  118. package/dist/commands/support.js +321 -0
  119. package/dist/commands/sweep.d.ts +11 -0
  120. package/dist/commands/tip.d.ts +11 -0
  121. package/dist/commands/tip.js +86 -0
  122. package/dist/commands/trash.d.ts +17 -0
  123. package/dist/commands/trash.js +1 -1
  124. package/dist/commands/trial.d.ts +7 -0
  125. package/dist/commands/trial.js +16 -18
  126. package/dist/commands/unlock.d.ts +16 -0
  127. package/dist/commands/unlock.js +159 -0
  128. package/dist/commands/update.d.ts +42 -0
  129. package/dist/commands/update.js +1 -1
  130. package/dist/commands/usage.d.ts +8 -0
  131. package/dist/commands/verify.d.ts +18 -0
  132. package/dist/commands/verify.js +10 -6
  133. package/dist/commands/wallet-activity.d.ts +26 -0
  134. package/dist/commands/wallet-activity.js +117 -0
  135. package/dist/commands/wallet-donate.d.ts +26 -0
  136. package/dist/commands/wallet-donate.js +163 -0
  137. package/dist/commands/wallet-hall.d.ts +35 -0
  138. package/dist/commands/wallet-hall.js +214 -0
  139. package/dist/commands/wallet-send.d.ts +22 -0
  140. package/dist/commands/wallet-send.js +153 -0
  141. package/dist/commands/wallet-storage-ops.d.ts +24 -0
  142. package/dist/commands/wallet-storage-ops.js +215 -0
  143. package/dist/commands/wallet-storage.d.ts +18 -0
  144. package/dist/commands/wallet-storage.js +95 -0
  145. package/dist/commands/wallet-swap.d.ts +32 -0
  146. package/dist/commands/wallet-swap.js +287 -0
  147. package/dist/commands/wallet.d.ts +36 -0
  148. package/dist/commands/wallet.js +57 -15
  149. package/dist/commands/whoami.d.ts +10 -0
  150. package/dist/commands/whoami.js +24 -6
  151. package/dist/consent.d.ts +140 -0
  152. package/dist/consent.js +89 -30
  153. package/dist/credentials.d.ts +146 -0
  154. package/dist/credentials.js +10 -10
  155. package/dist/crypto-surface.d.ts +197 -0
  156. package/dist/crypto.d.ts +81 -0
  157. package/dist/crypto.js +13 -0
  158. package/dist/deposit.d.ts +25 -0
  159. package/dist/deposit.js +78 -0
  160. package/dist/download-part.d.ts +40 -0
  161. package/dist/download-sink.d.ts +76 -0
  162. package/dist/download.d.ts +79 -0
  163. package/dist/download.js +3 -3
  164. package/dist/drive-paths.d.ts +73 -0
  165. package/dist/environment.d.ts +62 -0
  166. package/dist/environment.js +29 -9
  167. package/dist/errors.d.ts +22 -0
  168. package/dist/errors.js +3 -3
  169. package/dist/exit.d.ts +44 -0
  170. package/dist/expiry.d.ts +58 -0
  171. package/dist/extend-budget.d.ts +35 -0
  172. package/dist/extend-budget.js +81 -0
  173. package/dist/extend-chain.d.ts +43 -0
  174. package/dist/extend-chain.js +40 -3
  175. package/dist/extend-plan.d.ts +148 -0
  176. package/dist/extend-plan.js +1 -1
  177. package/dist/gate.d.ts +18 -0
  178. package/dist/gate.js +100 -0
  179. package/dist/guards.d.ts +2 -0
  180. package/dist/help.d.ts +20 -0
  181. package/dist/help.js +199 -33
  182. package/dist/human-check.d.ts +23 -0
  183. package/dist/index.d.ts +42 -0
  184. package/dist/index.js +49 -0
  185. package/dist/item-trash.d.ts +1 -0
  186. package/dist/kit-file.d.ts +56 -0
  187. package/dist/kit-file.js +10 -10
  188. package/dist/list-file.d.ts +88 -0
  189. package/dist/list-file.js +90 -7
  190. package/dist/list-view-find.d.ts +15 -0
  191. package/dist/list-view-order.d.ts +32 -0
  192. package/dist/main.d.ts +12 -0
  193. package/dist/main.js +112 -113
  194. package/dist/manifest-chunk-cache.d.ts +14 -0
  195. package/dist/manifest-chunk-cache.js +103 -0
  196. package/dist/manifest-chunk-flow.d.ts +81 -0
  197. package/dist/manifest-chunk-flow.js +307 -0
  198. package/dist/manifest-create.d.ts +23 -0
  199. package/dist/manifest-create.js +26 -30
  200. package/dist/manifest-write.d.ts +161 -0
  201. package/dist/manifest-write.js +42 -33
  202. package/dist/manifest.d.ts +82 -0
  203. package/dist/manifest.js +69 -21
  204. package/dist/mark-render.d.ts +26 -0
  205. package/dist/mcp-args.d.ts +17 -0
  206. package/dist/mcp-ask.d.ts +43 -0
  207. package/dist/mcp-ask.js +100 -0
  208. package/dist/mcp-tools/context.d.ts +46 -0
  209. package/dist/mcp-tools/credits.d.ts +3 -0
  210. package/dist/mcp-tools/credits.js +61 -0
  211. package/dist/mcp-tools/files.d.ts +3 -0
  212. package/dist/mcp-tools/files.js +34 -0
  213. package/dist/mcp-tools/organise.d.ts +3 -0
  214. package/dist/mcp-tools/organise.js +82 -2
  215. package/dist/mcp-tools/reads.d.ts +3 -0
  216. package/dist/mcp-tools/reads.js +132 -4
  217. package/dist/mcp-tools/share.d.ts +3 -0
  218. package/dist/mcp-tools/share.js +26 -7
  219. package/dist/mcp-tools/support.d.ts +3 -0
  220. package/dist/mcp-tools/support.js +140 -0
  221. package/dist/mcp-tools/tiers.d.ts +31 -0
  222. package/dist/mcp-tools/tiers.js +147 -0
  223. package/dist/mcp.d.ts +80 -0
  224. package/dist/mcp.js +110 -9
  225. package/dist/net-retry.d.ts +38 -0
  226. package/dist/network.d.ts +10 -0
  227. package/dist/notice.d.ts +7 -0
  228. package/dist/notice.js +7 -7
  229. package/dist/product.d.ts +29 -0
  230. package/dist/product.js +1 -1
  231. package/dist/progress.d.ts +37 -0
  232. package/dist/prompt.d.ts +31 -0
  233. package/dist/prompt.js +1 -1
  234. package/dist/rebuild-key-check.d.ts +26 -0
  235. package/dist/rebuild-key-check.js +90 -0
  236. package/dist/rebuild.d.ts +87 -0
  237. package/dist/rebuild.js +26 -4
  238. package/dist/recovery-assemble.d.ts +40 -0
  239. package/dist/recovery-assemble.js +1 -1
  240. package/dist/recovery-build.d.ts +40 -0
  241. package/dist/recovery-map-file.d.ts +53 -0
  242. package/dist/recovery-map-file.js +4 -4
  243. package/dist/recovery-map.d.ts +197 -0
  244. package/dist/recovery-release.d.ts +104 -0
  245. package/dist/recovery-seq.d.ts +10 -0
  246. package/dist/recovery-source.d.ts +50 -0
  247. package/dist/redact.d.ts +70 -0
  248. package/dist/redact.js +212 -0
  249. package/dist/registration.d.ts +30 -0
  250. package/dist/registration.js +5 -5
  251. package/dist/risk.d.ts +380 -0
  252. package/dist/risk.js +206 -0
  253. package/dist/run-log.d.ts +78 -0
  254. package/dist/run-log.js +301 -0
  255. package/dist/s3/listing.d.ts +47 -0
  256. package/dist/s3/multipart.d.ts +21 -0
  257. package/dist/s3/response-sink.d.ts +8 -0
  258. package/dist/s3/same-file.d.ts +54 -0
  259. package/dist/s3/server.d.ts +58 -0
  260. package/dist/s3/server.js +2 -2
  261. package/dist/s3/sigv4.d.ts +46 -0
  262. package/dist/s3/sigv4.js +1 -1
  263. package/dist/s3/staging.d.ts +10 -0
  264. package/dist/s3/xml.d.ts +28 -0
  265. package/dist/safe-path.d.ts +41 -0
  266. package/dist/seal.d.ts +120 -0
  267. package/dist/secret-reader.d.ts +28 -0
  268. package/dist/server.d.ts +9 -0
  269. package/dist/session.d.ts +32 -0
  270. package/dist/session.js +1 -1
  271. package/dist/setup-questions.d.ts +7 -0
  272. package/dist/share.d.ts +108 -0
  273. package/dist/share.js +1 -1
  274. package/dist/shared/lib/crypto/size-padding.d.ts +55 -0
  275. package/dist/shared/lib/crypto/size-padding.js +5 -0
  276. package/dist/shared/lib/drive/manifest-chunks.d.ts +95 -0
  277. package/dist/shared/lib/drive/manifest-chunks.js +252 -0
  278. package/dist/shared/lib/drive/manifest-codec.d.ts +214 -0
  279. package/dist/shared/lib/drive/manifest-codec.js +7 -7
  280. package/dist/shared/lib/drive/manifest-index.d.ts +98 -0
  281. package/dist/shared/lib/drive/manifest-ops.d.ts +167 -0
  282. package/dist/shared/lib/drive/manifest-ops.js +9 -4
  283. package/dist/shared/lib/drive/manifest-pack.d.ts +65 -0
  284. package/dist/shared/lib/drive/manifest-pack.js +287 -0
  285. package/dist/shared/lib/drive/manifest-settings.d.ts +113 -0
  286. package/dist/shared/lib/drive/manifest-settings.js +87 -6
  287. package/dist/shared/lib/drive/name-conflict.d.ts +76 -0
  288. package/dist/shared/lib/drive/rebuild-verify.d.ts +73 -0
  289. package/dist/shared/lib/drive/rebuild-verify.js +112 -0
  290. package/dist/shared/lib/drive/unique-name.d.ts +9 -0
  291. package/dist/shared/lib/drive/zstd.d.ts +27 -0
  292. package/dist/shared/lib/drive/zstd.js +74 -0
  293. package/dist/shared/lib/extend/epochs.d.ts +205 -0
  294. package/dist/shared/lib/net/retry-budget.d.ts +79 -0
  295. package/dist/shared/lib/share/shared-file-info.d.ts +21 -0
  296. package/dist/shared/lib/storage-control/chain.d.ts +57 -0
  297. package/dist/shared/lib/storage-control/chain.js +82 -0
  298. package/dist/shared/lib/storage-control/plan.d.ts +40 -0
  299. package/dist/shared/lib/storage-control/plan.js +72 -0
  300. package/dist/shared/lib/storage-control/reuse.d.ts +72 -0
  301. package/dist/shared/lib/storage-control/reuse.js +95 -0
  302. package/dist/shared/lib/storage-network.d.ts +25 -0
  303. package/dist/shared/lib/upload/part-plan.d.ts +24 -0
  304. package/dist/shared/lib/wallet/activity.d.ts +138 -0
  305. package/dist/shared/lib/wallet/activity.js +208 -0
  306. package/dist/shared/lib/wallet/send-rules.d.ts +68 -0
  307. package/dist/shared/lib/wallet/send-rules.js +116 -0
  308. package/dist/shared/lib/wallet/swap-rules.d.ts +115 -0
  309. package/dist/shared/lib/wallet/swap-rules.js +199 -0
  310. package/dist/shared/lib/wallet/tip.d.ts +14 -0
  311. package/dist/shared/lib/wallet/tip.js +34 -0
  312. package/dist/shared/lib/wallet/venue-ids.d.ts +23 -0
  313. package/dist/shared/lib/wallet/venue-ids.js +53 -0
  314. package/dist/standing-tip.d.ts +24 -0
  315. package/dist/standing-tip.js +52 -0
  316. package/dist/stdout.d.ts +38 -0
  317. package/dist/storage-control-chain.d.ts +38 -0
  318. package/dist/storage-control-chain.js +78 -0
  319. package/dist/sui-rpc.d.ts +15 -0
  320. package/dist/sui-rpc.js +59 -0
  321. package/dist/support-attach.d.ts +24 -0
  322. package/dist/support-attach.js +72 -0
  323. package/dist/support-copy.d.ts +42 -0
  324. package/dist/support-copy.js +109 -0
  325. package/dist/support-wire.d.ts +49 -0
  326. package/dist/support-wire.js +194 -0
  327. package/dist/trash-sweep.d.ts +55 -0
  328. package/dist/units.d.ts +2 -0
  329. package/dist/update-check.d.ts +50 -0
  330. package/dist/update-source.d.ts +63 -0
  331. package/dist/upload-api.d.ts +3 -0
  332. package/dist/upload-file.d.ts +97 -0
  333. package/dist/upload-file.js +3 -2
  334. package/dist/upload-price.d.ts +50 -0
  335. package/dist/upload-steps.d.ts +26 -0
  336. package/dist/upload-steps.js +29 -9
  337. package/dist/upload-store.d.ts +182 -0
  338. package/dist/upload-wallet-chain.d.ts +54 -0
  339. package/dist/upload-wallet-chain.js +203 -0
  340. package/dist/upload-wallet-plan.d.ts +128 -0
  341. package/dist/upload-wallet-plan.js +184 -0
  342. package/dist/upload-wallet.d.ts +24 -0
  343. package/dist/upload-wallet.js +208 -0
  344. package/dist/upload-wire.d.ts +244 -0
  345. package/dist/upload.d.ts +18 -0
  346. package/dist/upload.js +10 -0
  347. package/dist/usage-report.d.ts +35 -0
  348. package/dist/wallet-activity-chain.d.ts +5 -0
  349. package/dist/wallet-activity-chain.js +31 -0
  350. package/dist/wallet-chain.d.ts +19 -0
  351. package/dist/wallet-chain.js +2 -2
  352. package/dist/wallet-grant.d.ts +50 -0
  353. package/dist/wallet-grant.js +218 -0
  354. package/dist/wallet-send-chain.d.ts +24 -0
  355. package/dist/wallet-send-chain.js +49 -0
  356. package/dist/wallet-sign.d.ts +133 -0
  357. package/dist/wallet-sign.js +317 -0
  358. package/dist/wallet-storage-chain.d.ts +3 -0
  359. package/dist/wallet-storage-chain.js +20 -0
  360. package/dist/wallet-swap-chain.d.ts +52 -0
  361. package/dist/wallet-swap-chain.js +186 -0
  362. package/dist/wallet-swap-quote.d.ts +22 -0
  363. package/dist/wallet-swap-quote.js +126 -0
  364. package/dist/wallet.d.ts +135 -0
  365. package/dist/wallet.js +5 -5
  366. package/dist/walrus-write.d.ts +56 -0
  367. package/dist/walrus-write.js +5 -4
  368. package/dist/walrus.d.ts +86 -0
  369. package/dist/walrus.js +48 -10
  370. package/dist/zstd-node.d.ts +11 -0
  371. package/dist/zstd-node.js +71 -0
  372. package/docs/commands/accept-terms.md +15 -0
  373. package/docs/commands/create.md +17 -0
  374. package/docs/commands/credits.md +34 -0
  375. package/docs/commands/delete-account.md +14 -0
  376. package/docs/commands/deposit.md +27 -0
  377. package/docs/commands/devices.md +9 -0
  378. package/docs/commands/documents.md +10 -0
  379. package/docs/commands/env.md +21 -0
  380. package/docs/commands/extend.md +27 -0
  381. package/docs/commands/folders.md +10 -0
  382. package/docs/commands/get.md +14 -0
  383. package/docs/commands/key.md +14 -0
  384. package/docs/commands/login.md +23 -0
  385. package/docs/commands/logout.md +11 -0
  386. package/docs/commands/losses.md +13 -0
  387. package/docs/commands/ls.md +16 -0
  388. package/docs/commands/marks.md +9 -0
  389. package/docs/commands/mcp.md +33 -0
  390. package/docs/commands/mode.md +29 -0
  391. package/docs/commands/on-collision.md +13 -0
  392. package/docs/commands/padding.md +13 -0
  393. package/docs/commands/public-code.md +9 -0
  394. package/docs/commands/pull.md +9 -0
  395. package/docs/commands/push.md +12 -0
  396. package/docs/commands/put.md +36 -0
  397. package/docs/commands/rebuild.md +13 -0
  398. package/docs/commands/recovery.md +18 -0
  399. package/docs/commands/s3.md +17 -0
  400. package/docs/commands/share.md +15 -0
  401. package/docs/commands/support.md +16 -0
  402. package/docs/commands/tip.md +21 -0
  403. package/docs/commands/trash.md +25 -0
  404. package/docs/commands/trial.md +12 -0
  405. package/docs/commands/unlock.md +25 -0
  406. package/docs/commands/update.md +14 -0
  407. package/docs/commands/usage.md +14 -0
  408. package/docs/commands/verify.md +18 -0
  409. package/docs/commands/wallet.md +67 -0
  410. package/docs/commands/whoami.md +12 -0
  411. package/package.json +67 -8
  412. package/server.json +28 -0
  413. package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +23 -2
  414. package/vendor/nmts-crypto/nmts_crypto_wasm.js +44 -2
  415. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
  416. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +1 -0
  417. package/vendor/nmts-crypto/package.json +1 -1
  418. package/dist/commands/consent.js +0 -77
  419. package/dist/extend-sign.js +0 -130
@@ -0,0 +1,95 @@
1
+ // Registering a new blob into a storage resource the wallet ALREADY holds — the place where
2
+ // "put it in that space" is expressed as a transaction. ⚠ PUBLISHED — copied byte-for-byte into
3
+ // the `nmts` command-line package; keep comments self-contained English.
4
+ //
5
+ // ⛔ WHY THE SDK IS NOT USED HERE. `client.registerBlob` hard-codes `storage: this.createStorage(…)`
6
+ // — it always BUYS. There is no slot for a resource one already owns. The Move function takes
7
+ // that slot as an argument (`register_blob(self, storage, blobId, rootHash, size, encodingType,
8
+ // deletable, writePayment)`), and the SDK offers no path to it.
9
+ //
10
+ // ⛔ THE GENERATED MOVE BINDINGS CANNOT BE USED EITHER. `@mysten/walrus/dist/contracts/walrus/
11
+ // system.mjs` is a path the package does not export; importing it is refused with
12
+ // `ERR_PACKAGE_PATH_NOT_EXPORTED` (measured 2026-08-28). So the `moveCall` is written by hand,
13
+ // which is the right thing anyway: leaning on somebody's internal path breaks silently on their
14
+ // next version.
15
+ //
16
+ // ⛔ THE WRITE-PAYMENT COIN GOES IN BY REFERENCE. Move takes what it needs out of it and THE EMPTY
17
+ // SHELL IS THE CALLER'S TO DESTROY. Left alone, the transaction never reaches the chain: it is
18
+ // refused at assembly with `UnusedValueWithoutDrop` — which happened once, for real.
19
+ //
20
+ // ⭐ THIS FILE BUILDS TRANSACTIONS AND NOTHING ELSE. "May this resource be used" is answered by the
21
+ // pure judgement below, and the final verdict is a DRY RUN (if the chain refuses, no value
22
+ // leaves).
23
+ import { coinWithBalance, Transaction } from "@mysten/sui/transactions";
24
+ import { bcs } from "@mysten/sui/bcs";
25
+ /**
26
+ * Only "it certainly fits" is true.
27
+ *
28
+ * ⛔ THE ENCODED LENGTH IS NOT COMPUTED HERE. That arithmetic is the protocol's and lives inside
29
+ * the SDK (unexported); a copy kept here would be wrong the day they change it, and only we
30
+ * would not know. ▶ Instead MONOTONICITY alone is used: the encoded length never shrinks as the
31
+ * raw length grows, so a new file no larger than the one the resource held certainly fits.
32
+ * ⚠ This is therefore a SUFFICIENT condition. When it is false the real answer comes from a dry
33
+ * run — resources carry a 63 MiB floor, so a slightly larger file fitting a small file's slot
34
+ * is common in practice.
35
+ */
36
+ export function surelyFits(input) {
37
+ if (input.resourceEndEpoch <= input.currentEpoch)
38
+ return false;
39
+ if (input.heldRawBytes === undefined)
40
+ return false;
41
+ return input.newRawBytes <= input.heldRawBytes;
42
+ }
43
+ /** A registration that uses ONE held storage resource as it is. */
44
+ export function registerIntoStorage(input, transaction) {
45
+ const tx = transaction ?? new Transaction();
46
+ tx.setSenderIfNotSet(input.owner);
47
+ const writeCoin = tx.add(coinWithBalance({ balance: input.writeCost, type: input.walType }));
48
+ const blob = tx.moveCall({
49
+ package: input.walrusPackageId,
50
+ module: "system",
51
+ function: "register_blob",
52
+ arguments: [
53
+ tx.object(input.systemObjectId),
54
+ tx.object(input.storageObjectId),
55
+ tx.pure.u256(input.blobIdAsInt),
56
+ tx.pure.u256(BigInt(bcs.u256().parse(input.rootHash))),
57
+ tx.pure.u64(input.rawBytes),
58
+ // 1 = RS2. ⚠ Must equal what the SDK registers with — otherwise the storage nodes wait for
59
+ // a different encoding.
60
+ tx.pure.u8(1),
61
+ tx.pure.bool(input.deletable),
62
+ writeCoin,
63
+ ],
64
+ });
65
+ // ⛔ The place the header comment is about. Not destroyed = refused at assembly.
66
+ tx.moveCall({ target: "0x2::coin::destroy_zero", typeArguments: [input.walType], arguments: [writeCoin] });
67
+ tx.transferObjects([blob], input.owner);
68
+ return tx;
69
+ }
70
+ /**
71
+ * "Cut to fit": shrink a held resource to exactly what the file needs, so the rest stays a free
72
+ * resource instead of being bound inside the blob. The owner's rule: the person chooses between
73
+ * cutting and binding whole, and is shown the leftover in bytes — no default is chosen for them.
74
+ *
75
+ * ⛔ WHICH HALF IS WHICH IS THE CONTRACT'S CHOICE, read from `storage_resource.move`: `split_by_size`
76
+ * MODIFIES the given resource down to `split_size` and RETURNS a new object holding the rest.
77
+ * So the object id the caller already holds is the one that registers the blob afterwards, and
78
+ * the returned object is the leftover — which must be transferred, or the transaction is
79
+ * refused at assembly for an unused value.
80
+ *
81
+ * ⚠ `keepBytes` must be the ENCODED size (the chain's `encoded_blob_length`), never the raw one:
82
+ * registration checks `encoded_size <= storage_size` and a resource cut to the raw size fails it.
83
+ */
84
+ export function splitStorageToFit(input, transaction) {
85
+ const tx = transaction ?? new Transaction();
86
+ tx.setSenderIfNotSet(input.owner);
87
+ const rest = tx.moveCall({
88
+ package: input.walrusPackageId,
89
+ module: "storage_resource",
90
+ function: "split_by_size",
91
+ arguments: [tx.object(input.storageObjectId), tx.pure.u64(input.keepBytes)],
92
+ });
93
+ tx.transferObjects([rest], input.owner);
94
+ return tx;
95
+ }
@@ -0,0 +1,25 @@
1
+ /** Network codes, as stored. Fixed forever once a row carries one. */
2
+ export declare const NETWORK_WALRUS = 0;
3
+ /** Filecoin — product tier 「NMTS Heavy」. Reserved; no upload path exists yet. */
4
+ export declare const NETWORK_FILECOIN = 1;
5
+ /** Arweave — reserved and deliberately last: it cannot be deleted, ever (BACKLOG §2.2). */
6
+ export declare const NETWORK_ARWEAVE = 2;
7
+ /** The wire NAME of each network, as the recovery map spells it. */
8
+ export type StorageNetworkName = "walrus" | "filecoin" | "arweave";
9
+ /**
10
+ * Code → the name a recovery map stores. `null` for a code this build has never heard of.
11
+ *
12
+ * A newer client could store a network this one predates. Returning null makes that visible to
13
+ * the caller instead of mislabelling someone's bytes.
14
+ */
15
+ export declare function networkName(code: number): StorageNetworkName | null;
16
+ /** Name → code. `null` for anything not in the registry. */
17
+ export declare function networkCode(name: string): number | null;
18
+ /**
19
+ * What an ABSENT network field means: Walrus.
20
+ *
21
+ * This is a fact, not a fallback. No other network has ever had an upload path, so every part,
22
+ * entry and map written before the field existed is on Walrus by construction. Stated as a named
23
+ * constant so the reasoning sits next to every use of it rather than being re-derived.
24
+ */
25
+ export declare const NETWORK_WHEN_UNRECORDED = 0;
@@ -0,0 +1,24 @@
1
+ export interface PartRange {
2
+ /**
3
+ * Zero-based position of this part in the file.
4
+ *
5
+ * It orders the download AND is sealed into the part's own header, so a storage service cannot
6
+ * reorder parts or serve one in another's place without the decryption failing.
7
+ */
8
+ partIndex: number;
9
+ /** Where this part starts in the plaintext, inclusive. */
10
+ offset: number;
11
+ /** How many plaintext bytes this part carries. Becomes the declared length in its header. */
12
+ length: number;
13
+ }
14
+ /**
15
+ * Split a plaintext length into ordered, contiguous, non-overlapping ranges of at most
16
+ * `partSizeBytes` each; the last one carries the remainder.
17
+ *
18
+ * The ranges tile `[0, plaintextLen)` exactly — the lengths sum to `plaintextLen` — and a file that
19
+ * fits in one part is simply the one-range case, so a caller never needs a separate path for it.
20
+ *
21
+ * Throws on a non-positive length or part size rather than coercing: both are caller mistakes, and
22
+ * a silently corrected one would produce a plan that does not describe the file.
23
+ */
24
+ export declare function planParts(plaintextLen: number, partSizeBytes: number): PartRange[];
@@ -0,0 +1,138 @@
1
+ /** The names we can prove. `other` means "could not name it", not "nothing happened". */
2
+ export type ActivityKind = "seal" | "extend" | "erase" | "exchange" | "donate" | "send" | "receive" | "other";
3
+ /** Who paid the network fee. `pool` means the free-trial pool did. */
4
+ export type GasPayer = "self" | "pool" | "other";
5
+ export interface ActivityChange {
6
+ /** The coin's name when it is one we know, else `null` (the type string is kept regardless). */
7
+ coin: "SUI" | "WAL" | null;
8
+ coinType: string;
9
+ /** How much THIS address's balance moved. Negative means it left. */
10
+ amount: bigint;
11
+ }
12
+ export interface ActivityRow {
13
+ digest: string;
14
+ /** The chain's own timestamp (epoch ms). `null` when the RPC did not give one — never invented. */
15
+ atMs: number | null;
16
+ failed: boolean;
17
+ gasPayer: GasPayer;
18
+ kind: ActivityKind;
19
+ /** THIS address's balance changes only. Other people's changes are not in this list. */
20
+ changes: ActivityChange[];
21
+ explorerUrl: string;
22
+ }
23
+ /** Everything the judgement compares against — all passed in; this file touches no screen and no network. */
24
+ export interface ActivityContext {
25
+ /** The wallet whose list this is. */
26
+ address: string;
27
+ /** Where gifts go (developer, pool). Empty ⇒ nothing is ever named a donation. */
28
+ donationAddresses: readonly string[];
29
+ /** The free-trial pool's address. Empty ⇒ no `pool` judgement. */
30
+ poolAddress: string;
31
+ /** The network's WAL coin type — the one balance change we name "WAL". */
32
+ walCoinType: string;
33
+ /** The Walrus system object id — the input that proves a storage-network transaction. */
34
+ walrusSystemObjectId: string;
35
+ /** The DeepBook package on this network, or `null` when there is none. */
36
+ deepbookPackageId: string | null;
37
+ /** The Bluefin package on this network, or `null` when there is none (testnet). */
38
+ bluefinPackageId: string | null;
39
+ /** The official testnet WAL exchange object, or `null` on a network that has none (mainnet). */
40
+ exchangeObjectId: string | null;
41
+ /** The network name the explorer link is built for: `"mainnet"` or `"testnet"`. */
42
+ network: string;
43
+ }
44
+ export interface RpcMoveCall {
45
+ package?: string;
46
+ module?: string;
47
+ function?: string;
48
+ }
49
+ /**
50
+ * One command of a programmable transaction.
51
+ *
52
+ * ⚠ THE INDEX SIGNATURE IS REQUIRED. The SDK's command type is a union of `{MoveCall}`,
53
+ * `{TransferObjects}`, `{SplitCoins}` … and with only `MoveCall?` here TypeScript refuses it
54
+ * ("no properties in common" — weak-type detection). The index signature says "any other field
55
+ * is fine".
56
+ */
57
+ export interface RpcCommand {
58
+ MoveCall?: RpcMoveCall;
59
+ [other: string]: unknown;
60
+ }
61
+ /**
62
+ * What can sit in a command slot — usually the shape above, but sometimes A BARE STRING (the
63
+ * command list of an end-of-epoch transaction carries name-only entries). Our wallet transactions
64
+ * never contain one, but the receiving type includes that branch, so it is accepted — and skipped.
65
+ */
66
+ export type RpcCommandEntry = RpcCommand | string;
67
+ /** One transaction input. The index signature is needed for the same reason (pure-value inputs have no `objectId`). */
68
+ export interface RpcInput {
69
+ objectId?: string;
70
+ [other: string]: unknown;
71
+ }
72
+ export interface RpcBalanceChange {
73
+ owner?: unknown;
74
+ coinType?: string;
75
+ amount?: string;
76
+ }
77
+ export interface RpcTransaction {
78
+ digest?: string;
79
+ timestampMs?: string | number | null;
80
+ balanceChanges?: readonly RpcBalanceChange[] | null;
81
+ effects?: {
82
+ status?: {
83
+ status?: string;
84
+ };
85
+ } | null;
86
+ transaction?: {
87
+ data?: {
88
+ sender?: string;
89
+ gasData?: {
90
+ owner?: string;
91
+ };
92
+ transaction?: {
93
+ /** `ProgrammableTransaction` and the like. Not read, but it MUST be declared — for the same
94
+ * reason as the index signatures: without it other kinds (`ChangeEpoch`) fail the type check. */
95
+ kind?: string;
96
+ inputs?: readonly RpcInput[];
97
+ transactions?: readonly RpcCommandEntry[];
98
+ };
99
+ };
100
+ } | null;
101
+ }
102
+ /**
103
+ * Put an address into one shape before comparing.
104
+ *
105
+ * ⚠ A Sui address can be written zero-padded or not (`0x2` and `0x000…02` are the same one). The
106
+ * RPC's form and the one in our configuration can differ, and then THE SAME ADDRESS COMPARES AS
107
+ * DIFFERENT — a gift would fall through to "send". So both are padded to 32 bytes first.
108
+ */
109
+ export declare function normalizeAddress(raw: string): string;
110
+ /**
111
+ * One transaction → one row for a screen or a terminal.
112
+ *
113
+ * ⛔ THE ORDER OF THE JUDGEMENT IS THE ANSWER — a transaction matching several branches gets the
114
+ * first: ① storage network (system object + a known `system` function) ② exchange ③ donation
115
+ * ④ send / receive ⑤ other. Storage comes first because it is the commonest reason a balance
116
+ * here goes down; donation comes before send because a more specific truth beats a less
117
+ * specific one.
118
+ */
119
+ export declare function toActivityRow(tx: RpcTransaction, ctx: ActivityContext): ActivityRow;
120
+ /**
121
+ * Where a person can look the transaction up themselves.
122
+ *
123
+ * ⚠ A plain navigation link (not a fetch, so no `connect-src` concern). The same explorer's object
124
+ * links are already used elsewhere in the product, in the same shape.
125
+ * ⭐ The URL shape was CHECKED IN A REAL BROWSER (2026-08-17): opening it shows that digest.
126
+ * ⛔ It cannot be checked with `curl` — the site renders in the browser, the fetched HTML is
127
+ * empty, and EVERY path answers 200.
128
+ */
129
+ export declare function explorerTxUrl(digest: string, network: string): string;
130
+ /**
131
+ * The two lists (sent, received) folded into one.
132
+ *
133
+ * ⛔ THE RPC FILTER HAS NO OR — `FromAddress` and `ToAddress` cannot be asked for together, so
134
+ * they are asked for twice and merged here. A transaction can appear on both sides, so
135
+ * DUPLICATES ARE REMOVED BY DIGEST.
136
+ * ⚠ Rows with no time go LAST — treating a missing time as 0 would float "1970" to the top.
137
+ */
138
+ export declare function mergeActivity(groups: readonly (readonly ActivityRow[])[], limit: number): ActivityRow[];
@@ -0,0 +1,208 @@
1
+ // The wallet's activity list — one pure judgement per transaction. ⚠ PUBLISHED — copied
2
+ // byte-for-byte into the `nmts` command-line package; keep comments self-contained English.
3
+ //
4
+ // ⛔ THE ONE RULE THIS FILE KEEPS: NO NAME OF OURS ON A TRANSACTION WE ARE NOT SURE OF. The chain
5
+ // gives a digest, a time and balance changes — not our words "upload" or "exchange". Writing
6
+ // "upload" on a "probably an upload" is a lie to the person, and the worst kind: they came here
7
+ // to find out why the balance went down.
8
+ // ▶ So a name is put only where a constant we already hold PROVES it, and the rest is "other"
9
+ // — still shown with its time, its balance changes and its chain link. Not knowing is written
10
+ // as not knowing, never drawn as nothing having happened.
11
+ //
12
+ // ⭐ What proves each name (every one a measured constant, none a guess):
13
+ // · storage network — the transaction's inputs carry the Walrus SYSTEM object (an id the SDK
14
+ // publishes per network) and a Move call's module is `system`. The function then decides:
15
+ // `register_blob` / `certify_blob` → seal · `extend_blob` → extend · `delete_blob` → erase.
16
+ // (Function names read verbatim from `@mysten/walrus`'s generated contract bindings, 2026-08-17.)
17
+ // · exchange — a Move call's package is DeepBook or Bluefin, or the inputs carry the testnet
18
+ // exchange object.
19
+ // · donate — a transaction in which one of our donation addresses GAINED balance.
20
+ // · send / receive — a pure transfer with no Move call; our balance down = send, up = receive.
21
+ // · anything else → no name.
22
+ //
23
+ // ⚠ What this judgement cannot do:
24
+ // · a transaction that does several things gets the FIRST name that matches (the order below is
25
+ // the answer);
26
+ // · a Walrus package upgrade keeps the system object id, so this survives one; the day the
27
+ // system object itself changes, storage transactions quietly become "other" — a missing name,
28
+ // never a wrong one;
29
+ // · the list is what the CHAIN knows. Whether a storage node still holds the bytes is not
30
+ // proved here.
31
+ //
32
+ // ⛔ NO CONSTANT IS IMPORTED. Everything the judgement compares against arrives in
33
+ // `ActivityContext`, so the same file serves the browser (which reads its build's network) and
34
+ // the command-line tool (which resolves the network at run time) without a fork.
35
+ // ── Small readers ─────────────────────────────────────────────────────────────────────────────
36
+ /** The address out of `{ AddressOwner: "0x…" }`. Other owner shapes (shared, immutable) have none → `null`. */
37
+ function ownerAddress(owner) {
38
+ if (typeof owner !== "object" || owner === null)
39
+ return null;
40
+ if (!("AddressOwner" in owner))
41
+ return null;
42
+ const value = owner.AddressOwner;
43
+ return typeof value === "string" ? value : null;
44
+ }
45
+ /** The RPC gives the time as a string. Unreadable ⇒ `null`, NEVER an invented number. */
46
+ function readTimestamp(raw) {
47
+ if (raw === null || raw === undefined)
48
+ return null;
49
+ const value = typeof raw === "number" ? raw : Number.parseInt(raw, 10);
50
+ return Number.isFinite(value) && value > 0 ? value : null;
51
+ }
52
+ /**
53
+ * Put an address into one shape before comparing.
54
+ *
55
+ * ⚠ A Sui address can be written zero-padded or not (`0x2` and `0x000…02` are the same one). The
56
+ * RPC's form and the one in our configuration can differ, and then THE SAME ADDRESS COMPARES AS
57
+ * DIFFERENT — a gift would fall through to "send". So both are padded to 32 bytes first.
58
+ */
59
+ export function normalizeAddress(raw) {
60
+ const body = raw.trim().toLowerCase().replace(/^0x/, "");
61
+ if (body === "" || !/^[0-9a-f]+$/.test(body) || body.length > 64)
62
+ return raw.trim().toLowerCase();
63
+ return `0x${body.padStart(64, "0")}`;
64
+ }
65
+ /** Every Move call (empty for a pure transfer). */
66
+ function moveCalls(tx) {
67
+ const commands = tx.transaction?.data?.transaction?.transactions ?? [];
68
+ const calls = [];
69
+ for (const command of commands) {
70
+ if (typeof command === "string")
71
+ continue;
72
+ if (command.MoveCall !== undefined)
73
+ calls.push(command.MoveCall);
74
+ }
75
+ return calls;
76
+ }
77
+ /** Every object id among the inputs, zero-padded. */
78
+ function inputObjectIds(tx) {
79
+ const ids = new Set();
80
+ for (const input of tx.transaction?.data?.transaction?.inputs ?? []) {
81
+ if (typeof input.objectId === "string")
82
+ ids.add(normalizeAddress(input.objectId));
83
+ }
84
+ return ids;
85
+ }
86
+ /** The functions of the Walrus `system` module whose names we know → our kind. */
87
+ const WALRUS_FUNCTION_KIND = {
88
+ register_blob: "seal",
89
+ certify_blob: "seal",
90
+ extend_blob: "extend",
91
+ delete_blob: "erase",
92
+ };
93
+ /**
94
+ * One transaction → one row for a screen or a terminal.
95
+ *
96
+ * ⛔ THE ORDER OF THE JUDGEMENT IS THE ANSWER — a transaction matching several branches gets the
97
+ * first: ① storage network (system object + a known `system` function) ② exchange ③ donation
98
+ * ④ send / receive ⑤ other. Storage comes first because it is the commonest reason a balance
99
+ * here goes down; donation comes before send because a more specific truth beats a less
100
+ * specific one.
101
+ */
102
+ export function toActivityRow(tx, ctx) {
103
+ const me = normalizeAddress(ctx.address);
104
+ const digest = typeof tx.digest === "string" ? tx.digest : "";
105
+ const sender = normalizeAddress(tx.transaction?.data?.sender ?? "");
106
+ const gasOwnerRaw = tx.transaction?.data?.gasData?.owner;
107
+ const gasOwner = typeof gasOwnerRaw === "string" ? normalizeAddress(gasOwnerRaw) : sender;
108
+ const pool = ctx.poolAddress === "" ? null : normalizeAddress(ctx.poolAddress);
109
+ const gasPayer = gasOwner === sender ? "self" : pool !== null && gasOwner === pool ? "pool" : "other";
110
+ const changes = [];
111
+ let donationGain = false;
112
+ for (const change of tx.balanceChanges ?? []) {
113
+ const owner = ownerAddress(change.owner);
114
+ if (owner === null)
115
+ continue;
116
+ const normalized = normalizeAddress(owner);
117
+ const amount = BigInt(change.amount ?? "0");
118
+ if (normalized === me) {
119
+ const coinType = change.coinType ?? "";
120
+ changes.push({
121
+ coin: coinType === ctx.walCoinType ? "WAL" : coinType === "0x2::sui::SUI" ? "SUI" : null,
122
+ coinType,
123
+ amount,
124
+ });
125
+ continue;
126
+ }
127
+ if (amount > 0n && ctx.donationAddresses.some((a) => a !== "" && normalizeAddress(a) === normalized)) {
128
+ donationGain = true;
129
+ }
130
+ }
131
+ const calls = moveCalls(tx);
132
+ const inputs = inputObjectIds(tx);
133
+ const walrusSystem = normalizeAddress(ctx.walrusSystemObjectId);
134
+ let kind = "other";
135
+ const walrusCall = inputs.has(walrusSystem)
136
+ ? calls.find((c) => c.module === "system" && (c.function ?? "") in WALRUS_FUNCTION_KIND)
137
+ : undefined;
138
+ if (walrusCall !== undefined) {
139
+ kind = WALRUS_FUNCTION_KIND[walrusCall.function ?? ""] ?? "other";
140
+ }
141
+ else if (calls.some((c) => typeof c.package === "string" &&
142
+ ((ctx.deepbookPackageId !== null &&
143
+ normalizeAddress(c.package) === normalizeAddress(ctx.deepbookPackageId)) ||
144
+ (ctx.bluefinPackageId !== null &&
145
+ normalizeAddress(c.package) === normalizeAddress(ctx.bluefinPackageId)))) ||
146
+ (ctx.exchangeObjectId !== null && inputs.has(normalizeAddress(ctx.exchangeObjectId)))) {
147
+ kind = "exchange";
148
+ }
149
+ else if (donationGain && sender === me) {
150
+ kind = "donate";
151
+ }
152
+ else if (calls.length === 0 && changes.length > 0) {
153
+ const net = changes.reduce((sum, c) => sum + c.amount, 0n);
154
+ if (sender === me && net < 0n)
155
+ kind = "send";
156
+ else if (sender !== me && net > 0n)
157
+ kind = "receive";
158
+ }
159
+ return {
160
+ digest,
161
+ atMs: readTimestamp(tx.timestampMs),
162
+ failed: (tx.effects?.status?.status ?? "success") !== "success",
163
+ gasPayer,
164
+ kind,
165
+ changes,
166
+ explorerUrl: explorerTxUrl(digest, ctx.network),
167
+ };
168
+ }
169
+ /**
170
+ * Where a person can look the transaction up themselves.
171
+ *
172
+ * ⚠ A plain navigation link (not a fetch, so no `connect-src` concern). The same explorer's object
173
+ * links are already used elsewhere in the product, in the same shape.
174
+ * ⭐ The URL shape was CHECKED IN A REAL BROWSER (2026-08-17): opening it shows that digest.
175
+ * ⛔ It cannot be checked with `curl` — the site renders in the browser, the fetched HTML is
176
+ * empty, and EVERY path answers 200.
177
+ */
178
+ export function explorerTxUrl(digest, network) {
179
+ return `https://suiscan.xyz/${network}/tx/${digest}`;
180
+ }
181
+ /**
182
+ * The two lists (sent, received) folded into one.
183
+ *
184
+ * ⛔ THE RPC FILTER HAS NO OR — `FromAddress` and `ToAddress` cannot be asked for together, so
185
+ * they are asked for twice and merged here. A transaction can appear on both sides, so
186
+ * DUPLICATES ARE REMOVED BY DIGEST.
187
+ * ⚠ Rows with no time go LAST — treating a missing time as 0 would float "1970" to the top.
188
+ */
189
+ export function mergeActivity(groups, limit) {
190
+ const byDigest = new Map();
191
+ for (const group of groups) {
192
+ for (const row of group) {
193
+ if (row.digest !== "" && !byDigest.has(row.digest))
194
+ byDigest.set(row.digest, row);
195
+ }
196
+ }
197
+ return [...byDigest.values()]
198
+ .sort((a, b) => {
199
+ if (a.atMs === b.atMs)
200
+ return 0;
201
+ if (a.atMs === null)
202
+ return 1;
203
+ if (b.atMs === null)
204
+ return -1;
205
+ return b.atMs - a.atMs;
206
+ })
207
+ .slice(0, limit);
208
+ }
@@ -0,0 +1,68 @@
1
+ /** Base-unit scale for both tokens (1 SUI = 1e9 MIST, 1 WAL = 1e9 FROST). */
2
+ export declare const TOKEN_DECIMALS = 9;
3
+ /**
4
+ * SUI kept back so a send or exchange can pay its own gas (0.05 SUI). A ceiling, not the charged
5
+ * amount — a real fee is a few million MIST; this is generous so a send never strands the wallet
6
+ * without gas.
7
+ */
8
+ export declare const SUI_GAS_RESERVE_MIST = 50000000n;
9
+ /** Which token a send moves. */
10
+ export type SendCoin = "SUI" | "WAL";
11
+ /** Trim and lowercase an address (hex is case-insensitive; lowercase is the shape kept). */
12
+ export declare function normalizeSuiAddress(input: string): string;
13
+ /** True when `input`, normalised, is a full 0x + 64-hex Sui address. */
14
+ export declare function isValidSuiAddress(input: string): boolean;
15
+ /**
16
+ * A decimal amount ("0.5", "12", ".25") as base units, EXACTLY — no floating point, so 0.1 never
17
+ * drifts. Null for anything malformed or finer than the chain keeps (never silently rounded). Does
18
+ * not judge whether the amount is affordable; that is the validator's job.
19
+ */
20
+ export declare function parseTokenAmountToBaseUnits(input: string, decimals?: number): bigint | null;
21
+ /**
22
+ * The most that can be sent, in base units. SUI keeps the gas reserve back; WAL is fully sendable
23
+ * (a WAL transfer pays its gas in SUI, which the validator checks separately). Never negative.
24
+ */
25
+ export declare function maxSendableBaseUnits(params: {
26
+ coin: SendCoin;
27
+ suiBalance: bigint;
28
+ walBalance: bigint;
29
+ gasReserve?: bigint;
30
+ }): bigint;
31
+ /** Stable error codes for a send. Each maps to one honest sentence on whichever surface shows it. */
32
+ export type SendValidationError = "invalidAddress" | "invalidAmount" | "insufficientBalance" | "noGasForWal";
33
+ export type SendValidation = {
34
+ ok: true;
35
+ amountBaseUnits: bigint;
36
+ address: string;
37
+ } | {
38
+ ok: false;
39
+ error: SendValidationError;
40
+ };
41
+ /**
42
+ * Validate a send. The address must be a full Sui address; the amount must be above zero and within
43
+ * what can be sent; a WAL send also needs the gas reserve in SUI — else `noGasForWal`.
44
+ */
45
+ export declare function validateSendForm(params: {
46
+ coin: SendCoin;
47
+ amountInput: string;
48
+ addressInput: string;
49
+ suiBalance: bigint;
50
+ walBalance: bigint;
51
+ gasReserve?: bigint;
52
+ }): SendValidation;
53
+ /** The lowest gas budget a person may set: 0.002 SUI. Below it no transaction goes through. */
54
+ export declare const GAS_BUDGET_MIN_MIST = 2000000n;
55
+ /** The absolute ceiling: 1 SUI. A slipped extra zero stops here. */
56
+ export declare const GAS_BUDGET_ABS_MAX_MIST = 1000000000n;
57
+ /**
58
+ * The RECOMMENDED gas budget from a measured (dry-run) fee: twice the measurement, at least
59
+ * 0.005 SUI, at most 1 SUI.
60
+ *
61
+ * Why twice: the measurement is taken against this moment's object versions and reference gas
62
+ * price, and both move a little between signing and broadcast. A budget below the real cost makes
63
+ * the transaction FAIL FOR WANT OF GAS, and that gas is gone; the doubling is what buys out that
64
+ * failure. A budget is a ceiling, not a charge — what is not used stays in the wallet.
65
+ */
66
+ export declare function recommendedGasBudgetMist(estimateMist: bigint): bigint;
67
+ /** Keep a typed gas budget inside the usable range — clamped, not refused. */
68
+ export declare function clampGasBudgetMist(n: bigint): bigint;