@typus/typus-perp-sdk 1.0.30 → 1.0.31

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 (33) hide show
  1. package/dist/src/fetch.d.ts +3 -0
  2. package/dist/src/fetch.js +3 -1
  3. package/dist/src/typus_perp/admin/functions.d.ts +25 -25
  4. package/dist/src/typus_perp/admin/functions.js +66 -53
  5. package/dist/src/typus_perp/admin/structs.d.ts +222 -222
  6. package/dist/src/typus_perp/admin/structs.js +256 -256
  7. package/dist/src/typus_perp/error/functions.d.ts +67 -67
  8. package/dist/src/typus_perp/error/functions.js +201 -134
  9. package/dist/src/typus_perp/escrow/functions.d.ts +3 -3
  10. package/dist/src/typus_perp/escrow/functions.js +9 -6
  11. package/dist/src/typus_perp/lending/functions.d.ts +15 -0
  12. package/dist/src/typus_perp/lending/functions.js +22 -0
  13. package/dist/src/typus_perp/lp-pool/functions.d.ts +102 -63
  14. package/dist/src/typus_perp/lp-pool/functions.js +243 -123
  15. package/dist/src/typus_perp/lp-pool/structs.d.ts +616 -348
  16. package/dist/src/typus_perp/lp-pool/structs.js +1202 -768
  17. package/dist/src/typus_perp/math/functions.d.ts +16 -5
  18. package/dist/src/typus_perp/math/functions.js +33 -12
  19. package/dist/src/typus_perp/position/functions.d.ts +86 -86
  20. package/dist/src/typus_perp/position/functions.js +223 -157
  21. package/dist/src/typus_perp/symbol/functions.d.ts +4 -4
  22. package/dist/src/typus_perp/symbol/functions.js +14 -10
  23. package/dist/src/typus_perp/tlp/functions.d.ts +5 -5
  24. package/dist/src/typus_perp/tlp/functions.js +17 -12
  25. package/dist/src/typus_perp/token-interface/functions.d.ts +2 -2
  26. package/dist/src/typus_perp/token-interface/functions.js +6 -4
  27. package/dist/src/typus_perp/trading/functions.d.ts +75 -75
  28. package/dist/src/typus_perp/trading/functions.js +189 -138
  29. package/dist/src/typus_perp/trading/structs.d.ts +6 -0
  30. package/dist/src/typus_perp/trading/structs.js +6 -0
  31. package/dist/src/typus_perp/treasury-caps/functions.d.ts +4 -4
  32. package/dist/src/typus_perp/treasury-caps/functions.js +14 -10
  33. package/package.json +2 -2
@@ -105,12 +105,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
105
105
  return to.concat(ar || Array.prototype.slice.call(from));
106
106
  };
107
107
  Object.defineProperty(exports, "__esModule", { value: true });
108
- exports.ProtocolFeeEvent = exports.SendFeeEvent = exports.FeePool = exports.FeeInfo = exports.Version = void 0;
109
- exports.isVersion = isVersion;
108
+ exports.Version = exports.SendFeeEvent = exports.ProtocolFeeEvent = exports.FeePool = exports.FeeInfo = void 0;
110
109
  exports.isFeeInfo = isFeeInfo;
111
110
  exports.isFeePool = isFeePool;
112
- exports.isSendFeeEvent = isSendFeeEvent;
113
111
  exports.isProtocolFeeEvent = isProtocolFeeEvent;
112
+ exports.isSendFeeEvent = isSendFeeEvent;
113
+ exports.isVersion = isVersion;
114
114
  var reified = __importStar(require("../../_framework/reified"));
115
115
  var structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
116
116
  var structs_2 = require("../../_dependencies/source/0x2/object/structs");
@@ -120,183 +120,6 @@ var util_1 = require("../../_framework/util");
120
120
  var index_1 = require("../index");
121
121
  var bcs_1 = require("@mysten/sui/bcs");
122
122
  var utils_1 = require("@mysten/sui/utils");
123
- /* ============================== Version =============================== */
124
- function isVersion(type) {
125
- type = (0, util_1.compressSuiType)(type);
126
- return type === "".concat(index_1.PKG_V1, "::admin::Version");
127
- }
128
- var Version = /** @class */ (function () {
129
- function Version(typeArgs, fields) {
130
- this.__StructClass = true;
131
- this.$typeName = Version.$typeName;
132
- this.$isPhantom = Version.$isPhantom;
133
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], __read(typeArgs), false));
134
- this.$typeArgs = typeArgs;
135
- this.id = fields.id;
136
- this.value = fields.value;
137
- this.feePool = fields.feePool;
138
- this.liquidatorFeePool = fields.liquidatorFeePool;
139
- this.authority = fields.authority;
140
- this.u64Padding = fields.u64Padding;
141
- }
142
- Version.reified = function () {
143
- var _this = this;
144
- return {
145
- typeName: Version.$typeName,
146
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], [], false)),
147
- typeArgs: [],
148
- isPhantom: Version.$isPhantom,
149
- reifiedTypeArgs: [],
150
- fromFields: function (fields) { return Version.fromFields(fields); },
151
- fromFieldsWithTypes: function (item) { return Version.fromFieldsWithTypes(item); },
152
- fromBcs: function (data) { return Version.fromBcs(data); },
153
- bcs: Version.bcs,
154
- fromJSONField: function (field) { return Version.fromJSONField(field); },
155
- fromJSON: function (json) { return Version.fromJSON(json); },
156
- fromSuiParsedData: function (content) { return Version.fromSuiParsedData(content); },
157
- fromSuiObjectData: function (content) { return Version.fromSuiObjectData(content); },
158
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
159
- return [2 /*return*/, Version.fetch(client, id)];
160
- }); }); },
161
- new: function (fields) {
162
- return new Version([], fields);
163
- },
164
- kind: "StructClassReified",
165
- };
166
- };
167
- Object.defineProperty(Version, "r", {
168
- get: function () {
169
- return Version.reified();
170
- },
171
- enumerable: false,
172
- configurable: true
173
- });
174
- Version.phantom = function () {
175
- return (0, reified_1.phantom)(Version.reified());
176
- };
177
- Object.defineProperty(Version, "p", {
178
- get: function () {
179
- return Version.phantom();
180
- },
181
- enumerable: false,
182
- configurable: true
183
- });
184
- Object.defineProperty(Version, "bcs", {
185
- get: function () {
186
- return bcs_1.bcs.struct("Version", {
187
- id: structs_2.UID.bcs,
188
- value: bcs_1.bcs.u64(),
189
- fee_pool: FeePool.bcs,
190
- liquidator_fee_pool: FeePool.bcs,
191
- authority: structs_3.VecSet.bcs(bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } })),
192
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
193
- });
194
- },
195
- enumerable: false,
196
- configurable: true
197
- });
198
- Version.fromFields = function (fields) {
199
- return Version.reified().new({
200
- id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
201
- value: (0, reified_1.decodeFromFields)("u64", fields.value),
202
- feePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.fee_pool),
203
- liquidatorFeePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.liquidator_fee_pool),
204
- authority: (0, reified_1.decodeFromFields)(structs_3.VecSet.reified("address"), fields.authority),
205
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
206
- });
207
- };
208
- Version.fromFieldsWithTypes = function (item) {
209
- if (!isVersion(item.type)) {
210
- throw new Error("not a Version type");
211
- }
212
- return Version.reified().new({
213
- id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
214
- value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
215
- feePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.fee_pool),
216
- liquidatorFeePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.liquidator_fee_pool),
217
- authority: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecSet.reified("address"), item.fields.authority),
218
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
219
- });
220
- };
221
- Version.fromBcs = function (data) {
222
- return Version.fromFields(Version.bcs.parse(data));
223
- };
224
- Version.prototype.toJSONField = function () {
225
- return {
226
- id: this.id,
227
- value: this.value.toString(),
228
- feePool: this.feePool.toJSONField(),
229
- liquidatorFeePool: this.liquidatorFeePool.toJSONField(),
230
- authority: this.authority.toJSONField(),
231
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
232
- };
233
- };
234
- Version.prototype.toJSON = function () {
235
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
236
- };
237
- Version.fromJSONField = function (field) {
238
- return Version.reified().new({
239
- id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
240
- value: (0, reified_1.decodeFromJSONField)("u64", field.value),
241
- feePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.feePool),
242
- liquidatorFeePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.liquidatorFeePool),
243
- authority: (0, reified_1.decodeFromJSONField)(structs_3.VecSet.reified("address"), field.authority),
244
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
245
- });
246
- };
247
- Version.fromJSON = function (json) {
248
- if (json.$typeName !== Version.$typeName) {
249
- throw new Error("not a WithTwoGenerics json object");
250
- }
251
- return Version.fromJSONField(json);
252
- };
253
- Version.fromSuiParsedData = function (content) {
254
- if (content.dataType !== "moveObject") {
255
- throw new Error("not an object");
256
- }
257
- if (!isVersion(content.type)) {
258
- throw new Error("object at ".concat(content.fields.id, " is not a Version object"));
259
- }
260
- return Version.fromFieldsWithTypes(content);
261
- };
262
- Version.fromSuiObjectData = function (data) {
263
- if (data.bcs) {
264
- if (data.bcs.dataType !== "moveObject" || !isVersion(data.bcs.type)) {
265
- throw new Error("object at is not a Version object");
266
- }
267
- return Version.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
268
- }
269
- if (data.content) {
270
- return Version.fromSuiParsedData(data.content);
271
- }
272
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
273
- };
274
- Version.fetch = function (client, id) {
275
- return __awaiter(this, void 0, void 0, function () {
276
- var res;
277
- var _a, _b;
278
- return __generator(this, function (_c) {
279
- switch (_c.label) {
280
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
281
- case 1:
282
- res = _c.sent();
283
- if (res.error) {
284
- throw new Error("error fetching Version object at id ".concat(id, ": ").concat(res.error.code));
285
- }
286
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isVersion(res.data.bcs.type)) {
287
- throw new Error("object at id ".concat(id, " is not a Version object"));
288
- }
289
- return [2 /*return*/, Version.fromSuiObjectData(res.data)];
290
- }
291
- });
292
- });
293
- };
294
- Version.$typeName = "".concat(index_1.PKG_V1, "::admin::Version");
295
- Version.$numTypeParams = 0;
296
- Version.$isPhantom = [];
297
- return Version;
298
- }());
299
- exports.Version = Version;
300
123
  /* ============================== FeeInfo =============================== */
301
124
  function isFeeInfo(type) {
302
125
  type = (0, util_1.compressSuiType)(type);
@@ -603,6 +426,159 @@ var FeePool = /** @class */ (function () {
603
426
  return FeePool;
604
427
  }());
605
428
  exports.FeePool = FeePool;
429
+ /* ============================== ProtocolFeeEvent =============================== */
430
+ function isProtocolFeeEvent(type) {
431
+ type = (0, util_1.compressSuiType)(type);
432
+ return type === "".concat(index_1.PKG_V1, "::admin::ProtocolFeeEvent");
433
+ }
434
+ var ProtocolFeeEvent = /** @class */ (function () {
435
+ function ProtocolFeeEvent(typeArgs, fields) {
436
+ this.__StructClass = true;
437
+ this.$typeName = ProtocolFeeEvent.$typeName;
438
+ this.$isPhantom = ProtocolFeeEvent.$isPhantom;
439
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([ProtocolFeeEvent.$typeName], __read(typeArgs), false));
440
+ this.$typeArgs = typeArgs;
441
+ this.token = fields.token;
442
+ this.amount = fields.amount;
443
+ }
444
+ ProtocolFeeEvent.reified = function () {
445
+ var _this = this;
446
+ return {
447
+ typeName: ProtocolFeeEvent.$typeName,
448
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([ProtocolFeeEvent.$typeName], [], false)),
449
+ typeArgs: [],
450
+ isPhantom: ProtocolFeeEvent.$isPhantom,
451
+ reifiedTypeArgs: [],
452
+ fromFields: function (fields) { return ProtocolFeeEvent.fromFields(fields); },
453
+ fromFieldsWithTypes: function (item) { return ProtocolFeeEvent.fromFieldsWithTypes(item); },
454
+ fromBcs: function (data) { return ProtocolFeeEvent.fromBcs(data); },
455
+ bcs: ProtocolFeeEvent.bcs,
456
+ fromJSONField: function (field) { return ProtocolFeeEvent.fromJSONField(field); },
457
+ fromJSON: function (json) { return ProtocolFeeEvent.fromJSON(json); },
458
+ fromSuiParsedData: function (content) { return ProtocolFeeEvent.fromSuiParsedData(content); },
459
+ fromSuiObjectData: function (content) { return ProtocolFeeEvent.fromSuiObjectData(content); },
460
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
461
+ return [2 /*return*/, ProtocolFeeEvent.fetch(client, id)];
462
+ }); }); },
463
+ new: function (fields) {
464
+ return new ProtocolFeeEvent([], fields);
465
+ },
466
+ kind: "StructClassReified",
467
+ };
468
+ };
469
+ Object.defineProperty(ProtocolFeeEvent, "r", {
470
+ get: function () {
471
+ return ProtocolFeeEvent.reified();
472
+ },
473
+ enumerable: false,
474
+ configurable: true
475
+ });
476
+ ProtocolFeeEvent.phantom = function () {
477
+ return (0, reified_1.phantom)(ProtocolFeeEvent.reified());
478
+ };
479
+ Object.defineProperty(ProtocolFeeEvent, "p", {
480
+ get: function () {
481
+ return ProtocolFeeEvent.phantom();
482
+ },
483
+ enumerable: false,
484
+ configurable: true
485
+ });
486
+ Object.defineProperty(ProtocolFeeEvent, "bcs", {
487
+ get: function () {
488
+ return bcs_1.bcs.struct("ProtocolFeeEvent", {
489
+ token: structs_1.TypeName.bcs,
490
+ amount: bcs_1.bcs.u64(),
491
+ });
492
+ },
493
+ enumerable: false,
494
+ configurable: true
495
+ });
496
+ ProtocolFeeEvent.fromFields = function (fields) {
497
+ return ProtocolFeeEvent.reified().new({
498
+ token: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token),
499
+ amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
500
+ });
501
+ };
502
+ ProtocolFeeEvent.fromFieldsWithTypes = function (item) {
503
+ if (!isProtocolFeeEvent(item.type)) {
504
+ throw new Error("not a ProtocolFeeEvent type");
505
+ }
506
+ return ProtocolFeeEvent.reified().new({
507
+ token: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token),
508
+ amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
509
+ });
510
+ };
511
+ ProtocolFeeEvent.fromBcs = function (data) {
512
+ return ProtocolFeeEvent.fromFields(ProtocolFeeEvent.bcs.parse(data));
513
+ };
514
+ ProtocolFeeEvent.prototype.toJSONField = function () {
515
+ return {
516
+ token: this.token.toJSONField(),
517
+ amount: this.amount.toString(),
518
+ };
519
+ };
520
+ ProtocolFeeEvent.prototype.toJSON = function () {
521
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
522
+ };
523
+ ProtocolFeeEvent.fromJSONField = function (field) {
524
+ return ProtocolFeeEvent.reified().new({
525
+ token: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.token),
526
+ amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
527
+ });
528
+ };
529
+ ProtocolFeeEvent.fromJSON = function (json) {
530
+ if (json.$typeName !== ProtocolFeeEvent.$typeName) {
531
+ throw new Error("not a WithTwoGenerics json object");
532
+ }
533
+ return ProtocolFeeEvent.fromJSONField(json);
534
+ };
535
+ ProtocolFeeEvent.fromSuiParsedData = function (content) {
536
+ if (content.dataType !== "moveObject") {
537
+ throw new Error("not an object");
538
+ }
539
+ if (!isProtocolFeeEvent(content.type)) {
540
+ throw new Error("object at ".concat(content.fields.id, " is not a ProtocolFeeEvent object"));
541
+ }
542
+ return ProtocolFeeEvent.fromFieldsWithTypes(content);
543
+ };
544
+ ProtocolFeeEvent.fromSuiObjectData = function (data) {
545
+ if (data.bcs) {
546
+ if (data.bcs.dataType !== "moveObject" || !isProtocolFeeEvent(data.bcs.type)) {
547
+ throw new Error("object at is not a ProtocolFeeEvent object");
548
+ }
549
+ return ProtocolFeeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
550
+ }
551
+ if (data.content) {
552
+ return ProtocolFeeEvent.fromSuiParsedData(data.content);
553
+ }
554
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
555
+ };
556
+ ProtocolFeeEvent.fetch = function (client, id) {
557
+ return __awaiter(this, void 0, void 0, function () {
558
+ var res;
559
+ var _a, _b;
560
+ return __generator(this, function (_c) {
561
+ switch (_c.label) {
562
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
563
+ case 1:
564
+ res = _c.sent();
565
+ if (res.error) {
566
+ throw new Error("error fetching ProtocolFeeEvent object at id ".concat(id, ": ").concat(res.error.code));
567
+ }
568
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isProtocolFeeEvent(res.data.bcs.type)) {
569
+ throw new Error("object at id ".concat(id, " is not a ProtocolFeeEvent object"));
570
+ }
571
+ return [2 /*return*/, ProtocolFeeEvent.fromSuiObjectData(res.data)];
572
+ }
573
+ });
574
+ });
575
+ };
576
+ ProtocolFeeEvent.$typeName = "".concat(index_1.PKG_V1, "::admin::ProtocolFeeEvent");
577
+ ProtocolFeeEvent.$numTypeParams = 0;
578
+ ProtocolFeeEvent.$isPhantom = [];
579
+ return ProtocolFeeEvent;
580
+ }());
581
+ exports.ProtocolFeeEvent = ProtocolFeeEvent;
606
582
  /* ============================== SendFeeEvent =============================== */
607
583
  function isSendFeeEvent(type) {
608
584
  type = (0, util_1.compressSuiType)(type);
@@ -756,134 +732,158 @@ var SendFeeEvent = /** @class */ (function () {
756
732
  return SendFeeEvent;
757
733
  }());
758
734
  exports.SendFeeEvent = SendFeeEvent;
759
- /* ============================== ProtocolFeeEvent =============================== */
760
- function isProtocolFeeEvent(type) {
735
+ /* ============================== Version =============================== */
736
+ function isVersion(type) {
761
737
  type = (0, util_1.compressSuiType)(type);
762
- return type === "".concat(index_1.PKG_V1, "::admin::ProtocolFeeEvent");
738
+ return type === "".concat(index_1.PKG_V1, "::admin::Version");
763
739
  }
764
- var ProtocolFeeEvent = /** @class */ (function () {
765
- function ProtocolFeeEvent(typeArgs, fields) {
740
+ var Version = /** @class */ (function () {
741
+ function Version(typeArgs, fields) {
766
742
  this.__StructClass = true;
767
- this.$typeName = ProtocolFeeEvent.$typeName;
768
- this.$isPhantom = ProtocolFeeEvent.$isPhantom;
769
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([ProtocolFeeEvent.$typeName], __read(typeArgs), false));
743
+ this.$typeName = Version.$typeName;
744
+ this.$isPhantom = Version.$isPhantom;
745
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], __read(typeArgs), false));
770
746
  this.$typeArgs = typeArgs;
771
- this.token = fields.token;
772
- this.amount = fields.amount;
747
+ this.id = fields.id;
748
+ this.value = fields.value;
749
+ this.feePool = fields.feePool;
750
+ this.liquidatorFeePool = fields.liquidatorFeePool;
751
+ this.authority = fields.authority;
752
+ this.u64Padding = fields.u64Padding;
773
753
  }
774
- ProtocolFeeEvent.reified = function () {
754
+ Version.reified = function () {
775
755
  var _this = this;
776
756
  return {
777
- typeName: ProtocolFeeEvent.$typeName,
778
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([ProtocolFeeEvent.$typeName], [], false)),
757
+ typeName: Version.$typeName,
758
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], [], false)),
779
759
  typeArgs: [],
780
- isPhantom: ProtocolFeeEvent.$isPhantom,
760
+ isPhantom: Version.$isPhantom,
781
761
  reifiedTypeArgs: [],
782
- fromFields: function (fields) { return ProtocolFeeEvent.fromFields(fields); },
783
- fromFieldsWithTypes: function (item) { return ProtocolFeeEvent.fromFieldsWithTypes(item); },
784
- fromBcs: function (data) { return ProtocolFeeEvent.fromBcs(data); },
785
- bcs: ProtocolFeeEvent.bcs,
786
- fromJSONField: function (field) { return ProtocolFeeEvent.fromJSONField(field); },
787
- fromJSON: function (json) { return ProtocolFeeEvent.fromJSON(json); },
788
- fromSuiParsedData: function (content) { return ProtocolFeeEvent.fromSuiParsedData(content); },
789
- fromSuiObjectData: function (content) { return ProtocolFeeEvent.fromSuiObjectData(content); },
762
+ fromFields: function (fields) { return Version.fromFields(fields); },
763
+ fromFieldsWithTypes: function (item) { return Version.fromFieldsWithTypes(item); },
764
+ fromBcs: function (data) { return Version.fromBcs(data); },
765
+ bcs: Version.bcs,
766
+ fromJSONField: function (field) { return Version.fromJSONField(field); },
767
+ fromJSON: function (json) { return Version.fromJSON(json); },
768
+ fromSuiParsedData: function (content) { return Version.fromSuiParsedData(content); },
769
+ fromSuiObjectData: function (content) { return Version.fromSuiObjectData(content); },
790
770
  fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
791
- return [2 /*return*/, ProtocolFeeEvent.fetch(client, id)];
771
+ return [2 /*return*/, Version.fetch(client, id)];
792
772
  }); }); },
793
773
  new: function (fields) {
794
- return new ProtocolFeeEvent([], fields);
774
+ return new Version([], fields);
795
775
  },
796
776
  kind: "StructClassReified",
797
777
  };
798
778
  };
799
- Object.defineProperty(ProtocolFeeEvent, "r", {
779
+ Object.defineProperty(Version, "r", {
800
780
  get: function () {
801
- return ProtocolFeeEvent.reified();
781
+ return Version.reified();
802
782
  },
803
783
  enumerable: false,
804
784
  configurable: true
805
785
  });
806
- ProtocolFeeEvent.phantom = function () {
807
- return (0, reified_1.phantom)(ProtocolFeeEvent.reified());
786
+ Version.phantom = function () {
787
+ return (0, reified_1.phantom)(Version.reified());
808
788
  };
809
- Object.defineProperty(ProtocolFeeEvent, "p", {
789
+ Object.defineProperty(Version, "p", {
810
790
  get: function () {
811
- return ProtocolFeeEvent.phantom();
791
+ return Version.phantom();
812
792
  },
813
793
  enumerable: false,
814
794
  configurable: true
815
795
  });
816
- Object.defineProperty(ProtocolFeeEvent, "bcs", {
796
+ Object.defineProperty(Version, "bcs", {
817
797
  get: function () {
818
- return bcs_1.bcs.struct("ProtocolFeeEvent", {
819
- token: structs_1.TypeName.bcs,
820
- amount: bcs_1.bcs.u64(),
798
+ return bcs_1.bcs.struct("Version", {
799
+ id: structs_2.UID.bcs,
800
+ value: bcs_1.bcs.u64(),
801
+ fee_pool: FeePool.bcs,
802
+ liquidator_fee_pool: FeePool.bcs,
803
+ authority: structs_3.VecSet.bcs(bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } })),
804
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
821
805
  });
822
806
  },
823
807
  enumerable: false,
824
808
  configurable: true
825
809
  });
826
- ProtocolFeeEvent.fromFields = function (fields) {
827
- return ProtocolFeeEvent.reified().new({
828
- token: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token),
829
- amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
810
+ Version.fromFields = function (fields) {
811
+ return Version.reified().new({
812
+ id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
813
+ value: (0, reified_1.decodeFromFields)("u64", fields.value),
814
+ feePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.fee_pool),
815
+ liquidatorFeePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.liquidator_fee_pool),
816
+ authority: (0, reified_1.decodeFromFields)(structs_3.VecSet.reified("address"), fields.authority),
817
+ u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
830
818
  });
831
819
  };
832
- ProtocolFeeEvent.fromFieldsWithTypes = function (item) {
833
- if (!isProtocolFeeEvent(item.type)) {
834
- throw new Error("not a ProtocolFeeEvent type");
820
+ Version.fromFieldsWithTypes = function (item) {
821
+ if (!isVersion(item.type)) {
822
+ throw new Error("not a Version type");
835
823
  }
836
- return ProtocolFeeEvent.reified().new({
837
- token: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token),
838
- amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
824
+ return Version.reified().new({
825
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
826
+ value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
827
+ feePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.fee_pool),
828
+ liquidatorFeePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.liquidator_fee_pool),
829
+ authority: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecSet.reified("address"), item.fields.authority),
830
+ u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
839
831
  });
840
832
  };
841
- ProtocolFeeEvent.fromBcs = function (data) {
842
- return ProtocolFeeEvent.fromFields(ProtocolFeeEvent.bcs.parse(data));
833
+ Version.fromBcs = function (data) {
834
+ return Version.fromFields(Version.bcs.parse(data));
843
835
  };
844
- ProtocolFeeEvent.prototype.toJSONField = function () {
836
+ Version.prototype.toJSONField = function () {
845
837
  return {
846
- token: this.token.toJSONField(),
847
- amount: this.amount.toString(),
838
+ id: this.id,
839
+ value: this.value.toString(),
840
+ feePool: this.feePool.toJSONField(),
841
+ liquidatorFeePool: this.liquidatorFeePool.toJSONField(),
842
+ authority: this.authority.toJSONField(),
843
+ u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
848
844
  };
849
845
  };
850
- ProtocolFeeEvent.prototype.toJSON = function () {
846
+ Version.prototype.toJSON = function () {
851
847
  return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
852
848
  };
853
- ProtocolFeeEvent.fromJSONField = function (field) {
854
- return ProtocolFeeEvent.reified().new({
855
- token: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.token),
856
- amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
849
+ Version.fromJSONField = function (field) {
850
+ return Version.reified().new({
851
+ id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
852
+ value: (0, reified_1.decodeFromJSONField)("u64", field.value),
853
+ feePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.feePool),
854
+ liquidatorFeePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.liquidatorFeePool),
855
+ authority: (0, reified_1.decodeFromJSONField)(structs_3.VecSet.reified("address"), field.authority),
856
+ u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
857
857
  });
858
858
  };
859
- ProtocolFeeEvent.fromJSON = function (json) {
860
- if (json.$typeName !== ProtocolFeeEvent.$typeName) {
859
+ Version.fromJSON = function (json) {
860
+ if (json.$typeName !== Version.$typeName) {
861
861
  throw new Error("not a WithTwoGenerics json object");
862
862
  }
863
- return ProtocolFeeEvent.fromJSONField(json);
863
+ return Version.fromJSONField(json);
864
864
  };
865
- ProtocolFeeEvent.fromSuiParsedData = function (content) {
865
+ Version.fromSuiParsedData = function (content) {
866
866
  if (content.dataType !== "moveObject") {
867
867
  throw new Error("not an object");
868
868
  }
869
- if (!isProtocolFeeEvent(content.type)) {
870
- throw new Error("object at ".concat(content.fields.id, " is not a ProtocolFeeEvent object"));
869
+ if (!isVersion(content.type)) {
870
+ throw new Error("object at ".concat(content.fields.id, " is not a Version object"));
871
871
  }
872
- return ProtocolFeeEvent.fromFieldsWithTypes(content);
872
+ return Version.fromFieldsWithTypes(content);
873
873
  };
874
- ProtocolFeeEvent.fromSuiObjectData = function (data) {
874
+ Version.fromSuiObjectData = function (data) {
875
875
  if (data.bcs) {
876
- if (data.bcs.dataType !== "moveObject" || !isProtocolFeeEvent(data.bcs.type)) {
877
- throw new Error("object at is not a ProtocolFeeEvent object");
876
+ if (data.bcs.dataType !== "moveObject" || !isVersion(data.bcs.type)) {
877
+ throw new Error("object at is not a Version object");
878
878
  }
879
- return ProtocolFeeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
879
+ return Version.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
880
880
  }
881
881
  if (data.content) {
882
- return ProtocolFeeEvent.fromSuiParsedData(data.content);
882
+ return Version.fromSuiParsedData(data.content);
883
883
  }
884
884
  throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
885
885
  };
886
- ProtocolFeeEvent.fetch = function (client, id) {
886
+ Version.fetch = function (client, id) {
887
887
  return __awaiter(this, void 0, void 0, function () {
888
888
  var res;
889
889
  var _a, _b;
@@ -893,19 +893,19 @@ var ProtocolFeeEvent = /** @class */ (function () {
893
893
  case 1:
894
894
  res = _c.sent();
895
895
  if (res.error) {
896
- throw new Error("error fetching ProtocolFeeEvent object at id ".concat(id, ": ").concat(res.error.code));
896
+ throw new Error("error fetching Version object at id ".concat(id, ": ").concat(res.error.code));
897
897
  }
898
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isProtocolFeeEvent(res.data.bcs.type)) {
899
- throw new Error("object at id ".concat(id, " is not a ProtocolFeeEvent object"));
898
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isVersion(res.data.bcs.type)) {
899
+ throw new Error("object at id ".concat(id, " is not a Version object"));
900
900
  }
901
- return [2 /*return*/, ProtocolFeeEvent.fromSuiObjectData(res.data)];
901
+ return [2 /*return*/, Version.fromSuiObjectData(res.data)];
902
902
  }
903
903
  });
904
904
  });
905
905
  };
906
- ProtocolFeeEvent.$typeName = "".concat(index_1.PKG_V1, "::admin::ProtocolFeeEvent");
907
- ProtocolFeeEvent.$numTypeParams = 0;
908
- ProtocolFeeEvent.$isPhantom = [];
909
- return ProtocolFeeEvent;
906
+ Version.$typeName = "".concat(index_1.PKG_V1, "::admin::Version");
907
+ Version.$numTypeParams = 0;
908
+ Version.$isPhantom = [];
909
+ return Version;
910
910
  }());
911
- exports.ProtocolFeeEvent = ProtocolFeeEvent;
911
+ exports.Version = Version;