@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,291 @@
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.Supply = exports.Balance = void 0;
13
+ exports.isBalance = isBalance;
14
+ exports.isSupply = isSupply;
15
+ const reified_1 = require("../../../../_framework/reified");
16
+ const util_1 = require("../../../../_framework/util");
17
+ const index_1 = require("../index");
18
+ const bcs_1 = require("@mysten/sui/bcs");
19
+ const utils_1 = require("@mysten/sui/utils");
20
+ /* ============================== Balance =============================== */
21
+ function isBalance(type) {
22
+ type = (0, util_1.compressSuiType)(type);
23
+ return type.startsWith(`${index_1.PKG_V28}::balance::Balance` + "<");
24
+ }
25
+ class Balance {
26
+ constructor(typeArgs, fields) {
27
+ this.__StructClass = true;
28
+ this.$typeName = Balance.$typeName;
29
+ this.$isPhantom = Balance.$isPhantom;
30
+ this.$fullTypeName = (0, util_1.composeSuiType)(Balance.$typeName, ...typeArgs);
31
+ this.$typeArgs = typeArgs;
32
+ this.value = fields.value;
33
+ }
34
+ static reified(T) {
35
+ return {
36
+ typeName: Balance.$typeName,
37
+ fullTypeName: (0, util_1.composeSuiType)(Balance.$typeName, ...[(0, reified_1.extractType)(T)]),
38
+ typeArgs: [(0, reified_1.extractType)(T)],
39
+ isPhantom: Balance.$isPhantom,
40
+ reifiedTypeArgs: [T],
41
+ fromFields: (fields) => Balance.fromFields(T, fields),
42
+ fromFieldsWithTypes: (item) => Balance.fromFieldsWithTypes(T, item),
43
+ fromBcs: (data) => Balance.fromBcs(T, data),
44
+ bcs: Balance.bcs,
45
+ fromJSONField: (field) => Balance.fromJSONField(T, field),
46
+ fromJSON: (json) => Balance.fromJSON(T, json),
47
+ fromSuiParsedData: (content) => Balance.fromSuiParsedData(T, content),
48
+ fromSuiObjectData: (content) => Balance.fromSuiObjectData(T, content),
49
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Balance.fetch(client, T, id); }),
50
+ new: (fields) => {
51
+ return new Balance([(0, reified_1.extractType)(T)], fields);
52
+ },
53
+ kind: "StructClassReified",
54
+ };
55
+ }
56
+ static get r() {
57
+ return Balance.reified;
58
+ }
59
+ static phantom(T) {
60
+ return (0, reified_1.phantom)(Balance.reified(T));
61
+ }
62
+ static get p() {
63
+ return Balance.phantom;
64
+ }
65
+ static get bcs() {
66
+ return bcs_1.bcs.struct("Balance", {
67
+ value: bcs_1.bcs.u64(),
68
+ });
69
+ }
70
+ static fromFields(typeArg, fields) {
71
+ return Balance.reified(typeArg).new({
72
+ value: (0, reified_1.decodeFromFields)("u64", fields.value),
73
+ });
74
+ }
75
+ static fromFieldsWithTypes(typeArg, item) {
76
+ if (!isBalance(item.type)) {
77
+ throw new Error("not a Balance type");
78
+ }
79
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
80
+ return Balance.reified(typeArg).new({
81
+ value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
82
+ });
83
+ }
84
+ static fromBcs(typeArg, data) {
85
+ return Balance.fromFields(typeArg, Balance.bcs.parse(data));
86
+ }
87
+ toJSONField() {
88
+ return {
89
+ value: this.value.toString(),
90
+ };
91
+ }
92
+ toJSON() {
93
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
94
+ }
95
+ static fromJSONField(typeArg, field) {
96
+ return Balance.reified(typeArg).new({
97
+ value: (0, reified_1.decodeFromJSONField)("u64", field.value),
98
+ });
99
+ }
100
+ static fromJSON(typeArg, json) {
101
+ if (json.$typeName !== Balance.$typeName) {
102
+ throw new Error("not a WithTwoGenerics json object");
103
+ }
104
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Balance.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
105
+ return Balance.fromJSONField(typeArg, json);
106
+ }
107
+ static fromSuiParsedData(typeArg, content) {
108
+ if (content.dataType !== "moveObject") {
109
+ throw new Error("not an object");
110
+ }
111
+ if (!isBalance(content.type)) {
112
+ throw new Error(`object at ${content.fields.id} is not a Balance object`);
113
+ }
114
+ return Balance.fromFieldsWithTypes(typeArg, content);
115
+ }
116
+ static fromSuiObjectData(typeArg, data) {
117
+ if (data.bcs) {
118
+ if (data.bcs.dataType !== "moveObject" || !isBalance(data.bcs.type)) {
119
+ throw new Error(`object at is not a Balance object`);
120
+ }
121
+ const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
122
+ if (gotTypeArgs.length !== 1) {
123
+ throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
124
+ }
125
+ const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
126
+ const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
127
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
128
+ throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
129
+ }
130
+ return Balance.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
131
+ }
132
+ if (data.content) {
133
+ return Balance.fromSuiParsedData(typeArg, data.content);
134
+ }
135
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
136
+ }
137
+ static fetch(client, typeArg, id) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ var _a, _b;
140
+ const res = yield client.getObject({ id, options: { showBcs: true } });
141
+ if (res.error) {
142
+ throw new Error(`error fetching Balance object at id ${id}: ${res.error.code}`);
143
+ }
144
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
145
+ !isBalance(res.data.bcs.type)) {
146
+ throw new Error(`object at id ${id} is not a Balance object`);
147
+ }
148
+ return Balance.fromSuiObjectData(typeArg, res.data);
149
+ });
150
+ }
151
+ }
152
+ exports.Balance = Balance;
153
+ Balance.$typeName = `${index_1.PKG_V28}::balance::Balance`;
154
+ Balance.$numTypeParams = 1;
155
+ Balance.$isPhantom = [true];
156
+ /* ============================== Supply =============================== */
157
+ function isSupply(type) {
158
+ type = (0, util_1.compressSuiType)(type);
159
+ return type.startsWith(`${index_1.PKG_V28}::balance::Supply` + "<");
160
+ }
161
+ class Supply {
162
+ constructor(typeArgs, fields) {
163
+ this.__StructClass = true;
164
+ this.$typeName = Supply.$typeName;
165
+ this.$isPhantom = Supply.$isPhantom;
166
+ this.$fullTypeName = (0, util_1.composeSuiType)(Supply.$typeName, ...typeArgs);
167
+ this.$typeArgs = typeArgs;
168
+ this.value = fields.value;
169
+ }
170
+ static reified(T) {
171
+ return {
172
+ typeName: Supply.$typeName,
173
+ fullTypeName: (0, util_1.composeSuiType)(Supply.$typeName, ...[(0, reified_1.extractType)(T)]),
174
+ typeArgs: [(0, reified_1.extractType)(T)],
175
+ isPhantom: Supply.$isPhantom,
176
+ reifiedTypeArgs: [T],
177
+ fromFields: (fields) => Supply.fromFields(T, fields),
178
+ fromFieldsWithTypes: (item) => Supply.fromFieldsWithTypes(T, item),
179
+ fromBcs: (data) => Supply.fromBcs(T, data),
180
+ bcs: Supply.bcs,
181
+ fromJSONField: (field) => Supply.fromJSONField(T, field),
182
+ fromJSON: (json) => Supply.fromJSON(T, json),
183
+ fromSuiParsedData: (content) => Supply.fromSuiParsedData(T, content),
184
+ fromSuiObjectData: (content) => Supply.fromSuiObjectData(T, content),
185
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Supply.fetch(client, T, id); }),
186
+ new: (fields) => {
187
+ return new Supply([(0, reified_1.extractType)(T)], fields);
188
+ },
189
+ kind: "StructClassReified",
190
+ };
191
+ }
192
+ static get r() {
193
+ return Supply.reified;
194
+ }
195
+ static phantom(T) {
196
+ return (0, reified_1.phantom)(Supply.reified(T));
197
+ }
198
+ static get p() {
199
+ return Supply.phantom;
200
+ }
201
+ static get bcs() {
202
+ return bcs_1.bcs.struct("Supply", {
203
+ value: bcs_1.bcs.u64(),
204
+ });
205
+ }
206
+ static fromFields(typeArg, fields) {
207
+ return Supply.reified(typeArg).new({
208
+ value: (0, reified_1.decodeFromFields)("u64", fields.value),
209
+ });
210
+ }
211
+ static fromFieldsWithTypes(typeArg, item) {
212
+ if (!isSupply(item.type)) {
213
+ throw new Error("not a Supply type");
214
+ }
215
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
216
+ return Supply.reified(typeArg).new({
217
+ value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
218
+ });
219
+ }
220
+ static fromBcs(typeArg, data) {
221
+ return Supply.fromFields(typeArg, Supply.bcs.parse(data));
222
+ }
223
+ toJSONField() {
224
+ return {
225
+ value: this.value.toString(),
226
+ };
227
+ }
228
+ toJSON() {
229
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
230
+ }
231
+ static fromJSONField(typeArg, field) {
232
+ return Supply.reified(typeArg).new({
233
+ value: (0, reified_1.decodeFromJSONField)("u64", field.value),
234
+ });
235
+ }
236
+ static fromJSON(typeArg, json) {
237
+ if (json.$typeName !== Supply.$typeName) {
238
+ throw new Error("not a WithTwoGenerics json object");
239
+ }
240
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Supply.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
241
+ return Supply.fromJSONField(typeArg, json);
242
+ }
243
+ static fromSuiParsedData(typeArg, content) {
244
+ if (content.dataType !== "moveObject") {
245
+ throw new Error("not an object");
246
+ }
247
+ if (!isSupply(content.type)) {
248
+ throw new Error(`object at ${content.fields.id} is not a Supply object`);
249
+ }
250
+ return Supply.fromFieldsWithTypes(typeArg, content);
251
+ }
252
+ static fromSuiObjectData(typeArg, data) {
253
+ if (data.bcs) {
254
+ if (data.bcs.dataType !== "moveObject" || !isSupply(data.bcs.type)) {
255
+ throw new Error(`object at is not a Supply object`);
256
+ }
257
+ const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
258
+ if (gotTypeArgs.length !== 1) {
259
+ throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
260
+ }
261
+ const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
262
+ const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
263
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
264
+ throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
265
+ }
266
+ return Supply.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
267
+ }
268
+ if (data.content) {
269
+ return Supply.fromSuiParsedData(typeArg, data.content);
270
+ }
271
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
272
+ }
273
+ static fetch(client, typeArg, id) {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ var _a, _b;
276
+ const res = yield client.getObject({ id, options: { showBcs: true } });
277
+ if (res.error) {
278
+ throw new Error(`error fetching Supply object at id ${id}: ${res.error.code}`);
279
+ }
280
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
281
+ !isSupply(res.data.bcs.type)) {
282
+ throw new Error(`object at id ${id} is not a Supply object`);
283
+ }
284
+ return Supply.fromSuiObjectData(typeArg, res.data);
285
+ });
286
+ }
287
+ }
288
+ exports.Supply = Supply;
289
+ Supply.$typeName = `${index_1.PKG_V28}::balance::Supply`;
290
+ Supply.$numTypeParams = 1;
291
+ Supply.$isPhantom = [true];