@typus/typus-perp-sdk 1.1.19 → 1.1.20

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.
@@ -105,11 +105,11 @@ 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.Version = exports.SendFeeEvent = exports.FeePool = exports.FeeInfo = void 0;
109
- exports.isFeeInfo = isFeeInfo;
108
+ exports.SendFeeEvent = exports.FeeInfo = exports.FeePool = exports.Version = void 0;
109
+ exports.isVersion = isVersion;
110
110
  exports.isFeePool = isFeePool;
111
+ exports.isFeeInfo = isFeeInfo;
111
112
  exports.isSendFeeEvent = isSendFeeEvent;
112
- exports.isVersion = isVersion;
113
113
  var reified = __importStar(require("../../_framework/reified"));
114
114
  var structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
115
115
  var structs_2 = require("../../_dependencies/source/0x2/object/structs");
@@ -119,134 +119,165 @@ var util_1 = require("../../_framework/util");
119
119
  var index_1 = require("../index");
120
120
  var bcs_1 = require("@mysten/sui/bcs");
121
121
  var utils_1 = require("@mysten/sui/utils");
122
- /* ============================== FeeInfo =============================== */
123
- function isFeeInfo(type) {
122
+ /* ============================== Version =============================== */
123
+ function isVersion(type) {
124
124
  type = (0, util_1.compressSuiType)(type);
125
- return type === "".concat(index_1.PKG_V1, "::admin::FeeInfo");
125
+ return type === "".concat(index_1.PKG_V1, "::admin::Version");
126
126
  }
127
- var FeeInfo = /** @class */ (function () {
128
- function FeeInfo(typeArgs, fields) {
127
+ var Version = /** @class */ (function () {
128
+ function Version(typeArgs, fields) {
129
129
  this.__StructClass = true;
130
- this.$typeName = FeeInfo.$typeName;
131
- this.$isPhantom = FeeInfo.$isPhantom;
132
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([FeeInfo.$typeName], __read(typeArgs), false));
130
+ this.$typeName = Version.$typeName;
131
+ this.$isPhantom = Version.$isPhantom;
132
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], __read(typeArgs), false));
133
133
  this.$typeArgs = typeArgs;
134
- this.token = fields.token;
134
+ this.id = fields.id;
135
135
  this.value = fields.value;
136
+ this.feePool = fields.feePool;
137
+ this.liquidatorFeePool = fields.liquidatorFeePool;
138
+ this.authority = fields.authority;
139
+ this.u64Padding = fields.u64Padding;
136
140
  }
137
- FeeInfo.reified = function () {
141
+ Version.reified = function () {
138
142
  var _this = this;
143
+ var reifiedBcs = Version.bcs;
139
144
  return {
140
- typeName: FeeInfo.$typeName,
141
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([FeeInfo.$typeName], [], false)),
145
+ typeName: Version.$typeName,
146
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], [], false)),
142
147
  typeArgs: [],
143
- isPhantom: FeeInfo.$isPhantom,
148
+ isPhantom: Version.$isPhantom,
144
149
  reifiedTypeArgs: [],
145
- fromFields: function (fields) { return FeeInfo.fromFields(fields); },
146
- fromFieldsWithTypes: function (item) { return FeeInfo.fromFieldsWithTypes(item); },
147
- fromBcs: function (data) { return FeeInfo.fromBcs(data); },
148
- bcs: FeeInfo.bcs,
149
- fromJSONField: function (field) { return FeeInfo.fromJSONField(field); },
150
- fromJSON: function (json) { return FeeInfo.fromJSON(json); },
151
- fromSuiParsedData: function (content) { return FeeInfo.fromSuiParsedData(content); },
152
- fromSuiObjectData: function (content) { return FeeInfo.fromSuiObjectData(content); },
150
+ fromFields: function (fields) { return Version.fromFields(fields); },
151
+ fromFieldsWithTypes: function (item) { return Version.fromFieldsWithTypes(item); },
152
+ fromBcs: function (data) { return Version.fromFields(reifiedBcs.parse(data)); },
153
+ bcs: reifiedBcs,
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); },
153
158
  fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
154
- return [2 /*return*/, FeeInfo.fetch(client, id)];
159
+ return [2 /*return*/, Version.fetch(client, id)];
155
160
  }); }); },
156
161
  new: function (fields) {
157
- return new FeeInfo([], fields);
162
+ return new Version([], fields);
158
163
  },
159
164
  kind: "StructClassReified",
160
165
  };
161
166
  };
162
- Object.defineProperty(FeeInfo, "r", {
167
+ Object.defineProperty(Version, "r", {
163
168
  get: function () {
164
- return FeeInfo.reified();
169
+ return Version.reified();
165
170
  },
166
171
  enumerable: false,
167
172
  configurable: true
168
173
  });
169
- FeeInfo.phantom = function () {
170
- return (0, reified_1.phantom)(FeeInfo.reified());
174
+ Version.phantom = function () {
175
+ return (0, reified_1.phantom)(Version.reified());
171
176
  };
172
- Object.defineProperty(FeeInfo, "p", {
177
+ Object.defineProperty(Version, "p", {
173
178
  get: function () {
174
- return FeeInfo.phantom();
179
+ return Version.phantom();
175
180
  },
176
181
  enumerable: false,
177
182
  configurable: true
178
183
  });
179
- Object.defineProperty(FeeInfo, "bcs", {
184
+ Version.instantiateBcs = function () {
185
+ return bcs_1.bcs.struct("Version", {
186
+ id: structs_2.UID.bcs,
187
+ value: bcs_1.bcs.u64(),
188
+ fee_pool: FeePool.bcs,
189
+ liquidator_fee_pool: FeePool.bcs,
190
+ 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); } })),
191
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
192
+ });
193
+ };
194
+ Object.defineProperty(Version, "bcs", {
180
195
  get: function () {
181
- return bcs_1.bcs.struct("FeeInfo", {
182
- token: structs_1.TypeName.bcs,
183
- value: bcs_1.bcs.u64(),
184
- });
196
+ if (!Version.cachedBcs) {
197
+ Version.cachedBcs = Version.instantiateBcs();
198
+ }
199
+ return Version.cachedBcs;
185
200
  },
186
201
  enumerable: false,
187
202
  configurable: true
188
203
  });
189
- FeeInfo.fromFields = function (fields) {
190
- return FeeInfo.reified().new({
191
- token: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token),
204
+ Version.fromFields = function (fields) {
205
+ return Version.reified().new({
206
+ id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
192
207
  value: (0, reified_1.decodeFromFields)("u64", fields.value),
208
+ feePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.fee_pool),
209
+ liquidatorFeePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.liquidator_fee_pool),
210
+ authority: (0, reified_1.decodeFromFields)(structs_3.VecSet.reified("address"), fields.authority),
211
+ u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
193
212
  });
194
213
  };
195
- FeeInfo.fromFieldsWithTypes = function (item) {
196
- if (!isFeeInfo(item.type)) {
197
- throw new Error("not a FeeInfo type");
214
+ Version.fromFieldsWithTypes = function (item) {
215
+ if (!isVersion(item.type)) {
216
+ throw new Error("not a Version type");
198
217
  }
199
- return FeeInfo.reified().new({
200
- token: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token),
218
+ return Version.reified().new({
219
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
201
220
  value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
221
+ feePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.fee_pool),
222
+ liquidatorFeePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.liquidator_fee_pool),
223
+ authority: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecSet.reified("address"), item.fields.authority),
224
+ u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
202
225
  });
203
226
  };
204
- FeeInfo.fromBcs = function (data) {
205
- return FeeInfo.fromFields(FeeInfo.bcs.parse(data));
227
+ Version.fromBcs = function (data) {
228
+ return Version.fromFields(Version.bcs.parse(data));
206
229
  };
207
- FeeInfo.prototype.toJSONField = function () {
230
+ Version.prototype.toJSONField = function () {
208
231
  return {
209
- token: this.token.toJSONField(),
232
+ id: this.id,
210
233
  value: this.value.toString(),
234
+ feePool: this.feePool.toJSONField(),
235
+ liquidatorFeePool: this.liquidatorFeePool.toJSONField(),
236
+ authority: this.authority.toJSONField(),
237
+ u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
211
238
  };
212
239
  };
213
- FeeInfo.prototype.toJSON = function () {
240
+ Version.prototype.toJSON = function () {
214
241
  return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
215
242
  };
216
- FeeInfo.fromJSONField = function (field) {
217
- return FeeInfo.reified().new({
218
- token: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.token),
243
+ Version.fromJSONField = function (field) {
244
+ return Version.reified().new({
245
+ id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
219
246
  value: (0, reified_1.decodeFromJSONField)("u64", field.value),
247
+ feePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.feePool),
248
+ liquidatorFeePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.liquidatorFeePool),
249
+ authority: (0, reified_1.decodeFromJSONField)(structs_3.VecSet.reified("address"), field.authority),
250
+ u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
220
251
  });
221
252
  };
222
- FeeInfo.fromJSON = function (json) {
223
- if (json.$typeName !== FeeInfo.$typeName) {
253
+ Version.fromJSON = function (json) {
254
+ if (json.$typeName !== Version.$typeName) {
224
255
  throw new Error("not a WithTwoGenerics json object");
225
256
  }
226
- return FeeInfo.fromJSONField(json);
257
+ return Version.fromJSONField(json);
227
258
  };
228
- FeeInfo.fromSuiParsedData = function (content) {
259
+ Version.fromSuiParsedData = function (content) {
229
260
  if (content.dataType !== "moveObject") {
230
261
  throw new Error("not an object");
231
262
  }
232
- if (!isFeeInfo(content.type)) {
233
- throw new Error("object at ".concat(content.fields.id, " is not a FeeInfo object"));
263
+ if (!isVersion(content.type)) {
264
+ throw new Error("object at ".concat(content.fields.id, " is not a Version object"));
234
265
  }
235
- return FeeInfo.fromFieldsWithTypes(content);
266
+ return Version.fromFieldsWithTypes(content);
236
267
  };
237
- FeeInfo.fromSuiObjectData = function (data) {
268
+ Version.fromSuiObjectData = function (data) {
238
269
  if (data.bcs) {
239
- if (data.bcs.dataType !== "moveObject" || !isFeeInfo(data.bcs.type)) {
240
- throw new Error("object at is not a FeeInfo object");
270
+ if (data.bcs.dataType !== "moveObject" || !isVersion(data.bcs.type)) {
271
+ throw new Error("object at is not a Version object");
241
272
  }
242
- return FeeInfo.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
273
+ return Version.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
243
274
  }
244
275
  if (data.content) {
245
- return FeeInfo.fromSuiParsedData(data.content);
276
+ return Version.fromSuiParsedData(data.content);
246
277
  }
247
278
  throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
248
279
  };
249
- FeeInfo.fetch = function (client, id) {
280
+ Version.fetch = function (client, id) {
250
281
  return __awaiter(this, void 0, void 0, function () {
251
282
  var res;
252
283
  var _a, _b;
@@ -256,22 +287,23 @@ var FeeInfo = /** @class */ (function () {
256
287
  case 1:
257
288
  res = _c.sent();
258
289
  if (res.error) {
259
- throw new Error("error fetching FeeInfo object at id ".concat(id, ": ").concat(res.error.code));
290
+ throw new Error("error fetching Version object at id ".concat(id, ": ").concat(res.error.code));
260
291
  }
261
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isFeeInfo(res.data.bcs.type)) {
262
- throw new Error("object at id ".concat(id, " is not a FeeInfo object"));
292
+ 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)) {
293
+ throw new Error("object at id ".concat(id, " is not a Version object"));
263
294
  }
264
- return [2 /*return*/, FeeInfo.fromSuiObjectData(res.data)];
295
+ return [2 /*return*/, Version.fromSuiObjectData(res.data)];
265
296
  }
266
297
  });
267
298
  });
268
299
  };
269
- FeeInfo.$typeName = "".concat(index_1.PKG_V1, "::admin::FeeInfo");
270
- FeeInfo.$numTypeParams = 0;
271
- FeeInfo.$isPhantom = [];
272
- return FeeInfo;
300
+ Version.$typeName = "".concat(index_1.PKG_V1, "::admin::Version");
301
+ Version.$numTypeParams = 0;
302
+ Version.$isPhantom = [];
303
+ Version.cachedBcs = null;
304
+ return Version;
273
305
  }());
274
- exports.FeeInfo = FeeInfo;
306
+ exports.Version = Version;
275
307
  /* ============================== FeePool =============================== */
276
308
  function isFeePool(type) {
277
309
  type = (0, util_1.compressSuiType)(type);
@@ -289,6 +321,7 @@ var FeePool = /** @class */ (function () {
289
321
  }
290
322
  FeePool.reified = function () {
291
323
  var _this = this;
324
+ var reifiedBcs = FeePool.bcs;
292
325
  return {
293
326
  typeName: FeePool.$typeName,
294
327
  fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([FeePool.$typeName], [], false)),
@@ -297,8 +330,8 @@ var FeePool = /** @class */ (function () {
297
330
  reifiedTypeArgs: [],
298
331
  fromFields: function (fields) { return FeePool.fromFields(fields); },
299
332
  fromFieldsWithTypes: function (item) { return FeePool.fromFieldsWithTypes(item); },
300
- fromBcs: function (data) { return FeePool.fromBcs(data); },
301
- bcs: FeePool.bcs,
333
+ fromBcs: function (data) { return FeePool.fromFields(reifiedBcs.parse(data)); },
334
+ bcs: reifiedBcs,
302
335
  fromJSONField: function (field) { return FeePool.fromJSONField(field); },
303
336
  fromJSON: function (json) { return FeePool.fromJSON(json); },
304
337
  fromSuiParsedData: function (content) { return FeePool.fromSuiParsedData(content); },
@@ -329,12 +362,18 @@ var FeePool = /** @class */ (function () {
329
362
  enumerable: false,
330
363
  configurable: true
331
364
  });
365
+ FeePool.instantiateBcs = function () {
366
+ return bcs_1.bcs.struct("FeePool", {
367
+ id: structs_2.UID.bcs,
368
+ fee_infos: bcs_1.bcs.vector(FeeInfo.bcs),
369
+ });
370
+ };
332
371
  Object.defineProperty(FeePool, "bcs", {
333
372
  get: function () {
334
- return bcs_1.bcs.struct("FeePool", {
335
- id: structs_2.UID.bcs,
336
- fee_infos: bcs_1.bcs.vector(FeeInfo.bcs),
337
- });
373
+ if (!FeePool.cachedBcs) {
374
+ FeePool.cachedBcs = FeePool.instantiateBcs();
375
+ }
376
+ return FeePool.cachedBcs;
338
377
  },
339
378
  enumerable: false,
340
379
  configurable: true
@@ -422,137 +461,145 @@ var FeePool = /** @class */ (function () {
422
461
  FeePool.$typeName = "".concat(index_1.PKG_V1, "::admin::FeePool");
423
462
  FeePool.$numTypeParams = 0;
424
463
  FeePool.$isPhantom = [];
464
+ FeePool.cachedBcs = null;
425
465
  return FeePool;
426
466
  }());
427
467
  exports.FeePool = FeePool;
428
- /* ============================== SendFeeEvent =============================== */
429
- function isSendFeeEvent(type) {
468
+ /* ============================== FeeInfo =============================== */
469
+ function isFeeInfo(type) {
430
470
  type = (0, util_1.compressSuiType)(type);
431
- return type === "".concat(index_1.PKG_V1, "::admin::SendFeeEvent");
471
+ return type === "".concat(index_1.PKG_V1, "::admin::FeeInfo");
432
472
  }
433
- var SendFeeEvent = /** @class */ (function () {
434
- function SendFeeEvent(typeArgs, fields) {
473
+ var FeeInfo = /** @class */ (function () {
474
+ function FeeInfo(typeArgs, fields) {
435
475
  this.__StructClass = true;
436
- this.$typeName = SendFeeEvent.$typeName;
437
- this.$isPhantom = SendFeeEvent.$isPhantom;
438
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([SendFeeEvent.$typeName], __read(typeArgs), false));
476
+ this.$typeName = FeeInfo.$typeName;
477
+ this.$isPhantom = FeeInfo.$isPhantom;
478
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([FeeInfo.$typeName], __read(typeArgs), false));
439
479
  this.$typeArgs = typeArgs;
440
480
  this.token = fields.token;
441
- this.amount = fields.amount;
481
+ this.value = fields.value;
442
482
  }
443
- SendFeeEvent.reified = function () {
483
+ FeeInfo.reified = function () {
444
484
  var _this = this;
485
+ var reifiedBcs = FeeInfo.bcs;
445
486
  return {
446
- typeName: SendFeeEvent.$typeName,
447
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([SendFeeEvent.$typeName], [], false)),
487
+ typeName: FeeInfo.$typeName,
488
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([FeeInfo.$typeName], [], false)),
448
489
  typeArgs: [],
449
- isPhantom: SendFeeEvent.$isPhantom,
490
+ isPhantom: FeeInfo.$isPhantom,
450
491
  reifiedTypeArgs: [],
451
- fromFields: function (fields) { return SendFeeEvent.fromFields(fields); },
452
- fromFieldsWithTypes: function (item) { return SendFeeEvent.fromFieldsWithTypes(item); },
453
- fromBcs: function (data) { return SendFeeEvent.fromBcs(data); },
454
- bcs: SendFeeEvent.bcs,
455
- fromJSONField: function (field) { return SendFeeEvent.fromJSONField(field); },
456
- fromJSON: function (json) { return SendFeeEvent.fromJSON(json); },
457
- fromSuiParsedData: function (content) { return SendFeeEvent.fromSuiParsedData(content); },
458
- fromSuiObjectData: function (content) { return SendFeeEvent.fromSuiObjectData(content); },
492
+ fromFields: function (fields) { return FeeInfo.fromFields(fields); },
493
+ fromFieldsWithTypes: function (item) { return FeeInfo.fromFieldsWithTypes(item); },
494
+ fromBcs: function (data) { return FeeInfo.fromFields(reifiedBcs.parse(data)); },
495
+ bcs: reifiedBcs,
496
+ fromJSONField: function (field) { return FeeInfo.fromJSONField(field); },
497
+ fromJSON: function (json) { return FeeInfo.fromJSON(json); },
498
+ fromSuiParsedData: function (content) { return FeeInfo.fromSuiParsedData(content); },
499
+ fromSuiObjectData: function (content) { return FeeInfo.fromSuiObjectData(content); },
459
500
  fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
460
- return [2 /*return*/, SendFeeEvent.fetch(client, id)];
501
+ return [2 /*return*/, FeeInfo.fetch(client, id)];
461
502
  }); }); },
462
503
  new: function (fields) {
463
- return new SendFeeEvent([], fields);
504
+ return new FeeInfo([], fields);
464
505
  },
465
506
  kind: "StructClassReified",
466
507
  };
467
508
  };
468
- Object.defineProperty(SendFeeEvent, "r", {
509
+ Object.defineProperty(FeeInfo, "r", {
469
510
  get: function () {
470
- return SendFeeEvent.reified();
511
+ return FeeInfo.reified();
471
512
  },
472
513
  enumerable: false,
473
514
  configurable: true
474
515
  });
475
- SendFeeEvent.phantom = function () {
476
- return (0, reified_1.phantom)(SendFeeEvent.reified());
516
+ FeeInfo.phantom = function () {
517
+ return (0, reified_1.phantom)(FeeInfo.reified());
477
518
  };
478
- Object.defineProperty(SendFeeEvent, "p", {
519
+ Object.defineProperty(FeeInfo, "p", {
479
520
  get: function () {
480
- return SendFeeEvent.phantom();
521
+ return FeeInfo.phantom();
481
522
  },
482
523
  enumerable: false,
483
524
  configurable: true
484
525
  });
485
- Object.defineProperty(SendFeeEvent, "bcs", {
526
+ FeeInfo.instantiateBcs = function () {
527
+ return bcs_1.bcs.struct("FeeInfo", {
528
+ token: structs_1.TypeName.bcs,
529
+ value: bcs_1.bcs.u64(),
530
+ });
531
+ };
532
+ Object.defineProperty(FeeInfo, "bcs", {
486
533
  get: function () {
487
- return bcs_1.bcs.struct("SendFeeEvent", {
488
- token: structs_1.TypeName.bcs,
489
- amount: bcs_1.bcs.u64(),
490
- });
534
+ if (!FeeInfo.cachedBcs) {
535
+ FeeInfo.cachedBcs = FeeInfo.instantiateBcs();
536
+ }
537
+ return FeeInfo.cachedBcs;
491
538
  },
492
539
  enumerable: false,
493
540
  configurable: true
494
541
  });
495
- SendFeeEvent.fromFields = function (fields) {
496
- return SendFeeEvent.reified().new({
542
+ FeeInfo.fromFields = function (fields) {
543
+ return FeeInfo.reified().new({
497
544
  token: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token),
498
- amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
545
+ value: (0, reified_1.decodeFromFields)("u64", fields.value),
499
546
  });
500
547
  };
501
- SendFeeEvent.fromFieldsWithTypes = function (item) {
502
- if (!isSendFeeEvent(item.type)) {
503
- throw new Error("not a SendFeeEvent type");
548
+ FeeInfo.fromFieldsWithTypes = function (item) {
549
+ if (!isFeeInfo(item.type)) {
550
+ throw new Error("not a FeeInfo type");
504
551
  }
505
- return SendFeeEvent.reified().new({
552
+ return FeeInfo.reified().new({
506
553
  token: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token),
507
- amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
554
+ value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
508
555
  });
509
556
  };
510
- SendFeeEvent.fromBcs = function (data) {
511
- return SendFeeEvent.fromFields(SendFeeEvent.bcs.parse(data));
557
+ FeeInfo.fromBcs = function (data) {
558
+ return FeeInfo.fromFields(FeeInfo.bcs.parse(data));
512
559
  };
513
- SendFeeEvent.prototype.toJSONField = function () {
560
+ FeeInfo.prototype.toJSONField = function () {
514
561
  return {
515
562
  token: this.token.toJSONField(),
516
- amount: this.amount.toString(),
563
+ value: this.value.toString(),
517
564
  };
518
565
  };
519
- SendFeeEvent.prototype.toJSON = function () {
566
+ FeeInfo.prototype.toJSON = function () {
520
567
  return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
521
568
  };
522
- SendFeeEvent.fromJSONField = function (field) {
523
- return SendFeeEvent.reified().new({
569
+ FeeInfo.fromJSONField = function (field) {
570
+ return FeeInfo.reified().new({
524
571
  token: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.token),
525
- amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
572
+ value: (0, reified_1.decodeFromJSONField)("u64", field.value),
526
573
  });
527
574
  };
528
- SendFeeEvent.fromJSON = function (json) {
529
- if (json.$typeName !== SendFeeEvent.$typeName) {
575
+ FeeInfo.fromJSON = function (json) {
576
+ if (json.$typeName !== FeeInfo.$typeName) {
530
577
  throw new Error("not a WithTwoGenerics json object");
531
578
  }
532
- return SendFeeEvent.fromJSONField(json);
579
+ return FeeInfo.fromJSONField(json);
533
580
  };
534
- SendFeeEvent.fromSuiParsedData = function (content) {
581
+ FeeInfo.fromSuiParsedData = function (content) {
535
582
  if (content.dataType !== "moveObject") {
536
583
  throw new Error("not an object");
537
584
  }
538
- if (!isSendFeeEvent(content.type)) {
539
- throw new Error("object at ".concat(content.fields.id, " is not a SendFeeEvent object"));
585
+ if (!isFeeInfo(content.type)) {
586
+ throw new Error("object at ".concat(content.fields.id, " is not a FeeInfo object"));
540
587
  }
541
- return SendFeeEvent.fromFieldsWithTypes(content);
588
+ return FeeInfo.fromFieldsWithTypes(content);
542
589
  };
543
- SendFeeEvent.fromSuiObjectData = function (data) {
590
+ FeeInfo.fromSuiObjectData = function (data) {
544
591
  if (data.bcs) {
545
- if (data.bcs.dataType !== "moveObject" || !isSendFeeEvent(data.bcs.type)) {
546
- throw new Error("object at is not a SendFeeEvent object");
592
+ if (data.bcs.dataType !== "moveObject" || !isFeeInfo(data.bcs.type)) {
593
+ throw new Error("object at is not a FeeInfo object");
547
594
  }
548
- return SendFeeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
595
+ return FeeInfo.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
549
596
  }
550
597
  if (data.content) {
551
- return SendFeeEvent.fromSuiParsedData(data.content);
598
+ return FeeInfo.fromSuiParsedData(data.content);
552
599
  }
553
600
  throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
554
601
  };
555
- SendFeeEvent.fetch = function (client, id) {
602
+ FeeInfo.fetch = function (client, id) {
556
603
  return __awaiter(this, void 0, void 0, function () {
557
604
  var res;
558
605
  var _a, _b;
@@ -562,174 +609,158 @@ var SendFeeEvent = /** @class */ (function () {
562
609
  case 1:
563
610
  res = _c.sent();
564
611
  if (res.error) {
565
- throw new Error("error fetching SendFeeEvent object at id ".concat(id, ": ").concat(res.error.code));
612
+ throw new Error("error fetching FeeInfo object at id ".concat(id, ": ").concat(res.error.code));
566
613
  }
567
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isSendFeeEvent(res.data.bcs.type)) {
568
- throw new Error("object at id ".concat(id, " is not a SendFeeEvent object"));
614
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isFeeInfo(res.data.bcs.type)) {
615
+ throw new Error("object at id ".concat(id, " is not a FeeInfo object"));
569
616
  }
570
- return [2 /*return*/, SendFeeEvent.fromSuiObjectData(res.data)];
617
+ return [2 /*return*/, FeeInfo.fromSuiObjectData(res.data)];
571
618
  }
572
619
  });
573
620
  });
574
621
  };
575
- SendFeeEvent.$typeName = "".concat(index_1.PKG_V1, "::admin::SendFeeEvent");
576
- SendFeeEvent.$numTypeParams = 0;
577
- SendFeeEvent.$isPhantom = [];
578
- return SendFeeEvent;
622
+ FeeInfo.$typeName = "".concat(index_1.PKG_V1, "::admin::FeeInfo");
623
+ FeeInfo.$numTypeParams = 0;
624
+ FeeInfo.$isPhantom = [];
625
+ FeeInfo.cachedBcs = null;
626
+ return FeeInfo;
579
627
  }());
580
- exports.SendFeeEvent = SendFeeEvent;
581
- /* ============================== Version =============================== */
582
- function isVersion(type) {
628
+ exports.FeeInfo = FeeInfo;
629
+ /* ============================== SendFeeEvent =============================== */
630
+ function isSendFeeEvent(type) {
583
631
  type = (0, util_1.compressSuiType)(type);
584
- return type === "".concat(index_1.PKG_V1, "::admin::Version");
632
+ return type === "".concat(index_1.PKG_V1, "::admin::SendFeeEvent");
585
633
  }
586
- var Version = /** @class */ (function () {
587
- function Version(typeArgs, fields) {
634
+ var SendFeeEvent = /** @class */ (function () {
635
+ function SendFeeEvent(typeArgs, fields) {
588
636
  this.__StructClass = true;
589
- this.$typeName = Version.$typeName;
590
- this.$isPhantom = Version.$isPhantom;
591
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], __read(typeArgs), false));
637
+ this.$typeName = SendFeeEvent.$typeName;
638
+ this.$isPhantom = SendFeeEvent.$isPhantom;
639
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([SendFeeEvent.$typeName], __read(typeArgs), false));
592
640
  this.$typeArgs = typeArgs;
593
- this.id = fields.id;
594
- this.value = fields.value;
595
- this.feePool = fields.feePool;
596
- this.liquidatorFeePool = fields.liquidatorFeePool;
597
- this.authority = fields.authority;
598
- this.u64Padding = fields.u64Padding;
641
+ this.token = fields.token;
642
+ this.amount = fields.amount;
599
643
  }
600
- Version.reified = function () {
644
+ SendFeeEvent.reified = function () {
601
645
  var _this = this;
646
+ var reifiedBcs = SendFeeEvent.bcs;
602
647
  return {
603
- typeName: Version.$typeName,
604
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], [], false)),
648
+ typeName: SendFeeEvent.$typeName,
649
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([SendFeeEvent.$typeName], [], false)),
605
650
  typeArgs: [],
606
- isPhantom: Version.$isPhantom,
651
+ isPhantom: SendFeeEvent.$isPhantom,
607
652
  reifiedTypeArgs: [],
608
- fromFields: function (fields) { return Version.fromFields(fields); },
609
- fromFieldsWithTypes: function (item) { return Version.fromFieldsWithTypes(item); },
610
- fromBcs: function (data) { return Version.fromBcs(data); },
611
- bcs: Version.bcs,
612
- fromJSONField: function (field) { return Version.fromJSONField(field); },
613
- fromJSON: function (json) { return Version.fromJSON(json); },
614
- fromSuiParsedData: function (content) { return Version.fromSuiParsedData(content); },
615
- fromSuiObjectData: function (content) { return Version.fromSuiObjectData(content); },
653
+ fromFields: function (fields) { return SendFeeEvent.fromFields(fields); },
654
+ fromFieldsWithTypes: function (item) { return SendFeeEvent.fromFieldsWithTypes(item); },
655
+ fromBcs: function (data) { return SendFeeEvent.fromFields(reifiedBcs.parse(data)); },
656
+ bcs: reifiedBcs,
657
+ fromJSONField: function (field) { return SendFeeEvent.fromJSONField(field); },
658
+ fromJSON: function (json) { return SendFeeEvent.fromJSON(json); },
659
+ fromSuiParsedData: function (content) { return SendFeeEvent.fromSuiParsedData(content); },
660
+ fromSuiObjectData: function (content) { return SendFeeEvent.fromSuiObjectData(content); },
616
661
  fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
617
- return [2 /*return*/, Version.fetch(client, id)];
662
+ return [2 /*return*/, SendFeeEvent.fetch(client, id)];
618
663
  }); }); },
619
664
  new: function (fields) {
620
- return new Version([], fields);
665
+ return new SendFeeEvent([], fields);
621
666
  },
622
667
  kind: "StructClassReified",
623
668
  };
624
669
  };
625
- Object.defineProperty(Version, "r", {
670
+ Object.defineProperty(SendFeeEvent, "r", {
626
671
  get: function () {
627
- return Version.reified();
672
+ return SendFeeEvent.reified();
628
673
  },
629
674
  enumerable: false,
630
675
  configurable: true
631
676
  });
632
- Version.phantom = function () {
633
- return (0, reified_1.phantom)(Version.reified());
677
+ SendFeeEvent.phantom = function () {
678
+ return (0, reified_1.phantom)(SendFeeEvent.reified());
634
679
  };
635
- Object.defineProperty(Version, "p", {
680
+ Object.defineProperty(SendFeeEvent, "p", {
636
681
  get: function () {
637
- return Version.phantom();
682
+ return SendFeeEvent.phantom();
638
683
  },
639
684
  enumerable: false,
640
685
  configurable: true
641
686
  });
642
- Object.defineProperty(Version, "bcs", {
687
+ SendFeeEvent.instantiateBcs = function () {
688
+ return bcs_1.bcs.struct("SendFeeEvent", {
689
+ token: structs_1.TypeName.bcs,
690
+ amount: bcs_1.bcs.u64(),
691
+ });
692
+ };
693
+ Object.defineProperty(SendFeeEvent, "bcs", {
643
694
  get: function () {
644
- return bcs_1.bcs.struct("Version", {
645
- id: structs_2.UID.bcs,
646
- value: bcs_1.bcs.u64(),
647
- fee_pool: FeePool.bcs,
648
- liquidator_fee_pool: FeePool.bcs,
649
- 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); } })),
650
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
651
- });
695
+ if (!SendFeeEvent.cachedBcs) {
696
+ SendFeeEvent.cachedBcs = SendFeeEvent.instantiateBcs();
697
+ }
698
+ return SendFeeEvent.cachedBcs;
652
699
  },
653
700
  enumerable: false,
654
701
  configurable: true
655
702
  });
656
- Version.fromFields = function (fields) {
657
- return Version.reified().new({
658
- id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
659
- value: (0, reified_1.decodeFromFields)("u64", fields.value),
660
- feePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.fee_pool),
661
- liquidatorFeePool: (0, reified_1.decodeFromFields)(FeePool.reified(), fields.liquidator_fee_pool),
662
- authority: (0, reified_1.decodeFromFields)(structs_3.VecSet.reified("address"), fields.authority),
663
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
703
+ SendFeeEvent.fromFields = function (fields) {
704
+ return SendFeeEvent.reified().new({
705
+ token: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token),
706
+ amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
664
707
  });
665
708
  };
666
- Version.fromFieldsWithTypes = function (item) {
667
- if (!isVersion(item.type)) {
668
- throw new Error("not a Version type");
709
+ SendFeeEvent.fromFieldsWithTypes = function (item) {
710
+ if (!isSendFeeEvent(item.type)) {
711
+ throw new Error("not a SendFeeEvent type");
669
712
  }
670
- return Version.reified().new({
671
- id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
672
- value: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value),
673
- feePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.fee_pool),
674
- liquidatorFeePool: (0, reified_1.decodeFromFieldsWithTypes)(FeePool.reified(), item.fields.liquidator_fee_pool),
675
- authority: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecSet.reified("address"), item.fields.authority),
676
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
713
+ return SendFeeEvent.reified().new({
714
+ token: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token),
715
+ amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
677
716
  });
678
717
  };
679
- Version.fromBcs = function (data) {
680
- return Version.fromFields(Version.bcs.parse(data));
718
+ SendFeeEvent.fromBcs = function (data) {
719
+ return SendFeeEvent.fromFields(SendFeeEvent.bcs.parse(data));
681
720
  };
682
- Version.prototype.toJSONField = function () {
721
+ SendFeeEvent.prototype.toJSONField = function () {
683
722
  return {
684
- id: this.id,
685
- value: this.value.toString(),
686
- feePool: this.feePool.toJSONField(),
687
- liquidatorFeePool: this.liquidatorFeePool.toJSONField(),
688
- authority: this.authority.toJSONField(),
689
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
723
+ token: this.token.toJSONField(),
724
+ amount: this.amount.toString(),
690
725
  };
691
726
  };
692
- Version.prototype.toJSON = function () {
727
+ SendFeeEvent.prototype.toJSON = function () {
693
728
  return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
694
729
  };
695
- Version.fromJSONField = function (field) {
696
- return Version.reified().new({
697
- id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
698
- value: (0, reified_1.decodeFromJSONField)("u64", field.value),
699
- feePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.feePool),
700
- liquidatorFeePool: (0, reified_1.decodeFromJSONField)(FeePool.reified(), field.liquidatorFeePool),
701
- authority: (0, reified_1.decodeFromJSONField)(structs_3.VecSet.reified("address"), field.authority),
702
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
730
+ SendFeeEvent.fromJSONField = function (field) {
731
+ return SendFeeEvent.reified().new({
732
+ token: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.token),
733
+ amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
703
734
  });
704
735
  };
705
- Version.fromJSON = function (json) {
706
- if (json.$typeName !== Version.$typeName) {
736
+ SendFeeEvent.fromJSON = function (json) {
737
+ if (json.$typeName !== SendFeeEvent.$typeName) {
707
738
  throw new Error("not a WithTwoGenerics json object");
708
739
  }
709
- return Version.fromJSONField(json);
740
+ return SendFeeEvent.fromJSONField(json);
710
741
  };
711
- Version.fromSuiParsedData = function (content) {
742
+ SendFeeEvent.fromSuiParsedData = function (content) {
712
743
  if (content.dataType !== "moveObject") {
713
744
  throw new Error("not an object");
714
745
  }
715
- if (!isVersion(content.type)) {
716
- throw new Error("object at ".concat(content.fields.id, " is not a Version object"));
746
+ if (!isSendFeeEvent(content.type)) {
747
+ throw new Error("object at ".concat(content.fields.id, " is not a SendFeeEvent object"));
717
748
  }
718
- return Version.fromFieldsWithTypes(content);
749
+ return SendFeeEvent.fromFieldsWithTypes(content);
719
750
  };
720
- Version.fromSuiObjectData = function (data) {
751
+ SendFeeEvent.fromSuiObjectData = function (data) {
721
752
  if (data.bcs) {
722
- if (data.bcs.dataType !== "moveObject" || !isVersion(data.bcs.type)) {
723
- throw new Error("object at is not a Version object");
753
+ if (data.bcs.dataType !== "moveObject" || !isSendFeeEvent(data.bcs.type)) {
754
+ throw new Error("object at is not a SendFeeEvent object");
724
755
  }
725
- return Version.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
756
+ return SendFeeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
726
757
  }
727
758
  if (data.content) {
728
- return Version.fromSuiParsedData(data.content);
759
+ return SendFeeEvent.fromSuiParsedData(data.content);
729
760
  }
730
761
  throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
731
762
  };
732
- Version.fetch = function (client, id) {
763
+ SendFeeEvent.fetch = function (client, id) {
733
764
  return __awaiter(this, void 0, void 0, function () {
734
765
  var res;
735
766
  var _a, _b;
@@ -739,19 +770,20 @@ var Version = /** @class */ (function () {
739
770
  case 1:
740
771
  res = _c.sent();
741
772
  if (res.error) {
742
- throw new Error("error fetching Version object at id ".concat(id, ": ").concat(res.error.code));
773
+ throw new Error("error fetching SendFeeEvent object at id ".concat(id, ": ").concat(res.error.code));
743
774
  }
744
- 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)) {
745
- throw new Error("object at id ".concat(id, " is not a Version object"));
775
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isSendFeeEvent(res.data.bcs.type)) {
776
+ throw new Error("object at id ".concat(id, " is not a SendFeeEvent object"));
746
777
  }
747
- return [2 /*return*/, Version.fromSuiObjectData(res.data)];
778
+ return [2 /*return*/, SendFeeEvent.fromSuiObjectData(res.data)];
748
779
  }
749
780
  });
750
781
  });
751
782
  };
752
- Version.$typeName = "".concat(index_1.PKG_V1, "::admin::Version");
753
- Version.$numTypeParams = 0;
754
- Version.$isPhantom = [];
755
- return Version;
783
+ SendFeeEvent.$typeName = "".concat(index_1.PKG_V1, "::admin::SendFeeEvent");
784
+ SendFeeEvent.$numTypeParams = 0;
785
+ SendFeeEvent.$isPhantom = [];
786
+ SendFeeEvent.cachedBcs = null;
787
+ return SendFeeEvent;
756
788
  }());
757
- exports.Version = Version;
789
+ exports.SendFeeEvent = SendFeeEvent;