zklighter-perps 1.0.0
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/.circleci/config.yml +86 -0
- package/.openapi-generator/FILES +95 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/apis/AccountApi.ts +454 -0
- package/apis/BlockApi.ts +178 -0
- package/apis/CandlestickApi.ts +231 -0
- package/apis/InfoApi.ts +197 -0
- package/apis/OrderApi.ts +607 -0
- package/apis/RelayerApi.ts +95 -0
- package/apis/RootApi.ts +56 -0
- package/apis/TransactionApi.ts +608 -0
- package/apis/WsApi.ts +82 -0
- package/apis/index.ts +11 -0
- package/config.yaml +5 -0
- package/index.ts +5 -0
- package/models/AccountMarketStats.ts +100 -0
- package/models/AccountPnL.ts +91 -0
- package/models/AccountPosition.ts +140 -0
- package/models/AccountStats.ts +92 -0
- package/models/Block.ts +163 -0
- package/models/Blocks.ts +91 -0
- package/models/Candlestick.ts +108 -0
- package/models/Candlesticks.ts +91 -0
- package/models/ContractAddress.ts +68 -0
- package/models/CurrentHeight.ts +76 -0
- package/models/Cursor.ts +60 -0
- package/models/DetailedAccount.ts +169 -0
- package/models/DetailedAccounts.ts +91 -0
- package/models/EnrichedTx.ts +204 -0
- package/models/ExchangeStats.ts +107 -0
- package/models/Funding.ts +84 -0
- package/models/Fundings.ts +91 -0
- package/models/L1ProviderInfo.ts +84 -0
- package/models/Layer1BasicInfo.ts +143 -0
- package/models/Layer2BasicInfo.ts +92 -0
- package/models/MainAccount.ts +92 -0
- package/models/MainAccounts.ts +91 -0
- package/models/MarketInfo.ts +140 -0
- package/models/MarketSig.ts +100 -0
- package/models/NextNonce.ts +76 -0
- package/models/Order.ts +209 -0
- package/models/OrderBook.ts +143 -0
- package/models/OrderBookDepth.ts +99 -0
- package/models/OrderBookDetail.ts +287 -0
- package/models/OrderBookDetails.ts +83 -0
- package/models/OrderBookOrders.ts +107 -0
- package/models/OrderBookStats.ts +100 -0
- package/models/OrderBooks.ts +83 -0
- package/models/Orders.ts +91 -0
- package/models/Permission.ts +76 -0
- package/models/PnLEntry.ts +68 -0
- package/models/PriceLevel.ts +68 -0
- package/models/ReqDoFaucet.ts +60 -0
- package/models/ReqGetAccount.ts +79 -0
- package/models/ReqGetAccountActiveOrders.ts +76 -0
- package/models/ReqGetAccountByL1Address.ts +60 -0
- package/models/ReqGetAccountInactiveOrders.ts +111 -0
- package/models/ReqGetAccountOrders.ts +84 -0
- package/models/ReqGetAccountPendingTxs.ts +87 -0
- package/models/ReqGetAccountPnL.ts +124 -0
- package/models/ReqGetAccountTxs.ts +103 -0
- package/models/ReqGetBlock.ts +79 -0
- package/models/ReqGetBlockTxs.ts +79 -0
- package/models/ReqGetByAccount.ts +79 -0
- package/models/ReqGetCandlesticks.ts +107 -0
- package/models/ReqGetFundings.ts +102 -0
- package/models/ReqGetL1Tx.ts +60 -0
- package/models/ReqGetMarketSig.ts +76 -0
- package/models/ReqGetNextNonce.ts +68 -0
- package/models/ReqGetOrderBookDetails.ts +79 -0
- package/models/ReqGetOrderBookOrders.ts +68 -0
- package/models/ReqGetOrderBooks.ts +79 -0
- package/models/ReqGetPermission.ts +87 -0
- package/models/ReqGetRangeWithCursor.ts +68 -0
- package/models/ReqGetRangeWithIndex.ts +68 -0
- package/models/ReqGetRangeWithIndexSortable.ts +87 -0
- package/models/ReqGetRecentTrades.ts +68 -0
- package/models/ReqGetRollbacks.ts +76 -0
- package/models/ReqGetSubAccount.ts +87 -0
- package/models/ReqGetTrades.ts +104 -0
- package/models/ReqGetTx.ts +79 -0
- package/models/ReqSearch.ts +60 -0
- package/models/ResultCode.ts +68 -0
- package/models/Rollback.ts +84 -0
- package/models/Rollbacks.ts +91 -0
- package/models/Search.ts +76 -0
- package/models/SignBody.ts +76 -0
- package/models/SimpleOrder.ts +100 -0
- package/models/Status.ts +68 -0
- package/models/SubAccount.ts +116 -0
- package/models/SubAccounts.ts +107 -0
- package/models/Trade.ts +148 -0
- package/models/Trades.ts +83 -0
- package/models/Tx.ts +164 -0
- package/models/TxHash.ts +76 -0
- package/models/Txs.ts +83 -0
- package/models/ValidatorInfo.ts +68 -0
- package/models/index.ts +84 -0
- package/openapi-generator-cli.jar +0 -0
- package/openapi.json +3934 -0
- package/package.json +23 -0
- package/runtime.ts +426 -0
package/apis/RootApi.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
Status,
|
|
19
|
+
} from '../models/index';
|
|
20
|
+
import {
|
|
21
|
+
StatusFromJSON,
|
|
22
|
+
StatusToJSON,
|
|
23
|
+
} from '../models/index';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export class RootApi extends runtime.BaseAPI {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get status of zklighter
|
|
32
|
+
*/
|
|
33
|
+
async getStatusRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Status>> {
|
|
34
|
+
const queryParameters: any = {};
|
|
35
|
+
|
|
36
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
37
|
+
|
|
38
|
+
const response = await this.request({
|
|
39
|
+
path: `/`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
headers: headerParameters,
|
|
42
|
+
query: queryParameters,
|
|
43
|
+
}, initOverrides);
|
|
44
|
+
|
|
45
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => StatusFromJSON(jsonValue));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get status of zklighter
|
|
50
|
+
*/
|
|
51
|
+
async getStatus(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Status> {
|
|
52
|
+
const response = await this.getStatusRaw(initOverrides);
|
|
53
|
+
return await response.value();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
@@ -0,0 +1,608 @@
|
|
|
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
|
+
EnrichedTx,
|
|
19
|
+
NextNonce,
|
|
20
|
+
SignBody,
|
|
21
|
+
TxHash,
|
|
22
|
+
Txs,
|
|
23
|
+
} from '../models/index';
|
|
24
|
+
import {
|
|
25
|
+
EnrichedTxFromJSON,
|
|
26
|
+
EnrichedTxToJSON,
|
|
27
|
+
NextNonceFromJSON,
|
|
28
|
+
NextNonceToJSON,
|
|
29
|
+
SignBodyFromJSON,
|
|
30
|
+
SignBodyToJSON,
|
|
31
|
+
TxHashFromJSON,
|
|
32
|
+
TxHashToJSON,
|
|
33
|
+
TxsFromJSON,
|
|
34
|
+
TxsToJSON,
|
|
35
|
+
} from '../models/index';
|
|
36
|
+
|
|
37
|
+
export interface GetAccountPendingTxsRequest {
|
|
38
|
+
by: GetAccountPendingTxsByEnum;
|
|
39
|
+
value: string;
|
|
40
|
+
types?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GetAccountTxsRequest {
|
|
44
|
+
limit: number;
|
|
45
|
+
by: GetAccountTxsByEnum;
|
|
46
|
+
value: string;
|
|
47
|
+
index?: number;
|
|
48
|
+
types?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface GetBlockTxsRequest {
|
|
52
|
+
by: GetBlockTxsByEnum;
|
|
53
|
+
value: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface GetL2SignatureBodyRequest {
|
|
57
|
+
txType?: number;
|
|
58
|
+
txInfo?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface GetNextNonceRequest {
|
|
62
|
+
accountIndex: number;
|
|
63
|
+
subAccountIndex: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface GetPendingTxsRequest {
|
|
67
|
+
limit: number;
|
|
68
|
+
index?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface GetTxRequest {
|
|
72
|
+
by: GetTxByEnum;
|
|
73
|
+
value: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface GetTxFromL1TxHashRequest {
|
|
77
|
+
hash: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface GetTxsRequest {
|
|
81
|
+
limit: number;
|
|
82
|
+
index?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface SendTxRequest {
|
|
86
|
+
txType?: number;
|
|
87
|
+
txInfo?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
export class TransactionApi extends runtime.BaseAPI {
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get pending transactions of a specific account
|
|
97
|
+
*/
|
|
98
|
+
async getAccountPendingTxsRaw(requestParameters: GetAccountPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
99
|
+
if (requestParameters['by'] == null) {
|
|
100
|
+
throw new runtime.RequiredError(
|
|
101
|
+
'by',
|
|
102
|
+
'Required parameter "by" was null or undefined when calling getAccountPendingTxs().'
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (requestParameters['value'] == null) {
|
|
107
|
+
throw new runtime.RequiredError(
|
|
108
|
+
'value',
|
|
109
|
+
'Required parameter "value" was null or undefined when calling getAccountPendingTxs().'
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const queryParameters: any = {};
|
|
114
|
+
|
|
115
|
+
if (requestParameters['by'] != null) {
|
|
116
|
+
queryParameters['by'] = requestParameters['by'];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (requestParameters['value'] != null) {
|
|
120
|
+
queryParameters['value'] = requestParameters['value'];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (requestParameters['types'] != null) {
|
|
124
|
+
queryParameters['types'] = requestParameters['types'];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
128
|
+
|
|
129
|
+
const response = await this.request({
|
|
130
|
+
path: `/api/v1/accountPendingTxs`,
|
|
131
|
+
method: 'GET',
|
|
132
|
+
headers: headerParameters,
|
|
133
|
+
query: queryParameters,
|
|
134
|
+
}, initOverrides);
|
|
135
|
+
|
|
136
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get pending transactions of a specific account
|
|
141
|
+
*/
|
|
142
|
+
async getAccountPendingTxs(requestParameters: GetAccountPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
143
|
+
const response = await this.getAccountPendingTxsRaw(requestParameters, initOverrides);
|
|
144
|
+
return await response.value();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get transactions of a specific account
|
|
149
|
+
*/
|
|
150
|
+
async getAccountTxsRaw(requestParameters: GetAccountTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
151
|
+
if (requestParameters['limit'] == null) {
|
|
152
|
+
throw new runtime.RequiredError(
|
|
153
|
+
'limit',
|
|
154
|
+
'Required parameter "limit" was null or undefined when calling getAccountTxs().'
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (requestParameters['by'] == null) {
|
|
159
|
+
throw new runtime.RequiredError(
|
|
160
|
+
'by',
|
|
161
|
+
'Required parameter "by" was null or undefined when calling getAccountTxs().'
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (requestParameters['value'] == null) {
|
|
166
|
+
throw new runtime.RequiredError(
|
|
167
|
+
'value',
|
|
168
|
+
'Required parameter "value" was null or undefined when calling getAccountTxs().'
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const queryParameters: any = {};
|
|
173
|
+
|
|
174
|
+
if (requestParameters['index'] != null) {
|
|
175
|
+
queryParameters['index'] = requestParameters['index'];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (requestParameters['limit'] != null) {
|
|
179
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (requestParameters['by'] != null) {
|
|
183
|
+
queryParameters['by'] = requestParameters['by'];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (requestParameters['value'] != null) {
|
|
187
|
+
queryParameters['value'] = requestParameters['value'];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (requestParameters['types'] != null) {
|
|
191
|
+
queryParameters['types'] = requestParameters['types'];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
195
|
+
|
|
196
|
+
const response = await this.request({
|
|
197
|
+
path: `/api/v1/accountTxs`,
|
|
198
|
+
method: 'GET',
|
|
199
|
+
headers: headerParameters,
|
|
200
|
+
query: queryParameters,
|
|
201
|
+
}, initOverrides);
|
|
202
|
+
|
|
203
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Get transactions of a specific account
|
|
208
|
+
*/
|
|
209
|
+
async getAccountTxs(requestParameters: GetAccountTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
210
|
+
const response = await this.getAccountTxsRaw(requestParameters, initOverrides);
|
|
211
|
+
return await response.value();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Get transactions in a block
|
|
216
|
+
*/
|
|
217
|
+
async getBlockTxsRaw(requestParameters: GetBlockTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
218
|
+
if (requestParameters['by'] == null) {
|
|
219
|
+
throw new runtime.RequiredError(
|
|
220
|
+
'by',
|
|
221
|
+
'Required parameter "by" was null or undefined when calling getBlockTxs().'
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (requestParameters['value'] == null) {
|
|
226
|
+
throw new runtime.RequiredError(
|
|
227
|
+
'value',
|
|
228
|
+
'Required parameter "value" was null or undefined when calling getBlockTxs().'
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const queryParameters: any = {};
|
|
233
|
+
|
|
234
|
+
if (requestParameters['by'] != null) {
|
|
235
|
+
queryParameters['by'] = requestParameters['by'];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (requestParameters['value'] != null) {
|
|
239
|
+
queryParameters['value'] = requestParameters['value'];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
243
|
+
|
|
244
|
+
const response = await this.request({
|
|
245
|
+
path: `/api/v1/blockTxs`,
|
|
246
|
+
method: 'GET',
|
|
247
|
+
headers: headerParameters,
|
|
248
|
+
query: queryParameters,
|
|
249
|
+
}, initOverrides);
|
|
250
|
+
|
|
251
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Get transactions in a block
|
|
256
|
+
*/
|
|
257
|
+
async getBlockTxs(requestParameters: GetBlockTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
258
|
+
const response = await this.getBlockTxsRaw(requestParameters, initOverrides);
|
|
259
|
+
return await response.value();
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Get transaction signature body
|
|
264
|
+
*/
|
|
265
|
+
async getL2SignatureBodyRaw(requestParameters: GetL2SignatureBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SignBody>> {
|
|
266
|
+
const queryParameters: any = {};
|
|
267
|
+
|
|
268
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
269
|
+
|
|
270
|
+
const consumes: runtime.Consume[] = [
|
|
271
|
+
{ contentType: 'multipart/form-data' },
|
|
272
|
+
];
|
|
273
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
274
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
275
|
+
|
|
276
|
+
let formParams: { append(param: string, value: any): any };
|
|
277
|
+
let useForm = false;
|
|
278
|
+
if (useForm) {
|
|
279
|
+
formParams = new FormData();
|
|
280
|
+
} else {
|
|
281
|
+
formParams = new URLSearchParams();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (requestParameters['txType'] != null) {
|
|
285
|
+
formParams.append('tx_type', requestParameters['txType'] as any);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (requestParameters['txInfo'] != null) {
|
|
289
|
+
formParams.append('tx_info', requestParameters['txInfo'] as any);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const response = await this.request({
|
|
293
|
+
path: `/api/v1/l2Signature`,
|
|
294
|
+
method: 'POST',
|
|
295
|
+
headers: headerParameters,
|
|
296
|
+
query: queryParameters,
|
|
297
|
+
body: formParams,
|
|
298
|
+
}, initOverrides);
|
|
299
|
+
|
|
300
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SignBodyFromJSON(jsonValue));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Get transaction signature body
|
|
305
|
+
*/
|
|
306
|
+
async getL2SignatureBody(requestParameters: GetL2SignatureBodyRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SignBody> {
|
|
307
|
+
const response = await this.getL2SignatureBodyRaw(requestParameters, initOverrides);
|
|
308
|
+
return await response.value();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Get next nonce for a specific account
|
|
313
|
+
*/
|
|
314
|
+
async getNextNonceRaw(requestParameters: GetNextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NextNonce>> {
|
|
315
|
+
if (requestParameters['accountIndex'] == null) {
|
|
316
|
+
throw new runtime.RequiredError(
|
|
317
|
+
'accountIndex',
|
|
318
|
+
'Required parameter "accountIndex" was null or undefined when calling getNextNonce().'
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (requestParameters['subAccountIndex'] == null) {
|
|
323
|
+
throw new runtime.RequiredError(
|
|
324
|
+
'subAccountIndex',
|
|
325
|
+
'Required parameter "subAccountIndex" was null or undefined when calling getNextNonce().'
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const queryParameters: any = {};
|
|
330
|
+
|
|
331
|
+
if (requestParameters['accountIndex'] != null) {
|
|
332
|
+
queryParameters['account_index'] = requestParameters['accountIndex'];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (requestParameters['subAccountIndex'] != null) {
|
|
336
|
+
queryParameters['sub_account_index'] = requestParameters['subAccountIndex'];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
340
|
+
|
|
341
|
+
const response = await this.request({
|
|
342
|
+
path: `/api/v1/nextNonce`,
|
|
343
|
+
method: 'GET',
|
|
344
|
+
headers: headerParameters,
|
|
345
|
+
query: queryParameters,
|
|
346
|
+
}, initOverrides);
|
|
347
|
+
|
|
348
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => NextNonceFromJSON(jsonValue));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Get next nonce for a specific account
|
|
353
|
+
*/
|
|
354
|
+
async getNextNonce(requestParameters: GetNextNonceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NextNonce> {
|
|
355
|
+
const response = await this.getNextNonceRaw(requestParameters, initOverrides);
|
|
356
|
+
return await response.value();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Get pending transactions
|
|
361
|
+
*/
|
|
362
|
+
async getPendingTxsRaw(requestParameters: GetPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
363
|
+
if (requestParameters['limit'] == null) {
|
|
364
|
+
throw new runtime.RequiredError(
|
|
365
|
+
'limit',
|
|
366
|
+
'Required parameter "limit" was null or undefined when calling getPendingTxs().'
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const queryParameters: any = {};
|
|
371
|
+
|
|
372
|
+
if (requestParameters['index'] != null) {
|
|
373
|
+
queryParameters['index'] = requestParameters['index'];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (requestParameters['limit'] != null) {
|
|
377
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
381
|
+
|
|
382
|
+
const response = await this.request({
|
|
383
|
+
path: `/api/v1/pendingTxs`,
|
|
384
|
+
method: 'GET',
|
|
385
|
+
headers: headerParameters,
|
|
386
|
+
query: queryParameters,
|
|
387
|
+
}, initOverrides);
|
|
388
|
+
|
|
389
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Get pending transactions
|
|
394
|
+
*/
|
|
395
|
+
async getPendingTxs(requestParameters: GetPendingTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
396
|
+
const response = await this.getPendingTxsRaw(requestParameters, initOverrides);
|
|
397
|
+
return await response.value();
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Get transaction by hash or sequence index
|
|
402
|
+
*/
|
|
403
|
+
async getTxRaw(requestParameters: GetTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnrichedTx>> {
|
|
404
|
+
if (requestParameters['by'] == null) {
|
|
405
|
+
throw new runtime.RequiredError(
|
|
406
|
+
'by',
|
|
407
|
+
'Required parameter "by" was null or undefined when calling getTx().'
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (requestParameters['value'] == null) {
|
|
412
|
+
throw new runtime.RequiredError(
|
|
413
|
+
'value',
|
|
414
|
+
'Required parameter "value" was null or undefined when calling getTx().'
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const queryParameters: any = {};
|
|
419
|
+
|
|
420
|
+
if (requestParameters['by'] != null) {
|
|
421
|
+
queryParameters['by'] = requestParameters['by'];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (requestParameters['value'] != null) {
|
|
425
|
+
queryParameters['value'] = requestParameters['value'];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
429
|
+
|
|
430
|
+
const response = await this.request({
|
|
431
|
+
path: `/api/v1/tx`,
|
|
432
|
+
method: 'GET',
|
|
433
|
+
headers: headerParameters,
|
|
434
|
+
query: queryParameters,
|
|
435
|
+
}, initOverrides);
|
|
436
|
+
|
|
437
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => EnrichedTxFromJSON(jsonValue));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Get transaction by hash or sequence index
|
|
442
|
+
*/
|
|
443
|
+
async getTx(requestParameters: GetTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnrichedTx> {
|
|
444
|
+
const response = await this.getTxRaw(requestParameters, initOverrides);
|
|
445
|
+
return await response.value();
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Get L1 transaction by L1 transaction hash
|
|
450
|
+
*/
|
|
451
|
+
async getTxFromL1TxHashRaw(requestParameters: GetTxFromL1TxHashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnrichedTx>> {
|
|
452
|
+
if (requestParameters['hash'] == null) {
|
|
453
|
+
throw new runtime.RequiredError(
|
|
454
|
+
'hash',
|
|
455
|
+
'Required parameter "hash" was null or undefined when calling getTxFromL1TxHash().'
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const queryParameters: any = {};
|
|
460
|
+
|
|
461
|
+
if (requestParameters['hash'] != null) {
|
|
462
|
+
queryParameters['hash'] = requestParameters['hash'];
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
466
|
+
|
|
467
|
+
const response = await this.request({
|
|
468
|
+
path: `/api/v1/txFromL1TxHash`,
|
|
469
|
+
method: 'GET',
|
|
470
|
+
headers: headerParameters,
|
|
471
|
+
query: queryParameters,
|
|
472
|
+
}, initOverrides);
|
|
473
|
+
|
|
474
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => EnrichedTxFromJSON(jsonValue));
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Get L1 transaction by L1 transaction hash
|
|
479
|
+
*/
|
|
480
|
+
async getTxFromL1TxHash(requestParameters: GetTxFromL1TxHashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnrichedTx> {
|
|
481
|
+
const response = await this.getTxFromL1TxHashRaw(requestParameters, initOverrides);
|
|
482
|
+
return await response.value();
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Get transactions which are already packed into blocks
|
|
487
|
+
*/
|
|
488
|
+
async getTxsRaw(requestParameters: GetTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Txs>> {
|
|
489
|
+
if (requestParameters['limit'] == null) {
|
|
490
|
+
throw new runtime.RequiredError(
|
|
491
|
+
'limit',
|
|
492
|
+
'Required parameter "limit" was null or undefined when calling getTxs().'
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const queryParameters: any = {};
|
|
497
|
+
|
|
498
|
+
if (requestParameters['index'] != null) {
|
|
499
|
+
queryParameters['index'] = requestParameters['index'];
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (requestParameters['limit'] != null) {
|
|
503
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
507
|
+
|
|
508
|
+
const response = await this.request({
|
|
509
|
+
path: `/api/v1/txs`,
|
|
510
|
+
method: 'GET',
|
|
511
|
+
headers: headerParameters,
|
|
512
|
+
query: queryParameters,
|
|
513
|
+
}, initOverrides);
|
|
514
|
+
|
|
515
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxsFromJSON(jsonValue));
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Get transactions which are already packed into blocks
|
|
520
|
+
*/
|
|
521
|
+
async getTxs(requestParameters: GetTxsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Txs> {
|
|
522
|
+
const response = await this.getTxsRaw(requestParameters, initOverrides);
|
|
523
|
+
return await response.value();
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Send raw transaction
|
|
528
|
+
*/
|
|
529
|
+
async sendTxRaw(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TxHash>> {
|
|
530
|
+
const queryParameters: any = {};
|
|
531
|
+
|
|
532
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
533
|
+
|
|
534
|
+
const consumes: runtime.Consume[] = [
|
|
535
|
+
{ contentType: 'multipart/form-data' },
|
|
536
|
+
];
|
|
537
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
538
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
539
|
+
|
|
540
|
+
let formParams: { append(param: string, value: any): any };
|
|
541
|
+
let useForm = false;
|
|
542
|
+
if (useForm) {
|
|
543
|
+
formParams = new FormData();
|
|
544
|
+
} else {
|
|
545
|
+
formParams = new URLSearchParams();
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (requestParameters['txType'] != null) {
|
|
549
|
+
formParams.append('tx_type', requestParameters['txType'] as any);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (requestParameters['txInfo'] != null) {
|
|
553
|
+
formParams.append('tx_info', requestParameters['txInfo'] as any);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const response = await this.request({
|
|
557
|
+
path: `/api/v1/sendTx`,
|
|
558
|
+
method: 'POST',
|
|
559
|
+
headers: headerParameters,
|
|
560
|
+
query: queryParameters,
|
|
561
|
+
body: formParams,
|
|
562
|
+
}, initOverrides);
|
|
563
|
+
|
|
564
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TxHashFromJSON(jsonValue));
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Send raw transaction
|
|
569
|
+
*/
|
|
570
|
+
async sendTx(requestParameters: SendTxRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHash> {
|
|
571
|
+
const response = await this.sendTxRaw(requestParameters, initOverrides);
|
|
572
|
+
return await response.value();
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @export
|
|
579
|
+
*/
|
|
580
|
+
export const GetAccountPendingTxsByEnum = {
|
|
581
|
+
AccountIndex: 'account_index',
|
|
582
|
+
L1Address: 'l1_address'
|
|
583
|
+
} as const;
|
|
584
|
+
export type GetAccountPendingTxsByEnum = typeof GetAccountPendingTxsByEnum[keyof typeof GetAccountPendingTxsByEnum];
|
|
585
|
+
/**
|
|
586
|
+
* @export
|
|
587
|
+
*/
|
|
588
|
+
export const GetAccountTxsByEnum = {
|
|
589
|
+
AccountIndex: 'account_index',
|
|
590
|
+
L1Address: 'l1_address'
|
|
591
|
+
} as const;
|
|
592
|
+
export type GetAccountTxsByEnum = typeof GetAccountTxsByEnum[keyof typeof GetAccountTxsByEnum];
|
|
593
|
+
/**
|
|
594
|
+
* @export
|
|
595
|
+
*/
|
|
596
|
+
export const GetBlockTxsByEnum = {
|
|
597
|
+
Height: 'block_height',
|
|
598
|
+
Commitment: 'block_commitment'
|
|
599
|
+
} as const;
|
|
600
|
+
export type GetBlockTxsByEnum = typeof GetBlockTxsByEnum[keyof typeof GetBlockTxsByEnum];
|
|
601
|
+
/**
|
|
602
|
+
* @export
|
|
603
|
+
*/
|
|
604
|
+
export const GetTxByEnum = {
|
|
605
|
+
Hash: 'hash',
|
|
606
|
+
SequenceIndex: 'sequence_index'
|
|
607
|
+
} as const;
|
|
608
|
+
export type GetTxByEnum = typeof GetTxByEnum[keyof typeof GetTxByEnum];
|