zklighter-perps 1.0.50 → 1.0.51

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.
@@ -33,6 +33,8 @@ models/Fundings.ts
33
33
  models/L1ProviderInfo.ts
34
34
  models/Layer1BasicInfo.ts
35
35
  models/Layer2BasicInfo.ts
36
+ models/Leaderboard.ts
37
+ models/LeaderboardEntry.ts
36
38
  models/Liquidation.ts
37
39
  models/MarketInfo.ts
38
40
  models/NextNonce.ts
@@ -69,6 +71,7 @@ models/ReqGetByAccount.ts
69
71
  models/ReqGetCandlesticks.ts
70
72
  models/ReqGetFundings.ts
71
73
  models/ReqGetL1Tx.ts
74
+ models/ReqGetLeaderboard.ts
72
75
  models/ReqGetNextNonce.ts
73
76
  models/ReqGetOrderBookDetails.ts
74
77
  models/ReqGetOrderBookOrders.ts
@@ -19,6 +19,7 @@ import type {
19
19
  AccountPnL,
20
20
  Accounts,
21
21
  DetailedAccounts,
22
+ Leaderboard,
22
23
  PublicPools,
23
24
  ResultCode,
24
25
  SubAccounts,
@@ -32,6 +33,8 @@ import {
32
33
  AccountsToJSON,
33
34
  DetailedAccountsFromJSON,
34
35
  DetailedAccountsToJSON,
36
+ LeaderboardFromJSON,
37
+ LeaderboardToJSON,
35
38
  PublicPoolsFromJSON,
36
39
  PublicPoolsToJSON,
37
40
  ResultCodeFromJSON,
@@ -64,6 +67,11 @@ export interface FaucetRequest {
64
67
  l1_address: string;
65
68
  }
66
69
 
70
+ export interface LeaderboardRequest {
71
+ type: LeaderboardTypeEnum;
72
+ l1_address?: string;
73
+ }
74
+
67
75
  export interface PnlRequest {
68
76
  by: PnlByEnum;
69
77
  value: string;
@@ -309,6 +317,49 @@ export class AccountApi extends runtime.BaseAPI {
309
317
  return await response.value();
310
318
  }
311
319
 
320
+ /**
321
+ * Get points leaderboard
322
+ * leaderboard
323
+ */
324
+ async leaderboardRaw(requestParameters: LeaderboardRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Leaderboard>> {
325
+ if (requestParameters['type'] == null) {
326
+ throw new runtime.RequiredError(
327
+ 'type',
328
+ 'Required parameter "type" was null or undefined when calling leaderboard().'
329
+ );
330
+ }
331
+
332
+ const queryParameters: any = {};
333
+
334
+ if (requestParameters['type'] != null) {
335
+ queryParameters['type'] = requestParameters['type'];
336
+ }
337
+
338
+ if (requestParameters['l1_address'] != null) {
339
+ queryParameters['l1_address'] = requestParameters['l1_address'];
340
+ }
341
+
342
+ const headerParameters: runtime.HTTPHeaders = {};
343
+
344
+ const response = await this.request({
345
+ path: `/api/v1/leaderboard`,
346
+ method: 'GET',
347
+ headers: headerParameters,
348
+ query: queryParameters,
349
+ }, initOverrides);
350
+
351
+ return new runtime.JSONApiResponse(response, (jsonValue) => LeaderboardFromJSON(jsonValue));
352
+ }
353
+
354
+ /**
355
+ * Get points leaderboard
356
+ * leaderboard
357
+ */
358
+ async leaderboard(requestParameters: LeaderboardRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Leaderboard> {
359
+ const response = await this.leaderboardRaw(requestParameters, initOverrides);
360
+ return await response.value();
361
+ }
362
+
312
363
  /**
313
364
  * Get account PnL chart
314
365
  * pnl
@@ -482,6 +533,14 @@ export const AccountsSortEnum = {
482
533
  Desc: 'desc'
483
534
  } as const;
484
535
  export type AccountsSortEnum = typeof AccountsSortEnum[keyof typeof AccountsSortEnum];
536
+ /**
537
+ * @export
538
+ */
539
+ export const LeaderboardTypeEnum = {
540
+ Weekly: 'weekly',
541
+ All: 'all'
542
+ } as const;
543
+ export type LeaderboardTypeEnum = typeof LeaderboardTypeEnum[keyof typeof LeaderboardTypeEnum];
485
544
  /**
486
545
  * @export
487
546
  */
@@ -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 { LeaderboardEntry } from './LeaderboardEntry';
17
+ import {
18
+ LeaderboardEntryFromJSON,
19
+ LeaderboardEntryFromJSONTyped,
20
+ LeaderboardEntryToJSON,
21
+ } from './LeaderboardEntry';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface Leaderboard
27
+ */
28
+ export interface Leaderboard {
29
+ /**
30
+ *
31
+ * @type {Array<LeaderboardEntry>}
32
+ * @memberof Leaderboard
33
+ */
34
+ entries: Array<LeaderboardEntry>;
35
+ /**
36
+ *
37
+ * @type {number}
38
+ * @memberof Leaderboard
39
+ */
40
+ week_start: number;
41
+ }
42
+
43
+ /**
44
+ * Check if a given object implements the Leaderboard interface.
45
+ */
46
+ export function instanceOfLeaderboard(value: object): value is Leaderboard {
47
+ if (!('entries' in value) || value['entries'] === undefined) return false;
48
+ if (!('week_start' in value) || value['week_start'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function LeaderboardFromJSON(json: any): Leaderboard {
53
+ return LeaderboardFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function LeaderboardFromJSONTyped(json: any, ignoreDiscriminator: boolean): Leaderboard {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'entries': ((json['entries'] as Array<any>).map(LeaderboardEntryFromJSON)),
63
+ 'week_start': json['week_start'],
64
+ };
65
+ }
66
+
67
+ export function LeaderboardToJSON(value?: Leaderboard | null): any {
68
+ if (value == null) {
69
+ return value;
70
+ }
71
+ return {
72
+
73
+ 'entries': ((value['entries'] as Array<any>).map(LeaderboardEntryToJSON)),
74
+ 'week_start': value['week_start'],
75
+ };
76
+ }
77
+
@@ -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 LeaderboardEntry
20
+ */
21
+ export interface LeaderboardEntry {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof LeaderboardEntry
26
+ */
27
+ l1_address: string;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof LeaderboardEntry
32
+ */
33
+ points: number;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof LeaderboardEntry
38
+ */
39
+ entry: number;
40
+ }
41
+
42
+ /**
43
+ * Check if a given object implements the LeaderboardEntry interface.
44
+ */
45
+ export function instanceOfLeaderboardEntry(value: object): value is LeaderboardEntry {
46
+ if (!('l1_address' in value) || value['l1_address'] === undefined) return false;
47
+ if (!('points' in value) || value['points'] === undefined) return false;
48
+ if (!('entry' in value) || value['entry'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function LeaderboardEntryFromJSON(json: any): LeaderboardEntry {
53
+ return LeaderboardEntryFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function LeaderboardEntryFromJSONTyped(json: any, ignoreDiscriminator: boolean): LeaderboardEntry {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'l1_address': json['l1_address'],
63
+ 'points': json['points'],
64
+ 'entry': json['entry'],
65
+ };
66
+ }
67
+
68
+ export function LeaderboardEntryToJSON(value?: LeaderboardEntry | null): any {
69
+ if (value == null) {
70
+ return value;
71
+ }
72
+ return {
73
+
74
+ 'l1_address': value['l1_address'],
75
+ 'points': value['points'],
76
+ 'entry': value['entry'],
77
+ };
78
+ }
79
+
@@ -0,0 +1,80 @@
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 ReqGetLeaderboard
20
+ */
21
+ export interface ReqGetLeaderboard {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof ReqGetLeaderboard
26
+ */
27
+ type: ReqGetLeaderboardTypeEnum;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof ReqGetLeaderboard
32
+ */
33
+ l1_address?: string;
34
+ }
35
+
36
+
37
+ /**
38
+ * @export
39
+ */
40
+ export const ReqGetLeaderboardTypeEnum = {
41
+ Weekly: 'weekly',
42
+ All: 'all'
43
+ } as const;
44
+ export type ReqGetLeaderboardTypeEnum = typeof ReqGetLeaderboardTypeEnum[keyof typeof ReqGetLeaderboardTypeEnum];
45
+
46
+
47
+ /**
48
+ * Check if a given object implements the ReqGetLeaderboard interface.
49
+ */
50
+ export function instanceOfReqGetLeaderboard(value: object): value is ReqGetLeaderboard {
51
+ if (!('type' in value) || value['type'] === undefined) return false;
52
+ return true;
53
+ }
54
+
55
+ export function ReqGetLeaderboardFromJSON(json: any): ReqGetLeaderboard {
56
+ return ReqGetLeaderboardFromJSONTyped(json, false);
57
+ }
58
+
59
+ export function ReqGetLeaderboardFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReqGetLeaderboard {
60
+ if (json == null) {
61
+ return json;
62
+ }
63
+ return {
64
+
65
+ 'type': json['type'],
66
+ 'l1_address': json['l1_address'] == null ? undefined : json['l1_address'],
67
+ };
68
+ }
69
+
70
+ export function ReqGetLeaderboardToJSON(value?: ReqGetLeaderboard | null): any {
71
+ if (value == null) {
72
+ return value;
73
+ }
74
+ return {
75
+
76
+ 'type': value['type'],
77
+ 'l1_address': value['l1_address'],
78
+ };
79
+ }
80
+
package/models/index.ts CHANGED
@@ -25,6 +25,8 @@ export * from './Fundings';
25
25
  export * from './L1ProviderInfo';
26
26
  export * from './Layer1BasicInfo';
27
27
  export * from './Layer2BasicInfo';
28
+ export * from './Leaderboard';
29
+ export * from './LeaderboardEntry';
28
30
  export * from './Liquidation';
29
31
  export * from './MarketInfo';
30
32
  export * from './NextNonce';
@@ -61,6 +63,7 @@ export * from './ReqGetByAccount';
61
63
  export * from './ReqGetCandlesticks';
62
64
  export * from './ReqGetFundings';
63
65
  export * from './ReqGetL1Tx';
66
+ export * from './ReqGetLeaderboard';
64
67
  export * from './ReqGetNextNonce';
65
68
  export * from './ReqGetOrderBookDetails';
66
69
  export * from './ReqGetOrderBookOrders';
package/openapi.json CHANGED
@@ -922,6 +922,51 @@
922
922
  "description": "Get zklighter general info, including contract address, and count of transactions and active users"
923
923
  }
924
924
  },
925
+ "/api/v1/leaderboard": {
926
+ "get": {
927
+ "summary": "leaderboard",
928
+ "operationId": "leaderboard",
929
+ "responses": {
930
+ "200": {
931
+ "description": "A successful response.",
932
+ "schema": {
933
+ "$ref": "#/definitions/Leaderboard"
934
+ }
935
+ },
936
+ "400": {
937
+ "description": "Bad request",
938
+ "schema": {
939
+ "$ref": "#/definitions/ResultCode"
940
+ }
941
+ }
942
+ },
943
+ "parameters": [
944
+ {
945
+ "name": "type",
946
+ "in": "query",
947
+ "required": true,
948
+ "type": "string",
949
+ "enum": [
950
+ "weekly",
951
+ "all"
952
+ ]
953
+ },
954
+ {
955
+ "name": "l1_address",
956
+ "in": "query",
957
+ "required": false,
958
+ "type": "string"
959
+ }
960
+ ],
961
+ "tags": [
962
+ "account"
963
+ ],
964
+ "consumes": [
965
+ "multipart/form-data"
966
+ ],
967
+ "description": "Get points leaderboard"
968
+ }
969
+ },
925
970
  "/api/v1/markNotifRead": {
926
971
  "get": {
927
972
  "summary": "markNotifRead",
@@ -2769,6 +2814,51 @@
2769
2814
  "total_transaction_count"
2770
2815
  ]
2771
2816
  },
2817
+ "Leaderboard": {
2818
+ "type": "object",
2819
+ "properties": {
2820
+ "entries": {
2821
+ "type": "array",
2822
+ "items": {
2823
+ "$ref": "#/definitions/LeaderboardEntry"
2824
+ }
2825
+ },
2826
+ "week_start": {
2827
+ "type": "integer",
2828
+ "format": "int64",
2829
+ "example": "1730073600000"
2830
+ }
2831
+ },
2832
+ "title": "Leaderboard",
2833
+ "required": [
2834
+ "entries",
2835
+ "week_start"
2836
+ ]
2837
+ },
2838
+ "LeaderboardEntry": {
2839
+ "type": "object",
2840
+ "properties": {
2841
+ "l1_address": {
2842
+ "type": "string",
2843
+ "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
2844
+ },
2845
+ "points": {
2846
+ "type": "integer",
2847
+ "format": "int64",
2848
+ "example": "1000"
2849
+ },
2850
+ "entry": {
2851
+ "type": "integer",
2852
+ "format": "int32"
2853
+ }
2854
+ },
2855
+ "title": "LeaderboardEntry",
2856
+ "required": [
2857
+ "l1_address",
2858
+ "points",
2859
+ "entry"
2860
+ ]
2861
+ },
2772
2862
  "Liquidation": {
2773
2863
  "type": "object",
2774
2864
  "properties": {
@@ -4139,6 +4229,25 @@
4139
4229
  "hash"
4140
4230
  ]
4141
4231
  },
4232
+ "ReqGetLeaderboard": {
4233
+ "type": "object",
4234
+ "properties": {
4235
+ "type": {
4236
+ "type": "string",
4237
+ "enum": [
4238
+ "weekly",
4239
+ "all"
4240
+ ]
4241
+ },
4242
+ "l1_address": {
4243
+ "type": "string"
4244
+ }
4245
+ },
4246
+ "title": "ReqGetLeaderboard",
4247
+ "required": [
4248
+ "type"
4249
+ ]
4250
+ },
4142
4251
  "ReqGetNextNonce": {
4143
4252
  "type": "object",
4144
4253
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "description": "zkLighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {