@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,37 +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 structs_1 = require("../../0x1/ascii/structs");
|
|
23
|
-
const structs_2 = require("../../0x1/option/structs");
|
|
24
|
-
const structs_3 = require("../../0x1/string/structs");
|
|
25
|
-
const structs_4 = require("../balance/structs");
|
|
26
|
-
const index_1 = require("../index");
|
|
27
|
-
const structs_5 = require("../object/structs");
|
|
28
|
-
const structs_6 = require("../url/structs");
|
|
29
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
30
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
10
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../../../_framework/reified";
|
|
11
|
+
import { composeSuiType, compressSuiType, parseTypeName, } from "../../../../_framework/util";
|
|
12
|
+
import { String as String1 } from "../../0x1/ascii/structs";
|
|
13
|
+
import { Option } from "../../0x1/option/structs";
|
|
14
|
+
import { String } from "../../0x1/string/structs";
|
|
15
|
+
import { Balance, Supply } from "../balance/structs";
|
|
16
|
+
import { PKG_V31 } from "../index";
|
|
17
|
+
import { ID, UID } from "../object/structs";
|
|
18
|
+
import { Url } from "../url/structs";
|
|
19
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
20
|
+
import { fromBase64 } from "@mysten/sui/utils";
|
|
31
21
|
/* ============================== Coin =============================== */
|
|
32
|
-
function isCoin(type) {
|
|
33
|
-
type =
|
|
34
|
-
return type.startsWith(`${
|
|
22
|
+
export function isCoin(type) {
|
|
23
|
+
type = compressSuiType(type);
|
|
24
|
+
return type.startsWith(`${PKG_V31}::coin::Coin` + "<");
|
|
35
25
|
}
|
|
36
|
-
class Coin {
|
|
26
|
+
export class Coin {
|
|
37
27
|
constructor(typeArgs, fields) {
|
|
38
28
|
this.__StructClass = true;
|
|
39
29
|
this.$typeName = Coin.$typeName;
|
|
40
30
|
this.$isPhantom = Coin.$isPhantom;
|
|
41
|
-
this.$fullTypeName =
|
|
31
|
+
this.$fullTypeName = composeSuiType(Coin.$typeName, ...typeArgs);
|
|
42
32
|
this.$typeArgs = typeArgs;
|
|
43
33
|
this.id = fields.id;
|
|
44
34
|
this.balance = fields.balance;
|
|
@@ -46,8 +36,8 @@ class Coin {
|
|
|
46
36
|
static reified(T) {
|
|
47
37
|
return {
|
|
48
38
|
typeName: Coin.$typeName,
|
|
49
|
-
fullTypeName:
|
|
50
|
-
typeArgs: [
|
|
39
|
+
fullTypeName: composeSuiType(Coin.$typeName, ...[extractType(T)]),
|
|
40
|
+
typeArgs: [extractType(T)],
|
|
51
41
|
isPhantom: Coin.$isPhantom,
|
|
52
42
|
reifiedTypeArgs: [T],
|
|
53
43
|
fromFields: (fields) => Coin.fromFields(T, fields),
|
|
@@ -60,7 +50,7 @@ class Coin {
|
|
|
60
50
|
fromSuiObjectData: (content) => Coin.fromSuiObjectData(T, content),
|
|
61
51
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Coin.fetch(client, T, id); }),
|
|
62
52
|
new: (fields) => {
|
|
63
|
-
return new Coin([
|
|
53
|
+
return new Coin([extractType(T)], fields);
|
|
64
54
|
},
|
|
65
55
|
kind: "StructClassReified",
|
|
66
56
|
};
|
|
@@ -69,31 +59,31 @@ class Coin {
|
|
|
69
59
|
return Coin.reified;
|
|
70
60
|
}
|
|
71
61
|
static phantom(T) {
|
|
72
|
-
return
|
|
62
|
+
return phantom(Coin.reified(T));
|
|
73
63
|
}
|
|
74
64
|
static get p() {
|
|
75
65
|
return Coin.phantom;
|
|
76
66
|
}
|
|
77
67
|
static get bcs() {
|
|
78
|
-
return
|
|
79
|
-
id:
|
|
80
|
-
balance:
|
|
68
|
+
return bcs.struct("Coin", {
|
|
69
|
+
id: UID.bcs,
|
|
70
|
+
balance: Balance.bcs,
|
|
81
71
|
});
|
|
82
72
|
}
|
|
83
73
|
static fromFields(typeArg, fields) {
|
|
84
74
|
return Coin.reified(typeArg).new({
|
|
85
|
-
id:
|
|
86
|
-
balance:
|
|
75
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
76
|
+
balance: decodeFromFields(Balance.reified(typeArg), fields.balance),
|
|
87
77
|
});
|
|
88
78
|
}
|
|
89
79
|
static fromFieldsWithTypes(typeArg, item) {
|
|
90
80
|
if (!isCoin(item.type)) {
|
|
91
81
|
throw new Error("not a Coin type");
|
|
92
82
|
}
|
|
93
|
-
|
|
83
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
94
84
|
return Coin.reified(typeArg).new({
|
|
95
|
-
id:
|
|
96
|
-
balance:
|
|
85
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
86
|
+
balance: decodeFromFieldsWithTypes(Balance.reified(typeArg), item.fields.balance),
|
|
97
87
|
});
|
|
98
88
|
}
|
|
99
89
|
static fromBcs(typeArg, data) {
|
|
@@ -110,15 +100,15 @@ class Coin {
|
|
|
110
100
|
}
|
|
111
101
|
static fromJSONField(typeArg, field) {
|
|
112
102
|
return Coin.reified(typeArg).new({
|
|
113
|
-
id:
|
|
114
|
-
balance:
|
|
103
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
104
|
+
balance: decodeFromJSONField(Balance.reified(typeArg), field.balance),
|
|
115
105
|
});
|
|
116
106
|
}
|
|
117
107
|
static fromJSON(typeArg, json) {
|
|
118
108
|
if (json.$typeName !== Coin.$typeName) {
|
|
119
109
|
throw new Error("not a WithTwoGenerics json object");
|
|
120
110
|
}
|
|
121
|
-
|
|
111
|
+
assertReifiedTypeArgsMatch(composeSuiType(Coin.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
122
112
|
return Coin.fromJSONField(typeArg, json);
|
|
123
113
|
}
|
|
124
114
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -135,16 +125,16 @@ class Coin {
|
|
|
135
125
|
if (data.bcs.dataType !== "moveObject" || !isCoin(data.bcs.type)) {
|
|
136
126
|
throw new Error(`object at is not a Coin object`);
|
|
137
127
|
}
|
|
138
|
-
const gotTypeArgs =
|
|
128
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
139
129
|
if (gotTypeArgs.length !== 1) {
|
|
140
130
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
141
131
|
}
|
|
142
|
-
const gotTypeArg =
|
|
143
|
-
const expectedTypeArg =
|
|
144
|
-
if (gotTypeArg !==
|
|
132
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
133
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
134
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
145
135
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
146
136
|
}
|
|
147
|
-
return Coin.fromBcs(typeArg, (
|
|
137
|
+
return Coin.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
148
138
|
}
|
|
149
139
|
if (data.content) {
|
|
150
140
|
return Coin.fromSuiParsedData(typeArg, data.content);
|
|
@@ -166,21 +156,20 @@ class Coin {
|
|
|
166
156
|
});
|
|
167
157
|
}
|
|
168
158
|
}
|
|
169
|
-
|
|
170
|
-
Coin.$typeName = `${index_1.PKG_V31}::coin::Coin`;
|
|
159
|
+
Coin.$typeName = `${PKG_V31}::coin::Coin`;
|
|
171
160
|
Coin.$numTypeParams = 1;
|
|
172
161
|
Coin.$isPhantom = [true];
|
|
173
162
|
/* ============================== CoinMetadata =============================== */
|
|
174
|
-
function isCoinMetadata(type) {
|
|
175
|
-
type =
|
|
176
|
-
return type.startsWith(`${
|
|
163
|
+
export function isCoinMetadata(type) {
|
|
164
|
+
type = compressSuiType(type);
|
|
165
|
+
return type.startsWith(`${PKG_V31}::coin::CoinMetadata` + "<");
|
|
177
166
|
}
|
|
178
|
-
class CoinMetadata {
|
|
167
|
+
export class CoinMetadata {
|
|
179
168
|
constructor(typeArgs, fields) {
|
|
180
169
|
this.__StructClass = true;
|
|
181
170
|
this.$typeName = CoinMetadata.$typeName;
|
|
182
171
|
this.$isPhantom = CoinMetadata.$isPhantom;
|
|
183
|
-
this.$fullTypeName =
|
|
172
|
+
this.$fullTypeName = composeSuiType(CoinMetadata.$typeName, ...typeArgs);
|
|
184
173
|
this.$typeArgs = typeArgs;
|
|
185
174
|
this.id = fields.id;
|
|
186
175
|
this.decimals = fields.decimals;
|
|
@@ -192,8 +181,8 @@ class CoinMetadata {
|
|
|
192
181
|
static reified(T) {
|
|
193
182
|
return {
|
|
194
183
|
typeName: CoinMetadata.$typeName,
|
|
195
|
-
fullTypeName:
|
|
196
|
-
typeArgs: [
|
|
184
|
+
fullTypeName: composeSuiType(CoinMetadata.$typeName, ...[extractType(T)]),
|
|
185
|
+
typeArgs: [extractType(T)],
|
|
197
186
|
isPhantom: CoinMetadata.$isPhantom,
|
|
198
187
|
reifiedTypeArgs: [T],
|
|
199
188
|
fromFields: (fields) => CoinMetadata.fromFields(T, fields),
|
|
@@ -206,7 +195,7 @@ class CoinMetadata {
|
|
|
206
195
|
fromSuiObjectData: (content) => CoinMetadata.fromSuiObjectData(T, content),
|
|
207
196
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return CoinMetadata.fetch(client, T, id); }),
|
|
208
197
|
new: (fields) => {
|
|
209
|
-
return new CoinMetadata([
|
|
198
|
+
return new CoinMetadata([extractType(T)], fields);
|
|
210
199
|
},
|
|
211
200
|
kind: "StructClassReified",
|
|
212
201
|
};
|
|
@@ -215,43 +204,43 @@ class CoinMetadata {
|
|
|
215
204
|
return CoinMetadata.reified;
|
|
216
205
|
}
|
|
217
206
|
static phantom(T) {
|
|
218
|
-
return
|
|
207
|
+
return phantom(CoinMetadata.reified(T));
|
|
219
208
|
}
|
|
220
209
|
static get p() {
|
|
221
210
|
return CoinMetadata.phantom;
|
|
222
211
|
}
|
|
223
212
|
static get bcs() {
|
|
224
|
-
return
|
|
225
|
-
id:
|
|
226
|
-
decimals:
|
|
227
|
-
name:
|
|
228
|
-
symbol:
|
|
229
|
-
description:
|
|
230
|
-
icon_url:
|
|
213
|
+
return bcs.struct("CoinMetadata", {
|
|
214
|
+
id: UID.bcs,
|
|
215
|
+
decimals: bcs.u8(),
|
|
216
|
+
name: String.bcs,
|
|
217
|
+
symbol: String1.bcs,
|
|
218
|
+
description: String.bcs,
|
|
219
|
+
icon_url: Option.bcs(Url.bcs),
|
|
231
220
|
});
|
|
232
221
|
}
|
|
233
222
|
static fromFields(typeArg, fields) {
|
|
234
223
|
return CoinMetadata.reified(typeArg).new({
|
|
235
|
-
id:
|
|
236
|
-
decimals:
|
|
237
|
-
name:
|
|
238
|
-
symbol:
|
|
239
|
-
description:
|
|
240
|
-
iconUrl:
|
|
224
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
225
|
+
decimals: decodeFromFields("u8", fields.decimals),
|
|
226
|
+
name: decodeFromFields(String.reified(), fields.name),
|
|
227
|
+
symbol: decodeFromFields(String1.reified(), fields.symbol),
|
|
228
|
+
description: decodeFromFields(String.reified(), fields.description),
|
|
229
|
+
iconUrl: decodeFromFields(Option.reified(Url.reified()), fields.icon_url),
|
|
241
230
|
});
|
|
242
231
|
}
|
|
243
232
|
static fromFieldsWithTypes(typeArg, item) {
|
|
244
233
|
if (!isCoinMetadata(item.type)) {
|
|
245
234
|
throw new Error("not a CoinMetadata type");
|
|
246
235
|
}
|
|
247
|
-
|
|
236
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
248
237
|
return CoinMetadata.reified(typeArg).new({
|
|
249
|
-
id:
|
|
250
|
-
decimals:
|
|
251
|
-
name:
|
|
252
|
-
symbol:
|
|
253
|
-
description:
|
|
254
|
-
iconUrl:
|
|
238
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
239
|
+
decimals: decodeFromFieldsWithTypes("u8", item.fields.decimals),
|
|
240
|
+
name: decodeFromFieldsWithTypes(String.reified(), item.fields.name),
|
|
241
|
+
symbol: decodeFromFieldsWithTypes(String1.reified(), item.fields.symbol),
|
|
242
|
+
description: decodeFromFieldsWithTypes(String.reified(), item.fields.description),
|
|
243
|
+
iconUrl: decodeFromFieldsWithTypes(Option.reified(Url.reified()), item.fields.icon_url),
|
|
255
244
|
});
|
|
256
245
|
}
|
|
257
246
|
static fromBcs(typeArg, data) {
|
|
@@ -264,7 +253,7 @@ class CoinMetadata {
|
|
|
264
253
|
name: this.name,
|
|
265
254
|
symbol: this.symbol,
|
|
266
255
|
description: this.description,
|
|
267
|
-
iconUrl:
|
|
256
|
+
iconUrl: fieldToJSON(`${Option.$typeName}<${Url.$typeName}>`, this.iconUrl),
|
|
268
257
|
};
|
|
269
258
|
}
|
|
270
259
|
toJSON() {
|
|
@@ -272,19 +261,19 @@ class CoinMetadata {
|
|
|
272
261
|
}
|
|
273
262
|
static fromJSONField(typeArg, field) {
|
|
274
263
|
return CoinMetadata.reified(typeArg).new({
|
|
275
|
-
id:
|
|
276
|
-
decimals:
|
|
277
|
-
name:
|
|
278
|
-
symbol:
|
|
279
|
-
description:
|
|
280
|
-
iconUrl:
|
|
264
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
265
|
+
decimals: decodeFromJSONField("u8", field.decimals),
|
|
266
|
+
name: decodeFromJSONField(String.reified(), field.name),
|
|
267
|
+
symbol: decodeFromJSONField(String1.reified(), field.symbol),
|
|
268
|
+
description: decodeFromJSONField(String.reified(), field.description),
|
|
269
|
+
iconUrl: decodeFromJSONField(Option.reified(Url.reified()), field.iconUrl),
|
|
281
270
|
});
|
|
282
271
|
}
|
|
283
272
|
static fromJSON(typeArg, json) {
|
|
284
273
|
if (json.$typeName !== CoinMetadata.$typeName) {
|
|
285
274
|
throw new Error("not a WithTwoGenerics json object");
|
|
286
275
|
}
|
|
287
|
-
|
|
276
|
+
assertReifiedTypeArgsMatch(composeSuiType(CoinMetadata.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
288
277
|
return CoinMetadata.fromJSONField(typeArg, json);
|
|
289
278
|
}
|
|
290
279
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -302,16 +291,16 @@ class CoinMetadata {
|
|
|
302
291
|
!isCoinMetadata(data.bcs.type)) {
|
|
303
292
|
throw new Error(`object at is not a CoinMetadata object`);
|
|
304
293
|
}
|
|
305
|
-
const gotTypeArgs =
|
|
294
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
306
295
|
if (gotTypeArgs.length !== 1) {
|
|
307
296
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
308
297
|
}
|
|
309
|
-
const gotTypeArg =
|
|
310
|
-
const expectedTypeArg =
|
|
311
|
-
if (gotTypeArg !==
|
|
298
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
299
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
300
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
312
301
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
313
302
|
}
|
|
314
|
-
return CoinMetadata.fromBcs(typeArg, (
|
|
303
|
+
return CoinMetadata.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
315
304
|
}
|
|
316
305
|
if (data.content) {
|
|
317
306
|
return CoinMetadata.fromSuiParsedData(typeArg, data.content);
|
|
@@ -333,29 +322,28 @@ class CoinMetadata {
|
|
|
333
322
|
});
|
|
334
323
|
}
|
|
335
324
|
}
|
|
336
|
-
|
|
337
|
-
CoinMetadata.$typeName = `${index_1.PKG_V31}::coin::CoinMetadata`;
|
|
325
|
+
CoinMetadata.$typeName = `${PKG_V31}::coin::CoinMetadata`;
|
|
338
326
|
CoinMetadata.$numTypeParams = 1;
|
|
339
327
|
CoinMetadata.$isPhantom = [true];
|
|
340
328
|
/* ============================== CurrencyCreated =============================== */
|
|
341
|
-
function isCurrencyCreated(type) {
|
|
342
|
-
type =
|
|
343
|
-
return type.startsWith(`${
|
|
329
|
+
export function isCurrencyCreated(type) {
|
|
330
|
+
type = compressSuiType(type);
|
|
331
|
+
return type.startsWith(`${PKG_V31}::coin::CurrencyCreated` + "<");
|
|
344
332
|
}
|
|
345
|
-
class CurrencyCreated {
|
|
333
|
+
export class CurrencyCreated {
|
|
346
334
|
constructor(typeArgs, fields) {
|
|
347
335
|
this.__StructClass = true;
|
|
348
336
|
this.$typeName = CurrencyCreated.$typeName;
|
|
349
337
|
this.$isPhantom = CurrencyCreated.$isPhantom;
|
|
350
|
-
this.$fullTypeName =
|
|
338
|
+
this.$fullTypeName = composeSuiType(CurrencyCreated.$typeName, ...typeArgs);
|
|
351
339
|
this.$typeArgs = typeArgs;
|
|
352
340
|
this.decimals = fields.decimals;
|
|
353
341
|
}
|
|
354
342
|
static reified(T) {
|
|
355
343
|
return {
|
|
356
344
|
typeName: CurrencyCreated.$typeName,
|
|
357
|
-
fullTypeName:
|
|
358
|
-
typeArgs: [
|
|
345
|
+
fullTypeName: composeSuiType(CurrencyCreated.$typeName, ...[extractType(T)]),
|
|
346
|
+
typeArgs: [extractType(T)],
|
|
359
347
|
isPhantom: CurrencyCreated.$isPhantom,
|
|
360
348
|
reifiedTypeArgs: [T],
|
|
361
349
|
fromFields: (fields) => CurrencyCreated.fromFields(T, fields),
|
|
@@ -368,7 +356,7 @@ class CurrencyCreated {
|
|
|
368
356
|
fromSuiObjectData: (content) => CurrencyCreated.fromSuiObjectData(T, content),
|
|
369
357
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return CurrencyCreated.fetch(client, T, id); }),
|
|
370
358
|
new: (fields) => {
|
|
371
|
-
return new CurrencyCreated([
|
|
359
|
+
return new CurrencyCreated([extractType(T)], fields);
|
|
372
360
|
},
|
|
373
361
|
kind: "StructClassReified",
|
|
374
362
|
};
|
|
@@ -377,28 +365,28 @@ class CurrencyCreated {
|
|
|
377
365
|
return CurrencyCreated.reified;
|
|
378
366
|
}
|
|
379
367
|
static phantom(T) {
|
|
380
|
-
return
|
|
368
|
+
return phantom(CurrencyCreated.reified(T));
|
|
381
369
|
}
|
|
382
370
|
static get p() {
|
|
383
371
|
return CurrencyCreated.phantom;
|
|
384
372
|
}
|
|
385
373
|
static get bcs() {
|
|
386
|
-
return
|
|
387
|
-
decimals:
|
|
374
|
+
return bcs.struct("CurrencyCreated", {
|
|
375
|
+
decimals: bcs.u8(),
|
|
388
376
|
});
|
|
389
377
|
}
|
|
390
378
|
static fromFields(typeArg, fields) {
|
|
391
379
|
return CurrencyCreated.reified(typeArg).new({
|
|
392
|
-
decimals:
|
|
380
|
+
decimals: decodeFromFields("u8", fields.decimals),
|
|
393
381
|
});
|
|
394
382
|
}
|
|
395
383
|
static fromFieldsWithTypes(typeArg, item) {
|
|
396
384
|
if (!isCurrencyCreated(item.type)) {
|
|
397
385
|
throw new Error("not a CurrencyCreated type");
|
|
398
386
|
}
|
|
399
|
-
|
|
387
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
400
388
|
return CurrencyCreated.reified(typeArg).new({
|
|
401
|
-
decimals:
|
|
389
|
+
decimals: decodeFromFieldsWithTypes("u8", item.fields.decimals),
|
|
402
390
|
});
|
|
403
391
|
}
|
|
404
392
|
static fromBcs(typeArg, data) {
|
|
@@ -414,14 +402,14 @@ class CurrencyCreated {
|
|
|
414
402
|
}
|
|
415
403
|
static fromJSONField(typeArg, field) {
|
|
416
404
|
return CurrencyCreated.reified(typeArg).new({
|
|
417
|
-
decimals:
|
|
405
|
+
decimals: decodeFromJSONField("u8", field.decimals),
|
|
418
406
|
});
|
|
419
407
|
}
|
|
420
408
|
static fromJSON(typeArg, json) {
|
|
421
409
|
if (json.$typeName !== CurrencyCreated.$typeName) {
|
|
422
410
|
throw new Error("not a WithTwoGenerics json object");
|
|
423
411
|
}
|
|
424
|
-
|
|
412
|
+
assertReifiedTypeArgsMatch(composeSuiType(CurrencyCreated.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
425
413
|
return CurrencyCreated.fromJSONField(typeArg, json);
|
|
426
414
|
}
|
|
427
415
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -439,16 +427,16 @@ class CurrencyCreated {
|
|
|
439
427
|
!isCurrencyCreated(data.bcs.type)) {
|
|
440
428
|
throw new Error(`object at is not a CurrencyCreated object`);
|
|
441
429
|
}
|
|
442
|
-
const gotTypeArgs =
|
|
430
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
443
431
|
if (gotTypeArgs.length !== 1) {
|
|
444
432
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
445
433
|
}
|
|
446
|
-
const gotTypeArg =
|
|
447
|
-
const expectedTypeArg =
|
|
448
|
-
if (gotTypeArg !==
|
|
434
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
435
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
436
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
449
437
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
450
438
|
}
|
|
451
|
-
return CurrencyCreated.fromBcs(typeArg, (
|
|
439
|
+
return CurrencyCreated.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
452
440
|
}
|
|
453
441
|
if (data.content) {
|
|
454
442
|
return CurrencyCreated.fromSuiParsedData(typeArg, data.content);
|
|
@@ -470,29 +458,28 @@ class CurrencyCreated {
|
|
|
470
458
|
});
|
|
471
459
|
}
|
|
472
460
|
}
|
|
473
|
-
|
|
474
|
-
CurrencyCreated.$typeName = `${index_1.PKG_V31}::coin::CurrencyCreated`;
|
|
461
|
+
CurrencyCreated.$typeName = `${PKG_V31}::coin::CurrencyCreated`;
|
|
475
462
|
CurrencyCreated.$numTypeParams = 1;
|
|
476
463
|
CurrencyCreated.$isPhantom = [true];
|
|
477
464
|
/* ============================== DenyCap =============================== */
|
|
478
|
-
function isDenyCap(type) {
|
|
479
|
-
type =
|
|
480
|
-
return type.startsWith(`${
|
|
465
|
+
export function isDenyCap(type) {
|
|
466
|
+
type = compressSuiType(type);
|
|
467
|
+
return type.startsWith(`${PKG_V31}::coin::DenyCap` + "<");
|
|
481
468
|
}
|
|
482
|
-
class DenyCap {
|
|
469
|
+
export class DenyCap {
|
|
483
470
|
constructor(typeArgs, fields) {
|
|
484
471
|
this.__StructClass = true;
|
|
485
472
|
this.$typeName = DenyCap.$typeName;
|
|
486
473
|
this.$isPhantom = DenyCap.$isPhantom;
|
|
487
|
-
this.$fullTypeName =
|
|
474
|
+
this.$fullTypeName = composeSuiType(DenyCap.$typeName, ...typeArgs);
|
|
488
475
|
this.$typeArgs = typeArgs;
|
|
489
476
|
this.id = fields.id;
|
|
490
477
|
}
|
|
491
478
|
static reified(T) {
|
|
492
479
|
return {
|
|
493
480
|
typeName: DenyCap.$typeName,
|
|
494
|
-
fullTypeName:
|
|
495
|
-
typeArgs: [
|
|
481
|
+
fullTypeName: composeSuiType(DenyCap.$typeName, ...[extractType(T)]),
|
|
482
|
+
typeArgs: [extractType(T)],
|
|
496
483
|
isPhantom: DenyCap.$isPhantom,
|
|
497
484
|
reifiedTypeArgs: [T],
|
|
498
485
|
fromFields: (fields) => DenyCap.fromFields(T, fields),
|
|
@@ -505,7 +492,7 @@ class DenyCap {
|
|
|
505
492
|
fromSuiObjectData: (content) => DenyCap.fromSuiObjectData(T, content),
|
|
506
493
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return DenyCap.fetch(client, T, id); }),
|
|
507
494
|
new: (fields) => {
|
|
508
|
-
return new DenyCap([
|
|
495
|
+
return new DenyCap([extractType(T)], fields);
|
|
509
496
|
},
|
|
510
497
|
kind: "StructClassReified",
|
|
511
498
|
};
|
|
@@ -514,28 +501,28 @@ class DenyCap {
|
|
|
514
501
|
return DenyCap.reified;
|
|
515
502
|
}
|
|
516
503
|
static phantom(T) {
|
|
517
|
-
return
|
|
504
|
+
return phantom(DenyCap.reified(T));
|
|
518
505
|
}
|
|
519
506
|
static get p() {
|
|
520
507
|
return DenyCap.phantom;
|
|
521
508
|
}
|
|
522
509
|
static get bcs() {
|
|
523
|
-
return
|
|
524
|
-
id:
|
|
510
|
+
return bcs.struct("DenyCap", {
|
|
511
|
+
id: UID.bcs,
|
|
525
512
|
});
|
|
526
513
|
}
|
|
527
514
|
static fromFields(typeArg, fields) {
|
|
528
515
|
return DenyCap.reified(typeArg).new({
|
|
529
|
-
id:
|
|
516
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
530
517
|
});
|
|
531
518
|
}
|
|
532
519
|
static fromFieldsWithTypes(typeArg, item) {
|
|
533
520
|
if (!isDenyCap(item.type)) {
|
|
534
521
|
throw new Error("not a DenyCap type");
|
|
535
522
|
}
|
|
536
|
-
|
|
523
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
537
524
|
return DenyCap.reified(typeArg).new({
|
|
538
|
-
id:
|
|
525
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
539
526
|
});
|
|
540
527
|
}
|
|
541
528
|
static fromBcs(typeArg, data) {
|
|
@@ -551,14 +538,14 @@ class DenyCap {
|
|
|
551
538
|
}
|
|
552
539
|
static fromJSONField(typeArg, field) {
|
|
553
540
|
return DenyCap.reified(typeArg).new({
|
|
554
|
-
id:
|
|
541
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
555
542
|
});
|
|
556
543
|
}
|
|
557
544
|
static fromJSON(typeArg, json) {
|
|
558
545
|
if (json.$typeName !== DenyCap.$typeName) {
|
|
559
546
|
throw new Error("not a WithTwoGenerics json object");
|
|
560
547
|
}
|
|
561
|
-
|
|
548
|
+
assertReifiedTypeArgsMatch(composeSuiType(DenyCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
562
549
|
return DenyCap.fromJSONField(typeArg, json);
|
|
563
550
|
}
|
|
564
551
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -575,16 +562,16 @@ class DenyCap {
|
|
|
575
562
|
if (data.bcs.dataType !== "moveObject" || !isDenyCap(data.bcs.type)) {
|
|
576
563
|
throw new Error(`object at is not a DenyCap object`);
|
|
577
564
|
}
|
|
578
|
-
const gotTypeArgs =
|
|
565
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
579
566
|
if (gotTypeArgs.length !== 1) {
|
|
580
567
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
581
568
|
}
|
|
582
|
-
const gotTypeArg =
|
|
583
|
-
const expectedTypeArg =
|
|
584
|
-
if (gotTypeArg !==
|
|
569
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
570
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
571
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
585
572
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
586
573
|
}
|
|
587
|
-
return DenyCap.fromBcs(typeArg, (
|
|
574
|
+
return DenyCap.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
588
575
|
}
|
|
589
576
|
if (data.content) {
|
|
590
577
|
return DenyCap.fromSuiParsedData(typeArg, data.content);
|
|
@@ -606,21 +593,20 @@ class DenyCap {
|
|
|
606
593
|
});
|
|
607
594
|
}
|
|
608
595
|
}
|
|
609
|
-
|
|
610
|
-
DenyCap.$typeName = `${index_1.PKG_V31}::coin::DenyCap`;
|
|
596
|
+
DenyCap.$typeName = `${PKG_V31}::coin::DenyCap`;
|
|
611
597
|
DenyCap.$numTypeParams = 1;
|
|
612
598
|
DenyCap.$isPhantom = [true];
|
|
613
599
|
/* ============================== DenyCapV2 =============================== */
|
|
614
|
-
function isDenyCapV2(type) {
|
|
615
|
-
type =
|
|
616
|
-
return type.startsWith(`${
|
|
600
|
+
export function isDenyCapV2(type) {
|
|
601
|
+
type = compressSuiType(type);
|
|
602
|
+
return type.startsWith(`${PKG_V31}::coin::DenyCapV2` + "<");
|
|
617
603
|
}
|
|
618
|
-
class DenyCapV2 {
|
|
604
|
+
export class DenyCapV2 {
|
|
619
605
|
constructor(typeArgs, fields) {
|
|
620
606
|
this.__StructClass = true;
|
|
621
607
|
this.$typeName = DenyCapV2.$typeName;
|
|
622
608
|
this.$isPhantom = DenyCapV2.$isPhantom;
|
|
623
|
-
this.$fullTypeName =
|
|
609
|
+
this.$fullTypeName = composeSuiType(DenyCapV2.$typeName, ...typeArgs);
|
|
624
610
|
this.$typeArgs = typeArgs;
|
|
625
611
|
this.id = fields.id;
|
|
626
612
|
this.allowGlobalPause = fields.allowGlobalPause;
|
|
@@ -628,8 +614,8 @@ class DenyCapV2 {
|
|
|
628
614
|
static reified(T) {
|
|
629
615
|
return {
|
|
630
616
|
typeName: DenyCapV2.$typeName,
|
|
631
|
-
fullTypeName:
|
|
632
|
-
typeArgs: [
|
|
617
|
+
fullTypeName: composeSuiType(DenyCapV2.$typeName, ...[extractType(T)]),
|
|
618
|
+
typeArgs: [extractType(T)],
|
|
633
619
|
isPhantom: DenyCapV2.$isPhantom,
|
|
634
620
|
reifiedTypeArgs: [T],
|
|
635
621
|
fromFields: (fields) => DenyCapV2.fromFields(T, fields),
|
|
@@ -642,7 +628,7 @@ class DenyCapV2 {
|
|
|
642
628
|
fromSuiObjectData: (content) => DenyCapV2.fromSuiObjectData(T, content),
|
|
643
629
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return DenyCapV2.fetch(client, T, id); }),
|
|
644
630
|
new: (fields) => {
|
|
645
|
-
return new DenyCapV2([
|
|
631
|
+
return new DenyCapV2([extractType(T)], fields);
|
|
646
632
|
},
|
|
647
633
|
kind: "StructClassReified",
|
|
648
634
|
};
|
|
@@ -651,31 +637,31 @@ class DenyCapV2 {
|
|
|
651
637
|
return DenyCapV2.reified;
|
|
652
638
|
}
|
|
653
639
|
static phantom(T) {
|
|
654
|
-
return
|
|
640
|
+
return phantom(DenyCapV2.reified(T));
|
|
655
641
|
}
|
|
656
642
|
static get p() {
|
|
657
643
|
return DenyCapV2.phantom;
|
|
658
644
|
}
|
|
659
645
|
static get bcs() {
|
|
660
|
-
return
|
|
661
|
-
id:
|
|
662
|
-
allow_global_pause:
|
|
646
|
+
return bcs.struct("DenyCapV2", {
|
|
647
|
+
id: UID.bcs,
|
|
648
|
+
allow_global_pause: bcs.bool(),
|
|
663
649
|
});
|
|
664
650
|
}
|
|
665
651
|
static fromFields(typeArg, fields) {
|
|
666
652
|
return DenyCapV2.reified(typeArg).new({
|
|
667
|
-
id:
|
|
668
|
-
allowGlobalPause:
|
|
653
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
654
|
+
allowGlobalPause: decodeFromFields("bool", fields.allow_global_pause),
|
|
669
655
|
});
|
|
670
656
|
}
|
|
671
657
|
static fromFieldsWithTypes(typeArg, item) {
|
|
672
658
|
if (!isDenyCapV2(item.type)) {
|
|
673
659
|
throw new Error("not a DenyCapV2 type");
|
|
674
660
|
}
|
|
675
|
-
|
|
661
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
676
662
|
return DenyCapV2.reified(typeArg).new({
|
|
677
|
-
id:
|
|
678
|
-
allowGlobalPause:
|
|
663
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
664
|
+
allowGlobalPause: decodeFromFieldsWithTypes("bool", item.fields.allow_global_pause),
|
|
679
665
|
});
|
|
680
666
|
}
|
|
681
667
|
static fromBcs(typeArg, data) {
|
|
@@ -692,15 +678,15 @@ class DenyCapV2 {
|
|
|
692
678
|
}
|
|
693
679
|
static fromJSONField(typeArg, field) {
|
|
694
680
|
return DenyCapV2.reified(typeArg).new({
|
|
695
|
-
id:
|
|
696
|
-
allowGlobalPause:
|
|
681
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
682
|
+
allowGlobalPause: decodeFromJSONField("bool", field.allowGlobalPause),
|
|
697
683
|
});
|
|
698
684
|
}
|
|
699
685
|
static fromJSON(typeArg, json) {
|
|
700
686
|
if (json.$typeName !== DenyCapV2.$typeName) {
|
|
701
687
|
throw new Error("not a WithTwoGenerics json object");
|
|
702
688
|
}
|
|
703
|
-
|
|
689
|
+
assertReifiedTypeArgsMatch(composeSuiType(DenyCapV2.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
704
690
|
return DenyCapV2.fromJSONField(typeArg, json);
|
|
705
691
|
}
|
|
706
692
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -717,16 +703,16 @@ class DenyCapV2 {
|
|
|
717
703
|
if (data.bcs.dataType !== "moveObject" || !isDenyCapV2(data.bcs.type)) {
|
|
718
704
|
throw new Error(`object at is not a DenyCapV2 object`);
|
|
719
705
|
}
|
|
720
|
-
const gotTypeArgs =
|
|
706
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
721
707
|
if (gotTypeArgs.length !== 1) {
|
|
722
708
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
723
709
|
}
|
|
724
|
-
const gotTypeArg =
|
|
725
|
-
const expectedTypeArg =
|
|
726
|
-
if (gotTypeArg !==
|
|
710
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
711
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
712
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
727
713
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
728
714
|
}
|
|
729
|
-
return DenyCapV2.fromBcs(typeArg, (
|
|
715
|
+
return DenyCapV2.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
730
716
|
}
|
|
731
717
|
if (data.content) {
|
|
732
718
|
return DenyCapV2.fromSuiParsedData(typeArg, data.content);
|
|
@@ -748,21 +734,20 @@ class DenyCapV2 {
|
|
|
748
734
|
});
|
|
749
735
|
}
|
|
750
736
|
}
|
|
751
|
-
|
|
752
|
-
DenyCapV2.$typeName = `${index_1.PKG_V31}::coin::DenyCapV2`;
|
|
737
|
+
DenyCapV2.$typeName = `${PKG_V31}::coin::DenyCapV2`;
|
|
753
738
|
DenyCapV2.$numTypeParams = 1;
|
|
754
739
|
DenyCapV2.$isPhantom = [true];
|
|
755
740
|
/* ============================== RegulatedCoinMetadata =============================== */
|
|
756
|
-
function isRegulatedCoinMetadata(type) {
|
|
757
|
-
type =
|
|
758
|
-
return type.startsWith(`${
|
|
741
|
+
export function isRegulatedCoinMetadata(type) {
|
|
742
|
+
type = compressSuiType(type);
|
|
743
|
+
return type.startsWith(`${PKG_V31}::coin::RegulatedCoinMetadata` + "<");
|
|
759
744
|
}
|
|
760
|
-
class RegulatedCoinMetadata {
|
|
745
|
+
export class RegulatedCoinMetadata {
|
|
761
746
|
constructor(typeArgs, fields) {
|
|
762
747
|
this.__StructClass = true;
|
|
763
748
|
this.$typeName = RegulatedCoinMetadata.$typeName;
|
|
764
749
|
this.$isPhantom = RegulatedCoinMetadata.$isPhantom;
|
|
765
|
-
this.$fullTypeName =
|
|
750
|
+
this.$fullTypeName = composeSuiType(RegulatedCoinMetadata.$typeName, ...typeArgs);
|
|
766
751
|
this.$typeArgs = typeArgs;
|
|
767
752
|
this.id = fields.id;
|
|
768
753
|
this.coinMetadataObject = fields.coinMetadataObject;
|
|
@@ -771,8 +756,8 @@ class RegulatedCoinMetadata {
|
|
|
771
756
|
static reified(T) {
|
|
772
757
|
return {
|
|
773
758
|
typeName: RegulatedCoinMetadata.$typeName,
|
|
774
|
-
fullTypeName:
|
|
775
|
-
typeArgs: [
|
|
759
|
+
fullTypeName: composeSuiType(RegulatedCoinMetadata.$typeName, ...[extractType(T)]),
|
|
760
|
+
typeArgs: [extractType(T)],
|
|
776
761
|
isPhantom: RegulatedCoinMetadata.$isPhantom,
|
|
777
762
|
reifiedTypeArgs: [T],
|
|
778
763
|
fromFields: (fields) => RegulatedCoinMetadata.fromFields(T, fields),
|
|
@@ -785,7 +770,7 @@ class RegulatedCoinMetadata {
|
|
|
785
770
|
fromSuiObjectData: (content) => RegulatedCoinMetadata.fromSuiObjectData(T, content),
|
|
786
771
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RegulatedCoinMetadata.fetch(client, T, id); }),
|
|
787
772
|
new: (fields) => {
|
|
788
|
-
return new RegulatedCoinMetadata([
|
|
773
|
+
return new RegulatedCoinMetadata([extractType(T)], fields);
|
|
789
774
|
},
|
|
790
775
|
kind: "StructClassReified",
|
|
791
776
|
};
|
|
@@ -794,34 +779,34 @@ class RegulatedCoinMetadata {
|
|
|
794
779
|
return RegulatedCoinMetadata.reified;
|
|
795
780
|
}
|
|
796
781
|
static phantom(T) {
|
|
797
|
-
return
|
|
782
|
+
return phantom(RegulatedCoinMetadata.reified(T));
|
|
798
783
|
}
|
|
799
784
|
static get p() {
|
|
800
785
|
return RegulatedCoinMetadata.phantom;
|
|
801
786
|
}
|
|
802
787
|
static get bcs() {
|
|
803
|
-
return
|
|
804
|
-
id:
|
|
805
|
-
coin_metadata_object:
|
|
806
|
-
deny_cap_object:
|
|
788
|
+
return bcs.struct("RegulatedCoinMetadata", {
|
|
789
|
+
id: UID.bcs,
|
|
790
|
+
coin_metadata_object: ID.bcs,
|
|
791
|
+
deny_cap_object: ID.bcs,
|
|
807
792
|
});
|
|
808
793
|
}
|
|
809
794
|
static fromFields(typeArg, fields) {
|
|
810
795
|
return RegulatedCoinMetadata.reified(typeArg).new({
|
|
811
|
-
id:
|
|
812
|
-
coinMetadataObject:
|
|
813
|
-
denyCapObject:
|
|
796
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
797
|
+
coinMetadataObject: decodeFromFields(ID.reified(), fields.coin_metadata_object),
|
|
798
|
+
denyCapObject: decodeFromFields(ID.reified(), fields.deny_cap_object),
|
|
814
799
|
});
|
|
815
800
|
}
|
|
816
801
|
static fromFieldsWithTypes(typeArg, item) {
|
|
817
802
|
if (!isRegulatedCoinMetadata(item.type)) {
|
|
818
803
|
throw new Error("not a RegulatedCoinMetadata type");
|
|
819
804
|
}
|
|
820
|
-
|
|
805
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
821
806
|
return RegulatedCoinMetadata.reified(typeArg).new({
|
|
822
|
-
id:
|
|
823
|
-
coinMetadataObject:
|
|
824
|
-
denyCapObject:
|
|
807
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
808
|
+
coinMetadataObject: decodeFromFieldsWithTypes(ID.reified(), item.fields.coin_metadata_object),
|
|
809
|
+
denyCapObject: decodeFromFieldsWithTypes(ID.reified(), item.fields.deny_cap_object),
|
|
825
810
|
});
|
|
826
811
|
}
|
|
827
812
|
static fromBcs(typeArg, data) {
|
|
@@ -839,16 +824,16 @@ class RegulatedCoinMetadata {
|
|
|
839
824
|
}
|
|
840
825
|
static fromJSONField(typeArg, field) {
|
|
841
826
|
return RegulatedCoinMetadata.reified(typeArg).new({
|
|
842
|
-
id:
|
|
843
|
-
coinMetadataObject:
|
|
844
|
-
denyCapObject:
|
|
827
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
828
|
+
coinMetadataObject: decodeFromJSONField(ID.reified(), field.coinMetadataObject),
|
|
829
|
+
denyCapObject: decodeFromJSONField(ID.reified(), field.denyCapObject),
|
|
845
830
|
});
|
|
846
831
|
}
|
|
847
832
|
static fromJSON(typeArg, json) {
|
|
848
833
|
if (json.$typeName !== RegulatedCoinMetadata.$typeName) {
|
|
849
834
|
throw new Error("not a WithTwoGenerics json object");
|
|
850
835
|
}
|
|
851
|
-
|
|
836
|
+
assertReifiedTypeArgsMatch(composeSuiType(RegulatedCoinMetadata.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
852
837
|
return RegulatedCoinMetadata.fromJSONField(typeArg, json);
|
|
853
838
|
}
|
|
854
839
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -866,16 +851,16 @@ class RegulatedCoinMetadata {
|
|
|
866
851
|
!isRegulatedCoinMetadata(data.bcs.type)) {
|
|
867
852
|
throw new Error(`object at is not a RegulatedCoinMetadata object`);
|
|
868
853
|
}
|
|
869
|
-
const gotTypeArgs =
|
|
854
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
870
855
|
if (gotTypeArgs.length !== 1) {
|
|
871
856
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
872
857
|
}
|
|
873
|
-
const gotTypeArg =
|
|
874
|
-
const expectedTypeArg =
|
|
875
|
-
if (gotTypeArg !==
|
|
858
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
859
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
860
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
876
861
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
877
862
|
}
|
|
878
|
-
return RegulatedCoinMetadata.fromBcs(typeArg, (
|
|
863
|
+
return RegulatedCoinMetadata.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
879
864
|
}
|
|
880
865
|
if (data.content) {
|
|
881
866
|
return RegulatedCoinMetadata.fromSuiParsedData(typeArg, data.content);
|
|
@@ -897,21 +882,20 @@ class RegulatedCoinMetadata {
|
|
|
897
882
|
});
|
|
898
883
|
}
|
|
899
884
|
}
|
|
900
|
-
|
|
901
|
-
RegulatedCoinMetadata.$typeName = `${index_1.PKG_V31}::coin::RegulatedCoinMetadata`;
|
|
885
|
+
RegulatedCoinMetadata.$typeName = `${PKG_V31}::coin::RegulatedCoinMetadata`;
|
|
902
886
|
RegulatedCoinMetadata.$numTypeParams = 1;
|
|
903
887
|
RegulatedCoinMetadata.$isPhantom = [true];
|
|
904
888
|
/* ============================== TreasuryCap =============================== */
|
|
905
|
-
function isTreasuryCap(type) {
|
|
906
|
-
type =
|
|
907
|
-
return type.startsWith(`${
|
|
889
|
+
export function isTreasuryCap(type) {
|
|
890
|
+
type = compressSuiType(type);
|
|
891
|
+
return type.startsWith(`${PKG_V31}::coin::TreasuryCap` + "<");
|
|
908
892
|
}
|
|
909
|
-
class TreasuryCap {
|
|
893
|
+
export class TreasuryCap {
|
|
910
894
|
constructor(typeArgs, fields) {
|
|
911
895
|
this.__StructClass = true;
|
|
912
896
|
this.$typeName = TreasuryCap.$typeName;
|
|
913
897
|
this.$isPhantom = TreasuryCap.$isPhantom;
|
|
914
|
-
this.$fullTypeName =
|
|
898
|
+
this.$fullTypeName = composeSuiType(TreasuryCap.$typeName, ...typeArgs);
|
|
915
899
|
this.$typeArgs = typeArgs;
|
|
916
900
|
this.id = fields.id;
|
|
917
901
|
this.totalSupply = fields.totalSupply;
|
|
@@ -919,8 +903,8 @@ class TreasuryCap {
|
|
|
919
903
|
static reified(T) {
|
|
920
904
|
return {
|
|
921
905
|
typeName: TreasuryCap.$typeName,
|
|
922
|
-
fullTypeName:
|
|
923
|
-
typeArgs: [
|
|
906
|
+
fullTypeName: composeSuiType(TreasuryCap.$typeName, ...[extractType(T)]),
|
|
907
|
+
typeArgs: [extractType(T)],
|
|
924
908
|
isPhantom: TreasuryCap.$isPhantom,
|
|
925
909
|
reifiedTypeArgs: [T],
|
|
926
910
|
fromFields: (fields) => TreasuryCap.fromFields(T, fields),
|
|
@@ -933,7 +917,7 @@ class TreasuryCap {
|
|
|
933
917
|
fromSuiObjectData: (content) => TreasuryCap.fromSuiObjectData(T, content),
|
|
934
918
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return TreasuryCap.fetch(client, T, id); }),
|
|
935
919
|
new: (fields) => {
|
|
936
|
-
return new TreasuryCap([
|
|
920
|
+
return new TreasuryCap([extractType(T)], fields);
|
|
937
921
|
},
|
|
938
922
|
kind: "StructClassReified",
|
|
939
923
|
};
|
|
@@ -942,31 +926,31 @@ class TreasuryCap {
|
|
|
942
926
|
return TreasuryCap.reified;
|
|
943
927
|
}
|
|
944
928
|
static phantom(T) {
|
|
945
|
-
return
|
|
929
|
+
return phantom(TreasuryCap.reified(T));
|
|
946
930
|
}
|
|
947
931
|
static get p() {
|
|
948
932
|
return TreasuryCap.phantom;
|
|
949
933
|
}
|
|
950
934
|
static get bcs() {
|
|
951
|
-
return
|
|
952
|
-
id:
|
|
953
|
-
total_supply:
|
|
935
|
+
return bcs.struct("TreasuryCap", {
|
|
936
|
+
id: UID.bcs,
|
|
937
|
+
total_supply: Supply.bcs,
|
|
954
938
|
});
|
|
955
939
|
}
|
|
956
940
|
static fromFields(typeArg, fields) {
|
|
957
941
|
return TreasuryCap.reified(typeArg).new({
|
|
958
|
-
id:
|
|
959
|
-
totalSupply:
|
|
942
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
943
|
+
totalSupply: decodeFromFields(Supply.reified(typeArg), fields.total_supply),
|
|
960
944
|
});
|
|
961
945
|
}
|
|
962
946
|
static fromFieldsWithTypes(typeArg, item) {
|
|
963
947
|
if (!isTreasuryCap(item.type)) {
|
|
964
948
|
throw new Error("not a TreasuryCap type");
|
|
965
949
|
}
|
|
966
|
-
|
|
950
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
967
951
|
return TreasuryCap.reified(typeArg).new({
|
|
968
|
-
id:
|
|
969
|
-
totalSupply:
|
|
952
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
953
|
+
totalSupply: decodeFromFieldsWithTypes(Supply.reified(typeArg), item.fields.total_supply),
|
|
970
954
|
});
|
|
971
955
|
}
|
|
972
956
|
static fromBcs(typeArg, data) {
|
|
@@ -983,15 +967,15 @@ class TreasuryCap {
|
|
|
983
967
|
}
|
|
984
968
|
static fromJSONField(typeArg, field) {
|
|
985
969
|
return TreasuryCap.reified(typeArg).new({
|
|
986
|
-
id:
|
|
987
|
-
totalSupply:
|
|
970
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
971
|
+
totalSupply: decodeFromJSONField(Supply.reified(typeArg), field.totalSupply),
|
|
988
972
|
});
|
|
989
973
|
}
|
|
990
974
|
static fromJSON(typeArg, json) {
|
|
991
975
|
if (json.$typeName !== TreasuryCap.$typeName) {
|
|
992
976
|
throw new Error("not a WithTwoGenerics json object");
|
|
993
977
|
}
|
|
994
|
-
|
|
978
|
+
assertReifiedTypeArgsMatch(composeSuiType(TreasuryCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
995
979
|
return TreasuryCap.fromJSONField(typeArg, json);
|
|
996
980
|
}
|
|
997
981
|
static fromSuiParsedData(typeArg, content) {
|
|
@@ -1008,16 +992,16 @@ class TreasuryCap {
|
|
|
1008
992
|
if (data.bcs.dataType !== "moveObject" || !isTreasuryCap(data.bcs.type)) {
|
|
1009
993
|
throw new Error(`object at is not a TreasuryCap object`);
|
|
1010
994
|
}
|
|
1011
|
-
const gotTypeArgs =
|
|
995
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
1012
996
|
if (gotTypeArgs.length !== 1) {
|
|
1013
997
|
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
1014
998
|
}
|
|
1015
|
-
const gotTypeArg =
|
|
1016
|
-
const expectedTypeArg =
|
|
1017
|
-
if (gotTypeArg !==
|
|
999
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
1000
|
+
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
1001
|
+
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
1018
1002
|
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
1019
1003
|
}
|
|
1020
|
-
return TreasuryCap.fromBcs(typeArg, (
|
|
1004
|
+
return TreasuryCap.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
1021
1005
|
}
|
|
1022
1006
|
if (data.content) {
|
|
1023
1007
|
return TreasuryCap.fromSuiParsedData(typeArg, data.content);
|
|
@@ -1039,7 +1023,6 @@ class TreasuryCap {
|
|
|
1039
1023
|
});
|
|
1040
1024
|
}
|
|
1041
1025
|
}
|
|
1042
|
-
|
|
1043
|
-
TreasuryCap.$typeName = `${index_1.PKG_V31}::coin::TreasuryCap`;
|
|
1026
|
+
TreasuryCap.$typeName = `${PKG_V31}::coin::TreasuryCap`;
|
|
1044
1027
|
TreasuryCap.$numTypeParams = 1;
|
|
1045
1028
|
TreasuryCap.$isPhantom = [true];
|