@shelby-protocol/sdk 0.3.0 → 0.4.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 (126) hide show
  1. package/dist/browser/index.d.ts +19 -10
  2. package/dist/browser/index.mjs +4200 -146
  3. package/dist/core/aptos-explorer.mjs +46 -5
  4. package/dist/core/blobs.mjs +12 -4
  5. package/dist/core/chunk.mjs +58 -9
  6. package/dist/core/clients/ShelbyBlobClient.d.ts +155 -83
  7. package/dist/core/clients/ShelbyBlobClient.mjs +1286 -17
  8. package/dist/core/clients/ShelbyClient.d.ts +39 -6
  9. package/dist/core/clients/ShelbyClient.mjs +3233 -23
  10. package/dist/core/clients/ShelbyClientConfig.d.ts +9 -1
  11. package/dist/core/clients/ShelbyClientConfig.mjs +0 -1
  12. package/dist/core/clients/ShelbyMetadataClient.d.ts +20 -6
  13. package/dist/core/clients/ShelbyMetadataClient.mjs +388 -6
  14. package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +7 -7
  15. package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +894 -13
  16. package/dist/core/clients/ShelbyPlacementGroupClient.mjs +310 -8
  17. package/dist/core/clients/ShelbyRPCClient.d.ts +117 -25
  18. package/dist/core/clients/ShelbyRPCClient.mjs +1245 -12
  19. package/dist/core/clients/index.d.ts +4 -2
  20. package/dist/core/clients/index.mjs +3802 -39
  21. package/dist/core/clients/utils.mjs +65 -6
  22. package/dist/core/commitments.d.ts +12 -1
  23. package/dist/core/commitments.mjs +277 -11
  24. package/dist/core/constants.d.ts +3 -3
  25. package/dist/core/constants.mjs +39 -16
  26. package/dist/core/erasure/clay-codes.mjs +129 -4
  27. package/dist/core/erasure/constants.d.ts +16 -1
  28. package/dist/core/erasure/constants.mjs +48 -11
  29. package/dist/core/erasure/default.mjs +191 -9
  30. package/dist/core/erasure/index.d.ts +1 -1
  31. package/dist/core/erasure/index.mjs +281 -24
  32. package/dist/core/erasure/reed-solomon.mjs +68 -4
  33. package/dist/core/erasure/utils.mjs +0 -2
  34. package/dist/core/errors.d.ts +20 -1
  35. package/dist/core/errors.mjs +58 -8
  36. package/dist/core/index.d.ts +9 -9
  37. package/dist/core/index.mjs +4194 -146
  38. package/dist/core/layout.mjs +37 -5
  39. package/dist/core/networks.mjs +10 -5
  40. package/dist/core/operations/generated/sdk.d.ts +807 -42
  41. package/dist/core/operations/generated/sdk.mjs +267 -18
  42. package/dist/core/operations/index.d.ts +1 -1
  43. package/dist/core/operations/index.mjs +368 -24
  44. package/dist/core/promises.mjs +4 -4
  45. package/dist/core/rpc-responses.d.ts +1 -57
  46. package/dist/core/rpc-responses.mjs +14 -15
  47. package/dist/core/shelby-explorer.mjs +31 -6
  48. package/dist/core/sp/chunk_proof.d.ts +23 -0
  49. package/dist/core/sp/chunk_proof.mjs +113 -0
  50. package/dist/core/sp/index.d.ts +3 -0
  51. package/dist/core/sp/index.mjs +402 -0
  52. package/dist/core/sp/sp_write_client.d.ts +53 -0
  53. package/dist/core/sp/sp_write_client.mjs +302 -0
  54. package/dist/core/strings.mjs +0 -2
  55. package/dist/core/types/blobs.d.ts +24 -5
  56. package/dist/core/types/blobs.mjs +24 -1
  57. package/dist/core/types/index.d.ts +2 -2
  58. package/dist/core/types/index.mjs +275 -10
  59. package/dist/core/types/payments.d.ts +6 -6
  60. package/dist/core/types/payments.mjs +230 -5
  61. package/dist/core/types/placement_groups.mjs +0 -1
  62. package/dist/core/types/storage_providers.d.ts +32 -6
  63. package/dist/core/types/storage_providers.mjs +22 -1
  64. package/dist/core/utils.mjs +94 -8
  65. package/dist/gen/rpc_server_pb.d.ts +295 -0
  66. package/dist/gen/rpc_server_pb.mjs +28 -0
  67. package/dist/node/clients/ShelbyNodeClient.d.ts +2 -0
  68. package/dist/node/clients/ShelbyNodeClient.mjs +3237 -24
  69. package/dist/node/clients/index.d.ts +2 -0
  70. package/dist/node/clients/index.mjs +3236 -26
  71. package/dist/node/index.d.ts +9 -9
  72. package/dist/node/index.mjs +4217 -153
  73. package/dist/node/parallel/commitment_worker.d.ts +9 -0
  74. package/dist/node/parallel/commitment_worker.mjs +85 -0
  75. package/dist/node/parallel/commitment_worker_pool.d.ts +35 -0
  76. package/dist/node/parallel/commitment_worker_pool.mjs +339 -0
  77. package/dist/node/parallel/coverage_flush.d.ts +16 -0
  78. package/dist/node/parallel/coverage_flush.mjs +43 -0
  79. package/dist/node/parallel/default_commitment_worker_pool.d.ts +24 -0
  80. package/dist/node/parallel/default_commitment_worker_pool.mjs +355 -0
  81. package/dist/node/parallel/index.d.ts +12 -0
  82. package/dist/node/parallel/index.mjs +631 -0
  83. package/dist/node/parallel/parallel_commitments.d.ts +32 -0
  84. package/dist/node/parallel/parallel_commitments.mjs +614 -0
  85. package/dist/node/parallel/worker_pool.d.ts +74 -0
  86. package/dist/node/parallel/worker_pool.mjs +301 -0
  87. package/dist/node/testUtil.mjs +8 -4
  88. package/package.json +16 -5
  89. package/dist/chunk-3NRBHSMQ.mjs +0 -12
  90. package/dist/chunk-5BVSWXQJ.mjs +0 -801
  91. package/dist/chunk-6FJNAUU5.mjs +0 -278
  92. package/dist/chunk-6XSZRDLJ.mjs +0 -375
  93. package/dist/chunk-7P6ASYW6.mjs +0 -9
  94. package/dist/chunk-A4IG6GSE.mjs +0 -21
  95. package/dist/chunk-AD2G3QYD.mjs +0 -0
  96. package/dist/chunk-AUQDI5BS.mjs +0 -43
  97. package/dist/chunk-AY3HBWXA.mjs +0 -51
  98. package/dist/chunk-BDSW5PHM.mjs +0 -37
  99. package/dist/chunk-C6RQ3AEU.mjs +0 -51
  100. package/dist/chunk-CQ6QPIZK.mjs +0 -37
  101. package/dist/chunk-D6GQHO6G.mjs +0 -15
  102. package/dist/chunk-EM67QTMR.mjs +0 -0
  103. package/dist/chunk-I6NG5GNL.mjs +0 -8
  104. package/dist/chunk-JTXYKO3U.mjs +0 -38
  105. package/dist/chunk-KG2TMLEV.mjs +0 -207
  106. package/dist/chunk-M3CP5TFP.mjs +0 -39
  107. package/dist/chunk-M7W43K2Q.mjs +0 -505
  108. package/dist/chunk-MB7C7VQF.mjs +0 -0
  109. package/dist/chunk-MNCQBEMS.mjs +0 -55
  110. package/dist/chunk-MQUVYMNQ.mjs +0 -0
  111. package/dist/chunk-NEO7Z3ZQ.mjs +0 -49
  112. package/dist/chunk-NHWWORCH.mjs +0 -72
  113. package/dist/chunk-OEK24ON7.mjs +0 -135
  114. package/dist/chunk-QQ57OGQ2.mjs +0 -0
  115. package/dist/chunk-RNNJXTX2.mjs +0 -154
  116. package/dist/chunk-S6Q4OG7H.mjs +0 -83
  117. package/dist/chunk-TET3DJEO.mjs +0 -199
  118. package/dist/chunk-UEZNZBJO.mjs +0 -104
  119. package/dist/chunk-V46D5NBW.mjs +0 -11
  120. package/dist/chunk-V4B3GAMQ.mjs +0 -42
  121. package/dist/chunk-WFWRBNTW.mjs +0 -412
  122. package/dist/chunk-WTICJPDB.mjs +0 -0
  123. package/dist/chunk-XNEIWM4O.mjs +0 -0
  124. package/dist/chunk-Z4FZ7W6L.mjs +0 -39
  125. package/dist/chunk-Z7RFCADT.mjs +0 -0
  126. package/dist/chunk-ZHXCVRZX.mjs +0 -0
@@ -5,9 +5,9 @@ import { BlobName } from '../layout.js';
5
5
  import { WriteBlobCommitmentsOptions, ShelbyBlobClient } from './ShelbyBlobClient.js';
6
6
  import { ShelbyClientConfig } from './ShelbyClientConfig.js';
7
7
  import { ShelbyMetadataClient } from './ShelbyMetadataClient.js';
8
- import { ShelbyRPCClient } from './ShelbyRPCClient.js';
9
- import '@shelby-protocol/clay-codes';
8
+ import { ShelbyRPCClient, BlobOwnerAuth } from './ShelbyRPCClient.js';
10
9
  import 'zod';
10
+ import '@shelby-protocol/clay-codes';
11
11
  import '../types/blobs.js';
12
12
  import '../operations/index.js';
13
13
  import 'graphql-request';
@@ -15,6 +15,8 @@ import '../operations/generated/sdk.js';
15
15
  import 'graphql';
16
16
  import '../networks.js';
17
17
  import '../types/storage_providers.js';
18
+ import '../commitments.js';
19
+ import '../rpc-responses.js';
18
20
  import '../types/payments.js';
19
21
 
20
22
  type UploadOptions = WriteBlobCommitmentsOptions;
@@ -76,11 +78,42 @@ declare class ShelbyClient {
76
78
  * ```
77
79
  */
78
80
  constructor(config: ShelbyClientConfig, provider?: ErasureCodingProvider);
81
+ /**
82
+ * Sign an authentication challenge for blob owner verification.
83
+ *
84
+ * The default implementation delegates to `ShelbyRPCClient.signChallenge`
85
+ * which works for standard Ed25519 accounts. Kits that use derived /
86
+ * abstracted accounts (Solana, Ethereum) should override this method to
87
+ * provide the correct public key bytes and derivation metadata.
88
+ */
89
+ protected signChallenge(account: Account, challenge: string): BlobOwnerAuth;
79
90
  /**
80
91
  * Get the erasure coding provider, creating it if necessary.
81
92
  * This allows lazy initialization for users who don't provide a provider.
82
93
  */
83
94
  private getProvider;
95
+ /**
96
+ * Build orderless transaction options (a random replay-protection nonce) for
97
+ * the per-blob commit transactions. batchUpload finalizes blobs
98
+ * concurrently, so without orderless replay protection the parallel
99
+ * same-account submissions collide on the sequence number ("transaction
100
+ * already in mempool with a different payload"). The nonce makes each commit
101
+ * independent regardless of the client's `orderless` config flag.
102
+ */
103
+ private orderlessCommitOptions;
104
+ /**
105
+ * Resolve the on-chain UID assigned to `blobName` from a committed register
106
+ * transaction. `register_blob` only publishes the uid -> name mapping via
107
+ * `BlobRegisteredEvent` (a pending blob is not yet in the `objects` map, so it
108
+ * cannot be read back by name), so the upload flow must parse it here before
109
+ * uploading bytes or committing.
110
+ */
111
+ private uidFromRegisterTx;
112
+ /**
113
+ * Await a blob-registration transaction, rephrasing on-chain location
114
+ * failures into a human-readable message.
115
+ */
116
+ private waitForRegistration;
84
117
  /**
85
118
  * The base URL for the Shelby RPC node.
86
119
  */
@@ -92,8 +125,8 @@ declare class ShelbyClient {
92
125
  *
93
126
  * Note: This method accepts only `Uint8Array` and buffers the entire blob in memory.
94
127
  * For streaming uploads of large files (e.g. >2 GiB), orchestrate the steps manually
95
- * using `generateCommitments()`, `coordination.registerBlob()`, and `rpc.putBlob()`
96
- * with a `ReadableStream`.
128
+ * using `generateCommitments()`, `coordination.registerBlob()`, `rpc.putBlobChunksets()`,
129
+ * and `coordination.commitObject()` with a `ReadableStream`.
97
130
  *
98
131
  * @param params.blobData - The raw data to upload as a Uint8Array.
99
132
  * @param params.signer - The account that signs and pays for the transaction.
@@ -129,8 +162,8 @@ declare class ShelbyClient {
129
162
  *
130
163
  * Note: This method accepts only `Uint8Array` and buffers each blob in memory.
131
164
  * For streaming uploads of large files, orchestrate the steps manually using
132
- * `generateCommitments()`, `coordination.registerBlob()`, and `rpc.putBlob()`
133
- * with a `ReadableStream`.
165
+ * `generateCommitments()`, `coordination.registerBlob()`, `rpc.putBlobChunksets()`,
166
+ * and `coordination.commitObject()` with a `ReadableStream`.
134
167
  *
135
168
  * @param params.blobs - The blobs to upload.
136
169
  * @param params.blobs.blobData - The raw data to upload as a Uint8Array.