@typus/typus-perp-sdk 1.1.50 → 1.1.52

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.
@@ -696,7 +696,7 @@ async function getLeaderboardFromSentio(startTs, endTs, type = LeaderboardType.C
696
696
  WHERE o.base_token NOT IN (
697
697
  'XAU', 'XAG', 'USOIL', 'JPY', 'SPYX', 'QQQX',
698
698
  'TSLAX', 'NVDAX', 'AAPLX', 'GOOGLX', 'METAX',
699
- 'COINX', 'CRCLX'
699
+ 'COINX', 'CRCLX', 'MSTRX', 'HOODX'
700
700
  )
701
701
  AND s.timestamp >= ${startTs} AND s.timestamp < ${endTs}
702
702
  ),
@@ -750,7 +750,7 @@ async function getLeaderboardFromSentio(startTs, endTs, type = LeaderboardType.C
750
750
  WHERE o.base_token IN (
751
751
  'XAU', 'XAG', 'USOIL', 'JPY', 'SPYX', 'QQQX',
752
752
  'TSLAX', 'NVDAX', 'AAPLX', 'GOOGLX', 'METAX',
753
- 'COINX', 'CRCLX'
753
+ 'COINX', 'CRCLX', 'MSTRX', 'HOODX'
754
754
  )
755
755
  AND s.timestamp >= ${startTs} AND s.timestamp < ${endTs}
756
756
  ),
@@ -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;
@@ -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
- const datas = await (0, sentio_1.getFromSentio)("RemovePosition", userAddress, startTimestamp.toString());
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
- x.collateral = (0, bignumber_js_1.default)(x.collateral ?? 0).plus(related_collateral).toNumber();
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typus/typus-perp-sdk",
3
- "version": "1.1.50",
3
+ "version": "1.1.52",
4
4
  "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
5
  "author": "Typus",
6
6
  "description": "typus perp sdk",
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@mysten/bcs": "1.9.2",
10
10
  "@mysten/sui": "1.44.0",
11
- "@typus/typus-sdk": "1.8.41"
11
+ "@typus/typus-sdk": "1.8.42"
12
12
  },
13
13
  "resolutions": {
14
14
  "@mysten/bcs": "1.9.2",