@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.
Files changed (227) hide show
  1. package/dist/_generated/index.js +6 -0
  2. package/dist/_generated/utils/index.d.ts +12 -0
  3. package/dist/_generated/utils/index.js +135 -0
  4. package/dist/_generated/zing_framework/coin_utils.d.ts +15 -0
  5. package/dist/_generated/zing_framework/coin_utils.js +19 -0
  6. package/dist/_generated/zing_framework/deps/sui/object.d.ts +8 -0
  7. package/{src/_generated/zing_governance/deps/sui/object.ts → dist/_generated/zing_framework/deps/sui/object.js} +4 -7
  8. package/dist/_generated/zing_framework/derived_object_bag.d.ts +166 -0
  9. package/dist/_generated/zing_framework/derived_object_bag.js +221 -0
  10. package/dist/_generated/zing_framework/derived_table.d.ts +153 -0
  11. package/dist/_generated/zing_framework/derived_table.js +200 -0
  12. package/dist/_generated/zing_governance/admin.d.ts +20 -0
  13. package/dist/_generated/zing_governance/admin.js +26 -0
  14. package/dist/_generated/zing_governance/deps/sui/object.d.ts +8 -0
  15. package/{src/_generated/zing_identity/deps/sui/object.ts → dist/_generated/zing_governance/deps/sui/object.js} +4 -7
  16. package/dist/_generated/zing_governance/treasury.d.ts +56 -0
  17. package/dist/_generated/zing_governance/treasury.js +78 -0
  18. package/dist/_generated/zing_identity/config.d.ts +87 -0
  19. package/dist/_generated/zing_identity/config.js +98 -0
  20. package/{src/_generated/zing_studio/deps/std/type_name.ts → dist/_generated/zing_identity/deps/std/type_name.d.ts} +3 -11
  21. package/dist/_generated/zing_identity/deps/std/type_name.js +22 -0
  22. package/dist/_generated/zing_identity/deps/sui/object.d.ts +8 -0
  23. package/{src/_generated/zing_studio/deps/sui/object.ts → dist/_generated/zing_identity/deps/sui/object.js} +4 -7
  24. package/dist/_generated/zing_identity/deps/sui/object_table.d.ts +12 -0
  25. package/{src/_generated/zing_identity/deps/sui/object_table.ts → dist/_generated/zing_identity/deps/sui/object_table.js} +7 -10
  26. package/dist/_generated/zing_identity/deps/sui/table.d.ts +12 -0
  27. package/{src/_generated/zing_studio/deps/sui/table.ts → dist/_generated/zing_identity/deps/sui/table.js} +7 -10
  28. package/{src/_generated/zing_identity/deps/sui/vec_set.ts → dist/_generated/zing_identity/deps/sui/vec_set.d.ts} +3 -14
  29. package/dist/_generated/zing_identity/deps/sui/vec_set.js +22 -0
  30. package/dist/_generated/zing_identity/ecdsa.d.ts +81 -0
  31. package/dist/_generated/zing_identity/ecdsa.js +87 -0
  32. package/dist/_generated/zing_identity/identity.d.ts +262 -0
  33. package/dist/_generated/zing_identity/identity.js +294 -0
  34. package/dist/_generated/zing_identity/reclaim.d.ts +356 -0
  35. package/dist/_generated/zing_identity/reclaim.js +414 -0
  36. package/dist/_generated/zing_studio/app.d.ts +351 -0
  37. package/dist/_generated/zing_studio/app.js +451 -0
  38. package/dist/_generated/zing_studio/article.d.ts +331 -0
  39. package/dist/_generated/zing_studio/article.js +331 -0
  40. package/dist/_generated/zing_studio/config.d.ts +203 -0
  41. package/dist/_generated/zing_studio/config.js +233 -0
  42. package/{src/_generated/zing_identity/deps/std/type_name.ts → dist/_generated/zing_studio/deps/std/type_name.d.ts} +3 -11
  43. package/dist/_generated/zing_studio/deps/std/type_name.js +22 -0
  44. package/dist/_generated/zing_studio/deps/sui/bag.d.ts +12 -0
  45. package/{src/_generated/zing_studio/deps/sui/bag.ts → dist/_generated/zing_studio/deps/sui/bag.js} +7 -10
  46. package/dist/_generated/zing_studio/deps/sui/balance.d.ts +12 -0
  47. package/{src/_generated/zing_studio/deps/sui/balance.ts → dist/_generated/zing_studio/deps/sui/balance.js} +4 -7
  48. package/dist/_generated/zing_studio/deps/sui/coin.d.ts +12 -0
  49. package/{src/_generated/zing_studio/deps/sui/coin.ts → dist/_generated/zing_studio/deps/sui/coin.js} +5 -8
  50. package/dist/_generated/zing_studio/deps/sui/dynamic_field.d.ts +126 -0
  51. package/dist/_generated/zing_studio/deps/sui/dynamic_field.js +140 -0
  52. package/dist/_generated/zing_studio/deps/sui/object.d.ts +8 -0
  53. package/{src/_generated/zing_framework/deps/sui/object.ts → dist/_generated/zing_studio/deps/sui/object.js} +4 -7
  54. package/dist/_generated/zing_studio/deps/sui/table.d.ts +12 -0
  55. package/{src/_generated/zing_identity/deps/sui/table.ts → dist/_generated/zing_studio/deps/sui/table.js} +7 -10
  56. package/dist/_generated/zing_studio/deps/sui/vec_map.d.ts +30 -0
  57. package/{src/_generated/zing_studio/deps/sui/vec_map.ts → dist/_generated/zing_studio/deps/sui/vec_map.js} +15 -21
  58. package/{src/_generated/zing_studio/deps/sui/vec_set.ts → dist/_generated/zing_studio/deps/sui/vec_set.d.ts} +3 -14
  59. package/dist/_generated/zing_studio/deps/sui/vec_set.js +22 -0
  60. package/dist/_generated/zing_studio/deps/walrus/blob.d.ts +20 -0
  61. package/{src/_generated/zing_studio/deps/walrus/blob.ts → dist/_generated/zing_studio/deps/walrus/blob.js} +11 -12
  62. package/dist/_generated/zing_studio/deps/walrus/events.d.ts +83 -0
  63. package/dist/_generated/zing_studio/deps/walrus/events.js +122 -0
  64. package/dist/_generated/zing_studio/deps/walrus/metadata.d.ts +71 -0
  65. package/dist/_generated/zing_studio/deps/walrus/metadata.js +73 -0
  66. package/dist/_generated/zing_studio/deps/walrus/storage_resource.d.ts +12 -0
  67. package/{src/_generated/zing_studio/deps/walrus/storage_resource.ts → dist/_generated/zing_studio/deps/walrus/storage_resource.js} +7 -8
  68. package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.d.ts +12 -0
  69. 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
  70. package/dist/_generated/zing_studio/deps/zing_framework/derived_table.d.ts +12 -0
  71. package/{src/_generated/zing_studio/deps/zing_framework/derived_table.ts → dist/_generated/zing_studio/deps/zing_framework/derived_table.js} +7 -8
  72. package/dist/_generated/zing_studio/donation.d.ts +24 -0
  73. package/{src/_generated/zing_studio/donation.ts → dist/_generated/zing_studio/donation.js} +7 -8
  74. package/dist/_generated/zing_studio/enclave.d.ts +187 -0
  75. package/dist/_generated/zing_studio/enclave.js +231 -0
  76. package/dist/_generated/zing_studio/nitro_attestation.d.ts +148 -0
  77. package/dist/_generated/zing_studio/nitro_attestation.js +183 -0
  78. package/dist/_generated/zing_studio/referral.d.ts +166 -0
  79. package/dist/_generated/zing_studio/referral.js +224 -0
  80. package/dist/_generated/zing_studio/storage.d.ts +327 -0
  81. package/dist/_generated/zing_studio/storage.js +365 -0
  82. package/dist/_generated/zing_studio/studio.d.ts +282 -0
  83. package/dist/_generated/zing_studio/studio.js +360 -0
  84. package/dist/bcs.d.ts +61 -0
  85. package/dist/bcs.js +109 -0
  86. package/dist/client/index.d.ts +228 -0
  87. package/dist/client/index.js +296 -0
  88. package/dist/client/types.d.ts +23 -0
  89. package/dist/client/types.js +1 -0
  90. package/dist/components/index.js +3 -0
  91. package/dist/components/wallet-provider.d.ts +7 -0
  92. package/dist/components/wallet-provider.js +33 -0
  93. package/dist/components/walrus-provider.d.ts +31 -0
  94. package/dist/components/walrus-provider.js +71 -0
  95. package/dist/components/zing-provider.d.ts +15 -0
  96. package/dist/components/zing-provider.js +22 -0
  97. package/dist/config/common.d.ts +23 -0
  98. package/dist/config/common.js +61 -0
  99. package/dist/config/index.d.ts +8 -0
  100. package/dist/config/index.js +28 -0
  101. package/dist/config/mainnet.d.ts +6 -0
  102. package/dist/config/mainnet.js +80 -0
  103. package/dist/config/testnet.d.ts +6 -0
  104. package/dist/config/testnet.js +81 -0
  105. package/dist/config/types.d.ts +49 -0
  106. package/dist/config/types.js +1 -0
  107. package/dist/const.d.ts +4 -0
  108. package/dist/const.js +25 -0
  109. package/dist/getters.d.ts +228 -0
  110. package/dist/getters.js +317 -0
  111. package/{src/hooks/index.ts → dist/hooks/index.d.ts} +2 -3
  112. package/dist/hooks/index.js +9 -0
  113. package/dist/hooks/useGetStudio.d.ts +26 -0
  114. package/dist/hooks/useGetStudio.js +17 -0
  115. package/dist/hooks/useGetTierPlan.d.ts +7 -0
  116. package/dist/hooks/useGetTierPlan.js +85 -0
  117. package/dist/hooks/useReclaim.d.ts +12 -0
  118. package/dist/hooks/useReclaim.js +87 -0
  119. package/dist/hooks/useSignAndExecuteTransaction.d.ts +6 -0
  120. package/dist/hooks/useSignAndExecuteTransaction.js +40 -0
  121. package/dist/hooks/useSignPersonalMessage.d.ts +8 -0
  122. package/dist/hooks/useSignPersonalMessage.js +21 -0
  123. package/dist/hooks/useZingInfiniteQueries.d.ts +75 -0
  124. package/dist/hooks/useZingInfiniteQueries.js +28 -0
  125. package/dist/hooks/useZingMutation.d.ts +35 -0
  126. package/dist/hooks/useZingMutation.js +37 -0
  127. package/dist/hooks/useZingQueries.d.ts +127 -0
  128. package/dist/hooks/useZingQueries.js +37 -0
  129. package/dist/hooks/useZingQuery.d.ts +147 -0
  130. package/dist/hooks/useZingQuery.js +34 -0
  131. package/{src/index.ts → dist/index.d.ts} +2 -3
  132. package/dist/index.js +9 -0
  133. package/dist/lib/utils/colorful-logger.d.ts +2 -0
  134. package/dist/lib/utils/colorful-logger.js +23 -0
  135. package/dist/lib/utils/const.d.ts +25 -0
  136. package/dist/lib/utils/const.js +25 -0
  137. package/dist/lib/utils/helpers.d.ts +10 -0
  138. package/dist/lib/utils/helpers.js +49 -0
  139. package/dist/lib/utils/index.js +4 -0
  140. package/dist/lib/utils/init-app-with-shadow.d.ts +6 -0
  141. package/dist/lib/utils/init-app-with-shadow.js +28 -0
  142. package/dist/lib/utils/quilt.d.ts +61 -0
  143. package/dist/lib/utils/quilt.js +194 -0
  144. package/dist/lib/utils/reclaim.d.ts +29 -0
  145. package/dist/lib/utils/reclaim.js +88 -0
  146. package/dist/lib/utils/types.d.ts +5 -0
  147. package/dist/lib/utils/types.js +1 -0
  148. package/dist/mutations/index.js +3 -0
  149. package/dist/mutations/seal.d.ts +12 -0
  150. package/dist/mutations/seal.js +41 -0
  151. package/dist/mutations/signer.d.ts +10 -0
  152. package/dist/mutations/signer.js +176 -0
  153. package/dist/mutations/walrus.d.ts +98 -0
  154. package/dist/mutations/walrus.js +488 -0
  155. package/dist/stores/index.js +3 -0
  156. package/dist/stores/walletStore.d.ts +48 -0
  157. package/dist/stores/walletStore.js +232 -0
  158. package/dist/stores/walrusStore.d.ts +28 -0
  159. package/dist/stores/walrusStore.js +61 -0
  160. package/dist/stores/zkloginStore.d.ts +28 -0
  161. package/dist/stores/zkloginStore.js +27 -0
  162. package/dist/types.d.ts +99 -0
  163. package/dist/types.js +1 -0
  164. package/package.json +14 -6
  165. package/src/_generated/utils/index.ts +0 -181
  166. package/src/_generated/zing_framework/coin_utils.ts +0 -41
  167. package/src/_generated/zing_framework/derived_object_bag.ts +0 -400
  168. package/src/_generated/zing_framework/derived_table.ts +0 -366
  169. package/src/_generated/zing_governance/admin.ts +0 -47
  170. package/src/_generated/zing_governance/treasury.ts +0 -134
  171. package/src/_generated/zing_identity/config.ts +0 -191
  172. package/src/_generated/zing_identity/ecdsa.ts +0 -166
  173. package/src/_generated/zing_identity/identity.ts +0 -661
  174. package/src/_generated/zing_identity/reclaim.ts +0 -803
  175. package/src/_generated/zing_studio/app.ts +0 -855
  176. package/src/_generated/zing_studio/article.ts +0 -598
  177. package/src/_generated/zing_studio/config.ts +0 -475
  178. package/src/_generated/zing_studio/deps/sui/dynamic_field.ts +0 -272
  179. package/src/_generated/zing_studio/deps/walrus/events.ts +0 -124
  180. package/src/_generated/zing_studio/deps/walrus/metadata.ts +0 -137
  181. package/src/_generated/zing_studio/enclave.ts +0 -466
  182. package/src/_generated/zing_studio/nitro_attestation.ts +0 -308
  183. package/src/_generated/zing_studio/referral.ts +0 -447
  184. package/src/_generated/zing_studio/storage.ts +0 -664
  185. package/src/_generated/zing_studio/studio.ts +0 -682
  186. package/src/bcs.ts +0 -139
  187. package/src/client/index.ts +0 -557
  188. package/src/client/types.ts +0 -28
  189. package/src/components/wallet-provider.tsx +0 -53
  190. package/src/components/walrus-provider.tsx +0 -212
  191. package/src/components/zing-provider.tsx +0 -54
  192. package/src/config/common.ts +0 -82
  193. package/src/config/index.ts +0 -45
  194. package/src/config/mainnet.ts +0 -109
  195. package/src/config/testnet.ts +0 -111
  196. package/src/config/types.ts +0 -69
  197. package/src/const.ts +0 -32
  198. package/src/getters.ts +0 -523
  199. package/src/hooks/useGetStudio.ts +0 -22
  200. package/src/hooks/useGetTierPlan.ts +0 -115
  201. package/src/hooks/useReclaim.ts +0 -165
  202. package/src/hooks/useSignAndExecuteTransaction.ts +0 -57
  203. package/src/hooks/useSignPersonalMessage.ts +0 -28
  204. package/src/hooks/useZingInfiniteQueries.ts +0 -92
  205. package/src/hooks/useZingMutation.ts +0 -66
  206. package/src/hooks/useZingQueries.ts +0 -107
  207. package/src/hooks/useZingQuery.ts +0 -88
  208. package/src/lib/utils/colorful-logger.ts +0 -27
  209. package/src/lib/utils/const.ts +0 -25
  210. package/src/lib/utils/helpers.ts +0 -78
  211. package/src/lib/utils/init-app-with-shadow.ts +0 -42
  212. package/src/lib/utils/quilt.ts +0 -317
  213. package/src/lib/utils/reclaim.ts +0 -148
  214. package/src/lib/utils/types.ts +0 -14
  215. package/src/mutations/seal.ts +0 -78
  216. package/src/mutations/signer.ts +0 -241
  217. package/src/mutations/walrus.ts +0 -862
  218. package/src/stores/walletStore.ts +0 -360
  219. package/src/stores/walrusStore.ts +0 -118
  220. package/src/stores/zkloginStore.ts +0 -53
  221. package/src/types.ts +0 -120
  222. package/tsconfig.json +0 -12
  223. /package/{src/_generated/index.js → dist/_generated/index.d.ts} +0 -0
  224. /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
  225. /package/{src/lib/utils/index.ts → dist/lib/utils/index.d.ts} +0 -0
  226. /package/{src/mutations/index.ts → dist/mutations/index.d.ts} +0 -0
  227. /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
- }