@shelby-protocol/sdk 0.2.4 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/browser/index.d.ts +13 -4
  2. package/dist/browser/index.mjs +3719 -140
  3. package/dist/{clay-codes-DHP-bYcP.d.ts → clay-codes-DdXABBDx.d.ts} +0 -7
  4. package/dist/core/aptos-explorer.mjs +46 -5
  5. package/dist/core/blobs.d.ts +1 -1
  6. package/dist/core/blobs.mjs +12 -4
  7. package/dist/core/chunk.mjs +58 -9
  8. package/dist/core/clients/ShelbyBlobClient.d.ts +9 -44
  9. package/dist/core/clients/ShelbyBlobClient.mjs +1084 -17
  10. package/dist/core/clients/ShelbyClient.d.ts +12 -2
  11. package/dist/core/clients/ShelbyClient.mjs +2915 -23
  12. package/dist/core/clients/ShelbyClientConfig.d.ts +8 -0
  13. package/dist/core/clients/ShelbyClientConfig.mjs +0 -1
  14. package/dist/core/clients/ShelbyMetadataClient.d.ts +0 -18
  15. package/dist/core/clients/ShelbyMetadataClient.mjs +306 -6
  16. package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +7 -49
  17. package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +839 -13
  18. package/dist/core/clients/ShelbyPlacementGroupClient.mjs +307 -8
  19. package/dist/core/clients/ShelbyRPCClient.d.ts +107 -4
  20. package/dist/core/clients/ShelbyRPCClient.mjs +1261 -12
  21. package/dist/core/clients/index.d.ts +3 -2
  22. package/dist/core/clients/index.mjs +3421 -40
  23. package/dist/core/clients/utils.mjs +65 -6
  24. package/dist/core/commitments.d.ts +3 -12
  25. package/dist/core/commitments.mjs +270 -11
  26. package/dist/core/constants.d.ts +4 -4
  27. package/dist/core/constants.mjs +39 -16
  28. package/dist/core/erasure/clay-codes.d.ts +1 -1
  29. package/dist/core/erasure/clay-codes.mjs +129 -4
  30. package/dist/core/erasure/constants.mjs +33 -10
  31. package/dist/core/erasure/default.d.ts +1 -1
  32. package/dist/core/erasure/default.mjs +191 -9
  33. package/dist/core/erasure/index.d.ts +1 -1
  34. package/dist/core/erasure/index.mjs +266 -23
  35. package/dist/core/erasure/provider.d.ts +1 -1
  36. package/dist/core/erasure/reed-solomon.d.ts +1 -1
  37. package/dist/core/erasure/reed-solomon.mjs +68 -4
  38. package/dist/core/erasure/utils.d.ts +1 -1
  39. package/dist/core/erasure/utils.mjs +0 -2
  40. package/dist/core/errors.mjs +29 -8
  41. package/dist/core/index.d.ts +4 -4
  42. package/dist/core/index.mjs +3713 -140
  43. package/dist/core/layout.d.ts +1 -1
  44. package/dist/core/layout.mjs +37 -5
  45. package/dist/core/networks.mjs +10 -5
  46. package/dist/core/operations/generated/sdk.d.ts +9 -0
  47. package/dist/core/operations/generated/sdk.mjs +183 -18
  48. package/dist/core/operations/index.mjs +284 -24
  49. package/dist/core/promises.mjs +4 -4
  50. package/dist/core/rpc-responses.d.ts +38 -1
  51. package/dist/core/rpc-responses.mjs +31 -8
  52. package/dist/core/shelby-explorer.mjs +31 -6
  53. package/dist/core/strings.mjs +0 -2
  54. package/dist/core/types/blobs.d.ts +1 -1
  55. package/dist/core/types/blobs.mjs +0 -1
  56. package/dist/core/types/index.d.ts +1 -1
  57. package/dist/core/types/index.mjs +230 -9
  58. package/dist/core/types/payments.d.ts +6 -6
  59. package/dist/core/types/payments.mjs +230 -5
  60. package/dist/core/types/placement_groups.mjs +0 -1
  61. package/dist/core/types/storage_providers.mjs +0 -1
  62. package/dist/core/utils.mjs +94 -8
  63. package/dist/node/clients/ShelbyNodeClient.d.ts +2 -1
  64. package/dist/node/clients/ShelbyNodeClient.mjs +2919 -24
  65. package/dist/node/clients/index.d.ts +2 -1
  66. package/dist/node/clients/index.mjs +2920 -26
  67. package/dist/node/index.d.ts +4 -4
  68. package/dist/node/index.mjs +3736 -147
  69. package/dist/node/parallel/commitment_worker.d.ts +9 -0
  70. package/dist/node/parallel/commitment_worker.mjs +298 -0
  71. package/dist/node/parallel/commitment_worker_pool.d.ts +35 -0
  72. package/dist/node/parallel/commitment_worker_pool.mjs +286 -0
  73. package/dist/node/parallel/default_commitment_worker_pool.d.ts +24 -0
  74. package/dist/node/parallel/default_commitment_worker_pool.mjs +302 -0
  75. package/dist/node/parallel/index.d.ts +11 -0
  76. package/dist/node/parallel/index.mjs +563 -0
  77. package/dist/node/parallel/parallel_commitments.d.ts +32 -0
  78. package/dist/node/parallel/parallel_commitments.mjs +561 -0
  79. package/dist/node/parallel/worker_pool.d.ts +74 -0
  80. package/dist/node/parallel/worker_pool.mjs +248 -0
  81. package/dist/node/testUtil.mjs +8 -4
  82. package/package.json +9 -6
  83. package/dist/chunk-3NRBHSMQ.mjs +0 -12
  84. package/dist/chunk-3PCG7PNP.mjs +0 -375
  85. package/dist/chunk-7OV5ZYW6.mjs +0 -55
  86. package/dist/chunk-7P6ASYW6.mjs +0 -9
  87. package/dist/chunk-A4IG6GSE.mjs +0 -21
  88. package/dist/chunk-AD2G3QYD.mjs +0 -0
  89. package/dist/chunk-AEDVYYGD.mjs +0 -11
  90. package/dist/chunk-AUQDI5BS.mjs +0 -43
  91. package/dist/chunk-BDSW5PHM.mjs +0 -37
  92. package/dist/chunk-BKL7NCUB.mjs +0 -412
  93. package/dist/chunk-BUWAD67L.mjs +0 -505
  94. package/dist/chunk-BXEVML7N.mjs +0 -169
  95. package/dist/chunk-C6RQ3AEU.mjs +0 -51
  96. package/dist/chunk-CQ6QPIZK.mjs +0 -37
  97. package/dist/chunk-D6GQHO6G.mjs +0 -15
  98. package/dist/chunk-EM67QTMR.mjs +0 -0
  99. package/dist/chunk-I6NG5GNL.mjs +0 -8
  100. package/dist/chunk-IE6LYVIA.mjs +0 -26
  101. package/dist/chunk-IKRWBDG5.mjs +0 -42
  102. package/dist/chunk-JTXYKO3U.mjs +0 -38
  103. package/dist/chunk-KYQRWJ3U.mjs +0 -49
  104. package/dist/chunk-MB7C7VQF.mjs +0 -0
  105. package/dist/chunk-MQUVYMNQ.mjs +0 -0
  106. package/dist/chunk-NHWWORCH.mjs +0 -72
  107. package/dist/chunk-NI6XBZLI.mjs +0 -83
  108. package/dist/chunk-OGKZ575S.mjs +0 -136
  109. package/dist/chunk-QQ57OGQ2.mjs +0 -0
  110. package/dist/chunk-SSE4MFNN.mjs +0 -278
  111. package/dist/chunk-TET3DJEO.mjs +0 -199
  112. package/dist/chunk-TVLV7C74.mjs +0 -207
  113. package/dist/chunk-UEZNZBJO.mjs +0 -104
  114. package/dist/chunk-WJTVYLKW.mjs +0 -782
  115. package/dist/chunk-WTICJPDB.mjs +0 -0
  116. package/dist/chunk-XNEIWM4O.mjs +0 -0
  117. package/dist/chunk-XRLHLAOW.mjs +0 -51
  118. package/dist/chunk-Z4FZ7W6L.mjs +0 -39
  119. package/dist/chunk-Z7RFCADT.mjs +0 -0
  120. package/dist/chunk-ZHXCVRZX.mjs +0 -0
  121. package/dist/core/operations/generated/types.d.ts +0 -908
  122. package/dist/core/operations/generated/types.mjs +0 -63
  123. package/dist/core/types/encodings.d.ts +0 -11
  124. package/dist/core/types/encodings.mjs +0 -0
@@ -1,11 +1,310 @@
1
- import {
2
- ShelbyPlacementGroupClient
3
- } from "../../chunk-NI6XBZLI.mjs";
4
- import "../../chunk-KYQRWJ3U.mjs";
5
- import "../../chunk-TET3DJEO.mjs";
6
- import "../../chunk-IKRWBDG5.mjs";
7
- import "../../chunk-7OV5ZYW6.mjs";
8
- import "../../chunk-7P6ASYW6.mjs";
1
+ // src/core/operations/index.ts
2
+ import { Network as Network2 } from "@aptos-labs/ts-sdk";
3
+ import { GraphQLClient } from "graphql-request";
4
+
5
+ // src/core/clients/utils.ts
6
+ import { AptosConfig } from "@aptos-labs/ts-sdk";
7
+
8
+ // src/core/constants.ts
9
+ import { Network } from "@aptos-labs/ts-sdk";
10
+ var NetworkToShelbyRPCBaseUrl = {
11
+ [Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/shelby",
12
+ [Network.NETNA]: void 0,
13
+ [Network.DEVNET]: void 0,
14
+ [Network.TESTNET]: "https://api.testnet.shelby.xyz/shelby",
15
+ [Network.MAINNET]: void 0,
16
+ [Network.LOCAL]: "http://localhost:9090",
17
+ [Network.CUSTOM]: void 0
18
+ };
19
+ var NetworkToShelbyBlobIndexerBaseUrl = {
20
+ [Network.SHELBYNET]: "https://api.shelbynet.aptoslabs.com/nocode/v1/public/alias/shelby/shelbynet/v1/graphql",
21
+ [Network.NETNA]: void 0,
22
+ [Network.DEVNET]: void 0,
23
+ [Network.TESTNET]: "https://api.testnet.aptoslabs.com/nocode/v1/public/alias/shelby/testnet/v1/graphql",
24
+ [Network.MAINNET]: void 0,
25
+ [Network.LOCAL]: "http://localhost:8091/v1/graphql",
26
+ [Network.CUSTOM]: void 0
27
+ };
28
+ var NetworkToGasStationBaseUrl = {
29
+ [Network.SHELBYNET]: "https://api.shelbynet.shelby.xyz/gs/v1",
30
+ [Network.NETNA]: void 0,
31
+ [Network.DEVNET]: void 0,
32
+ [Network.TESTNET]: "https://api.testnet.shelby.xyz/gs/v1",
33
+ [Network.MAINNET]: void 0,
34
+ [Network.LOCAL]: void 0,
35
+ [Network.CUSTOM]: void 0
36
+ };
37
+
38
+ // src/core/clients/utils.ts
39
+ var getAptosConfig = (config) => {
40
+ const baseFaucetConfig = config.faucet?.authToken ? { AUTH_TOKEN: config.faucet.authToken } : void 0;
41
+ if (config.aptos) {
42
+ return new AptosConfig({
43
+ // Spread user's aptos config first
44
+ ...config.aptos,
45
+ // Network from top-level is authoritative - cannot be overridden
46
+ network: config.network,
47
+ // Merge clientConfig with API_KEY default
48
+ clientConfig: {
49
+ API_KEY: config.apiKey,
50
+ ...config.aptos.clientConfig
51
+ },
52
+ // Merge faucetConfig: aptos config first, then base authToken (authoritative)
53
+ faucetConfig: {
54
+ ...config.aptos.faucetConfig,
55
+ ...baseFaucetConfig
56
+ }
57
+ });
58
+ }
59
+ return new AptosConfig({
60
+ network: config.network,
61
+ clientConfig: {
62
+ API_KEY: config.apiKey
63
+ },
64
+ faucetConfig: baseFaucetConfig
65
+ });
66
+ };
67
+
68
+ // src/core/operations/generated/sdk.ts
69
+ import gql from "graphql-tag";
70
+ var GetBlobsDocument = gql`
71
+ query getBlobs($where: blobs_bool_exp, $orderBy: [blobs_order_by!], $limit: Int, $offset: Int) {
72
+ blobs(where: $where, order_by: $orderBy, limit: $limit, offset: $offset) {
73
+ owner
74
+ blob_commitment
75
+ blob_name
76
+ created_at
77
+ expires_at
78
+ num_chunksets
79
+ is_deleted
80
+ is_written
81
+ placement_group
82
+ size
83
+ updated_at
84
+ slice_address
85
+ }
86
+ }
87
+ `;
88
+ var GetBlobActivitiesDocument = gql`
89
+ query getBlobActivities($where: blob_activities_bool_exp, $orderBy: [blob_activities_order_by!], $limit: Int, $offset: Int) {
90
+ blob_activities(
91
+ where: $where
92
+ order_by: $orderBy
93
+ limit: $limit
94
+ offset: $offset
95
+ ) {
96
+ blob_name
97
+ event_index
98
+ event_type
99
+ transaction_hash
100
+ transaction_version
101
+ timestamp
102
+ owner
103
+ }
104
+ }
105
+ `;
106
+ var GetBlobsCountDocument = gql`
107
+ query getBlobsCount($where: blobs_bool_exp) {
108
+ blobs_aggregate(where: $where) {
109
+ aggregate {
110
+ count
111
+ }
112
+ }
113
+ }
114
+ `;
115
+ var GetBlobActivitiesCountDocument = gql`
116
+ query getBlobActivitiesCount($where: blob_activities_bool_exp) {
117
+ blob_activities_aggregate(where: $where) {
118
+ aggregate {
119
+ count
120
+ }
121
+ }
122
+ }
123
+ `;
124
+ var GetTotalBlobsSizeDocument = gql`
125
+ query getTotalBlobsSize($where: blobs_bool_exp) {
126
+ blobs_aggregate(where: $where) {
127
+ aggregate {
128
+ sum {
129
+ size
130
+ }
131
+ }
132
+ }
133
+ }
134
+ `;
135
+ var GetPlacementGroupSlotsDocument = gql`
136
+ query getPlacementGroupSlots($where: placement_group_slots_bool_exp, $orderBy: [placement_group_slots_order_by!], $limit: Int, $offset: Int) {
137
+ placement_group_slots(
138
+ where: $where
139
+ order_by: $orderBy
140
+ limit: $limit
141
+ offset: $offset
142
+ ) {
143
+ placement_group
144
+ slot_index
145
+ storage_provider
146
+ status
147
+ updated_at
148
+ }
149
+ }
150
+ `;
151
+ var GetPlacementGroupSlotsCountDocument = gql`
152
+ query getPlacementGroupSlotsCount($where: placement_group_slots_bool_exp) {
153
+ placement_group_slots_aggregate(where: $where) {
154
+ aggregate {
155
+ count
156
+ }
157
+ }
158
+ }
159
+ `;
160
+ var GetProcessorStatusDocument = gql`
161
+ query getProcessorStatus {
162
+ processor_status {
163
+ last_success_version
164
+ last_transaction_timestamp
165
+ last_updated
166
+ }
167
+ }
168
+ `;
169
+ var defaultWrapper = (action, _operationName, _operationType, _variables) => action();
170
+ function getSdk(client, withWrapper = defaultWrapper) {
171
+ return {
172
+ getBlobs(variables, requestHeaders, signal) {
173
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobsDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobs", "query", variables);
174
+ },
175
+ getBlobActivities(variables, requestHeaders, signal) {
176
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobActivitiesDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobActivities", "query", variables);
177
+ },
178
+ getBlobsCount(variables, requestHeaders, signal) {
179
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobsCountDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobsCount", "query", variables);
180
+ },
181
+ getBlobActivitiesCount(variables, requestHeaders, signal) {
182
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobActivitiesCountDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobActivitiesCount", "query", variables);
183
+ },
184
+ getTotalBlobsSize(variables, requestHeaders, signal) {
185
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetTotalBlobsSizeDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getTotalBlobsSize", "query", variables);
186
+ },
187
+ getPlacementGroupSlots(variables, requestHeaders, signal) {
188
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetPlacementGroupSlotsDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getPlacementGroupSlots", "query", variables);
189
+ },
190
+ getPlacementGroupSlotsCount(variables, requestHeaders, signal) {
191
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetPlacementGroupSlotsCountDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getPlacementGroupSlotsCount", "query", variables);
192
+ },
193
+ getProcessorStatus(variables, requestHeaders, signal) {
194
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: GetProcessorStatusDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getProcessorStatus", "query", variables);
195
+ }
196
+ };
197
+ }
198
+
199
+ // src/core/operations/index.ts
200
+ function createShelbyIndexerClient(baseUrl, options) {
201
+ const graphqlClient = new GraphQLClient(baseUrl, options);
202
+ return getSdk(graphqlClient);
203
+ }
204
+ function getShelbyIndexerClient(config) {
205
+ const aptosConfig = getAptosConfig(config);
206
+ let { apiKey: indexerApiKey, baseUrl } = config.indexer ?? {};
207
+ if (!baseUrl) {
208
+ switch (aptosConfig?.network) {
209
+ // TODO: Add endpoints for core networks
210
+ case Network2.MAINNET:
211
+ case Network2.TESTNET:
212
+ case Network2.DEVNET:
213
+ case Network2.SHELBYNET:
214
+ case Network2.LOCAL:
215
+ baseUrl = NetworkToShelbyBlobIndexerBaseUrl[aptosConfig.network];
216
+ break;
217
+ }
218
+ }
219
+ if (baseUrl === void 0) {
220
+ throw new Error(
221
+ "The ShelbyClientConfig does not support the Shelby indexer. Please configure the endpoint in the ShelbyClientConfig.indexer.endpoint or provide a supported Aptos network."
222
+ );
223
+ }
224
+ const apiKey = indexerApiKey ?? config.apiKey;
225
+ return createShelbyIndexerClient(baseUrl, {
226
+ headers: {
227
+ ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {},
228
+ "x-aptos-client": "shelby-ts-sdk"
229
+ }
230
+ });
231
+ }
232
+
233
+ // src/core/clients/ShelbyPlacementGroupClient.ts
234
+ var ShelbyPlacementGroupClient = class {
235
+ indexer;
236
+ /**
237
+ * Creates a new ShelbyPlacementGroupClient.
238
+ *
239
+ * @param config - The client configuration object.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * const pgClient = new ShelbyPlacementGroupClient({
244
+ * network: Network.SHELBYNET,
245
+ * });
246
+ * ```
247
+ */
248
+ constructor(config) {
249
+ this.indexer = getShelbyIndexerClient(config);
250
+ }
251
+ /**
252
+ * Retrieves placement group slots from the indexer.
253
+ *
254
+ * @param params.where (optional) - The where clause to filter slots by.
255
+ * @param params.pagination (optional) - The pagination options.
256
+ * @param params.orderBy (optional) - The order by clause to sort slots by.
257
+ * @returns The placement group slots that match the filter.
258
+ *
259
+ * @example
260
+ * ```typescript
261
+ * // Get all active slots
262
+ * const slots = await client.getPlacementGroupSlots({
263
+ * where: { status: { _eq: "active" } },
264
+ * });
265
+ * ```
266
+ */
267
+ async getPlacementGroupSlots(params) {
268
+ const { limit, offset } = params.pagination ?? {};
269
+ const { orderBy, where } = params;
270
+ const { placement_group_slots } = await this.indexer.getPlacementGroupSlots(
271
+ {
272
+ where,
273
+ limit,
274
+ offset,
275
+ orderBy
276
+ }
277
+ );
278
+ return placement_group_slots.map(
279
+ (slot) => ({
280
+ placementGroup: slot.placement_group,
281
+ slotIndex: Number(slot.slot_index),
282
+ storageProvider: slot.storage_provider,
283
+ status: slot.status,
284
+ updatedAt: Number(slot.updated_at)
285
+ })
286
+ );
287
+ }
288
+ /**
289
+ * Retrieves the total count of placement group slots from the indexer.
290
+ *
291
+ * @param params.where (optional) - The where clause to filter slots by.
292
+ * @returns The count of placement group slots that match the filter.
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * // Get count of active slots
297
+ * const count = await client.getPlacementGroupSlotsCount({
298
+ * where: { status: { _eq: "active" } },
299
+ * });
300
+ * ```
301
+ */
302
+ async getPlacementGroupSlotsCount(params) {
303
+ const { where } = params;
304
+ const { placement_group_slots_aggregate } = await this.indexer.getPlacementGroupSlotsCount({ where });
305
+ return placement_group_slots_aggregate?.aggregate?.count ?? 0;
306
+ }
307
+ };
9
308
  export {
10
309
  ShelbyPlacementGroupClient
11
310
  };
@@ -1,17 +1,48 @@
1
- import { AccountAddressInput } from '@aptos-labs/ts-sdk';
1
+ import { Account, AccountAddressInput } from '@aptos-labs/ts-sdk';
2
2
  import { ShelbyBlob } from '../blobs.js';
3
3
  import { BlobName } from '../layout.js';
4
4
  import { ShelbyIndexerClient } from '../operations/index.js';
5
+ import { ChallengeResponse, MultipartUploadStatusResponse } from '../rpc-responses.js';
5
6
  import { SenderBuiltMicropayment } from '../types/payments.js';
6
7
  import { ShelbyRPCConfig, ShelbyClientConfig } from './ShelbyClientConfig.js';
7
8
  import 'zod';
8
- import '../../clay-codes-DHP-bYcP.js';
9
+ import '../../clay-codes-DdXABBDx.js';
9
10
  import '@shelby-protocol/clay-codes';
10
11
  import 'graphql-request';
11
12
  import '../operations/generated/sdk.js';
12
13
  import 'graphql';
13
14
  import '../networks.js';
14
15
 
16
+ /**
17
+ * Auth scheme identifier sent in X-Shelby-Auth-Scheme.
18
+ * - "ed25519": standard Ed25519 account (default when header is absent)
19
+ * - "derivable": Derived Abstracted Account (Solana, Ethereum, etc.)
20
+ */
21
+ type AuthScheme = "ed25519" | "derivable";
22
+ interface BlobOwnerAuthBase {
23
+ challenge: string;
24
+ signature: Uint8Array;
25
+ publicKey: Uint8Array;
26
+ }
27
+ interface Ed25519BlobOwnerAuth extends BlobOwnerAuthBase {
28
+ authScheme?: "ed25519";
29
+ }
30
+ interface DerivableBlobOwnerAuth extends BlobOwnerAuthBase {
31
+ authScheme: "derivable";
32
+ /** External identity (e.g. Solana base58 pubkey). */
33
+ identity: string;
34
+ /** dApp domain used during key derivation. */
35
+ domain: string;
36
+ /** On-chain authentication function (e.g. "0x1::solana_derivable_account::authenticate"). */
37
+ authFunction: string;
38
+ }
39
+ /**
40
+ * Authentication credentials for blob owner operations.
41
+ *
42
+ * Ed25519 (default): only the base fields are needed.
43
+ * Derivable: requires identity, domain, and authFunction.
44
+ */
45
+ type BlobOwnerAuth = Ed25519BlobOwnerAuth | DerivableBlobOwnerAuth;
15
46
  type BlobDataSource = Uint8Array | ReadableStream<Uint8Array>;
16
47
  type PutBlobProgress = {
17
48
  phase: "uploading" | "finalizing";
@@ -33,6 +64,9 @@ declare class ShelbyRPCClient {
33
64
  *
34
65
  * @param config - The client configuration object.
35
66
  * @param config.network - The Shelby network to use.
67
+ * @param options.signChallengeHandler - Optional override for challenge
68
+ * signing. When set, `putBlobResumable` uses this instead of the built-in
69
+ * `signChallenge`. Intended for kit-level overrides (e.g. Solana DAA).
36
70
  *
37
71
  * @example
38
72
  * ```typescript
@@ -42,7 +76,48 @@ declare class ShelbyRPCClient {
42
76
  * });
43
77
  * ```
44
78
  */
45
- constructor(config: ShelbyClientConfig);
79
+ constructor(config: ShelbyClientConfig, options?: {
80
+ signChallengeHandler?: (account: Account, challenge: string) => BlobOwnerAuth;
81
+ });
82
+ /**
83
+ * Request an authentication challenge for the given account.
84
+ * The challenge must be signed and included in subsequent authenticated requests.
85
+ *
86
+ * @param account - The Aptos account address to authenticate as.
87
+ * @returns The challenge string and expiration timestamp.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const { challenge, expiresAt } = await client.getChallenge(account.accountAddress);
92
+ * const auth = client.signChallenge(account, challenge);
93
+ * ```
94
+ */
95
+ getChallenge(account: AccountAddressInput): Promise<ChallengeResponse>;
96
+ /**
97
+ * Check if there's an existing multipart upload for a blob.
98
+ * Returns the upload status including which parts have been uploaded.
99
+ *
100
+ * @param account - The account that owns the blob.
101
+ * @param blobName - The name of the blob.
102
+ * @returns The upload status, or undefined if no pending upload exists.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const status = await client.getMultipartUploadStatus(account, "myblob.txt");
107
+ * if (status) {
108
+ * console.log(`Resuming upload ${status.uploadId}, ${status.completedParts.length} parts done`);
109
+ * }
110
+ * ```
111
+ */
112
+ getMultipartUploadStatus(account: AccountAddressInput, blobName: string): Promise<MultipartUploadStatusResponse | undefined>;
113
+ /**
114
+ * Sign a challenge using the given account and return auth credentials.
115
+ *
116
+ * @param account - The Aptos account to sign with.
117
+ * @param challenge - The hex-encoded challenge string from getChallenge().
118
+ * @returns BlobOwnerAuth credentials for authenticated requests.
119
+ */
120
+ signChallenge(account: Account, challenge: string): BlobOwnerAuth;
46
121
  /**
47
122
  * Uploads blob data to the Shelby RPC node for storage by storage providers.
48
123
  * This method should be called after blob commitments have been registered on the blockchain.
@@ -72,6 +147,34 @@ declare class ShelbyRPCClient {
72
147
  totalBytes?: number;
73
148
  onProgress?: (progress: PutBlobProgress) => void;
74
149
  }): Promise<void>;
150
+ /**
151
+ * Uploads blob data to the Shelby RPC node with authentication and resume support.
152
+ * This method authenticates using challenge-response and can resume interrupted uploads.
153
+ *
154
+ * @param params.account - The Aptos Account (with signing capability) that owns the blob.
155
+ * @param params.blobName - The name/path of the blob (e.g. "folder/file.txt").
156
+ * @param params.blobData - The raw blob data as a Uint8Array or ReadableStream.
157
+ * @param params.totalBytes - Total byte length. Required for streams; optional for Uint8Array.
158
+ * @param params.onProgress - Optional callback for upload progress.
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * await client.putBlobResumable({
163
+ * account: myAccount, // Aptos Account with signing capability
164
+ * blobName: "documents/report.pdf",
165
+ * blobData: fileData,
166
+ * totalBytes: fileData.length,
167
+ * });
168
+ * ```
169
+ */
170
+ putBlobResumable(params: {
171
+ account: Account;
172
+ blobName: BlobName;
173
+ blobData: BlobDataSource;
174
+ totalBytes?: number;
175
+ partSize?: number;
176
+ onProgress?: (progress: PutBlobProgress) => void;
177
+ }): Promise<void>;
75
178
  /**
76
179
  * Downloads a blob from the Shelby RPC node.
77
180
  * Returns a streaming response with validation to ensure data integrity.
@@ -122,4 +225,4 @@ declare class ShelbyRPCClient {
122
225
  }): Promise<ShelbyBlob>;
123
226
  }
124
227
 
125
- export { type BlobDataSource, type PutBlobProgress, ShelbyRPCClient };
228
+ export { type AuthScheme, type BlobDataSource, type BlobOwnerAuth, type DerivableBlobOwnerAuth, type Ed25519BlobOwnerAuth, type PutBlobProgress, ShelbyRPCClient };