@0xsequence/relayer 2.3.38 → 2.3.40
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/dist/0xsequence-relayer.cjs.dev.js +607 -368
- package/dist/0xsequence-relayer.cjs.prod.js +607 -368
- package/dist/0xsequence-relayer.esm.js +607 -368
- package/dist/declarations/src/rpc-relayer/relayer.gen.d.ts +217 -178
- package/package.json +6 -6
- package/src/rpc-relayer/relayer.gen.ts +1163 -1020
|
@@ -1,76 +1,159 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// sequence-relayer v0.4.1
|
|
2
|
+
// sequence-relayer v0.4.1 7f8a4b83b00e0b6849c76c2ff0e23931e26b3d9f
|
|
3
3
|
// --
|
|
4
|
-
// Code generated by
|
|
4
|
+
// Code generated by Webrpc-gen@v0.31.2 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
|
-
// webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts
|
|
6
|
+
// webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts -compat
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const WebrpcHeaderValue = "webrpc@v0.26.0;gen-typescript@v0.17.0;sequence-relayer@v0.4.1"
|
|
11
|
-
|
|
12
|
-
// WebRPC description and code-gen version
|
|
13
|
-
export const WebRPCVersion = "v1"
|
|
8
|
+
// Webrpc description and code-gen version
|
|
9
|
+
export const WebrpcVersion = 'v1'
|
|
14
10
|
|
|
15
11
|
// Schema version of your RIDL schema
|
|
16
|
-
export const
|
|
12
|
+
export const WebrpcSchemaVersion = 'v0.4.1'
|
|
17
13
|
|
|
18
14
|
// Schema hash generated from your RIDL schema
|
|
19
|
-
export const
|
|
15
|
+
export const WebrpcSchemaHash = '7f8a4b83b00e0b6849c76c2ff0e23931e26b3d9f'
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
codeGenVersion: string;
|
|
25
|
-
schemaName: string;
|
|
26
|
-
schemaVersion: string;
|
|
27
|
-
};
|
|
17
|
+
//
|
|
18
|
+
// Client interface
|
|
19
|
+
//
|
|
28
20
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
if (!headerValue) {
|
|
32
|
-
return {
|
|
33
|
-
webrpcGenVersion: "",
|
|
34
|
-
codeGenName: "",
|
|
35
|
-
codeGenVersion: "",
|
|
36
|
-
schemaName: "",
|
|
37
|
-
schemaVersion: "",
|
|
38
|
-
};
|
|
39
|
-
}
|
|
21
|
+
export interface RelayerClient {
|
|
22
|
+
ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
}
|
|
24
|
+
version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>
|
|
43
25
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
webrpcGenVersion: "",
|
|
49
|
-
codeGenName: "",
|
|
50
|
-
codeGenVersion: "",
|
|
51
|
-
schemaName: "",
|
|
52
|
-
schemaVersion: "",
|
|
53
|
-
};
|
|
54
|
-
}
|
|
26
|
+
runtimeStatus(headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn>
|
|
27
|
+
|
|
28
|
+
getSequenceContext(headers?: object, signal?: AbortSignal): Promise<GetSequenceContextReturn>
|
|
55
29
|
|
|
56
|
-
|
|
57
|
-
const [codeGenName, codeGenVersion] = versions[1]!.split("@");
|
|
58
|
-
const [schemaName, schemaVersion] = versions[2]!.split("@");
|
|
30
|
+
getChainID(headers?: object, signal?: AbortSignal): Promise<GetChainIDReturn>
|
|
59
31
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* Transactions
|
|
35
|
+
*
|
|
36
|
+
* TODO (future): rename this to just, 'SendTransaction(txn: MetaTransaction)' or 'SendTransaction(txn: SignedTransaction)', or something..
|
|
37
|
+
* Project ID is only used by service and admin calls. Other clients must have projectID passed via the context
|
|
38
|
+
* TODO: rename return txnHash: string to metaTxnID: string
|
|
39
|
+
*/
|
|
40
|
+
sendMetaTxn(req: SendMetaTxnArgs, headers?: object, signal?: AbortSignal): Promise<SendMetaTxnReturn>
|
|
41
|
+
|
|
42
|
+
getMetaTxnNonce(req: GetMetaTxnNonceArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnNonceReturn>
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* TODO: one day, make GetMetaTxnReceipt respond immediately with receipt or not
|
|
46
|
+
* and add WaitTransactionReceipt method, which will block and wait, similar to how GetMetaTxnReceipt
|
|
47
|
+
* is implemented now.
|
|
48
|
+
* For backwards compat, we can leave the current GetMetaTxnReceipt how it is, an deprecate it, and introduce
|
|
49
|
+
* new, GetTransactionReceipt and WaitTransactionReceipt methods
|
|
50
|
+
* we can also accept metaTxnId and txnHash .. so can take either or.. I wonder if ERC-4337 has any convention on this?
|
|
51
|
+
*/
|
|
52
|
+
getMetaTxnReceipt(req: GetMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnReceiptReturn>
|
|
53
|
+
|
|
54
|
+
simulate(req: SimulateArgs, headers?: object, signal?: AbortSignal): Promise<SimulateReturn>
|
|
55
|
+
|
|
56
|
+
simulateV3(req: SimulateV3Args, headers?: object, signal?: AbortSignal): Promise<SimulateV3Return>
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
|
|
60
|
+
*/
|
|
61
|
+
updateMetaTxnGasLimits(
|
|
62
|
+
req: UpdateMetaTxnGasLimitsArgs,
|
|
63
|
+
headers?: object,
|
|
64
|
+
signal?: AbortSignal
|
|
65
|
+
): Promise<UpdateMetaTxnGasLimitsReturn>
|
|
66
|
+
|
|
67
|
+
feeTokens(headers?: object, signal?: AbortSignal): Promise<FeeTokensReturn>
|
|
68
|
+
|
|
69
|
+
feeOptions(req: FeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<FeeOptionsReturn>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
|
|
73
|
+
*/
|
|
74
|
+
getMetaTxnNetworkFeeOptions(
|
|
75
|
+
req: GetMetaTxnNetworkFeeOptionsArgs,
|
|
76
|
+
headers?: object,
|
|
77
|
+
signal?: AbortSignal
|
|
78
|
+
): Promise<GetMetaTxnNetworkFeeOptionsReturn>
|
|
79
|
+
|
|
80
|
+
getMetaTransactions(req: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTransactionsReturn>
|
|
81
|
+
|
|
82
|
+
getTransactionCost(req: GetTransactionCostArgs, headers?: object, signal?: AbortSignal): Promise<GetTransactionCostReturn>
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sent transactions from an account. If filter is omitted then it will return all transactions.
|
|
86
|
+
*/
|
|
87
|
+
sentTransactions(req: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Pending transactions waiting to be mined for an account. This endpoint is just a sugar of `SentTransactions`
|
|
91
|
+
* with the filter set to pending: true.
|
|
92
|
+
*/
|
|
93
|
+
pendingTransactions(req: PendingTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<PendingTransactionsReturn>
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Legacy Gas Tank
|
|
97
|
+
*/
|
|
98
|
+
getGasTank(req: GetGasTankArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankReturn>
|
|
99
|
+
|
|
100
|
+
addGasTank(req: AddGasTankArgs, headers?: object, signal?: AbortSignal): Promise<AddGasTankReturn>
|
|
101
|
+
|
|
102
|
+
updateGasTank(req: UpdateGasTankArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasTankReturn>
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Legacy Gas Adjustment
|
|
106
|
+
*/
|
|
107
|
+
nextGasTankBalanceAdjustmentNonce(
|
|
108
|
+
req: NextGasTankBalanceAdjustmentNonceArgs,
|
|
109
|
+
headers?: object,
|
|
110
|
+
signal?: AbortSignal
|
|
111
|
+
): Promise<NextGasTankBalanceAdjustmentNonceReturn>
|
|
112
|
+
|
|
113
|
+
adjustGasTankBalance(req: AdjustGasTankBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustGasTankBalanceReturn>
|
|
114
|
+
|
|
115
|
+
getGasTankBalanceAdjustment(
|
|
116
|
+
req: GetGasTankBalanceAdjustmentArgs,
|
|
117
|
+
headers?: object,
|
|
118
|
+
signal?: AbortSignal
|
|
119
|
+
): Promise<GetGasTankBalanceAdjustmentReturn>
|
|
120
|
+
|
|
121
|
+
listGasTankBalanceAdjustments(
|
|
122
|
+
req: ListGasTankBalanceAdjustmentsArgs,
|
|
123
|
+
headers?: object,
|
|
124
|
+
signal?: AbortSignal
|
|
125
|
+
): Promise<ListGasTankBalanceAdjustmentsReturn>
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Gas Sponsorship
|
|
129
|
+
*/
|
|
130
|
+
listGasSponsors(req: ListGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasSponsorsReturn>
|
|
131
|
+
|
|
132
|
+
getGasSponsor(req: GetGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<GetGasSponsorReturn>
|
|
133
|
+
|
|
134
|
+
addGasSponsor(req: AddGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<AddGasSponsorReturn>
|
|
135
|
+
|
|
136
|
+
updateGasSponsor(req: UpdateGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasSponsorReturn>
|
|
137
|
+
|
|
138
|
+
removeGasSponsor(req: RemoveGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<RemoveGasSponsorReturn>
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Gas Sponsor Lookup
|
|
142
|
+
*/
|
|
143
|
+
addressGasSponsors(req: AddressGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<AddressGasSponsorsReturn>
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Project Balance
|
|
147
|
+
*/
|
|
148
|
+
getProjectBalance(req: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn>
|
|
149
|
+
|
|
150
|
+
adjustProjectBalance(req: AdjustProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustProjectBalanceReturn>
|
|
67
151
|
}
|
|
68
152
|
|
|
69
153
|
//
|
|
70
|
-
//
|
|
154
|
+
// Schema types
|
|
71
155
|
//
|
|
72
156
|
|
|
73
|
-
|
|
74
157
|
export enum ETHTxnStatus {
|
|
75
158
|
UNKNOWN = 'UNKNOWN',
|
|
76
159
|
DROPPED = 'DROPPED',
|
|
@@ -138,8 +221,7 @@ export interface SenderStatus {
|
|
|
138
221
|
active: boolean
|
|
139
222
|
}
|
|
140
223
|
|
|
141
|
-
export interface RuntimeChecks {
|
|
142
|
-
}
|
|
224
|
+
export interface RuntimeChecks {}
|
|
143
225
|
|
|
144
226
|
export interface SequenceContext {
|
|
145
227
|
factory: string
|
|
@@ -215,8 +297,8 @@ export interface MetaTxnLog {
|
|
|
215
297
|
minedAt: string
|
|
216
298
|
target: string
|
|
217
299
|
input: string
|
|
218
|
-
txnArgs: {[key: string]: any}
|
|
219
|
-
txnReceipt?: {[key: string]: any}
|
|
300
|
+
txnArgs: { [key: string]: any }
|
|
301
|
+
txnReceipt?: { [key: string]: any }
|
|
220
302
|
walletAddress: string
|
|
221
303
|
metaTxnNonce: string
|
|
222
304
|
gasLimit: number
|
|
@@ -252,20 +334,10 @@ export interface MetaTxnReceiptLog {
|
|
|
252
334
|
data: string
|
|
253
335
|
}
|
|
254
336
|
|
|
255
|
-
export interface IntentPrecondition {
|
|
256
|
-
type: string
|
|
257
|
-
chainId: string
|
|
258
|
-
data: any
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export interface IntentSolution {
|
|
262
|
-
transactions: Array<Transactions>
|
|
263
|
-
}
|
|
264
|
-
|
|
265
337
|
export interface Transactions {
|
|
266
338
|
chainID: string
|
|
267
339
|
transactions: Array<Transaction>
|
|
268
|
-
preconditions?: Array<
|
|
340
|
+
preconditions?: Array<TransactionPrecondition>
|
|
269
341
|
}
|
|
270
342
|
|
|
271
343
|
export interface Transaction {
|
|
@@ -277,6 +349,14 @@ export interface Transaction {
|
|
|
277
349
|
data: string
|
|
278
350
|
}
|
|
279
351
|
|
|
352
|
+
export interface TransactionPrecondition {
|
|
353
|
+
type: string
|
|
354
|
+
chainId: number
|
|
355
|
+
ownerAddress: string
|
|
356
|
+
tokenAddress: string
|
|
357
|
+
minAmount: bigint
|
|
358
|
+
}
|
|
359
|
+
|
|
280
360
|
export interface TxnLogUser {
|
|
281
361
|
username: string
|
|
282
362
|
}
|
|
@@ -346,158 +426,83 @@ export interface SortBy {
|
|
|
346
426
|
order: SortOrder
|
|
347
427
|
}
|
|
348
428
|
|
|
349
|
-
export interface
|
|
350
|
-
ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
|
|
351
|
-
version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>
|
|
352
|
-
runtimeStatus(headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn>
|
|
353
|
-
getSequenceContext(headers?: object, signal?: AbortSignal): Promise<GetSequenceContextReturn>
|
|
354
|
-
getChainID(headers?: object, signal?: AbortSignal): Promise<GetChainIDReturn>
|
|
355
|
-
/**
|
|
356
|
-
*
|
|
357
|
-
* Transactions
|
|
358
|
-
*
|
|
359
|
-
* TODO (future): rename this to just, 'SendTransaction(txn: MetaTransaction)' or 'SendTransaction(txn: SignedTransaction)', or something..
|
|
360
|
-
* Project ID is only used by service and admin calls. Other clients must have projectID passed via the context
|
|
361
|
-
* TODO: rename return txnHash: string to metaTxnID: string
|
|
362
|
-
*/
|
|
363
|
-
sendMetaTxn(args: SendMetaTxnArgs, headers?: object, signal?: AbortSignal): Promise<SendMetaTxnReturn>
|
|
364
|
-
getMetaTxnNonce(args: GetMetaTxnNonceArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnNonceReturn>
|
|
365
|
-
/**
|
|
366
|
-
* TODO: one day, make GetMetaTxnReceipt respond immediately with receipt or not
|
|
367
|
-
* and add WaitTransactionReceipt method, which will block and wait, similar to how GetMetaTxnReceipt
|
|
368
|
-
* is implemented now.
|
|
369
|
-
* For backwards compat, we can leave the current GetMetaTxnReceipt how it is, an deprecate it, and introduce
|
|
370
|
-
* new, GetTransactionReceipt and WaitTransactionReceipt methods
|
|
371
|
-
* we can also accept metaTxnId and txnHash .. so can take either or.. I wonder if ERC-4337 has any convention on this?
|
|
372
|
-
*/
|
|
373
|
-
getMetaTxnReceipt(args: GetMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnReceiptReturn>
|
|
374
|
-
simulate(args: SimulateArgs, headers?: object, signal?: AbortSignal): Promise<SimulateReturn>
|
|
375
|
-
simulateV3(args: SimulateV3Args, headers?: object, signal?: AbortSignal): Promise<SimulateV3Return>
|
|
376
|
-
/**
|
|
377
|
-
* TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
|
|
378
|
-
*/
|
|
379
|
-
updateMetaTxnGasLimits(args: UpdateMetaTxnGasLimitsArgs, headers?: object, signal?: AbortSignal): Promise<UpdateMetaTxnGasLimitsReturn>
|
|
380
|
-
feeTokens(headers?: object, signal?: AbortSignal): Promise<FeeTokensReturn>
|
|
381
|
-
feeOptions(args: FeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<FeeOptionsReturn>
|
|
382
|
-
/**
|
|
383
|
-
* TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
|
|
384
|
-
*/
|
|
385
|
-
getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnNetworkFeeOptionsReturn>
|
|
386
|
-
getMetaTransactions(args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTransactionsReturn>
|
|
387
|
-
getTransactionCost(args: GetTransactionCostArgs, headers?: object, signal?: AbortSignal): Promise<GetTransactionCostReturn>
|
|
388
|
-
/**
|
|
389
|
-
* Sent transactions from an account. If filter is omitted then it will return all transactions.
|
|
390
|
-
*/
|
|
391
|
-
sentTransactions(args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn>
|
|
392
|
-
/**
|
|
393
|
-
* Pending transactions waiting to be mined for an account. This endpoint is just a sugar of `SentTransactions`
|
|
394
|
-
* with the filter set to pending: true.
|
|
395
|
-
*/
|
|
396
|
-
pendingTransactions(args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<PendingTransactionsReturn>
|
|
397
|
-
/**
|
|
398
|
-
* Legacy Gas Tank
|
|
399
|
-
*/
|
|
400
|
-
getGasTank(args: GetGasTankArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankReturn>
|
|
401
|
-
addGasTank(args: AddGasTankArgs, headers?: object, signal?: AbortSignal): Promise<AddGasTankReturn>
|
|
402
|
-
updateGasTank(args: UpdateGasTankArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasTankReturn>
|
|
403
|
-
/**
|
|
404
|
-
* Legacy Gas Adjustment
|
|
405
|
-
*/
|
|
406
|
-
nextGasTankBalanceAdjustmentNonce(args: NextGasTankBalanceAdjustmentNonceArgs, headers?: object, signal?: AbortSignal): Promise<NextGasTankBalanceAdjustmentNonceReturn>
|
|
407
|
-
adjustGasTankBalance(args: AdjustGasTankBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustGasTankBalanceReturn>
|
|
408
|
-
getGasTankBalanceAdjustment(args: GetGasTankBalanceAdjustmentArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankBalanceAdjustmentReturn>
|
|
409
|
-
listGasTankBalanceAdjustments(args: ListGasTankBalanceAdjustmentsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasTankBalanceAdjustmentsReturn>
|
|
410
|
-
/**
|
|
411
|
-
* Gas Sponsorship
|
|
412
|
-
*/
|
|
413
|
-
listGasSponsors(args: ListGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasSponsorsReturn>
|
|
414
|
-
getGasSponsor(args: GetGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<GetGasSponsorReturn>
|
|
415
|
-
addGasSponsor(args: AddGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<AddGasSponsorReturn>
|
|
416
|
-
updateGasSponsor(args: UpdateGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasSponsorReturn>
|
|
417
|
-
removeGasSponsor(args: RemoveGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<RemoveGasSponsorReturn>
|
|
418
|
-
/**
|
|
419
|
-
* Gas Sponsor Lookup
|
|
420
|
-
*/
|
|
421
|
-
addressGasSponsors(args: AddressGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<AddressGasSponsorsReturn>
|
|
422
|
-
/**
|
|
423
|
-
* Project Balance
|
|
424
|
-
*/
|
|
425
|
-
getProjectBalance(args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn>
|
|
426
|
-
adjustProjectBalance(args: AdjustProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustProjectBalanceReturn>
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export interface PingArgs {
|
|
430
|
-
}
|
|
429
|
+
export interface PingArgs {}
|
|
431
430
|
|
|
432
431
|
export interface PingReturn {
|
|
433
|
-
status: boolean
|
|
434
|
-
}
|
|
435
|
-
export interface VersionArgs {
|
|
432
|
+
status: boolean
|
|
436
433
|
}
|
|
437
434
|
|
|
435
|
+
export interface VersionArgs {}
|
|
436
|
+
|
|
438
437
|
export interface VersionReturn {
|
|
439
|
-
version: Version
|
|
440
|
-
}
|
|
441
|
-
export interface RuntimeStatusArgs {
|
|
438
|
+
version: Version
|
|
442
439
|
}
|
|
443
440
|
|
|
441
|
+
export interface RuntimeStatusArgs {}
|
|
442
|
+
|
|
444
443
|
export interface RuntimeStatusReturn {
|
|
445
|
-
status: RuntimeStatus
|
|
446
|
-
}
|
|
447
|
-
export interface GetSequenceContextArgs {
|
|
444
|
+
status: RuntimeStatus
|
|
448
445
|
}
|
|
449
446
|
|
|
447
|
+
export interface GetSequenceContextArgs {}
|
|
448
|
+
|
|
450
449
|
export interface GetSequenceContextReturn {
|
|
451
|
-
data: SequenceContext
|
|
452
|
-
}
|
|
453
|
-
export interface GetChainIDArgs {
|
|
450
|
+
data: SequenceContext
|
|
454
451
|
}
|
|
455
452
|
|
|
453
|
+
export interface GetChainIDArgs {}
|
|
454
|
+
|
|
456
455
|
export interface GetChainIDReturn {
|
|
457
|
-
chainID: number
|
|
456
|
+
chainID: number
|
|
458
457
|
}
|
|
458
|
+
|
|
459
459
|
export interface SendMetaTxnArgs {
|
|
460
460
|
call: MetaTxn
|
|
461
461
|
quote?: string
|
|
462
462
|
projectID?: number
|
|
463
|
-
preconditions?: Array<
|
|
463
|
+
preconditions?: Array<TransactionPrecondition>
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
export interface SendMetaTxnReturn {
|
|
467
467
|
status: boolean
|
|
468
|
-
txnHash: string
|
|
468
|
+
txnHash: string
|
|
469
469
|
}
|
|
470
|
+
|
|
470
471
|
export interface GetMetaTxnNonceArgs {
|
|
471
472
|
walletContractAddress: string
|
|
472
473
|
space?: string
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
export interface GetMetaTxnNonceReturn {
|
|
476
|
-
nonce: string
|
|
477
|
+
nonce: string
|
|
477
478
|
}
|
|
479
|
+
|
|
478
480
|
export interface GetMetaTxnReceiptArgs {
|
|
479
481
|
metaTxID: string
|
|
480
482
|
}
|
|
481
483
|
|
|
482
484
|
export interface GetMetaTxnReceiptReturn {
|
|
483
|
-
receipt: MetaTxnReceipt
|
|
485
|
+
receipt: MetaTxnReceipt
|
|
484
486
|
}
|
|
487
|
+
|
|
485
488
|
export interface SimulateArgs {
|
|
486
489
|
wallet: string
|
|
487
490
|
transactions: string
|
|
488
491
|
}
|
|
489
492
|
|
|
490
493
|
export interface SimulateReturn {
|
|
491
|
-
results: Array<SimulateResult>
|
|
494
|
+
results: Array<SimulateResult>
|
|
492
495
|
}
|
|
496
|
+
|
|
493
497
|
export interface SimulateV3Args {
|
|
494
498
|
wallet: string
|
|
495
499
|
calls: string
|
|
496
500
|
}
|
|
497
501
|
|
|
498
502
|
export interface SimulateV3Return {
|
|
499
|
-
results: Array<SimulateV3Result>
|
|
503
|
+
results: Array<SimulateV3Result>
|
|
500
504
|
}
|
|
505
|
+
|
|
501
506
|
export interface UpdateMetaTxnGasLimitsArgs {
|
|
502
507
|
walletAddress: string
|
|
503
508
|
walletConfig: any
|
|
@@ -505,15 +510,17 @@ export interface UpdateMetaTxnGasLimitsArgs {
|
|
|
505
510
|
}
|
|
506
511
|
|
|
507
512
|
export interface UpdateMetaTxnGasLimitsReturn {
|
|
508
|
-
payload: string
|
|
509
|
-
}
|
|
510
|
-
export interface FeeTokensArgs {
|
|
513
|
+
payload: string
|
|
511
514
|
}
|
|
512
515
|
|
|
516
|
+
export interface FeeTokensArgs {}
|
|
517
|
+
|
|
513
518
|
export interface FeeTokensReturn {
|
|
514
519
|
isFeeRequired: boolean
|
|
515
|
-
tokens: Array<FeeToken>
|
|
520
|
+
tokens: Array<FeeToken>
|
|
521
|
+
paymentAddress: string
|
|
516
522
|
}
|
|
523
|
+
|
|
517
524
|
export interface FeeOptionsArgs {
|
|
518
525
|
wallet: string
|
|
519
526
|
to: string
|
|
@@ -524,16 +531,18 @@ export interface FeeOptionsArgs {
|
|
|
524
531
|
export interface FeeOptionsReturn {
|
|
525
532
|
options: Array<FeeOption>
|
|
526
533
|
sponsored: boolean
|
|
527
|
-
quote?: string
|
|
534
|
+
quote?: string
|
|
528
535
|
}
|
|
536
|
+
|
|
529
537
|
export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
530
538
|
walletConfig: any
|
|
531
539
|
payload: string
|
|
532
540
|
}
|
|
533
541
|
|
|
534
542
|
export interface GetMetaTxnNetworkFeeOptionsReturn {
|
|
535
|
-
options: Array<FeeOption>
|
|
543
|
+
options: Array<FeeOption>
|
|
536
544
|
}
|
|
545
|
+
|
|
537
546
|
export interface GetMetaTransactionsArgs {
|
|
538
547
|
projectId: number
|
|
539
548
|
page?: Page
|
|
@@ -541,8 +550,9 @@ export interface GetMetaTransactionsArgs {
|
|
|
541
550
|
|
|
542
551
|
export interface GetMetaTransactionsReturn {
|
|
543
552
|
page: Page
|
|
544
|
-
transactions: Array<MetaTxnLog>
|
|
553
|
+
transactions: Array<MetaTxnLog>
|
|
545
554
|
}
|
|
555
|
+
|
|
546
556
|
export interface GetTransactionCostArgs {
|
|
547
557
|
projectId: number
|
|
548
558
|
from: string
|
|
@@ -550,8 +560,9 @@ export interface GetTransactionCostArgs {
|
|
|
550
560
|
}
|
|
551
561
|
|
|
552
562
|
export interface GetTransactionCostReturn {
|
|
553
|
-
cost: number
|
|
563
|
+
cost: number
|
|
554
564
|
}
|
|
565
|
+
|
|
555
566
|
export interface SentTransactionsArgs {
|
|
556
567
|
filter?: SentTransactionsFilter
|
|
557
568
|
page?: Page
|
|
@@ -559,23 +570,26 @@ export interface SentTransactionsArgs {
|
|
|
559
570
|
|
|
560
571
|
export interface SentTransactionsReturn {
|
|
561
572
|
page: Page
|
|
562
|
-
transactions: Array<Transaction>
|
|
573
|
+
transactions: Array<Transaction>
|
|
563
574
|
}
|
|
575
|
+
|
|
564
576
|
export interface PendingTransactionsArgs {
|
|
565
577
|
page?: Page
|
|
566
578
|
}
|
|
567
579
|
|
|
568
580
|
export interface PendingTransactionsReturn {
|
|
569
581
|
page: Page
|
|
570
|
-
transactions: Array<Transaction>
|
|
582
|
+
transactions: Array<Transaction>
|
|
571
583
|
}
|
|
584
|
+
|
|
572
585
|
export interface GetGasTankArgs {
|
|
573
586
|
id: number
|
|
574
587
|
}
|
|
575
588
|
|
|
576
589
|
export interface GetGasTankReturn {
|
|
577
|
-
gasTank: GasTank
|
|
590
|
+
gasTank: GasTank
|
|
578
591
|
}
|
|
592
|
+
|
|
579
593
|
export interface AddGasTankArgs {
|
|
580
594
|
name: string
|
|
581
595
|
feeMarkupFactor: number
|
|
@@ -584,8 +598,9 @@ export interface AddGasTankArgs {
|
|
|
584
598
|
|
|
585
599
|
export interface AddGasTankReturn {
|
|
586
600
|
status: boolean
|
|
587
|
-
gasTank: GasTank
|
|
601
|
+
gasTank: GasTank
|
|
588
602
|
}
|
|
603
|
+
|
|
589
604
|
export interface UpdateGasTankArgs {
|
|
590
605
|
id: number
|
|
591
606
|
name?: string
|
|
@@ -595,15 +610,17 @@ export interface UpdateGasTankArgs {
|
|
|
595
610
|
|
|
596
611
|
export interface UpdateGasTankReturn {
|
|
597
612
|
status: boolean
|
|
598
|
-
gasTank: GasTank
|
|
613
|
+
gasTank: GasTank
|
|
599
614
|
}
|
|
615
|
+
|
|
600
616
|
export interface NextGasTankBalanceAdjustmentNonceArgs {
|
|
601
617
|
id: number
|
|
602
618
|
}
|
|
603
619
|
|
|
604
620
|
export interface NextGasTankBalanceAdjustmentNonceReturn {
|
|
605
|
-
nonce: number
|
|
621
|
+
nonce: number
|
|
606
622
|
}
|
|
623
|
+
|
|
607
624
|
export interface AdjustGasTankBalanceArgs {
|
|
608
625
|
id: number
|
|
609
626
|
nonce: number
|
|
@@ -612,16 +629,18 @@ export interface AdjustGasTankBalanceArgs {
|
|
|
612
629
|
|
|
613
630
|
export interface AdjustGasTankBalanceReturn {
|
|
614
631
|
status: boolean
|
|
615
|
-
adjustment: GasTankBalanceAdjustment
|
|
632
|
+
adjustment: GasTankBalanceAdjustment
|
|
616
633
|
}
|
|
634
|
+
|
|
617
635
|
export interface GetGasTankBalanceAdjustmentArgs {
|
|
618
636
|
id: number
|
|
619
637
|
nonce: number
|
|
620
638
|
}
|
|
621
639
|
|
|
622
640
|
export interface GetGasTankBalanceAdjustmentReturn {
|
|
623
|
-
adjustment: GasTankBalanceAdjustment
|
|
641
|
+
adjustment: GasTankBalanceAdjustment
|
|
624
642
|
}
|
|
643
|
+
|
|
625
644
|
export interface ListGasTankBalanceAdjustmentsArgs {
|
|
626
645
|
id: number
|
|
627
646
|
page?: Page
|
|
@@ -629,8 +648,9 @@ export interface ListGasTankBalanceAdjustmentsArgs {
|
|
|
629
648
|
|
|
630
649
|
export interface ListGasTankBalanceAdjustmentsReturn {
|
|
631
650
|
page: Page
|
|
632
|
-
adjustments: Array<GasTankBalanceAdjustment>
|
|
651
|
+
adjustments: Array<GasTankBalanceAdjustment>
|
|
633
652
|
}
|
|
653
|
+
|
|
634
654
|
export interface ListGasSponsorsArgs {
|
|
635
655
|
projectId: number
|
|
636
656
|
page?: Page
|
|
@@ -638,16 +658,18 @@ export interface ListGasSponsorsArgs {
|
|
|
638
658
|
|
|
639
659
|
export interface ListGasSponsorsReturn {
|
|
640
660
|
page: Page
|
|
641
|
-
gasSponsors: Array<GasSponsor>
|
|
661
|
+
gasSponsors: Array<GasSponsor>
|
|
642
662
|
}
|
|
663
|
+
|
|
643
664
|
export interface GetGasSponsorArgs {
|
|
644
665
|
projectId: number
|
|
645
666
|
id: number
|
|
646
667
|
}
|
|
647
668
|
|
|
648
669
|
export interface GetGasSponsorReturn {
|
|
649
|
-
gasSponsor: GasSponsor
|
|
670
|
+
gasSponsor: GasSponsor
|
|
650
671
|
}
|
|
672
|
+
|
|
651
673
|
export interface AddGasSponsorArgs {
|
|
652
674
|
projectId: number
|
|
653
675
|
address: string
|
|
@@ -657,8 +679,9 @@ export interface AddGasSponsorArgs {
|
|
|
657
679
|
|
|
658
680
|
export interface AddGasSponsorReturn {
|
|
659
681
|
status: boolean
|
|
660
|
-
gasSponsor: GasSponsor
|
|
682
|
+
gasSponsor: GasSponsor
|
|
661
683
|
}
|
|
684
|
+
|
|
662
685
|
export interface UpdateGasSponsorArgs {
|
|
663
686
|
projectId: number
|
|
664
687
|
id: number
|
|
@@ -668,16 +691,18 @@ export interface UpdateGasSponsorArgs {
|
|
|
668
691
|
|
|
669
692
|
export interface UpdateGasSponsorReturn {
|
|
670
693
|
status: boolean
|
|
671
|
-
gasSponsor: GasSponsor
|
|
694
|
+
gasSponsor: GasSponsor
|
|
672
695
|
}
|
|
696
|
+
|
|
673
697
|
export interface RemoveGasSponsorArgs {
|
|
674
698
|
projectId: number
|
|
675
699
|
id: number
|
|
676
700
|
}
|
|
677
701
|
|
|
678
702
|
export interface RemoveGasSponsorReturn {
|
|
679
|
-
status: boolean
|
|
703
|
+
status: boolean
|
|
680
704
|
}
|
|
705
|
+
|
|
681
706
|
export interface AddressGasSponsorsArgs {
|
|
682
707
|
address: string
|
|
683
708
|
page?: Page
|
|
@@ -685,15 +710,17 @@ export interface AddressGasSponsorsArgs {
|
|
|
685
710
|
|
|
686
711
|
export interface AddressGasSponsorsReturn {
|
|
687
712
|
page: Page
|
|
688
|
-
gasSponsors: Array<GasSponsor>
|
|
713
|
+
gasSponsors: Array<GasSponsor>
|
|
689
714
|
}
|
|
715
|
+
|
|
690
716
|
export interface GetProjectBalanceArgs {
|
|
691
717
|
projectId: number
|
|
692
718
|
}
|
|
693
719
|
|
|
694
720
|
export interface GetProjectBalanceReturn {
|
|
695
|
-
balance: number
|
|
721
|
+
balance: number
|
|
696
722
|
}
|
|
723
|
+
|
|
697
724
|
export interface AdjustProjectBalanceArgs {
|
|
698
725
|
projectId: number
|
|
699
726
|
amount: number
|
|
@@ -701,15 +728,14 @@ export interface AdjustProjectBalanceArgs {
|
|
|
701
728
|
}
|
|
702
729
|
|
|
703
730
|
export interface AdjustProjectBalanceReturn {
|
|
704
|
-
balance: number
|
|
731
|
+
balance: number
|
|
705
732
|
}
|
|
706
733
|
|
|
707
|
-
|
|
708
|
-
|
|
709
734
|
//
|
|
710
735
|
// Client
|
|
711
736
|
//
|
|
712
|
-
|
|
737
|
+
|
|
738
|
+
export class Relayer implements RelayerClient {
|
|
713
739
|
protected hostname: string
|
|
714
740
|
protected fetch: Fetch
|
|
715
741
|
protected path = '/rpc/Relayer/'
|
|
@@ -722,502 +748,528 @@ export class Relayer implements Relayer {
|
|
|
722
748
|
private url(name: string): string {
|
|
723
749
|
return this.hostname + this.path + name
|
|
724
750
|
}
|
|
725
|
-
|
|
751
|
+
|
|
752
|
+
queryKey = {
|
|
753
|
+
ping: () => ['Relayer', 'ping'] as const,
|
|
754
|
+
version: () => ['Relayer', 'version'] as const,
|
|
755
|
+
runtimeStatus: () => ['Relayer', 'runtimeStatus'] as const,
|
|
756
|
+
getSequenceContext: () => ['Relayer', 'getSequenceContext'] as const,
|
|
757
|
+
getChainID: () => ['Relayer', 'getChainID'] as const,
|
|
758
|
+
sendMetaTxn: (req: SendMetaTxnArgs) => ['Relayer', 'sendMetaTxn', req] as const,
|
|
759
|
+
getMetaTxnNonce: (req: GetMetaTxnNonceArgs) => ['Relayer', 'getMetaTxnNonce', req] as const,
|
|
760
|
+
getMetaTxnReceipt: (req: GetMetaTxnReceiptArgs) => ['Relayer', 'getMetaTxnReceipt', req] as const,
|
|
761
|
+
simulate: (req: SimulateArgs) => ['Relayer', 'simulate', req] as const,
|
|
762
|
+
simulateV3: (req: SimulateV3Args) => ['Relayer', 'simulateV3', req] as const,
|
|
763
|
+
updateMetaTxnGasLimits: (req: UpdateMetaTxnGasLimitsArgs) => ['Relayer', 'updateMetaTxnGasLimits', req] as const,
|
|
764
|
+
feeTokens: () => ['Relayer', 'feeTokens'] as const,
|
|
765
|
+
feeOptions: (req: FeeOptionsArgs) => ['Relayer', 'feeOptions', req] as const,
|
|
766
|
+
getMetaTxnNetworkFeeOptions: (req: GetMetaTxnNetworkFeeOptionsArgs) =>
|
|
767
|
+
['Relayer', 'getMetaTxnNetworkFeeOptions', req] as const,
|
|
768
|
+
getMetaTransactions: (req: GetMetaTransactionsArgs) => ['Relayer', 'getMetaTransactions', req] as const,
|
|
769
|
+
getTransactionCost: (req: GetTransactionCostArgs) => ['Relayer', 'getTransactionCost', req] as const,
|
|
770
|
+
sentTransactions: (req: SentTransactionsArgs) => ['Relayer', 'sentTransactions', req] as const,
|
|
771
|
+
pendingTransactions: (req: PendingTransactionsArgs) => ['Relayer', 'pendingTransactions', req] as const,
|
|
772
|
+
getGasTank: (req: GetGasTankArgs) => ['Relayer', 'getGasTank', req] as const,
|
|
773
|
+
addGasTank: (req: AddGasTankArgs) => ['Relayer', 'addGasTank', req] as const,
|
|
774
|
+
updateGasTank: (req: UpdateGasTankArgs) => ['Relayer', 'updateGasTank', req] as const,
|
|
775
|
+
nextGasTankBalanceAdjustmentNonce: (req: NextGasTankBalanceAdjustmentNonceArgs) =>
|
|
776
|
+
['Relayer', 'nextGasTankBalanceAdjustmentNonce', req] as const,
|
|
777
|
+
adjustGasTankBalance: (req: AdjustGasTankBalanceArgs) => ['Relayer', 'adjustGasTankBalance', req] as const,
|
|
778
|
+
getGasTankBalanceAdjustment: (req: GetGasTankBalanceAdjustmentArgs) =>
|
|
779
|
+
['Relayer', 'getGasTankBalanceAdjustment', req] as const,
|
|
780
|
+
listGasTankBalanceAdjustments: (req: ListGasTankBalanceAdjustmentsArgs) =>
|
|
781
|
+
['Relayer', 'listGasTankBalanceAdjustments', req] as const,
|
|
782
|
+
listGasSponsors: (req: ListGasSponsorsArgs) => ['Relayer', 'listGasSponsors', req] as const,
|
|
783
|
+
getGasSponsor: (req: GetGasSponsorArgs) => ['Relayer', 'getGasSponsor', req] as const,
|
|
784
|
+
addGasSponsor: (req: AddGasSponsorArgs) => ['Relayer', 'addGasSponsor', req] as const,
|
|
785
|
+
updateGasSponsor: (req: UpdateGasSponsorArgs) => ['Relayer', 'updateGasSponsor', req] as const,
|
|
786
|
+
removeGasSponsor: (req: RemoveGasSponsorArgs) => ['Relayer', 'removeGasSponsor', req] as const,
|
|
787
|
+
addressGasSponsors: (req: AddressGasSponsorsArgs) => ['Relayer', 'addressGasSponsors', req] as const,
|
|
788
|
+
getProjectBalance: (req: GetProjectBalanceArgs) => ['Relayer', 'getProjectBalance', req] as const,
|
|
789
|
+
adjustProjectBalance: (req: AdjustProjectBalanceArgs) => ['Relayer', 'adjustProjectBalance', req] as const
|
|
790
|
+
}
|
|
791
|
+
|
|
726
792
|
ping = (headers?: object, signal?: AbortSignal): Promise<PingReturn> => {
|
|
727
|
-
return this.fetch(
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
738
|
-
})
|
|
793
|
+
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(
|
|
794
|
+
res => {
|
|
795
|
+
return buildResponse(res).then(_data => {
|
|
796
|
+
return JsonDecode<PingReturn>(_data, 'PingReturn')
|
|
797
|
+
})
|
|
798
|
+
},
|
|
799
|
+
error => {
|
|
800
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
801
|
+
}
|
|
802
|
+
)
|
|
739
803
|
}
|
|
740
|
-
|
|
804
|
+
|
|
741
805
|
version = (headers?: object, signal?: AbortSignal): Promise<VersionReturn> => {
|
|
742
|
-
return this.fetch(
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
753
|
-
})
|
|
806
|
+
return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then(
|
|
807
|
+
res => {
|
|
808
|
+
return buildResponse(res).then(_data => {
|
|
809
|
+
return JsonDecode<VersionReturn>(_data, 'VersionReturn')
|
|
810
|
+
})
|
|
811
|
+
},
|
|
812
|
+
error => {
|
|
813
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
814
|
+
}
|
|
815
|
+
)
|
|
754
816
|
}
|
|
755
|
-
|
|
817
|
+
|
|
756
818
|
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn> => {
|
|
757
|
-
return this.fetch(
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
768
|
-
})
|
|
819
|
+
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(
|
|
820
|
+
res => {
|
|
821
|
+
return buildResponse(res).then(_data => {
|
|
822
|
+
return JsonDecode<RuntimeStatusReturn>(_data, 'RuntimeStatusReturn')
|
|
823
|
+
})
|
|
824
|
+
},
|
|
825
|
+
error => {
|
|
826
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
827
|
+
}
|
|
828
|
+
)
|
|
769
829
|
}
|
|
770
|
-
|
|
830
|
+
|
|
771
831
|
getSequenceContext = (headers?: object, signal?: AbortSignal): Promise<GetSequenceContextReturn> => {
|
|
772
|
-
return this.fetch(
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
783
|
-
})
|
|
832
|
+
return this.fetch(this.url('GetSequenceContext'), createHttpRequest('{}', headers, signal)).then(
|
|
833
|
+
res => {
|
|
834
|
+
return buildResponse(res).then(_data => {
|
|
835
|
+
return JsonDecode<GetSequenceContextReturn>(_data, 'GetSequenceContextReturn')
|
|
836
|
+
})
|
|
837
|
+
},
|
|
838
|
+
error => {
|
|
839
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
840
|
+
}
|
|
841
|
+
)
|
|
784
842
|
}
|
|
785
|
-
|
|
843
|
+
|
|
786
844
|
getChainID = (headers?: object, signal?: AbortSignal): Promise<GetChainIDReturn> => {
|
|
787
|
-
return this.fetch(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
}
|
|
880
|
-
})
|
|
881
|
-
}, (error) => {
|
|
882
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
883
|
-
})
|
|
845
|
+
return this.fetch(this.url('GetChainID'), createHttpRequest('{}', headers, signal)).then(
|
|
846
|
+
res => {
|
|
847
|
+
return buildResponse(res).then(_data => {
|
|
848
|
+
return JsonDecode<GetChainIDReturn>(_data, 'GetChainIDReturn')
|
|
849
|
+
})
|
|
850
|
+
},
|
|
851
|
+
error => {
|
|
852
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
sendMetaTxn = (req: SendMetaTxnArgs, headers?: object, signal?: AbortSignal): Promise<SendMetaTxnReturn> => {
|
|
858
|
+
return this.fetch(this.url('SendMetaTxn'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
859
|
+
res => {
|
|
860
|
+
return buildResponse(res).then(_data => {
|
|
861
|
+
return JsonDecode<SendMetaTxnReturn>(_data, 'SendMetaTxnReturn')
|
|
862
|
+
})
|
|
863
|
+
},
|
|
864
|
+
error => {
|
|
865
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
866
|
+
}
|
|
867
|
+
)
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
getMetaTxnNonce = (req: GetMetaTxnNonceArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnNonceReturn> => {
|
|
871
|
+
return this.fetch(this.url('GetMetaTxnNonce'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
872
|
+
res => {
|
|
873
|
+
return buildResponse(res).then(_data => {
|
|
874
|
+
return JsonDecode<GetMetaTxnNonceReturn>(_data, 'GetMetaTxnNonceReturn')
|
|
875
|
+
})
|
|
876
|
+
},
|
|
877
|
+
error => {
|
|
878
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
getMetaTxnReceipt = (req: GetMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnReceiptReturn> => {
|
|
884
|
+
return this.fetch(this.url('GetMetaTxnReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
885
|
+
res => {
|
|
886
|
+
return buildResponse(res).then(_data => {
|
|
887
|
+
return JsonDecode<GetMetaTxnReceiptReturn>(_data, 'GetMetaTxnReceiptReturn')
|
|
888
|
+
})
|
|
889
|
+
},
|
|
890
|
+
error => {
|
|
891
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
892
|
+
}
|
|
893
|
+
)
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
simulate = (req: SimulateArgs, headers?: object, signal?: AbortSignal): Promise<SimulateReturn> => {
|
|
897
|
+
return this.fetch(this.url('Simulate'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
898
|
+
res => {
|
|
899
|
+
return buildResponse(res).then(_data => {
|
|
900
|
+
return JsonDecode<SimulateReturn>(_data, 'SimulateReturn')
|
|
901
|
+
})
|
|
902
|
+
},
|
|
903
|
+
error => {
|
|
904
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
simulateV3 = (req: SimulateV3Args, headers?: object, signal?: AbortSignal): Promise<SimulateV3Return> => {
|
|
910
|
+
return this.fetch(this.url('SimulateV3'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
911
|
+
res => {
|
|
912
|
+
return buildResponse(res).then(_data => {
|
|
913
|
+
return JsonDecode<SimulateV3Return>(_data, 'SimulateV3Return')
|
|
914
|
+
})
|
|
915
|
+
},
|
|
916
|
+
error => {
|
|
917
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
918
|
+
}
|
|
919
|
+
)
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
updateMetaTxnGasLimits = (
|
|
923
|
+
req: UpdateMetaTxnGasLimitsArgs,
|
|
924
|
+
headers?: object,
|
|
925
|
+
signal?: AbortSignal
|
|
926
|
+
): Promise<UpdateMetaTxnGasLimitsReturn> => {
|
|
927
|
+
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
928
|
+
res => {
|
|
929
|
+
return buildResponse(res).then(_data => {
|
|
930
|
+
return JsonDecode<UpdateMetaTxnGasLimitsReturn>(_data, 'UpdateMetaTxnGasLimitsReturn')
|
|
931
|
+
})
|
|
932
|
+
},
|
|
933
|
+
error => {
|
|
934
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
935
|
+
}
|
|
936
|
+
)
|
|
884
937
|
}
|
|
885
|
-
|
|
938
|
+
|
|
886
939
|
feeTokens = (headers?: object, signal?: AbortSignal): Promise<FeeTokensReturn> => {
|
|
887
|
-
return this.fetch(
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
return {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
pendingTransactions = (
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
return {
|
|
997
|
-
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
adjustGasTankBalance = (
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
return {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
removeGasSponsor = (
|
|
1153
|
-
return this.fetch(
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
adjustProjectBalance = (
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
940
|
+
return this.fetch(this.url('FeeTokens'), createHttpRequest('{}', headers, signal)).then(
|
|
941
|
+
res => {
|
|
942
|
+
return buildResponse(res).then(_data => {
|
|
943
|
+
return JsonDecode<FeeTokensReturn>(_data, 'FeeTokensReturn')
|
|
944
|
+
})
|
|
945
|
+
},
|
|
946
|
+
error => {
|
|
947
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
feeOptions = (req: FeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<FeeOptionsReturn> => {
|
|
953
|
+
return this.fetch(this.url('FeeOptions'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
954
|
+
res => {
|
|
955
|
+
return buildResponse(res).then(_data => {
|
|
956
|
+
return JsonDecode<FeeOptionsReturn>(_data, 'FeeOptionsReturn')
|
|
957
|
+
})
|
|
958
|
+
},
|
|
959
|
+
error => {
|
|
960
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
961
|
+
}
|
|
962
|
+
)
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
getMetaTxnNetworkFeeOptions = (
|
|
966
|
+
req: GetMetaTxnNetworkFeeOptionsArgs,
|
|
967
|
+
headers?: object,
|
|
968
|
+
signal?: AbortSignal
|
|
969
|
+
): Promise<GetMetaTxnNetworkFeeOptionsReturn> => {
|
|
970
|
+
return this.fetch(this.url('GetMetaTxnNetworkFeeOptions'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
971
|
+
res => {
|
|
972
|
+
return buildResponse(res).then(_data => {
|
|
973
|
+
return JsonDecode<GetMetaTxnNetworkFeeOptionsReturn>(_data, 'GetMetaTxnNetworkFeeOptionsReturn')
|
|
974
|
+
})
|
|
975
|
+
},
|
|
976
|
+
error => {
|
|
977
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
978
|
+
}
|
|
979
|
+
)
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
getMetaTransactions = (
|
|
983
|
+
req: GetMetaTransactionsArgs,
|
|
984
|
+
headers?: object,
|
|
985
|
+
signal?: AbortSignal
|
|
986
|
+
): Promise<GetMetaTransactionsReturn> => {
|
|
987
|
+
return this.fetch(this.url('GetMetaTransactions'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
988
|
+
res => {
|
|
989
|
+
return buildResponse(res).then(_data => {
|
|
990
|
+
return JsonDecode<GetMetaTransactionsReturn>(_data, 'GetMetaTransactionsReturn')
|
|
991
|
+
})
|
|
992
|
+
},
|
|
993
|
+
error => {
|
|
994
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
995
|
+
}
|
|
996
|
+
)
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
getTransactionCost = (
|
|
1000
|
+
req: GetTransactionCostArgs,
|
|
1001
|
+
headers?: object,
|
|
1002
|
+
signal?: AbortSignal
|
|
1003
|
+
): Promise<GetTransactionCostReturn> => {
|
|
1004
|
+
return this.fetch(this.url('GetTransactionCost'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1005
|
+
res => {
|
|
1006
|
+
return buildResponse(res).then(_data => {
|
|
1007
|
+
return JsonDecode<GetTransactionCostReturn>(_data, 'GetTransactionCostReturn')
|
|
1008
|
+
})
|
|
1009
|
+
},
|
|
1010
|
+
error => {
|
|
1011
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1012
|
+
}
|
|
1013
|
+
)
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
sentTransactions = (req: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn> => {
|
|
1017
|
+
return this.fetch(this.url('SentTransactions'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1018
|
+
res => {
|
|
1019
|
+
return buildResponse(res).then(_data => {
|
|
1020
|
+
return JsonDecode<SentTransactionsReturn>(_data, 'SentTransactionsReturn')
|
|
1021
|
+
})
|
|
1022
|
+
},
|
|
1023
|
+
error => {
|
|
1024
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1025
|
+
}
|
|
1026
|
+
)
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
pendingTransactions = (
|
|
1030
|
+
req: PendingTransactionsArgs,
|
|
1031
|
+
headers?: object,
|
|
1032
|
+
signal?: AbortSignal
|
|
1033
|
+
): Promise<PendingTransactionsReturn> => {
|
|
1034
|
+
return this.fetch(this.url('PendingTransactions'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1035
|
+
res => {
|
|
1036
|
+
return buildResponse(res).then(_data => {
|
|
1037
|
+
return JsonDecode<PendingTransactionsReturn>(_data, 'PendingTransactionsReturn')
|
|
1038
|
+
})
|
|
1039
|
+
},
|
|
1040
|
+
error => {
|
|
1041
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1042
|
+
}
|
|
1043
|
+
)
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
getGasTank = (req: GetGasTankArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankReturn> => {
|
|
1047
|
+
return this.fetch(this.url('GetGasTank'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1048
|
+
res => {
|
|
1049
|
+
return buildResponse(res).then(_data => {
|
|
1050
|
+
return JsonDecode<GetGasTankReturn>(_data, 'GetGasTankReturn')
|
|
1051
|
+
})
|
|
1052
|
+
},
|
|
1053
|
+
error => {
|
|
1054
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1055
|
+
}
|
|
1056
|
+
)
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
addGasTank = (req: AddGasTankArgs, headers?: object, signal?: AbortSignal): Promise<AddGasTankReturn> => {
|
|
1060
|
+
return this.fetch(this.url('AddGasTank'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1061
|
+
res => {
|
|
1062
|
+
return buildResponse(res).then(_data => {
|
|
1063
|
+
return JsonDecode<AddGasTankReturn>(_data, 'AddGasTankReturn')
|
|
1064
|
+
})
|
|
1065
|
+
},
|
|
1066
|
+
error => {
|
|
1067
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1068
|
+
}
|
|
1069
|
+
)
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
updateGasTank = (req: UpdateGasTankArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasTankReturn> => {
|
|
1073
|
+
return this.fetch(this.url('UpdateGasTank'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1074
|
+
res => {
|
|
1075
|
+
return buildResponse(res).then(_data => {
|
|
1076
|
+
return JsonDecode<UpdateGasTankReturn>(_data, 'UpdateGasTankReturn')
|
|
1077
|
+
})
|
|
1078
|
+
},
|
|
1079
|
+
error => {
|
|
1080
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
nextGasTankBalanceAdjustmentNonce = (
|
|
1086
|
+
req: NextGasTankBalanceAdjustmentNonceArgs,
|
|
1087
|
+
headers?: object,
|
|
1088
|
+
signal?: AbortSignal
|
|
1089
|
+
): Promise<NextGasTankBalanceAdjustmentNonceReturn> => {
|
|
1090
|
+
return this.fetch(this.url('NextGasTankBalanceAdjustmentNonce'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1091
|
+
res => {
|
|
1092
|
+
return buildResponse(res).then(_data => {
|
|
1093
|
+
return JsonDecode<NextGasTankBalanceAdjustmentNonceReturn>(_data, 'NextGasTankBalanceAdjustmentNonceReturn')
|
|
1094
|
+
})
|
|
1095
|
+
},
|
|
1096
|
+
error => {
|
|
1097
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1098
|
+
}
|
|
1099
|
+
)
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
adjustGasTankBalance = (
|
|
1103
|
+
req: AdjustGasTankBalanceArgs,
|
|
1104
|
+
headers?: object,
|
|
1105
|
+
signal?: AbortSignal
|
|
1106
|
+
): Promise<AdjustGasTankBalanceReturn> => {
|
|
1107
|
+
return this.fetch(this.url('AdjustGasTankBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1108
|
+
res => {
|
|
1109
|
+
return buildResponse(res).then(_data => {
|
|
1110
|
+
return JsonDecode<AdjustGasTankBalanceReturn>(_data, 'AdjustGasTankBalanceReturn')
|
|
1111
|
+
})
|
|
1112
|
+
},
|
|
1113
|
+
error => {
|
|
1114
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1115
|
+
}
|
|
1116
|
+
)
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
getGasTankBalanceAdjustment = (
|
|
1120
|
+
req: GetGasTankBalanceAdjustmentArgs,
|
|
1121
|
+
headers?: object,
|
|
1122
|
+
signal?: AbortSignal
|
|
1123
|
+
): Promise<GetGasTankBalanceAdjustmentReturn> => {
|
|
1124
|
+
return this.fetch(this.url('GetGasTankBalanceAdjustment'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1125
|
+
res => {
|
|
1126
|
+
return buildResponse(res).then(_data => {
|
|
1127
|
+
return JsonDecode<GetGasTankBalanceAdjustmentReturn>(_data, 'GetGasTankBalanceAdjustmentReturn')
|
|
1128
|
+
})
|
|
1129
|
+
},
|
|
1130
|
+
error => {
|
|
1131
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
listGasTankBalanceAdjustments = (
|
|
1137
|
+
req: ListGasTankBalanceAdjustmentsArgs,
|
|
1138
|
+
headers?: object,
|
|
1139
|
+
signal?: AbortSignal
|
|
1140
|
+
): Promise<ListGasTankBalanceAdjustmentsReturn> => {
|
|
1141
|
+
return this.fetch(this.url('ListGasTankBalanceAdjustments'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1142
|
+
res => {
|
|
1143
|
+
return buildResponse(res).then(_data => {
|
|
1144
|
+
return JsonDecode<ListGasTankBalanceAdjustmentsReturn>(_data, 'ListGasTankBalanceAdjustmentsReturn')
|
|
1145
|
+
})
|
|
1146
|
+
},
|
|
1147
|
+
error => {
|
|
1148
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
listGasSponsors = (req: ListGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasSponsorsReturn> => {
|
|
1154
|
+
return this.fetch(this.url('ListGasSponsors'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1155
|
+
res => {
|
|
1156
|
+
return buildResponse(res).then(_data => {
|
|
1157
|
+
return JsonDecode<ListGasSponsorsReturn>(_data, 'ListGasSponsorsReturn')
|
|
1158
|
+
})
|
|
1159
|
+
},
|
|
1160
|
+
error => {
|
|
1161
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
getGasSponsor = (req: GetGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<GetGasSponsorReturn> => {
|
|
1167
|
+
return this.fetch(this.url('GetGasSponsor'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1168
|
+
res => {
|
|
1169
|
+
return buildResponse(res).then(_data => {
|
|
1170
|
+
return JsonDecode<GetGasSponsorReturn>(_data, 'GetGasSponsorReturn')
|
|
1171
|
+
})
|
|
1172
|
+
},
|
|
1173
|
+
error => {
|
|
1174
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1175
|
+
}
|
|
1176
|
+
)
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
addGasSponsor = (req: AddGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<AddGasSponsorReturn> => {
|
|
1180
|
+
return this.fetch(this.url('AddGasSponsor'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1181
|
+
res => {
|
|
1182
|
+
return buildResponse(res).then(_data => {
|
|
1183
|
+
return JsonDecode<AddGasSponsorReturn>(_data, 'AddGasSponsorReturn')
|
|
1184
|
+
})
|
|
1185
|
+
},
|
|
1186
|
+
error => {
|
|
1187
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1188
|
+
}
|
|
1189
|
+
)
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
updateGasSponsor = (req: UpdateGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasSponsorReturn> => {
|
|
1193
|
+
return this.fetch(this.url('UpdateGasSponsor'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1194
|
+
res => {
|
|
1195
|
+
return buildResponse(res).then(_data => {
|
|
1196
|
+
return JsonDecode<UpdateGasSponsorReturn>(_data, 'UpdateGasSponsorReturn')
|
|
1197
|
+
})
|
|
1198
|
+
},
|
|
1199
|
+
error => {
|
|
1200
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1201
|
+
}
|
|
1202
|
+
)
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
removeGasSponsor = (req: RemoveGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<RemoveGasSponsorReturn> => {
|
|
1206
|
+
return this.fetch(this.url('RemoveGasSponsor'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1207
|
+
res => {
|
|
1208
|
+
return buildResponse(res).then(_data => {
|
|
1209
|
+
return JsonDecode<RemoveGasSponsorReturn>(_data, 'RemoveGasSponsorReturn')
|
|
1210
|
+
})
|
|
1211
|
+
},
|
|
1212
|
+
error => {
|
|
1213
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1214
|
+
}
|
|
1215
|
+
)
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
addressGasSponsors = (
|
|
1219
|
+
req: AddressGasSponsorsArgs,
|
|
1220
|
+
headers?: object,
|
|
1221
|
+
signal?: AbortSignal
|
|
1222
|
+
): Promise<AddressGasSponsorsReturn> => {
|
|
1223
|
+
return this.fetch(this.url('AddressGasSponsors'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1224
|
+
res => {
|
|
1225
|
+
return buildResponse(res).then(_data => {
|
|
1226
|
+
return JsonDecode<AddressGasSponsorsReturn>(_data, 'AddressGasSponsorsReturn')
|
|
1227
|
+
})
|
|
1228
|
+
},
|
|
1229
|
+
error => {
|
|
1230
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1231
|
+
}
|
|
1232
|
+
)
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
getProjectBalance = (req: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn> => {
|
|
1236
|
+
return this.fetch(this.url('GetProjectBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1237
|
+
res => {
|
|
1238
|
+
return buildResponse(res).then(_data => {
|
|
1239
|
+
return JsonDecode<GetProjectBalanceReturn>(_data, 'GetProjectBalanceReturn')
|
|
1240
|
+
})
|
|
1241
|
+
},
|
|
1242
|
+
error => {
|
|
1243
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1244
|
+
}
|
|
1245
|
+
)
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
adjustProjectBalance = (
|
|
1249
|
+
req: AdjustProjectBalanceArgs,
|
|
1250
|
+
headers?: object,
|
|
1251
|
+
signal?: AbortSignal
|
|
1252
|
+
): Promise<AdjustProjectBalanceReturn> => {
|
|
1253
|
+
return this.fetch(this.url('AdjustProjectBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1254
|
+
res => {
|
|
1255
|
+
return buildResponse(res).then(_data => {
|
|
1256
|
+
return JsonDecode<AdjustProjectBalanceReturn>(_data, 'AdjustProjectBalanceReturn')
|
|
1257
|
+
})
|
|
1258
|
+
},
|
|
1259
|
+
error => {
|
|
1260
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1261
|
+
}
|
|
1262
|
+
)
|
|
1207
1263
|
}
|
|
1208
|
-
|
|
1209
1264
|
}
|
|
1210
1265
|
|
|
1211
|
-
|
|
1212
|
-
const reqHeaders: {[key: string]: string} = {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
method: 'POST',
|
|
1217
|
-
headers: reqHeaders,
|
|
1218
|
-
body: JSON.stringify(body || {}),
|
|
1219
|
-
signal
|
|
1266
|
+
const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
1267
|
+
const reqHeaders: { [key: string]: string } = {
|
|
1268
|
+
...headers,
|
|
1269
|
+
'Content-Type': 'application/json',
|
|
1270
|
+
[WebrpcHeader]: WebrpcHeaderValue
|
|
1220
1271
|
}
|
|
1272
|
+
return { method: 'POST', headers: reqHeaders, body, signal }
|
|
1221
1273
|
}
|
|
1222
1274
|
|
|
1223
1275
|
const buildResponse = (res: Response): Promise<any> => {
|
|
@@ -1225,554 +1277,592 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
1225
1277
|
let data
|
|
1226
1278
|
try {
|
|
1227
1279
|
data = JSON.parse(text)
|
|
1228
|
-
} catch(error) {
|
|
1229
|
-
let message = ''
|
|
1230
|
-
if (error instanceof Error) {
|
|
1231
|
-
message = error.message
|
|
1232
|
-
}
|
|
1280
|
+
} catch (error) {
|
|
1233
1281
|
throw WebrpcBadResponseError.new({
|
|
1234
1282
|
status: res.status,
|
|
1235
|
-
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
1236
|
-
)
|
|
1283
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`
|
|
1284
|
+
})
|
|
1237
1285
|
}
|
|
1238
1286
|
if (!res.ok) {
|
|
1239
|
-
const code: number =
|
|
1287
|
+
const code: number = typeof data.code === 'number' ? data.code : 0
|
|
1240
1288
|
throw (webrpcErrorByCode[code] || WebrpcError).new(data)
|
|
1241
1289
|
}
|
|
1242
1290
|
return data
|
|
1243
1291
|
})
|
|
1244
1292
|
}
|
|
1245
1293
|
|
|
1294
|
+
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
1295
|
+
|
|
1296
|
+
//
|
|
1297
|
+
// BigInt helpers
|
|
1298
|
+
//
|
|
1299
|
+
|
|
1300
|
+
const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = {
|
|
1301
|
+
SendMetaTxnArgs: [['preconditions', 'TransactionPrecondition[]']],
|
|
1302
|
+
TransactionPrecondition: ['minAmount'],
|
|
1303
|
+
Transactions: [['preconditions', 'TransactionPrecondition[]']]
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// Decode in-place: mutate object graph; throw if expected numeric string is invalid.
|
|
1307
|
+
function decodeType(typ: string, obj: any): any {
|
|
1308
|
+
if (obj == null || typeof obj !== 'object') return obj
|
|
1309
|
+
const descs = BIG_INT_FIELDS[typ] || []
|
|
1310
|
+
if (!descs.length) return obj
|
|
1311
|
+
for (const d of descs) {
|
|
1312
|
+
if (Array.isArray(d)) {
|
|
1313
|
+
const [fieldName, nestedType] = d
|
|
1314
|
+
if (fieldName.endsWith('[]')) {
|
|
1315
|
+
const base = fieldName.slice(0, -2)
|
|
1316
|
+
const arr = obj[base]
|
|
1317
|
+
if (Array.isArray(arr)) {
|
|
1318
|
+
for (let i = 0; i < arr.length; i++) arr[i] = decodeType(nestedType, arr[i])
|
|
1319
|
+
}
|
|
1320
|
+
} else if (obj[fieldName]) {
|
|
1321
|
+
// Handle nestedType that might be an array type like 'Message[]'
|
|
1322
|
+
if (nestedType.endsWith('[]')) {
|
|
1323
|
+
const baseType = nestedType.slice(0, -2)
|
|
1324
|
+
const arr = obj[fieldName]
|
|
1325
|
+
if (Array.isArray(arr)) {
|
|
1326
|
+
for (let i = 0; i < arr.length; i++) arr[i] = decodeType(baseType, arr[i])
|
|
1327
|
+
}
|
|
1328
|
+
} else {
|
|
1329
|
+
obj[fieldName] = decodeType(nestedType, obj[fieldName])
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
continue
|
|
1333
|
+
}
|
|
1334
|
+
if (d.endsWith('[]')) {
|
|
1335
|
+
const base = d.slice(0, -2)
|
|
1336
|
+
const arr = obj[base]
|
|
1337
|
+
if (Array.isArray(arr)) {
|
|
1338
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1339
|
+
const v = arr[i]
|
|
1340
|
+
if (typeof v === 'string') {
|
|
1341
|
+
try {
|
|
1342
|
+
arr[i] = BigInt(v)
|
|
1343
|
+
} catch (e) {
|
|
1344
|
+
throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${base}[${i}]: ${v}` })
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
continue
|
|
1350
|
+
}
|
|
1351
|
+
const v = obj[d]
|
|
1352
|
+
if (typeof v === 'string') {
|
|
1353
|
+
try {
|
|
1354
|
+
obj[d] = BigInt(v)
|
|
1355
|
+
} catch (e) {
|
|
1356
|
+
throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${d}: ${v}` })
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
return obj
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
// Encode object to JSON with BigInts converted to decimal strings.
|
|
1364
|
+
export const JsonEncode = <T = any>(obj: T): string => {
|
|
1365
|
+
return JSON.stringify(obj, (key, value) => (typeof value === 'bigint' ? value.toString() : value))
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
// Decode data (JSON string or already-parsed object) and convert declared BigInt string fields back to BigInt.
|
|
1369
|
+
export const JsonDecode = <T = any>(data: string | any, typ: string = ''): T => {
|
|
1370
|
+
let parsed: any = data
|
|
1371
|
+
if (typeof data === 'string') {
|
|
1372
|
+
try {
|
|
1373
|
+
parsed = JSON.parse(data)
|
|
1374
|
+
} catch (err) {
|
|
1375
|
+
throw WebrpcBadResponseError.new({ cause: `JsonDecode: JSON.parse failed: ${(err as Error).message}` })
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
return decodeType(typ, parsed) as T
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1246
1381
|
//
|
|
1247
1382
|
// Errors
|
|
1248
1383
|
//
|
|
1249
1384
|
|
|
1385
|
+
type WebrpcErrorParams = { name?: string; code?: number; message?: string; status?: number; cause?: string }
|
|
1386
|
+
|
|
1250
1387
|
export class WebrpcError extends Error {
|
|
1251
|
-
name: string
|
|
1252
1388
|
code: number
|
|
1253
|
-
message: string
|
|
1254
1389
|
status: number
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
this.
|
|
1263
|
-
this.code = typeof code === 'number' ? code : 0
|
|
1264
|
-
this.message = message || `endpoint error ${this.code}`
|
|
1265
|
-
this.msg = this.message
|
|
1266
|
-
this.status = typeof status === 'number' ? status : 0
|
|
1267
|
-
this.cause = cause
|
|
1390
|
+
|
|
1391
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1392
|
+
super(error.message)
|
|
1393
|
+
this.name = error.name || 'WebrpcEndpointError'
|
|
1394
|
+
this.code = typeof error.code === 'number' ? error.code : 0
|
|
1395
|
+
this.message = error.message || `endpoint error`
|
|
1396
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1397
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1268
1398
|
Object.setPrototypeOf(this, WebrpcError.prototype)
|
|
1269
1399
|
}
|
|
1270
1400
|
|
|
1271
1401
|
static new(payload: any): WebrpcError {
|
|
1272
|
-
return new this(
|
|
1402
|
+
return new this({ message: payload.message, code: payload.code, status: payload.status, cause: payload.cause })
|
|
1273
1403
|
}
|
|
1274
1404
|
}
|
|
1275
1405
|
|
|
1276
|
-
// Webrpc errors
|
|
1277
|
-
|
|
1278
1406
|
export class WebrpcEndpointError extends WebrpcError {
|
|
1279
|
-
constructor(
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
super(name, code, message, status, cause)
|
|
1407
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1408
|
+
super(error)
|
|
1409
|
+
this.name = error.name || 'WebrpcEndpoint'
|
|
1410
|
+
this.code = typeof error.code === 'number' ? error.code : 0
|
|
1411
|
+
this.message = error.message || `endpoint error`
|
|
1412
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1413
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1287
1414
|
Object.setPrototypeOf(this, WebrpcEndpointError.prototype)
|
|
1288
1415
|
}
|
|
1289
1416
|
}
|
|
1290
1417
|
|
|
1291
1418
|
export class WebrpcRequestFailedError extends WebrpcError {
|
|
1292
|
-
constructor(
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
super(name, code, message, status, cause)
|
|
1419
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1420
|
+
super(error)
|
|
1421
|
+
this.name = error.name || 'WebrpcRequestFailed'
|
|
1422
|
+
this.code = typeof error.code === 'number' ? error.code : -1
|
|
1423
|
+
this.message = error.message || `request failed`
|
|
1424
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1425
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1300
1426
|
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype)
|
|
1301
1427
|
}
|
|
1302
1428
|
}
|
|
1303
1429
|
|
|
1304
1430
|
export class WebrpcBadRouteError extends WebrpcError {
|
|
1305
|
-
constructor(
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
super(name, code, message, status, cause)
|
|
1431
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1432
|
+
super(error)
|
|
1433
|
+
this.name = error.name || 'WebrpcBadRoute'
|
|
1434
|
+
this.code = typeof error.code === 'number' ? error.code : -2
|
|
1435
|
+
this.message = error.message || `bad route`
|
|
1436
|
+
this.status = typeof error.status === 'number' ? error.status : 404
|
|
1437
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1313
1438
|
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype)
|
|
1314
1439
|
}
|
|
1315
1440
|
}
|
|
1316
1441
|
|
|
1317
1442
|
export class WebrpcBadMethodError extends WebrpcError {
|
|
1318
|
-
constructor(
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
super(name, code, message, status, cause)
|
|
1443
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1444
|
+
super(error)
|
|
1445
|
+
this.name = error.name || 'WebrpcBadMethod'
|
|
1446
|
+
this.code = typeof error.code === 'number' ? error.code : -3
|
|
1447
|
+
this.message = error.message || `bad method`
|
|
1448
|
+
this.status = typeof error.status === 'number' ? error.status : 405
|
|
1449
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1326
1450
|
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype)
|
|
1327
1451
|
}
|
|
1328
1452
|
}
|
|
1329
1453
|
|
|
1330
1454
|
export class WebrpcBadRequestError extends WebrpcError {
|
|
1331
|
-
constructor(
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
super(name, code, message, status, cause)
|
|
1455
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1456
|
+
super(error)
|
|
1457
|
+
this.name = error.name || 'WebrpcBadRequest'
|
|
1458
|
+
this.code = typeof error.code === 'number' ? error.code : -4
|
|
1459
|
+
this.message = error.message || `bad request`
|
|
1460
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1461
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1339
1462
|
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype)
|
|
1340
1463
|
}
|
|
1341
1464
|
}
|
|
1342
1465
|
|
|
1343
1466
|
export class WebrpcBadResponseError extends WebrpcError {
|
|
1344
|
-
constructor(
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
super(name, code, message, status, cause)
|
|
1467
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1468
|
+
super(error)
|
|
1469
|
+
this.name = error.name || 'WebrpcBadResponse'
|
|
1470
|
+
this.code = typeof error.code === 'number' ? error.code : -5
|
|
1471
|
+
this.message = error.message || `bad response`
|
|
1472
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
1473
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1352
1474
|
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype)
|
|
1353
1475
|
}
|
|
1354
1476
|
}
|
|
1355
1477
|
|
|
1356
1478
|
export class WebrpcServerPanicError extends WebrpcError {
|
|
1357
|
-
constructor(
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
super(name, code, message, status, cause)
|
|
1479
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1480
|
+
super(error)
|
|
1481
|
+
this.name = error.name || 'WebrpcServerPanic'
|
|
1482
|
+
this.code = typeof error.code === 'number' ? error.code : -6
|
|
1483
|
+
this.message = error.message || `server panic`
|
|
1484
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
1485
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1365
1486
|
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype)
|
|
1366
1487
|
}
|
|
1367
1488
|
}
|
|
1368
1489
|
|
|
1369
1490
|
export class WebrpcInternalErrorError extends WebrpcError {
|
|
1370
|
-
constructor(
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
super(name, code, message, status, cause)
|
|
1491
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1492
|
+
super(error)
|
|
1493
|
+
this.name = error.name || 'WebrpcInternalError'
|
|
1494
|
+
this.code = typeof error.code === 'number' ? error.code : -7
|
|
1495
|
+
this.message = error.message || `internal error`
|
|
1496
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
1497
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1378
1498
|
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype)
|
|
1379
1499
|
}
|
|
1380
1500
|
}
|
|
1381
1501
|
|
|
1382
|
-
export class
|
|
1383
|
-
constructor(
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype)
|
|
1502
|
+
export class WebrpcClientAbortedError extends WebrpcError {
|
|
1503
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1504
|
+
super(error)
|
|
1505
|
+
this.name = error.name || 'WebrpcClientAborted'
|
|
1506
|
+
this.code = typeof error.code === 'number' ? error.code : -8
|
|
1507
|
+
this.message = error.message || `request aborted by client`
|
|
1508
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1509
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1510
|
+
Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype)
|
|
1392
1511
|
}
|
|
1393
1512
|
}
|
|
1394
1513
|
|
|
1395
1514
|
export class WebrpcStreamLostError extends WebrpcError {
|
|
1396
|
-
constructor(
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
super(name, code, message, status, cause)
|
|
1515
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1516
|
+
super(error)
|
|
1517
|
+
this.name = error.name || 'WebrpcStreamLost'
|
|
1518
|
+
this.code = typeof error.code === 'number' ? error.code : -9
|
|
1519
|
+
this.message = error.message || `stream lost`
|
|
1520
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1521
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1404
1522
|
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype)
|
|
1405
1523
|
}
|
|
1406
1524
|
}
|
|
1407
1525
|
|
|
1408
1526
|
export class WebrpcStreamFinishedError extends WebrpcError {
|
|
1409
|
-
constructor(
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
super(name, code, message, status, cause)
|
|
1527
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1528
|
+
super(error)
|
|
1529
|
+
this.name = error.name || 'WebrpcStreamFinished'
|
|
1530
|
+
this.code = typeof error.code === 'number' ? error.code : -10
|
|
1531
|
+
this.message = error.message || `stream finished`
|
|
1532
|
+
this.status = typeof error.status === 'number' ? error.status : 200
|
|
1533
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1417
1534
|
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype)
|
|
1418
1535
|
}
|
|
1419
1536
|
}
|
|
1420
1537
|
|
|
1421
|
-
|
|
1538
|
+
//
|
|
1422
1539
|
// Schema errors
|
|
1540
|
+
//
|
|
1423
1541
|
|
|
1424
1542
|
export class UnauthorizedError extends WebrpcError {
|
|
1425
|
-
constructor(
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
super(name, code, message, status, cause)
|
|
1543
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1544
|
+
super(error)
|
|
1545
|
+
this.name = error.name || 'Unauthorized'
|
|
1546
|
+
this.code = typeof error.code === 'number' ? error.code : 1000
|
|
1547
|
+
this.message = error.message || `Unauthorized access`
|
|
1548
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
1549
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1433
1550
|
Object.setPrototypeOf(this, UnauthorizedError.prototype)
|
|
1434
1551
|
}
|
|
1435
1552
|
}
|
|
1436
1553
|
|
|
1437
1554
|
export class PermissionDeniedError extends WebrpcError {
|
|
1438
|
-
constructor(
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
super(name, code, message, status, cause)
|
|
1555
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1556
|
+
super(error)
|
|
1557
|
+
this.name = error.name || 'PermissionDenied'
|
|
1558
|
+
this.code = typeof error.code === 'number' ? error.code : 1001
|
|
1559
|
+
this.message = error.message || `Permission denied`
|
|
1560
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1561
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1446
1562
|
Object.setPrototypeOf(this, PermissionDeniedError.prototype)
|
|
1447
1563
|
}
|
|
1448
1564
|
}
|
|
1449
1565
|
|
|
1450
1566
|
export class SessionExpiredError extends WebrpcError {
|
|
1451
|
-
constructor(
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
super(name, code, message, status, cause)
|
|
1567
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1568
|
+
super(error)
|
|
1569
|
+
this.name = error.name || 'SessionExpired'
|
|
1570
|
+
this.code = typeof error.code === 'number' ? error.code : 1002
|
|
1571
|
+
this.message = error.message || `Session expired`
|
|
1572
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1573
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1459
1574
|
Object.setPrototypeOf(this, SessionExpiredError.prototype)
|
|
1460
1575
|
}
|
|
1461
1576
|
}
|
|
1462
1577
|
|
|
1463
1578
|
export class MethodNotFoundError extends WebrpcError {
|
|
1464
|
-
constructor(
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
super(name, code, message, status, cause)
|
|
1579
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1580
|
+
super(error)
|
|
1581
|
+
this.name = error.name || 'MethodNotFound'
|
|
1582
|
+
this.code = typeof error.code === 'number' ? error.code : 1003
|
|
1583
|
+
this.message = error.message || `Method not found`
|
|
1584
|
+
this.status = typeof error.status === 'number' ? error.status : 404
|
|
1585
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1472
1586
|
Object.setPrototypeOf(this, MethodNotFoundError.prototype)
|
|
1473
1587
|
}
|
|
1474
1588
|
}
|
|
1475
1589
|
|
|
1476
1590
|
export class RequestConflictError extends WebrpcError {
|
|
1477
|
-
constructor(
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
super(name, code, message, status, cause)
|
|
1591
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1592
|
+
super(error)
|
|
1593
|
+
this.name = error.name || 'RequestConflict'
|
|
1594
|
+
this.code = typeof error.code === 'number' ? error.code : 1004
|
|
1595
|
+
this.message = error.message || `Conflict with target resource`
|
|
1596
|
+
this.status = typeof error.status === 'number' ? error.status : 409
|
|
1597
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1485
1598
|
Object.setPrototypeOf(this, RequestConflictError.prototype)
|
|
1486
1599
|
}
|
|
1487
1600
|
}
|
|
1488
1601
|
|
|
1489
1602
|
export class AbortedError extends WebrpcError {
|
|
1490
|
-
constructor(
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
super(name, code, message, status, cause)
|
|
1603
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1604
|
+
super(error)
|
|
1605
|
+
this.name = error.name || 'Aborted'
|
|
1606
|
+
this.code = typeof error.code === 'number' ? error.code : 1005
|
|
1607
|
+
this.message = error.message || `Request aborted`
|
|
1608
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1609
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1498
1610
|
Object.setPrototypeOf(this, AbortedError.prototype)
|
|
1499
1611
|
}
|
|
1500
1612
|
}
|
|
1501
1613
|
|
|
1502
1614
|
export class GeoblockedError extends WebrpcError {
|
|
1503
|
-
constructor(
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
super(name, code, message, status, cause)
|
|
1615
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1616
|
+
super(error)
|
|
1617
|
+
this.name = error.name || 'Geoblocked'
|
|
1618
|
+
this.code = typeof error.code === 'number' ? error.code : 1006
|
|
1619
|
+
this.message = error.message || `Geoblocked region`
|
|
1620
|
+
this.status = typeof error.status === 'number' ? error.status : 451
|
|
1621
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1511
1622
|
Object.setPrototypeOf(this, GeoblockedError.prototype)
|
|
1512
1623
|
}
|
|
1513
1624
|
}
|
|
1514
1625
|
|
|
1515
1626
|
export class RateLimitedError extends WebrpcError {
|
|
1516
|
-
constructor(
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
super(name, code, message, status, cause)
|
|
1627
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1628
|
+
super(error)
|
|
1629
|
+
this.name = error.name || 'RateLimited'
|
|
1630
|
+
this.code = typeof error.code === 'number' ? error.code : 1007
|
|
1631
|
+
this.message = error.message || `Rate-limited. Please slow down.`
|
|
1632
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
1633
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1524
1634
|
Object.setPrototypeOf(this, RateLimitedError.prototype)
|
|
1525
1635
|
}
|
|
1526
1636
|
}
|
|
1527
1637
|
|
|
1528
1638
|
export class ProjectNotFoundError extends WebrpcError {
|
|
1529
|
-
constructor(
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
super(name, code, message, status, cause)
|
|
1639
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1640
|
+
super(error)
|
|
1641
|
+
this.name = error.name || 'ProjectNotFound'
|
|
1642
|
+
this.code = typeof error.code === 'number' ? error.code : 1008
|
|
1643
|
+
this.message = error.message || `Project not found`
|
|
1644
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
1645
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1537
1646
|
Object.setPrototypeOf(this, ProjectNotFoundError.prototype)
|
|
1538
1647
|
}
|
|
1539
1648
|
}
|
|
1540
1649
|
|
|
1541
1650
|
export class AccessKeyNotFoundError extends WebrpcError {
|
|
1542
|
-
constructor(
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
super(name, code, message, status, cause)
|
|
1651
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1652
|
+
super(error)
|
|
1653
|
+
this.name = error.name || 'AccessKeyNotFound'
|
|
1654
|
+
this.code = typeof error.code === 'number' ? error.code : 1101
|
|
1655
|
+
this.message = error.message || `Access key not found`
|
|
1656
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
1657
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1550
1658
|
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype)
|
|
1551
1659
|
}
|
|
1552
1660
|
}
|
|
1553
1661
|
|
|
1554
1662
|
export class AccessKeyMismatchError extends WebrpcError {
|
|
1555
|
-
constructor(
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
super(name, code, message, status, cause)
|
|
1663
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1664
|
+
super(error)
|
|
1665
|
+
this.name = error.name || 'AccessKeyMismatch'
|
|
1666
|
+
this.code = typeof error.code === 'number' ? error.code : 1102
|
|
1667
|
+
this.message = error.message || `Access key mismatch`
|
|
1668
|
+
this.status = typeof error.status === 'number' ? error.status : 409
|
|
1669
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1563
1670
|
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype)
|
|
1564
1671
|
}
|
|
1565
1672
|
}
|
|
1566
1673
|
|
|
1567
1674
|
export class InvalidOriginError extends WebrpcError {
|
|
1568
|
-
constructor(
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
super(name, code, message, status, cause)
|
|
1675
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1676
|
+
super(error)
|
|
1677
|
+
this.name = error.name || 'InvalidOrigin'
|
|
1678
|
+
this.code = typeof error.code === 'number' ? error.code : 1103
|
|
1679
|
+
this.message = error.message || `Invalid origin for Access Key`
|
|
1680
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1681
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1576
1682
|
Object.setPrototypeOf(this, InvalidOriginError.prototype)
|
|
1577
1683
|
}
|
|
1578
1684
|
}
|
|
1579
1685
|
|
|
1580
1686
|
export class InvalidServiceError extends WebrpcError {
|
|
1581
|
-
constructor(
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
super(name, code, message, status, cause)
|
|
1687
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1688
|
+
super(error)
|
|
1689
|
+
this.name = error.name || 'InvalidService'
|
|
1690
|
+
this.code = typeof error.code === 'number' ? error.code : 1104
|
|
1691
|
+
this.message = error.message || `Service not enabled for Access key`
|
|
1692
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1693
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1589
1694
|
Object.setPrototypeOf(this, InvalidServiceError.prototype)
|
|
1590
1695
|
}
|
|
1591
1696
|
}
|
|
1592
1697
|
|
|
1593
1698
|
export class UnauthorizedUserError extends WebrpcError {
|
|
1594
|
-
constructor(
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
super(name, code, message, status, cause)
|
|
1699
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1700
|
+
super(error)
|
|
1701
|
+
this.name = error.name || 'UnauthorizedUser'
|
|
1702
|
+
this.code = typeof error.code === 'number' ? error.code : 1105
|
|
1703
|
+
this.message = error.message || `Unauthorized user`
|
|
1704
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1705
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1602
1706
|
Object.setPrototypeOf(this, UnauthorizedUserError.prototype)
|
|
1603
1707
|
}
|
|
1604
1708
|
}
|
|
1605
1709
|
|
|
1606
1710
|
export class QuotaExceededError extends WebrpcError {
|
|
1607
|
-
constructor(
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
super(name, code, message, status, cause)
|
|
1711
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1712
|
+
super(error)
|
|
1713
|
+
this.name = error.name || 'QuotaExceeded'
|
|
1714
|
+
this.code = typeof error.code === 'number' ? error.code : 1200
|
|
1715
|
+
this.message = error.message || `Quota request exceeded`
|
|
1716
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
1717
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1615
1718
|
Object.setPrototypeOf(this, QuotaExceededError.prototype)
|
|
1616
1719
|
}
|
|
1617
1720
|
}
|
|
1618
1721
|
|
|
1619
1722
|
export class QuotaRateLimitError extends WebrpcError {
|
|
1620
|
-
constructor(
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
super(name, code, message, status, cause)
|
|
1723
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1724
|
+
super(error)
|
|
1725
|
+
this.name = error.name || 'QuotaRateLimit'
|
|
1726
|
+
this.code = typeof error.code === 'number' ? error.code : 1201
|
|
1727
|
+
this.message = error.message || `Quota rate limit exceeded`
|
|
1728
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
1729
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1628
1730
|
Object.setPrototypeOf(this, QuotaRateLimitError.prototype)
|
|
1629
1731
|
}
|
|
1630
1732
|
}
|
|
1631
1733
|
|
|
1632
1734
|
export class NoDefaultKeyError extends WebrpcError {
|
|
1633
|
-
constructor(
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
super(name, code, message, status, cause)
|
|
1735
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1736
|
+
super(error)
|
|
1737
|
+
this.name = error.name || 'NoDefaultKey'
|
|
1738
|
+
this.code = typeof error.code === 'number' ? error.code : 1300
|
|
1739
|
+
this.message = error.message || `No default access key found`
|
|
1740
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1741
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1641
1742
|
Object.setPrototypeOf(this, NoDefaultKeyError.prototype)
|
|
1642
1743
|
}
|
|
1643
1744
|
}
|
|
1644
1745
|
|
|
1645
1746
|
export class MaxAccessKeysError extends WebrpcError {
|
|
1646
|
-
constructor(
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
super(name, code, message, status, cause)
|
|
1747
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1748
|
+
super(error)
|
|
1749
|
+
this.name = error.name || 'MaxAccessKeys'
|
|
1750
|
+
this.code = typeof error.code === 'number' ? error.code : 1301
|
|
1751
|
+
this.message = error.message || `Access keys limit reached`
|
|
1752
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1753
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1654
1754
|
Object.setPrototypeOf(this, MaxAccessKeysError.prototype)
|
|
1655
1755
|
}
|
|
1656
1756
|
}
|
|
1657
1757
|
|
|
1658
1758
|
export class AtLeastOneKeyError extends WebrpcError {
|
|
1659
|
-
constructor(
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
super(name, code, message, status, cause)
|
|
1759
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1760
|
+
super(error)
|
|
1761
|
+
this.name = error.name || 'AtLeastOneKey'
|
|
1762
|
+
this.code = typeof error.code === 'number' ? error.code : 1302
|
|
1763
|
+
this.message = error.message || `You need at least one Access Key`
|
|
1764
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1765
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1667
1766
|
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype)
|
|
1668
1767
|
}
|
|
1669
1768
|
}
|
|
1670
1769
|
|
|
1671
1770
|
export class TimeoutError extends WebrpcError {
|
|
1672
|
-
constructor(
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
super(name, code, message, status, cause)
|
|
1771
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1772
|
+
super(error)
|
|
1773
|
+
this.name = error.name || 'Timeout'
|
|
1774
|
+
this.code = typeof error.code === 'number' ? error.code : 1900
|
|
1775
|
+
this.message = error.message || `Request timed out`
|
|
1776
|
+
this.status = typeof error.status === 'number' ? error.status : 408
|
|
1777
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1680
1778
|
Object.setPrototypeOf(this, TimeoutError.prototype)
|
|
1681
1779
|
}
|
|
1682
1780
|
}
|
|
1683
1781
|
|
|
1684
1782
|
export class InvalidArgumentError extends WebrpcError {
|
|
1685
|
-
constructor(
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
super(name, code, message, status, cause)
|
|
1783
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1784
|
+
super(error)
|
|
1785
|
+
this.name = error.name || 'InvalidArgument'
|
|
1786
|
+
this.code = typeof error.code === 'number' ? error.code : 2001
|
|
1787
|
+
this.message = error.message || `Invalid argument`
|
|
1788
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1789
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1693
1790
|
Object.setPrototypeOf(this, InvalidArgumentError.prototype)
|
|
1694
1791
|
}
|
|
1695
1792
|
}
|
|
1696
1793
|
|
|
1697
1794
|
export class UnavailableError extends WebrpcError {
|
|
1698
|
-
constructor(
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
super(name, code, message, status, cause)
|
|
1795
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1796
|
+
super(error)
|
|
1797
|
+
this.name = error.name || 'Unavailable'
|
|
1798
|
+
this.code = typeof error.code === 'number' ? error.code : 2002
|
|
1799
|
+
this.message = error.message || `Unavailable resource`
|
|
1800
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1801
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1706
1802
|
Object.setPrototypeOf(this, UnavailableError.prototype)
|
|
1707
1803
|
}
|
|
1708
1804
|
}
|
|
1709
1805
|
|
|
1710
1806
|
export class QueryFailedError extends WebrpcError {
|
|
1711
|
-
constructor(
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
super(name, code, message, status, cause)
|
|
1807
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1808
|
+
super(error)
|
|
1809
|
+
this.name = error.name || 'QueryFailed'
|
|
1810
|
+
this.code = typeof error.code === 'number' ? error.code : 2003
|
|
1811
|
+
this.message = error.message || `Query failed`
|
|
1812
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1813
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1719
1814
|
Object.setPrototypeOf(this, QueryFailedError.prototype)
|
|
1720
1815
|
}
|
|
1721
1816
|
}
|
|
1722
1817
|
|
|
1723
1818
|
export class NotFoundError extends WebrpcError {
|
|
1724
|
-
constructor(
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
super(name, code, message, status, cause)
|
|
1819
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1820
|
+
super(error)
|
|
1821
|
+
this.name = error.name || 'NotFound'
|
|
1822
|
+
this.code = typeof error.code === 'number' ? error.code : 3000
|
|
1823
|
+
this.message = error.message || `Resource not found`
|
|
1824
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1825
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1732
1826
|
Object.setPrototypeOf(this, NotFoundError.prototype)
|
|
1733
1827
|
}
|
|
1734
1828
|
}
|
|
1735
1829
|
|
|
1736
1830
|
export class InsufficientFeeError extends WebrpcError {
|
|
1737
|
-
constructor(
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
super(name, code, message, status, cause)
|
|
1831
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1832
|
+
super(error)
|
|
1833
|
+
this.name = error.name || 'InsufficientFee'
|
|
1834
|
+
this.code = typeof error.code === 'number' ? error.code : 3004
|
|
1835
|
+
this.message = error.message || `Insufficient fee`
|
|
1836
|
+
this.status = typeof error.status === 'number' ? error.status : 402
|
|
1837
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1745
1838
|
Object.setPrototypeOf(this, InsufficientFeeError.prototype)
|
|
1746
1839
|
}
|
|
1747
1840
|
}
|
|
1748
1841
|
|
|
1749
1842
|
export class NotEnoughBalanceError extends WebrpcError {
|
|
1750
|
-
constructor(
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
super(name, code, message, status, cause)
|
|
1843
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1844
|
+
super(error)
|
|
1845
|
+
this.name = error.name || 'NotEnoughBalance'
|
|
1846
|
+
this.code = typeof error.code === 'number' ? error.code : 3005
|
|
1847
|
+
this.message = error.message || `Not enough balance`
|
|
1848
|
+
this.status = typeof error.status === 'number' ? error.status : 402
|
|
1849
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1758
1850
|
Object.setPrototypeOf(this, NotEnoughBalanceError.prototype)
|
|
1759
1851
|
}
|
|
1760
1852
|
}
|
|
1761
1853
|
|
|
1762
1854
|
export class SimulationFailedError extends WebrpcError {
|
|
1763
|
-
constructor(
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
super(name, code, message, status, cause)
|
|
1855
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1856
|
+
super(error)
|
|
1857
|
+
this.name = error.name || 'SimulationFailed'
|
|
1858
|
+
this.code = typeof error.code === 'number' ? error.code : 3006
|
|
1859
|
+
this.message = error.message || `Simulation failed`
|
|
1860
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1861
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1771
1862
|
Object.setPrototypeOf(this, SimulationFailedError.prototype)
|
|
1772
1863
|
}
|
|
1773
1864
|
}
|
|
1774
1865
|
|
|
1775
|
-
|
|
1776
1866
|
export enum errors {
|
|
1777
1867
|
WebrpcEndpoint = 'WebrpcEndpoint',
|
|
1778
1868
|
WebrpcRequestFailed = 'WebrpcRequestFailed',
|
|
@@ -1782,7 +1872,7 @@ export enum errors {
|
|
|
1782
1872
|
WebrpcBadResponse = 'WebrpcBadResponse',
|
|
1783
1873
|
WebrpcServerPanic = 'WebrpcServerPanic',
|
|
1784
1874
|
WebrpcInternalError = 'WebrpcInternalError',
|
|
1785
|
-
|
|
1875
|
+
WebrpcClientAborted = 'WebrpcClientAborted',
|
|
1786
1876
|
WebrpcStreamLost = 'WebrpcStreamLost',
|
|
1787
1877
|
WebrpcStreamFinished = 'WebrpcStreamFinished',
|
|
1788
1878
|
Unauthorized = 'Unauthorized',
|
|
@@ -1811,7 +1901,7 @@ export enum errors {
|
|
|
1811
1901
|
NotFound = 'NotFound',
|
|
1812
1902
|
InsufficientFee = 'InsufficientFee',
|
|
1813
1903
|
NotEnoughBalance = 'NotEnoughBalance',
|
|
1814
|
-
SimulationFailed = 'SimulationFailed'
|
|
1904
|
+
SimulationFailed = 'SimulationFailed'
|
|
1815
1905
|
}
|
|
1816
1906
|
|
|
1817
1907
|
export enum WebrpcErrorCodes {
|
|
@@ -1823,7 +1913,7 @@ export enum WebrpcErrorCodes {
|
|
|
1823
1913
|
WebrpcBadResponse = -5,
|
|
1824
1914
|
WebrpcServerPanic = -6,
|
|
1825
1915
|
WebrpcInternalError = -7,
|
|
1826
|
-
|
|
1916
|
+
WebrpcClientAborted = -8,
|
|
1827
1917
|
WebrpcStreamLost = -9,
|
|
1828
1918
|
WebrpcStreamFinished = -10,
|
|
1829
1919
|
Unauthorized = 1000,
|
|
@@ -1852,7 +1942,7 @@ export enum WebrpcErrorCodes {
|
|
|
1852
1942
|
NotFound = 3000,
|
|
1853
1943
|
InsufficientFee = 3004,
|
|
1854
1944
|
NotEnoughBalance = 3005,
|
|
1855
|
-
SimulationFailed = 3006
|
|
1945
|
+
SimulationFailed = 3006
|
|
1856
1946
|
}
|
|
1857
1947
|
|
|
1858
1948
|
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
@@ -1864,7 +1954,7 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
1864
1954
|
[-5]: WebrpcBadResponseError,
|
|
1865
1955
|
[-6]: WebrpcServerPanicError,
|
|
1866
1956
|
[-7]: WebrpcInternalErrorError,
|
|
1867
|
-
[-8]:
|
|
1957
|
+
[-8]: WebrpcClientAbortedError,
|
|
1868
1958
|
[-9]: WebrpcStreamLostError,
|
|
1869
1959
|
[-10]: WebrpcStreamFinishedError,
|
|
1870
1960
|
[1000]: UnauthorizedError,
|
|
@@ -1893,8 +1983,61 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
1893
1983
|
[3000]: NotFoundError,
|
|
1894
1984
|
[3004]: InsufficientFeeError,
|
|
1895
1985
|
[3005]: NotEnoughBalanceError,
|
|
1896
|
-
[3006]: SimulationFailedError
|
|
1986
|
+
[3006]: SimulationFailedError
|
|
1897
1987
|
}
|
|
1898
1988
|
|
|
1899
|
-
|
|
1989
|
+
//
|
|
1990
|
+
// Webrpc
|
|
1991
|
+
//
|
|
1992
|
+
|
|
1993
|
+
export const WebrpcHeader = 'Webrpc'
|
|
1900
1994
|
|
|
1995
|
+
export const WebrpcHeaderValue = 'webrpc@v0.31.2;gen-typescript@v0.23.1;sequence-relayer@v0.4.1'
|
|
1996
|
+
|
|
1997
|
+
type WebrpcGenVersions = {
|
|
1998
|
+
WebrpcGenVersion: string
|
|
1999
|
+
codeGenName: string
|
|
2000
|
+
codeGenVersion: string
|
|
2001
|
+
schemaName: string
|
|
2002
|
+
schemaVersion: string
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
2006
|
+
const headerValue = headers.get(WebrpcHeader)
|
|
2007
|
+
if (!headerValue) {
|
|
2008
|
+
return {
|
|
2009
|
+
WebrpcGenVersion: '',
|
|
2010
|
+
codeGenName: '',
|
|
2011
|
+
codeGenVersion: '',
|
|
2012
|
+
schemaName: '',
|
|
2013
|
+
schemaVersion: ''
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
return parseWebrpcGenVersions(headerValue)
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
2021
|
+
const versions = header.split(';')
|
|
2022
|
+
if (versions.length < 3) {
|
|
2023
|
+
return {
|
|
2024
|
+
WebrpcGenVersion: '',
|
|
2025
|
+
codeGenName: '',
|
|
2026
|
+
codeGenVersion: '',
|
|
2027
|
+
schemaName: '',
|
|
2028
|
+
schemaVersion: ''
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
const [_, WebrpcGenVersion] = versions[0]!.split('@')
|
|
2033
|
+
const [codeGenName, codeGenVersion] = versions[1]!.split('@')
|
|
2034
|
+
const [schemaName, schemaVersion] = versions[2]!.split('@')
|
|
2035
|
+
|
|
2036
|
+
return {
|
|
2037
|
+
WebrpcGenVersion: WebrpcGenVersion ?? '',
|
|
2038
|
+
codeGenName: codeGenName ?? '',
|
|
2039
|
+
codeGenVersion: codeGenVersion ?? '',
|
|
2040
|
+
schemaName: schemaName ?? '',
|
|
2041
|
+
schemaVersion: schemaVersion ?? ''
|
|
2042
|
+
}
|
|
2043
|
+
}
|