viem 0.0.0 → 0.0.1-alpha.1
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/LICENSE +21 -0
- package/README.md +16 -0
- package/actions/package.json +4 -0
- package/chains/package.json +4 -0
- package/clients/package.json +4 -0
- package/dist/BaseError-7688f84e.d.ts +18 -0
- package/dist/actions/index.d.ts +8 -0
- package/dist/actions/index.js +123 -0
- package/dist/chains.d.ts +113 -0
- package/dist/chains.js +133 -0
- package/dist/chunk-LLYFXUSV.js +1098 -0
- package/dist/chunk-OQTFTQTO.js +277 -0
- package/dist/chunk-Z6LRV6XI.js +1978 -0
- package/dist/clients/index.d.ts +8 -0
- package/dist/clients/index.js +25 -0
- package/dist/createWalletClient-915223f3.d.ts +130 -0
- package/dist/eip1193-8f7c22ce.d.ts +987 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +290 -0
- package/dist/parseGwei-bbc055e4.d.ts +326 -0
- package/dist/rpc-3c0e3985.d.ts +98 -0
- package/dist/rpc-655c0ba4.d.ts +292 -0
- package/dist/transactionRequest-ade896ac.d.ts +44 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.js +154 -0
- package/dist/watchAsset-04ab8db5.d.ts +533 -0
- package/dist/webSocket-c6e0d26f.d.ts +88 -0
- package/dist/window.d.ts +9 -0
- package/dist/window.js +0 -0
- package/package.json +111 -7
- package/utils/package.json +4 -0
- package/window/package.json +4 -0
package/dist/index.d.ts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
export { C as CallArgs, a as CallResponse, b as CreateBlockFilterResponse, c as CreatePendingTransactionFilterResponse, D as DropTransactionArgs, E as EstimateGasArgs, d as EstimateGasResponse, G as GetBalanceArgs, e as GetBalanceResponse, f as GetBlockArgs, g as GetBlockNumberArgs, h as GetBlockNumberResponse, i as GetBlockResponse, j as GetBlockTransactionCountArgs, k as GetBlockTransactionCountResponse, l as GetFeeHistoryArgs, m as GetFeeHistoryResponse, n as GetFilterChangesArgs, o as GetFilterChangesResponse, p as GetFilterLogsArgs, q as GetFilterLogsResponse, r as GetGasPriceResponse, s as GetPermissionsResponse, t as GetTransactionArgs, u as GetTransactionConfirmationsArgs, v as GetTransactionConfirmationsResponse, w as GetTransactionCountArgs, x as GetTransactionCountResponse, z as GetTransactionReceiptArgs, A as GetTransactionReceiptResponse, y as GetTransactionResponse, I as ImpersonateAccountArgs, B as IncreaseTimeArgs, M as MineArgs, O as OnBlock, F as OnBlockNumber, H as OnBlockNumberResponse, J as OnBlockResponse, K as OnTransactions, L as OnTransactionsResponse, N as RequestPermissionsResponse, R as ResetArgs, P as RevertArgs, S as SendTransactionArgs, Q as SendTransactionResponse, T as SendUnsignedTransactionArgs, U as SendUnsignedTransactionResponse, V as SetBalanceArgs, W as SetBlockGasLimitArgs, $ as SetBlockTimestampIntervalArgs, X as SetCodeArgs, Y as SetCoinbaseArgs, Z as SetIntervalMiningArgs, _ as SetMinGasPriceArgs, a1 as SetNextBlockBaseFeePerGasArgs, a0 as SetNextBlockTimestampArgs, a2 as SetNonceArgs, a3 as SetStorageAtArgs, a4 as SignMessageArgs, a5 as SignMessageResponse, a6 as StopImpersonatingAccountArgs, a7 as SwitchChainArgs, a8 as UninstallFilterArgs, a9 as UninstallFilterResponse, aa as WaitForTransactionReceiptArgs, ab as WaitForTransactionReceiptResponse, ac as WatchAssetArgs, ad as WatchAssetResponse, ae as WatchBlockNumberArgs, af as WatchBlocksArgs, ag as WatchPendingTransactionsArgs, ah as addChain, ai as call, aj as createBlockFilter, ak as createPendingTransactionFilter, am as dropTransaction, al as estimateGas, an as getAccounts, ao as getAutomine, ap as getBalance, aq as getBlock, ar as getBlockNumber, as as getBlockTransactionCount, at as getChainId, au as getFeeHistory, av as getFilterChanges, aw as getFilterLogs, ax as getGasPrice, ay as getPermissions, az as getTransaction, aA as getTransactionConfirmations, aB as getTransactionCount, aC as getTransactionReceipt, aD as getTxpoolContent, aE as getTxpoolStatus, aF as impersonateAccount, aG as increaseTime, aH as inspectTxpool, aI as mine, aJ as removeBlockTimestampInterval, aL as requestAccounts, aM as requestPermissions, aK as reset, aN as revert, aO as sendTransaction, aP as sendUnsignedTransaction, aQ as setAutomine, aR as setBalance, aS as setBlockGasLimit, aT as setBlockTimestampInterval, aU as setCode, aV as setCoinbase, aW as setIntervalMining, aX as setLoggingEnabled, aY as setMinGasPrice, aZ as setNextBlockBaseFeePerGas, a_ as setNextBlockTimestamp, a$ as setNonce, b0 as setStorageAt, b1 as signMessage, b2 as snapshot, b3 as stopImpersonatingAccount, b4 as switchChain, b5 as uninstallFilter, b6 as waitForTransactionReceipt, b7 as watchAsset, b8 as watchBlockNumber, b9 as watchBlocks, ba as watchPendingTransactions } from './watchAsset-04ab8db5.js';
|
2
|
+
export { C as Client, a as ClientConfig, P as PublicClient, b as PublicClientConfig, T as TestClient, c as TestClientConfig, d as Transport, e as TransportConfig, W as WalletClient, f as WalletClientConfig, g as createClient, h as createPublicClient, i as createTestClient, j as createTransport, k as createWalletClient } from './createWalletClient-915223f3.js';
|
3
|
+
export { C as CustomTransport, a as CustomTransportConfig, F as FallbackTransport, b as FallbackTransportConfig, H as HttpTransport, c as HttpTransportConfig, U as UrlRequiredError, W as WebSocketTransport, d as WebSocketTransportConfig, e as custom, f as fallback, h as http, w as webSocket } from './webSocket-c6e0d26f.js';
|
4
|
+
export { a as AccessList, A as Address, B as Block, b as BlockIdentifier, c as BlockNumber, d as BlockTag, f as ByteArray, F as FeeHistory, h as FeeValues, i as FeeValuesEIP1559, j as FeeValuesLegacy, k as Hash, H as Hex, L as Log, R as RpcBlock, l as RpcBlockIdentifier, m as RpcBlockNumber, n as RpcFeeHistory, o as RpcFeeValues, p as RpcLog, q as RpcTransaction, r as RpcTransactionReceipt, s as RpcTransactionRequest, u as RpcUncle, D as Transaction, E as TransactionBase, G as TransactionEIP1559, I as TransactionEIP2930, J as TransactionLegacy, T as TransactionReceipt, v as TransactionRequest, x as TransactionRequestBase, y as TransactionRequestEIP1559, z as TransactionRequestEIP2930, C as TransactionRequestLegacy, U as Uncle, e as etherUnits, g as gweiUnits, t as transactionType, w as weiUnits } from './rpc-655c0ba4.js';
|
5
|
+
export { A as AbiDecodingDataSizeInvalidError, a as AbiEncodingArrayLengthMismatchError, b as AbiEncodingLengthMismatchError, E as EncodeRlpResponse, G as GetContractAddressOptions, d as GetCreate2AddressOptions, c as GetCreateAddressOptions, g as InternalRpcError, I as InvalidAbiDecodingTypeError, e as InvalidAbiEncodingTypeError, f as InvalidArrayError, h as InvalidInputRpcError, i as InvalidParamsRpcError, j as InvalidRequestRpcError, J as JsonRpcVersionUnsupportedError, L as LimitExceededRpcError, M as MethodNotFoundRpcError, k as MethodNotSupportedRpcError, P as ParseRpcError, R as ResourceNotFoundRpcError, l as ResourceUnavailableRpcError, m as RpcRequestError, T as TransactionRejectedRpcError, p as boolToBytes, q as boolToHex, r as bytesToBigint, s as bytesToBool, n as bytesToHex, t as bytesToNumber, o as bytesToString, u as decodeAbi, v as decodeBytes, w as decodeHex, x as decodeRlp, y as encodeAbi, z as encodeBytes, B as encodeHex, C as encodeRlp, Q as formatEther, a7 as formatGwei, a8 as formatUnit, D as getAddress, F as getContractAddress, K as getCreate2Address, H as getCreateAddress, N as getEventSignature, O as getFunctionSignature, X as hexToBigInt, Y as hexToBool, Z as hexToBytes, a9 as hexToNumber, _ as hexToString, S as isAddress, U as isAddressEqual, V as isBytes, W as isHex, $ as keccak256, a0 as numberToBytes, aa as numberToHex, a1 as pad, a2 as padBytes, a3 as padHex, a4 as parseEther, a5 as parseGwei, a6 as parseUnit, ab as size, ac as slice, ad as sliceBytes, ae as sliceHex, af as stringToBytes, ag as stringToHex, ah as trim } from './parseGwei-bbc055e4.js';
|
6
|
+
export { B as BaseError } from './BaseError-7688f84e.js';
|
7
|
+
export { F as FormattedBlock, a as FormattedTransaction, b as FormattedTransactionRequest, f as formatBlock, c as formatTransaction, d as formatTransactionRequest } from './transactionRequest-ade896ac.js';
|
8
|
+
export { H as HttpRequestError, R as RpcError, T as TimeoutError } from './rpc-3c0e3985.js';
|
9
|
+
import './chains.js';
|
10
|
+
import '@wagmi/chains';
|
11
|
+
import './eip1193-8f7c22ce.js';
|
12
|
+
import 'abitype';
|
package/dist/index.js
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
import {
|
2
|
+
addChain,
|
3
|
+
call,
|
4
|
+
createBlockFilter,
|
5
|
+
createPendingTransactionFilter,
|
6
|
+
dropTransaction,
|
7
|
+
estimateGas,
|
8
|
+
getAccounts,
|
9
|
+
getAutomine,
|
10
|
+
getBalance,
|
11
|
+
getBlock,
|
12
|
+
getBlockNumber,
|
13
|
+
getBlockTransactionCount,
|
14
|
+
getChainId,
|
15
|
+
getFeeHistory,
|
16
|
+
getFilterChanges,
|
17
|
+
getFilterLogs,
|
18
|
+
getGasPrice,
|
19
|
+
getPermissions,
|
20
|
+
getTransaction,
|
21
|
+
getTransactionConfirmations,
|
22
|
+
getTransactionCount,
|
23
|
+
getTransactionReceipt,
|
24
|
+
getTxpoolContent,
|
25
|
+
getTxpoolStatus,
|
26
|
+
impersonateAccount,
|
27
|
+
increaseTime,
|
28
|
+
inspectTxpool,
|
29
|
+
mine,
|
30
|
+
removeBlockTimestampInterval,
|
31
|
+
requestAccounts,
|
32
|
+
requestPermissions,
|
33
|
+
reset,
|
34
|
+
revert,
|
35
|
+
sendTransaction,
|
36
|
+
sendUnsignedTransaction,
|
37
|
+
setAutomine,
|
38
|
+
setBalance,
|
39
|
+
setBlockGasLimit,
|
40
|
+
setBlockTimestampInterval,
|
41
|
+
setCode,
|
42
|
+
setCoinbase,
|
43
|
+
setIntervalMining,
|
44
|
+
setLoggingEnabled,
|
45
|
+
setMinGasPrice,
|
46
|
+
setNextBlockBaseFeePerGas,
|
47
|
+
setNextBlockTimestamp,
|
48
|
+
setNonce,
|
49
|
+
setStorageAt,
|
50
|
+
signMessage,
|
51
|
+
snapshot,
|
52
|
+
stopImpersonatingAccount,
|
53
|
+
switchChain,
|
54
|
+
uninstallFilter,
|
55
|
+
waitForTransactionReceipt,
|
56
|
+
watchAsset,
|
57
|
+
watchBlockNumber,
|
58
|
+
watchBlocks,
|
59
|
+
watchPendingTransactions
|
60
|
+
} from "./chunk-LLYFXUSV.js";
|
61
|
+
import {
|
62
|
+
UrlRequiredError,
|
63
|
+
createClient,
|
64
|
+
createPublicClient,
|
65
|
+
createTestClient,
|
66
|
+
createTransport,
|
67
|
+
createWalletClient,
|
68
|
+
custom,
|
69
|
+
fallback,
|
70
|
+
http,
|
71
|
+
webSocket
|
72
|
+
} from "./chunk-OQTFTQTO.js";
|
73
|
+
import {
|
74
|
+
BaseError,
|
75
|
+
HttpRequestError,
|
76
|
+
InternalRpcError,
|
77
|
+
InvalidInputRpcError,
|
78
|
+
InvalidParamsRpcError,
|
79
|
+
InvalidRequestRpcError,
|
80
|
+
JsonRpcVersionUnsupportedError,
|
81
|
+
LimitExceededRpcError,
|
82
|
+
MethodNotFoundRpcError,
|
83
|
+
MethodNotSupportedRpcError,
|
84
|
+
ParseRpcError,
|
85
|
+
ResourceNotFoundRpcError,
|
86
|
+
ResourceUnavailableRpcError,
|
87
|
+
RpcError,
|
88
|
+
RpcRequestError,
|
89
|
+
TimeoutError,
|
90
|
+
TransactionRejectedRpcError,
|
91
|
+
boolToBytes,
|
92
|
+
boolToHex,
|
93
|
+
bytesToBigint,
|
94
|
+
bytesToBool,
|
95
|
+
bytesToHex,
|
96
|
+
bytesToNumber,
|
97
|
+
bytesToString,
|
98
|
+
decodeAbi,
|
99
|
+
decodeBytes,
|
100
|
+
decodeHex,
|
101
|
+
decodeRlp,
|
102
|
+
encodeAbi,
|
103
|
+
encodeBytes,
|
104
|
+
encodeHex,
|
105
|
+
encodeRlp,
|
106
|
+
etherUnits,
|
107
|
+
formatBlock,
|
108
|
+
formatEther,
|
109
|
+
formatGwei,
|
110
|
+
formatTransaction,
|
111
|
+
formatTransactionRequest,
|
112
|
+
formatUnit,
|
113
|
+
getAddress,
|
114
|
+
getContractAddress,
|
115
|
+
getCreate2Address,
|
116
|
+
getCreateAddress,
|
117
|
+
getEventSignature,
|
118
|
+
getFunctionSignature,
|
119
|
+
gweiUnits,
|
120
|
+
hexToBigInt,
|
121
|
+
hexToBool,
|
122
|
+
hexToBytes,
|
123
|
+
hexToNumber,
|
124
|
+
hexToString,
|
125
|
+
isAddress,
|
126
|
+
isAddressEqual,
|
127
|
+
isBytes,
|
128
|
+
isHex,
|
129
|
+
keccak256,
|
130
|
+
numberToBytes,
|
131
|
+
numberToHex,
|
132
|
+
pad,
|
133
|
+
padBytes,
|
134
|
+
padHex,
|
135
|
+
parseEther,
|
136
|
+
parseGwei,
|
137
|
+
parseUnit,
|
138
|
+
size,
|
139
|
+
slice,
|
140
|
+
sliceBytes,
|
141
|
+
sliceHex,
|
142
|
+
stringToBytes,
|
143
|
+
stringToHex,
|
144
|
+
transactionType,
|
145
|
+
trim,
|
146
|
+
weiUnits
|
147
|
+
} from "./chunk-Z6LRV6XI.js";
|
148
|
+
export {
|
149
|
+
BaseError,
|
150
|
+
HttpRequestError,
|
151
|
+
InternalRpcError,
|
152
|
+
InvalidInputRpcError,
|
153
|
+
InvalidParamsRpcError,
|
154
|
+
InvalidRequestRpcError,
|
155
|
+
JsonRpcVersionUnsupportedError,
|
156
|
+
LimitExceededRpcError,
|
157
|
+
MethodNotFoundRpcError,
|
158
|
+
MethodNotSupportedRpcError,
|
159
|
+
ParseRpcError,
|
160
|
+
ResourceNotFoundRpcError,
|
161
|
+
ResourceUnavailableRpcError,
|
162
|
+
RpcError,
|
163
|
+
RpcRequestError,
|
164
|
+
TimeoutError,
|
165
|
+
TransactionRejectedRpcError,
|
166
|
+
UrlRequiredError,
|
167
|
+
addChain,
|
168
|
+
boolToBytes,
|
169
|
+
boolToHex,
|
170
|
+
bytesToBigint,
|
171
|
+
bytesToBool,
|
172
|
+
bytesToHex,
|
173
|
+
bytesToNumber,
|
174
|
+
bytesToString,
|
175
|
+
call,
|
176
|
+
createBlockFilter,
|
177
|
+
createClient,
|
178
|
+
createPendingTransactionFilter,
|
179
|
+
createPublicClient,
|
180
|
+
createTestClient,
|
181
|
+
createTransport,
|
182
|
+
createWalletClient,
|
183
|
+
custom,
|
184
|
+
decodeAbi,
|
185
|
+
decodeBytes,
|
186
|
+
decodeHex,
|
187
|
+
decodeRlp,
|
188
|
+
dropTransaction,
|
189
|
+
encodeAbi,
|
190
|
+
encodeBytes,
|
191
|
+
encodeHex,
|
192
|
+
encodeRlp,
|
193
|
+
estimateGas,
|
194
|
+
etherUnits,
|
195
|
+
fallback,
|
196
|
+
formatBlock,
|
197
|
+
formatEther,
|
198
|
+
formatGwei,
|
199
|
+
formatTransaction,
|
200
|
+
formatTransactionRequest,
|
201
|
+
formatUnit,
|
202
|
+
getAccounts,
|
203
|
+
getAddress,
|
204
|
+
getAutomine,
|
205
|
+
getBalance,
|
206
|
+
getBlock,
|
207
|
+
getBlockNumber,
|
208
|
+
getBlockTransactionCount,
|
209
|
+
getChainId,
|
210
|
+
getContractAddress,
|
211
|
+
getCreate2Address,
|
212
|
+
getCreateAddress,
|
213
|
+
getEventSignature,
|
214
|
+
getFeeHistory,
|
215
|
+
getFilterChanges,
|
216
|
+
getFilterLogs,
|
217
|
+
getFunctionSignature,
|
218
|
+
getGasPrice,
|
219
|
+
getPermissions,
|
220
|
+
getTransaction,
|
221
|
+
getTransactionConfirmations,
|
222
|
+
getTransactionCount,
|
223
|
+
getTransactionReceipt,
|
224
|
+
getTxpoolContent,
|
225
|
+
getTxpoolStatus,
|
226
|
+
gweiUnits,
|
227
|
+
hexToBigInt,
|
228
|
+
hexToBool,
|
229
|
+
hexToBytes,
|
230
|
+
hexToNumber,
|
231
|
+
hexToString,
|
232
|
+
http,
|
233
|
+
impersonateAccount,
|
234
|
+
increaseTime,
|
235
|
+
inspectTxpool,
|
236
|
+
isAddress,
|
237
|
+
isAddressEqual,
|
238
|
+
isBytes,
|
239
|
+
isHex,
|
240
|
+
keccak256,
|
241
|
+
mine,
|
242
|
+
numberToBytes,
|
243
|
+
numberToHex,
|
244
|
+
pad,
|
245
|
+
padBytes,
|
246
|
+
padHex,
|
247
|
+
parseEther,
|
248
|
+
parseGwei,
|
249
|
+
parseUnit,
|
250
|
+
removeBlockTimestampInterval,
|
251
|
+
requestAccounts,
|
252
|
+
requestPermissions,
|
253
|
+
reset,
|
254
|
+
revert,
|
255
|
+
sendTransaction,
|
256
|
+
sendUnsignedTransaction,
|
257
|
+
setAutomine,
|
258
|
+
setBalance,
|
259
|
+
setBlockGasLimit,
|
260
|
+
setBlockTimestampInterval,
|
261
|
+
setCode,
|
262
|
+
setCoinbase,
|
263
|
+
setIntervalMining,
|
264
|
+
setLoggingEnabled,
|
265
|
+
setMinGasPrice,
|
266
|
+
setNextBlockBaseFeePerGas,
|
267
|
+
setNextBlockTimestamp,
|
268
|
+
setNonce,
|
269
|
+
setStorageAt,
|
270
|
+
signMessage,
|
271
|
+
size,
|
272
|
+
slice,
|
273
|
+
sliceBytes,
|
274
|
+
sliceHex,
|
275
|
+
snapshot,
|
276
|
+
stopImpersonatingAccount,
|
277
|
+
stringToBytes,
|
278
|
+
stringToHex,
|
279
|
+
switchChain,
|
280
|
+
transactionType,
|
281
|
+
trim,
|
282
|
+
uninstallFilter,
|
283
|
+
waitForTransactionReceipt,
|
284
|
+
watchAsset,
|
285
|
+
watchBlockNumber,
|
286
|
+
watchBlocks,
|
287
|
+
watchPendingTransactions,
|
288
|
+
webSocket,
|
289
|
+
weiUnits
|
290
|
+
};
|
@@ -0,0 +1,326 @@
|
|
1
|
+
import { AbiParameter, AbiParametersToPrimitiveTypes } from 'abitype';
|
2
|
+
import { H as Hex, A as Address, f as ByteArray } from './rpc-655c0ba4.js';
|
3
|
+
import { B as BaseError } from './BaseError-7688f84e.js';
|
4
|
+
import { R as RpcError } from './rpc-3c0e3985.js';
|
5
|
+
|
6
|
+
declare function decodeAbi<TParams extends readonly AbiParameter[]>({ data, params, }: {
|
7
|
+
data: Hex;
|
8
|
+
params: TParams;
|
9
|
+
}): AbiParametersToPrimitiveTypes<TParams>;
|
10
|
+
declare class AbiDecodingDataSizeInvalidError extends BaseError {
|
11
|
+
name: string;
|
12
|
+
constructor(size: number);
|
13
|
+
}
|
14
|
+
declare class InvalidAbiDecodingTypeError extends BaseError {
|
15
|
+
name: string;
|
16
|
+
constructor(type: string);
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @description Encodes a list of primitive values into an ABI-encoded hex value.
|
21
|
+
*/
|
22
|
+
declare function encodeAbi<TParams extends readonly AbiParameter[]>({ params, values, }: {
|
23
|
+
params: TParams;
|
24
|
+
values: AbiParametersToPrimitiveTypes<TParams>;
|
25
|
+
}): `0x${string}`;
|
26
|
+
declare class AbiEncodingArrayLengthMismatchError extends BaseError {
|
27
|
+
name: string;
|
28
|
+
constructor({ expectedLength, givenLength, type, }: {
|
29
|
+
expectedLength: number;
|
30
|
+
givenLength: number;
|
31
|
+
type: string;
|
32
|
+
});
|
33
|
+
}
|
34
|
+
declare class AbiEncodingLengthMismatchError extends BaseError {
|
35
|
+
name: string;
|
36
|
+
constructor({ expectedLength, givenLength, }: {
|
37
|
+
expectedLength: number;
|
38
|
+
givenLength: number;
|
39
|
+
});
|
40
|
+
}
|
41
|
+
declare class InvalidAbiEncodingTypeError extends BaseError {
|
42
|
+
name: string;
|
43
|
+
constructor(type: string);
|
44
|
+
}
|
45
|
+
declare class InvalidArrayError extends BaseError {
|
46
|
+
name: string;
|
47
|
+
constructor(value: unknown);
|
48
|
+
}
|
49
|
+
|
50
|
+
declare function getAddress(address: Address): `0x${string}`;
|
51
|
+
|
52
|
+
type GetCreateAddressOptions = {
|
53
|
+
from: Address;
|
54
|
+
nonce: bigint;
|
55
|
+
};
|
56
|
+
type GetCreate2AddressOptions = {
|
57
|
+
bytecode: ByteArray | Hex;
|
58
|
+
from: Address;
|
59
|
+
salt: ByteArray | Hex;
|
60
|
+
};
|
61
|
+
type GetContractAddressOptions = ({
|
62
|
+
opcode?: 'CREATE';
|
63
|
+
} & GetCreateAddressOptions) | ({
|
64
|
+
opcode: 'CREATE2';
|
65
|
+
} & GetCreate2AddressOptions);
|
66
|
+
declare function getContractAddress(opts: GetContractAddressOptions): `0x${string}`;
|
67
|
+
declare function getCreateAddress(opts: GetCreateAddressOptions): `0x${string}`;
|
68
|
+
declare function getCreate2Address(opts: GetCreate2AddressOptions): `0x${string}`;
|
69
|
+
|
70
|
+
declare function isAddress(address: Address): boolean;
|
71
|
+
|
72
|
+
declare function isAddressEqual(a: Address, b: Address): boolean;
|
73
|
+
|
74
|
+
declare function buildRequest<TRequest extends (args: any) => Promise<any>>(request: TRequest): TRequest;
|
75
|
+
declare class RequestError extends BaseError {
|
76
|
+
constructor(err: Error, { docsPath, humanMessage }: {
|
77
|
+
docsPath?: string;
|
78
|
+
humanMessage: string;
|
79
|
+
});
|
80
|
+
}
|
81
|
+
declare class RpcRequestError extends RequestError {
|
82
|
+
code: number;
|
83
|
+
constructor(err: RpcError, { docsPath, humanMessage }: {
|
84
|
+
docsPath?: string;
|
85
|
+
humanMessage: string;
|
86
|
+
});
|
87
|
+
}
|
88
|
+
declare class ParseRpcError extends RpcRequestError {
|
89
|
+
name: string;
|
90
|
+
code: number;
|
91
|
+
constructor(err: RpcError);
|
92
|
+
}
|
93
|
+
declare class InvalidRequestRpcError extends RpcRequestError {
|
94
|
+
name: string;
|
95
|
+
code: number;
|
96
|
+
constructor(err: RpcError);
|
97
|
+
}
|
98
|
+
declare class MethodNotFoundRpcError extends RpcRequestError {
|
99
|
+
name: string;
|
100
|
+
code: number;
|
101
|
+
constructor(err: RpcError);
|
102
|
+
}
|
103
|
+
declare class InvalidParamsRpcError extends RpcRequestError {
|
104
|
+
name: string;
|
105
|
+
code: number;
|
106
|
+
constructor(err: RpcError);
|
107
|
+
}
|
108
|
+
declare class InternalRpcError extends RpcRequestError {
|
109
|
+
name: string;
|
110
|
+
code: number;
|
111
|
+
constructor(err: RpcError);
|
112
|
+
}
|
113
|
+
declare class InvalidInputRpcError extends RpcRequestError {
|
114
|
+
name: string;
|
115
|
+
code: number;
|
116
|
+
constructor(err: RpcError);
|
117
|
+
}
|
118
|
+
declare class ResourceNotFoundRpcError extends RpcRequestError {
|
119
|
+
name: string;
|
120
|
+
code: number;
|
121
|
+
constructor(err: RpcError);
|
122
|
+
}
|
123
|
+
declare class ResourceUnavailableRpcError extends RpcRequestError {
|
124
|
+
name: string;
|
125
|
+
code: number;
|
126
|
+
constructor(err: RpcError);
|
127
|
+
}
|
128
|
+
declare class TransactionRejectedRpcError extends RpcRequestError {
|
129
|
+
name: string;
|
130
|
+
code: number;
|
131
|
+
constructor(err: RpcError);
|
132
|
+
}
|
133
|
+
declare class MethodNotSupportedRpcError extends RpcRequestError {
|
134
|
+
name: string;
|
135
|
+
code: number;
|
136
|
+
constructor(err: RpcError);
|
137
|
+
}
|
138
|
+
declare class LimitExceededRpcError extends RpcRequestError {
|
139
|
+
name: string;
|
140
|
+
code: number;
|
141
|
+
constructor(err: RpcError);
|
142
|
+
}
|
143
|
+
declare class JsonRpcVersionUnsupportedError extends RpcRequestError {
|
144
|
+
name: string;
|
145
|
+
code: number;
|
146
|
+
constructor(err: RpcError);
|
147
|
+
}
|
148
|
+
|
149
|
+
declare function isBytes(value: any): boolean;
|
150
|
+
|
151
|
+
declare function isHex(value: any): boolean;
|
152
|
+
|
153
|
+
type PadOptions = {
|
154
|
+
dir?: 'left' | 'right';
|
155
|
+
size?: number;
|
156
|
+
};
|
157
|
+
type PadResult<TValue extends ByteArray | Hex> = TValue extends Hex ? Hex : ByteArray;
|
158
|
+
declare function pad<TValue extends ByteArray | Hex>(hexOrBytes: TValue, { dir, size }?: PadOptions): PadResult<TValue>;
|
159
|
+
declare function padHex(hex_: Hex, { dir, size }?: PadOptions): `0x${string}`;
|
160
|
+
declare function padBytes(bytes: ByteArray, { dir, size }?: PadOptions): Uint8Array;
|
161
|
+
|
162
|
+
type TrimOptions = {
|
163
|
+
dir?: 'left' | 'right';
|
164
|
+
};
|
165
|
+
type TrimResult<TValue extends ByteArray | Hex> = TValue extends Hex ? Hex : ByteArray;
|
166
|
+
declare function trim<TValue extends ByteArray | Hex>(hexOrBytes: TValue, { dir }?: TrimOptions): TrimResult<TValue>;
|
167
|
+
|
168
|
+
/**
|
169
|
+
* @description Retrieves the size of the value (in bytes).
|
170
|
+
*
|
171
|
+
* @param value The value (hex or byte array) to retrieve the size of.
|
172
|
+
* @returns The size of the value (in bytes).
|
173
|
+
*/
|
174
|
+
declare function size(value: Hex | ByteArray): number;
|
175
|
+
|
176
|
+
type SliceResult<TValue extends ByteArray | Hex> = TValue extends Hex ? Hex : ByteArray;
|
177
|
+
/**
|
178
|
+
* @description Returns a section of the hex or byte array given a start/end bytes offset.
|
179
|
+
*
|
180
|
+
* @param value The hex or byte array to slice.
|
181
|
+
* @param start The start offset (in bytes).
|
182
|
+
* @param end The end offset (in bytes).
|
183
|
+
*/
|
184
|
+
declare function slice<TValue extends ByteArray | Hex>(value: TValue, start?: number, end?: number): SliceResult<TValue>;
|
185
|
+
/**
|
186
|
+
* @description Returns a section of the byte array given a start/end bytes offset.
|
187
|
+
*
|
188
|
+
* @param value The byte array to slice.
|
189
|
+
* @param start The start offset (in bytes).
|
190
|
+
* @param end The end offset (in bytes).
|
191
|
+
*/
|
192
|
+
declare function sliceBytes(value: ByteArray, start?: number, end?: number): Uint8Array;
|
193
|
+
/**
|
194
|
+
* @description Returns a section of the hex value given a start/end bytes offset.
|
195
|
+
*
|
196
|
+
* @param value The hex value to slice.
|
197
|
+
* @param start The start offset (in bytes).
|
198
|
+
* @param end The end offset (in bytes).
|
199
|
+
*/
|
200
|
+
declare function sliceHex(value_: Hex, start?: number, end?: number): string;
|
201
|
+
|
202
|
+
/**
|
203
|
+
* @description Encodes a boolean into a hex string
|
204
|
+
*/
|
205
|
+
declare function boolToHex(value: boolean): Hex;
|
206
|
+
/**
|
207
|
+
* @description Encodes a bytes array into a hex string
|
208
|
+
*/
|
209
|
+
declare function bytesToHex(value: ByteArray): Hex;
|
210
|
+
/**
|
211
|
+
* @description Encodes a string, number, bigint, or ByteArray into a hex string
|
212
|
+
*/
|
213
|
+
declare function encodeHex(value: string | number | bigint | boolean | ByteArray): Hex;
|
214
|
+
type NumberToHexOpts$1 = {
|
215
|
+
signed?: boolean;
|
216
|
+
size: number;
|
217
|
+
} | {
|
218
|
+
signed?: never;
|
219
|
+
size?: never;
|
220
|
+
};
|
221
|
+
/**
|
222
|
+
* @description Encodes a number or bigint into a hex string
|
223
|
+
*/
|
224
|
+
declare function numberToHex(value_: number | bigint, opts?: NumberToHexOpts$1): Hex;
|
225
|
+
/**
|
226
|
+
* @description Encodes a UTF-8 string into a hex string
|
227
|
+
*/
|
228
|
+
declare function stringToHex(value: string): Hex;
|
229
|
+
|
230
|
+
/**
|
231
|
+
* @description Encodes a boolean into a byte array.
|
232
|
+
*/
|
233
|
+
declare function boolToBytes(value: boolean): Uint8Array;
|
234
|
+
/** @description Encodes a UTF-8 string, hex value, bigint, number or boolean to a byte array. */
|
235
|
+
declare function encodeBytes(value: string | bigint | number | boolean | Hex): ByteArray;
|
236
|
+
/**
|
237
|
+
* @description Encodes a hex string into a byte array.
|
238
|
+
*/
|
239
|
+
declare function hexToBytes(hex_: Hex): ByteArray;
|
240
|
+
/**
|
241
|
+
* @description Encodes a number into a byte array.
|
242
|
+
*/
|
243
|
+
declare function numberToBytes(value: bigint | number, opts?: NumberToHexOpts$1): Uint8Array;
|
244
|
+
/**
|
245
|
+
* @description Encodes a UTF-8 string into a byte array.
|
246
|
+
*/
|
247
|
+
declare function stringToBytes(value: string): ByteArray;
|
248
|
+
|
249
|
+
type RecursiveArray<T> = T | Array<RecursiveArray<T>>;
|
250
|
+
type To$1 = 'hex' | 'bytes';
|
251
|
+
type EncodeRlpResponse<TTo extends To$1> = TTo extends 'bytes' ? ByteArray : TTo extends 'hex' ? Hex : never;
|
252
|
+
declare function encodeRlp<TTo extends To$1 = 'hex'>(hexOrBytes: RecursiveArray<Hex> | RecursiveArray<ByteArray>, to_?: TTo): EncodeRlpResponse<TTo>;
|
253
|
+
|
254
|
+
type DecodeBytesResponse<TTo> = TTo extends 'string' ? string : TTo extends 'hex' ? Hex : TTo extends 'bigint' ? bigint : TTo extends 'number' ? number : TTo extends 'boolean' ? boolean : never;
|
255
|
+
/**
|
256
|
+
* @description Decodes a byte array into a UTF-8 string, hex value, number, bigint or boolean.
|
257
|
+
*/
|
258
|
+
declare function decodeBytes<TTo extends 'string' | 'hex' | 'bigint' | 'number' | 'boolean'>(bytes: ByteArray, to: TTo): DecodeBytesResponse<TTo>;
|
259
|
+
/**
|
260
|
+
* @description Decodes a byte array into a bigint.
|
261
|
+
*/
|
262
|
+
declare function bytesToBigint(bytes: ByteArray): bigint;
|
263
|
+
/**
|
264
|
+
* @description Decodes a byte array into a boolean.
|
265
|
+
*/
|
266
|
+
declare function bytesToBool(bytes: ByteArray): boolean;
|
267
|
+
|
268
|
+
/**
|
269
|
+
* @description Decodes a byte array into a number.
|
270
|
+
*/
|
271
|
+
declare function bytesToNumber(bytes: ByteArray): number;
|
272
|
+
/**
|
273
|
+
* @description Decodes a byte array into a UTF-8 string.
|
274
|
+
*/
|
275
|
+
declare function bytesToString(bytes: ByteArray): string;
|
276
|
+
|
277
|
+
type DecodeHexResponse<TTo> = TTo extends 'string' ? string : TTo extends 'bigint' ? bigint : TTo extends 'number' ? number : TTo extends 'bytes' ? ByteArray : TTo extends 'boolean' ? boolean : never;
|
278
|
+
/**
|
279
|
+
* @description Decodes a hex string into a string, number, bigint, boolean, or bytes32 array.
|
280
|
+
*/
|
281
|
+
declare function decodeHex<TTo extends 'string' | 'bigint' | 'number' | 'bytes' | 'boolean'>(hex: Hex, to: TTo): DecodeHexResponse<TTo>;
|
282
|
+
type HexToBigIntOpts = {
|
283
|
+
signed?: boolean;
|
284
|
+
};
|
285
|
+
/**
|
286
|
+
* @description Decodes a hex string into a bigint.
|
287
|
+
*/
|
288
|
+
declare function hexToBigInt(hex: Hex, opts?: HexToBigIntOpts): bigint;
|
289
|
+
/**
|
290
|
+
* @description Decodes a hex string into a boolean.
|
291
|
+
*/
|
292
|
+
declare function hexToBool(hex: Hex): boolean;
|
293
|
+
type NumberToHexOpts = HexToBigIntOpts;
|
294
|
+
/**
|
295
|
+
* @description Decodes a hex string into a number.
|
296
|
+
*/
|
297
|
+
declare function hexToNumber(hex: Hex, opts?: NumberToHexOpts): number;
|
298
|
+
/**
|
299
|
+
* @description Decodes a hex string into a UTF-8 string.
|
300
|
+
*/
|
301
|
+
declare function hexToString(hex: Hex): string;
|
302
|
+
|
303
|
+
type DecodeRlpResponse<TTo> = TTo extends 'bytes' ? ByteArray : TTo extends 'hex' ? Hex : never;
|
304
|
+
declare function decodeRlp<TTo extends 'bytes' | 'hex'>(value: ByteArray | Hex, to: TTo): RecursiveArray<DecodeRlpResponse<TTo>>;
|
305
|
+
|
306
|
+
declare const getEventSignature: (event: `${string}(${string})`) => `0x${string}`;
|
307
|
+
|
308
|
+
declare const getFunctionSignature: (fn: string) => string;
|
309
|
+
|
310
|
+
type To = 'hex' | 'bytes';
|
311
|
+
type Keccak256Hash<TTo extends To> = TTo extends 'bytes' ? ByteArray : TTo extends 'hex' ? Hex : never;
|
312
|
+
declare function keccak256<TTo extends To = 'hex'>(value: ByteArray, to_?: TTo): Keccak256Hash<TTo>;
|
313
|
+
|
314
|
+
declare function formatEther(wei: bigint, unit?: 'wei' | 'gwei'): string;
|
315
|
+
|
316
|
+
declare function formatGwei(wei: bigint, unit?: 'wei'): string;
|
317
|
+
|
318
|
+
declare function formatUnit(value: bigint, decimals: number): string;
|
319
|
+
|
320
|
+
declare function parseUnit(value: `${number}`, decimals: number): bigint;
|
321
|
+
|
322
|
+
declare function parseEther(ether: `${number}`, unit?: 'wei' | 'gwei'): bigint;
|
323
|
+
|
324
|
+
declare function parseGwei(ether: `${number}`, unit?: 'wei'): bigint;
|
325
|
+
|
326
|
+
export { keccak256 as $, AbiDecodingDataSizeInvalidError as A, encodeHex as B, encodeRlp as C, getAddress as D, EncodeRlpResponse as E, getContractAddress as F, GetContractAddressOptions as G, getCreateAddress as H, InvalidAbiDecodingTypeError as I, JsonRpcVersionUnsupportedError as J, getCreate2Address as K, LimitExceededRpcError as L, MethodNotFoundRpcError as M, getEventSignature as N, getFunctionSignature as O, ParseRpcError as P, formatEther as Q, ResourceNotFoundRpcError as R, isAddress as S, TransactionRejectedRpcError as T, isAddressEqual as U, isBytes as V, isHex as W, hexToBigInt as X, hexToBool as Y, hexToBytes as Z, hexToString as _, AbiEncodingArrayLengthMismatchError as a, numberToBytes as a0, pad as a1, padBytes as a2, padHex as a3, parseEther as a4, parseGwei as a5, parseUnit as a6, formatGwei as a7, formatUnit as a8, hexToNumber as a9, numberToHex as aa, size as ab, slice as ac, sliceBytes as ad, sliceHex as ae, stringToBytes as af, stringToHex as ag, trim as ah, buildRequest as ai, AbiEncodingLengthMismatchError as b, GetCreateAddressOptions as c, GetCreate2AddressOptions as d, InvalidAbiEncodingTypeError as e, InvalidArrayError as f, InternalRpcError as g, InvalidInputRpcError as h, InvalidParamsRpcError as i, InvalidRequestRpcError as j, MethodNotSupportedRpcError as k, ResourceUnavailableRpcError as l, RpcRequestError as m, bytesToHex as n, bytesToString as o, boolToBytes as p, boolToHex as q, bytesToBigint as r, bytesToBool as s, bytesToNumber as t, decodeAbi as u, decodeBytes as v, decodeHex as w, decodeRlp as x, encodeAbi as y, encodeBytes as z };
|