@shelby-protocol/sdk 0.0.9 → 0.2.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 (99) hide show
  1. package/dist/browser/index.d.ts +17 -10
  2. package/dist/browser/index.mjs +89 -28
  3. package/dist/{chunk-XWAPNLU6.mjs → chunk-2WEX3K7C.mjs} +6 -4
  4. package/dist/chunk-4MG4XGY4.mjs +91 -0
  5. package/dist/{chunk-SEXQTDX6.mjs → chunk-4ZOFT75Q.mjs} +16 -2
  6. package/dist/{chunk-BTHSKDJR.mjs → chunk-7PN65RDX.mjs} +44 -10
  7. package/dist/chunk-AABBONAF.mjs +34 -0
  8. package/dist/{chunk-ZPW742E7.mjs → chunk-AUQDI5BS.mjs} +17 -2
  9. package/dist/{chunk-HFGEQP5N.mjs → chunk-CGYJLKBU.mjs} +4 -4
  10. package/dist/chunk-CQ6QPIZK.mjs +37 -0
  11. package/dist/{chunk-VRLIOKWG.mjs → chunk-D6GQHO6G.mjs} +5 -1
  12. package/dist/chunk-E5QCRTBU.mjs +493 -0
  13. package/dist/chunk-HPPMI7DC.mjs +56 -0
  14. package/dist/chunk-IE6LYVIA.mjs +26 -0
  15. package/dist/{chunk-67F5YZ25.mjs → chunk-JTXYKO3U.mjs} +10 -0
  16. package/dist/{chunk-WJKSPJSS.mjs → chunk-KJ24NKPH.mjs} +46 -0
  17. package/dist/{chunk-WBFEX7OM.mjs → chunk-MV6FNYAU.mjs} +31 -7
  18. package/dist/{chunk-PZF2VTGP.mjs → chunk-NHWWORCH.mjs} +3 -1
  19. package/dist/{chunk-NLPIHQ7K.mjs → chunk-OGKZ575S.mjs} +6 -19
  20. package/dist/{chunk-5I3MBJGN.mjs → chunk-PJVWGMVI.mjs} +164 -35
  21. package/dist/{chunk-7UVMDCCR.mjs → chunk-SRV4YWFH.mjs} +232 -47
  22. package/dist/chunk-W37FZSMA.mjs +83 -0
  23. package/dist/chunk-WTICJPDB.mjs +0 -0
  24. package/dist/chunk-Z4FZ7W6L.mjs +39 -0
  25. package/dist/{chunk-QFWQ7FIC.mjs → chunk-ZEDD2MPU.mjs} +1 -1
  26. package/dist/{clay-codes-pdZFxI_B.d.ts → clay-codes-DHP-bYcP.d.ts} +6 -2
  27. package/dist/core/blobs.d.ts +2 -0
  28. package/dist/core/chunk.d.ts +10 -1
  29. package/dist/core/chunk.mjs +2 -2
  30. package/dist/core/clients/ShelbyBlobClient.d.ts +165 -12
  31. package/dist/core/clients/ShelbyBlobClient.mjs +13 -11
  32. package/dist/core/clients/ShelbyClient.d.ts +21 -4
  33. package/dist/core/clients/ShelbyClient.mjs +17 -14
  34. package/dist/core/clients/ShelbyClientConfig.d.ts +7 -2
  35. package/dist/{node → core}/clients/ShelbyMetadataClient.d.ts +3 -3
  36. package/dist/core/clients/ShelbyMetadataClient.mjs +9 -0
  37. package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +349 -0
  38. package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +16 -0
  39. package/dist/core/clients/ShelbyPlacementGroupClient.d.ts +73 -0
  40. package/dist/core/clients/ShelbyPlacementGroupClient.mjs +11 -0
  41. package/dist/core/clients/ShelbyRPCClient.d.ts +30 -4
  42. package/dist/core/clients/ShelbyRPCClient.mjs +8 -8
  43. package/dist/core/clients/index.d.ts +11 -5
  44. package/dist/core/clients/index.mjs +35 -15
  45. package/dist/core/clients/utils.d.ts +54 -0
  46. package/dist/core/clients/utils.mjs +1 -1
  47. package/dist/core/commitments.d.ts +6 -2
  48. package/dist/core/commitments.mjs +5 -3
  49. package/dist/core/constants.d.ts +18 -3
  50. package/dist/core/constants.mjs +5 -1
  51. package/dist/core/erasure/clay-codes.d.ts +1 -1
  52. package/dist/core/erasure/clay-codes.mjs +5 -5
  53. package/dist/core/erasure/constants.d.ts +15 -3
  54. package/dist/core/erasure/constants.mjs +3 -1
  55. package/dist/core/erasure/default.d.ts +5 -2
  56. package/dist/core/erasure/default.mjs +12 -6
  57. package/dist/core/erasure/index.d.ts +3 -3
  58. package/dist/core/erasure/index.mjs +15 -7
  59. package/dist/core/erasure/provider.d.ts +1 -1
  60. package/dist/core/erasure/reed-solomon.d.ts +1 -1
  61. package/dist/core/erasure/reed-solomon.mjs +1 -1
  62. package/dist/core/erasure/utils.d.ts +1 -1
  63. package/dist/core/errors.d.ts +58 -0
  64. package/dist/core/errors.mjs +15 -0
  65. package/dist/core/index.d.ts +17 -10
  66. package/dist/core/index.mjs +89 -28
  67. package/dist/core/layout.d.ts +5 -16
  68. package/dist/core/layout.mjs +3 -9
  69. package/dist/core/networks.d.ts +1 -1
  70. package/dist/core/networks.mjs +1 -1
  71. package/dist/core/operations/generated/sdk.d.ts +207 -17
  72. package/dist/core/operations/generated/sdk.mjs +7 -1
  73. package/dist/core/operations/index.d.ts +9 -3
  74. package/dist/core/operations/index.mjs +10 -4
  75. package/dist/core/rpc-responses.d.ts +69 -0
  76. package/dist/core/rpc-responses.mjs +15 -0
  77. package/dist/core/types/blobs.d.ts +8 -4
  78. package/dist/core/types/encodings.d.ts +1 -1
  79. package/dist/core/types/index.d.ts +4 -2
  80. package/dist/core/types/index.mjs +12 -2
  81. package/dist/core/types/payments.d.ts +94 -0
  82. package/dist/core/types/payments.mjs +9 -0
  83. package/dist/core/types/placement_groups.d.ts +30 -1
  84. package/dist/core/types/placement_groups.mjs +1 -0
  85. package/dist/core/types/storage_providers.d.ts +32 -2
  86. package/dist/node/clients/ShelbyNodeClient.d.ts +9 -6
  87. package/dist/node/clients/ShelbyNodeClient.mjs +18 -15
  88. package/dist/node/clients/index.d.ts +7 -6
  89. package/dist/node/clients/index.mjs +19 -17
  90. package/dist/node/index.d.ts +17 -11
  91. package/dist/node/index.mjs +91 -34
  92. package/package.json +3 -2
  93. package/dist/chunk-CPNZAQVY.mjs +0 -29
  94. package/dist/chunk-GY5DCVVL.mjs +0 -86
  95. package/dist/chunk-RBFWGDMY.mjs +0 -30
  96. package/dist/node/clients/ShelbyMetadataClient.mjs +0 -9
  97. /package/dist/{chunk-DJJD2AXO.mjs → chunk-AD2G3QYD.mjs} +0 -0
  98. /package/dist/{chunk-MWDW4ROU.mjs → chunk-EM67QTMR.mjs} +0 -0
  99. /package/dist/{chunk-RNXGC54D.mjs → chunk-QQ57OGQ2.mjs} +0 -0
@@ -1,39 +1,57 @@
1
1
  import "../chunk-MB7C7VQF.mjs";
2
2
  import {
3
3
  ShelbyNodeClient
4
- } from "../chunk-QFWQ7FIC.mjs";
4
+ } from "../chunk-ZEDD2MPU.mjs";
5
5
  import {
6
- ShelbyMetadataClient
7
- } from "../chunk-WBFEX7OM.mjs";
8
- import "../chunk-DJJD2AXO.mjs";
9
- import "../chunk-MWDW4ROU.mjs";
10
- import "../chunk-MQUVYMNQ.mjs";
11
- import "../chunk-ZHXCVRZX.mjs";
12
- import "../chunk-RNXGC54D.mjs";
6
+ testUtil_exports
7
+ } from "../chunk-A4IG6GSE.mjs";
8
+ import "../chunk-EM67QTMR.mjs";
9
+ import "../chunk-WTICJPDB.mjs";
13
10
  import {
14
11
  ShelbyClient
15
- } from "../chunk-BTHSKDJR.mjs";
12
+ } from "../chunk-7PN65RDX.mjs";
16
13
  import {
14
+ MissingTransactionSubmitterError,
17
15
  ShelbyBlobClient
18
- } from "../chunk-7UVMDCCR.mjs";
16
+ } from "../chunk-SRV4YWFH.mjs";
19
17
  import "../chunk-XNEIWM4O.mjs";
20
18
  import {
21
- createDefaultErasureCodingProvider
22
- } from "../chunk-CPNZAQVY.mjs";
19
+ createDefaultErasureCodingProvider,
20
+ defaultErasureCodingConfig,
21
+ erasureCodingConfig16Total10Data13Helper,
22
+ erasureCodingConfig4Total2Data3Helper
23
+ } from "../chunk-HPPMI7DC.mjs";
23
24
  import {
24
25
  ClayErasureCodingProvider
25
- } from "../chunk-NLPIHQ7K.mjs";
26
+ } from "../chunk-OGKZ575S.mjs";
26
27
  import {
27
28
  ReedSolomonErasureCodingProvider
28
- } from "../chunk-PZF2VTGP.mjs";
29
+ } from "../chunk-NHWWORCH.mjs";
29
30
  import "../chunk-Z7RFCADT.mjs";
31
+ import {
32
+ ShelbyMetadataClient
33
+ } from "../chunk-MV6FNYAU.mjs";
34
+ import {
35
+ ShelbyMicropaymentChannelClient
36
+ } from "../chunk-E5QCRTBU.mjs";
37
+ import "../chunk-QQ57OGQ2.mjs";
38
+ import "../chunk-ZHXCVRZX.mjs";
39
+ import "../chunk-AD2G3QYD.mjs";
40
+ import "../chunk-MQUVYMNQ.mjs";
41
+ import {
42
+ ShelbyPlacementGroupClient
43
+ } from "../chunk-W37FZSMA.mjs";
30
44
  import {
31
45
  ShelbyRPCClient
32
- } from "../chunk-5I3MBJGN.mjs";
46
+ } from "../chunk-PJVWGMVI.mjs";
47
+ import {
48
+ SenderBuiltMicropayment,
49
+ StaleChannelStateError
50
+ } from "../chunk-4MG4XGY4.mjs";
33
51
  import {
34
52
  createShelbyIndexerClient,
35
53
  getShelbyIndexerClient
36
- } from "../chunk-HFGEQP5N.mjs";
54
+ } from "../chunk-CGYJLKBU.mjs";
37
55
  import {
38
56
  Blob_Activities_Select_Column,
39
57
  Blobs_Select_Column,
@@ -42,31 +60,32 @@ import {
42
60
  GetBlobActivitiesDocument,
43
61
  GetBlobsCountDocument,
44
62
  GetBlobsDocument,
63
+ GetPlacementGroupSlotsCountDocument,
64
+ GetPlacementGroupSlotsDocument,
65
+ GetProcessorStatusDocument,
45
66
  Order_By,
46
67
  Placement_Group_Slots_Select_Column,
47
68
  Processor_Status_Select_Column,
48
69
  getSdk
49
- } from "../chunk-WJKSPJSS.mjs";
50
- import {
51
- BlobNameSchema,
52
- ChunkKey,
53
- allChunksForBlob,
54
- roundSize
55
- } from "../chunk-GY5DCVVL.mjs";
70
+ } from "../chunk-KJ24NKPH.mjs";
71
+ import "../chunk-AABBONAF.mjs";
56
72
  import {
57
73
  isShelbyNetwork,
58
74
  shelbyNetworks
59
- } from "../chunk-VRLIOKWG.mjs";
75
+ } from "../chunk-D6GQHO6G.mjs";
60
76
  import "../chunk-I6NG5GNL.mjs";
77
+ import {
78
+ CompleteMultipartUploadResponseSchema,
79
+ RPCErrorResponseSchema,
80
+ StaleMicropaymentErrorResponseSchema,
81
+ StartMultipartUploadResponseSchema,
82
+ UploadPartResponseSchema
83
+ } from "../chunk-IE6LYVIA.mjs";
61
84
  import {
62
85
  getShelbyAccountBlobsExplorerUrl,
63
86
  getShelbyAccountExplorerUrl,
64
87
  getShelbyBlobExplorerUrl
65
88
  } from "../chunk-BDSW5PHM.mjs";
66
- import "../chunk-RBFWGDMY.mjs";
67
- import {
68
- testUtil_exports
69
- } from "../chunk-A4IG6GSE.mjs";
70
89
  import {
71
90
  getAptosAccountExplorerUrl,
72
91
  getAptosTransactionExplorerUrl
@@ -76,11 +95,12 @@ import {
76
95
  } from "../chunk-OTBLZL2S.mjs";
77
96
  import {
78
97
  BlobCommitmentsSchema,
98
+ COMMITMENT_SCHEMA_VERSION,
79
99
  ChunksetCommitmentSchema,
80
100
  expectedTotalChunksets,
81
101
  generateCommitments,
82
102
  generateMerkleRoot
83
- } from "../chunk-XWAPNLU6.mjs";
103
+ } from "../chunk-2WEX3K7C.mjs";
84
104
  import {
85
105
  buildRequestUrl,
86
106
  concatHashes,
@@ -94,18 +114,21 @@ import {
94
114
  DEFAULT_CHUNKSET_SIZE_BYTES,
95
115
  DEFAULT_CHUNK_SIZE_BYTES,
96
116
  ERASURE_CODE_AND_CHUNK_MAPPING
97
- } from "../chunk-67F5YZ25.mjs";
117
+ } from "../chunk-JTXYKO3U.mjs";
98
118
  import {
99
119
  DEFAULT_ERASURE_D,
100
120
  DEFAULT_ERASURE_K,
101
121
  DEFAULT_ERASURE_M,
102
122
  DEFAULT_ERASURE_N,
123
+ DEFAULT_SAMPLE_SIZE,
103
124
  ERASURE_CODE_PARAMS,
104
125
  ErasureCodingScheme
105
- } from "../chunk-ZPW742E7.mjs";
126
+ } from "../chunk-AUQDI5BS.mjs";
106
127
  import {
107
128
  DEFAULT_PROJECT_DESCRIPTION,
108
129
  DEFAULT_PROJECT_NAME,
130
+ MICROPAYMENTS_DEPLOYER,
131
+ NetworkToGasStationBaseUrl,
109
132
  NetworkToShelbyBlobIndexerBaseUrl,
110
133
  NetworkToShelbyRPCBaseUrl,
111
134
  SHELBYUSD_FA_METADATA_ADDRESS,
@@ -115,7 +138,18 @@ import {
115
138
  SHELBY_DEPLOYER,
116
139
  TOKEN_DEPLOYER,
117
140
  TOKEN_OBJECT_ADDRESS
118
- } from "../chunk-SEXQTDX6.mjs";
141
+ } from "../chunk-4ZOFT75Q.mjs";
142
+ import {
143
+ ShelbyErrorCodes,
144
+ isAccessDeniedError,
145
+ isBlobAlreadyExistsError,
146
+ isBlobExpiredError,
147
+ isBlobNotFoundError
148
+ } from "../chunk-CQ6QPIZK.mjs";
149
+ import {
150
+ BlobNameSchema,
151
+ ChunkKey
152
+ } from "../chunk-Z4FZ7W6L.mjs";
119
153
  import "../chunk-7P6ASYW6.mjs";
120
154
  export {
121
155
  BlobCommitmentsSchema,
@@ -123,10 +157,12 @@ export {
123
157
  Blob_Activities_Select_Column,
124
158
  Blobs_Select_Column,
125
159
  CHUNK_SIZE_PARAMS,
160
+ COMMITMENT_SCHEMA_VERSION,
126
161
  ChunkKey,
127
162
  ChunkSizeScheme,
128
163
  ChunksetCommitmentSchema,
129
164
  ClayErasureCodingProvider,
165
+ CompleteMultipartUploadResponseSchema,
130
166
  Cursor_Ordering,
131
167
  DEFAULT_CHUNKSET_SIZE_BYTES,
132
168
  DEFAULT_CHUNK_SIZE_BYTES,
@@ -136,6 +172,7 @@ export {
136
172
  DEFAULT_ERASURE_N,
137
173
  DEFAULT_PROJECT_DESCRIPTION,
138
174
  DEFAULT_PROJECT_NAME,
175
+ DEFAULT_SAMPLE_SIZE,
139
176
  ERASURE_CODE_AND_CHUNK_MAPPING,
140
177
  ERASURE_CODE_PARAMS,
141
178
  ErasureCodingScheme,
@@ -143,30 +180,47 @@ export {
143
180
  GetBlobActivitiesDocument,
144
181
  GetBlobsCountDocument,
145
182
  GetBlobsDocument,
183
+ GetPlacementGroupSlotsCountDocument,
184
+ GetPlacementGroupSlotsDocument,
185
+ GetProcessorStatusDocument,
186
+ MICROPAYMENTS_DEPLOYER,
187
+ MissingTransactionSubmitterError,
188
+ NetworkToGasStationBaseUrl,
146
189
  NetworkToShelbyBlobIndexerBaseUrl,
147
190
  NetworkToShelbyRPCBaseUrl,
148
191
  Order_By,
149
192
  Placement_Group_Slots_Select_Column,
150
193
  Processor_Status_Select_Column,
194
+ RPCErrorResponseSchema,
151
195
  ReedSolomonErasureCodingProvider,
152
196
  SHELBYUSD_FA_METADATA_ADDRESS,
153
197
  SHELBYUSD_TOKEN_ADDRESS,
154
198
  SHELBYUSD_TOKEN_MODULE,
155
199
  SHELBYUSD_TOKEN_NAME,
156
200
  SHELBY_DEPLOYER,
201
+ SenderBuiltMicropayment,
157
202
  ShelbyBlobClient,
158
203
  ShelbyClient,
204
+ ShelbyErrorCodes,
159
205
  ShelbyMetadataClient,
206
+ ShelbyMicropaymentChannelClient,
160
207
  ShelbyNodeClient,
208
+ ShelbyPlacementGroupClient,
161
209
  ShelbyRPCClient,
210
+ StaleChannelStateError,
211
+ StaleMicropaymentErrorResponseSchema,
212
+ StartMultipartUploadResponseSchema,
162
213
  TOKEN_DEPLOYER,
163
214
  TOKEN_OBJECT_ADDRESS,
164
- allChunksForBlob,
215
+ UploadPartResponseSchema,
165
216
  buildRequestUrl,
166
217
  concatHashes,
167
218
  createBlobKey,
168
219
  createDefaultErasureCodingProvider,
169
220
  createShelbyIndexerClient,
221
+ defaultErasureCodingConfig,
222
+ erasureCodingConfig16Total10Data13Helper,
223
+ erasureCodingConfig4Total2Data3Helper,
170
224
  expectedTotalChunksets,
171
225
  generateCommitments,
172
226
  generateMerkleRoot,
@@ -178,9 +232,12 @@ export {
178
232
  getShelbyAccountExplorerUrl,
179
233
  getShelbyBlobExplorerUrl,
180
234
  getShelbyIndexerClient,
235
+ isAccessDeniedError,
236
+ isBlobAlreadyExistsError,
237
+ isBlobExpiredError,
238
+ isBlobNotFoundError,
181
239
  isShelbyNetwork,
182
240
  readInChunks,
183
- roundSize,
184
241
  shelbyNetworks,
185
242
  testUtil_exports as testUtil,
186
243
  zeroPadBytes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shelby-protocol/sdk",
3
- "version": "0.0.9",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,7 +29,7 @@
29
29
  "@shelby-protocol/reed-solomon": "0.0.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@aptos-labs/ts-sdk": "^5.1.1",
32
+ "@aptos-labs/ts-sdk": "5.2.1",
33
33
  "@graphql-codegen/cli": "^6.0.0",
34
34
  "@graphql-codegen/typescript-graphql-request": "^6.3.0",
35
35
  "@parcel/watcher": "^2.5.1",
@@ -55,6 +55,7 @@
55
55
  "build": "tsc --noEmit && (rimraf dist; tsup) && pnpm run verify:config",
56
56
  "test": "vitest dev",
57
57
  "test:once": "vitest run",
58
+ "test:integration": "vitest run --config vitest.integration.config.ts --reporter=verbose",
58
59
  "benchmark:erasure": "tsx benchmark/erasure.ts"
59
60
  }
60
61
  }
@@ -1,29 +0,0 @@
1
- import {
2
- ClayErasureCodingProvider
3
- } from "./chunk-NLPIHQ7K.mjs";
4
- import {
5
- DEFAULT_CHUNK_SIZE_BYTES
6
- } from "./chunk-67F5YZ25.mjs";
7
- import {
8
- DEFAULT_ERASURE_D,
9
- DEFAULT_ERASURE_K,
10
- DEFAULT_ERASURE_N
11
- } from "./chunk-ZPW742E7.mjs";
12
-
13
- // src/core/erasure/default.ts
14
- var defaultProviderPromise;
15
- function createDefaultErasureCodingProvider() {
16
- if (!defaultProviderPromise) {
17
- defaultProviderPromise = ClayErasureCodingProvider.create({
18
- erasure_n: DEFAULT_ERASURE_N,
19
- erasure_k: DEFAULT_ERASURE_K,
20
- erasure_d: DEFAULT_ERASURE_D,
21
- chunkSizeBytes: DEFAULT_CHUNK_SIZE_BYTES
22
- });
23
- }
24
- return defaultProviderPromise;
25
- }
26
-
27
- export {
28
- createDefaultErasureCodingProvider
29
- };
@@ -1,86 +0,0 @@
1
- import {
2
- DEFAULT_CHUNKSET_SIZE_BYTES,
3
- DEFAULT_CHUNK_SIZE_BYTES
4
- } from "./chunk-67F5YZ25.mjs";
5
- import {
6
- DEFAULT_ERASURE_K,
7
- DEFAULT_ERASURE_N
8
- } from "./chunk-ZPW742E7.mjs";
9
-
10
- // src/core/layout.ts
11
- import { AccountAddress } from "@aptos-labs/ts-sdk";
12
- import { z } from "zod";
13
- var BlobNameSchema = z.string().min(1, "Blob name path parameter cannot be empty.").max(1024, "Blob name cannot exceed 1024 characters.").refine((name) => !name.endsWith("/"), {
14
- message: "Blob name cannot end with a slash"
15
- });
16
- var ChunkKey = class _ChunkKey {
17
- constructor(account, blobName, chunksetIdx, chunkIdx) {
18
- this.account = account;
19
- this.blobName = blobName;
20
- this.chunksetIdx = chunksetIdx;
21
- this.chunkIdx = chunkIdx;
22
- if (chunkIdx >= DEFAULT_ERASURE_N) {
23
- throw new Error(
24
- `Cannot create a chunk with idx ${chunkIdx}. M+K=${DEFAULT_ERASURE_N}`
25
- );
26
- }
27
- }
28
- key() {
29
- return `${this.account.toString()}.${this.blobName}.${this.chunksetIdx}.${this.chunkIdx}`;
30
- }
31
- // Returns the range in the blob that this key represents, or "partity" if this is parity chunk.
32
- range() {
33
- if (this.chunkIdx >= DEFAULT_ERASURE_K) {
34
- return "parity";
35
- }
36
- const chunksetStart = this.chunksetIdx * DEFAULT_CHUNKSET_SIZE_BYTES;
37
- const chunkStart = chunksetStart + this.chunkIdx * DEFAULT_CHUNK_SIZE_BYTES;
38
- return {
39
- start: chunkStart,
40
- end: chunkStart + DEFAULT_CHUNK_SIZE_BYTES
41
- };
42
- }
43
- static fromJSON(json) {
44
- return new _ChunkKey(
45
- AccountAddress.fromString(json.account),
46
- json.blobName,
47
- json.chunksetIdx,
48
- json.chunkIdx
49
- );
50
- }
51
- toJSON() {
52
- return {
53
- account: this.account.toString(),
54
- blobName: this.blobName,
55
- chunksetIdx: this.chunksetIdx,
56
- chunkIdx: this.chunkIdx
57
- };
58
- }
59
- };
60
- function roundSize(size) {
61
- let ret = 0;
62
- let remain = size;
63
- while (remain > 0) {
64
- ret += DEFAULT_CHUNKSET_SIZE_BYTES;
65
- remain -= DEFAULT_CHUNKSET_SIZE_BYTES;
66
- }
67
- return ret;
68
- }
69
- function allChunksForBlob(account, blobName, _size) {
70
- const ret = [];
71
- const size = roundSize(_size);
72
- const nChunksets = size / DEFAULT_CHUNKSET_SIZE_BYTES;
73
- for (let chunksetIdx = 0; chunksetIdx < nChunksets; ++chunksetIdx) {
74
- for (let chunkIdx = 0; chunkIdx < DEFAULT_ERASURE_N; ++chunkIdx) {
75
- ret.push(new ChunkKey(account, blobName, chunksetIdx, chunkIdx));
76
- }
77
- }
78
- return ret;
79
- }
80
-
81
- export {
82
- BlobNameSchema,
83
- ChunkKey,
84
- roundSize,
85
- allChunksForBlob
86
- };
@@ -1,30 +0,0 @@
1
- // src/core/clients/utils.ts
2
- import { AptosConfig, Network } from "@aptos-labs/ts-sdk";
3
- var getAptosConfig = (config) => {
4
- if (config.aptos) {
5
- return new AptosConfig(config.aptos);
6
- }
7
- let aptosConfig;
8
- switch (config.network) {
9
- case "local":
10
- aptosConfig = new AptosConfig({
11
- network: Network.LOCAL
12
- });
13
- break;
14
- case "shelbynet":
15
- aptosConfig = new AptosConfig({
16
- network: Network.SHELBYNET,
17
- clientConfig: {
18
- API_KEY: config.apiKey
19
- }
20
- });
21
- break;
22
- default:
23
- throw new Error(`Unsupported network: ${config.network}`);
24
- }
25
- return aptosConfig;
26
- };
27
-
28
- export {
29
- getAptosConfig
30
- };
@@ -1,9 +0,0 @@
1
- import {
2
- ShelbyMetadataClient
3
- } from "../../chunk-WBFEX7OM.mjs";
4
- import "../../chunk-RBFWGDMY.mjs";
5
- import "../../chunk-SEXQTDX6.mjs";
6
- import "../../chunk-7P6ASYW6.mjs";
7
- export {
8
- ShelbyMetadataClient
9
- };
File without changes
File without changes
File without changes