zklighter-perps 1.0.29 → 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.
@@ -40,50 +40,36 @@ import {
40
40
  TxsToJSON,
41
41
  } from '../models/index';
42
42
 
43
- export interface GetAccountPendingTxsRequest {
44
- by: GetAccountPendingTxsByEnum;
43
+ export interface AccountPendingTxsRequest {
44
+ by: AccountPendingTxsByEnum;
45
45
  value: string;
46
46
  types?: number;
47
47
  }
48
48
 
49
- export interface GetAccountTxsRequest {
49
+ export interface AccountTxsRequest {
50
50
  limit: number;
51
- by: GetAccountTxsByEnum;
51
+ by: AccountTxsByEnum;
52
52
  value: string;
53
53
  index?: number;
54
54
  types?: number;
55
55
  }
56
56
 
57
- export interface GetBlockTxsRequest {
58
- by: GetBlockTxsByEnum;
57
+ export interface BlockTxsRequest {
58
+ by: BlockTxsByEnum;
59
59
  value: string;
60
60
  }
61
61
 
62
- export interface GetL2SignatureBodyRequest {
62
+ export interface L2SignatureRequest {
63
63
  tx_type: number;
64
64
  tx_info: string;
65
65
  }
66
66
 
67
- export interface GetNextNonceRequest {
67
+ export interface NextNonceRequest {
68
68
  account_index: number;
69
69
  api_key_index: number;
70
70
  }
71
71
 
72
- export interface GetPendingTxsRequest {
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
- * GetAccountPendingTxs
108
+ * accountPendingTxs
109
109
  */
110
- async getAccountPendingTxsRaw(requestParameters: GetAccountPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
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 getAccountPendingTxs().'
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 getAccountPendingTxs().'
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
- * GetAccountPendingTxs
153
+ * accountPendingTxs
154
154
  */
155
- async getAccountPendingTxs(requestParameters: GetAccountPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
156
- const response = await this.getAccountPendingTxsRaw(requestParameters, initOverrides);
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
- * GetAccountTxs
162
+ * accountTxs
163
163
  */
164
- async getAccountTxsRaw(requestParameters: GetAccountTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
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 getAccountTxs().'
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 getAccountTxs().'
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 getAccountTxs().'
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
- * GetAccountTxs
222
+ * accountTxs
223
223
  */
224
- async getAccountTxs(requestParameters: GetAccountTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
225
- const response = await this.getAccountTxsRaw(requestParameters, initOverrides);
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
- * GetBlockTxs
231
+ * blockTxs
232
232
  */
233
- async getBlockTxsRaw(requestParameters: GetBlockTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
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 getBlockTxs().'
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 getBlockTxs().'
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
- * GetBlockTxs
272
+ * blockTxs
273
273
  */
274
- async getBlockTxs(requestParameters: GetBlockTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
275
- const response = await this.getBlockTxsRaw(requestParameters, initOverrides);
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
- * GetL2SignatureBody
281
+ * l2Signature
282
282
  */
283
- async getL2SignatureBodyRaw(requestParameters: GetL2SignatureBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SignBody>> {
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 getL2SignatureBody().'
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 getL2SignatureBody().'
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
- * GetL2SignatureBody
337
+ * l2Signature
338
338
  */
339
- async getL2SignatureBody(requestParameters: GetL2SignatureBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SignBody> {
340
- const response = await this.getL2SignatureBodyRaw(requestParameters, initOverrides);
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
- * GetNextNonce
346
+ * nextNonce
347
347
  */
348
- async getNextNonceRaw(requestParameters: GetNextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NextNonce>> {
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 getNextNonce().'
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 getNextNonce().'
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
- * GetNextNonce
387
+ * nextNonce
388
388
  */
389
- async getNextNonce(requestParameters: GetNextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NextNonce> {
390
- const response = await this.getNextNonceRaw(requestParameters, initOverrides);
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
- * GetPendingTxs
396
+ * pendingTxs
397
397
  */
398
- async getPendingTxsRaw(requestParameters: GetPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
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 getPendingTxs().'
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
- * GetPendingTxs
430
+ * pendingTxs
431
431
  */
432
- async getPendingTxs(requestParameters: GetPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
433
- const response = await this.getPendingTxsRaw(requestParameters, initOverrides);
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
- * Get transaction by hash or sequence index
439
- * GetTx
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 getTxRaw(requestParameters: GetTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnrichedTx>> {
442
- if (requestParameters['by'] == null) {
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
- 'by',
445
- 'Required parameter "by" was null or undefined when calling getTx().'
444
+ 'tx_type',
445
+ 'Required parameter "tx_type" was null or undefined when calling sendTx().'
446
446
  );
447
447
  }
448
448
 
449
- if (requestParameters['value'] == null) {
449
+ if (requestParameters['tx_info'] == null) {
450
450
  throw new runtime.RequiredError(
451
- 'value',
452
- 'Required parameter "value" was null or undefined when calling getTx().'
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
- if (requestParameters['by'] != null) {
459
- queryParameters['by'] = requestParameters['by'];
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['value'] != null) {
463
- queryParameters['value'] = requestParameters['value'];
474
+ if (requestParameters['tx_type'] != null) {
475
+ formParams.append('tx_type', requestParameters['tx_type'] as any);
464
476
  }
465
477
 
466
- const headerParameters: runtime.HTTPHeaders = {};
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/tx`,
470
- method: 'GET',
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) => EnrichedTxFromJSON(jsonValue));
490
+ return new runtime.JSONApiResponse(response, (jsonValue) => TxHashFromJSON(jsonValue));
476
491
  }
477
492
 
478
493
  /**
479
- * Get transaction by hash or sequence index
480
- * GetTx
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 getTx(requestParameters: GetTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnrichedTx> {
483
- const response = await this.getTxRaw(requestParameters, initOverrides);
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
- * Get L1 transaction by L1 transaction hash
489
- * getTxFromL1TxHash
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 getTxFromL1TxHashRaw(requestParameters: GetTxFromL1TxHashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnrichedTx>> {
492
- if (requestParameters['hash'] == null) {
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
- 'hash',
495
- 'Required parameter "hash" was null or undefined when calling getTxFromL1TxHash().'
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
- if (requestParameters['hash'] != null) {
502
- queryParameters['hash'] = requestParameters['hash'];
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
- const headerParameters: runtime.HTTPHeaders = {};
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/txFromL1TxHash`,
509
- method: 'GET',
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) => EnrichedTxFromJSON(jsonValue));
555
+ return new runtime.JSONApiResponse(response, (jsonValue) => TxHashesFromJSON(jsonValue));
515
556
  }
516
557
 
517
558
  /**
518
- * Get L1 transaction by L1 transaction hash
519
- * getTxFromL1TxHash
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 getTxFromL1TxHash(requestParameters: GetTxFromL1TxHashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnrichedTx> {
522
- const response = await this.getTxFromL1TxHashRaw(requestParameters, initOverrides);
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 transactions which are already packed into blocks
528
- * GetTxs
568
+ * Get transaction by hash or sequence index
569
+ * tx
529
570
  */
530
- async getTxsRaw(requestParameters: GetTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
531
- if (requestParameters['limit'] == null) {
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
- 'limit',
534
- 'Required parameter "limit" was null or undefined when calling getTxs().'
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['index'] != null) {
541
- queryParameters['index'] = requestParameters['index'];
588
+ if (requestParameters['by'] != null) {
589
+ queryParameters['by'] = requestParameters['by'];
542
590
  }
543
591
 
544
- if (requestParameters['limit'] != null) {
545
- queryParameters['limit'] = requestParameters['limit'];
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/txs`,
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) => TxsFromJSON(jsonValue));
605
+ return new runtime.JSONApiResponse(response, (jsonValue) => EnrichedTxFromJSON(jsonValue));
558
606
  }
559
607
 
560
608
  /**
561
- * Get transactions which are already packed into blocks
562
- * GetTxs
609
+ * Get transaction by hash or sequence index
610
+ * tx
563
611
  */
564
- async getTxs(requestParameters: GetTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
565
- const response = await this.getTxsRaw(requestParameters, initOverrides);
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
- * Send raw transaction
571
- * SendTx
618
+ * Get L1 transaction by L1 transaction hash
619
+ * txFromL1TxHash
572
620
  */
573
- async sendTxRaw(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TxHash>> {
574
- if (requestParameters['tx_type'] == null) {
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
- 'tx_info',
584
- 'Required parameter "tx_info" was null or undefined when calling sendTx().'
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
- const headerParameters: runtime.HTTPHeaders = {};
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
- if (requestParameters['tx_info'] != null) {
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/sendTx`,
616
- method: 'POST',
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) => TxHashFromJSON(jsonValue));
644
+ return new runtime.JSONApiResponse(response, (jsonValue) => EnrichedTxFromJSON(jsonValue));
623
645
  }
624
646
 
625
647
  /**
626
- * Send raw transaction
627
- * SendTx
648
+ * Get L1 transaction by L1 transaction hash
649
+ * txFromL1TxHash
628
650
  */
629
- async sendTx(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHash> {
630
- const response = await this.sendTxRaw(requestParameters, initOverrides);
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
- * Send multiple raw transactions
636
- * SendTxBatch
657
+ * Get transactions which are already packed into blocks
658
+ * txs
637
659
  */
638
- async sendTxBatchRaw(requestParameters: SendTxBatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TxHashes>> {
639
- if (requestParameters['tx_types'] == null) {
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
- 'tx_infos',
649
- 'Required parameter "tx_infos" was null or undefined when calling sendTxBatch().'
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
- const headerParameters: runtime.HTTPHeaders = {};
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['tx_types'] != null) {
672
- formParams.append('tx_types', requestParameters['tx_types'] as any);
674
+ if (requestParameters['limit'] != null) {
675
+ queryParameters['limit'] = requestParameters['limit'];
673
676
  }
674
677
 
675
- if (requestParameters['tx_infos'] != null) {
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/sendTxBatch`,
681
- method: 'POST',
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) => TxHashesFromJSON(jsonValue));
687
+ return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
688
688
  }
689
689
 
690
690
  /**
691
- * Send multiple raw transactions
692
- * SendTxBatch
691
+ * Get transactions which are already packed into blocks
692
+ * txs
693
693
  */
694
- async sendTxBatch(requestParameters: SendTxBatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHashes> {
695
- const response = await this.sendTxBatchRaw(requestParameters, initOverrides);
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 GetAccountPendingTxsByEnum = {
704
+ export const AccountPendingTxsByEnum = {
705
705
  AccountIndex: 'account_index'
706
706
  } as const;
707
- export type GetAccountPendingTxsByEnum = typeof GetAccountPendingTxsByEnum[keyof typeof GetAccountPendingTxsByEnum];
707
+ export type AccountPendingTxsByEnum = typeof AccountPendingTxsByEnum[keyof typeof AccountPendingTxsByEnum];
708
708
  /**
709
709
  * @export
710
710
  */
711
- export const GetAccountTxsByEnum = {
711
+ export const AccountTxsByEnum = {
712
712
  AccountIndex: 'account_index'
713
713
  } as const;
714
- export type GetAccountTxsByEnum = typeof GetAccountTxsByEnum[keyof typeof GetAccountTxsByEnum];
714
+ export type AccountTxsByEnum = typeof AccountTxsByEnum[keyof typeof AccountTxsByEnum];
715
715
  /**
716
716
  * @export
717
717
  */
718
- export const GetBlockTxsByEnum = {
718
+ export const BlockTxsByEnum = {
719
719
  Height: 'block_height',
720
720
  Commitment: 'block_commitment'
721
721
  } as const;
722
- export type GetBlockTxsByEnum = typeof GetBlockTxsByEnum[keyof typeof GetBlockTxsByEnum];
722
+ export type BlockTxsByEnum = typeof BlockTxsByEnum[keyof typeof BlockTxsByEnum];
723
723
  /**
724
724
  * @export
725
725
  */
726
- export const GetTxByEnum = {
726
+ export const TxByEnum = {
727
727
  Hash: 'hash',
728
728
  SequenceIndex: 'sequence_index'
729
729
  } as const;
730
- export type GetTxByEnum = typeof GetTxByEnum[keyof typeof GetTxByEnum];
730
+ export type TxByEnum = typeof TxByEnum[keyof typeof TxByEnum];