@suilend/springsui-cli 1.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.
Files changed (63) hide show
  1. package/cli/src/index.d.ts +1 -0
  2. package/cli/src/index.js +304 -0
  3. package/package.json +1 -0
  4. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +92 -0
  5. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js +289 -0
  6. package/sdk/src/_generated/_dependencies/source/0x1/index.d.ts +3 -0
  7. package/sdk/src/_generated/_dependencies/source/0x1/index.js +6 -0
  8. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.d.ts +52 -0
  9. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +180 -0
  10. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +50 -0
  11. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +167 -0
  12. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +53 -0
  13. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +144 -0
  14. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +61 -0
  15. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +149 -0
  16. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +88 -0
  17. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +291 -0
  18. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +460 -0
  19. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.js +1045 -0
  20. package/sdk/src/_generated/_dependencies/source/0x2/index.d.ts +3 -0
  21. package/sdk/src/_generated/_dependencies/source/0x2/index.js +6 -0
  22. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.d.ts +92 -0
  23. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +270 -0
  24. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +46 -0
  25. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +142 -0
  26. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +61 -0
  27. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +163 -0
  28. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +53 -0
  29. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +143 -0
  30. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +111 -0
  31. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js +325 -0
  32. package/sdk/src/_generated/_dependencies/source/0x3/index.d.ts +3 -0
  33. package/sdk/src/_generated/_dependencies/source/0x3/index.js +6 -0
  34. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.d.ts +487 -0
  35. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js +915 -0
  36. package/sdk/src/_generated/_framework/reified.d.ts +108 -0
  37. package/sdk/src/_generated/_framework/reified.js +240 -0
  38. package/sdk/src/_generated/_framework/util.d.ts +35 -0
  39. package/sdk/src/_generated/_framework/util.js +334 -0
  40. package/sdk/src/_generated/_framework/vector.d.ts +35 -0
  41. package/sdk/src/_generated/_framework/vector.js +77 -0
  42. package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +54 -0
  43. package/sdk/src/_generated/liquid_staking/cell/structs.js +156 -0
  44. package/sdk/src/_generated/liquid_staking/fees/functions.d.ts +51 -0
  45. package/sdk/src/_generated/liquid_staking/fees/functions.js +130 -0
  46. package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +165 -0
  47. package/sdk/src/_generated/liquid_staking/fees/structs.js +307 -0
  48. package/sdk/src/_generated/liquid_staking/index.d.ts +4 -0
  49. package/sdk/src/_generated/liquid_staking/index.js +10 -0
  50. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.d.ts +88 -0
  51. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +199 -0
  52. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +955 -0
  53. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +1477 -0
  54. package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +358 -0
  55. package/sdk/src/_generated/liquid_staking/storage/structs.js +365 -0
  56. package/sdk/src/_generated/liquid_staking/version/structs.d.ts +46 -0
  57. package/sdk/src/_generated/liquid_staking/version/structs.js +143 -0
  58. package/sdk/src/_generated/liquid_staking/weight/functions.d.ts +19 -0
  59. package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -0
  60. package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +205 -0
  61. package/sdk/src/_generated/liquid_staking/weight/structs.js +332 -0
  62. package/sdk/src/index.d.ts +44 -0
  63. package/sdk/src/index.js +234 -0
@@ -0,0 +1,205 @@
1
+ import { Bag } from "../../_dependencies/source/0x2/bag/structs";
2
+ import { UID } from "../../_dependencies/source/0x2/object/structs";
3
+ import { VecMap } from "../../_dependencies/source/0x2/vec-map/structs";
4
+ import { PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeStr } from "../../_framework/reified";
5
+ import { FieldsWithTypes } from "../../_framework/util";
6
+ import { PKG_V1 } from "../index";
7
+ import { AdminCap } from "../liquid-staking/structs";
8
+ import { Version } from "../version/structs";
9
+ import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
10
+ export declare function isWeightHook(type: string): boolean;
11
+ export interface WeightHookFields<P extends PhantomTypeArgument> {
12
+ id: ToField<UID>;
13
+ validatorAddressesAndWeights: ToField<VecMap<"address", "u64">>;
14
+ totalWeight: ToField<"u64">;
15
+ adminCap: ToField<AdminCap<P>>;
16
+ version: ToField<Version>;
17
+ extraFields: ToField<Bag>;
18
+ }
19
+ export type WeightHookReified<P extends PhantomTypeArgument> = Reified<WeightHook<P>, WeightHookFields<P>>;
20
+ export declare class WeightHook<P extends PhantomTypeArgument> implements StructClass {
21
+ __StructClass: true;
22
+ static readonly $typeName = "0xcfbcad8e0444ca85ad7ee28054585d12a7487bdbd83569ded988ca13441bf16e::weight::WeightHook";
23
+ static readonly $numTypeParams = 1;
24
+ static readonly $isPhantom: readonly [true];
25
+ readonly $typeName = "0xcfbcad8e0444ca85ad7ee28054585d12a7487bdbd83569ded988ca13441bf16e::weight::WeightHook";
26
+ readonly $fullTypeName: `${typeof PKG_V1}::weight::WeightHook<${PhantomToTypeStr<P>}>`;
27
+ readonly $typeArgs: [PhantomToTypeStr<P>];
28
+ readonly $isPhantom: readonly [true];
29
+ readonly id: ToField<UID>;
30
+ readonly validatorAddressesAndWeights: ToField<VecMap<"address", "u64">>;
31
+ readonly totalWeight: ToField<"u64">;
32
+ readonly adminCap: ToField<AdminCap<P>>;
33
+ readonly version: ToField<Version>;
34
+ readonly extraFields: ToField<Bag>;
35
+ private constructor();
36
+ static reified<P extends PhantomReified<PhantomTypeArgument>>(P: P): WeightHookReified<ToPhantomTypeArgument<P>>;
37
+ static get r(): typeof WeightHook.reified;
38
+ static phantom<P extends PhantomReified<PhantomTypeArgument>>(P: P): PhantomReified<ToTypeStr<WeightHook<ToPhantomTypeArgument<P>>>>;
39
+ static get p(): typeof WeightHook.phantom;
40
+ static get bcs(): import("@mysten/sui/bcs").BcsType<{
41
+ id: {
42
+ id: {
43
+ bytes: string;
44
+ };
45
+ };
46
+ validator_addresses_and_weights: {
47
+ contents: {
48
+ key: string;
49
+ value: string;
50
+ }[];
51
+ };
52
+ total_weight: string;
53
+ admin_cap: {
54
+ id: {
55
+ id: {
56
+ bytes: string;
57
+ };
58
+ };
59
+ };
60
+ version: {
61
+ pos0: number;
62
+ };
63
+ extra_fields: {
64
+ id: {
65
+ id: {
66
+ bytes: string;
67
+ };
68
+ };
69
+ size: string;
70
+ };
71
+ }, {
72
+ id: {
73
+ id: {
74
+ bytes: string;
75
+ };
76
+ };
77
+ validator_addresses_and_weights: {
78
+ contents: Iterable<{
79
+ key: string;
80
+ value: string | number | bigint;
81
+ }> & {
82
+ length: number;
83
+ };
84
+ };
85
+ total_weight: string | number | bigint;
86
+ admin_cap: {
87
+ id: {
88
+ id: {
89
+ bytes: string;
90
+ };
91
+ };
92
+ };
93
+ version: {
94
+ pos0: number;
95
+ };
96
+ extra_fields: {
97
+ id: {
98
+ id: {
99
+ bytes: string;
100
+ };
101
+ };
102
+ size: string | number | bigint;
103
+ };
104
+ }>;
105
+ static fromFields<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, fields: Record<string, any>): WeightHook<ToPhantomTypeArgument<P>>;
106
+ static fromFieldsWithTypes<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, item: FieldsWithTypes): WeightHook<ToPhantomTypeArgument<P>>;
107
+ static fromBcs<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, data: Uint8Array): WeightHook<ToPhantomTypeArgument<P>>;
108
+ toJSONField(): {
109
+ id: string;
110
+ validatorAddressesAndWeights: {
111
+ contents: {
112
+ key: string;
113
+ value: string;
114
+ }[];
115
+ };
116
+ totalWeight: string;
117
+ adminCap: {
118
+ id: string;
119
+ };
120
+ version: {
121
+ pos0: number;
122
+ };
123
+ extraFields: {
124
+ id: string;
125
+ size: string;
126
+ };
127
+ };
128
+ toJSON(): {
129
+ id: string;
130
+ validatorAddressesAndWeights: {
131
+ contents: {
132
+ key: string;
133
+ value: string;
134
+ }[];
135
+ };
136
+ totalWeight: string;
137
+ adminCap: {
138
+ id: string;
139
+ };
140
+ version: {
141
+ pos0: number;
142
+ };
143
+ extraFields: {
144
+ id: string;
145
+ size: string;
146
+ };
147
+ $typeName: string;
148
+ $typeArgs: [PhantomToTypeStr<P>];
149
+ };
150
+ static fromJSONField<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, field: any): WeightHook<ToPhantomTypeArgument<P>>;
151
+ static fromJSON<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, json: Record<string, any>): WeightHook<ToPhantomTypeArgument<P>>;
152
+ static fromSuiParsedData<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, content: SuiParsedData): WeightHook<ToPhantomTypeArgument<P>>;
153
+ static fromSuiObjectData<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, data: SuiObjectData): WeightHook<ToPhantomTypeArgument<P>>;
154
+ static fetch<P extends PhantomReified<PhantomTypeArgument>>(client: SuiClient, typeArg: P, id: string): Promise<WeightHook<ToPhantomTypeArgument<P>>>;
155
+ }
156
+ export declare function isWeightHookAdminCap(type: string): boolean;
157
+ export interface WeightHookAdminCapFields<P extends PhantomTypeArgument> {
158
+ id: ToField<UID>;
159
+ }
160
+ export type WeightHookAdminCapReified<P extends PhantomTypeArgument> = Reified<WeightHookAdminCap<P>, WeightHookAdminCapFields<P>>;
161
+ export declare class WeightHookAdminCap<P extends PhantomTypeArgument> implements StructClass {
162
+ __StructClass: true;
163
+ static readonly $typeName = "0xcfbcad8e0444ca85ad7ee28054585d12a7487bdbd83569ded988ca13441bf16e::weight::WeightHookAdminCap";
164
+ static readonly $numTypeParams = 1;
165
+ static readonly $isPhantom: readonly [true];
166
+ readonly $typeName = "0xcfbcad8e0444ca85ad7ee28054585d12a7487bdbd83569ded988ca13441bf16e::weight::WeightHookAdminCap";
167
+ readonly $fullTypeName: `${typeof PKG_V1}::weight::WeightHookAdminCap<${PhantomToTypeStr<P>}>`;
168
+ readonly $typeArgs: [PhantomToTypeStr<P>];
169
+ readonly $isPhantom: readonly [true];
170
+ readonly id: ToField<UID>;
171
+ private constructor();
172
+ static reified<P extends PhantomReified<PhantomTypeArgument>>(P: P): WeightHookAdminCapReified<ToPhantomTypeArgument<P>>;
173
+ static get r(): typeof WeightHookAdminCap.reified;
174
+ static phantom<P extends PhantomReified<PhantomTypeArgument>>(P: P): PhantomReified<ToTypeStr<WeightHookAdminCap<ToPhantomTypeArgument<P>>>>;
175
+ static get p(): typeof WeightHookAdminCap.phantom;
176
+ static get bcs(): import("@mysten/sui/bcs").BcsType<{
177
+ id: {
178
+ id: {
179
+ bytes: string;
180
+ };
181
+ };
182
+ }, {
183
+ id: {
184
+ id: {
185
+ bytes: string;
186
+ };
187
+ };
188
+ }>;
189
+ static fromFields<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, fields: Record<string, any>): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
190
+ static fromFieldsWithTypes<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, item: FieldsWithTypes): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
191
+ static fromBcs<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, data: Uint8Array): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
192
+ toJSONField(): {
193
+ id: string;
194
+ };
195
+ toJSON(): {
196
+ id: string;
197
+ $typeName: string;
198
+ $typeArgs: [PhantomToTypeStr<P>];
199
+ };
200
+ static fromJSONField<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, field: any): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
201
+ static fromJSON<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, json: Record<string, any>): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
202
+ static fromSuiParsedData<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, content: SuiParsedData): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
203
+ static fromSuiObjectData<P extends PhantomReified<PhantomTypeArgument>>(typeArg: P, data: SuiObjectData): WeightHookAdminCap<ToPhantomTypeArgument<P>>;
204
+ static fetch<P extends PhantomReified<PhantomTypeArgument>>(client: SuiClient, typeArg: P, id: string): Promise<WeightHookAdminCap<ToPhantomTypeArgument<P>>>;
205
+ }
@@ -0,0 +1,332 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WeightHookAdminCap = exports.WeightHook = void 0;
13
+ exports.isWeightHook = isWeightHook;
14
+ exports.isWeightHookAdminCap = isWeightHookAdminCap;
15
+ const structs_1 = require("../../_dependencies/source/0x2/bag/structs");
16
+ const structs_2 = require("../../_dependencies/source/0x2/object/structs");
17
+ const structs_3 = require("../../_dependencies/source/0x2/vec-map/structs");
18
+ const reified_1 = require("../../_framework/reified");
19
+ const util_1 = require("../../_framework/util");
20
+ const index_1 = require("../index");
21
+ const structs_4 = require("../liquid-staking/structs");
22
+ const structs_5 = require("../version/structs");
23
+ const bcs_1 = require("@mysten/sui/bcs");
24
+ const utils_1 = require("@mysten/sui/utils");
25
+ /* ============================== WeightHook =============================== */
26
+ function isWeightHook(type) {
27
+ type = (0, util_1.compressSuiType)(type);
28
+ return type.startsWith(`${index_1.PKG_V1}::weight::WeightHook` + "<");
29
+ }
30
+ class WeightHook {
31
+ constructor(typeArgs, fields) {
32
+ this.__StructClass = true;
33
+ this.$typeName = WeightHook.$typeName;
34
+ this.$isPhantom = WeightHook.$isPhantom;
35
+ this.$fullTypeName = (0, util_1.composeSuiType)(WeightHook.$typeName, ...typeArgs);
36
+ this.$typeArgs = typeArgs;
37
+ this.id = fields.id;
38
+ this.validatorAddressesAndWeights = fields.validatorAddressesAndWeights;
39
+ this.totalWeight = fields.totalWeight;
40
+ this.adminCap = fields.adminCap;
41
+ this.version = fields.version;
42
+ this.extraFields = fields.extraFields;
43
+ }
44
+ static reified(P) {
45
+ return {
46
+ typeName: WeightHook.$typeName,
47
+ fullTypeName: (0, util_1.composeSuiType)(WeightHook.$typeName, ...[(0, reified_1.extractType)(P)]),
48
+ typeArgs: [(0, reified_1.extractType)(P)],
49
+ isPhantom: WeightHook.$isPhantom,
50
+ reifiedTypeArgs: [P],
51
+ fromFields: (fields) => WeightHook.fromFields(P, fields),
52
+ fromFieldsWithTypes: (item) => WeightHook.fromFieldsWithTypes(P, item),
53
+ fromBcs: (data) => WeightHook.fromBcs(P, data),
54
+ bcs: WeightHook.bcs,
55
+ fromJSONField: (field) => WeightHook.fromJSONField(P, field),
56
+ fromJSON: (json) => WeightHook.fromJSON(P, json),
57
+ fromSuiParsedData: (content) => WeightHook.fromSuiParsedData(P, content),
58
+ fromSuiObjectData: (content) => WeightHook.fromSuiObjectData(P, content),
59
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return WeightHook.fetch(client, P, id); }),
60
+ new: (fields) => {
61
+ return new WeightHook([(0, reified_1.extractType)(P)], fields);
62
+ },
63
+ kind: "StructClassReified",
64
+ };
65
+ }
66
+ static get r() {
67
+ return WeightHook.reified;
68
+ }
69
+ static phantom(P) {
70
+ return (0, reified_1.phantom)(WeightHook.reified(P));
71
+ }
72
+ static get p() {
73
+ return WeightHook.phantom;
74
+ }
75
+ static get bcs() {
76
+ return bcs_1.bcs.struct("WeightHook", {
77
+ id: structs_2.UID.bcs,
78
+ validator_addresses_and_weights: structs_3.VecMap.bcs(bcs_1.bcs
79
+ .bytes(32)
80
+ .transform({
81
+ input: (val) => (0, utils_1.fromHEX)(val),
82
+ output: (val) => (0, utils_1.toHEX)(val),
83
+ }), bcs_1.bcs.u64()),
84
+ total_weight: bcs_1.bcs.u64(),
85
+ admin_cap: structs_4.AdminCap.bcs,
86
+ version: structs_5.Version.bcs,
87
+ extra_fields: structs_1.Bag.bcs,
88
+ });
89
+ }
90
+ static fromFields(typeArg, fields) {
91
+ return WeightHook.reified(typeArg).new({
92
+ id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
93
+ validatorAddressesAndWeights: (0, reified_1.decodeFromFields)(structs_3.VecMap.reified("address", "u64"), fields.validator_addresses_and_weights),
94
+ totalWeight: (0, reified_1.decodeFromFields)("u64", fields.total_weight),
95
+ adminCap: (0, reified_1.decodeFromFields)(structs_4.AdminCap.reified(typeArg), fields.admin_cap),
96
+ version: (0, reified_1.decodeFromFields)(structs_5.Version.reified(), fields.version),
97
+ extraFields: (0, reified_1.decodeFromFields)(structs_1.Bag.reified(), fields.extra_fields),
98
+ });
99
+ }
100
+ static fromFieldsWithTypes(typeArg, item) {
101
+ if (!isWeightHook(item.type)) {
102
+ throw new Error("not a WeightHook type");
103
+ }
104
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
105
+ return WeightHook.reified(typeArg).new({
106
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
107
+ validatorAddressesAndWeights: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecMap.reified("address", "u64"), item.fields.validator_addresses_and_weights),
108
+ totalWeight: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.total_weight),
109
+ adminCap: (0, reified_1.decodeFromFieldsWithTypes)(structs_4.AdminCap.reified(typeArg), item.fields.admin_cap),
110
+ version: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.Version.reified(), item.fields.version),
111
+ extraFields: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Bag.reified(), item.fields.extra_fields),
112
+ });
113
+ }
114
+ static fromBcs(typeArg, data) {
115
+ return WeightHook.fromFields(typeArg, WeightHook.bcs.parse(data));
116
+ }
117
+ toJSONField() {
118
+ return {
119
+ id: this.id,
120
+ validatorAddressesAndWeights: this.validatorAddressesAndWeights.toJSONField(),
121
+ totalWeight: this.totalWeight.toString(),
122
+ adminCap: this.adminCap.toJSONField(),
123
+ version: this.version.toJSONField(),
124
+ extraFields: this.extraFields.toJSONField(),
125
+ };
126
+ }
127
+ toJSON() {
128
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
129
+ }
130
+ static fromJSONField(typeArg, field) {
131
+ return WeightHook.reified(typeArg).new({
132
+ id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
133
+ validatorAddressesAndWeights: (0, reified_1.decodeFromJSONField)(structs_3.VecMap.reified("address", "u64"), field.validatorAddressesAndWeights),
134
+ totalWeight: (0, reified_1.decodeFromJSONField)("u64", field.totalWeight),
135
+ adminCap: (0, reified_1.decodeFromJSONField)(structs_4.AdminCap.reified(typeArg), field.adminCap),
136
+ version: (0, reified_1.decodeFromJSONField)(structs_5.Version.reified(), field.version),
137
+ extraFields: (0, reified_1.decodeFromJSONField)(structs_1.Bag.reified(), field.extraFields),
138
+ });
139
+ }
140
+ static fromJSON(typeArg, json) {
141
+ if (json.$typeName !== WeightHook.$typeName) {
142
+ throw new Error("not a WithTwoGenerics json object");
143
+ }
144
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(WeightHook.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
145
+ return WeightHook.fromJSONField(typeArg, json);
146
+ }
147
+ static fromSuiParsedData(typeArg, content) {
148
+ if (content.dataType !== "moveObject") {
149
+ throw new Error("not an object");
150
+ }
151
+ if (!isWeightHook(content.type)) {
152
+ throw new Error(`object at ${content.fields.id} is not a WeightHook object`);
153
+ }
154
+ return WeightHook.fromFieldsWithTypes(typeArg, content);
155
+ }
156
+ static fromSuiObjectData(typeArg, data) {
157
+ if (data.bcs) {
158
+ if (data.bcs.dataType !== "moveObject" || !isWeightHook(data.bcs.type)) {
159
+ throw new Error(`object at is not a WeightHook object`);
160
+ }
161
+ const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
162
+ if (gotTypeArgs.length !== 1) {
163
+ throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
164
+ }
165
+ const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
166
+ const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
167
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
168
+ throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
169
+ }
170
+ return WeightHook.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
171
+ }
172
+ if (data.content) {
173
+ return WeightHook.fromSuiParsedData(typeArg, data.content);
174
+ }
175
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
176
+ }
177
+ static fetch(client, typeArg, id) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ var _a, _b;
180
+ const res = yield client.getObject({ id, options: { showBcs: true } });
181
+ if (res.error) {
182
+ throw new Error(`error fetching WeightHook object at id ${id}: ${res.error.code}`);
183
+ }
184
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
185
+ !isWeightHook(res.data.bcs.type)) {
186
+ throw new Error(`object at id ${id} is not a WeightHook object`);
187
+ }
188
+ return WeightHook.fromSuiObjectData(typeArg, res.data);
189
+ });
190
+ }
191
+ }
192
+ exports.WeightHook = WeightHook;
193
+ WeightHook.$typeName = `${index_1.PKG_V1}::weight::WeightHook`;
194
+ WeightHook.$numTypeParams = 1;
195
+ WeightHook.$isPhantom = [true];
196
+ /* ============================== WeightHookAdminCap =============================== */
197
+ function isWeightHookAdminCap(type) {
198
+ type = (0, util_1.compressSuiType)(type);
199
+ return type.startsWith(`${index_1.PKG_V1}::weight::WeightHookAdminCap` + "<");
200
+ }
201
+ class WeightHookAdminCap {
202
+ constructor(typeArgs, fields) {
203
+ this.__StructClass = true;
204
+ this.$typeName = WeightHookAdminCap.$typeName;
205
+ this.$isPhantom = WeightHookAdminCap.$isPhantom;
206
+ this.$fullTypeName = (0, util_1.composeSuiType)(WeightHookAdminCap.$typeName, ...typeArgs);
207
+ this.$typeArgs = typeArgs;
208
+ this.id = fields.id;
209
+ }
210
+ static reified(P) {
211
+ return {
212
+ typeName: WeightHookAdminCap.$typeName,
213
+ fullTypeName: (0, util_1.composeSuiType)(WeightHookAdminCap.$typeName, ...[(0, reified_1.extractType)(P)]),
214
+ typeArgs: [(0, reified_1.extractType)(P)],
215
+ isPhantom: WeightHookAdminCap.$isPhantom,
216
+ reifiedTypeArgs: [P],
217
+ fromFields: (fields) => WeightHookAdminCap.fromFields(P, fields),
218
+ fromFieldsWithTypes: (item) => WeightHookAdminCap.fromFieldsWithTypes(P, item),
219
+ fromBcs: (data) => WeightHookAdminCap.fromBcs(P, data),
220
+ bcs: WeightHookAdminCap.bcs,
221
+ fromJSONField: (field) => WeightHookAdminCap.fromJSONField(P, field),
222
+ fromJSON: (json) => WeightHookAdminCap.fromJSON(P, json),
223
+ fromSuiParsedData: (content) => WeightHookAdminCap.fromSuiParsedData(P, content),
224
+ fromSuiObjectData: (content) => WeightHookAdminCap.fromSuiObjectData(P, content),
225
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return WeightHookAdminCap.fetch(client, P, id); }),
226
+ new: (fields) => {
227
+ return new WeightHookAdminCap([(0, reified_1.extractType)(P)], fields);
228
+ },
229
+ kind: "StructClassReified",
230
+ };
231
+ }
232
+ static get r() {
233
+ return WeightHookAdminCap.reified;
234
+ }
235
+ static phantom(P) {
236
+ return (0, reified_1.phantom)(WeightHookAdminCap.reified(P));
237
+ }
238
+ static get p() {
239
+ return WeightHookAdminCap.phantom;
240
+ }
241
+ static get bcs() {
242
+ return bcs_1.bcs.struct("WeightHookAdminCap", {
243
+ id: structs_2.UID.bcs,
244
+ });
245
+ }
246
+ static fromFields(typeArg, fields) {
247
+ return WeightHookAdminCap.reified(typeArg).new({
248
+ id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
249
+ });
250
+ }
251
+ static fromFieldsWithTypes(typeArg, item) {
252
+ if (!isWeightHookAdminCap(item.type)) {
253
+ throw new Error("not a WeightHookAdminCap type");
254
+ }
255
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
256
+ return WeightHookAdminCap.reified(typeArg).new({
257
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
258
+ });
259
+ }
260
+ static fromBcs(typeArg, data) {
261
+ return WeightHookAdminCap.fromFields(typeArg, WeightHookAdminCap.bcs.parse(data));
262
+ }
263
+ toJSONField() {
264
+ return {
265
+ id: this.id,
266
+ };
267
+ }
268
+ toJSON() {
269
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
270
+ }
271
+ static fromJSONField(typeArg, field) {
272
+ return WeightHookAdminCap.reified(typeArg).new({
273
+ id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
274
+ });
275
+ }
276
+ static fromJSON(typeArg, json) {
277
+ if (json.$typeName !== WeightHookAdminCap.$typeName) {
278
+ throw new Error("not a WithTwoGenerics json object");
279
+ }
280
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(WeightHookAdminCap.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
281
+ return WeightHookAdminCap.fromJSONField(typeArg, json);
282
+ }
283
+ static fromSuiParsedData(typeArg, content) {
284
+ if (content.dataType !== "moveObject") {
285
+ throw new Error("not an object");
286
+ }
287
+ if (!isWeightHookAdminCap(content.type)) {
288
+ throw new Error(`object at ${content.fields.id} is not a WeightHookAdminCap object`);
289
+ }
290
+ return WeightHookAdminCap.fromFieldsWithTypes(typeArg, content);
291
+ }
292
+ static fromSuiObjectData(typeArg, data) {
293
+ if (data.bcs) {
294
+ if (data.bcs.dataType !== "moveObject" ||
295
+ !isWeightHookAdminCap(data.bcs.type)) {
296
+ throw new Error(`object at is not a WeightHookAdminCap object`);
297
+ }
298
+ const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
299
+ if (gotTypeArgs.length !== 1) {
300
+ throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
301
+ }
302
+ const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
303
+ const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
304
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
305
+ throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
306
+ }
307
+ return WeightHookAdminCap.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
308
+ }
309
+ if (data.content) {
310
+ return WeightHookAdminCap.fromSuiParsedData(typeArg, data.content);
311
+ }
312
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
313
+ }
314
+ static fetch(client, typeArg, id) {
315
+ return __awaiter(this, void 0, void 0, function* () {
316
+ var _a, _b;
317
+ const res = yield client.getObject({ id, options: { showBcs: true } });
318
+ if (res.error) {
319
+ throw new Error(`error fetching WeightHookAdminCap object at id ${id}: ${res.error.code}`);
320
+ }
321
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
322
+ !isWeightHookAdminCap(res.data.bcs.type)) {
323
+ throw new Error(`object at id ${id} is not a WeightHookAdminCap object`);
324
+ }
325
+ return WeightHookAdminCap.fromSuiObjectData(typeArg, res.data);
326
+ });
327
+ }
328
+ }
329
+ exports.WeightHookAdminCap = WeightHookAdminCap;
330
+ WeightHookAdminCap.$typeName = `${index_1.PKG_V1}::weight::WeightHookAdminCap`;
331
+ WeightHookAdminCap.$numTypeParams = 1;
332
+ WeightHookAdminCap.$isPhantom = [true];
@@ -0,0 +1,44 @@
1
+ import { SuiClient } from "@mysten/sui/client";
2
+ import { Transaction, TransactionObjectInput } from "@mysten/sui/transactions";
3
+ import { LiquidStakingInfo } from "./_generated/liquid_staking/liquid-staking/structs";
4
+ export interface LiquidStakingObjectInfo {
5
+ id: string;
6
+ type: string;
7
+ }
8
+ export declare class LstClient {
9
+ liquidStakingObject: LiquidStakingObjectInfo;
10
+ client: SuiClient;
11
+ static initialize(client: SuiClient, liquidStakingObjectInfo: LiquidStakingObjectInfo): Promise<LstClient>;
12
+ constructor(liquidStakingObject: LiquidStakingObjectInfo, client: SuiClient);
13
+ getAdminCapId(address: string): Promise<string | null | undefined>;
14
+ getWeightHookAdminCapId(address: string): Promise<string | null | undefined>;
15
+ mint(tx: Transaction, suiCoinId: TransactionObjectInput): {
16
+ $kind: "NestedResult";
17
+ NestedResult: [number, number];
18
+ };
19
+ redeemLst(tx: Transaction, lstId: TransactionObjectInput): {
20
+ $kind: "NestedResult";
21
+ NestedResult: [number, number];
22
+ };
23
+ increaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, suiAmount: number): void;
24
+ decreaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, maxSuiAmount: number): void;
25
+ collectFees(tx: Transaction, adminCapId: TransactionObjectInput): {
26
+ $kind: "NestedResult";
27
+ NestedResult: [number, number];
28
+ };
29
+ updateFees(tx: Transaction, adminCapId: TransactionObjectInput, feeConfigArgs: FeeConfigArgs): void;
30
+ initializeWeightHook(tx: Transaction, adminCapId: TransactionObjectInput): {
31
+ $kind: "NestedResult";
32
+ NestedResult: [number, number];
33
+ };
34
+ setValidatorAddressesAndWeights(tx: Transaction, weightHookId: TransactionObjectInput, weightHookAdminCap: TransactionObjectInput, validatorAddressesAndWeights: Map<string, number>): void;
35
+ rebalance(tx: Transaction, weightHookId: TransactionObjectInput): void;
36
+ }
37
+ export declare function fetchLiquidStakingInfo(info: LiquidStakingObjectInfo, client: SuiClient): Promise<LiquidStakingInfo<any>>;
38
+ interface FeeConfigArgs {
39
+ mintFeeBps?: number;
40
+ redeemFeeBps?: number;
41
+ spreadFee?: number;
42
+ }
43
+ export declare function getSpringSuiApy(client: SuiClient): Promise<number | undefined>;
44
+ export {};