zklighter-perps 1.0.28 → 1.0.30
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.
- package/apis/AccountApi.ts +157 -235
- package/apis/BlockApi.ts +28 -26
- package/apis/CandlestickApi.ts +28 -28
- package/apis/InfoApi.ts +21 -21
- package/apis/LiquidationApi.ts +4 -4
- package/apis/OrderApi.ts +85 -85
- package/apis/RootApi.ts +5 -5
- package/apis/TransactionApi.ts +208 -208
- package/openapi.json +80 -131
- package/package.json +1 -1
package/apis/TransactionApi.ts
CHANGED
|
@@ -40,50 +40,36 @@ import {
|
|
|
40
40
|
TxsToJSON,
|
|
41
41
|
} from '../models/index';
|
|
42
42
|
|
|
43
|
-
export interface
|
|
44
|
-
by:
|
|
43
|
+
export interface AccountPendingTxsRequest {
|
|
44
|
+
by: AccountPendingTxsByEnum;
|
|
45
45
|
value: string;
|
|
46
46
|
types?: number;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export interface
|
|
49
|
+
export interface AccountTxsRequest {
|
|
50
50
|
limit: number;
|
|
51
|
-
by:
|
|
51
|
+
by: AccountTxsByEnum;
|
|
52
52
|
value: string;
|
|
53
53
|
index?: number;
|
|
54
54
|
types?: number;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export interface
|
|
58
|
-
by:
|
|
57
|
+
export interface BlockTxsRequest {
|
|
58
|
+
by: BlockTxsByEnum;
|
|
59
59
|
value: string;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export interface
|
|
62
|
+
export interface L2SignatureRequest {
|
|
63
63
|
tx_type: number;
|
|
64
64
|
tx_info: string;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export interface
|
|
67
|
+
export interface NextNonceRequest {
|
|
68
68
|
account_index: number;
|
|
69
69
|
api_key_index: number;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export interface
|
|
73
|
-
limit: number;
|
|
74
|
-
index?: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface GetTxRequest {
|
|
78
|
-
by: GetTxByEnum;
|
|
79
|
-
value: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface GetTxFromL1TxHashRequest {
|
|
83
|
-
hash: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface GetTxsRequest {
|
|
72
|
+
export interface PendingTxsRequest {
|
|
87
73
|
limit: number;
|
|
88
74
|
index?: number;
|
|
89
75
|
}
|
|
@@ -98,6 +84,20 @@ export interface SendTxBatchRequest {
|
|
|
98
84
|
tx_infos: string;
|
|
99
85
|
}
|
|
100
86
|
|
|
87
|
+
export interface TxRequest {
|
|
88
|
+
by: TxByEnum;
|
|
89
|
+
value: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface TxFromL1TxHashRequest {
|
|
93
|
+
hash: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface TxsRequest {
|
|
97
|
+
limit: number;
|
|
98
|
+
index?: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
101
|
/**
|
|
102
102
|
*
|
|
103
103
|
*/
|
|
@@ -105,20 +105,20 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* Get pending transactions of a specific account
|
|
108
|
-
*
|
|
108
|
+
* accountPendingTxs
|
|
109
109
|
*/
|
|
110
|
-
async
|
|
110
|
+
async accountPendingTxsRaw(requestParameters: AccountPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
111
111
|
if (requestParameters['by'] == null) {
|
|
112
112
|
throw new runtime.RequiredError(
|
|
113
113
|
'by',
|
|
114
|
-
'Required parameter "by" was null or undefined when calling
|
|
114
|
+
'Required parameter "by" was null or undefined when calling accountPendingTxs().'
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
if (requestParameters['value'] == null) {
|
|
119
119
|
throw new runtime.RequiredError(
|
|
120
120
|
'value',
|
|
121
|
-
'Required parameter "value" was null or undefined when calling
|
|
121
|
+
'Required parameter "value" was null or undefined when calling accountPendingTxs().'
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -150,36 +150,36 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
152
|
* Get pending transactions of a specific account
|
|
153
|
-
*
|
|
153
|
+
* accountPendingTxs
|
|
154
154
|
*/
|
|
155
|
-
async
|
|
156
|
-
const response = await this.
|
|
155
|
+
async accountPendingTxs(requestParameters: AccountPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
156
|
+
const response = await this.accountPendingTxsRaw(requestParameters, initOverrides);
|
|
157
157
|
return await response.value();
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* Get transactions of a specific account
|
|
162
|
-
*
|
|
162
|
+
* accountTxs
|
|
163
163
|
*/
|
|
164
|
-
async
|
|
164
|
+
async accountTxsRaw(requestParameters: AccountTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
165
165
|
if (requestParameters['limit'] == null) {
|
|
166
166
|
throw new runtime.RequiredError(
|
|
167
167
|
'limit',
|
|
168
|
-
'Required parameter "limit" was null or undefined when calling
|
|
168
|
+
'Required parameter "limit" was null or undefined when calling accountTxs().'
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
if (requestParameters['by'] == null) {
|
|
173
173
|
throw new runtime.RequiredError(
|
|
174
174
|
'by',
|
|
175
|
-
'Required parameter "by" was null or undefined when calling
|
|
175
|
+
'Required parameter "by" was null or undefined when calling accountTxs().'
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
if (requestParameters['value'] == null) {
|
|
180
180
|
throw new runtime.RequiredError(
|
|
181
181
|
'value',
|
|
182
|
-
'Required parameter "value" was null or undefined when calling
|
|
182
|
+
'Required parameter "value" was null or undefined when calling accountTxs().'
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -219,29 +219,29 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* Get transactions of a specific account
|
|
222
|
-
*
|
|
222
|
+
* accountTxs
|
|
223
223
|
*/
|
|
224
|
-
async
|
|
225
|
-
const response = await this.
|
|
224
|
+
async accountTxs(requestParameters: AccountTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
225
|
+
const response = await this.accountTxsRaw(requestParameters, initOverrides);
|
|
226
226
|
return await response.value();
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* Get transactions in a block
|
|
231
|
-
*
|
|
231
|
+
* blockTxs
|
|
232
232
|
*/
|
|
233
|
-
async
|
|
233
|
+
async blockTxsRaw(requestParameters: BlockTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
234
234
|
if (requestParameters['by'] == null) {
|
|
235
235
|
throw new runtime.RequiredError(
|
|
236
236
|
'by',
|
|
237
|
-
'Required parameter "by" was null or undefined when calling
|
|
237
|
+
'Required parameter "by" was null or undefined when calling blockTxs().'
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
if (requestParameters['value'] == null) {
|
|
242
242
|
throw new runtime.RequiredError(
|
|
243
243
|
'value',
|
|
244
|
-
'Required parameter "value" was null or undefined when calling
|
|
244
|
+
'Required parameter "value" was null or undefined when calling blockTxs().'
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
|
|
@@ -269,29 +269,29 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* Get transactions in a block
|
|
272
|
-
*
|
|
272
|
+
* blockTxs
|
|
273
273
|
*/
|
|
274
|
-
async
|
|
275
|
-
const response = await this.
|
|
274
|
+
async blockTxs(requestParameters: BlockTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
275
|
+
const response = await this.blockTxsRaw(requestParameters, initOverrides);
|
|
276
276
|
return await response.value();
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
280
|
* Get transaction signature body
|
|
281
|
-
*
|
|
281
|
+
* l2Signature
|
|
282
282
|
*/
|
|
283
|
-
async
|
|
283
|
+
async l2SignatureRaw(requestParameters: L2SignatureRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SignBody>> {
|
|
284
284
|
if (requestParameters['tx_type'] == null) {
|
|
285
285
|
throw new runtime.RequiredError(
|
|
286
286
|
'tx_type',
|
|
287
|
-
'Required parameter "tx_type" was null or undefined when calling
|
|
287
|
+
'Required parameter "tx_type" was null or undefined when calling l2Signature().'
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
if (requestParameters['tx_info'] == null) {
|
|
292
292
|
throw new runtime.RequiredError(
|
|
293
293
|
'tx_info',
|
|
294
|
-
'Required parameter "tx_info" was null or undefined when calling
|
|
294
|
+
'Required parameter "tx_info" was null or undefined when calling l2Signature().'
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
297
|
|
|
@@ -334,29 +334,29 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
334
334
|
|
|
335
335
|
/**
|
|
336
336
|
* Get transaction signature body
|
|
337
|
-
*
|
|
337
|
+
* l2Signature
|
|
338
338
|
*/
|
|
339
|
-
async
|
|
340
|
-
const response = await this.
|
|
339
|
+
async l2Signature(requestParameters: L2SignatureRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SignBody> {
|
|
340
|
+
const response = await this.l2SignatureRaw(requestParameters, initOverrides);
|
|
341
341
|
return await response.value();
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
345
|
* Get next nonce for a specific account
|
|
346
|
-
*
|
|
346
|
+
* nextNonce
|
|
347
347
|
*/
|
|
348
|
-
async
|
|
348
|
+
async nextNonceRaw(requestParameters: NextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NextNonce>> {
|
|
349
349
|
if (requestParameters['account_index'] == null) {
|
|
350
350
|
throw new runtime.RequiredError(
|
|
351
351
|
'account_index',
|
|
352
|
-
'Required parameter "account_index" was null or undefined when calling
|
|
352
|
+
'Required parameter "account_index" was null or undefined when calling nextNonce().'
|
|
353
353
|
);
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
if (requestParameters['api_key_index'] == null) {
|
|
357
357
|
throw new runtime.RequiredError(
|
|
358
358
|
'api_key_index',
|
|
359
|
-
'Required parameter "api_key_index" was null or undefined when calling
|
|
359
|
+
'Required parameter "api_key_index" was null or undefined when calling nextNonce().'
|
|
360
360
|
);
|
|
361
361
|
}
|
|
362
362
|
|
|
@@ -384,22 +384,22 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
386
|
* Get next nonce for a specific account
|
|
387
|
-
*
|
|
387
|
+
* nextNonce
|
|
388
388
|
*/
|
|
389
|
-
async
|
|
390
|
-
const response = await this.
|
|
389
|
+
async nextNonce(requestParameters: NextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NextNonce> {
|
|
390
|
+
const response = await this.nextNonceRaw(requestParameters, initOverrides);
|
|
391
391
|
return await response.value();
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* Get pending transactions
|
|
396
|
-
*
|
|
396
|
+
* pendingTxs
|
|
397
397
|
*/
|
|
398
|
-
async
|
|
398
|
+
async pendingTxsRaw(requestParameters: PendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
399
399
|
if (requestParameters['limit'] == null) {
|
|
400
400
|
throw new runtime.RequiredError(
|
|
401
401
|
'limit',
|
|
402
|
-
'Required parameter "limit" was null or undefined when calling
|
|
402
|
+
'Required parameter "limit" was null or undefined when calling pendingTxs().'
|
|
403
403
|
);
|
|
404
404
|
}
|
|
405
405
|
|
|
@@ -427,272 +427,272 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
427
427
|
|
|
428
428
|
/**
|
|
429
429
|
* Get pending transactions
|
|
430
|
-
*
|
|
430
|
+
* pendingTxs
|
|
431
431
|
*/
|
|
432
|
-
async
|
|
433
|
-
const response = await this.
|
|
432
|
+
async pendingTxs(requestParameters: PendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
433
|
+
const response = await this.pendingTxsRaw(requestParameters, initOverrides);
|
|
434
434
|
return await response.value();
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
/**
|
|
438
|
-
*
|
|
439
|
-
*
|
|
438
|
+
* You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers)
|
|
439
|
+
* sendTx
|
|
440
440
|
*/
|
|
441
|
-
async
|
|
442
|
-
if (requestParameters['
|
|
441
|
+
async sendTxRaw(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TxHash>> {
|
|
442
|
+
if (requestParameters['tx_type'] == null) {
|
|
443
443
|
throw new runtime.RequiredError(
|
|
444
|
-
'
|
|
445
|
-
'Required parameter "
|
|
444
|
+
'tx_type',
|
|
445
|
+
'Required parameter "tx_type" was null or undefined when calling sendTx().'
|
|
446
446
|
);
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
if (requestParameters['
|
|
449
|
+
if (requestParameters['tx_info'] == null) {
|
|
450
450
|
throw new runtime.RequiredError(
|
|
451
|
-
'
|
|
452
|
-
'Required parameter "
|
|
451
|
+
'tx_info',
|
|
452
|
+
'Required parameter "tx_info" was null or undefined when calling sendTx().'
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
const queryParameters: any = {};
|
|
457
457
|
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
459
|
+
|
|
460
|
+
const consumes: runtime.Consume[] = [
|
|
461
|
+
{ contentType: 'multipart/form-data' },
|
|
462
|
+
];
|
|
463
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
464
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
465
|
+
|
|
466
|
+
let formParams: { append(param: string, value: any): any };
|
|
467
|
+
let useForm = false;
|
|
468
|
+
if (useForm) {
|
|
469
|
+
formParams = new FormData();
|
|
470
|
+
} else {
|
|
471
|
+
formParams = new URLSearchParams();
|
|
460
472
|
}
|
|
461
473
|
|
|
462
|
-
if (requestParameters['
|
|
463
|
-
|
|
474
|
+
if (requestParameters['tx_type'] != null) {
|
|
475
|
+
formParams.append('tx_type', requestParameters['tx_type'] as any);
|
|
464
476
|
}
|
|
465
477
|
|
|
466
|
-
|
|
478
|
+
if (requestParameters['tx_info'] != null) {
|
|
479
|
+
formParams.append('tx_info', requestParameters['tx_info'] as any);
|
|
480
|
+
}
|
|
467
481
|
|
|
468
482
|
const response = await this.request({
|
|
469
|
-
path: `/api/v1/
|
|
470
|
-
method: '
|
|
483
|
+
path: `/api/v1/sendTx`,
|
|
484
|
+
method: 'POST',
|
|
471
485
|
headers: headerParameters,
|
|
472
486
|
query: queryParameters,
|
|
487
|
+
body: formParams,
|
|
473
488
|
}, initOverrides);
|
|
474
489
|
|
|
475
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
490
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxHashFromJSON(jsonValue));
|
|
476
491
|
}
|
|
477
492
|
|
|
478
493
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
494
|
+
* You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers)
|
|
495
|
+
* sendTx
|
|
481
496
|
*/
|
|
482
|
-
async
|
|
483
|
-
const response = await this.
|
|
497
|
+
async sendTx(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHash> {
|
|
498
|
+
const response = await this.sendTxRaw(requestParameters, initOverrides);
|
|
484
499
|
return await response.value();
|
|
485
500
|
}
|
|
486
501
|
|
|
487
502
|
/**
|
|
488
|
-
*
|
|
489
|
-
*
|
|
503
|
+
* You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers)
|
|
504
|
+
* sendTxBatch
|
|
490
505
|
*/
|
|
491
|
-
async
|
|
492
|
-
if (requestParameters['
|
|
506
|
+
async sendTxBatchRaw(requestParameters: SendTxBatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TxHashes>> {
|
|
507
|
+
if (requestParameters['tx_types'] == null) {
|
|
493
508
|
throw new runtime.RequiredError(
|
|
494
|
-
'
|
|
495
|
-
'Required parameter "
|
|
509
|
+
'tx_types',
|
|
510
|
+
'Required parameter "tx_types" was null or undefined when calling sendTxBatch().'
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (requestParameters['tx_infos'] == null) {
|
|
515
|
+
throw new runtime.RequiredError(
|
|
516
|
+
'tx_infos',
|
|
517
|
+
'Required parameter "tx_infos" was null or undefined when calling sendTxBatch().'
|
|
496
518
|
);
|
|
497
519
|
}
|
|
498
520
|
|
|
499
521
|
const queryParameters: any = {};
|
|
500
522
|
|
|
501
|
-
|
|
502
|
-
|
|
523
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
524
|
+
|
|
525
|
+
const consumes: runtime.Consume[] = [
|
|
526
|
+
{ contentType: 'multipart/form-data' },
|
|
527
|
+
];
|
|
528
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
529
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
530
|
+
|
|
531
|
+
let formParams: { append(param: string, value: any): any };
|
|
532
|
+
let useForm = false;
|
|
533
|
+
if (useForm) {
|
|
534
|
+
formParams = new FormData();
|
|
535
|
+
} else {
|
|
536
|
+
formParams = new URLSearchParams();
|
|
503
537
|
}
|
|
504
538
|
|
|
505
|
-
|
|
539
|
+
if (requestParameters['tx_types'] != null) {
|
|
540
|
+
formParams.append('tx_types', requestParameters['tx_types'] as any);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (requestParameters['tx_infos'] != null) {
|
|
544
|
+
formParams.append('tx_infos', requestParameters['tx_infos'] as any);
|
|
545
|
+
}
|
|
506
546
|
|
|
507
547
|
const response = await this.request({
|
|
508
|
-
path: `/api/v1/
|
|
509
|
-
method: '
|
|
548
|
+
path: `/api/v1/sendTxBatch`,
|
|
549
|
+
method: 'POST',
|
|
510
550
|
headers: headerParameters,
|
|
511
551
|
query: queryParameters,
|
|
552
|
+
body: formParams,
|
|
512
553
|
}, initOverrides);
|
|
513
554
|
|
|
514
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
555
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxHashesFromJSON(jsonValue));
|
|
515
556
|
}
|
|
516
557
|
|
|
517
558
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
559
|
+
* You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers)
|
|
560
|
+
* sendTxBatch
|
|
520
561
|
*/
|
|
521
|
-
async
|
|
522
|
-
const response = await this.
|
|
562
|
+
async sendTxBatch(requestParameters: SendTxBatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHashes> {
|
|
563
|
+
const response = await this.sendTxBatchRaw(requestParameters, initOverrides);
|
|
523
564
|
return await response.value();
|
|
524
565
|
}
|
|
525
566
|
|
|
526
567
|
/**
|
|
527
|
-
* Get
|
|
528
|
-
*
|
|
568
|
+
* Get transaction by hash or sequence index
|
|
569
|
+
* tx
|
|
529
570
|
*/
|
|
530
|
-
async
|
|
531
|
-
if (requestParameters['
|
|
571
|
+
async txRaw(requestParameters: TxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnrichedTx>> {
|
|
572
|
+
if (requestParameters['by'] == null) {
|
|
532
573
|
throw new runtime.RequiredError(
|
|
533
|
-
'
|
|
534
|
-
'Required parameter "
|
|
574
|
+
'by',
|
|
575
|
+
'Required parameter "by" was null or undefined when calling tx().'
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (requestParameters['value'] == null) {
|
|
580
|
+
throw new runtime.RequiredError(
|
|
581
|
+
'value',
|
|
582
|
+
'Required parameter "value" was null or undefined when calling tx().'
|
|
535
583
|
);
|
|
536
584
|
}
|
|
537
585
|
|
|
538
586
|
const queryParameters: any = {};
|
|
539
587
|
|
|
540
|
-
if (requestParameters['
|
|
541
|
-
queryParameters['
|
|
588
|
+
if (requestParameters['by'] != null) {
|
|
589
|
+
queryParameters['by'] = requestParameters['by'];
|
|
542
590
|
}
|
|
543
591
|
|
|
544
|
-
if (requestParameters['
|
|
545
|
-
queryParameters['
|
|
592
|
+
if (requestParameters['value'] != null) {
|
|
593
|
+
queryParameters['value'] = requestParameters['value'];
|
|
546
594
|
}
|
|
547
595
|
|
|
548
596
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
549
597
|
|
|
550
598
|
const response = await this.request({
|
|
551
|
-
path: `/api/v1/
|
|
599
|
+
path: `/api/v1/tx`,
|
|
552
600
|
method: 'GET',
|
|
553
601
|
headers: headerParameters,
|
|
554
602
|
query: queryParameters,
|
|
555
603
|
}, initOverrides);
|
|
556
604
|
|
|
557
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
605
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => EnrichedTxFromJSON(jsonValue));
|
|
558
606
|
}
|
|
559
607
|
|
|
560
608
|
/**
|
|
561
|
-
* Get
|
|
562
|
-
*
|
|
609
|
+
* Get transaction by hash or sequence index
|
|
610
|
+
* tx
|
|
563
611
|
*/
|
|
564
|
-
async
|
|
565
|
-
const response = await this.
|
|
612
|
+
async tx(requestParameters: TxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnrichedTx> {
|
|
613
|
+
const response = await this.txRaw(requestParameters, initOverrides);
|
|
566
614
|
return await response.value();
|
|
567
615
|
}
|
|
568
616
|
|
|
569
617
|
/**
|
|
570
|
-
*
|
|
571
|
-
*
|
|
618
|
+
* Get L1 transaction by L1 transaction hash
|
|
619
|
+
* txFromL1TxHash
|
|
572
620
|
*/
|
|
573
|
-
async
|
|
574
|
-
if (requestParameters['
|
|
575
|
-
throw new runtime.RequiredError(
|
|
576
|
-
'tx_type',
|
|
577
|
-
'Required parameter "tx_type" was null or undefined when calling sendTx().'
|
|
578
|
-
);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
if (requestParameters['tx_info'] == null) {
|
|
621
|
+
async txFromL1TxHashRaw(requestParameters: TxFromL1TxHashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnrichedTx>> {
|
|
622
|
+
if (requestParameters['hash'] == null) {
|
|
582
623
|
throw new runtime.RequiredError(
|
|
583
|
-
'
|
|
584
|
-
'Required parameter "
|
|
624
|
+
'hash',
|
|
625
|
+
'Required parameter "hash" was null or undefined when calling txFromL1TxHash().'
|
|
585
626
|
);
|
|
586
627
|
}
|
|
587
628
|
|
|
588
629
|
const queryParameters: any = {};
|
|
589
630
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
const consumes: runtime.Consume[] = [
|
|
593
|
-
{ contentType: 'multipart/form-data' },
|
|
594
|
-
];
|
|
595
|
-
// @ts-ignore: canConsumeForm may be unused
|
|
596
|
-
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
597
|
-
|
|
598
|
-
let formParams: { append(param: string, value: any): any };
|
|
599
|
-
let useForm = false;
|
|
600
|
-
if (useForm) {
|
|
601
|
-
formParams = new FormData();
|
|
602
|
-
} else {
|
|
603
|
-
formParams = new URLSearchParams();
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (requestParameters['tx_type'] != null) {
|
|
607
|
-
formParams.append('tx_type', requestParameters['tx_type'] as any);
|
|
631
|
+
if (requestParameters['hash'] != null) {
|
|
632
|
+
queryParameters['hash'] = requestParameters['hash'];
|
|
608
633
|
}
|
|
609
634
|
|
|
610
|
-
|
|
611
|
-
formParams.append('tx_info', requestParameters['tx_info'] as any);
|
|
612
|
-
}
|
|
635
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
613
636
|
|
|
614
637
|
const response = await this.request({
|
|
615
|
-
path: `/api/v1/
|
|
616
|
-
method: '
|
|
638
|
+
path: `/api/v1/txFromL1TxHash`,
|
|
639
|
+
method: 'GET',
|
|
617
640
|
headers: headerParameters,
|
|
618
641
|
query: queryParameters,
|
|
619
|
-
body: formParams,
|
|
620
642
|
}, initOverrides);
|
|
621
643
|
|
|
622
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
644
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => EnrichedTxFromJSON(jsonValue));
|
|
623
645
|
}
|
|
624
646
|
|
|
625
647
|
/**
|
|
626
|
-
*
|
|
627
|
-
*
|
|
648
|
+
* Get L1 transaction by L1 transaction hash
|
|
649
|
+
* txFromL1TxHash
|
|
628
650
|
*/
|
|
629
|
-
async
|
|
630
|
-
const response = await this.
|
|
651
|
+
async txFromL1TxHash(requestParameters: TxFromL1TxHashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnrichedTx> {
|
|
652
|
+
const response = await this.txFromL1TxHashRaw(requestParameters, initOverrides);
|
|
631
653
|
return await response.value();
|
|
632
654
|
}
|
|
633
655
|
|
|
634
656
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
657
|
+
* Get transactions which are already packed into blocks
|
|
658
|
+
* txs
|
|
637
659
|
*/
|
|
638
|
-
async
|
|
639
|
-
if (requestParameters['
|
|
640
|
-
throw new runtime.RequiredError(
|
|
641
|
-
'tx_types',
|
|
642
|
-
'Required parameter "tx_types" was null or undefined when calling sendTxBatch().'
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (requestParameters['tx_infos'] == null) {
|
|
660
|
+
async txsRaw(requestParameters: TxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
661
|
+
if (requestParameters['limit'] == null) {
|
|
647
662
|
throw new runtime.RequiredError(
|
|
648
|
-
'
|
|
649
|
-
'Required parameter "
|
|
663
|
+
'limit',
|
|
664
|
+
'Required parameter "limit" was null or undefined when calling txs().'
|
|
650
665
|
);
|
|
651
666
|
}
|
|
652
667
|
|
|
653
668
|
const queryParameters: any = {};
|
|
654
669
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
const consumes: runtime.Consume[] = [
|
|
658
|
-
{ contentType: 'multipart/form-data' },
|
|
659
|
-
];
|
|
660
|
-
// @ts-ignore: canConsumeForm may be unused
|
|
661
|
-
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
662
|
-
|
|
663
|
-
let formParams: { append(param: string, value: any): any };
|
|
664
|
-
let useForm = false;
|
|
665
|
-
if (useForm) {
|
|
666
|
-
formParams = new FormData();
|
|
667
|
-
} else {
|
|
668
|
-
formParams = new URLSearchParams();
|
|
670
|
+
if (requestParameters['index'] != null) {
|
|
671
|
+
queryParameters['index'] = requestParameters['index'];
|
|
669
672
|
}
|
|
670
673
|
|
|
671
|
-
if (requestParameters['
|
|
672
|
-
|
|
674
|
+
if (requestParameters['limit'] != null) {
|
|
675
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
673
676
|
}
|
|
674
677
|
|
|
675
|
-
|
|
676
|
-
formParams.append('tx_infos', requestParameters['tx_infos'] as any);
|
|
677
|
-
}
|
|
678
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
678
679
|
|
|
679
680
|
const response = await this.request({
|
|
680
|
-
path: `/api/v1/
|
|
681
|
-
method: '
|
|
681
|
+
path: `/api/v1/txs`,
|
|
682
|
+
method: 'GET',
|
|
682
683
|
headers: headerParameters,
|
|
683
684
|
query: queryParameters,
|
|
684
|
-
body: formParams,
|
|
685
685
|
}, initOverrides);
|
|
686
686
|
|
|
687
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
687
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
|
|
688
688
|
}
|
|
689
689
|
|
|
690
690
|
/**
|
|
691
|
-
*
|
|
692
|
-
*
|
|
691
|
+
* Get transactions which are already packed into blocks
|
|
692
|
+
* txs
|
|
693
693
|
*/
|
|
694
|
-
async
|
|
695
|
-
const response = await this.
|
|
694
|
+
async txs(requestParameters: TxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
695
|
+
const response = await this.txsRaw(requestParameters, initOverrides);
|
|
696
696
|
return await response.value();
|
|
697
697
|
}
|
|
698
698
|
|
|
@@ -701,30 +701,30 @@ export class TransactionApi extends runtime.BaseAPI {
|
|
|
701
701
|
/**
|
|
702
702
|
* @export
|
|
703
703
|
*/
|
|
704
|
-
export const
|
|
704
|
+
export const AccountPendingTxsByEnum = {
|
|
705
705
|
AccountIndex: 'account_index'
|
|
706
706
|
} as const;
|
|
707
|
-
export type
|
|
707
|
+
export type AccountPendingTxsByEnum = typeof AccountPendingTxsByEnum[keyof typeof AccountPendingTxsByEnum];
|
|
708
708
|
/**
|
|
709
709
|
* @export
|
|
710
710
|
*/
|
|
711
|
-
export const
|
|
711
|
+
export const AccountTxsByEnum = {
|
|
712
712
|
AccountIndex: 'account_index'
|
|
713
713
|
} as const;
|
|
714
|
-
export type
|
|
714
|
+
export type AccountTxsByEnum = typeof AccountTxsByEnum[keyof typeof AccountTxsByEnum];
|
|
715
715
|
/**
|
|
716
716
|
* @export
|
|
717
717
|
*/
|
|
718
|
-
export const
|
|
718
|
+
export const BlockTxsByEnum = {
|
|
719
719
|
Height: 'block_height',
|
|
720
720
|
Commitment: 'block_commitment'
|
|
721
721
|
} as const;
|
|
722
|
-
export type
|
|
722
|
+
export type BlockTxsByEnum = typeof BlockTxsByEnum[keyof typeof BlockTxsByEnum];
|
|
723
723
|
/**
|
|
724
724
|
* @export
|
|
725
725
|
*/
|
|
726
|
-
export const
|
|
726
|
+
export const TxByEnum = {
|
|
727
727
|
Hash: 'hash',
|
|
728
728
|
SequenceIndex: 'sequence_index'
|
|
729
729
|
} as const;
|
|
730
|
-
export type
|
|
730
|
+
export type TxByEnum = typeof TxByEnum[keyof typeof TxByEnum];
|