@zing-protocol/zing-sdk 0.0.1 → 0.0.3
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 +18 -10
- 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
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import * as object from "./deps/sui/object.js";
|
|
5
|
-
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
6
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
7
|
-
import type { RawTransactionArgument } from "../utils/index.js";
|
|
8
|
-
import type { BcsType } from "@mysten/sui/bcs";
|
|
9
|
-
import type { Transaction } from "@mysten/sui/transactions";
|
|
10
|
-
|
|
11
|
-
const $moduleName = "@local-pkg/zing_framework::derived_table";
|
|
12
|
-
export const DerivedTable = new MoveStruct({
|
|
13
|
-
name: `${$moduleName}::DerivedTable`,
|
|
14
|
-
fields: {
|
|
15
|
-
/** the ID of this table */
|
|
16
|
-
id: object.UID,
|
|
17
|
-
/** the number of key-value pairs in the table */
|
|
18
|
-
size: bcs.u64(),
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
export interface NewArguments<DerivedObjectKey extends BcsType<any>> {
|
|
22
|
-
parent: RawTransactionArgument<string>;
|
|
23
|
-
key: RawTransactionArgument<DerivedObjectKey>;
|
|
24
|
-
}
|
|
25
|
-
export interface NewOptions<DerivedObjectKey extends BcsType<any>> {
|
|
26
|
-
package?: string;
|
|
27
|
-
arguments:
|
|
28
|
-
| NewArguments<DerivedObjectKey>
|
|
29
|
-
| [
|
|
30
|
-
parent: RawTransactionArgument<string>,
|
|
31
|
-
key: RawTransactionArgument<DerivedObjectKey>,
|
|
32
|
-
];
|
|
33
|
-
typeArguments: [string, string, string];
|
|
34
|
-
}
|
|
35
|
-
/** Creates a new, empty table */
|
|
36
|
-
export function _new<DerivedObjectKey extends BcsType<any>>(
|
|
37
|
-
options: NewOptions<DerivedObjectKey>,
|
|
38
|
-
) {
|
|
39
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
40
|
-
const argumentsTypes = [
|
|
41
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
42
|
-
`${options.typeArguments[0]}`,
|
|
43
|
-
] satisfies string[];
|
|
44
|
-
const parameterNames = ["parent", "key"];
|
|
45
|
-
return (tx: Transaction) =>
|
|
46
|
-
tx.moveCall({
|
|
47
|
-
package: packageAddress,
|
|
48
|
-
module: "derived_table",
|
|
49
|
-
function: "new",
|
|
50
|
-
arguments: normalizeMoveArguments(
|
|
51
|
-
options.arguments,
|
|
52
|
-
argumentsTypes,
|
|
53
|
-
parameterNames,
|
|
54
|
-
),
|
|
55
|
-
typeArguments: options.typeArguments,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
export interface AddArguments<K extends BcsType<any>, V extends BcsType<any>> {
|
|
59
|
-
table: RawTransactionArgument<string>;
|
|
60
|
-
k: RawTransactionArgument<K>;
|
|
61
|
-
v: RawTransactionArgument<V>;
|
|
62
|
-
}
|
|
63
|
-
export interface AddOptions<K extends BcsType<any>, V extends BcsType<any>> {
|
|
64
|
-
package?: string;
|
|
65
|
-
arguments:
|
|
66
|
-
| AddArguments<K, V>
|
|
67
|
-
| [
|
|
68
|
-
table: RawTransactionArgument<string>,
|
|
69
|
-
k: RawTransactionArgument<K>,
|
|
70
|
-
v: RawTransactionArgument<V>,
|
|
71
|
-
];
|
|
72
|
-
typeArguments: [string, string];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Adds a key-value pair to the table `table: &mut DerivedTable<K, V>` Aborts with
|
|
76
|
-
* `sui::dynamic_field::EFieldAlreadyExists` if the table already has an entry with
|
|
77
|
-
* that key `k: K`.
|
|
78
|
-
*/
|
|
79
|
-
export function add<K extends BcsType<any>, V extends BcsType<any>>(
|
|
80
|
-
options: AddOptions<K, V>,
|
|
81
|
-
) {
|
|
82
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
83
|
-
const argumentsTypes = [
|
|
84
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
85
|
-
`${options.typeArguments[0]}`,
|
|
86
|
-
`${options.typeArguments[1]}`,
|
|
87
|
-
] satisfies string[];
|
|
88
|
-
const parameterNames = ["table", "k", "v"];
|
|
89
|
-
return (tx: Transaction) =>
|
|
90
|
-
tx.moveCall({
|
|
91
|
-
package: packageAddress,
|
|
92
|
-
module: "derived_table",
|
|
93
|
-
function: "add",
|
|
94
|
-
arguments: normalizeMoveArguments(
|
|
95
|
-
options.arguments,
|
|
96
|
-
argumentsTypes,
|
|
97
|
-
parameterNames,
|
|
98
|
-
),
|
|
99
|
-
typeArguments: options.typeArguments,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
export interface BorrowArguments<K extends BcsType<any>> {
|
|
103
|
-
table: RawTransactionArgument<string>;
|
|
104
|
-
k: RawTransactionArgument<K>;
|
|
105
|
-
}
|
|
106
|
-
export interface BorrowOptions<K extends BcsType<any>> {
|
|
107
|
-
package?: string;
|
|
108
|
-
arguments:
|
|
109
|
-
| BorrowArguments<K>
|
|
110
|
-
| [table: RawTransactionArgument<string>, k: RawTransactionArgument<K>];
|
|
111
|
-
typeArguments: [string, string];
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Immutable borrows the value associated with the key in the table
|
|
115
|
-
* `table: &DerivedTable<K, V>`. Aborts with
|
|
116
|
-
* `sui::dynamic_field::EFieldDoesNotExist` if the table does not have an entry
|
|
117
|
-
* with that key `k: K`.
|
|
118
|
-
*/
|
|
119
|
-
export function borrow<K extends BcsType<any>>(options: BorrowOptions<K>) {
|
|
120
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
121
|
-
const argumentsTypes = [
|
|
122
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
123
|
-
`${options.typeArguments[0]}`,
|
|
124
|
-
] satisfies string[];
|
|
125
|
-
const parameterNames = ["table", "k"];
|
|
126
|
-
return (tx: Transaction) =>
|
|
127
|
-
tx.moveCall({
|
|
128
|
-
package: packageAddress,
|
|
129
|
-
module: "derived_table",
|
|
130
|
-
function: "borrow",
|
|
131
|
-
arguments: normalizeMoveArguments(
|
|
132
|
-
options.arguments,
|
|
133
|
-
argumentsTypes,
|
|
134
|
-
parameterNames,
|
|
135
|
-
),
|
|
136
|
-
typeArguments: options.typeArguments,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
export interface BorrowMutArguments<K extends BcsType<any>> {
|
|
140
|
-
table: RawTransactionArgument<string>;
|
|
141
|
-
k: RawTransactionArgument<K>;
|
|
142
|
-
}
|
|
143
|
-
export interface BorrowMutOptions<K extends BcsType<any>> {
|
|
144
|
-
package?: string;
|
|
145
|
-
arguments:
|
|
146
|
-
| BorrowMutArguments<K>
|
|
147
|
-
| [table: RawTransactionArgument<string>, k: RawTransactionArgument<K>];
|
|
148
|
-
typeArguments: [string, string];
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Mutably borrows the value associated with the key in the table
|
|
152
|
-
* `table: &mut DerivedTable<K, V>`. Aborts with
|
|
153
|
-
* `sui::dynamic_field::EFieldDoesNotExist` if the table does not have an entry
|
|
154
|
-
* with that key `k: K`.
|
|
155
|
-
*/
|
|
156
|
-
export function borrowMut<K extends BcsType<any>>(
|
|
157
|
-
options: BorrowMutOptions<K>,
|
|
158
|
-
) {
|
|
159
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
160
|
-
const argumentsTypes = [
|
|
161
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
162
|
-
`${options.typeArguments[0]}`,
|
|
163
|
-
] satisfies string[];
|
|
164
|
-
const parameterNames = ["table", "k"];
|
|
165
|
-
return (tx: Transaction) =>
|
|
166
|
-
tx.moveCall({
|
|
167
|
-
package: packageAddress,
|
|
168
|
-
module: "derived_table",
|
|
169
|
-
function: "borrow_mut",
|
|
170
|
-
arguments: normalizeMoveArguments(
|
|
171
|
-
options.arguments,
|
|
172
|
-
argumentsTypes,
|
|
173
|
-
parameterNames,
|
|
174
|
-
),
|
|
175
|
-
typeArguments: options.typeArguments,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
export interface RemoveArguments<K extends BcsType<any>> {
|
|
179
|
-
table: RawTransactionArgument<string>;
|
|
180
|
-
k: RawTransactionArgument<K>;
|
|
181
|
-
}
|
|
182
|
-
export interface RemoveOptions<K extends BcsType<any>> {
|
|
183
|
-
package?: string;
|
|
184
|
-
arguments:
|
|
185
|
-
| RemoveArguments<K>
|
|
186
|
-
| [table: RawTransactionArgument<string>, k: RawTransactionArgument<K>];
|
|
187
|
-
typeArguments: [string, string];
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Removes the key-value pair in the table `table: &mut DerivedTable<K, V>` and
|
|
191
|
-
* returns the value. Aborts with `sui::dynamic_field::EFieldDoesNotExist` if the
|
|
192
|
-
* table does not have an entry with that key `k: K`.
|
|
193
|
-
*/
|
|
194
|
-
export function remove<K extends BcsType<any>>(options: RemoveOptions<K>) {
|
|
195
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
196
|
-
const argumentsTypes = [
|
|
197
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
198
|
-
`${options.typeArguments[0]}`,
|
|
199
|
-
] satisfies string[];
|
|
200
|
-
const parameterNames = ["table", "k"];
|
|
201
|
-
return (tx: Transaction) =>
|
|
202
|
-
tx.moveCall({
|
|
203
|
-
package: packageAddress,
|
|
204
|
-
module: "derived_table",
|
|
205
|
-
function: "remove",
|
|
206
|
-
arguments: normalizeMoveArguments(
|
|
207
|
-
options.arguments,
|
|
208
|
-
argumentsTypes,
|
|
209
|
-
parameterNames,
|
|
210
|
-
),
|
|
211
|
-
typeArguments: options.typeArguments,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
export interface ContainsArguments<K extends BcsType<any>> {
|
|
215
|
-
table: RawTransactionArgument<string>;
|
|
216
|
-
k: RawTransactionArgument<K>;
|
|
217
|
-
}
|
|
218
|
-
export interface ContainsOptions<K extends BcsType<any>> {
|
|
219
|
-
package?: string;
|
|
220
|
-
arguments:
|
|
221
|
-
| ContainsArguments<K>
|
|
222
|
-
| [table: RawTransactionArgument<string>, k: RawTransactionArgument<K>];
|
|
223
|
-
typeArguments: [string, string];
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Returns true if there is a value associated with the key `k: K` in table
|
|
227
|
-
* `table: &DerivedTable<K, V>`
|
|
228
|
-
*/
|
|
229
|
-
export function contains<K extends BcsType<any>>(options: ContainsOptions<K>) {
|
|
230
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
231
|
-
const argumentsTypes = [
|
|
232
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
233
|
-
`${options.typeArguments[0]}`,
|
|
234
|
-
] satisfies string[];
|
|
235
|
-
const parameterNames = ["table", "k"];
|
|
236
|
-
return (tx: Transaction) =>
|
|
237
|
-
tx.moveCall({
|
|
238
|
-
package: packageAddress,
|
|
239
|
-
module: "derived_table",
|
|
240
|
-
function: "contains",
|
|
241
|
-
arguments: normalizeMoveArguments(
|
|
242
|
-
options.arguments,
|
|
243
|
-
argumentsTypes,
|
|
244
|
-
parameterNames,
|
|
245
|
-
),
|
|
246
|
-
typeArguments: options.typeArguments,
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
export interface LengthArguments {
|
|
250
|
-
table: RawTransactionArgument<string>;
|
|
251
|
-
}
|
|
252
|
-
export interface LengthOptions {
|
|
253
|
-
package?: string;
|
|
254
|
-
arguments: LengthArguments | [table: RawTransactionArgument<string>];
|
|
255
|
-
typeArguments: [string, string];
|
|
256
|
-
}
|
|
257
|
-
/** Returns the size of the table, the number of key-value pairs */
|
|
258
|
-
export function length(options: LengthOptions) {
|
|
259
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
260
|
-
const argumentsTypes = [
|
|
261
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
262
|
-
] satisfies string[];
|
|
263
|
-
const parameterNames = ["table"];
|
|
264
|
-
return (tx: Transaction) =>
|
|
265
|
-
tx.moveCall({
|
|
266
|
-
package: packageAddress,
|
|
267
|
-
module: "derived_table",
|
|
268
|
-
function: "length",
|
|
269
|
-
arguments: normalizeMoveArguments(
|
|
270
|
-
options.arguments,
|
|
271
|
-
argumentsTypes,
|
|
272
|
-
parameterNames,
|
|
273
|
-
),
|
|
274
|
-
typeArguments: options.typeArguments,
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
export interface IsEmptyArguments {
|
|
278
|
-
table: RawTransactionArgument<string>;
|
|
279
|
-
}
|
|
280
|
-
export interface IsEmptyOptions {
|
|
281
|
-
package?: string;
|
|
282
|
-
arguments: IsEmptyArguments | [table: RawTransactionArgument<string>];
|
|
283
|
-
typeArguments: [string, string];
|
|
284
|
-
}
|
|
285
|
-
/** Returns true if the table is empty (if `length` returns `0`) */
|
|
286
|
-
export function isEmpty(options: IsEmptyOptions) {
|
|
287
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
288
|
-
const argumentsTypes = [
|
|
289
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
290
|
-
] satisfies string[];
|
|
291
|
-
const parameterNames = ["table"];
|
|
292
|
-
return (tx: Transaction) =>
|
|
293
|
-
tx.moveCall({
|
|
294
|
-
package: packageAddress,
|
|
295
|
-
module: "derived_table",
|
|
296
|
-
function: "is_empty",
|
|
297
|
-
arguments: normalizeMoveArguments(
|
|
298
|
-
options.arguments,
|
|
299
|
-
argumentsTypes,
|
|
300
|
-
parameterNames,
|
|
301
|
-
),
|
|
302
|
-
typeArguments: options.typeArguments,
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
export interface DestroyEmptyArguments {
|
|
306
|
-
table: RawTransactionArgument<string>;
|
|
307
|
-
}
|
|
308
|
-
export interface DestroyEmptyOptions {
|
|
309
|
-
package?: string;
|
|
310
|
-
arguments: DestroyEmptyArguments | [table: RawTransactionArgument<string>];
|
|
311
|
-
typeArguments: [string, string];
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Destroys an empty table Aborts with `EDerivedTableNotEmpty` if the table still
|
|
315
|
-
* contains values
|
|
316
|
-
*/
|
|
317
|
-
export function destroyEmpty(options: DestroyEmptyOptions) {
|
|
318
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
319
|
-
const argumentsTypes = [
|
|
320
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
321
|
-
] satisfies string[];
|
|
322
|
-
const parameterNames = ["table"];
|
|
323
|
-
return (tx: Transaction) =>
|
|
324
|
-
tx.moveCall({
|
|
325
|
-
package: packageAddress,
|
|
326
|
-
module: "derived_table",
|
|
327
|
-
function: "destroy_empty",
|
|
328
|
-
arguments: normalizeMoveArguments(
|
|
329
|
-
options.arguments,
|
|
330
|
-
argumentsTypes,
|
|
331
|
-
parameterNames,
|
|
332
|
-
),
|
|
333
|
-
typeArguments: options.typeArguments,
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
export interface DropArguments {
|
|
337
|
-
table: RawTransactionArgument<string>;
|
|
338
|
-
}
|
|
339
|
-
export interface DropOptions {
|
|
340
|
-
package?: string;
|
|
341
|
-
arguments: DropArguments | [table: RawTransactionArgument<string>];
|
|
342
|
-
typeArguments: [string, string];
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Drop a possibly non-empty table. Usable only if the value type `V` has the
|
|
346
|
-
* `drop` ability
|
|
347
|
-
*/
|
|
348
|
-
export function drop(options: DropOptions) {
|
|
349
|
-
const packageAddress = options.package ?? "@local-pkg/zing_framework";
|
|
350
|
-
const argumentsTypes = [
|
|
351
|
-
`${packageAddress}::derived_table::DerivedTable<${options.typeArguments[0]}, ${options.typeArguments[1]}>`,
|
|
352
|
-
] satisfies string[];
|
|
353
|
-
const parameterNames = ["table"];
|
|
354
|
-
return (tx: Transaction) =>
|
|
355
|
-
tx.moveCall({
|
|
356
|
-
package: packageAddress,
|
|
357
|
-
module: "derived_table",
|
|
358
|
-
function: "drop",
|
|
359
|
-
arguments: normalizeMoveArguments(
|
|
360
|
-
options.arguments,
|
|
361
|
-
argumentsTypes,
|
|
362
|
-
parameterNames,
|
|
363
|
-
),
|
|
364
|
-
typeArguments: options.typeArguments,
|
|
365
|
-
});
|
|
366
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import * as object from "./deps/sui/object.js";
|
|
5
|
-
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
6
|
-
import type { RawTransactionArgument } from "../utils/index.js";
|
|
7
|
-
import type { Transaction } from "@mysten/sui/transactions";
|
|
8
|
-
|
|
9
|
-
const $moduleName = "@local-pkg/zing_governance::admin";
|
|
10
|
-
export const AdminCap = new MoveStruct({
|
|
11
|
-
name: `${$moduleName}::AdminCap`,
|
|
12
|
-
fields: {
|
|
13
|
-
id: object.UID,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
export interface NewAdminCapArguments {
|
|
17
|
-
Cap: RawTransactionArgument<string>;
|
|
18
|
-
recipient: RawTransactionArgument<string>;
|
|
19
|
-
}
|
|
20
|
-
export interface NewAdminCapOptions {
|
|
21
|
-
package?: string;
|
|
22
|
-
arguments:
|
|
23
|
-
| NewAdminCapArguments
|
|
24
|
-
| [
|
|
25
|
-
Cap: RawTransactionArgument<string>,
|
|
26
|
-
recipient: RawTransactionArgument<string>,
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
export function newAdminCap(options: NewAdminCapOptions) {
|
|
30
|
-
const packageAddress = options.package ?? "@local-pkg/zing_governance";
|
|
31
|
-
const argumentsTypes = [
|
|
32
|
-
`${packageAddress}::admin::AdminCap`,
|
|
33
|
-
"address",
|
|
34
|
-
] satisfies string[];
|
|
35
|
-
const parameterNames = ["Cap", "recipient"];
|
|
36
|
-
return (tx: Transaction) =>
|
|
37
|
-
tx.moveCall({
|
|
38
|
-
package: packageAddress,
|
|
39
|
-
module: "admin",
|
|
40
|
-
function: "new_admin_cap",
|
|
41
|
-
arguments: normalizeMoveArguments(
|
|
42
|
-
options.arguments,
|
|
43
|
-
argumentsTypes,
|
|
44
|
-
parameterNames,
|
|
45
|
-
),
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import * as object from "./deps/sui/object.js";
|
|
5
|
-
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
6
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
7
|
-
import type { RawTransactionArgument } from "../utils/index.js";
|
|
8
|
-
import type { Transaction } from "@mysten/sui/transactions";
|
|
9
|
-
|
|
10
|
-
const $moduleName = "@local-pkg/zing_governance::treasury";
|
|
11
|
-
export const TreasurySupplyEvent = new MoveStruct({
|
|
12
|
-
name: `${$moduleName}::TreasurySupplyEvent`,
|
|
13
|
-
fields: {
|
|
14
|
-
coin_type: bcs.string(),
|
|
15
|
-
value: bcs.u64(),
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
export const TreasuryClaimEvent = new MoveStruct({
|
|
19
|
-
name: `${$moduleName}::TreasuryClaimEvent`,
|
|
20
|
-
fields: {
|
|
21
|
-
coin_type: bcs.string(),
|
|
22
|
-
value: bcs.u64(),
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
export const BalanceKey = new MoveStruct({
|
|
26
|
-
name: `${$moduleName}::BalanceKey`,
|
|
27
|
-
fields: {
|
|
28
|
-
dummy_field: bcs.bool(),
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
export const Treasury = new MoveStruct({
|
|
32
|
-
name: `${$moduleName}::Treasury`,
|
|
33
|
-
fields: {
|
|
34
|
-
id: object.UID,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
export interface BalanceOfArguments {
|
|
38
|
-
self: RawTransactionArgument<string>;
|
|
39
|
-
}
|
|
40
|
-
export interface BalanceOfOptions {
|
|
41
|
-
package?: string;
|
|
42
|
-
arguments: BalanceOfArguments | [self: RawTransactionArgument<string>];
|
|
43
|
-
typeArguments: [string];
|
|
44
|
-
}
|
|
45
|
-
export function balanceOf(options: BalanceOfOptions) {
|
|
46
|
-
const packageAddress = options.package ?? "@local-pkg/zing_governance";
|
|
47
|
-
const argumentsTypes = [
|
|
48
|
-
`${packageAddress}::treasury::Treasury`,
|
|
49
|
-
] satisfies string[];
|
|
50
|
-
const parameterNames = ["self"];
|
|
51
|
-
return (tx: Transaction) =>
|
|
52
|
-
tx.moveCall({
|
|
53
|
-
package: packageAddress,
|
|
54
|
-
module: "treasury",
|
|
55
|
-
function: "balance_of",
|
|
56
|
-
arguments: normalizeMoveArguments(
|
|
57
|
-
options.arguments,
|
|
58
|
-
argumentsTypes,
|
|
59
|
-
parameterNames,
|
|
60
|
-
),
|
|
61
|
-
typeArguments: options.typeArguments,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
export interface SupplyTreasuryArguments {
|
|
65
|
-
self: RawTransactionArgument<string>;
|
|
66
|
-
balance: RawTransactionArgument<string>;
|
|
67
|
-
}
|
|
68
|
-
export interface SupplyTreasuryOptions {
|
|
69
|
-
package?: string;
|
|
70
|
-
arguments:
|
|
71
|
-
| SupplyTreasuryArguments
|
|
72
|
-
| [
|
|
73
|
-
self: RawTransactionArgument<string>,
|
|
74
|
-
balance: RawTransactionArgument<string>,
|
|
75
|
-
];
|
|
76
|
-
typeArguments: [string];
|
|
77
|
-
}
|
|
78
|
-
export function supplyTreasury(options: SupplyTreasuryOptions) {
|
|
79
|
-
const packageAddress = options.package ?? "@local-pkg/zing_governance";
|
|
80
|
-
const argumentsTypes = [
|
|
81
|
-
`${packageAddress}::treasury::Treasury`,
|
|
82
|
-
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
83
|
-
] satisfies string[];
|
|
84
|
-
const parameterNames = ["self", "balance"];
|
|
85
|
-
return (tx: Transaction) =>
|
|
86
|
-
tx.moveCall({
|
|
87
|
-
package: packageAddress,
|
|
88
|
-
module: "treasury",
|
|
89
|
-
function: "supply_treasury",
|
|
90
|
-
arguments: normalizeMoveArguments(
|
|
91
|
-
options.arguments,
|
|
92
|
-
argumentsTypes,
|
|
93
|
-
parameterNames,
|
|
94
|
-
),
|
|
95
|
-
typeArguments: options.typeArguments,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export interface ClaimArguments {
|
|
99
|
-
self: RawTransactionArgument<string>;
|
|
100
|
-
Cap: RawTransactionArgument<string>;
|
|
101
|
-
value: RawTransactionArgument<number | bigint>;
|
|
102
|
-
}
|
|
103
|
-
export interface ClaimOptions {
|
|
104
|
-
package?: string;
|
|
105
|
-
arguments:
|
|
106
|
-
| ClaimArguments
|
|
107
|
-
| [
|
|
108
|
-
self: RawTransactionArgument<string>,
|
|
109
|
-
Cap: RawTransactionArgument<string>,
|
|
110
|
-
value: RawTransactionArgument<number | bigint>,
|
|
111
|
-
];
|
|
112
|
-
typeArguments: [string];
|
|
113
|
-
}
|
|
114
|
-
export function claim(options: ClaimOptions) {
|
|
115
|
-
const packageAddress = options.package ?? "@local-pkg/zing_governance";
|
|
116
|
-
const argumentsTypes = [
|
|
117
|
-
`${packageAddress}::treasury::Treasury`,
|
|
118
|
-
`${packageAddress}::admin::AdminCap`,
|
|
119
|
-
"u64",
|
|
120
|
-
] satisfies string[];
|
|
121
|
-
const parameterNames = ["self", "Cap", "value"];
|
|
122
|
-
return (tx: Transaction) =>
|
|
123
|
-
tx.moveCall({
|
|
124
|
-
package: packageAddress,
|
|
125
|
-
module: "treasury",
|
|
126
|
-
function: "claim",
|
|
127
|
-
arguments: normalizeMoveArguments(
|
|
128
|
-
options.arguments,
|
|
129
|
-
argumentsTypes,
|
|
130
|
-
parameterNames,
|
|
131
|
-
),
|
|
132
|
-
typeArguments: options.typeArguments,
|
|
133
|
-
});
|
|
134
|
-
}
|