zklighter-perps 1.0.348 → 1.0.350

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.
@@ -283,6 +283,7 @@ models/ReqTvHistory.ts
283
283
  models/ReqTvSymbolInfo.ts
284
284
  models/RespAtomicOrder.ts
285
285
  models/RespAtomicOrderList.ts
286
+ models/RespBuyVolumeQuota.ts
286
287
  models/RespChangeAccountTier.ts
287
288
  models/RespConnectX.ts
288
289
  models/RespConnectXCallback.ts
@@ -30,6 +30,7 @@ import type {
30
30
  PartnerStats,
31
31
  PnlLeaderboard,
32
32
  PositionFundings,
33
+ RespBuyVolumeQuota,
33
34
  RespChangeAccountTier,
34
35
  RespConnectX,
35
36
  RespConnectXCallback,
@@ -82,6 +83,8 @@ import {
82
83
  PnlLeaderboardToJSON,
83
84
  PositionFundingsFromJSON,
84
85
  PositionFundingsToJSON,
86
+ RespBuyVolumeQuotaFromJSON,
87
+ RespBuyVolumeQuotaToJSON,
85
88
  RespChangeAccountTierFromJSON,
86
89
  RespChangeAccountTierToJSON,
87
90
  RespConnectXFromJSON,
@@ -169,6 +172,14 @@ export interface ApikeysRequest {
169
172
  api_key_index?: number;
170
173
  }
171
174
 
175
+ export interface BuyVolumeQuotaRequest {
176
+ quota: number;
177
+ authorization?: string;
178
+ tx_info?: string;
179
+ tx_hash?: string;
180
+ destination_l1_address?: string;
181
+ }
182
+
172
183
  export interface ChangeAccountTierRequest {
173
184
  account_index: number;
174
185
  new_tier: string;
@@ -772,6 +783,76 @@ export class AccountApi extends runtime.BaseAPI {
772
783
  return await response.value();
773
784
  }
774
785
 
786
+ /**
787
+ * Buy volume quota with USDC
788
+ * buyVolumeQuota
789
+ */
790
+ async buyVolumeQuotaRaw(requestParameters: BuyVolumeQuotaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RespBuyVolumeQuota>> {
791
+ if (requestParameters['quota'] == null) {
792
+ throw new runtime.RequiredError(
793
+ 'quota',
794
+ 'Required parameter "quota" was null or undefined when calling buyVolumeQuota().'
795
+ );
796
+ }
797
+
798
+ const queryParameters: any = {};
799
+
800
+ const headerParameters: runtime.HTTPHeaders = {};
801
+
802
+ if (requestParameters['authorization'] != null) {
803
+ headerParameters['authorization'] = String(requestParameters['authorization']);
804
+ }
805
+
806
+ const consumes: runtime.Consume[] = [
807
+ { contentType: 'multipart/form-data' },
808
+ ];
809
+ // @ts-ignore: canConsumeForm may be unused
810
+ const canConsumeForm = runtime.canConsumeForm(consumes);
811
+
812
+ let formParams: { append(param: string, value: any): any };
813
+ let useForm = false;
814
+ if (useForm) {
815
+ formParams = new FormData();
816
+ } else {
817
+ formParams = new URLSearchParams();
818
+ }
819
+
820
+ if (requestParameters['tx_info'] != null) {
821
+ formParams.append('tx_info', requestParameters['tx_info'] as any);
822
+ }
823
+
824
+ if (requestParameters['tx_hash'] != null) {
825
+ formParams.append('tx_hash', requestParameters['tx_hash'] as any);
826
+ }
827
+
828
+ if (requestParameters['quota'] != null) {
829
+ formParams.append('quota', requestParameters['quota'] as any);
830
+ }
831
+
832
+ if (requestParameters['destination_l1_address'] != null) {
833
+ formParams.append('destination_l1_address', requestParameters['destination_l1_address'] as any);
834
+ }
835
+
836
+ const response = await this.request({
837
+ path: `/api/v1/buyVolumeQuota`,
838
+ method: 'POST',
839
+ headers: headerParameters,
840
+ query: queryParameters,
841
+ body: formParams,
842
+ }, initOverrides);
843
+
844
+ return new runtime.JSONApiResponse(response, (jsonValue) => RespBuyVolumeQuotaFromJSON(jsonValue));
845
+ }
846
+
847
+ /**
848
+ * Buy volume quota with USDC
849
+ * buyVolumeQuota
850
+ */
851
+ async buyVolumeQuota(requestParameters: BuyVolumeQuotaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RespBuyVolumeQuota> {
852
+ const response = await this.buyVolumeQuotaRaw(requestParameters, initOverrides);
853
+ return await response.value();
854
+ }
855
+
775
856
  /**
776
857
  * Change account tier
777
858
  * changeAccountTier
package/apis/InfoApi.ts CHANGED
@@ -94,7 +94,7 @@ export class InfoApi extends runtime.BaseAPI {
94
94
  }
95
95
 
96
96
  /**
97
- * Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol
97
+ * Get price oracle info (source, median exchanges, price cap, last accepted time and publishing status) for all markets or a single symbol
98
98
  * priceOracleInfo
99
99
  */
100
100
  async priceOracleInfoRaw(requestParameters: PriceOracleInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RespPriceOracleInfo>> {
@@ -117,7 +117,7 @@ export class InfoApi extends runtime.BaseAPI {
117
117
  }
118
118
 
119
119
  /**
120
- * Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol
120
+ * Get price oracle info (source, median exchanges, price cap, last accepted time and publishing status) for all markets or a single symbol
121
121
  * priceOracleInfo
122
122
  */
123
123
  async priceOracleInfo(requestParameters: PriceOracleInfoRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RespPriceOracleInfo> {
@@ -103,6 +103,24 @@ export interface AccountLimits {
103
103
  * @memberof AccountLimits
104
104
  */
105
105
  user_tier_last_update?: number;
106
+ /**
107
+ *
108
+ * @type {string}
109
+ * @memberof AccountLimits
110
+ */
111
+ volume_quota_remaining: string;
112
+ /**
113
+ *
114
+ * @type {string}
115
+ * @memberof AccountLimits
116
+ */
117
+ volume_quota_cap: string;
118
+ /**
119
+ *
120
+ * @type {string}
121
+ * @memberof AccountLimits
122
+ */
123
+ volume_quota_purchase_cap: string;
106
124
  }
107
125
 
108
126
  /**
@@ -121,6 +139,9 @@ export function instanceOfAccountLimits(value: object): value is AccountLimits {
121
139
  if (!('current_taker_fee_tick' in value) || value['current_taker_fee_tick'] === undefined) return false;
122
140
  if (!('leased_lit' in value) || value['leased_lit'] === undefined) return false;
123
141
  if (!('effective_lit_stakes' in value) || value['effective_lit_stakes'] === undefined) return false;
142
+ if (!('volume_quota_remaining' in value) || value['volume_quota_remaining'] === undefined) return false;
143
+ if (!('volume_quota_cap' in value) || value['volume_quota_cap'] === undefined) return false;
144
+ if (!('volume_quota_purchase_cap' in value) || value['volume_quota_purchase_cap'] === undefined) return false;
124
145
  return true;
125
146
  }
126
147
 
@@ -148,6 +169,9 @@ export function AccountLimitsFromJSONTyped(json: any, ignoreDiscriminator: boole
148
169
  'leased_lit': json['leased_lit'],
149
170
  'effective_lit_stakes': json['effective_lit_stakes'],
150
171
  'user_tier_last_update': json['user_tier_last_update'] == null ? undefined : json['user_tier_last_update'],
172
+ 'volume_quota_remaining': json['volume_quota_remaining'],
173
+ 'volume_quota_cap': json['volume_quota_cap'],
174
+ 'volume_quota_purchase_cap': json['volume_quota_purchase_cap'],
151
175
  };
152
176
  }
153
177
 
@@ -171,6 +195,9 @@ export function AccountLimitsToJSON(value?: AccountLimits | null): any {
171
195
  'leased_lit': value['leased_lit'],
172
196
  'effective_lit_stakes': value['effective_lit_stakes'],
173
197
  'user_tier_last_update': value['user_tier_last_update'],
198
+ 'volume_quota_remaining': value['volume_quota_remaining'],
199
+ 'volume_quota_cap': value['volume_quota_cap'],
200
+ 'volume_quota_purchase_cap': value['volume_quota_purchase_cap'],
174
201
  };
175
202
  }
176
203
 
@@ -61,6 +61,30 @@ export interface PriceOraclePrice {
61
61
  * @memberof PriceOraclePrice
62
62
  */
63
63
  price_cap_reference_price: number;
64
+ /**
65
+ * 0 if none accepted since the price service started
66
+ * @type {number}
67
+ * @memberof PriceOraclePrice
68
+ */
69
+ last_accepted_at_ms: number;
70
+ /**
71
+ * no source is currently publishing a price
72
+ * @type {boolean}
73
+ * @memberof PriceOraclePrice
74
+ */
75
+ awaiting_sources: boolean;
76
+ /**
77
+ * a newer price is pending acceptance
78
+ * @type {boolean}
79
+ * @memberof PriceOraclePrice
80
+ */
81
+ awaiting_verification: boolean;
82
+ /**
83
+ * no price accepted for longer than the market's staleness threshold
84
+ * @type {boolean}
85
+ * @memberof PriceOraclePrice
86
+ */
87
+ stale: boolean;
64
88
  }
65
89
 
66
90
  /**
@@ -74,6 +98,10 @@ export function instanceOfPriceOraclePrice(value: object): value is PriceOracleP
74
98
  if (!('underlying' in value) || value['underlying'] === undefined) return false;
75
99
  if (!('price_cap_bps' in value) || value['price_cap_bps'] === undefined) return false;
76
100
  if (!('price_cap_reference_price' in value) || value['price_cap_reference_price'] === undefined) return false;
101
+ if (!('last_accepted_at_ms' in value) || value['last_accepted_at_ms'] === undefined) return false;
102
+ if (!('awaiting_sources' in value) || value['awaiting_sources'] === undefined) return false;
103
+ if (!('awaiting_verification' in value) || value['awaiting_verification'] === undefined) return false;
104
+ if (!('stale' in value) || value['stale'] === undefined) return false;
77
105
  return true;
78
106
  }
79
107
 
@@ -94,6 +122,10 @@ export function PriceOraclePriceFromJSONTyped(json: any, ignoreDiscriminator: bo
94
122
  'underlying': json['underlying'],
95
123
  'price_cap_bps': json['price_cap_bps'],
96
124
  'price_cap_reference_price': json['price_cap_reference_price'],
125
+ 'last_accepted_at_ms': json['last_accepted_at_ms'],
126
+ 'awaiting_sources': json['awaiting_sources'],
127
+ 'awaiting_verification': json['awaiting_verification'],
128
+ 'stale': json['stale'],
97
129
  };
98
130
  }
99
131
 
@@ -110,6 +142,10 @@ export function PriceOraclePriceToJSON(value?: PriceOraclePrice | null): any {
110
142
  'underlying': value['underlying'],
111
143
  'price_cap_bps': value['price_cap_bps'],
112
144
  'price_cap_reference_price': value['price_cap_reference_price'],
145
+ 'last_accepted_at_ms': value['last_accepted_at_ms'],
146
+ 'awaiting_sources': value['awaiting_sources'],
147
+ 'awaiting_verification': value['awaiting_verification'],
148
+ 'stale': value['stale'],
113
149
  };
114
150
  }
115
151
 
@@ -0,0 +1,125 @@
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 RespBuyVolumeQuota
20
+ */
21
+ export interface RespBuyVolumeQuota {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof RespBuyVolumeQuota
26
+ */
27
+ code: number;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof RespBuyVolumeQuota
32
+ */
33
+ message?: string;
34
+ /**
35
+ *
36
+ * @type {string}
37
+ * @memberof RespBuyVolumeQuota
38
+ */
39
+ tx_hash: string;
40
+ /**
41
+ *
42
+ * @type {string}
43
+ * @memberof RespBuyVolumeQuota
44
+ */
45
+ l1_address: string;
46
+ /**
47
+ *
48
+ * @type {number}
49
+ * @memberof RespBuyVolumeQuota
50
+ */
51
+ quota: number;
52
+ /**
53
+ *
54
+ * @type {number}
55
+ * @memberof RespBuyVolumeQuota
56
+ */
57
+ volume_quota_remaining: number;
58
+ /**
59
+ *
60
+ * @type {string}
61
+ * @memberof RespBuyVolumeQuota
62
+ */
63
+ status: RespBuyVolumeQuotaStatusEnum;
64
+ }
65
+
66
+
67
+ /**
68
+ * @export
69
+ */
70
+ export const RespBuyVolumeQuotaStatusEnum = {
71
+ Credited: 'credited',
72
+ Pending: 'pending'
73
+ } as const;
74
+ export type RespBuyVolumeQuotaStatusEnum = typeof RespBuyVolumeQuotaStatusEnum[keyof typeof RespBuyVolumeQuotaStatusEnum];
75
+
76
+
77
+ /**
78
+ * Check if a given object implements the RespBuyVolumeQuota interface.
79
+ */
80
+ export function instanceOfRespBuyVolumeQuota(value: object): value is RespBuyVolumeQuota {
81
+ if (!('code' in value) || value['code'] === undefined) return false;
82
+ if (!('tx_hash' in value) || value['tx_hash'] === undefined) return false;
83
+ if (!('l1_address' in value) || value['l1_address'] === undefined) return false;
84
+ if (!('quota' in value) || value['quota'] === undefined) return false;
85
+ if (!('volume_quota_remaining' in value) || value['volume_quota_remaining'] === undefined) return false;
86
+ if (!('status' in value) || value['status'] === undefined) return false;
87
+ return true;
88
+ }
89
+
90
+ export function RespBuyVolumeQuotaFromJSON(json: any): RespBuyVolumeQuota {
91
+ return RespBuyVolumeQuotaFromJSONTyped(json, false);
92
+ }
93
+
94
+ export function RespBuyVolumeQuotaFromJSONTyped(json: any, ignoreDiscriminator: boolean): RespBuyVolumeQuota {
95
+ if (json == null) {
96
+ return json;
97
+ }
98
+ return {
99
+
100
+ 'code': json['code'],
101
+ 'message': json['message'] == null ? undefined : json['message'],
102
+ 'tx_hash': json['tx_hash'],
103
+ 'l1_address': json['l1_address'],
104
+ 'quota': json['quota'],
105
+ 'volume_quota_remaining': json['volume_quota_remaining'],
106
+ 'status': json['status'],
107
+ };
108
+ }
109
+
110
+ export function RespBuyVolumeQuotaToJSON(value?: RespBuyVolumeQuota | null): any {
111
+ if (value == null) {
112
+ return value;
113
+ }
114
+ return {
115
+
116
+ 'code': value['code'],
117
+ 'message': value['message'],
118
+ 'tx_hash': value['tx_hash'],
119
+ 'l1_address': value['l1_address'],
120
+ 'quota': value['quota'],
121
+ 'volume_quota_remaining': value['volume_quota_remaining'],
122
+ 'status': value['status'],
123
+ };
124
+ }
125
+
package/models/index.ts CHANGED
@@ -254,6 +254,7 @@ export * from './ReqTvHistory';
254
254
  export * from './ReqTvSymbolInfo';
255
255
  export * from './RespAtomicOrder';
256
256
  export * from './RespAtomicOrderList';
257
+ export * from './RespBuyVolumeQuota';
257
258
  export * from './RespChangeAccountTier';
258
259
  export * from './RespConnectX';
259
260
  export * from './RespConnectXCallback';
package/openapi.json CHANGED
@@ -1318,6 +1318,49 @@
1318
1318
  "description": "Get if next bridge is fast"
1319
1319
  }
1320
1320
  },
1321
+ "/api/v1/buyVolumeQuota": {
1322
+ "post": {
1323
+ "summary": "buyVolumeQuota",
1324
+ "operationId": "buyVolumeQuota",
1325
+ "responses": {
1326
+ "200": {
1327
+ "description": "A successful response.",
1328
+ "schema": {
1329
+ "$ref": "#/definitions/RespBuyVolumeQuota"
1330
+ }
1331
+ },
1332
+ "400": {
1333
+ "description": "Bad request",
1334
+ "schema": {
1335
+ "$ref": "#/definitions/ResultCode"
1336
+ }
1337
+ }
1338
+ },
1339
+ "parameters": [
1340
+ {
1341
+ "name": "authorization",
1342
+ "in": "header",
1343
+ "required": false,
1344
+ "type": "string"
1345
+ },
1346
+ {
1347
+ "name": "body",
1348
+ "in": "body",
1349
+ "required": true,
1350
+ "schema": {
1351
+ "$ref": "#/definitions/ReqBuyVolumeQuota"
1352
+ }
1353
+ }
1354
+ ],
1355
+ "tags": [
1356
+ "account"
1357
+ ],
1358
+ "consumes": [
1359
+ "multipart/form-data"
1360
+ ],
1361
+ "description": "Buy volume quota with USDC"
1362
+ }
1363
+ },
1321
1364
  "/api/v1/candles": {
1322
1365
  "get": {
1323
1366
  "summary": "candles",
@@ -5784,7 +5827,7 @@
5784
5827
  "consumes": [
5785
5828
  "multipart/form-data"
5786
5829
  ],
5787
- "description": "Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol"
5830
+ "description": "Get price oracle info (source, median exchanges, price cap, last accepted time and publishing status) for all markets or a single symbol"
5788
5831
  }
5789
5832
  },
5790
5833
  "/api/v1/publicPoolsMetadata": {
@@ -8602,6 +8645,18 @@
8602
8645
  "user_tier_last_update": {
8603
8646
  "type": "integer",
8604
8647
  "format": "int64"
8648
+ },
8649
+ "volume_quota_remaining": {
8650
+ "type": "string",
8651
+ "example": "1010780"
8652
+ },
8653
+ "volume_quota_cap": {
8654
+ "type": "string",
8655
+ "example": "15000000"
8656
+ },
8657
+ "volume_quota_purchase_cap": {
8658
+ "type": "string",
8659
+ "example": "30000000"
8605
8660
  }
8606
8661
  },
8607
8662
  "title": "AccountLimits",
@@ -8617,7 +8672,10 @@
8617
8672
  "current_maker_fee_tick",
8618
8673
  "current_taker_fee_tick",
8619
8674
  "leased_lit",
8620
- "effective_lit_stakes"
8675
+ "effective_lit_stakes",
8676
+ "volume_quota_remaining",
8677
+ "volume_quota_cap",
8678
+ "volume_quota_purchase_cap"
8621
8679
  ]
8622
8680
  },
8623
8681
  "AccountMarginStats": {
@@ -16136,6 +16194,26 @@
16136
16194
  "type": "number",
16137
16195
  "format": "double",
16138
16196
  "description": " cap bounds: ref * (1 -/+ bps / 10000)"
16197
+ },
16198
+ "last_accepted_at_ms": {
16199
+ "type": "integer",
16200
+ "format": "int64",
16201
+ "description": " 0 if none accepted since the price service started"
16202
+ },
16203
+ "awaiting_sources": {
16204
+ "type": "boolean",
16205
+ "format": "boolean",
16206
+ "description": " no source is currently publishing a price"
16207
+ },
16208
+ "awaiting_verification": {
16209
+ "type": "boolean",
16210
+ "format": "boolean",
16211
+ "description": " a newer price is pending acceptance"
16212
+ },
16213
+ "stale": {
16214
+ "type": "boolean",
16215
+ "format": "boolean",
16216
+ "description": " no price accepted for longer than the market's staleness threshold"
16139
16217
  }
16140
16218
  },
16141
16219
  "title": "PriceOraclePrice",
@@ -16146,7 +16224,11 @@
16146
16224
  "median_sources",
16147
16225
  "underlying",
16148
16226
  "price_cap_bps",
16149
- "price_cap_reference_price"
16227
+ "price_cap_reference_price",
16228
+ "last_accepted_at_ms",
16229
+ "awaiting_sources",
16230
+ "awaiting_verification",
16231
+ "stale"
16150
16232
  ]
16151
16233
  },
16152
16234
  "PublicPoolInfo": {
@@ -16908,6 +16990,28 @@
16908
16990
  "account_index"
16909
16991
  ]
16910
16992
  },
16993
+ "ReqBuyVolumeQuota": {
16994
+ "type": "object",
16995
+ "properties": {
16996
+ "tx_info": {
16997
+ "type": "string"
16998
+ },
16999
+ "tx_hash": {
17000
+ "type": "string"
17001
+ },
17002
+ "quota": {
17003
+ "type": "integer",
17004
+ "format": "int64"
17005
+ },
17006
+ "destination_l1_address": {
17007
+ "type": "string"
17008
+ }
17009
+ },
17010
+ "title": "ReqBuyVolumeQuota",
17011
+ "required": [
17012
+ "quota"
17013
+ ]
17014
+ },
16911
17015
  "ReqChangeAccountTier": {
16912
17016
  "type": "object",
16913
17017
  "properties": {
@@ -20683,6 +20787,54 @@
20683
20787
  "atomic_orders"
20684
20788
  ]
20685
20789
  },
20790
+ "RespBuyVolumeQuota": {
20791
+ "type": "object",
20792
+ "properties": {
20793
+ "code": {
20794
+ "type": "integer",
20795
+ "format": "int32",
20796
+ "example": "200"
20797
+ },
20798
+ "message": {
20799
+ "type": "string"
20800
+ },
20801
+ "tx_hash": {
20802
+ "type": "string",
20803
+ "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
20804
+ },
20805
+ "l1_address": {
20806
+ "type": "string",
20807
+ "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
20808
+ },
20809
+ "quota": {
20810
+ "type": "integer",
20811
+ "format": "int64",
20812
+ "example": "1000000"
20813
+ },
20814
+ "volume_quota_remaining": {
20815
+ "type": "integer",
20816
+ "format": "int64",
20817
+ "example": "1010780"
20818
+ },
20819
+ "status": {
20820
+ "type": "string",
20821
+ "example": "credited",
20822
+ "enum": [
20823
+ "credited",
20824
+ "pending"
20825
+ ]
20826
+ }
20827
+ },
20828
+ "title": "RespBuyVolumeQuota",
20829
+ "required": [
20830
+ "code",
20831
+ "tx_hash",
20832
+ "l1_address",
20833
+ "quota",
20834
+ "volume_quota_remaining",
20835
+ "status"
20836
+ ]
20837
+ },
20686
20838
  "RespChangeAccountTier": {
20687
20839
  "type": "object",
20688
20840
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.348",
3
+ "version": "1.0.350",
4
4
  "description": "Lighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {