zklighter-perps 1.0.121 → 1.0.123

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.
@@ -54,6 +54,10 @@ models/L1ProviderInfo.ts
54
54
  models/Layer1BasicInfo.ts
55
55
  models/Leaderboard.ts
56
56
  models/LeaderboardEntry.ts
57
+ models/LiqTrade.ts
58
+ models/Liquidation.ts
59
+ models/LiquidationInfo.ts
60
+ models/LiquidationInfos.ts
57
61
  models/MarketInfo.ts
58
62
  models/NextNonce.ts
59
63
  models/Order.ts
@@ -98,6 +102,7 @@ models/ReqGetL1Metadata.ts
98
102
  models/ReqGetL1Tx.ts
99
103
  models/ReqGetLatestDeposit.ts
100
104
  models/ReqGetLeaderboard.ts
105
+ models/ReqGetLiquidationInfos.ts
101
106
  models/ReqGetNextNonce.ts
102
107
  models/ReqGetOrderBookDetails.ts
103
108
  models/ReqGetOrderBookOrders.ts
@@ -117,6 +122,7 @@ models/ReqIsWhitelisted.ts
117
122
  models/RespGetFastBridgeInfo.ts
118
123
  models/RespGetFastwithdrawalInfo.ts
119
124
  models/ResultCode.ts
125
+ models/RiskInfo.ts
120
126
  models/SimpleOrder.ts
121
127
  models/Status.ts
122
128
  models/SubAccounts.ts
@@ -23,6 +23,7 @@ import type {
23
23
  IsWhitelisted,
24
24
  L1Metadata,
25
25
  Leaderboard,
26
+ LiquidationInfos,
26
27
  PositionFundings,
27
28
  PublicPools,
28
29
  ResultCode,
@@ -45,6 +46,8 @@ import {
45
46
  L1MetadataToJSON,
46
47
  LeaderboardFromJSON,
47
48
  LeaderboardToJSON,
49
+ LiquidationInfosFromJSON,
50
+ LiquidationInfosToJSON,
48
51
  PositionFundingsFromJSON,
49
52
  PositionFundingsToJSON,
50
53
  PublicPoolsFromJSON,
@@ -101,6 +104,15 @@ export interface LeaderboardRequest {
101
104
  l1_address?: string;
102
105
  }
103
106
 
107
+ export interface LiquidationsRequest {
108
+ account_index: number;
109
+ limit: number;
110
+ authorization?: string;
111
+ auth?: string;
112
+ market_id?: number;
113
+ cursor?: string;
114
+ }
115
+
104
116
  export interface PnlRequest {
105
117
  by: PnlByEnum;
106
118
  value: string;
@@ -542,6 +554,72 @@ export class AccountApi extends runtime.BaseAPI {
542
554
  return await response.value();
543
555
  }
544
556
 
557
+ /**
558
+ * Get liquidation infos
559
+ * liquidations
560
+ */
561
+ async liquidationsRaw(requestParameters: LiquidationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiquidationInfos>> {
562
+ if (requestParameters['account_index'] == null) {
563
+ throw new runtime.RequiredError(
564
+ 'account_index',
565
+ 'Required parameter "account_index" was null or undefined when calling liquidations().'
566
+ );
567
+ }
568
+
569
+ if (requestParameters['limit'] == null) {
570
+ throw new runtime.RequiredError(
571
+ 'limit',
572
+ 'Required parameter "limit" was null or undefined when calling liquidations().'
573
+ );
574
+ }
575
+
576
+ const queryParameters: any = {};
577
+
578
+ if (requestParameters['auth'] != null) {
579
+ queryParameters['auth'] = requestParameters['auth'];
580
+ }
581
+
582
+ if (requestParameters['account_index'] != null) {
583
+ queryParameters['account_index'] = requestParameters['account_index'];
584
+ }
585
+
586
+ if (requestParameters['market_id'] != null) {
587
+ queryParameters['market_id'] = requestParameters['market_id'];
588
+ }
589
+
590
+ if (requestParameters['cursor'] != null) {
591
+ queryParameters['cursor'] = requestParameters['cursor'];
592
+ }
593
+
594
+ if (requestParameters['limit'] != null) {
595
+ queryParameters['limit'] = requestParameters['limit'];
596
+ }
597
+
598
+ const headerParameters: runtime.HTTPHeaders = {};
599
+
600
+ if (requestParameters['authorization'] != null) {
601
+ headerParameters['authorization'] = String(requestParameters['authorization']);
602
+ }
603
+
604
+ const response = await this.request({
605
+ path: `/api/v1/liquidations`,
606
+ method: 'GET',
607
+ headers: headerParameters,
608
+ query: queryParameters,
609
+ }, initOverrides);
610
+
611
+ return new runtime.JSONApiResponse(response, (jsonValue) => LiquidationInfosFromJSON(jsonValue));
612
+ }
613
+
614
+ /**
615
+ * Get liquidation infos
616
+ * liquidations
617
+ */
618
+ async liquidations(requestParameters: LiquidationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiquidationInfos> {
619
+ const response = await this.liquidationsRaw(requestParameters, initOverrides);
620
+ return await response.value();
621
+ }
622
+
545
623
  /**
546
624
  * Get account PnL chart
547
625
  * pnl
@@ -0,0 +1,88 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ *
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document:
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface LiqTrade
20
+ */
21
+ export interface LiqTrade {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof LiqTrade
26
+ */
27
+ price: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof LiqTrade
32
+ */
33
+ size: string;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof LiqTrade
38
+ */
39
+ taker_fee: number;
40
+ /**
41
+ *
42
+ * @type {number}
43
+ * @memberof LiqTrade
44
+ */
45
+ maker_fee: number;
46
+ }
47
+
48
+ /**
49
+ * Check if a given object implements the LiqTrade interface.
50
+ */
51
+ export function instanceOfLiqTrade(value: object): value is LiqTrade {
52
+ if (!('price' in value) || value['price'] === undefined) return false;
53
+ if (!('size' in value) || value['size'] === undefined) return false;
54
+ if (!('taker_fee' in value) || value['taker_fee'] === undefined) return false;
55
+ if (!('maker_fee' in value) || value['maker_fee'] === undefined) return false;
56
+ return true;
57
+ }
58
+
59
+ export function LiqTradeFromJSON(json: any): LiqTrade {
60
+ return LiqTradeFromJSONTyped(json, false);
61
+ }
62
+
63
+ export function LiqTradeFromJSONTyped(json: any, ignoreDiscriminator: boolean): LiqTrade {
64
+ if (json == null) {
65
+ return json;
66
+ }
67
+ return {
68
+
69
+ 'price': json['price'],
70
+ 'size': json['size'],
71
+ 'taker_fee': json['taker_fee'],
72
+ 'maker_fee': json['maker_fee'],
73
+ };
74
+ }
75
+
76
+ export function LiqTradeToJSON(value?: LiqTrade | null): any {
77
+ if (value == null) {
78
+ return value;
79
+ }
80
+ return {
81
+
82
+ 'price': value['price'],
83
+ 'size': value['size'],
84
+ 'taker_fee': value['taker_fee'],
85
+ 'maker_fee': value['maker_fee'],
86
+ };
87
+ }
88
+
@@ -13,6 +13,19 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { LiqTrade } from './LiqTrade';
17
+ import {
18
+ LiqTradeFromJSON,
19
+ LiqTradeFromJSONTyped,
20
+ LiqTradeToJSON,
21
+ } from './LiqTrade';
22
+ import type { LiquidationInfo } from './LiquidationInfo';
23
+ import {
24
+ LiquidationInfoFromJSON,
25
+ LiquidationInfoFromJSONTyped,
26
+ LiquidationInfoToJSON,
27
+ } from './LiquidationInfo';
28
+
16
29
  /**
17
30
  *
18
31
  * @export
@@ -24,42 +37,60 @@ export interface Liquidation {
24
37
  * @type {number}
25
38
  * @memberof Liquidation
26
39
  */
27
- liquidation_id: number;
40
+ id: number;
28
41
  /**
29
42
  *
30
43
  * @type {number}
31
44
  * @memberof Liquidation
32
45
  */
33
- account_index: number;
46
+ market_id: number;
34
47
  /**
35
48
  *
36
- * @type {number}
49
+ * @type {string}
37
50
  * @memberof Liquidation
38
51
  */
39
- liquidation_type: number;
52
+ type: LiquidationTypeEnum;
40
53
  /**
41
54
  *
42
- * @type {string}
55
+ * @type {LiqTrade}
43
56
  * @memberof Liquidation
44
57
  */
45
- portfolio_value: string;
58
+ trade: LiqTrade;
46
59
  /**
47
60
  *
48
- * @type {string}
61
+ * @type {LiquidationInfo}
62
+ * @memberof Liquidation
63
+ */
64
+ info: LiquidationInfo;
65
+ /**
66
+ *
67
+ * @type {number}
49
68
  * @memberof Liquidation
50
69
  */
51
- margin_requirement: string;
70
+ executed_at: number;
52
71
  }
53
72
 
73
+
74
+ /**
75
+ * @export
76
+ */
77
+ export const LiquidationTypeEnum = {
78
+ Partial: 'partial',
79
+ Deleverage: 'deleverage'
80
+ } as const;
81
+ export type LiquidationTypeEnum = typeof LiquidationTypeEnum[keyof typeof LiquidationTypeEnum];
82
+
83
+
54
84
  /**
55
85
  * Check if a given object implements the Liquidation interface.
56
86
  */
57
87
  export function instanceOfLiquidation(value: object): value is Liquidation {
58
- if (!('liquidation_id' in value) || value['liquidation_id'] === undefined) return false;
59
- if (!('account_index' in value) || value['account_index'] === undefined) return false;
60
- if (!('liquidation_type' in value) || value['liquidation_type'] === undefined) return false;
61
- if (!('portfolio_value' in value) || value['portfolio_value'] === undefined) return false;
62
- if (!('margin_requirement' in value) || value['margin_requirement'] === undefined) return false;
88
+ if (!('id' in value) || value['id'] === undefined) return false;
89
+ if (!('market_id' in value) || value['market_id'] === undefined) return false;
90
+ if (!('type' in value) || value['type'] === undefined) return false;
91
+ if (!('trade' in value) || value['trade'] === undefined) return false;
92
+ if (!('info' in value) || value['info'] === undefined) return false;
93
+ if (!('executed_at' in value) || value['executed_at'] === undefined) return false;
63
94
  return true;
64
95
  }
65
96
 
@@ -73,11 +104,12 @@ export function LiquidationFromJSONTyped(json: any, ignoreDiscriminator: boolean
73
104
  }
74
105
  return {
75
106
 
76
- 'liquidation_id': json['liquidation_id'],
77
- 'account_index': json['account_index'],
78
- 'liquidation_type': json['liquidation_type'],
79
- 'portfolio_value': json['portfolio_value'],
80
- 'margin_requirement': json['margin_requirement'],
107
+ 'id': json['id'],
108
+ 'market_id': json['market_id'],
109
+ 'type': json['type'],
110
+ 'trade': LiqTradeFromJSON(json['trade']),
111
+ 'info': LiquidationInfoFromJSON(json['info']),
112
+ 'executed_at': json['executed_at'],
81
113
  };
82
114
  }
83
115
 
@@ -87,11 +119,12 @@ export function LiquidationToJSON(value?: Liquidation | null): any {
87
119
  }
88
120
  return {
89
121
 
90
- 'liquidation_id': value['liquidation_id'],
91
- 'account_index': value['account_index'],
92
- 'liquidation_type': value['liquidation_type'],
93
- 'portfolio_value': value['portfolio_value'],
94
- 'margin_requirement': value['margin_requirement'],
122
+ 'id': value['id'],
123
+ 'market_id': value['market_id'],
124
+ 'type': value['type'],
125
+ 'trade': LiqTradeToJSON(value['trade']),
126
+ 'info': LiquidationInfoToJSON(value['info']),
127
+ 'executed_at': value['executed_at'],
95
128
  };
96
129
  }
97
130
 
@@ -0,0 +1,101 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ *
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document:
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { AccountPosition } from './AccountPosition';
17
+ import {
18
+ AccountPositionFromJSON,
19
+ AccountPositionFromJSONTyped,
20
+ AccountPositionToJSON,
21
+ } from './AccountPosition';
22
+ import type { RiskInfo } from './RiskInfo';
23
+ import {
24
+ RiskInfoFromJSON,
25
+ RiskInfoFromJSONTyped,
26
+ RiskInfoToJSON,
27
+ } from './RiskInfo';
28
+
29
+ /**
30
+ *
31
+ * @export
32
+ * @interface LiquidationInfo
33
+ */
34
+ export interface LiquidationInfo {
35
+ /**
36
+ *
37
+ * @type {Array<AccountPosition>}
38
+ * @memberof LiquidationInfo
39
+ */
40
+ positions: Array<AccountPosition>;
41
+ /**
42
+ *
43
+ * @type {RiskInfo}
44
+ * @memberof LiquidationInfo
45
+ */
46
+ risk_info_before: RiskInfo;
47
+ /**
48
+ *
49
+ * @type {RiskInfo}
50
+ * @memberof LiquidationInfo
51
+ */
52
+ risk_info_after: RiskInfo;
53
+ /**
54
+ *
55
+ * @type {{ [key: string]: number; }}
56
+ * @memberof LiquidationInfo
57
+ */
58
+ mark_prices: { [key: string]: number; };
59
+ }
60
+
61
+ /**
62
+ * Check if a given object implements the LiquidationInfo interface.
63
+ */
64
+ export function instanceOfLiquidationInfo(value: object): value is LiquidationInfo {
65
+ if (!('positions' in value) || value['positions'] === undefined) return false;
66
+ if (!('risk_info_before' in value) || value['risk_info_before'] === undefined) return false;
67
+ if (!('risk_info_after' in value) || value['risk_info_after'] === undefined) return false;
68
+ if (!('mark_prices' in value) || value['mark_prices'] === undefined) return false;
69
+ return true;
70
+ }
71
+
72
+ export function LiquidationInfoFromJSON(json: any): LiquidationInfo {
73
+ return LiquidationInfoFromJSONTyped(json, false);
74
+ }
75
+
76
+ export function LiquidationInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): LiquidationInfo {
77
+ if (json == null) {
78
+ return json;
79
+ }
80
+ return {
81
+
82
+ 'positions': ((json['positions'] as Array<any>).map(AccountPositionFromJSON)),
83
+ 'risk_info_before': RiskInfoFromJSON(json['risk_info_before']),
84
+ 'risk_info_after': RiskInfoFromJSON(json['risk_info_after']),
85
+ 'mark_prices': json['mark_prices'],
86
+ };
87
+ }
88
+
89
+ export function LiquidationInfoToJSON(value?: LiquidationInfo | null): any {
90
+ if (value == null) {
91
+ return value;
92
+ }
93
+ return {
94
+
95
+ 'positions': ((value['positions'] as Array<any>).map(AccountPositionToJSON)),
96
+ 'risk_info_before': RiskInfoToJSON(value['risk_info_before']),
97
+ 'risk_info_after': RiskInfoToJSON(value['risk_info_after']),
98
+ 'mark_prices': value['mark_prices'],
99
+ };
100
+ }
101
+
@@ -0,0 +1,93 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ *
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document:
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { Liquidation } from './Liquidation';
17
+ import {
18
+ LiquidationFromJSON,
19
+ LiquidationFromJSONTyped,
20
+ LiquidationToJSON,
21
+ } from './Liquidation';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface LiquidationInfos
27
+ */
28
+ export interface LiquidationInfos {
29
+ /**
30
+ *
31
+ * @type {number}
32
+ * @memberof LiquidationInfos
33
+ */
34
+ code: number;
35
+ /**
36
+ *
37
+ * @type {string}
38
+ * @memberof LiquidationInfos
39
+ */
40
+ message?: string;
41
+ /**
42
+ *
43
+ * @type {Array<Liquidation>}
44
+ * @memberof LiquidationInfos
45
+ */
46
+ liquidations: Array<Liquidation>;
47
+ /**
48
+ *
49
+ * @type {string}
50
+ * @memberof LiquidationInfos
51
+ */
52
+ next_cursor?: string;
53
+ }
54
+
55
+ /**
56
+ * Check if a given object implements the LiquidationInfos interface.
57
+ */
58
+ export function instanceOfLiquidationInfos(value: object): value is LiquidationInfos {
59
+ if (!('code' in value) || value['code'] === undefined) return false;
60
+ if (!('liquidations' in value) || value['liquidations'] === undefined) return false;
61
+ return true;
62
+ }
63
+
64
+ export function LiquidationInfosFromJSON(json: any): LiquidationInfos {
65
+ return LiquidationInfosFromJSONTyped(json, false);
66
+ }
67
+
68
+ export function LiquidationInfosFromJSONTyped(json: any, ignoreDiscriminator: boolean): LiquidationInfos {
69
+ if (json == null) {
70
+ return json;
71
+ }
72
+ return {
73
+
74
+ 'code': json['code'],
75
+ 'message': json['message'] == null ? undefined : json['message'],
76
+ 'liquidations': ((json['liquidations'] as Array<any>).map(LiquidationFromJSON)),
77
+ 'next_cursor': json['next_cursor'] == null ? undefined : json['next_cursor'],
78
+ };
79
+ }
80
+
81
+ export function LiquidationInfosToJSON(value?: LiquidationInfos | null): any {
82
+ if (value == null) {
83
+ return value;
84
+ }
85
+ return {
86
+
87
+ 'code': value['code'],
88
+ 'message': value['message'],
89
+ 'liquidations': ((value['liquidations'] as Array<any>).map(LiquidationToJSON)),
90
+ 'next_cursor': value['next_cursor'],
91
+ };
92
+ }
93
+
@@ -0,0 +1,94 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ *
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document:
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface ReqGetLiquidationInfos
20
+ */
21
+ export interface ReqGetLiquidationInfos {
22
+ /**
23
+ * made optional to support header auth clients
24
+ * @type {string}
25
+ * @memberof ReqGetLiquidationInfos
26
+ */
27
+ auth?: string;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof ReqGetLiquidationInfos
32
+ */
33
+ account_index: number;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof ReqGetLiquidationInfos
38
+ */
39
+ market_id?: number;
40
+ /**
41
+ *
42
+ * @type {string}
43
+ * @memberof ReqGetLiquidationInfos
44
+ */
45
+ cursor?: string;
46
+ /**
47
+ *
48
+ * @type {number}
49
+ * @memberof ReqGetLiquidationInfos
50
+ */
51
+ limit: number;
52
+ }
53
+
54
+ /**
55
+ * Check if a given object implements the ReqGetLiquidationInfos interface.
56
+ */
57
+ export function instanceOfReqGetLiquidationInfos(value: object): value is ReqGetLiquidationInfos {
58
+ if (!('account_index' in value) || value['account_index'] === undefined) return false;
59
+ if (!('limit' in value) || value['limit'] === undefined) return false;
60
+ return true;
61
+ }
62
+
63
+ export function ReqGetLiquidationInfosFromJSON(json: any): ReqGetLiquidationInfos {
64
+ return ReqGetLiquidationInfosFromJSONTyped(json, false);
65
+ }
66
+
67
+ export function ReqGetLiquidationInfosFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReqGetLiquidationInfos {
68
+ if (json == null) {
69
+ return json;
70
+ }
71
+ return {
72
+
73
+ 'auth': json['auth'] == null ? undefined : json['auth'],
74
+ 'account_index': json['account_index'],
75
+ 'market_id': json['market_id'] == null ? undefined : json['market_id'],
76
+ 'cursor': json['cursor'] == null ? undefined : json['cursor'],
77
+ 'limit': json['limit'],
78
+ };
79
+ }
80
+
81
+ export function ReqGetLiquidationInfosToJSON(value?: ReqGetLiquidationInfos | null): any {
82
+ if (value == null) {
83
+ return value;
84
+ }
85
+ return {
86
+
87
+ 'auth': value['auth'],
88
+ 'account_index': value['account_index'],
89
+ 'market_id': value['market_id'],
90
+ 'cursor': value['cursor'],
91
+ 'limit': value['limit'],
92
+ };
93
+ }
94
+
@@ -0,0 +1,97 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ *
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document:
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface RiskInfo
20
+ */
21
+ export interface RiskInfo {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof RiskInfo
26
+ */
27
+ collateral: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof RiskInfo
32
+ */
33
+ total_account_value: string;
34
+ /**
35
+ *
36
+ * @type {string}
37
+ * @memberof RiskInfo
38
+ */
39
+ initial_margin_req: string;
40
+ /**
41
+ *
42
+ * @type {string}
43
+ * @memberof RiskInfo
44
+ */
45
+ maintenance_margin_req: string;
46
+ /**
47
+ *
48
+ * @type {string}
49
+ * @memberof RiskInfo
50
+ */
51
+ close_out_margin_req: string;
52
+ }
53
+
54
+ /**
55
+ * Check if a given object implements the RiskInfo interface.
56
+ */
57
+ export function instanceOfRiskInfo(value: object): value is RiskInfo {
58
+ if (!('collateral' in value) || value['collateral'] === undefined) return false;
59
+ if (!('total_account_value' in value) || value['total_account_value'] === undefined) return false;
60
+ if (!('initial_margin_req' in value) || value['initial_margin_req'] === undefined) return false;
61
+ if (!('maintenance_margin_req' in value) || value['maintenance_margin_req'] === undefined) return false;
62
+ if (!('close_out_margin_req' in value) || value['close_out_margin_req'] === undefined) return false;
63
+ return true;
64
+ }
65
+
66
+ export function RiskInfoFromJSON(json: any): RiskInfo {
67
+ return RiskInfoFromJSONTyped(json, false);
68
+ }
69
+
70
+ export function RiskInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): RiskInfo {
71
+ if (json == null) {
72
+ return json;
73
+ }
74
+ return {
75
+
76
+ 'collateral': json['collateral'],
77
+ 'total_account_value': json['total_account_value'],
78
+ 'initial_margin_req': json['initial_margin_req'],
79
+ 'maintenance_margin_req': json['maintenance_margin_req'],
80
+ 'close_out_margin_req': json['close_out_margin_req'],
81
+ };
82
+ }
83
+
84
+ export function RiskInfoToJSON(value?: RiskInfo | null): any {
85
+ if (value == null) {
86
+ return value;
87
+ }
88
+ return {
89
+
90
+ 'collateral': value['collateral'],
91
+ 'total_account_value': value['total_account_value'],
92
+ 'initial_margin_req': value['initial_margin_req'],
93
+ 'maintenance_margin_req': value['maintenance_margin_req'],
94
+ 'close_out_margin_req': value['close_out_margin_req'],
95
+ };
96
+ }
97
+
package/models/index.ts CHANGED
@@ -42,6 +42,10 @@ export * from './L1ProviderInfo';
42
42
  export * from './Layer1BasicInfo';
43
43
  export * from './Leaderboard';
44
44
  export * from './LeaderboardEntry';
45
+ export * from './LiqTrade';
46
+ export * from './Liquidation';
47
+ export * from './LiquidationInfo';
48
+ export * from './LiquidationInfos';
45
49
  export * from './MarketInfo';
46
50
  export * from './NextNonce';
47
51
  export * from './Order';
@@ -86,6 +90,7 @@ export * from './ReqGetL1Metadata';
86
90
  export * from './ReqGetL1Tx';
87
91
  export * from './ReqGetLatestDeposit';
88
92
  export * from './ReqGetLeaderboard';
93
+ export * from './ReqGetLiquidationInfos';
89
94
  export * from './ReqGetNextNonce';
90
95
  export * from './ReqGetOrderBookDetails';
91
96
  export * from './ReqGetOrderBookOrders';
@@ -105,6 +110,7 @@ export * from './ReqIsWhitelisted';
105
110
  export * from './RespGetFastBridgeInfo';
106
111
  export * from './RespGetFastwithdrawalInfo';
107
112
  export * from './ResultCode';
113
+ export * from './RiskInfo';
108
114
  export * from './SimpleOrder';
109
115
  export * from './Status';
110
116
  export * from './SubAccounts';
package/openapi.json CHANGED
@@ -1445,6 +1445,78 @@
1445
1445
  "description": "Get points leaderboard"
1446
1446
  }
1447
1447
  },
1448
+ "/api/v1/liquidations": {
1449
+ "get": {
1450
+ "summary": "liquidations",
1451
+ "operationId": "liquidations",
1452
+ "responses": {
1453
+ "200": {
1454
+ "description": "A successful response.",
1455
+ "schema": {
1456
+ "$ref": "#/definitions/LiquidationInfos"
1457
+ }
1458
+ },
1459
+ "400": {
1460
+ "description": "Bad request",
1461
+ "schema": {
1462
+ "$ref": "#/definitions/ResultCode"
1463
+ }
1464
+ }
1465
+ },
1466
+ "parameters": [
1467
+ {
1468
+ "name": "authorization",
1469
+ "description": " make required after integ is done",
1470
+ "in": "header",
1471
+ "required": false,
1472
+ "type": "string"
1473
+ },
1474
+ {
1475
+ "name": "auth",
1476
+ "description": " made optional to support header auth clients",
1477
+ "in": "query",
1478
+ "required": false,
1479
+ "type": "string"
1480
+ },
1481
+ {
1482
+ "name": "account_index",
1483
+ "in": "query",
1484
+ "required": true,
1485
+ "type": "integer",
1486
+ "format": "int64"
1487
+ },
1488
+ {
1489
+ "name": "market_id",
1490
+ "in": "query",
1491
+ "required": false,
1492
+ "type": "integer",
1493
+ "format": "uint8"
1494
+ },
1495
+ {
1496
+ "name": "cursor",
1497
+ "in": "query",
1498
+ "required": false,
1499
+ "type": "string"
1500
+ },
1501
+ {
1502
+ "name": "limit",
1503
+ "in": "query",
1504
+ "required": true,
1505
+ "type": "integer",
1506
+ "format": "int64",
1507
+ "minimum": 1,
1508
+ "maximum": 100
1509
+ }
1510
+ ],
1511
+ "tags": [
1512
+ "account"
1513
+ ],
1514
+ "consumes": [
1515
+ "multipart/form-data"
1516
+ ],
1517
+ "description": "Get liquidation infos"
1518
+ }
1519
+ },
1448
1520
  "/api/v1/nextNonce": {
1449
1521
  "get": {
1450
1522
  "summary": "nextNonce",
@@ -4287,6 +4359,129 @@
4287
4359
  "entryId"
4288
4360
  ]
4289
4361
  },
4362
+ "LiqTrade": {
4363
+ "type": "object",
4364
+ "properties": {
4365
+ "price": {
4366
+ "type": "string"
4367
+ },
4368
+ "size": {
4369
+ "type": "string"
4370
+ },
4371
+ "taker_fee": {
4372
+ "type": "integer",
4373
+ "format": "int32"
4374
+ },
4375
+ "maker_fee": {
4376
+ "type": "integer",
4377
+ "format": "int32"
4378
+ }
4379
+ },
4380
+ "title": "LiqTrade",
4381
+ "required": [
4382
+ "price",
4383
+ "size",
4384
+ "taker_fee",
4385
+ "maker_fee"
4386
+ ]
4387
+ },
4388
+ "Liquidation": {
4389
+ "type": "object",
4390
+ "properties": {
4391
+ "id": {
4392
+ "type": "integer",
4393
+ "format": "int64"
4394
+ },
4395
+ "market_id": {
4396
+ "type": "integer",
4397
+ "format": "uint8"
4398
+ },
4399
+ "type": {
4400
+ "type": "string",
4401
+ "enum": [
4402
+ "partial",
4403
+ "deleverage"
4404
+ ]
4405
+ },
4406
+ "trade": {
4407
+ "$ref": "#/definitions/LiqTrade"
4408
+ },
4409
+ "info": {
4410
+ "$ref": "#/definitions/LiquidationInfo"
4411
+ },
4412
+ "executed_at": {
4413
+ "type": "integer",
4414
+ "format": "int64"
4415
+ }
4416
+ },
4417
+ "title": "Liquidation",
4418
+ "required": [
4419
+ "id",
4420
+ "market_id",
4421
+ "type",
4422
+ "trade",
4423
+ "info",
4424
+ "executed_at"
4425
+ ]
4426
+ },
4427
+ "LiquidationInfo": {
4428
+ "type": "object",
4429
+ "properties": {
4430
+ "positions": {
4431
+ "type": "array",
4432
+ "items": {
4433
+ "$ref": "#/definitions/AccountPosition"
4434
+ }
4435
+ },
4436
+ "risk_info_before": {
4437
+ "$ref": "#/definitions/RiskInfo"
4438
+ },
4439
+ "risk_info_after": {
4440
+ "$ref": "#/definitions/RiskInfo"
4441
+ },
4442
+ "mark_prices": {
4443
+ "type": "object",
4444
+ "additionalProperties": {
4445
+ "type": "integer",
4446
+ "format": "int64"
4447
+ }
4448
+ }
4449
+ },
4450
+ "title": "LiquidationInfo",
4451
+ "required": [
4452
+ "positions",
4453
+ "risk_info_before",
4454
+ "risk_info_after",
4455
+ "mark_prices"
4456
+ ]
4457
+ },
4458
+ "LiquidationInfos": {
4459
+ "type": "object",
4460
+ "properties": {
4461
+ "code": {
4462
+ "type": "integer",
4463
+ "format": "int32",
4464
+ "example": "200"
4465
+ },
4466
+ "message": {
4467
+ "type": "string"
4468
+ },
4469
+ "liquidations": {
4470
+ "type": "array",
4471
+ "items": {
4472
+ "$ref": "#/definitions/Liquidation"
4473
+ }
4474
+ },
4475
+ "next_cursor": {
4476
+ "type": "string"
4477
+ }
4478
+ },
4479
+ "title": "LiquidationInfos",
4480
+ "required": [
4481
+ "code",
4482
+ "liquidations"
4483
+ ]
4484
+ },
4290
4485
  "MarketInfo": {
4291
4486
  "type": "object",
4292
4487
  "properties": {
@@ -6162,6 +6357,37 @@
6162
6357
  "type"
6163
6358
  ]
6164
6359
  },
6360
+ "ReqGetLiquidationInfos": {
6361
+ "type": "object",
6362
+ "properties": {
6363
+ "auth": {
6364
+ "type": "string",
6365
+ "description": " made optional to support header auth clients"
6366
+ },
6367
+ "account_index": {
6368
+ "type": "integer",
6369
+ "format": "int64"
6370
+ },
6371
+ "market_id": {
6372
+ "type": "integer",
6373
+ "format": "uint8"
6374
+ },
6375
+ "cursor": {
6376
+ "type": "string"
6377
+ },
6378
+ "limit": {
6379
+ "type": "integer",
6380
+ "format": "int64",
6381
+ "maximum": 100,
6382
+ "minimum": 1
6383
+ }
6384
+ },
6385
+ "title": "ReqGetLiquidationInfos",
6386
+ "required": [
6387
+ "account_index",
6388
+ "limit"
6389
+ ]
6390
+ },
6165
6391
  "ReqGetNextNonce": {
6166
6392
  "type": "object",
6167
6393
  "properties": {
@@ -6697,6 +6923,34 @@
6697
6923
  "code"
6698
6924
  ]
6699
6925
  },
6926
+ "RiskInfo": {
6927
+ "type": "object",
6928
+ "properties": {
6929
+ "collateral": {
6930
+ "type": "string"
6931
+ },
6932
+ "total_account_value": {
6933
+ "type": "string"
6934
+ },
6935
+ "initial_margin_req": {
6936
+ "type": "string"
6937
+ },
6938
+ "maintenance_margin_req": {
6939
+ "type": "string"
6940
+ },
6941
+ "close_out_margin_req": {
6942
+ "type": "string"
6943
+ }
6944
+ },
6945
+ "title": "RiskInfo",
6946
+ "required": [
6947
+ "collateral",
6948
+ "total_account_value",
6949
+ "initial_margin_req",
6950
+ "maintenance_margin_req",
6951
+ "close_out_margin_req"
6952
+ ]
6953
+ },
6700
6954
  "SimpleOrder": {
6701
6955
  "type": "object",
6702
6956
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.121",
3
+ "version": "1.0.123",
4
4
  "description": "zkLighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {