@0xsequence/relayer 2.3.35 → 3.0.0-beta.2
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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +3862 -0
- package/LICENSE +0 -17
- package/README.md +1 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/preconditions/codec.d.ts +12 -0
- package/dist/preconditions/codec.d.ts.map +1 -0
- package/dist/preconditions/codec.js +125 -0
- package/dist/preconditions/index.d.ts +4 -0
- package/dist/preconditions/index.d.ts.map +1 -0
- package/dist/preconditions/index.js +3 -0
- package/dist/preconditions/selectors.d.ts +7 -0
- package/dist/preconditions/selectors.d.ts.map +1 -0
- package/dist/preconditions/selectors.js +27 -0
- package/dist/preconditions/types.d.ts +70 -0
- package/dist/preconditions/types.d.ts.map +1 -0
- package/dist/preconditions/types.js +203 -0
- package/dist/relayer/index.d.ts +45 -0
- package/dist/relayer/index.d.ts.map +1 -0
- package/dist/relayer/index.js +3 -0
- package/dist/relayer/relayer.d.ts +26 -0
- package/dist/relayer/relayer.d.ts.map +1 -0
- package/dist/relayer/relayer.js +7 -0
- package/dist/relayer/rpc-relayer/index.d.ts +38 -0
- package/dist/relayer/rpc-relayer/index.d.ts.map +1 -0
- package/dist/relayer/rpc-relayer/index.js +375 -0
- package/dist/{declarations/src → relayer}/rpc-relayer/relayer.gen.d.ts +218 -178
- package/dist/relayer/rpc-relayer/relayer.gen.d.ts.map +1 -0
- package/dist/relayer/rpc-relayer/relayer.gen.js +1246 -0
- package/dist/relayer/standard/abi.d.ts +73 -0
- package/dist/relayer/standard/abi.d.ts.map +1 -0
- package/dist/relayer/standard/abi.js +10 -0
- package/dist/relayer/standard/eip6963.d.ts +31 -0
- package/dist/relayer/standard/eip6963.d.ts.map +1 -0
- package/dist/relayer/standard/eip6963.js +51 -0
- package/dist/relayer/standard/index.d.ts +5 -0
- package/dist/relayer/standard/index.d.ts.map +1 -0
- package/dist/relayer/standard/index.js +4 -0
- package/dist/relayer/standard/local.d.ts +60 -0
- package/dist/relayer/standard/local.d.ts.map +1 -0
- package/dist/relayer/standard/local.js +285 -0
- package/dist/relayer/standard/pk-relayer.d.ts +28 -0
- package/dist/relayer/standard/pk-relayer.d.ts.map +1 -0
- package/dist/relayer/standard/pk-relayer.js +112 -0
- package/dist/relayer/standard/sequence.d.ts +27 -0
- package/dist/relayer/standard/sequence.d.ts.map +1 -0
- package/dist/relayer/standard/sequence.js +84 -0
- package/package.json +28 -25
- package/src/index.ts +3 -111
- package/src/preconditions/codec.ts +190 -0
- package/src/preconditions/index.ts +3 -0
- package/src/preconditions/selectors.ts +38 -0
- package/src/preconditions/types.ts +201 -0
- package/src/relayer/index.ts +60 -0
- package/src/relayer/relayer.ts +37 -0
- package/src/relayer/rpc-relayer/index.ts +449 -0
- package/src/relayer/rpc-relayer/relayer.gen.ts +2268 -0
- package/src/relayer/standard/abi.ts +13 -0
- package/src/relayer/standard/eip6963.ts +74 -0
- package/src/relayer/standard/index.ts +4 -0
- package/src/relayer/standard/local.ts +353 -0
- package/src/relayer/standard/pk-relayer.ts +138 -0
- package/src/relayer/standard/sequence.ts +110 -0
- package/test/preconditions/codec.test.ts +531 -0
- package/test/preconditions/preconditions.test.ts +283 -0
- package/test/preconditions/selectors.test.ts +415 -0
- package/test/preconditions/types.test.ts +443 -0
- package/test/relayer/relayer.test.ts +355 -0
- package/tsconfig.json +10 -0
- package/dist/0xsequence-relayer.cjs.d.ts +0 -2
- package/dist/0xsequence-relayer.cjs.dev.js +0 -1626
- package/dist/0xsequence-relayer.cjs.js +0 -7
- package/dist/0xsequence-relayer.cjs.prod.js +0 -1626
- package/dist/0xsequence-relayer.esm.js +0 -1613
- package/dist/declarations/src/index.d.ts +0 -42
- package/dist/declarations/src/local-relayer.d.ts +0 -35
- package/dist/declarations/src/provider-relayer.d.ts +0 -47
- package/dist/declarations/src/rpc-relayer/index.d.ts +0 -72
- package/src/local-relayer.ts +0 -125
- package/src/provider-relayer.ts +0 -284
- package/src/rpc-relayer/index.ts +0 -380
- package/src/rpc-relayer/relayer.gen.ts +0 -1900
|
@@ -1,1900 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// sequence-relayer v0.4.1 62fe2b49d57c4a0d3960ac1176d48ecfffc7af5a
|
|
3
|
-
// --
|
|
4
|
-
// Code generated by webrpc-gen@v0.26.0 with typescript generator. DO NOT EDIT.
|
|
5
|
-
//
|
|
6
|
-
// webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts
|
|
7
|
-
|
|
8
|
-
export const WebrpcHeader = "Webrpc"
|
|
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"
|
|
14
|
-
|
|
15
|
-
// Schema version of your RIDL schema
|
|
16
|
-
export const WebRPCSchemaVersion = "v0.4.1"
|
|
17
|
-
|
|
18
|
-
// Schema hash generated from your RIDL schema
|
|
19
|
-
export const WebRPCSchemaHash = "62fe2b49d57c4a0d3960ac1176d48ecfffc7af5a"
|
|
20
|
-
|
|
21
|
-
type WebrpcGenVersions = {
|
|
22
|
-
webrpcGenVersion: string;
|
|
23
|
-
codeGenName: string;
|
|
24
|
-
codeGenVersion: string;
|
|
25
|
-
schemaName: string;
|
|
26
|
-
schemaVersion: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
30
|
-
const headerValue = headers.get(WebrpcHeader);
|
|
31
|
-
if (!headerValue) {
|
|
32
|
-
return {
|
|
33
|
-
webrpcGenVersion: "",
|
|
34
|
-
codeGenName: "",
|
|
35
|
-
codeGenVersion: "",
|
|
36
|
-
schemaName: "",
|
|
37
|
-
schemaVersion: "",
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return parseWebrpcGenVersions(headerValue);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
45
|
-
const versions = header.split(";");
|
|
46
|
-
if (versions.length < 3) {
|
|
47
|
-
return {
|
|
48
|
-
webrpcGenVersion: "",
|
|
49
|
-
codeGenName: "",
|
|
50
|
-
codeGenVersion: "",
|
|
51
|
-
schemaName: "",
|
|
52
|
-
schemaVersion: "",
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const [_, webrpcGenVersion] = versions[0]!.split("@");
|
|
57
|
-
const [codeGenName, codeGenVersion] = versions[1]!.split("@");
|
|
58
|
-
const [schemaName, schemaVersion] = versions[2]!.split("@");
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
webrpcGenVersion: webrpcGenVersion ?? "",
|
|
62
|
-
codeGenName: codeGenName ?? "",
|
|
63
|
-
codeGenVersion: codeGenVersion ?? "",
|
|
64
|
-
schemaName: schemaName ?? "",
|
|
65
|
-
schemaVersion: schemaVersion ?? "",
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
// Types
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export enum ETHTxnStatus {
|
|
75
|
-
UNKNOWN = 'UNKNOWN',
|
|
76
|
-
DROPPED = 'DROPPED',
|
|
77
|
-
QUEUED = 'QUEUED',
|
|
78
|
-
SENT = 'SENT',
|
|
79
|
-
SUCCEEDED = 'SUCCEEDED',
|
|
80
|
-
PARTIALLY_FAILED = 'PARTIALLY_FAILED',
|
|
81
|
-
FAILED = 'FAILED',
|
|
82
|
-
PENDING_PRECONDITION = 'PENDING_PRECONDITION'
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export enum TransferType {
|
|
86
|
-
SEND = 'SEND',
|
|
87
|
-
RECEIVE = 'RECEIVE',
|
|
88
|
-
BRIDGE_DEPOSIT = 'BRIDGE_DEPOSIT',
|
|
89
|
-
BRIDGE_WITHDRAW = 'BRIDGE_WITHDRAW',
|
|
90
|
-
BURN = 'BURN',
|
|
91
|
-
UNKNOWN = 'UNKNOWN'
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export enum SimulateStatus {
|
|
95
|
-
SKIPPED = 'SKIPPED',
|
|
96
|
-
SUCCEEDED = 'SUCCEEDED',
|
|
97
|
-
FAILED = 'FAILED',
|
|
98
|
-
ABORTED = 'ABORTED',
|
|
99
|
-
REVERTED = 'REVERTED',
|
|
100
|
-
NOT_ENOUGH_GAS = 'NOT_ENOUGH_GAS'
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export enum FeeTokenType {
|
|
104
|
-
UNKNOWN = 'UNKNOWN',
|
|
105
|
-
ERC20_TOKEN = 'ERC20_TOKEN',
|
|
106
|
-
ERC1155_TOKEN = 'ERC1155_TOKEN'
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export enum SortOrder {
|
|
110
|
-
DESC = 'DESC',
|
|
111
|
-
ASC = 'ASC'
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface Version {
|
|
115
|
-
webrpcVersion: string
|
|
116
|
-
schemaVersion: string
|
|
117
|
-
schemaHash: string
|
|
118
|
-
appVersion: string
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface RuntimeStatus {
|
|
122
|
-
healthOK: boolean
|
|
123
|
-
startTime: string
|
|
124
|
-
uptime: number
|
|
125
|
-
ver: string
|
|
126
|
-
branch: string
|
|
127
|
-
commitHash: string
|
|
128
|
-
chainID: number
|
|
129
|
-
useEIP1559: boolean
|
|
130
|
-
senders: Array<SenderStatus>
|
|
131
|
-
checks: RuntimeChecks
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface SenderStatus {
|
|
135
|
-
index: number
|
|
136
|
-
address: string
|
|
137
|
-
etherBalance: number
|
|
138
|
-
active: boolean
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface RuntimeChecks {
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface SequenceContext {
|
|
145
|
-
factory: string
|
|
146
|
-
mainModule: string
|
|
147
|
-
mainModuleUpgradable: string
|
|
148
|
-
guestModule: string
|
|
149
|
-
utils: string
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface GasTank {
|
|
153
|
-
id: number
|
|
154
|
-
chainId: number
|
|
155
|
-
name: string
|
|
156
|
-
currentBalance: number
|
|
157
|
-
unlimited: boolean
|
|
158
|
-
feeMarkupFactor: number
|
|
159
|
-
updatedAt: string
|
|
160
|
-
createdAt: string
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export interface GasTankBalanceAdjustment {
|
|
164
|
-
gasTankId: number
|
|
165
|
-
nonce: number
|
|
166
|
-
amount: number
|
|
167
|
-
totalBalance: number
|
|
168
|
-
balanceTimestamp: string
|
|
169
|
-
createdAt: string
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface GasSponsor {
|
|
173
|
-
id: number
|
|
174
|
-
gasTankId: number
|
|
175
|
-
projectId: number
|
|
176
|
-
chainId: number
|
|
177
|
-
address: string
|
|
178
|
-
name: string
|
|
179
|
-
active: boolean
|
|
180
|
-
updatedAt: string
|
|
181
|
-
createdAt: string
|
|
182
|
-
deletedAt: string
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export interface GasSponsorUsage {
|
|
186
|
-
name: string
|
|
187
|
-
id: number
|
|
188
|
-
totalGasUsed: number
|
|
189
|
-
totalTxnFees: number
|
|
190
|
-
totalTxnFeesUsd: number
|
|
191
|
-
avgGasPrice: number
|
|
192
|
-
totalTxns: number
|
|
193
|
-
startTime: string
|
|
194
|
-
endTime: string
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export interface MetaTxn {
|
|
198
|
-
walletAddress: string
|
|
199
|
-
contract: string
|
|
200
|
-
input: string
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface MetaTxnLog {
|
|
204
|
-
id: number
|
|
205
|
-
chainId: number
|
|
206
|
-
projectId: number
|
|
207
|
-
txnHash: string
|
|
208
|
-
txnNonce: string
|
|
209
|
-
metaTxnID?: string
|
|
210
|
-
txnStatus: ETHTxnStatus
|
|
211
|
-
txnRevertReason: string
|
|
212
|
-
requeues: number
|
|
213
|
-
queuedAt: string
|
|
214
|
-
sentAt: string
|
|
215
|
-
minedAt: string
|
|
216
|
-
target: string
|
|
217
|
-
input: string
|
|
218
|
-
txnArgs: {[key: string]: any}
|
|
219
|
-
txnReceipt?: {[key: string]: any}
|
|
220
|
-
walletAddress: string
|
|
221
|
-
metaTxnNonce: string
|
|
222
|
-
gasLimit: number
|
|
223
|
-
gasPrice: string
|
|
224
|
-
gasUsed: number
|
|
225
|
-
gasEstimated: number
|
|
226
|
-
gasFeeMarkup?: number
|
|
227
|
-
usdRate: string
|
|
228
|
-
creditsUsed: number
|
|
229
|
-
cost: string
|
|
230
|
-
isWhitelisted: boolean
|
|
231
|
-
gasSponsor?: number
|
|
232
|
-
gasTank?: number
|
|
233
|
-
updatedAt: string
|
|
234
|
-
createdAt: string
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface MetaTxnReceipt {
|
|
238
|
-
id: string
|
|
239
|
-
status: string
|
|
240
|
-
revertReason?: string
|
|
241
|
-
index: number
|
|
242
|
-
logs: Array<MetaTxnReceiptLog>
|
|
243
|
-
receipts: Array<MetaTxnReceipt>
|
|
244
|
-
blockNumber: string
|
|
245
|
-
txnHash: string
|
|
246
|
-
txnReceipt: string
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export interface MetaTxnReceiptLog {
|
|
250
|
-
address: string
|
|
251
|
-
topics: Array<string>
|
|
252
|
-
data: string
|
|
253
|
-
}
|
|
254
|
-
|
|
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
|
-
export interface Transactions {
|
|
266
|
-
chainID: string
|
|
267
|
-
transactions: Array<Transaction>
|
|
268
|
-
preconditions?: Array<IntentPrecondition>
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export interface Transaction {
|
|
272
|
-
delegateCall: boolean
|
|
273
|
-
revertOnError: boolean
|
|
274
|
-
gasLimit: string
|
|
275
|
-
target: string
|
|
276
|
-
value: string
|
|
277
|
-
data: string
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export interface TxnLogUser {
|
|
281
|
-
username: string
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
export interface TxnLogTransfer {
|
|
285
|
-
transferType: TransferType
|
|
286
|
-
contractAddress: string
|
|
287
|
-
from: string
|
|
288
|
-
to: string
|
|
289
|
-
ids: Array<string>
|
|
290
|
-
amounts: Array<string>
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export interface SentTransactionsFilter {
|
|
294
|
-
pending?: boolean
|
|
295
|
-
failed?: boolean
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export interface SimulateResult {
|
|
299
|
-
executed: boolean
|
|
300
|
-
succeeded: boolean
|
|
301
|
-
result?: string
|
|
302
|
-
reason?: string
|
|
303
|
-
gasUsed: number
|
|
304
|
-
gasLimit: number
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export interface SimulateV3Result {
|
|
308
|
-
status: SimulateStatus
|
|
309
|
-
result?: string
|
|
310
|
-
error?: string
|
|
311
|
-
gasUsed: number
|
|
312
|
-
gasLimit: number
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export interface FeeOption {
|
|
316
|
-
token: FeeToken
|
|
317
|
-
to: string
|
|
318
|
-
value: string
|
|
319
|
-
gasLimit: number
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export interface FeeToken {
|
|
323
|
-
chainId: number
|
|
324
|
-
name: string
|
|
325
|
-
symbol: string
|
|
326
|
-
type: FeeTokenType
|
|
327
|
-
decimals?: number
|
|
328
|
-
logoURL: string
|
|
329
|
-
contractAddress?: string
|
|
330
|
-
tokenID?: string
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export interface Page {
|
|
334
|
-
pageSize?: number
|
|
335
|
-
page?: number
|
|
336
|
-
more?: boolean
|
|
337
|
-
totalRecords?: number
|
|
338
|
-
column?: string
|
|
339
|
-
before?: any
|
|
340
|
-
after?: any
|
|
341
|
-
sort?: Array<SortBy>
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export interface SortBy {
|
|
345
|
-
column: string
|
|
346
|
-
order: SortOrder
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export interface Relayer {
|
|
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
|
-
}
|
|
431
|
-
|
|
432
|
-
export interface PingReturn {
|
|
433
|
-
status: boolean
|
|
434
|
-
}
|
|
435
|
-
export interface VersionArgs {
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
export interface VersionReturn {
|
|
439
|
-
version: Version
|
|
440
|
-
}
|
|
441
|
-
export interface RuntimeStatusArgs {
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export interface RuntimeStatusReturn {
|
|
445
|
-
status: RuntimeStatus
|
|
446
|
-
}
|
|
447
|
-
export interface GetSequenceContextArgs {
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
export interface GetSequenceContextReturn {
|
|
451
|
-
data: SequenceContext
|
|
452
|
-
}
|
|
453
|
-
export interface GetChainIDArgs {
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
export interface GetChainIDReturn {
|
|
457
|
-
chainID: number
|
|
458
|
-
}
|
|
459
|
-
export interface SendMetaTxnArgs {
|
|
460
|
-
call: MetaTxn
|
|
461
|
-
quote?: string
|
|
462
|
-
projectID?: number
|
|
463
|
-
preconditions?: Array<IntentPrecondition>
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export interface SendMetaTxnReturn {
|
|
467
|
-
status: boolean
|
|
468
|
-
txnHash: string
|
|
469
|
-
}
|
|
470
|
-
export interface GetMetaTxnNonceArgs {
|
|
471
|
-
walletContractAddress: string
|
|
472
|
-
space?: string
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
export interface GetMetaTxnNonceReturn {
|
|
476
|
-
nonce: string
|
|
477
|
-
}
|
|
478
|
-
export interface GetMetaTxnReceiptArgs {
|
|
479
|
-
metaTxID: string
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export interface GetMetaTxnReceiptReturn {
|
|
483
|
-
receipt: MetaTxnReceipt
|
|
484
|
-
}
|
|
485
|
-
export interface SimulateArgs {
|
|
486
|
-
wallet: string
|
|
487
|
-
transactions: string
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
export interface SimulateReturn {
|
|
491
|
-
results: Array<SimulateResult>
|
|
492
|
-
}
|
|
493
|
-
export interface SimulateV3Args {
|
|
494
|
-
wallet: string
|
|
495
|
-
calls: string
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
export interface SimulateV3Return {
|
|
499
|
-
results: Array<SimulateV3Result>
|
|
500
|
-
}
|
|
501
|
-
export interface UpdateMetaTxnGasLimitsArgs {
|
|
502
|
-
walletAddress: string
|
|
503
|
-
walletConfig: any
|
|
504
|
-
payload: string
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
export interface UpdateMetaTxnGasLimitsReturn {
|
|
508
|
-
payload: string
|
|
509
|
-
}
|
|
510
|
-
export interface FeeTokensArgs {
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
export interface FeeTokensReturn {
|
|
514
|
-
isFeeRequired: boolean
|
|
515
|
-
tokens: Array<FeeToken>
|
|
516
|
-
}
|
|
517
|
-
export interface FeeOptionsArgs {
|
|
518
|
-
wallet: string
|
|
519
|
-
to: string
|
|
520
|
-
data: string
|
|
521
|
-
simulate?: boolean
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
export interface FeeOptionsReturn {
|
|
525
|
-
options: Array<FeeOption>
|
|
526
|
-
sponsored: boolean
|
|
527
|
-
quote?: string
|
|
528
|
-
}
|
|
529
|
-
export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
530
|
-
walletConfig: any
|
|
531
|
-
payload: string
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
export interface GetMetaTxnNetworkFeeOptionsReturn {
|
|
535
|
-
options: Array<FeeOption>
|
|
536
|
-
}
|
|
537
|
-
export interface GetMetaTransactionsArgs {
|
|
538
|
-
projectId: number
|
|
539
|
-
page?: Page
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
export interface GetMetaTransactionsReturn {
|
|
543
|
-
page: Page
|
|
544
|
-
transactions: Array<MetaTxnLog>
|
|
545
|
-
}
|
|
546
|
-
export interface GetTransactionCostArgs {
|
|
547
|
-
projectId: number
|
|
548
|
-
from: string
|
|
549
|
-
to: string
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
export interface GetTransactionCostReturn {
|
|
553
|
-
cost: number
|
|
554
|
-
}
|
|
555
|
-
export interface SentTransactionsArgs {
|
|
556
|
-
filter?: SentTransactionsFilter
|
|
557
|
-
page?: Page
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
export interface SentTransactionsReturn {
|
|
561
|
-
page: Page
|
|
562
|
-
transactions: Array<Transaction>
|
|
563
|
-
}
|
|
564
|
-
export interface PendingTransactionsArgs {
|
|
565
|
-
page?: Page
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
export interface PendingTransactionsReturn {
|
|
569
|
-
page: Page
|
|
570
|
-
transactions: Array<Transaction>
|
|
571
|
-
}
|
|
572
|
-
export interface GetGasTankArgs {
|
|
573
|
-
id: number
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
export interface GetGasTankReturn {
|
|
577
|
-
gasTank: GasTank
|
|
578
|
-
}
|
|
579
|
-
export interface AddGasTankArgs {
|
|
580
|
-
name: string
|
|
581
|
-
feeMarkupFactor: number
|
|
582
|
-
unlimited?: boolean
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
export interface AddGasTankReturn {
|
|
586
|
-
status: boolean
|
|
587
|
-
gasTank: GasTank
|
|
588
|
-
}
|
|
589
|
-
export interface UpdateGasTankArgs {
|
|
590
|
-
id: number
|
|
591
|
-
name?: string
|
|
592
|
-
feeMarkupFactor?: number
|
|
593
|
-
unlimited?: boolean
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
export interface UpdateGasTankReturn {
|
|
597
|
-
status: boolean
|
|
598
|
-
gasTank: GasTank
|
|
599
|
-
}
|
|
600
|
-
export interface NextGasTankBalanceAdjustmentNonceArgs {
|
|
601
|
-
id: number
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
export interface NextGasTankBalanceAdjustmentNonceReturn {
|
|
605
|
-
nonce: number
|
|
606
|
-
}
|
|
607
|
-
export interface AdjustGasTankBalanceArgs {
|
|
608
|
-
id: number
|
|
609
|
-
nonce: number
|
|
610
|
-
amount: number
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
export interface AdjustGasTankBalanceReturn {
|
|
614
|
-
status: boolean
|
|
615
|
-
adjustment: GasTankBalanceAdjustment
|
|
616
|
-
}
|
|
617
|
-
export interface GetGasTankBalanceAdjustmentArgs {
|
|
618
|
-
id: number
|
|
619
|
-
nonce: number
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
export interface GetGasTankBalanceAdjustmentReturn {
|
|
623
|
-
adjustment: GasTankBalanceAdjustment
|
|
624
|
-
}
|
|
625
|
-
export interface ListGasTankBalanceAdjustmentsArgs {
|
|
626
|
-
id: number
|
|
627
|
-
page?: Page
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
export interface ListGasTankBalanceAdjustmentsReturn {
|
|
631
|
-
page: Page
|
|
632
|
-
adjustments: Array<GasTankBalanceAdjustment>
|
|
633
|
-
}
|
|
634
|
-
export interface ListGasSponsorsArgs {
|
|
635
|
-
projectId: number
|
|
636
|
-
page?: Page
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
export interface ListGasSponsorsReturn {
|
|
640
|
-
page: Page
|
|
641
|
-
gasSponsors: Array<GasSponsor>
|
|
642
|
-
}
|
|
643
|
-
export interface GetGasSponsorArgs {
|
|
644
|
-
projectId: number
|
|
645
|
-
id: number
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
export interface GetGasSponsorReturn {
|
|
649
|
-
gasSponsor: GasSponsor
|
|
650
|
-
}
|
|
651
|
-
export interface AddGasSponsorArgs {
|
|
652
|
-
projectId: number
|
|
653
|
-
address: string
|
|
654
|
-
name?: string
|
|
655
|
-
active?: boolean
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
export interface AddGasSponsorReturn {
|
|
659
|
-
status: boolean
|
|
660
|
-
gasSponsor: GasSponsor
|
|
661
|
-
}
|
|
662
|
-
export interface UpdateGasSponsorArgs {
|
|
663
|
-
projectId: number
|
|
664
|
-
id: number
|
|
665
|
-
name?: string
|
|
666
|
-
active?: boolean
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
export interface UpdateGasSponsorReturn {
|
|
670
|
-
status: boolean
|
|
671
|
-
gasSponsor: GasSponsor
|
|
672
|
-
}
|
|
673
|
-
export interface RemoveGasSponsorArgs {
|
|
674
|
-
projectId: number
|
|
675
|
-
id: number
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
export interface RemoveGasSponsorReturn {
|
|
679
|
-
status: boolean
|
|
680
|
-
}
|
|
681
|
-
export interface AddressGasSponsorsArgs {
|
|
682
|
-
address: string
|
|
683
|
-
page?: Page
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
export interface AddressGasSponsorsReturn {
|
|
687
|
-
page: Page
|
|
688
|
-
gasSponsors: Array<GasSponsor>
|
|
689
|
-
}
|
|
690
|
-
export interface GetProjectBalanceArgs {
|
|
691
|
-
projectId: number
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
export interface GetProjectBalanceReturn {
|
|
695
|
-
balance: number
|
|
696
|
-
}
|
|
697
|
-
export interface AdjustProjectBalanceArgs {
|
|
698
|
-
projectId: number
|
|
699
|
-
amount: number
|
|
700
|
-
identifier: string
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
export interface AdjustProjectBalanceReturn {
|
|
704
|
-
balance: number
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
//
|
|
710
|
-
// Client
|
|
711
|
-
//
|
|
712
|
-
export class Relayer implements Relayer {
|
|
713
|
-
protected hostname: string
|
|
714
|
-
protected fetch: Fetch
|
|
715
|
-
protected path = '/rpc/Relayer/'
|
|
716
|
-
|
|
717
|
-
constructor(hostname: string, fetch: Fetch) {
|
|
718
|
-
this.hostname = hostname.replace(/\/*$/, '')
|
|
719
|
-
this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init)
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
private url(name: string): string {
|
|
723
|
-
return this.hostname + this.path + name
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
ping = (headers?: object, signal?: AbortSignal): Promise<PingReturn> => {
|
|
727
|
-
return this.fetch(
|
|
728
|
-
this.url('Ping'),
|
|
729
|
-
createHTTPRequest({}, headers, signal)
|
|
730
|
-
).then((res) => {
|
|
731
|
-
return buildResponse(res).then(_data => {
|
|
732
|
-
return {
|
|
733
|
-
status: <boolean>(_data.status),
|
|
734
|
-
}
|
|
735
|
-
})
|
|
736
|
-
}, (error) => {
|
|
737
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
738
|
-
})
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
version = (headers?: object, signal?: AbortSignal): Promise<VersionReturn> => {
|
|
742
|
-
return this.fetch(
|
|
743
|
-
this.url('Version'),
|
|
744
|
-
createHTTPRequest({}, headers, signal)
|
|
745
|
-
).then((res) => {
|
|
746
|
-
return buildResponse(res).then(_data => {
|
|
747
|
-
return {
|
|
748
|
-
version: <Version>(_data.version),
|
|
749
|
-
}
|
|
750
|
-
})
|
|
751
|
-
}, (error) => {
|
|
752
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
753
|
-
})
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn> => {
|
|
757
|
-
return this.fetch(
|
|
758
|
-
this.url('RuntimeStatus'),
|
|
759
|
-
createHTTPRequest({}, headers, signal)
|
|
760
|
-
).then((res) => {
|
|
761
|
-
return buildResponse(res).then(_data => {
|
|
762
|
-
return {
|
|
763
|
-
status: <RuntimeStatus>(_data.status),
|
|
764
|
-
}
|
|
765
|
-
})
|
|
766
|
-
}, (error) => {
|
|
767
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
768
|
-
})
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
getSequenceContext = (headers?: object, signal?: AbortSignal): Promise<GetSequenceContextReturn> => {
|
|
772
|
-
return this.fetch(
|
|
773
|
-
this.url('GetSequenceContext'),
|
|
774
|
-
createHTTPRequest({}, headers, signal)
|
|
775
|
-
).then((res) => {
|
|
776
|
-
return buildResponse(res).then(_data => {
|
|
777
|
-
return {
|
|
778
|
-
data: <SequenceContext>(_data.data),
|
|
779
|
-
}
|
|
780
|
-
})
|
|
781
|
-
}, (error) => {
|
|
782
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
783
|
-
})
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
getChainID = (headers?: object, signal?: AbortSignal): Promise<GetChainIDReturn> => {
|
|
787
|
-
return this.fetch(
|
|
788
|
-
this.url('GetChainID'),
|
|
789
|
-
createHTTPRequest({}, headers, signal)
|
|
790
|
-
).then((res) => {
|
|
791
|
-
return buildResponse(res).then(_data => {
|
|
792
|
-
return {
|
|
793
|
-
chainID: <number>(_data.chainID),
|
|
794
|
-
}
|
|
795
|
-
})
|
|
796
|
-
}, (error) => {
|
|
797
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
798
|
-
})
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
sendMetaTxn = (args: SendMetaTxnArgs, headers?: object, signal?: AbortSignal): Promise<SendMetaTxnReturn> => {
|
|
802
|
-
return this.fetch(
|
|
803
|
-
this.url('SendMetaTxn'),
|
|
804
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
805
|
-
return buildResponse(res).then(_data => {
|
|
806
|
-
return {
|
|
807
|
-
status: <boolean>(_data.status),
|
|
808
|
-
txnHash: <string>(_data.txnHash),
|
|
809
|
-
}
|
|
810
|
-
})
|
|
811
|
-
}, (error) => {
|
|
812
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
813
|
-
})
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
getMetaTxnNonce = (args: GetMetaTxnNonceArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnNonceReturn> => {
|
|
817
|
-
return this.fetch(
|
|
818
|
-
this.url('GetMetaTxnNonce'),
|
|
819
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
820
|
-
return buildResponse(res).then(_data => {
|
|
821
|
-
return {
|
|
822
|
-
nonce: <string>(_data.nonce),
|
|
823
|
-
}
|
|
824
|
-
})
|
|
825
|
-
}, (error) => {
|
|
826
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
827
|
-
})
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
getMetaTxnReceipt = (args: GetMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnReceiptReturn> => {
|
|
831
|
-
return this.fetch(
|
|
832
|
-
this.url('GetMetaTxnReceipt'),
|
|
833
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
834
|
-
return buildResponse(res).then(_data => {
|
|
835
|
-
return {
|
|
836
|
-
receipt: <MetaTxnReceipt>(_data.receipt),
|
|
837
|
-
}
|
|
838
|
-
})
|
|
839
|
-
}, (error) => {
|
|
840
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
841
|
-
})
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
simulate = (args: SimulateArgs, headers?: object, signal?: AbortSignal): Promise<SimulateReturn> => {
|
|
845
|
-
return this.fetch(
|
|
846
|
-
this.url('Simulate'),
|
|
847
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
848
|
-
return buildResponse(res).then(_data => {
|
|
849
|
-
return {
|
|
850
|
-
results: <Array<SimulateResult>>(_data.results),
|
|
851
|
-
}
|
|
852
|
-
})
|
|
853
|
-
}, (error) => {
|
|
854
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
855
|
-
})
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
simulateV3 = (args: SimulateV3Args, headers?: object, signal?: AbortSignal): Promise<SimulateV3Return> => {
|
|
859
|
-
return this.fetch(
|
|
860
|
-
this.url('SimulateV3'),
|
|
861
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
862
|
-
return buildResponse(res).then(_data => {
|
|
863
|
-
return {
|
|
864
|
-
results: <Array<SimulateV3Result>>(_data.results),
|
|
865
|
-
}
|
|
866
|
-
})
|
|
867
|
-
}, (error) => {
|
|
868
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
869
|
-
})
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
updateMetaTxnGasLimits = (args: UpdateMetaTxnGasLimitsArgs, headers?: object, signal?: AbortSignal): Promise<UpdateMetaTxnGasLimitsReturn> => {
|
|
873
|
-
return this.fetch(
|
|
874
|
-
this.url('UpdateMetaTxnGasLimits'),
|
|
875
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
876
|
-
return buildResponse(res).then(_data => {
|
|
877
|
-
return {
|
|
878
|
-
payload: <string>(_data.payload),
|
|
879
|
-
}
|
|
880
|
-
})
|
|
881
|
-
}, (error) => {
|
|
882
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
883
|
-
})
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
feeTokens = (headers?: object, signal?: AbortSignal): Promise<FeeTokensReturn> => {
|
|
887
|
-
return this.fetch(
|
|
888
|
-
this.url('FeeTokens'),
|
|
889
|
-
createHTTPRequest({}, headers, signal)
|
|
890
|
-
).then((res) => {
|
|
891
|
-
return buildResponse(res).then(_data => {
|
|
892
|
-
return {
|
|
893
|
-
isFeeRequired: <boolean>(_data.isFeeRequired),
|
|
894
|
-
tokens: <Array<FeeToken>>(_data.tokens),
|
|
895
|
-
}
|
|
896
|
-
})
|
|
897
|
-
}, (error) => {
|
|
898
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
899
|
-
})
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
feeOptions = (args: FeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<FeeOptionsReturn> => {
|
|
903
|
-
return this.fetch(
|
|
904
|
-
this.url('FeeOptions'),
|
|
905
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
906
|
-
return buildResponse(res).then(_data => {
|
|
907
|
-
return {
|
|
908
|
-
options: <Array<FeeOption>>(_data.options),
|
|
909
|
-
sponsored: <boolean>(_data.sponsored),
|
|
910
|
-
quote: <string>(_data.quote),
|
|
911
|
-
}
|
|
912
|
-
})
|
|
913
|
-
}, (error) => {
|
|
914
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
915
|
-
})
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
getMetaTxnNetworkFeeOptions = (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTxnNetworkFeeOptionsReturn> => {
|
|
919
|
-
return this.fetch(
|
|
920
|
-
this.url('GetMetaTxnNetworkFeeOptions'),
|
|
921
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
922
|
-
return buildResponse(res).then(_data => {
|
|
923
|
-
return {
|
|
924
|
-
options: <Array<FeeOption>>(_data.options),
|
|
925
|
-
}
|
|
926
|
-
})
|
|
927
|
-
}, (error) => {
|
|
928
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
929
|
-
})
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
getMetaTransactions = (args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTransactionsReturn> => {
|
|
933
|
-
return this.fetch(
|
|
934
|
-
this.url('GetMetaTransactions'),
|
|
935
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
936
|
-
return buildResponse(res).then(_data => {
|
|
937
|
-
return {
|
|
938
|
-
page: <Page>(_data.page),
|
|
939
|
-
transactions: <Array<MetaTxnLog>>(_data.transactions),
|
|
940
|
-
}
|
|
941
|
-
})
|
|
942
|
-
}, (error) => {
|
|
943
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
944
|
-
})
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
getTransactionCost = (args: GetTransactionCostArgs, headers?: object, signal?: AbortSignal): Promise<GetTransactionCostReturn> => {
|
|
948
|
-
return this.fetch(
|
|
949
|
-
this.url('GetTransactionCost'),
|
|
950
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
951
|
-
return buildResponse(res).then(_data => {
|
|
952
|
-
return {
|
|
953
|
-
cost: <number>(_data.cost),
|
|
954
|
-
}
|
|
955
|
-
})
|
|
956
|
-
}, (error) => {
|
|
957
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
958
|
-
})
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
sentTransactions = (args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn> => {
|
|
962
|
-
return this.fetch(
|
|
963
|
-
this.url('SentTransactions'),
|
|
964
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
965
|
-
return buildResponse(res).then(_data => {
|
|
966
|
-
return {
|
|
967
|
-
page: <Page>(_data.page),
|
|
968
|
-
transactions: <Array<Transaction>>(_data.transactions),
|
|
969
|
-
}
|
|
970
|
-
})
|
|
971
|
-
}, (error) => {
|
|
972
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
973
|
-
})
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
pendingTransactions = (args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<PendingTransactionsReturn> => {
|
|
977
|
-
return this.fetch(
|
|
978
|
-
this.url('PendingTransactions'),
|
|
979
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
980
|
-
return buildResponse(res).then(_data => {
|
|
981
|
-
return {
|
|
982
|
-
page: <Page>(_data.page),
|
|
983
|
-
transactions: <Array<Transaction>>(_data.transactions),
|
|
984
|
-
}
|
|
985
|
-
})
|
|
986
|
-
}, (error) => {
|
|
987
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
988
|
-
})
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
getGasTank = (args: GetGasTankArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankReturn> => {
|
|
992
|
-
return this.fetch(
|
|
993
|
-
this.url('GetGasTank'),
|
|
994
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
995
|
-
return buildResponse(res).then(_data => {
|
|
996
|
-
return {
|
|
997
|
-
gasTank: <GasTank>(_data.gasTank),
|
|
998
|
-
}
|
|
999
|
-
})
|
|
1000
|
-
}, (error) => {
|
|
1001
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1002
|
-
})
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
addGasTank = (args: AddGasTankArgs, headers?: object, signal?: AbortSignal): Promise<AddGasTankReturn> => {
|
|
1006
|
-
return this.fetch(
|
|
1007
|
-
this.url('AddGasTank'),
|
|
1008
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1009
|
-
return buildResponse(res).then(_data => {
|
|
1010
|
-
return {
|
|
1011
|
-
status: <boolean>(_data.status),
|
|
1012
|
-
gasTank: <GasTank>(_data.gasTank),
|
|
1013
|
-
}
|
|
1014
|
-
})
|
|
1015
|
-
}, (error) => {
|
|
1016
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1017
|
-
})
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
updateGasTank = (args: UpdateGasTankArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasTankReturn> => {
|
|
1021
|
-
return this.fetch(
|
|
1022
|
-
this.url('UpdateGasTank'),
|
|
1023
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1024
|
-
return buildResponse(res).then(_data => {
|
|
1025
|
-
return {
|
|
1026
|
-
status: <boolean>(_data.status),
|
|
1027
|
-
gasTank: <GasTank>(_data.gasTank),
|
|
1028
|
-
}
|
|
1029
|
-
})
|
|
1030
|
-
}, (error) => {
|
|
1031
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1032
|
-
})
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
nextGasTankBalanceAdjustmentNonce = (args: NextGasTankBalanceAdjustmentNonceArgs, headers?: object, signal?: AbortSignal): Promise<NextGasTankBalanceAdjustmentNonceReturn> => {
|
|
1036
|
-
return this.fetch(
|
|
1037
|
-
this.url('NextGasTankBalanceAdjustmentNonce'),
|
|
1038
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1039
|
-
return buildResponse(res).then(_data => {
|
|
1040
|
-
return {
|
|
1041
|
-
nonce: <number>(_data.nonce),
|
|
1042
|
-
}
|
|
1043
|
-
})
|
|
1044
|
-
}, (error) => {
|
|
1045
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1046
|
-
})
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
adjustGasTankBalance = (args: AdjustGasTankBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustGasTankBalanceReturn> => {
|
|
1050
|
-
return this.fetch(
|
|
1051
|
-
this.url('AdjustGasTankBalance'),
|
|
1052
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1053
|
-
return buildResponse(res).then(_data => {
|
|
1054
|
-
return {
|
|
1055
|
-
status: <boolean>(_data.status),
|
|
1056
|
-
adjustment: <GasTankBalanceAdjustment>(_data.adjustment),
|
|
1057
|
-
}
|
|
1058
|
-
})
|
|
1059
|
-
}, (error) => {
|
|
1060
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1061
|
-
})
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
getGasTankBalanceAdjustment = (args: GetGasTankBalanceAdjustmentArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankBalanceAdjustmentReturn> => {
|
|
1065
|
-
return this.fetch(
|
|
1066
|
-
this.url('GetGasTankBalanceAdjustment'),
|
|
1067
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1068
|
-
return buildResponse(res).then(_data => {
|
|
1069
|
-
return {
|
|
1070
|
-
adjustment: <GasTankBalanceAdjustment>(_data.adjustment),
|
|
1071
|
-
}
|
|
1072
|
-
})
|
|
1073
|
-
}, (error) => {
|
|
1074
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1075
|
-
})
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
listGasTankBalanceAdjustments = (args: ListGasTankBalanceAdjustmentsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasTankBalanceAdjustmentsReturn> => {
|
|
1079
|
-
return this.fetch(
|
|
1080
|
-
this.url('ListGasTankBalanceAdjustments'),
|
|
1081
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1082
|
-
return buildResponse(res).then(_data => {
|
|
1083
|
-
return {
|
|
1084
|
-
page: <Page>(_data.page),
|
|
1085
|
-
adjustments: <Array<GasTankBalanceAdjustment>>(_data.adjustments),
|
|
1086
|
-
}
|
|
1087
|
-
})
|
|
1088
|
-
}, (error) => {
|
|
1089
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1090
|
-
})
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
listGasSponsors = (args: ListGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasSponsorsReturn> => {
|
|
1094
|
-
return this.fetch(
|
|
1095
|
-
this.url('ListGasSponsors'),
|
|
1096
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1097
|
-
return buildResponse(res).then(_data => {
|
|
1098
|
-
return {
|
|
1099
|
-
page: <Page>(_data.page),
|
|
1100
|
-
gasSponsors: <Array<GasSponsor>>(_data.gasSponsors),
|
|
1101
|
-
}
|
|
1102
|
-
})
|
|
1103
|
-
}, (error) => {
|
|
1104
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1105
|
-
})
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
getGasSponsor = (args: GetGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<GetGasSponsorReturn> => {
|
|
1109
|
-
return this.fetch(
|
|
1110
|
-
this.url('GetGasSponsor'),
|
|
1111
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1112
|
-
return buildResponse(res).then(_data => {
|
|
1113
|
-
return {
|
|
1114
|
-
gasSponsor: <GasSponsor>(_data.gasSponsor),
|
|
1115
|
-
}
|
|
1116
|
-
})
|
|
1117
|
-
}, (error) => {
|
|
1118
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1119
|
-
})
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
addGasSponsor = (args: AddGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<AddGasSponsorReturn> => {
|
|
1123
|
-
return this.fetch(
|
|
1124
|
-
this.url('AddGasSponsor'),
|
|
1125
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1126
|
-
return buildResponse(res).then(_data => {
|
|
1127
|
-
return {
|
|
1128
|
-
status: <boolean>(_data.status),
|
|
1129
|
-
gasSponsor: <GasSponsor>(_data.gasSponsor),
|
|
1130
|
-
}
|
|
1131
|
-
})
|
|
1132
|
-
}, (error) => {
|
|
1133
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1134
|
-
})
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
updateGasSponsor = (args: UpdateGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasSponsorReturn> => {
|
|
1138
|
-
return this.fetch(
|
|
1139
|
-
this.url('UpdateGasSponsor'),
|
|
1140
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1141
|
-
return buildResponse(res).then(_data => {
|
|
1142
|
-
return {
|
|
1143
|
-
status: <boolean>(_data.status),
|
|
1144
|
-
gasSponsor: <GasSponsor>(_data.gasSponsor),
|
|
1145
|
-
}
|
|
1146
|
-
})
|
|
1147
|
-
}, (error) => {
|
|
1148
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1149
|
-
})
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
removeGasSponsor = (args: RemoveGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<RemoveGasSponsorReturn> => {
|
|
1153
|
-
return this.fetch(
|
|
1154
|
-
this.url('RemoveGasSponsor'),
|
|
1155
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1156
|
-
return buildResponse(res).then(_data => {
|
|
1157
|
-
return {
|
|
1158
|
-
status: <boolean>(_data.status),
|
|
1159
|
-
}
|
|
1160
|
-
})
|
|
1161
|
-
}, (error) => {
|
|
1162
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1163
|
-
})
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
addressGasSponsors = (args: AddressGasSponsorsArgs, headers?: object, signal?: AbortSignal): Promise<AddressGasSponsorsReturn> => {
|
|
1167
|
-
return this.fetch(
|
|
1168
|
-
this.url('AddressGasSponsors'),
|
|
1169
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1170
|
-
return buildResponse(res).then(_data => {
|
|
1171
|
-
return {
|
|
1172
|
-
page: <Page>(_data.page),
|
|
1173
|
-
gasSponsors: <Array<GasSponsor>>(_data.gasSponsors),
|
|
1174
|
-
}
|
|
1175
|
-
})
|
|
1176
|
-
}, (error) => {
|
|
1177
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1178
|
-
})
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
getProjectBalance = (args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn> => {
|
|
1182
|
-
return this.fetch(
|
|
1183
|
-
this.url('GetProjectBalance'),
|
|
1184
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1185
|
-
return buildResponse(res).then(_data => {
|
|
1186
|
-
return {
|
|
1187
|
-
balance: <number>(_data.balance),
|
|
1188
|
-
}
|
|
1189
|
-
})
|
|
1190
|
-
}, (error) => {
|
|
1191
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1192
|
-
})
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
adjustProjectBalance = (args: AdjustProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustProjectBalanceReturn> => {
|
|
1196
|
-
return this.fetch(
|
|
1197
|
-
this.url('AdjustProjectBalance'),
|
|
1198
|
-
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1199
|
-
return buildResponse(res).then(_data => {
|
|
1200
|
-
return {
|
|
1201
|
-
balance: <number>(_data.balance),
|
|
1202
|
-
}
|
|
1203
|
-
})
|
|
1204
|
-
}, (error) => {
|
|
1205
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1206
|
-
})
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
1212
|
-
const reqHeaders: {[key: string]: string} = { ...headers, 'Content-Type': 'application/json' }
|
|
1213
|
-
reqHeaders[WebrpcHeader] = WebrpcHeaderValue
|
|
1214
|
-
|
|
1215
|
-
return {
|
|
1216
|
-
method: 'POST',
|
|
1217
|
-
headers: reqHeaders,
|
|
1218
|
-
body: JSON.stringify(body || {}),
|
|
1219
|
-
signal
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
const buildResponse = (res: Response): Promise<any> => {
|
|
1224
|
-
return res.text().then(text => {
|
|
1225
|
-
let data
|
|
1226
|
-
try {
|
|
1227
|
-
data = JSON.parse(text)
|
|
1228
|
-
} catch(error) {
|
|
1229
|
-
let message = ''
|
|
1230
|
-
if (error instanceof Error) {
|
|
1231
|
-
message = error.message
|
|
1232
|
-
}
|
|
1233
|
-
throw WebrpcBadResponseError.new({
|
|
1234
|
-
status: res.status,
|
|
1235
|
-
cause: `JSON.parse(): ${message}: response text: ${text}`},
|
|
1236
|
-
)
|
|
1237
|
-
}
|
|
1238
|
-
if (!res.ok) {
|
|
1239
|
-
const code: number = (typeof data.code === 'number') ? data.code : 0
|
|
1240
|
-
throw (webrpcErrorByCode[code] || WebrpcError).new(data)
|
|
1241
|
-
}
|
|
1242
|
-
return data
|
|
1243
|
-
})
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
//
|
|
1247
|
-
// Errors
|
|
1248
|
-
//
|
|
1249
|
-
|
|
1250
|
-
export class WebrpcError extends Error {
|
|
1251
|
-
name: string
|
|
1252
|
-
code: number
|
|
1253
|
-
message: string
|
|
1254
|
-
status: number
|
|
1255
|
-
cause?: string
|
|
1256
|
-
|
|
1257
|
-
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
|
|
1258
|
-
msg: string
|
|
1259
|
-
|
|
1260
|
-
constructor(name: string, code: number, message: string, status: number, cause?: string) {
|
|
1261
|
-
super(message)
|
|
1262
|
-
this.name = name || 'WebrpcError'
|
|
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
|
|
1268
|
-
Object.setPrototypeOf(this, WebrpcError.prototype)
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
static new(payload: any): WebrpcError {
|
|
1272
|
-
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause)
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
// Webrpc errors
|
|
1277
|
-
|
|
1278
|
-
export class WebrpcEndpointError extends WebrpcError {
|
|
1279
|
-
constructor(
|
|
1280
|
-
name: string = 'WebrpcEndpoint',
|
|
1281
|
-
code: number = 0,
|
|
1282
|
-
message: string = `endpoint error`,
|
|
1283
|
-
status: number = 0,
|
|
1284
|
-
cause?: string
|
|
1285
|
-
) {
|
|
1286
|
-
super(name, code, message, status, cause)
|
|
1287
|
-
Object.setPrototypeOf(this, WebrpcEndpointError.prototype)
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
export class WebrpcRequestFailedError extends WebrpcError {
|
|
1292
|
-
constructor(
|
|
1293
|
-
name: string = 'WebrpcRequestFailed',
|
|
1294
|
-
code: number = -1,
|
|
1295
|
-
message: string = `request failed`,
|
|
1296
|
-
status: number = 0,
|
|
1297
|
-
cause?: string
|
|
1298
|
-
) {
|
|
1299
|
-
super(name, code, message, status, cause)
|
|
1300
|
-
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype)
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
export class WebrpcBadRouteError extends WebrpcError {
|
|
1305
|
-
constructor(
|
|
1306
|
-
name: string = 'WebrpcBadRoute',
|
|
1307
|
-
code: number = -2,
|
|
1308
|
-
message: string = `bad route`,
|
|
1309
|
-
status: number = 0,
|
|
1310
|
-
cause?: string
|
|
1311
|
-
) {
|
|
1312
|
-
super(name, code, message, status, cause)
|
|
1313
|
-
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype)
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
export class WebrpcBadMethodError extends WebrpcError {
|
|
1318
|
-
constructor(
|
|
1319
|
-
name: string = 'WebrpcBadMethod',
|
|
1320
|
-
code: number = -3,
|
|
1321
|
-
message: string = `bad method`,
|
|
1322
|
-
status: number = 0,
|
|
1323
|
-
cause?: string
|
|
1324
|
-
) {
|
|
1325
|
-
super(name, code, message, status, cause)
|
|
1326
|
-
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype)
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
export class WebrpcBadRequestError extends WebrpcError {
|
|
1331
|
-
constructor(
|
|
1332
|
-
name: string = 'WebrpcBadRequest',
|
|
1333
|
-
code: number = -4,
|
|
1334
|
-
message: string = `bad request`,
|
|
1335
|
-
status: number = 0,
|
|
1336
|
-
cause?: string
|
|
1337
|
-
) {
|
|
1338
|
-
super(name, code, message, status, cause)
|
|
1339
|
-
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype)
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
export class WebrpcBadResponseError extends WebrpcError {
|
|
1344
|
-
constructor(
|
|
1345
|
-
name: string = 'WebrpcBadResponse',
|
|
1346
|
-
code: number = -5,
|
|
1347
|
-
message: string = `bad response`,
|
|
1348
|
-
status: number = 0,
|
|
1349
|
-
cause?: string
|
|
1350
|
-
) {
|
|
1351
|
-
super(name, code, message, status, cause)
|
|
1352
|
-
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype)
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
export class WebrpcServerPanicError extends WebrpcError {
|
|
1357
|
-
constructor(
|
|
1358
|
-
name: string = 'WebrpcServerPanic',
|
|
1359
|
-
code: number = -6,
|
|
1360
|
-
message: string = `server panic`,
|
|
1361
|
-
status: number = 0,
|
|
1362
|
-
cause?: string
|
|
1363
|
-
) {
|
|
1364
|
-
super(name, code, message, status, cause)
|
|
1365
|
-
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype)
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
export class WebrpcInternalErrorError extends WebrpcError {
|
|
1370
|
-
constructor(
|
|
1371
|
-
name: string = 'WebrpcInternalError',
|
|
1372
|
-
code: number = -7,
|
|
1373
|
-
message: string = `internal error`,
|
|
1374
|
-
status: number = 0,
|
|
1375
|
-
cause?: string
|
|
1376
|
-
) {
|
|
1377
|
-
super(name, code, message, status, cause)
|
|
1378
|
-
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype)
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
export class WebrpcClientDisconnectedError extends WebrpcError {
|
|
1383
|
-
constructor(
|
|
1384
|
-
name: string = 'WebrpcClientDisconnected',
|
|
1385
|
-
code: number = -8,
|
|
1386
|
-
message: string = `client disconnected`,
|
|
1387
|
-
status: number = 0,
|
|
1388
|
-
cause?: string
|
|
1389
|
-
) {
|
|
1390
|
-
super(name, code, message, status, cause)
|
|
1391
|
-
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype)
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
export class WebrpcStreamLostError extends WebrpcError {
|
|
1396
|
-
constructor(
|
|
1397
|
-
name: string = 'WebrpcStreamLost',
|
|
1398
|
-
code: number = -9,
|
|
1399
|
-
message: string = `stream lost`,
|
|
1400
|
-
status: number = 0,
|
|
1401
|
-
cause?: string
|
|
1402
|
-
) {
|
|
1403
|
-
super(name, code, message, status, cause)
|
|
1404
|
-
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype)
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
export class WebrpcStreamFinishedError extends WebrpcError {
|
|
1409
|
-
constructor(
|
|
1410
|
-
name: string = 'WebrpcStreamFinished',
|
|
1411
|
-
code: number = -10,
|
|
1412
|
-
message: string = `stream finished`,
|
|
1413
|
-
status: number = 0,
|
|
1414
|
-
cause?: string
|
|
1415
|
-
) {
|
|
1416
|
-
super(name, code, message, status, cause)
|
|
1417
|
-
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype)
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
// Schema errors
|
|
1423
|
-
|
|
1424
|
-
export class UnauthorizedError extends WebrpcError {
|
|
1425
|
-
constructor(
|
|
1426
|
-
name: string = 'Unauthorized',
|
|
1427
|
-
code: number = 1000,
|
|
1428
|
-
message: string = `Unauthorized access`,
|
|
1429
|
-
status: number = 0,
|
|
1430
|
-
cause?: string
|
|
1431
|
-
) {
|
|
1432
|
-
super(name, code, message, status, cause)
|
|
1433
|
-
Object.setPrototypeOf(this, UnauthorizedError.prototype)
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
export class PermissionDeniedError extends WebrpcError {
|
|
1438
|
-
constructor(
|
|
1439
|
-
name: string = 'PermissionDenied',
|
|
1440
|
-
code: number = 1001,
|
|
1441
|
-
message: string = `Permission denied`,
|
|
1442
|
-
status: number = 0,
|
|
1443
|
-
cause?: string
|
|
1444
|
-
) {
|
|
1445
|
-
super(name, code, message, status, cause)
|
|
1446
|
-
Object.setPrototypeOf(this, PermissionDeniedError.prototype)
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
export class SessionExpiredError extends WebrpcError {
|
|
1451
|
-
constructor(
|
|
1452
|
-
name: string = 'SessionExpired',
|
|
1453
|
-
code: number = 1002,
|
|
1454
|
-
message: string = `Session expired`,
|
|
1455
|
-
status: number = 0,
|
|
1456
|
-
cause?: string
|
|
1457
|
-
) {
|
|
1458
|
-
super(name, code, message, status, cause)
|
|
1459
|
-
Object.setPrototypeOf(this, SessionExpiredError.prototype)
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
export class MethodNotFoundError extends WebrpcError {
|
|
1464
|
-
constructor(
|
|
1465
|
-
name: string = 'MethodNotFound',
|
|
1466
|
-
code: number = 1003,
|
|
1467
|
-
message: string = `Method not found`,
|
|
1468
|
-
status: number = 0,
|
|
1469
|
-
cause?: string
|
|
1470
|
-
) {
|
|
1471
|
-
super(name, code, message, status, cause)
|
|
1472
|
-
Object.setPrototypeOf(this, MethodNotFoundError.prototype)
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
export class RequestConflictError extends WebrpcError {
|
|
1477
|
-
constructor(
|
|
1478
|
-
name: string = 'RequestConflict',
|
|
1479
|
-
code: number = 1004,
|
|
1480
|
-
message: string = `Conflict with target resource`,
|
|
1481
|
-
status: number = 0,
|
|
1482
|
-
cause?: string
|
|
1483
|
-
) {
|
|
1484
|
-
super(name, code, message, status, cause)
|
|
1485
|
-
Object.setPrototypeOf(this, RequestConflictError.prototype)
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
export class AbortedError extends WebrpcError {
|
|
1490
|
-
constructor(
|
|
1491
|
-
name: string = 'Aborted',
|
|
1492
|
-
code: number = 1005,
|
|
1493
|
-
message: string = `Request aborted`,
|
|
1494
|
-
status: number = 0,
|
|
1495
|
-
cause?: string
|
|
1496
|
-
) {
|
|
1497
|
-
super(name, code, message, status, cause)
|
|
1498
|
-
Object.setPrototypeOf(this, AbortedError.prototype)
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
export class GeoblockedError extends WebrpcError {
|
|
1503
|
-
constructor(
|
|
1504
|
-
name: string = 'Geoblocked',
|
|
1505
|
-
code: number = 1006,
|
|
1506
|
-
message: string = `Geoblocked region`,
|
|
1507
|
-
status: number = 0,
|
|
1508
|
-
cause?: string
|
|
1509
|
-
) {
|
|
1510
|
-
super(name, code, message, status, cause)
|
|
1511
|
-
Object.setPrototypeOf(this, GeoblockedError.prototype)
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
export class RateLimitedError extends WebrpcError {
|
|
1516
|
-
constructor(
|
|
1517
|
-
name: string = 'RateLimited',
|
|
1518
|
-
code: number = 1007,
|
|
1519
|
-
message: string = `Rate-limited. Please slow down.`,
|
|
1520
|
-
status: number = 0,
|
|
1521
|
-
cause?: string
|
|
1522
|
-
) {
|
|
1523
|
-
super(name, code, message, status, cause)
|
|
1524
|
-
Object.setPrototypeOf(this, RateLimitedError.prototype)
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
export class ProjectNotFoundError extends WebrpcError {
|
|
1529
|
-
constructor(
|
|
1530
|
-
name: string = 'ProjectNotFound',
|
|
1531
|
-
code: number = 1008,
|
|
1532
|
-
message: string = `Project not found`,
|
|
1533
|
-
status: number = 0,
|
|
1534
|
-
cause?: string
|
|
1535
|
-
) {
|
|
1536
|
-
super(name, code, message, status, cause)
|
|
1537
|
-
Object.setPrototypeOf(this, ProjectNotFoundError.prototype)
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
export class AccessKeyNotFoundError extends WebrpcError {
|
|
1542
|
-
constructor(
|
|
1543
|
-
name: string = 'AccessKeyNotFound',
|
|
1544
|
-
code: number = 1101,
|
|
1545
|
-
message: string = `Access key not found`,
|
|
1546
|
-
status: number = 0,
|
|
1547
|
-
cause?: string
|
|
1548
|
-
) {
|
|
1549
|
-
super(name, code, message, status, cause)
|
|
1550
|
-
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype)
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
export class AccessKeyMismatchError extends WebrpcError {
|
|
1555
|
-
constructor(
|
|
1556
|
-
name: string = 'AccessKeyMismatch',
|
|
1557
|
-
code: number = 1102,
|
|
1558
|
-
message: string = `Access key mismatch`,
|
|
1559
|
-
status: number = 0,
|
|
1560
|
-
cause?: string
|
|
1561
|
-
) {
|
|
1562
|
-
super(name, code, message, status, cause)
|
|
1563
|
-
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype)
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
export class InvalidOriginError extends WebrpcError {
|
|
1568
|
-
constructor(
|
|
1569
|
-
name: string = 'InvalidOrigin',
|
|
1570
|
-
code: number = 1103,
|
|
1571
|
-
message: string = `Invalid origin for Access Key`,
|
|
1572
|
-
status: number = 0,
|
|
1573
|
-
cause?: string
|
|
1574
|
-
) {
|
|
1575
|
-
super(name, code, message, status, cause)
|
|
1576
|
-
Object.setPrototypeOf(this, InvalidOriginError.prototype)
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
export class InvalidServiceError extends WebrpcError {
|
|
1581
|
-
constructor(
|
|
1582
|
-
name: string = 'InvalidService',
|
|
1583
|
-
code: number = 1104,
|
|
1584
|
-
message: string = `Service not enabled for Access key`,
|
|
1585
|
-
status: number = 0,
|
|
1586
|
-
cause?: string
|
|
1587
|
-
) {
|
|
1588
|
-
super(name, code, message, status, cause)
|
|
1589
|
-
Object.setPrototypeOf(this, InvalidServiceError.prototype)
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
export class UnauthorizedUserError extends WebrpcError {
|
|
1594
|
-
constructor(
|
|
1595
|
-
name: string = 'UnauthorizedUser',
|
|
1596
|
-
code: number = 1105,
|
|
1597
|
-
message: string = `Unauthorized user`,
|
|
1598
|
-
status: number = 0,
|
|
1599
|
-
cause?: string
|
|
1600
|
-
) {
|
|
1601
|
-
super(name, code, message, status, cause)
|
|
1602
|
-
Object.setPrototypeOf(this, UnauthorizedUserError.prototype)
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
export class QuotaExceededError extends WebrpcError {
|
|
1607
|
-
constructor(
|
|
1608
|
-
name: string = 'QuotaExceeded',
|
|
1609
|
-
code: number = 1200,
|
|
1610
|
-
message: string = `Quota request exceeded`,
|
|
1611
|
-
status: number = 0,
|
|
1612
|
-
cause?: string
|
|
1613
|
-
) {
|
|
1614
|
-
super(name, code, message, status, cause)
|
|
1615
|
-
Object.setPrototypeOf(this, QuotaExceededError.prototype)
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
export class QuotaRateLimitError extends WebrpcError {
|
|
1620
|
-
constructor(
|
|
1621
|
-
name: string = 'QuotaRateLimit',
|
|
1622
|
-
code: number = 1201,
|
|
1623
|
-
message: string = `Quota rate limit exceeded`,
|
|
1624
|
-
status: number = 0,
|
|
1625
|
-
cause?: string
|
|
1626
|
-
) {
|
|
1627
|
-
super(name, code, message, status, cause)
|
|
1628
|
-
Object.setPrototypeOf(this, QuotaRateLimitError.prototype)
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
export class NoDefaultKeyError extends WebrpcError {
|
|
1633
|
-
constructor(
|
|
1634
|
-
name: string = 'NoDefaultKey',
|
|
1635
|
-
code: number = 1300,
|
|
1636
|
-
message: string = `No default access key found`,
|
|
1637
|
-
status: number = 0,
|
|
1638
|
-
cause?: string
|
|
1639
|
-
) {
|
|
1640
|
-
super(name, code, message, status, cause)
|
|
1641
|
-
Object.setPrototypeOf(this, NoDefaultKeyError.prototype)
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
export class MaxAccessKeysError extends WebrpcError {
|
|
1646
|
-
constructor(
|
|
1647
|
-
name: string = 'MaxAccessKeys',
|
|
1648
|
-
code: number = 1301,
|
|
1649
|
-
message: string = `Access keys limit reached`,
|
|
1650
|
-
status: number = 0,
|
|
1651
|
-
cause?: string
|
|
1652
|
-
) {
|
|
1653
|
-
super(name, code, message, status, cause)
|
|
1654
|
-
Object.setPrototypeOf(this, MaxAccessKeysError.prototype)
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
export class AtLeastOneKeyError extends WebrpcError {
|
|
1659
|
-
constructor(
|
|
1660
|
-
name: string = 'AtLeastOneKey',
|
|
1661
|
-
code: number = 1302,
|
|
1662
|
-
message: string = `You need at least one Access Key`,
|
|
1663
|
-
status: number = 0,
|
|
1664
|
-
cause?: string
|
|
1665
|
-
) {
|
|
1666
|
-
super(name, code, message, status, cause)
|
|
1667
|
-
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype)
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
export class TimeoutError extends WebrpcError {
|
|
1672
|
-
constructor(
|
|
1673
|
-
name: string = 'Timeout',
|
|
1674
|
-
code: number = 1900,
|
|
1675
|
-
message: string = `Request timed out`,
|
|
1676
|
-
status: number = 0,
|
|
1677
|
-
cause?: string
|
|
1678
|
-
) {
|
|
1679
|
-
super(name, code, message, status, cause)
|
|
1680
|
-
Object.setPrototypeOf(this, TimeoutError.prototype)
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
export class InvalidArgumentError extends WebrpcError {
|
|
1685
|
-
constructor(
|
|
1686
|
-
name: string = 'InvalidArgument',
|
|
1687
|
-
code: number = 2001,
|
|
1688
|
-
message: string = `Invalid argument`,
|
|
1689
|
-
status: number = 0,
|
|
1690
|
-
cause?: string
|
|
1691
|
-
) {
|
|
1692
|
-
super(name, code, message, status, cause)
|
|
1693
|
-
Object.setPrototypeOf(this, InvalidArgumentError.prototype)
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
export class UnavailableError extends WebrpcError {
|
|
1698
|
-
constructor(
|
|
1699
|
-
name: string = 'Unavailable',
|
|
1700
|
-
code: number = 2002,
|
|
1701
|
-
message: string = `Unavailable resource`,
|
|
1702
|
-
status: number = 0,
|
|
1703
|
-
cause?: string
|
|
1704
|
-
) {
|
|
1705
|
-
super(name, code, message, status, cause)
|
|
1706
|
-
Object.setPrototypeOf(this, UnavailableError.prototype)
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
export class QueryFailedError extends WebrpcError {
|
|
1711
|
-
constructor(
|
|
1712
|
-
name: string = 'QueryFailed',
|
|
1713
|
-
code: number = 2003,
|
|
1714
|
-
message: string = `Query failed`,
|
|
1715
|
-
status: number = 0,
|
|
1716
|
-
cause?: string
|
|
1717
|
-
) {
|
|
1718
|
-
super(name, code, message, status, cause)
|
|
1719
|
-
Object.setPrototypeOf(this, QueryFailedError.prototype)
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
export class NotFoundError extends WebrpcError {
|
|
1724
|
-
constructor(
|
|
1725
|
-
name: string = 'NotFound',
|
|
1726
|
-
code: number = 3000,
|
|
1727
|
-
message: string = `Resource not found`,
|
|
1728
|
-
status: number = 0,
|
|
1729
|
-
cause?: string
|
|
1730
|
-
) {
|
|
1731
|
-
super(name, code, message, status, cause)
|
|
1732
|
-
Object.setPrototypeOf(this, NotFoundError.prototype)
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
export class InsufficientFeeError extends WebrpcError {
|
|
1737
|
-
constructor(
|
|
1738
|
-
name: string = 'InsufficientFee',
|
|
1739
|
-
code: number = 3004,
|
|
1740
|
-
message: string = `Insufficient fee`,
|
|
1741
|
-
status: number = 0,
|
|
1742
|
-
cause?: string
|
|
1743
|
-
) {
|
|
1744
|
-
super(name, code, message, status, cause)
|
|
1745
|
-
Object.setPrototypeOf(this, InsufficientFeeError.prototype)
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
export class NotEnoughBalanceError extends WebrpcError {
|
|
1750
|
-
constructor(
|
|
1751
|
-
name: string = 'NotEnoughBalance',
|
|
1752
|
-
code: number = 3005,
|
|
1753
|
-
message: string = `Not enough balance`,
|
|
1754
|
-
status: number = 0,
|
|
1755
|
-
cause?: string
|
|
1756
|
-
) {
|
|
1757
|
-
super(name, code, message, status, cause)
|
|
1758
|
-
Object.setPrototypeOf(this, NotEnoughBalanceError.prototype)
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
export class SimulationFailedError extends WebrpcError {
|
|
1763
|
-
constructor(
|
|
1764
|
-
name: string = 'SimulationFailed',
|
|
1765
|
-
code: number = 3006,
|
|
1766
|
-
message: string = `Simulation failed`,
|
|
1767
|
-
status: number = 0,
|
|
1768
|
-
cause?: string
|
|
1769
|
-
) {
|
|
1770
|
-
super(name, code, message, status, cause)
|
|
1771
|
-
Object.setPrototypeOf(this, SimulationFailedError.prototype)
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
export enum errors {
|
|
1777
|
-
WebrpcEndpoint = 'WebrpcEndpoint',
|
|
1778
|
-
WebrpcRequestFailed = 'WebrpcRequestFailed',
|
|
1779
|
-
WebrpcBadRoute = 'WebrpcBadRoute',
|
|
1780
|
-
WebrpcBadMethod = 'WebrpcBadMethod',
|
|
1781
|
-
WebrpcBadRequest = 'WebrpcBadRequest',
|
|
1782
|
-
WebrpcBadResponse = 'WebrpcBadResponse',
|
|
1783
|
-
WebrpcServerPanic = 'WebrpcServerPanic',
|
|
1784
|
-
WebrpcInternalError = 'WebrpcInternalError',
|
|
1785
|
-
WebrpcClientDisconnected = 'WebrpcClientDisconnected',
|
|
1786
|
-
WebrpcStreamLost = 'WebrpcStreamLost',
|
|
1787
|
-
WebrpcStreamFinished = 'WebrpcStreamFinished',
|
|
1788
|
-
Unauthorized = 'Unauthorized',
|
|
1789
|
-
PermissionDenied = 'PermissionDenied',
|
|
1790
|
-
SessionExpired = 'SessionExpired',
|
|
1791
|
-
MethodNotFound = 'MethodNotFound',
|
|
1792
|
-
RequestConflict = 'RequestConflict',
|
|
1793
|
-
Aborted = 'Aborted',
|
|
1794
|
-
Geoblocked = 'Geoblocked',
|
|
1795
|
-
RateLimited = 'RateLimited',
|
|
1796
|
-
ProjectNotFound = 'ProjectNotFound',
|
|
1797
|
-
AccessKeyNotFound = 'AccessKeyNotFound',
|
|
1798
|
-
AccessKeyMismatch = 'AccessKeyMismatch',
|
|
1799
|
-
InvalidOrigin = 'InvalidOrigin',
|
|
1800
|
-
InvalidService = 'InvalidService',
|
|
1801
|
-
UnauthorizedUser = 'UnauthorizedUser',
|
|
1802
|
-
QuotaExceeded = 'QuotaExceeded',
|
|
1803
|
-
QuotaRateLimit = 'QuotaRateLimit',
|
|
1804
|
-
NoDefaultKey = 'NoDefaultKey',
|
|
1805
|
-
MaxAccessKeys = 'MaxAccessKeys',
|
|
1806
|
-
AtLeastOneKey = 'AtLeastOneKey',
|
|
1807
|
-
Timeout = 'Timeout',
|
|
1808
|
-
InvalidArgument = 'InvalidArgument',
|
|
1809
|
-
Unavailable = 'Unavailable',
|
|
1810
|
-
QueryFailed = 'QueryFailed',
|
|
1811
|
-
NotFound = 'NotFound',
|
|
1812
|
-
InsufficientFee = 'InsufficientFee',
|
|
1813
|
-
NotEnoughBalance = 'NotEnoughBalance',
|
|
1814
|
-
SimulationFailed = 'SimulationFailed',
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
export enum WebrpcErrorCodes {
|
|
1818
|
-
WebrpcEndpoint = 0,
|
|
1819
|
-
WebrpcRequestFailed = -1,
|
|
1820
|
-
WebrpcBadRoute = -2,
|
|
1821
|
-
WebrpcBadMethod = -3,
|
|
1822
|
-
WebrpcBadRequest = -4,
|
|
1823
|
-
WebrpcBadResponse = -5,
|
|
1824
|
-
WebrpcServerPanic = -6,
|
|
1825
|
-
WebrpcInternalError = -7,
|
|
1826
|
-
WebrpcClientDisconnected = -8,
|
|
1827
|
-
WebrpcStreamLost = -9,
|
|
1828
|
-
WebrpcStreamFinished = -10,
|
|
1829
|
-
Unauthorized = 1000,
|
|
1830
|
-
PermissionDenied = 1001,
|
|
1831
|
-
SessionExpired = 1002,
|
|
1832
|
-
MethodNotFound = 1003,
|
|
1833
|
-
RequestConflict = 1004,
|
|
1834
|
-
Aborted = 1005,
|
|
1835
|
-
Geoblocked = 1006,
|
|
1836
|
-
RateLimited = 1007,
|
|
1837
|
-
ProjectNotFound = 1008,
|
|
1838
|
-
AccessKeyNotFound = 1101,
|
|
1839
|
-
AccessKeyMismatch = 1102,
|
|
1840
|
-
InvalidOrigin = 1103,
|
|
1841
|
-
InvalidService = 1104,
|
|
1842
|
-
UnauthorizedUser = 1105,
|
|
1843
|
-
QuotaExceeded = 1200,
|
|
1844
|
-
QuotaRateLimit = 1201,
|
|
1845
|
-
NoDefaultKey = 1300,
|
|
1846
|
-
MaxAccessKeys = 1301,
|
|
1847
|
-
AtLeastOneKey = 1302,
|
|
1848
|
-
Timeout = 1900,
|
|
1849
|
-
InvalidArgument = 2001,
|
|
1850
|
-
Unavailable = 2002,
|
|
1851
|
-
QueryFailed = 2003,
|
|
1852
|
-
NotFound = 3000,
|
|
1853
|
-
InsufficientFee = 3004,
|
|
1854
|
-
NotEnoughBalance = 3005,
|
|
1855
|
-
SimulationFailed = 3006,
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
1859
|
-
[0]: WebrpcEndpointError,
|
|
1860
|
-
[-1]: WebrpcRequestFailedError,
|
|
1861
|
-
[-2]: WebrpcBadRouteError,
|
|
1862
|
-
[-3]: WebrpcBadMethodError,
|
|
1863
|
-
[-4]: WebrpcBadRequestError,
|
|
1864
|
-
[-5]: WebrpcBadResponseError,
|
|
1865
|
-
[-6]: WebrpcServerPanicError,
|
|
1866
|
-
[-7]: WebrpcInternalErrorError,
|
|
1867
|
-
[-8]: WebrpcClientDisconnectedError,
|
|
1868
|
-
[-9]: WebrpcStreamLostError,
|
|
1869
|
-
[-10]: WebrpcStreamFinishedError,
|
|
1870
|
-
[1000]: UnauthorizedError,
|
|
1871
|
-
[1001]: PermissionDeniedError,
|
|
1872
|
-
[1002]: SessionExpiredError,
|
|
1873
|
-
[1003]: MethodNotFoundError,
|
|
1874
|
-
[1004]: RequestConflictError,
|
|
1875
|
-
[1005]: AbortedError,
|
|
1876
|
-
[1006]: GeoblockedError,
|
|
1877
|
-
[1007]: RateLimitedError,
|
|
1878
|
-
[1008]: ProjectNotFoundError,
|
|
1879
|
-
[1101]: AccessKeyNotFoundError,
|
|
1880
|
-
[1102]: AccessKeyMismatchError,
|
|
1881
|
-
[1103]: InvalidOriginError,
|
|
1882
|
-
[1104]: InvalidServiceError,
|
|
1883
|
-
[1105]: UnauthorizedUserError,
|
|
1884
|
-
[1200]: QuotaExceededError,
|
|
1885
|
-
[1201]: QuotaRateLimitError,
|
|
1886
|
-
[1300]: NoDefaultKeyError,
|
|
1887
|
-
[1301]: MaxAccessKeysError,
|
|
1888
|
-
[1302]: AtLeastOneKeyError,
|
|
1889
|
-
[1900]: TimeoutError,
|
|
1890
|
-
[2001]: InvalidArgumentError,
|
|
1891
|
-
[2002]: UnavailableError,
|
|
1892
|
-
[2003]: QueryFailedError,
|
|
1893
|
-
[3000]: NotFoundError,
|
|
1894
|
-
[3004]: InsufficientFeeError,
|
|
1895
|
-
[3005]: NotEnoughBalanceError,
|
|
1896
|
-
[3006]: SimulationFailedError,
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
1900
|
-
|