@needmoretruth/nmts-cli 0.45.0 → 0.47.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 (252) hide show
  1. package/AGENTS.md +8 -8
  2. package/CHANGELOG.md +78 -0
  3. package/README.ko.md +6 -3
  4. package/README.md +31 -11
  5. package/dist/api-advice.js +17 -2
  6. package/dist/api.d.ts +22 -0
  7. package/dist/api.js +49 -1
  8. package/dist/arg-options.d.ts +19 -1
  9. package/dist/args.js +14 -2
  10. package/dist/artifact-about.d.ts +1 -1
  11. package/dist/autonomy.js +3 -3
  12. package/dist/collision.d.ts +20 -3
  13. package/dist/collision.js +21 -3
  14. package/dist/commands/erase.js +1 -0
  15. package/dist/commands/handover.d.ts +15 -0
  16. package/dist/commands/handover.js +376 -0
  17. package/dist/commands/heavy-run.d.ts +59 -0
  18. package/dist/commands/heavy-run.js +247 -0
  19. package/dist/commands/heavy.d.ts +7 -0
  20. package/dist/commands/heavy.js +123 -0
  21. package/dist/commands/link.d.ts +12 -0
  22. package/dist/commands/link.js +121 -0
  23. package/dist/commands/ls.d.ts +5 -0
  24. package/dist/commands/ls.js +9 -1
  25. package/dist/commands/public-code-manage.d.ts +24 -0
  26. package/dist/commands/public-code-manage.js +217 -0
  27. package/dist/commands/public-code.d.ts +12 -1
  28. package/dist/commands/public-code.js +140 -45
  29. package/dist/commands/push-heavy.d.ts +6 -0
  30. package/dist/commands/push-heavy.js +128 -0
  31. package/dist/commands/push-tree.d.ts +24 -0
  32. package/dist/commands/push-tree.js +91 -0
  33. package/dist/commands/push.d.ts +4 -13
  34. package/dist/commands/push.js +7 -77
  35. package/dist/commands/put-heavy.d.ts +9 -0
  36. package/dist/commands/put-heavy.js +120 -0
  37. package/dist/commands/put-payer.d.ts +21 -0
  38. package/dist/commands/put-payer.js +24 -0
  39. package/dist/commands/put.d.ts +2 -2
  40. package/dist/commands/put.js +8 -7
  41. package/dist/commands/receive.js +14 -8
  42. package/dist/commands/s3.js +44 -10
  43. package/dist/commands/share-dispatch.js +14 -1
  44. package/dist/commands/share.d.ts +2 -0
  45. package/dist/commands/share.js +45 -35
  46. package/dist/commands/shares-sent.js +8 -3
  47. package/dist/crypto-surface.d.ts +35 -0
  48. package/dist/crypto-surface.js +13 -0
  49. package/dist/crypto.d.ts +8 -0
  50. package/dist/crypto.js +8 -0
  51. package/dist/download-part.d.ts +32 -1
  52. package/dist/download-part.js +95 -6
  53. package/dist/download-range.d.ts +19 -0
  54. package/dist/download-range.js +108 -0
  55. package/dist/download-sink.d.ts +15 -0
  56. package/dist/download.d.ts +14 -0
  57. package/dist/download.js +19 -4
  58. package/dist/handover-codes.d.ts +25 -0
  59. package/dist/handover-codes.js +106 -0
  60. package/dist/handover.d.ts +62 -0
  61. package/dist/handover.js +217 -0
  62. package/dist/heavy-api.d.ts +36 -0
  63. package/dist/heavy-api.js +107 -0
  64. package/dist/heavy-copy.d.ts +72 -0
  65. package/dist/heavy-copy.js +108 -0
  66. package/dist/heavy-evm.d.ts +20 -0
  67. package/dist/heavy-evm.js +106 -0
  68. package/dist/heavy-self-pay.d.ts +92 -0
  69. package/dist/heavy-self-pay.js +167 -0
  70. package/dist/heavy-upload.d.ts +87 -0
  71. package/dist/heavy-upload.js +154 -0
  72. package/dist/heavy-wallet-pay.d.ts +39 -0
  73. package/dist/heavy-wallet-pay.js +73 -0
  74. package/dist/help-options.js +13 -4
  75. package/dist/help.js +24 -3
  76. package/dist/links.d.ts +58 -0
  77. package/dist/links.js +206 -0
  78. package/dist/list-tier.d.ts +7 -0
  79. package/dist/list-tier.js +47 -0
  80. package/dist/main.js +13 -10
  81. package/dist/manifest-write.d.ts +4 -3
  82. package/dist/mcp-tools/reads.js +20 -6
  83. package/dist/mcp-tools/share.js +47 -1
  84. package/dist/mcp-tools/tiers.js +16 -1
  85. package/dist/platform-sign.d.ts +4 -4
  86. package/dist/platform-sign.js +3 -3
  87. package/dist/portable.d.ts +23 -0
  88. package/dist/portable.js +19 -0
  89. package/dist/product.d.ts +1 -1
  90. package/dist/product.js +1 -1
  91. package/dist/public-code-activity.d.ts +35 -0
  92. package/dist/public-code-activity.js +88 -0
  93. package/dist/public-code-refusals.d.ts +25 -0
  94. package/dist/public-code-refusals.js +87 -0
  95. package/dist/public-codes.d.ts +76 -0
  96. package/dist/public-codes.js +182 -0
  97. package/dist/recovery-build.js +16 -0
  98. package/dist/recovery-map-part.d.ts +82 -0
  99. package/dist/recovery-map-part.js +83 -0
  100. package/dist/recovery-map.d.ts +5 -40
  101. package/dist/recovery-map.js +18 -1
  102. package/dist/recovery-source.d.ts +3 -0
  103. package/dist/recovery-source.js +9 -0
  104. package/dist/risk.d.ts +55 -1
  105. package/dist/risk.js +55 -3
  106. package/dist/run-log.d.ts +1 -1
  107. package/dist/run-log.js +7 -1
  108. package/dist/s3/address.d.ts +20 -0
  109. package/dist/s3/address.js +97 -0
  110. package/dist/s3/answer.d.ts +48 -0
  111. package/dist/s3/answer.js +330 -0
  112. package/dist/s3/body-deframe.d.ts +49 -0
  113. package/dist/s3/body-deframe.js +264 -0
  114. package/dist/s3/body-measure.d.ts +13 -0
  115. package/dist/s3/body-measure.js +48 -0
  116. package/dist/s3/body-plan.d.ts +31 -0
  117. package/dist/s3/body-plan.js +159 -0
  118. package/dist/s3/body.d.ts +46 -0
  119. package/dist/s3/body.js +117 -0
  120. package/dist/s3/call.d.ts +36 -0
  121. package/dist/s3/call.js +42 -0
  122. package/dist/s3/checksum.d.ts +26 -0
  123. package/dist/s3/checksum.js +176 -0
  124. package/dist/s3/content-type.d.ts +3 -0
  125. package/dist/s3/content-type.js +49 -0
  126. package/dist/s3/contract.d.ts +91 -14
  127. package/dist/s3/drive-conditions.d.ts +47 -0
  128. package/dist/s3/drive-conditions.js +134 -0
  129. package/dist/s3/drive-key.d.ts +11 -0
  130. package/dist/s3/drive-key.js +58 -0
  131. package/dist/s3/drive-limits.d.ts +33 -0
  132. package/dist/s3/drive-limits.js +53 -0
  133. package/dist/s3/drive-lock.d.ts +11 -0
  134. package/dist/s3/drive-lock.js +47 -0
  135. package/dist/s3/drive-trashed-name.d.ts +13 -0
  136. package/dist/s3/drive-trashed-name.js +59 -0
  137. package/dist/s3/drive-write.d.ts +38 -0
  138. package/dist/s3/drive-write.js +258 -0
  139. package/dist/s3/drive.d.ts +59 -25
  140. package/dist/s3/drive.js +46 -77
  141. package/dist/s3/listing.d.ts +27 -1
  142. package/dist/s3/listing.js +62 -20
  143. package/dist/s3/long-answer.d.ts +12 -0
  144. package/dist/s3/long-answer.js +104 -0
  145. package/dist/s3/multipart-assemble.d.ts +17 -0
  146. package/dist/s3/multipart-assemble.js +68 -0
  147. package/dist/s3/multipart-sweep.d.ts +15 -0
  148. package/dist/s3/multipart-sweep.js +87 -0
  149. package/dist/s3/multipart-view.d.ts +45 -0
  150. package/dist/s3/multipart-view.js +232 -0
  151. package/dist/s3/multipart.d.ts +26 -19
  152. package/dist/s3/multipart.js +193 -78
  153. package/dist/s3/object-read.d.ts +17 -0
  154. package/dist/s3/object-read.js +127 -0
  155. package/dist/s3/object-write.d.ts +35 -0
  156. package/dist/s3/object-write.js +198 -0
  157. package/dist/s3/range.d.ts +14 -0
  158. package/dist/s3/range.js +80 -0
  159. package/dist/s3/response-sink.d.ts +12 -2
  160. package/dist/s3/response-sink.js +71 -7
  161. package/dist/s3/routes.d.ts +0 -1
  162. package/dist/s3/routes.js +242 -217
  163. package/dist/s3/same-file.d.ts +4 -1
  164. package/dist/s3/same-file.js +12 -3
  165. package/dist/s3/server.d.ts +54 -4
  166. package/dist/s3/server.js +174 -14
  167. package/dist/s3/sigv4-canonical.d.ts +91 -0
  168. package/dist/s3/sigv4-canonical.js +148 -0
  169. package/dist/s3/sigv4-presigned.d.ts +13 -0
  170. package/dist/s3/sigv4-presigned.js +82 -0
  171. package/dist/s3/sigv4.d.ts +26 -27
  172. package/dist/s3/sigv4.js +137 -102
  173. package/dist/s3/spool.d.ts +37 -0
  174. package/dist/s3/spool.js +104 -0
  175. package/dist/s3/staging.d.ts +90 -7
  176. package/dist/s3/staging.js +97 -66
  177. package/dist/s3/xml-multipart.d.ts +38 -0
  178. package/dist/s3/xml-multipart.js +47 -0
  179. package/dist/s3/xml-read.d.ts +28 -0
  180. package/dist/s3/xml-read.js +235 -0
  181. package/dist/s3/xml.d.ts +45 -2
  182. package/dist/s3/xml.js +72 -13
  183. package/dist/s3-gateway.d.ts +11 -5
  184. package/dist/s3-gateway.js +5 -2
  185. package/dist/seal.d.ts +1 -1
  186. package/dist/share-codes.d.ts +40 -0
  187. package/dist/share-codes.js +151 -0
  188. package/dist/share.d.ts +39 -0
  189. package/dist/share.js +54 -13
  190. package/dist/shared/lib/api/types-heavy.d.ts +167 -0
  191. package/dist/shared/lib/api/types-heavy.js +60 -0
  192. package/dist/shared/lib/drive/rebuild-verify.js +1 -0
  193. package/dist/shared/lib/filecoin/providers.d.ts +25 -0
  194. package/dist/shared/lib/filecoin/providers.js +58 -0
  195. package/dist/shared/lib/heavy/download.d.ts +48 -0
  196. package/dist/shared/lib/heavy/download.js +116 -0
  197. package/dist/shared/lib/heavy/order-plan.d.ts +77 -0
  198. package/dist/shared/lib/heavy/order-plan.js +83 -0
  199. package/dist/shared/lib/heavy/order-runner.d.ts +9 -0
  200. package/dist/shared/lib/heavy/order-runner.js +300 -0
  201. package/dist/shared/lib/heavy/order-types.d.ts +90 -0
  202. package/dist/shared/lib/heavy/order-types.js +6 -0
  203. package/dist/shared/lib/heavy/order-wire.d.ts +55 -0
  204. package/dist/shared/lib/heavy/order-wire.js +113 -0
  205. package/dist/shared/lib/heavy/piece-cid.d.ts +24 -0
  206. package/dist/shared/lib/heavy/piece-cid.js +55 -0
  207. package/dist/shared/lib/heavy/sp-upload.d.ts +37 -0
  208. package/dist/shared/lib/heavy/sp-upload.js +112 -0
  209. package/dist/shared/lib/heavy/synapse-piece.d.ts +1 -0
  210. package/dist/shared/lib/heavy/synapse-piece.js +8 -0
  211. package/dist/shared/lib/share/handover-format.d.ts +129 -0
  212. package/dist/shared/lib/share/handover-format.js +323 -0
  213. package/dist/shared/lib/share/public-link.d.ts +41 -0
  214. package/dist/shared/lib/share/public-link.js +107 -0
  215. package/dist/shared/lib/share/shared-file-info.js +1 -0
  216. package/dist/shared/lib/storage-network.d.ts +4 -4
  217. package/dist/shared/lib/storage-network.js +7 -7
  218. package/dist/shared/lib/storage-tier.d.ts +28 -0
  219. package/dist/shared/lib/storage-tier.js +63 -0
  220. package/dist/shared/lib/wallet/send-rules.js +1 -0
  221. package/dist/upload-file.d.ts +8 -0
  222. package/dist/upload-file.js +57 -25
  223. package/dist/upload-price-node.d.ts +3 -0
  224. package/dist/upload-price-node.js +3 -6
  225. package/dist/upload-price.d.ts +10 -0
  226. package/dist/upload-price.js +13 -1
  227. package/dist/upload-run.d.ts +80 -0
  228. package/dist/upload-run.js +173 -0
  229. package/dist/upload-steps.js +15 -4
  230. package/dist/upload-store.d.ts +15 -6
  231. package/dist/upload-store.js +6 -0
  232. package/dist/upload-wallet-put.d.ts +9 -4
  233. package/dist/upload-wallet-put.js +16 -6
  234. package/dist/upload-wallet.js +4 -0
  235. package/dist/upload-wire.d.ts +25 -0
  236. package/dist/upload-wire.js +20 -1
  237. package/dist/upload.js +28 -13
  238. package/dist/wallet-sign.js +2 -2
  239. package/docs/commands/handover.md +54 -0
  240. package/docs/commands/heavy.md +35 -0
  241. package/docs/commands/link.md +27 -0
  242. package/docs/commands/mcp.md +2 -1
  243. package/docs/commands/public-code.md +25 -6
  244. package/docs/commands/push.md +4 -1
  245. package/docs/commands/put.md +15 -1
  246. package/docs/commands/share.md +8 -3
  247. package/package.json +5 -2
  248. package/server.json +2 -2
  249. package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +106 -4
  250. package/vendor/nmts-crypto/nmts_crypto_wasm.js +286 -3
  251. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
  252. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +12 -1
@@ -0,0 +1,167 @@
1
+ /** One stored copy of a Heavy part: which company holds it, where on chain, and where to read it. */
2
+ export interface HeavyCopy {
3
+ /** The storage company's registry id. */
4
+ provider_id: string;
5
+ /** The on-chain data set the piece was added to. */
6
+ data_set_id: string;
7
+ /** The piece's id inside that data set. */
8
+ piece_id: string;
9
+ /** `https://<company>/piece/<PieceCID>` — public, no credentials, byte ranges allowed. */
10
+ retrieval_url: string;
11
+ }
12
+ /** The field a Filecoin (network 1) part carries on every read and on commit. */
13
+ export interface HeavyPartCopies {
14
+ /** Where the part's copies are kept. Present on network-1 parts only; absent means Walrus. */
15
+ copies?: HeavyCopy[];
16
+ }
17
+ /** The fields that tie a committed part to the order and slot that paid for it. */
18
+ export interface HeavyOrderBinding {
19
+ /** The order that paid for this part. Omitted on the self-paid path, which has no order. */
20
+ heavy_order_id?: string;
21
+ /** Which slot of that order this part is. */
22
+ heavy_slot?: number;
23
+ }
24
+ /** How an order is paid. */
25
+ export type HeavyPay = "credits" | "wallet";
26
+ /** One slot asked for when an order opens: its number and the exact sealed size it will upload. */
27
+ export interface HeavySlotRequest {
28
+ /** 0..n-1, one per sealed part across every file of the upload. */
29
+ slot: number;
30
+ /** Bytes of the sealed part, 127..=1_065_353_216 — known before sealing. */
31
+ sealed_len: number;
32
+ }
33
+ /** `POST /v1/heavy/orders` body. */
34
+ export interface HeavyCreateOrderRequest {
35
+ /** 16..64 of `[A-Za-z0-9_-]`. The same key and body answer the same order; nothing is charged twice. */
36
+ idempotency_key: string;
37
+ /** 1..=256 slots. */
38
+ slots: HeavySlotRequest[];
39
+ pay: HeavyPay;
40
+ /** Wallet orders only: 1..=365 days. Credit orders are always 28. */
41
+ term_days?: number;
42
+ /** Wallet orders only: the `0x` + 64-hex Sui address that will pay. */
43
+ payer?: string;
44
+ }
45
+ /** What a wallet order costs, and where the payment goes. */
46
+ export interface HeavyPrice {
47
+ /** The price in FROST (1 WAL = 10^9 FROST), as a decimal string. */
48
+ wal_frost: string;
49
+ /** The `0x` + 64-hex Sui address the WAL is sent to. */
50
+ treasury: string;
51
+ /** How long after every slot is stored the payment may arrive before the copies are removed. */
52
+ pay_within_secs: number;
53
+ }
54
+ export type HeavyOrderState = "open" | "stored" | "paid" | "bound" | "expired" | "failed";
55
+ export type HeavySlotState = "open" | "targeted" | "committing" | "stored" | "failed" | "removed";
56
+ /** `POST /v1/heavy/orders` 200. */
57
+ export interface HeavyOrderCreated {
58
+ order_id: string;
59
+ state: "open";
60
+ pay: HeavyPay;
61
+ term_days: number;
62
+ /** Credit orders: what was taken. */
63
+ credits?: number;
64
+ /** Wallet orders: what will be owed once everything is stored. */
65
+ price?: HeavyPrice;
66
+ slots: {
67
+ slot: number;
68
+ state: "open";
69
+ }[];
70
+ }
71
+ /** One slot as `GET /v1/heavy/orders/{id}` reports it. */
72
+ export interface HeavySlotView {
73
+ slot: number;
74
+ state: HeavySlotState;
75
+ piece_cid?: string;
76
+ /** Present once the slot is stored. */
77
+ copies?: HeavyCopy[];
78
+ /** Why a failed slot failed, as the server words it for a log. */
79
+ error?: string;
80
+ }
81
+ /** `GET /v1/heavy/orders/{id}` 200. */
82
+ export interface HeavyOrderView {
83
+ order_id: string;
84
+ state: HeavyOrderState;
85
+ pay: HeavyPay;
86
+ term_days: number;
87
+ price?: HeavyPrice;
88
+ /** The Filecoin epoch (30 s) the copies are kept until; set once every slot is stored. */
89
+ expiry_epoch?: number;
90
+ slots: HeavySlotView[];
91
+ }
92
+ /** `POST …/slots/{slot}/target` body. */
93
+ export interface HeavyTargetRequest {
94
+ /** The part's FRC-0069 PieceCID (`bafkzcib…`); its raw size must equal the slot's `sealed_len`. */
95
+ piece_cid: string;
96
+ }
97
+ /** `POST …/slots/{slot}/target` 200 — where to upload this slot's bytes. */
98
+ export interface HeavySlotTarget {
99
+ provider_id: string;
100
+ /** The company's service origin; the upload goes to `<service_url>/pdp/piece/uploads`. */
101
+ service_url: string;
102
+ }
103
+ /** `POST …/slots/{slot}/uploaded` 202. */
104
+ export interface HeavyUploadedReply {
105
+ state: "committing";
106
+ }
107
+ /** `POST …/paid` body — the Sui transaction that sent the WAL. */
108
+ export interface HeavyPaidRequest {
109
+ tx_digest: string;
110
+ }
111
+ /** `POST …/paid` 200. */
112
+ export interface HeavyPaidReply {
113
+ state: "paid";
114
+ }
115
+ /** Per-call options every order route accepts. */
116
+ export interface HeavyCallOptions {
117
+ signal?: AbortSignal;
118
+ }
119
+ /**
120
+ * The order routes as one object. The browser builds it over its api client; the command line
121
+ * builds it over its own. The upload orchestrator depends on nothing but this.
122
+ */
123
+ export interface HeavyOrderApi {
124
+ createOrder(body: HeavyCreateOrderRequest, options?: HeavyCallOptions): Promise<HeavyOrderCreated>;
125
+ getOrder(orderId: string, options?: HeavyCallOptions): Promise<HeavyOrderView>;
126
+ targetSlot(orderId: string, slot: number, body: HeavyTargetRequest, options?: HeavyCallOptions): Promise<HeavySlotTarget>;
127
+ slotUploaded(orderId: string, slot: number, options?: HeavyCallOptions): Promise<HeavyUploadedReply>;
128
+ markPaid(orderId: string, body: HeavyPaidRequest, options?: HeavyCallOptions): Promise<HeavyPaidReply>;
129
+ }
130
+ /**
131
+ * A finished Heavy part, ready to go into `POST /v1/items` as one of a file's parts.
132
+ *
133
+ * Structurally one of that route's part inputs: the treasury owns order-paid storage (`owner_kind`
134
+ * 1), the part is a whole piece rather than a quilt patch (`storage_kind` 0), and `blob_id` holds
135
+ * the PieceCID — the id the Filecoin network knows the bytes by.
136
+ */
137
+ export interface HeavyPartCommit {
138
+ part_index: number;
139
+ storage_kind: 0;
140
+ network: 1;
141
+ blob_id: string;
142
+ sealed_len: number;
143
+ owner_kind: 1;
144
+ /** A Filecoin epoch, not a Walrus one: the unit is the network's own. */
145
+ expiry_epoch: number;
146
+ heavy_order_id: string;
147
+ heavy_slot: number;
148
+ copies: HeavyCopy[];
149
+ }
150
+ /**
151
+ * Every refusal the order routes can answer, by the name the contract gives it.
152
+ *
153
+ * credits_insufficient · idempotency_conflict · file_credits_cap · day_credits_cap ·
154
+ * heavy_wallet_pay_off · heavy_price_unavailable · unpaid_orders_cap ·
155
+ * heavy_unavailable (opening an order)
156
+ * piece_cid_invalid · piece_size_mismatch · slot_state (placing a slot)
157
+ * not_stored · payment_not_found · payment_mismatch · digest_used (reporting a payment)
158
+ */
159
+ export declare const HEAVY_REFUSALS: readonly ["credits_insufficient", "idempotency_conflict", "file_credits_cap", "day_credits_cap", "heavy_wallet_pay_off", "heavy_price_unavailable", "unpaid_orders_cap", "heavy_unavailable", "piece_cid_invalid", "piece_size_mismatch", "slot_state", "not_stored", "payment_not_found", "payment_mismatch", "digest_used"];
160
+ export type HeavyRefusal = (typeof HEAVY_REFUSALS)[number];
161
+ /**
162
+ * The Heavy refusal an error code names, or `null` when it names none.
163
+ *
164
+ * Letter case is ignored: servers spell error codes in capitals (`CREDITS_INSUFFICIENT`) and the
165
+ * contract writes them in lower case, and both mean one thing.
166
+ */
167
+ export declare function heavyRefusalOf(code: string): HeavyRefusal | null;
@@ -0,0 +1,60 @@
1
+ // The wire shapes of NMTS Heavy's order routes, and the refusals they answer with.
2
+ //
3
+ // ⚠ THIS FILE IS PUBLISHED. It is copied byte-for-byte into the `nmts` command-line package, so it
4
+ // imports nothing and its comments stay self-contained English.
5
+ //
6
+ // WHAT AN ORDER IS. One upload (one file or fifty) opens ONE order. The order has a slot per sealed
7
+ // part; each slot is placed with a Filecoin storage company, the client uploads the bytes to that
8
+ // company directly, and the server has the copies committed on chain and reports when they are
9
+ // stored. Payment is either credits (taken when the order opens) or the person's wallet (paid once,
10
+ // after every slot is stored). The finished parts are then committed to a file like any other part,
11
+ // naming the order and slot that paid for them.
12
+ //
13
+ // ⛔ IDS ARE DECIMAL STRINGS, NOT NUMBERS. Data-set and piece ids are uint256 on chain and can exceed
14
+ // what a JSON number carries exactly, so every id travels as a string and is never parsed.
15
+ /**
16
+ * Every refusal the order routes can answer, by the name the contract gives it.
17
+ *
18
+ * credits_insufficient · idempotency_conflict · file_credits_cap · day_credits_cap ·
19
+ * heavy_wallet_pay_off · heavy_price_unavailable · unpaid_orders_cap ·
20
+ * heavy_unavailable (opening an order)
21
+ * piece_cid_invalid · piece_size_mismatch · slot_state (placing a slot)
22
+ * not_stored · payment_not_found · payment_mismatch · digest_used (reporting a payment)
23
+ */
24
+ export const HEAVY_REFUSALS = [
25
+ "credits_insufficient",
26
+ "idempotency_conflict",
27
+ "file_credits_cap",
28
+ "day_credits_cap",
29
+ "heavy_wallet_pay_off",
30
+ "heavy_price_unavailable",
31
+ "unpaid_orders_cap",
32
+ "heavy_unavailable",
33
+ "piece_cid_invalid",
34
+ "piece_size_mismatch",
35
+ "slot_state",
36
+ "not_stored",
37
+ "payment_not_found",
38
+ "payment_mismatch",
39
+ "digest_used",
40
+ ];
41
+ /**
42
+ * The credit refusals Standard already has, which the order route may answer with instead of a new
43
+ * code of its own. They mean the same thing to the person, so they read as the same refusal here.
44
+ */
45
+ const SAME_AS = {
46
+ credits_short: "credits_insufficient",
47
+ credit_file_cap: "file_credits_cap",
48
+ credit_daily_cap: "day_credits_cap",
49
+ };
50
+ /**
51
+ * The Heavy refusal an error code names, or `null` when it names none.
52
+ *
53
+ * Letter case is ignored: servers spell error codes in capitals (`CREDITS_INSUFFICIENT`) and the
54
+ * contract writes them in lower case, and both mean one thing.
55
+ */
56
+ export function heavyRefusalOf(code) {
57
+ const lower = code.toLowerCase();
58
+ const direct = HEAVY_REFUSALS.find((r) => r === lower);
59
+ return direct ?? SAME_AS[lower] ?? null;
60
+ }
@@ -98,6 +98,7 @@ async function attempt(open, row) {
98
98
  return await open(row);
99
99
  }
100
100
  catch {
101
+ // Every way the reader throws means the bytes did not arrive, which is `unreadable`.
101
102
  return { ok: false, reason: "unreadable" };
102
103
  }
103
104
  }
@@ -0,0 +1,25 @@
1
+ /** A Filecoin chain NMTS Heavy can run on. */
2
+ export type FilecoinChain = "calibration" | "mainnet";
3
+ /** One storage company NMTS may place a copy with. */
4
+ export interface FilecoinProvider {
5
+ /** The company's id in the chain's service-provider registry. */
6
+ readonly id: bigint;
7
+ /** The host of its storage service (`https://<host>`); uploads and reads go here. */
8
+ readonly host: string;
9
+ /** Who runs it. Two copies of one file never go to the same operator when another exists. */
10
+ readonly operator: string;
11
+ /** Whether the chain's endorsement list names it. The first copy always goes to an endorsed one. */
12
+ readonly endorsed: boolean;
13
+ }
14
+ /** The allowlist, per chain, in preference order. */
15
+ export declare const FILECOIN_PROVIDERS: Readonly<Record<FilecoinChain, readonly FilecoinProvider[]>>;
16
+ /**
17
+ * Which Filecoin chain goes with which NMTS network: test data stays on test networks.
18
+ *
19
+ * Keyed by the NMTS network name ("testnet" | "mainnet") so that this file needs no import.
20
+ */
21
+ export declare const FILECOIN_CHAIN_FOR_NETWORK: Readonly<Record<"testnet" | "mainnet", FilecoinChain>>;
22
+ /** The `https://<host>` origins of one chain's list, in order. */
23
+ export declare function filecoinProviderOrigins(chain: FilecoinChain): string[];
24
+ /** The allowlisted company serving `host` on `chain`, or `null` when the host is not on the list. */
25
+ export declare function providerForHost(chain: FilecoinChain, host: string): FilecoinProvider | null;
@@ -0,0 +1,58 @@
1
+ // The Filecoin storage companies NMTS Heavy may place a file with, per Filecoin chain.
2
+ //
3
+ // ⚠ THIS FILE IS PUBLISHED. It is copied byte-for-byte into the `nmts` command-line package, so
4
+ // its comments stay self-contained English and it imports nothing.
5
+ //
6
+ // WHY A FIXED LIST AND NOT "EVERY APPROVED COMPANY ON CHAIN". A browser may only talk to hosts its
7
+ // Content-Security-Policy names, and the policy is written at build time. Accepting whatever the
8
+ // chain approves at the moment of an upload would mean opening the policy to any host at all. So
9
+ // the candidates are this list; adding one is a code change and a release. The chain's own
10
+ // approved set still applies on top: a company here that the chain no longer approves is skipped.
11
+ //
12
+ // HOW A PAIR IS CHOSEN (the server does it, from this same list): the first copy goes to an
13
+ // endorsed company, the second to a company run by a DIFFERENT operator, so that one operator
14
+ // failing never takes both copies. `operator` exists only to make that comparison.
15
+ //
16
+ // ⛔ THE SERVER KEEPS AN IDENTICAL TABLE. Both sides must agree on every row, or the server places a
17
+ // copy with a company the browser is not allowed to read from. A test compares the two files.
18
+ //
19
+ // Recorded 2026-09-23 on Filecoin Calibration: approved providers 2, 4 and 9; endorsed 4 and 9;
20
+ // 2 and 9 are run by the same operator.
21
+ // Recorded 2026-09-26 on Filecoin mainnet: approved providers 1, 5, 7, 32, 36 and 37; endorsed 1, 5,
22
+ // 7 and 32; 1 and 32 are run by one operator, 36 and 37 by another. Every one answers the browser's
23
+ // cross-origin upload and read requests. A company that stops answering is skipped when a pair is
24
+ // chosen, not removed from this list.
25
+ /** The allowlist, per chain, in preference order. */
26
+ export const FILECOIN_PROVIDERS = {
27
+ calibration: [
28
+ { id: 4n, host: "caliberation-pdp.infrafolio.com", operator: "infrafolio", endorsed: true },
29
+ { id: 9n, host: "calib.ezpdpz.net", operator: "ezpdpz", endorsed: true },
30
+ { id: 2n, host: "calib2.ezpdpz.net", operator: "ezpdpz", endorsed: false },
31
+ ],
32
+ mainnet: [
33
+ { id: 1n, host: "main.ezpdpz.net", operator: "ezpdpz", endorsed: true },
34
+ { id: 5n, host: "pdp.lotus.dedyn.io", operator: "mongo2stor", endorsed: true },
35
+ { id: 7n, host: "mainnet-pdp.infrafolio.com", operator: "infrafolio", endorsed: true },
36
+ { id: 32n, host: "main2.ezpdpz.net", operator: "ezpdpz", endorsed: true },
37
+ { id: 36n, host: "cello.fidl.tech", operator: "fidl", endorsed: false },
38
+ { id: 37n, host: "bass.fidl.tech", operator: "fidl", endorsed: false },
39
+ ],
40
+ };
41
+ /**
42
+ * Which Filecoin chain goes with which NMTS network: test data stays on test networks.
43
+ *
44
+ * Keyed by the NMTS network name ("testnet" | "mainnet") so that this file needs no import.
45
+ */
46
+ export const FILECOIN_CHAIN_FOR_NETWORK = {
47
+ testnet: "calibration",
48
+ mainnet: "mainnet",
49
+ };
50
+ /** The `https://<host>` origins of one chain's list, in order. */
51
+ export function filecoinProviderOrigins(chain) {
52
+ return FILECOIN_PROVIDERS[chain].map((p) => `https://${p.host}`);
53
+ }
54
+ /** The allowlisted company serving `host` on `chain`, or `null` when the host is not on the list. */
55
+ export function providerForHost(chain, host) {
56
+ const wanted = host.toLowerCase();
57
+ return FILECOIN_PROVIDERS[chain].find((p) => p.host === wanted) ?? null;
58
+ }
@@ -0,0 +1,48 @@
1
+ import type { HeavyCopy } from "../api/types-heavy.ts";
2
+ import { type FilecoinChain } from "../filecoin/providers.ts";
3
+ /** Inclusive start, exclusive end — the same shape the Walrus reads use. */
4
+ export interface HeavyByteRange {
5
+ start: number;
6
+ end?: number;
7
+ }
8
+ /** Why one copy was not used. */
9
+ export type HeavyCopySkip = "not_https" | "host_not_allowed" | "not_found" | "http_error" | "network_error";
10
+ export interface HeavyCopyAttempt {
11
+ providerId: string;
12
+ reason: HeavyCopySkip;
13
+ /** The HTTP status, when an answer was the reason. */
14
+ status?: number;
15
+ }
16
+ /**
17
+ * Every copy failed. `notFound` is true only when every company actually asked answered 404 — one
18
+ * that was down or erred may still hold the piece, which is the same rule the Walrus reads keep.
19
+ */
20
+ export declare class HeavyDownloadError extends Error {
21
+ readonly pieceCid: string;
22
+ readonly attempts: readonly HeavyCopyAttempt[];
23
+ readonly notFound: boolean;
24
+ constructor(pieceCid: string, attempts: readonly HeavyCopyAttempt[]);
25
+ }
26
+ export interface FetchHeavyPartInput {
27
+ /** The part's PieceCID — its `blob_id`. Used in messages only; each copy's address already names it. */
28
+ pieceCid: string;
29
+ /** The copies, in the order to try them. */
30
+ copies: readonly HeavyCopy[];
31
+ /** Which chain's allowlist the companies must be on. */
32
+ chain: FilecoinChain;
33
+ range?: HeavyByteRange;
34
+ signal?: AbortSignal;
35
+ /** Ask https companies outside the allowlist too (a program with no browser security policy). */
36
+ allowUnlisted?: boolean;
37
+ /** Default: the global `fetch`. */
38
+ fetchImpl?: (input: string, init?: RequestInit) => Promise<Response>;
39
+ }
40
+ /**
41
+ * Open a streaming read of one Heavy part from the first copy that serves it.
42
+ *
43
+ * Resolves with the response (status 200, or 206 for a range) whose body is the sealed part;
44
+ * rejects with `HeavyDownloadError` when no copy serves it, or with the AbortError of `signal`.
45
+ * A company that ignores `Range` and answers 200 with the whole part is accepted — the caller reads
46
+ * only what it needs and cancels the rest.
47
+ */
48
+ export declare function fetchHeavyPart(input: FetchHeavyPartInput): Promise<Response>;
@@ -0,0 +1,116 @@
1
+ // Read one NMTS Heavy part back from the storage companies that keep its copies.
2
+ //
3
+ // ⚠ THIS FILE IS PUBLISHED. It is copied byte-for-byte into the `nmts` command-line package.
4
+ // Keep the comments self-contained English, with no pointer only we can follow.
5
+ //
6
+ // Each copy names a public address, `https://<company>/piece/<PieceCID>` — no credentials, open CORS,
7
+ // byte ranges allowed. The copies are asked in order; the first that answers with the bytes is used,
8
+ // and any failure moves on to the next one.
9
+ //
10
+ // ⛔ ONLY ALLOWLISTED COMPANIES, ONLY HTTPS. An address comes from our server, and a browser page may
11
+ // only talk to hosts its security policy names — so a copy at a company outside the allowlist for
12
+ // this chain is skipped with a reason rather than asked (the request would be blocked anyway, as a
13
+ // bare "Failed to fetch"). A program with no such policy may pass `allowUnlisted` to ask any https
14
+ // company — somebody paying from their own wallet may have picked one the list does not name.
15
+ //
16
+ // ⛔ THE BYTES ARE NOT CHECKED HERE. They are an end-to-end sealed stream, and opening it is the check:
17
+ // a wrong or altered byte fails authentication when it is decrypted. Recomputing the PieceCID would
18
+ // cost a full hash of the part and tell us nothing the decryption does not.
19
+ import { providerForHost } from "../filecoin/providers.js";
20
+ /**
21
+ * Every copy failed. `notFound` is true only when every company actually asked answered 404 — one
22
+ * that was down or erred may still hold the piece, which is the same rule the Walrus reads keep.
23
+ */
24
+ export class HeavyDownloadError extends Error {
25
+ pieceCid;
26
+ attempts;
27
+ notFound;
28
+ constructor(pieceCid, attempts) {
29
+ const asked = attempts.filter((a) => a.reason !== "not_https" && a.reason !== "host_not_allowed");
30
+ const notFound = asked.length > 0 && asked.every((a) => a.reason === "not_found");
31
+ super(attempts.length === 0
32
+ ? `Piece ${pieceCid} has no recorded copies to read.`
33
+ : `No copy of piece ${pieceCid} could be read: ` +
34
+ attempts.map((a) => `${a.providerId} ${a.reason}${a.status ? ` ${a.status}` : ""}`).join(" | "));
35
+ // Two names, so a reader that sorts failures by name can tell "gone" from "unreachable".
36
+ this.name = notFound ? "HeavyPieceNotFoundError" : "HeavyDownloadError";
37
+ this.pieceCid = pieceCid;
38
+ this.attempts = attempts;
39
+ this.notFound = notFound;
40
+ }
41
+ }
42
+ /** Build the HTTP `Range` value from an exclusive-end range, or `null` for the whole part. */
43
+ function rangeHeader(range) {
44
+ if (range === undefined)
45
+ return null;
46
+ const { start, end } = range;
47
+ if (!Number.isSafeInteger(start) || start < 0)
48
+ throw new RangeError(`Invalid range start ${start}.`);
49
+ if (end === undefined)
50
+ return `bytes=${start}-`;
51
+ if (!Number.isSafeInteger(end) || end <= start)
52
+ throw new RangeError(`Invalid range end ${end}.`);
53
+ return `bytes=${start}-${end - 1}`;
54
+ }
55
+ /** Why this copy may not be asked at all, or `null` when it may. */
56
+ function refusalFor(copy, chain, allowUnlisted) {
57
+ let url;
58
+ try {
59
+ url = new URL(copy.retrieval_url);
60
+ }
61
+ catch {
62
+ // An address that does not parse is refused the same way as one that is not https.
63
+ return "not_https";
64
+ }
65
+ if (url.protocol !== "https:")
66
+ return "not_https";
67
+ if (!allowUnlisted && providerForHost(chain, url.hostname) === null)
68
+ return "host_not_allowed";
69
+ return null;
70
+ }
71
+ /**
72
+ * Open a streaming read of one Heavy part from the first copy that serves it.
73
+ *
74
+ * Resolves with the response (status 200, or 206 for a range) whose body is the sealed part;
75
+ * rejects with `HeavyDownloadError` when no copy serves it, or with the AbortError of `signal`.
76
+ * A company that ignores `Range` and answers 200 with the whole part is accepted — the caller reads
77
+ * only what it needs and cancels the rest.
78
+ */
79
+ export async function fetchHeavyPart(input) {
80
+ const fetchImpl = input.fetchImpl ?? ((url, init) => fetch(url, init));
81
+ const range = rangeHeader(input.range);
82
+ const attempts = [];
83
+ for (const copy of input.copies) {
84
+ if (input.signal?.aborted)
85
+ throw new DOMException("The operation was aborted.", "AbortError");
86
+ const refused = refusalFor(copy, input.chain, input.allowUnlisted === true);
87
+ if (refused !== null) {
88
+ attempts.push({ providerId: copy.provider_id, reason: refused });
89
+ continue;
90
+ }
91
+ let res;
92
+ try {
93
+ res = await fetchImpl(copy.retrieval_url, {
94
+ method: "GET",
95
+ ...(range === null ? {} : { headers: { Range: range } }),
96
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
97
+ });
98
+ }
99
+ catch (err) {
100
+ if (input.signal?.aborted)
101
+ throw err;
102
+ attempts.push({ providerId: copy.provider_id, reason: "network_error" });
103
+ continue;
104
+ }
105
+ if ((res.status === 200 || res.status === 206) && res.body !== null)
106
+ return res;
107
+ attempts.push({
108
+ providerId: copy.provider_id,
109
+ reason: res.status === 404 ? "not_found" : "http_error",
110
+ status: res.status,
111
+ });
112
+ // This answer is not going to be read; free the connection before asking the next company.
113
+ await res.body?.cancel().catch(() => undefined); // a failed cancel changes nothing we do next
114
+ }
115
+ throw new HeavyDownloadError(input.pieceCid, attempts);
116
+ }
@@ -0,0 +1,77 @@
1
+ import type { HeavyPay, HeavyPrice, HeavySlotRequest } from "../api/types-heavy.ts";
2
+ /**
3
+ * How much plaintext one Heavy part carries at most: 512 MiB.
4
+ *
5
+ * WHY THIS NUMBER. A storage company takes at most 1,065,353,216 bytes in one piece. A 512 MiB part
6
+ * seals to 512 MiB plus about 2 KiB (a 72-byte header and a 16-byte tag per 4 MiB chunk), and size
7
+ * padding never grows a part past its own power of two, so a full part stays near half the limit
8
+ * whatever padding is chosen. It is also what a browser tab can hold comfortably while it hashes the
9
+ * part and sends it.
10
+ */
11
+ export declare const HEAVY_PART_SIZE_BYTES: number;
12
+ /** A sealed part may be no smaller than this (a Filecoin piece's minimum)… */
13
+ export declare const HEAVY_PIECE_MIN_BYTES = 127;
14
+ /** …and no larger than this (the storage companies' limit per piece). */
15
+ export declare const HEAVY_PIECE_MAX_BYTES = 1065353216;
16
+ /**
17
+ * The least plaintext that seals to a legal piece: 127 − the 72-byte header − one 16-byte tag. A
18
+ * part shorter than this is padded (the same size padding the format already has) before sealing.
19
+ */
20
+ export declare const HEAVY_MIN_SEAL_FROM_BYTES: number;
21
+ /** Slots one order may hold. */
22
+ export declare const HEAVY_MAX_SLOTS = 256;
23
+ /** One part of one file, before sealing. */
24
+ export interface HeavyRunPart {
25
+ /** Its position in its file (0-based). */
26
+ partIndex: number;
27
+ /** The exact size it will seal to — the order is opened with this before anything is sealed. */
28
+ sealedLen: number;
29
+ }
30
+ /** One file of the upload. */
31
+ export interface HeavyRunFile {
32
+ /** The caller's own name for the file; it comes back on the result unchanged. */
33
+ key: string;
34
+ parts: readonly HeavyRunPart[];
35
+ }
36
+ /** How the upload is paid. */
37
+ export type HeavyPayment = {
38
+ pay: "credits";
39
+ } | {
40
+ pay: "wallet";
41
+ /** `0x` + 64 hex — the Sui address that will send the WAL. */
42
+ payer: string;
43
+ /** 1..=365 days. */
44
+ termDays: number;
45
+ /** Send `price.wal_frost` FROST to `price.treasury`; resolve with the Sui transaction digest. */
46
+ payWallet: (price: HeavyPrice, orderId: string) => Promise<string>;
47
+ };
48
+ /** One slot of the order: which part of which file it carries. */
49
+ export interface SlotPlan {
50
+ slot: number;
51
+ fileIndex: number;
52
+ fileKey: string;
53
+ partIndex: number;
54
+ sealedLen: number;
55
+ }
56
+ /**
57
+ * Number the slots across the files (file by file, part by part), and refuse any part an order
58
+ * could never take — before anything is opened, sealed or charged.
59
+ */
60
+ export declare function planSlots(files: readonly HeavyRunFile[]): SlotPlan[];
61
+ /** The `POST /v1/heavy/orders` body for an upload — exactly what `runHeavyOrder` sends. */
62
+ export interface HeavyOrderRequestBody {
63
+ idempotency_key: string;
64
+ slots: HeavySlotRequest[];
65
+ pay: HeavyPay;
66
+ term_days?: number;
67
+ payer?: string;
68
+ }
69
+ /**
70
+ * Build the order request for an upload.
71
+ *
72
+ * Exposed so a screen can open the order early — a wallet order's answer carries the price to show
73
+ * — and then run the upload under the SAME idempotency key, which reaches the same order again.
74
+ * ⚠ A different body under the same key is refused (`idempotency_conflict`): if the person changes
75
+ * the term, make a new key.
76
+ */
77
+ export declare function heavyOrderRequest(files: readonly HeavyRunFile[], payment: HeavyPayment, idempotencyKey: string): HeavyOrderRequestBody;
@@ -0,0 +1,83 @@
1
+ // The sizes an NMTS Heavy part may have, and how an upload's parts become one order's slots.
2
+ //
3
+ // ⚠ THIS FILE IS PUBLISHED. It is copied byte-for-byte into the `nmts` command-line package.
4
+ // Keep the comments self-contained English, with no pointer only we can follow.
5
+ import { HeavyOrderError } from "./order-wire.js";
6
+ /**
7
+ * How much plaintext one Heavy part carries at most: 512 MiB.
8
+ *
9
+ * WHY THIS NUMBER. A storage company takes at most 1,065,353,216 bytes in one piece. A 512 MiB part
10
+ * seals to 512 MiB plus about 2 KiB (a 72-byte header and a 16-byte tag per 4 MiB chunk), and size
11
+ * padding never grows a part past its own power of two, so a full part stays near half the limit
12
+ * whatever padding is chosen. It is also what a browser tab can hold comfortably while it hashes the
13
+ * part and sends it.
14
+ */
15
+ export const HEAVY_PART_SIZE_BYTES = 512 * 1024 * 1024;
16
+ /** A sealed part may be no smaller than this (a Filecoin piece's minimum)… */
17
+ export const HEAVY_PIECE_MIN_BYTES = 127;
18
+ /** …and no larger than this (the storage companies' limit per piece). */
19
+ export const HEAVY_PIECE_MAX_BYTES = 1_065_353_216;
20
+ /**
21
+ * The least plaintext that seals to a legal piece: 127 − the 72-byte header − one 16-byte tag. A
22
+ * part shorter than this is padded (the same size padding the format already has) before sealing.
23
+ */
24
+ export const HEAVY_MIN_SEAL_FROM_BYTES = HEAVY_PIECE_MIN_BYTES - 72 - 16;
25
+ /** Slots one order may hold. */
26
+ export const HEAVY_MAX_SLOTS = 256;
27
+ /**
28
+ * Number the slots across the files (file by file, part by part), and refuse any part an order
29
+ * could never take — before anything is opened, sealed or charged.
30
+ */
31
+ export function planSlots(files) {
32
+ const plans = [];
33
+ files.forEach((file, fileIndex) => {
34
+ const parts = [...file.parts].sort((a, b) => a.partIndex - b.partIndex);
35
+ if (parts.length === 0) {
36
+ throw new HeavyOrderError("slot_count", `File "${file.key}" has no parts.`);
37
+ }
38
+ parts.forEach((part, position) => {
39
+ if (part.partIndex !== position) {
40
+ throw new HeavyOrderError("slot_count", `File "${file.key}" has no part ${position}; its parts must be numbered 0..n-1.`);
41
+ }
42
+ if (!Number.isSafeInteger(part.sealedLen) || part.sealedLen < HEAVY_PIECE_MIN_BYTES) {
43
+ throw new HeavyOrderError("piece_too_small", `Part ${part.partIndex} of "${file.key}" seals to ${part.sealedLen} bytes; a piece needs ` +
44
+ `${HEAVY_PIECE_MIN_BYTES}. Pad it to at least ${HEAVY_MIN_SEAL_FROM_BYTES} bytes of plaintext.`);
45
+ }
46
+ if (part.sealedLen > HEAVY_PIECE_MAX_BYTES) {
47
+ throw new HeavyOrderError("piece_too_large", `Part ${part.partIndex} of "${file.key}" seals to ${part.sealedLen} bytes; a piece holds ` +
48
+ `at most ${HEAVY_PIECE_MAX_BYTES}.`);
49
+ }
50
+ plans.push({
51
+ slot: plans.length,
52
+ fileIndex,
53
+ fileKey: file.key,
54
+ partIndex: part.partIndex,
55
+ sealedLen: part.sealedLen,
56
+ });
57
+ });
58
+ });
59
+ if (plans.length === 0 || plans.length > HEAVY_MAX_SLOTS) {
60
+ throw new HeavyOrderError("slot_count", `An order holds 1..${HEAVY_MAX_SLOTS} parts; this upload has ${plans.length}.`);
61
+ }
62
+ return plans;
63
+ }
64
+ /**
65
+ * Build the order request for an upload.
66
+ *
67
+ * Exposed so a screen can open the order early — a wallet order's answer carries the price to show
68
+ * — and then run the upload under the SAME idempotency key, which reaches the same order again.
69
+ * ⚠ A different body under the same key is refused (`idempotency_conflict`): if the person changes
70
+ * the term, make a new key.
71
+ */
72
+ export function heavyOrderRequest(files, payment, idempotencyKey) {
73
+ const slots = planSlots(files).map((p) => ({ slot: p.slot, sealed_len: p.sealedLen }));
74
+ return payment.pay === "credits"
75
+ ? { idempotency_key: idempotencyKey, slots, pay: "credits" }
76
+ : {
77
+ idempotency_key: idempotencyKey,
78
+ slots,
79
+ pay: "wallet",
80
+ term_days: payment.termDays,
81
+ payer: payment.payer,
82
+ };
83
+ }
@@ -0,0 +1,9 @@
1
+ import type { HeavyRunDeps, HeavyRunOptions, HeavyRunResult } from "./order-types.ts";
2
+ export { HEAVY_MAX_SLOTS, HEAVY_MIN_SEAL_FROM_BYTES, HEAVY_PART_SIZE_BYTES, HEAVY_PIECE_MAX_BYTES, HEAVY_PIECE_MIN_BYTES, heavyOrderRequest, type HeavyOrderRequestBody, type HeavyPayment, type HeavyRunFile, type HeavyRunPart, } from "./order-plan.ts";
3
+ export { HeavyOrderError, type HeavyFailure } from "./order-wire.ts";
4
+ export type { HeavyProgress, HeavyRunDeps, HeavyRunOptions, HeavyRunResult, HeavySealJob, SealedBytes, } from "./order-types.ts";
5
+ /**
6
+ * Run one Heavy upload to the end. Resolves with the parts to commit; rejects with a
7
+ * `HeavyOrderError`, or with an AbortError when `options.signal` aborts.
8
+ */
9
+ export declare function runHeavyOrder(options: HeavyRunOptions, deps: HeavyRunDeps): Promise<HeavyRunResult>;