@shelby-protocol/sdk 0.0.4 → 0.0.5
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 +4 -4
- package/dist/browser/index.mjs +40 -35
- package/dist/{chunk-MYN7KW2X.mjs → chunk-2DD6Q5CK.mjs} +1 -1
- package/dist/{chunk-KBUWZXFA.mjs → chunk-4JZO2D7T.mjs} +6 -1
- package/dist/{chunk-GKRHKR3J.mjs → chunk-L7H6EKII.mjs} +7 -7
- package/dist/{chunk-LTV26KU4.mjs → chunk-PCNLFNAT.mjs} +1 -1
- package/dist/{chunk-VPT45MTZ.mjs → chunk-T6TVHFJO.mjs} +1 -1
- package/dist/{chunk-4W3FFVXZ.mjs → chunk-TPGMXZRD.mjs} +8 -8
- package/dist/{chunk-DLMDDEWF.mjs → chunk-WJKSPJSS.mjs} +26 -0
- package/dist/{chunk-3QINXXV6.mjs → chunk-Y7KTNPPR.mjs} +61 -24
- package/dist/core/chunk.mjs +1 -1
- package/dist/core/clients/ShelbyBlobClient.d.ts +35 -17
- package/dist/core/clients/ShelbyBlobClient.mjs +7 -7
- package/dist/core/clients/ShelbyClient.mjs +10 -10
- package/dist/core/clients/ShelbyRPCClient.mjs +7 -7
- package/dist/core/clients/index.mjs +12 -12
- package/dist/core/commitments.mjs +3 -3
- package/dist/core/erasure/clay-codes.mjs +1 -1
- package/dist/core/erasure/default.mjs +1 -1
- package/dist/core/erasure/index.mjs +3 -3
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.mjs +40 -35
- package/dist/core/layout.mjs +1 -1
- package/dist/core/operations/generated/sdk.d.ts +307 -1
- package/dist/core/operations/generated/sdk.mjs +5 -1
- package/dist/core/operations/index.d.ts +6 -1
- package/dist/core/operations/index.mjs +5 -2
- package/dist/core/types/blobs.d.ts +9 -0
- package/dist/core/types/index.mjs +1 -1
- package/dist/core/utils.d.ts +8 -1
- package/dist/core/utils.mjs +3 -1
- package/dist/node/clients/ShelbyNodeClient.mjs +11 -11
- package/dist/node/clients/index.mjs +13 -13
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.mjs +46 -41
- package/package.json +3 -3
package/dist/browser/index.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ export { ShelbyIndexerClient, createShelbyIndexerClient, getShelbyIndexerClient
|
|
|
16
16
|
export { getShelbyAccountBlobsExplorerUrl, getShelbyAccountExplorerUrl, getShelbyBlobExplorerUrl } from '../core/shelby-explorer.js';
|
|
17
17
|
export { BlobActivity, BlobActivityType, BlobEncoding, BlobMetadata, ClayEncoding } from '../core/types/blobs.js';
|
|
18
18
|
export { StorageProviderInfo } from '../core/types/storage_providers.js';
|
|
19
|
-
export { buildRequestUrl, concatHashes, readInChunks, zeroPadBytes } from '../core/utils.js';
|
|
19
|
+
export { buildRequestUrl, concatHashes, getBlobNameSuffix, readInChunks, zeroPadBytes } from '../core/utils.js';
|
|
20
|
+
export { Order_By } from '../core/operations/generated/sdk.js';
|
|
20
21
|
import '@aptos-labs/ts-sdk';
|
|
21
22
|
import 'zod';
|
|
22
|
-
import '../core/operations/generated/sdk.js';
|
|
23
|
-
import 'graphql';
|
|
24
|
-
import 'graphql-request';
|
|
25
23
|
import '@shelby-protocol/clay-codes';
|
|
24
|
+
import 'graphql-request';
|
|
25
|
+
import 'graphql';
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
import "../chunk-DJJD2AXO.mjs";
|
|
2
2
|
import "../chunk-MWDW4ROU.mjs";
|
|
3
|
-
import "../chunk-ZHXCVRZX.mjs";
|
|
4
3
|
import "../chunk-MQUVYMNQ.mjs";
|
|
4
|
+
import "../chunk-ZHXCVRZX.mjs";
|
|
5
5
|
import "../chunk-RNXGC54D.mjs";
|
|
6
6
|
import {
|
|
7
7
|
ShelbyClient
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import {
|
|
10
|
-
ShelbyBlobClient
|
|
11
|
-
} from "../chunk-3QINXXV6.mjs";
|
|
8
|
+
} from "../chunk-TPGMXZRD.mjs";
|
|
12
9
|
import "../chunk-Z7RFCADT.mjs";
|
|
13
10
|
import {
|
|
14
11
|
ShelbyRPCClient
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import {
|
|
17
|
-
createShelbyIndexerClient,
|
|
18
|
-
getShelbyIndexerClient
|
|
19
|
-
} from "../chunk-VPT45MTZ.mjs";
|
|
20
|
-
import "../chunk-DLMDDEWF.mjs";
|
|
21
|
-
import {
|
|
22
|
-
BlobNameSchema,
|
|
23
|
-
ChunkKey,
|
|
24
|
-
allChunksForBlob,
|
|
25
|
-
roundSize
|
|
26
|
-
} from "../chunk-FIFKKWXV.mjs";
|
|
12
|
+
} from "../chunk-L7H6EKII.mjs";
|
|
27
13
|
import {
|
|
28
14
|
isShelbyNetwork,
|
|
29
15
|
shelbyNetworks
|
|
@@ -34,6 +20,16 @@ import {
|
|
|
34
20
|
getShelbyAccountExplorerUrl,
|
|
35
21
|
getShelbyBlobExplorerUrl
|
|
36
22
|
} from "../chunk-BDSW5PHM.mjs";
|
|
23
|
+
import {
|
|
24
|
+
ShelbyBlobClient
|
|
25
|
+
} from "../chunk-Y7KTNPPR.mjs";
|
|
26
|
+
import {
|
|
27
|
+
createShelbyIndexerClient,
|
|
28
|
+
getShelbyIndexerClient
|
|
29
|
+
} from "../chunk-T6TVHFJO.mjs";
|
|
30
|
+
import {
|
|
31
|
+
Order_By
|
|
32
|
+
} from "../chunk-WJKSPJSS.mjs";
|
|
37
33
|
import "../chunk-RBFWGDMY.mjs";
|
|
38
34
|
import {
|
|
39
35
|
getAptosAccountExplorerUrl,
|
|
@@ -47,13 +43,33 @@ import {
|
|
|
47
43
|
ChunksetCommitmentSchema,
|
|
48
44
|
expectedTotalChunksets,
|
|
49
45
|
generateCommitments
|
|
50
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-PCNLFNAT.mjs";
|
|
51
47
|
import {
|
|
52
48
|
buildRequestUrl,
|
|
53
49
|
concatHashes,
|
|
50
|
+
getBlobNameSuffix,
|
|
54
51
|
readInChunks,
|
|
55
52
|
zeroPadBytes
|
|
56
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-4JZO2D7T.mjs";
|
|
54
|
+
import {
|
|
55
|
+
DEFAULT_PROJECT_DESCRIPTION,
|
|
56
|
+
DEFAULT_PROJECT_NAME,
|
|
57
|
+
NetworkToShelbyBlobIndexerBaseUrl,
|
|
58
|
+
NetworkToShelbyRPCBaseUrl,
|
|
59
|
+
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
60
|
+
SHELBYUSD_TOKEN_ADDRESS,
|
|
61
|
+
SHELBYUSD_TOKEN_MODULE,
|
|
62
|
+
SHELBYUSD_TOKEN_NAME,
|
|
63
|
+
SHELBY_DEPLOYER,
|
|
64
|
+
TOKEN_DEPLOYER,
|
|
65
|
+
TOKEN_OBJECT_ADDRESS
|
|
66
|
+
} from "../chunk-SEXQTDX6.mjs";
|
|
67
|
+
import {
|
|
68
|
+
BlobNameSchema,
|
|
69
|
+
ChunkKey,
|
|
70
|
+
allChunksForBlob,
|
|
71
|
+
roundSize
|
|
72
|
+
} from "../chunk-FIFKKWXV.mjs";
|
|
57
73
|
import {
|
|
58
74
|
CHUNK_SIZE_PARAMS,
|
|
59
75
|
ChunkSizeScheme,
|
|
@@ -63,6 +79,9 @@ import {
|
|
|
63
79
|
ERASURE_CODE_AND_CHUNK_MAPPING,
|
|
64
80
|
createDefaultErasureCodingProvider
|
|
65
81
|
} from "../chunk-APML3CGJ.mjs";
|
|
82
|
+
import {
|
|
83
|
+
ReedSolomonErasureCodingProvider
|
|
84
|
+
} from "../chunk-3ZDXWPYC.mjs";
|
|
66
85
|
import {
|
|
67
86
|
DEFAULT_ERASURE_D,
|
|
68
87
|
DEFAULT_ERASURE_K,
|
|
@@ -71,22 +90,6 @@ import {
|
|
|
71
90
|
ERASURE_CODE_PARAMS,
|
|
72
91
|
ErasureCodingScheme
|
|
73
92
|
} from "../chunk-ZPW742E7.mjs";
|
|
74
|
-
import {
|
|
75
|
-
ReedSolomonErasureCodingProvider
|
|
76
|
-
} from "../chunk-3ZDXWPYC.mjs";
|
|
77
|
-
import {
|
|
78
|
-
DEFAULT_PROJECT_DESCRIPTION,
|
|
79
|
-
DEFAULT_PROJECT_NAME,
|
|
80
|
-
NetworkToShelbyBlobIndexerBaseUrl,
|
|
81
|
-
NetworkToShelbyRPCBaseUrl,
|
|
82
|
-
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
83
|
-
SHELBYUSD_TOKEN_ADDRESS,
|
|
84
|
-
SHELBYUSD_TOKEN_MODULE,
|
|
85
|
-
SHELBYUSD_TOKEN_NAME,
|
|
86
|
-
SHELBY_DEPLOYER,
|
|
87
|
-
TOKEN_DEPLOYER,
|
|
88
|
-
TOKEN_OBJECT_ADDRESS
|
|
89
|
-
} from "../chunk-SEXQTDX6.mjs";
|
|
90
93
|
import "../chunk-7P6ASYW6.mjs";
|
|
91
94
|
export {
|
|
92
95
|
BlobCommitmentsSchema,
|
|
@@ -109,6 +112,7 @@ export {
|
|
|
109
112
|
ErasureCodingScheme,
|
|
110
113
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
111
114
|
NetworkToShelbyRPCBaseUrl,
|
|
115
|
+
Order_By,
|
|
112
116
|
ReedSolomonErasureCodingProvider,
|
|
113
117
|
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
114
118
|
SHELBYUSD_TOKEN_ADDRESS,
|
|
@@ -130,6 +134,7 @@ export {
|
|
|
130
134
|
generateCommitments,
|
|
131
135
|
getAptosAccountExplorerUrl,
|
|
132
136
|
getAptosTransactionExplorerUrl,
|
|
137
|
+
getBlobNameSuffix,
|
|
133
138
|
getShelbyAccountBlobsExplorerUrl,
|
|
134
139
|
getShelbyAccountExplorerUrl,
|
|
135
140
|
getShelbyBlobExplorerUrl,
|
|
@@ -83,10 +83,15 @@ function buildRequestUrl(path, baseUrl) {
|
|
|
83
83
|
const safePath = path.replace(/^\/+/, "");
|
|
84
84
|
return new URL(safePath, safeBase);
|
|
85
85
|
}
|
|
86
|
+
function getBlobNameSuffix(blobName) {
|
|
87
|
+
const parts = blobName.split("/");
|
|
88
|
+
return parts.slice(1).join("/") || "";
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
export {
|
|
88
92
|
readInChunks,
|
|
89
93
|
zeroPadBytes,
|
|
90
94
|
concatHashes,
|
|
91
|
-
buildRequestUrl
|
|
95
|
+
buildRequestUrl,
|
|
96
|
+
getBlobNameSuffix
|
|
92
97
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getShelbyIndexerClient
|
|
3
|
-
} from "./chunk-VPT45MTZ.mjs";
|
|
4
|
-
import {
|
|
5
|
-
BlobNameSchema
|
|
6
|
-
} from "./chunk-FIFKKWXV.mjs";
|
|
7
1
|
import {
|
|
8
2
|
sleep
|
|
9
3
|
} from "./chunk-I6NG5GNL.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getShelbyIndexerClient
|
|
6
|
+
} from "./chunk-T6TVHFJO.mjs";
|
|
10
7
|
import {
|
|
11
8
|
buildRequestUrl
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4JZO2D7T.mjs";
|
|
13
10
|
import {
|
|
14
11
|
NetworkToShelbyRPCBaseUrl
|
|
15
12
|
} from "./chunk-SEXQTDX6.mjs";
|
|
13
|
+
import {
|
|
14
|
+
BlobNameSchema
|
|
15
|
+
} from "./chunk-FIFKKWXV.mjs";
|
|
16
16
|
|
|
17
17
|
// src/core/clients/ShelbyRPCClient.ts
|
|
18
18
|
import { AccountAddress } from "@aptos-labs/ts-sdk";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShelbyBlobClient
|
|
3
|
-
} from "./chunk-3QINXXV6.mjs";
|
|
4
1
|
import {
|
|
5
2
|
ShelbyRPCClient
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L7H6EKII.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ShelbyBlobClient
|
|
6
|
+
} from "./chunk-Y7KTNPPR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getAptosConfig
|
|
9
9
|
} from "./chunk-RBFWGDMY.mjs";
|
|
10
10
|
import {
|
|
11
11
|
generateCommitments
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
ClayErasureCodingProvider
|
|
15
|
-
} from "./chunk-APML3CGJ.mjs";
|
|
12
|
+
} from "./chunk-PCNLFNAT.mjs";
|
|
16
13
|
import {
|
|
17
14
|
NetworkToShelbyRPCBaseUrl
|
|
18
15
|
} from "./chunk-SEXQTDX6.mjs";
|
|
16
|
+
import {
|
|
17
|
+
ClayErasureCodingProvider
|
|
18
|
+
} from "./chunk-APML3CGJ.mjs";
|
|
19
19
|
|
|
20
20
|
// src/core/clients/ShelbyClient.ts
|
|
21
21
|
import {
|
|
@@ -87,6 +87,24 @@ var GetBlobActivitiesDocument = gql`
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
`;
|
|
90
|
+
var GetBlobsCountDocument = gql`
|
|
91
|
+
query getBlobsCount($where: blobs_bool_exp) {
|
|
92
|
+
blobs_aggregate(where: $where) {
|
|
93
|
+
aggregate {
|
|
94
|
+
count
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
var GetBlobActivitiesCountDocument = gql`
|
|
100
|
+
query getBlobActivitiesCount($where: blob_activities_bool_exp) {
|
|
101
|
+
blob_activities_aggregate(where: $where) {
|
|
102
|
+
aggregate {
|
|
103
|
+
count
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
90
108
|
var defaultWrapper = (action, _operationName, _operationType, _variables) => action();
|
|
91
109
|
function getSdk(client, withWrapper = defaultWrapper) {
|
|
92
110
|
return {
|
|
@@ -95,6 +113,12 @@ function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
95
113
|
},
|
|
96
114
|
getBlobActivities(variables, requestHeaders, signal) {
|
|
97
115
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobActivitiesDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobActivities", "query", variables);
|
|
116
|
+
},
|
|
117
|
+
getBlobsCount(variables, requestHeaders, signal) {
|
|
118
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobsCountDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobsCount", "query", variables);
|
|
119
|
+
},
|
|
120
|
+
getBlobActivitiesCount(variables, requestHeaders, signal) {
|
|
121
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetBlobActivitiesCountDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "getBlobActivitiesCount", "query", variables);
|
|
98
122
|
}
|
|
99
123
|
};
|
|
100
124
|
}
|
|
@@ -108,5 +132,7 @@ export {
|
|
|
108
132
|
Processor_Status_Select_Column,
|
|
109
133
|
GetBlobsDocument,
|
|
110
134
|
GetBlobActivitiesDocument,
|
|
135
|
+
GetBlobsCountDocument,
|
|
136
|
+
GetBlobActivitiesCountDocument,
|
|
111
137
|
getSdk
|
|
112
138
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getShelbyIndexerClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T6TVHFJO.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getAptosConfig
|
|
6
6
|
} from "./chunk-RBFWGDMY.mjs";
|
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
} from "./chunk-OTBLZL2S.mjs";
|
|
10
10
|
import {
|
|
11
11
|
expectedTotalChunksets
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PCNLFNAT.mjs";
|
|
13
|
+
import {
|
|
14
|
+
getBlobNameSuffix
|
|
15
|
+
} from "./chunk-4JZO2D7T.mjs";
|
|
16
|
+
import {
|
|
17
|
+
SHELBY_DEPLOYER
|
|
18
|
+
} from "./chunk-SEXQTDX6.mjs";
|
|
13
19
|
import {
|
|
14
20
|
DEFAULT_CHUNKSET_SIZE_BYTES,
|
|
15
21
|
ERASURE_CODE_AND_CHUNK_MAPPING
|
|
@@ -17,9 +23,6 @@ import {
|
|
|
17
23
|
import {
|
|
18
24
|
ERASURE_CODE_PARAMS
|
|
19
25
|
} from "./chunk-ZPW742E7.mjs";
|
|
20
|
-
import {
|
|
21
|
-
SHELBY_DEPLOYER
|
|
22
|
-
} from "./chunk-SEXQTDX6.mjs";
|
|
23
26
|
|
|
24
27
|
// src/core/clients/ShelbyBlobClient.ts
|
|
25
28
|
import {
|
|
@@ -117,6 +120,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
117
120
|
).toUint8Array(),
|
|
118
121
|
owner: AccountAddress.fromString(metadata.owner),
|
|
119
122
|
name: params.name,
|
|
123
|
+
blobNameSuffix: getBlobNameSuffix(params.name),
|
|
120
124
|
size: Number(metadata.blob_size),
|
|
121
125
|
encoding,
|
|
122
126
|
expirationMicros: metadata.expiration_micros,
|
|
@@ -149,13 +153,14 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
149
153
|
* ```
|
|
150
154
|
*/
|
|
151
155
|
getAccountBlobs(params) {
|
|
156
|
+
const { where, ...rest } = params;
|
|
152
157
|
return this.getBlobs({
|
|
153
158
|
where: {
|
|
154
|
-
...
|
|
159
|
+
...where ?? {},
|
|
155
160
|
owner: { _eq: AccountAddress.from(params.account).toString() }
|
|
156
161
|
},
|
|
157
|
-
pagination:
|
|
158
|
-
orderBy:
|
|
162
|
+
pagination: rest.pagination,
|
|
163
|
+
orderBy: rest.orderBy
|
|
159
164
|
});
|
|
160
165
|
}
|
|
161
166
|
/**
|
|
@@ -177,8 +182,14 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
177
182
|
async getBlobs(params = {}) {
|
|
178
183
|
const { limit, offset } = params.pagination ?? {};
|
|
179
184
|
const { orderBy, where } = params;
|
|
185
|
+
const currentMicros = Date.now() * 1e3;
|
|
186
|
+
const defaultActiveFilter = {
|
|
187
|
+
expires_at: { _gte: currentMicros },
|
|
188
|
+
is_deleted: { _eq: "0" }
|
|
189
|
+
};
|
|
190
|
+
const finalWhere = where !== void 0 ? { ...defaultActiveFilter, ...where } : defaultActiveFilter;
|
|
180
191
|
const { blobs } = await this.indexer.getBlobs({
|
|
181
|
-
where,
|
|
192
|
+
where: finalWhere,
|
|
182
193
|
limit,
|
|
183
194
|
offset,
|
|
184
195
|
orderBy
|
|
@@ -187,6 +198,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
187
198
|
(blob) => ({
|
|
188
199
|
owner: AccountAddress.from(blob.owner),
|
|
189
200
|
name: blob.blob_name,
|
|
201
|
+
blobNameSuffix: getBlobNameSuffix(blob.blob_name),
|
|
190
202
|
blobMerkleRoot: Hex.fromHexInput(blob.blob_commitment).toUint8Array(),
|
|
191
203
|
size: Number(blob.size),
|
|
192
204
|
// TODO: Add encoding when supported in NCI
|
|
@@ -232,28 +244,36 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
232
244
|
);
|
|
233
245
|
}
|
|
234
246
|
/**
|
|
235
|
-
* Retrieves the
|
|
236
|
-
* the commitment, the storage provider location, and the status of the chunk (stored or pending).
|
|
247
|
+
* Retrieves the total number of blobs from the blockchain.
|
|
237
248
|
*
|
|
238
|
-
* @
|
|
239
|
-
*
|
|
240
|
-
* @param params.account - The account namespace the blob is stored in (e.g. "0x1")
|
|
241
|
-
* @param params.name - The name of the blob (e.g. "foo/bar")
|
|
242
|
-
* @returns The chunks that make up the blob.
|
|
249
|
+
* @param params.where (optional) - The where clause to filter the blobs by.
|
|
250
|
+
* @returns The total number of blobs.
|
|
243
251
|
*
|
|
244
252
|
* @example
|
|
245
253
|
* ```typescript
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
254
|
+
* const count = await client.getBlobsCount();
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
async getBlobsCount(params) {
|
|
258
|
+
const { where } = params;
|
|
259
|
+
const { blobs_aggregate } = await this.indexer.getBlobsCount({ where });
|
|
260
|
+
return blobs_aggregate?.aggregate?.count ?? 0;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Retrieves the total number of blob activities from the blockchain.
|
|
264
|
+
*
|
|
265
|
+
* @param params.where (optional) - The where clause to filter the blob activities by.
|
|
266
|
+
* @returns The total number of blob activities.
|
|
251
267
|
*
|
|
252
|
-
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* const count = await client.getBlobActivitiesCount();
|
|
253
271
|
* ```
|
|
254
272
|
*/
|
|
255
|
-
|
|
256
|
-
|
|
273
|
+
async getBlobActivitiesCount(params) {
|
|
274
|
+
const { where } = params;
|
|
275
|
+
const { blob_activities_aggregate } = await this.indexer.getBlobActivitiesCount({ where });
|
|
276
|
+
return blob_activities_aggregate?.aggregate?.count ?? 0;
|
|
257
277
|
}
|
|
258
278
|
/**
|
|
259
279
|
* Registers a blob on the blockchain by writing its merkle root and metadata.
|
|
@@ -380,6 +400,23 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
380
400
|
]
|
|
381
401
|
};
|
|
382
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Creates a transaction payload to delete a blob on the blockchain.
|
|
405
|
+
* This is a static helper method for constructing the Move function call payload.
|
|
406
|
+
*
|
|
407
|
+
* @param params.deployer - Optional deployer account address. Defaults to SHELBY_DEPLOYER.
|
|
408
|
+
* @param params.blobNameSuffix - The blob name suffix (e.g. "bar.txt").
|
|
409
|
+
*
|
|
410
|
+
* @returns An Aptos transaction payload data object for the delete_blob Move function.
|
|
411
|
+
*
|
|
412
|
+
* @see https://github.com/shelby/shelby/blob/64e9d7b4f0005e586faeb1e4085c79159234b6b6/move/shelby_contract/sources/global_metadata.move#L616
|
|
413
|
+
*/
|
|
414
|
+
static createDeleteBlobPayload(params) {
|
|
415
|
+
return {
|
|
416
|
+
function: `${(params.deployer ?? SHELBY_DEPLOYER).toString()}::global_metadata::delete_blob`,
|
|
417
|
+
functionArguments: [params.blobNameSuffix]
|
|
418
|
+
};
|
|
419
|
+
}
|
|
383
420
|
};
|
|
384
421
|
|
|
385
422
|
export {
|
package/dist/core/chunk.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
DEFAULT_CHUNK_SIZE_BYTES,
|
|
6
6
|
ERASURE_CODE_AND_CHUNK_MAPPING
|
|
7
7
|
} from "../chunk-APML3CGJ.mjs";
|
|
8
|
-
import "../chunk-ZPW742E7.mjs";
|
|
9
8
|
import "../chunk-3ZDXWPYC.mjs";
|
|
9
|
+
import "../chunk-ZPW742E7.mjs";
|
|
10
10
|
import "../chunk-7P6ASYW6.mjs";
|
|
11
11
|
export {
|
|
12
12
|
CHUNK_SIZE_PARAMS,
|
|
@@ -120,30 +120,33 @@ declare class ShelbyBlobClient {
|
|
|
120
120
|
orderBy?: Blob_Activities_Order_By;
|
|
121
121
|
}): Promise<BlobActivity[]>;
|
|
122
122
|
/**
|
|
123
|
-
* Retrieves the
|
|
124
|
-
* the commitment, the storage provider location, and the status of the chunk (stored or pending).
|
|
123
|
+
* Retrieves the total number of blobs from the blockchain.
|
|
125
124
|
*
|
|
126
|
-
* @
|
|
127
|
-
*
|
|
128
|
-
* @param params.account - The account namespace the blob is stored in (e.g. "0x1")
|
|
129
|
-
* @param params.name - The name of the blob (e.g. "foo/bar")
|
|
130
|
-
* @returns The chunks that make up the blob.
|
|
125
|
+
* @param params.where (optional) - The where clause to filter the blobs by.
|
|
126
|
+
* @returns The total number of blobs.
|
|
131
127
|
*
|
|
132
128
|
* @example
|
|
133
129
|
* ```typescript
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
* const count = await client.getBlobsCount();
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
getBlobsCount(params: {
|
|
134
|
+
where?: Blobs_Bool_Exp;
|
|
135
|
+
}): Promise<number>;
|
|
136
|
+
/**
|
|
137
|
+
* Retrieves the total number of blob activities from the blockchain.
|
|
138
|
+
*
|
|
139
|
+
* @param params.where (optional) - The where clause to filter the blob activities by.
|
|
140
|
+
* @returns The total number of blob activities.
|
|
139
141
|
*
|
|
140
|
-
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const count = await client.getBlobActivitiesCount();
|
|
141
145
|
* ```
|
|
142
146
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}): Promise<string[]>;
|
|
147
|
+
getBlobActivitiesCount(params: {
|
|
148
|
+
where?: Blob_Activities_Bool_Exp;
|
|
149
|
+
}): Promise<number>;
|
|
147
150
|
/**
|
|
148
151
|
* Registers a blob on the blockchain by writing its merkle root and metadata.
|
|
149
152
|
*
|
|
@@ -235,6 +238,21 @@ declare class ShelbyBlobClient {
|
|
|
235
238
|
numChunksets: number;
|
|
236
239
|
}[];
|
|
237
240
|
}): InputGenerateTransactionPayloadData;
|
|
241
|
+
/**
|
|
242
|
+
* Creates a transaction payload to delete a blob on the blockchain.
|
|
243
|
+
* This is a static helper method for constructing the Move function call payload.
|
|
244
|
+
*
|
|
245
|
+
* @param params.deployer - Optional deployer account address. Defaults to SHELBY_DEPLOYER.
|
|
246
|
+
* @param params.blobNameSuffix - The blob name suffix (e.g. "bar.txt").
|
|
247
|
+
*
|
|
248
|
+
* @returns An Aptos transaction payload data object for the delete_blob Move function.
|
|
249
|
+
*
|
|
250
|
+
* @see https://github.com/shelby/shelby/blob/64e9d7b4f0005e586faeb1e4085c79159234b6b6/move/shelby_contract/sources/global_metadata.move#L616
|
|
251
|
+
*/
|
|
252
|
+
static createDeleteBlobPayload(params: {
|
|
253
|
+
deployer?: AccountAddress;
|
|
254
|
+
blobNameSuffix: string;
|
|
255
|
+
}): InputGenerateTransactionPayloadData;
|
|
238
256
|
}
|
|
239
257
|
|
|
240
258
|
export { ShelbyBlobClient, type WriteBlobCommitmentsOptions };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyBlobClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-Y7KTNPPR.mjs";
|
|
4
|
+
import "../../chunk-T6TVHFJO.mjs";
|
|
5
|
+
import "../../chunk-WJKSPJSS.mjs";
|
|
6
6
|
import "../../chunk-RBFWGDMY.mjs";
|
|
7
7
|
import "../../chunk-OTBLZL2S.mjs";
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-PCNLFNAT.mjs";
|
|
9
|
+
import "../../chunk-4JZO2D7T.mjs";
|
|
10
|
+
import "../../chunk-SEXQTDX6.mjs";
|
|
10
11
|
import "../../chunk-APML3CGJ.mjs";
|
|
11
|
-
import "../../chunk-ZPW742E7.mjs";
|
|
12
12
|
import "../../chunk-3ZDXWPYC.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-ZPW742E7.mjs";
|
|
14
14
|
import "../../chunk-7P6ASYW6.mjs";
|
|
15
15
|
export {
|
|
16
16
|
ShelbyBlobClient
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-GKRHKR3J.mjs";
|
|
6
|
-
import "../../chunk-VPT45MTZ.mjs";
|
|
7
|
-
import "../../chunk-DLMDDEWF.mjs";
|
|
8
|
-
import "../../chunk-FIFKKWXV.mjs";
|
|
3
|
+
} from "../../chunk-TPGMXZRD.mjs";
|
|
4
|
+
import "../../chunk-L7H6EKII.mjs";
|
|
9
5
|
import "../../chunk-I6NG5GNL.mjs";
|
|
6
|
+
import "../../chunk-Y7KTNPPR.mjs";
|
|
7
|
+
import "../../chunk-T6TVHFJO.mjs";
|
|
8
|
+
import "../../chunk-WJKSPJSS.mjs";
|
|
10
9
|
import "../../chunk-RBFWGDMY.mjs";
|
|
11
10
|
import "../../chunk-OTBLZL2S.mjs";
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-PCNLFNAT.mjs";
|
|
12
|
+
import "../../chunk-4JZO2D7T.mjs";
|
|
13
|
+
import "../../chunk-SEXQTDX6.mjs";
|
|
14
|
+
import "../../chunk-FIFKKWXV.mjs";
|
|
14
15
|
import "../../chunk-APML3CGJ.mjs";
|
|
15
|
-
import "../../chunk-ZPW742E7.mjs";
|
|
16
16
|
import "../../chunk-3ZDXWPYC.mjs";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-ZPW742E7.mjs";
|
|
18
18
|
import "../../chunk-7P6ASYW6.mjs";
|
|
19
19
|
export {
|
|
20
20
|
ShelbyClient
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyRPCClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-VPT45MTZ.mjs";
|
|
5
|
-
import "../../chunk-DLMDDEWF.mjs";
|
|
6
|
-
import "../../chunk-FIFKKWXV.mjs";
|
|
3
|
+
} from "../../chunk-L7H6EKII.mjs";
|
|
7
4
|
import "../../chunk-I6NG5GNL.mjs";
|
|
5
|
+
import "../../chunk-T6TVHFJO.mjs";
|
|
6
|
+
import "../../chunk-WJKSPJSS.mjs";
|
|
8
7
|
import "../../chunk-RBFWGDMY.mjs";
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-4JZO2D7T.mjs";
|
|
9
|
+
import "../../chunk-SEXQTDX6.mjs";
|
|
10
|
+
import "../../chunk-FIFKKWXV.mjs";
|
|
10
11
|
import "../../chunk-APML3CGJ.mjs";
|
|
11
|
-
import "../../chunk-ZPW742E7.mjs";
|
|
12
12
|
import "../../chunk-3ZDXWPYC.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-ZPW742E7.mjs";
|
|
14
14
|
import "../../chunk-7P6ASYW6.mjs";
|
|
15
15
|
export {
|
|
16
16
|
ShelbyRPCClient
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import "../../chunk-RNXGC54D.mjs";
|
|
2
2
|
import {
|
|
3
3
|
ShelbyClient
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import {
|
|
6
|
-
ShelbyBlobClient
|
|
7
|
-
} from "../../chunk-3QINXXV6.mjs";
|
|
4
|
+
} from "../../chunk-TPGMXZRD.mjs";
|
|
8
5
|
import "../../chunk-Z7RFCADT.mjs";
|
|
9
6
|
import {
|
|
10
7
|
ShelbyRPCClient
|
|
11
|
-
} from "../../chunk-
|
|
12
|
-
import "../../chunk-VPT45MTZ.mjs";
|
|
13
|
-
import "../../chunk-DLMDDEWF.mjs";
|
|
14
|
-
import "../../chunk-FIFKKWXV.mjs";
|
|
8
|
+
} from "../../chunk-L7H6EKII.mjs";
|
|
15
9
|
import "../../chunk-I6NG5GNL.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ShelbyBlobClient
|
|
12
|
+
} from "../../chunk-Y7KTNPPR.mjs";
|
|
13
|
+
import "../../chunk-T6TVHFJO.mjs";
|
|
14
|
+
import "../../chunk-WJKSPJSS.mjs";
|
|
16
15
|
import "../../chunk-RBFWGDMY.mjs";
|
|
17
16
|
import "../../chunk-OTBLZL2S.mjs";
|
|
18
|
-
import "../../chunk-
|
|
19
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-PCNLFNAT.mjs";
|
|
18
|
+
import "../../chunk-4JZO2D7T.mjs";
|
|
19
|
+
import "../../chunk-SEXQTDX6.mjs";
|
|
20
|
+
import "../../chunk-FIFKKWXV.mjs";
|
|
20
21
|
import "../../chunk-APML3CGJ.mjs";
|
|
21
|
-
import "../../chunk-ZPW742E7.mjs";
|
|
22
22
|
import "../../chunk-3ZDXWPYC.mjs";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-ZPW742E7.mjs";
|
|
24
24
|
import "../../chunk-7P6ASYW6.mjs";
|
|
25
25
|
export {
|
|
26
26
|
ShelbyBlobClient,
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
ChunksetCommitmentSchema,
|
|
4
4
|
expectedTotalChunksets,
|
|
5
5
|
generateCommitments
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-PCNLFNAT.mjs";
|
|
7
|
+
import "../chunk-4JZO2D7T.mjs";
|
|
8
8
|
import "../chunk-APML3CGJ.mjs";
|
|
9
|
-
import "../chunk-ZPW742E7.mjs";
|
|
10
9
|
import "../chunk-3ZDXWPYC.mjs";
|
|
10
|
+
import "../chunk-ZPW742E7.mjs";
|
|
11
11
|
import "../chunk-7P6ASYW6.mjs";
|
|
12
12
|
export {
|
|
13
13
|
BlobCommitmentsSchema,
|