@shelby-protocol/sdk 0.2.4 → 0.3.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.
- package/dist/browser/index.d.ts +13 -4
- package/dist/browser/index.mjs +3719 -140
- package/dist/{clay-codes-DHP-bYcP.d.ts → clay-codes-DdXABBDx.d.ts} +0 -7
- package/dist/core/aptos-explorer.mjs +46 -5
- package/dist/core/blobs.d.ts +1 -1
- package/dist/core/blobs.mjs +12 -4
- package/dist/core/chunk.mjs +58 -9
- package/dist/core/clients/ShelbyBlobClient.d.ts +9 -44
- package/dist/core/clients/ShelbyBlobClient.mjs +1084 -17
- package/dist/core/clients/ShelbyClient.d.ts +12 -2
- package/dist/core/clients/ShelbyClient.mjs +2915 -23
- package/dist/core/clients/ShelbyClientConfig.d.ts +8 -0
- package/dist/core/clients/ShelbyClientConfig.mjs +0 -1
- package/dist/core/clients/ShelbyMetadataClient.d.ts +0 -18
- package/dist/core/clients/ShelbyMetadataClient.mjs +306 -6
- package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +7 -49
- package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +839 -13
- package/dist/core/clients/ShelbyPlacementGroupClient.mjs +307 -8
- package/dist/core/clients/ShelbyRPCClient.d.ts +107 -4
- package/dist/core/clients/ShelbyRPCClient.mjs +1261 -12
- package/dist/core/clients/index.d.ts +3 -2
- package/dist/core/clients/index.mjs +3421 -40
- package/dist/core/clients/utils.mjs +65 -6
- package/dist/core/commitments.d.ts +3 -12
- package/dist/core/commitments.mjs +270 -11
- package/dist/core/constants.d.ts +4 -4
- package/dist/core/constants.mjs +39 -16
- package/dist/core/erasure/clay-codes.d.ts +1 -1
- package/dist/core/erasure/clay-codes.mjs +129 -4
- package/dist/core/erasure/constants.mjs +33 -10
- package/dist/core/erasure/default.d.ts +1 -1
- package/dist/core/erasure/default.mjs +191 -9
- package/dist/core/erasure/index.d.ts +1 -1
- package/dist/core/erasure/index.mjs +266 -23
- package/dist/core/erasure/provider.d.ts +1 -1
- package/dist/core/erasure/reed-solomon.d.ts +1 -1
- package/dist/core/erasure/reed-solomon.mjs +68 -4
- package/dist/core/erasure/utils.d.ts +1 -1
- package/dist/core/erasure/utils.mjs +0 -2
- package/dist/core/errors.mjs +29 -8
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.mjs +3713 -140
- package/dist/core/layout.d.ts +1 -1
- package/dist/core/layout.mjs +37 -5
- package/dist/core/networks.mjs +10 -5
- package/dist/core/operations/generated/sdk.d.ts +9 -0
- package/dist/core/operations/generated/sdk.mjs +183 -18
- package/dist/core/operations/index.mjs +284 -24
- package/dist/core/promises.mjs +4 -4
- package/dist/core/rpc-responses.d.ts +38 -1
- package/dist/core/rpc-responses.mjs +31 -8
- package/dist/core/shelby-explorer.mjs +31 -6
- package/dist/core/strings.mjs +0 -2
- package/dist/core/types/blobs.d.ts +1 -1
- package/dist/core/types/blobs.mjs +0 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.mjs +230 -9
- package/dist/core/types/payments.d.ts +6 -6
- package/dist/core/types/payments.mjs +230 -5
- package/dist/core/types/placement_groups.mjs +0 -1
- package/dist/core/types/storage_providers.mjs +0 -1
- package/dist/core/utils.mjs +94 -8
- package/dist/node/clients/ShelbyNodeClient.d.ts +2 -1
- package/dist/node/clients/ShelbyNodeClient.mjs +2919 -24
- package/dist/node/clients/index.d.ts +2 -1
- package/dist/node/clients/index.mjs +2920 -26
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.mjs +3736 -147
- package/dist/node/parallel/commitment_worker.d.ts +9 -0
- package/dist/node/parallel/commitment_worker.mjs +298 -0
- package/dist/node/parallel/commitment_worker_pool.d.ts +35 -0
- package/dist/node/parallel/commitment_worker_pool.mjs +286 -0
- package/dist/node/parallel/default_commitment_worker_pool.d.ts +24 -0
- package/dist/node/parallel/default_commitment_worker_pool.mjs +302 -0
- package/dist/node/parallel/index.d.ts +11 -0
- package/dist/node/parallel/index.mjs +563 -0
- package/dist/node/parallel/parallel_commitments.d.ts +32 -0
- package/dist/node/parallel/parallel_commitments.mjs +561 -0
- package/dist/node/parallel/worker_pool.d.ts +74 -0
- package/dist/node/parallel/worker_pool.mjs +248 -0
- package/dist/node/testUtil.mjs +8 -4
- package/package.json +9 -6
- package/dist/chunk-3NRBHSMQ.mjs +0 -12
- package/dist/chunk-3PCG7PNP.mjs +0 -375
- package/dist/chunk-7OV5ZYW6.mjs +0 -55
- package/dist/chunk-7P6ASYW6.mjs +0 -9
- package/dist/chunk-A4IG6GSE.mjs +0 -21
- package/dist/chunk-AD2G3QYD.mjs +0 -0
- package/dist/chunk-AEDVYYGD.mjs +0 -11
- package/dist/chunk-AUQDI5BS.mjs +0 -43
- package/dist/chunk-BDSW5PHM.mjs +0 -37
- package/dist/chunk-BKL7NCUB.mjs +0 -412
- package/dist/chunk-BUWAD67L.mjs +0 -505
- package/dist/chunk-BXEVML7N.mjs +0 -169
- package/dist/chunk-C6RQ3AEU.mjs +0 -51
- package/dist/chunk-CQ6QPIZK.mjs +0 -37
- package/dist/chunk-D6GQHO6G.mjs +0 -15
- package/dist/chunk-EM67QTMR.mjs +0 -0
- package/dist/chunk-I6NG5GNL.mjs +0 -8
- package/dist/chunk-IE6LYVIA.mjs +0 -26
- package/dist/chunk-IKRWBDG5.mjs +0 -42
- package/dist/chunk-JTXYKO3U.mjs +0 -38
- package/dist/chunk-KYQRWJ3U.mjs +0 -49
- package/dist/chunk-MB7C7VQF.mjs +0 -0
- package/dist/chunk-MQUVYMNQ.mjs +0 -0
- package/dist/chunk-NHWWORCH.mjs +0 -72
- package/dist/chunk-NI6XBZLI.mjs +0 -83
- package/dist/chunk-OGKZ575S.mjs +0 -136
- package/dist/chunk-QQ57OGQ2.mjs +0 -0
- package/dist/chunk-SSE4MFNN.mjs +0 -278
- package/dist/chunk-TET3DJEO.mjs +0 -199
- package/dist/chunk-TVLV7C74.mjs +0 -207
- package/dist/chunk-UEZNZBJO.mjs +0 -104
- package/dist/chunk-WJTVYLKW.mjs +0 -782
- package/dist/chunk-WTICJPDB.mjs +0 -0
- package/dist/chunk-XNEIWM4O.mjs +0 -0
- package/dist/chunk-XRLHLAOW.mjs +0 -51
- package/dist/chunk-Z4FZ7W6L.mjs +0 -39
- package/dist/chunk-Z7RFCADT.mjs +0 -0
- package/dist/chunk-ZHXCVRZX.mjs +0 -0
- package/dist/core/operations/generated/types.d.ts +0 -908
- package/dist/core/operations/generated/types.mjs +0 -63
- package/dist/core/types/encodings.d.ts +0 -11
- package/dist/core/types/encodings.mjs +0 -0
package/dist/chunk-WTICJPDB.mjs
DELETED
|
File without changes
|
package/dist/chunk-XNEIWM4O.mjs
DELETED
|
File without changes
|
package/dist/chunk-XRLHLAOW.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClayErasureCodingProvider
|
|
3
|
-
} from "./chunk-OGKZ575S.mjs";
|
|
4
|
-
import {
|
|
5
|
-
DEFAULT_CHUNK_SIZE_BYTES
|
|
6
|
-
} from "./chunk-JTXYKO3U.mjs";
|
|
7
|
-
import {
|
|
8
|
-
ERASURE_CODE_PARAMS
|
|
9
|
-
} from "./chunk-AUQDI5BS.mjs";
|
|
10
|
-
|
|
11
|
-
// src/core/erasure/default.ts
|
|
12
|
-
var defaultProviderPromise;
|
|
13
|
-
function createDefaultErasureCodingProvider() {
|
|
14
|
-
if (!defaultProviderPromise) {
|
|
15
|
-
defaultProviderPromise = ClayErasureCodingProvider.create(
|
|
16
|
-
defaultErasureCodingConfig()
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
return defaultProviderPromise;
|
|
20
|
-
}
|
|
21
|
-
function defaultErasureCodingConfig() {
|
|
22
|
-
const encoding = Number(process.env.SHELBY_ENCODING) || 0;
|
|
23
|
-
if (encoding === 0) {
|
|
24
|
-
return erasureCodingConfig16Total10Data13Helper();
|
|
25
|
-
}
|
|
26
|
-
return erasureCodingConfig4Total2Data3Helper();
|
|
27
|
-
}
|
|
28
|
-
function erasureCodingConfig16Total10Data13Helper() {
|
|
29
|
-
return erasureCodingConfig(
|
|
30
|
-
"ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
function erasureCodingConfig4Total2Data3Helper() {
|
|
34
|
-
return erasureCodingConfig("ClayCode_4Total_2Data_3Helper" /* ClayCode_4Total_2Data_3Helper */);
|
|
35
|
-
}
|
|
36
|
-
function erasureCodingConfig(encodingScheme) {
|
|
37
|
-
return {
|
|
38
|
-
erasure_n: ERASURE_CODE_PARAMS[encodingScheme].erasure_n,
|
|
39
|
-
erasure_k: ERASURE_CODE_PARAMS[encodingScheme].erasure_k,
|
|
40
|
-
erasure_d: ERASURE_CODE_PARAMS[encodingScheme].erasure_d,
|
|
41
|
-
chunkSizeBytes: DEFAULT_CHUNK_SIZE_BYTES,
|
|
42
|
-
enumIndex: ERASURE_CODE_PARAMS[encodingScheme].enumIndex
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
createDefaultErasureCodingProvider,
|
|
48
|
-
defaultErasureCodingConfig,
|
|
49
|
-
erasureCodingConfig16Total10Data13Helper,
|
|
50
|
-
erasureCodingConfig4Total2Data3Helper
|
|
51
|
-
};
|
package/dist/chunk-Z4FZ7W6L.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// src/core/layout.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
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("/"), {
|
|
4
|
-
message: "Blob name cannot end with a slash"
|
|
5
|
-
});
|
|
6
|
-
var ChunkKey = class {
|
|
7
|
-
constructor(account, blobName, chunksetIdx, chunkIdx, config) {
|
|
8
|
-
this.account = account;
|
|
9
|
-
this.blobName = blobName;
|
|
10
|
-
this.chunksetIdx = chunksetIdx;
|
|
11
|
-
this.chunkIdx = chunkIdx;
|
|
12
|
-
this.config = config;
|
|
13
|
-
if (chunkIdx >= config.erasure_n) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
`Cannot create a chunk with idx ${chunkIdx}. M+K=${config.erasure_n}`
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
key() {
|
|
20
|
-
return `${this.account.toString()}.${this.blobName}.${this.chunksetIdx}.${this.chunkIdx}`;
|
|
21
|
-
}
|
|
22
|
-
// Returns the range in the blob that this key represents, or "parity" if this is parity chunk.
|
|
23
|
-
range() {
|
|
24
|
-
if (this.chunkIdx >= this.config.erasure_k) {
|
|
25
|
-
return "parity";
|
|
26
|
-
}
|
|
27
|
-
const chunksetStart = this.chunksetIdx * this.config.chunkSizeBytes * this.config.erasure_k;
|
|
28
|
-
const chunkStart = chunksetStart + this.chunkIdx * this.config.chunkSizeBytes;
|
|
29
|
-
return {
|
|
30
|
-
start: chunkStart,
|
|
31
|
-
end: chunkStart + this.config.chunkSizeBytes
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
BlobNameSchema,
|
|
38
|
-
ChunkKey
|
|
39
|
-
};
|
package/dist/chunk-Z7RFCADT.mjs
DELETED
|
File without changes
|
package/dist/chunk-ZHXCVRZX.mjs
DELETED
|
File without changes
|