@shelby-protocol/sdk 0.1.0 → 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.
- package/dist/browser/index.d.ts +5 -4
- package/dist/browser/index.mjs +32 -24
- package/dist/{chunk-RLRI2533.mjs → chunk-2WEX3K7C.mjs} +3 -3
- package/dist/{chunk-FLLOQZVD.mjs → chunk-4ZOFT75Q.mjs} +12 -2
- package/dist/{chunk-W6YL46DT.mjs → chunk-7PN65RDX.mjs} +27 -6
- package/dist/{chunk-LZSIZJYR.mjs → chunk-AUQDI5BS.mjs} +14 -1
- package/dist/{chunk-3ZL3FSNA.mjs → chunk-CGYJLKBU.mjs} +1 -1
- package/dist/{chunk-VRLIOKWG.mjs → chunk-D6GQHO6G.mjs} +5 -1
- package/dist/{chunk-66GI734H.mjs → chunk-E5QCRTBU.mjs} +2 -2
- package/dist/chunk-HPPMI7DC.mjs +56 -0
- package/dist/{chunk-67F5YZ25.mjs → chunk-JTXYKO3U.mjs} +10 -0
- package/dist/{chunk-YZXIPUVQ.mjs → chunk-MV6FNYAU.mjs} +10 -10
- package/dist/{chunk-PZF2VTGP.mjs → chunk-NHWWORCH.mjs} +3 -1
- package/dist/{chunk-UCDAABAS.mjs → chunk-OGKZ575S.mjs} +6 -19
- package/dist/{chunk-ZAM2EUVN.mjs → chunk-PJVWGMVI.mjs} +5 -5
- package/dist/{chunk-AGRRYZWV.mjs → chunk-SRV4YWFH.mjs} +27 -13
- package/dist/{chunk-MSCUDBMH.mjs → chunk-W37FZSMA.mjs} +1 -1
- package/dist/chunk-Z4FZ7W6L.mjs +39 -0
- package/dist/{chunk-DI2K6OUG.mjs → chunk-ZEDD2MPU.mjs} +1 -1
- package/dist/{clay-codes-pdZFxI_B.d.ts → clay-codes-DHP-bYcP.d.ts} +6 -2
- package/dist/core/blobs.d.ts +2 -0
- package/dist/core/chunk.d.ts +10 -1
- package/dist/core/chunk.mjs +2 -2
- package/dist/core/clients/ShelbyBlobClient.d.ts +5 -1
- package/dist/core/clients/ShelbyBlobClient.mjs +9 -9
- package/dist/core/clients/ShelbyClient.d.ts +7 -1
- package/dist/core/clients/ShelbyClient.mjs +13 -12
- package/dist/{node → core}/clients/ShelbyMetadataClient.d.ts +3 -3
- package/dist/{node → core}/clients/ShelbyMetadataClient.mjs +2 -2
- package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +3 -3
- package/dist/core/clients/ShelbyPlacementGroupClient.mjs +3 -3
- package/dist/core/clients/ShelbyRPCClient.d.ts +2 -0
- package/dist/core/clients/ShelbyRPCClient.mjs +4 -6
- package/dist/core/clients/index.d.ts +4 -2
- package/dist/core/clients/index.mjs +19 -15
- package/dist/core/commitments.d.ts +1 -1
- package/dist/core/commitments.mjs +3 -3
- package/dist/core/constants.d.ts +15 -3
- package/dist/core/constants.mjs +3 -1
- package/dist/core/erasure/clay-codes.d.ts +1 -1
- package/dist/core/erasure/clay-codes.mjs +5 -5
- package/dist/core/erasure/constants.d.ts +10 -2
- package/dist/core/erasure/constants.mjs +1 -1
- package/dist/core/erasure/default.d.ts +5 -2
- package/dist/core/erasure/default.mjs +12 -6
- package/dist/core/erasure/index.d.ts +2 -2
- package/dist/core/erasure/index.mjs +13 -7
- 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 +1 -1
- package/dist/core/erasure/utils.d.ts +1 -1
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.mjs +32 -24
- package/dist/core/layout.d.ts +5 -16
- package/dist/core/layout.mjs +3 -9
- package/dist/core/networks.d.ts +1 -1
- package/dist/core/networks.mjs +1 -1
- package/dist/core/operations/index.mjs +2 -2
- package/dist/core/types/blobs.d.ts +1 -1
- package/dist/core/types/encodings.d.ts +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/node/clients/ShelbyNodeClient.d.ts +5 -3
- package/dist/node/clients/ShelbyNodeClient.mjs +14 -13
- package/dist/node/clients/index.d.ts +3 -3
- package/dist/node/clients/index.mjs +15 -15
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.mjs +32 -28
- package/package.json +1 -1
- package/dist/chunk-OMZOR2ZF.mjs +0 -29
- package/dist/chunk-W5NRGZEP.mjs +0 -86
- package/dist/core/operations/generated/types.d.ts +0 -908
- package/dist/core/operations/generated/types.mjs +0 -63
- /package/dist/{chunk-FGUK6IBA.mjs → chunk-WTICJPDB.mjs} +0 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -4,16 +4,17 @@ export { CHUNK_SIZE_PARAMS, ChunkSizeScheme, DEFAULT_CHUNKSET_SIZE_BYTES, DEFAUL
|
|
|
4
4
|
export { AckTransactionOptions, BuildOptions, MissingTransactionSubmitterError, ShelbyBlobClient, UsdSponsorOptions, WriteBlobCommitmentsOptions } from '../core/clients/ShelbyBlobClient.js';
|
|
5
5
|
export { ShelbyClient, UploadOptions } from '../core/clients/ShelbyClient.js';
|
|
6
6
|
export { ShelbyClientConfig, ShelbyIndexerConfig, ShelbyRPCConfig } from '../core/clients/ShelbyClientConfig.js';
|
|
7
|
+
export { ShelbyMetadataClient } from '../core/clients/ShelbyMetadataClient.js';
|
|
7
8
|
export { ShelbyMicropaymentChannelClient } from '../core/clients/ShelbyMicropaymentChannelClient.js';
|
|
8
9
|
export { ShelbyPlacementGroupClient } from '../core/clients/ShelbyPlacementGroupClient.js';
|
|
9
10
|
export { BlobDataSource, PutBlobProgress, ShelbyRPCClient } from '../core/clients/ShelbyRPCClient.js';
|
|
10
11
|
export { BlobCommitments, BlobCommitmentsSchema, COMMITMENT_SCHEMA_VERSION, ChunksetCommitment, ChunksetCommitmentSchema, GenerateCommitmentsOptions, expectedTotalChunksets, generateCommitments, generateMerkleRoot } from '../core/commitments.js';
|
|
11
|
-
export { DEFAULT_PROJECT_DESCRIPTION, DEFAULT_PROJECT_NAME, MICROPAYMENTS_DEPLOYER, NetworkToShelbyBlobIndexerBaseUrl, NetworkToShelbyRPCBaseUrl, SHELBYUSD_FA_METADATA_ADDRESS, SHELBYUSD_TOKEN_ADDRESS, SHELBYUSD_TOKEN_MODULE, SHELBYUSD_TOKEN_NAME, SHELBY_DEPLOYER, TOKEN_DEPLOYER, TOKEN_OBJECT_ADDRESS } from '../core/constants.js';
|
|
12
|
-
export { C as ClayErasureCodingProvider, D as DecodeConfig, E as ErasureCodingConfig, a as ErasureCodingProvider, R as ReedSolomonErasureCodingProvider } from '../clay-codes-
|
|
12
|
+
export { DEFAULT_PROJECT_DESCRIPTION, DEFAULT_PROJECT_NAME, MICROPAYMENTS_DEPLOYER, NetworkToGasStationBaseUrl, NetworkToShelbyBlobIndexerBaseUrl, NetworkToShelbyRPCBaseUrl, SHELBYUSD_FA_METADATA_ADDRESS, SHELBYUSD_TOKEN_ADDRESS, SHELBYUSD_TOKEN_MODULE, SHELBYUSD_TOKEN_NAME, SHELBY_DEPLOYER, TOKEN_DEPLOYER, TOKEN_OBJECT_ADDRESS } from '../core/constants.js';
|
|
13
|
+
export { C as ClayErasureCodingProvider, D as DecodeConfig, E as ErasureCodingConfig, a as ErasureCodingProvider, R as ReedSolomonErasureCodingProvider } from '../clay-codes-DHP-bYcP.js';
|
|
13
14
|
export { DEFAULT_ERASURE_D, DEFAULT_ERASURE_K, DEFAULT_ERASURE_M, DEFAULT_ERASURE_N, DEFAULT_SAMPLE_SIZE, ERASURE_CODE_PARAMS, ErasureCodeParams, ErasureCodingScheme, ErasureSchemeParams } from '../core/erasure/constants.js';
|
|
14
|
-
export { createDefaultErasureCodingProvider } from '../core/erasure/default.js';
|
|
15
|
+
export { createDefaultErasureCodingProvider, defaultErasureCodingConfig, erasureCodingConfig16Total10Data13Helper, erasureCodingConfig4Total2Data3Helper } from '../core/erasure/default.js';
|
|
15
16
|
export { ShelbyErrorCodes, isAccessDeniedError, isBlobAlreadyExistsError, isBlobExpiredError, isBlobNotFoundError } from '../core/errors.js';
|
|
16
|
-
export { BlobName, BlobNameSchema, ChunkKey
|
|
17
|
+
export { BlobName, BlobNameSchema, ChunkKey } from '../core/layout.js';
|
|
17
18
|
export { ShelbyNetwork, isShelbyNetwork, shelbyNetworks } from '../core/networks.js';
|
|
18
19
|
export { ShelbyIndexerClient, createShelbyIndexerClient, getShelbyIndexerClient } from '../core/operations/index.js';
|
|
19
20
|
export { CompleteMultipartUploadResponse, CompleteMultipartUploadResponseSchema, RPCErrorResponse, RPCErrorResponseSchema, StaleMicropaymentErrorResponse, StaleMicropaymentErrorResponseSchema, StartMultipartUploadResponse, StartMultipartUploadResponseSchema, UploadPartResponse, UploadPartResponseSchema } from '../core/rpc-responses.js';
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
import "../chunk-EM67QTMR.mjs";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-WTICJPDB.mjs";
|
|
3
3
|
import {
|
|
4
4
|
ShelbyClient
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-7PN65RDX.mjs";
|
|
6
6
|
import {
|
|
7
7
|
MissingTransactionSubmitterError,
|
|
8
8
|
ShelbyBlobClient
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-SRV4YWFH.mjs";
|
|
10
10
|
import "../chunk-XNEIWM4O.mjs";
|
|
11
11
|
import {
|
|
12
|
-
createDefaultErasureCodingProvider
|
|
13
|
-
|
|
12
|
+
createDefaultErasureCodingProvider,
|
|
13
|
+
defaultErasureCodingConfig,
|
|
14
|
+
erasureCodingConfig16Total10Data13Helper,
|
|
15
|
+
erasureCodingConfig4Total2Data3Helper
|
|
16
|
+
} from "../chunk-HPPMI7DC.mjs";
|
|
14
17
|
import {
|
|
15
18
|
ClayErasureCodingProvider
|
|
16
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-OGKZ575S.mjs";
|
|
17
20
|
import {
|
|
18
21
|
ReedSolomonErasureCodingProvider
|
|
19
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-NHWWORCH.mjs";
|
|
20
23
|
import "../chunk-Z7RFCADT.mjs";
|
|
24
|
+
import {
|
|
25
|
+
ShelbyMetadataClient
|
|
26
|
+
} from "../chunk-MV6FNYAU.mjs";
|
|
21
27
|
import {
|
|
22
28
|
ShelbyMicropaymentChannelClient
|
|
23
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-E5QCRTBU.mjs";
|
|
24
30
|
import "../chunk-QQ57OGQ2.mjs";
|
|
25
31
|
import "../chunk-ZHXCVRZX.mjs";
|
|
26
32
|
import "../chunk-AD2G3QYD.mjs";
|
|
27
33
|
import "../chunk-MQUVYMNQ.mjs";
|
|
28
34
|
import {
|
|
29
35
|
ShelbyPlacementGroupClient
|
|
30
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-W37FZSMA.mjs";
|
|
31
37
|
import {
|
|
32
38
|
ShelbyRPCClient
|
|
33
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-PJVWGMVI.mjs";
|
|
34
40
|
import {
|
|
35
41
|
SenderBuiltMicropayment,
|
|
36
42
|
StaleChannelStateError
|
|
@@ -38,7 +44,7 @@ import {
|
|
|
38
44
|
import {
|
|
39
45
|
createShelbyIndexerClient,
|
|
40
46
|
getShelbyIndexerClient
|
|
41
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-CGYJLKBU.mjs";
|
|
42
48
|
import {
|
|
43
49
|
Blob_Activities_Select_Column,
|
|
44
50
|
Blobs_Select_Column,
|
|
@@ -56,16 +62,10 @@ import {
|
|
|
56
62
|
getSdk
|
|
57
63
|
} from "../chunk-KJ24NKPH.mjs";
|
|
58
64
|
import "../chunk-AABBONAF.mjs";
|
|
59
|
-
import {
|
|
60
|
-
BlobNameSchema,
|
|
61
|
-
ChunkKey,
|
|
62
|
-
allChunksForBlob,
|
|
63
|
-
roundSize
|
|
64
|
-
} from "../chunk-W5NRGZEP.mjs";
|
|
65
65
|
import {
|
|
66
66
|
isShelbyNetwork,
|
|
67
67
|
shelbyNetworks
|
|
68
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-D6GQHO6G.mjs";
|
|
69
69
|
import "../chunk-I6NG5GNL.mjs";
|
|
70
70
|
import {
|
|
71
71
|
CompleteMultipartUploadResponseSchema,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
expectedTotalChunksets,
|
|
94
94
|
generateCommitments,
|
|
95
95
|
generateMerkleRoot
|
|
96
|
-
} from "../chunk-
|
|
96
|
+
} from "../chunk-2WEX3K7C.mjs";
|
|
97
97
|
import {
|
|
98
98
|
buildRequestUrl,
|
|
99
99
|
concatHashes,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
DEFAULT_CHUNKSET_SIZE_BYTES,
|
|
108
108
|
DEFAULT_CHUNK_SIZE_BYTES,
|
|
109
109
|
ERASURE_CODE_AND_CHUNK_MAPPING
|
|
110
|
-
} from "../chunk-
|
|
110
|
+
} from "../chunk-JTXYKO3U.mjs";
|
|
111
111
|
import {
|
|
112
112
|
DEFAULT_ERASURE_D,
|
|
113
113
|
DEFAULT_ERASURE_K,
|
|
@@ -116,11 +116,12 @@ import {
|
|
|
116
116
|
DEFAULT_SAMPLE_SIZE,
|
|
117
117
|
ERASURE_CODE_PARAMS,
|
|
118
118
|
ErasureCodingScheme
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-AUQDI5BS.mjs";
|
|
120
120
|
import {
|
|
121
121
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
122
122
|
DEFAULT_PROJECT_NAME,
|
|
123
123
|
MICROPAYMENTS_DEPLOYER,
|
|
124
|
+
NetworkToGasStationBaseUrl,
|
|
124
125
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
125
126
|
NetworkToShelbyRPCBaseUrl,
|
|
126
127
|
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
@@ -130,7 +131,7 @@ import {
|
|
|
130
131
|
SHELBY_DEPLOYER,
|
|
131
132
|
TOKEN_DEPLOYER,
|
|
132
133
|
TOKEN_OBJECT_ADDRESS
|
|
133
|
-
} from "../chunk-
|
|
134
|
+
} from "../chunk-4ZOFT75Q.mjs";
|
|
134
135
|
import {
|
|
135
136
|
ShelbyErrorCodes,
|
|
136
137
|
isAccessDeniedError,
|
|
@@ -138,6 +139,10 @@ import {
|
|
|
138
139
|
isBlobExpiredError,
|
|
139
140
|
isBlobNotFoundError
|
|
140
141
|
} from "../chunk-CQ6QPIZK.mjs";
|
|
142
|
+
import {
|
|
143
|
+
BlobNameSchema,
|
|
144
|
+
ChunkKey
|
|
145
|
+
} from "../chunk-Z4FZ7W6L.mjs";
|
|
141
146
|
import "../chunk-7P6ASYW6.mjs";
|
|
142
147
|
export {
|
|
143
148
|
BlobCommitmentsSchema,
|
|
@@ -173,6 +178,7 @@ export {
|
|
|
173
178
|
GetProcessorStatusDocument,
|
|
174
179
|
MICROPAYMENTS_DEPLOYER,
|
|
175
180
|
MissingTransactionSubmitterError,
|
|
181
|
+
NetworkToGasStationBaseUrl,
|
|
176
182
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
177
183
|
NetworkToShelbyRPCBaseUrl,
|
|
178
184
|
Order_By,
|
|
@@ -189,6 +195,7 @@ export {
|
|
|
189
195
|
ShelbyBlobClient,
|
|
190
196
|
ShelbyClient,
|
|
191
197
|
ShelbyErrorCodes,
|
|
198
|
+
ShelbyMetadataClient,
|
|
192
199
|
ShelbyMicropaymentChannelClient,
|
|
193
200
|
ShelbyPlacementGroupClient,
|
|
194
201
|
ShelbyRPCClient,
|
|
@@ -198,12 +205,14 @@ export {
|
|
|
198
205
|
TOKEN_DEPLOYER,
|
|
199
206
|
TOKEN_OBJECT_ADDRESS,
|
|
200
207
|
UploadPartResponseSchema,
|
|
201
|
-
allChunksForBlob,
|
|
202
208
|
buildRequestUrl,
|
|
203
209
|
concatHashes,
|
|
204
210
|
createBlobKey,
|
|
205
211
|
createDefaultErasureCodingProvider,
|
|
206
212
|
createShelbyIndexerClient,
|
|
213
|
+
defaultErasureCodingConfig,
|
|
214
|
+
erasureCodingConfig16Total10Data13Helper,
|
|
215
|
+
erasureCodingConfig4Total2Data3Helper,
|
|
207
216
|
expectedTotalChunksets,
|
|
208
217
|
generateCommitments,
|
|
209
218
|
generateMerkleRoot,
|
|
@@ -221,7 +230,6 @@ export {
|
|
|
221
230
|
isBlobNotFoundError,
|
|
222
231
|
isShelbyNetwork,
|
|
223
232
|
readInChunks,
|
|
224
|
-
roundSize,
|
|
225
233
|
shelbyNetworks,
|
|
226
234
|
zeroPadBytes
|
|
227
235
|
};
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
} from "./chunk-4JZO2D7T.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_CHUNKSET_SIZE_BYTES
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JTXYKO3U.mjs";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_ERASURE_K,
|
|
11
11
|
DEFAULT_ERASURE_M
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AUQDI5BS.mjs";
|
|
13
13
|
|
|
14
14
|
// src/core/commitments.ts
|
|
15
15
|
import { Hex } from "@aptos-labs/ts-sdk";
|
|
@@ -111,7 +111,7 @@ async function generateChunksetCommitments(shouldPad, chunksetIdx, chunksetData,
|
|
|
111
111
|
return { h: a, entry };
|
|
112
112
|
}
|
|
113
113
|
async function generateCommitments(provider, fullData, onChunk, options) {
|
|
114
|
-
const expectedChunksetSize =
|
|
114
|
+
const expectedChunksetSize = provider.config.chunkSizeBytes * provider.config.erasure_k;
|
|
115
115
|
const shouldPad = options?.pad ?? true;
|
|
116
116
|
const chunksetCommitments = [];
|
|
117
117
|
const chunksetCommitmentHashes = [];
|
|
@@ -6,7 +6,7 @@ var NetworkToShelbyRPCBaseUrl = {
|
|
|
6
6
|
[Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/shelby",
|
|
7
7
|
[Network.NETNA]: void 0,
|
|
8
8
|
[Network.DEVNET]: void 0,
|
|
9
|
-
[Network.TESTNET]:
|
|
9
|
+
[Network.TESTNET]: "https://api.testnet.shelby.xyz/shelby",
|
|
10
10
|
[Network.MAINNET]: void 0,
|
|
11
11
|
[Network.LOCAL]: void 0,
|
|
12
12
|
[Network.CUSTOM]: void 0
|
|
@@ -15,7 +15,16 @@ var NetworkToShelbyBlobIndexerBaseUrl = {
|
|
|
15
15
|
[Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/cmforrguw0042s601fn71f9l2/v1/graphql",
|
|
16
16
|
[Network.NETNA]: void 0,
|
|
17
17
|
[Network.DEVNET]: void 0,
|
|
18
|
-
[Network.TESTNET]:
|
|
18
|
+
[Network.TESTNET]: "https://api.testnet.aptoslabs.com/nocode/v1/public/cmlfqs5wt00qrs601zt5s4kfj/v1/graphql",
|
|
19
|
+
[Network.MAINNET]: void 0,
|
|
20
|
+
[Network.LOCAL]: void 0,
|
|
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",
|
|
19
28
|
[Network.MAINNET]: void 0,
|
|
20
29
|
[Network.LOCAL]: void 0,
|
|
21
30
|
[Network.CUSTOM]: void 0
|
|
@@ -34,6 +43,7 @@ export {
|
|
|
34
43
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
35
44
|
NetworkToShelbyRPCBaseUrl,
|
|
36
45
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
46
|
+
NetworkToGasStationBaseUrl,
|
|
37
47
|
SHELBY_DEPLOYER,
|
|
38
48
|
MICROPAYMENTS_DEPLOYER,
|
|
39
49
|
TOKEN_DEPLOYER,
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyBlobClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SRV4YWFH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
defaultErasureCodingConfig
|
|
6
|
+
} from "./chunk-HPPMI7DC.mjs";
|
|
4
7
|
import {
|
|
5
8
|
ClayErasureCodingProvider
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OGKZ575S.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ShelbyMetadataClient
|
|
12
|
+
} from "./chunk-MV6FNYAU.mjs";
|
|
7
13
|
import {
|
|
8
14
|
ShelbyRPCClient
|
|
9
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PJVWGMVI.mjs";
|
|
10
16
|
import {
|
|
11
17
|
getAptosConfig
|
|
12
18
|
} from "./chunk-AABBONAF.mjs";
|
|
@@ -15,16 +21,17 @@ import {
|
|
|
15
21
|
} from "./chunk-OTBLZL2S.mjs";
|
|
16
22
|
import {
|
|
17
23
|
generateCommitments
|
|
18
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-2WEX3K7C.mjs";
|
|
19
25
|
import {
|
|
20
26
|
NetworkToShelbyRPCBaseUrl
|
|
21
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4ZOFT75Q.mjs";
|
|
22
28
|
|
|
23
29
|
// src/core/clients/ShelbyClient.ts
|
|
24
30
|
import {
|
|
25
31
|
AccountAddress,
|
|
26
32
|
Aptos,
|
|
27
33
|
DEFAULT_TXN_TIMEOUT_SEC,
|
|
34
|
+
Network,
|
|
28
35
|
TransactionResponseType
|
|
29
36
|
} from "@aptos-labs/ts-sdk";
|
|
30
37
|
import pLimit from "p-limit";
|
|
@@ -34,6 +41,10 @@ var ShelbyClient = class {
|
|
|
34
41
|
* and metadata for blobs.
|
|
35
42
|
*/
|
|
36
43
|
coordination;
|
|
44
|
+
/**
|
|
45
|
+
* The metadata client is used for protocol-level metadata queries.
|
|
46
|
+
*/
|
|
47
|
+
metadata;
|
|
37
48
|
/**
|
|
38
49
|
* The RPC client is used to interact with the Shelby RPC node which can be responsible for storing,
|
|
39
50
|
* confirming, and retrieving blobs from the storage layer.
|
|
@@ -85,6 +96,7 @@ var ShelbyClient = class {
|
|
|
85
96
|
this.config = config;
|
|
86
97
|
this.aptos = new Aptos(getAptosConfig(config));
|
|
87
98
|
this.coordination = new ShelbyBlobClient(config);
|
|
99
|
+
this.metadata = new ShelbyMetadataClient(config);
|
|
88
100
|
this.rpc = new ShelbyRPCClient(config);
|
|
89
101
|
this._provider = provider;
|
|
90
102
|
}
|
|
@@ -94,7 +106,9 @@ var ShelbyClient = class {
|
|
|
94
106
|
*/
|
|
95
107
|
async getProvider() {
|
|
96
108
|
if (!this._provider) {
|
|
97
|
-
this._provider = await ClayErasureCodingProvider.create(
|
|
109
|
+
this._provider = await ClayErasureCodingProvider.create(
|
|
110
|
+
defaultErasureCodingConfig()
|
|
111
|
+
);
|
|
98
112
|
}
|
|
99
113
|
return this._provider;
|
|
100
114
|
}
|
|
@@ -151,6 +165,7 @@ var ShelbyClient = class {
|
|
|
151
165
|
blobMerkleRoot: blobCommitments.blob_merkle_root,
|
|
152
166
|
size: params.blobData.length,
|
|
153
167
|
expirationMicros: params.expirationMicros,
|
|
168
|
+
config: provider.config,
|
|
154
169
|
options: params.options
|
|
155
170
|
});
|
|
156
171
|
await this.coordination.aptos.waitForTransaction({
|
|
@@ -231,6 +246,7 @@ var ShelbyClient = class {
|
|
|
231
246
|
blobSize: blob.blobData.length,
|
|
232
247
|
blobMerkleRoot: blobCommitments[index].blob_merkle_root
|
|
233
248
|
})),
|
|
249
|
+
config: provider.config,
|
|
234
250
|
options: params.options
|
|
235
251
|
});
|
|
236
252
|
await this.coordination.aptos.waitForTransaction({
|
|
@@ -288,6 +304,11 @@ var ShelbyClient = class {
|
|
|
288
304
|
* ```
|
|
289
305
|
*/
|
|
290
306
|
async fundAccountWithShelbyUSD(params) {
|
|
307
|
+
if (this.config.network === Network.TESTNET) {
|
|
308
|
+
throw new Error(
|
|
309
|
+
`ShelbyUSD cannot be minted programmatically on ${Network.TESTNET}. Please use the faucet at https://docs.shelby.xyz/apis/faucet/shelbyusd instead.`
|
|
310
|
+
);
|
|
311
|
+
}
|
|
291
312
|
const { address, amount } = params;
|
|
292
313
|
try {
|
|
293
314
|
const faucet = this.config.faucet?.baseUrl ?? "https://faucet.shelbynet.shelby.xyz/fund?asset=shelbyusd";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/core/erasure/constants.ts
|
|
2
2
|
var ErasureCodingScheme = /* @__PURE__ */ ((ErasureCodingScheme2) => {
|
|
3
3
|
ErasureCodingScheme2["ClayCode_16Total_10Data_13Helper"] = "ClayCode_16Total_10Data_13Helper";
|
|
4
|
+
ErasureCodingScheme2["ClayCode_4Total_2Data_3Helper"] = "ClayCode_4Total_2Data_3Helper";
|
|
4
5
|
return ErasureCodingScheme2;
|
|
5
6
|
})(ErasureCodingScheme || {});
|
|
6
7
|
var ERASURE_CODE_PARAMS = {
|
|
@@ -10,7 +11,19 @@ var ERASURE_CODE_PARAMS = {
|
|
|
10
11
|
// data chunks
|
|
11
12
|
erasure_k: 10,
|
|
12
13
|
// helper nodes
|
|
13
|
-
erasure_d: 13
|
|
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
|
|
14
27
|
}
|
|
15
28
|
};
|
|
16
29
|
var DEFAULT_ERASURE_N = ERASURE_CODE_PARAMS["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */].erasure_n;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// src/core/networks.ts
|
|
2
2
|
import { Network } from "@aptos-labs/ts-sdk";
|
|
3
|
-
var shelbyNetworks = [
|
|
3
|
+
var shelbyNetworks = [
|
|
4
|
+
Network.LOCAL,
|
|
5
|
+
Network.TESTNET,
|
|
6
|
+
Network.SHELBYNET
|
|
7
|
+
];
|
|
4
8
|
var isShelbyNetwork = (network) => {
|
|
5
9
|
return shelbyNetworks.includes(network.toLowerCase());
|
|
6
10
|
};
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-4MG4XGY4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getShelbyIndexerClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CGYJLKBU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getAptosConfig
|
|
9
9
|
} from "./chunk-AABBONAF.mjs";
|
|
10
10
|
import {
|
|
11
11
|
MICROPAYMENTS_DEPLOYER
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4ZOFT75Q.mjs";
|
|
13
13
|
|
|
14
14
|
// src/core/clients/ShelbyMicropaymentChannelClient.ts
|
|
15
15
|
import {
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
console.log(
|
|
23
|
+
`default erasure coding, with env: ${process.env.SHELBY_ENCODING}`
|
|
24
|
+
);
|
|
25
|
+
const encoding = Number(process.env.SHELBY_ENCODING) || 0;
|
|
26
|
+
if (encoding === 0) {
|
|
27
|
+
console.log("getting default erasure coding (16,10,13)");
|
|
28
|
+
return erasureCodingConfig16Total10Data13Helper();
|
|
29
|
+
}
|
|
30
|
+
console.log("getting default erasure coding (4,2,3)");
|
|
31
|
+
return erasureCodingConfig4Total2Data3Helper();
|
|
32
|
+
}
|
|
33
|
+
function erasureCodingConfig16Total10Data13Helper() {
|
|
34
|
+
return erasureCodingConfig(
|
|
35
|
+
"ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function erasureCodingConfig4Total2Data3Helper() {
|
|
39
|
+
return erasureCodingConfig("ClayCode_4Total_2Data_3Helper" /* ClayCode_4Total_2Data_3Helper */);
|
|
40
|
+
}
|
|
41
|
+
function erasureCodingConfig(encodingScheme) {
|
|
42
|
+
return {
|
|
43
|
+
erasure_n: ERASURE_CODE_PARAMS[encodingScheme].erasure_n,
|
|
44
|
+
erasure_k: ERASURE_CODE_PARAMS[encodingScheme].erasure_k,
|
|
45
|
+
erasure_d: ERASURE_CODE_PARAMS[encodingScheme].erasure_d,
|
|
46
|
+
chunkSizeBytes: DEFAULT_CHUNK_SIZE_BYTES,
|
|
47
|
+
enumIndex: ERASURE_CODE_PARAMS[encodingScheme].enumIndex
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
createDefaultErasureCodingProvider,
|
|
53
|
+
defaultErasureCodingConfig,
|
|
54
|
+
erasureCodingConfig16Total10Data13Helper,
|
|
55
|
+
erasureCodingConfig4Total2Data3Helper
|
|
56
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/core/chunk.ts
|
|
2
2
|
var ChunkSizeScheme = /* @__PURE__ */ ((ChunkSizeScheme2) => {
|
|
3
3
|
ChunkSizeScheme2["ChunkSet10MiB_Chunk1MiB"] = "ChunkSet10MiB_Chunk1MiB";
|
|
4
|
+
ChunkSizeScheme2["ChunkSet2MiB_Chunk1MiB"] = "ChunkSet2MiB_Chunk1MiB";
|
|
4
5
|
return ChunkSizeScheme2;
|
|
5
6
|
})(ChunkSizeScheme || {});
|
|
6
7
|
var CHUNK_SIZE_PARAMS = {
|
|
@@ -9,6 +10,12 @@ var CHUNK_SIZE_PARAMS = {
|
|
|
9
10
|
chunkSizeBytes: 1 * 1024 * 1024,
|
|
10
11
|
// 10MiB
|
|
11
12
|
chunksetSizeBytes: 10 * 1024 * 1024
|
|
13
|
+
},
|
|
14
|
+
["ChunkSet2MiB_Chunk1MiB" /* ChunkSet2MiB_Chunk1MiB */]: {
|
|
15
|
+
// 1MiB
|
|
16
|
+
chunkSizeBytes: 1 * 1024 * 1024,
|
|
17
|
+
// 2MiB
|
|
18
|
+
chunksetSizeBytes: 2 * 1024 * 1024
|
|
12
19
|
}
|
|
13
20
|
};
|
|
14
21
|
var DEFAULT_CHUNK_SIZE_BYTES = CHUNK_SIZE_PARAMS["ChunkSet10MiB_Chunk1MiB" /* ChunkSet10MiB_Chunk1MiB */].chunkSizeBytes;
|
|
@@ -16,6 +23,9 @@ var DEFAULT_CHUNKSET_SIZE_BYTES = CHUNK_SIZE_PARAMS["ChunkSet10MiB_Chunk1MiB" /*
|
|
|
16
23
|
var ERASURE_CODE_AND_CHUNK_MAPPING = {
|
|
17
24
|
["ClayCode_16Total_10Data_13Helper" /* ClayCode_16Total_10Data_13Helper */]: {
|
|
18
25
|
...CHUNK_SIZE_PARAMS.ChunkSet10MiB_Chunk1MiB
|
|
26
|
+
},
|
|
27
|
+
["ClayCode_4Total_2Data_3Helper" /* ClayCode_4Total_2Data_3Helper */]: {
|
|
28
|
+
...CHUNK_SIZE_PARAMS.ChunkSet2MiB_Chunk1MiB
|
|
19
29
|
}
|
|
20
30
|
};
|
|
21
31
|
|
|
@@ -3,23 +3,23 @@ import {
|
|
|
3
3
|
} from "./chunk-AABBONAF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
SHELBY_DEPLOYER
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4ZOFT75Q.mjs";
|
|
7
7
|
|
|
8
|
-
// src/
|
|
8
|
+
// src/core/clients/ShelbyMetadataClient.ts
|
|
9
9
|
import {
|
|
10
10
|
AccountAddress,
|
|
11
11
|
Aptos,
|
|
12
12
|
Hex
|
|
13
13
|
} from "@aptos-labs/ts-sdk";
|
|
14
14
|
function parseStorageProviderState(raw) {
|
|
15
|
-
switch (raw.
|
|
15
|
+
switch (raw.__variant__) {
|
|
16
16
|
case "Active":
|
|
17
17
|
return {
|
|
18
18
|
variant: "Active",
|
|
19
|
-
quota: raw.
|
|
20
|
-
stakeAtStartOfStakingEpoch: raw.
|
|
21
|
-
faulty: raw.
|
|
22
|
-
leaving: raw.
|
|
19
|
+
quota: raw.quota.value,
|
|
20
|
+
stakeAtStartOfStakingEpoch: raw.stake_at_start_of_staking_epoch,
|
|
21
|
+
faulty: raw.faulty,
|
|
22
|
+
leaving: raw.leaving
|
|
23
23
|
};
|
|
24
24
|
case "Waitlisted":
|
|
25
25
|
return {
|
|
@@ -28,9 +28,9 @@ function parseStorageProviderState(raw) {
|
|
|
28
28
|
case "Frozen":
|
|
29
29
|
return {
|
|
30
30
|
variant: "Frozen",
|
|
31
|
-
frozenReason: raw.
|
|
32
|
-
frozenFrom: raw.
|
|
33
|
-
frozenTill: raw.
|
|
31
|
+
frozenReason: raw.frozen_reason,
|
|
32
|
+
frozenFrom: raw.frozen_from,
|
|
33
|
+
frozenTill: raw.frozen_till
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -9,6 +9,7 @@ var ReedSolomonErasureCodingProvider = class {
|
|
|
9
9
|
const erasure_k = options?.erasure_k ?? DEFAULT_ERASURE_K;
|
|
10
10
|
const erasure_n = options?.erasure_n ?? DEFAULT_ERASURE_N;
|
|
11
11
|
const chunkSizeBytes = options?.chunkSizeBytes ?? DEFAULT_CHUNK_SIZE_BYTES;
|
|
12
|
+
const enumIndex = -1;
|
|
12
13
|
if (erasure_k <= 0)
|
|
13
14
|
throw new Error("erasure_k (number of data chunks) must be > 0");
|
|
14
15
|
if (erasure_n <= erasure_k)
|
|
@@ -19,7 +20,8 @@ var ReedSolomonErasureCodingProvider = class {
|
|
|
19
20
|
this.config = {
|
|
20
21
|
erasure_n,
|
|
21
22
|
erasure_k,
|
|
22
|
-
chunkSizeBytes
|
|
23
|
+
chunkSizeBytes,
|
|
24
|
+
enumIndex
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
encode(data) {
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_CHUNK_SIZE_BYTES
|
|
3
|
-
} from "./chunk-67F5YZ25.mjs";
|
|
4
|
-
import {
|
|
5
|
-
DEFAULT_ERASURE_D,
|
|
6
|
-
DEFAULT_ERASURE_K,
|
|
7
|
-
DEFAULT_ERASURE_N
|
|
8
|
-
} from "./chunk-LZSIZJYR.mjs";
|
|
9
|
-
|
|
10
1
|
// src/core/erasure/clay-codes.ts
|
|
11
2
|
import {
|
|
12
3
|
createDecoder,
|
|
@@ -27,13 +18,7 @@ var ClayErasureCodingProvider = class _ClayErasureCodingProvider {
|
|
|
27
18
|
/**
|
|
28
19
|
* Static factory method to create an initialized ClayErasureCodingProvider
|
|
29
20
|
*/
|
|
30
|
-
static async create(
|
|
31
|
-
const config = buildClayConfig({
|
|
32
|
-
erasure_n: options?.erasure_n ?? DEFAULT_ERASURE_N,
|
|
33
|
-
erasure_k: options?.erasure_k ?? DEFAULT_ERASURE_K,
|
|
34
|
-
erasure_d: options?.erasure_d ?? DEFAULT_ERASURE_D,
|
|
35
|
-
chunkSizeBytes: options?.chunkSizeBytes ?? DEFAULT_CHUNK_SIZE_BYTES
|
|
36
|
-
});
|
|
21
|
+
static async create(config) {
|
|
37
22
|
const provider = new _ClayErasureCodingProvider(config);
|
|
38
23
|
[provider.encoderCache, provider.decoderCache] = await Promise.all([
|
|
39
24
|
createEncoder({
|
|
@@ -118,7 +103,7 @@ var ClayErasureCodingProvider = class _ClayErasureCodingProvider {
|
|
|
118
103
|
}
|
|
119
104
|
};
|
|
120
105
|
function buildClayConfig(input) {
|
|
121
|
-
const { erasure_n, erasure_k, erasure_d, chunkSizeBytes } = input;
|
|
106
|
+
const { erasure_n, erasure_k, erasure_d, chunkSizeBytes, enumIndex } = input;
|
|
122
107
|
if (erasure_n <= 0)
|
|
123
108
|
throw new Error("erasure_n (total number of chunks) must be > 0");
|
|
124
109
|
if (erasure_k <= 0)
|
|
@@ -140,10 +125,12 @@ function buildClayConfig(input) {
|
|
|
140
125
|
erasure_n,
|
|
141
126
|
erasure_k,
|
|
142
127
|
erasure_d,
|
|
143
|
-
chunkSizeBytes
|
|
128
|
+
chunkSizeBytes,
|
|
129
|
+
enumIndex
|
|
144
130
|
};
|
|
145
131
|
}
|
|
146
132
|
|
|
147
133
|
export {
|
|
148
|
-
ClayErasureCodingProvider
|
|
134
|
+
ClayErasureCodingProvider,
|
|
135
|
+
buildClayConfig
|
|
149
136
|
};
|
|
@@ -3,10 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-4MG4XGY4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getShelbyIndexerClient
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
BlobNameSchema
|
|
9
|
-
} from "./chunk-W5NRGZEP.mjs";
|
|
6
|
+
} from "./chunk-CGYJLKBU.mjs";
|
|
10
7
|
import {
|
|
11
8
|
sleep
|
|
12
9
|
} from "./chunk-I6NG5GNL.mjs";
|
|
@@ -20,7 +17,10 @@ import {
|
|
|
20
17
|
} from "./chunk-4JZO2D7T.mjs";
|
|
21
18
|
import {
|
|
22
19
|
NetworkToShelbyRPCBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4ZOFT75Q.mjs";
|
|
21
|
+
import {
|
|
22
|
+
BlobNameSchema
|
|
23
|
+
} from "./chunk-Z4FZ7W6L.mjs";
|
|
24
24
|
|
|
25
25
|
// src/core/clients/ShelbyRPCClient.ts
|
|
26
26
|
import { AccountAddress } from "@aptos-labs/ts-sdk";
|