zklighter-perps 1.0.90 → 1.0.92

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.
@@ -5,6 +5,7 @@ apis/CandlestickApi.ts
5
5
  apis/InfoApi.ts
6
6
  apis/LiquidationApi.ts
7
7
  apis/OrderApi.ts
8
+ apis/ReferralApi.ts
8
9
  apis/RootApi.ts
9
10
  apis/TransactionApi.ts
10
11
  apis/index.ts
@@ -65,6 +66,7 @@ models/PublicPool.ts
65
66
  models/PublicPoolInfo.ts
66
67
  models/PublicPoolShare.ts
67
68
  models/PublicPools.ts
69
+ models/ReferralCode.ts
68
70
  models/ReqDoFaucet.ts
69
71
  models/ReqGetAccount.ts
70
72
  models/ReqGetAccountActiveOrders.ts
@@ -94,6 +96,7 @@ models/ReqGetRangeWithCursor.ts
94
96
  models/ReqGetRangeWithIndex.ts
95
97
  models/ReqGetRangeWithIndexSortable.ts
96
98
  models/ReqGetRecentTrades.ts
99
+ models/ReqGetReferralCode.ts
97
100
  models/ReqGetTrades.ts
98
101
  models/ReqGetTx.ts
99
102
  models/ReqGetWithdrawHistory.ts
@@ -245,7 +245,7 @@ export class AccountApi extends runtime.BaseAPI {
245
245
  }
246
246
 
247
247
  /**
248
- * Get account api key
248
+ * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account.
249
249
  * apikeys
250
250
  */
251
251
  async apikeysRaw(requestParameters: ApikeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountApiKeys>> {
@@ -286,7 +286,7 @@ export class AccountApi extends runtime.BaseAPI {
286
286
  }
287
287
 
288
288
  /**
289
- * Get account api key
289
+ * Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account.
290
290
  * apikeys
291
291
  */
292
292
  async apikeys(requestParameters: ApikeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountApiKeys> {
package/apis/InfoApi.ts CHANGED
@@ -62,7 +62,7 @@ export class InfoApi extends runtime.BaseAPI {
62
62
  }
63
63
 
64
64
  /**
65
- * Get zklighter general info, including contract address, and count of transactions and active users
65
+ * Get zklighter general info, including transaction and block stats
66
66
  * layer2BasicInfo
67
67
  */
68
68
  async layer2BasicInfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Layer2BasicInfo>> {
@@ -81,7 +81,7 @@ export class InfoApi extends runtime.BaseAPI {
81
81
  }
82
82
 
83
83
  /**
84
- * Get zklighter general info, including contract address, and count of transactions and active users
84
+ * Get zklighter general info, including transaction and block stats
85
85
  * layer2BasicInfo
86
86
  */
87
87
  async layer2BasicInfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Layer2BasicInfo> {
package/apis/OrderApi.ts CHANGED
@@ -98,7 +98,7 @@ export interface TradesRequest {
98
98
  export class OrderApi extends runtime.BaseAPI {
99
99
 
100
100
  /**
101
- * Get account active orders
101
+ * Get account active orders. `auth` can be generated using the SDK.
102
102
  * accountActiveOrders
103
103
  */
104
104
  async accountActiveOrdersRaw(requestParameters: AccountActiveOrdersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Orders>> {
@@ -150,7 +150,7 @@ export class OrderApi extends runtime.BaseAPI {
150
150
  }
151
151
 
152
152
  /**
153
- * Get account active orders
153
+ * Get account active orders. `auth` can be generated using the SDK.
154
154
  * accountActiveOrders
155
155
  */
156
156
  async accountActiveOrders(requestParameters: AccountActiveOrdersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Orders> {
@@ -159,7 +159,7 @@ export class OrderApi extends runtime.BaseAPI {
159
159
  }
160
160
 
161
161
  /**
162
- * Get account active orders
162
+ * Get account inactive orders
163
163
  * accountInactiveOrders
164
164
  */
165
165
  async accountInactiveOrdersRaw(requestParameters: AccountInactiveOrdersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Orders>> {
@@ -216,7 +216,7 @@ export class OrderApi extends runtime.BaseAPI {
216
216
  }
217
217
 
218
218
  /**
219
- * Get account active orders
219
+ * Get account inactive orders
220
220
  * accountInactiveOrders
221
221
  */
222
222
  async accountInactiveOrders(requestParameters: AccountInactiveOrdersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Orders> {
@@ -0,0 +1,250 @@
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
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ ReferralCode,
19
+ ResultCode,
20
+ } from '../models/index';
21
+ import {
22
+ ReferralCodeFromJSON,
23
+ ReferralCodeToJSON,
24
+ ResultCodeFromJSON,
25
+ ResultCodeToJSON,
26
+ } from '../models/index';
27
+
28
+ export interface ReferralCreateRequest {
29
+ auth: string;
30
+ account_index: number;
31
+ }
32
+
33
+ export interface ReferralGetRequest {
34
+ auth: string;
35
+ account_index: number;
36
+ }
37
+
38
+ export interface ReferralUseRequest {
39
+ l1_address: string;
40
+ referral_code: string;
41
+ x: string;
42
+ discord?: string;
43
+ telegram?: string;
44
+ }
45
+
46
+ /**
47
+ *
48
+ */
49
+ export class ReferralApi extends runtime.BaseAPI {
50
+
51
+ /**
52
+ * Create referral code
53
+ * referral_create
54
+ */
55
+ async referralCreateRaw(requestParameters: ReferralCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ReferralCode>> {
56
+ if (requestParameters['auth'] == null) {
57
+ throw new runtime.RequiredError(
58
+ 'auth',
59
+ 'Required parameter "auth" was null or undefined when calling referralCreate().'
60
+ );
61
+ }
62
+
63
+ if (requestParameters['account_index'] == null) {
64
+ throw new runtime.RequiredError(
65
+ 'account_index',
66
+ 'Required parameter "account_index" was null or undefined when calling referralCreate().'
67
+ );
68
+ }
69
+
70
+ const queryParameters: any = {};
71
+
72
+ const headerParameters: runtime.HTTPHeaders = {};
73
+
74
+ const consumes: runtime.Consume[] = [
75
+ { contentType: 'multipart/form-data' },
76
+ ];
77
+ // @ts-ignore: canConsumeForm may be unused
78
+ const canConsumeForm = runtime.canConsumeForm(consumes);
79
+
80
+ let formParams: { append(param: string, value: any): any };
81
+ let useForm = false;
82
+ if (useForm) {
83
+ formParams = new FormData();
84
+ } else {
85
+ formParams = new URLSearchParams();
86
+ }
87
+
88
+ if (requestParameters['auth'] != null) {
89
+ formParams.append('auth', requestParameters['auth'] as any);
90
+ }
91
+
92
+ if (requestParameters['account_index'] != null) {
93
+ formParams.append('account_index', requestParameters['account_index'] as any);
94
+ }
95
+
96
+ const response = await this.request({
97
+ path: `/api/v1/referral/create`,
98
+ method: 'POST',
99
+ headers: headerParameters,
100
+ query: queryParameters,
101
+ body: formParams,
102
+ }, initOverrides);
103
+
104
+ return new runtime.JSONApiResponse(response, (jsonValue) => ReferralCodeFromJSON(jsonValue));
105
+ }
106
+
107
+ /**
108
+ * Create referral code
109
+ * referral_create
110
+ */
111
+ async referralCreate(requestParameters: ReferralCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ReferralCode> {
112
+ const response = await this.referralCreateRaw(requestParameters, initOverrides);
113
+ return await response.value();
114
+ }
115
+
116
+ /**
117
+ * Get referral code
118
+ * referral_get
119
+ */
120
+ async referralGetRaw(requestParameters: ReferralGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ReferralCode>> {
121
+ if (requestParameters['auth'] == null) {
122
+ throw new runtime.RequiredError(
123
+ 'auth',
124
+ 'Required parameter "auth" was null or undefined when calling referralGet().'
125
+ );
126
+ }
127
+
128
+ if (requestParameters['account_index'] == null) {
129
+ throw new runtime.RequiredError(
130
+ 'account_index',
131
+ 'Required parameter "account_index" was null or undefined when calling referralGet().'
132
+ );
133
+ }
134
+
135
+ const queryParameters: any = {};
136
+
137
+ if (requestParameters['auth'] != null) {
138
+ queryParameters['auth'] = requestParameters['auth'];
139
+ }
140
+
141
+ if (requestParameters['account_index'] != null) {
142
+ queryParameters['account_index'] = requestParameters['account_index'];
143
+ }
144
+
145
+ const headerParameters: runtime.HTTPHeaders = {};
146
+
147
+ const response = await this.request({
148
+ path: `/api/v1/referral/get`,
149
+ method: 'GET',
150
+ headers: headerParameters,
151
+ query: queryParameters,
152
+ }, initOverrides);
153
+
154
+ return new runtime.JSONApiResponse(response, (jsonValue) => ReferralCodeFromJSON(jsonValue));
155
+ }
156
+
157
+ /**
158
+ * Get referral code
159
+ * referral_get
160
+ */
161
+ async referralGet(requestParameters: ReferralGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ReferralCode> {
162
+ const response = await this.referralGetRaw(requestParameters, initOverrides);
163
+ return await response.value();
164
+ }
165
+
166
+ /**
167
+ * Use referral code
168
+ * referral_use
169
+ */
170
+ async referralUseRaw(requestParameters: ReferralUseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ResultCode>> {
171
+ if (requestParameters['l1_address'] == null) {
172
+ throw new runtime.RequiredError(
173
+ 'l1_address',
174
+ 'Required parameter "l1_address" was null or undefined when calling referralUse().'
175
+ );
176
+ }
177
+
178
+ if (requestParameters['referral_code'] == null) {
179
+ throw new runtime.RequiredError(
180
+ 'referral_code',
181
+ 'Required parameter "referral_code" was null or undefined when calling referralUse().'
182
+ );
183
+ }
184
+
185
+ if (requestParameters['x'] == null) {
186
+ throw new runtime.RequiredError(
187
+ 'x',
188
+ 'Required parameter "x" was null or undefined when calling referralUse().'
189
+ );
190
+ }
191
+
192
+ const queryParameters: any = {};
193
+
194
+ const headerParameters: runtime.HTTPHeaders = {};
195
+
196
+ const consumes: runtime.Consume[] = [
197
+ { contentType: 'multipart/form-data' },
198
+ ];
199
+ // @ts-ignore: canConsumeForm may be unused
200
+ const canConsumeForm = runtime.canConsumeForm(consumes);
201
+
202
+ let formParams: { append(param: string, value: any): any };
203
+ let useForm = false;
204
+ if (useForm) {
205
+ formParams = new FormData();
206
+ } else {
207
+ formParams = new URLSearchParams();
208
+ }
209
+
210
+ if (requestParameters['l1_address'] != null) {
211
+ formParams.append('l1_address', requestParameters['l1_address'] as any);
212
+ }
213
+
214
+ if (requestParameters['referral_code'] != null) {
215
+ formParams.append('referral_code', requestParameters['referral_code'] as any);
216
+ }
217
+
218
+ if (requestParameters['discord'] != null) {
219
+ formParams.append('discord', requestParameters['discord'] as any);
220
+ }
221
+
222
+ if (requestParameters['telegram'] != null) {
223
+ formParams.append('telegram', requestParameters['telegram'] as any);
224
+ }
225
+
226
+ if (requestParameters['x'] != null) {
227
+ formParams.append('x', requestParameters['x'] as any);
228
+ }
229
+
230
+ const response = await this.request({
231
+ path: `/api/v1/referral/use`,
232
+ method: 'POST',
233
+ headers: headerParameters,
234
+ query: queryParameters,
235
+ body: formParams,
236
+ }, initOverrides);
237
+
238
+ return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue));
239
+ }
240
+
241
+ /**
242
+ * Use referral code
243
+ * referral_use
244
+ */
245
+ async referralUse(requestParameters: ReferralUseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResultCode> {
246
+ const response = await this.referralUseRaw(requestParameters, initOverrides);
247
+ return await response.value();
248
+ }
249
+
250
+ }
@@ -343,7 +343,7 @@ export class TransactionApi extends runtime.BaseAPI {
343
343
  }
344
344
 
345
345
  /**
346
- * Get next nonce for a specific account
346
+ * Get next nonce for a specific account and api key
347
347
  * nextNonce
348
348
  */
349
349
  async nextNonceRaw(requestParameters: NextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NextNonce>> {
@@ -384,7 +384,7 @@ export class TransactionApi extends runtime.BaseAPI {
384
384
  }
385
385
 
386
386
  /**
387
- * Get next nonce for a specific account
387
+ * Get next nonce for a specific account and api key
388
388
  * nextNonce
389
389
  */
390
390
  async nextNonce(requestParameters: NextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NextNonce> {
package/apis/index.ts CHANGED
@@ -7,5 +7,6 @@ export * from './CandlestickApi';
7
7
  export * from './InfoApi';
8
8
  export * from './LiquidationApi';
9
9
  export * from './OrderApi';
10
+ export * from './ReferralApi';
10
11
  export * from './RootApi';
11
12
  export * from './TransactionApi';
@@ -31,6 +31,24 @@ export interface AccountMetadata {
31
31
  * @memberof AccountMetadata
32
32
  */
33
33
  description: string;
34
+ /**
35
+ *
36
+ * @type {boolean}
37
+ * @memberof AccountMetadata
38
+ */
39
+ can_invite: boolean;
40
+ /**
41
+ *
42
+ * @type {string}
43
+ * @memberof AccountMetadata
44
+ */
45
+ referral_points_percentage: string;
46
+ /**
47
+ *
48
+ * @type {number}
49
+ * @memberof AccountMetadata
50
+ */
51
+ max_referral_usage_limit: number;
34
52
  }
35
53
 
36
54
  /**
@@ -39,6 +57,9 @@ export interface AccountMetadata {
39
57
  export function instanceOfAccountMetadata(value: object): value is AccountMetadata {
40
58
  if (!('name' in value) || value['name'] === undefined) return false;
41
59
  if (!('description' in value) || value['description'] === undefined) return false;
60
+ if (!('can_invite' in value) || value['can_invite'] === undefined) return false;
61
+ if (!('referral_points_percentage' in value) || value['referral_points_percentage'] === undefined) return false;
62
+ if (!('max_referral_usage_limit' in value) || value['max_referral_usage_limit'] === undefined) return false;
42
63
  return true;
43
64
  }
44
65
 
@@ -54,6 +75,9 @@ export function AccountMetadataFromJSONTyped(json: any, ignoreDiscriminator: boo
54
75
 
55
76
  'name': json['name'],
56
77
  'description': json['description'],
78
+ 'can_invite': json['can_invite'],
79
+ 'referral_points_percentage': json['referral_points_percentage'],
80
+ 'max_referral_usage_limit': json['max_referral_usage_limit'],
57
81
  };
58
82
  }
59
83
 
@@ -65,6 +89,9 @@ export function AccountMetadataToJSON(value?: AccountMetadata | null): any {
65
89
 
66
90
  'name': value['name'],
67
91
  'description': value['description'],
92
+ 'can_invite': value['can_invite'],
93
+ 'referral_points_percentage': value['referral_points_percentage'],
94
+ 'max_referral_usage_limit': value['max_referral_usage_limit'],
68
95
  };
69
96
  }
70
97
 
@@ -116,6 +116,24 @@ export interface DetailedAccount {
116
116
  * @memberof DetailedAccount
117
117
  */
118
118
  description: string;
119
+ /**
120
+ *
121
+ * @type {boolean}
122
+ * @memberof DetailedAccount
123
+ */
124
+ can_invite: boolean;
125
+ /**
126
+ *
127
+ * @type {string}
128
+ * @memberof DetailedAccount
129
+ */
130
+ referral_points_percentage: string;
131
+ /**
132
+ *
133
+ * @type {number}
134
+ * @memberof DetailedAccount
135
+ */
136
+ max_referral_usage_limit: number;
119
137
  /**
120
138
  *
121
139
  * @type {Array<AccountPosition>}
@@ -163,6 +181,9 @@ export function instanceOfDetailedAccount(value: object): value is DetailedAccou
163
181
  if (!('collateral' in value) || value['collateral'] === undefined) return false;
164
182
  if (!('name' in value) || value['name'] === undefined) return false;
165
183
  if (!('description' in value) || value['description'] === undefined) return false;
184
+ if (!('can_invite' in value) || value['can_invite'] === undefined) return false;
185
+ if (!('referral_points_percentage' in value) || value['referral_points_percentage'] === undefined) return false;
186
+ if (!('max_referral_usage_limit' in value) || value['max_referral_usage_limit'] === undefined) return false;
166
187
  if (!('positions' in value) || value['positions'] === undefined) return false;
167
188
  if (!('total_asset_value' in value) || value['total_asset_value'] === undefined) return false;
168
189
  if (!('market_stats' in value) || value['market_stats'] === undefined) return false;
@@ -193,6 +214,9 @@ export function DetailedAccountFromJSONTyped(json: any, ignoreDiscriminator: boo
193
214
  'collateral': json['collateral'],
194
215
  'name': json['name'],
195
216
  'description': json['description'],
217
+ 'can_invite': json['can_invite'],
218
+ 'referral_points_percentage': json['referral_points_percentage'],
219
+ 'max_referral_usage_limit': json['max_referral_usage_limit'],
196
220
  'positions': ((json['positions'] as Array<any>).map(AccountPositionFromJSON)),
197
221
  'total_asset_value': json['total_asset_value'],
198
222
  'market_stats': ((json['market_stats'] as Array<any>).map(AccountMarketStatsFromJSON)),
@@ -219,6 +243,9 @@ export function DetailedAccountToJSON(value?: DetailedAccount | null): any {
219
243
  'collateral': value['collateral'],
220
244
  'name': value['name'],
221
245
  'description': value['description'],
246
+ 'can_invite': value['can_invite'],
247
+ 'referral_points_percentage': value['referral_points_percentage'],
248
+ 'max_referral_usage_limit': value['max_referral_usage_limit'],
222
249
  'positions': ((value['positions'] as Array<any>).map(AccountPositionToJSON)),
223
250
  'total_asset_value': value['total_asset_value'],
224
251
  'market_stats': ((value['market_stats'] as Array<any>).map(AccountMarketStatsToJSON)),
@@ -104,6 +104,24 @@ export interface PublicPool {
104
104
  * @memberof PublicPool
105
105
  */
106
106
  description: string;
107
+ /**
108
+ *
109
+ * @type {boolean}
110
+ * @memberof PublicPool
111
+ */
112
+ can_invite: boolean;
113
+ /**
114
+ *
115
+ * @type {string}
116
+ * @memberof PublicPool
117
+ */
118
+ referral_points_percentage: string;
119
+ /**
120
+ *
121
+ * @type {number}
122
+ * @memberof PublicPool
123
+ */
124
+ max_referral_usage_limit: number;
107
125
  /**
108
126
  *
109
127
  * @type {string}
@@ -139,6 +157,9 @@ export function instanceOfPublicPool(value: object): value is PublicPool {
139
157
  if (!('collateral' in value) || value['collateral'] === undefined) return false;
140
158
  if (!('name' in value) || value['name'] === undefined) return false;
141
159
  if (!('description' in value) || value['description'] === undefined) return false;
160
+ if (!('can_invite' in value) || value['can_invite'] === undefined) return false;
161
+ if (!('referral_points_percentage' in value) || value['referral_points_percentage'] === undefined) return false;
162
+ if (!('max_referral_usage_limit' in value) || value['max_referral_usage_limit'] === undefined) return false;
142
163
  if (!('total_asset_value' in value) || value['total_asset_value'] === undefined) return false;
143
164
  if (!('pool_info' in value) || value['pool_info'] === undefined) return false;
144
165
  if (!('account_share' in value) || value['account_share'] === undefined) return false;
@@ -167,6 +188,9 @@ export function PublicPoolFromJSONTyped(json: any, ignoreDiscriminator: boolean)
167
188
  'collateral': json['collateral'],
168
189
  'name': json['name'],
169
190
  'description': json['description'],
191
+ 'can_invite': json['can_invite'],
192
+ 'referral_points_percentage': json['referral_points_percentage'],
193
+ 'max_referral_usage_limit': json['max_referral_usage_limit'],
170
194
  'total_asset_value': json['total_asset_value'],
171
195
  'pool_info': PublicPoolInfoFromJSON(json['pool_info']),
172
196
  'account_share': PublicPoolShareFromJSON(json['account_share']),
@@ -191,6 +215,9 @@ export function PublicPoolToJSON(value?: PublicPool | null): any {
191
215
  'collateral': value['collateral'],
192
216
  'name': value['name'],
193
217
  'description': value['description'],
218
+ 'can_invite': value['can_invite'],
219
+ 'referral_points_percentage': value['referral_points_percentage'],
220
+ 'max_referral_usage_limit': value['max_referral_usage_limit'],
194
221
  'total_asset_value': value['total_asset_value'],
195
222
  'pool_info': PublicPoolInfoToJSON(value['pool_info']),
196
223
  'account_share': PublicPoolShareToJSON(value['account_share']),
@@ -0,0 +1,87 @@
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 ReferralCode
20
+ */
21
+ export interface ReferralCode {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof ReferralCode
26
+ */
27
+ code: number;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof ReferralCode
32
+ */
33
+ message?: string;
34
+ /**
35
+ *
36
+ * @type {string}
37
+ * @memberof ReferralCode
38
+ */
39
+ referral_code: string;
40
+ /**
41
+ *
42
+ * @type {number}
43
+ * @memberof ReferralCode
44
+ */
45
+ remaining_usage: number;
46
+ }
47
+
48
+ /**
49
+ * Check if a given object implements the ReferralCode interface.
50
+ */
51
+ export function instanceOfReferralCode(value: object): value is ReferralCode {
52
+ if (!('code' in value) || value['code'] === undefined) return false;
53
+ if (!('referral_code' in value) || value['referral_code'] === undefined) return false;
54
+ if (!('remaining_usage' in value) || value['remaining_usage'] === undefined) return false;
55
+ return true;
56
+ }
57
+
58
+ export function ReferralCodeFromJSON(json: any): ReferralCode {
59
+ return ReferralCodeFromJSONTyped(json, false);
60
+ }
61
+
62
+ export function ReferralCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReferralCode {
63
+ if (json == null) {
64
+ return json;
65
+ }
66
+ return {
67
+
68
+ 'code': json['code'],
69
+ 'message': json['message'] == null ? undefined : json['message'],
70
+ 'referral_code': json['referral_code'],
71
+ 'remaining_usage': json['remaining_usage'],
72
+ };
73
+ }
74
+
75
+ export function ReferralCodeToJSON(value?: ReferralCode | null): any {
76
+ if (value == null) {
77
+ return value;
78
+ }
79
+ return {
80
+
81
+ 'code': value['code'],
82
+ 'message': value['message'],
83
+ 'referral_code': value['referral_code'],
84
+ 'remaining_usage': value['remaining_usage'],
85
+ };
86
+ }
87
+
@@ -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 ReqGetReferralCode
20
+ */
21
+ export interface ReqGetReferralCode {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof ReqGetReferralCode
26
+ */
27
+ auth: string;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof ReqGetReferralCode
32
+ */
33
+ account_index: number;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ReqGetReferralCode interface.
38
+ */
39
+ export function instanceOfReqGetReferralCode(value: object): value is ReqGetReferralCode {
40
+ if (!('auth' in value) || value['auth'] === undefined) return false;
41
+ if (!('account_index' in value) || value['account_index'] === undefined) return false;
42
+ return true;
43
+ }
44
+
45
+ export function ReqGetReferralCodeFromJSON(json: any): ReqGetReferralCode {
46
+ return ReqGetReferralCodeFromJSONTyped(json, false);
47
+ }
48
+
49
+ export function ReqGetReferralCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReqGetReferralCode {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+
55
+ 'auth': json['auth'],
56
+ 'account_index': json['account_index'],
57
+ };
58
+ }
59
+
60
+ export function ReqGetReferralCodeToJSON(value?: ReqGetReferralCode | null): any {
61
+ if (value == null) {
62
+ return value;
63
+ }
64
+ return {
65
+
66
+ 'auth': value['auth'],
67
+ 'account_index': value['account_index'],
68
+ };
69
+ }
70
+
package/models/index.ts CHANGED
@@ -56,6 +56,7 @@ export * from './PublicPool';
56
56
  export * from './PublicPoolInfo';
57
57
  export * from './PublicPoolShare';
58
58
  export * from './PublicPools';
59
+ export * from './ReferralCode';
59
60
  export * from './ReqDoFaucet';
60
61
  export * from './ReqGetAccount';
61
62
  export * from './ReqGetAccountActiveOrders';
@@ -85,6 +86,7 @@ export * from './ReqGetRangeWithCursor';
85
86
  export * from './ReqGetRangeWithIndex';
86
87
  export * from './ReqGetRangeWithIndexSortable';
87
88
  export * from './ReqGetRecentTrades';
89
+ export * from './ReqGetReferralCode';
88
90
  export * from './ReqGetTrades';
89
91
  export * from './ReqGetTx';
90
92
  export * from './ReqGetWithdrawHistory';
package/openapi.json CHANGED
@@ -130,7 +130,7 @@
130
130
  "consumes": [
131
131
  "multipart/form-data"
132
132
  ],
133
- "description": "Get account active orders"
133
+ "description": "Get account active orders. `auth` can be generated using the SDK."
134
134
  }
135
135
  },
136
136
  "/api/v1/accountInactiveOrders": {
@@ -203,7 +203,7 @@
203
203
  "consumes": [
204
204
  "multipart/form-data"
205
205
  ],
206
- "description": "Get account active orders"
206
+ "description": "Get account inactive orders"
207
207
  }
208
208
  },
209
209
  "/api/v1/accountOrders": {
@@ -520,7 +520,7 @@
520
520
  "consumes": [
521
521
  "multipart/form-data"
522
522
  ],
523
- "description": "Get account api key"
523
+ "description": "Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account."
524
524
  }
525
525
  },
526
526
  "/api/v1/block": {
@@ -1259,7 +1259,7 @@
1259
1259
  "tags": [
1260
1260
  "info"
1261
1261
  ],
1262
- "description": "Get zklighter general info, including contract address, and count of transactions and active users"
1262
+ "description": "Get zklighter general info, including transaction and block stats"
1263
1263
  }
1264
1264
  },
1265
1265
  "/api/v1/leaderboard": {
@@ -1384,7 +1384,7 @@
1384
1384
  "consumes": [
1385
1385
  "multipart/form-data"
1386
1386
  ],
1387
- "description": "Get next nonce for a specific account"
1387
+ "description": "Get next nonce for a specific account and api key"
1388
1388
  }
1389
1389
  },
1390
1390
  "/api/v1/orderBookDetails": {
@@ -1747,6 +1747,122 @@
1747
1747
  "description": "Get recent trades"
1748
1748
  }
1749
1749
  },
1750
+ "/api/v1/referral/create": {
1751
+ "post": {
1752
+ "summary": "referral_create",
1753
+ "operationId": "referral_create",
1754
+ "responses": {
1755
+ "200": {
1756
+ "description": "A successful response.",
1757
+ "schema": {
1758
+ "$ref": "#/definitions/ReferralCode"
1759
+ }
1760
+ },
1761
+ "400": {
1762
+ "description": "Bad request",
1763
+ "schema": {
1764
+ "$ref": "#/definitions/ResultCode"
1765
+ }
1766
+ }
1767
+ },
1768
+ "parameters": [
1769
+ {
1770
+ "name": "body",
1771
+ "in": "body",
1772
+ "required": true,
1773
+ "schema": {
1774
+ "$ref": "#/definitions/ReqCreateReferralCode"
1775
+ }
1776
+ }
1777
+ ],
1778
+ "tags": [
1779
+ "referral"
1780
+ ],
1781
+ "consumes": [
1782
+ "multipart/form-data"
1783
+ ],
1784
+ "description": "Create referral code"
1785
+ }
1786
+ },
1787
+ "/api/v1/referral/get": {
1788
+ "get": {
1789
+ "summary": "referral_get",
1790
+ "operationId": "referral_get",
1791
+ "responses": {
1792
+ "200": {
1793
+ "description": "A successful response.",
1794
+ "schema": {
1795
+ "$ref": "#/definitions/ReferralCode"
1796
+ }
1797
+ },
1798
+ "400": {
1799
+ "description": "Bad request",
1800
+ "schema": {
1801
+ "$ref": "#/definitions/ResultCode"
1802
+ }
1803
+ }
1804
+ },
1805
+ "parameters": [
1806
+ {
1807
+ "name": "auth",
1808
+ "in": "query",
1809
+ "required": true,
1810
+ "type": "string"
1811
+ },
1812
+ {
1813
+ "name": "account_index",
1814
+ "in": "query",
1815
+ "required": true,
1816
+ "type": "integer",
1817
+ "format": "int64"
1818
+ }
1819
+ ],
1820
+ "tags": [
1821
+ "referral"
1822
+ ],
1823
+ "consumes": [
1824
+ "multipart/form-data"
1825
+ ],
1826
+ "description": "Get referral code"
1827
+ }
1828
+ },
1829
+ "/api/v1/referral/use": {
1830
+ "post": {
1831
+ "summary": "referral_use",
1832
+ "operationId": "referral_use",
1833
+ "responses": {
1834
+ "200": {
1835
+ "description": "A successful response.",
1836
+ "schema": {
1837
+ "$ref": "#/definitions/ResultCode"
1838
+ }
1839
+ },
1840
+ "400": {
1841
+ "description": "Bad request",
1842
+ "schema": {
1843
+ "$ref": "#/definitions/ResultCode"
1844
+ }
1845
+ }
1846
+ },
1847
+ "parameters": [
1848
+ {
1849
+ "name": "body",
1850
+ "in": "body",
1851
+ "required": true,
1852
+ "schema": {
1853
+ "$ref": "#/definitions/ReqUseReferralCode"
1854
+ }
1855
+ }
1856
+ ],
1857
+ "tags": [
1858
+ "referral"
1859
+ ],
1860
+ "consumes": [
1861
+ "multipart/form-data"
1862
+ ],
1863
+ "description": "Use referral code"
1864
+ }
1865
+ },
1750
1866
  "/api/v1/sendTx": {
1751
1867
  "post": {
1752
1868
  "summary": "sendTx",
@@ -2312,12 +2428,26 @@
2312
2428
  },
2313
2429
  "description": {
2314
2430
  "type": "string"
2431
+ },
2432
+ "can_invite": {
2433
+ "type": "boolean",
2434
+ "format": "boolean"
2435
+ },
2436
+ "referral_points_percentage": {
2437
+ "type": "string"
2438
+ },
2439
+ "max_referral_usage_limit": {
2440
+ "type": "integer",
2441
+ "format": "int32"
2315
2442
  }
2316
2443
  },
2317
2444
  "title": "AccountMetadata",
2318
2445
  "required": [
2319
2446
  "name",
2320
- "description"
2447
+ "description",
2448
+ "can_invite",
2449
+ "referral_points_percentage",
2450
+ "max_referral_usage_limit"
2321
2451
  ]
2322
2452
  },
2323
2453
  "AccountPnL": {
@@ -3045,6 +3175,17 @@
3045
3175
  "description": {
3046
3176
  "type": "string"
3047
3177
  },
3178
+ "can_invite": {
3179
+ "type": "boolean",
3180
+ "format": "boolean"
3181
+ },
3182
+ "referral_points_percentage": {
3183
+ "type": "string"
3184
+ },
3185
+ "max_referral_usage_limit": {
3186
+ "type": "integer",
3187
+ "format": "int32"
3188
+ },
3048
3189
  "positions": {
3049
3190
  "type": "array",
3050
3191
  "items": {
@@ -3084,6 +3225,9 @@
3084
3225
  "collateral",
3085
3226
  "name",
3086
3227
  "description",
3228
+ "can_invite",
3229
+ "referral_points_percentage",
3230
+ "max_referral_usage_limit",
3087
3231
  "positions",
3088
3232
  "total_asset_value",
3089
3233
  "market_stats",
@@ -4523,6 +4667,17 @@
4523
4667
  "description": {
4524
4668
  "type": "string"
4525
4669
  },
4670
+ "can_invite": {
4671
+ "type": "boolean",
4672
+ "format": "boolean"
4673
+ },
4674
+ "referral_points_percentage": {
4675
+ "type": "string"
4676
+ },
4677
+ "max_referral_usage_limit": {
4678
+ "type": "integer",
4679
+ "format": "int32"
4680
+ },
4526
4681
  "total_asset_value": {
4527
4682
  "type": "string",
4528
4683
  "example": "19995"
@@ -4547,6 +4702,9 @@
4547
4702
  "collateral",
4548
4703
  "name",
4549
4704
  "description",
4705
+ "can_invite",
4706
+ "referral_points_percentage",
4707
+ "max_referral_usage_limit",
4550
4708
  "total_asset_value",
4551
4709
  "pool_info",
4552
4710
  "account_share"
@@ -4642,6 +4800,34 @@
4642
4800
  "public_pools"
4643
4801
  ]
4644
4802
  },
4803
+ "ReferralCode": {
4804
+ "type": "object",
4805
+ "properties": {
4806
+ "code": {
4807
+ "type": "integer",
4808
+ "format": "int32",
4809
+ "example": "200"
4810
+ },
4811
+ "message": {
4812
+ "type": "string"
4813
+ },
4814
+ "referral_code": {
4815
+ "type": "string",
4816
+ "example": "5V24K3MJ"
4817
+ },
4818
+ "remaining_usage": {
4819
+ "type": "integer",
4820
+ "format": "int32",
4821
+ "example": "3"
4822
+ }
4823
+ },
4824
+ "title": "ReferralCode",
4825
+ "required": [
4826
+ "code",
4827
+ "referral_code",
4828
+ "remaining_usage"
4829
+ ]
4830
+ },
4645
4831
  "ReqCancelDeposit": {
4646
4832
  "type": "object",
4647
4833
  "properties": {
@@ -4682,6 +4868,23 @@
4682
4868
  "amount"
4683
4869
  ]
4684
4870
  },
4871
+ "ReqCreateReferralCode": {
4872
+ "type": "object",
4873
+ "properties": {
4874
+ "auth": {
4875
+ "type": "string"
4876
+ },
4877
+ "account_index": {
4878
+ "type": "integer",
4879
+ "format": "int64"
4880
+ }
4881
+ },
4882
+ "title": "ReqCreateReferralCode",
4883
+ "required": [
4884
+ "auth",
4885
+ "account_index"
4886
+ ]
4887
+ },
4685
4888
  "ReqDoFaucet": {
4686
4889
  "type": "object",
4687
4890
  "properties": {
@@ -5352,6 +5555,23 @@
5352
5555
  "limit"
5353
5556
  ]
5354
5557
  },
5558
+ "ReqGetReferralCode": {
5559
+ "type": "object",
5560
+ "properties": {
5561
+ "auth": {
5562
+ "type": "string"
5563
+ },
5564
+ "account_index": {
5565
+ "type": "integer",
5566
+ "format": "int64"
5567
+ }
5568
+ },
5569
+ "title": "ReqGetReferralCode",
5570
+ "required": [
5571
+ "auth",
5572
+ "account_index"
5573
+ ]
5574
+ },
5355
5575
  "ReqGetTrades": {
5356
5576
  "type": "object",
5357
5577
  "properties": {
@@ -5569,6 +5789,32 @@
5569
5789
  "auth"
5570
5790
  ]
5571
5791
  },
5792
+ "ReqUseReferralCode": {
5793
+ "type": "object",
5794
+ "properties": {
5795
+ "l1_address": {
5796
+ "type": "string"
5797
+ },
5798
+ "referral_code": {
5799
+ "type": "string"
5800
+ },
5801
+ "discord": {
5802
+ "type": "string"
5803
+ },
5804
+ "telegram": {
5805
+ "type": "string"
5806
+ },
5807
+ "x": {
5808
+ "type": "string"
5809
+ }
5810
+ },
5811
+ "title": "ReqUseReferralCode",
5812
+ "required": [
5813
+ "l1_address",
5814
+ "referral_code",
5815
+ "x"
5816
+ ]
5817
+ },
5572
5818
  "RespGetFastwithdrawalInfo": {
5573
5819
  "type": "object",
5574
5820
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zklighter-perps",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
4
4
  "description": "zkLighter Perps SDK",
5
5
  "main": "index.ts",
6
6
  "directories": {