ccxt 4.2.60 → 4.2.62
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/README.md +6 -5
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +11280 -3407
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/hyperliquid.js +9 -0
- package/dist/cjs/src/base/Exchange.js +22 -1
- package/dist/cjs/src/base/functions/encode.js +5 -0
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/bitfinex2.js +1 -1
- package/dist/cjs/src/bitget.js +74 -23
- package/dist/cjs/src/coinbase.js +108 -103
- package/dist/cjs/src/coinex.js +61 -1
- package/dist/cjs/src/hyperliquid.js +2035 -0
- package/dist/cjs/src/kraken.js +8 -2
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoinfutures.js +2 -2
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +2 -2
- package/dist/cjs/src/pro/bingx.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +158 -0
- package/dist/cjs/src/static_dependencies/ethers/address/address.js +144 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +407 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/address.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +28 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/array.js +176 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +52 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/null.js +30 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/number.js +60 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/string.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +68 -0
- package/dist/cjs/src/static_dependencies/ethers/fragments.js +614 -0
- package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +492 -0
- package/dist/cjs/src/static_dependencies/ethers/index.js +35 -0
- package/dist/cjs/src/static_dependencies/ethers/interface.js +44 -0
- package/dist/cjs/src/static_dependencies/ethers/typed.js +618 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +20 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/data.js +134 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +228 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/events.js +13 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +29 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/index.js +53 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +231 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +47 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +218 -0
- package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +292 -0
- package/dist/cjs/src/tokocrypto.js +22 -2
- package/dist/cjs/src/wazirx.js +308 -3
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/coinbase.d.ts +3 -3
- package/js/src/abstract/hyperliquid.d.ts +9 -0
- package/js/src/abstract/hyperliquid.js +11 -0
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +13 -1
- package/js/src/base/functions/encode.d.ts +2 -1
- package/js/src/base/functions/encode.js +5 -1
- package/js/src/bitfinex2.js +1 -1
- package/js/src/bitget.js +74 -23
- package/js/src/coinbase.js +108 -103
- package/js/src/coinex.d.ts +3 -1
- package/js/src/coinex.js +61 -1
- package/js/src/hyperliquid.d.ts +83 -0
- package/js/src/hyperliquid.js +2036 -0
- package/js/src/kraken.js +8 -2
- package/js/src/krakenfutures.d.ts +2 -1
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoinfutures.js +2 -2
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +2 -2
- package/js/src/pro/bingx.js +1 -0
- package/js/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
- package/js/src/static_dependencies/ethers/abi-coder.js +148 -0
- package/js/src/static_dependencies/ethers/address/address.d.ts +55 -0
- package/js/src/static_dependencies/ethers/address/address.js +162 -0
- package/js/src/static_dependencies/ethers/address/checks.d.ts +80 -0
- package/js/src/static_dependencies/ethers/address/checks.js +119 -0
- package/js/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
- package/js/src/static_dependencies/ethers/address/contract-address.js +73 -0
- package/js/src/static_dependencies/ethers/address/index.d.ts +48 -0
- package/js/src/static_dependencies/ethers/address/index.js +24 -0
- package/js/src/static_dependencies/ethers/bytes32.d.ts +14 -0
- package/js/src/static_dependencies/ethers/bytes32.js +45 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
- package/js/src/static_dependencies/ethers/coders/address.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/address.js +34 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.js +27 -0
- package/js/src/static_dependencies/ethers/coders/array.d.ts +24 -0
- package/js/src/static_dependencies/ethers/coders/array.js +162 -0
- package/js/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/boolean.js +26 -0
- package/js/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
- package/js/src/static_dependencies/ethers/coders/bytes.js +39 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
- package/js/src/static_dependencies/ethers/coders/null.d.ts +11 -0
- package/js/src/static_dependencies/ethers/coders/null.js +29 -0
- package/js/src/static_dependencies/ethers/coders/number.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/number.js +48 -0
- package/js/src/static_dependencies/ethers/coders/string.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/string.js +26 -0
- package/js/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/tuple.js +67 -0
- package/js/src/static_dependencies/ethers/fragments.d.ts +458 -0
- package/js/src/static_dependencies/ethers/fragments.js +1252 -0
- package/js/src/static_dependencies/ethers/hash/index.d.ts +10 -0
- package/js/src/static_dependencies/ethers/hash/index.js +15 -0
- package/js/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
- package/js/src/static_dependencies/ethers/hash/solidity.js +107 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.js +490 -0
- package/js/src/static_dependencies/ethers/index.d.ts +19 -0
- package/js/src/static_dependencies/ethers/index.js +22 -0
- package/js/src/static_dependencies/ethers/interface.d.ts +380 -0
- package/js/src/static_dependencies/ethers/interface.js +990 -0
- package/js/src/static_dependencies/ethers/typed.d.ts +569 -0
- package/js/src/static_dependencies/ethers/typed.js +608 -0
- package/js/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/base58.js +68 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.d.ts +3 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.js +24 -0
- package/js/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
- package/js/src/static_dependencies/ethers/utils/base64.js +58 -0
- package/js/src/static_dependencies/ethers/utils/data.d.ts +92 -0
- package/js/src/static_dependencies/ethers/utils/data.js +175 -0
- package/js/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
- package/js/src/static_dependencies/ethers/utils/errors.js +227 -0
- package/js/src/static_dependencies/ethers/utils/events.d.ts +76 -0
- package/js/src/static_dependencies/ethers/utils/events.js +52 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
- package/js/src/static_dependencies/ethers/utils/index.d.ts +30 -0
- package/js/src/static_dependencies/ethers/utils/index.js +38 -0
- package/js/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
- package/js/src/static_dependencies/ethers/utils/maths.js +220 -0
- package/js/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/properties.js +59 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
- package/js/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
- package/js/src/static_dependencies/ethers/utils/rlp.js +14 -0
- package/js/src/static_dependencies/ethers/utils/units.d.ts +23 -0
- package/js/src/static_dependencies/ethers/utils/units.js +88 -0
- package/js/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
- package/js/src/static_dependencies/ethers/utils/utf8.js +225 -0
- package/js/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
- package/js/src/static_dependencies/ethers/utils/uuid.js +35 -0
- package/js/src/static_dependencies/messagepack/msgpack.d.ts +2 -0
- package/js/src/static_dependencies/messagepack/msgpack.js +572 -0
- package/js/src/tokocrypto.js +22 -2
- package/js/src/wazirx.d.ts +12 -1
- package/js/src/wazirx.js +308 -3
- package/package.json +1 -1
- package/skip-tests.json +18 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All errors in ethers include properties to ensure they are both
|
|
3
|
+
* human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).
|
|
4
|
+
*
|
|
5
|
+
* The [[isError]] function can be used to check the error ``code`` and
|
|
6
|
+
* provide a type guard for the properties present on that error interface.
|
|
7
|
+
*
|
|
8
|
+
* @_section: api/utils/errors:Errors [about-errors]
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* An error may contain additional properties, but those must not
|
|
12
|
+
* conflict with any implicit properties.
|
|
13
|
+
*/
|
|
14
|
+
export declare type ErrorInfo<T> = Omit<T, "code" | "name" | "message" | "shortMessage"> & {
|
|
15
|
+
shortMessage?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* All errors emitted by ethers have an **ErrorCode** to help
|
|
19
|
+
* identify and coalesce errors to simplify programmatic analysis.
|
|
20
|
+
*
|
|
21
|
+
* Each **ErrorCode** is the %%code%% proerty of a coresponding
|
|
22
|
+
* [[EthersError]].
|
|
23
|
+
*
|
|
24
|
+
* **Generic Errors**
|
|
25
|
+
*
|
|
26
|
+
* **``"UNKNOWN_ERROR"``** - see [[UnknownError]]
|
|
27
|
+
*
|
|
28
|
+
* **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]]
|
|
29
|
+
*
|
|
30
|
+
* **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]]
|
|
31
|
+
*
|
|
32
|
+
* **``"NETWORK_ERROR"``** - see [[NetworkError]]
|
|
33
|
+
*
|
|
34
|
+
* **``"SERVER_ERROR"``** - see [[ServerError]]
|
|
35
|
+
*
|
|
36
|
+
* **``"TIMEOUT"``** - see [[TimeoutError]]
|
|
37
|
+
*
|
|
38
|
+
* **``"BAD_DATA"``** - see [[BadDataError]]
|
|
39
|
+
*
|
|
40
|
+
* **``"CANCELLED"``** - see [[CancelledError]]
|
|
41
|
+
*
|
|
42
|
+
* **Operational Errors**
|
|
43
|
+
*
|
|
44
|
+
* **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]]
|
|
45
|
+
*
|
|
46
|
+
* **``"NUMERIC_FAULT"``** - see [[NumericFaultError]]
|
|
47
|
+
*
|
|
48
|
+
* **Argument Errors**
|
|
49
|
+
*
|
|
50
|
+
* **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]]
|
|
51
|
+
*
|
|
52
|
+
* **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]]
|
|
53
|
+
*
|
|
54
|
+
* **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]]
|
|
55
|
+
*
|
|
56
|
+
* **``"VALUE_MISMATCH"``** - //unused//
|
|
57
|
+
*
|
|
58
|
+
* **Blockchain Errors**
|
|
59
|
+
*
|
|
60
|
+
* **``"CALL_EXCEPTION"``** - see [[CallExceptionError]]
|
|
61
|
+
*
|
|
62
|
+
* **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]]
|
|
63
|
+
*
|
|
64
|
+
* **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]]
|
|
65
|
+
*
|
|
66
|
+
* **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]]
|
|
67
|
+
*
|
|
68
|
+
* **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]]
|
|
69
|
+
*
|
|
70
|
+
* **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]]
|
|
71
|
+
*
|
|
72
|
+
* **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]]
|
|
73
|
+
*
|
|
74
|
+
* **User Interaction Errors**
|
|
75
|
+
*
|
|
76
|
+
* **``"ACTION_REJECTED"``** - see [[ActionRejectedError]]
|
|
77
|
+
*/
|
|
78
|
+
export declare type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED";
|
|
79
|
+
/**
|
|
80
|
+
* All errors in Ethers include properties to assist in
|
|
81
|
+
* machine-readable errors.
|
|
82
|
+
*/
|
|
83
|
+
export interface EthersError<T extends ErrorCode = ErrorCode> extends Error {
|
|
84
|
+
/**
|
|
85
|
+
* The string error code.
|
|
86
|
+
*/
|
|
87
|
+
code: ErrorCode;
|
|
88
|
+
/**
|
|
89
|
+
* A short message describing the error, with minimal additional
|
|
90
|
+
* details.
|
|
91
|
+
*/
|
|
92
|
+
shortMessage: string;
|
|
93
|
+
/**
|
|
94
|
+
* Additional info regarding the error that may be useful.
|
|
95
|
+
*
|
|
96
|
+
* This is generally helpful mostly for human-based debugging.
|
|
97
|
+
*/
|
|
98
|
+
info?: Record<string, any>;
|
|
99
|
+
/**
|
|
100
|
+
* Any related error.
|
|
101
|
+
*/
|
|
102
|
+
error?: Error;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* This Error is a catch-all for when there is no way for Ethers to
|
|
106
|
+
* know what the underlying problem is.
|
|
107
|
+
*/
|
|
108
|
+
export interface UnknownError extends EthersError<"UNKNOWN_ERROR"> {
|
|
109
|
+
[key: string]: any;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* This Error is mostly used as a stub for functionality that is
|
|
113
|
+
* intended for the future, but is currently not implemented.
|
|
114
|
+
*/
|
|
115
|
+
export interface NotImplementedError extends EthersError<"NOT_IMPLEMENTED"> {
|
|
116
|
+
/**
|
|
117
|
+
* The attempted operation.
|
|
118
|
+
*/
|
|
119
|
+
operation: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* This Error indicates that the attempted operation is not supported.
|
|
123
|
+
*
|
|
124
|
+
* This could range from a specific JSON-RPC end-point not supporting
|
|
125
|
+
* a feature to a specific configuration of an object prohibiting the
|
|
126
|
+
* operation.
|
|
127
|
+
*
|
|
128
|
+
* For example, a [[Wallet]] with no connected [[Provider]] is unable
|
|
129
|
+
* to send a transaction.
|
|
130
|
+
*/
|
|
131
|
+
export interface UnsupportedOperationError extends EthersError<"UNSUPPORTED_OPERATION"> {
|
|
132
|
+
/**
|
|
133
|
+
* The attempted operation.
|
|
134
|
+
*/
|
|
135
|
+
operation: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* This Error indicates a problem connecting to a network.
|
|
139
|
+
*/
|
|
140
|
+
export interface NetworkError extends EthersError<"NETWORK_ERROR"> {
|
|
141
|
+
/**
|
|
142
|
+
* The network event.
|
|
143
|
+
*/
|
|
144
|
+
event: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* This Error indicates there was a problem fetching a resource from
|
|
148
|
+
* a server.
|
|
149
|
+
*/
|
|
150
|
+
export interface ServerError extends EthersError<"SERVER_ERROR"> {
|
|
151
|
+
/**
|
|
152
|
+
* The requested resource.
|
|
153
|
+
*/
|
|
154
|
+
request: Record<any, any> | string;
|
|
155
|
+
/**
|
|
156
|
+
* The response received from the server, if available.
|
|
157
|
+
*/
|
|
158
|
+
response?: Record<any, any>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* This Error indicates that the timeout duration has expired and
|
|
162
|
+
* that the operation has been implicitly cancelled.
|
|
163
|
+
*
|
|
164
|
+
* The side-effect of the operation may still occur, as this
|
|
165
|
+
* generally means a request has been sent and there has simply
|
|
166
|
+
* been no response to indicate whether it was processed or not.
|
|
167
|
+
*/
|
|
168
|
+
export interface TimeoutError extends EthersError<"TIMEOUT"> {
|
|
169
|
+
/**
|
|
170
|
+
* The attempted operation.
|
|
171
|
+
*/
|
|
172
|
+
operation: string;
|
|
173
|
+
/**
|
|
174
|
+
* The reason.
|
|
175
|
+
*/
|
|
176
|
+
reason: string;
|
|
177
|
+
/**
|
|
178
|
+
* The resource request, if available.
|
|
179
|
+
*/
|
|
180
|
+
request?: Record<any, any>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* This Error indicates that a provided set of data cannot
|
|
184
|
+
* be correctly interpreted.
|
|
185
|
+
*/
|
|
186
|
+
export interface BadDataError extends EthersError<"BAD_DATA"> {
|
|
187
|
+
/**
|
|
188
|
+
* The data.
|
|
189
|
+
*/
|
|
190
|
+
value: any;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* This Error indicates that the operation was cancelled by a
|
|
194
|
+
* programmatic call, for example to ``cancel()``.
|
|
195
|
+
*/
|
|
196
|
+
export interface CancelledError extends EthersError<"CANCELLED"> {
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* This Error indicates an attempt was made to read outside the bounds
|
|
200
|
+
* of protected data.
|
|
201
|
+
*
|
|
202
|
+
* Most operations in Ethers are protected by bounds checks, to mitigate
|
|
203
|
+
* exploits when parsing data.
|
|
204
|
+
*/
|
|
205
|
+
export interface BufferOverrunError extends EthersError<"BUFFER_OVERRUN"> {
|
|
206
|
+
/**
|
|
207
|
+
* The buffer that was overrun.
|
|
208
|
+
*/
|
|
209
|
+
buffer: Uint8Array;
|
|
210
|
+
/**
|
|
211
|
+
* The length of the buffer.
|
|
212
|
+
*/
|
|
213
|
+
length: number;
|
|
214
|
+
/**
|
|
215
|
+
* The offset that was requested.
|
|
216
|
+
*/
|
|
217
|
+
offset: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* This Error indicates an operation which would result in incorrect
|
|
221
|
+
* arithmetic output has occurred.
|
|
222
|
+
*
|
|
223
|
+
* For example, trying to divide by zero or using a ``uint8`` to store
|
|
224
|
+
* a negative value.
|
|
225
|
+
*/
|
|
226
|
+
export interface NumericFaultError extends EthersError<"NUMERIC_FAULT"> {
|
|
227
|
+
/**
|
|
228
|
+
* The attempted operation.
|
|
229
|
+
*/
|
|
230
|
+
operation: string;
|
|
231
|
+
/**
|
|
232
|
+
* The fault reported.
|
|
233
|
+
*/
|
|
234
|
+
fault: string;
|
|
235
|
+
/**
|
|
236
|
+
* The value the operation was attempted against.
|
|
237
|
+
*/
|
|
238
|
+
value: any;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* This Error indicates an incorrect type or value was passed to
|
|
242
|
+
* a function or method.
|
|
243
|
+
*/
|
|
244
|
+
export interface InvalidArgumentError extends EthersError<"INVALID_ARGUMENT"> {
|
|
245
|
+
/**
|
|
246
|
+
* The name of the argument.
|
|
247
|
+
*/
|
|
248
|
+
argument: string;
|
|
249
|
+
/**
|
|
250
|
+
* The value that was provided.
|
|
251
|
+
*/
|
|
252
|
+
value: any;
|
|
253
|
+
info?: Record<string, any>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* This Error indicates there were too few arguments were provided.
|
|
257
|
+
*/
|
|
258
|
+
export interface MissingArgumentError extends EthersError<"MISSING_ARGUMENT"> {
|
|
259
|
+
/**
|
|
260
|
+
* The number of arguments received.
|
|
261
|
+
*/
|
|
262
|
+
count: number;
|
|
263
|
+
/**
|
|
264
|
+
* The number of arguments expected.
|
|
265
|
+
*/
|
|
266
|
+
expectedCount: number;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* This Error indicates too many arguments were provided.
|
|
270
|
+
*/
|
|
271
|
+
export interface UnexpectedArgumentError extends EthersError<"UNEXPECTED_ARGUMENT"> {
|
|
272
|
+
/**
|
|
273
|
+
* The number of arguments received.
|
|
274
|
+
*/
|
|
275
|
+
count: number;
|
|
276
|
+
/**
|
|
277
|
+
* The number of arguments expected.
|
|
278
|
+
*/
|
|
279
|
+
expectedCount: number;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The action that resulted in the call exception.
|
|
283
|
+
*/
|
|
284
|
+
export declare type CallExceptionAction = "call" | "estimateGas" | "getTransactionResult" | "sendTransaction" | "unknown";
|
|
285
|
+
/**
|
|
286
|
+
* The related transaction that caused the error.
|
|
287
|
+
*/
|
|
288
|
+
export declare type CallExceptionTransaction = {
|
|
289
|
+
to: null | string;
|
|
290
|
+
from?: string;
|
|
291
|
+
data: string;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* This **Error** indicates a transaction reverted.
|
|
295
|
+
*/
|
|
296
|
+
export interface CallExceptionError extends EthersError<"CALL_EXCEPTION"> {
|
|
297
|
+
/**
|
|
298
|
+
* The action being performed when the revert was encountered.
|
|
299
|
+
*/
|
|
300
|
+
action: CallExceptionAction;
|
|
301
|
+
/**
|
|
302
|
+
* The revert data returned.
|
|
303
|
+
*/
|
|
304
|
+
data: null | string;
|
|
305
|
+
/**
|
|
306
|
+
* A human-readable representation of data, if possible.
|
|
307
|
+
*/
|
|
308
|
+
reason: null | string;
|
|
309
|
+
/**
|
|
310
|
+
* The transaction that triggered the exception.
|
|
311
|
+
*/
|
|
312
|
+
transaction: CallExceptionTransaction;
|
|
313
|
+
/**
|
|
314
|
+
* The contract invocation details, if available.
|
|
315
|
+
*/
|
|
316
|
+
invocation: null | {
|
|
317
|
+
method: string;
|
|
318
|
+
signature: string;
|
|
319
|
+
args: Array<any>;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* The built-in or custom revert error, if available
|
|
323
|
+
*/
|
|
324
|
+
revert: null | {
|
|
325
|
+
signature: string;
|
|
326
|
+
name: string;
|
|
327
|
+
args: Array<any>;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* If the error occurred in a transaction that was mined
|
|
331
|
+
* (with a status of ``0``), this is the receipt.
|
|
332
|
+
*/
|
|
333
|
+
receipt?: Record<any, any>;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The sending account has insufficient funds to cover the
|
|
337
|
+
* entire transaction cost.
|
|
338
|
+
*/
|
|
339
|
+
export interface InsufficientFundsError extends EthersError<"INSUFFICIENT_FUNDS"> {
|
|
340
|
+
/**
|
|
341
|
+
* The transaction.
|
|
342
|
+
*/
|
|
343
|
+
transaction: Record<any, any>;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* The sending account has already used this nonce in a
|
|
347
|
+
* transaction that has been included.
|
|
348
|
+
*/
|
|
349
|
+
export interface NonceExpiredError extends EthersError<"NONCE_EXPIRED"> {
|
|
350
|
+
/**
|
|
351
|
+
* The transaction.
|
|
352
|
+
*/
|
|
353
|
+
transaction: Record<any, any>;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* A CCIP-read exception, which cannot be recovered from or
|
|
357
|
+
* be further processed.
|
|
358
|
+
*/
|
|
359
|
+
export interface OffchainFaultError extends EthersError<"OFFCHAIN_FAULT"> {
|
|
360
|
+
/**
|
|
361
|
+
* The transaction.
|
|
362
|
+
*/
|
|
363
|
+
transaction?: Record<any, any>;
|
|
364
|
+
/**
|
|
365
|
+
* The reason the CCIP-read failed.
|
|
366
|
+
*/
|
|
367
|
+
reason: string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* An attempt was made to replace a transaction, but with an
|
|
371
|
+
* insufficient additional fee to afford evicting the old
|
|
372
|
+
* transaction from the memory pool.
|
|
373
|
+
*/
|
|
374
|
+
export interface ReplacementUnderpricedError extends EthersError<"REPLACEMENT_UNDERPRICED"> {
|
|
375
|
+
/**
|
|
376
|
+
* The transaction.
|
|
377
|
+
*/
|
|
378
|
+
transaction: Record<any, any>;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* A pending transaction was replaced by another.
|
|
382
|
+
*/
|
|
383
|
+
export interface TransactionReplacedError extends EthersError<"TRANSACTION_REPLACED"> {
|
|
384
|
+
/**
|
|
385
|
+
* If the transaction was cancelled, such that the original
|
|
386
|
+
* effects of the transaction cannot be assured.
|
|
387
|
+
*/
|
|
388
|
+
cancelled: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* The reason the transaction was replaced.
|
|
391
|
+
*/
|
|
392
|
+
reason: "repriced" | "cancelled" | "replaced";
|
|
393
|
+
/**
|
|
394
|
+
* The hash of the replaced transaction.
|
|
395
|
+
*/
|
|
396
|
+
hash: string;
|
|
397
|
+
/**
|
|
398
|
+
* The transaction that replaced the transaction.
|
|
399
|
+
*/
|
|
400
|
+
replacement: Record<any, any>;
|
|
401
|
+
/**
|
|
402
|
+
* The receipt of the transaction that replace the transaction.
|
|
403
|
+
*/
|
|
404
|
+
receipt: Record<any, any>;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* This Error indicates an ENS name was used, but the name has not
|
|
408
|
+
* been configured.
|
|
409
|
+
*
|
|
410
|
+
* This could indicate an ENS name is unowned or that the current
|
|
411
|
+
* address being pointed to is the [[ZeroAddress]].
|
|
412
|
+
*/
|
|
413
|
+
export interface UnconfiguredNameError extends EthersError<"UNCONFIGURED_NAME"> {
|
|
414
|
+
/**
|
|
415
|
+
* The ENS name that was requested
|
|
416
|
+
*/
|
|
417
|
+
value: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* This Error indicates a request was rejected by the user.
|
|
421
|
+
*
|
|
422
|
+
* In most clients (such as MetaMask), when an operation requires user
|
|
423
|
+
* authorization (such as ``signer.sendTransaction``), the client
|
|
424
|
+
* presents a dialog box to the user. If the user denies the request
|
|
425
|
+
* this error is thrown.
|
|
426
|
+
*/
|
|
427
|
+
export interface ActionRejectedError extends EthersError<"ACTION_REJECTED"> {
|
|
428
|
+
/**
|
|
429
|
+
* The requested action.
|
|
430
|
+
*/
|
|
431
|
+
action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown";
|
|
432
|
+
/**
|
|
433
|
+
* The reason the action was rejected.
|
|
434
|
+
*
|
|
435
|
+
* If there is already a pending request, some clients may indicate
|
|
436
|
+
* there is already a ``"pending"`` action. This prevents an app
|
|
437
|
+
* from spamming the user.
|
|
438
|
+
*/
|
|
439
|
+
reason: "expired" | "rejected" | "pending";
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* A conditional type that transforms the [[ErrorCode]] T into
|
|
443
|
+
* its EthersError type.
|
|
444
|
+
*
|
|
445
|
+
* @flatworm-skip-docs
|
|
446
|
+
*/
|
|
447
|
+
export declare type CodedEthersError<T> = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never;
|
|
448
|
+
/**
|
|
449
|
+
* Returns true if the %%error%% matches an error thrown by ethers
|
|
450
|
+
* that matches the error %%code%%.
|
|
451
|
+
*
|
|
452
|
+
* In TypeScript environments, this can be used to check that %%error%%
|
|
453
|
+
* matches an EthersError type, which means the expected properties will
|
|
454
|
+
* be set.
|
|
455
|
+
*
|
|
456
|
+
* @See [ErrorCodes](api:ErrorCode)
|
|
457
|
+
* @example
|
|
458
|
+
* try {
|
|
459
|
+
* // code....
|
|
460
|
+
* } catch (e) {
|
|
461
|
+
* if (isError(e, "CALL_EXCEPTION")) {
|
|
462
|
+
* // The Type Guard has validated this object
|
|
463
|
+
* console.log(e.data);
|
|
464
|
+
* }
|
|
465
|
+
* }
|
|
466
|
+
*/
|
|
467
|
+
export declare function isError<K extends ErrorCode, T extends CodedEthersError<K>>(error: any, code: K): error is T;
|
|
468
|
+
/**
|
|
469
|
+
* Returns true if %%error%% is a [[CallExceptionError].
|
|
470
|
+
*/
|
|
471
|
+
export declare function isCallException(error: any): error is CallExceptionError;
|
|
472
|
+
/**
|
|
473
|
+
* Returns a new Error configured to the format ethers emits errors, with
|
|
474
|
+
* the %%message%%, [[api:ErrorCode]] %%code%% and additional properties
|
|
475
|
+
* for the corresponding EthersError.
|
|
476
|
+
*
|
|
477
|
+
* Each error in ethers includes the version of ethers, a
|
|
478
|
+
* machine-readable [[ErrorCode]], and depending on %%code%%, additional
|
|
479
|
+
* required properties. The error message will also include the %%message%%,
|
|
480
|
+
* ethers version, %%code%% and all additional properties, serialized.
|
|
481
|
+
*/
|
|
482
|
+
export declare function makeError<K extends ErrorCode, T extends CodedEthersError<K>>(message: string, code: K, info?: ErrorInfo<T>): T;
|
|
483
|
+
/**
|
|
484
|
+
* Throws an EthersError with %%message%%, %%code%% and additional error
|
|
485
|
+
* %%info%% when %%check%% is falsish..
|
|
486
|
+
*
|
|
487
|
+
* @see [[api:makeError]]
|
|
488
|
+
*/
|
|
489
|
+
export declare function assert<K extends ErrorCode, T extends CodedEthersError<K>>(check: unknown, message: string, code: K, info?: ErrorInfo<T>): asserts check;
|
|
490
|
+
/**
|
|
491
|
+
* A simple helper to simply ensuring provided arguments match expected
|
|
492
|
+
* constraints, throwing if not.
|
|
493
|
+
*
|
|
494
|
+
* In TypeScript environments, the %%check%% has been asserted true, so
|
|
495
|
+
* any further code does not need additional compile-time checks.
|
|
496
|
+
*/
|
|
497
|
+
export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check;
|
|
498
|
+
export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void;
|
|
499
|
+
/**
|
|
500
|
+
* Throws if the normalization %%form%% is not supported.
|
|
501
|
+
*/
|
|
502
|
+
export declare function assertNormalize(form: string): void;
|
|
503
|
+
/**
|
|
504
|
+
* Many classes use file-scoped values to guard the constructor,
|
|
505
|
+
* making it effectively private. This facilitates that pattern
|
|
506
|
+
* by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,
|
|
507
|
+
* throwing if not, indicating the %%className%% if provided.
|
|
508
|
+
*/
|
|
509
|
+
export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void;
|