@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,272 +0,0 @@
|
|
|
1
|
-
import * as object from "./object.js";
|
|
2
|
-
import { MoveStruct, normalizeMoveArguments } from "../../../utils/index.js";
|
|
3
|
-
import type { RawTransactionArgument } from "../../../utils/index.js";
|
|
4
|
-
import type { BcsType } from "@mysten/sui/bcs";
|
|
5
|
-
import type { Transaction } from "@mysten/sui/transactions";
|
|
6
|
-
|
|
7
|
-
const $moduleName = "@local-pkg/suiii::dynamic_field";
|
|
8
|
-
/** Internal object used for storing the field and value */
|
|
9
|
-
export function Field<Name extends BcsType<any>, Value extends BcsType<any>>(
|
|
10
|
-
...typeParameters: [Name, Value]
|
|
11
|
-
) {
|
|
12
|
-
return new MoveStruct({
|
|
13
|
-
name: `${$moduleName}::Field<${typeParameters[0].name as Name["name"]}, ${typeParameters[1].name as Value["name"]}>`,
|
|
14
|
-
fields: {
|
|
15
|
-
/**
|
|
16
|
-
* Determined by the hash of the object ID, the field name value and it's type,
|
|
17
|
-
* i.e. hash(parent.id || name || Name)
|
|
18
|
-
*/
|
|
19
|
-
id: object.UID,
|
|
20
|
-
/** The value for the name of this field */
|
|
21
|
-
name: typeParameters[0],
|
|
22
|
-
/** The value bound to this field */
|
|
23
|
-
value: typeParameters[1],
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
export interface BorrowArguments<Name extends BcsType<any>> {
|
|
28
|
-
object: RawTransactionArgument<string>;
|
|
29
|
-
name: RawTransactionArgument<Name>;
|
|
30
|
-
}
|
|
31
|
-
export interface BorrowOptions<Name extends BcsType<any>> {
|
|
32
|
-
package?: string;
|
|
33
|
-
arguments:
|
|
34
|
-
| BorrowArguments<Name>
|
|
35
|
-
| [
|
|
36
|
-
object: RawTransactionArgument<string>,
|
|
37
|
-
name: RawTransactionArgument<Name>,
|
|
38
|
-
];
|
|
39
|
-
typeArguments: [string, string];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Immutably borrows the `object`s dynamic field with the name specified by
|
|
43
|
-
* `name: Name`. Aborts with `EFieldDoesNotExist` if the object does not have a
|
|
44
|
-
* field with that name. Aborts with `EFieldTypeMismatch` if the field exists, but
|
|
45
|
-
* the value does not have the specified type.
|
|
46
|
-
*/
|
|
47
|
-
export function borrow<Name extends BcsType<any>>(
|
|
48
|
-
options: BorrowOptions<Name>,
|
|
49
|
-
) {
|
|
50
|
-
const packageAddress = options.package ?? "@local-pkg/suiii";
|
|
51
|
-
const argumentsTypes = [
|
|
52
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
53
|
-
`${options.typeArguments[0]}`,
|
|
54
|
-
] satisfies string[];
|
|
55
|
-
const parameterNames = ["object", "name"];
|
|
56
|
-
return (tx: Transaction) =>
|
|
57
|
-
tx.moveCall({
|
|
58
|
-
package: packageAddress,
|
|
59
|
-
module: "dynamic_field",
|
|
60
|
-
function: "borrow",
|
|
61
|
-
arguments: normalizeMoveArguments(
|
|
62
|
-
options.arguments,
|
|
63
|
-
argumentsTypes,
|
|
64
|
-
parameterNames,
|
|
65
|
-
),
|
|
66
|
-
typeArguments: options.typeArguments,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
export interface BorrowMutArguments<Name extends BcsType<any>> {
|
|
70
|
-
object: RawTransactionArgument<string>;
|
|
71
|
-
name: RawTransactionArgument<Name>;
|
|
72
|
-
}
|
|
73
|
-
export interface BorrowMutOptions<Name extends BcsType<any>> {
|
|
74
|
-
package?: string;
|
|
75
|
-
arguments:
|
|
76
|
-
| BorrowMutArguments<Name>
|
|
77
|
-
| [
|
|
78
|
-
object: RawTransactionArgument<string>,
|
|
79
|
-
name: RawTransactionArgument<Name>,
|
|
80
|
-
];
|
|
81
|
-
typeArguments: [string, string];
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Mutably borrows the `object`s dynamic field with the name specified by
|
|
85
|
-
* `name: Name`. Aborts with `EFieldDoesNotExist` if the object does not have a
|
|
86
|
-
* field with that name. Aborts with `EFieldTypeMismatch` if the field exists, but
|
|
87
|
-
* the value does not have the specified type.
|
|
88
|
-
*/
|
|
89
|
-
export function borrowMut<Name extends BcsType<any>>(
|
|
90
|
-
options: BorrowMutOptions<Name>,
|
|
91
|
-
) {
|
|
92
|
-
const packageAddress = options.package ?? "@local-pkg/suiii";
|
|
93
|
-
const argumentsTypes = [
|
|
94
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
95
|
-
`${options.typeArguments[0]}`,
|
|
96
|
-
] satisfies string[];
|
|
97
|
-
const parameterNames = ["object", "name"];
|
|
98
|
-
return (tx: Transaction) =>
|
|
99
|
-
tx.moveCall({
|
|
100
|
-
package: packageAddress,
|
|
101
|
-
module: "dynamic_field",
|
|
102
|
-
function: "borrow_mut",
|
|
103
|
-
arguments: normalizeMoveArguments(
|
|
104
|
-
options.arguments,
|
|
105
|
-
argumentsTypes,
|
|
106
|
-
parameterNames,
|
|
107
|
-
),
|
|
108
|
-
typeArguments: options.typeArguments,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
export interface RemoveArguments<Name extends BcsType<any>> {
|
|
112
|
-
object: RawTransactionArgument<string>;
|
|
113
|
-
name: RawTransactionArgument<Name>;
|
|
114
|
-
}
|
|
115
|
-
export interface RemoveOptions<Name extends BcsType<any>> {
|
|
116
|
-
package?: string;
|
|
117
|
-
arguments:
|
|
118
|
-
| RemoveArguments<Name>
|
|
119
|
-
| [
|
|
120
|
-
object: RawTransactionArgument<string>,
|
|
121
|
-
name: RawTransactionArgument<Name>,
|
|
122
|
-
];
|
|
123
|
-
typeArguments: [string, string];
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Removes the `object`s dynamic field with the name specified by `name: Name` and
|
|
127
|
-
* returns the bound value. Aborts with `EFieldDoesNotExist` if the object does not
|
|
128
|
-
* have a field with that name. Aborts with `EFieldTypeMismatch` if the field
|
|
129
|
-
* exists, but the value does not have the specified type.
|
|
130
|
-
*/
|
|
131
|
-
export function remove<Name extends BcsType<any>>(
|
|
132
|
-
options: RemoveOptions<Name>,
|
|
133
|
-
) {
|
|
134
|
-
const packageAddress = options.package ?? "@local-pkg/suiii";
|
|
135
|
-
const argumentsTypes = [
|
|
136
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
137
|
-
`${options.typeArguments[0]}`,
|
|
138
|
-
] satisfies string[];
|
|
139
|
-
const parameterNames = ["object", "name"];
|
|
140
|
-
return (tx: Transaction) =>
|
|
141
|
-
tx.moveCall({
|
|
142
|
-
package: packageAddress,
|
|
143
|
-
module: "dynamic_field",
|
|
144
|
-
function: "remove",
|
|
145
|
-
arguments: normalizeMoveArguments(
|
|
146
|
-
options.arguments,
|
|
147
|
-
argumentsTypes,
|
|
148
|
-
parameterNames,
|
|
149
|
-
),
|
|
150
|
-
typeArguments: options.typeArguments,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
export interface Exists_Arguments<Name extends BcsType<any>> {
|
|
154
|
-
object: RawTransactionArgument<string>;
|
|
155
|
-
name: RawTransactionArgument<Name>;
|
|
156
|
-
}
|
|
157
|
-
export interface Exists_Options<Name extends BcsType<any>> {
|
|
158
|
-
package?: string;
|
|
159
|
-
arguments:
|
|
160
|
-
| Exists_Arguments<Name>
|
|
161
|
-
| [
|
|
162
|
-
object: RawTransactionArgument<string>,
|
|
163
|
-
name: RawTransactionArgument<Name>,
|
|
164
|
-
];
|
|
165
|
-
typeArguments: [string];
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Returns true if and only if the `object` has a dynamic field with the name
|
|
169
|
-
* specified by `name: Name` but without specifying the `Value` type
|
|
170
|
-
*/
|
|
171
|
-
export function exists_<Name extends BcsType<any>>(
|
|
172
|
-
options: Exists_Options<Name>,
|
|
173
|
-
) {
|
|
174
|
-
const packageAddress = options.package ?? "@local-pkg/suiii";
|
|
175
|
-
const argumentsTypes = [
|
|
176
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
177
|
-
`${options.typeArguments[0]}`,
|
|
178
|
-
] satisfies string[];
|
|
179
|
-
const parameterNames = ["object", "name"];
|
|
180
|
-
return (tx: Transaction) =>
|
|
181
|
-
tx.moveCall({
|
|
182
|
-
package: packageAddress,
|
|
183
|
-
module: "dynamic_field",
|
|
184
|
-
function: "exists_",
|
|
185
|
-
arguments: normalizeMoveArguments(
|
|
186
|
-
options.arguments,
|
|
187
|
-
argumentsTypes,
|
|
188
|
-
parameterNames,
|
|
189
|
-
),
|
|
190
|
-
typeArguments: options.typeArguments,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
export interface RemoveIfExistsArguments<Name extends BcsType<any>> {
|
|
194
|
-
object: RawTransactionArgument<string>;
|
|
195
|
-
name: RawTransactionArgument<Name>;
|
|
196
|
-
}
|
|
197
|
-
export interface RemoveIfExistsOptions<Name extends BcsType<any>> {
|
|
198
|
-
package?: string;
|
|
199
|
-
arguments:
|
|
200
|
-
| RemoveIfExistsArguments<Name>
|
|
201
|
-
| [
|
|
202
|
-
object: RawTransactionArgument<string>,
|
|
203
|
-
name: RawTransactionArgument<Name>,
|
|
204
|
-
];
|
|
205
|
-
typeArguments: [string, string];
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Removes the dynamic field if it exists. Returns the `some(Value)` if it exists
|
|
209
|
-
* or none otherwise.
|
|
210
|
-
*/
|
|
211
|
-
export function removeIfExists<Name extends BcsType<any>>(
|
|
212
|
-
options: RemoveIfExistsOptions<Name>,
|
|
213
|
-
) {
|
|
214
|
-
const packageAddress = options.package ?? "@local-pkg/suiii";
|
|
215
|
-
const argumentsTypes = [
|
|
216
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
217
|
-
`${options.typeArguments[0]}`,
|
|
218
|
-
] satisfies string[];
|
|
219
|
-
const parameterNames = ["object", "name"];
|
|
220
|
-
return (tx: Transaction) =>
|
|
221
|
-
tx.moveCall({
|
|
222
|
-
package: packageAddress,
|
|
223
|
-
module: "dynamic_field",
|
|
224
|
-
function: "remove_if_exists",
|
|
225
|
-
arguments: normalizeMoveArguments(
|
|
226
|
-
options.arguments,
|
|
227
|
-
argumentsTypes,
|
|
228
|
-
parameterNames,
|
|
229
|
-
),
|
|
230
|
-
typeArguments: options.typeArguments,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
export interface ExistsWithTypeArguments<Name extends BcsType<any>> {
|
|
234
|
-
object: RawTransactionArgument<string>;
|
|
235
|
-
name: RawTransactionArgument<Name>;
|
|
236
|
-
}
|
|
237
|
-
export interface ExistsWithTypeOptions<Name extends BcsType<any>> {
|
|
238
|
-
package?: string;
|
|
239
|
-
arguments:
|
|
240
|
-
| ExistsWithTypeArguments<Name>
|
|
241
|
-
| [
|
|
242
|
-
object: RawTransactionArgument<string>,
|
|
243
|
-
name: RawTransactionArgument<Name>,
|
|
244
|
-
];
|
|
245
|
-
typeArguments: [string, string];
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Returns true if and only if the `object` has a dynamic field with the name
|
|
249
|
-
* specified by `name: Name` with an assigned value of type `Value`.
|
|
250
|
-
*/
|
|
251
|
-
export function existsWithType<Name extends BcsType<any>>(
|
|
252
|
-
options: ExistsWithTypeOptions<Name>,
|
|
253
|
-
) {
|
|
254
|
-
const packageAddress = options.package ?? "@local-pkg/suiii";
|
|
255
|
-
const argumentsTypes = [
|
|
256
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::UID",
|
|
257
|
-
`${options.typeArguments[0]}`,
|
|
258
|
-
] satisfies string[];
|
|
259
|
-
const parameterNames = ["object", "name"];
|
|
260
|
-
return (tx: Transaction) =>
|
|
261
|
-
tx.moveCall({
|
|
262
|
-
package: packageAddress,
|
|
263
|
-
module: "dynamic_field",
|
|
264
|
-
function: "exists_with_type",
|
|
265
|
-
arguments: normalizeMoveArguments(
|
|
266
|
-
options.arguments,
|
|
267
|
-
argumentsTypes,
|
|
268
|
-
parameterNames,
|
|
269
|
-
),
|
|
270
|
-
typeArguments: options.typeArguments,
|
|
271
|
-
});
|
|
272
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { MoveStruct } from "../../../utils/index.js";
|
|
2
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
3
|
-
|
|
4
|
-
const $moduleName = "@local-pkg/walrus::events";
|
|
5
|
-
|
|
6
|
-
export const BlobRegistered = new MoveStruct({
|
|
7
|
-
name: `${$moduleName}::BlobRegistered`,
|
|
8
|
-
fields: {
|
|
9
|
-
epoch: bcs.u32(),
|
|
10
|
-
blob_id: bcs.u256(),
|
|
11
|
-
size: bcs.u64(),
|
|
12
|
-
encoding_type: bcs.u8(),
|
|
13
|
-
end_epoch: bcs.u32(),
|
|
14
|
-
deletable: bcs.bool(),
|
|
15
|
-
object_id: bcs.Address,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
export const BlobCertified = new MoveStruct({
|
|
19
|
-
name: `${$moduleName}::BlobCertified`,
|
|
20
|
-
fields: {
|
|
21
|
-
epoch: bcs.u32(),
|
|
22
|
-
blob_id: bcs.u256(),
|
|
23
|
-
end_epoch: bcs.u32(),
|
|
24
|
-
deletable: bcs.bool(),
|
|
25
|
-
object_id: bcs.Address,
|
|
26
|
-
is_extension: bcs.bool(),
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
export const BlobDeleted = new MoveStruct({
|
|
30
|
-
name: `${$moduleName}::BlobDeleted`,
|
|
31
|
-
fields: {
|
|
32
|
-
epoch: bcs.u32(),
|
|
33
|
-
blob_id: bcs.u256(),
|
|
34
|
-
end_epoch: bcs.u32(),
|
|
35
|
-
object_id: bcs.Address,
|
|
36
|
-
was_certified: bcs.bool(),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
export const InvalidBlobID = new MoveStruct({
|
|
40
|
-
name: `${$moduleName}::InvalidBlobID`,
|
|
41
|
-
fields: {
|
|
42
|
-
epoch: bcs.u32(),
|
|
43
|
-
blob_id: bcs.u256(),
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
export const EpochChangeStart = new MoveStruct({
|
|
47
|
-
name: `${$moduleName}::EpochChangeStart`,
|
|
48
|
-
fields: {
|
|
49
|
-
epoch: bcs.u32(),
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
export const EpochChangeDone = new MoveStruct({
|
|
53
|
-
name: `${$moduleName}::EpochChangeDone`,
|
|
54
|
-
fields: {
|
|
55
|
-
epoch: bcs.u32(),
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
export const ShardsReceived = new MoveStruct({
|
|
59
|
-
name: `${$moduleName}::ShardsReceived`,
|
|
60
|
-
fields: {
|
|
61
|
-
epoch: bcs.u32(),
|
|
62
|
-
shards: bcs.vector(bcs.u16()),
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
export const EpochParametersSelected = new MoveStruct({
|
|
66
|
-
name: `${$moduleName}::EpochParametersSelected`,
|
|
67
|
-
fields: {
|
|
68
|
-
next_epoch: bcs.u32(),
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
export const ShardRecoveryStart = new MoveStruct({
|
|
72
|
-
name: `${$moduleName}::ShardRecoveryStart`,
|
|
73
|
-
fields: {
|
|
74
|
-
epoch: bcs.u32(),
|
|
75
|
-
shards: bcs.vector(bcs.u16()),
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
export const ContractUpgraded = new MoveStruct({
|
|
79
|
-
name: `${$moduleName}::ContractUpgraded`,
|
|
80
|
-
fields: {
|
|
81
|
-
epoch: bcs.u32(),
|
|
82
|
-
package_id: bcs.Address,
|
|
83
|
-
version: bcs.u64(),
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
export const RegisterDenyListUpdate = new MoveStruct({
|
|
87
|
-
name: `${$moduleName}::RegisterDenyListUpdate`,
|
|
88
|
-
fields: {
|
|
89
|
-
epoch: bcs.u32(),
|
|
90
|
-
root: bcs.u256(),
|
|
91
|
-
sequence_number: bcs.u64(),
|
|
92
|
-
node_id: bcs.Address,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
export const DenyListUpdate = new MoveStruct({
|
|
96
|
-
name: `${$moduleName}::DenyListUpdate`,
|
|
97
|
-
fields: {
|
|
98
|
-
epoch: bcs.u32(),
|
|
99
|
-
root: bcs.u256(),
|
|
100
|
-
sequence_number: bcs.u64(),
|
|
101
|
-
node_id: bcs.Address,
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
export const DenyListBlobDeleted = new MoveStruct({
|
|
105
|
-
name: `${$moduleName}::DenyListBlobDeleted`,
|
|
106
|
-
fields: {
|
|
107
|
-
epoch: bcs.u32(),
|
|
108
|
-
blob_id: bcs.u256(),
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
export const ContractUpgradeProposed = new MoveStruct({
|
|
112
|
-
name: `${$moduleName}::ContractUpgradeProposed`,
|
|
113
|
-
fields: {
|
|
114
|
-
epoch: bcs.u32(),
|
|
115
|
-
package_digest: bcs.vector(bcs.u8()),
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
export const ContractUpgradeQuorumReached = new MoveStruct({
|
|
119
|
-
name: `${$moduleName}::ContractUpgradeQuorumReached`,
|
|
120
|
-
fields: {
|
|
121
|
-
epoch: bcs.u32(),
|
|
122
|
-
package_digest: bcs.vector(bcs.u8()),
|
|
123
|
-
},
|
|
124
|
-
});
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { MoveStruct, normalizeMoveArguments } from "../../../utils/index.js";
|
|
2
|
-
import * as vec_map from "../sui/vec_map.js";
|
|
3
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
4
|
-
import type { RawTransactionArgument } from "../../../utils/index.js";
|
|
5
|
-
import type { Transaction } from "@mysten/sui/transactions";
|
|
6
|
-
|
|
7
|
-
const $moduleName = "@local-pkg/walrus::metadata";
|
|
8
|
-
export const Metadata = new MoveStruct({
|
|
9
|
-
name: `${$moduleName}::Metadata`,
|
|
10
|
-
fields: {
|
|
11
|
-
metadata: vec_map.VecMap(bcs.string(), bcs.string()),
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
export interface NewOptions {
|
|
15
|
-
package?: string;
|
|
16
|
-
arguments?: [];
|
|
17
|
-
}
|
|
18
|
-
/** Creates a new instance of Metadata. */
|
|
19
|
-
export function _new(options: NewOptions = {}) {
|
|
20
|
-
const packageAddress = options.package ?? "@local-pkg/walrus";
|
|
21
|
-
return (tx: Transaction) =>
|
|
22
|
-
tx.moveCall({
|
|
23
|
-
package: packageAddress,
|
|
24
|
-
module: "metadata",
|
|
25
|
-
function: "new",
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export interface InsertOrUpdateArguments {
|
|
29
|
-
self: RawTransactionArgument<string>;
|
|
30
|
-
key: RawTransactionArgument<string>;
|
|
31
|
-
value: RawTransactionArgument<string>;
|
|
32
|
-
}
|
|
33
|
-
export interface InsertOrUpdateOptions {
|
|
34
|
-
package?: string;
|
|
35
|
-
arguments:
|
|
36
|
-
| InsertOrUpdateArguments
|
|
37
|
-
| [
|
|
38
|
-
self: RawTransactionArgument<string>,
|
|
39
|
-
key: RawTransactionArgument<string>,
|
|
40
|
-
value: RawTransactionArgument<string>,
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Inserts a key-value pair into the metadata.
|
|
45
|
-
*
|
|
46
|
-
* If the key is already present, the value is updated.
|
|
47
|
-
*/
|
|
48
|
-
export function insertOrUpdate(options: InsertOrUpdateOptions) {
|
|
49
|
-
const packageAddress = options.package ?? "@local-pkg/walrus";
|
|
50
|
-
const argumentsTypes = [
|
|
51
|
-
`${packageAddress}::metadata::Metadata`,
|
|
52
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
53
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
54
|
-
] satisfies string[];
|
|
55
|
-
const parameterNames = ["self", "key", "value"];
|
|
56
|
-
return (tx: Transaction) =>
|
|
57
|
-
tx.moveCall({
|
|
58
|
-
package: packageAddress,
|
|
59
|
-
module: "metadata",
|
|
60
|
-
function: "insert_or_update",
|
|
61
|
-
arguments: normalizeMoveArguments(
|
|
62
|
-
options.arguments,
|
|
63
|
-
argumentsTypes,
|
|
64
|
-
parameterNames,
|
|
65
|
-
),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
export interface RemoveArguments {
|
|
69
|
-
self: RawTransactionArgument<string>;
|
|
70
|
-
key: RawTransactionArgument<string>;
|
|
71
|
-
}
|
|
72
|
-
export interface RemoveOptions {
|
|
73
|
-
package?: string;
|
|
74
|
-
arguments:
|
|
75
|
-
| RemoveArguments
|
|
76
|
-
| [
|
|
77
|
-
self: RawTransactionArgument<string>,
|
|
78
|
-
key: RawTransactionArgument<string>,
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
/** Removes the metadata associated with the given key. */
|
|
82
|
-
export function remove(options: RemoveOptions) {
|
|
83
|
-
const packageAddress = options.package ?? "@local-pkg/walrus";
|
|
84
|
-
const argumentsTypes = [
|
|
85
|
-
`${packageAddress}::metadata::Metadata`,
|
|
86
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
87
|
-
] satisfies string[];
|
|
88
|
-
const parameterNames = ["self", "key"];
|
|
89
|
-
return (tx: Transaction) =>
|
|
90
|
-
tx.moveCall({
|
|
91
|
-
package: packageAddress,
|
|
92
|
-
module: "metadata",
|
|
93
|
-
function: "remove",
|
|
94
|
-
arguments: normalizeMoveArguments(
|
|
95
|
-
options.arguments,
|
|
96
|
-
argumentsTypes,
|
|
97
|
-
parameterNames,
|
|
98
|
-
),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
export interface RemoveIfExistsArguments {
|
|
102
|
-
self: RawTransactionArgument<string>;
|
|
103
|
-
key: RawTransactionArgument<string>;
|
|
104
|
-
}
|
|
105
|
-
export interface RemoveIfExistsOptions {
|
|
106
|
-
package?: string;
|
|
107
|
-
arguments:
|
|
108
|
-
| RemoveIfExistsArguments
|
|
109
|
-
| [
|
|
110
|
-
self: RawTransactionArgument<string>,
|
|
111
|
-
key: RawTransactionArgument<string>,
|
|
112
|
-
];
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Removes the metadata associated with the given key, if it exists.
|
|
116
|
-
*
|
|
117
|
-
* Optionally returns the previous value associated with the key.
|
|
118
|
-
*/
|
|
119
|
-
export function removeIfExists(options: RemoveIfExistsOptions) {
|
|
120
|
-
const packageAddress = options.package ?? "@local-pkg/walrus";
|
|
121
|
-
const argumentsTypes = [
|
|
122
|
-
`${packageAddress}::metadata::Metadata`,
|
|
123
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
124
|
-
] satisfies string[];
|
|
125
|
-
const parameterNames = ["self", "key"];
|
|
126
|
-
return (tx: Transaction) =>
|
|
127
|
-
tx.moveCall({
|
|
128
|
-
package: packageAddress,
|
|
129
|
-
module: "metadata",
|
|
130
|
-
function: "remove_if_exists",
|
|
131
|
-
arguments: normalizeMoveArguments(
|
|
132
|
-
options.arguments,
|
|
133
|
-
argumentsTypes,
|
|
134
|
-
parameterNames,
|
|
135
|
-
),
|
|
136
|
-
});
|
|
137
|
-
}
|