zklighter-perps 1.0.361 → 1.0.362

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.
@@ -51,6 +51,8 @@ models/Alert.ts
51
51
  models/Announcement.ts
52
52
  models/Announcements.ts
53
53
  models/ApiKey.ts
54
+ models/ApiKeyRestrictions.ts
55
+ models/ApiKeySeries.ts
54
56
  models/ApiToken.ts
55
57
  models/ApprovedIntegrator.ts
56
58
  models/Asset.ts
@@ -152,6 +154,7 @@ models/OrderBook.ts
152
154
  models/OrderBookDepth.ts
153
155
  models/OrderBookDepthWithBeginNonce.ts
154
156
  models/OrderBookDetails.ts
157
+ models/OrderBookLevel.ts
155
158
  models/OrderBookOrders.ts
156
159
  models/OrderBookStats.ts
157
160
  models/OrderBooks.ts
@@ -169,6 +169,8 @@ export interface AirdropCreateRequest {
169
169
 
170
170
  export interface ApikeysRequest {
171
171
  account_index: number;
172
+ authorization?: string;
173
+ auth?: string;
172
174
  api_key_index?: number;
173
175
  }
174
176
 
@@ -367,6 +369,18 @@ export interface RfqUpdateRequest {
367
369
  auth?: string;
368
370
  }
369
371
 
372
+ export interface SetApiKeyRestrictionsRequest {
373
+ account_index: number;
374
+ api_key_index: number;
375
+ public_key: string;
376
+ market_ids: string;
377
+ valid_until: number;
378
+ timestamp: number;
379
+ signature: string;
380
+ series?: string;
381
+ allowed_ips?: string;
382
+ }
383
+
370
384
  export interface SetMakerOnlyApiKeysRequest {
371
385
  account_index: number;
372
386
  api_key_indexes: string;
@@ -741,7 +755,7 @@ export class AccountApi extends runtime.BaseAPI {
741
755
  }
742
756
 
743
757
  /**
744
- * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account.
758
+ * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. Restrictions are returned only with auth for the account.
745
759
  * apikeys
746
760
  */
747
761
  async apikeysRaw(requestParameters: ApikeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountApiKeys>> {
@@ -754,6 +768,14 @@ export class AccountApi extends runtime.BaseAPI {
754
768
 
755
769
  const queryParameters: any = {};
756
770
 
771
+ if (requestParameters['authorization'] != null) {
772
+ queryParameters['authorization'] = requestParameters['authorization'];
773
+ }
774
+
775
+ if (requestParameters['auth'] != null) {
776
+ queryParameters['auth'] = requestParameters['auth'];
777
+ }
778
+
757
779
  if (requestParameters['account_index'] != null) {
758
780
  queryParameters['account_index'] = requestParameters['account_index'];
759
781
  }
@@ -775,7 +797,7 @@ export class AccountApi extends runtime.BaseAPI {
775
797
  }
776
798
 
777
799
  /**
778
- * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account.
800
+ * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. Restrictions are returned only with auth for the account.
779
801
  * apikeys
780
802
  */
781
803
  async apikeys(requestParameters: ApikeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountApiKeys> {
@@ -2492,6 +2514,134 @@ export class AccountApi extends runtime.BaseAPI {
2492
2514
  return await response.value();
2493
2515
  }
2494
2516
 
2517
+ /**
2518
+ * Replace an API key\'s restrictions. They apply to every transaction the key signs except ChangePubKey and ChangeECDSAPubKey, which the L1 wallet signs. With a market whitelist, the key can only place, modify and cancel orders and change leverage or margin in those markets and in binary options markets of those series (event creator and tag). With an IP whitelist, the key can only send from those IPs. An expired key can sign nothing else. Restrictions belong to the key\'s public key. The account\'s L1 wallet personal_signs these lines: \'Set API Key Restrictions\', a blank line, \'account index: N\', \'api key index: N\', \'pubkey: 0x<public_key>\', \'market ids: <market_ids>\', \'series: <series>\', \'allowed ips: <allowed_ips>\', \'valid until: N\', \'timestamp: N\', \'chainId: N\', \'Only sign this message for a trusted client!\'. Each N is 0x plus 16 lowercase hex digits, public_key is lowercase hex, and lists are the exact strings sent, with an omitted series or allowed_ips signed as [].
2519
+ * setApiKeyRestrictions
2520
+ */
2521
+ async setApiKeyRestrictionsRaw(requestParameters: SetApiKeyRestrictionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ResultCode>> {
2522
+ if (requestParameters['account_index'] == null) {
2523
+ throw new runtime.RequiredError(
2524
+ 'account_index',
2525
+ 'Required parameter "account_index" was null or undefined when calling setApiKeyRestrictions().'
2526
+ );
2527
+ }
2528
+
2529
+ if (requestParameters['api_key_index'] == null) {
2530
+ throw new runtime.RequiredError(
2531
+ 'api_key_index',
2532
+ 'Required parameter "api_key_index" was null or undefined when calling setApiKeyRestrictions().'
2533
+ );
2534
+ }
2535
+
2536
+ if (requestParameters['public_key'] == null) {
2537
+ throw new runtime.RequiredError(
2538
+ 'public_key',
2539
+ 'Required parameter "public_key" was null or undefined when calling setApiKeyRestrictions().'
2540
+ );
2541
+ }
2542
+
2543
+ if (requestParameters['market_ids'] == null) {
2544
+ throw new runtime.RequiredError(
2545
+ 'market_ids',
2546
+ 'Required parameter "market_ids" was null or undefined when calling setApiKeyRestrictions().'
2547
+ );
2548
+ }
2549
+
2550
+ if (requestParameters['valid_until'] == null) {
2551
+ throw new runtime.RequiredError(
2552
+ 'valid_until',
2553
+ 'Required parameter "valid_until" was null or undefined when calling setApiKeyRestrictions().'
2554
+ );
2555
+ }
2556
+
2557
+ if (requestParameters['timestamp'] == null) {
2558
+ throw new runtime.RequiredError(
2559
+ 'timestamp',
2560
+ 'Required parameter "timestamp" was null or undefined when calling setApiKeyRestrictions().'
2561
+ );
2562
+ }
2563
+
2564
+ if (requestParameters['signature'] == null) {
2565
+ throw new runtime.RequiredError(
2566
+ 'signature',
2567
+ 'Required parameter "signature" was null or undefined when calling setApiKeyRestrictions().'
2568
+ );
2569
+ }
2570
+
2571
+ const queryParameters: any = {};
2572
+
2573
+ const headerParameters: runtime.HTTPHeaders = {};
2574
+
2575
+ const consumes: runtime.Consume[] = [
2576
+ { contentType: 'multipart/form-data' },
2577
+ ];
2578
+ // @ts-ignore: canConsumeForm may be unused
2579
+ const canConsumeForm = runtime.canConsumeForm(consumes);
2580
+
2581
+ let formParams: { append(param: string, value: any): any };
2582
+ let useForm = false;
2583
+ if (useForm) {
2584
+ formParams = new FormData();
2585
+ } else {
2586
+ formParams = new URLSearchParams();
2587
+ }
2588
+
2589
+ if (requestParameters['account_index'] != null) {
2590
+ formParams.append('account_index', requestParameters['account_index'] as any);
2591
+ }
2592
+
2593
+ if (requestParameters['api_key_index'] != null) {
2594
+ formParams.append('api_key_index', requestParameters['api_key_index'] as any);
2595
+ }
2596
+
2597
+ if (requestParameters['public_key'] != null) {
2598
+ formParams.append('public_key', requestParameters['public_key'] as any);
2599
+ }
2600
+
2601
+ if (requestParameters['market_ids'] != null) {
2602
+ formParams.append('market_ids', requestParameters['market_ids'] as any);
2603
+ }
2604
+
2605
+ if (requestParameters['series'] != null) {
2606
+ formParams.append('series', requestParameters['series'] as any);
2607
+ }
2608
+
2609
+ if (requestParameters['allowed_ips'] != null) {
2610
+ formParams.append('allowed_ips', requestParameters['allowed_ips'] as any);
2611
+ }
2612
+
2613
+ if (requestParameters['valid_until'] != null) {
2614
+ formParams.append('valid_until', requestParameters['valid_until'] as any);
2615
+ }
2616
+
2617
+ if (requestParameters['timestamp'] != null) {
2618
+ formParams.append('timestamp', requestParameters['timestamp'] as any);
2619
+ }
2620
+
2621
+ if (requestParameters['signature'] != null) {
2622
+ formParams.append('signature', requestParameters['signature'] as any);
2623
+ }
2624
+
2625
+ const response = await this.request({
2626
+ path: `/api/v1/setApiKeyRestrictions`,
2627
+ method: 'POST',
2628
+ headers: headerParameters,
2629
+ query: queryParameters,
2630
+ body: formParams,
2631
+ }, initOverrides);
2632
+
2633
+ return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue));
2634
+ }
2635
+
2636
+ /**
2637
+ * Replace an API key\'s restrictions. They apply to every transaction the key signs except ChangePubKey and ChangeECDSAPubKey, which the L1 wallet signs. With a market whitelist, the key can only place, modify and cancel orders and change leverage or margin in those markets and in binary options markets of those series (event creator and tag). With an IP whitelist, the key can only send from those IPs. An expired key can sign nothing else. Restrictions belong to the key\'s public key. The account\'s L1 wallet personal_signs these lines: \'Set API Key Restrictions\', a blank line, \'account index: N\', \'api key index: N\', \'pubkey: 0x<public_key>\', \'market ids: <market_ids>\', \'series: <series>\', \'allowed ips: <allowed_ips>\', \'valid until: N\', \'timestamp: N\', \'chainId: N\', \'Only sign this message for a trusted client!\'. Each N is 0x plus 16 lowercase hex digits, public_key is lowercase hex, and lists are the exact strings sent, with an omitted series or allowed_ips signed as [].
2638
+ * setApiKeyRestrictions
2639
+ */
2640
+ async setApiKeyRestrictions(requestParameters: SetApiKeyRestrictionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResultCode> {
2641
+ const response = await this.setApiKeyRestrictionsRaw(requestParameters, initOverrides);
2642
+ return await response.value();
2643
+ }
2644
+
2495
2645
  /**
2496
2646
  * Set maker-only API key indexes
2497
2647
  * setMakerOnlyApiKeys
package/apis/OrderApi.ts CHANGED
@@ -167,6 +167,8 @@ export interface OrderBookDetailsRequest {
167
167
  export interface OrderBookOrdersRequest {
168
168
  market_id: number;
169
169
  limit: number;
170
+ n_sig_figs?: number;
171
+ mantissa?: number;
170
172
  }
171
173
 
172
174
  export interface OrderBooksRequest {
@@ -988,6 +990,14 @@ export class OrderApi extends runtime.BaseAPI {
988
990
  queryParameters['limit'] = requestParameters['limit'];
989
991
  }
990
992
 
993
+ if (requestParameters['n_sig_figs'] != null) {
994
+ queryParameters['n_sig_figs'] = requestParameters['n_sig_figs'];
995
+ }
996
+
997
+ if (requestParameters['mantissa'] != null) {
998
+ queryParameters['mantissa'] = requestParameters['mantissa'];
999
+ }
1000
+
991
1001
  const headerParameters: runtime.HTTPHeaders = {};
992
1002
 
993
1003
  const response = await this.request({
package/models/ApiKey.ts CHANGED
@@ -13,6 +13,13 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { ApiKeyRestrictions } from './ApiKeyRestrictions';
17
+ import {
18
+ ApiKeyRestrictionsFromJSON,
19
+ ApiKeyRestrictionsFromJSONTyped,
20
+ ApiKeyRestrictionsToJSON,
21
+ } from './ApiKeyRestrictions';
22
+
16
23
  /**
17
24
  *
18
25
  * @export
@@ -55,6 +62,12 @@ export interface ApiKey {
55
62
  * @memberof ApiKey
56
63
  */
57
64
  transaction_time: number;
65
+ /**
66
+ *
67
+ * @type {ApiKeyRestrictions}
68
+ * @memberof ApiKey
69
+ */
70
+ restrictions: ApiKeyRestrictions;
58
71
  }
59
72
 
60
73
  /**
@@ -67,6 +80,7 @@ export function instanceOfApiKey(value: object): value is ApiKey {
67
80
  if (!('key_type' in value) || value['key_type'] === undefined) return false;
68
81
  if (!('public_key' in value) || value['public_key'] === undefined) return false;
69
82
  if (!('transaction_time' in value) || value['transaction_time'] === undefined) return false;
83
+ if (!('restrictions' in value) || value['restrictions'] === undefined) return false;
70
84
  return true;
71
85
  }
72
86
 
@@ -86,6 +100,7 @@ export function ApiKeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ap
86
100
  'key_type': json['key_type'],
87
101
  'public_key': json['public_key'],
88
102
  'transaction_time': json['transaction_time'],
103
+ 'restrictions': ApiKeyRestrictionsFromJSON(json['restrictions']),
89
104
  };
90
105
  }
91
106
 
@@ -101,6 +116,7 @@ export function ApiKeyToJSON(value?: ApiKey | null): any {
101
116
  'key_type': value['key_type'],
102
117
  'public_key': value['public_key'],
103
118
  'transaction_time': value['transaction_time'],
119
+ 'restrictions': ApiKeyRestrictionsToJSON(value['restrictions']),
104
120
  };
105
121
  }
106
122
 
@@ -0,0 +1,95 @@
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 { ApiKeySeries } from './ApiKeySeries';
17
+ import {
18
+ ApiKeySeriesFromJSON,
19
+ ApiKeySeriesFromJSONTyped,
20
+ ApiKeySeriesToJSON,
21
+ } from './ApiKeySeries';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface ApiKeyRestrictions
27
+ */
28
+ export interface ApiKeyRestrictions {
29
+ /**
30
+ * markets this key may trade; with series also empty, allows all
31
+ * @type {Array<number>}
32
+ * @memberof ApiKeyRestrictions
33
+ */
34
+ market_ids: Array<number>;
35
+ /**
36
+ * binary options series this key may trade, in addition to market_ids
37
+ * @type {Array<ApiKeySeries>}
38
+ * @memberof ApiKeyRestrictions
39
+ */
40
+ series: Array<ApiKeySeries>;
41
+ /**
42
+ * IP addresses this key may send from; empty allows all
43
+ * @type {Array<string>}
44
+ * @memberof ApiKeyRestrictions
45
+ */
46
+ allowed_ips: Array<string>;
47
+ /**
48
+ * unix seconds when the key expires; 0 means never
49
+ * @type {number}
50
+ * @memberof ApiKeyRestrictions
51
+ */
52
+ valid_until: number;
53
+ }
54
+
55
+ /**
56
+ * Check if a given object implements the ApiKeyRestrictions interface.
57
+ */
58
+ export function instanceOfApiKeyRestrictions(value: object): value is ApiKeyRestrictions {
59
+ if (!('market_ids' in value) || value['market_ids'] === undefined) return false;
60
+ if (!('series' in value) || value['series'] === undefined) return false;
61
+ if (!('allowed_ips' in value) || value['allowed_ips'] === undefined) return false;
62
+ if (!('valid_until' in value) || value['valid_until'] === undefined) return false;
63
+ return true;
64
+ }
65
+
66
+ export function ApiKeyRestrictionsFromJSON(json: any): ApiKeyRestrictions {
67
+ return ApiKeyRestrictionsFromJSONTyped(json, false);
68
+ }
69
+
70
+ export function ApiKeyRestrictionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKeyRestrictions {
71
+ if (json == null) {
72
+ return json;
73
+ }
74
+ return {
75
+
76
+ 'market_ids': json['market_ids'],
77
+ 'series': ((json['series'] as Array<any>).map(ApiKeySeriesFromJSON)),
78
+ 'allowed_ips': json['allowed_ips'],
79
+ 'valid_until': json['valid_until'],
80
+ };
81
+ }
82
+
83
+ export function ApiKeyRestrictionsToJSON(value?: ApiKeyRestrictions | null): any {
84
+ if (value == null) {
85
+ return value;
86
+ }
87
+ return {
88
+
89
+ 'market_ids': value['market_ids'],
90
+ 'series': ((value['series'] as Array<any>).map(ApiKeySeriesToJSON)),
91
+ 'allowed_ips': value['allowed_ips'],
92
+ 'valid_until': value['valid_until'],
93
+ };
94
+ }
95
+
@@ -0,0 +1,70 @@
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 ApiKeySeries
20
+ */
21
+ export interface ApiKeySeries {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof ApiKeySeries
26
+ */
27
+ creator_account_index: number;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof ApiKeySeries
32
+ */
33
+ tag: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ApiKeySeries interface.
38
+ */
39
+ export function instanceOfApiKeySeries(value: object): value is ApiKeySeries {
40
+ if (!('creator_account_index' in value) || value['creator_account_index'] === undefined) return false;
41
+ if (!('tag' in value) || value['tag'] === undefined) return false;
42
+ return true;
43
+ }
44
+
45
+ export function ApiKeySeriesFromJSON(json: any): ApiKeySeries {
46
+ return ApiKeySeriesFromJSONTyped(json, false);
47
+ }
48
+
49
+ export function ApiKeySeriesFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKeySeries {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+
55
+ 'creator_account_index': json['creator_account_index'],
56
+ 'tag': json['tag'],
57
+ };
58
+ }
59
+
60
+ export function ApiKeySeriesToJSON(value?: ApiKeySeries | null): any {
61
+ if (value == null) {
62
+ return value;
63
+ }
64
+ return {
65
+
66
+ 'creator_account_index': value['creator_account_index'],
67
+ 'tag': value['tag'],
68
+ };
69
+ }
70
+
package/models/Block.ts CHANGED
@@ -38,6 +38,12 @@ export interface Block {
38
38
  * @memberof Block
39
39
  */
40
40
  height: number;
41
+ /**
42
+ *
43
+ * @type {number}
44
+ * @memberof Block
45
+ */
46
+ created_at: number;
41
47
  /**
42
48
  *
43
49
  * @type {string}
@@ -112,6 +118,7 @@ export interface Block {
112
118
  export function instanceOfBlock(value: object): value is Block {
113
119
  if (!('commitment' in value) || value['commitment'] === undefined) return false;
114
120
  if (!('height' in value) || value['height'] === undefined) return false;
121
+ if (!('created_at' in value) || value['created_at'] === undefined) return false;
115
122
  if (!('state_root' in value) || value['state_root'] === undefined) return false;
116
123
  if (!('priority_operations' in value) || value['priority_operations'] === undefined) return false;
117
124
  if (!('on_chain_l2_operations' in value) || value['on_chain_l2_operations'] === undefined) return false;
@@ -138,6 +145,7 @@ export function BlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): Blo
138
145
 
139
146
  'commitment': json['commitment'],
140
147
  'height': json['height'],
148
+ 'created_at': json['created_at'],
141
149
  'state_root': json['state_root'],
142
150
  'priority_operations': json['priority_operations'],
143
151
  'on_chain_l2_operations': json['on_chain_l2_operations'],
@@ -160,6 +168,7 @@ export function BlockToJSON(value?: Block | null): any {
160
168
 
161
169
  'commitment': value['commitment'],
162
170
  'height': value['height'],
171
+ 'created_at': value['created_at'],
163
172
  'state_root': value['state_root'],
164
173
  'priority_operations': value['priority_operations'],
165
174
  'on_chain_l2_operations': value['on_chain_l2_operations'],
@@ -0,0 +1,79 @@
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 OrderBookLevel
20
+ */
21
+ export interface OrderBookLevel {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof OrderBookLevel
26
+ */
27
+ price: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof OrderBookLevel
32
+ */
33
+ size: string;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof OrderBookLevel
38
+ */
39
+ orders: number;
40
+ }
41
+
42
+ /**
43
+ * Check if a given object implements the OrderBookLevel interface.
44
+ */
45
+ export function instanceOfOrderBookLevel(value: object): value is OrderBookLevel {
46
+ if (!('price' in value) || value['price'] === undefined) return false;
47
+ if (!('size' in value) || value['size'] === undefined) return false;
48
+ if (!('orders' in value) || value['orders'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function OrderBookLevelFromJSON(json: any): OrderBookLevel {
53
+ return OrderBookLevelFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function OrderBookLevelFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderBookLevel {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'price': json['price'],
63
+ 'size': json['size'],
64
+ 'orders': json['orders'],
65
+ };
66
+ }
67
+
68
+ export function OrderBookLevelToJSON(value?: OrderBookLevel | null): any {
69
+ if (value == null) {
70
+ return value;
71
+ }
72
+ return {
73
+
74
+ 'price': value['price'],
75
+ 'size': value['size'],
76
+ 'orders': value['orders'],
77
+ };
78
+ }
79
+
@@ -13,6 +13,12 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { OrderBookLevel } from './OrderBookLevel';
17
+ import {
18
+ OrderBookLevelFromJSON,
19
+ OrderBookLevelFromJSONTyped,
20
+ OrderBookLevelToJSON,
21
+ } from './OrderBookLevel';
16
22
  import type { SimpleOrder } from './SimpleOrder';
17
23
  import {
18
24
  SimpleOrderFromJSON,
@@ -62,6 +68,24 @@ export interface OrderBookOrders {
62
68
  * @memberof OrderBookOrders
63
69
  */
64
70
  bids: Array<SimpleOrder>;
71
+ /**
72
+ *
73
+ * @type {string}
74
+ * @memberof OrderBookOrders
75
+ */
76
+ group_size: string;
77
+ /**
78
+ *
79
+ * @type {Array<OrderBookLevel>}
80
+ * @memberof OrderBookOrders
81
+ */
82
+ ask_levels: Array<OrderBookLevel>;
83
+ /**
84
+ *
85
+ * @type {Array<OrderBookLevel>}
86
+ * @memberof OrderBookOrders
87
+ */
88
+ bid_levels: Array<OrderBookLevel>;
65
89
  }
66
90
 
67
91
  /**
@@ -73,6 +97,9 @@ export function instanceOfOrderBookOrders(value: object): value is OrderBookOrde
73
97
  if (!('asks' in value) || value['asks'] === undefined) return false;
74
98
  if (!('total_bids' in value) || value['total_bids'] === undefined) return false;
75
99
  if (!('bids' in value) || value['bids'] === undefined) return false;
100
+ if (!('group_size' in value) || value['group_size'] === undefined) return false;
101
+ if (!('ask_levels' in value) || value['ask_levels'] === undefined) return false;
102
+ if (!('bid_levels' in value) || value['bid_levels'] === undefined) return false;
76
103
  return true;
77
104
  }
78
105
 
@@ -92,6 +119,9 @@ export function OrderBookOrdersFromJSONTyped(json: any, ignoreDiscriminator: boo
92
119
  'asks': ((json['asks'] as Array<any>).map(SimpleOrderFromJSON)),
93
120
  'total_bids': json['total_bids'],
94
121
  'bids': ((json['bids'] as Array<any>).map(SimpleOrderFromJSON)),
122
+ 'group_size': json['group_size'],
123
+ 'ask_levels': ((json['ask_levels'] as Array<any>).map(OrderBookLevelFromJSON)),
124
+ 'bid_levels': ((json['bid_levels'] as Array<any>).map(OrderBookLevelFromJSON)),
95
125
  };
96
126
  }
97
127
 
@@ -107,6 +137,9 @@ export function OrderBookOrdersToJSON(value?: OrderBookOrders | null): any {
107
137
  'asks': ((value['asks'] as Array<any>).map(SimpleOrderToJSON)),
108
138
  'total_bids': value['total_bids'],
109
139
  'bids': ((value['bids'] as Array<any>).map(SimpleOrderToJSON)),
140
+ 'group_size': value['group_size'],
141
+ 'ask_levels': ((value['ask_levels'] as Array<any>).map(OrderBookLevelToJSON)),
142
+ 'bid_levels': ((value['bid_levels'] as Array<any>).map(OrderBookLevelToJSON)),
110
143
  };
111
144
  }
112
145
 
@@ -19,6 +19,12 @@ import { mapValues } from '../runtime';
19
19
  * @interface ReqGetAccountApiKeys
20
20
  */
21
21
  export interface ReqGetAccountApiKeys {
22
+ /**
23
+ * made optional to support header auth clients
24
+ * @type {string}
25
+ * @memberof ReqGetAccountApiKeys
26
+ */
27
+ auth?: string;
22
28
  /**
23
29
  *
24
30
  * @type {number}
@@ -51,6 +57,7 @@ export function ReqGetAccountApiKeysFromJSONTyped(json: any, ignoreDiscriminator
51
57
  }
52
58
  return {
53
59
 
60
+ 'auth': json['auth'] == null ? undefined : json['auth'],
54
61
  'account_index': json['account_index'],
55
62
  'api_key_index': json['api_key_index'] == null ? undefined : json['api_key_index'],
56
63
  };
@@ -62,6 +69,7 @@ export function ReqGetAccountApiKeysToJSON(value?: ReqGetAccountApiKeys | null):
62
69
  }
63
70
  return {
64
71
 
72
+ 'auth': value['auth'],
65
73
  'account_index': value['account_index'],
66
74
  'api_key_index': value['api_key_index'],
67
75
  };
@@ -31,6 +31,18 @@ export interface ReqGetOrderBookOrders {
31
31
  * @memberof ReqGetOrderBookOrders
32
32
  */
33
33
  limit: number;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof ReqGetOrderBookOrders
38
+ */
39
+ n_sig_figs?: number;
40
+ /**
41
+ *
42
+ * @type {number}
43
+ * @memberof ReqGetOrderBookOrders
44
+ */
45
+ mantissa?: number;
34
46
  }
35
47
 
36
48
  /**
@@ -54,6 +66,8 @@ export function ReqGetOrderBookOrdersFromJSONTyped(json: any, ignoreDiscriminato
54
66
 
55
67
  'market_id': json['market_id'],
56
68
  'limit': json['limit'],
69
+ 'n_sig_figs': json['n_sig_figs'] == null ? undefined : json['n_sig_figs'],
70
+ 'mantissa': json['mantissa'] == null ? undefined : json['mantissa'],
57
71
  };
58
72
  }
59
73
 
@@ -65,6 +79,8 @@ export function ReqGetOrderBookOrdersToJSON(value?: ReqGetOrderBookOrders | null
65
79
 
66
80
  'market_id': value['market_id'],
67
81
  'limit': value['limit'],
82
+ 'n_sig_figs': value['n_sig_figs'],
83
+ 'mantissa': value['mantissa'],
68
84
  };
69
85
  }
70
86
 
package/models/index.ts CHANGED
@@ -22,6 +22,8 @@ export * from './Alert';
22
22
  export * from './Announcement';
23
23
  export * from './Announcements';
24
24
  export * from './ApiKey';
25
+ export * from './ApiKeyRestrictions';
26
+ export * from './ApiKeySeries';
25
27
  export * from './ApiToken';
26
28
  export * from './ApprovedIntegrator';
27
29
  export * from './Asset';
@@ -123,6 +125,7 @@ export * from './OrderBook';
123
125
  export * from './OrderBookDepth';
124
126
  export * from './OrderBookDepthWithBeginNonce';
125
127
  export * from './OrderBookDetails';
128
+ export * from './OrderBookLevel';
126
129
  export * from './OrderBookOrders';
127
130
  export * from './OrderBookStats';
128
131
  export * from './OrderBooks';
package/openapi.json CHANGED
@@ -911,6 +911,20 @@
911
911
  }
912
912
  },
913
913
  "parameters": [
914
+ {
915
+ "name": "authorization",
916
+ "description": " make required after integ is done",
917
+ "in": "query",
918
+ "required": false,
919
+ "type": "string"
920
+ },
921
+ {
922
+ "name": "auth",
923
+ "description": " made optional to support header auth clients",
924
+ "in": "query",
925
+ "required": false,
926
+ "type": "string"
927
+ },
914
928
  {
915
929
  "name": "account_index",
916
930
  "in": "query",
@@ -933,7 +947,7 @@
933
947
  "consumes": [
934
948
  "multipart/form-data"
935
949
  ],
936
- "description": "Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account."
950
+ "description": "Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. Restrictions are returned only with auth for the account."
937
951
  }
938
952
  },
939
953
  "/api/v1/assetDetails": {
@@ -5386,6 +5400,20 @@
5386
5400
  "format": "int64",
5387
5401
  "minimum": 1,
5388
5402
  "maximum": 250
5403
+ },
5404
+ {
5405
+ "name": "n_sig_figs",
5406
+ "in": "query",
5407
+ "required": false,
5408
+ "type": "integer",
5409
+ "format": "uint8"
5410
+ },
5411
+ {
5412
+ "name": "mantissa",
5413
+ "in": "query",
5414
+ "required": false,
5415
+ "type": "integer",
5416
+ "format": "uint8"
5389
5417
  }
5390
5418
  ],
5391
5419
  "tags": [
@@ -7114,6 +7142,43 @@
7114
7142
  "description": "Set account metadata"
7115
7143
  }
7116
7144
  },
7145
+ "/api/v1/setApiKeyRestrictions": {
7146
+ "post": {
7147
+ "summary": "setApiKeyRestrictions",
7148
+ "operationId": "setApiKeyRestrictions",
7149
+ "responses": {
7150
+ "200": {
7151
+ "description": "A successful response.",
7152
+ "schema": {
7153
+ "$ref": "#/definitions/ResultCode"
7154
+ }
7155
+ },
7156
+ "400": {
7157
+ "description": "Bad request",
7158
+ "schema": {
7159
+ "$ref": "#/definitions/ResultCode"
7160
+ }
7161
+ }
7162
+ },
7163
+ "parameters": [
7164
+ {
7165
+ "name": "body",
7166
+ "in": "body",
7167
+ "required": true,
7168
+ "schema": {
7169
+ "$ref": "#/definitions/ReqSetApiKeyRestrictions"
7170
+ }
7171
+ }
7172
+ ],
7173
+ "tags": [
7174
+ "account"
7175
+ ],
7176
+ "consumes": [
7177
+ "multipart/form-data"
7178
+ ],
7179
+ "description": "Replace an API key's restrictions. They apply to every transaction the key signs except ChangePubKey and ChangeECDSAPubKey, which the L1 wallet signs. With a market whitelist, the key can only place, modify and cancel orders and change leverage or margin in those markets and in binary options markets of those series (event creator and tag). With an IP whitelist, the key can only send from those IPs. An expired key can sign nothing else. Restrictions belong to the key's public key. The account's L1 wallet personal_signs these lines: 'Set API Key Restrictions', a blank line, 'account index: N', 'api key index: N', 'pubkey: 0x<public_key>', 'market ids: <market_ids>', 'series: <series>', 'allowed ips: <allowed_ips>', 'valid until: N', 'timestamp: N', 'chainId: N', 'Only sign this message for a trusted client!'. Each N is 0x plus 16 lowercase hex digits, public_key is lowercase hex, and lists are the exact strings sent, with an omitted series or allowed_ips signed as []."
7180
+ }
7181
+ },
7117
7182
  "/api/v1/setMakerOnlyApiKeys": {
7118
7183
  "post": {
7119
7184
  "summary": "setMakerOnlyApiKeys",
@@ -9684,6 +9749,10 @@
9684
9749
  "type": "integer",
9685
9750
  "format": "int64",
9686
9751
  "example": "1257894000000000"
9752
+ },
9753
+ "restrictions": {
9754
+ "$ref": "#/definitions/ApiKeyRestrictions",
9755
+ "description": " only returned with auth for the account"
9687
9756
  }
9688
9757
  },
9689
9758
  "title": "ApiKey",
@@ -9693,7 +9762,67 @@
9693
9762
  "nonce",
9694
9763
  "key_type",
9695
9764
  "public_key",
9696
- "transaction_time"
9765
+ "transaction_time",
9766
+ "restrictions"
9767
+ ]
9768
+ },
9769
+ "ApiKeyRestrictions": {
9770
+ "type": "object",
9771
+ "properties": {
9772
+ "market_ids": {
9773
+ "type": "array",
9774
+ "items": {
9775
+ "type": "integer",
9776
+ "format": "int64"
9777
+ },
9778
+ "description": " markets this key may trade; with series also empty, allows all"
9779
+ },
9780
+ "series": {
9781
+ "type": "array",
9782
+ "items": {
9783
+ "$ref": "#/definitions/ApiKeySeries"
9784
+ },
9785
+ "description": " binary options series this key may trade, in addition to market_ids"
9786
+ },
9787
+ "allowed_ips": {
9788
+ "type": "array",
9789
+ "items": {
9790
+ "type": "string"
9791
+ },
9792
+ "description": " IP addresses this key may send from; empty allows all"
9793
+ },
9794
+ "valid_until": {
9795
+ "type": "integer",
9796
+ "format": "int64",
9797
+ "example": "0",
9798
+ "description": " unix seconds when the key expires; 0 means never"
9799
+ }
9800
+ },
9801
+ "title": "ApiKeyRestrictions",
9802
+ "required": [
9803
+ "market_ids",
9804
+ "series",
9805
+ "allowed_ips",
9806
+ "valid_until"
9807
+ ]
9808
+ },
9809
+ "ApiKeySeries": {
9810
+ "type": "object",
9811
+ "properties": {
9812
+ "creator_account_index": {
9813
+ "type": "integer",
9814
+ "format": "int64",
9815
+ "example": "3"
9816
+ },
9817
+ "tag": {
9818
+ "type": "string",
9819
+ "example": "btc-updown-5m"
9820
+ }
9821
+ },
9822
+ "title": "ApiKeySeries",
9823
+ "required": [
9824
+ "creator_account_index",
9825
+ "tag"
9697
9826
  ]
9698
9827
  },
9699
9828
  "ApiToken": {
@@ -10440,6 +10569,10 @@
10440
10569
  "type": "integer",
10441
10570
  "format": "int64"
10442
10571
  },
10572
+ "created_at": {
10573
+ "type": "integer",
10574
+ "format": "int64"
10575
+ },
10443
10576
  "state_root": {
10444
10577
  "type": "string"
10445
10578
  },
@@ -10487,6 +10620,7 @@
10487
10620
  "required": [
10488
10621
  "commitment",
10489
10622
  "height",
10623
+ "created_at",
10490
10624
  "state_root",
10491
10625
  "priority_operations",
10492
10626
  "on_chain_l2_operations",
@@ -14881,6 +15015,30 @@
14881
15015
  "spot_order_book_details"
14882
15016
  ]
14883
15017
  },
15018
+ "OrderBookLevel": {
15019
+ "type": "object",
15020
+ "properties": {
15021
+ "price": {
15022
+ "type": "string",
15023
+ "example": "74890.0"
15024
+ },
15025
+ "size": {
15026
+ "type": "string",
15027
+ "example": "3.21500"
15028
+ },
15029
+ "orders": {
15030
+ "type": "integer",
15031
+ "format": "int64",
15032
+ "example": "14"
15033
+ }
15034
+ },
15035
+ "title": "OrderBookLevel",
15036
+ "required": [
15037
+ "price",
15038
+ "size",
15039
+ "orders"
15040
+ ]
15041
+ },
14884
15042
  "OrderBookOrders": {
14885
15043
  "type": "object",
14886
15044
  "properties": {
@@ -14913,6 +15071,21 @@
14913
15071
  "items": {
14914
15072
  "$ref": "#/definitions/SimpleOrder"
14915
15073
  }
15074
+ },
15075
+ "group_size": {
15076
+ "type": "string"
15077
+ },
15078
+ "ask_levels": {
15079
+ "type": "array",
15080
+ "items": {
15081
+ "$ref": "#/definitions/OrderBookLevel"
15082
+ }
15083
+ },
15084
+ "bid_levels": {
15085
+ "type": "array",
15086
+ "items": {
15087
+ "$ref": "#/definitions/OrderBookLevel"
15088
+ }
14916
15089
  }
14917
15090
  },
14918
15091
  "title": "OrderBookOrders",
@@ -14921,7 +15094,10 @@
14921
15094
  "total_asks",
14922
15095
  "asks",
14923
15096
  "total_bids",
14924
- "bids"
15097
+ "bids",
15098
+ "group_size",
15099
+ "ask_levels",
15100
+ "bid_levels"
14925
15101
  ]
14926
15102
  },
14927
15103
  "OrderBookStats": {
@@ -17950,6 +18126,10 @@
17950
18126
  "ReqGetAccountApiKeys": {
17951
18127
  "type": "object",
17952
18128
  "properties": {
18129
+ "auth": {
18130
+ "type": "string",
18131
+ "description": " made optional to support header auth clients"
18132
+ },
17953
18133
  "account_index": {
17954
18134
  "type": "integer",
17955
18135
  "format": "int64"
@@ -19322,6 +19502,14 @@
19322
19502
  "format": "int64",
19323
19503
  "maximum": 250,
19324
19504
  "minimum": 1
19505
+ },
19506
+ "n_sig_figs": {
19507
+ "type": "integer",
19508
+ "format": "uint8"
19509
+ },
19510
+ "mantissa": {
19511
+ "type": "integer",
19512
+ "format": "uint8"
19325
19513
  }
19326
19514
  },
19327
19515
  "title": "ReqGetOrderBookOrders",
@@ -20821,6 +21009,59 @@
20821
21009
  "metadata"
20822
21010
  ]
20823
21011
  },
21012
+ "ReqSetApiKeyRestrictions": {
21013
+ "type": "object",
21014
+ "properties": {
21015
+ "account_index": {
21016
+ "type": "integer",
21017
+ "format": "int64"
21018
+ },
21019
+ "api_key_index": {
21020
+ "type": "integer",
21021
+ "format": "uint8"
21022
+ },
21023
+ "public_key": {
21024
+ "type": "string",
21025
+ "description": " hex public key the restrictions apply to, without 0x"
21026
+ },
21027
+ "market_ids": {
21028
+ "type": "string",
21029
+ "description": " JSON array of up to 16 market ids, e.g. \"[0,1]\"; \"[]\" with no series allows all"
21030
+ },
21031
+ "series": {
21032
+ "type": "string",
21033
+ "description": " JSON array of up to 16 {\"creator_account_index\", \"tag\"} event series, e.g. btc-updown-5m"
21034
+ },
21035
+ "allowed_ips": {
21036
+ "type": "string",
21037
+ "description": " JSON array of up to 16 IP addresses, e.g. \"[\\\"203.0.113.7\\\"]\"; empty allows all"
21038
+ },
21039
+ "valid_until": {
21040
+ "type": "integer",
21041
+ "format": "int64",
21042
+ "description": " unix seconds, at most 180 days ahead; 0 means no expiry"
21043
+ },
21044
+ "timestamp": {
21045
+ "type": "integer",
21046
+ "format": "int64",
21047
+ "description": " unix seconds when signed; must be recent and newer than the last update"
21048
+ },
21049
+ "signature": {
21050
+ "type": "string",
21051
+ "description": " L1 signature of the account owner over TemplateApiKeyRestrictions"
21052
+ }
21053
+ },
21054
+ "title": "ReqSetApiKeyRestrictions",
21055
+ "required": [
21056
+ "account_index",
21057
+ "api_key_index",
21058
+ "public_key",
21059
+ "market_ids",
21060
+ "valid_until",
21061
+ "timestamp",
21062
+ "signature"
21063
+ ]
21064
+ },
20824
21065
  "ReqSetMakerOnlyApiKeys": {
20825
21066
  "type": "object",
20826
21067
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.361",
3
+ "version": "1.0.362",
4
4
  "description": "Lighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {