@typus/typus-perp-sdk 1.0.2 → 1.0.4
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 +2 -0
- package/dist/src/fetch.js +28 -13
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +12 -2
- package/dist/src/typus_perp/admin/structs.d.ts +66 -4
- package/dist/src/typus_perp/admin/structs.js +155 -1
- package/dist/src/typus_perp/error/functions.d.ts +1 -0
- package/dist/src/typus_perp/error/functions.js +4 -0
- package/dist/src/typus_perp/escrow/structs.d.ts +1 -1
- package/dist/src/typus_perp/index.js +3 -3
- package/dist/src/typus_perp/init.js +2 -1
- package/dist/src/typus_perp/lp-pool/structs.d.ts +26 -26
- package/dist/src/typus_perp/oracle/structs.d.ts +2 -2
- package/dist/src/typus_perp/position/functions.d.ts +3 -0
- package/dist/src/typus_perp/position/functions.js +7 -1
- package/dist/src/typus_perp/position/structs.d.ts +24 -164
- package/dist/src/typus_perp/position/structs.js +19 -209
- package/dist/src/typus_perp/symbol/structs.d.ts +1 -1
- package/dist/src/typus_perp/tlp/structs.d.ts +2 -2
- package/dist/src/typus_perp/trading/structs.d.ts +173 -29
- package/dist/src/typus_perp/trading/structs.js +221 -1
- package/dist/src/typus_perp/treasury-caps/structs.d.ts +1 -1
- package/dist/src/typus_stake_pool/admin/structs.d.ts +4 -4
- package/dist/src/typus_stake_pool/index.js +3 -3
- package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +22 -22
- package/dist/src/user/history.js +94 -14
- package/dist/src/user/order.js +17 -11
- package/dist/src/user/orderWithBidReceipt.d.ts +2 -4
- package/dist/src/user/orderWithBidReceipt.js +9 -20
- package/dist/src/user/tlp.js +18 -18
- package/package.json +2 -1
|
@@ -105,12 +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.TradingOrder = exports.RemovePositionEvent = exports.
|
|
108
|
+
exports.TradingOrder = exports.RemovePositionEvent = exports.RealizeFundingEvent = exports.Position = exports.OrderFilledEvent = exports.OptionCollateralInfo = void 0;
|
|
109
109
|
exports.isOptionCollateralInfo = isOptionCollateralInfo;
|
|
110
110
|
exports.isOrderFilledEvent = isOrderFilledEvent;
|
|
111
111
|
exports.isPosition = isPosition;
|
|
112
112
|
exports.isRealizeFundingEvent = isRealizeFundingEvent;
|
|
113
|
-
exports.isRealizedPnlEvent = isRealizedPnlEvent;
|
|
114
113
|
exports.isRemovePositionEvent = isRemovePositionEvent;
|
|
115
114
|
exports.isTradingOrder = isTradingOrder;
|
|
116
115
|
var reified = __importStar(require("../../_framework/reified"));
|
|
@@ -308,6 +307,8 @@ var OrderFilledEvent = /** @class */ (function () {
|
|
|
308
307
|
this.realizedTradingFee = fields.realizedTradingFee;
|
|
309
308
|
this.realizedBorrowFee = fields.realizedBorrowFee;
|
|
310
309
|
this.realizedFeeInUsd = fields.realizedFeeInUsd;
|
|
310
|
+
this.realizedAmount = fields.realizedAmount;
|
|
311
|
+
this.realizedAmountSign = fields.realizedAmountSign;
|
|
311
312
|
this.u64Padding = fields.u64Padding;
|
|
312
313
|
}
|
|
313
314
|
OrderFilledEvent.reified = function () {
|
|
@@ -369,6 +370,8 @@ var OrderFilledEvent = /** @class */ (function () {
|
|
|
369
370
|
realized_trading_fee: bcs_1.bcs.u64(),
|
|
370
371
|
realized_borrow_fee: bcs_1.bcs.u64(),
|
|
371
372
|
realized_fee_in_usd: bcs_1.bcs.u64(),
|
|
373
|
+
realized_amount: bcs_1.bcs.u64(),
|
|
374
|
+
realized_amount_sign: bcs_1.bcs.bool(),
|
|
372
375
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
373
376
|
});
|
|
374
377
|
},
|
|
@@ -391,6 +394,8 @@ var OrderFilledEvent = /** @class */ (function () {
|
|
|
391
394
|
realizedTradingFee: (0, reified_1.decodeFromFields)("u64", fields.realized_trading_fee),
|
|
392
395
|
realizedBorrowFee: (0, reified_1.decodeFromFields)("u64", fields.realized_borrow_fee),
|
|
393
396
|
realizedFeeInUsd: (0, reified_1.decodeFromFields)("u64", fields.realized_fee_in_usd),
|
|
397
|
+
realizedAmount: (0, reified_1.decodeFromFields)("u64", fields.realized_amount),
|
|
398
|
+
realizedAmountSign: (0, reified_1.decodeFromFields)("bool", fields.realized_amount_sign),
|
|
394
399
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
395
400
|
});
|
|
396
401
|
};
|
|
@@ -413,6 +418,8 @@ var OrderFilledEvent = /** @class */ (function () {
|
|
|
413
418
|
realizedTradingFee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_trading_fee),
|
|
414
419
|
realizedBorrowFee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_borrow_fee),
|
|
415
420
|
realizedFeeInUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_fee_in_usd),
|
|
421
|
+
realizedAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_amount),
|
|
422
|
+
realizedAmountSign: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.realized_amount_sign),
|
|
416
423
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
417
424
|
});
|
|
418
425
|
};
|
|
@@ -435,6 +442,8 @@ var OrderFilledEvent = /** @class */ (function () {
|
|
|
435
442
|
realizedTradingFee: this.realizedTradingFee.toString(),
|
|
436
443
|
realizedBorrowFee: this.realizedBorrowFee.toString(),
|
|
437
444
|
realizedFeeInUsd: this.realizedFeeInUsd.toString(),
|
|
445
|
+
realizedAmount: this.realizedAmount.toString(),
|
|
446
|
+
realizedAmountSign: this.realizedAmountSign,
|
|
438
447
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
439
448
|
};
|
|
440
449
|
};
|
|
@@ -457,6 +466,8 @@ var OrderFilledEvent = /** @class */ (function () {
|
|
|
457
466
|
realizedTradingFee: (0, reified_1.decodeFromJSONField)("u64", field.realizedTradingFee),
|
|
458
467
|
realizedBorrowFee: (0, reified_1.decodeFromJSONField)("u64", field.realizedBorrowFee),
|
|
459
468
|
realizedFeeInUsd: (0, reified_1.decodeFromJSONField)("u64", field.realizedFeeInUsd),
|
|
469
|
+
realizedAmount: (0, reified_1.decodeFromJSONField)("u64", field.realizedAmount),
|
|
470
|
+
realizedAmountSign: (0, reified_1.decodeFromJSONField)("bool", field.realizedAmountSign),
|
|
460
471
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
461
472
|
});
|
|
462
473
|
};
|
|
@@ -828,6 +839,7 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
828
839
|
this.positionId = fields.positionId;
|
|
829
840
|
this.realizedFundingSign = fields.realizedFundingSign;
|
|
830
841
|
this.realizedFundingFee = fields.realizedFundingFee;
|
|
842
|
+
this.realizedFundingFeeUsd = fields.realizedFundingFeeUsd;
|
|
831
843
|
this.u64Padding = fields.u64Padding;
|
|
832
844
|
}
|
|
833
845
|
RealizeFundingEvent.reified = function () {
|
|
@@ -881,6 +893,7 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
881
893
|
position_id: bcs_1.bcs.u64(),
|
|
882
894
|
realized_funding_sign: bcs_1.bcs.bool(),
|
|
883
895
|
realized_funding_fee: bcs_1.bcs.u64(),
|
|
896
|
+
realized_funding_fee_usd: bcs_1.bcs.u64(),
|
|
884
897
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
885
898
|
});
|
|
886
899
|
},
|
|
@@ -895,6 +908,7 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
895
908
|
positionId: (0, reified_1.decodeFromFields)("u64", fields.position_id),
|
|
896
909
|
realizedFundingSign: (0, reified_1.decodeFromFields)("bool", fields.realized_funding_sign),
|
|
897
910
|
realizedFundingFee: (0, reified_1.decodeFromFields)("u64", fields.realized_funding_fee),
|
|
911
|
+
realizedFundingFeeUsd: (0, reified_1.decodeFromFields)("u64", fields.realized_funding_fee_usd),
|
|
898
912
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
899
913
|
});
|
|
900
914
|
};
|
|
@@ -909,6 +923,7 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
909
923
|
positionId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.position_id),
|
|
910
924
|
realizedFundingSign: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.realized_funding_sign),
|
|
911
925
|
realizedFundingFee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_funding_fee),
|
|
926
|
+
realizedFundingFeeUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_funding_fee_usd),
|
|
912
927
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
913
928
|
});
|
|
914
929
|
};
|
|
@@ -923,6 +938,7 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
923
938
|
positionId: this.positionId.toString(),
|
|
924
939
|
realizedFundingSign: this.realizedFundingSign,
|
|
925
940
|
realizedFundingFee: this.realizedFundingFee.toString(),
|
|
941
|
+
realizedFundingFeeUsd: this.realizedFundingFeeUsd.toString(),
|
|
926
942
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
927
943
|
};
|
|
928
944
|
};
|
|
@@ -937,6 +953,7 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
937
953
|
positionId: (0, reified_1.decodeFromJSONField)("u64", field.positionId),
|
|
938
954
|
realizedFundingSign: (0, reified_1.decodeFromJSONField)("bool", field.realizedFundingSign),
|
|
939
955
|
realizedFundingFee: (0, reified_1.decodeFromJSONField)("u64", field.realizedFundingFee),
|
|
956
|
+
realizedFundingFeeUsd: (0, reified_1.decodeFromJSONField)("u64", field.realizedFundingFeeUsd),
|
|
940
957
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
941
958
|
});
|
|
942
959
|
};
|
|
@@ -993,213 +1010,6 @@ var RealizeFundingEvent = /** @class */ (function () {
|
|
|
993
1010
|
return RealizeFundingEvent;
|
|
994
1011
|
}());
|
|
995
1012
|
exports.RealizeFundingEvent = RealizeFundingEvent;
|
|
996
|
-
/* ============================== RealizedPnlEvent =============================== */
|
|
997
|
-
function isRealizedPnlEvent(type) {
|
|
998
|
-
type = (0, util_1.compressSuiType)(type);
|
|
999
|
-
return type === "".concat(index_1.PKG_V1, "::position::RealizedPnlEvent");
|
|
1000
|
-
}
|
|
1001
|
-
var RealizedPnlEvent = /** @class */ (function () {
|
|
1002
|
-
function RealizedPnlEvent(typeArgs, fields) {
|
|
1003
|
-
this.__StructClass = true;
|
|
1004
|
-
this.$typeName = RealizedPnlEvent.$typeName;
|
|
1005
|
-
this.$isPhantom = RealizedPnlEvent.$isPhantom;
|
|
1006
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([RealizedPnlEvent.$typeName], __read(typeArgs), false));
|
|
1007
|
-
this.$typeArgs = typeArgs;
|
|
1008
|
-
this.user = fields.user;
|
|
1009
|
-
this.collateralToken = fields.collateralToken;
|
|
1010
|
-
this.symbol = fields.symbol;
|
|
1011
|
-
this.positionId = fields.positionId;
|
|
1012
|
-
this.positionAverageEntryPrice = fields.positionAverageEntryPrice;
|
|
1013
|
-
this.filledPrice = fields.filledPrice;
|
|
1014
|
-
this.realizedPnlSign = fields.realizedPnlSign;
|
|
1015
|
-
this.realizedPnl = fields.realizedPnl;
|
|
1016
|
-
this.realizedTradingFee = fields.realizedTradingFee;
|
|
1017
|
-
this.realizedBorrowFee = fields.realizedBorrowFee;
|
|
1018
|
-
this.u64Padding = fields.u64Padding;
|
|
1019
|
-
}
|
|
1020
|
-
RealizedPnlEvent.reified = function () {
|
|
1021
|
-
var _this = this;
|
|
1022
|
-
return {
|
|
1023
|
-
typeName: RealizedPnlEvent.$typeName,
|
|
1024
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([RealizedPnlEvent.$typeName], [], false)),
|
|
1025
|
-
typeArgs: [],
|
|
1026
|
-
isPhantom: RealizedPnlEvent.$isPhantom,
|
|
1027
|
-
reifiedTypeArgs: [],
|
|
1028
|
-
fromFields: function (fields) { return RealizedPnlEvent.fromFields(fields); },
|
|
1029
|
-
fromFieldsWithTypes: function (item) { return RealizedPnlEvent.fromFieldsWithTypes(item); },
|
|
1030
|
-
fromBcs: function (data) { return RealizedPnlEvent.fromBcs(data); },
|
|
1031
|
-
bcs: RealizedPnlEvent.bcs,
|
|
1032
|
-
fromJSONField: function (field) { return RealizedPnlEvent.fromJSONField(field); },
|
|
1033
|
-
fromJSON: function (json) { return RealizedPnlEvent.fromJSON(json); },
|
|
1034
|
-
fromSuiParsedData: function (content) { return RealizedPnlEvent.fromSuiParsedData(content); },
|
|
1035
|
-
fromSuiObjectData: function (content) { return RealizedPnlEvent.fromSuiObjectData(content); },
|
|
1036
|
-
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1037
|
-
return [2 /*return*/, RealizedPnlEvent.fetch(client, id)];
|
|
1038
|
-
}); }); },
|
|
1039
|
-
new: function (fields) {
|
|
1040
|
-
return new RealizedPnlEvent([], fields);
|
|
1041
|
-
},
|
|
1042
|
-
kind: "StructClassReified",
|
|
1043
|
-
};
|
|
1044
|
-
};
|
|
1045
|
-
Object.defineProperty(RealizedPnlEvent, "r", {
|
|
1046
|
-
get: function () {
|
|
1047
|
-
return RealizedPnlEvent.reified();
|
|
1048
|
-
},
|
|
1049
|
-
enumerable: false,
|
|
1050
|
-
configurable: true
|
|
1051
|
-
});
|
|
1052
|
-
RealizedPnlEvent.phantom = function () {
|
|
1053
|
-
return (0, reified_1.phantom)(RealizedPnlEvent.reified());
|
|
1054
|
-
};
|
|
1055
|
-
Object.defineProperty(RealizedPnlEvent, "p", {
|
|
1056
|
-
get: function () {
|
|
1057
|
-
return RealizedPnlEvent.phantom();
|
|
1058
|
-
},
|
|
1059
|
-
enumerable: false,
|
|
1060
|
-
configurable: true
|
|
1061
|
-
});
|
|
1062
|
-
Object.defineProperty(RealizedPnlEvent, "bcs", {
|
|
1063
|
-
get: function () {
|
|
1064
|
-
return bcs_1.bcs.struct("RealizedPnlEvent", {
|
|
1065
|
-
user: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
|
|
1066
|
-
collateral_token: structs_2.TypeName.bcs,
|
|
1067
|
-
symbol: structs_4.Symbol.bcs,
|
|
1068
|
-
position_id: bcs_1.bcs.u64(),
|
|
1069
|
-
position_average_entry_price: bcs_1.bcs.u64(),
|
|
1070
|
-
filled_price: bcs_1.bcs.u64(),
|
|
1071
|
-
realized_pnl_sign: bcs_1.bcs.bool(),
|
|
1072
|
-
realized_pnl: bcs_1.bcs.u64(),
|
|
1073
|
-
realized_trading_fee: bcs_1.bcs.u64(),
|
|
1074
|
-
realized_borrow_fee: bcs_1.bcs.u64(),
|
|
1075
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
1076
|
-
});
|
|
1077
|
-
},
|
|
1078
|
-
enumerable: false,
|
|
1079
|
-
configurable: true
|
|
1080
|
-
});
|
|
1081
|
-
RealizedPnlEvent.fromFields = function (fields) {
|
|
1082
|
-
return RealizedPnlEvent.reified().new({
|
|
1083
|
-
user: (0, reified_1.decodeFromFields)("address", fields.user),
|
|
1084
|
-
collateralToken: (0, reified_1.decodeFromFields)(structs_2.TypeName.reified(), fields.collateral_token),
|
|
1085
|
-
symbol: (0, reified_1.decodeFromFields)(structs_4.Symbol.reified(), fields.symbol),
|
|
1086
|
-
positionId: (0, reified_1.decodeFromFields)("u64", fields.position_id),
|
|
1087
|
-
positionAverageEntryPrice: (0, reified_1.decodeFromFields)("u64", fields.position_average_entry_price),
|
|
1088
|
-
filledPrice: (0, reified_1.decodeFromFields)("u64", fields.filled_price),
|
|
1089
|
-
realizedPnlSign: (0, reified_1.decodeFromFields)("bool", fields.realized_pnl_sign),
|
|
1090
|
-
realizedPnl: (0, reified_1.decodeFromFields)("u64", fields.realized_pnl),
|
|
1091
|
-
realizedTradingFee: (0, reified_1.decodeFromFields)("u64", fields.realized_trading_fee),
|
|
1092
|
-
realizedBorrowFee: (0, reified_1.decodeFromFields)("u64", fields.realized_borrow_fee),
|
|
1093
|
-
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
1094
|
-
});
|
|
1095
|
-
};
|
|
1096
|
-
RealizedPnlEvent.fromFieldsWithTypes = function (item) {
|
|
1097
|
-
if (!isRealizedPnlEvent(item.type)) {
|
|
1098
|
-
throw new Error("not a RealizedPnlEvent type");
|
|
1099
|
-
}
|
|
1100
|
-
return RealizedPnlEvent.reified().new({
|
|
1101
|
-
user: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.user),
|
|
1102
|
-
collateralToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.TypeName.reified(), item.fields.collateral_token),
|
|
1103
|
-
symbol: (0, reified_1.decodeFromFieldsWithTypes)(structs_4.Symbol.reified(), item.fields.symbol),
|
|
1104
|
-
positionId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.position_id),
|
|
1105
|
-
positionAverageEntryPrice: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.position_average_entry_price),
|
|
1106
|
-
filledPrice: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.filled_price),
|
|
1107
|
-
realizedPnlSign: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.realized_pnl_sign),
|
|
1108
|
-
realizedPnl: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_pnl),
|
|
1109
|
-
realizedTradingFee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_trading_fee),
|
|
1110
|
-
realizedBorrowFee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.realized_borrow_fee),
|
|
1111
|
-
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
1112
|
-
});
|
|
1113
|
-
};
|
|
1114
|
-
RealizedPnlEvent.fromBcs = function (data) {
|
|
1115
|
-
return RealizedPnlEvent.fromFields(RealizedPnlEvent.bcs.parse(data));
|
|
1116
|
-
};
|
|
1117
|
-
RealizedPnlEvent.prototype.toJSONField = function () {
|
|
1118
|
-
return {
|
|
1119
|
-
user: this.user,
|
|
1120
|
-
collateralToken: this.collateralToken.toJSONField(),
|
|
1121
|
-
symbol: this.symbol.toJSONField(),
|
|
1122
|
-
positionId: this.positionId.toString(),
|
|
1123
|
-
positionAverageEntryPrice: this.positionAverageEntryPrice.toString(),
|
|
1124
|
-
filledPrice: this.filledPrice.toString(),
|
|
1125
|
-
realizedPnlSign: this.realizedPnlSign,
|
|
1126
|
-
realizedPnl: this.realizedPnl.toString(),
|
|
1127
|
-
realizedTradingFee: this.realizedTradingFee.toString(),
|
|
1128
|
-
realizedBorrowFee: this.realizedBorrowFee.toString(),
|
|
1129
|
-
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
1130
|
-
};
|
|
1131
|
-
};
|
|
1132
|
-
RealizedPnlEvent.prototype.toJSON = function () {
|
|
1133
|
-
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
1134
|
-
};
|
|
1135
|
-
RealizedPnlEvent.fromJSONField = function (field) {
|
|
1136
|
-
return RealizedPnlEvent.reified().new({
|
|
1137
|
-
user: (0, reified_1.decodeFromJSONField)("address", field.user),
|
|
1138
|
-
collateralToken: (0, reified_1.decodeFromJSONField)(structs_2.TypeName.reified(), field.collateralToken),
|
|
1139
|
-
symbol: (0, reified_1.decodeFromJSONField)(structs_4.Symbol.reified(), field.symbol),
|
|
1140
|
-
positionId: (0, reified_1.decodeFromJSONField)("u64", field.positionId),
|
|
1141
|
-
positionAverageEntryPrice: (0, reified_1.decodeFromJSONField)("u64", field.positionAverageEntryPrice),
|
|
1142
|
-
filledPrice: (0, reified_1.decodeFromJSONField)("u64", field.filledPrice),
|
|
1143
|
-
realizedPnlSign: (0, reified_1.decodeFromJSONField)("bool", field.realizedPnlSign),
|
|
1144
|
-
realizedPnl: (0, reified_1.decodeFromJSONField)("u64", field.realizedPnl),
|
|
1145
|
-
realizedTradingFee: (0, reified_1.decodeFromJSONField)("u64", field.realizedTradingFee),
|
|
1146
|
-
realizedBorrowFee: (0, reified_1.decodeFromJSONField)("u64", field.realizedBorrowFee),
|
|
1147
|
-
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
1148
|
-
});
|
|
1149
|
-
};
|
|
1150
|
-
RealizedPnlEvent.fromJSON = function (json) {
|
|
1151
|
-
if (json.$typeName !== RealizedPnlEvent.$typeName) {
|
|
1152
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
1153
|
-
}
|
|
1154
|
-
return RealizedPnlEvent.fromJSONField(json);
|
|
1155
|
-
};
|
|
1156
|
-
RealizedPnlEvent.fromSuiParsedData = function (content) {
|
|
1157
|
-
if (content.dataType !== "moveObject") {
|
|
1158
|
-
throw new Error("not an object");
|
|
1159
|
-
}
|
|
1160
|
-
if (!isRealizedPnlEvent(content.type)) {
|
|
1161
|
-
throw new Error("object at ".concat(content.fields.id, " is not a RealizedPnlEvent object"));
|
|
1162
|
-
}
|
|
1163
|
-
return RealizedPnlEvent.fromFieldsWithTypes(content);
|
|
1164
|
-
};
|
|
1165
|
-
RealizedPnlEvent.fromSuiObjectData = function (data) {
|
|
1166
|
-
if (data.bcs) {
|
|
1167
|
-
if (data.bcs.dataType !== "moveObject" || !isRealizedPnlEvent(data.bcs.type)) {
|
|
1168
|
-
throw new Error("object at is not a RealizedPnlEvent object");
|
|
1169
|
-
}
|
|
1170
|
-
return RealizedPnlEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1171
|
-
}
|
|
1172
|
-
if (data.content) {
|
|
1173
|
-
return RealizedPnlEvent.fromSuiParsedData(data.content);
|
|
1174
|
-
}
|
|
1175
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1176
|
-
};
|
|
1177
|
-
RealizedPnlEvent.fetch = function (client, id) {
|
|
1178
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1179
|
-
var res;
|
|
1180
|
-
var _a, _b;
|
|
1181
|
-
return __generator(this, function (_c) {
|
|
1182
|
-
switch (_c.label) {
|
|
1183
|
-
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
1184
|
-
case 1:
|
|
1185
|
-
res = _c.sent();
|
|
1186
|
-
if (res.error) {
|
|
1187
|
-
throw new Error("error fetching RealizedPnlEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
1188
|
-
}
|
|
1189
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isRealizedPnlEvent(res.data.bcs.type)) {
|
|
1190
|
-
throw new Error("object at id ".concat(id, " is not a RealizedPnlEvent object"));
|
|
1191
|
-
}
|
|
1192
|
-
return [2 /*return*/, RealizedPnlEvent.fromSuiObjectData(res.data)];
|
|
1193
|
-
}
|
|
1194
|
-
});
|
|
1195
|
-
});
|
|
1196
|
-
};
|
|
1197
|
-
RealizedPnlEvent.$typeName = "".concat(index_1.PKG_V1, "::position::RealizedPnlEvent");
|
|
1198
|
-
RealizedPnlEvent.$numTypeParams = 0;
|
|
1199
|
-
RealizedPnlEvent.$isPhantom = [];
|
|
1200
|
-
return RealizedPnlEvent;
|
|
1201
|
-
}());
|
|
1202
|
-
exports.RealizedPnlEvent = RealizedPnlEvent;
|
|
1203
1013
|
/* ============================== RemovePositionEvent =============================== */
|
|
1204
1014
|
function isRemovePositionEvent(type) {
|
|
1205
1015
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -24,7 +24,7 @@ export declare class Symbol implements StructClass {
|
|
|
24
24
|
static reified(): SymbolReified;
|
|
25
25
|
static get r(): import("../../_framework/reified").StructClassReified<Symbol, SymbolFields>;
|
|
26
26
|
static phantom(): PhantomReified<ToTypeStr<Symbol>>;
|
|
27
|
-
static get p(): PhantomReified<"::symbol::Symbol" | "
|
|
27
|
+
static get p(): PhantomReified<"::symbol::Symbol" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::symbol::Symbol">;
|
|
28
28
|
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
29
29
|
base_token: {
|
|
30
30
|
name: {
|
|
@@ -22,7 +22,7 @@ export declare class LpRegistry implements StructClass {
|
|
|
22
22
|
static reified(): LpRegistryReified;
|
|
23
23
|
static get r(): import("../../_framework/reified").StructClassReified<LpRegistry, LpRegistryFields>;
|
|
24
24
|
static phantom(): PhantomReified<ToTypeStr<LpRegistry>>;
|
|
25
|
-
static get p(): PhantomReified<"::tlp::LpRegistry" | "
|
|
25
|
+
static get p(): PhantomReified<"::tlp::LpRegistry" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::tlp::LpRegistry">;
|
|
26
26
|
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
27
27
|
id: {
|
|
28
28
|
id: {
|
|
@@ -72,7 +72,7 @@ export declare class TLP implements StructClass {
|
|
|
72
72
|
static reified(): TLPReified;
|
|
73
73
|
static get r(): import("../../_framework/reified").StructClassReified<TLP, TLPFields>;
|
|
74
74
|
static phantom(): PhantomReified<ToTypeStr<TLP>>;
|
|
75
|
-
static get p(): PhantomReified<"::tlp::TLP" | "
|
|
75
|
+
static get p(): PhantomReified<"::tlp::TLP" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::tlp::TLP">;
|
|
76
76
|
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
77
77
|
dummy_field: boolean;
|
|
78
78
|
}, {
|