@zing-protocol/zing-sdk 0.0.1 → 0.0.2
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.js +6 -0
- package/dist/_generated/utils/index.d.ts +12 -0
- package/dist/_generated/utils/index.js +135 -0
- package/dist/_generated/zing_framework/coin_utils.d.ts +15 -0
- package/dist/_generated/zing_framework/coin_utils.js +19 -0
- package/dist/_generated/zing_framework/deps/sui/object.d.ts +8 -0
- package/{src/_generated/zing_governance/deps/sui/object.ts → dist/_generated/zing_framework/deps/sui/object.js} +4 -7
- package/dist/_generated/zing_framework/derived_object_bag.d.ts +166 -0
- package/dist/_generated/zing_framework/derived_object_bag.js +221 -0
- package/dist/_generated/zing_framework/derived_table.d.ts +153 -0
- package/dist/_generated/zing_framework/derived_table.js +200 -0
- package/dist/_generated/zing_governance/admin.d.ts +20 -0
- package/dist/_generated/zing_governance/admin.js +26 -0
- package/dist/_generated/zing_governance/deps/sui/object.d.ts +8 -0
- package/{src/_generated/zing_identity/deps/sui/object.ts → dist/_generated/zing_governance/deps/sui/object.js} +4 -7
- package/dist/_generated/zing_governance/treasury.d.ts +56 -0
- package/dist/_generated/zing_governance/treasury.js +78 -0
- package/dist/_generated/zing_identity/config.d.ts +87 -0
- package/dist/_generated/zing_identity/config.js +98 -0
- package/{src/_generated/zing_studio/deps/std/type_name.ts → dist/_generated/zing_identity/deps/std/type_name.d.ts} +3 -11
- package/dist/_generated/zing_identity/deps/std/type_name.js +22 -0
- package/dist/_generated/zing_identity/deps/sui/object.d.ts +8 -0
- package/{src/_generated/zing_studio/deps/sui/object.ts → dist/_generated/zing_identity/deps/sui/object.js} +4 -7
- package/dist/_generated/zing_identity/deps/sui/object_table.d.ts +12 -0
- package/{src/_generated/zing_identity/deps/sui/object_table.ts → dist/_generated/zing_identity/deps/sui/object_table.js} +7 -10
- package/dist/_generated/zing_identity/deps/sui/table.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/sui/table.ts → dist/_generated/zing_identity/deps/sui/table.js} +7 -10
- package/{src/_generated/zing_identity/deps/sui/vec_set.ts → dist/_generated/zing_identity/deps/sui/vec_set.d.ts} +3 -14
- package/dist/_generated/zing_identity/deps/sui/vec_set.js +22 -0
- package/dist/_generated/zing_identity/ecdsa.d.ts +81 -0
- package/dist/_generated/zing_identity/ecdsa.js +87 -0
- package/dist/_generated/zing_identity/identity.d.ts +262 -0
- package/dist/_generated/zing_identity/identity.js +294 -0
- package/dist/_generated/zing_identity/reclaim.d.ts +356 -0
- package/dist/_generated/zing_identity/reclaim.js +414 -0
- package/dist/_generated/zing_studio/app.d.ts +351 -0
- package/dist/_generated/zing_studio/app.js +451 -0
- package/dist/_generated/zing_studio/article.d.ts +331 -0
- package/dist/_generated/zing_studio/article.js +331 -0
- package/dist/_generated/zing_studio/config.d.ts +203 -0
- package/dist/_generated/zing_studio/config.js +233 -0
- package/{src/_generated/zing_identity/deps/std/type_name.ts → dist/_generated/zing_studio/deps/std/type_name.d.ts} +3 -11
- package/dist/_generated/zing_studio/deps/std/type_name.js +22 -0
- package/dist/_generated/zing_studio/deps/sui/bag.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/sui/bag.ts → dist/_generated/zing_studio/deps/sui/bag.js} +7 -10
- package/dist/_generated/zing_studio/deps/sui/balance.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/sui/balance.ts → dist/_generated/zing_studio/deps/sui/balance.js} +4 -7
- package/dist/_generated/zing_studio/deps/sui/coin.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/sui/coin.ts → dist/_generated/zing_studio/deps/sui/coin.js} +5 -8
- package/dist/_generated/zing_studio/deps/sui/dynamic_field.d.ts +126 -0
- package/dist/_generated/zing_studio/deps/sui/dynamic_field.js +140 -0
- package/dist/_generated/zing_studio/deps/sui/object.d.ts +8 -0
- package/{src/_generated/zing_framework/deps/sui/object.ts → dist/_generated/zing_studio/deps/sui/object.js} +4 -7
- package/dist/_generated/zing_studio/deps/sui/table.d.ts +12 -0
- package/{src/_generated/zing_identity/deps/sui/table.ts → dist/_generated/zing_studio/deps/sui/table.js} +7 -10
- package/dist/_generated/zing_studio/deps/sui/vec_map.d.ts +30 -0
- package/{src/_generated/zing_studio/deps/sui/vec_map.ts → dist/_generated/zing_studio/deps/sui/vec_map.js} +15 -21
- package/{src/_generated/zing_studio/deps/sui/vec_set.ts → dist/_generated/zing_studio/deps/sui/vec_set.d.ts} +3 -14
- package/dist/_generated/zing_studio/deps/sui/vec_set.js +22 -0
- package/dist/_generated/zing_studio/deps/walrus/blob.d.ts +20 -0
- package/{src/_generated/zing_studio/deps/walrus/blob.ts → dist/_generated/zing_studio/deps/walrus/blob.js} +11 -12
- package/dist/_generated/zing_studio/deps/walrus/events.d.ts +83 -0
- package/dist/_generated/zing_studio/deps/walrus/events.js +122 -0
- package/dist/_generated/zing_studio/deps/walrus/metadata.d.ts +71 -0
- package/dist/_generated/zing_studio/deps/walrus/metadata.js +73 -0
- package/dist/_generated/zing_studio/deps/walrus/storage_resource.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/walrus/storage_resource.ts → dist/_generated/zing_studio/deps/walrus/storage_resource.js} +7 -8
- package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/zing_framework/derived_object_bag.ts → dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.js} +7 -8
- package/dist/_generated/zing_studio/deps/zing_framework/derived_table.d.ts +12 -0
- package/{src/_generated/zing_studio/deps/zing_framework/derived_table.ts → dist/_generated/zing_studio/deps/zing_framework/derived_table.js} +7 -8
- package/dist/_generated/zing_studio/donation.d.ts +24 -0
- package/{src/_generated/zing_studio/donation.ts → dist/_generated/zing_studio/donation.js} +7 -8
- package/dist/_generated/zing_studio/enclave.d.ts +187 -0
- package/dist/_generated/zing_studio/enclave.js +231 -0
- package/dist/_generated/zing_studio/nitro_attestation.d.ts +148 -0
- package/dist/_generated/zing_studio/nitro_attestation.js +183 -0
- package/dist/_generated/zing_studio/referral.d.ts +166 -0
- package/dist/_generated/zing_studio/referral.js +224 -0
- package/dist/_generated/zing_studio/storage.d.ts +327 -0
- package/dist/_generated/zing_studio/storage.js +365 -0
- package/dist/_generated/zing_studio/studio.d.ts +282 -0
- package/dist/_generated/zing_studio/studio.js +360 -0
- package/dist/bcs.d.ts +61 -0
- package/dist/bcs.js +109 -0
- package/dist/client/index.d.ts +228 -0
- package/dist/client/index.js +296 -0
- package/dist/client/types.d.ts +23 -0
- package/dist/client/types.js +1 -0
- package/dist/components/index.js +3 -0
- package/dist/components/wallet-provider.d.ts +7 -0
- package/dist/components/wallet-provider.js +33 -0
- package/dist/components/walrus-provider.d.ts +31 -0
- package/dist/components/walrus-provider.js +71 -0
- package/dist/components/zing-provider.d.ts +15 -0
- package/dist/components/zing-provider.js +22 -0
- package/dist/config/common.d.ts +23 -0
- package/dist/config/common.js +61 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +28 -0
- package/dist/config/mainnet.d.ts +6 -0
- package/dist/config/mainnet.js +80 -0
- package/dist/config/testnet.d.ts +6 -0
- package/dist/config/testnet.js +81 -0
- package/dist/config/types.d.ts +49 -0
- package/dist/config/types.js +1 -0
- package/dist/const.d.ts +4 -0
- package/dist/const.js +25 -0
- package/dist/getters.d.ts +228 -0
- package/dist/getters.js +317 -0
- package/{src/hooks/index.ts → dist/hooks/index.d.ts} +2 -3
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useGetStudio.d.ts +26 -0
- package/dist/hooks/useGetStudio.js +17 -0
- package/dist/hooks/useGetTierPlan.d.ts +7 -0
- package/dist/hooks/useGetTierPlan.js +85 -0
- package/dist/hooks/useReclaim.d.ts +12 -0
- package/dist/hooks/useReclaim.js +87 -0
- package/dist/hooks/useSignAndExecuteTransaction.d.ts +6 -0
- package/dist/hooks/useSignAndExecuteTransaction.js +40 -0
- package/dist/hooks/useSignPersonalMessage.d.ts +8 -0
- package/dist/hooks/useSignPersonalMessage.js +21 -0
- package/dist/hooks/useZingInfiniteQueries.d.ts +75 -0
- package/dist/hooks/useZingInfiniteQueries.js +28 -0
- package/dist/hooks/useZingMutation.d.ts +35 -0
- package/dist/hooks/useZingMutation.js +37 -0
- package/dist/hooks/useZingQueries.d.ts +127 -0
- package/dist/hooks/useZingQueries.js +37 -0
- package/dist/hooks/useZingQuery.d.ts +147 -0
- package/dist/hooks/useZingQuery.js +34 -0
- package/{src/index.ts → dist/index.d.ts} +2 -3
- package/dist/index.js +9 -0
- package/dist/lib/utils/colorful-logger.d.ts +2 -0
- package/dist/lib/utils/colorful-logger.js +23 -0
- package/dist/lib/utils/const.d.ts +25 -0
- package/dist/lib/utils/const.js +25 -0
- package/dist/lib/utils/helpers.d.ts +10 -0
- package/dist/lib/utils/helpers.js +49 -0
- package/dist/lib/utils/index.js +4 -0
- package/dist/lib/utils/init-app-with-shadow.d.ts +6 -0
- package/dist/lib/utils/init-app-with-shadow.js +28 -0
- package/dist/lib/utils/quilt.d.ts +61 -0
- package/dist/lib/utils/quilt.js +194 -0
- package/dist/lib/utils/reclaim.d.ts +29 -0
- package/dist/lib/utils/reclaim.js +88 -0
- package/dist/lib/utils/types.d.ts +5 -0
- package/dist/lib/utils/types.js +1 -0
- package/dist/mutations/index.js +3 -0
- package/dist/mutations/seal.d.ts +12 -0
- package/dist/mutations/seal.js +41 -0
- package/dist/mutations/signer.d.ts +10 -0
- package/dist/mutations/signer.js +176 -0
- package/dist/mutations/walrus.d.ts +98 -0
- package/dist/mutations/walrus.js +488 -0
- package/dist/stores/index.js +3 -0
- package/dist/stores/walletStore.d.ts +48 -0
- package/dist/stores/walletStore.js +232 -0
- package/dist/stores/walrusStore.d.ts +28 -0
- package/dist/stores/walrusStore.js +61 -0
- package/dist/stores/zkloginStore.d.ts +28 -0
- package/dist/stores/zkloginStore.js +27 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.js +1 -0
- package/package.json +14 -6
- package/src/_generated/utils/index.ts +0 -181
- package/src/_generated/zing_framework/coin_utils.ts +0 -41
- package/src/_generated/zing_framework/derived_object_bag.ts +0 -400
- package/src/_generated/zing_framework/derived_table.ts +0 -366
- package/src/_generated/zing_governance/admin.ts +0 -47
- package/src/_generated/zing_governance/treasury.ts +0 -134
- package/src/_generated/zing_identity/config.ts +0 -191
- package/src/_generated/zing_identity/ecdsa.ts +0 -166
- package/src/_generated/zing_identity/identity.ts +0 -661
- package/src/_generated/zing_identity/reclaim.ts +0 -803
- package/src/_generated/zing_studio/app.ts +0 -855
- package/src/_generated/zing_studio/article.ts +0 -598
- package/src/_generated/zing_studio/config.ts +0 -475
- package/src/_generated/zing_studio/deps/sui/dynamic_field.ts +0 -272
- package/src/_generated/zing_studio/deps/walrus/events.ts +0 -124
- package/src/_generated/zing_studio/deps/walrus/metadata.ts +0 -137
- package/src/_generated/zing_studio/enclave.ts +0 -466
- package/src/_generated/zing_studio/nitro_attestation.ts +0 -308
- package/src/_generated/zing_studio/referral.ts +0 -447
- package/src/_generated/zing_studio/storage.ts +0 -664
- package/src/_generated/zing_studio/studio.ts +0 -682
- package/src/bcs.ts +0 -139
- package/src/client/index.ts +0 -557
- package/src/client/types.ts +0 -28
- package/src/components/wallet-provider.tsx +0 -53
- package/src/components/walrus-provider.tsx +0 -212
- package/src/components/zing-provider.tsx +0 -54
- package/src/config/common.ts +0 -82
- package/src/config/index.ts +0 -45
- package/src/config/mainnet.ts +0 -109
- package/src/config/testnet.ts +0 -111
- package/src/config/types.ts +0 -69
- package/src/const.ts +0 -32
- package/src/getters.ts +0 -523
- package/src/hooks/useGetStudio.ts +0 -22
- package/src/hooks/useGetTierPlan.ts +0 -115
- package/src/hooks/useReclaim.ts +0 -165
- package/src/hooks/useSignAndExecuteTransaction.ts +0 -57
- package/src/hooks/useSignPersonalMessage.ts +0 -28
- package/src/hooks/useZingInfiniteQueries.ts +0 -92
- package/src/hooks/useZingMutation.ts +0 -66
- package/src/hooks/useZingQueries.ts +0 -107
- package/src/hooks/useZingQuery.ts +0 -88
- package/src/lib/utils/colorful-logger.ts +0 -27
- package/src/lib/utils/const.ts +0 -25
- package/src/lib/utils/helpers.ts +0 -78
- package/src/lib/utils/init-app-with-shadow.ts +0 -42
- package/src/lib/utils/quilt.ts +0 -317
- package/src/lib/utils/reclaim.ts +0 -148
- package/src/lib/utils/types.ts +0 -14
- package/src/mutations/seal.ts +0 -78
- package/src/mutations/signer.ts +0 -241
- package/src/mutations/walrus.ts +0 -862
- package/src/stores/walletStore.ts +0 -360
- package/src/stores/walrusStore.ts +0 -118
- package/src/stores/zkloginStore.ts +0 -53
- package/src/types.ts +0 -120
- package/tsconfig.json +0 -12
- /package/{src/_generated/index.js → dist/_generated/index.d.ts} +0 -0
- /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
- /package/{src/lib/utils/index.ts → dist/lib/utils/index.d.ts} +0 -0
- /package/{src/mutations/index.ts → dist/mutations/index.d.ts} +0 -0
- /package/{src/stores/index.ts → dist/stores/index.d.ts} +0 -0
package/dist/bcs.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ObjectOwner } from "@mysten/sui/client";
|
|
2
|
+
export declare const BlobId: import("@mysten/sui/bcs").BcsType<string, string | bigint, "u256">;
|
|
3
|
+
export declare const QuiltPatchId: import("@mysten/sui/bcs").BcsStruct<{
|
|
4
|
+
quiltId: import("@mysten/sui/bcs").BcsType<string, string | bigint, "u256">;
|
|
5
|
+
patchId: import("@mysten/sui/bcs").BcsStruct<{
|
|
6
|
+
version: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
|
|
7
|
+
startIndex: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
|
|
8
|
+
endIndex: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
|
|
9
|
+
}, string>;
|
|
10
|
+
}, string>;
|
|
11
|
+
export declare const QuiltPatchTags: import("@mysten/sui/bcs").BcsType<{
|
|
12
|
+
[k: string]: string;
|
|
13
|
+
}, Map<string, string> | Record<string, string>, "Map<string, string>">;
|
|
14
|
+
export declare const QuiltPatchV1: import("@mysten/sui/bcs").BcsStruct<{
|
|
15
|
+
endIndex: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
|
|
16
|
+
identifier: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
17
|
+
tags: import("@mysten/sui/bcs").BcsType<{
|
|
18
|
+
[k: string]: string;
|
|
19
|
+
}, Map<string, string> | Record<string, string>, "Map<string, string>">;
|
|
20
|
+
}, string>;
|
|
21
|
+
export declare const QuiltIndexV1: import("@mysten/sui/bcs").BcsStruct<{
|
|
22
|
+
patches: import("@mysten/sui/bcs").BcsType<{
|
|
23
|
+
endIndex: number;
|
|
24
|
+
identifier: string;
|
|
25
|
+
tags: {
|
|
26
|
+
[k: string]: string;
|
|
27
|
+
};
|
|
28
|
+
}[], Iterable<{
|
|
29
|
+
endIndex: number;
|
|
30
|
+
identifier: string;
|
|
31
|
+
tags: Map<string, string> | Record<string, string>;
|
|
32
|
+
}> & {
|
|
33
|
+
length: number;
|
|
34
|
+
}, string>;
|
|
35
|
+
}, string>;
|
|
36
|
+
export declare const MoveObjectType: import("@mysten/sui/bcs").BcsEnum<{
|
|
37
|
+
Other: import("@mysten/sui/bcs").BcsStruct<{
|
|
38
|
+
address: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
39
|
+
module: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
40
|
+
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
41
|
+
typeParams: import("@mysten/sui/bcs").BcsType<import("@mysten/sui/bcs").TypeTag[], Iterable<import("@mysten/sui/bcs").TypeTag> & {
|
|
42
|
+
length: number;
|
|
43
|
+
}, string>;
|
|
44
|
+
}, string>;
|
|
45
|
+
GasCoin: null;
|
|
46
|
+
StakedSui: null;
|
|
47
|
+
Coin: import("@mysten/sui/bcs").BcsType<string, string | import("@mysten/sui/bcs").TypeTag, string>;
|
|
48
|
+
}, "MoveObjectType">;
|
|
49
|
+
export declare const SuiMoveObject: import("@mysten/sui/bcs").BcsStruct<{
|
|
50
|
+
data: import("@mysten/sui/bcs").BcsEnum<{
|
|
51
|
+
MoveObject: import("@mysten/sui/bcs").BcsStruct<{
|
|
52
|
+
type: import("@mysten/sui/bcs").BcsType<any, string, string>;
|
|
53
|
+
hasPublicTransfer: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
54
|
+
version: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
55
|
+
contents: import("@mysten/sui/bcs").BcsType<any, string, string>;
|
|
56
|
+
}, string>;
|
|
57
|
+
}, "Data">;
|
|
58
|
+
owner: import("@mysten/sui/bcs").BcsType<any, ObjectOwner, string>;
|
|
59
|
+
previousTransaction: import("@mysten/sui/bcs").BcsType<string, string, "ObjectDigest">;
|
|
60
|
+
storageRebate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
61
|
+
}, string>;
|
package/dist/bcs.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { bcs, TypeTagSerializer } from "@mysten/sui/bcs";
|
|
2
|
+
import { fromBase64, normalizeStructTag, parseStructTag, SUI_FRAMEWORK_ADDRESS, SUI_SYSTEM_ADDRESS, } from "@mysten/sui/utils";
|
|
3
|
+
import { blobIdFromInt, blobIdToInt } from "@mysten/walrus";
|
|
4
|
+
function compareBcsBytes(a, b) {
|
|
5
|
+
// sort by length first, because bcs bytes prefix length
|
|
6
|
+
if (a.length !== b.length) {
|
|
7
|
+
return a.length - b.length;
|
|
8
|
+
}
|
|
9
|
+
for (let i = 0; i < a.length; i++) {
|
|
10
|
+
if (a[i] !== b[i]) {
|
|
11
|
+
return a[i] - b[i];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
export const BlobId = bcs.u256().transform({
|
|
17
|
+
input: (blobId) => typeof blobId === "string" ? blobIdToInt(blobId) : blobId,
|
|
18
|
+
output: (id) => blobIdFromInt(id),
|
|
19
|
+
});
|
|
20
|
+
export const QuiltPatchId = bcs.struct("QuiltPatchId", {
|
|
21
|
+
quiltId: BlobId,
|
|
22
|
+
patchId: bcs.struct("InternalQuiltPatchId", {
|
|
23
|
+
version: bcs.u8(),
|
|
24
|
+
startIndex: bcs.u16(),
|
|
25
|
+
endIndex: bcs.u16(),
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
export const QuiltPatchTags = bcs.map(bcs.string(), bcs.string()).transform({
|
|
29
|
+
// tags is a BTreeMap, so we need to sort entries before serializing
|
|
30
|
+
input: (tags) => new Map([...(tags instanceof Map ? tags : Object.entries(tags))].sort(([a], [b]) => compareBcsBytes(bcs.string().serialize(a).toBytes(), bcs.string().serialize(b).toBytes()))),
|
|
31
|
+
output: (tags) => Object.fromEntries(tags),
|
|
32
|
+
});
|
|
33
|
+
export const QuiltPatchV1 = bcs.struct("QuiltPatchV1", {
|
|
34
|
+
endIndex: bcs.u16(),
|
|
35
|
+
identifier: bcs.string(),
|
|
36
|
+
tags: QuiltPatchTags,
|
|
37
|
+
});
|
|
38
|
+
export const QuiltIndexV1 = bcs.struct("QuiltIndexV1", {
|
|
39
|
+
patches: bcs.vector(QuiltPatchV1),
|
|
40
|
+
});
|
|
41
|
+
export const MoveObjectType = bcs.enum("MoveObjectType", {
|
|
42
|
+
Other: bcs.StructTag,
|
|
43
|
+
GasCoin: null,
|
|
44
|
+
StakedSui: null,
|
|
45
|
+
Coin: bcs.TypeTag,
|
|
46
|
+
});
|
|
47
|
+
export const SuiMoveObject = bcs.struct("SuiMoveObject", {
|
|
48
|
+
data: bcs.enum("Data", {
|
|
49
|
+
MoveObject: bcs.struct("MoveObject", {
|
|
50
|
+
type: MoveObjectType.transform({
|
|
51
|
+
input: (objectType) => {
|
|
52
|
+
const structTag = parseStructTag(objectType);
|
|
53
|
+
if (structTag.address === SUI_FRAMEWORK_ADDRESS &&
|
|
54
|
+
structTag.module === "coin" &&
|
|
55
|
+
structTag.name === "Coin" &&
|
|
56
|
+
typeof structTag.typeParams[0] === "object") {
|
|
57
|
+
const innerStructTag = structTag.typeParams[0];
|
|
58
|
+
if (innerStructTag.address === SUI_FRAMEWORK_ADDRESS &&
|
|
59
|
+
innerStructTag.module === "sui" &&
|
|
60
|
+
innerStructTag.name === "SUI") {
|
|
61
|
+
return { GasCoin: true, $kind: "GasCoin" };
|
|
62
|
+
}
|
|
63
|
+
return { Coin: normalizeStructTag(innerStructTag), $kind: "Coin" };
|
|
64
|
+
}
|
|
65
|
+
else if (structTag.address === SUI_SYSTEM_ADDRESS &&
|
|
66
|
+
structTag.module === "staking_pool" &&
|
|
67
|
+
structTag.name === "StakedSui") {
|
|
68
|
+
return { StakedSui: true, $kind: "StakedSui" };
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
Other: {
|
|
72
|
+
...structTag,
|
|
73
|
+
typeParams: structTag.typeParams.map((typeParam) => TypeTagSerializer.parseFromStr(normalizeStructTag(typeParam))),
|
|
74
|
+
},
|
|
75
|
+
$kind: "Other",
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
hasPublicTransfer: bcs.bool(),
|
|
80
|
+
version: bcs.u64(),
|
|
81
|
+
contents: bcs.byteVector().transform({ input: fromBase64 }),
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
owner: bcs.Owner.transform({
|
|
85
|
+
input: (objectOwner) => {
|
|
86
|
+
if (objectOwner === "Immutable") {
|
|
87
|
+
return { Immutable: null };
|
|
88
|
+
}
|
|
89
|
+
else if ("Shared" in objectOwner) {
|
|
90
|
+
return {
|
|
91
|
+
Shared: {
|
|
92
|
+
initialSharedVersion: objectOwner.Shared.initial_shared_version,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else if ("ConsensusAddressOwner" in objectOwner) {
|
|
97
|
+
return {
|
|
98
|
+
ConsensusAddressOwner: {
|
|
99
|
+
owner: objectOwner.ConsensusAddressOwner.owner,
|
|
100
|
+
startVersion: objectOwner.ConsensusAddressOwner.start_version,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return objectOwner;
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
previousTransaction: bcs.ObjectDigest,
|
|
108
|
+
storageRebate: bcs.u64(),
|
|
109
|
+
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { SessionKey } from "@mysten/seal";
|
|
2
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
3
|
+
import type { PurchaseStorageTierParams, SetMonthlySubscriptionFeeParams, SubscribeParams } from "./types.js";
|
|
4
|
+
import type { CoinSymbol, PlatformType, WorkType } from "../config/index.js";
|
|
5
|
+
import type { Config, WalrusSystemState } from "../config/types.js";
|
|
6
|
+
import type { SuiNetwork, ZKLoginSignerState } from "../types.js";
|
|
7
|
+
import type { SealClient } from "@mysten/seal";
|
|
8
|
+
import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
9
|
+
import type { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
|
|
10
|
+
interface Params {
|
|
11
|
+
network: SuiNetwork;
|
|
12
|
+
suiGrpcClient: SuiGrpcClient;
|
|
13
|
+
suiJsonRpcClient: SuiJsonRpcClient;
|
|
14
|
+
gasPoolBearerToken: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class ZingClient {
|
|
17
|
+
suiGrpcClient: SuiGrpcClient;
|
|
18
|
+
suiJsonRpcClient: SuiJsonRpcClient;
|
|
19
|
+
network: SuiNetwork;
|
|
20
|
+
config: Config;
|
|
21
|
+
gasPoolBearerToken: string;
|
|
22
|
+
constructor({ network, suiGrpcClient, suiJsonRpcClient, gasPoolBearerToken, }: Params);
|
|
23
|
+
getConfig(): Config;
|
|
24
|
+
getDerivedStudioID(address: string): string;
|
|
25
|
+
getDerivedStorageID(address: string): string;
|
|
26
|
+
getDerivedWorksID(address: string): string;
|
|
27
|
+
getDerivedMembershipID(address: string): string;
|
|
28
|
+
getIdentifierByAddress(platform: PlatformType, address: string): Promise<string | null>;
|
|
29
|
+
getIdentifierInfoByIdentifier(platform: PlatformType, identifier: string): Promise<{
|
|
30
|
+
owner: string;
|
|
31
|
+
updated_at: string;
|
|
32
|
+
} | null>;
|
|
33
|
+
getStudio(owner: string): Promise<{
|
|
34
|
+
id: {
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
37
|
+
owner: string;
|
|
38
|
+
period: string[];
|
|
39
|
+
monthly_subscription_fee: {
|
|
40
|
+
contents: {
|
|
41
|
+
key: number;
|
|
42
|
+
value: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
membership: {
|
|
46
|
+
id: {
|
|
47
|
+
id: string;
|
|
48
|
+
};
|
|
49
|
+
size: string;
|
|
50
|
+
};
|
|
51
|
+
works: {
|
|
52
|
+
id: {
|
|
53
|
+
id: string;
|
|
54
|
+
};
|
|
55
|
+
size: string;
|
|
56
|
+
};
|
|
57
|
+
encrypted_file_key: number[] | null;
|
|
58
|
+
} | null>;
|
|
59
|
+
getStorageSpace(owner: string): Promise<{
|
|
60
|
+
id: {
|
|
61
|
+
id: string;
|
|
62
|
+
};
|
|
63
|
+
owner: string;
|
|
64
|
+
tier: number | null;
|
|
65
|
+
storage_used: {
|
|
66
|
+
contents: {
|
|
67
|
+
key: number;
|
|
68
|
+
value: string;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
credits: string;
|
|
72
|
+
} | null>;
|
|
73
|
+
getStorageTreasury(): Promise<{
|
|
74
|
+
id: {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
77
|
+
tier_plan: {
|
|
78
|
+
contents: {
|
|
79
|
+
key: number;
|
|
80
|
+
value: {
|
|
81
|
+
price: string;
|
|
82
|
+
duration_days: number;
|
|
83
|
+
storage_limit: string;
|
|
84
|
+
};
|
|
85
|
+
}[];
|
|
86
|
+
};
|
|
87
|
+
storages_by_epoch: {
|
|
88
|
+
contents: {
|
|
89
|
+
key: number;
|
|
90
|
+
value: {
|
|
91
|
+
id: {
|
|
92
|
+
id: string;
|
|
93
|
+
};
|
|
94
|
+
start_epoch: number;
|
|
95
|
+
end_epoch: number;
|
|
96
|
+
storage_size: string;
|
|
97
|
+
};
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
wal_treasury: {
|
|
101
|
+
id: {
|
|
102
|
+
id: string;
|
|
103
|
+
};
|
|
104
|
+
balance: {
|
|
105
|
+
value: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
} | null>;
|
|
109
|
+
getMember(owner: string, member: string): Promise<{
|
|
110
|
+
level: number;
|
|
111
|
+
expired_at: string;
|
|
112
|
+
} | null>;
|
|
113
|
+
getMembers(owner: string, cursor?: string, limit?: number): Promise<{
|
|
114
|
+
data: {
|
|
115
|
+
member: string;
|
|
116
|
+
level: number;
|
|
117
|
+
expiredAt: string;
|
|
118
|
+
}[];
|
|
119
|
+
nextCursor: string | undefined;
|
|
120
|
+
hasNextPage: boolean;
|
|
121
|
+
}>;
|
|
122
|
+
getWork(walrusSystem: WalrusSystemState, workId: string, workType?: WorkType): Promise<{
|
|
123
|
+
id: {
|
|
124
|
+
id: string;
|
|
125
|
+
};
|
|
126
|
+
owner: string;
|
|
127
|
+
deleted: boolean;
|
|
128
|
+
created_at: string;
|
|
129
|
+
subscription_level: number | null;
|
|
130
|
+
blobs: {
|
|
131
|
+
id: {
|
|
132
|
+
id: string;
|
|
133
|
+
};
|
|
134
|
+
registered_epoch: number;
|
|
135
|
+
blob_id: string;
|
|
136
|
+
size: string;
|
|
137
|
+
encoding_type: number;
|
|
138
|
+
certified_epoch: number | null;
|
|
139
|
+
storage: {
|
|
140
|
+
id: {
|
|
141
|
+
id: string;
|
|
142
|
+
};
|
|
143
|
+
start_epoch: number;
|
|
144
|
+
end_epoch: number;
|
|
145
|
+
storage_size: string;
|
|
146
|
+
};
|
|
147
|
+
deletable: boolean;
|
|
148
|
+
}[];
|
|
149
|
+
files: {
|
|
150
|
+
contents: {
|
|
151
|
+
key: string;
|
|
152
|
+
value: {
|
|
153
|
+
blob_index: string;
|
|
154
|
+
mime_type: string;
|
|
155
|
+
size: string;
|
|
156
|
+
};
|
|
157
|
+
}[];
|
|
158
|
+
};
|
|
159
|
+
} | null>;
|
|
160
|
+
getWorks(walrusSystem: WalrusSystemState, owner: string, workType?: WorkType, cursor?: string, limit?: number): Promise<{
|
|
161
|
+
data: {
|
|
162
|
+
id: {
|
|
163
|
+
id: string;
|
|
164
|
+
};
|
|
165
|
+
owner: string;
|
|
166
|
+
deleted: boolean;
|
|
167
|
+
created_at: string;
|
|
168
|
+
subscription_level: number | null;
|
|
169
|
+
blobs: {
|
|
170
|
+
id: {
|
|
171
|
+
id: string;
|
|
172
|
+
};
|
|
173
|
+
registered_epoch: number;
|
|
174
|
+
blob_id: string;
|
|
175
|
+
size: string;
|
|
176
|
+
encoding_type: number;
|
|
177
|
+
certified_epoch: number | null;
|
|
178
|
+
storage: {
|
|
179
|
+
id: {
|
|
180
|
+
id: string;
|
|
181
|
+
};
|
|
182
|
+
start_epoch: number;
|
|
183
|
+
end_epoch: number;
|
|
184
|
+
storage_size: string;
|
|
185
|
+
};
|
|
186
|
+
deletable: boolean;
|
|
187
|
+
}[];
|
|
188
|
+
files: {
|
|
189
|
+
contents: {
|
|
190
|
+
key: string;
|
|
191
|
+
value: {
|
|
192
|
+
blob_index: string;
|
|
193
|
+
mime_type: string;
|
|
194
|
+
size: string;
|
|
195
|
+
};
|
|
196
|
+
}[];
|
|
197
|
+
};
|
|
198
|
+
}[];
|
|
199
|
+
nextCursor: string | undefined;
|
|
200
|
+
hasNextPage: boolean;
|
|
201
|
+
}>;
|
|
202
|
+
getBalance(owner: string, coinSymbol: CoinSymbol): Promise<import("node_modules/@mysten/sui/dist/esm/grpc/proto/sui/rpc/v2/state_service.js").GetBalanceResponse>;
|
|
203
|
+
getSessionKey(signer: ZKLoginSignerState, owner: string): Promise<SessionKey>;
|
|
204
|
+
buildSealApproveTransactionBytes(owner: string): Promise<Uint8Array<ArrayBuffer>>;
|
|
205
|
+
getFileKey(sealClient: SealClient, sessionKey: SessionKey, owner: string, encryptedFileKeyBytes: number[]): Promise<CryptoKey>;
|
|
206
|
+
/**
|
|
207
|
+
* Constructs the transaction for subscribing to a studio.
|
|
208
|
+
* Does not execute; returns the Transaction object to be signed.
|
|
209
|
+
*/
|
|
210
|
+
subscribeToStudioTransaction({ sender, creatorAddress, subscriptionAmount, level, }: SubscribeParams): (tx: Transaction) => void;
|
|
211
|
+
purchaseStorageTierTransaction({ sender, objs, newTierIdx, balance, referrer, }: PurchaseStorageTierParams): (tx: Transaction) => void;
|
|
212
|
+
setMonthlySubscriptionFeeTransaction({ sender, monthlyFee, level, }: SetMonthlySubscriptionFeeParams): (tx: Transaction) => void;
|
|
213
|
+
updateArticleSubscriptionLevelTransaction({ sender, articleId, subscriptionLevel, }: {
|
|
214
|
+
sender: string;
|
|
215
|
+
articleId: string;
|
|
216
|
+
subscriptionLevel: null | number;
|
|
217
|
+
}): (tx: Transaction) => void;
|
|
218
|
+
deleteArticleTransaction({ sender, articleId, }: {
|
|
219
|
+
sender: string;
|
|
220
|
+
articleId: string;
|
|
221
|
+
}): (tx: Transaction) => void;
|
|
222
|
+
donateTransaction({ recipient, message, value, }: {
|
|
223
|
+
recipient: string;
|
|
224
|
+
message: string;
|
|
225
|
+
value: number;
|
|
226
|
+
}): (tx: Transaction) => void;
|
|
227
|
+
}
|
|
228
|
+
export {};
|