@typus/typus-perp-sdk 1.0.25 → 1.0.26
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.
|
@@ -5,6 +5,7 @@ type orderType = "Market" | "Limit" | "Take Profit" | "Stop Loss";
|
|
|
5
5
|
type statusType = "Open" | "Filled" | "Canceled";
|
|
6
6
|
interface Event {
|
|
7
7
|
action: actionType;
|
|
8
|
+
typeName: string | undefined;
|
|
8
9
|
order_id: string | undefined;
|
|
9
10
|
position_id: string | undefined;
|
|
10
11
|
market: string;
|
package/dist/src/user/history.js
CHANGED
|
@@ -120,6 +120,7 @@ function parseUserHistory(raw_events) {
|
|
|
120
120
|
}
|
|
121
121
|
var e = {
|
|
122
122
|
action: "Place Order",
|
|
123
|
+
typeName: name,
|
|
123
124
|
order_id: json.order_id,
|
|
124
125
|
position_id: json.linked_position_id,
|
|
125
126
|
market: market,
|
|
@@ -130,7 +131,7 @@ function parseUserHistory(raw_events) {
|
|
|
130
131
|
base_token: base_token,
|
|
131
132
|
collateral: collateral,
|
|
132
133
|
collateral_token: collateral_token,
|
|
133
|
-
price: Number(price) / Math.pow(10,
|
|
134
|
+
price: Number(price) / Math.pow(10, (0, constants_1.assetToDecimal)("USD")), // WARNING: fixed decimal
|
|
134
135
|
realized_pnl: undefined,
|
|
135
136
|
timestamp: timestamp,
|
|
136
137
|
tx_digest: tx_digest,
|
|
@@ -160,6 +161,7 @@ function parseUserHistory(raw_events) {
|
|
|
160
161
|
var realized_pnl = ((realized_amount - realized_trading_fee) * realized_fee_in_usd) / realized_trading_fee;
|
|
161
162
|
var e = {
|
|
162
163
|
action: action,
|
|
164
|
+
typeName: name,
|
|
163
165
|
order_id: json.order_id,
|
|
164
166
|
position_id: (_a = json.linked_position_id) !== null && _a !== void 0 ? _a : json.new_position_id,
|
|
165
167
|
market: market,
|
|
@@ -194,6 +196,7 @@ function parseUserHistory(raw_events) {
|
|
|
194
196
|
var related = events.findLast(function (e) { return e.order_id === json.order_id && e.market === market; });
|
|
195
197
|
var e = {
|
|
196
198
|
action: "Cancel Order",
|
|
199
|
+
typeName: name,
|
|
197
200
|
order_id: json.order_id,
|
|
198
201
|
position_id: undefined,
|
|
199
202
|
market: market,
|
|
@@ -226,6 +229,7 @@ function parseUserHistory(raw_events) {
|
|
|
226
229
|
}
|
|
227
230
|
var e = {
|
|
228
231
|
action: "Modify Collateral",
|
|
232
|
+
typeName: name,
|
|
229
233
|
order_id: undefined,
|
|
230
234
|
position_id: json.position_id,
|
|
231
235
|
market: market,
|
|
@@ -250,6 +254,7 @@ function parseUserHistory(raw_events) {
|
|
|
250
254
|
var to_price = Number(json.oracle_price_to_token);
|
|
251
255
|
var e = {
|
|
252
256
|
action: "Swap",
|
|
257
|
+
typeName: name,
|
|
253
258
|
order_id: undefined,
|
|
254
259
|
position_id: undefined,
|
|
255
260
|
market: "".concat(from_token, "/").concat(to_token),
|
|
@@ -319,6 +324,7 @@ function getLiquidateFromSentio(userAddress, startTimestamp) {
|
|
|
319
324
|
var collateral = Number(x.liquidator_fee) + Number(x.value_for_lp_pool);
|
|
320
325
|
var txHistory = {
|
|
321
326
|
action: "Liquidation",
|
|
327
|
+
typeName: undefined,
|
|
322
328
|
order_id: x.order_id,
|
|
323
329
|
position_id: x.position_id,
|
|
324
330
|
market: "".concat(x.trading_token, "/USD"),
|
|
@@ -353,6 +359,7 @@ function getOrderMatchFromSentio(userAddress, startTimestamp) {
|
|
|
353
359
|
var realized_pnl = ((x.realized_amount - x.realized_trading_fee) * x.realized_fee_in_usd) / x.realized_trading_fee;
|
|
354
360
|
var txHistory = {
|
|
355
361
|
action: x.order_type == "Open" ? "Order Filled (Open Position)" : "Order Filled (Close Position)",
|
|
362
|
+
typeName: undefined,
|
|
356
363
|
order_id: x.order_id,
|
|
357
364
|
position_id: x.position_id,
|
|
358
365
|
market: "".concat(x.trading_token, "/USD"),
|