@typus/typus-perp-sdk 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/fetch.d.ts +3 -0
- package/dist/src/fetch.js +3 -1
- package/dist/src/typus_perp/admin/functions.d.ts +25 -25
- package/dist/src/typus_perp/admin/functions.js +66 -53
- package/dist/src/typus_perp/admin/structs.d.ts +222 -222
- package/dist/src/typus_perp/admin/structs.js +256 -256
- package/dist/src/typus_perp/error/functions.d.ts +67 -67
- package/dist/src/typus_perp/error/functions.js +201 -134
- package/dist/src/typus_perp/escrow/functions.d.ts +3 -3
- package/dist/src/typus_perp/escrow/functions.js +9 -6
- package/dist/src/typus_perp/lending/functions.d.ts +15 -0
- package/dist/src/typus_perp/lending/functions.js +22 -0
- package/dist/src/typus_perp/lp-pool/functions.d.ts +102 -63
- package/dist/src/typus_perp/lp-pool/functions.js +243 -123
- package/dist/src/typus_perp/lp-pool/structs.d.ts +616 -348
- package/dist/src/typus_perp/lp-pool/structs.js +1202 -768
- package/dist/src/typus_perp/math/functions.d.ts +16 -5
- package/dist/src/typus_perp/math/functions.js +33 -12
- package/dist/src/typus_perp/position/functions.d.ts +86 -86
- package/dist/src/typus_perp/position/functions.js +223 -157
- package/dist/src/typus_perp/symbol/functions.d.ts +4 -4
- package/dist/src/typus_perp/symbol/functions.js +14 -10
- package/dist/src/typus_perp/tlp/functions.d.ts +5 -5
- package/dist/src/typus_perp/tlp/functions.js +17 -12
- package/dist/src/typus_perp/token-interface/functions.d.ts +2 -2
- package/dist/src/typus_perp/token-interface/functions.js +6 -4
- package/dist/src/typus_perp/trading/functions.d.ts +75 -75
- package/dist/src/typus_perp/trading/functions.js +189 -138
- package/dist/src/typus_perp/trading/structs.d.ts +6 -0
- package/dist/src/typus_perp/trading/structs.js +6 -0
- package/dist/src/typus_perp/treasury-caps/functions.d.ts +4 -4
- package/dist/src/typus_perp/treasury-caps/functions.js +14 -10
- 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.
|
|
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
|
-
/* ==============================
|
|
760
|
-
function
|
|
735
|
+
/* ============================== Version =============================== */
|
|
736
|
+
function isVersion(type) {
|
|
761
737
|
type = (0, util_1.compressSuiType)(type);
|
|
762
|
-
return type === "".concat(index_1.PKG_V1, "::admin::
|
|
738
|
+
return type === "".concat(index_1.PKG_V1, "::admin::Version");
|
|
763
739
|
}
|
|
764
|
-
var
|
|
765
|
-
function
|
|
740
|
+
var Version = /** @class */ (function () {
|
|
741
|
+
function Version(typeArgs, fields) {
|
|
766
742
|
this.__StructClass = true;
|
|
767
|
-
this.$typeName =
|
|
768
|
-
this.$isPhantom =
|
|
769
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
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.
|
|
772
|
-
this.
|
|
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
|
-
|
|
754
|
+
Version.reified = function () {
|
|
775
755
|
var _this = this;
|
|
776
756
|
return {
|
|
777
|
-
typeName:
|
|
778
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
757
|
+
typeName: Version.$typeName,
|
|
758
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Version.$typeName], [], false)),
|
|
779
759
|
typeArgs: [],
|
|
780
|
-
isPhantom:
|
|
760
|
+
isPhantom: Version.$isPhantom,
|
|
781
761
|
reifiedTypeArgs: [],
|
|
782
|
-
fromFields: function (fields) { return
|
|
783
|
-
fromFieldsWithTypes: function (item) { return
|
|
784
|
-
fromBcs: function (data) { return
|
|
785
|
-
bcs:
|
|
786
|
-
fromJSONField: function (field) { return
|
|
787
|
-
fromJSON: function (json) { return
|
|
788
|
-
fromSuiParsedData: function (content) { return
|
|
789
|
-
fromSuiObjectData: function (content) { return
|
|
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*/,
|
|
771
|
+
return [2 /*return*/, Version.fetch(client, id)];
|
|
792
772
|
}); }); },
|
|
793
773
|
new: function (fields) {
|
|
794
|
-
return new
|
|
774
|
+
return new Version([], fields);
|
|
795
775
|
},
|
|
796
776
|
kind: "StructClassReified",
|
|
797
777
|
};
|
|
798
778
|
};
|
|
799
|
-
Object.defineProperty(
|
|
779
|
+
Object.defineProperty(Version, "r", {
|
|
800
780
|
get: function () {
|
|
801
|
-
return
|
|
781
|
+
return Version.reified();
|
|
802
782
|
},
|
|
803
783
|
enumerable: false,
|
|
804
784
|
configurable: true
|
|
805
785
|
});
|
|
806
|
-
|
|
807
|
-
return (0, reified_1.phantom)(
|
|
786
|
+
Version.phantom = function () {
|
|
787
|
+
return (0, reified_1.phantom)(Version.reified());
|
|
808
788
|
};
|
|
809
|
-
Object.defineProperty(
|
|
789
|
+
Object.defineProperty(Version, "p", {
|
|
810
790
|
get: function () {
|
|
811
|
-
return
|
|
791
|
+
return Version.phantom();
|
|
812
792
|
},
|
|
813
793
|
enumerable: false,
|
|
814
794
|
configurable: true
|
|
815
795
|
});
|
|
816
|
-
Object.defineProperty(
|
|
796
|
+
Object.defineProperty(Version, "bcs", {
|
|
817
797
|
get: function () {
|
|
818
|
-
return bcs_1.bcs.struct("
|
|
819
|
-
|
|
820
|
-
|
|
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
|
-
|
|
827
|
-
return
|
|
828
|
-
|
|
829
|
-
|
|
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
|
-
|
|
833
|
-
if (!
|
|
834
|
-
throw new Error("not a
|
|
820
|
+
Version.fromFieldsWithTypes = function (item) {
|
|
821
|
+
if (!isVersion(item.type)) {
|
|
822
|
+
throw new Error("not a Version type");
|
|
835
823
|
}
|
|
836
|
-
return
|
|
837
|
-
|
|
838
|
-
|
|
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
|
-
|
|
842
|
-
return
|
|
833
|
+
Version.fromBcs = function (data) {
|
|
834
|
+
return Version.fromFields(Version.bcs.parse(data));
|
|
843
835
|
};
|
|
844
|
-
|
|
836
|
+
Version.prototype.toJSONField = function () {
|
|
845
837
|
return {
|
|
846
|
-
|
|
847
|
-
|
|
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
|
-
|
|
846
|
+
Version.prototype.toJSON = function () {
|
|
851
847
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
852
848
|
};
|
|
853
|
-
|
|
854
|
-
return
|
|
855
|
-
|
|
856
|
-
|
|
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
|
-
|
|
860
|
-
if (json.$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
|
|
863
|
+
return Version.fromJSONField(json);
|
|
864
864
|
};
|
|
865
|
-
|
|
865
|
+
Version.fromSuiParsedData = function (content) {
|
|
866
866
|
if (content.dataType !== "moveObject") {
|
|
867
867
|
throw new Error("not an object");
|
|
868
868
|
}
|
|
869
|
-
if (!
|
|
870
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
869
|
+
if (!isVersion(content.type)) {
|
|
870
|
+
throw new Error("object at ".concat(content.fields.id, " is not a Version object"));
|
|
871
871
|
}
|
|
872
|
-
return
|
|
872
|
+
return Version.fromFieldsWithTypes(content);
|
|
873
873
|
};
|
|
874
|
-
|
|
874
|
+
Version.fromSuiObjectData = function (data) {
|
|
875
875
|
if (data.bcs) {
|
|
876
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
877
|
-
throw new Error("object at is not a
|
|
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
|
|
879
|
+
return Version.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
880
880
|
}
|
|
881
881
|
if (data.content) {
|
|
882
|
-
return
|
|
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
|
-
|
|
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
|
|
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" || !
|
|
899
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
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*/,
|
|
901
|
+
return [2 /*return*/, Version.fromSuiObjectData(res.data)];
|
|
902
902
|
}
|
|
903
903
|
});
|
|
904
904
|
});
|
|
905
905
|
};
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
return
|
|
906
|
+
Version.$typeName = "".concat(index_1.PKG_V1, "::admin::Version");
|
|
907
|
+
Version.$numTypeParams = 0;
|
|
908
|
+
Version.$isPhantom = [];
|
|
909
|
+
return Version;
|
|
910
910
|
}());
|
|
911
|
-
exports.
|
|
911
|
+
exports.Version = Version;
|