@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
|
@@ -1,9 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "
|
|
6
|
-
|
|
1
|
+
// src/core/clients/utils.ts
|
|
2
|
+
import { AptosConfig } from "@aptos-labs/ts-sdk";
|
|
3
|
+
|
|
4
|
+
// src/core/constants.ts
|
|
5
|
+
import { Network } from "@aptos-labs/ts-sdk";
|
|
6
|
+
var NetworkToShelbyRPCBaseUrl = {
|
|
7
|
+
[Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/shelby",
|
|
8
|
+
[Network.NETNA]: void 0,
|
|
9
|
+
[Network.DEVNET]: void 0,
|
|
10
|
+
[Network.TESTNET]: "https://api.testnet.shelby.xyz/shelby",
|
|
11
|
+
[Network.MAINNET]: void 0,
|
|
12
|
+
[Network.LOCAL]: "http://localhost:9090",
|
|
13
|
+
[Network.CUSTOM]: void 0
|
|
14
|
+
};
|
|
15
|
+
var NetworkToShelbyBlobIndexerBaseUrl = {
|
|
16
|
+
[Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/alias/shelby/shelbynet/v1/graphql",
|
|
17
|
+
[Network.NETNA]: void 0,
|
|
18
|
+
[Network.DEVNET]: void 0,
|
|
19
|
+
[Network.TESTNET]: "https://api.testnet.aptoslabs.com/nocode/v1/public/alias/shelby/testnet/v1/graphql",
|
|
20
|
+
[Network.MAINNET]: void 0,
|
|
21
|
+
[Network.LOCAL]: "http://localhost:8091/v1/graphql",
|
|
22
|
+
[Network.CUSTOM]: void 0
|
|
23
|
+
};
|
|
24
|
+
var NetworkToGasStationBaseUrl = {
|
|
25
|
+
[Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/gs/v1",
|
|
26
|
+
[Network.NETNA]: void 0,
|
|
27
|
+
[Network.DEVNET]: void 0,
|
|
28
|
+
[Network.TESTNET]: "https://api.testnet.shelby.xyz/gs/v1",
|
|
29
|
+
[Network.MAINNET]: void 0,
|
|
30
|
+
[Network.LOCAL]: void 0,
|
|
31
|
+
[Network.CUSTOM]: void 0
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/core/clients/utils.ts
|
|
35
|
+
var getAptosConfig = (config) => {
|
|
36
|
+
const baseFaucetConfig = config.faucet?.authToken ? { AUTH_TOKEN: config.faucet.authToken } : void 0;
|
|
37
|
+
if (config.aptos) {
|
|
38
|
+
return new AptosConfig({
|
|
39
|
+
// Spread user's aptos config first
|
|
40
|
+
...config.aptos,
|
|
41
|
+
// Network from top-level is authoritative - cannot be overridden
|
|
42
|
+
network: config.network,
|
|
43
|
+
// Merge clientConfig with API_KEY default
|
|
44
|
+
clientConfig: {
|
|
45
|
+
API_KEY: config.apiKey,
|
|
46
|
+
...config.aptos.clientConfig
|
|
47
|
+
},
|
|
48
|
+
// Merge faucetConfig: aptos config first, then base authToken (authoritative)
|
|
49
|
+
faucetConfig: {
|
|
50
|
+
...config.aptos.faucetConfig,
|
|
51
|
+
...baseFaucetConfig
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return new AptosConfig({
|
|
56
|
+
network: config.network,
|
|
57
|
+
clientConfig: {
|
|
58
|
+
API_KEY: config.apiKey
|
|
59
|
+
},
|
|
60
|
+
faucetConfig: baseFaucetConfig
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var getShelbyRPCBaseUrl = (config) => {
|
|
64
|
+
return config.rpc?.baseUrl ?? NetworkToShelbyRPCBaseUrl[config.network] ?? NetworkToShelbyRPCBaseUrl.testnet;
|
|
65
|
+
};
|
|
7
66
|
export {
|
|
8
67
|
getAptosConfig,
|
|
9
68
|
getShelbyRPCBaseUrl
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hex } from '@aptos-labs/ts-sdk';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { a as ErasureCodingProvider } from '../clay-codes-
|
|
3
|
+
import { a as ErasureCodingProvider } from '../clay-codes-DdXABBDx.js';
|
|
4
4
|
import '@shelby-protocol/clay-codes';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -99,14 +99,6 @@ declare const BlobCommitmentsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
99
99
|
}[];
|
|
100
100
|
}>;
|
|
101
101
|
type BlobCommitments = z.infer<typeof BlobCommitmentsSchema>;
|
|
102
|
-
interface GenerateCommitmentsOptions {
|
|
103
|
-
/**
|
|
104
|
-
* When true (default) chunksets are zero padded before encoding.
|
|
105
|
-
* Disable only when the incoming data already matches the provider's
|
|
106
|
-
* systematic capacity and you need to preserve raw byte layout.
|
|
107
|
-
*/
|
|
108
|
-
pad?: boolean;
|
|
109
|
-
}
|
|
110
102
|
/**
|
|
111
103
|
* Create the merkle root of the tree based on the hashes in the parameter. Non-existent siblings use the zero hash.
|
|
112
104
|
*
|
|
@@ -120,7 +112,6 @@ declare function generateMerkleRoot(leafHashes: Hex[]): Promise<Hex>;
|
|
|
120
112
|
* @param provider - Erasure coding backend that will expand chunksets.
|
|
121
113
|
* @param fullData - The data stream to generate commitments for.
|
|
122
114
|
* @param onChunk - A callback that is called for each chunk of data.
|
|
123
|
-
* @param options - Optional overrides for padding behaviour.
|
|
124
115
|
*
|
|
125
116
|
* @returns The blob commitments.
|
|
126
117
|
*
|
|
@@ -131,6 +122,6 @@ declare function generateMerkleRoot(leafHashes: Hex[]): Promise<Hex>;
|
|
|
131
122
|
* const commitments = await generateCommitments(provider, buffer);
|
|
132
123
|
* ```
|
|
133
124
|
*/
|
|
134
|
-
declare function generateCommitments(provider: ErasureCodingProvider, fullData: ReadableStream<Uint8Array> | Uint8Array, onChunk?: (chunksetIdx: number, chunkIdx: number, chunkData: Uint8Array) => Promise<void> | void
|
|
125
|
+
declare function generateCommitments(provider: ErasureCodingProvider, fullData: ReadableStream<Uint8Array> | Uint8Array, onChunk?: (chunksetIdx: number, chunkIdx: number, chunkData: Uint8Array) => Promise<void> | void): Promise<BlobCommitments>;
|
|
135
126
|
|
|
136
|
-
export { type BlobCommitments, BlobCommitmentsSchema, COMMITMENT_SCHEMA_VERSION, type ChunksetCommitment, ChunksetCommitmentSchema,
|
|
127
|
+
export { type BlobCommitments, BlobCommitmentsSchema, COMMITMENT_SCHEMA_VERSION, type ChunksetCommitment, ChunksetCommitmentSchema, expectedTotalChunksets, generateCommitments, generateMerkleRoot };
|
|
@@ -1,15 +1,274 @@
|
|
|
1
|
+
// src/core/commitments.ts
|
|
2
|
+
import { Hex as Hex2 } from "@aptos-labs/ts-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
// src/core/erasure/constants.ts
|
|
6
|
+
var ERASURE_CODE_PARAMS = {
|
|
7
|
+
["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */]: {
|
|
8
|
+
// total chunks (data + parity)
|
|
9
|
+
erasure_n: 16,
|
|
10
|
+
// data chunks
|
|
11
|
+
erasure_k: 10,
|
|
12
|
+
// helper nodes
|
|
13
|
+
erasure_d: 13,
|
|
14
|
+
// enum index
|
|
15
|
+
enumIndex: 0
|
|
16
|
+
},
|
|
17
|
+
["ClayCode_4Total_2Data_3Helper" /* ClayCode_4Total_2Data_3Helper */]: {
|
|
18
|
+
// total chunks (data + parity)
|
|
19
|
+
erasure_n: 4,
|
|
20
|
+
// data chunks
|
|
21
|
+
erasure_k: 2,
|
|
22
|
+
// helper nodes
|
|
23
|
+
erasure_d: 3,
|
|
24
|
+
// enum index
|
|
25
|
+
enumIndex: 1
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var DEFAULT_ERASURE_N = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_n;
|
|
29
|
+
var DEFAULT_ERASURE_K = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_k;
|
|
30
|
+
var DEFAULT_ERASURE_D = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_d;
|
|
31
|
+
var DEFAULT_ERASURE_M = DEFAULT_ERASURE_N - DEFAULT_ERASURE_K;
|
|
32
|
+
|
|
33
|
+
// src/core/chunk.ts
|
|
34
|
+
var CHUNK_SIZE_PARAMS = {
|
|
35
|
+
["ChunkSet10MiB_Chunk1MiB" /* ChunkSet10MiB_Chunk1MiB */]: {
|
|
36
|
+
// 1MiB
|
|
37
|
+
chunkSizeBytes: 1 * 1024 * 1024,
|
|
38
|
+
// 10MiB
|
|
39
|
+
chunksetSizeBytes: 10 * 1024 * 1024
|
|
40
|
+
},
|
|
41
|
+
["ChunkSet2MiB_Chunk1MiB" /* ChunkSet2MiB_Chunk1MiB */]: {
|
|
42
|
+
// 1MiB
|
|
43
|
+
chunkSizeBytes: 1 * 1024 * 1024,
|
|
44
|
+
// 2MiB
|
|
45
|
+
chunksetSizeBytes: 2 * 1024 * 1024
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var DEFAULT_CHUNK_SIZE_BYTES = CHUNK_SIZE_PARAMS["ChunkSet10MiB_Chunk1MiB" /* ChunkSet10MiB_Chunk1MiB */].chunkSizeBytes;
|
|
49
|
+
var DEFAULT_CHUNKSET_SIZE_BYTES = CHUNK_SIZE_PARAMS["ChunkSet10MiB_Chunk1MiB" /* ChunkSet10MiB_Chunk1MiB */].chunksetSizeBytes;
|
|
50
|
+
var ERASURE_CODE_AND_CHUNK_MAPPING = {
|
|
51
|
+
["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */]: {
|
|
52
|
+
...CHUNK_SIZE_PARAMS.ChunkSet10MiB_Chunk1MiB
|
|
53
|
+
},
|
|
54
|
+
["ClayCode_4Total_2Data_3Helper" /* ClayCode_4Total_2Data_3Helper */]: {
|
|
55
|
+
...CHUNK_SIZE_PARAMS.ChunkSet2MiB_Chunk1MiB
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/core/utils.ts
|
|
1
60
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
61
|
+
AccountAddress,
|
|
62
|
+
Hex
|
|
63
|
+
} from "@aptos-labs/ts-sdk";
|
|
64
|
+
async function* readInChunks(input, chunkSize) {
|
|
65
|
+
let idx = 0;
|
|
66
|
+
if (isReadableStream(input)) {
|
|
67
|
+
const reader = input.getReader();
|
|
68
|
+
let buffer = new Uint8Array(chunkSize);
|
|
69
|
+
let bufferWriteOffset = 0;
|
|
70
|
+
try {
|
|
71
|
+
while (true) {
|
|
72
|
+
const { value, done } = await reader.read();
|
|
73
|
+
if (done) break;
|
|
74
|
+
if (value === void 0) continue;
|
|
75
|
+
let srcOffset = 0;
|
|
76
|
+
while (srcOffset < value.length) {
|
|
77
|
+
const remainingCapacity = chunkSize - bufferWriteOffset;
|
|
78
|
+
const bytesToCopy = Math.min(
|
|
79
|
+
remainingCapacity,
|
|
80
|
+
value.length - srcOffset
|
|
81
|
+
);
|
|
82
|
+
buffer.set(
|
|
83
|
+
value.subarray(srcOffset, srcOffset + bytesToCopy),
|
|
84
|
+
bufferWriteOffset
|
|
85
|
+
);
|
|
86
|
+
bufferWriteOffset += bytesToCopy;
|
|
87
|
+
srcOffset += bytesToCopy;
|
|
88
|
+
if (bufferWriteOffset >= chunkSize) {
|
|
89
|
+
yield [idx++, buffer];
|
|
90
|
+
buffer = new Uint8Array(chunkSize);
|
|
91
|
+
bufferWriteOffset = 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} finally {
|
|
96
|
+
reader.releaseLock();
|
|
97
|
+
}
|
|
98
|
+
if (bufferWriteOffset > 0) {
|
|
99
|
+
yield [idx++, buffer.subarray(0, bufferWriteOffset)];
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const view = toUint8Array(input);
|
|
104
|
+
for (let offset = 0; offset < view.byteLength; offset += chunkSize) {
|
|
105
|
+
yield [
|
|
106
|
+
idx++,
|
|
107
|
+
view.subarray(offset, Math.min(offset + chunkSize, view.byteLength))
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function zeroPadBytes(buffer, desiredLength) {
|
|
112
|
+
if (buffer.byteLength === desiredLength) {
|
|
113
|
+
return buffer;
|
|
114
|
+
}
|
|
115
|
+
if (buffer.byteLength > desiredLength) {
|
|
116
|
+
return buffer.subarray(0, desiredLength);
|
|
117
|
+
}
|
|
118
|
+
const paddedBuffer = new Uint8Array(desiredLength);
|
|
119
|
+
paddedBuffer.set(buffer);
|
|
120
|
+
return paddedBuffer;
|
|
121
|
+
}
|
|
122
|
+
async function concatHashes(parts) {
|
|
123
|
+
const chunks = parts.map((part) => Hex.fromHexInput(part).toUint8Array());
|
|
124
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
|
|
125
|
+
const combined = new Uint8Array(totalLength);
|
|
126
|
+
let offset = 0;
|
|
127
|
+
for (const chunk of chunks) {
|
|
128
|
+
combined.set(chunk, offset);
|
|
129
|
+
offset += chunk.byteLength;
|
|
130
|
+
}
|
|
131
|
+
return Hex.fromHexInput(
|
|
132
|
+
new Uint8Array(await crypto.subtle.digest("SHA-256", combined))
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function isReadableStream(value) {
|
|
136
|
+
return typeof value === "object" && value !== null && "getReader" in value && typeof value.getReader === "function";
|
|
137
|
+
}
|
|
138
|
+
function toUint8Array(view) {
|
|
139
|
+
return view instanceof Uint8Array ? view : new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// src/core/commitments.ts
|
|
143
|
+
var COMMITMENT_SCHEMA_VERSION = "1.3";
|
|
144
|
+
var ChunksetCommitmentSchema = z.object({
|
|
145
|
+
// Chunkset root (vector commitment of child chunks)
|
|
146
|
+
chunkset_root: z.string(),
|
|
147
|
+
// the size is known statically from the current configuration
|
|
148
|
+
chunk_commitments: z.array(z.string())
|
|
149
|
+
}).refine(
|
|
150
|
+
(data) => {
|
|
151
|
+
return data.chunk_commitments.length === DEFAULT_ERASURE_K + DEFAULT_ERASURE_M;
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
message: `Chunkset must have exactly ${DEFAULT_ERASURE_K + DEFAULT_ERASURE_M} chunks (ERASURE_K + ERASURE_M = ${DEFAULT_ERASURE_K} + ${DEFAULT_ERASURE_M})`,
|
|
155
|
+
path: ["chunk_commitments"]
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
function expectedTotalChunksets(rawSize, chunksetSize = DEFAULT_CHUNKSET_SIZE_BYTES) {
|
|
159
|
+
if (chunksetSize <= 0) {
|
|
160
|
+
throw new Error("chunksetSize must be positive");
|
|
161
|
+
}
|
|
162
|
+
if (rawSize === 0) return 1;
|
|
163
|
+
return Math.ceil(rawSize / chunksetSize);
|
|
164
|
+
}
|
|
165
|
+
var BlobCommitmentsSchema = z.object({
|
|
166
|
+
schema_version: z.string(),
|
|
167
|
+
raw_data_size: z.number(),
|
|
168
|
+
// FIXME I am not sure about this being here, or if it should be somewhere else
|
|
169
|
+
blob_merkle_root: z.string(),
|
|
170
|
+
chunkset_commitments: z.array(ChunksetCommitmentSchema)
|
|
171
|
+
}).refine(
|
|
172
|
+
(data) => {
|
|
173
|
+
return expectedTotalChunksets(data.raw_data_size) === data.chunkset_commitments.length;
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
message: "Total chunkset count mismatches with raw data size",
|
|
177
|
+
// FIXME put more details in here
|
|
178
|
+
path: ["chunkset_commitments"]
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
async function generateMerkleRoot(leafHashes) {
|
|
182
|
+
if (!leafHashes.length) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
"An empty array cannot be used to construct a Merkle tree."
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
const zeroArray = new Uint8Array(leafHashes[0].toUint8Array().length);
|
|
188
|
+
const zeroBytes = Hex2.fromHexInput(zeroArray);
|
|
189
|
+
let currentLeaves = leafHashes;
|
|
190
|
+
while (currentLeaves.length > 1) {
|
|
191
|
+
if (currentLeaves.length % 2 !== 0) {
|
|
192
|
+
currentLeaves.push(zeroBytes);
|
|
193
|
+
}
|
|
194
|
+
const nextLeaves = [];
|
|
195
|
+
for (let i = 0; i < currentLeaves.length; i += 2) {
|
|
196
|
+
nextLeaves.push(
|
|
197
|
+
await concatHashes([
|
|
198
|
+
currentLeaves[i].toUint8Array(),
|
|
199
|
+
currentLeaves[i + 1].toUint8Array()
|
|
200
|
+
])
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
currentLeaves = nextLeaves;
|
|
204
|
+
}
|
|
205
|
+
return currentLeaves[0];
|
|
206
|
+
}
|
|
207
|
+
async function generateChunksetCommitments(chunksetIdx, chunksetData, expectedChunksetSize, provider, onChunk) {
|
|
208
|
+
const { erasure_n } = provider.config;
|
|
209
|
+
const chunksetPayload = zeroPadBytes(chunksetData, expectedChunksetSize);
|
|
210
|
+
const { chunks } = provider.encode(chunksetPayload);
|
|
211
|
+
if (chunks.length !== erasure_n) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Erasure provider produced ${chunks.length} chunks, expected ${erasure_n}.`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
const chunkRoots = provider.getChunkMerkleRoots();
|
|
217
|
+
let chunkIdx = 0;
|
|
218
|
+
for (const chunkData of chunks) {
|
|
219
|
+
if (onChunk !== void 0) {
|
|
220
|
+
await onChunk(chunksetIdx, chunkIdx, chunkData);
|
|
221
|
+
}
|
|
222
|
+
chunkIdx += 1;
|
|
223
|
+
}
|
|
224
|
+
const a = await generateMerkleRoot(
|
|
225
|
+
chunkRoots.map((a2) => Hex2.fromHexInput(a2))
|
|
226
|
+
);
|
|
227
|
+
const entry = {
|
|
228
|
+
chunkset_root: a.toString(),
|
|
229
|
+
chunk_commitments: chunkRoots.map(
|
|
230
|
+
(chunk) => Hex2.fromHexInput(chunk).toString()
|
|
231
|
+
)
|
|
232
|
+
};
|
|
233
|
+
return { h: a, entry };
|
|
234
|
+
}
|
|
235
|
+
async function generateCommitments(provider, fullData, onChunk) {
|
|
236
|
+
const expectedChunksetSize = provider.config.chunkSizeBytes * provider.config.erasure_k;
|
|
237
|
+
const chunksetCommitments = [];
|
|
238
|
+
const chunksetCommitmentHashes = [];
|
|
239
|
+
let rawDataSize = 0;
|
|
240
|
+
const chunksetGen = readInChunks(fullData, expectedChunksetSize);
|
|
241
|
+
for await (const [chunksetIdx, chunksetData] of chunksetGen) {
|
|
242
|
+
rawDataSize += chunksetData.length;
|
|
243
|
+
const { h, entry } = await generateChunksetCommitments(
|
|
244
|
+
chunksetIdx,
|
|
245
|
+
chunksetData,
|
|
246
|
+
expectedChunksetSize,
|
|
247
|
+
provider,
|
|
248
|
+
onChunk
|
|
249
|
+
);
|
|
250
|
+
chunksetCommitments.push(entry);
|
|
251
|
+
chunksetCommitmentHashes.push(h);
|
|
252
|
+
}
|
|
253
|
+
if (rawDataSize === 0) {
|
|
254
|
+
const zeroChunkset = new Uint8Array(expectedChunksetSize);
|
|
255
|
+
const { h, entry } = await generateChunksetCommitments(
|
|
256
|
+
0,
|
|
257
|
+
zeroChunkset,
|
|
258
|
+
expectedChunksetSize,
|
|
259
|
+
provider,
|
|
260
|
+
onChunk
|
|
261
|
+
);
|
|
262
|
+
chunksetCommitments.push(entry);
|
|
263
|
+
chunksetCommitmentHashes.push(h);
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
schema_version: COMMITMENT_SCHEMA_VERSION,
|
|
267
|
+
raw_data_size: rawDataSize,
|
|
268
|
+
blob_merkle_root: (await generateMerkleRoot(chunksetCommitmentHashes)).toString(),
|
|
269
|
+
chunkset_commitments: chunksetCommitments
|
|
270
|
+
};
|
|
271
|
+
}
|
|
13
272
|
export {
|
|
14
273
|
BlobCommitmentsSchema,
|
|
15
274
|
COMMITMENT_SCHEMA_VERSION,
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -6,19 +6,19 @@ declare const NetworkToShelbyRPCBaseUrl: {
|
|
|
6
6
|
readonly devnet: undefined;
|
|
7
7
|
readonly testnet: "https://api.testnet.shelby.xyz/shelby";
|
|
8
8
|
readonly mainnet: undefined;
|
|
9
|
-
readonly local:
|
|
9
|
+
readonly local: "http://localhost:9090";
|
|
10
10
|
readonly custom: undefined;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Mapping of Aptos networks to Shelby Blob indexer services.
|
|
14
14
|
*/
|
|
15
15
|
declare const NetworkToShelbyBlobIndexerBaseUrl: {
|
|
16
|
-
readonly shelbynet: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/
|
|
16
|
+
readonly shelbynet: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/alias/shelby/shelbynet/v1/graphql";
|
|
17
17
|
readonly netna: undefined;
|
|
18
18
|
readonly devnet: undefined;
|
|
19
|
-
readonly testnet: "https://api.testnet.aptoslabs.com/nocode/v1/public/
|
|
19
|
+
readonly testnet: "https://api.testnet.aptoslabs.com/nocode/v1/public/alias/shelby/testnet/v1/graphql";
|
|
20
20
|
readonly mainnet: undefined;
|
|
21
|
-
readonly local:
|
|
21
|
+
readonly local: "http://localhost:8091/v1/graphql";
|
|
22
22
|
readonly custom: undefined;
|
|
23
23
|
};
|
|
24
24
|
/**
|
package/dist/core/constants.mjs
CHANGED
|
@@ -1,19 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
// src/core/constants.ts
|
|
2
|
+
import { Network } from "@aptos-labs/ts-sdk";
|
|
3
|
+
var DEFAULT_PROJECT_NAME = "shelby";
|
|
4
|
+
var DEFAULT_PROJECT_DESCRIPTION = "High performance, decentralized storage";
|
|
5
|
+
var NetworkToShelbyRPCBaseUrl = {
|
|
6
|
+
[Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/shelby",
|
|
7
|
+
[Network.NETNA]: void 0,
|
|
8
|
+
[Network.DEVNET]: void 0,
|
|
9
|
+
[Network.TESTNET]: "https://api.testnet.shelby.xyz/shelby",
|
|
10
|
+
[Network.MAINNET]: void 0,
|
|
11
|
+
[Network.LOCAL]: "http://localhost:9090",
|
|
12
|
+
[Network.CUSTOM]: void 0
|
|
13
|
+
};
|
|
14
|
+
var NetworkToShelbyBlobIndexerBaseUrl = {
|
|
15
|
+
[Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/alias/shelby/shelbynet/v1/graphql",
|
|
16
|
+
[Network.NETNA]: void 0,
|
|
17
|
+
[Network.DEVNET]: void 0,
|
|
18
|
+
[Network.TESTNET]: "https://api.testnet.aptoslabs.com/nocode/v1/public/alias/shelby/testnet/v1/graphql",
|
|
19
|
+
[Network.MAINNET]: void 0,
|
|
20
|
+
[Network.LOCAL]: "http://localhost:8091/v1/graphql",
|
|
21
|
+
[Network.CUSTOM]: void 0
|
|
22
|
+
};
|
|
23
|
+
var NetworkToGasStationBaseUrl = {
|
|
24
|
+
[Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/gs/v1",
|
|
25
|
+
[Network.NETNA]: void 0,
|
|
26
|
+
[Network.DEVNET]: void 0,
|
|
27
|
+
[Network.TESTNET]: "https://api.testnet.shelby.xyz/gs/v1",
|
|
28
|
+
[Network.MAINNET]: void 0,
|
|
29
|
+
[Network.LOCAL]: void 0,
|
|
30
|
+
[Network.CUSTOM]: void 0
|
|
31
|
+
};
|
|
32
|
+
var SHELBY_DEPLOYER = "0x85fdb9a176ab8ef1d9d9c1b60d60b3924f0800ac1de1cc2085fb0b8bb4988e6a";
|
|
33
|
+
var MICROPAYMENTS_DEPLOYER = "0x1ae7275148bf6ef742b658fd9cbcc2e094201606f4a7bc707bab0201da8043ee";
|
|
34
|
+
var TOKEN_DEPLOYER = "0x33009e852be7f93762dd0bf303383c2cb2c5cab7a30d8238ca5f9f177ae75124";
|
|
35
|
+
var TOKEN_OBJECT_ADDRESS = "0x249f5c642a63885ff88a5113b3ba0079840af5a1357706f8c7f3bfc5dd12511f";
|
|
36
|
+
var SHELBYUSD_TOKEN_ADDRESS = TOKEN_OBJECT_ADDRESS;
|
|
37
|
+
var SHELBYUSD_TOKEN_MODULE = "shelby_usd";
|
|
38
|
+
var SHELBYUSD_TOKEN_NAME = "ShelbyUSD";
|
|
39
|
+
var SHELBYUSD_FA_METADATA_ADDRESS = "0x1b18363a9f1fe5e6ebf247daba5cc1c18052bb232efdc4c50f556053922d98e1";
|
|
17
40
|
export {
|
|
18
41
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
19
42
|
DEFAULT_PROJECT_NAME,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@shelby-protocol/clay-codes';
|
|
2
|
-
export { b as ClayConfig, g as ClayDecodeConfig, f as ClayErasureCodeParams, C as ClayErasureCodingProvider, c as ClayProviderOptions, h as buildClayConfig } from '../../clay-codes-
|
|
2
|
+
export { b as ClayConfig, g as ClayDecodeConfig, f as ClayErasureCodeParams, C as ClayErasureCodingProvider, c as ClayProviderOptions, h as buildClayConfig } from '../../clay-codes-DdXABBDx.js';
|
|
@@ -1,8 +1,133 @@
|
|
|
1
|
+
// src/core/erasure/clay-codes.ts
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "
|
|
5
|
-
|
|
3
|
+
createDecoder,
|
|
4
|
+
createEncoder
|
|
5
|
+
} from "@shelby-protocol/clay-codes";
|
|
6
|
+
function getTotalChunks(config) {
|
|
7
|
+
return config.erasure_n;
|
|
8
|
+
}
|
|
9
|
+
var ClayErasureCodingProvider = class _ClayErasureCodingProvider {
|
|
10
|
+
config;
|
|
11
|
+
encoderCache;
|
|
12
|
+
decoderCache;
|
|
13
|
+
lastFunction;
|
|
14
|
+
constructor(config) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.lastFunction = "none" /* NONE */;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Static factory method to create an initialized ClayErasureCodingProvider
|
|
20
|
+
*/
|
|
21
|
+
static async create(config) {
|
|
22
|
+
const provider = new _ClayErasureCodingProvider(config);
|
|
23
|
+
[provider.encoderCache, provider.decoderCache] = await Promise.all([
|
|
24
|
+
createEncoder({
|
|
25
|
+
n: getTotalChunks(config),
|
|
26
|
+
k: config.erasure_k,
|
|
27
|
+
d: config.erasure_d,
|
|
28
|
+
chunkSizeBytes: config.chunkSizeBytes
|
|
29
|
+
}),
|
|
30
|
+
createDecoder({
|
|
31
|
+
n: getTotalChunks(config),
|
|
32
|
+
k: config.erasure_k,
|
|
33
|
+
d: config.erasure_d,
|
|
34
|
+
chunkSizeBytes: config.chunkSizeBytes,
|
|
35
|
+
erasedChunkIndexes: []
|
|
36
|
+
})
|
|
37
|
+
]);
|
|
38
|
+
return provider;
|
|
39
|
+
}
|
|
40
|
+
encode(data) {
|
|
41
|
+
const { erasure_k, chunkSizeBytes } = this.config;
|
|
42
|
+
if (!this.encoderCache) {
|
|
43
|
+
throw new Error("Encoder cache is missing");
|
|
44
|
+
}
|
|
45
|
+
const systematicCapacity = erasure_k * chunkSizeBytes;
|
|
46
|
+
if (data.byteLength > systematicCapacity) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Data size ${data.byteLength} bytes exceeds systematic capacity ${systematicCapacity} bytes (erasure_k=${erasure_k} * chunkSizeBytes=${chunkSizeBytes}).`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
if (this.requiresPadding(data.length)) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Data size ${data.length} bytes does not match systematic capacity ${systematicCapacity} bytes (erasure_k=${erasure_k} * chunkSizeBytes=${chunkSizeBytes}). Provide pre-padded data before encoding.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
this.lastFunction = "encoded" /* ENCODED */;
|
|
57
|
+
return this.encoderCache.erasureCode(data);
|
|
58
|
+
}
|
|
59
|
+
decode(available, config) {
|
|
60
|
+
if (!this.decoderCache) {
|
|
61
|
+
throw new Error("Decoder cache is missing");
|
|
62
|
+
}
|
|
63
|
+
const { erasure_k, chunkSizeBytes } = this.config;
|
|
64
|
+
if (available.length < erasure_k) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Insufficient available chunks: need at least ${erasure_k}, received ${available.length}.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
for (let i = 0; i < available.length; i++) {
|
|
70
|
+
const chunk = available[i];
|
|
71
|
+
if (chunk.length !== chunkSizeBytes) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`Chunk ${i} size ${chunk.length} bytes does not match expected chunkSizeBytes ${chunkSizeBytes}.`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
this.lastFunction = "decoded" /* DECODED */;
|
|
78
|
+
return this.decoderCache.decode(available, config);
|
|
79
|
+
}
|
|
80
|
+
getChunkMerkleRoots() {
|
|
81
|
+
if (this.decoderCache && this.lastFunction === "decoded" /* DECODED */)
|
|
82
|
+
return this.decoderCache.getChunkMerkleRoots();
|
|
83
|
+
if (this.encoderCache && this.lastFunction === "encoded" /* ENCODED */)
|
|
84
|
+
return this.encoderCache.getChunkMerkleRoots();
|
|
85
|
+
throw new Error(
|
|
86
|
+
"You must call encode or decode before calling getChunkMerkleRoots"
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Determines if data can be erasure coded as-is or requires padding.
|
|
91
|
+
*
|
|
92
|
+
* Data can be erasure coded without padding if its size exactly matches
|
|
93
|
+
* the total systematic data capacity (k * chunkSizeBytes).
|
|
94
|
+
*
|
|
95
|
+
* @param dataSize - Size of the data in bytes
|
|
96
|
+
* @returns true if data needs padding, false if it can be coded as-is
|
|
97
|
+
*/
|
|
98
|
+
requiresPadding(dataSize) {
|
|
99
|
+
const { erasure_k, chunkSizeBytes } = this.config;
|
|
100
|
+
const systematicCapacity = erasure_k * chunkSizeBytes;
|
|
101
|
+
return dataSize !== systematicCapacity;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function buildClayConfig(input) {
|
|
105
|
+
const { erasure_n, erasure_k, erasure_d, chunkSizeBytes, enumIndex } = input;
|
|
106
|
+
if (erasure_n <= 0)
|
|
107
|
+
throw new Error("erasure_n (total number of chunks) must be > 0");
|
|
108
|
+
if (erasure_k <= 0)
|
|
109
|
+
throw new Error("erasure_k (number of data chunks) must be > 0");
|
|
110
|
+
if (erasure_k >= erasure_n)
|
|
111
|
+
throw new Error(
|
|
112
|
+
`erasure_k (${erasure_k}) must be < erasure_n (${erasure_n})`
|
|
113
|
+
);
|
|
114
|
+
if (erasure_d <= erasure_k)
|
|
115
|
+
throw new Error(
|
|
116
|
+
`erasure_d (${erasure_d}) must be > erasure_k (${erasure_k})`
|
|
117
|
+
);
|
|
118
|
+
if (erasure_d >= erasure_n)
|
|
119
|
+
throw new Error(
|
|
120
|
+
`erasure_d (${erasure_d}) must be < erasure_n (${erasure_n})`
|
|
121
|
+
);
|
|
122
|
+
if (chunkSizeBytes <= 0) throw new Error("chunkSizeBytes must be > 0");
|
|
123
|
+
return {
|
|
124
|
+
erasure_n,
|
|
125
|
+
erasure_k,
|
|
126
|
+
erasure_d,
|
|
127
|
+
chunkSizeBytes,
|
|
128
|
+
enumIndex
|
|
129
|
+
};
|
|
130
|
+
}
|
|
6
131
|
export {
|
|
7
132
|
ClayErasureCodingProvider,
|
|
8
133
|
buildClayConfig
|
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
// src/core/erasure/constants.ts
|
|
2
|
+
var ErasureCodingScheme = /* @__PURE__ */ ((ErasureCodingScheme2) => {
|
|
3
|
+
ErasureCodingScheme2["ClayCode_16Total_10Data_13Helper"] = "ClayCode_16Total_10Data_13Helper";
|
|
4
|
+
ErasureCodingScheme2["ClayCode_4Total_2Data_3Helper"] = "ClayCode_4Total_2Data_3Helper";
|
|
5
|
+
return ErasureCodingScheme2;
|
|
6
|
+
})(ErasureCodingScheme || {});
|
|
7
|
+
var ERASURE_CODE_PARAMS = {
|
|
8
|
+
["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */]: {
|
|
9
|
+
// total chunks (data + parity)
|
|
10
|
+
erasure_n: 16,
|
|
11
|
+
// data chunks
|
|
12
|
+
erasure_k: 10,
|
|
13
|
+
// helper nodes
|
|
14
|
+
erasure_d: 13,
|
|
15
|
+
// enum index
|
|
16
|
+
enumIndex: 0
|
|
17
|
+
},
|
|
18
|
+
["ClayCode_4Total_2Data_3Helper" /* ClayCode_4Total_2Data_3Helper */]: {
|
|
19
|
+
// total chunks (data + parity)
|
|
20
|
+
erasure_n: 4,
|
|
21
|
+
// data chunks
|
|
22
|
+
erasure_k: 2,
|
|
23
|
+
// helper nodes
|
|
24
|
+
erasure_d: 3,
|
|
25
|
+
// enum index
|
|
26
|
+
enumIndex: 1
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var DEFAULT_ERASURE_N = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_n;
|
|
30
|
+
var DEFAULT_ERASURE_K = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_k;
|
|
31
|
+
var DEFAULT_ERASURE_D = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_d;
|
|
32
|
+
var DEFAULT_ERASURE_M = DEFAULT_ERASURE_N - DEFAULT_ERASURE_K;
|
|
33
|
+
var DEFAULT_SAMPLE_SIZE = 1024;
|
|
11
34
|
export {
|
|
12
35
|
DEFAULT_ERASURE_D,
|
|
13
36
|
DEFAULT_ERASURE_K,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ClayErasureCodingProvider, b as ClayConfig } from '../../clay-codes-
|
|
1
|
+
import { C as ClayErasureCodingProvider, b as ClayConfig } from '../../clay-codes-DdXABBDx.js';
|
|
2
2
|
import '@shelby-protocol/clay-codes';
|
|
3
3
|
|
|
4
4
|
declare function createDefaultErasureCodingProvider(): Promise<ClayErasureCodingProvider>;
|