zklighter-perps 1.0.17 → 1.0.18

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.
@@ -9,11 +9,13 @@ apis/TransactionApi.ts
9
9
  apis/index.ts
10
10
  index.ts
11
11
  models/Account.ts
12
+ models/AccountApiKeys.ts
12
13
  models/AccountMarketStats.ts
13
14
  models/AccountPnL.ts
14
15
  models/AccountPosition.ts
15
16
  models/AccountStats.ts
16
17
  models/Accounts.ts
18
+ models/ApiKey.ts
17
19
  models/Block.ts
18
20
  models/Blocks.ts
19
21
  models/Candlestick.ts
@@ -48,6 +50,7 @@ models/PriceLevel.ts
48
50
  models/ReqDoFaucet.ts
49
51
  models/ReqGetAccount.ts
50
52
  models/ReqGetAccountActiveOrders.ts
53
+ models/ReqGetAccountApiKeys.ts
51
54
  models/ReqGetAccountByL1Address.ts
52
55
  models/ReqGetAccountInactiveOrders.ts
53
56
  models/ReqGetAccountOrders.ts
@@ -15,6 +15,7 @@
15
15
 
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
+ AccountApiKeys,
18
19
  AccountPnL,
19
20
  Accounts,
20
21
  DetailedAccounts,
@@ -23,6 +24,8 @@ import type {
23
24
  SubAccounts,
24
25
  } from '../models/index';
25
26
  import {
27
+ AccountApiKeysFromJSON,
28
+ AccountApiKeysToJSON,
26
29
  AccountPnLFromJSON,
27
30
  AccountPnLToJSON,
28
31
  AccountsFromJSON,
@@ -46,6 +49,11 @@ export interface GetAccountRequest {
46
49
  value: string;
47
50
  }
48
51
 
52
+ export interface GetAccountApiKeysRequest {
53
+ account_index: number;
54
+ api_key_index: number;
55
+ }
56
+
49
57
  export interface GetAccountPnlRequest {
50
58
  by: GetAccountPnlByEnum;
51
59
  value: string;
@@ -165,6 +173,56 @@ export class AccountApi extends runtime.BaseAPI {
165
173
  return await response.value();
166
174
  }
167
175
 
176
+ /**
177
+ * Get account api key
178
+ * GetAccountApiKeys
179
+ */
180
+ async getAccountApiKeysRaw(requestParameters: GetAccountApiKeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountApiKeys>> {
181
+ if (requestParameters['account_index'] == null) {
182
+ throw new runtime.RequiredError(
183
+ 'account_index',
184
+ 'Required parameter "account_index" was null or undefined when calling getAccountApiKeys().'
185
+ );
186
+ }
187
+
188
+ if (requestParameters['api_key_index'] == null) {
189
+ throw new runtime.RequiredError(
190
+ 'api_key_index',
191
+ 'Required parameter "api_key_index" was null or undefined when calling getAccountApiKeys().'
192
+ );
193
+ }
194
+
195
+ const queryParameters: any = {};
196
+
197
+ if (requestParameters['account_index'] != null) {
198
+ queryParameters['account_index'] = requestParameters['account_index'];
199
+ }
200
+
201
+ if (requestParameters['api_key_index'] != null) {
202
+ queryParameters['api_key_index'] = requestParameters['api_key_index'];
203
+ }
204
+
205
+ const headerParameters: runtime.HTTPHeaders = {};
206
+
207
+ const response = await this.request({
208
+ path: `/api/v1/apikeys`,
209
+ method: 'GET',
210
+ headers: headerParameters,
211
+ query: queryParameters,
212
+ }, initOverrides);
213
+
214
+ return new runtime.JSONApiResponse(response, (jsonValue) => AccountApiKeysFromJSON(jsonValue));
215
+ }
216
+
217
+ /**
218
+ * Get account api key
219
+ * GetAccountApiKeys
220
+ */
221
+ async getAccountApiKeys(requestParameters: GetAccountApiKeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountApiKeys> {
222
+ const response = await this.getAccountApiKeysRaw(requestParameters, initOverrides);
223
+ return await response.value();
224
+ }
225
+
168
226
  /**
169
227
  * Get account PnL chart
170
228
  * GetAccountPnl
@@ -0,0 +1,84 @@
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 { ApiKey } from './ApiKey';
17
+ import {
18
+ ApiKeyFromJSON,
19
+ ApiKeyFromJSONTyped,
20
+ ApiKeyToJSON,
21
+ } from './ApiKey';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface AccountApiKeys
27
+ */
28
+ export interface AccountApiKeys {
29
+ /**
30
+ *
31
+ * @type {number}
32
+ * @memberof AccountApiKeys
33
+ */
34
+ code?: number;
35
+ /**
36
+ *
37
+ * @type {string}
38
+ * @memberof AccountApiKeys
39
+ */
40
+ message?: string;
41
+ /**
42
+ *
43
+ * @type {Array<ApiKey>}
44
+ * @memberof AccountApiKeys
45
+ */
46
+ api_keys: Array<ApiKey>;
47
+ }
48
+
49
+ /**
50
+ * Check if a given object implements the AccountApiKeys interface.
51
+ */
52
+ export function instanceOfAccountApiKeys(value: object): value is AccountApiKeys {
53
+ if (!('api_keys' in value) || value['api_keys'] === undefined) return false;
54
+ return true;
55
+ }
56
+
57
+ export function AccountApiKeysFromJSON(json: any): AccountApiKeys {
58
+ return AccountApiKeysFromJSONTyped(json, false);
59
+ }
60
+
61
+ export function AccountApiKeysFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountApiKeys {
62
+ if (json == null) {
63
+ return json;
64
+ }
65
+ return {
66
+
67
+ 'code': json['code'] == null ? undefined : json['code'],
68
+ 'message': json['message'] == null ? undefined : json['message'],
69
+ 'api_keys': ((json['api_keys'] as Array<any>).map(ApiKeyFromJSON)),
70
+ };
71
+ }
72
+
73
+ export function AccountApiKeysToJSON(value?: AccountApiKeys | null): any {
74
+ if (value == null) {
75
+ return value;
76
+ }
77
+ return {
78
+
79
+ 'code': value['code'],
80
+ 'message': value['message'],
81
+ 'api_keys': ((value['api_keys'] as Array<any>).map(ApiKeyToJSON)),
82
+ };
83
+ }
84
+
@@ -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 ApiKey
20
+ */
21
+ export interface ApiKey {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof ApiKey
26
+ */
27
+ account_index: number;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof ApiKey
32
+ */
33
+ api_key_index: number;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof ApiKey
38
+ */
39
+ nonce: number;
40
+ /**
41
+ *
42
+ * @type {string}
43
+ * @memberof ApiKey
44
+ */
45
+ public_key: string;
46
+ }
47
+
48
+ /**
49
+ * Check if a given object implements the ApiKey interface.
50
+ */
51
+ export function instanceOfApiKey(value: object): value is ApiKey {
52
+ if (!('account_index' in value) || value['account_index'] === undefined) return false;
53
+ if (!('api_key_index' in value) || value['api_key_index'] === undefined) return false;
54
+ if (!('nonce' in value) || value['nonce'] === undefined) return false;
55
+ if (!('public_key' in value) || value['public_key'] === undefined) return false;
56
+ return true;
57
+ }
58
+
59
+ export function ApiKeyFromJSON(json: any): ApiKey {
60
+ return ApiKeyFromJSONTyped(json, false);
61
+ }
62
+
63
+ export function ApiKeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKey {
64
+ if (json == null) {
65
+ return json;
66
+ }
67
+ return {
68
+
69
+ 'account_index': json['account_index'],
70
+ 'api_key_index': json['api_key_index'],
71
+ 'nonce': json['nonce'],
72
+ 'public_key': json['public_key'],
73
+ };
74
+ }
75
+
76
+ export function ApiKeyToJSON(value?: ApiKey | null): any {
77
+ if (value == null) {
78
+ return value;
79
+ }
80
+ return {
81
+
82
+ 'account_index': value['account_index'],
83
+ 'api_key_index': value['api_key_index'],
84
+ 'nonce': value['nonce'],
85
+ 'public_key': value['public_key'],
86
+ };
87
+ }
88
+
@@ -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 ReqGetAccountApiKeys
20
+ */
21
+ export interface ReqGetAccountApiKeys {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof ReqGetAccountApiKeys
26
+ */
27
+ account_index: number;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof ReqGetAccountApiKeys
32
+ */
33
+ api_key_index: number;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ReqGetAccountApiKeys interface.
38
+ */
39
+ export function instanceOfReqGetAccountApiKeys(value: object): value is ReqGetAccountApiKeys {
40
+ if (!('account_index' in value) || value['account_index'] === undefined) return false;
41
+ if (!('api_key_index' in value) || value['api_key_index'] === undefined) return false;
42
+ return true;
43
+ }
44
+
45
+ export function ReqGetAccountApiKeysFromJSON(json: any): ReqGetAccountApiKeys {
46
+ return ReqGetAccountApiKeysFromJSONTyped(json, false);
47
+ }
48
+
49
+ export function ReqGetAccountApiKeysFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReqGetAccountApiKeys {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+
55
+ 'account_index': json['account_index'],
56
+ 'api_key_index': json['api_key_index'],
57
+ };
58
+ }
59
+
60
+ export function ReqGetAccountApiKeysToJSON(value?: ReqGetAccountApiKeys | null): any {
61
+ if (value == null) {
62
+ return value;
63
+ }
64
+ return {
65
+
66
+ 'account_index': value['account_index'],
67
+ 'api_key_index': value['api_key_index'],
68
+ };
69
+ }
70
+
package/models/index.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export * from './Account';
4
+ export * from './AccountApiKeys';
4
5
  export * from './AccountMarketStats';
5
6
  export * from './AccountPnL';
6
7
  export * from './AccountPosition';
7
8
  export * from './AccountStats';
8
9
  export * from './Accounts';
10
+ export * from './ApiKey';
9
11
  export * from './Block';
10
12
  export * from './Blocks';
11
13
  export * from './Candlestick';
@@ -40,6 +42,7 @@ export * from './PriceLevel';
40
42
  export * from './ReqDoFaucet';
41
43
  export * from './ReqGetAccount';
42
44
  export * from './ReqGetAccountActiveOrders';
45
+ export * from './ReqGetAccountApiKeys';
43
46
  export * from './ReqGetAccountByL1Address';
44
47
  export * from './ReqGetAccountInactiveOrders';
45
48
  export * from './ReqGetAccountOrders';
package/openapi.json CHANGED
@@ -464,6 +464,49 @@
464
464
  "description": "Get accounts by l1_address returns all accounts associated with the given L1 address"
465
465
  }
466
466
  },
467
+ "/api/v1/apikeys": {
468
+ "get": {
469
+ "summary": "GetAccountApiKeys",
470
+ "operationId": "GetAccountApiKeys",
471
+ "responses": {
472
+ "200": {
473
+ "description": "A successful response.",
474
+ "schema": {
475
+ "$ref": "#/definitions/AccountApiKeys"
476
+ }
477
+ },
478
+ "400": {
479
+ "description": "Bad request",
480
+ "schema": {
481
+ "$ref": "#/definitions/ResultCode"
482
+ }
483
+ }
484
+ },
485
+ "parameters": [
486
+ {
487
+ "name": "account_index",
488
+ "in": "query",
489
+ "required": true,
490
+ "type": "integer",
491
+ "format": "int32"
492
+ },
493
+ {
494
+ "name": "api_key_index",
495
+ "in": "query",
496
+ "required": true,
497
+ "type": "integer",
498
+ "format": "uint8"
499
+ }
500
+ ],
501
+ "tags": [
502
+ "account"
503
+ ],
504
+ "consumes": [
505
+ "multipart/form-data"
506
+ ],
507
+ "description": "Get account api key"
508
+ }
509
+ },
467
510
  "/api/v1/block": {
468
511
  "get": {
469
512
  "summary": "GetBlock",
@@ -1775,6 +1818,29 @@
1775
1818
  "collateral"
1776
1819
  ]
1777
1820
  },
1821
+ "AccountApiKeys": {
1822
+ "type": "object",
1823
+ "properties": {
1824
+ "code": {
1825
+ "type": "integer",
1826
+ "format": "int32",
1827
+ "example": "100"
1828
+ },
1829
+ "message": {
1830
+ "type": "string"
1831
+ },
1832
+ "api_keys": {
1833
+ "type": "array",
1834
+ "items": {
1835
+ "$ref": "#/definitions/ApiKey"
1836
+ }
1837
+ }
1838
+ },
1839
+ "title": "AccountApiKeys",
1840
+ "required": [
1841
+ "api_keys"
1842
+ ]
1843
+ },
1778
1844
  "AccountMarketStats": {
1779
1845
  "type": "object",
1780
1846
  "properties": {
@@ -1974,6 +2040,36 @@
1974
2040
  "accounts"
1975
2041
  ]
1976
2042
  },
2043
+ "ApiKey": {
2044
+ "type": "object",
2045
+ "properties": {
2046
+ "account_index": {
2047
+ "type": "integer",
2048
+ "format": "int32",
2049
+ "example": "3"
2050
+ },
2051
+ "api_key_index": {
2052
+ "type": "integer",
2053
+ "format": "uint8",
2054
+ "example": "0"
2055
+ },
2056
+ "nonce": {
2057
+ "type": "integer",
2058
+ "format": "int64",
2059
+ "example": "722"
2060
+ },
2061
+ "public_key": {
2062
+ "type": "string"
2063
+ }
2064
+ },
2065
+ "title": "ApiKey",
2066
+ "required": [
2067
+ "account_index",
2068
+ "api_key_index",
2069
+ "nonce",
2070
+ "public_key"
2071
+ ]
2072
+ },
1977
2073
  "Block": {
1978
2074
  "type": "object",
1979
2075
  "properties": {
@@ -3362,6 +3458,24 @@
3362
3458
  "market_id"
3363
3459
  ]
3364
3460
  },
3461
+ "ReqGetAccountApiKeys": {
3462
+ "type": "object",
3463
+ "properties": {
3464
+ "account_index": {
3465
+ "type": "integer",
3466
+ "format": "int32"
3467
+ },
3468
+ "api_key_index": {
3469
+ "type": "integer",
3470
+ "format": "uint8"
3471
+ }
3472
+ },
3473
+ "title": "ReqGetAccountApiKeys",
3474
+ "required": [
3475
+ "account_index",
3476
+ "api_key_index"
3477
+ ]
3478
+ },
3365
3479
  "ReqGetAccountByL1Address": {
3366
3480
  "type": "object",
3367
3481
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "zkLighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {