@zing-protocol/zing-sdk 0.0.16 → 0.0.17
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/client/index.d.ts
CHANGED
|
@@ -5,16 +5,19 @@ import type { CoinSymbol, PlatformType, WorkType } from "../config/index.js";
|
|
|
5
5
|
import type { Config } from "../config/types.js";
|
|
6
6
|
import type { SuiNetwork, ZKLoginSignerState } from "../types.js";
|
|
7
7
|
import type { SealClient } from "@mysten/seal";
|
|
8
|
+
import type { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
8
9
|
import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
9
10
|
interface Params {
|
|
10
11
|
network: SuiNetwork;
|
|
11
12
|
suiGrpcClient: SuiGrpcClient;
|
|
13
|
+
suiGraphQLClient: SuiGraphQLClient;
|
|
12
14
|
}
|
|
13
15
|
export declare class ZingClient {
|
|
14
16
|
suiGrpcClient: SuiGrpcClient;
|
|
17
|
+
suiGraphQLClient: SuiGraphQLClient;
|
|
15
18
|
network: SuiNetwork;
|
|
16
19
|
config: Config;
|
|
17
|
-
constructor({ network, suiGrpcClient }: Params);
|
|
20
|
+
constructor({ network, suiGraphQLClient, suiGrpcClient }: Params);
|
|
18
21
|
getConfig(): Config;
|
|
19
22
|
getDerivedStudioID(address: string): string;
|
|
20
23
|
getDerivedStorageID(address: string): string;
|
package/dist/client/index.js
CHANGED
|
@@ -11,8 +11,9 @@ import { SessionKey } from "@mysten/seal";
|
|
|
11
11
|
import { Transaction, coinWithBalance } from "@mysten/sui/transactions";
|
|
12
12
|
import { fromHex } from "@mysten/sui/utils";
|
|
13
13
|
export class ZingClient {
|
|
14
|
-
constructor({ network, suiGrpcClient }) {
|
|
14
|
+
constructor({ network, suiGraphQLClient, suiGrpcClient }) {
|
|
15
15
|
this.suiGrpcClient = suiGrpcClient;
|
|
16
|
+
this.suiGraphQLClient = suiGraphQLClient;
|
|
16
17
|
this.network = network || "testnet";
|
|
17
18
|
this.config = getConfig(network);
|
|
18
19
|
}
|
|
@@ -111,7 +112,7 @@ export class ZingClient {
|
|
|
111
112
|
address: owner,
|
|
112
113
|
packageId: this.config.zing.ZING_STUDIO_V0_PACKAGE_ADDRESS,
|
|
113
114
|
ttlMin: 10,
|
|
114
|
-
suiClient: this.
|
|
115
|
+
suiClient: this.suiGraphQLClient,
|
|
115
116
|
});
|
|
116
117
|
const message = sessionKey.getPersonalMessage();
|
|
117
118
|
const { zkLoginSignature } = await signPersonalMessage(saltServerUrl, signer, message);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ZingClient } from "../client/index.js";
|
|
2
2
|
import type { SuiNetwork } from "../types.js";
|
|
3
|
+
import type { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
3
4
|
import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
4
5
|
import type { ReactNode } from "react";
|
|
5
6
|
interface ZingClientProviderProps {
|
|
6
7
|
network: SuiNetwork;
|
|
7
8
|
suiGrpcClient: SuiGrpcClient;
|
|
9
|
+
suiGraphQLClient: SuiGraphQLClient;
|
|
8
10
|
children: ReactNode;
|
|
9
11
|
}
|
|
10
12
|
export declare const ZingClientProvider: React.FC<ZingClientProviderProps>;
|
|
@@ -4,11 +4,12 @@ import { createContext, useContext, useMemo } from "react";
|
|
|
4
4
|
const ZingClientContext = createContext({
|
|
5
5
|
client: null,
|
|
6
6
|
});
|
|
7
|
-
export const ZingClientProvider = ({ network, suiGrpcClient, children, }) => {
|
|
7
|
+
export const ZingClientProvider = ({ network, suiGrpcClient, suiGraphQLClient, children, }) => {
|
|
8
8
|
const client = useMemo(() => new ZingClient({
|
|
9
9
|
network,
|
|
10
10
|
suiGrpcClient,
|
|
11
|
-
|
|
11
|
+
suiGraphQLClient,
|
|
12
|
+
}), [network, suiGrpcClient, suiGraphQLClient]);
|
|
12
13
|
return (_jsx(ZingClientContext.Provider, { value: { client }, children: children }));
|
|
13
14
|
};
|
|
14
15
|
export const useZingClient = () => {
|