@typus/typus-perp-sdk 1.1.50 → 1.1.51
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.
|
@@ -30,8 +30,8 @@ export declare function getGraphQLEvents(module: string, sender: string | null,
|
|
|
30
30
|
export declare function getArchivePlaceOrderEvents(userAddress: string, startTimestamp: number, endTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
31
31
|
export declare function getLiquidateFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
32
32
|
export declare function getRealizeFundingFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
33
|
-
export declare function getRemovePositionFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
33
|
+
export declare function getRemovePositionFromSentio(userAddress: string, startTimestamp: number, events: Event[], datas?: any[]): Promise<Event[]>;
|
|
34
34
|
export declare function getCancelOrderFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
35
|
-
export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number, events: Event[], datas?: any[], archiveDatas?: Event[]): Promise<Event[]>;
|
|
35
|
+
export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number, events: Event[], removeEventDatas: any[], datas?: any[], archiveDatas?: Event[]): Promise<Event[]>;
|
|
36
36
|
export declare function getRealizeOptionFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
37
37
|
export declare function toSentioToken(name: TOKEN): string;
|
package/dist/src/user/history.js
CHANGED
|
@@ -553,8 +553,9 @@ async function getRealizeFundingFromSentio(userAddress, startTimestamp, events)
|
|
|
553
553
|
events = events.sort((a, b) => Number(new Date(a.timestamp)) - Number(new Date(b.timestamp)));
|
|
554
554
|
return events;
|
|
555
555
|
}
|
|
556
|
-
async function getRemovePositionFromSentio(userAddress, startTimestamp, events) {
|
|
557
|
-
|
|
556
|
+
async function getRemovePositionFromSentio(userAddress, startTimestamp, events, datas) {
|
|
557
|
+
if (!datas)
|
|
558
|
+
datas = await (0, sentio_1.getFromSentio)("RemovePosition", userAddress, startTimestamp.toString());
|
|
558
559
|
// console.log(datas);
|
|
559
560
|
datas.forEach((x) => {
|
|
560
561
|
// console.log(x);
|
|
@@ -619,7 +620,7 @@ async function getCancelOrderFromSentio(userAddress, startTimestamp, events) {
|
|
|
619
620
|
events = events.sort((a, b) => Number(new Date(a.timestamp)) - Number(new Date(b.timestamp)));
|
|
620
621
|
return events;
|
|
621
622
|
}
|
|
622
|
-
async function getOrderMatchFromSentio(userAddress, startTimestamp, events, datas, archiveDatas) {
|
|
623
|
+
async function getOrderMatchFromSentio(userAddress, startTimestamp, events, removeEventDatas, datas, archiveDatas) {
|
|
623
624
|
if (!datas)
|
|
624
625
|
datas = await (0, sentio_1.getFromSentio)("OrderFilled", userAddress, startTimestamp.toString(), undefined, true);
|
|
625
626
|
let order_match = datas.map((x) => {
|
|
@@ -665,7 +666,15 @@ async function getOrderMatchFromSentio(userAddress, startTimestamp, events, data
|
|
|
665
666
|
origin_order_place_event = archiveDatas.findLast((e) => e.order_id == origin_order_filled_event?.order_id && e.base_token == origin_order_filled_event.base_token);
|
|
666
667
|
}
|
|
667
668
|
const related_collateral = origin_order_place_event?.collateral ?? 0;
|
|
668
|
-
|
|
669
|
+
const isPartialClose = removeEventDatas.findIndex(r => r.transaction_hash === x.tx_digest);
|
|
670
|
+
if (isPartialClose !== -1) {
|
|
671
|
+
x.collateral = (0, bignumber_js_1.default)(x.collateral ?? 0).plus(related_collateral).toNumber();
|
|
672
|
+
}
|
|
673
|
+
else if (x.collateral) {
|
|
674
|
+
if (x.collateral < 0) {
|
|
675
|
+
x.collateral = undefined;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
669
678
|
}
|
|
670
679
|
}
|
|
671
680
|
x.dov_index = related.dov_index;
|