viem 0.0.1-alpha.1 → 0.0.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,284 @@
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';
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-0c9d01e2.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-15ad1601.js';
3
+ export { C as CustomTransport, a as CustomTransportConfig, F as FallbackTransport, b as FallbackTransportConfig, H as HttpTransport, c as HttpTransportConfig, W as WebSocketTransport, d as WebSocketTransportConfig, e as custom, f as fallback, h as http, w as webSocket } from './webSocket-b55b0951.js';
4
+ import { A as Address, H as Hash, B as ByteArray, a as Hex, b as BlockTag } from './rpc-15b85963.js';
5
+ export { c as AccessList, A as Address, d as Block, f as BlockIdentifier, h as BlockNumber, b as BlockTag, B as ByteArray, F as FeeHistory, i as FeeValues, j as FeeValuesEIP1559, k as FeeValuesLegacy, H as Hash, a 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-15b85963.js';
6
+ export { E as EncodeRlpResponse, G as GetContractAddressOptions, b as GetCreate2AddressOptions, a as GetCreateAddressOptions, e as boolToBytes, f as boolToHex, g as bytesToBigint, h as bytesToBool, c as bytesToHex, i as bytesToNumber, d as bytesToString, j as decodeAbi, k as decodeBytes, l as decodeFunctionData, m as decodeHex, n as decodeRlp, o as encodeAbi, p as encodeBytes, q as encodeFunctionData, r as encodeHex, s as encodeRlp, z as formatEther, S as formatGwei, T as formatUnit, t as getAddress, u as getContractAddress, w as getCreate2Address, v as getCreateAddress, x as getEventSignature, y as getFunctionSignature, F as hexToBigInt, H as hexToBool, I as hexToBytes, U as hexToNumber, J as hexToString, A as isAddress, B as isAddressEqual, C as isBytes, D as isHex, K as keccak256, L as numberToBytes, V as numberToHex, M as pad, N as padBytes, O as padHex, P as parseEther, Q as parseGwei, R as parseUnit, W as size, X as slice, Y as sliceBytes, Z as sliceHex, _ as stringToBytes, $ as stringToHex, a0 as trim } from './parseGwei-0f85e8ca.js';
7
+ export { F as FormattedBlock, a as FormattedTransaction, b as FormattedTransactionRequest, f as formatBlock, c as formatTransaction, d as formatTransactionRequest } from './transactionRequest-f538ea86.js';
9
8
  import './chains.js';
10
9
  import '@wagmi/chains';
11
- import './eip1193-8f7c22ce.js';
10
+ import './eip1193-8b4d90ce.js';
11
+ import './rpc-26932bae.js';
12
12
  import 'abitype';
13
+
14
+ type BaseErrorArgs = {
15
+ docsPath?: string;
16
+ } & ({
17
+ cause?: never;
18
+ details?: string;
19
+ } | {
20
+ cause: BaseError | Error;
21
+ details?: never;
22
+ });
23
+ declare class BaseError extends Error {
24
+ humanMessage: string;
25
+ details: string;
26
+ docsPath?: string;
27
+ name: string;
28
+ constructor(humanMessage: string, args?: BaseErrorArgs);
29
+ }
30
+
31
+ declare class AbiDecodingDataSizeInvalidError extends BaseError {
32
+ name: string;
33
+ constructor(size: number);
34
+ }
35
+ declare class AbiEncodingArrayLengthMismatchError extends BaseError {
36
+ name: string;
37
+ constructor({ expectedLength, givenLength, type, }: {
38
+ expectedLength: number;
39
+ givenLength: number;
40
+ type: string;
41
+ });
42
+ }
43
+ declare class AbiEncodingLengthMismatchError extends BaseError {
44
+ name: string;
45
+ constructor({ expectedLength, givenLength, }: {
46
+ expectedLength: number;
47
+ givenLength: number;
48
+ });
49
+ }
50
+ declare class AbiFunctionNotFoundError extends BaseError {
51
+ name: string;
52
+ constructor(functionName: string);
53
+ }
54
+ declare class InvalidAbiEncodingTypeError extends BaseError {
55
+ name: string;
56
+ constructor(type: string);
57
+ }
58
+ declare class InvalidAbiDecodingTypeError extends BaseError {
59
+ name: string;
60
+ constructor(type: string);
61
+ }
62
+ declare class InvalidArrayError extends BaseError {
63
+ name: string;
64
+ constructor(value: unknown);
65
+ }
66
+ declare class InvalidDefinitionTypeError extends BaseError {
67
+ name: string;
68
+ constructor(type: string);
69
+ }
70
+
71
+ declare class InvalidAddressError extends BaseError {
72
+ name: string;
73
+ constructor({ address }: {
74
+ address: Address;
75
+ });
76
+ }
77
+
78
+ declare class BlockNotFoundError extends BaseError {
79
+ name: string;
80
+ constructor({ blockHash, blockNumber, }: {
81
+ blockHash?: Hash;
82
+ blockNumber?: bigint;
83
+ });
84
+ }
85
+
86
+ declare class SizeExceedsPaddingSizeError extends BaseError {
87
+ name: string;
88
+ constructor({ size, targetSize, type, }: {
89
+ size: number;
90
+ targetSize: number;
91
+ type: 'hex' | 'bytes';
92
+ });
93
+ }
94
+
95
+ declare class DataLengthTooLongError extends BaseError {
96
+ name: string;
97
+ constructor({ consumed, length }: {
98
+ consumed: number;
99
+ length: number;
100
+ });
101
+ }
102
+ declare class DataLengthTooShortError extends BaseError {
103
+ name: string;
104
+ constructor({ length, dataLength }: {
105
+ length: number;
106
+ dataLength: number;
107
+ });
108
+ }
109
+ declare class InvalidBytesBooleanError extends BaseError {
110
+ name: string;
111
+ constructor(bytes: ByteArray);
112
+ }
113
+ declare class InvalidHexBooleanError extends BaseError {
114
+ name: string;
115
+ constructor(hex: Hex);
116
+ }
117
+ declare class InvalidHexValueError extends BaseError {
118
+ name: string;
119
+ constructor(value: Hex);
120
+ }
121
+ declare class OffsetOutOfBoundsError extends BaseError {
122
+ name: string;
123
+ constructor({ nextOffset, offset }: {
124
+ nextOffset: number;
125
+ offset: number;
126
+ });
127
+ }
128
+
129
+ declare class HttpRequestError extends BaseError {
130
+ name: string;
131
+ status: number;
132
+ constructor({ body, details, status, url, }: {
133
+ body: {
134
+ [key: string]: unknown;
135
+ };
136
+ details: string;
137
+ status: number;
138
+ url: string;
139
+ });
140
+ }
141
+ declare class WebSocketRequestError extends BaseError {
142
+ name: string;
143
+ constructor({ body, details, url, }: {
144
+ body: {
145
+ [key: string]: unknown;
146
+ };
147
+ details: string;
148
+ url: string;
149
+ });
150
+ }
151
+ declare class RpcError extends BaseError {
152
+ code: number;
153
+ name: string;
154
+ constructor({ body, error, url, }: {
155
+ body: {
156
+ [key: string]: unknown;
157
+ };
158
+ error: {
159
+ code: number;
160
+ message: string;
161
+ };
162
+ url: string;
163
+ });
164
+ }
165
+ declare class TimeoutError extends BaseError {
166
+ name: string;
167
+ constructor({ body, url, }: {
168
+ body: {
169
+ [key: string]: unknown;
170
+ };
171
+ url: string;
172
+ });
173
+ }
174
+
175
+ declare class RequestError extends BaseError {
176
+ constructor(err: Error, { docsPath, humanMessage }: {
177
+ docsPath?: string;
178
+ humanMessage: string;
179
+ });
180
+ }
181
+ declare class RpcRequestError extends RequestError {
182
+ code: number;
183
+ constructor(err: RpcError, { docsPath, humanMessage }: {
184
+ docsPath?: string;
185
+ humanMessage: string;
186
+ });
187
+ }
188
+ declare class ParseRpcError extends RpcRequestError {
189
+ name: string;
190
+ code: number;
191
+ constructor(err: RpcError);
192
+ }
193
+ declare class InvalidRequestRpcError extends RpcRequestError {
194
+ name: string;
195
+ code: number;
196
+ constructor(err: RpcError);
197
+ }
198
+ declare class MethodNotFoundRpcError extends RpcRequestError {
199
+ name: string;
200
+ code: number;
201
+ constructor(err: RpcError);
202
+ }
203
+ declare class InvalidParamsRpcError extends RpcRequestError {
204
+ name: string;
205
+ code: number;
206
+ constructor(err: RpcError);
207
+ }
208
+ declare class InternalRpcError extends RpcRequestError {
209
+ name: string;
210
+ code: number;
211
+ constructor(err: RpcError);
212
+ }
213
+ declare class InvalidInputRpcError extends RpcRequestError {
214
+ name: string;
215
+ code: number;
216
+ constructor(err: RpcError);
217
+ }
218
+ declare class ResourceNotFoundRpcError extends RpcRequestError {
219
+ name: string;
220
+ code: number;
221
+ constructor(err: RpcError);
222
+ }
223
+ declare class ResourceUnavailableRpcError extends RpcRequestError {
224
+ name: string;
225
+ code: number;
226
+ constructor(err: RpcError);
227
+ }
228
+ declare class TransactionRejectedRpcError extends RpcRequestError {
229
+ name: string;
230
+ code: number;
231
+ constructor(err: RpcError);
232
+ }
233
+ declare class MethodNotSupportedRpcError extends RpcRequestError {
234
+ name: string;
235
+ code: number;
236
+ constructor(err: RpcError);
237
+ }
238
+ declare class LimitExceededRpcError extends RpcRequestError {
239
+ name: string;
240
+ code: number;
241
+ constructor(err: RpcError);
242
+ }
243
+ declare class JsonRpcVersionUnsupportedError extends RpcRequestError {
244
+ name: string;
245
+ code: number;
246
+ constructor(err: RpcError);
247
+ }
248
+ declare class UnknownRpcError extends RequestError {
249
+ name: string;
250
+ constructor(err: Error);
251
+ }
252
+
253
+ declare class InvalidGasArgumentsError extends BaseError {
254
+ name: string;
255
+ constructor();
256
+ }
257
+ declare class TransactionNotFoundError extends BaseError {
258
+ name: string;
259
+ constructor({ blockHash, blockNumber, blockTag, hash, index, }: {
260
+ blockHash?: Hash;
261
+ blockNumber?: bigint;
262
+ blockTag?: BlockTag;
263
+ hash?: Hash;
264
+ index?: number;
265
+ });
266
+ }
267
+ declare class TransactionReceiptNotFoundError extends BaseError {
268
+ name: string;
269
+ constructor({ hash }: {
270
+ hash: Hash;
271
+ });
272
+ }
273
+ declare class WaitForTransactionReceiptTimeoutError extends BaseError {
274
+ name: string;
275
+ constructor({ hash }: {
276
+ hash: Hash;
277
+ });
278
+ }
279
+
280
+ declare class UrlRequiredError extends BaseError {
281
+ constructor();
282
+ }
283
+
284
+ export { AbiDecodingDataSizeInvalidError, AbiEncodingArrayLengthMismatchError, AbiEncodingLengthMismatchError, AbiFunctionNotFoundError, BaseError, BlockNotFoundError, DataLengthTooLongError, DataLengthTooShortError, HttpRequestError, InternalRpcError, InvalidAbiDecodingTypeError, InvalidAbiEncodingTypeError, InvalidAddressError, InvalidArrayError, InvalidBytesBooleanError, InvalidDefinitionTypeError, InvalidGasArgumentsError, InvalidHexBooleanError, InvalidHexValueError, InvalidInputRpcError, InvalidParamsRpcError, InvalidRequestRpcError, JsonRpcVersionUnsupportedError, LimitExceededRpcError, MethodNotFoundRpcError, MethodNotSupportedRpcError, OffsetOutOfBoundsError, ParseRpcError, RequestError, ResourceNotFoundRpcError, ResourceUnavailableRpcError, RpcError, RpcRequestError, SizeExceedsPaddingSizeError, TimeoutError, TransactionNotFoundError, TransactionReceiptNotFoundError, TransactionRejectedRpcError, UnknownRpcError, UrlRequiredError, WaitForTransactionReceiptTimeoutError, WebSocketRequestError };
package/dist/index.js CHANGED
@@ -57,9 +57,8 @@ import {
57
57
  watchBlockNumber,
58
58
  watchBlocks,
59
59
  watchPendingTransactions
60
- } from "./chunk-LLYFXUSV.js";
60
+ } from "./chunk-YZEQFYZ3.js";
61
61
  import {
62
- UrlRequiredError,
63
62
  createClient,
64
63
  createPublicClient,
65
64
  createTestClient,
@@ -69,25 +68,8 @@ import {
69
68
  fallback,
70
69
  http,
71
70
  webSocket
72
- } from "./chunk-OQTFTQTO.js";
71
+ } from "./chunk-TLEMV4T3.js";
73
72
  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
73
  boolToBytes,
92
74
  boolToHex,
93
75
  bytesToBigint,
@@ -97,10 +79,12 @@ import {
97
79
  bytesToString,
98
80
  decodeAbi,
99
81
  decodeBytes,
82
+ decodeFunctionData,
100
83
  decodeHex,
101
84
  decodeRlp,
102
85
  encodeAbi,
103
86
  encodeBytes,
87
+ encodeFunctionData,
104
88
  encodeHex,
105
89
  encodeRlp,
106
90
  etherUnits,
@@ -144,11 +128,71 @@ import {
144
128
  transactionType,
145
129
  trim,
146
130
  weiUnits
147
- } from "./chunk-Z6LRV6XI.js";
131
+ } from "./chunk-SRDTRROA.js";
132
+ import {
133
+ AbiDecodingDataSizeInvalidError,
134
+ AbiEncodingArrayLengthMismatchError,
135
+ AbiEncodingLengthMismatchError,
136
+ AbiFunctionNotFoundError,
137
+ BaseError,
138
+ BlockNotFoundError,
139
+ DataLengthTooLongError,
140
+ DataLengthTooShortError,
141
+ HttpRequestError,
142
+ InternalRpcError,
143
+ InvalidAbiDecodingTypeError,
144
+ InvalidAbiEncodingTypeError,
145
+ InvalidAddressError,
146
+ InvalidArrayError,
147
+ InvalidBytesBooleanError,
148
+ InvalidDefinitionTypeError,
149
+ InvalidGasArgumentsError,
150
+ InvalidHexBooleanError,
151
+ InvalidHexValueError,
152
+ InvalidInputRpcError,
153
+ InvalidParamsRpcError,
154
+ InvalidRequestRpcError,
155
+ JsonRpcVersionUnsupportedError,
156
+ LimitExceededRpcError,
157
+ MethodNotFoundRpcError,
158
+ MethodNotSupportedRpcError,
159
+ OffsetOutOfBoundsError,
160
+ ParseRpcError,
161
+ RequestError,
162
+ ResourceNotFoundRpcError,
163
+ ResourceUnavailableRpcError,
164
+ RpcError,
165
+ RpcRequestError,
166
+ SizeExceedsPaddingSizeError,
167
+ TimeoutError,
168
+ TransactionNotFoundError,
169
+ TransactionReceiptNotFoundError,
170
+ TransactionRejectedRpcError,
171
+ UnknownRpcError,
172
+ UrlRequiredError,
173
+ WaitForTransactionReceiptTimeoutError,
174
+ WebSocketRequestError
175
+ } from "./chunk-WZITKXV3.js";
148
176
  export {
177
+ AbiDecodingDataSizeInvalidError,
178
+ AbiEncodingArrayLengthMismatchError,
179
+ AbiEncodingLengthMismatchError,
180
+ AbiFunctionNotFoundError,
149
181
  BaseError,
182
+ BlockNotFoundError,
183
+ DataLengthTooLongError,
184
+ DataLengthTooShortError,
150
185
  HttpRequestError,
151
186
  InternalRpcError,
187
+ InvalidAbiDecodingTypeError,
188
+ InvalidAbiEncodingTypeError,
189
+ InvalidAddressError,
190
+ InvalidArrayError,
191
+ InvalidBytesBooleanError,
192
+ InvalidDefinitionTypeError,
193
+ InvalidGasArgumentsError,
194
+ InvalidHexBooleanError,
195
+ InvalidHexValueError,
152
196
  InvalidInputRpcError,
153
197
  InvalidParamsRpcError,
154
198
  InvalidRequestRpcError,
@@ -156,14 +200,22 @@ export {
156
200
  LimitExceededRpcError,
157
201
  MethodNotFoundRpcError,
158
202
  MethodNotSupportedRpcError,
203
+ OffsetOutOfBoundsError,
159
204
  ParseRpcError,
205
+ RequestError,
160
206
  ResourceNotFoundRpcError,
161
207
  ResourceUnavailableRpcError,
162
208
  RpcError,
163
209
  RpcRequestError,
210
+ SizeExceedsPaddingSizeError,
164
211
  TimeoutError,
212
+ TransactionNotFoundError,
213
+ TransactionReceiptNotFoundError,
165
214
  TransactionRejectedRpcError,
215
+ UnknownRpcError,
166
216
  UrlRequiredError,
217
+ WaitForTransactionReceiptTimeoutError,
218
+ WebSocketRequestError,
167
219
  addChain,
168
220
  boolToBytes,
169
221
  boolToHex,
@@ -183,11 +235,13 @@ export {
183
235
  custom,
184
236
  decodeAbi,
185
237
  decodeBytes,
238
+ decodeFunctionData,
186
239
  decodeHex,
187
240
  decodeRlp,
188
241
  dropTransaction,
189
242
  encodeAbi,
190
243
  encodeBytes,
244
+ encodeFunctionData,
191
245
  encodeHex,
192
246
  encodeRlp,
193
247
  estimateGas,
@@ -1,20 +1,35 @@
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';
1
+ import { Abi, AbiFunction, ExtractAbiFunction, AbiParametersToPrimitiveTypes, AbiParameter, ExtractAbiFunctionNames } from 'abitype';
2
+ import { a as Hex, A as Address, B as ByteArray } from './rpc-15b85963.js';
3
+
4
+ type ExtractArgsFromAbi<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction & {
5
+ type: 'function';
6
+ } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction & {
7
+ type: 'function';
8
+ }, TArgs = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? {
9
+ /**
10
+ * Arguments to pass contract method
11
+ *
12
+ * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link abi} for type inference.
13
+ */
14
+ args?: readonly unknown[];
15
+ } : TArgs extends readonly [] ? {
16
+ args?: never;
17
+ } : {
18
+ /** Arguments to pass contract method */ args: TArgs;
19
+ };
5
20
 
6
21
  declare function decodeAbi<TParams extends readonly AbiParameter[]>({ data, params, }: {
7
22
  data: Hex;
8
23
  params: TParams;
9
24
  }): 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
- }
25
+
26
+ declare function decodeFunctionData({ abi, data }: {
27
+ abi: Abi;
28
+ data: Hex;
29
+ }): {
30
+ functionName: string;
31
+ args: readonly unknown[] | undefined;
32
+ };
18
33
 
19
34
  /**
20
35
  * @description Encodes a list of primitive values into an ABI-encoded hex value.
@@ -22,30 +37,12 @@ declare class InvalidAbiDecodingTypeError extends BaseError {
22
37
  declare function encodeAbi<TParams extends readonly AbiParameter[]>({ params, values, }: {
23
38
  params: TParams;
24
39
  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
- }
40
+ }): `0x${string}` | undefined;
41
+
42
+ declare function encodeFunctionData<TAbi extends Abi = Abi, TFunctionName extends ExtractAbiFunctionNames<TAbi> = any>({ abi, args, functionName, }: {
43
+ abi: TAbi;
44
+ functionName: TFunctionName;
45
+ } & ExtractArgsFromAbi<TAbi, TFunctionName>): `0x${string}`;
49
46
 
50
47
  declare function getAddress(address: Address): `0x${string}`;
51
48
 
@@ -71,81 +68,6 @@ declare function isAddress(address: Address): boolean;
71
68
 
72
69
  declare function isAddressEqual(a: Address, b: Address): boolean;
73
70
 
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
71
  declare function isBytes(value: any): boolean;
150
72
 
151
73
  declare function isHex(value: any): boolean;
@@ -305,7 +227,7 @@ declare function decodeRlp<TTo extends 'bytes' | 'hex'>(value: ByteArray | Hex,
305
227
 
306
228
  declare const getEventSignature: (event: `${string}(${string})`) => `0x${string}`;
307
229
 
308
- declare const getFunctionSignature: (fn: string) => string;
230
+ declare const getFunctionSignature: (fn: string) => `0x${string}`;
309
231
 
310
232
  type To = 'hex' | 'bytes';
311
233
  type Keccak256Hash<TTo extends To> = TTo extends 'bytes' ? ByteArray : TTo extends 'hex' ? Hex : never;
@@ -323,4 +245,4 @@ declare function parseEther(ether: `${number}`, unit?: 'wei' | 'gwei'): bigint;
323
245
 
324
246
  declare function parseGwei(ether: `${number}`, unit?: 'wei'): bigint;
325
247
 
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 };
248
+ export { stringToHex as $, isAddress as A, isAddressEqual as B, isBytes as C, isHex as D, EncodeRlpResponse as E, hexToBigInt as F, GetContractAddressOptions as G, hexToBool as H, hexToBytes as I, hexToString as J, keccak256 as K, numberToBytes as L, pad as M, padBytes as N, padHex as O, parseEther as P, parseGwei as Q, parseUnit as R, formatGwei as S, formatUnit as T, hexToNumber as U, numberToHex as V, size as W, slice as X, sliceBytes as Y, sliceHex as Z, stringToBytes as _, GetCreateAddressOptions as a, trim as a0, GetCreate2AddressOptions as b, bytesToHex as c, bytesToString as d, boolToBytes as e, boolToHex as f, bytesToBigint as g, bytesToBool as h, bytesToNumber as i, decodeAbi as j, decodeBytes as k, decodeFunctionData as l, decodeHex as m, decodeRlp as n, encodeAbi as o, encodeBytes as p, encodeFunctionData as q, encodeHex as r, encodeRlp as s, getAddress as t, getContractAddress as u, getCreateAddress as v, getCreate2Address as w, getEventSignature as x, getFunctionSignature as y, formatEther as z };
@@ -289,4 +289,4 @@ type RpcTransactionReceipt = TransactionReceipt<Quantity, Index, Status, Transac
289
289
  type RpcTransactionRequest = TransactionRequest<Quantity, Index>;
290
290
  type RpcTransaction = TransactionLegacy<Quantity, Index, '0x0'> | TransactionEIP2930<Quantity, Index, '0x1'> | TransactionEIP1559<Quantity, Index, '0x2'>;
291
291
 
292
- export { Address as A, Block as B, TransactionRequestLegacy as C, Transaction as D, TransactionBase as E, FeeHistory as F, TransactionEIP1559 as G, Hex as H, TransactionEIP2930 as I, TransactionLegacy as J, EstimateGasParameters as K, Log as L, MergeIntersectionProperties as M, TransactionType$1 as N, OptionalNullable as O, RpcEstimateGasParameters as P, Quantity as Q, RpcBlock as R, TransactionReceipt as T, Uncle as U, AccessList as a, BlockIdentifier as b, BlockNumber as c, BlockTag as d, etherUnits as e, ByteArray as f, gweiUnits as g, FeeValues as h, FeeValuesEIP1559 as i, FeeValuesLegacy as j, Hash as k, RpcBlockIdentifier as l, RpcBlockNumber as m, RpcFeeHistory as n, RpcFeeValues as o, RpcLog as p, RpcTransaction as q, RpcTransactionReceipt as r, RpcTransactionRequest as s, transactionType as t, RpcUncle as u, TransactionRequest as v, weiUnits as w, TransactionRequestBase as x, TransactionRequestEIP1559 as y, TransactionRequestEIP2930 as z };
292
+ export { Address as A, ByteArray as B, TransactionRequestLegacy as C, Transaction as D, TransactionBase as E, FeeHistory as F, TransactionEIP1559 as G, Hash as H, TransactionEIP2930 as I, TransactionLegacy as J, EstimateGasParameters as K, Log as L, MergeIntersectionProperties as M, TransactionType$1 as N, OptionalNullable as O, RpcEstimateGasParameters as P, Quantity as Q, RpcBlock as R, TransactionReceipt as T, Uncle as U, Hex as a, BlockTag as b, AccessList as c, Block as d, etherUnits as e, BlockIdentifier as f, gweiUnits as g, BlockNumber as h, FeeValues as i, FeeValuesEIP1559 as j, FeeValuesLegacy as k, RpcBlockIdentifier as l, RpcBlockNumber as m, RpcFeeHistory as n, RpcFeeValues as o, RpcLog as p, RpcTransaction as q, RpcTransactionReceipt as r, RpcTransactionRequest as s, transactionType as t, RpcUncle as u, TransactionRequest as v, weiUnits as w, TransactionRequestBase as x, TransactionRequestEIP1559 as y, TransactionRequestEIP2930 as z };