@suilend/springsui-cli 1.0.12 → 1.0.14
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 +51 -55
- package/cli/src/index.js +165 -146
- package/package.json +1 -1
- package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +8 -12
- 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 +2 -9
- package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +31 -69
- package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +5 -7
- package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +21 -59
- package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +7 -11
- package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +20 -25
- package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +9 -16
- package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +24 -29
- package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -11
- package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +49 -56
- package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +73 -141
- 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 +9 -15
- package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +34 -41
- package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +4 -6
- package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +19 -24
- package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +9 -16
- package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +31 -36
- package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +7 -11
- package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +20 -25
- package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +15 -20
- 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 +77 -159
- 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 +4 -16
- package/sdk/src/_generated/_framework/util.js +26 -40
- package/sdk/src/_generated/_framework/vector.d.ts +1 -5
- package/sdk/src/_generated/_framework/vector.js +16 -21
- package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +2 -13
- package/sdk/src/_generated/liquid_staking/cell/structs.js +31 -36
- package/sdk/src/_generated/liquid_staking/fees/functions.d.ts +19 -19
- package/sdk/src/_generated/liquid_staking/fees/functions.js +55 -75
- package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +27 -51
- 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.d.ts +20 -20
- package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +86 -107
- package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +144 -286
- package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +264 -320
- package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +44 -103
- package/sdk/src/_generated/liquid_staking/storage/structs.js +85 -125
- package/sdk/src/_generated/liquid_staking/version/structs.d.ts +4 -6
- package/sdk/src/_generated/liquid_staking/version/structs.js +19 -24
- package/sdk/src/_generated/liquid_staking/weight/functions.d.ts +11 -11
- package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -56
- package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +61 -113
- package/sdk/src/_generated/liquid_staking/weight/structs.js +128 -141
- package/sdk/src/client.d.ts +26 -36
- package/sdk/src/client.js +90 -126
- package/sdk/src/grpcAdapter.d.ts +50 -0
- package/sdk/src/grpcAdapter.js +75 -0
- package/sdk/src/index.d.ts +1 -0
- package/sdk/src/index.js +3 -18
- package/sdk/src/lib/index.js +1 -17
- package/sdk/src/lib/transactions.d.ts +1 -4
- package/sdk/src/lib/transactions.js +3 -8
|
@@ -9,7 +9,7 @@ import { PhantomReified, Reified, StructClass, ToField, ToTypeStr, ToTypeStr as
|
|
|
9
9
|
import { FieldsWithTypes } from "../../_framework/util";
|
|
10
10
|
import { Vector } from "../../_framework/vector";
|
|
11
11
|
import { PKG_V1 } from "../index";
|
|
12
|
-
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
12
|
+
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui-v1/client";
|
|
13
13
|
export declare function isStorage(type: string): boolean;
|
|
14
14
|
export interface StorageFields {
|
|
15
15
|
suiPool: ToField<Balance<ToPhantom<SUI>>>;
|
|
@@ -38,21 +38,17 @@ export declare class Storage implements StructClass {
|
|
|
38
38
|
static get r(): reified.StructClassReified<Storage, StorageFields>;
|
|
39
39
|
static phantom(): PhantomReified<ToTypeStr<Storage>>;
|
|
40
40
|
static get p(): reified.PhantomReified<"0xb0575765166030556a6eafd3b1b970eba8183ff748860680245b9edd41c716e7::storage::Storage">;
|
|
41
|
-
static get bcs(): import("@mysten/sui/bcs").
|
|
42
|
-
sui_pool: {
|
|
43
|
-
value: string
|
|
44
|
-
}
|
|
45
|
-
validator_infos: {
|
|
41
|
+
static get bcs(): import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
42
|
+
sui_pool: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
43
|
+
value: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
44
|
+
}, string>;
|
|
45
|
+
validator_infos: import("@mysten/sui-v1/bcs").BcsType<{
|
|
46
46
|
staking_pool_id: {
|
|
47
47
|
bytes: string;
|
|
48
48
|
};
|
|
49
49
|
validator_address: string;
|
|
50
|
-
active_stake:
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
inactive_stake: {
|
|
54
|
-
vec: any[];
|
|
55
|
-
};
|
|
50
|
+
active_stake: unknown;
|
|
51
|
+
inactive_stake: unknown;
|
|
56
52
|
exchange_rate: {
|
|
57
53
|
sui_amount: string;
|
|
58
54
|
pool_token_amount: string;
|
|
@@ -66,36 +62,13 @@ export declare class Storage implements StructClass {
|
|
|
66
62
|
};
|
|
67
63
|
size: string;
|
|
68
64
|
};
|
|
69
|
-
}[]
|
|
70
|
-
total_sui_supply: string;
|
|
71
|
-
last_refresh_epoch: string;
|
|
72
|
-
extra_fields: {
|
|
73
|
-
id: {
|
|
74
|
-
id: {
|
|
75
|
-
bytes: string;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
size: string;
|
|
79
|
-
};
|
|
80
|
-
}, {
|
|
81
|
-
sui_pool: {
|
|
82
|
-
value: string | number | bigint;
|
|
83
|
-
};
|
|
84
|
-
validator_infos: Iterable<{
|
|
65
|
+
}[], Iterable<{
|
|
85
66
|
staking_pool_id: {
|
|
86
67
|
bytes: string;
|
|
87
68
|
};
|
|
88
69
|
validator_address: string;
|
|
89
|
-
active_stake:
|
|
90
|
-
|
|
91
|
-
length: number;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
inactive_stake: {
|
|
95
|
-
vec: Iterable<any> & {
|
|
96
|
-
length: number;
|
|
97
|
-
};
|
|
98
|
-
};
|
|
70
|
+
active_stake: unknown;
|
|
71
|
+
inactive_stake: unknown;
|
|
99
72
|
exchange_rate: {
|
|
100
73
|
sui_amount: string | number | bigint;
|
|
101
74
|
pool_token_amount: string | number | bigint;
|
|
@@ -111,18 +84,18 @@ export declare class Storage implements StructClass {
|
|
|
111
84
|
};
|
|
112
85
|
}> & {
|
|
113
86
|
length: number;
|
|
114
|
-
}
|
|
115
|
-
total_sui_supply: string | number | bigint
|
|
116
|
-
last_refresh_epoch: string | number | bigint
|
|
117
|
-
extra_fields: {
|
|
118
|
-
id: {
|
|
119
|
-
id: {
|
|
120
|
-
bytes: string
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
size: string | number | bigint
|
|
124
|
-
}
|
|
125
|
-
}>;
|
|
87
|
+
}, string>;
|
|
88
|
+
total_sui_supply: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
89
|
+
last_refresh_epoch: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
90
|
+
extra_fields: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
91
|
+
id: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
92
|
+
id: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
93
|
+
bytes: import("@mysten/sui-v1/bcs").BcsType<string, string, string>;
|
|
94
|
+
}, string>;
|
|
95
|
+
}, string>;
|
|
96
|
+
size: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
97
|
+
}, string>;
|
|
98
|
+
}, string>;
|
|
126
99
|
static fromFields(fields: Record<string, any>): Storage;
|
|
127
100
|
static fromFieldsWithTypes(item: FieldsWithTypes): Storage;
|
|
128
101
|
static fromBcs(data: Uint8Array): Storage;
|
|
@@ -240,59 +213,27 @@ export declare class ValidatorInfo implements StructClass {
|
|
|
240
213
|
static get r(): reified.StructClassReified<ValidatorInfo, ValidatorInfoFields>;
|
|
241
214
|
static phantom(): PhantomReified<ToTypeStr<ValidatorInfo>>;
|
|
242
215
|
static get p(): reified.PhantomReified<"0xb0575765166030556a6eafd3b1b970eba8183ff748860680245b9edd41c716e7::storage::ValidatorInfo">;
|
|
243
|
-
static get bcs(): import("@mysten/sui/bcs").
|
|
244
|
-
staking_pool_id: {
|
|
245
|
-
bytes: string
|
|
246
|
-
}
|
|
247
|
-
validator_address: string
|
|
248
|
-
active_stake:
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
};
|
|
265
|
-
size: string;
|
|
266
|
-
};
|
|
267
|
-
}, {
|
|
268
|
-
staking_pool_id: {
|
|
269
|
-
bytes: string;
|
|
270
|
-
};
|
|
271
|
-
validator_address: string;
|
|
272
|
-
active_stake: {
|
|
273
|
-
vec: Iterable<any> & {
|
|
274
|
-
length: number;
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
inactive_stake: {
|
|
278
|
-
vec: Iterable<any> & {
|
|
279
|
-
length: number;
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
exchange_rate: {
|
|
283
|
-
sui_amount: string | number | bigint;
|
|
284
|
-
pool_token_amount: string | number | bigint;
|
|
285
|
-
};
|
|
286
|
-
total_sui_amount: string | number | bigint;
|
|
287
|
-
extra_fields: {
|
|
288
|
-
id: {
|
|
289
|
-
id: {
|
|
290
|
-
bytes: string;
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
size: string | number | bigint;
|
|
294
|
-
};
|
|
295
|
-
}>;
|
|
216
|
+
static get bcs(): import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
217
|
+
staking_pool_id: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
218
|
+
bytes: import("@mysten/sui-v1/bcs").BcsType<string, string, string>;
|
|
219
|
+
}, string>;
|
|
220
|
+
validator_address: import("@mysten/sui-v1/bcs").BcsType<string, string, string>;
|
|
221
|
+
active_stake: any;
|
|
222
|
+
inactive_stake: any;
|
|
223
|
+
exchange_rate: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
224
|
+
sui_amount: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
225
|
+
pool_token_amount: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
226
|
+
}, string>;
|
|
227
|
+
total_sui_amount: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
228
|
+
extra_fields: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
229
|
+
id: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
230
|
+
id: import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
231
|
+
bytes: import("@mysten/sui-v1/bcs").BcsType<string, string, string>;
|
|
232
|
+
}, string>;
|
|
233
|
+
}, string>;
|
|
234
|
+
size: import("@mysten/sui-v1/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
235
|
+
}, string>;
|
|
236
|
+
}, string>;
|
|
296
237
|
static fromFields(fields: Record<string, any>): ValidatorInfo;
|
|
297
238
|
static fromFieldsWithTypes(item: FieldsWithTypes): ValidatorInfo;
|
|
298
239
|
static fromBcs(data: Uint8Array): ValidatorInfo;
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,33 +7,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
8
|
});
|
|
43
9
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const util_1 = require("../../_framework/util");
|
|
57
|
-
const index_1 = require("../index");
|
|
58
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
59
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
10
|
+
import * as reified from "../../_framework/reified";
|
|
11
|
+
import { Option } from "../../_dependencies/source/0x1/option/structs";
|
|
12
|
+
import { Bag } from "../../_dependencies/source/0x2/bag/structs";
|
|
13
|
+
import { Balance } from "../../_dependencies/source/0x2/balance/structs";
|
|
14
|
+
import { ID } from "../../_dependencies/source/0x2/object/structs";
|
|
15
|
+
import { SUI } from "../../_dependencies/source/0x2/sui/structs";
|
|
16
|
+
import { FungibleStakedSui, PoolTokenExchangeRate, StakedSui, } from "../../_dependencies/source/0x3/staking-pool/structs";
|
|
17
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
18
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
19
|
+
import { PKG_V1 } from "../index";
|
|
20
|
+
import { bcs } from "@mysten/sui-v1/bcs";
|
|
21
|
+
import { fromB64, fromHEX, toHEX } from "@mysten/sui-v1/utils";
|
|
60
22
|
/* ============================== Storage =============================== */
|
|
61
|
-
function isStorage(type) {
|
|
62
|
-
type =
|
|
63
|
-
return type === `${
|
|
23
|
+
export function isStorage(type) {
|
|
24
|
+
type = compressSuiType(type);
|
|
25
|
+
return type === `${PKG_V1}::storage::Storage`;
|
|
64
26
|
}
|
|
65
|
-
class Storage {
|
|
27
|
+
export class Storage {
|
|
66
28
|
constructor(typeArgs, fields) {
|
|
67
29
|
this.__StructClass = true;
|
|
68
30
|
this.$typeName = Storage.$typeName;
|
|
69
31
|
this.$isPhantom = Storage.$isPhantom;
|
|
70
|
-
this.$fullTypeName =
|
|
32
|
+
this.$fullTypeName = composeSuiType(Storage.$typeName, ...typeArgs);
|
|
71
33
|
this.$typeArgs = typeArgs;
|
|
72
34
|
this.suiPool = fields.suiPool;
|
|
73
35
|
this.validatorInfos = fields.validatorInfos;
|
|
@@ -78,7 +40,7 @@ class Storage {
|
|
|
78
40
|
static reified() {
|
|
79
41
|
return {
|
|
80
42
|
typeName: Storage.$typeName,
|
|
81
|
-
fullTypeName:
|
|
43
|
+
fullTypeName: composeSuiType(Storage.$typeName, ...[]),
|
|
82
44
|
typeArgs: [],
|
|
83
45
|
isPhantom: Storage.$isPhantom,
|
|
84
46
|
reifiedTypeArgs: [],
|
|
@@ -101,27 +63,27 @@ class Storage {
|
|
|
101
63
|
return Storage.reified();
|
|
102
64
|
}
|
|
103
65
|
static phantom() {
|
|
104
|
-
return
|
|
66
|
+
return phantom(Storage.reified());
|
|
105
67
|
}
|
|
106
68
|
static get p() {
|
|
107
69
|
return Storage.phantom();
|
|
108
70
|
}
|
|
109
71
|
static get bcs() {
|
|
110
|
-
return
|
|
111
|
-
sui_pool:
|
|
112
|
-
validator_infos:
|
|
113
|
-
total_sui_supply:
|
|
114
|
-
last_refresh_epoch:
|
|
115
|
-
extra_fields:
|
|
72
|
+
return bcs.struct("Storage", {
|
|
73
|
+
sui_pool: Balance.bcs,
|
|
74
|
+
validator_infos: bcs.vector(ValidatorInfo.bcs),
|
|
75
|
+
total_sui_supply: bcs.u64(),
|
|
76
|
+
last_refresh_epoch: bcs.u64(),
|
|
77
|
+
extra_fields: Bag.bcs,
|
|
116
78
|
});
|
|
117
79
|
}
|
|
118
80
|
static fromFields(fields) {
|
|
119
81
|
return Storage.reified().new({
|
|
120
|
-
suiPool:
|
|
121
|
-
validatorInfos:
|
|
122
|
-
totalSuiSupply:
|
|
123
|
-
lastRefreshEpoch:
|
|
124
|
-
extraFields:
|
|
82
|
+
suiPool: decodeFromFields(Balance.reified(reified.phantom(SUI.reified())), fields.sui_pool),
|
|
83
|
+
validatorInfos: decodeFromFields(reified.vector(ValidatorInfo.reified()), fields.validator_infos),
|
|
84
|
+
totalSuiSupply: decodeFromFields("u64", fields.total_sui_supply),
|
|
85
|
+
lastRefreshEpoch: decodeFromFields("u64", fields.last_refresh_epoch),
|
|
86
|
+
extraFields: decodeFromFields(Bag.reified(), fields.extra_fields),
|
|
125
87
|
});
|
|
126
88
|
}
|
|
127
89
|
static fromFieldsWithTypes(item) {
|
|
@@ -129,11 +91,11 @@ class Storage {
|
|
|
129
91
|
throw new Error("not a Storage type");
|
|
130
92
|
}
|
|
131
93
|
return Storage.reified().new({
|
|
132
|
-
suiPool:
|
|
133
|
-
validatorInfos:
|
|
134
|
-
totalSuiSupply:
|
|
135
|
-
lastRefreshEpoch:
|
|
136
|
-
extraFields:
|
|
94
|
+
suiPool: decodeFromFieldsWithTypes(Balance.reified(reified.phantom(SUI.reified())), item.fields.sui_pool),
|
|
95
|
+
validatorInfos: decodeFromFieldsWithTypes(reified.vector(ValidatorInfo.reified()), item.fields.validator_infos),
|
|
96
|
+
totalSuiSupply: decodeFromFieldsWithTypes("u64", item.fields.total_sui_supply),
|
|
97
|
+
lastRefreshEpoch: decodeFromFieldsWithTypes("u64", item.fields.last_refresh_epoch),
|
|
98
|
+
extraFields: decodeFromFieldsWithTypes(Bag.reified(), item.fields.extra_fields),
|
|
137
99
|
});
|
|
138
100
|
}
|
|
139
101
|
static fromBcs(data) {
|
|
@@ -142,7 +104,7 @@ class Storage {
|
|
|
142
104
|
toJSONField() {
|
|
143
105
|
return {
|
|
144
106
|
suiPool: this.suiPool.toJSONField(),
|
|
145
|
-
validatorInfos:
|
|
107
|
+
validatorInfos: fieldToJSON(`vector<${ValidatorInfo.$typeName}>`, this.validatorInfos),
|
|
146
108
|
totalSuiSupply: this.totalSuiSupply.toString(),
|
|
147
109
|
lastRefreshEpoch: this.lastRefreshEpoch.toString(),
|
|
148
110
|
extraFields: this.extraFields.toJSONField(),
|
|
@@ -153,11 +115,11 @@ class Storage {
|
|
|
153
115
|
}
|
|
154
116
|
static fromJSONField(field) {
|
|
155
117
|
return Storage.reified().new({
|
|
156
|
-
suiPool:
|
|
157
|
-
validatorInfos:
|
|
158
|
-
totalSuiSupply:
|
|
159
|
-
lastRefreshEpoch:
|
|
160
|
-
extraFields:
|
|
118
|
+
suiPool: decodeFromJSONField(Balance.reified(reified.phantom(SUI.reified())), field.suiPool),
|
|
119
|
+
validatorInfos: decodeFromJSONField(reified.vector(ValidatorInfo.reified()), field.validatorInfos),
|
|
120
|
+
totalSuiSupply: decodeFromJSONField("u64", field.totalSuiSupply),
|
|
121
|
+
lastRefreshEpoch: decodeFromJSONField("u64", field.lastRefreshEpoch),
|
|
122
|
+
extraFields: decodeFromJSONField(Bag.reified(), field.extraFields),
|
|
161
123
|
});
|
|
162
124
|
}
|
|
163
125
|
static fromJSON(json) {
|
|
@@ -180,7 +142,7 @@ class Storage {
|
|
|
180
142
|
if (data.bcs.dataType !== "moveObject" || !isStorage(data.bcs.type)) {
|
|
181
143
|
throw new Error(`object at is not a Storage object`);
|
|
182
144
|
}
|
|
183
|
-
return Storage.fromBcs(
|
|
145
|
+
return Storage.fromBcs(fromB64(data.bcs.bcsBytes));
|
|
184
146
|
}
|
|
185
147
|
if (data.content) {
|
|
186
148
|
return Storage.fromSuiParsedData(data.content);
|
|
@@ -202,21 +164,20 @@ class Storage {
|
|
|
202
164
|
});
|
|
203
165
|
}
|
|
204
166
|
}
|
|
205
|
-
|
|
206
|
-
Storage.$typeName = `${index_1.PKG_V1}::storage::Storage`;
|
|
167
|
+
Storage.$typeName = `${PKG_V1}::storage::Storage`;
|
|
207
168
|
Storage.$numTypeParams = 0;
|
|
208
169
|
Storage.$isPhantom = [];
|
|
209
170
|
/* ============================== ValidatorInfo =============================== */
|
|
210
|
-
function isValidatorInfo(type) {
|
|
211
|
-
type =
|
|
212
|
-
return type === `${
|
|
171
|
+
export function isValidatorInfo(type) {
|
|
172
|
+
type = compressSuiType(type);
|
|
173
|
+
return type === `${PKG_V1}::storage::ValidatorInfo`;
|
|
213
174
|
}
|
|
214
|
-
class ValidatorInfo {
|
|
175
|
+
export class ValidatorInfo {
|
|
215
176
|
constructor(typeArgs, fields) {
|
|
216
177
|
this.__StructClass = true;
|
|
217
178
|
this.$typeName = ValidatorInfo.$typeName;
|
|
218
179
|
this.$isPhantom = ValidatorInfo.$isPhantom;
|
|
219
|
-
this.$fullTypeName =
|
|
180
|
+
this.$fullTypeName = composeSuiType(ValidatorInfo.$typeName, ...typeArgs);
|
|
220
181
|
this.$typeArgs = typeArgs;
|
|
221
182
|
this.stakingPoolId = fields.stakingPoolId;
|
|
222
183
|
this.validatorAddress = fields.validatorAddress;
|
|
@@ -229,7 +190,7 @@ class ValidatorInfo {
|
|
|
229
190
|
static reified() {
|
|
230
191
|
return {
|
|
231
192
|
typeName: ValidatorInfo.$typeName,
|
|
232
|
-
fullTypeName:
|
|
193
|
+
fullTypeName: composeSuiType(ValidatorInfo.$typeName, ...[]),
|
|
233
194
|
typeArgs: [],
|
|
234
195
|
isPhantom: ValidatorInfo.$isPhantom,
|
|
235
196
|
reifiedTypeArgs: [],
|
|
@@ -252,36 +213,36 @@ class ValidatorInfo {
|
|
|
252
213
|
return ValidatorInfo.reified();
|
|
253
214
|
}
|
|
254
215
|
static phantom() {
|
|
255
|
-
return
|
|
216
|
+
return phantom(ValidatorInfo.reified());
|
|
256
217
|
}
|
|
257
218
|
static get p() {
|
|
258
219
|
return ValidatorInfo.phantom();
|
|
259
220
|
}
|
|
260
221
|
static get bcs() {
|
|
261
|
-
return
|
|
262
|
-
staking_pool_id:
|
|
263
|
-
validator_address:
|
|
222
|
+
return bcs.struct("ValidatorInfo", {
|
|
223
|
+
staking_pool_id: ID.bcs,
|
|
224
|
+
validator_address: bcs
|
|
264
225
|
.bytes(32)
|
|
265
226
|
.transform({
|
|
266
|
-
input: (val) =>
|
|
267
|
-
output: (val) =>
|
|
227
|
+
input: (val) => fromHEX(val),
|
|
228
|
+
output: (val) => toHEX(val),
|
|
268
229
|
}),
|
|
269
|
-
active_stake:
|
|
270
|
-
inactive_stake:
|
|
271
|
-
exchange_rate:
|
|
272
|
-
total_sui_amount:
|
|
273
|
-
extra_fields:
|
|
230
|
+
active_stake: Option.bcs(FungibleStakedSui.bcs),
|
|
231
|
+
inactive_stake: Option.bcs(StakedSui.bcs),
|
|
232
|
+
exchange_rate: PoolTokenExchangeRate.bcs,
|
|
233
|
+
total_sui_amount: bcs.u64(),
|
|
234
|
+
extra_fields: Bag.bcs,
|
|
274
235
|
});
|
|
275
236
|
}
|
|
276
237
|
static fromFields(fields) {
|
|
277
238
|
return ValidatorInfo.reified().new({
|
|
278
|
-
stakingPoolId:
|
|
279
|
-
validatorAddress:
|
|
280
|
-
activeStake:
|
|
281
|
-
inactiveStake:
|
|
282
|
-
exchangeRate:
|
|
283
|
-
totalSuiAmount:
|
|
284
|
-
extraFields:
|
|
239
|
+
stakingPoolId: decodeFromFields(ID.reified(), fields.staking_pool_id),
|
|
240
|
+
validatorAddress: decodeFromFields("address", fields.validator_address),
|
|
241
|
+
activeStake: decodeFromFields(Option.reified(FungibleStakedSui.reified()), fields.active_stake),
|
|
242
|
+
inactiveStake: decodeFromFields(Option.reified(StakedSui.reified()), fields.inactive_stake),
|
|
243
|
+
exchangeRate: decodeFromFields(PoolTokenExchangeRate.reified(), fields.exchange_rate),
|
|
244
|
+
totalSuiAmount: decodeFromFields("u64", fields.total_sui_amount),
|
|
245
|
+
extraFields: decodeFromFields(Bag.reified(), fields.extra_fields),
|
|
285
246
|
});
|
|
286
247
|
}
|
|
287
248
|
static fromFieldsWithTypes(item) {
|
|
@@ -289,13 +250,13 @@ class ValidatorInfo {
|
|
|
289
250
|
throw new Error("not a ValidatorInfo type");
|
|
290
251
|
}
|
|
291
252
|
return ValidatorInfo.reified().new({
|
|
292
|
-
stakingPoolId:
|
|
293
|
-
validatorAddress:
|
|
294
|
-
activeStake:
|
|
295
|
-
inactiveStake:
|
|
296
|
-
exchangeRate:
|
|
297
|
-
totalSuiAmount:
|
|
298
|
-
extraFields:
|
|
253
|
+
stakingPoolId: decodeFromFieldsWithTypes(ID.reified(), item.fields.staking_pool_id),
|
|
254
|
+
validatorAddress: decodeFromFieldsWithTypes("address", item.fields.validator_address),
|
|
255
|
+
activeStake: decodeFromFieldsWithTypes(Option.reified(FungibleStakedSui.reified()), item.fields.active_stake),
|
|
256
|
+
inactiveStake: decodeFromFieldsWithTypes(Option.reified(StakedSui.reified()), item.fields.inactive_stake),
|
|
257
|
+
exchangeRate: decodeFromFieldsWithTypes(PoolTokenExchangeRate.reified(), item.fields.exchange_rate),
|
|
258
|
+
totalSuiAmount: decodeFromFieldsWithTypes("u64", item.fields.total_sui_amount),
|
|
259
|
+
extraFields: decodeFromFieldsWithTypes(Bag.reified(), item.fields.extra_fields),
|
|
299
260
|
});
|
|
300
261
|
}
|
|
301
262
|
static fromBcs(data) {
|
|
@@ -305,8 +266,8 @@ class ValidatorInfo {
|
|
|
305
266
|
return {
|
|
306
267
|
stakingPoolId: this.stakingPoolId,
|
|
307
268
|
validatorAddress: this.validatorAddress,
|
|
308
|
-
activeStake:
|
|
309
|
-
inactiveStake:
|
|
269
|
+
activeStake: fieldToJSON(`${Option.$typeName}<${FungibleStakedSui.$typeName}>`, this.activeStake),
|
|
270
|
+
inactiveStake: fieldToJSON(`${Option.$typeName}<${StakedSui.$typeName}>`, this.inactiveStake),
|
|
310
271
|
exchangeRate: this.exchangeRate.toJSONField(),
|
|
311
272
|
totalSuiAmount: this.totalSuiAmount.toString(),
|
|
312
273
|
extraFields: this.extraFields.toJSONField(),
|
|
@@ -317,13 +278,13 @@ class ValidatorInfo {
|
|
|
317
278
|
}
|
|
318
279
|
static fromJSONField(field) {
|
|
319
280
|
return ValidatorInfo.reified().new({
|
|
320
|
-
stakingPoolId:
|
|
321
|
-
validatorAddress:
|
|
322
|
-
activeStake:
|
|
323
|
-
inactiveStake:
|
|
324
|
-
exchangeRate:
|
|
325
|
-
totalSuiAmount:
|
|
326
|
-
extraFields:
|
|
281
|
+
stakingPoolId: decodeFromJSONField(ID.reified(), field.stakingPoolId),
|
|
282
|
+
validatorAddress: decodeFromJSONField("address", field.validatorAddress),
|
|
283
|
+
activeStake: decodeFromJSONField(Option.reified(FungibleStakedSui.reified()), field.activeStake),
|
|
284
|
+
inactiveStake: decodeFromJSONField(Option.reified(StakedSui.reified()), field.inactiveStake),
|
|
285
|
+
exchangeRate: decodeFromJSONField(PoolTokenExchangeRate.reified(), field.exchangeRate),
|
|
286
|
+
totalSuiAmount: decodeFromJSONField("u64", field.totalSuiAmount),
|
|
287
|
+
extraFields: decodeFromJSONField(Bag.reified(), field.extraFields),
|
|
327
288
|
});
|
|
328
289
|
}
|
|
329
290
|
static fromJSON(json) {
|
|
@@ -347,7 +308,7 @@ class ValidatorInfo {
|
|
|
347
308
|
!isValidatorInfo(data.bcs.type)) {
|
|
348
309
|
throw new Error(`object at is not a ValidatorInfo object`);
|
|
349
310
|
}
|
|
350
|
-
return ValidatorInfo.fromBcs(
|
|
311
|
+
return ValidatorInfo.fromBcs(fromB64(data.bcs.bcsBytes));
|
|
351
312
|
}
|
|
352
313
|
if (data.content) {
|
|
353
314
|
return ValidatorInfo.fromSuiParsedData(data.content);
|
|
@@ -369,7 +330,6 @@ class ValidatorInfo {
|
|
|
369
330
|
});
|
|
370
331
|
}
|
|
371
332
|
}
|
|
372
|
-
|
|
373
|
-
ValidatorInfo.$typeName = `${index_1.PKG_V1}::storage::ValidatorInfo`;
|
|
333
|
+
ValidatorInfo.$typeName = `${PKG_V1}::storage::ValidatorInfo`;
|
|
374
334
|
ValidatorInfo.$numTypeParams = 0;
|
|
375
335
|
ValidatorInfo.$isPhantom = [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../_framework/reified";
|
|
2
2
|
import { FieldsWithTypes } from "../../_framework/util";
|
|
3
3
|
import { PKG_V1 } from "../index";
|
|
4
|
-
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
4
|
+
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui-v1/client";
|
|
5
5
|
export declare function isVersion(type: string): boolean;
|
|
6
6
|
export interface VersionFields {
|
|
7
7
|
pos0: ToField<"u16">;
|
|
@@ -22,11 +22,9 @@ export declare class Version implements StructClass {
|
|
|
22
22
|
static get r(): import("../../_framework/reified").StructClassReified<Version, VersionFields>;
|
|
23
23
|
static phantom(): PhantomReified<ToTypeStr<Version>>;
|
|
24
24
|
static get p(): PhantomReified<"0xb0575765166030556a6eafd3b1b970eba8183ff748860680245b9edd41c716e7::version::Version">;
|
|
25
|
-
static get bcs(): import("@mysten/sui/bcs").
|
|
26
|
-
pos0: number
|
|
27
|
-
},
|
|
28
|
-
pos0: number;
|
|
29
|
-
}>;
|
|
25
|
+
static get bcs(): import("@mysten/sui-v1/bcs").BcsStruct<{
|
|
26
|
+
pos0: import("@mysten/sui-v1/bcs").BcsType<number, number, "u16">;
|
|
27
|
+
}, string>;
|
|
30
28
|
static fromFields(fields: Record<string, any>): Version;
|
|
31
29
|
static fromFieldsWithTypes(item: FieldsWithTypes): Version;
|
|
32
30
|
static fromBcs(data: Uint8Array): Version;
|