@shelby-protocol/sdk 0.2.4 → 0.3.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 +3 -3
- package/dist/browser/index.mjs +34 -30
- package/dist/{chunk-WJTVYLKW.mjs → chunk-5BVSWXQJ.mjs} +26 -7
- package/dist/{chunk-SSE4MFNN.mjs → chunk-6FJNAUU5.mjs} +2 -2
- package/dist/{chunk-3PCG7PNP.mjs → chunk-6XSZRDLJ.mjs} +9 -9
- package/dist/{chunk-XRLHLAOW.mjs → chunk-AY3HBWXA.mjs} +1 -1
- package/dist/{chunk-TVLV7C74.mjs → chunk-KG2TMLEV.mjs} +1 -1
- package/dist/{chunk-IE6LYVIA.mjs → chunk-M3CP5TFP.mjs} +13 -0
- package/dist/{chunk-BUWAD67L.mjs → chunk-M7W43K2Q.mjs} +4 -4
- package/dist/{chunk-7OV5ZYW6.mjs → chunk-MNCQBEMS.mjs} +2 -2
- package/dist/{chunk-KYQRWJ3U.mjs → chunk-NEO7Z3ZQ.mjs} +2 -2
- package/dist/{chunk-OGKZ575S.mjs → chunk-OEK24ON7.mjs} +1 -2
- package/dist/{chunk-BXEVML7N.mjs → chunk-RNNJXTX2.mjs} +3 -18
- package/dist/{chunk-NI6XBZLI.mjs → chunk-S6Q4OG7H.mjs} +1 -1
- package/dist/{chunk-AEDVYYGD.mjs → chunk-V46D5NBW.mjs} +1 -1
- package/dist/{chunk-IKRWBDG5.mjs → chunk-V4B3GAMQ.mjs} +1 -1
- package/dist/{chunk-BKL7NCUB.mjs → chunk-WFWRBNTW.mjs} +7 -7
- package/dist/{clay-codes-DHP-bYcP.d.ts → clay-codes-DdXABBDx.d.ts} +0 -7
- package/dist/core/blobs.d.ts +1 -1
- package/dist/core/clients/ShelbyBlobClient.d.ts +9 -1
- package/dist/core/clients/ShelbyBlobClient.mjs +7 -7
- package/dist/core/clients/ShelbyClient.d.ts +2 -2
- package/dist/core/clients/ShelbyClient.mjs +13 -13
- package/dist/core/clients/ShelbyClientConfig.d.ts +8 -0
- package/dist/core/clients/ShelbyMetadataClient.mjs +3 -3
- package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +6 -6
- package/dist/core/clients/ShelbyPlacementGroupClient.mjs +4 -4
- package/dist/core/clients/ShelbyRPCClient.d.ts +1 -1
- package/dist/core/clients/ShelbyRPCClient.mjs +7 -7
- package/dist/core/clients/index.d.ts +1 -1
- package/dist/core/clients/index.mjs +20 -20
- package/dist/core/clients/utils.mjs +2 -2
- package/dist/core/commitments.d.ts +3 -12
- package/dist/core/commitments.mjs +1 -1
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.mjs +1 -1
- package/dist/core/erasure/clay-codes.d.ts +1 -1
- package/dist/core/erasure/clay-codes.mjs +1 -1
- package/dist/core/erasure/default.d.ts +1 -1
- package/dist/core/erasure/default.mjs +2 -2
- package/dist/core/erasure/index.d.ts +1 -1
- package/dist/core/erasure/index.mjs +2 -2
- package/dist/core/erasure/provider.d.ts +1 -1
- package/dist/core/erasure/reed-solomon.d.ts +1 -1
- package/dist/core/erasure/utils.d.ts +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.mjs +34 -30
- package/dist/core/layout.d.ts +1 -1
- package/dist/core/operations/index.mjs +3 -3
- package/dist/core/rpc-responses.d.ts +38 -1
- package/dist/core/rpc-responses.mjs +5 -1
- package/dist/core/types/blobs.d.ts +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.mjs +3 -3
- package/dist/core/types/payments.mjs +2 -2
- package/dist/node/clients/ShelbyNodeClient.d.ts +1 -1
- package/dist/node/clients/ShelbyNodeClient.mjs +14 -14
- package/dist/node/clients/index.d.ts +1 -1
- package/dist/node/clients/index.mjs +14 -14
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.mjs +38 -34
- package/package.json +4 -5
- 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/browser/index.d.ts
CHANGED
|
@@ -8,16 +8,16 @@ export { ShelbyMetadataClient } from '../core/clients/ShelbyMetadataClient.js';
|
|
|
8
8
|
export { ShelbyMicropaymentChannelClient } from '../core/clients/ShelbyMicropaymentChannelClient.js';
|
|
9
9
|
export { ShelbyPlacementGroupClient } from '../core/clients/ShelbyPlacementGroupClient.js';
|
|
10
10
|
export { BlobDataSource, PutBlobProgress, ShelbyRPCClient } from '../core/clients/ShelbyRPCClient.js';
|
|
11
|
-
export { BlobCommitments, BlobCommitmentsSchema, COMMITMENT_SCHEMA_VERSION, ChunksetCommitment, ChunksetCommitmentSchema,
|
|
11
|
+
export { BlobCommitments, BlobCommitmentsSchema, COMMITMENT_SCHEMA_VERSION, ChunksetCommitment, ChunksetCommitmentSchema, expectedTotalChunksets, generateCommitments, generateMerkleRoot } from '../core/commitments.js';
|
|
12
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-
|
|
13
|
+
export { C as ClayErasureCodingProvider, D as DecodeConfig, E as ErasureCodingConfig, a as ErasureCodingProvider, R as ReedSolomonErasureCodingProvider } from '../clay-codes-DdXABBDx.js';
|
|
14
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';
|
|
15
15
|
export { createDefaultErasureCodingProvider, defaultErasureCodingConfig, erasureCodingConfig16Total10Data13Helper, erasureCodingConfig4Total2Data3Helper } from '../core/erasure/default.js';
|
|
16
16
|
export { ShelbyErrorCodes, isAccessDeniedError, isBlobAlreadyExistsError, isBlobExpiredError, isBlobNotFoundError } from '../core/errors.js';
|
|
17
17
|
export { BlobName, BlobNameSchema, ChunkKey } from '../core/layout.js';
|
|
18
18
|
export { ShelbyNetwork, isShelbyNetwork, shelbyNetworks } from '../core/networks.js';
|
|
19
19
|
export { ShelbyIndexerClient, createShelbyIndexerClient, getShelbyIndexerClient } from '../core/operations/index.js';
|
|
20
|
-
export { CompleteMultipartUploadResponse, CompleteMultipartUploadResponseSchema, RPCErrorResponse, RPCErrorResponseSchema, StaleMicropaymentErrorResponse, StaleMicropaymentErrorResponseSchema, StartMultipartUploadResponse, StartMultipartUploadResponseSchema, UploadPartResponse, UploadPartResponseSchema } from '../core/rpc-responses.js';
|
|
20
|
+
export { ChallengeResponse, ChallengeResponseSchema, CompleteMultipartUploadResponse, CompleteMultipartUploadResponseSchema, MultipartUploadStatusResponse, MultipartUploadStatusResponseSchema, RPCErrorResponse, RPCErrorResponseSchema, StaleMicropaymentErrorResponse, StaleMicropaymentErrorResponseSchema, StartMultipartUploadResponse, StartMultipartUploadResponseSchema, UploadPartResponse, UploadPartResponseSchema } from '../core/rpc-responses.js';
|
|
21
21
|
export { getShelbyAccountBlobsExplorerUrl, getShelbyAccountExplorerUrl, getShelbyBlobExplorerUrl } from '../core/shelby-explorer.js';
|
|
22
22
|
export { BlobActivity, BlobActivityType, BlobEncoding, BlobMetadata, ClayEncoding, StorageProviderAck } from '../core/types/blobs.js';
|
|
23
23
|
export { ChannelInfo, SenderBuiltMicropayment, StaleChannelStateError } from '../core/types/payments.js';
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import "../chunk-EM67QTMR.mjs";
|
|
2
2
|
import "../chunk-WTICJPDB.mjs";
|
|
3
|
+
import {
|
|
4
|
+
ShelbyPlacementGroupClient
|
|
5
|
+
} from "../chunk-S6Q4OG7H.mjs";
|
|
3
6
|
import {
|
|
4
7
|
ShelbyClient
|
|
5
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-6XSZRDLJ.mjs";
|
|
9
|
+
import {
|
|
10
|
+
ShelbyRPCClient
|
|
11
|
+
} from "../chunk-WFWRBNTW.mjs";
|
|
6
12
|
import {
|
|
7
13
|
MissingTransactionSubmitterError,
|
|
8
14
|
ShelbyBlobClient
|
|
9
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-5BVSWXQJ.mjs";
|
|
10
16
|
import "../chunk-XNEIWM4O.mjs";
|
|
11
17
|
import {
|
|
12
18
|
ReedSolomonErasureCodingProvider
|
|
@@ -16,35 +22,29 @@ import {
|
|
|
16
22
|
defaultErasureCodingConfig,
|
|
17
23
|
erasureCodingConfig16Total10Data13Helper,
|
|
18
24
|
erasureCodingConfig4Total2Data3Helper
|
|
19
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-AY3HBWXA.mjs";
|
|
20
26
|
import {
|
|
21
27
|
ClayErasureCodingProvider
|
|
22
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-OEK24ON7.mjs";
|
|
23
29
|
import "../chunk-Z7RFCADT.mjs";
|
|
24
30
|
import {
|
|
25
31
|
ShelbyMetadataClient
|
|
26
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-6FJNAUU5.mjs";
|
|
27
33
|
import {
|
|
28
34
|
ShelbyMicropaymentChannelClient
|
|
29
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-M7W43K2Q.mjs";
|
|
30
36
|
import "../chunk-QQ57OGQ2.mjs";
|
|
37
|
+
import "../chunk-MQUVYMNQ.mjs";
|
|
31
38
|
import "../chunk-ZHXCVRZX.mjs";
|
|
32
39
|
import "../chunk-AD2G3QYD.mjs";
|
|
33
|
-
import "../chunk-MQUVYMNQ.mjs";
|
|
34
|
-
import {
|
|
35
|
-
ShelbyPlacementGroupClient
|
|
36
|
-
} from "../chunk-NI6XBZLI.mjs";
|
|
37
|
-
import {
|
|
38
|
-
ShelbyRPCClient
|
|
39
|
-
} from "../chunk-BKL7NCUB.mjs";
|
|
40
40
|
import {
|
|
41
41
|
SenderBuiltMicropayment,
|
|
42
42
|
StaleChannelStateError
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-KG2TMLEV.mjs";
|
|
44
44
|
import {
|
|
45
45
|
createShelbyIndexerClient,
|
|
46
46
|
getShelbyIndexerClient
|
|
47
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-NEO7Z3ZQ.mjs";
|
|
48
48
|
import {
|
|
49
49
|
Blob_Activities_Select_Column,
|
|
50
50
|
Blobs_Select_Column,
|
|
@@ -62,19 +62,32 @@ import {
|
|
|
62
62
|
Processor_Status_Select_Column,
|
|
63
63
|
getSdk
|
|
64
64
|
} from "../chunk-TET3DJEO.mjs";
|
|
65
|
-
import "../chunk-
|
|
65
|
+
import "../chunk-V4B3GAMQ.mjs";
|
|
66
|
+
import {
|
|
67
|
+
ShelbyErrorCodes,
|
|
68
|
+
isAccessDeniedError,
|
|
69
|
+
isBlobAlreadyExistsError,
|
|
70
|
+
isBlobExpiredError,
|
|
71
|
+
isBlobNotFoundError
|
|
72
|
+
} from "../chunk-CQ6QPIZK.mjs";
|
|
73
|
+
import {
|
|
74
|
+
BlobNameSchema,
|
|
75
|
+
ChunkKey
|
|
76
|
+
} from "../chunk-Z4FZ7W6L.mjs";
|
|
66
77
|
import {
|
|
67
78
|
isShelbyNetwork,
|
|
68
79
|
shelbyNetworks
|
|
69
80
|
} from "../chunk-D6GQHO6G.mjs";
|
|
70
81
|
import "../chunk-I6NG5GNL.mjs";
|
|
71
82
|
import {
|
|
83
|
+
ChallengeResponseSchema,
|
|
72
84
|
CompleteMultipartUploadResponseSchema,
|
|
85
|
+
MultipartUploadStatusResponseSchema,
|
|
73
86
|
RPCErrorResponseSchema,
|
|
74
87
|
StaleMicropaymentErrorResponseSchema,
|
|
75
88
|
StartMultipartUploadResponseSchema,
|
|
76
89
|
UploadPartResponseSchema
|
|
77
|
-
} from "../chunk-
|
|
90
|
+
} from "../chunk-M3CP5TFP.mjs";
|
|
78
91
|
import {
|
|
79
92
|
getShelbyAccountBlobsExplorerUrl,
|
|
80
93
|
getShelbyAccountExplorerUrl,
|
|
@@ -94,7 +107,7 @@ import {
|
|
|
94
107
|
expectedTotalChunksets,
|
|
95
108
|
generateCommitments,
|
|
96
109
|
generateMerkleRoot
|
|
97
|
-
} from "../chunk-
|
|
110
|
+
} from "../chunk-RNNJXTX2.mjs";
|
|
98
111
|
import {
|
|
99
112
|
buildRequestUrl,
|
|
100
113
|
concatHashes,
|
|
@@ -133,18 +146,7 @@ import {
|
|
|
133
146
|
SHELBY_DEPLOYER,
|
|
134
147
|
TOKEN_DEPLOYER,
|
|
135
148
|
TOKEN_OBJECT_ADDRESS
|
|
136
|
-
} from "../chunk-
|
|
137
|
-
import {
|
|
138
|
-
ShelbyErrorCodes,
|
|
139
|
-
isAccessDeniedError,
|
|
140
|
-
isBlobAlreadyExistsError,
|
|
141
|
-
isBlobExpiredError,
|
|
142
|
-
isBlobNotFoundError
|
|
143
|
-
} from "../chunk-CQ6QPIZK.mjs";
|
|
144
|
-
import {
|
|
145
|
-
BlobNameSchema,
|
|
146
|
-
ChunkKey
|
|
147
|
-
} from "../chunk-Z4FZ7W6L.mjs";
|
|
149
|
+
} from "../chunk-MNCQBEMS.mjs";
|
|
148
150
|
import "../chunk-7P6ASYW6.mjs";
|
|
149
151
|
export {
|
|
150
152
|
BlobCommitmentsSchema,
|
|
@@ -153,6 +155,7 @@ export {
|
|
|
153
155
|
Blobs_Select_Column,
|
|
154
156
|
CHUNK_SIZE_PARAMS,
|
|
155
157
|
COMMITMENT_SCHEMA_VERSION,
|
|
158
|
+
ChallengeResponseSchema,
|
|
156
159
|
ChunkKey,
|
|
157
160
|
ChunkSizeScheme,
|
|
158
161
|
ChunksetCommitmentSchema,
|
|
@@ -181,6 +184,7 @@ export {
|
|
|
181
184
|
GetTotalBlobsSizeDocument,
|
|
182
185
|
MICROPAYMENTS_DEPLOYER,
|
|
183
186
|
MissingTransactionSubmitterError,
|
|
187
|
+
MultipartUploadStatusResponseSchema,
|
|
184
188
|
NetworkToGasStationBaseUrl,
|
|
185
189
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
186
190
|
NetworkToShelbyRPCBaseUrl,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultErasureCodingConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AY3HBWXA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getShelbyIndexerClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NEO7Z3ZQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getAptosConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V4B3GAMQ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
createBlobKey
|
|
12
12
|
} from "./chunk-3NRBHSMQ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
expectedTotalChunksets
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RNNJXTX2.mjs";
|
|
16
16
|
import {
|
|
17
17
|
getBlobNameSuffix,
|
|
18
18
|
normalizeAddress
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-AUQDI5BS.mjs";
|
|
26
26
|
import {
|
|
27
27
|
SHELBY_DEPLOYER
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-MNCQBEMS.mjs";
|
|
29
29
|
|
|
30
30
|
// src/core/clients/ShelbyBlobClient.ts
|
|
31
31
|
import {
|
|
@@ -47,6 +47,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
47
47
|
deployer;
|
|
48
48
|
indexer;
|
|
49
49
|
defaultOptions;
|
|
50
|
+
orderless;
|
|
50
51
|
/**
|
|
51
52
|
* The ShelbyBlobClient is used to interact with the Shelby contract on the Aptos blockchain. This
|
|
52
53
|
* includes functions for registering blob commitments and retrieving blob metadata.
|
|
@@ -90,6 +91,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
90
91
|
this.deployer = config.deployer ?? AccountAddress.fromString(SHELBY_DEPLOYER);
|
|
91
92
|
this.indexer = getShelbyIndexerClient(config);
|
|
92
93
|
this.defaultOptions = defaultOptions ?? {};
|
|
94
|
+
this.orderless = config.orderless ?? false;
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
95
97
|
* Merges method-level options with default options, giving precedence to method-level values.
|
|
@@ -118,6 +120,19 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
118
120
|
throw new MissingTransactionSubmitterError();
|
|
119
121
|
}
|
|
120
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Merges orderless replay protection into transaction options when
|
|
125
|
+
* `config.orderless` is enabled. If the caller already supplies options
|
|
126
|
+
* (e.g. custom gas limits), those are preserved and the nonce is injected
|
|
127
|
+
* alongside them. When orderless mode is off, user options are returned as-is.
|
|
128
|
+
*/
|
|
129
|
+
orderlessTxOptions(userOptions) {
|
|
130
|
+
if (!this.orderless) return userOptions;
|
|
131
|
+
return {
|
|
132
|
+
replayProtectionNonce: crypto.getRandomValues(new Uint32Array(1))[0],
|
|
133
|
+
...userOptions
|
|
134
|
+
};
|
|
135
|
+
}
|
|
121
136
|
/**
|
|
122
137
|
* Retrieves the blob metadata from the blockchain. If it does not exist,
|
|
123
138
|
* returns `undefined`.
|
|
@@ -384,6 +399,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
384
399
|
const chunksetSize = config.chunkSizeBytes * config.erasure_k;
|
|
385
400
|
const buildArgs = {
|
|
386
401
|
...options.build,
|
|
402
|
+
options: this.orderlessTxOptions(options.build?.options),
|
|
387
403
|
data: _ShelbyBlobClient.createRegisterBlobPayload({
|
|
388
404
|
deployer: this.deployer,
|
|
389
405
|
account: params.account.accountAddress,
|
|
@@ -429,7 +445,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
429
445
|
*/
|
|
430
446
|
async deleteBlob(params) {
|
|
431
447
|
const transaction = await this.aptos.transaction.build.simple({
|
|
432
|
-
|
|
448
|
+
options: this.orderlessTxOptions(params.options),
|
|
433
449
|
data: _ShelbyBlobClient.createDeleteBlobPayload({
|
|
434
450
|
deployer: this.deployer,
|
|
435
451
|
blobName: params.blobName
|
|
@@ -472,7 +488,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
472
488
|
*/
|
|
473
489
|
async deleteMultipleBlobs(params) {
|
|
474
490
|
const transaction = await this.aptos.transaction.build.simple({
|
|
475
|
-
|
|
491
|
+
options: this.orderlessTxOptions(params.options),
|
|
476
492
|
data: _ShelbyBlobClient.createDeleteMultipleBlobsPayload({
|
|
477
493
|
deployer: this.deployer,
|
|
478
494
|
blobNames: params.blobNames
|
|
@@ -514,6 +530,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
514
530
|
async addChunksetAcknowledgements(params) {
|
|
515
531
|
const transaction = await this.aptos.transaction.build.simple({
|
|
516
532
|
...params.options?.build,
|
|
533
|
+
options: this.orderlessTxOptions(params.options?.build?.options),
|
|
517
534
|
data: _ShelbyBlobClient.createChunksetAcknowledgementsPayload({
|
|
518
535
|
blobOwner: params.blobOwner,
|
|
519
536
|
blobName: params.blobName,
|
|
@@ -570,6 +587,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
570
587
|
const chunksetSize = config.chunkSizeBytes * config.erasure_k;
|
|
571
588
|
const buildArgs = {
|
|
572
589
|
...options.build,
|
|
590
|
+
options: this.orderlessTxOptions(options.build?.options),
|
|
573
591
|
sender: params.account.accountAddress,
|
|
574
592
|
data: _ShelbyBlobClient.createBatchRegisterBlobsPayload({
|
|
575
593
|
deployer: this.deployer,
|
|
@@ -759,6 +777,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
759
777
|
async addBlobAcknowledgements(params) {
|
|
760
778
|
const transaction = await this.aptos.transaction.build.simple({
|
|
761
779
|
...params.options?.build,
|
|
780
|
+
options: this.orderlessTxOptions(params.options?.build?.options),
|
|
762
781
|
data: _ShelbyBlobClient.createBlobAcknowledgementsPayload({
|
|
763
782
|
blobOwner: params.blobOwner,
|
|
764
783
|
blobName: params.blobName,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAptosConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V4B3GAMQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
normalizeAddress
|
|
6
6
|
} from "./chunk-UEZNZBJO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
SHELBY_DEPLOYER
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MNCQBEMS.mjs";
|
|
10
10
|
|
|
11
11
|
// src/core/clients/ShelbyMetadataClient.ts
|
|
12
12
|
import {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShelbyRPCClient
|
|
3
|
+
} from "./chunk-WFWRBNTW.mjs";
|
|
1
4
|
import {
|
|
2
5
|
ShelbyBlobClient
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5BVSWXQJ.mjs";
|
|
4
7
|
import {
|
|
5
8
|
defaultErasureCodingConfig
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AY3HBWXA.mjs";
|
|
7
10
|
import {
|
|
8
11
|
ClayErasureCodingProvider
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OEK24ON7.mjs";
|
|
10
13
|
import {
|
|
11
14
|
ShelbyMetadataClient
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
ShelbyRPCClient
|
|
15
|
-
} from "./chunk-BKL7NCUB.mjs";
|
|
15
|
+
} from "./chunk-6FJNAUU5.mjs";
|
|
16
16
|
import {
|
|
17
17
|
getAptosConfig,
|
|
18
18
|
getShelbyRPCBaseUrl
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-V4B3GAMQ.mjs";
|
|
20
20
|
import {
|
|
21
21
|
createBlobKey
|
|
22
22
|
} from "./chunk-3NRBHSMQ.mjs";
|
|
23
23
|
import {
|
|
24
24
|
generateCommitments
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RNNJXTX2.mjs";
|
|
26
26
|
import {
|
|
27
27
|
normalizeAddress
|
|
28
28
|
} from "./chunk-UEZNZBJO.mjs";
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
// src/core/rpc-responses.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
var ChallengeResponseSchema = z.object({
|
|
4
|
+
challenge: z.string(),
|
|
5
|
+
expiresAt: z.number()
|
|
6
|
+
});
|
|
7
|
+
var MultipartUploadStatusResponseSchema = z.object({
|
|
8
|
+
uploadId: z.string(),
|
|
9
|
+
completedParts: z.array(z.number()),
|
|
10
|
+
partSize: z.number(),
|
|
11
|
+
nParts: z.number(),
|
|
12
|
+
uploadedBytes: z.number()
|
|
13
|
+
});
|
|
3
14
|
var StartMultipartUploadResponseSchema = z.object({
|
|
4
15
|
uploadId: z.string()
|
|
5
16
|
});
|
|
@@ -18,6 +29,8 @@ var StaleMicropaymentErrorResponseSchema = z.object({
|
|
|
18
29
|
});
|
|
19
30
|
|
|
20
31
|
export {
|
|
32
|
+
ChallengeResponseSchema,
|
|
33
|
+
MultipartUploadStatusResponseSchema,
|
|
21
34
|
StartMultipartUploadResponseSchema,
|
|
22
35
|
UploadPartResponseSchema,
|
|
23
36
|
CompleteMultipartUploadResponseSchema,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SenderBuiltMicropayment
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KG2TMLEV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getShelbyIndexerClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NEO7Z3ZQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getAptosConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V4B3GAMQ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
normalizeAddress
|
|
12
12
|
} from "./chunk-UEZNZBJO.mjs";
|
|
13
13
|
import {
|
|
14
14
|
MICROPAYMENTS_DEPLOYER
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MNCQBEMS.mjs";
|
|
16
16
|
|
|
17
17
|
// src/core/clients/ShelbyMicropaymentChannelClient.ts
|
|
18
18
|
import {
|
|
@@ -12,10 +12,10 @@ var NetworkToShelbyRPCBaseUrl = {
|
|
|
12
12
|
[Network.CUSTOM]: void 0
|
|
13
13
|
};
|
|
14
14
|
var NetworkToShelbyBlobIndexerBaseUrl = {
|
|
15
|
-
[Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/
|
|
15
|
+
[Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/alias/shelby/shelbynet/v1/graphql",
|
|
16
16
|
[Network.NETNA]: void 0,
|
|
17
17
|
[Network.DEVNET]: void 0,
|
|
18
|
-
[Network.TESTNET]: "https://api.testnet.aptoslabs.com/nocode/v1/public/
|
|
18
|
+
[Network.TESTNET]: "https://api.testnet.aptoslabs.com/nocode/v1/public/alias/shelby/testnet/v1/graphql",
|
|
19
19
|
[Network.MAINNET]: void 0,
|
|
20
20
|
[Network.LOCAL]: void 0,
|
|
21
21
|
[Network.CUSTOM]: void 0
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-TET3DJEO.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getAptosConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-V4B3GAMQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
NetworkToShelbyBlobIndexerBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MNCQBEMS.mjs";
|
|
10
10
|
|
|
11
11
|
// src/core/operations/index.ts
|
|
12
12
|
import { Network } from "@aptos-labs/ts-sdk";
|
|
@@ -32,8 +32,7 @@ var ClayErasureCodingProvider = class _ClayErasureCodingProvider {
|
|
|
32
32
|
k: config.erasure_k,
|
|
33
33
|
d: config.erasure_d,
|
|
34
34
|
chunkSizeBytes: config.chunkSizeBytes,
|
|
35
|
-
|
|
36
|
-
// No chunks erased initially; will be reconfigured on decode
|
|
35
|
+
erasedChunkIndexes: []
|
|
37
36
|
})
|
|
38
37
|
]);
|
|
39
38
|
return provider;
|
|
@@ -78,13 +78,9 @@ async function generateMerkleRoot(leafHashes) {
|
|
|
78
78
|
}
|
|
79
79
|
return currentLeaves[0];
|
|
80
80
|
}
|
|
81
|
-
async function generateChunksetCommitments(
|
|
81
|
+
async function generateChunksetCommitments(chunksetIdx, chunksetData, expectedChunksetSize, provider, onChunk) {
|
|
82
82
|
const { erasure_n } = provider.config;
|
|
83
|
-
const chunksetPayload =
|
|
84
|
-
chunksetData,
|
|
85
|
-
expectedChunksetSize,
|
|
86
|
-
chunksetIdx
|
|
87
|
-
);
|
|
83
|
+
const chunksetPayload = zeroPadBytes(chunksetData, expectedChunksetSize);
|
|
88
84
|
const { chunks } = provider.encode(chunksetPayload);
|
|
89
85
|
if (chunks.length !== erasure_n) {
|
|
90
86
|
throw new Error(
|
|
@@ -110,9 +106,8 @@ async function generateChunksetCommitments(shouldPad, chunksetIdx, chunksetData,
|
|
|
110
106
|
};
|
|
111
107
|
return { h: a, entry };
|
|
112
108
|
}
|
|
113
|
-
async function generateCommitments(provider, fullData, onChunk
|
|
109
|
+
async function generateCommitments(provider, fullData, onChunk) {
|
|
114
110
|
const expectedChunksetSize = provider.config.chunkSizeBytes * provider.config.erasure_k;
|
|
115
|
-
const shouldPad = options?.pad ?? true;
|
|
116
111
|
const chunksetCommitments = [];
|
|
117
112
|
const chunksetCommitmentHashes = [];
|
|
118
113
|
let rawDataSize = 0;
|
|
@@ -120,7 +115,6 @@ async function generateCommitments(provider, fullData, onChunk, options) {
|
|
|
120
115
|
for await (const [chunksetIdx, chunksetData] of chunksetGen) {
|
|
121
116
|
rawDataSize += chunksetData.length;
|
|
122
117
|
const { h, entry } = await generateChunksetCommitments(
|
|
123
|
-
shouldPad,
|
|
124
118
|
chunksetIdx,
|
|
125
119
|
chunksetData,
|
|
126
120
|
expectedChunksetSize,
|
|
@@ -133,7 +127,6 @@ async function generateCommitments(provider, fullData, onChunk, options) {
|
|
|
133
127
|
if (rawDataSize === 0) {
|
|
134
128
|
const zeroChunkset = new Uint8Array(expectedChunksetSize);
|
|
135
129
|
const { h, entry } = await generateChunksetCommitments(
|
|
136
|
-
shouldPad,
|
|
137
130
|
0,
|
|
138
131
|
zeroChunkset,
|
|
139
132
|
expectedChunksetSize,
|
|
@@ -150,14 +143,6 @@ async function generateCommitments(provider, fullData, onChunk, options) {
|
|
|
150
143
|
chunkset_commitments: chunksetCommitments
|
|
151
144
|
};
|
|
152
145
|
}
|
|
153
|
-
function validatePrePaddedChunkset(chunkset, expectedSize, chunksetIdx) {
|
|
154
|
-
if (chunkset.byteLength !== expectedSize) {
|
|
155
|
-
throw new Error(
|
|
156
|
-
`Chunkset ${chunksetIdx} has size ${chunkset.byteLength} bytes but expected ${expectedSize} bytes. Enable padding or supply pre-padded data before calling generateCommitments.`
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
return chunkset;
|
|
160
|
-
}
|
|
161
146
|
|
|
162
147
|
export {
|
|
163
148
|
COMMITMENT_SCHEMA_VERSION,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StaleChannelStateError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KG2TMLEV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getShelbyIndexerClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NEO7Z3ZQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getShelbyRPCBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V4B3GAMQ.mjs";
|
|
10
|
+
import {
|
|
11
|
+
BlobNameSchema
|
|
12
|
+
} from "./chunk-Z4FZ7W6L.mjs";
|
|
10
13
|
import {
|
|
11
14
|
sleep
|
|
12
15
|
} from "./chunk-I6NG5GNL.mjs";
|
|
13
16
|
import {
|
|
14
17
|
StaleMicropaymentErrorResponseSchema,
|
|
15
18
|
StartMultipartUploadResponseSchema
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-M3CP5TFP.mjs";
|
|
17
20
|
import {
|
|
18
21
|
buildRequestUrl,
|
|
19
22
|
normalizeAddress,
|
|
20
23
|
readInChunks
|
|
21
24
|
} from "./chunk-UEZNZBJO.mjs";
|
|
22
|
-
import {
|
|
23
|
-
BlobNameSchema
|
|
24
|
-
} from "./chunk-Z4FZ7W6L.mjs";
|
|
25
25
|
|
|
26
26
|
// src/core/clients/ShelbyRPCClient.ts
|
|
27
27
|
var MICROPAYMENT_HEADER = "X-Shelby-Micropayment";
|
|
@@ -101,13 +101,6 @@ interface ClayErasureCodeParams {
|
|
|
101
101
|
type ClayProviderOptions = Partial<ClayErasureCodeParams & ErasureCodingConfig>;
|
|
102
102
|
/**
|
|
103
103
|
* Clay-specific decode configuration.
|
|
104
|
-
*
|
|
105
|
-
* Supports flexible erasure pattern specification in any of three formats:
|
|
106
|
-
* - availableChunkIndexes: Array of available chunk positions
|
|
107
|
-
* - erasedChunkIndexes: Array of missing chunk positions
|
|
108
|
-
* - erasedChunksMask: Bitmask where bit i=1 means chunk i is missing
|
|
109
|
-
*
|
|
110
|
-
* Exactly one of these three options must be provided.
|
|
111
104
|
*/
|
|
112
105
|
type ClayDecodeConfig = DecoderReconfigureOptions;
|
|
113
106
|
declare class ClayErasureCodingProvider implements ErasureCodingProvider {
|
package/dist/core/blobs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputGenerateTransactionOptions, Aptos, AccountAddress, InputTransactionPluginData, AccountAddressInput, Account, PendingTransactionResponse, InputGenerateTransactionPayloadData } from '@aptos-labs/ts-sdk';
|
|
2
2
|
import { BlobName } from '../layout.js';
|
|
3
3
|
import { BlobMetadata, BlobActivity, StorageProviderAck } from '../types/blobs.js';
|
|
4
|
-
import { E as ErasureCodingConfig } from '../../clay-codes-
|
|
4
|
+
import { E as ErasureCodingConfig } from '../../clay-codes-DdXABBDx.js';
|
|
5
5
|
import { ShelbyIndexerClient } from '../operations/index.js';
|
|
6
6
|
import { Blobs_Order_By, Blobs_Bool_Exp, Blob_Activities_Bool_Exp, Blob_Activities_Order_By } from '../operations/generated/sdk.js';
|
|
7
7
|
import { ShelbyClientConfig } from './ShelbyClientConfig.js';
|
|
@@ -60,6 +60,7 @@ declare class ShelbyBlobClient {
|
|
|
60
60
|
readonly deployer: AccountAddress;
|
|
61
61
|
readonly indexer: ShelbyIndexerClient;
|
|
62
62
|
readonly defaultOptions: WriteBlobCommitmentsOptions;
|
|
63
|
+
private readonly orderless;
|
|
63
64
|
/**
|
|
64
65
|
* The ShelbyBlobClient is used to interact with the Shelby contract on the Aptos blockchain. This
|
|
65
66
|
* includes functions for registering blob commitments and retrieving blob metadata.
|
|
@@ -110,6 +111,13 @@ declare class ShelbyBlobClient {
|
|
|
110
111
|
* provided without a transaction submitter.
|
|
111
112
|
*/
|
|
112
113
|
private validateUsdSponsorConfig;
|
|
114
|
+
/**
|
|
115
|
+
* Merges orderless replay protection into transaction options when
|
|
116
|
+
* `config.orderless` is enabled. If the caller already supplies options
|
|
117
|
+
* (e.g. custom gas limits), those are preserved and the nonce is injected
|
|
118
|
+
* alongside them. When orderless mode is off, user options are returned as-is.
|
|
119
|
+
*/
|
|
120
|
+
private orderlessTxOptions;
|
|
113
121
|
/**
|
|
114
122
|
* Retrieves the blob metadata from the blockchain. If it does not exist,
|
|
115
123
|
* returns `undefined`.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MissingTransactionSubmitterError,
|
|
3
3
|
ShelbyBlobClient
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-5BVSWXQJ.mjs";
|
|
5
5
|
import "../../chunk-XNEIWM4O.mjs";
|
|
6
6
|
import "../../chunk-NHWWORCH.mjs";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-AY3HBWXA.mjs";
|
|
8
|
+
import "../../chunk-OEK24ON7.mjs";
|
|
9
|
+
import "../../chunk-NEO7Z3ZQ.mjs";
|
|
10
10
|
import "../../chunk-TET3DJEO.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-V4B3GAMQ.mjs";
|
|
12
12
|
import "../../chunk-3NRBHSMQ.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-RNNJXTX2.mjs";
|
|
14
14
|
import "../../chunk-UEZNZBJO.mjs";
|
|
15
15
|
import "../../chunk-JTXYKO3U.mjs";
|
|
16
16
|
import "../../chunk-AUQDI5BS.mjs";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-MNCQBEMS.mjs";
|
|
18
18
|
import "../../chunk-7P6ASYW6.mjs";
|
|
19
19
|
export {
|
|
20
20
|
MissingTransactionSubmitterError,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Aptos, Account, AccountAddressInput } from '@aptos-labs/ts-sdk';
|
|
2
2
|
import { ShelbyBlob } from '../blobs.js';
|
|
3
|
-
import { a as ErasureCodingProvider } from '../../clay-codes-
|
|
3
|
+
import { a as ErasureCodingProvider } from '../../clay-codes-DdXABBDx.js';
|
|
4
4
|
import { BlobName } from '../layout.js';
|
|
5
5
|
import { WriteBlobCommitmentsOptions, ShelbyBlobClient } from './ShelbyBlobClient.js';
|
|
6
6
|
import { ShelbyClientConfig } from './ShelbyClientConfig.js';
|
|
7
7
|
import { ShelbyMetadataClient } from './ShelbyMetadataClient.js';
|
|
8
8
|
import { ShelbyRPCClient } from './ShelbyRPCClient.js';
|
|
9
|
-
import 'zod';
|
|
10
9
|
import '@shelby-protocol/clay-codes';
|
|
10
|
+
import 'zod';
|
|
11
11
|
import '../types/blobs.js';
|
|
12
12
|
import '../operations/index.js';
|
|
13
13
|
import 'graphql-request';
|