zklighter-perps 1.0.185 → 1.0.187

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.
@@ -26,6 +26,8 @@ models/AccountPnL.ts
26
26
  models/AccountPosition.ts
27
27
  models/AccountStats.ts
28
28
  models/AccountTradeStats.ts
29
+ models/AirdropPercentageItem.ts
30
+ models/AirdropPercentages.ts
29
31
  models/Announcement.ts
30
32
  models/Announcements.ts
31
33
  models/ApiKey.ts
@@ -104,6 +106,7 @@ models/ReqGetAccountLimits.ts
104
106
  models/ReqGetAccountMetadata.ts
105
107
  models/ReqGetAccountPnL.ts
106
108
  models/ReqGetAccountTxs.ts
109
+ models/ReqGetAirdropPercentages.ts
107
110
  models/ReqGetApiTokens.ts
108
111
  models/ReqGetAssetDetails.ts
109
112
  models/ReqGetBlock.ts
@@ -19,6 +19,7 @@ import type {
19
19
  AccountLimits,
20
20
  AccountMetadatas,
21
21
  AccountPnL,
22
+ AirdropPercentages,
22
23
  DetailedAccounts,
23
24
  IsWhitelisted,
24
25
  L1Metadata,
@@ -42,6 +43,8 @@ import {
42
43
  AccountMetadatasToJSON,
43
44
  AccountPnLFromJSON,
44
45
  AccountPnLToJSON,
46
+ AirdropPercentagesFromJSON,
47
+ AirdropPercentagesToJSON,
45
48
  DetailedAccountsFromJSON,
46
49
  DetailedAccountsToJSON,
47
50
  IsWhitelistedFromJSON,
@@ -92,6 +95,23 @@ export interface AccountsByL1AddressRequest {
92
95
  l1_address: string;
93
96
  }
94
97
 
98
+ export interface AirdropRequest {
99
+ l1_address: string;
100
+ authorization?: string;
101
+ auth?: string;
102
+ }
103
+
104
+ export interface AirdropCreateRequest {
105
+ l1_address: string;
106
+ percentages: string;
107
+ signature: string;
108
+ authorization?: string;
109
+ nonce?: number;
110
+ account_index?: number;
111
+ api_key_index?: number;
112
+ auth?: string;
113
+ }
114
+
95
115
  export interface ApikeysRequest {
96
116
  account_index: number;
97
117
  api_key_index?: number;
@@ -386,6 +406,149 @@ export class AccountApi extends runtime.BaseAPI {
386
406
  return await response.value();
387
407
  }
388
408
 
409
+ /**
410
+ * Get airdrop percentages
411
+ * airdrop
412
+ */
413
+ async airdropRaw(requestParameters: AirdropRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AirdropPercentages>> {
414
+ if (requestParameters['l1_address'] == null) {
415
+ throw new runtime.RequiredError(
416
+ 'l1_address',
417
+ 'Required parameter "l1_address" was null or undefined when calling airdrop().'
418
+ );
419
+ }
420
+
421
+ const queryParameters: any = {};
422
+
423
+ if (requestParameters['l1_address'] != null) {
424
+ queryParameters['l1_address'] = requestParameters['l1_address'];
425
+ }
426
+
427
+ if (requestParameters['auth'] != null) {
428
+ queryParameters['auth'] = requestParameters['auth'];
429
+ }
430
+
431
+ const headerParameters: runtime.HTTPHeaders = {};
432
+
433
+ if (requestParameters['authorization'] != null) {
434
+ headerParameters['authorization'] = String(requestParameters['authorization']);
435
+ }
436
+
437
+ const response = await this.request({
438
+ path: `/api/v1/airdrop`,
439
+ method: 'GET',
440
+ headers: headerParameters,
441
+ query: queryParameters,
442
+ }, initOverrides);
443
+
444
+ return new runtime.JSONApiResponse(response, (jsonValue) => AirdropPercentagesFromJSON(jsonValue));
445
+ }
446
+
447
+ /**
448
+ * Get airdrop percentages
449
+ * airdrop
450
+ */
451
+ async airdrop(requestParameters: AirdropRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AirdropPercentages> {
452
+ const response = await this.airdropRaw(requestParameters, initOverrides);
453
+ return await response.value();
454
+ }
455
+
456
+ /**
457
+ * Create airdrop percentages
458
+ * airdrop_create
459
+ */
460
+ async airdropCreateRaw(requestParameters: AirdropCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ResultCode>> {
461
+ if (requestParameters['l1_address'] == null) {
462
+ throw new runtime.RequiredError(
463
+ 'l1_address',
464
+ 'Required parameter "l1_address" was null or undefined when calling airdropCreate().'
465
+ );
466
+ }
467
+
468
+ if (requestParameters['percentages'] == null) {
469
+ throw new runtime.RequiredError(
470
+ 'percentages',
471
+ 'Required parameter "percentages" was null or undefined when calling airdropCreate().'
472
+ );
473
+ }
474
+
475
+ if (requestParameters['signature'] == null) {
476
+ throw new runtime.RequiredError(
477
+ 'signature',
478
+ 'Required parameter "signature" was null or undefined when calling airdropCreate().'
479
+ );
480
+ }
481
+
482
+ const queryParameters: any = {};
483
+
484
+ const headerParameters: runtime.HTTPHeaders = {};
485
+
486
+ if (requestParameters['authorization'] != null) {
487
+ headerParameters['authorization'] = String(requestParameters['authorization']);
488
+ }
489
+
490
+ const consumes: runtime.Consume[] = [
491
+ { contentType: 'multipart/form-data' },
492
+ ];
493
+ // @ts-ignore: canConsumeForm may be unused
494
+ const canConsumeForm = runtime.canConsumeForm(consumes);
495
+
496
+ let formParams: { append(param: string, value: any): any };
497
+ let useForm = false;
498
+ if (useForm) {
499
+ formParams = new FormData();
500
+ } else {
501
+ formParams = new URLSearchParams();
502
+ }
503
+
504
+ if (requestParameters['l1_address'] != null) {
505
+ formParams.append('l1_address', requestParameters['l1_address'] as any);
506
+ }
507
+
508
+ if (requestParameters['percentages'] != null) {
509
+ formParams.append('percentages', requestParameters['percentages'] as any);
510
+ }
511
+
512
+ if (requestParameters['nonce'] != null) {
513
+ formParams.append('nonce', requestParameters['nonce'] as any);
514
+ }
515
+
516
+ if (requestParameters['account_index'] != null) {
517
+ formParams.append('account_index', requestParameters['account_index'] as any);
518
+ }
519
+
520
+ if (requestParameters['api_key_index'] != null) {
521
+ formParams.append('api_key_index', requestParameters['api_key_index'] as any);
522
+ }
523
+
524
+ if (requestParameters['signature'] != null) {
525
+ formParams.append('signature', requestParameters['signature'] as any);
526
+ }
527
+
528
+ if (requestParameters['auth'] != null) {
529
+ formParams.append('auth', requestParameters['auth'] as any);
530
+ }
531
+
532
+ const response = await this.request({
533
+ path: `/api/v1/airdrop/create`,
534
+ method: 'POST',
535
+ headers: headerParameters,
536
+ query: queryParameters,
537
+ body: formParams,
538
+ }, initOverrides);
539
+
540
+ return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue));
541
+ }
542
+
543
+ /**
544
+ * Create airdrop percentages
545
+ * airdrop_create
546
+ */
547
+ async airdropCreate(requestParameters: AirdropCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResultCode> {
548
+ const response = await this.airdropCreateRaw(requestParameters, initOverrides);
549
+ return await response.value();
550
+ }
551
+
389
552
  /**
390
553
  * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account.
391
554
  * apikeys
@@ -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 AirdropPercentageItem
20
+ */
21
+ export interface AirdropPercentageItem {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof AirdropPercentageItem
26
+ */
27
+ l1_address: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof AirdropPercentageItem
32
+ */
33
+ percentage: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the AirdropPercentageItem interface.
38
+ */
39
+ export function instanceOfAirdropPercentageItem(value: object): value is AirdropPercentageItem {
40
+ if (!('l1_address' in value) || value['l1_address'] === undefined) return false;
41
+ if (!('percentage' in value) || value['percentage'] === undefined) return false;
42
+ return true;
43
+ }
44
+
45
+ export function AirdropPercentageItemFromJSON(json: any): AirdropPercentageItem {
46
+ return AirdropPercentageItemFromJSONTyped(json, false);
47
+ }
48
+
49
+ export function AirdropPercentageItemFromJSONTyped(json: any, ignoreDiscriminator: boolean): AirdropPercentageItem {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+
55
+ 'l1_address': json['l1_address'],
56
+ 'percentage': json['percentage'],
57
+ };
58
+ }
59
+
60
+ export function AirdropPercentageItemToJSON(value?: AirdropPercentageItem | null): any {
61
+ if (value == null) {
62
+ return value;
63
+ }
64
+ return {
65
+
66
+ 'l1_address': value['l1_address'],
67
+ 'percentage': value['percentage'],
68
+ };
69
+ }
70
+
@@ -0,0 +1,77 @@
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 { AirdropPercentageItem } from './AirdropPercentageItem';
17
+ import {
18
+ AirdropPercentageItemFromJSON,
19
+ AirdropPercentageItemFromJSONTyped,
20
+ AirdropPercentageItemToJSON,
21
+ } from './AirdropPercentageItem';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface AirdropPercentages
27
+ */
28
+ export interface AirdropPercentages {
29
+ /**
30
+ *
31
+ * @type {string}
32
+ * @memberof AirdropPercentages
33
+ */
34
+ l1_address: string;
35
+ /**
36
+ *
37
+ * @type {Array<AirdropPercentageItem>}
38
+ * @memberof AirdropPercentages
39
+ */
40
+ percentages: Array<AirdropPercentageItem>;
41
+ }
42
+
43
+ /**
44
+ * Check if a given object implements the AirdropPercentages interface.
45
+ */
46
+ export function instanceOfAirdropPercentages(value: object): value is AirdropPercentages {
47
+ if (!('l1_address' in value) || value['l1_address'] === undefined) return false;
48
+ if (!('percentages' in value) || value['percentages'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function AirdropPercentagesFromJSON(json: any): AirdropPercentages {
53
+ return AirdropPercentagesFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function AirdropPercentagesFromJSONTyped(json: any, ignoreDiscriminator: boolean): AirdropPercentages {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'l1_address': json['l1_address'],
63
+ 'percentages': ((json['percentages'] as Array<any>).map(AirdropPercentageItemFromJSON)),
64
+ };
65
+ }
66
+
67
+ export function AirdropPercentagesToJSON(value?: AirdropPercentages | null): any {
68
+ if (value == null) {
69
+ return value;
70
+ }
71
+ return {
72
+
73
+ 'l1_address': value['l1_address'],
74
+ 'percentages': ((value['percentages'] as Array<any>).map(AirdropPercentageItemToJSON)),
75
+ };
76
+ }
77
+
@@ -0,0 +1,69 @@
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 ReqGetAirdropPercentages
20
+ */
21
+ export interface ReqGetAirdropPercentages {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof ReqGetAirdropPercentages
26
+ */
27
+ l1_address: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof ReqGetAirdropPercentages
32
+ */
33
+ auth?: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ReqGetAirdropPercentages interface.
38
+ */
39
+ export function instanceOfReqGetAirdropPercentages(value: object): value is ReqGetAirdropPercentages {
40
+ if (!('l1_address' in value) || value['l1_address'] === undefined) return false;
41
+ return true;
42
+ }
43
+
44
+ export function ReqGetAirdropPercentagesFromJSON(json: any): ReqGetAirdropPercentages {
45
+ return ReqGetAirdropPercentagesFromJSONTyped(json, false);
46
+ }
47
+
48
+ export function ReqGetAirdropPercentagesFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReqGetAirdropPercentages {
49
+ if (json == null) {
50
+ return json;
51
+ }
52
+ return {
53
+
54
+ 'l1_address': json['l1_address'],
55
+ 'auth': json['auth'] == null ? undefined : json['auth'],
56
+ };
57
+ }
58
+
59
+ export function ReqGetAirdropPercentagesToJSON(value?: ReqGetAirdropPercentages | null): any {
60
+ if (value == null) {
61
+ return value;
62
+ }
63
+ return {
64
+
65
+ 'l1_address': value['l1_address'],
66
+ 'auth': value['auth'],
67
+ };
68
+ }
69
+
package/models/index.ts CHANGED
@@ -12,6 +12,8 @@ export * from './AccountPnL';
12
12
  export * from './AccountPosition';
13
13
  export * from './AccountStats';
14
14
  export * from './AccountTradeStats';
15
+ export * from './AirdropPercentageItem';
16
+ export * from './AirdropPercentages';
15
17
  export * from './Announcement';
16
18
  export * from './Announcements';
17
19
  export * from './ApiKey';
@@ -90,6 +92,7 @@ export * from './ReqGetAccountLimits';
90
92
  export * from './ReqGetAccountMetadata';
91
93
  export * from './ReqGetAccountPnL';
92
94
  export * from './ReqGetAccountTxs';
95
+ export * from './ReqGetAirdropPercentages';
93
96
  export * from './ReqGetApiTokens';
94
97
  export * from './ReqGetAssetDetails';
95
98
  export * from './ReqGetBlock';
package/openapi.json CHANGED
@@ -454,6 +454,98 @@
454
454
  "description": "Get accounts by l1_address returns all accounts associated with the given L1 address"
455
455
  }
456
456
  },
457
+ "/api/v1/airdrop": {
458
+ "get": {
459
+ "summary": "airdrop",
460
+ "operationId": "airdrop",
461
+ "responses": {
462
+ "200": {
463
+ "description": "A successful response.",
464
+ "schema": {
465
+ "$ref": "#/definitions/AirdropPercentages"
466
+ }
467
+ },
468
+ "400": {
469
+ "description": "Bad request",
470
+ "schema": {
471
+ "$ref": "#/definitions/ResultCode"
472
+ }
473
+ }
474
+ },
475
+ "parameters": [
476
+ {
477
+ "name": "authorization",
478
+ "description": " make required after integ is done",
479
+ "in": "header",
480
+ "required": false,
481
+ "type": "string"
482
+ },
483
+ {
484
+ "name": "l1_address",
485
+ "in": "query",
486
+ "required": true,
487
+ "type": "string"
488
+ },
489
+ {
490
+ "name": "auth",
491
+ "in": "query",
492
+ "required": false,
493
+ "type": "string"
494
+ }
495
+ ],
496
+ "tags": [
497
+ "account"
498
+ ],
499
+ "consumes": [
500
+ "multipart/form-data"
501
+ ],
502
+ "description": "Get airdrop percentages"
503
+ }
504
+ },
505
+ "/api/v1/airdrop/create": {
506
+ "post": {
507
+ "summary": "airdrop_create",
508
+ "operationId": "airdrop_create",
509
+ "responses": {
510
+ "200": {
511
+ "description": "A successful response.",
512
+ "schema": {
513
+ "$ref": "#/definitions/ResultCode"
514
+ }
515
+ },
516
+ "400": {
517
+ "description": "Bad request",
518
+ "schema": {
519
+ "$ref": "#/definitions/ResultCode"
520
+ }
521
+ }
522
+ },
523
+ "parameters": [
524
+ {
525
+ "name": "authorization",
526
+ "description": " make required after integ is done",
527
+ "in": "header",
528
+ "required": false,
529
+ "type": "string"
530
+ },
531
+ {
532
+ "name": "body",
533
+ "in": "body",
534
+ "required": true,
535
+ "schema": {
536
+ "$ref": "#/definitions/ReqCreateAirdropPercentages"
537
+ }
538
+ }
539
+ ],
540
+ "tags": [
541
+ "account"
542
+ ],
543
+ "consumes": [
544
+ "multipart/form-data"
545
+ ],
546
+ "description": "Create airdrop percentages"
547
+ }
548
+ },
457
549
  "/api/v1/announcement": {
458
550
  "get": {
459
551
  "summary": "announcement",
@@ -3933,6 +4025,41 @@
3933
4025
  "total_volume"
3934
4026
  ]
3935
4027
  },
4028
+ "AirdropPercentageItem": {
4029
+ "type": "object",
4030
+ "properties": {
4031
+ "l1_address": {
4032
+ "type": "string"
4033
+ },
4034
+ "percentage": {
4035
+ "type": "string"
4036
+ }
4037
+ },
4038
+ "title": "AirdropPercentageItem",
4039
+ "required": [
4040
+ "l1_address",
4041
+ "percentage"
4042
+ ]
4043
+ },
4044
+ "AirdropPercentages": {
4045
+ "type": "object",
4046
+ "properties": {
4047
+ "l1_address": {
4048
+ "type": "string"
4049
+ },
4050
+ "percentages": {
4051
+ "type": "array",
4052
+ "items": {
4053
+ "$ref": "#/definitions/AirdropPercentageItem"
4054
+ }
4055
+ }
4056
+ },
4057
+ "title": "AirdropPercentages",
4058
+ "required": [
4059
+ "l1_address",
4060
+ "percentages"
4061
+ ]
4062
+ },
3936
4063
  "Announcement": {
3937
4064
  "type": "object",
3938
4065
  "properties": {
@@ -7164,6 +7291,41 @@
7164
7291
  "new_tier"
7165
7292
  ]
7166
7293
  },
7294
+ "ReqCreateAirdropPercentages": {
7295
+ "type": "object",
7296
+ "properties": {
7297
+ "l1_address": {
7298
+ "type": "string"
7299
+ },
7300
+ "percentages": {
7301
+ "type": "string"
7302
+ },
7303
+ "nonce": {
7304
+ "type": "integer",
7305
+ "format": "int64"
7306
+ },
7307
+ "account_index": {
7308
+ "type": "integer",
7309
+ "format": "int64"
7310
+ },
7311
+ "api_key_index": {
7312
+ "type": "integer",
7313
+ "format": "uint8"
7314
+ },
7315
+ "signature": {
7316
+ "type": "string"
7317
+ },
7318
+ "auth": {
7319
+ "type": "string"
7320
+ }
7321
+ },
7322
+ "title": "ReqCreateAirdropPercentages",
7323
+ "required": [
7324
+ "l1_address",
7325
+ "percentages",
7326
+ "signature"
7327
+ ]
7328
+ },
7167
7329
  "ReqCreateIntentAddress": {
7168
7330
  "type": "object",
7169
7331
  "properties": {
@@ -7518,6 +7680,21 @@
7518
7680
  },
7519
7681
  "title": "ReqGetAccountTxs"
7520
7682
  },
7683
+ "ReqGetAirdropPercentages": {
7684
+ "type": "object",
7685
+ "properties": {
7686
+ "l1_address": {
7687
+ "type": "string"
7688
+ },
7689
+ "auth": {
7690
+ "type": "string"
7691
+ }
7692
+ },
7693
+ "title": "ReqGetAirdropPercentages",
7694
+ "required": [
7695
+ "l1_address"
7696
+ ]
7697
+ },
7521
7698
  "ReqGetApiTokens": {
7522
7699
  "type": "object",
7523
7700
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.185",
3
+ "version": "1.0.187",
4
4
  "description": "zkLighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {