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