@shelby-protocol/sdk 0.0.9 → 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 +17 -10
- package/dist/browser/index.mjs +89 -28
- package/dist/{chunk-XWAPNLU6.mjs → chunk-2WEX3K7C.mjs} +6 -4
- package/dist/chunk-4MG4XGY4.mjs +91 -0
- package/dist/{chunk-SEXQTDX6.mjs → chunk-4ZOFT75Q.mjs} +16 -2
- package/dist/{chunk-BTHSKDJR.mjs → chunk-7PN65RDX.mjs} +44 -10
- package/dist/chunk-AABBONAF.mjs +34 -0
- package/dist/{chunk-ZPW742E7.mjs → chunk-AUQDI5BS.mjs} +17 -2
- package/dist/{chunk-HFGEQP5N.mjs → chunk-CGYJLKBU.mjs} +4 -4
- package/dist/chunk-CQ6QPIZK.mjs +37 -0
- package/dist/{chunk-VRLIOKWG.mjs → chunk-D6GQHO6G.mjs} +5 -1
- package/dist/chunk-E5QCRTBU.mjs +493 -0
- package/dist/chunk-HPPMI7DC.mjs +56 -0
- package/dist/chunk-IE6LYVIA.mjs +26 -0
- package/dist/{chunk-67F5YZ25.mjs → chunk-JTXYKO3U.mjs} +10 -0
- package/dist/{chunk-WJKSPJSS.mjs → chunk-KJ24NKPH.mjs} +46 -0
- package/dist/{chunk-WBFEX7OM.mjs → chunk-MV6FNYAU.mjs} +31 -7
- package/dist/{chunk-PZF2VTGP.mjs → chunk-NHWWORCH.mjs} +3 -1
- package/dist/{chunk-NLPIHQ7K.mjs → chunk-OGKZ575S.mjs} +6 -19
- package/dist/{chunk-5I3MBJGN.mjs → chunk-PJVWGMVI.mjs} +164 -35
- package/dist/{chunk-7UVMDCCR.mjs → chunk-SRV4YWFH.mjs} +232 -47
- package/dist/chunk-W37FZSMA.mjs +83 -0
- package/dist/chunk-WTICJPDB.mjs +0 -0
- package/dist/chunk-Z4FZ7W6L.mjs +39 -0
- package/dist/{chunk-QFWQ7FIC.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 +165 -12
- package/dist/core/clients/ShelbyBlobClient.mjs +13 -11
- package/dist/core/clients/ShelbyClient.d.ts +21 -4
- package/dist/core/clients/ShelbyClient.mjs +17 -14
- package/dist/core/clients/ShelbyClientConfig.d.ts +7 -2
- package/dist/{node → core}/clients/ShelbyMetadataClient.d.ts +3 -3
- package/dist/core/clients/ShelbyMetadataClient.mjs +9 -0
- package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +349 -0
- package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +16 -0
- package/dist/core/clients/ShelbyPlacementGroupClient.d.ts +73 -0
- package/dist/core/clients/ShelbyPlacementGroupClient.mjs +11 -0
- package/dist/core/clients/ShelbyRPCClient.d.ts +30 -4
- package/dist/core/clients/ShelbyRPCClient.mjs +8 -8
- package/dist/core/clients/index.d.ts +11 -5
- package/dist/core/clients/index.mjs +35 -15
- package/dist/core/clients/utils.d.ts +54 -0
- package/dist/core/clients/utils.mjs +1 -1
- package/dist/core/commitments.d.ts +6 -2
- package/dist/core/commitments.mjs +5 -3
- package/dist/core/constants.d.ts +18 -3
- package/dist/core/constants.mjs +5 -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 +15 -3
- package/dist/core/erasure/constants.mjs +3 -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 +3 -3
- package/dist/core/erasure/index.mjs +15 -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/errors.d.ts +58 -0
- package/dist/core/errors.mjs +15 -0
- package/dist/core/index.d.ts +17 -10
- package/dist/core/index.mjs +89 -28
- 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/generated/sdk.d.ts +207 -17
- package/dist/core/operations/generated/sdk.mjs +7 -1
- package/dist/core/operations/index.d.ts +9 -3
- package/dist/core/operations/index.mjs +10 -4
- package/dist/core/rpc-responses.d.ts +69 -0
- package/dist/core/rpc-responses.mjs +15 -0
- package/dist/core/types/blobs.d.ts +8 -4
- package/dist/core/types/encodings.d.ts +1 -1
- package/dist/core/types/index.d.ts +4 -2
- package/dist/core/types/index.mjs +12 -2
- package/dist/core/types/payments.d.ts +94 -0
- package/dist/core/types/payments.mjs +9 -0
- package/dist/core/types/placement_groups.d.ts +30 -1
- package/dist/core/types/placement_groups.mjs +1 -0
- package/dist/core/types/storage_providers.d.ts +32 -2
- package/dist/node/clients/ShelbyNodeClient.d.ts +9 -6
- package/dist/node/clients/ShelbyNodeClient.mjs +18 -15
- package/dist/node/clients/index.d.ts +7 -6
- package/dist/node/clients/index.mjs +19 -17
- package/dist/node/index.d.ts +17 -11
- package/dist/node/index.mjs +91 -34
- package/package.json +3 -2
- package/dist/chunk-CPNZAQVY.mjs +0 -29
- package/dist/chunk-GY5DCVVL.mjs +0 -86
- package/dist/chunk-RBFWGDMY.mjs +0 -30
- package/dist/node/clients/ShelbyMetadataClient.mjs +0 -9
- /package/dist/{chunk-DJJD2AXO.mjs → chunk-AD2G3QYD.mjs} +0 -0
- /package/dist/{chunk-MWDW4ROU.mjs → chunk-EM67QTMR.mjs} +0 -0
- /package/dist/{chunk-RNXGC54D.mjs → chunk-QQ57OGQ2.mjs} +0 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
export { getAptosAccountExplorerUrl, getAptosTransactionExplorerUrl } from '../core/aptos-explorer.js';
|
|
2
2
|
export { ShelbyBlob, createBlobKey } from '../core/blobs.js';
|
|
3
3
|
export { CHUNK_SIZE_PARAMS, ChunkSizeScheme, DEFAULT_CHUNKSET_SIZE_BYTES, DEFAULT_CHUNK_SIZE_BYTES, ERASURE_CODE_AND_CHUNK_MAPPING } from '../core/chunk.js';
|
|
4
|
-
export { ShelbyBlobClient } from '../core/clients/ShelbyBlobClient.js';
|
|
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 {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
7
|
+
export { ShelbyMetadataClient } from '../core/clients/ShelbyMetadataClient.js';
|
|
8
|
+
export { ShelbyMicropaymentChannelClient } from '../core/clients/ShelbyMicropaymentChannelClient.js';
|
|
9
|
+
export { ShelbyPlacementGroupClient } from '../core/clients/ShelbyPlacementGroupClient.js';
|
|
10
|
+
export { BlobDataSource, PutBlobProgress, ShelbyRPCClient } from '../core/clients/ShelbyRPCClient.js';
|
|
11
|
+
export { BlobCommitments, BlobCommitmentsSchema, COMMITMENT_SCHEMA_VERSION, ChunksetCommitment, ChunksetCommitmentSchema, GenerateCommitmentsOptions, expectedTotalChunksets, generateCommitments, generateMerkleRoot } from '../core/commitments.js';
|
|
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';
|
|
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
|
+
export { createDefaultErasureCodingProvider, defaultErasureCodingConfig, erasureCodingConfig16Total10Data13Helper, erasureCodingConfig4Total2Data3Helper } from '../core/erasure/default.js';
|
|
16
|
+
export { ShelbyErrorCodes, isAccessDeniedError, isBlobAlreadyExistsError, isBlobExpiredError, isBlobNotFoundError } from '../core/errors.js';
|
|
17
|
+
export { BlobName, BlobNameSchema, ChunkKey } from '../core/layout.js';
|
|
14
18
|
export { ShelbyNetwork, isShelbyNetwork, shelbyNetworks } from '../core/networks.js';
|
|
15
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';
|
|
16
21
|
export { getShelbyAccountBlobsExplorerUrl, getShelbyAccountExplorerUrl, getShelbyBlobExplorerUrl } from '../core/shelby-explorer.js';
|
|
17
22
|
export { BlobActivity, BlobActivityType, BlobEncoding, BlobMetadata, ClayEncoding, StorageProviderAck } from '../core/types/blobs.js';
|
|
18
|
-
export {
|
|
23
|
+
export { ChannelInfo, SenderBuiltMicropayment, StaleChannelStateError } from '../core/types/payments.js';
|
|
24
|
+
export { PlacementGroupInfo, PlacementGroupSlot, PlacementGroupSlotStatus } from '../core/types/placement_groups.js';
|
|
25
|
+
export { ActiveStateDetails, FrozenStateDetails, StorageProviderInfo, StorageProviderStateDetails, WaitlistedStateDetails } from '../core/types/storage_providers.js';
|
|
19
26
|
export { buildRequestUrl, concatHashes, getBlobNameSuffix, readInChunks, zeroPadBytes } from '../core/utils.js';
|
|
20
|
-
export { Bigint_Comparison_Exp, Blob_Activities, Blob_Activities_Aggregate, Blob_Activities_Aggregate_Fields, Blob_Activities_Aggregate_FieldsCountArgs, Blob_Activities_Avg_Fields, Blob_Activities_Bool_Exp, Blob_Activities_Max_Fields, Blob_Activities_Min_Fields, Blob_Activities_Order_By, Blob_Activities_Select_Column, Blob_Activities_Stddev_Fields, Blob_Activities_Stddev_Pop_Fields, Blob_Activities_Stddev_Samp_Fields, Blob_Activities_Stream_Cursor_Input, Blob_Activities_Stream_Cursor_Value_Input, Blob_Activities_Sum_Fields, Blob_Activities_Var_Pop_Fields, Blob_Activities_Var_Samp_Fields, Blob_Activities_Variance_Fields, Blobs, BlobsPlacement_Group_SlotsArgs, Blobs_Aggregate, Blobs_Aggregate_Fields, Blobs_Aggregate_FieldsCountArgs, Blobs_Avg_Fields, Blobs_Bool_Exp, Blobs_Max_Fields, Blobs_Min_Fields, Blobs_Order_By, Blobs_Select_Column, Blobs_Stddev_Fields, Blobs_Stddev_Pop_Fields, Blobs_Stddev_Samp_Fields, Blobs_Stream_Cursor_Input, Blobs_Stream_Cursor_Value_Input, Blobs_Sum_Fields, Blobs_Var_Pop_Fields, Blobs_Var_Samp_Fields, Blobs_Variance_Fields, Cursor_Ordering, Exact, GetBlobActivitiesCountDocument, GetBlobActivitiesCountQuery, GetBlobActivitiesCountQueryVariables, GetBlobActivitiesDocument, GetBlobActivitiesQuery, GetBlobActivitiesQueryVariables, GetBlobsCountDocument, GetBlobsCountQuery, GetBlobsCountQueryVariables, GetBlobsDocument, GetBlobsQuery, GetBlobsQueryVariables, Incremental, InputMaybe, MakeEmpty, MakeMaybe, MakeOptional, Maybe, Numeric_Comparison_Exp, Order_By, Placement_Group_Slots, Placement_Group_Slots_Aggregate_Order_By, Placement_Group_Slots_Avg_Order_By, Placement_Group_Slots_Bool_Exp, Placement_Group_Slots_Max_Order_By, Placement_Group_Slots_Min_Order_By, Placement_Group_Slots_Order_By, Placement_Group_Slots_Select_Column, Placement_Group_Slots_Stddev_Order_By, Placement_Group_Slots_Stddev_Pop_Order_By, Placement_Group_Slots_Stddev_Samp_Order_By, Placement_Group_Slots_Stream_Cursor_Input, Placement_Group_Slots_Stream_Cursor_Value_Input, Placement_Group_Slots_Sum_Order_By, Placement_Group_Slots_Var_Pop_Order_By, Placement_Group_Slots_Var_Samp_Order_By, Placement_Group_Slots_Variance_Order_By, Processor_Status, Processor_Status_Bool_Exp, Processor_Status_Order_By, Processor_Status_Select_Column, Processor_Status_Stream_Cursor_Input, Processor_Status_Stream_Cursor_Value_Input, Query_Root, Query_RootBlob_ActivitiesArgs, Query_RootBlob_Activities_AggregateArgs, Query_RootBlob_Activities_By_PkArgs, Query_RootBlobsArgs, Query_RootBlobs_AggregateArgs, Query_RootBlobs_By_PkArgs, Query_RootPlacement_Group_SlotsArgs, Query_RootPlacement_Group_Slots_By_PkArgs, Query_RootProcessor_StatusArgs, Scalars, Sdk, SdkFunctionWrapper, String_Comparison_Exp, Subscription_Root, Subscription_RootBlob_ActivitiesArgs, Subscription_RootBlob_Activities_AggregateArgs, Subscription_RootBlob_Activities_By_PkArgs, Subscription_RootBlob_Activities_StreamArgs, Subscription_RootBlobsArgs, Subscription_RootBlobs_AggregateArgs, Subscription_RootBlobs_By_PkArgs, Subscription_RootBlobs_StreamArgs, Subscription_RootPlacement_Group_SlotsArgs, Subscription_RootPlacement_Group_Slots_By_PkArgs, Subscription_RootPlacement_Group_Slots_StreamArgs, Subscription_RootProcessor_StatusArgs, Subscription_RootProcessor_Status_StreamArgs, Timestamp_Comparison_Exp, getSdk } from '../core/operations/generated/sdk.js';
|
|
27
|
+
export { Bigint_Comparison_Exp, Blob_Activities, Blob_Activities_Aggregate, Blob_Activities_Aggregate_Fields, Blob_Activities_Aggregate_FieldsCountArgs, Blob_Activities_Avg_Fields, Blob_Activities_Bool_Exp, Blob_Activities_Max_Fields, Blob_Activities_Min_Fields, Blob_Activities_Order_By, Blob_Activities_Select_Column, Blob_Activities_Stddev_Fields, Blob_Activities_Stddev_Pop_Fields, Blob_Activities_Stddev_Samp_Fields, Blob_Activities_Stream_Cursor_Input, Blob_Activities_Stream_Cursor_Value_Input, Blob_Activities_Sum_Fields, Blob_Activities_Var_Pop_Fields, Blob_Activities_Var_Samp_Fields, Blob_Activities_Variance_Fields, Blobs, BlobsPlacement_Group_SlotsArgs, BlobsPlacement_Group_Slots_AggregateArgs, Blobs_Aggregate, Blobs_Aggregate_Fields, Blobs_Aggregate_FieldsCountArgs, Blobs_Avg_Fields, Blobs_Bool_Exp, Blobs_Max_Fields, Blobs_Min_Fields, Blobs_Order_By, Blobs_Select_Column, Blobs_Stddev_Fields, Blobs_Stddev_Pop_Fields, Blobs_Stddev_Samp_Fields, Blobs_Stream_Cursor_Input, Blobs_Stream_Cursor_Value_Input, Blobs_Sum_Fields, Blobs_Var_Pop_Fields, Blobs_Var_Samp_Fields, Blobs_Variance_Fields, Cursor_Ordering, Exact, GetBlobActivitiesCountDocument, GetBlobActivitiesCountQuery, GetBlobActivitiesCountQueryVariables, GetBlobActivitiesDocument, GetBlobActivitiesQuery, GetBlobActivitiesQueryVariables, GetBlobsCountDocument, GetBlobsCountQuery, GetBlobsCountQueryVariables, GetBlobsDocument, GetBlobsQuery, GetBlobsQueryVariables, GetPlacementGroupSlotsCountDocument, GetPlacementGroupSlotsCountQuery, GetPlacementGroupSlotsCountQueryVariables, GetPlacementGroupSlotsDocument, GetPlacementGroupSlotsQuery, GetPlacementGroupSlotsQueryVariables, GetProcessorStatusDocument, GetProcessorStatusQuery, GetProcessorStatusQueryVariables, Incremental, InputMaybe, Int_Comparison_Exp, MakeEmpty, MakeMaybe, MakeOptional, Maybe, Numeric_Comparison_Exp, Order_By, Placement_Group_Slots, Placement_Group_Slots_Aggregate, Placement_Group_Slots_Aggregate_Bool_Exp, Placement_Group_Slots_Aggregate_Bool_Exp_Count, Placement_Group_Slots_Aggregate_Fields, Placement_Group_Slots_Aggregate_FieldsCountArgs, Placement_Group_Slots_Aggregate_Order_By, Placement_Group_Slots_Avg_Fields, Placement_Group_Slots_Avg_Order_By, Placement_Group_Slots_Bool_Exp, Placement_Group_Slots_Max_Fields, Placement_Group_Slots_Max_Order_By, Placement_Group_Slots_Min_Fields, Placement_Group_Slots_Min_Order_By, Placement_Group_Slots_Order_By, Placement_Group_Slots_Select_Column, Placement_Group_Slots_Stddev_Fields, Placement_Group_Slots_Stddev_Order_By, Placement_Group_Slots_Stddev_Pop_Fields, Placement_Group_Slots_Stddev_Pop_Order_By, Placement_Group_Slots_Stddev_Samp_Fields, Placement_Group_Slots_Stddev_Samp_Order_By, Placement_Group_Slots_Stream_Cursor_Input, Placement_Group_Slots_Stream_Cursor_Value_Input, Placement_Group_Slots_Sum_Fields, Placement_Group_Slots_Sum_Order_By, Placement_Group_Slots_Var_Pop_Fields, Placement_Group_Slots_Var_Pop_Order_By, Placement_Group_Slots_Var_Samp_Fields, Placement_Group_Slots_Var_Samp_Order_By, Placement_Group_Slots_Variance_Fields, Placement_Group_Slots_Variance_Order_By, Processor_Status, Processor_Status_Bool_Exp, Processor_Status_Order_By, Processor_Status_Select_Column, Processor_Status_Stream_Cursor_Input, Processor_Status_Stream_Cursor_Value_Input, Query_Root, Query_RootBlob_ActivitiesArgs, Query_RootBlob_Activities_AggregateArgs, Query_RootBlob_Activities_By_PkArgs, Query_RootBlobsArgs, Query_RootBlobs_AggregateArgs, Query_RootBlobs_By_PkArgs, Query_RootPlacement_Group_SlotsArgs, Query_RootPlacement_Group_Slots_AggregateArgs, Query_RootPlacement_Group_Slots_By_PkArgs, Query_RootProcessor_StatusArgs, Scalars, Sdk, SdkFunctionWrapper, String_Comparison_Exp, Subscription_Root, Subscription_RootBlob_ActivitiesArgs, Subscription_RootBlob_Activities_AggregateArgs, Subscription_RootBlob_Activities_By_PkArgs, Subscription_RootBlob_Activities_StreamArgs, Subscription_RootBlobsArgs, Subscription_RootBlobs_AggregateArgs, Subscription_RootBlobs_By_PkArgs, Subscription_RootBlobs_StreamArgs, Subscription_RootPlacement_Group_SlotsArgs, Subscription_RootPlacement_Group_Slots_AggregateArgs, Subscription_RootPlacement_Group_Slots_By_PkArgs, Subscription_RootPlacement_Group_Slots_StreamArgs, Subscription_RootProcessor_StatusArgs, Subscription_RootProcessor_Status_StreamArgs, Timestamp_Comparison_Exp, getSdk } from '../core/operations/generated/sdk.js';
|
|
21
28
|
import '@aptos-labs/ts-sdk';
|
|
22
29
|
import 'zod';
|
|
23
30
|
import '@shelby-protocol/clay-codes';
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import "../chunk-
|
|
3
|
-
import "../chunk-MQUVYMNQ.mjs";
|
|
4
|
-
import "../chunk-ZHXCVRZX.mjs";
|
|
5
|
-
import "../chunk-RNXGC54D.mjs";
|
|
1
|
+
import "../chunk-EM67QTMR.mjs";
|
|
2
|
+
import "../chunk-WTICJPDB.mjs";
|
|
6
3
|
import {
|
|
7
4
|
ShelbyClient
|
|
8
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-7PN65RDX.mjs";
|
|
9
6
|
import {
|
|
7
|
+
MissingTransactionSubmitterError,
|
|
10
8
|
ShelbyBlobClient
|
|
11
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-SRV4YWFH.mjs";
|
|
12
10
|
import "../chunk-XNEIWM4O.mjs";
|
|
13
11
|
import {
|
|
14
|
-
createDefaultErasureCodingProvider
|
|
15
|
-
|
|
12
|
+
createDefaultErasureCodingProvider,
|
|
13
|
+
defaultErasureCodingConfig,
|
|
14
|
+
erasureCodingConfig16Total10Data13Helper,
|
|
15
|
+
erasureCodingConfig4Total2Data3Helper
|
|
16
|
+
} from "../chunk-HPPMI7DC.mjs";
|
|
16
17
|
import {
|
|
17
18
|
ClayErasureCodingProvider
|
|
18
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-OGKZ575S.mjs";
|
|
19
20
|
import {
|
|
20
21
|
ReedSolomonErasureCodingProvider
|
|
21
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-NHWWORCH.mjs";
|
|
22
23
|
import "../chunk-Z7RFCADT.mjs";
|
|
24
|
+
import {
|
|
25
|
+
ShelbyMetadataClient
|
|
26
|
+
} from "../chunk-MV6FNYAU.mjs";
|
|
27
|
+
import {
|
|
28
|
+
ShelbyMicropaymentChannelClient
|
|
29
|
+
} from "../chunk-E5QCRTBU.mjs";
|
|
30
|
+
import "../chunk-QQ57OGQ2.mjs";
|
|
31
|
+
import "../chunk-ZHXCVRZX.mjs";
|
|
32
|
+
import "../chunk-AD2G3QYD.mjs";
|
|
33
|
+
import "../chunk-MQUVYMNQ.mjs";
|
|
34
|
+
import {
|
|
35
|
+
ShelbyPlacementGroupClient
|
|
36
|
+
} from "../chunk-W37FZSMA.mjs";
|
|
23
37
|
import {
|
|
24
38
|
ShelbyRPCClient
|
|
25
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-PJVWGMVI.mjs";
|
|
40
|
+
import {
|
|
41
|
+
SenderBuiltMicropayment,
|
|
42
|
+
StaleChannelStateError
|
|
43
|
+
} from "../chunk-4MG4XGY4.mjs";
|
|
26
44
|
import {
|
|
27
45
|
createShelbyIndexerClient,
|
|
28
46
|
getShelbyIndexerClient
|
|
29
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-CGYJLKBU.mjs";
|
|
30
48
|
import {
|
|
31
49
|
Blob_Activities_Select_Column,
|
|
32
50
|
Blobs_Select_Column,
|
|
@@ -35,28 +53,32 @@ import {
|
|
|
35
53
|
GetBlobActivitiesDocument,
|
|
36
54
|
GetBlobsCountDocument,
|
|
37
55
|
GetBlobsDocument,
|
|
56
|
+
GetPlacementGroupSlotsCountDocument,
|
|
57
|
+
GetPlacementGroupSlotsDocument,
|
|
58
|
+
GetProcessorStatusDocument,
|
|
38
59
|
Order_By,
|
|
39
60
|
Placement_Group_Slots_Select_Column,
|
|
40
61
|
Processor_Status_Select_Column,
|
|
41
62
|
getSdk
|
|
42
|
-
} from "../chunk-
|
|
43
|
-
import
|
|
44
|
-
BlobNameSchema,
|
|
45
|
-
ChunkKey,
|
|
46
|
-
allChunksForBlob,
|
|
47
|
-
roundSize
|
|
48
|
-
} from "../chunk-GY5DCVVL.mjs";
|
|
63
|
+
} from "../chunk-KJ24NKPH.mjs";
|
|
64
|
+
import "../chunk-AABBONAF.mjs";
|
|
49
65
|
import {
|
|
50
66
|
isShelbyNetwork,
|
|
51
67
|
shelbyNetworks
|
|
52
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-D6GQHO6G.mjs";
|
|
53
69
|
import "../chunk-I6NG5GNL.mjs";
|
|
70
|
+
import {
|
|
71
|
+
CompleteMultipartUploadResponseSchema,
|
|
72
|
+
RPCErrorResponseSchema,
|
|
73
|
+
StaleMicropaymentErrorResponseSchema,
|
|
74
|
+
StartMultipartUploadResponseSchema,
|
|
75
|
+
UploadPartResponseSchema
|
|
76
|
+
} from "../chunk-IE6LYVIA.mjs";
|
|
54
77
|
import {
|
|
55
78
|
getShelbyAccountBlobsExplorerUrl,
|
|
56
79
|
getShelbyAccountExplorerUrl,
|
|
57
80
|
getShelbyBlobExplorerUrl
|
|
58
81
|
} from "../chunk-BDSW5PHM.mjs";
|
|
59
|
-
import "../chunk-RBFWGDMY.mjs";
|
|
60
82
|
import {
|
|
61
83
|
getAptosAccountExplorerUrl,
|
|
62
84
|
getAptosTransactionExplorerUrl
|
|
@@ -66,11 +88,12 @@ import {
|
|
|
66
88
|
} from "../chunk-OTBLZL2S.mjs";
|
|
67
89
|
import {
|
|
68
90
|
BlobCommitmentsSchema,
|
|
91
|
+
COMMITMENT_SCHEMA_VERSION,
|
|
69
92
|
ChunksetCommitmentSchema,
|
|
70
93
|
expectedTotalChunksets,
|
|
71
94
|
generateCommitments,
|
|
72
95
|
generateMerkleRoot
|
|
73
|
-
} from "../chunk-
|
|
96
|
+
} from "../chunk-2WEX3K7C.mjs";
|
|
74
97
|
import {
|
|
75
98
|
buildRequestUrl,
|
|
76
99
|
concatHashes,
|
|
@@ -84,18 +107,21 @@ import {
|
|
|
84
107
|
DEFAULT_CHUNKSET_SIZE_BYTES,
|
|
85
108
|
DEFAULT_CHUNK_SIZE_BYTES,
|
|
86
109
|
ERASURE_CODE_AND_CHUNK_MAPPING
|
|
87
|
-
} from "../chunk-
|
|
110
|
+
} from "../chunk-JTXYKO3U.mjs";
|
|
88
111
|
import {
|
|
89
112
|
DEFAULT_ERASURE_D,
|
|
90
113
|
DEFAULT_ERASURE_K,
|
|
91
114
|
DEFAULT_ERASURE_M,
|
|
92
115
|
DEFAULT_ERASURE_N,
|
|
116
|
+
DEFAULT_SAMPLE_SIZE,
|
|
93
117
|
ERASURE_CODE_PARAMS,
|
|
94
118
|
ErasureCodingScheme
|
|
95
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-AUQDI5BS.mjs";
|
|
96
120
|
import {
|
|
97
121
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
98
122
|
DEFAULT_PROJECT_NAME,
|
|
123
|
+
MICROPAYMENTS_DEPLOYER,
|
|
124
|
+
NetworkToGasStationBaseUrl,
|
|
99
125
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
100
126
|
NetworkToShelbyRPCBaseUrl,
|
|
101
127
|
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
@@ -105,7 +131,18 @@ import {
|
|
|
105
131
|
SHELBY_DEPLOYER,
|
|
106
132
|
TOKEN_DEPLOYER,
|
|
107
133
|
TOKEN_OBJECT_ADDRESS
|
|
108
|
-
} from "../chunk-
|
|
134
|
+
} from "../chunk-4ZOFT75Q.mjs";
|
|
135
|
+
import {
|
|
136
|
+
ShelbyErrorCodes,
|
|
137
|
+
isAccessDeniedError,
|
|
138
|
+
isBlobAlreadyExistsError,
|
|
139
|
+
isBlobExpiredError,
|
|
140
|
+
isBlobNotFoundError
|
|
141
|
+
} from "../chunk-CQ6QPIZK.mjs";
|
|
142
|
+
import {
|
|
143
|
+
BlobNameSchema,
|
|
144
|
+
ChunkKey
|
|
145
|
+
} from "../chunk-Z4FZ7W6L.mjs";
|
|
109
146
|
import "../chunk-7P6ASYW6.mjs";
|
|
110
147
|
export {
|
|
111
148
|
BlobCommitmentsSchema,
|
|
@@ -113,10 +150,12 @@ export {
|
|
|
113
150
|
Blob_Activities_Select_Column,
|
|
114
151
|
Blobs_Select_Column,
|
|
115
152
|
CHUNK_SIZE_PARAMS,
|
|
153
|
+
COMMITMENT_SCHEMA_VERSION,
|
|
116
154
|
ChunkKey,
|
|
117
155
|
ChunkSizeScheme,
|
|
118
156
|
ChunksetCommitmentSchema,
|
|
119
157
|
ClayErasureCodingProvider,
|
|
158
|
+
CompleteMultipartUploadResponseSchema,
|
|
120
159
|
Cursor_Ordering,
|
|
121
160
|
DEFAULT_CHUNKSET_SIZE_BYTES,
|
|
122
161
|
DEFAULT_CHUNK_SIZE_BYTES,
|
|
@@ -126,6 +165,7 @@ export {
|
|
|
126
165
|
DEFAULT_ERASURE_N,
|
|
127
166
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
128
167
|
DEFAULT_PROJECT_NAME,
|
|
168
|
+
DEFAULT_SAMPLE_SIZE,
|
|
129
169
|
ERASURE_CODE_AND_CHUNK_MAPPING,
|
|
130
170
|
ERASURE_CODE_PARAMS,
|
|
131
171
|
ErasureCodingScheme,
|
|
@@ -133,28 +173,46 @@ export {
|
|
|
133
173
|
GetBlobActivitiesDocument,
|
|
134
174
|
GetBlobsCountDocument,
|
|
135
175
|
GetBlobsDocument,
|
|
176
|
+
GetPlacementGroupSlotsCountDocument,
|
|
177
|
+
GetPlacementGroupSlotsDocument,
|
|
178
|
+
GetProcessorStatusDocument,
|
|
179
|
+
MICROPAYMENTS_DEPLOYER,
|
|
180
|
+
MissingTransactionSubmitterError,
|
|
181
|
+
NetworkToGasStationBaseUrl,
|
|
136
182
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
137
183
|
NetworkToShelbyRPCBaseUrl,
|
|
138
184
|
Order_By,
|
|
139
185
|
Placement_Group_Slots_Select_Column,
|
|
140
186
|
Processor_Status_Select_Column,
|
|
187
|
+
RPCErrorResponseSchema,
|
|
141
188
|
ReedSolomonErasureCodingProvider,
|
|
142
189
|
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
143
190
|
SHELBYUSD_TOKEN_ADDRESS,
|
|
144
191
|
SHELBYUSD_TOKEN_MODULE,
|
|
145
192
|
SHELBYUSD_TOKEN_NAME,
|
|
146
193
|
SHELBY_DEPLOYER,
|
|
194
|
+
SenderBuiltMicropayment,
|
|
147
195
|
ShelbyBlobClient,
|
|
148
196
|
ShelbyClient,
|
|
197
|
+
ShelbyErrorCodes,
|
|
198
|
+
ShelbyMetadataClient,
|
|
199
|
+
ShelbyMicropaymentChannelClient,
|
|
200
|
+
ShelbyPlacementGroupClient,
|
|
149
201
|
ShelbyRPCClient,
|
|
202
|
+
StaleChannelStateError,
|
|
203
|
+
StaleMicropaymentErrorResponseSchema,
|
|
204
|
+
StartMultipartUploadResponseSchema,
|
|
150
205
|
TOKEN_DEPLOYER,
|
|
151
206
|
TOKEN_OBJECT_ADDRESS,
|
|
152
|
-
|
|
207
|
+
UploadPartResponseSchema,
|
|
153
208
|
buildRequestUrl,
|
|
154
209
|
concatHashes,
|
|
155
210
|
createBlobKey,
|
|
156
211
|
createDefaultErasureCodingProvider,
|
|
157
212
|
createShelbyIndexerClient,
|
|
213
|
+
defaultErasureCodingConfig,
|
|
214
|
+
erasureCodingConfig16Total10Data13Helper,
|
|
215
|
+
erasureCodingConfig4Total2Data3Helper,
|
|
158
216
|
expectedTotalChunksets,
|
|
159
217
|
generateCommitments,
|
|
160
218
|
generateMerkleRoot,
|
|
@@ -166,9 +224,12 @@ export {
|
|
|
166
224
|
getShelbyAccountExplorerUrl,
|
|
167
225
|
getShelbyBlobExplorerUrl,
|
|
168
226
|
getShelbyIndexerClient,
|
|
227
|
+
isAccessDeniedError,
|
|
228
|
+
isBlobAlreadyExistsError,
|
|
229
|
+
isBlobExpiredError,
|
|
230
|
+
isBlobNotFoundError,
|
|
169
231
|
isShelbyNetwork,
|
|
170
232
|
readInChunks,
|
|
171
|
-
roundSize,
|
|
172
233
|
shelbyNetworks,
|
|
173
234
|
zeroPadBytes
|
|
174
235
|
};
|
|
@@ -5,15 +5,16 @@ 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";
|
|
16
16
|
import { z } from "zod";
|
|
17
|
+
var COMMITMENT_SCHEMA_VERSION = "1.3";
|
|
17
18
|
var ChunksetCommitmentSchema = z.object({
|
|
18
19
|
// Chunkset root (vector commitment of child chunks)
|
|
19
20
|
chunkset_root: z.string(),
|
|
@@ -110,7 +111,7 @@ async function generateChunksetCommitments(shouldPad, chunksetIdx, chunksetData,
|
|
|
110
111
|
return { h: a, entry };
|
|
111
112
|
}
|
|
112
113
|
async function generateCommitments(provider, fullData, onChunk, options) {
|
|
113
|
-
const expectedChunksetSize =
|
|
114
|
+
const expectedChunksetSize = provider.config.chunkSizeBytes * provider.config.erasure_k;
|
|
114
115
|
const shouldPad = options?.pad ?? true;
|
|
115
116
|
const chunksetCommitments = [];
|
|
116
117
|
const chunksetCommitmentHashes = [];
|
|
@@ -143,7 +144,7 @@ async function generateCommitments(provider, fullData, onChunk, options) {
|
|
|
143
144
|
chunksetCommitmentHashes.push(h);
|
|
144
145
|
}
|
|
145
146
|
return {
|
|
146
|
-
schema_version:
|
|
147
|
+
schema_version: COMMITMENT_SCHEMA_VERSION,
|
|
147
148
|
raw_data_size: rawDataSize,
|
|
148
149
|
blob_merkle_root: (await generateMerkleRoot(chunksetCommitmentHashes)).toString(),
|
|
149
150
|
chunkset_commitments: chunksetCommitments
|
|
@@ -159,6 +160,7 @@ function validatePrePaddedChunkset(chunkset, expectedSize, chunksetIdx) {
|
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
export {
|
|
163
|
+
COMMITMENT_SCHEMA_VERSION,
|
|
162
164
|
ChunksetCommitmentSchema,
|
|
163
165
|
expectedTotalChunksets,
|
|
164
166
|
BlobCommitmentsSchema,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/core/types/payments.ts
|
|
2
|
+
import {
|
|
3
|
+
AccountAuthenticator,
|
|
4
|
+
Deserializer,
|
|
5
|
+
Hex,
|
|
6
|
+
MultiAgentTransaction,
|
|
7
|
+
Serializer
|
|
8
|
+
} from "@aptos-labs/ts-sdk";
|
|
9
|
+
var StaleChannelStateError = class _StaleChannelStateError extends Error {
|
|
10
|
+
/**
|
|
11
|
+
* The last valid micropayment stored by the server.
|
|
12
|
+
* Clients can use this to reset their local channel state.
|
|
13
|
+
*/
|
|
14
|
+
storedMicropayment;
|
|
15
|
+
constructor(storedMicropayment, message) {
|
|
16
|
+
super(
|
|
17
|
+
message ?? "Client has stale channel state. Use the returned micropayment to reset local state."
|
|
18
|
+
);
|
|
19
|
+
this.name = "StaleChannelStateError";
|
|
20
|
+
this.storedMicropayment = storedMicropayment;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the stored micropayment as a base64-encoded string.
|
|
24
|
+
*/
|
|
25
|
+
toBase64() {
|
|
26
|
+
const bytes = this.storedMicropayment.bcsToBytes();
|
|
27
|
+
const binaryString = Array.from(
|
|
28
|
+
bytes,
|
|
29
|
+
(byte) => String.fromCharCode(byte)
|
|
30
|
+
).join("");
|
|
31
|
+
return btoa(binaryString);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a StaleChannelStateError from a base64-encoded micropayment string.
|
|
35
|
+
*/
|
|
36
|
+
static fromBase64(base64, message) {
|
|
37
|
+
const binaryString = atob(base64);
|
|
38
|
+
const bytes = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));
|
|
39
|
+
const micropayment = SenderBuiltMicropayment.deserialize(bytes);
|
|
40
|
+
return new _StaleChannelStateError(micropayment, message);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var SenderBuiltMicropayment = class _SenderBuiltMicropayment {
|
|
44
|
+
/**
|
|
45
|
+
* The actual micropayment transaction. It is built with the receiver address as fee payer and also requires a signature from the receiver to submit.
|
|
46
|
+
*/
|
|
47
|
+
micropayment;
|
|
48
|
+
/**
|
|
49
|
+
* The sender's signature.
|
|
50
|
+
*/
|
|
51
|
+
senderSignature;
|
|
52
|
+
constructor(micropayment, senderSignature) {
|
|
53
|
+
this.micropayment = micropayment;
|
|
54
|
+
this.senderSignature = senderSignature;
|
|
55
|
+
}
|
|
56
|
+
serialize(serializer) {
|
|
57
|
+
this.micropayment.serialize(serializer);
|
|
58
|
+
this.senderSignature.serialize(serializer);
|
|
59
|
+
}
|
|
60
|
+
bcsToBytes() {
|
|
61
|
+
const serializer = new Serializer();
|
|
62
|
+
this.serialize(serializer);
|
|
63
|
+
return serializer.toUint8Array();
|
|
64
|
+
}
|
|
65
|
+
bcsToHex() {
|
|
66
|
+
return Hex.fromHexInput(this.bcsToBytes());
|
|
67
|
+
}
|
|
68
|
+
toStringWithoutPrefix() {
|
|
69
|
+
return this.bcsToHex().toStringWithoutPrefix();
|
|
70
|
+
}
|
|
71
|
+
toString() {
|
|
72
|
+
return this.bcsToHex().toString();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Deserializes a SenderBuiltMicropayment from BCS bytes.
|
|
76
|
+
* @param bytes - The bytes to deserialize from (Uint8Array or hex string).
|
|
77
|
+
* @returns A new SenderBuiltMicropayment instance.
|
|
78
|
+
*/
|
|
79
|
+
static deserialize(bytes) {
|
|
80
|
+
const bytesArray = typeof bytes === "string" ? Hex.fromHexInput(bytes).toUint8Array() : bytes;
|
|
81
|
+
const deserializer = new Deserializer(bytesArray);
|
|
82
|
+
const micropayment = MultiAgentTransaction.deserialize(deserializer);
|
|
83
|
+
const senderSignature = AccountAuthenticator.deserialize(deserializer);
|
|
84
|
+
return new _SenderBuiltMicropayment(micropayment, senderSignature);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
StaleChannelStateError,
|
|
90
|
+
SenderBuiltMicropayment
|
|
91
|
+
};
|
|
@@ -4,21 +4,33 @@ var DEFAULT_PROJECT_NAME = "shelby";
|
|
|
4
4
|
var DEFAULT_PROJECT_DESCRIPTION = "High performance, decentralized storage";
|
|
5
5
|
var NetworkToShelbyRPCBaseUrl = {
|
|
6
6
|
[Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/shelby",
|
|
7
|
+
[Network.NETNA]: void 0,
|
|
7
8
|
[Network.DEVNET]: void 0,
|
|
8
|
-
[Network.TESTNET]:
|
|
9
|
+
[Network.TESTNET]: "https://api.testnet.shelby.xyz/shelby",
|
|
9
10
|
[Network.MAINNET]: void 0,
|
|
10
11
|
[Network.LOCAL]: void 0,
|
|
11
12
|
[Network.CUSTOM]: void 0
|
|
12
13
|
};
|
|
13
14
|
var NetworkToShelbyBlobIndexerBaseUrl = {
|
|
14
15
|
[Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/cmforrguw0042s601fn71f9l2/v1/graphql",
|
|
16
|
+
[Network.NETNA]: void 0,
|
|
15
17
|
[Network.DEVNET]: void 0,
|
|
16
|
-
[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",
|
|
17
28
|
[Network.MAINNET]: void 0,
|
|
18
29
|
[Network.LOCAL]: void 0,
|
|
19
30
|
[Network.CUSTOM]: void 0
|
|
20
31
|
};
|
|
21
32
|
var SHELBY_DEPLOYER = "0xc63d6a5efb0080a6029403131715bd4971e1149f7cc099aac69bb0069b3ddbf5";
|
|
33
|
+
var MICROPAYMENTS_DEPLOYER = "0xb42ac038b6dae86f6171e28e297aab9555ce09909445ec579e4ffe6b8d4d63bf";
|
|
22
34
|
var TOKEN_DEPLOYER = "0x33009e852be7f93762dd0bf303383c2cb2c5cab7a30d8238ca5f9f177ae75124";
|
|
23
35
|
var TOKEN_OBJECT_ADDRESS = "0x249f5c642a63885ff88a5113b3ba0079840af5a1357706f8c7f3bfc5dd12511f";
|
|
24
36
|
var SHELBYUSD_TOKEN_ADDRESS = TOKEN_OBJECT_ADDRESS;
|
|
@@ -31,7 +43,9 @@ export {
|
|
|
31
43
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
32
44
|
NetworkToShelbyRPCBaseUrl,
|
|
33
45
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
46
|
+
NetworkToGasStationBaseUrl,
|
|
34
47
|
SHELBY_DEPLOYER,
|
|
48
|
+
MICROPAYMENTS_DEPLOYER,
|
|
35
49
|
TOKEN_DEPLOYER,
|
|
36
50
|
TOKEN_OBJECT_ADDRESS,
|
|
37
51
|
SHELBYUSD_TOKEN_ADDRESS,
|
|
@@ -1,30 +1,37 @@
|
|
|
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
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-AABBONAF.mjs";
|
|
13
19
|
import {
|
|
14
20
|
createBlobKey
|
|
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
|
}
|
|
@@ -109,6 +123,11 @@ var ShelbyClient = class {
|
|
|
109
123
|
* This method handles the complete upload flow including commitment generation,
|
|
110
124
|
* blockchain registration, and storage upload.
|
|
111
125
|
*
|
|
126
|
+
* Note: This method accepts only `Uint8Array` and buffers the entire blob in memory.
|
|
127
|
+
* For streaming uploads of large files (e.g. >2 GiB), orchestrate the steps manually
|
|
128
|
+
* using `generateCommitments()`, `coordination.registerBlob()`, and `rpc.putBlob()`
|
|
129
|
+
* with a `ReadableStream`.
|
|
130
|
+
*
|
|
112
131
|
* @param params.blobData - The raw data to upload as a Uint8Array.
|
|
113
132
|
* @param params.signer - The account that signs and pays for the transaction.
|
|
114
133
|
* @param params.blobName - The name/path of the blob (e.g. "folder/file.txt").
|
|
@@ -146,6 +165,7 @@ var ShelbyClient = class {
|
|
|
146
165
|
blobMerkleRoot: blobCommitments.blob_merkle_root,
|
|
147
166
|
size: params.blobData.length,
|
|
148
167
|
expirationMicros: params.expirationMicros,
|
|
168
|
+
config: provider.config,
|
|
149
169
|
options: params.options
|
|
150
170
|
});
|
|
151
171
|
await this.coordination.aptos.waitForTransaction({
|
|
@@ -163,6 +183,11 @@ var ShelbyClient = class {
|
|
|
163
183
|
* This method handles the complete upload flow including commitment generation,
|
|
164
184
|
* blockchain registration, and storage upload.
|
|
165
185
|
*
|
|
186
|
+
* Note: This method accepts only `Uint8Array` and buffers each blob in memory.
|
|
187
|
+
* For streaming uploads of large files, orchestrate the steps manually using
|
|
188
|
+
* `generateCommitments()`, `coordination.registerBlob()`, and `rpc.putBlob()`
|
|
189
|
+
* with a `ReadableStream`.
|
|
190
|
+
*
|
|
166
191
|
* @param params.blobs - The blobs to upload.
|
|
167
192
|
* @param params.blobs.blobData - The raw data to upload as a Uint8Array.
|
|
168
193
|
* @param params.blobs.blobName - The name/path of the blob (e.g. "folder/file.txt").
|
|
@@ -221,6 +246,7 @@ var ShelbyClient = class {
|
|
|
221
246
|
blobSize: blob.blobData.length,
|
|
222
247
|
blobMerkleRoot: blobCommitments[index].blob_merkle_root
|
|
223
248
|
})),
|
|
249
|
+
config: provider.config,
|
|
224
250
|
options: params.options
|
|
225
251
|
});
|
|
226
252
|
await this.coordination.aptos.waitForTransaction({
|
|
@@ -278,9 +304,15 @@ var ShelbyClient = class {
|
|
|
278
304
|
* ```
|
|
279
305
|
*/
|
|
280
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
|
+
}
|
|
281
312
|
const { address, amount } = params;
|
|
282
313
|
try {
|
|
283
|
-
const faucet = this.config.faucet ?? "https://faucet.shelbynet.shelby.xyz/fund?asset=shelbyusd";
|
|
314
|
+
const faucet = this.config.faucet?.baseUrl ?? "https://faucet.shelbynet.shelby.xyz/fund?asset=shelbyusd";
|
|
315
|
+
const authToken = this.config.faucet?.authToken;
|
|
284
316
|
const response = await fetch(`${faucet}`, {
|
|
285
317
|
method: "POST",
|
|
286
318
|
body: JSON.stringify({
|
|
@@ -288,11 +320,13 @@ var ShelbyClient = class {
|
|
|
288
320
|
amount
|
|
289
321
|
}),
|
|
290
322
|
headers: {
|
|
291
|
-
"Content-Type": "application/json"
|
|
323
|
+
"Content-Type": "application/json",
|
|
324
|
+
...authToken ? { Authorization: `Bearer ${authToken}` } : {}
|
|
292
325
|
}
|
|
293
326
|
});
|
|
294
327
|
if (!response.ok) {
|
|
295
|
-
|
|
328
|
+
const errorBody = await response.text();
|
|
329
|
+
throw new Error(`Failed to fund account: ${errorBody}`);
|
|
296
330
|
}
|
|
297
331
|
const json = await response.json();
|
|
298
332
|
const res = await this.aptos.waitForTransaction({
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/core/clients/utils.ts
|
|
2
|
+
import { AptosConfig } from "@aptos-labs/ts-sdk";
|
|
3
|
+
var getAptosConfig = (config) => {
|
|
4
|
+
const baseFaucetConfig = config.faucet?.authToken ? { AUTH_TOKEN: config.faucet.authToken } : void 0;
|
|
5
|
+
if (config.aptos) {
|
|
6
|
+
return new AptosConfig({
|
|
7
|
+
// Spread user's aptos config first
|
|
8
|
+
...config.aptos,
|
|
9
|
+
// Network from top-level is authoritative - cannot be overridden
|
|
10
|
+
network: config.network,
|
|
11
|
+
// Merge clientConfig with API_KEY default
|
|
12
|
+
clientConfig: {
|
|
13
|
+
API_KEY: config.apiKey,
|
|
14
|
+
...config.aptos.clientConfig
|
|
15
|
+
},
|
|
16
|
+
// Merge faucetConfig: aptos config first, then base authToken (authoritative)
|
|
17
|
+
faucetConfig: {
|
|
18
|
+
...config.aptos.faucetConfig,
|
|
19
|
+
...baseFaucetConfig
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return new AptosConfig({
|
|
24
|
+
network: config.network,
|
|
25
|
+
clientConfig: {
|
|
26
|
+
API_KEY: config.apiKey
|
|
27
|
+
},
|
|
28
|
+
faucetConfig: baseFaucetConfig
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
getAptosConfig
|
|
34
|
+
};
|