@zing-protocol/zing-sdk 0.0.17 → 0.1.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.
- package/dist/_generated/index.d.ts +0 -2
- package/dist/_generated/index.js +0 -2
- package/dist/_generated/utils/index.d.ts +21 -2
- package/dist/_generated/utils/index.js +35 -11
- package/dist/_generated/zing_framework/coin_utils.js +1 -4
- package/dist/_generated/zing_framework/derived_object_bag.d.ts +4 -3
- package/dist/_generated/zing_framework/derived_object_bag.js +12 -37
- package/dist/_generated/zing_framework/derived_table.d.ts +5 -4
- package/dist/_generated/zing_framework/derived_table.js +12 -33
- package/dist/_generated/zing_governance/admin.d.ts +4 -17
- package/dist/_generated/zing_governance/admin.js +3 -17
- package/dist/_generated/zing_governance/treasury.d.ts +5 -4
- package/dist/_generated/zing_governance/treasury.js +5 -15
- package/dist/_generated/zing_studio/app.d.ts +70 -2
- package/dist/_generated/zing_studio/app.js +154 -100
- package/dist/_generated/zing_studio/article.d.ts +6 -52
- package/dist/_generated/zing_studio/article.js +23 -74
- package/dist/_generated/zing_studio/config.d.ts +34 -3
- package/dist/_generated/zing_studio/config.js +47 -50
- package/dist/_generated/zing_studio/deps/sui/bag.d.ts +25 -3
- package/dist/_generated/zing_studio/deps/sui/bag.js +1 -2
- package/dist/_generated/zing_studio/deps/sui/balance.d.ts +1 -1
- package/dist/_generated/zing_studio/deps/sui/balance.js +1 -1
- package/dist/_generated/zing_studio/deps/sui/coin.d.ts +3 -5
- package/dist/_generated/zing_studio/deps/sui/coin.js +3 -3
- package/dist/_generated/zing_studio/deps/sui/table.d.ts +21 -4
- package/dist/_generated/zing_studio/deps/sui/table.js +2 -3
- package/dist/_generated/zing_studio/deps/walrus/blob.d.ts +2 -6
- package/dist/_generated/zing_studio/deps/walrus/blob.js +1 -2
- package/dist/_generated/zing_studio/deps/walrus/storage_resource.d.ts +1 -3
- package/dist/_generated/zing_studio/deps/walrus/storage_resource.js +1 -2
- package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.d.ts +1 -3
- package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.js +1 -2
- package/dist/_generated/zing_studio/deps/zing_framework/derived_table.d.ts +2 -4
- package/dist/_generated/zing_studio/deps/zing_framework/derived_table.js +2 -3
- package/dist/_generated/zing_studio/donation.d.ts +6 -14
- package/dist/_generated/zing_studio/donation.js +2 -2
- package/dist/_generated/zing_studio/enclave.d.ts +17 -10
- package/dist/_generated/zing_studio/enclave.js +16 -41
- package/dist/_generated/zing_studio/referral.js +15 -46
- package/dist/_generated/zing_studio/storage.d.ts +13 -17
- package/dist/_generated/zing_studio/storage.js +46 -100
- package/dist/_generated/zing_studio/studio.d.ts +6 -28
- package/dist/_generated/zing_studio/studio.js +23 -96
- package/dist/client/index.d.ts +18 -55
- package/dist/client/index.js +1 -28
- package/dist/config/common.d.ts +0 -6
- package/dist/config/common.js +0 -51
- package/dist/config/mainnet.js +12 -38
- package/dist/config/testnet.js +2 -26
- package/dist/config/types.d.ts +1 -6
- package/dist/const.js +1 -1
- package/dist/getters.d.ts +17 -62
- package/dist/getters.js +62 -56
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useGetStudio.d.ts +4 -10
- package/dist/hooks/useReclaim.d.ts +0 -10
- package/dist/hooks/useReclaim.js +169 -92
- package/dist/hooks/useSignAndExecuteTransaction.js +4 -1
- package/dist/hooks/useZingInfiniteQueries.d.ts +3 -9
- package/dist/hooks/useZingInfiniteQueries.js +1 -0
- package/dist/hooks/useZingQueries.d.ts +8 -27
- package/dist/hooks/useZingQueries.js +1 -2
- package/dist/hooks/useZingQuery.d.ts +11 -36
- package/dist/hooks/useZingQuery.js +1 -2
- package/dist/lib/utils/index.d.ts +0 -1
- package/dist/lib/utils/index.js +0 -1
- package/dist/lib/utils/reclaim.d.ts +1 -29
- package/dist/lib/utils/reclaim.js +148 -87
- package/dist/mutations/signer.js +1 -1
- package/dist/mutations/walrus.js +1 -1
- package/package.json +1 -1
- package/dist/_generated/zing_framework/deps/sui/object.d.ts +0 -8
- package/dist/_generated/zing_framework/deps/sui/object.js +0 -13
- package/dist/_generated/zing_governance/deps/sui/object.d.ts +0 -8
- package/dist/_generated/zing_governance/deps/sui/object.js +0 -13
- package/dist/_generated/zing_identity/config.d.ts +0 -87
- package/dist/_generated/zing_identity/config.js +0 -98
- package/dist/_generated/zing_identity/deps/std/type_name.d.ts +0 -17
- package/dist/_generated/zing_identity/deps/std/type_name.js +0 -22
- package/dist/_generated/zing_identity/deps/sui/object.d.ts +0 -8
- package/dist/_generated/zing_identity/deps/sui/object.js +0 -13
- package/dist/_generated/zing_identity/deps/sui/object_table.d.ts +0 -12
- package/dist/_generated/zing_identity/deps/sui/object_table.js +0 -23
- package/dist/_generated/zing_identity/deps/sui/table.d.ts +0 -12
- package/dist/_generated/zing_identity/deps/sui/table.js +0 -35
- package/dist/_generated/zing_identity/deps/sui/vec_set.d.ts +0 -17
- package/dist/_generated/zing_identity/deps/sui/vec_set.js +0 -22
- package/dist/_generated/zing_identity/ecdsa.d.ts +0 -81
- package/dist/_generated/zing_identity/ecdsa.js +0 -87
- package/dist/_generated/zing_identity/identity.d.ts +0 -262
- package/dist/_generated/zing_identity/identity.js +0 -294
- package/dist/_generated/zing_identity/reclaim.d.ts +0 -356
- package/dist/_generated/zing_identity/reclaim.js +0 -414
- package/dist/_generated/zing_studio/nitro_attestation.d.ts +0 -148
- package/dist/_generated/zing_studio/nitro_attestation.js +0 -183
- package/dist/lib/oauth-pwa.d.ts +0 -11
- package/dist/lib/oauth-pwa.js +0 -55
package/dist/hooks/useReclaim.js
CHANGED
|
@@ -1,92 +1,169 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
export {};
|
|
2
|
+
// import { useSignAndExecuteTransaction } from "./useSignAndExecuteTransaction.js";
|
|
3
|
+
// import {
|
|
4
|
+
// commitProof,
|
|
5
|
+
// revealAndVerifyProof,
|
|
6
|
+
// } from "../_generated/zing_identity/reclaim.js";
|
|
7
|
+
// import { useZingClient } from "../components/zing-provider.js";
|
|
8
|
+
// import {
|
|
9
|
+
// hexToBytes,
|
|
10
|
+
// textToBytes,
|
|
11
|
+
// generateCommitmentHash,
|
|
12
|
+
// generateCommitNonce,
|
|
13
|
+
// } from "../lib/utils/reclaim.js";
|
|
14
|
+
// import { bcs } from "@mysten/sui/bcs";
|
|
15
|
+
// import { Transaction } from "@mysten/sui/transactions";
|
|
16
|
+
// import { useMutation } from "@tanstack/react-query";
|
|
17
|
+
// import sha3 from "js-sha3";
|
|
18
|
+
// import type { PlatformType } from "../config/common.js";
|
|
19
|
+
// import type { ReclaimProof } from "../lib/utils/reclaim.js";
|
|
20
|
+
// import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
21
|
+
//
|
|
22
|
+
// interface CommitProofParams {
|
|
23
|
+
// suiClient: SuiGrpcClient;
|
|
24
|
+
// walletAddress: string;
|
|
25
|
+
// platform: PlatformType;
|
|
26
|
+
// proof: ReclaimProof;
|
|
27
|
+
// }
|
|
28
|
+
//
|
|
29
|
+
// export function useCommitProof() {
|
|
30
|
+
// const { mutateAsync: signAndExecuteTransaction } =
|
|
31
|
+
// useSignAndExecuteTransaction();
|
|
32
|
+
// const zingClient = useZingClient();
|
|
33
|
+
// const config = zingClient.config;
|
|
34
|
+
//
|
|
35
|
+
// return useMutation({
|
|
36
|
+
// mutationFn: async ({
|
|
37
|
+
// suiClient,
|
|
38
|
+
// walletAddress,
|
|
39
|
+
// platform,
|
|
40
|
+
// proof,
|
|
41
|
+
// }: CommitProofParams) => {
|
|
42
|
+
// const nonce = generateCommitNonce(walletAddress, proof.identifier);
|
|
43
|
+
// const commitmentHash = generateCommitmentHash(proof, nonce);
|
|
44
|
+
// const identifierHash = hexToBytes(
|
|
45
|
+
// sha3.keccak256(textToBytes(proof.identifier)),
|
|
46
|
+
// );
|
|
47
|
+
//
|
|
48
|
+
// const identityPlatform = config.zing.IDENTITY_PLATFORMS[platform];
|
|
49
|
+
// const commitProofTransaction = new Transaction();
|
|
50
|
+
//
|
|
51
|
+
// commitProofTransaction.add(
|
|
52
|
+
// commitProof({
|
|
53
|
+
// package: config.zing.ZING_IDENTITY_PACKAGE_ADDRESS,
|
|
54
|
+
// typeArguments: [identityPlatform.PLATFORM_TYPE],
|
|
55
|
+
// arguments: {
|
|
56
|
+
// self: commitProofTransaction.sharedObjectRef(
|
|
57
|
+
// identityPlatform.RECLAIM_MANAGER_SHARED_OBJECT_REF,
|
|
58
|
+
// ),
|
|
59
|
+
// config: commitProofTransaction.sharedObjectRef(
|
|
60
|
+
// config.zing.ZING_IDENTITY_CONFIG_SHARED_OBJECT_REF,
|
|
61
|
+
// ),
|
|
62
|
+
// commitmentHash: commitProofTransaction.pure(
|
|
63
|
+
// bcs.vector(bcs.u8()).serialize(commitmentHash),
|
|
64
|
+
// ),
|
|
65
|
+
// identifierHash: commitProofTransaction.pure(
|
|
66
|
+
// bcs.vector(bcs.u8()).serialize(identifierHash),
|
|
67
|
+
// ),
|
|
68
|
+
// },
|
|
69
|
+
// }),
|
|
70
|
+
// );
|
|
71
|
+
//
|
|
72
|
+
// const commitTransactionResponse = await signAndExecuteTransaction({
|
|
73
|
+
// transaction: commitProofTransaction,
|
|
74
|
+
// });
|
|
75
|
+
// if (!commitTransactionResponse) throw new Error("fail to commit proof");
|
|
76
|
+
//
|
|
77
|
+
// const settledCommitTransactionResult = await suiClient.waitForTransaction(
|
|
78
|
+
// {
|
|
79
|
+
// digest: commitTransactionResponse.transactionDigest,
|
|
80
|
+
// include: {
|
|
81
|
+
// effects: true,
|
|
82
|
+
// objectTypes: true,
|
|
83
|
+
// },
|
|
84
|
+
// },
|
|
85
|
+
// );
|
|
86
|
+
//
|
|
87
|
+
// const commitTransactionObjectChanges =
|
|
88
|
+
// settledCommitTransactionResult.Transaction?.effects.changedObjects ||
|
|
89
|
+
// [];
|
|
90
|
+
//
|
|
91
|
+
// if (!commitTransactionObjectChanges)
|
|
92
|
+
// throw new Error("fail to commit proof");
|
|
93
|
+
//
|
|
94
|
+
// const commitment = commitTransactionObjectChanges.find((objChange) => {
|
|
95
|
+
// if (objChange.idOperation !== "Created") return false;
|
|
96
|
+
// const type =
|
|
97
|
+
// settledCommitTransactionResult.Transaction?.objectTypes![
|
|
98
|
+
// objChange.objectId
|
|
99
|
+
// ];
|
|
100
|
+
// return type === config.zing.PROOF_COMMITMENT_TYPE;
|
|
101
|
+
// });
|
|
102
|
+
//
|
|
103
|
+
// if (!commitment || commitment.idOperation !== "Created")
|
|
104
|
+
// throw new Error("fail to commit proof");
|
|
105
|
+
//
|
|
106
|
+
// const revealTransaction = new Transaction();
|
|
107
|
+
//
|
|
108
|
+
// const [, proofObj] = revealTransaction.add(
|
|
109
|
+
// revealAndVerifyProof({
|
|
110
|
+
// package: config.zing.ZING_IDENTITY_PACKAGE_ADDRESS,
|
|
111
|
+
// typeArguments: [identityPlatform.PLATFORM_TYPE],
|
|
112
|
+
// arguments: {
|
|
113
|
+
// self: revealTransaction.sharedObjectRef(
|
|
114
|
+
// identityPlatform.RECLAIM_MANAGER_SHARED_OBJECT_REF,
|
|
115
|
+
// ),
|
|
116
|
+
// config: revealTransaction.sharedObjectRef(
|
|
117
|
+
// config.zing.ZING_IDENTITY_CONFIG_SHARED_OBJECT_REF,
|
|
118
|
+
// ),
|
|
119
|
+
// commitmentId: revealTransaction.pure.id(commitment.objectId),
|
|
120
|
+
// provider: revealTransaction.pure.string(proof.claimData.provider),
|
|
121
|
+
// parameters: revealTransaction.pure.string(
|
|
122
|
+
// proof.claimData.parameters,
|
|
123
|
+
// ),
|
|
124
|
+
// context: revealTransaction.pure.string(proof.claimData.context),
|
|
125
|
+
// identifier: revealTransaction.pure.string(
|
|
126
|
+
// proof.claimData.identifier,
|
|
127
|
+
// ),
|
|
128
|
+
// owner: revealTransaction.pure.string(proof.claimData.owner),
|
|
129
|
+
// epoch: revealTransaction.pure.string(
|
|
130
|
+
// proof.claimData.epoch.toString(),
|
|
131
|
+
// ),
|
|
132
|
+
// timestampS: revealTransaction.pure.u64(proof.claimData.timestampS),
|
|
133
|
+
// signatures: revealTransaction.pure(
|
|
134
|
+
// bcs
|
|
135
|
+
// .vector(bcs.vector(bcs.u8()))
|
|
136
|
+
// .serialize(
|
|
137
|
+
// proof.signatures.map((sig) => hexToBytes(sig.substring(2))),
|
|
138
|
+
// ),
|
|
139
|
+
// ),
|
|
140
|
+
// nonce: revealTransaction.pure(
|
|
141
|
+
// bcs.vector(bcs.u8()).serialize(nonce),
|
|
142
|
+
// ),
|
|
143
|
+
// },
|
|
144
|
+
// }),
|
|
145
|
+
// );
|
|
146
|
+
//
|
|
147
|
+
// // Call extract parameters customizaed functions; this interface should identical for different platforms
|
|
148
|
+
// revealTransaction.moveCall({
|
|
149
|
+
// target: identityPlatform.PLATFORM_UPDATE_PROOF_TARGET,
|
|
150
|
+
// arguments: [
|
|
151
|
+
// // IdentityManager
|
|
152
|
+
// revealTransaction.sharedObjectRef(
|
|
153
|
+
// identityPlatform.IDENTITY_MANAGER_SHARED_OBJECT_REF,
|
|
154
|
+
// ),
|
|
155
|
+
// // IdentityConfig
|
|
156
|
+
// revealTransaction.sharedObjectRef(
|
|
157
|
+
// config.zing.ZING_IDENTITY_CONFIG_SHARED_OBJECT_REF,
|
|
158
|
+
// ),
|
|
159
|
+
// proofObj,
|
|
160
|
+
// ],
|
|
161
|
+
// });
|
|
162
|
+
//
|
|
163
|
+
// const transactionResponse = await signAndExecuteTransaction({
|
|
164
|
+
// transaction: revealTransaction,
|
|
165
|
+
// });
|
|
166
|
+
// return transactionResponse;
|
|
167
|
+
// },
|
|
168
|
+
// });
|
|
169
|
+
// }
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useWalletStore } from "../components/wallet-provider.js";
|
|
2
2
|
import { signAndExecuteGasPoolTransaction } from "../mutations/signer.js";
|
|
3
|
+
import { SUI_DECIMALS } from "@mysten/sui/utils";
|
|
3
4
|
import { useMutation } from "@tanstack/react-query";
|
|
4
5
|
const GAS_POOL_OWNER = "0x3198c7da350bf15c48fc598e5b03a0b6e13356801c71b4d1a18b92b09966e5da";
|
|
6
|
+
const GAS_BUDGET = 0.2 * 10 ** SUI_DECIMALS;
|
|
5
7
|
export const useSignAndExecuteTransaction = () => {
|
|
6
8
|
const getSigner = useWalletStore((s) => s.getSigner);
|
|
7
9
|
const suiClient = useWalletStore((s) => s.suiClient);
|
|
@@ -18,6 +20,7 @@ export const useSignAndExecuteTransaction = () => {
|
|
|
18
20
|
// for Debug usage
|
|
19
21
|
transaction.setSender(signer.suiAddress);
|
|
20
22
|
transaction.setGasOwner(GAS_POOL_OWNER);
|
|
23
|
+
transaction.setGasBudget(GAS_BUDGET);
|
|
21
24
|
const dryRunResponse = await suiClient.simulateTransaction({
|
|
22
25
|
transaction: await transaction.build({ client: suiClient }),
|
|
23
26
|
include: {
|
|
@@ -26,7 +29,7 @@ export const useSignAndExecuteTransaction = () => {
|
|
|
26
29
|
});
|
|
27
30
|
console.log({ dryRunResponse });
|
|
28
31
|
if (dryRunResponse.Transaction?.effects.status.success) {
|
|
29
|
-
const effects = await signAndExecuteGasPoolTransaction(saltServerUrl, signer, suiClient, transaction);
|
|
32
|
+
const effects = await signAndExecuteGasPoolTransaction(saltServerUrl, signer, suiClient, transaction, GAS_BUDGET);
|
|
30
33
|
// TODO: handle error message by code
|
|
31
34
|
if (!effects)
|
|
32
35
|
throw new Error("fail to get Transaction Effects");
|
|
@@ -13,26 +13,20 @@ declare const zingInfiniteQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
13
13
|
}>;
|
|
14
14
|
getWorks: (owner: string, workType?: import("../index.js").WorkType, cursor?: string, limit?: number) => Promise<{
|
|
15
15
|
data: {
|
|
16
|
-
id:
|
|
17
|
-
id: string;
|
|
18
|
-
};
|
|
16
|
+
id: string;
|
|
19
17
|
owner: string;
|
|
20
18
|
deleted: boolean;
|
|
21
19
|
created_at: string;
|
|
22
20
|
subscription_level: number | null;
|
|
23
21
|
blobs: {
|
|
24
|
-
id:
|
|
25
|
-
id: string;
|
|
26
|
-
};
|
|
22
|
+
id: string;
|
|
27
23
|
registered_epoch: number;
|
|
28
24
|
blob_id: string;
|
|
29
25
|
size: string;
|
|
30
26
|
encoding_type: number;
|
|
31
27
|
certified_epoch: number | null;
|
|
32
28
|
storage: {
|
|
33
|
-
id:
|
|
34
|
-
id: string;
|
|
35
|
-
};
|
|
29
|
+
id: string;
|
|
36
30
|
start_epoch: number;
|
|
37
31
|
end_epoch: number;
|
|
38
32
|
storage_size: string;
|
|
@@ -12,6 +12,7 @@ export function useZingInfiniteQuery(input, options = {}, memo = []) {
|
|
|
12
12
|
const methodMap = zingInfiniteQueryMethodMap(zingClient);
|
|
13
13
|
const { method, params, limit = 20 } = input;
|
|
14
14
|
return useInfiniteQuery({
|
|
15
|
+
// eslint-disable-next-line @tanstack/query/exhaustive-deps
|
|
15
16
|
queryKey: [zingClient.network, method, memo],
|
|
16
17
|
queryFn: async ({ pageParam }) => {
|
|
17
18
|
const fn = methodMap[method];
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { ZingClient } from "../client/index.js";
|
|
2
2
|
import type { UseQueryOptions } from "@tanstack/react-query";
|
|
3
3
|
declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
4
|
-
getIdentifierByAddress: (platform: import("../index.js").PlatformType, address: string) => Promise<string | null>;
|
|
5
|
-
getIdentifierInfoByIdentifier: (platform: import("../index.js").PlatformType, identifier: string) => Promise<{
|
|
6
|
-
owner: string;
|
|
7
|
-
updated_at: string;
|
|
8
|
-
} | null>;
|
|
9
4
|
getStudio: (owner: string) => Promise<{
|
|
10
|
-
id:
|
|
11
|
-
id: string;
|
|
12
|
-
};
|
|
5
|
+
id: string;
|
|
13
6
|
owner: string;
|
|
14
|
-
period: string
|
|
7
|
+
period: [string, string];
|
|
15
8
|
monthly_subscription_fee: {
|
|
16
9
|
contents: {
|
|
17
10
|
key: number;
|
|
@@ -19,15 +12,11 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
19
12
|
}[];
|
|
20
13
|
};
|
|
21
14
|
membership: {
|
|
22
|
-
id:
|
|
23
|
-
id: string;
|
|
24
|
-
};
|
|
15
|
+
id: string;
|
|
25
16
|
size: string;
|
|
26
17
|
};
|
|
27
18
|
works: {
|
|
28
|
-
id:
|
|
29
|
-
id: string;
|
|
30
|
-
};
|
|
19
|
+
id: string;
|
|
31
20
|
size: string;
|
|
32
21
|
};
|
|
33
22
|
encrypted_file_key: number[] | null;
|
|
@@ -39,9 +28,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
39
28
|
};
|
|
40
29
|
} | null>;
|
|
41
30
|
getStorageSpace: (owner: string) => Promise<{
|
|
42
|
-
id:
|
|
43
|
-
id: string;
|
|
44
|
-
};
|
|
31
|
+
id: string;
|
|
45
32
|
owner: string;
|
|
46
33
|
tier: number | null;
|
|
47
34
|
storage_used: {
|
|
@@ -57,9 +44,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
57
44
|
};
|
|
58
45
|
} | null>;
|
|
59
46
|
getStorageTreasury: () => Promise<{
|
|
60
|
-
id:
|
|
61
|
-
id: string;
|
|
62
|
-
};
|
|
47
|
+
id: string;
|
|
63
48
|
tier_plan: {
|
|
64
49
|
contents: {
|
|
65
50
|
key: number;
|
|
@@ -74,9 +59,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
74
59
|
contents: {
|
|
75
60
|
key: number;
|
|
76
61
|
value: {
|
|
77
|
-
id:
|
|
78
|
-
id: string;
|
|
79
|
-
};
|
|
62
|
+
id: string;
|
|
80
63
|
start_epoch: number;
|
|
81
64
|
end_epoch: number;
|
|
82
65
|
storage_size: string;
|
|
@@ -90,9 +73,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
90
73
|
}[];
|
|
91
74
|
};
|
|
92
75
|
wal_treasury: {
|
|
93
|
-
id:
|
|
94
|
-
id: string;
|
|
95
|
-
};
|
|
76
|
+
id: string;
|
|
96
77
|
balance: {
|
|
97
78
|
value: string;
|
|
98
79
|
};
|
|
@@ -4,8 +4,6 @@ import { useQueries } from "@tanstack/react-query";
|
|
|
4
4
|
// Method map (shared with useZingQuery)
|
|
5
5
|
// ---------------------------------------------
|
|
6
6
|
const zingQueryMethodMap = (zingClient) => ({
|
|
7
|
-
getIdentifierByAddress: zingClient.getIdentifierByAddress.bind(zingClient),
|
|
8
|
-
getIdentifierInfoByIdentifier: zingClient.getIdentifierInfoByIdentifier.bind(zingClient),
|
|
9
7
|
getStudio: zingClient.getStudio.bind(zingClient),
|
|
10
8
|
getStorageSpace: zingClient.getStorageSpace.bind(zingClient),
|
|
11
9
|
getStorageTreasury: zingClient.getStorageTreasury.bind(zingClient),
|
|
@@ -21,6 +19,7 @@ export function useZingQueries(options) {
|
|
|
21
19
|
const queryConfigs = options.queries.map((queryConfig) => {
|
|
22
20
|
const { method, params, ...queryOptions } = queryConfig;
|
|
23
21
|
return {
|
|
22
|
+
// eslint-disable-next-line @tanstack/query/exhaustive-deps
|
|
24
23
|
queryKey: [zingClient.network, method, params],
|
|
25
24
|
queryFn: async () => {
|
|
26
25
|
const fn = methodMap[method];
|
|
@@ -2,17 +2,10 @@ import type { ZingClient } from "../client/index.js";
|
|
|
2
2
|
import type { SuiNetwork } from "../types.js";
|
|
3
3
|
import type { UseQueryOptions } from "@tanstack/react-query";
|
|
4
4
|
declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
5
|
-
getIdentifierByAddress: (platform: import("../index.js").PlatformType, address: string) => Promise<string | null>;
|
|
6
|
-
getIdentifierInfoByIdentifier: (platform: import("../index.js").PlatformType, identifier: string) => Promise<{
|
|
7
|
-
owner: string;
|
|
8
|
-
updated_at: string;
|
|
9
|
-
} | null>;
|
|
10
5
|
getStudio: (owner: string) => Promise<{
|
|
11
|
-
id:
|
|
12
|
-
id: string;
|
|
13
|
-
};
|
|
6
|
+
id: string;
|
|
14
7
|
owner: string;
|
|
15
|
-
period: string
|
|
8
|
+
period: [string, string];
|
|
16
9
|
monthly_subscription_fee: {
|
|
17
10
|
contents: {
|
|
18
11
|
key: number;
|
|
@@ -20,15 +13,11 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
20
13
|
}[];
|
|
21
14
|
};
|
|
22
15
|
membership: {
|
|
23
|
-
id:
|
|
24
|
-
id: string;
|
|
25
|
-
};
|
|
16
|
+
id: string;
|
|
26
17
|
size: string;
|
|
27
18
|
};
|
|
28
19
|
works: {
|
|
29
|
-
id:
|
|
30
|
-
id: string;
|
|
31
|
-
};
|
|
20
|
+
id: string;
|
|
32
21
|
size: string;
|
|
33
22
|
};
|
|
34
23
|
encrypted_file_key: number[] | null;
|
|
@@ -40,9 +29,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
40
29
|
};
|
|
41
30
|
} | null>;
|
|
42
31
|
getStorageSpace: (owner: string) => Promise<{
|
|
43
|
-
id:
|
|
44
|
-
id: string;
|
|
45
|
-
};
|
|
32
|
+
id: string;
|
|
46
33
|
owner: string;
|
|
47
34
|
tier: number | null;
|
|
48
35
|
storage_used: {
|
|
@@ -58,9 +45,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
58
45
|
};
|
|
59
46
|
} | null>;
|
|
60
47
|
getStorageTreasury: () => Promise<{
|
|
61
|
-
id:
|
|
62
|
-
id: string;
|
|
63
|
-
};
|
|
48
|
+
id: string;
|
|
64
49
|
tier_plan: {
|
|
65
50
|
contents: {
|
|
66
51
|
key: number;
|
|
@@ -75,9 +60,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
75
60
|
contents: {
|
|
76
61
|
key: number;
|
|
77
62
|
value: {
|
|
78
|
-
id:
|
|
79
|
-
id: string;
|
|
80
|
-
};
|
|
63
|
+
id: string;
|
|
81
64
|
start_epoch: number;
|
|
82
65
|
end_epoch: number;
|
|
83
66
|
storage_size: string;
|
|
@@ -91,9 +74,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
91
74
|
}[];
|
|
92
75
|
};
|
|
93
76
|
wal_treasury: {
|
|
94
|
-
id:
|
|
95
|
-
id: string;
|
|
96
|
-
};
|
|
77
|
+
id: string;
|
|
97
78
|
balance: {
|
|
98
79
|
value: string;
|
|
99
80
|
};
|
|
@@ -119,26 +100,20 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
|
|
|
119
100
|
} | null>;
|
|
120
101
|
getBalance: (owner: string, coinSymbol: import("../index.js").CoinSymbol) => Promise<import("node_modules/@mysten/sui/dist/grpc/proto/sui/rpc/v2/state_service.mjs").GetBalanceResponse>;
|
|
121
102
|
getWork: (workId: string, workType?: import("../index.js").WorkType) => Promise<{
|
|
122
|
-
id:
|
|
123
|
-
id: string;
|
|
124
|
-
};
|
|
103
|
+
id: string;
|
|
125
104
|
owner: string;
|
|
126
105
|
deleted: boolean;
|
|
127
106
|
created_at: string;
|
|
128
107
|
subscription_level: number | null;
|
|
129
108
|
blobs: {
|
|
130
|
-
id:
|
|
131
|
-
id: string;
|
|
132
|
-
};
|
|
109
|
+
id: string;
|
|
133
110
|
registered_epoch: number;
|
|
134
111
|
blob_id: string;
|
|
135
112
|
size: string;
|
|
136
113
|
encoding_type: number;
|
|
137
114
|
certified_epoch: number | null;
|
|
138
115
|
storage: {
|
|
139
|
-
id:
|
|
140
|
-
id: string;
|
|
141
|
-
};
|
|
116
|
+
id: string;
|
|
142
117
|
start_epoch: number;
|
|
143
118
|
end_epoch: number;
|
|
144
119
|
storage_size: string;
|
|
@@ -4,8 +4,6 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
4
4
|
// Method map
|
|
5
5
|
// ---------------------------------------------
|
|
6
6
|
const zingQueryMethodMap = (zingClient) => ({
|
|
7
|
-
getIdentifierByAddress: zingClient.getIdentifierByAddress.bind(zingClient),
|
|
8
|
-
getIdentifierInfoByIdentifier: zingClient.getIdentifierInfoByIdentifier.bind(zingClient),
|
|
9
7
|
getStudio: zingClient.getStudio.bind(zingClient),
|
|
10
8
|
getStorageSpace: zingClient.getStorageSpace.bind(zingClient),
|
|
11
9
|
getStorageTreasury: zingClient.getStorageTreasury.bind(zingClient),
|
|
@@ -22,6 +20,7 @@ export function useZingQuery(input, options = {}, memo = []) {
|
|
|
22
20
|
const methodMap = zingQueryMethodMap(zingClient);
|
|
23
21
|
const { method, params } = input;
|
|
24
22
|
return useQuery({
|
|
23
|
+
// eslint-disable-next-line @tanstack/query/exhaustive-deps
|
|
25
24
|
queryKey: [zingClient.network, method, memo],
|
|
26
25
|
gcTime: options.gcTime,
|
|
27
26
|
staleTime: options.staleTime,
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
3
|
-
export declare function textToBytes(text: string): Uint8Array;
|
|
4
|
-
export declare function bytesToText(bytes: Uint8Array): string;
|
|
5
|
-
export declare function startVerification({ reclaimAppId, reclaimAppSecret, reclaimProviderId, }: {
|
|
6
|
-
reclaimAppId: string;
|
|
7
|
-
reclaimAppSecret: string;
|
|
8
|
-
reclaimProviderId: string;
|
|
9
|
-
}): Promise<unknown>;
|
|
10
|
-
export declare function generateCommitNonce(userAddress: string, claimIdentifier: string): number[];
|
|
11
|
-
export declare function generateCommitmentHash(proof: ReclaimProof, nonce: number[]): Uint8Array<ArrayBufferLike>;
|
|
12
|
-
export type ReclaimProof = {
|
|
13
|
-
identifier: string;
|
|
14
|
-
claimData: {
|
|
15
|
-
provider: string;
|
|
16
|
-
parameters: string;
|
|
17
|
-
owner: string;
|
|
18
|
-
timestampS: number;
|
|
19
|
-
context: string;
|
|
20
|
-
identifier: string;
|
|
21
|
-
epoch: number;
|
|
22
|
-
};
|
|
23
|
-
signatures: string[];
|
|
24
|
-
witnesses: {
|
|
25
|
-
id: string;
|
|
26
|
-
url: string;
|
|
27
|
-
}[];
|
|
28
|
-
publicData: string | null;
|
|
29
|
-
};
|
|
1
|
+
export {};
|