@shelby-protocol/sdk 0.0.1-experimental.4 → 0.0.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/README.md +41 -0
- package/dist/browser/index.d.ts +17 -8
- package/dist/browser/index.mjs +83 -34
- package/dist/chunk-3ZDXWPYC.mjs +65 -0
- package/dist/chunk-6MDQI7PW.mjs +177 -0
- package/dist/chunk-75VHXY5P.mjs +48 -0
- package/dist/chunk-APML3CGJ.mjs +176 -0
- package/dist/chunk-DLMDDEWF.mjs +112 -0
- package/dist/{chunk-C33H3C3N.mjs → chunk-EAPAG4L7.mjs} +1 -1
- package/dist/{chunk-GGYTHP5F.mjs → chunk-FIFKKWXV.mjs} +19 -17
- package/dist/chunk-HPVCKAN2.mjs +41 -0
- package/dist/{chunk-2FF5FICZ.mjs → chunk-JSR44EDC.mjs} +96 -42
- package/dist/chunk-KBUWZXFA.mjs +92 -0
- package/dist/chunk-LTV26KU4.mjs +141 -0
- package/dist/chunk-NTJSNNA7.mjs +175 -0
- package/dist/{chunk-QEMIORTL.mjs → chunk-OTBLZL2S.mjs} +1 -1
- package/dist/chunk-RBFWGDMY.mjs +30 -0
- package/dist/chunk-VRLIOKWG.mjs +11 -0
- package/dist/chunk-XGMJ4CG4.mjs +384 -0
- package/dist/chunk-Z7RFCADT.mjs +0 -0
- package/dist/chunk-ZPW742E7.mjs +28 -0
- package/dist/clay-codes-Ce9EmXfa.d.ts +129 -0
- package/dist/core/blobs.mjs +1 -1
- package/dist/core/chunk.d.ts +34 -0
- package/dist/core/chunk.mjs +17 -0
- package/dist/core/clients/ShelbyBlobClient.d.ts +121 -89
- package/dist/core/clients/ShelbyBlobClient.mjs +11 -3
- package/dist/core/clients/ShelbyClient.d.ts +71 -30
- package/dist/core/clients/ShelbyClient.mjs +14 -9
- package/dist/core/clients/ShelbyClientConfig.d.ts +43 -9
- package/dist/core/clients/ShelbyClientConfig.mjs +1 -0
- package/dist/core/clients/ShelbyRPCClient.d.ts +47 -20
- package/dist/core/clients/ShelbyRPCClient.mjs +10 -3
- package/dist/core/clients/index.d.ts +10 -5
- package/dist/core/clients/index.mjs +16 -10
- package/dist/core/clients/utils.d.ts +7 -0
- package/dist/core/clients/utils.mjs +7 -0
- package/dist/core/commitments.d.ts +18 -18
- package/dist/core/commitments.mjs +7 -5
- package/dist/core/constants.d.ts +24 -19
- package/dist/core/constants.mjs +15 -15
- package/dist/core/erasure/clay-codes.d.ts +2 -0
- package/dist/core/erasure/clay-codes.mjs +9 -0
- package/dist/core/erasure/constants.d.ts +48 -0
- package/dist/core/erasure/constants.mjs +17 -0
- package/dist/core/erasure/default.d.ts +6 -0
- package/dist/core/erasure/default.mjs +9 -0
- package/dist/core/erasure/index.d.ts +4 -0
- package/dist/core/erasure/index.mjs +27 -0
- package/dist/core/erasure/provider.d.ts +2 -0
- package/dist/core/erasure/provider.mjs +0 -0
- package/dist/core/erasure/reed-solomon.d.ts +2 -0
- package/dist/core/erasure/reed-solomon.mjs +7 -0
- package/dist/core/erasure/utils.d.ts +12 -0
- package/dist/core/erasure/utils.mjs +33 -0
- package/dist/core/index.d.ts +17 -8
- package/dist/core/index.mjs +83 -34
- package/dist/core/layout.mjs +4 -2
- package/dist/core/networks.d.ts +7 -0
- package/dist/core/networks.mjs +9 -0
- package/dist/core/operations/generated/sdk.d.ts +686 -0
- package/dist/core/operations/generated/sdk.mjs +23 -0
- package/dist/core/operations/index.d.ts +31 -0
- package/dist/core/operations/index.mjs +12 -0
- package/dist/core/strings.d.ts +6 -0
- package/dist/core/strings.mjs +9 -0
- package/dist/core/types/blobs.d.ts +49 -79
- package/dist/core/types/encodings.d.ts +5 -13
- package/dist/core/types/encodings.mjs +0 -1
- package/dist/core/types/index.d.ts +4 -2
- package/dist/core/types/index.mjs +1 -1
- package/dist/core/types/placement_groups.d.ts +15 -0
- package/dist/core/types/placement_groups.mjs +0 -0
- package/dist/core/types/storage_providers.d.ts +31 -0
- package/dist/core/types/storage_providers.mjs +1 -0
- package/dist/core/utils.d.ts +15 -3
- package/dist/core/utils.mjs +5 -3
- package/dist/node/clients/ShelbyMetadataClient.d.ts +72 -0
- package/dist/node/clients/ShelbyMetadataClient.mjs +9 -0
- package/dist/node/clients/ShelbyNodeClient.d.ts +8 -3
- package/dist/node/clients/ShelbyNodeClient.mjs +15 -10
- package/dist/node/clients/index.d.ts +12 -5
- package/dist/node/clients/index.mjs +20 -11
- package/dist/node/index.d.ts +18 -8
- package/dist/node/index.mjs +89 -36
- package/package.json +25 -12
- package/dist/chunk-5Z3RVWU3.mjs +0 -67
- package/dist/chunk-B3CB2YEO.mjs +0 -318
- package/dist/chunk-D2FERD4A.mjs +0 -39
- package/dist/chunk-G263DBCY.mjs +0 -105
- package/dist/chunk-P7BVGLTV.mjs +0 -32
- package/dist/chunk-QM5BVKLD.mjs +0 -109
- package/dist/core/erasure.d.ts +0 -6
- package/dist/core/erasure.mjs +0 -7
- /package/dist/{chunk-7S6RVKYB.mjs → chunk-MB7C7VQF.mjs} +0 -0
- /package/dist/{chunk-IHTPXUYI.mjs → chunk-MQUVYMNQ.mjs} +0 -0
- /package/dist/{chunk-PLUDE5C3.mjs → chunk-RNXGC54D.mjs} +0 -0
- /package/dist/{chunk-QKT5R735.mjs → chunk-TUANYVZQ.mjs} +0 -0
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyRPCClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-JSR44EDC.mjs";
|
|
4
|
+
import "../../chunk-75VHXY5P.mjs";
|
|
5
|
+
import "../../chunk-DLMDDEWF.mjs";
|
|
6
|
+
import "../../chunk-RBFWGDMY.mjs";
|
|
6
7
|
import "../../chunk-I6NG5GNL.mjs";
|
|
8
|
+
import "../../chunk-KBUWZXFA.mjs";
|
|
9
|
+
import "../../chunk-HPVCKAN2.mjs";
|
|
10
|
+
import "../../chunk-FIFKKWXV.mjs";
|
|
11
|
+
import "../../chunk-APML3CGJ.mjs";
|
|
12
|
+
import "../../chunk-3ZDXWPYC.mjs";
|
|
13
|
+
import "../../chunk-ZPW742E7.mjs";
|
|
7
14
|
import "../../chunk-7P6ASYW6.mjs";
|
|
8
15
|
export {
|
|
9
16
|
ShelbyRPCClient
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export { ShelbyBlobClient } from './ShelbyBlobClient.js';
|
|
2
|
-
export { ShelbyClient } from './ShelbyClient.js';
|
|
3
|
-
export { ShelbyClientConfig } from './ShelbyClientConfig.js';
|
|
2
|
+
export { ShelbyClient, UploadOptions } from './ShelbyClient.js';
|
|
3
|
+
export { ShelbyClientConfig, ShelbyIndexerConfig, ShelbyRPCConfig } from './ShelbyClientConfig.js';
|
|
4
4
|
export { ShelbyRPCClient } from './ShelbyRPCClient.js';
|
|
5
5
|
import '@aptos-labs/ts-sdk';
|
|
6
|
-
import '../commitments.js';
|
|
7
|
-
import 'zod';
|
|
8
|
-
import '../types/encodings.js';
|
|
9
6
|
import '../layout.js';
|
|
7
|
+
import 'zod';
|
|
10
8
|
import '../types/blobs.js';
|
|
9
|
+
import '../../clay-codes-Ce9EmXfa.js';
|
|
10
|
+
import '@shelby-protocol/clay-codes';
|
|
11
|
+
import '../operations/index.js';
|
|
12
|
+
import '../operations/generated/sdk.js';
|
|
13
|
+
import 'graphql';
|
|
14
|
+
import 'graphql-request';
|
|
15
|
+
import '../networks.js';
|
|
11
16
|
import '../blobs.js';
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import "../../chunk-
|
|
1
|
+
import "../../chunk-RNXGC54D.mjs";
|
|
2
2
|
import {
|
|
3
3
|
ShelbyClient
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-6MDQI7PW.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ShelbyBlobClient
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-XGMJ4CG4.mjs";
|
|
8
|
+
import "../../chunk-Z7RFCADT.mjs";
|
|
8
9
|
import {
|
|
9
10
|
ShelbyRPCClient
|
|
10
|
-
} from "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-P7BVGLTV.mjs";
|
|
15
|
-
import "../../chunk-GGYTHP5F.mjs";
|
|
16
|
-
import "../../chunk-D2FERD4A.mjs";
|
|
11
|
+
} from "../../chunk-JSR44EDC.mjs";
|
|
12
|
+
import "../../chunk-75VHXY5P.mjs";
|
|
13
|
+
import "../../chunk-DLMDDEWF.mjs";
|
|
14
|
+
import "../../chunk-RBFWGDMY.mjs";
|
|
17
15
|
import "../../chunk-I6NG5GNL.mjs";
|
|
16
|
+
import "../../chunk-OTBLZL2S.mjs";
|
|
17
|
+
import "../../chunk-LTV26KU4.mjs";
|
|
18
|
+
import "../../chunk-KBUWZXFA.mjs";
|
|
19
|
+
import "../../chunk-HPVCKAN2.mjs";
|
|
20
|
+
import "../../chunk-FIFKKWXV.mjs";
|
|
21
|
+
import "../../chunk-APML3CGJ.mjs";
|
|
22
|
+
import "../../chunk-3ZDXWPYC.mjs";
|
|
23
|
+
import "../../chunk-ZPW742E7.mjs";
|
|
18
24
|
import "../../chunk-7P6ASYW6.mjs";
|
|
19
25
|
export {
|
|
20
26
|
ShelbyBlobClient,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { a as ErasureCodingProvider } from '../clay-codes-Ce9EmXfa.js';
|
|
3
|
+
import '@shelby-protocol/clay-codes';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Defines the schema for the commitment format in commitments.json
|
|
@@ -42,6 +43,7 @@ declare const ChunksetCommitmentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
42
43
|
chunk_commitments: string[];
|
|
43
44
|
}>;
|
|
44
45
|
type ChunksetCommitment = z.infer<typeof ChunksetCommitmentSchema>;
|
|
46
|
+
declare function expectedTotalChunksets(rawSize: number, chunksetSize?: number): number;
|
|
45
47
|
/**
|
|
46
48
|
* Represents the (serializable) commitment schema for a single blob.
|
|
47
49
|
*/
|
|
@@ -99,33 +101,31 @@ declare const BlobCommitmentsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
99
101
|
}[];
|
|
100
102
|
}>;
|
|
101
103
|
type BlobCommitments = z.infer<typeof BlobCommitmentsSchema>;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* Callback is also a werid interface into this; I'm not entirely happy with it,
|
|
111
|
-
* but I want this logic to be centralized into a single helper then the rest of
|
|
112
|
-
* the code can be completely agnostic to coding scheme and layout of a chunkset.
|
|
113
|
-
*/
|
|
104
|
+
interface GenerateCommitmentsOptions {
|
|
105
|
+
/**
|
|
106
|
+
* When true (default) chunksets are zero padded before encoding.
|
|
107
|
+
* Disable only when the incoming data already matches the provider's
|
|
108
|
+
* systematic capacity and you need to preserve raw byte layout.
|
|
109
|
+
*/
|
|
110
|
+
pad?: boolean;
|
|
111
|
+
}
|
|
114
112
|
/**
|
|
115
113
|
* Generates the blob commitments for a given data stream.
|
|
116
114
|
*
|
|
115
|
+
* @param provider - Erasure coding backend that will expand chunksets.
|
|
117
116
|
* @param fullData - The data stream to generate commitments for.
|
|
118
117
|
* @param onChunk - A callback that is called for each chunk of data.
|
|
119
|
-
* @param options -
|
|
118
|
+
* @param options - Optional overrides for padding behaviour.
|
|
120
119
|
*
|
|
121
120
|
* @returns The blob commitments.
|
|
122
121
|
*
|
|
123
122
|
* @example
|
|
124
123
|
* ```typescript
|
|
125
|
-
* const buffer =
|
|
126
|
-
* const
|
|
124
|
+
* const buffer = new TextEncoder().encode("Hello, world!");
|
|
125
|
+
* const provider = await createDefaultErasureCodingProvider();
|
|
126
|
+
* const commitments = await generateCommitments(provider, buffer);
|
|
127
127
|
* ```
|
|
128
128
|
*/
|
|
129
|
-
declare function generateCommitments(fullData: ReadableStream |
|
|
129
|
+
declare function generateCommitments(provider: ErasureCodingProvider, fullData: ReadableStream<Uint8Array> | Uint8Array, onChunk?: (chunksetIdx: number, chunkIdx: number, chunkData: Uint8Array) => Promise<void> | void, options?: GenerateCommitmentsOptions): Promise<BlobCommitments>;
|
|
130
130
|
|
|
131
|
-
export { type BlobCommitments, BlobCommitmentsSchema, type ChunksetCommitment, ChunksetCommitmentSchema, generateCommitments };
|
|
131
|
+
export { type BlobCommitments, BlobCommitmentsSchema, type ChunksetCommitment, ChunksetCommitmentSchema, type GenerateCommitmentsOptions, expectedTotalChunksets, generateCommitments };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlobCommitmentsSchema,
|
|
3
3
|
ChunksetCommitmentSchema,
|
|
4
|
+
expectedTotalChunksets,
|
|
4
5
|
generateCommitments
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-LTV26KU4.mjs";
|
|
7
|
+
import "../chunk-KBUWZXFA.mjs";
|
|
8
|
+
import "../chunk-APML3CGJ.mjs";
|
|
9
|
+
import "../chunk-3ZDXWPYC.mjs";
|
|
10
|
+
import "../chunk-ZPW742E7.mjs";
|
|
10
11
|
import "../chunk-7P6ASYW6.mjs";
|
|
11
12
|
export {
|
|
12
13
|
BlobCommitmentsSchema,
|
|
13
14
|
ChunksetCommitmentSchema,
|
|
15
|
+
expectedTotalChunksets,
|
|
14
16
|
generateCommitments
|
|
15
17
|
};
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
declare const DEFAULT_PROJECT_NAME = "shelby";
|
|
2
2
|
declare const DEFAULT_PROJECT_DESCRIPTION = "High performance, decentralized storage";
|
|
3
|
-
declare const
|
|
3
|
+
declare const NetworkToShelbyRPCBaseUrl: {
|
|
4
|
+
readonly shelbynet: "https://api.shelbynet.shelby.xyz/shelby";
|
|
5
|
+
readonly devnet: undefined;
|
|
6
|
+
readonly testnet: undefined;
|
|
7
|
+
readonly mainnet: undefined;
|
|
8
|
+
readonly local: undefined;
|
|
9
|
+
readonly custom: undefined;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Mapping of Aptos networks to Shelby Blob indexer services.
|
|
13
|
+
*/
|
|
14
|
+
declare const NetworkToShelbyBlobIndexerBaseUrl: {
|
|
15
|
+
readonly shelbynet: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/cmforrguw0042s601fn71f9l2/v1/graphql";
|
|
16
|
+
readonly devnet: undefined;
|
|
17
|
+
readonly testnet: undefined;
|
|
18
|
+
readonly mainnet: undefined;
|
|
19
|
+
readonly local: undefined;
|
|
20
|
+
readonly custom: undefined;
|
|
21
|
+
};
|
|
4
22
|
declare const SHELBY_DEPLOYER = "0xc63d6a5efb0080a6029403131715bd4971e1149f7cc099aac69bb0069b3ddbf5";
|
|
5
23
|
declare const TOKEN_DEPLOYER = "0x33009e852be7f93762dd0bf303383c2cb2c5cab7a30d8238ca5f9f177ae75124";
|
|
6
24
|
declare const TOKEN_OBJECT_ADDRESS = "0x249f5c642a63885ff88a5113b3ba0079840af5a1357706f8c7f3bfc5dd12511f";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* The number of data chunks in the erasure coding scheme.
|
|
12
|
-
*/
|
|
13
|
-
declare const ERASURE_K = 2;
|
|
14
|
-
/**
|
|
15
|
-
* The number of parity chunks in the erasure coding scheme.
|
|
16
|
-
*/
|
|
17
|
-
declare const ERASURE_M = 1;
|
|
18
|
-
/**
|
|
19
|
-
* The default size of a chunkset in bytes.
|
|
20
|
-
*/
|
|
21
|
-
declare const CHUNKSET_SIZE_BYTES: number;
|
|
22
|
-
declare function getChunksetSizeBytes(): number;
|
|
23
|
-
declare function getChunkSizeBytes(): number;
|
|
25
|
+
declare const SHELBYUSD_TOKEN_ADDRESS = "0x249f5c642a63885ff88a5113b3ba0079840af5a1357706f8c7f3bfc5dd12511f";
|
|
26
|
+
declare const SHELBYUSD_TOKEN_MODULE = "shelby_usd";
|
|
27
|
+
declare const SHELBYUSD_TOKEN_NAME = "ShelbyUSD";
|
|
28
|
+
declare const SHELBYUSD_TOKEN_TYPE: "0x249f5c642a63885ff88a5113b3ba0079840af5a1357706f8c7f3bfc5dd12511f::shelby_usd::ShelbyUSD";
|
|
24
29
|
|
|
25
|
-
export {
|
|
30
|
+
export { DEFAULT_PROJECT_DESCRIPTION, DEFAULT_PROJECT_NAME, NetworkToShelbyBlobIndexerBaseUrl, NetworkToShelbyRPCBaseUrl, SHELBYUSD_TOKEN_ADDRESS, SHELBYUSD_TOKEN_MODULE, SHELBYUSD_TOKEN_NAME, SHELBYUSD_TOKEN_TYPE, SHELBY_DEPLOYER, TOKEN_DEPLOYER, TOKEN_OBJECT_ADDRESS };
|
package/dist/core/constants.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CHUNKSET_SIZE_BYTES,
|
|
3
2
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
4
3
|
DEFAULT_PROJECT_NAME,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
NetworkToShelbyBlobIndexerBaseUrl,
|
|
5
|
+
NetworkToShelbyRPCBaseUrl,
|
|
6
|
+
SHELBYUSD_TOKEN_ADDRESS,
|
|
7
|
+
SHELBYUSD_TOKEN_MODULE,
|
|
8
|
+
SHELBYUSD_TOKEN_NAME,
|
|
9
|
+
SHELBYUSD_TOKEN_TYPE,
|
|
8
10
|
SHELBY_DEPLOYER,
|
|
9
11
|
TOKEN_DEPLOYER,
|
|
10
|
-
TOKEN_OBJECT_ADDRESS
|
|
11
|
-
|
|
12
|
-
getChunksetSizeBytes
|
|
13
|
-
} from "../chunk-D2FERD4A.mjs";
|
|
12
|
+
TOKEN_OBJECT_ADDRESS
|
|
13
|
+
} from "../chunk-HPVCKAN2.mjs";
|
|
14
14
|
import "../chunk-7P6ASYW6.mjs";
|
|
15
15
|
export {
|
|
16
|
-
CHUNKSET_SIZE_BYTES,
|
|
17
16
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
18
17
|
DEFAULT_PROJECT_NAME,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
NetworkToShelbyBlobIndexerBaseUrl,
|
|
19
|
+
NetworkToShelbyRPCBaseUrl,
|
|
20
|
+
SHELBYUSD_TOKEN_ADDRESS,
|
|
21
|
+
SHELBYUSD_TOKEN_MODULE,
|
|
22
|
+
SHELBYUSD_TOKEN_NAME,
|
|
23
|
+
SHELBYUSD_TOKEN_TYPE,
|
|
22
24
|
SHELBY_DEPLOYER,
|
|
23
25
|
TOKEN_DEPLOYER,
|
|
24
|
-
TOKEN_OBJECT_ADDRESS
|
|
25
|
-
getChunkSizeBytes,
|
|
26
|
-
getChunksetSizeBytes
|
|
26
|
+
TOKEN_OBJECT_ADDRESS
|
|
27
27
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE: In some places, this file uses `snake_case` for field names.
|
|
3
|
+
* This deviates from the normal camelCase convention, but is intentional to match external specs/protocols.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Erasure coding schemes supported by Shelby.
|
|
7
|
+
*/
|
|
8
|
+
declare enum ErasureCodingScheme {
|
|
9
|
+
ClayCode_16Total_10Data_13Helper = "ClayCode_16Total_10Data_13Helper"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Union of all supported erasure coding parameter types.
|
|
13
|
+
* When new erasure schemes are added, union them to this type.
|
|
14
|
+
*/
|
|
15
|
+
type ErasureSchemeParams = (typeof ERASURE_CODE_PARAMS)["ClayCode_16Total_10Data_13Helper"] /** | ReedSolomonErasureCodeParams */;
|
|
16
|
+
type ErasureCodeParams = Record<ErasureCodingScheme, ErasureSchemeParams>;
|
|
17
|
+
/**
|
|
18
|
+
* Parameters for each supported erasure coding scheme.
|
|
19
|
+
*
|
|
20
|
+
* - `erasure_n`: Total number of chunks (data + parity)
|
|
21
|
+
* - `erasure_k`: Number of data chunks required to reconstruct original data
|
|
22
|
+
* - `erasure_d`: Number of helper nodes
|
|
23
|
+
*/
|
|
24
|
+
declare const ERASURE_CODE_PARAMS: {
|
|
25
|
+
readonly ClayCode_16Total_10Data_13Helper: {
|
|
26
|
+
readonly erasure_n: 16;
|
|
27
|
+
readonly erasure_k: 10;
|
|
28
|
+
readonly erasure_d: 13;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The total number of chunks (data + parity) in the erasure coding scheme.
|
|
33
|
+
*/
|
|
34
|
+
declare const DEFAULT_ERASURE_N: 16;
|
|
35
|
+
/**
|
|
36
|
+
* The number of data chunks in the erasure coding scheme.
|
|
37
|
+
*/
|
|
38
|
+
declare const DEFAULT_ERASURE_K: 10;
|
|
39
|
+
/**
|
|
40
|
+
* The number of helper nodes in the erasure coding scheme.
|
|
41
|
+
*/
|
|
42
|
+
declare const DEFAULT_ERASURE_D: 13;
|
|
43
|
+
/**
|
|
44
|
+
* The number of parity chunks in the erasure coding scheme (derived as n - k).
|
|
45
|
+
*/
|
|
46
|
+
declare const DEFAULT_ERASURE_M: number;
|
|
47
|
+
|
|
48
|
+
export { DEFAULT_ERASURE_D, DEFAULT_ERASURE_K, DEFAULT_ERASURE_M, DEFAULT_ERASURE_N, ERASURE_CODE_PARAMS, type ErasureCodeParams, ErasureCodingScheme, type ErasureSchemeParams };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_ERASURE_D,
|
|
3
|
+
DEFAULT_ERASURE_K,
|
|
4
|
+
DEFAULT_ERASURE_M,
|
|
5
|
+
DEFAULT_ERASURE_N,
|
|
6
|
+
ERASURE_CODE_PARAMS,
|
|
7
|
+
ErasureCodingScheme
|
|
8
|
+
} from "../../chunk-ZPW742E7.mjs";
|
|
9
|
+
import "../../chunk-7P6ASYW6.mjs";
|
|
10
|
+
export {
|
|
11
|
+
DEFAULT_ERASURE_D,
|
|
12
|
+
DEFAULT_ERASURE_K,
|
|
13
|
+
DEFAULT_ERASURE_M,
|
|
14
|
+
DEFAULT_ERASURE_N,
|
|
15
|
+
ERASURE_CODE_PARAMS,
|
|
16
|
+
ErasureCodingScheme
|
|
17
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { C as ClayErasureCodingProvider, D as DecodeConfig, E as ErasureCodingConfig, a as ErasureCodingProvider, R as ReedSolomonErasureCodingProvider } from '../../clay-codes-Ce9EmXfa.js';
|
|
2
|
+
export { DEFAULT_ERASURE_D, DEFAULT_ERASURE_K, DEFAULT_ERASURE_M, DEFAULT_ERASURE_N, ERASURE_CODE_PARAMS, ErasureCodeParams, ErasureCodingScheme, ErasureSchemeParams } from './constants.js';
|
|
3
|
+
export { createDefaultErasureCodingProvider } from './default.js';
|
|
4
|
+
import '@shelby-protocol/clay-codes';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClayErasureCodingProvider,
|
|
3
|
+
createDefaultErasureCodingProvider
|
|
4
|
+
} from "../../chunk-APML3CGJ.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ReedSolomonErasureCodingProvider
|
|
7
|
+
} from "../../chunk-3ZDXWPYC.mjs";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_ERASURE_D,
|
|
10
|
+
DEFAULT_ERASURE_K,
|
|
11
|
+
DEFAULT_ERASURE_M,
|
|
12
|
+
DEFAULT_ERASURE_N,
|
|
13
|
+
ERASURE_CODE_PARAMS,
|
|
14
|
+
ErasureCodingScheme
|
|
15
|
+
} from "../../chunk-ZPW742E7.mjs";
|
|
16
|
+
import "../../chunk-7P6ASYW6.mjs";
|
|
17
|
+
export {
|
|
18
|
+
ClayErasureCodingProvider,
|
|
19
|
+
DEFAULT_ERASURE_D,
|
|
20
|
+
DEFAULT_ERASURE_K,
|
|
21
|
+
DEFAULT_ERASURE_M,
|
|
22
|
+
DEFAULT_ERASURE_N,
|
|
23
|
+
ERASURE_CODE_PARAMS,
|
|
24
|
+
ErasureCodingScheme,
|
|
25
|
+
ReedSolomonErasureCodingProvider,
|
|
26
|
+
createDefaultErasureCodingProvider
|
|
27
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as ErasureCodingProvider } from '../../clay-codes-Ce9EmXfa.js';
|
|
2
|
+
import '@shelby-protocol/clay-codes';
|
|
3
|
+
|
|
4
|
+
declare function allocateAndCopy(data: Uint8Array, desiredLength: number): Uint8Array;
|
|
5
|
+
/**
|
|
6
|
+
* Zero-pad `data` to match the provider's systematic capacity (k * chunkSizeBytes).
|
|
7
|
+
*
|
|
8
|
+
* Returns the original buffer when it already fits the capacity and throws when it exceeds.
|
|
9
|
+
*/
|
|
10
|
+
declare function pad(provider: ErasureCodingProvider, data: Uint8Array): Uint8Array;
|
|
11
|
+
|
|
12
|
+
export { allocateAndCopy, pad };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "../../chunk-7P6ASYW6.mjs";
|
|
2
|
+
|
|
3
|
+
// src/core/erasure/utils.ts
|
|
4
|
+
function allocateAndCopy(data, desiredLength) {
|
|
5
|
+
if (data.byteLength === desiredLength) {
|
|
6
|
+
return data.slice();
|
|
7
|
+
}
|
|
8
|
+
if (data.byteLength > desiredLength) {
|
|
9
|
+
return data.subarray(0, desiredLength);
|
|
10
|
+
}
|
|
11
|
+
const buffer = new Uint8Array(desiredLength);
|
|
12
|
+
buffer.set(data);
|
|
13
|
+
return buffer;
|
|
14
|
+
}
|
|
15
|
+
function pad(provider, data) {
|
|
16
|
+
const { erasure_k, chunkSizeBytes } = provider.config;
|
|
17
|
+
const capacity = erasure_k * chunkSizeBytes;
|
|
18
|
+
if (data.byteLength > capacity) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Data size ${data.byteLength} bytes exceeds systematic capacity ${capacity} bytes.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
if (data.byteLength === capacity) {
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
const padded = new Uint8Array(capacity);
|
|
27
|
+
padded.set(data);
|
|
28
|
+
return padded;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
allocateAndCopy,
|
|
32
|
+
pad
|
|
33
|
+
};
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
export { ShelbyBlob, createBlobKey } from './blobs.js';
|
|
2
|
+
export { CHUNK_SIZE_PARAMS, ChunkSizeScheme, DEFAULT_CHUNKSET_SIZE_BYTES, DEFAULT_CHUNK_SIZE_BYTES, ERASURE_CODE_AND_CHUNK_MAPPING } from './chunk.js';
|
|
2
3
|
export { ShelbyBlobClient } from './clients/ShelbyBlobClient.js';
|
|
3
|
-
export { ShelbyClient } from './clients/ShelbyClient.js';
|
|
4
|
-
export { ShelbyClientConfig } from './clients/ShelbyClientConfig.js';
|
|
4
|
+
export { ShelbyClient, UploadOptions } from './clients/ShelbyClient.js';
|
|
5
|
+
export { ShelbyClientConfig, ShelbyIndexerConfig, ShelbyRPCConfig } from './clients/ShelbyClientConfig.js';
|
|
5
6
|
export { ShelbyRPCClient } from './clients/ShelbyRPCClient.js';
|
|
6
|
-
export { BlobCommitments, BlobCommitmentsSchema, ChunksetCommitment, ChunksetCommitmentSchema, generateCommitments } from './commitments.js';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
7
|
+
export { BlobCommitments, BlobCommitmentsSchema, ChunksetCommitment, ChunksetCommitmentSchema, GenerateCommitmentsOptions, expectedTotalChunksets, generateCommitments } from './commitments.js';
|
|
8
|
+
export { DEFAULT_PROJECT_DESCRIPTION, DEFAULT_PROJECT_NAME, NetworkToShelbyBlobIndexerBaseUrl, NetworkToShelbyRPCBaseUrl, SHELBYUSD_TOKEN_ADDRESS, SHELBYUSD_TOKEN_MODULE, SHELBYUSD_TOKEN_NAME, SHELBYUSD_TOKEN_TYPE, SHELBY_DEPLOYER, TOKEN_DEPLOYER, TOKEN_OBJECT_ADDRESS } from './constants.js';
|
|
9
|
+
export { C as ClayErasureCodingProvider, D as DecodeConfig, E as ErasureCodingConfig, a as ErasureCodingProvider, R as ReedSolomonErasureCodingProvider } from '../clay-codes-Ce9EmXfa.js';
|
|
10
|
+
export { DEFAULT_ERASURE_D, DEFAULT_ERASURE_K, DEFAULT_ERASURE_M, DEFAULT_ERASURE_N, ERASURE_CODE_PARAMS, ErasureCodeParams, ErasureCodingScheme, ErasureSchemeParams } from './erasure/constants.js';
|
|
11
|
+
export { createDefaultErasureCodingProvider } from './erasure/default.js';
|
|
9
12
|
export { BlobName, BlobNameSchema, ChunkKey, allChunksForBlob, roundSize } from './layout.js';
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
+
export { ShelbyNetwork, isShelbyNetwork, shelbyNetworks } from './networks.js';
|
|
14
|
+
export { ShelbyIndexerClient, createShelbyIndexerClient, getShelbyIndexerClient } from './operations/index.js';
|
|
15
|
+
export { BlobActivity, BlobActivityType, BlobEncoding, BlobMetadata, ClayEncoding } from './types/blobs.js';
|
|
16
|
+
export { StorageProviderInfo } from './types/storage_providers.js';
|
|
17
|
+
export { buildRequestUrl, concatHashes, readInChunks, zeroPadBytes } from './utils.js';
|
|
13
18
|
import '@aptos-labs/ts-sdk';
|
|
19
|
+
import './operations/generated/sdk.js';
|
|
20
|
+
import 'graphql';
|
|
21
|
+
import 'graphql-request';
|
|
14
22
|
import 'zod';
|
|
23
|
+
import '@shelby-protocol/clay-codes';
|