@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
|
@@ -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 {
|
|
12
|
+
import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
|
|
13
13
|
export declare function isStorage(type: string): boolean;
|
|
14
14
|
export interface StorageFields {
|
|
15
15
|
suiPool: ToField<Balance<ToPhantom<SUI>>>;
|
|
@@ -38,11 +38,11 @@ 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/
|
|
42
|
-
sui_pool: import("@mysten/
|
|
43
|
-
value: import("@mysten/
|
|
41
|
+
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
42
|
+
sui_pool: import("@mysten/bcs").BcsStruct<{
|
|
43
|
+
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
44
44
|
}, string>;
|
|
45
|
-
validator_infos: import("@mysten/
|
|
45
|
+
validator_infos: import("@mysten/bcs").BcsType<{
|
|
46
46
|
staking_pool_id: {
|
|
47
47
|
bytes: string;
|
|
48
48
|
};
|
|
@@ -143,15 +143,15 @@ export declare class Storage implements StructClass {
|
|
|
143
143
|
}> & {
|
|
144
144
|
length: number;
|
|
145
145
|
}, string>;
|
|
146
|
-
total_sui_supply: import("@mysten/
|
|
147
|
-
last_refresh_epoch: import("@mysten/
|
|
148
|
-
extra_fields: import("@mysten/
|
|
149
|
-
id: import("@mysten/
|
|
150
|
-
id: import("@mysten/
|
|
151
|
-
bytes: import("@mysten/
|
|
146
|
+
total_sui_supply: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
147
|
+
last_refresh_epoch: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
148
|
+
extra_fields: import("@mysten/bcs").BcsStruct<{
|
|
149
|
+
id: import("@mysten/bcs").BcsStruct<{
|
|
150
|
+
id: import("@mysten/bcs").BcsStruct<{
|
|
151
|
+
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
152
152
|
}, string>;
|
|
153
153
|
}, string>;
|
|
154
|
-
size: import("@mysten/
|
|
154
|
+
size: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
155
155
|
}, string>;
|
|
156
156
|
}, string>;
|
|
157
157
|
static fromFields(fields: Record<string, any>): Storage;
|
|
@@ -237,7 +237,7 @@ export declare class Storage implements StructClass {
|
|
|
237
237
|
static fromJSON(json: Record<string, any>): Storage;
|
|
238
238
|
static fromSuiParsedData(content: SuiParsedData): Storage;
|
|
239
239
|
static fromSuiObjectData(data: SuiObjectData): Storage;
|
|
240
|
-
static fetch(client:
|
|
240
|
+
static fetch(client: SuiJsonRpcClient, id: string): Promise<Storage>;
|
|
241
241
|
}
|
|
242
242
|
export declare function isValidatorInfo(type: string): boolean;
|
|
243
243
|
export interface ValidatorInfoFields {
|
|
@@ -271,13 +271,13 @@ export declare class ValidatorInfo implements StructClass {
|
|
|
271
271
|
static get r(): reified.StructClassReified<ValidatorInfo, ValidatorInfoFields>;
|
|
272
272
|
static phantom(): PhantomReified<ToTypeStr<ValidatorInfo>>;
|
|
273
273
|
static get p(): reified.PhantomReified<"0xb0575765166030556a6eafd3b1b970eba8183ff748860680245b9edd41c716e7::storage::ValidatorInfo">;
|
|
274
|
-
static get bcs(): import("@mysten/
|
|
275
|
-
staking_pool_id: import("@mysten/
|
|
276
|
-
bytes: import("@mysten/
|
|
274
|
+
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
275
|
+
staking_pool_id: import("@mysten/bcs").BcsStruct<{
|
|
276
|
+
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
277
277
|
}, string>;
|
|
278
|
-
validator_address: import("@mysten/
|
|
279
|
-
active_stake: import("@mysten/
|
|
280
|
-
vec: import("@mysten/
|
|
278
|
+
validator_address: import("@mysten/bcs").BcsType<string, string, string>;
|
|
279
|
+
active_stake: import("@mysten/bcs").BcsStruct<{
|
|
280
|
+
vec: import("@mysten/bcs").BcsType<{
|
|
281
281
|
id: {
|
|
282
282
|
id: {
|
|
283
283
|
bytes: string;
|
|
@@ -301,8 +301,8 @@ export declare class ValidatorInfo implements StructClass {
|
|
|
301
301
|
length: number;
|
|
302
302
|
}, string>;
|
|
303
303
|
}, string>;
|
|
304
|
-
inactive_stake: import("@mysten/
|
|
305
|
-
vec: import("@mysten/
|
|
304
|
+
inactive_stake: import("@mysten/bcs").BcsStruct<{
|
|
305
|
+
vec: import("@mysten/bcs").BcsType<{
|
|
306
306
|
id: {
|
|
307
307
|
id: {
|
|
308
308
|
bytes: string;
|
|
@@ -332,18 +332,18 @@ export declare class ValidatorInfo implements StructClass {
|
|
|
332
332
|
length: number;
|
|
333
333
|
}, string>;
|
|
334
334
|
}, string>;
|
|
335
|
-
exchange_rate: import("@mysten/
|
|
336
|
-
sui_amount: import("@mysten/
|
|
337
|
-
pool_token_amount: import("@mysten/
|
|
335
|
+
exchange_rate: import("@mysten/bcs").BcsStruct<{
|
|
336
|
+
sui_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
337
|
+
pool_token_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
338
338
|
}, string>;
|
|
339
|
-
total_sui_amount: import("@mysten/
|
|
340
|
-
extra_fields: import("@mysten/
|
|
341
|
-
id: import("@mysten/
|
|
342
|
-
id: import("@mysten/
|
|
343
|
-
bytes: import("@mysten/
|
|
339
|
+
total_sui_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
340
|
+
extra_fields: import("@mysten/bcs").BcsStruct<{
|
|
341
|
+
id: import("@mysten/bcs").BcsStruct<{
|
|
342
|
+
id: import("@mysten/bcs").BcsStruct<{
|
|
343
|
+
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
344
344
|
}, string>;
|
|
345
345
|
}, string>;
|
|
346
|
-
size: import("@mysten/
|
|
346
|
+
size: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
347
347
|
}, string>;
|
|
348
348
|
}, string>;
|
|
349
349
|
static fromFields(fields: Record<string, any>): ValidatorInfo;
|
|
@@ -407,5 +407,5 @@ export declare class ValidatorInfo implements StructClass {
|
|
|
407
407
|
static fromJSON(json: Record<string, any>): ValidatorInfo;
|
|
408
408
|
static fromSuiParsedData(content: SuiParsedData): ValidatorInfo;
|
|
409
409
|
static fromSuiObjectData(data: SuiObjectData): ValidatorInfo;
|
|
410
|
-
static fetch(client:
|
|
410
|
+
static fetch(client: SuiJsonRpcClient, id: string): Promise<ValidatorInfo>;
|
|
411
411
|
}
|
|
@@ -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/bcs";
|
|
21
|
+
import { fromBase64, fromHex, toHex } from "@mysten/sui/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(fromBase64(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(fromBase64(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 {
|
|
4
|
+
import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
|
|
5
5
|
export declare function isVersion(type: string): boolean;
|
|
6
6
|
export interface VersionFields {
|
|
7
7
|
pos0: ToField<"u16">;
|
|
@@ -22,8 +22,8 @@ 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/
|
|
26
|
-
pos0: import("@mysten/
|
|
25
|
+
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
26
|
+
pos0: import("@mysten/bcs").BcsType<number, number, "u16">;
|
|
27
27
|
}, string>;
|
|
28
28
|
static fromFields(fields: Record<string, any>): Version;
|
|
29
29
|
static fromFieldsWithTypes(item: FieldsWithTypes): Version;
|
|
@@ -40,5 +40,5 @@ export declare class Version implements StructClass {
|
|
|
40
40
|
static fromJSON(json: Record<string, any>): Version;
|
|
41
41
|
static fromSuiParsedData(content: SuiParsedData): Version;
|
|
42
42
|
static fromSuiObjectData(data: SuiObjectData): Version;
|
|
43
|
-
static fetch(client:
|
|
43
|
+
static fetch(client: SuiJsonRpcClient, id: string): Promise<Version>;
|
|
44
44
|
}
|
|
@@ -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,32 +7,29 @@ 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
|
-
const index_1 = require("../index");
|
|
17
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
18
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../_framework/reified";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
12
|
+
import { PKG_V1 } from "../index";
|
|
13
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
14
|
+
import { fromBase64 } from "@mysten/sui/utils";
|
|
19
15
|
/* ============================== Version =============================== */
|
|
20
|
-
function isVersion(type) {
|
|
21
|
-
type =
|
|
22
|
-
return type === `${
|
|
16
|
+
export function isVersion(type) {
|
|
17
|
+
type = compressSuiType(type);
|
|
18
|
+
return type === `${PKG_V1}::version::Version`;
|
|
23
19
|
}
|
|
24
|
-
class Version {
|
|
20
|
+
export class Version {
|
|
25
21
|
constructor(typeArgs, fields) {
|
|
26
22
|
this.__StructClass = true;
|
|
27
23
|
this.$typeName = Version.$typeName;
|
|
28
24
|
this.$isPhantom = Version.$isPhantom;
|
|
29
|
-
this.$fullTypeName =
|
|
25
|
+
this.$fullTypeName = composeSuiType(Version.$typeName, ...typeArgs);
|
|
30
26
|
this.$typeArgs = typeArgs;
|
|
31
27
|
this.pos0 = fields.pos0;
|
|
32
28
|
}
|
|
33
29
|
static reified() {
|
|
34
30
|
return {
|
|
35
31
|
typeName: Version.$typeName,
|
|
36
|
-
fullTypeName:
|
|
32
|
+
fullTypeName: composeSuiType(Version.$typeName, ...[]),
|
|
37
33
|
typeArgs: [],
|
|
38
34
|
isPhantom: Version.$isPhantom,
|
|
39
35
|
reifiedTypeArgs: [],
|
|
@@ -56,19 +52,19 @@ class Version {
|
|
|
56
52
|
return Version.reified();
|
|
57
53
|
}
|
|
58
54
|
static phantom() {
|
|
59
|
-
return
|
|
55
|
+
return phantom(Version.reified());
|
|
60
56
|
}
|
|
61
57
|
static get p() {
|
|
62
58
|
return Version.phantom();
|
|
63
59
|
}
|
|
64
60
|
static get bcs() {
|
|
65
|
-
return
|
|
66
|
-
pos0:
|
|
61
|
+
return bcs.struct("Version", {
|
|
62
|
+
pos0: bcs.u16(),
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
65
|
static fromFields(fields) {
|
|
70
66
|
return Version.reified().new({
|
|
71
|
-
pos0:
|
|
67
|
+
pos0: decodeFromFields("u16", fields.pos0),
|
|
72
68
|
});
|
|
73
69
|
}
|
|
74
70
|
static fromFieldsWithTypes(item) {
|
|
@@ -76,7 +72,7 @@ class Version {
|
|
|
76
72
|
throw new Error("not a Version type");
|
|
77
73
|
}
|
|
78
74
|
return Version.reified().new({
|
|
79
|
-
pos0:
|
|
75
|
+
pos0: decodeFromFieldsWithTypes("u16", item.fields.pos0),
|
|
80
76
|
});
|
|
81
77
|
}
|
|
82
78
|
static fromBcs(data) {
|
|
@@ -92,7 +88,7 @@ class Version {
|
|
|
92
88
|
}
|
|
93
89
|
static fromJSONField(field) {
|
|
94
90
|
return Version.reified().new({
|
|
95
|
-
pos0:
|
|
91
|
+
pos0: decodeFromJSONField("u16", field.pos0),
|
|
96
92
|
});
|
|
97
93
|
}
|
|
98
94
|
static fromJSON(json) {
|
|
@@ -115,7 +111,7 @@ class Version {
|
|
|
115
111
|
if (data.bcs.dataType !== "moveObject" || !isVersion(data.bcs.type)) {
|
|
116
112
|
throw new Error(`object at is not a Version object`);
|
|
117
113
|
}
|
|
118
|
-
return Version.fromBcs((
|
|
114
|
+
return Version.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
119
115
|
}
|
|
120
116
|
if (data.content) {
|
|
121
117
|
return Version.fromSuiParsedData(data.content);
|
|
@@ -137,7 +133,6 @@ class Version {
|
|
|
137
133
|
});
|
|
138
134
|
}
|
|
139
135
|
}
|
|
140
|
-
|
|
141
|
-
Version.$typeName = `${index_1.PKG_V1}::version::Version`;
|
|
136
|
+
Version.$typeName = `${PKG_V1}::version::Version`;
|
|
142
137
|
Version.$numTypeParams = 0;
|
|
143
138
|
Version.$isPhantom = [];
|