@suilend/springsui-cli 1.0.13 → 2.0.0
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/cli/src/bytecode.js +28 -30
- package/cli/src/index.js +51 -86
- package/package.json +1 -1
- package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js +35 -75
- package/sdk/src/_generated/_dependencies/source/0x1/index.js +3 -6
- package/sdk/src/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
- package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +31 -69
- package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +4 -4
- package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +21 -59
- package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -5
- package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +20 -25
- package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +24 -29
- package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +49 -56
- package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +52 -52
- package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.js +206 -223
- package/sdk/src/_generated/_dependencies/source/0x2/index.js +3 -6
- package/sdk/src/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -8
- package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +34 -41
- package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +4 -4
- package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +19 -24
- package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +31 -36
- package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +5 -5
- package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +20 -25
- package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +5 -5
- package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js +57 -97
- package/sdk/src/_generated/_dependencies/source/0x3/index.js +3 -6
- package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.d.ts +60 -60
- package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js +170 -218
- package/sdk/src/_generated/_framework/reified.d.ts +2 -2
- package/sdk/src/_generated/_framework/reified.js +27 -40
- package/sdk/src/_generated/_framework/util.d.ts +2 -14
- package/sdk/src/_generated/_framework/util.js +26 -40
- package/sdk/src/_generated/_framework/vector.d.ts +4 -4
- package/sdk/src/_generated/_framework/vector.js +16 -21
- package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +4 -4
- package/sdk/src/_generated/liquid_staking/cell/structs.js +31 -36
- package/sdk/src/_generated/liquid_staking/fees/functions.js +55 -75
- package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +21 -21
- package/sdk/src/_generated/liquid_staking/fees/structs.js +58 -65
- package/sdk/src/_generated/liquid_staking/index.js +6 -10
- package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +86 -107
- package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +98 -98
- package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +264 -320
- package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +31 -31
- package/sdk/src/_generated/liquid_staking/storage/structs.js +85 -125
- package/sdk/src/_generated/liquid_staking/version/structs.d.ts +4 -4
- package/sdk/src/_generated/liquid_staking/version/structs.js +19 -24
- package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -56
- package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +41 -41
- package/sdk/src/_generated/liquid_staking/weight/structs.js +128 -141
- package/sdk/src/client.d.ts +16 -16
- package/sdk/src/client.js +39 -82
- package/sdk/src/index.js +2 -18
- package/sdk/src/lib/index.js +1 -17
- package/sdk/src/lib/transactions.d.ts +1 -1
- package/sdk/src/lib/transactions.js +3 -8
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,35 +7,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const reified_1 = require("../../_framework/reified");
|
|
23
|
-
const util_1 = require("../../_framework/util");
|
|
24
|
-
const index_1 = require("../index");
|
|
25
|
-
const structs_5 = require("../liquid-staking/structs");
|
|
26
|
-
const structs_6 = require("../version/structs");
|
|
27
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
28
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
10
|
+
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
11
|
+
import { Bag } from "../../_dependencies/source/0x2/bag/structs";
|
|
12
|
+
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
13
|
+
import { VecMap } from "../../_dependencies/source/0x2/vec-map/structs";
|
|
14
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../_framework/reified";
|
|
15
|
+
import { composeSuiType, compressSuiType, parseTypeName, } from "../../_framework/util";
|
|
16
|
+
import { PKG_V1, PKG_V5 } from "../index";
|
|
17
|
+
import { AdminCap } from "../liquid-staking/structs";
|
|
18
|
+
import { Version } from "../version/structs";
|
|
19
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
20
|
+
import { fromBase64, fromHex, toHex } from "@mysten/sui/utils";
|
|
29
21
|
/* ============================== CreateEvent =============================== */
|
|
30
|
-
function isCreateEvent(type) {
|
|
31
|
-
type =
|
|
32
|
-
return type === `${
|
|
22
|
+
export function isCreateEvent(type) {
|
|
23
|
+
type = compressSuiType(type);
|
|
24
|
+
return type === `${PKG_V5}::weight::CreateEvent`;
|
|
33
25
|
}
|
|
34
|
-
class CreateEvent {
|
|
26
|
+
export class CreateEvent {
|
|
35
27
|
constructor(typeArgs, fields) {
|
|
36
28
|
this.__StructClass = true;
|
|
37
29
|
this.$typeName = CreateEvent.$typeName;
|
|
38
30
|
this.$isPhantom = CreateEvent.$isPhantom;
|
|
39
|
-
this.$fullTypeName =
|
|
31
|
+
this.$fullTypeName = composeSuiType(CreateEvent.$typeName, ...typeArgs);
|
|
40
32
|
this.$typeArgs = typeArgs;
|
|
41
33
|
this.typename = fields.typename;
|
|
42
34
|
this.weightHookId = fields.weightHookId;
|
|
@@ -45,7 +37,7 @@ class CreateEvent {
|
|
|
45
37
|
static reified() {
|
|
46
38
|
return {
|
|
47
39
|
typeName: CreateEvent.$typeName,
|
|
48
|
-
fullTypeName:
|
|
40
|
+
fullTypeName: composeSuiType(CreateEvent.$typeName, ...[]),
|
|
49
41
|
typeArgs: [],
|
|
50
42
|
isPhantom: CreateEvent.$isPhantom,
|
|
51
43
|
reifiedTypeArgs: [],
|
|
@@ -68,23 +60,23 @@ class CreateEvent {
|
|
|
68
60
|
return CreateEvent.reified();
|
|
69
61
|
}
|
|
70
62
|
static phantom() {
|
|
71
|
-
return
|
|
63
|
+
return phantom(CreateEvent.reified());
|
|
72
64
|
}
|
|
73
65
|
static get p() {
|
|
74
66
|
return CreateEvent.phantom();
|
|
75
67
|
}
|
|
76
68
|
static get bcs() {
|
|
77
|
-
return
|
|
78
|
-
typename:
|
|
79
|
-
weight_hook_id:
|
|
80
|
-
weight_hook_admin_cap_id:
|
|
69
|
+
return bcs.struct("CreateEvent", {
|
|
70
|
+
typename: TypeName.bcs,
|
|
71
|
+
weight_hook_id: ID.bcs,
|
|
72
|
+
weight_hook_admin_cap_id: ID.bcs,
|
|
81
73
|
});
|
|
82
74
|
}
|
|
83
75
|
static fromFields(fields) {
|
|
84
76
|
return CreateEvent.reified().new({
|
|
85
|
-
typename:
|
|
86
|
-
weightHookId:
|
|
87
|
-
weightHookAdminCapId:
|
|
77
|
+
typename: decodeFromFields(TypeName.reified(), fields.typename),
|
|
78
|
+
weightHookId: decodeFromFields(ID.reified(), fields.weight_hook_id),
|
|
79
|
+
weightHookAdminCapId: decodeFromFields(ID.reified(), fields.weight_hook_admin_cap_id),
|
|
88
80
|
});
|
|
89
81
|
}
|
|
90
82
|
static fromFieldsWithTypes(item) {
|
|
@@ -92,9 +84,9 @@ class CreateEvent {
|
|
|
92
84
|
throw new Error("not a CreateEvent type");
|
|
93
85
|
}
|
|
94
86
|
return CreateEvent.reified().new({
|
|
95
|
-
typename:
|
|
96
|
-
weightHookId:
|
|
97
|
-
weightHookAdminCapId:
|
|
87
|
+
typename: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.typename),
|
|
88
|
+
weightHookId: decodeFromFieldsWithTypes(ID.reified(), item.fields.weight_hook_id),
|
|
89
|
+
weightHookAdminCapId: decodeFromFieldsWithTypes(ID.reified(), item.fields.weight_hook_admin_cap_id),
|
|
98
90
|
});
|
|
99
91
|
}
|
|
100
92
|
static fromBcs(data) {
|
|
@@ -112,9 +104,9 @@ class CreateEvent {
|
|
|
112
104
|
}
|
|
113
105
|
static fromJSONField(field) {
|
|
114
106
|
return CreateEvent.reified().new({
|
|
115
|
-
typename:
|
|
116
|
-
weightHookId:
|
|
117
|
-
weightHookAdminCapId:
|
|
107
|
+
typename: decodeFromJSONField(TypeName.reified(), field.typename),
|
|
108
|
+
weightHookId: decodeFromJSONField(ID.reified(), field.weightHookId),
|
|
109
|
+
weightHookAdminCapId: decodeFromJSONField(ID.reified(), field.weightHookAdminCapId),
|
|
118
110
|
});
|
|
119
111
|
}
|
|
120
112
|
static fromJSON(json) {
|
|
@@ -137,7 +129,7 @@ class CreateEvent {
|
|
|
137
129
|
if (data.bcs.dataType !== "moveObject" || !isCreateEvent(data.bcs.type)) {
|
|
138
130
|
throw new Error(`object at is not a CreateEvent object`);
|
|
139
131
|
}
|
|
140
|
-
return CreateEvent.fromBcs((
|
|
132
|
+
return CreateEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
141
133
|
}
|
|
142
134
|
if (data.content) {
|
|
143
135
|
return CreateEvent.fromSuiParsedData(data.content);
|
|
@@ -159,28 +151,27 @@ class CreateEvent {
|
|
|
159
151
|
});
|
|
160
152
|
}
|
|
161
153
|
}
|
|
162
|
-
|
|
163
|
-
CreateEvent.$typeName = `${index_1.PKG_V5}::weight::CreateEvent`;
|
|
154
|
+
CreateEvent.$typeName = `${PKG_V5}::weight::CreateEvent`;
|
|
164
155
|
CreateEvent.$numTypeParams = 0;
|
|
165
156
|
CreateEvent.$isPhantom = [];
|
|
166
157
|
/* ============================== RegistryInfo =============================== */
|
|
167
|
-
function isRegistryInfo(type) {
|
|
168
|
-
type =
|
|
169
|
-
return type === `${
|
|
158
|
+
export function isRegistryInfo(type) {
|
|
159
|
+
type = compressSuiType(type);
|
|
160
|
+
return type === `${PKG_V5}::weight::RegistryInfo`;
|
|
170
161
|
}
|
|
171
|
-
class RegistryInfo {
|
|
162
|
+
export class RegistryInfo {
|
|
172
163
|
constructor(typeArgs, fields) {
|
|
173
164
|
this.__StructClass = true;
|
|
174
165
|
this.$typeName = RegistryInfo.$typeName;
|
|
175
166
|
this.$isPhantom = RegistryInfo.$isPhantom;
|
|
176
|
-
this.$fullTypeName =
|
|
167
|
+
this.$fullTypeName = composeSuiType(RegistryInfo.$typeName, ...typeArgs);
|
|
177
168
|
this.$typeArgs = typeArgs;
|
|
178
169
|
this.weightHookId = fields.weightHookId;
|
|
179
170
|
}
|
|
180
171
|
static reified() {
|
|
181
172
|
return {
|
|
182
173
|
typeName: RegistryInfo.$typeName,
|
|
183
|
-
fullTypeName:
|
|
174
|
+
fullTypeName: composeSuiType(RegistryInfo.$typeName, ...[]),
|
|
184
175
|
typeArgs: [],
|
|
185
176
|
isPhantom: RegistryInfo.$isPhantom,
|
|
186
177
|
reifiedTypeArgs: [],
|
|
@@ -203,19 +194,19 @@ class RegistryInfo {
|
|
|
203
194
|
return RegistryInfo.reified();
|
|
204
195
|
}
|
|
205
196
|
static phantom() {
|
|
206
|
-
return
|
|
197
|
+
return phantom(RegistryInfo.reified());
|
|
207
198
|
}
|
|
208
199
|
static get p() {
|
|
209
200
|
return RegistryInfo.phantom();
|
|
210
201
|
}
|
|
211
202
|
static get bcs() {
|
|
212
|
-
return
|
|
213
|
-
weight_hook_id:
|
|
203
|
+
return bcs.struct("RegistryInfo", {
|
|
204
|
+
weight_hook_id: ID.bcs,
|
|
214
205
|
});
|
|
215
206
|
}
|
|
216
207
|
static fromFields(fields) {
|
|
217
208
|
return RegistryInfo.reified().new({
|
|
218
|
-
weightHookId:
|
|
209
|
+
weightHookId: decodeFromFields(ID.reified(), fields.weight_hook_id),
|
|
219
210
|
});
|
|
220
211
|
}
|
|
221
212
|
static fromFieldsWithTypes(item) {
|
|
@@ -223,7 +214,7 @@ class RegistryInfo {
|
|
|
223
214
|
throw new Error("not a RegistryInfo type");
|
|
224
215
|
}
|
|
225
216
|
return RegistryInfo.reified().new({
|
|
226
|
-
weightHookId:
|
|
217
|
+
weightHookId: decodeFromFieldsWithTypes(ID.reified(), item.fields.weight_hook_id),
|
|
227
218
|
});
|
|
228
219
|
}
|
|
229
220
|
static fromBcs(data) {
|
|
@@ -239,7 +230,7 @@ class RegistryInfo {
|
|
|
239
230
|
}
|
|
240
231
|
static fromJSONField(field) {
|
|
241
232
|
return RegistryInfo.reified().new({
|
|
242
|
-
weightHookId:
|
|
233
|
+
weightHookId: decodeFromJSONField(ID.reified(), field.weightHookId),
|
|
243
234
|
});
|
|
244
235
|
}
|
|
245
236
|
static fromJSON(json) {
|
|
@@ -263,7 +254,7 @@ class RegistryInfo {
|
|
|
263
254
|
!isRegistryInfo(data.bcs.type)) {
|
|
264
255
|
throw new Error(`object at is not a RegistryInfo object`);
|
|
265
256
|
}
|
|
266
|
-
return RegistryInfo.fromBcs((
|
|
257
|
+
return RegistryInfo.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
267
258
|
}
|
|
268
259
|
if (data.content) {
|
|
269
260
|
return RegistryInfo.fromSuiParsedData(data.content);
|
|
@@ -285,28 +276,27 @@ class RegistryInfo {
|
|
|
285
276
|
});
|
|
286
277
|
}
|
|
287
278
|
}
|
|
288
|
-
|
|
289
|
-
RegistryInfo.$typeName = `${index_1.PKG_V5}::weight::RegistryInfo`;
|
|
279
|
+
RegistryInfo.$typeName = `${PKG_V5}::weight::RegistryInfo`;
|
|
290
280
|
RegistryInfo.$numTypeParams = 0;
|
|
291
281
|
RegistryInfo.$isPhantom = [];
|
|
292
282
|
/* ============================== WEIGHT =============================== */
|
|
293
|
-
function isWEIGHT(type) {
|
|
294
|
-
type =
|
|
295
|
-
return type === `${
|
|
283
|
+
export function isWEIGHT(type) {
|
|
284
|
+
type = compressSuiType(type);
|
|
285
|
+
return type === `${PKG_V1}::weight::WEIGHT`;
|
|
296
286
|
}
|
|
297
|
-
class WEIGHT {
|
|
287
|
+
export class WEIGHT {
|
|
298
288
|
constructor(typeArgs, fields) {
|
|
299
289
|
this.__StructClass = true;
|
|
300
290
|
this.$typeName = WEIGHT.$typeName;
|
|
301
291
|
this.$isPhantom = WEIGHT.$isPhantom;
|
|
302
|
-
this.$fullTypeName =
|
|
292
|
+
this.$fullTypeName = composeSuiType(WEIGHT.$typeName, ...typeArgs);
|
|
303
293
|
this.$typeArgs = typeArgs;
|
|
304
294
|
this.dummyField = fields.dummyField;
|
|
305
295
|
}
|
|
306
296
|
static reified() {
|
|
307
297
|
return {
|
|
308
298
|
typeName: WEIGHT.$typeName,
|
|
309
|
-
fullTypeName:
|
|
299
|
+
fullTypeName: composeSuiType(WEIGHT.$typeName, ...[]),
|
|
310
300
|
typeArgs: [],
|
|
311
301
|
isPhantom: WEIGHT.$isPhantom,
|
|
312
302
|
reifiedTypeArgs: [],
|
|
@@ -329,19 +319,19 @@ class WEIGHT {
|
|
|
329
319
|
return WEIGHT.reified();
|
|
330
320
|
}
|
|
331
321
|
static phantom() {
|
|
332
|
-
return
|
|
322
|
+
return phantom(WEIGHT.reified());
|
|
333
323
|
}
|
|
334
324
|
static get p() {
|
|
335
325
|
return WEIGHT.phantom();
|
|
336
326
|
}
|
|
337
327
|
static get bcs() {
|
|
338
|
-
return
|
|
339
|
-
dummy_field:
|
|
328
|
+
return bcs.struct("WEIGHT", {
|
|
329
|
+
dummy_field: bcs.bool(),
|
|
340
330
|
});
|
|
341
331
|
}
|
|
342
332
|
static fromFields(fields) {
|
|
343
333
|
return WEIGHT.reified().new({
|
|
344
|
-
dummyField:
|
|
334
|
+
dummyField: decodeFromFields("bool", fields.dummy_field),
|
|
345
335
|
});
|
|
346
336
|
}
|
|
347
337
|
static fromFieldsWithTypes(item) {
|
|
@@ -349,7 +339,7 @@ class WEIGHT {
|
|
|
349
339
|
throw new Error("not a WEIGHT type");
|
|
350
340
|
}
|
|
351
341
|
return WEIGHT.reified().new({
|
|
352
|
-
dummyField:
|
|
342
|
+
dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field),
|
|
353
343
|
});
|
|
354
344
|
}
|
|
355
345
|
static fromBcs(data) {
|
|
@@ -365,7 +355,7 @@ class WEIGHT {
|
|
|
365
355
|
}
|
|
366
356
|
static fromJSONField(field) {
|
|
367
357
|
return WEIGHT.reified().new({
|
|
368
|
-
dummyField:
|
|
358
|
+
dummyField: decodeFromJSONField("bool", field.dummyField),
|
|
369
359
|
});
|
|
370
360
|
}
|
|
371
361
|
static fromJSON(json) {
|
|
@@ -388,7 +378,7 @@ class WEIGHT {
|
|
|
388
378
|
if (data.bcs.dataType !== "moveObject" || !isWEIGHT(data.bcs.type)) {
|
|
389
379
|
throw new Error(`object at is not a WEIGHT object`);
|
|
390
380
|
}
|
|
391
|
-
return WEIGHT.fromBcs((
|
|
381
|
+
return WEIGHT.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
392
382
|
}
|
|
393
383
|
if (data.content) {
|
|
394
384
|
return WEIGHT.fromSuiParsedData(data.content);
|
|
@@ -410,21 +400,20 @@ class WEIGHT {
|
|
|
410
400
|
});
|
|
411
401
|
}
|
|
412
402
|
}
|
|
413
|
-
|
|
414
|
-
WEIGHT.$typeName = `${index_1.PKG_V1}::weight::WEIGHT`;
|
|
403
|
+
WEIGHT.$typeName = `${PKG_V1}::weight::WEIGHT`;
|
|
415
404
|
WEIGHT.$numTypeParams = 0;
|
|
416
405
|
WEIGHT.$isPhantom = [];
|
|
417
406
|
/* ============================== WeightHook =============================== */
|
|
418
|
-
function isWeightHook(type) {
|
|
419
|
-
type =
|
|
420
|
-
return type.startsWith(`${
|
|
407
|
+
export function isWeightHook(type) {
|
|
408
|
+
type = compressSuiType(type);
|
|
409
|
+
return type.startsWith(`${PKG_V1}::weight::WeightHook` + "<");
|
|
421
410
|
}
|
|
422
|
-
class WeightHook {
|
|
411
|
+
export class WeightHook {
|
|
423
412
|
constructor(typeArgs, fields) {
|
|
424
413
|
this.__StructClass = true;
|
|
425
414
|
this.$typeName = WeightHook.$typeName;
|
|
426
415
|
this.$isPhantom = WeightHook.$isPhantom;
|
|
427
|
-
this.$fullTypeName =
|
|
416
|
+
this.$fullTypeName = composeSuiType(WeightHook.$typeName, ...typeArgs);
|
|
428
417
|
this.$typeArgs = typeArgs;
|
|
429
418
|
this.id = fields.id;
|
|
430
419
|
this.validatorAddressesAndWeights = fields.validatorAddressesAndWeights;
|
|
@@ -436,8 +425,8 @@ class WeightHook {
|
|
|
436
425
|
static reified(P) {
|
|
437
426
|
return {
|
|
438
427
|
typeName: WeightHook.$typeName,
|
|
439
|
-
fullTypeName:
|
|
440
|
-
typeArgs: [
|
|
428
|
+
fullTypeName: composeSuiType(WeightHook.$typeName, ...[extractType(P)]),
|
|
429
|
+
typeArgs: [extractType(P)],
|
|
441
430
|
isPhantom: WeightHook.$isPhantom,
|
|
442
431
|
reifiedTypeArgs: [P],
|
|
443
432
|
fromFields: (fields) => WeightHook.fromFields(P, fields),
|
|
@@ -450,7 +439,7 @@ class WeightHook {
|
|
|
450
439
|
fromSuiObjectData: (content) => WeightHook.fromSuiObjectData(P, content),
|
|
451
440
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return WeightHook.fetch(client, P, id); }),
|
|
452
441
|
new: (fields) => {
|
|
453
|
-
return new WeightHook([
|
|
442
|
+
return new WeightHook([extractType(P)], fields);
|
|
454
443
|
},
|
|
455
444
|
kind: "StructClassReified",
|
|
456
445
|
};
|
|
@@ -459,48 +448,48 @@ class WeightHook {
|
|
|
459
448
|
return WeightHook.reified;
|
|
460
449
|
}
|
|
461
450
|
static phantom(P) {
|
|
462
|
-
return
|
|
451
|
+
return phantom(WeightHook.reified(P));
|
|
463
452
|
}
|
|
464
453
|
static get p() {
|
|
465
454
|
return WeightHook.phantom;
|
|
466
455
|
}
|
|
467
456
|
static get bcs() {
|
|
468
|
-
return
|
|
469
|
-
id:
|
|
470
|
-
validator_addresses_and_weights:
|
|
457
|
+
return bcs.struct("WeightHook", {
|
|
458
|
+
id: UID.bcs,
|
|
459
|
+
validator_addresses_and_weights: VecMap.bcs(bcs
|
|
471
460
|
.bytes(32)
|
|
472
461
|
.transform({
|
|
473
|
-
input: (val) => (
|
|
474
|
-
output: (val) => (
|
|
475
|
-
}),
|
|
476
|
-
total_weight:
|
|
477
|
-
admin_cap:
|
|
478
|
-
version:
|
|
479
|
-
extra_fields:
|
|
462
|
+
input: (val) => fromHex(val),
|
|
463
|
+
output: (val) => toHex(val),
|
|
464
|
+
}), bcs.u64()),
|
|
465
|
+
total_weight: bcs.u64(),
|
|
466
|
+
admin_cap: AdminCap.bcs,
|
|
467
|
+
version: Version.bcs,
|
|
468
|
+
extra_fields: Bag.bcs,
|
|
480
469
|
});
|
|
481
470
|
}
|
|
482
471
|
static fromFields(typeArg, fields) {
|
|
483
472
|
return WeightHook.reified(typeArg).new({
|
|
484
|
-
id:
|
|
485
|
-
validatorAddressesAndWeights:
|
|
486
|
-
totalWeight:
|
|
487
|
-
adminCap:
|
|
488
|
-
version:
|
|
489
|
-
extraFields:
|
|
473
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
474
|
+
validatorAddressesAndWeights: decodeFromFields(VecMap.reified("address", "u64"), fields.validator_addresses_and_weights),
|
|
475
|
+
totalWeight: decodeFromFields("u64", fields.total_weight),
|
|
476
|
+
adminCap: decodeFromFields(AdminCap.reified(typeArg), fields.admin_cap),
|
|
477
|
+
version: decodeFromFields(Version.reified(), fields.version),
|
|
478
|
+
extraFields: decodeFromFields(Bag.reified(), fields.extra_fields),
|
|
490
479
|
});
|
|
491
480
|
}
|
|
492
481
|
static fromFieldsWithTypes(typeArg, item) {
|
|
493
482
|
if (!isWeightHook(item.type)) {
|
|
494
483
|
throw new Error("not a WeightHook type");
|
|
495
484
|
}
|
|
496
|
-
|
|
485
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
497
486
|
return WeightHook.reified(typeArg).new({
|
|
498
|
-
id:
|
|
499
|
-
validatorAddressesAndWeights:
|
|
500
|
-
totalWeight:
|
|
501
|
-
adminCap:
|
|
502
|
-
version:
|
|
503
|
-
extraFields:
|
|
487
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
488
|
+
validatorAddressesAndWeights: decodeFromFieldsWithTypes(VecMap.reified("address", "u64"), item.fields.validator_addresses_and_weights),
|
|
489
|
+
totalWeight: decodeFromFieldsWithTypes("u64", item.fields.total_weight),
|
|
490
|
+
adminCap: decodeFromFieldsWithTypes(AdminCap.reified(typeArg), item.fields.admin_cap),
|
|
491
|
+
version: decodeFromFieldsWithTypes(Version.reified(), item.fields.version),
|
|
492
|
+
extraFields: decodeFromFieldsWithTypes(Bag.reified(), item.fields.extra_fields),
|
|
504
493
|
});
|
|
505
494
|
}
|
|
506
495
|
static fromBcs(typeArg, data) {
|
|
@@ -521,19 +510,19 @@ class WeightHook {
|
|
|
521
510
|
}
|
|
522
511
|
static fromJSONField(typeArg, field) {
|
|
523
512
|
return WeightHook.reified(typeArg).new({
|
|
524
|
-
id:
|
|
525
|
-
validatorAddressesAndWeights:
|
|
526
|
-
totalWeight:
|
|
527
|
-
adminCap:
|
|
528
|
-
version:
|
|
529
|
-
extraFields:
|
|
513
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
514
|
+
validatorAddressesAndWeights: decodeFromJSONField(VecMap.reified("address", "u64"), field.validatorAddressesAndWeights),
|
|
515
|
+
totalWeight: decodeFromJSONField("u64", field.totalWeight),
|
|
516
|
+
adminCap: decodeFromJSONField(AdminCap.reified(typeArg), field.adminCap),
|
|
517
|
+
version: decodeFromJSONField(Version.reified(), field.version),
|
|
518
|
+
extraFields: decodeFromJSONField(Bag.reified(), field.extraFields),
|
|
530
519
|
});
|
|
531
520
|
}
|
|
532
521
|
static fromJSON(typeArg, json) {
|
|
533
522
|
if (json.$typeName !== WeightHook.$typeName) {
|
|
534
523
|
throw new Error("not a WithTwoGenerics json object");
|
|
535
524
|
}
|
|
536
|
-
|
|
525
|
+
assertReifiedTypeArgsMatch(composeSuiType(WeightHook.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
537
526
|
return WeightHook.fromJSONField(typeArg, json);
|
|
538
527
|
}
|
|
539
528
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -550,16 +539,16 @@ class WeightHook {
|
|
|
550
539
|
if (data.bcs.dataType !== "moveObject" || !isWeightHook(data.bcs.type)) {
|
|
551
540
|
throw new Error(`object at is not a WeightHook object`);
|
|
552
541
|
}
|
|
553
|
-
const gotTypeArgs =
|
|
542
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
554
543
|
if (gotTypeArgs.length !== 1) {
|
|
555
544
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
556
545
|
}
|
|
557
|
-
const gotTypeArg =
|
|
558
|
-
const expectedTypeArg =
|
|
559
|
-
if (gotTypeArg !==
|
|
546
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
547
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
548
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
560
549
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
561
550
|
}
|
|
562
|
-
return WeightHook.fromBcs(typeArg, (
|
|
551
|
+
return WeightHook.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
563
552
|
}
|
|
564
553
|
if (data.content) {
|
|
565
554
|
return WeightHook.fromSuiParsedData(typeArg, data.content);
|
|
@@ -581,29 +570,28 @@ class WeightHook {
|
|
|
581
570
|
});
|
|
582
571
|
}
|
|
583
572
|
}
|
|
584
|
-
|
|
585
|
-
WeightHook.$typeName = `${index_1.PKG_V1}::weight::WeightHook`;
|
|
573
|
+
WeightHook.$typeName = `${PKG_V1}::weight::WeightHook`;
|
|
586
574
|
WeightHook.$numTypeParams = 1;
|
|
587
575
|
WeightHook.$isPhantom = [true];
|
|
588
576
|
/* ============================== WeightHookAdminCap =============================== */
|
|
589
|
-
function isWeightHookAdminCap(type) {
|
|
590
|
-
type =
|
|
591
|
-
return type.startsWith(`${
|
|
577
|
+
export function isWeightHookAdminCap(type) {
|
|
578
|
+
type = compressSuiType(type);
|
|
579
|
+
return type.startsWith(`${PKG_V1}::weight::WeightHookAdminCap` + "<");
|
|
592
580
|
}
|
|
593
|
-
class WeightHookAdminCap {
|
|
581
|
+
export class WeightHookAdminCap {
|
|
594
582
|
constructor(typeArgs, fields) {
|
|
595
583
|
this.__StructClass = true;
|
|
596
584
|
this.$typeName = WeightHookAdminCap.$typeName;
|
|
597
585
|
this.$isPhantom = WeightHookAdminCap.$isPhantom;
|
|
598
|
-
this.$fullTypeName =
|
|
586
|
+
this.$fullTypeName = composeSuiType(WeightHookAdminCap.$typeName, ...typeArgs);
|
|
599
587
|
this.$typeArgs = typeArgs;
|
|
600
588
|
this.id = fields.id;
|
|
601
589
|
}
|
|
602
590
|
static reified(P) {
|
|
603
591
|
return {
|
|
604
592
|
typeName: WeightHookAdminCap.$typeName,
|
|
605
|
-
fullTypeName:
|
|
606
|
-
typeArgs: [
|
|
593
|
+
fullTypeName: composeSuiType(WeightHookAdminCap.$typeName, ...[extractType(P)]),
|
|
594
|
+
typeArgs: [extractType(P)],
|
|
607
595
|
isPhantom: WeightHookAdminCap.$isPhantom,
|
|
608
596
|
reifiedTypeArgs: [P],
|
|
609
597
|
fromFields: (fields) => WeightHookAdminCap.fromFields(P, fields),
|
|
@@ -616,7 +604,7 @@ class WeightHookAdminCap {
|
|
|
616
604
|
fromSuiObjectData: (content) => WeightHookAdminCap.fromSuiObjectData(P, content),
|
|
617
605
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return WeightHookAdminCap.fetch(client, P, id); }),
|
|
618
606
|
new: (fields) => {
|
|
619
|
-
return new WeightHookAdminCap([
|
|
607
|
+
return new WeightHookAdminCap([extractType(P)], fields);
|
|
620
608
|
},
|
|
621
609
|
kind: "StructClassReified",
|
|
622
610
|
};
|
|
@@ -625,28 +613,28 @@ class WeightHookAdminCap {
|
|
|
625
613
|
return WeightHookAdminCap.reified;
|
|
626
614
|
}
|
|
627
615
|
static phantom(P) {
|
|
628
|
-
return
|
|
616
|
+
return phantom(WeightHookAdminCap.reified(P));
|
|
629
617
|
}
|
|
630
618
|
static get p() {
|
|
631
619
|
return WeightHookAdminCap.phantom;
|
|
632
620
|
}
|
|
633
621
|
static get bcs() {
|
|
634
|
-
return
|
|
635
|
-
id:
|
|
622
|
+
return bcs.struct("WeightHookAdminCap", {
|
|
623
|
+
id: UID.bcs,
|
|
636
624
|
});
|
|
637
625
|
}
|
|
638
626
|
static fromFields(typeArg, fields) {
|
|
639
627
|
return WeightHookAdminCap.reified(typeArg).new({
|
|
640
|
-
id:
|
|
628
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
641
629
|
});
|
|
642
630
|
}
|
|
643
631
|
static fromFieldsWithTypes(typeArg, item) {
|
|
644
632
|
if (!isWeightHookAdminCap(item.type)) {
|
|
645
633
|
throw new Error("not a WeightHookAdminCap type");
|
|
646
634
|
}
|
|
647
|
-
|
|
635
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
648
636
|
return WeightHookAdminCap.reified(typeArg).new({
|
|
649
|
-
id:
|
|
637
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
650
638
|
});
|
|
651
639
|
}
|
|
652
640
|
static fromBcs(typeArg, data) {
|
|
@@ -662,14 +650,14 @@ class WeightHookAdminCap {
|
|
|
662
650
|
}
|
|
663
651
|
static fromJSONField(typeArg, field) {
|
|
664
652
|
return WeightHookAdminCap.reified(typeArg).new({
|
|
665
|
-
id:
|
|
653
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
666
654
|
});
|
|
667
655
|
}
|
|
668
656
|
static fromJSON(typeArg, json) {
|
|
669
657
|
if (json.$typeName !== WeightHookAdminCap.$typeName) {
|
|
670
658
|
throw new Error("not a WithTwoGenerics json object");
|
|
671
659
|
}
|
|
672
|
-
|
|
660
|
+
assertReifiedTypeArgsMatch(composeSuiType(WeightHookAdminCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
673
661
|
return WeightHookAdminCap.fromJSONField(typeArg, json);
|
|
674
662
|
}
|
|
675
663
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -687,16 +675,16 @@ class WeightHookAdminCap {
|
|
|
687
675
|
!isWeightHookAdminCap(data.bcs.type)) {
|
|
688
676
|
throw new Error(`object at is not a WeightHookAdminCap object`);
|
|
689
677
|
}
|
|
690
|
-
const gotTypeArgs =
|
|
678
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
691
679
|
if (gotTypeArgs.length !== 1) {
|
|
692
680
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
693
681
|
}
|
|
694
|
-
const gotTypeArg =
|
|
695
|
-
const expectedTypeArg =
|
|
696
|
-
if (gotTypeArg !==
|
|
682
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
683
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
684
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
697
685
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
698
686
|
}
|
|
699
|
-
return WeightHookAdminCap.fromBcs(typeArg, (
|
|
687
|
+
return WeightHookAdminCap.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
700
688
|
}
|
|
701
689
|
if (data.content) {
|
|
702
690
|
return WeightHookAdminCap.fromSuiParsedData(typeArg, data.content);
|
|
@@ -718,7 +706,6 @@ class WeightHookAdminCap {
|
|
|
718
706
|
});
|
|
719
707
|
}
|
|
720
708
|
}
|
|
721
|
-
|
|
722
|
-
WeightHookAdminCap.$typeName = `${index_1.PKG_V1}::weight::WeightHookAdminCap`;
|
|
709
|
+
WeightHookAdminCap.$typeName = `${PKG_V1}::weight::WeightHookAdminCap`;
|
|
723
710
|
WeightHookAdminCap.$numTypeParams = 1;
|
|
724
711
|
WeightHookAdminCap.$isPhantom = [true];
|