@shelby-protocol/sdk 0.0.3 → 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 +7 -5
- package/dist/browser/index.mjs +35 -16
- package/dist/{chunk-I7SQAWUY.mjs → chunk-2DD6Q5CK.mjs} +1 -1
- package/dist/{chunk-KBUWZXFA.mjs → chunk-4JZO2D7T.mjs} +6 -1
- package/dist/chunk-BDSW5PHM.mjs +37 -0
- package/dist/chunk-C6RQ3AEU.mjs +51 -0
- package/dist/{chunk-NTJSNNA7.mjs → chunk-CTGCK3H2.mjs} +1 -1
- package/dist/{chunk-PGBEBDNY.mjs → chunk-L7H6EKII.mjs} +3 -3
- package/dist/{chunk-LTV26KU4.mjs → chunk-PCNLFNAT.mjs} +1 -1
- package/dist/{chunk-HPVCKAN2.mjs → chunk-SEXQTDX6.mjs} +2 -2
- package/dist/{chunk-57KKLRIW.mjs → chunk-T6TVHFJO.mjs} +2 -2
- package/dist/{chunk-PUNXDYH2.mjs → chunk-TPGMXZRD.mjs} +4 -4
- package/dist/{chunk-DLMDDEWF.mjs → chunk-WJKSPJSS.mjs} +26 -0
- package/dist/{chunk-USBWGA27.mjs → chunk-Y7KTNPPR.mjs} +62 -22
- package/dist/core/aptos-explorer.d.ts +10 -0
- package/dist/core/aptos-explorer.mjs +9 -0
- package/dist/core/clients/ShelbyBlobClient.d.ts +36 -17
- package/dist/core/clients/ShelbyBlobClient.mjs +6 -6
- package/dist/core/clients/ShelbyClient.mjs +8 -8
- package/dist/core/clients/ShelbyRPCClient.mjs +5 -5
- package/dist/core/clients/index.mjs +9 -9
- package/dist/core/commitments.mjs +2 -2
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.mjs +3 -3
- package/dist/core/index.d.ts +7 -5
- package/dist/core/index.mjs +35 -16
- 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 +6 -3
- package/dist/core/shelby-explorer.d.ts +14 -0
- package/dist/core/shelby-explorer.mjs +11 -0
- package/dist/core/types/blobs.d.ts +9 -0
- package/dist/core/utils.d.ts +8 -1
- package/dist/core/utils.mjs +3 -1
- package/dist/node/clients/ShelbyMetadataClient.mjs +2 -2
- package/dist/node/clients/ShelbyNodeClient.mjs +9 -9
- package/dist/node/clients/index.mjs +10 -10
- package/dist/node/index.d.ts +7 -5
- package/dist/node/index.mjs +37 -18
- package/package.json +1 -1
- /package/dist/{chunk-TUANYVZQ.mjs → chunk-DJJD2AXO.mjs} +0 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { getAptosAccountExplorerUrl, getAptosTransactionExplorerUrl } from '../core/aptos-explorer.js';
|
|
1
2
|
export { ShelbyBlob, createBlobKey } from '../core/blobs.js';
|
|
2
3
|
export { CHUNK_SIZE_PARAMS, ChunkSizeScheme, DEFAULT_CHUNKSET_SIZE_BYTES, DEFAULT_CHUNK_SIZE_BYTES, ERASURE_CODE_AND_CHUNK_MAPPING } from '../core/chunk.js';
|
|
3
4
|
export { ShelbyBlobClient } from '../core/clients/ShelbyBlobClient.js';
|
|
@@ -5,19 +6,20 @@ export { ShelbyClient, UploadOptions } from '../core/clients/ShelbyClient.js';
|
|
|
5
6
|
export { ShelbyClientConfig, ShelbyIndexerConfig, ShelbyRPCConfig } from '../core/clients/ShelbyClientConfig.js';
|
|
6
7
|
export { ShelbyRPCClient } from '../core/clients/ShelbyRPCClient.js';
|
|
7
8
|
export { BlobCommitments, BlobCommitmentsSchema, ChunksetCommitment, ChunksetCommitmentSchema, GenerateCommitmentsOptions, expectedTotalChunksets, generateCommitments } from '../core/commitments.js';
|
|
8
|
-
export { DEFAULT_PROJECT_DESCRIPTION, DEFAULT_PROJECT_NAME, NetworkToShelbyBlobIndexerBaseUrl, NetworkToShelbyRPCBaseUrl, SHELBYUSD_TOKEN_ADDRESS, SHELBYUSD_TOKEN_MODULE, SHELBYUSD_TOKEN_NAME,
|
|
9
|
+
export { DEFAULT_PROJECT_DESCRIPTION, DEFAULT_PROJECT_NAME, 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';
|
|
9
10
|
export { C as ClayErasureCodingProvider, D as DecodeConfig, E as ErasureCodingConfig, a as ErasureCodingProvider, R as ReedSolomonErasureCodingProvider } from '../clay-codes-Ce9EmXfa.js';
|
|
10
11
|
export { DEFAULT_ERASURE_D, DEFAULT_ERASURE_K, DEFAULT_ERASURE_M, DEFAULT_ERASURE_N, ERASURE_CODE_PARAMS, ErasureCodeParams, ErasureCodingScheme, ErasureSchemeParams } from '../core/erasure/constants.js';
|
|
11
12
|
export { createDefaultErasureCodingProvider } from '../core/erasure/default.js';
|
|
12
13
|
export { BlobName, BlobNameSchema, ChunkKey, allChunksForBlob, roundSize } from '../core/layout.js';
|
|
13
14
|
export { ShelbyNetwork, isShelbyNetwork, shelbyNetworks } from '../core/networks.js';
|
|
14
15
|
export { ShelbyIndexerClient, createShelbyIndexerClient, getShelbyIndexerClient } from '../core/operations/index.js';
|
|
16
|
+
export { getShelbyAccountBlobsExplorerUrl, getShelbyAccountExplorerUrl, getShelbyBlobExplorerUrl } from '../core/shelby-explorer.js';
|
|
15
17
|
export { BlobActivity, BlobActivityType, BlobEncoding, BlobMetadata, ClayEncoding } from '../core/types/blobs.js';
|
|
16
18
|
export { StorageProviderInfo } from '../core/types/storage_providers.js';
|
|
17
|
-
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';
|
|
18
21
|
import '@aptos-labs/ts-sdk';
|
|
19
22
|
import 'zod';
|
|
20
|
-
import '../core/operations/generated/sdk.js';
|
|
21
|
-
import 'graphql';
|
|
22
|
-
import 'graphql-request';
|
|
23
23
|
import '@shelby-protocol/clay-codes';
|
|
24
|
+
import 'graphql-request';
|
|
25
|
+
import 'graphql';
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-DJJD2AXO.mjs";
|
|
2
2
|
import "../chunk-MWDW4ROU.mjs";
|
|
3
3
|
import "../chunk-MQUVYMNQ.mjs";
|
|
4
4
|
import "../chunk-ZHXCVRZX.mjs";
|
|
5
5
|
import "../chunk-RNXGC54D.mjs";
|
|
6
6
|
import {
|
|
7
7
|
ShelbyClient
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-TPGMXZRD.mjs";
|
|
9
|
+
import "../chunk-Z7RFCADT.mjs";
|
|
9
10
|
import {
|
|
10
11
|
ShelbyRPCClient
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-L7H6EKII.mjs";
|
|
13
|
+
import {
|
|
14
|
+
isShelbyNetwork,
|
|
15
|
+
shelbyNetworks
|
|
16
|
+
} from "../chunk-VRLIOKWG.mjs";
|
|
12
17
|
import "../chunk-I6NG5GNL.mjs";
|
|
18
|
+
import {
|
|
19
|
+
getShelbyAccountBlobsExplorerUrl,
|
|
20
|
+
getShelbyAccountExplorerUrl,
|
|
21
|
+
getShelbyBlobExplorerUrl
|
|
22
|
+
} from "../chunk-BDSW5PHM.mjs";
|
|
13
23
|
import {
|
|
14
24
|
ShelbyBlobClient
|
|
15
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-Y7KTNPPR.mjs";
|
|
16
26
|
import {
|
|
17
27
|
createShelbyIndexerClient,
|
|
18
28
|
getShelbyIndexerClient
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import
|
|
29
|
+
} from "../chunk-T6TVHFJO.mjs";
|
|
30
|
+
import {
|
|
31
|
+
Order_By
|
|
32
|
+
} from "../chunk-WJKSPJSS.mjs";
|
|
21
33
|
import "../chunk-RBFWGDMY.mjs";
|
|
22
|
-
import
|
|
34
|
+
import {
|
|
35
|
+
getAptosAccountExplorerUrl,
|
|
36
|
+
getAptosTransactionExplorerUrl
|
|
37
|
+
} from "../chunk-C6RQ3AEU.mjs";
|
|
23
38
|
import {
|
|
24
39
|
createBlobKey
|
|
25
40
|
} from "../chunk-OTBLZL2S.mjs";
|
|
@@ -28,26 +43,27 @@ import {
|
|
|
28
43
|
ChunksetCommitmentSchema,
|
|
29
44
|
expectedTotalChunksets,
|
|
30
45
|
generateCommitments
|
|
31
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-PCNLFNAT.mjs";
|
|
32
47
|
import {
|
|
33
48
|
buildRequestUrl,
|
|
34
49
|
concatHashes,
|
|
50
|
+
getBlobNameSuffix,
|
|
35
51
|
readInChunks,
|
|
36
52
|
zeroPadBytes
|
|
37
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-4JZO2D7T.mjs";
|
|
38
54
|
import {
|
|
39
55
|
DEFAULT_PROJECT_DESCRIPTION,
|
|
40
56
|
DEFAULT_PROJECT_NAME,
|
|
41
57
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
42
58
|
NetworkToShelbyRPCBaseUrl,
|
|
59
|
+
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
43
60
|
SHELBYUSD_TOKEN_ADDRESS,
|
|
44
61
|
SHELBYUSD_TOKEN_MODULE,
|
|
45
62
|
SHELBYUSD_TOKEN_NAME,
|
|
46
|
-
SHELBYUSD_TOKEN_TYPE,
|
|
47
63
|
SHELBY_DEPLOYER,
|
|
48
64
|
TOKEN_DEPLOYER,
|
|
49
65
|
TOKEN_OBJECT_ADDRESS
|
|
50
|
-
} from "../chunk-
|
|
66
|
+
} from "../chunk-SEXQTDX6.mjs";
|
|
51
67
|
import {
|
|
52
68
|
BlobNameSchema,
|
|
53
69
|
ChunkKey,
|
|
@@ -74,10 +90,6 @@ import {
|
|
|
74
90
|
ERASURE_CODE_PARAMS,
|
|
75
91
|
ErasureCodingScheme
|
|
76
92
|
} from "../chunk-ZPW742E7.mjs";
|
|
77
|
-
import {
|
|
78
|
-
isShelbyNetwork,
|
|
79
|
-
shelbyNetworks
|
|
80
|
-
} from "../chunk-VRLIOKWG.mjs";
|
|
81
93
|
import "../chunk-7P6ASYW6.mjs";
|
|
82
94
|
export {
|
|
83
95
|
BlobCommitmentsSchema,
|
|
@@ -100,11 +112,12 @@ export {
|
|
|
100
112
|
ErasureCodingScheme,
|
|
101
113
|
NetworkToShelbyBlobIndexerBaseUrl,
|
|
102
114
|
NetworkToShelbyRPCBaseUrl,
|
|
115
|
+
Order_By,
|
|
103
116
|
ReedSolomonErasureCodingProvider,
|
|
117
|
+
SHELBYUSD_FA_METADATA_ADDRESS,
|
|
104
118
|
SHELBYUSD_TOKEN_ADDRESS,
|
|
105
119
|
SHELBYUSD_TOKEN_MODULE,
|
|
106
120
|
SHELBYUSD_TOKEN_NAME,
|
|
107
|
-
SHELBYUSD_TOKEN_TYPE,
|
|
108
121
|
SHELBY_DEPLOYER,
|
|
109
122
|
ShelbyBlobClient,
|
|
110
123
|
ShelbyClient,
|
|
@@ -119,6 +132,12 @@ export {
|
|
|
119
132
|
createShelbyIndexerClient,
|
|
120
133
|
expectedTotalChunksets,
|
|
121
134
|
generateCommitments,
|
|
135
|
+
getAptosAccountExplorerUrl,
|
|
136
|
+
getAptosTransactionExplorerUrl,
|
|
137
|
+
getBlobNameSuffix,
|
|
138
|
+
getShelbyAccountBlobsExplorerUrl,
|
|
139
|
+
getShelbyAccountExplorerUrl,
|
|
140
|
+
getShelbyBlobExplorerUrl,
|
|
122
141
|
getShelbyIndexerClient,
|
|
123
142
|
isShelbyNetwork,
|
|
124
143
|
readInChunks,
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/core/shelby-explorer.ts
|
|
2
|
+
import { Network } from "@aptos-labs/ts-sdk";
|
|
3
|
+
function getShelbyExplorerBaseUrl(network) {
|
|
4
|
+
const normalizedNetwork = network.toLowerCase();
|
|
5
|
+
switch (normalizedNetwork) {
|
|
6
|
+
case Network.MAINNET.toLowerCase():
|
|
7
|
+
return "https://explorer.shelby.xyz/mainnet";
|
|
8
|
+
case Network.TESTNET.toLowerCase():
|
|
9
|
+
return "https://explorer.shelby.xyz/testnet";
|
|
10
|
+
case Network.DEVNET.toLowerCase():
|
|
11
|
+
return "https://explorer.shelby.xyz/devnet";
|
|
12
|
+
case Network.LOCAL.toLowerCase():
|
|
13
|
+
return "https://explorer.shelby.xyz/local";
|
|
14
|
+
case Network.SHELBYNET.toLowerCase():
|
|
15
|
+
return "https://explorer.shelby.xyz/shelbynet";
|
|
16
|
+
default:
|
|
17
|
+
return `https://explorer.shelby.xyz/${normalizedNetwork}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getShelbyAccountBlobsExplorerUrl(network, accountAddress) {
|
|
21
|
+
const baseUrl = getShelbyExplorerBaseUrl(network);
|
|
22
|
+
return `${baseUrl}/account/${accountAddress}/blobs`;
|
|
23
|
+
}
|
|
24
|
+
function getShelbyBlobExplorerUrl(network, accountAddress, blobName) {
|
|
25
|
+
const baseUrl = getShelbyExplorerBaseUrl(network);
|
|
26
|
+
return `${baseUrl}/account/${accountAddress}/blob/${encodeURIComponent(blobName)}`;
|
|
27
|
+
}
|
|
28
|
+
function getShelbyAccountExplorerUrl(network, accountAddress) {
|
|
29
|
+
const baseUrl = getShelbyExplorerBaseUrl(network);
|
|
30
|
+
return `${baseUrl}/account/${accountAddress}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
getShelbyAccountBlobsExplorerUrl,
|
|
35
|
+
getShelbyBlobExplorerUrl,
|
|
36
|
+
getShelbyAccountExplorerUrl
|
|
37
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/core/aptos-explorer.ts
|
|
2
|
+
import { Network } from "@aptos-labs/ts-sdk";
|
|
3
|
+
function getAptosExplorerBaseUrl(network) {
|
|
4
|
+
const normalizedNetwork = network.toLowerCase();
|
|
5
|
+
switch (normalizedNetwork) {
|
|
6
|
+
case Network.MAINNET.toLowerCase():
|
|
7
|
+
return "https://explorer.aptoslabs.com";
|
|
8
|
+
case Network.TESTNET.toLowerCase():
|
|
9
|
+
return "https://explorer.aptoslabs.com";
|
|
10
|
+
case Network.DEVNET.toLowerCase():
|
|
11
|
+
return "https://explorer.aptoslabs.com";
|
|
12
|
+
case Network.LOCAL.toLowerCase():
|
|
13
|
+
return "https://explorer.aptoslabs.com";
|
|
14
|
+
case Network.SHELBYNET.toLowerCase():
|
|
15
|
+
return "https://explorer.aptoslabs.com";
|
|
16
|
+
default:
|
|
17
|
+
return "https://explorer.aptoslabs.com";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getAptosExplorerNetworkParam(network) {
|
|
21
|
+
const normalizedNetwork = network.toLowerCase();
|
|
22
|
+
switch (normalizedNetwork) {
|
|
23
|
+
case Network.MAINNET.toLowerCase():
|
|
24
|
+
return "mainnet";
|
|
25
|
+
case Network.TESTNET.toLowerCase():
|
|
26
|
+
return "testnet";
|
|
27
|
+
case Network.DEVNET.toLowerCase():
|
|
28
|
+
return "devnet";
|
|
29
|
+
case Network.LOCAL.toLowerCase():
|
|
30
|
+
return "local";
|
|
31
|
+
case Network.SHELBYNET.toLowerCase():
|
|
32
|
+
return "shelbynet";
|
|
33
|
+
default:
|
|
34
|
+
return normalizedNetwork;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function getAptosTransactionExplorerUrl(network, transactionHash) {
|
|
38
|
+
const baseUrl = getAptosExplorerBaseUrl(network);
|
|
39
|
+
const networkParam = getAptosExplorerNetworkParam(network);
|
|
40
|
+
return `${baseUrl}/txn/${transactionHash}?network=${networkParam}`;
|
|
41
|
+
}
|
|
42
|
+
function getAptosAccountExplorerUrl(network, accountAddress) {
|
|
43
|
+
const baseUrl = getAptosExplorerBaseUrl(network);
|
|
44
|
+
const networkParam = getAptosExplorerNetworkParam(network);
|
|
45
|
+
return `${baseUrl}/account/${accountAddress}?network=${networkParam}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
getAptosTransactionExplorerUrl,
|
|
50
|
+
getAptosAccountExplorerUrl
|
|
51
|
+
};
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-I6NG5GNL.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getShelbyIndexerClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T6TVHFJO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
buildRequestUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4JZO2D7T.mjs";
|
|
10
10
|
import {
|
|
11
11
|
NetworkToShelbyRPCBaseUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SEXQTDX6.mjs";
|
|
13
13
|
import {
|
|
14
14
|
BlobNameSchema
|
|
15
15
|
} from "./chunk-FIFKKWXV.mjs";
|
|
@@ -24,7 +24,7 @@ var TOKEN_OBJECT_ADDRESS = "0x249f5c642a63885ff88a5113b3ba0079840af5a1357706f8c7
|
|
|
24
24
|
var SHELBYUSD_TOKEN_ADDRESS = TOKEN_OBJECT_ADDRESS;
|
|
25
25
|
var SHELBYUSD_TOKEN_MODULE = "shelby_usd";
|
|
26
26
|
var SHELBYUSD_TOKEN_NAME = "ShelbyUSD";
|
|
27
|
-
var
|
|
27
|
+
var SHELBYUSD_FA_METADATA_ADDRESS = "0x1b18363a9f1fe5e6ebf247daba5cc1c18052bb232efdc4c50f556053922d98e1";
|
|
28
28
|
|
|
29
29
|
export {
|
|
30
30
|
DEFAULT_PROJECT_NAME,
|
|
@@ -37,5 +37,5 @@ export {
|
|
|
37
37
|
SHELBYUSD_TOKEN_ADDRESS,
|
|
38
38
|
SHELBYUSD_TOKEN_MODULE,
|
|
39
39
|
SHELBYUSD_TOKEN_NAME,
|
|
40
|
-
|
|
40
|
+
SHELBYUSD_FA_METADATA_ADDRESS
|
|
41
41
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSdk
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WJKSPJSS.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getAptosConfig
|
|
6
6
|
} from "./chunk-RBFWGDMY.mjs";
|
|
7
7
|
import {
|
|
8
8
|
NetworkToShelbyBlobIndexerBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SEXQTDX6.mjs";
|
|
10
10
|
|
|
11
11
|
// src/core/operations/index.ts
|
|
12
12
|
import { Network } from "@aptos-labs/ts-sdk";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyRPCClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L7H6EKII.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ShelbyBlobClient
|
|
6
|
-
} from "./chunk-
|
|
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-
|
|
12
|
+
} from "./chunk-PCNLFNAT.mjs";
|
|
13
13
|
import {
|
|
14
14
|
NetworkToShelbyRPCBaseUrl
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SEXQTDX6.mjs";
|
|
16
16
|
import {
|
|
17
17
|
ClayErasureCodingProvider
|
|
18
18
|
} from "./chunk-APML3CGJ.mjs";
|
|
@@ -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,10 +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";
|
|
13
16
|
import {
|
|
14
17
|
SHELBY_DEPLOYER
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SEXQTDX6.mjs";
|
|
16
19
|
import {
|
|
17
20
|
DEFAULT_CHUNKSET_SIZE_BYTES,
|
|
18
21
|
ERASURE_CODE_AND_CHUNK_MAPPING
|
|
@@ -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,10 +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
|
-
where: {
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
where: {
|
|
159
|
+
...where ?? {},
|
|
160
|
+
owner: { _eq: AccountAddress.from(params.account).toString() }
|
|
161
|
+
},
|
|
162
|
+
pagination: rest.pagination,
|
|
163
|
+
orderBy: rest.orderBy
|
|
156
164
|
});
|
|
157
165
|
}
|
|
158
166
|
/**
|
|
@@ -174,8 +182,14 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
174
182
|
async getBlobs(params = {}) {
|
|
175
183
|
const { limit, offset } = params.pagination ?? {};
|
|
176
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;
|
|
177
191
|
const { blobs } = await this.indexer.getBlobs({
|
|
178
|
-
where,
|
|
192
|
+
where: finalWhere,
|
|
179
193
|
limit,
|
|
180
194
|
offset,
|
|
181
195
|
orderBy
|
|
@@ -184,6 +198,7 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
184
198
|
(blob) => ({
|
|
185
199
|
owner: AccountAddress.from(blob.owner),
|
|
186
200
|
name: blob.blob_name,
|
|
201
|
+
blobNameSuffix: getBlobNameSuffix(blob.blob_name),
|
|
187
202
|
blobMerkleRoot: Hex.fromHexInput(blob.blob_commitment).toUint8Array(),
|
|
188
203
|
size: Number(blob.size),
|
|
189
204
|
// TODO: Add encoding when supported in NCI
|
|
@@ -229,28 +244,36 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
229
244
|
);
|
|
230
245
|
}
|
|
231
246
|
/**
|
|
232
|
-
* Retrieves the
|
|
233
|
-
* the commitment, the storage provider location, and the status of the chunk (stored or pending).
|
|
234
|
-
*
|
|
235
|
-
* @deprecated Will need to get reworked when we are acking blobs from storage providers.
|
|
247
|
+
* Retrieves the total number of blobs from the blockchain.
|
|
236
248
|
*
|
|
237
|
-
* @param params.
|
|
238
|
-
* @
|
|
239
|
-
* @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.
|
|
240
251
|
*
|
|
241
252
|
* @example
|
|
242
253
|
* ```typescript
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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.
|
|
248
264
|
*
|
|
249
|
-
*
|
|
265
|
+
* @param params.where (optional) - The where clause to filter the blob activities by.
|
|
266
|
+
* @returns The total number of blob activities.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* const count = await client.getBlobActivitiesCount();
|
|
250
271
|
* ```
|
|
251
272
|
*/
|
|
252
|
-
|
|
253
|
-
|
|
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;
|
|
254
277
|
}
|
|
255
278
|
/**
|
|
256
279
|
* Registers a blob on the blockchain by writing its merkle root and metadata.
|
|
@@ -377,6 +400,23 @@ var ShelbyBlobClient = class _ShelbyBlobClient {
|
|
|
377
400
|
]
|
|
378
401
|
};
|
|
379
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
|
+
}
|
|
380
420
|
};
|
|
381
421
|
|
|
382
422
|
export {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate an Aptos explorer URL for a transaction
|
|
3
|
+
*/
|
|
4
|
+
declare function getAptosTransactionExplorerUrl(network: string, transactionHash: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate an Aptos explorer URL for an account
|
|
7
|
+
*/
|
|
8
|
+
declare function getAptosAccountExplorerUrl(network: string, accountAddress: string): string;
|
|
9
|
+
|
|
10
|
+
export { getAptosAccountExplorerUrl, getAptosTransactionExplorerUrl };
|
|
@@ -85,6 +85,7 @@ declare class ShelbyBlobClient {
|
|
|
85
85
|
offset?: number;
|
|
86
86
|
};
|
|
87
87
|
orderBy?: Blobs_Order_By;
|
|
88
|
+
where?: Omit<Blobs_Bool_Exp, "owner">;
|
|
88
89
|
}): Promise<BlobMetadata[]>;
|
|
89
90
|
/**
|
|
90
91
|
* Retrieves blobs and their metadata from the blockchain.
|
|
@@ -119,30 +120,33 @@ declare class ShelbyBlobClient {
|
|
|
119
120
|
orderBy?: Blob_Activities_Order_By;
|
|
120
121
|
}): Promise<BlobActivity[]>;
|
|
121
122
|
/**
|
|
122
|
-
* Retrieves the
|
|
123
|
-
* 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.
|
|
124
124
|
*
|
|
125
|
-
* @
|
|
126
|
-
*
|
|
127
|
-
* @param params.account - The account namespace the blob is stored in (e.g. "0x1")
|
|
128
|
-
* @param params.name - The name of the blob (e.g. "foo/bar")
|
|
129
|
-
* @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.
|
|
130
127
|
*
|
|
131
128
|
* @example
|
|
132
129
|
* ```typescript
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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.
|
|
138
141
|
*
|
|
139
|
-
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const count = await client.getBlobActivitiesCount();
|
|
140
145
|
* ```
|
|
141
146
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}): Promise<string[]>;
|
|
147
|
+
getBlobActivitiesCount(params: {
|
|
148
|
+
where?: Blob_Activities_Bool_Exp;
|
|
149
|
+
}): Promise<number>;
|
|
146
150
|
/**
|
|
147
151
|
* Registers a blob on the blockchain by writing its merkle root and metadata.
|
|
148
152
|
*
|
|
@@ -234,6 +238,21 @@ declare class ShelbyBlobClient {
|
|
|
234
238
|
numChunksets: number;
|
|
235
239
|
}[];
|
|
236
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;
|
|
237
256
|
}
|
|
238
257
|
|
|
239
258
|
export { ShelbyBlobClient, type WriteBlobCommitmentsOptions };
|