@typus/typus-perp-sdk 1.0.26 → 1.0.28
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
2
|
-
type actionType = "Place Order" | "Cancel Order" | "Order Filled (Open Position)" | "Order Filled (Close Position)" | "Realized PnL" | "Modify Collateral" | "Exercise Position" | "Liquidation" | "Force Close Position " | "Swap";
|
|
3
|
-
type sideType = "Long" | "Short";
|
|
4
|
-
type orderType = "Market" | "Limit" | "Take Profit" | "Stop Loss";
|
|
5
|
-
type statusType = "Open" | "Filled" | "Canceled";
|
|
6
|
-
interface Event {
|
|
2
|
+
export type actionType = "Place Order" | "Cancel Order" | "Order Filled (Open Position)" | "Order Filled (Close Position)" | "Realized PnL" | "Modify Collateral" | "Exercise Position" | "Liquidation" | "Force Close Position " | "Swap";
|
|
3
|
+
export type sideType = "Long" | "Short";
|
|
4
|
+
export type orderType = "Market" | "Limit" | "Take Profit" | "Stop Loss";
|
|
5
|
+
export type statusType = "Open" | "Filled" | "Canceled";
|
|
6
|
+
export interface Event {
|
|
7
7
|
action: actionType;
|
|
8
8
|
typeName: string | undefined;
|
|
9
9
|
order_id: string | undefined;
|
|
@@ -25,4 +25,3 @@ export declare function parseUserHistory(raw_events: any): Promise<Event[]>;
|
|
|
25
25
|
export declare function getGraphQLEvents(module: string, sender: string, beforeCursor?: string | null): Promise<any>;
|
|
26
26
|
export declare function getLiquidateFromSentio(userAddress: string, startTimestamp: number): Promise<Event[]>;
|
|
27
27
|
export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number): Promise<Event[]>;
|
|
28
|
-
export {};
|
package/dist/src/user/history.js
CHANGED
|
@@ -131,7 +131,7 @@ function parseUserHistory(raw_events) {
|
|
|
131
131
|
base_token: base_token,
|
|
132
132
|
collateral: collateral,
|
|
133
133
|
collateral_token: collateral_token,
|
|
134
|
-
price: Number(price) / Math.pow(10,
|
|
134
|
+
price: Number(price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
135
135
|
realized_pnl: undefined,
|
|
136
136
|
timestamp: timestamp,
|
|
137
137
|
tx_digest: tx_digest,
|
|
@@ -266,7 +266,7 @@ function parseUserHistory(raw_events) {
|
|
|
266
266
|
collateral: Number(json.from_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(from_token)),
|
|
267
267
|
collateral_token: from_token,
|
|
268
268
|
price: from_price / to_price,
|
|
269
|
-
realized_pnl: -Number(json.fee_amount_usd) / Math.pow(10,
|
|
269
|
+
realized_pnl: -Number(json.fee_amount_usd) / Math.pow(10, 9),
|
|
270
270
|
timestamp: timestamp,
|
|
271
271
|
tx_digest: tx_digest,
|
|
272
272
|
};
|