viem 0.0.1-alpha.27 → 0.0.1-alpha.29

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.
Files changed (81) hide show
  1. package/dist/chain-4d46a747.d.ts +543 -0
  2. package/dist/{chain-b0cfb141.d.ts → chain-c7c44165.d.ts} +1 -1
  3. package/dist/chains.d.ts +5 -3
  4. package/dist/chains.js +46 -46
  5. package/dist/chains.mjs +1 -1
  6. package/dist/{chunk-JY7JGKSA.js → chunk-4VQKZYE2.js} +219 -157
  7. package/dist/chunk-4VQKZYE2.js.map +1 -0
  8. package/dist/{chunk-2DSFM32P.js → chunk-CKYH337I.js} +15 -15
  9. package/dist/{chunk-2DSFM32P.js.map → chunk-CKYH337I.js.map} +1 -1
  10. package/dist/{chunk-W7KWIGWO.js → chunk-EYORBAD4.js} +45 -44
  11. package/dist/chunk-EYORBAD4.js.map +1 -0
  12. package/dist/{chunk-LF6P33WQ.mjs → chunk-HPUQL3IM.mjs} +3 -3
  13. package/dist/chunk-HPUQL3IM.mjs.map +1 -0
  14. package/dist/chunk-OJ7H3CQF.js +265 -0
  15. package/dist/chunk-OJ7H3CQF.js.map +1 -0
  16. package/dist/chunk-Q67VUTW3.mjs +210 -0
  17. package/dist/chunk-Q67VUTW3.mjs.map +1 -0
  18. package/dist/{chunk-AKGXRZDN.mjs → chunk-RR4MGS6O.mjs} +27 -26
  19. package/dist/chunk-RR4MGS6O.mjs.map +1 -0
  20. package/dist/chunk-S252SZEL.mjs +265 -0
  21. package/dist/chunk-S252SZEL.mjs.map +1 -0
  22. package/dist/chunk-SEIPUKZE.js +210 -0
  23. package/dist/chunk-SEIPUKZE.js.map +1 -0
  24. package/dist/{chunk-BJJH7RYH.mjs → chunk-TQC7KZ24.mjs} +164 -102
  25. package/dist/chunk-TQC7KZ24.mjs.map +1 -0
  26. package/dist/contract.d.ts +12 -128
  27. package/dist/contract.js +6 -4
  28. package/dist/contract.mjs +5 -3
  29. package/dist/{createClient-6689596e.d.ts → createClient-5d5c14d6.d.ts} +5 -3
  30. package/dist/createPublicClient-2b4afeac.d.ts +629 -0
  31. package/dist/{eip1193-617a05ae.d.ts → eip1193-f09a55af.d.ts} +2 -2
  32. package/dist/ens.d.ts +10 -68
  33. package/dist/ens.js +5 -199
  34. package/dist/ens.js.map +1 -1
  35. package/dist/ens.mjs +7 -201
  36. package/dist/ens.mjs.map +1 -1
  37. package/dist/formatAbiItem-d231fef2.d.ts +14 -0
  38. package/dist/{getAbiItem-d2e8bd76.d.ts → getAbiItem-0e085959.d.ts} +15 -15
  39. package/dist/index.d.ts +22 -13
  40. package/dist/index.js +368 -26
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.mjs +358 -16
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/namehash-88f4639d.d.ts +22 -0
  45. package/dist/parseGwei-4d0b0d73.d.ts +344 -0
  46. package/dist/public.d.ts +11 -334
  47. package/dist/public.js +5 -3
  48. package/dist/public.mjs +4 -2
  49. package/dist/test-b9208949.d.ts +213 -0
  50. package/dist/test.d.ts +8 -149
  51. package/dist/test.js +20 -222
  52. package/dist/test.js.map +1 -1
  53. package/dist/test.mjs +30 -232
  54. package/dist/test.mjs.map +1 -1
  55. package/dist/{transactionReceipt-44dbf122.d.ts → transactionReceipt-84fc92e1.d.ts} +1 -1
  56. package/dist/{transactionRequest-f437b4ba.d.ts → transactionRequest-44c539b4.d.ts} +1 -1
  57. package/dist/utils/index.d.ts +12 -238
  58. package/dist/utils/index.js +2 -2
  59. package/dist/utils/index.mjs +1 -1
  60. package/dist/wallet-9b1c6905.d.ts +104 -0
  61. package/dist/wallet.d.ts +7 -41
  62. package/dist/wallet.js +3 -3
  63. package/dist/wallet.mjs +2 -2
  64. package/dist/window.d.ts +4 -2
  65. package/package.json +1 -1
  66. package/dist/call-3476b8ee.d.ts +0 -22
  67. package/dist/chain-42de87e5.d.ts +0 -359
  68. package/dist/chunk-AKGXRZDN.mjs.map +0 -1
  69. package/dist/chunk-BJJH7RYH.mjs.map +0 -1
  70. package/dist/chunk-JY7JGKSA.js.map +0 -1
  71. package/dist/chunk-LF6P33WQ.mjs.map +0 -1
  72. package/dist/chunk-W7KWIGWO.js.map +0 -1
  73. package/dist/contract-9dd2f98b.d.ts +0 -166
  74. package/dist/createPublicClient-fd558574.d.ts +0 -19
  75. package/dist/createTestClient-bc1d9028.d.ts +0 -34
  76. package/dist/createWalletClient-4df88244.d.ts +0 -30
  77. package/dist/decodeErrorResult-ac835649.d.ts +0 -16
  78. package/dist/readContract-c460f23a.d.ts +0 -10
  79. package/dist/rpc-8c10fc98.d.ts +0 -119
  80. package/dist/sendTransaction-7ce442c0.d.ts +0 -12
  81. package/dist/watchEvent-569c9976.d.ts +0 -41
package/dist/public.d.ts CHANGED
@@ -1,245 +1,14 @@
1
- export { C as CallArgs, a as CallResponse, c as call } from './call-3476b8ee.js';
2
- import { H as Hex, C as Chain, b as BlockTag, M as Formatter, O as MergeIntersectionProperties, S as Formatted, s as TransactionRequest, A as Address, a as Hash, F as FeeHistory, L as Log, f as BlockNumber, W as FormattedTransaction, X as TransactionFormatter, V as ExtractFormatter, p as RpcTransactionReceipt, T as TransactionReceipt, J as TransactionType, x as Transaction } from './chain-42de87e5.js';
3
- import { P as PublicClient } from './createPublicClient-fd558574.js';
4
- import { T as TransactionRequestFormatter } from './transactionRequest-f437b4ba.js';
5
- import { F as FormattedBlock, B as BlockFormatter, a as FormattedTransactionReceipt, T as TransactionReceiptFormatter } from './transactionReceipt-44dbf122.js';
6
- import { E as EventFilterArgs } from './watchEvent-569c9976.js';
7
- export { G as GetBytecodeArgs, a as GetBytecodeResponse, g as getBytecode, w as watchEvent } from './watchEvent-569c9976.js';
8
- import { j as EventDefinition } from './contract-9dd2f98b.js';
9
- import '@wagmi/chains';
10
- import './eip1193-617a05ae.js';
11
- import './createClient-6689596e.js';
1
+ import { P as PublicClient } from './createPublicClient-2b4afeac.js';
2
+ export { a3 as CallArgs, a4 as CallResponse, a5 as CreateBlockFilterResponse, a6 as CreateEventFilterArgs, a7 as CreateEventFilterResponse, a8 as CreatePendingTransactionFilterResponse, a9 as EstimateGasArgs, aa as EstimateGasResponse, ab as GetBalanceArgs, ac as GetBalanceResponse, ad as GetBlockArgs, ae as GetBlockNumberArgs, af as GetBlockNumberResponse, ag as GetBlockResponse, ah as GetBlockTransactionCountArgs, ai as GetBlockTransactionCountResponse, G as GetBytecodeArgs, e as GetBytecodeResponse, aj as GetFeeHistoryArgs, ak as GetFeeHistoryResponse, al as GetFilterChangesArgs, am as GetFilterChangesResponse, an as GetFilterLogsArgs, ao as GetFilterLogsResponse, ap as GetGasPriceResponse, aq as GetTransactionArgs, ar as GetTransactionConfirmationsArgs, as as GetTransactionConfirmationsResponse, at as GetTransactionReceiptArgs, au as GetTransactionReceiptResponse, av as GetTransactionResponse, aw as OnBlock, ax as OnBlockNumber, ay as OnBlockNumberResponse, az as OnBlockResponse, aA as OnTransactions, aB as OnTransactionsResponse, aC as ReplacementReason, aD as ReplacementResponse, aE as UninstallFilterArgs, aF as UninstallFilterResponse, aG as WaitForTransactionReceiptArgs, aH as WaitForTransactionReceiptResponse, aI as WatchBlockNumberArgs, aJ as WatchBlocksArgs, aK as WatchPendingTransactionsArgs, x as call, y as createBlockFilter, z as createEventFilter, A as createPendingTransactionFilter, B as estimateGas, D as getBalance, F as getBlock, H as getBlockNumber, I as getBlockNumberCache, J as getBlockTransactionCount, n as getBytecode, K as getChainId, L as getFeeHistory, N as getFilterChanges, Q as getFilterLogs, U as getGasPrice, T as getLogs, V as getTransaction, X as getTransactionConfirmations, Y as getTransactionReceipt, Z as uninstallFilter, _ as waitForTransactionReceipt, $ as watchBlockNumber, a0 as watchBlocks, a1 as watchEvent, a2 as watchPendingTransactions } from './createPublicClient-2b4afeac.js';
3
+ import { A as Address, b as BlockTag } from './chain-4d46a747.js';
4
+ import './eip1193-f09a55af.js';
5
+ import './createClient-5d5c14d6.js';
12
6
  import 'abitype';
13
-
14
- type FilterType = 'transaction' | 'block' | 'event';
15
- type Filter<TFilterType extends FilterType = 'event'> = {
16
- id: Hex;
17
- type: TFilterType;
18
- };
19
-
20
- type CreatePendingTransactionFilterResponse = Filter<'transaction'>;
21
- declare function createPendingTransactionFilter(client: PublicClient): Promise<CreatePendingTransactionFilterResponse>;
22
-
23
- type CreateBlockFilterResponse = Filter<'block'>;
24
- declare function createBlockFilter(client: PublicClient): Promise<CreateBlockFilterResponse>;
25
-
26
- type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Formatted<TFormatter, TransactionRequest, true>, TransactionRequest>;
27
- type EstimateGasArgs<TChain extends Chain = Chain> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & ({
28
- /** The balance of the account at a block number. */
29
- blockNumber?: bigint;
30
- blockTag?: never;
31
- } | {
32
- blockNumber?: never;
33
- /** The balance of the account at a block tag. */
34
- blockTag?: BlockTag;
35
- });
36
- type EstimateGasResponse = bigint;
37
- /**
38
- * @description Estimates the gas necessary to complete a transaction without submitting it to the network.
39
- */
40
- declare function estimateGas<TChain extends Chain>(client: PublicClient<any, TChain>, { accessList, blockNumber, blockTag, data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest }: EstimateGasArgs): Promise<EstimateGasResponse>;
41
-
42
- type GetBalanceArgs = {
43
- /** The address of the account. */
44
- address: Address;
45
- } & ({
46
- /** The balance of the account at a block number. */
47
- blockNumber?: bigint;
48
- blockTag?: never;
49
- } | {
50
- blockNumber?: never;
51
- /** The balance of the account at a block tag. */
52
- blockTag?: BlockTag;
53
- });
54
- type GetBalanceResponse = bigint;
55
- /**
56
- * @description Returns the balance of an address in wei.
57
- */
58
- declare function getBalance(client: PublicClient, { address, blockNumber, blockTag }: GetBalanceArgs): Promise<GetBalanceResponse>;
59
-
60
- type GetBlockArgs = {
61
- /** Whether or not to include transaction data in the response. */
62
- includeTransactions?: boolean;
63
- } & ({
64
- /** Hash of the block. */
65
- blockHash?: Hash;
66
- blockNumber?: never;
67
- blockTag?: never;
68
- } | {
69
- blockHash?: never;
70
- /** The block number. */
71
- blockNumber?: bigint;
72
- blockTag?: never;
73
- } | {
74
- blockHash?: never;
75
- blockNumber?: never;
76
- /** The block tag. Defaults to 'latest'. */
77
- blockTag?: BlockTag;
78
- });
79
- type GetBlockResponse<TChain extends Chain = Chain> = FormattedBlock<BlockFormatter<TChain>>;
80
- declare function getBlock<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, includeTransactions, }?: GetBlockArgs): Promise<GetBlockResponse<TChain>>;
81
-
82
- type GetBlockNumberArgs = {
83
- /** The maximum age (in ms) of the cached value. */
84
- maxAge?: number;
85
- };
86
- type GetBlockNumberResponse = bigint;
87
- declare function getBlockNumberCache(id: string): {
88
- clear: () => void;
89
- promise: {
90
- clear: () => boolean;
91
- get: () => Promise<unknown> | undefined;
92
- set: (data: Promise<unknown>) => Map<string, Promise<unknown>>;
93
- };
94
- response: {
95
- clear: () => boolean;
96
- get: () => {
97
- created: Date;
98
- data: unknown;
99
- } | undefined;
100
- set: (data: {
101
- created: Date;
102
- data: unknown;
103
- }) => Map<string, {
104
- created: Date;
105
- data: unknown;
106
- }>;
107
- };
108
- };
109
- /**
110
- * @description Returns the number of the most recent block seen.
111
- */
112
- declare function getBlockNumber(client: PublicClient, { maxAge }?: GetBlockNumberArgs): Promise<GetBlockNumberResponse>;
113
-
114
- type GetBlockTransactionCountArgs = {
115
- /** Hash of the block. */
116
- blockHash?: Hash;
117
- blockNumber?: never;
118
- blockTag?: never;
119
- } | {
120
- blockHash?: never;
121
- /** The block number. */
122
- blockNumber?: bigint;
123
- blockTag?: never;
124
- } | {
125
- blockHash?: never;
126
- blockNumber?: never;
127
- /** The block tag. Defaults to 'latest'. */
128
- blockTag?: BlockTag;
129
- };
130
- type GetBlockTransactionCountResponse = number;
131
- declare function getBlockTransactionCount<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountArgs): Promise<GetBlockTransactionCountResponse>;
132
-
133
- declare function getChainId(client: PublicClient): Promise<number>;
134
-
135
- type GetFeeHistoryArgs = {
136
- blockCount: number;
137
- rewardPercentiles: number[];
138
- } & ({
139
- blockNumber?: never;
140
- blockTag?: BlockTag;
141
- } | {
142
- blockNumber?: bigint;
143
- blockTag?: never;
144
- });
145
- type GetFeeHistoryResponse = FeeHistory;
146
- /**
147
- * @description Returns a collection of historical gas information.
148
- */
149
- declare function getFeeHistory(client: PublicClient, { blockCount, blockNumber, blockTag, rewardPercentiles, }: GetFeeHistoryArgs): Promise<GetFeeHistoryResponse>;
150
-
151
- type GetFilterChangesArgs<TFilterType extends FilterType> = {
152
- filter: Filter<TFilterType>;
153
- };
154
- type GetFilterChangesResponse<TFilterType extends FilterType> = TFilterType extends 'event' ? Log[] : Hash[];
155
- declare function getFilterChanges<TFilterType extends FilterType>(client: PublicClient, { filter }: GetFilterChangesArgs<TFilterType>): Promise<GetFilterChangesResponse<TFilterType>>;
156
-
157
- type GetFilterLogsArgs = {
158
- filter: Filter<'event'>;
159
- };
160
- type GetFilterLogsResponse = Log[];
161
- declare function getFilterLogs<TFilterType extends FilterType>(client: PublicClient, { filter }: GetFilterLogsArgs): Promise<GetFilterLogsResponse>;
162
-
163
- type GetGasPriceResponse = bigint;
164
- /**
165
- * @description Returns the current price of gas (in wei).
166
- */
167
- declare function getGasPrice(client: PublicClient): Promise<GetGasPriceResponse>;
168
-
169
- type GetLogsArgs<TEventDefinition extends EventDefinition> = {
170
- /** Address or list of addresses from which logs originated */
171
- address?: Address | Address[];
172
- } & ({
173
- event: TEventDefinition;
174
- args?: EventFilterArgs<TEventDefinition>;
175
- } | {
176
- event?: never;
177
- args?: never;
178
- }) & ({
179
- /** Block number or tag after which to include logs */
180
- fromBlock?: BlockNumber<bigint> | BlockTag;
181
- /** Block number or tag before which to include logs */
182
- toBlock?: BlockNumber<bigint> | BlockTag;
183
- blockHash?: never;
184
- } | {
185
- fromBlock?: never;
186
- toBlock?: never;
187
- /** Hash of block to include logs from */
188
- blockHash?: Hash;
189
- });
190
- type GetLogsResponse = Log[];
191
- /**
192
- * @description Returns a collection of event logs.
193
- */
194
- declare function getLogs<TEventDefinition extends EventDefinition>(client: PublicClient, { address, blockHash, fromBlock, toBlock, event, args, }?: GetLogsArgs<TEventDefinition>): Promise<GetLogsResponse>;
195
-
196
- type GetTransactionArgs = {
197
- /** The block hash */
198
- blockHash: Hash;
199
- blockNumber?: never;
200
- blockTag?: never;
201
- hash?: never;
202
- /** The index of the transaction on the block. */
203
- index: number;
204
- } | {
205
- blockHash?: never;
206
- /** The block number */
207
- blockNumber: bigint;
208
- blockTag?: never;
209
- hash?: never;
210
- /** The index of the transaction on the block. */
211
- index: number;
212
- } | {
213
- blockHash?: never;
214
- blockNumber?: never;
215
- /** The block tag. */
216
- blockTag: BlockTag;
217
- hash?: never;
218
- /** The index of the transaction on the block. */
219
- index: number;
220
- } | {
221
- blockHash?: never;
222
- blockNumber?: never;
223
- blockTag?: never;
224
- /** The hash of the transaction. */
225
- hash: Hash;
226
- index?: number;
227
- };
228
- type GetTransactionResponse<TChain extends Chain = Chain> = FormattedTransaction<TransactionFormatter<TChain>>;
229
- /** @description Returns information about a transaction given a hash or block identifier. */
230
- declare function getTransaction<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, hash, index, }: GetTransactionArgs): Promise<GetTransactionResponse<TChain>>;
231
-
232
- type GetTransactionConfirmationsArgs<TChain extends Chain> = {
233
- /** The transaction hash. */
234
- hash: Hash;
235
- transactionReceipt?: never;
236
- } | {
237
- hash?: never;
238
- /** The transaction receipt. */
239
- transactionReceipt: FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
240
- };
241
- type GetTransactionConfirmationsResponse = bigint;
242
- declare function getTransactionConfirmations<TChain extends Chain>(client: PublicClient<any, TChain>, { hash, transactionReceipt }: GetTransactionConfirmationsArgs<TChain>): Promise<GetTransactionConfirmationsResponse>;
7
+ import './transactionRequest-44c539b4.js';
8
+ import './wallet-9b1c6905.js';
9
+ import './transactionReceipt-84fc92e1.js';
10
+ import '@wagmi/chains';
11
+ import 'ethers@6/types/providers';
243
12
 
244
13
  type GetTransactionCountArgs = {
245
14
  /** The account address. */
@@ -259,96 +28,4 @@ type GetTransactionCountResponse = number;
259
28
  */
260
29
  declare function getTransactionCount(client: PublicClient, { address, blockTag, blockNumber }: GetTransactionCountArgs): Promise<GetTransactionCountResponse>;
261
30
 
262
- type GetTransactionReceiptArgs = {
263
- /** The hash of the transaction. */
264
- hash: Hash;
265
- };
266
- type GetTransactionReceiptResponse<TChain extends Chain = Chain> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
267
- declare function getTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { hash }: GetTransactionReceiptArgs): Promise<Formatted<ExtractFormatter<TChain, "transactionReceipt", Formatter<RpcTransactionReceipt, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>>>, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>, false>>;
268
-
269
- type UninstallFilterArgs = {
270
- filter: Filter<any>;
271
- };
272
- type UninstallFilterResponse = boolean;
273
- declare function uninstallFilter(client: PublicClient, { filter }: UninstallFilterArgs): Promise<UninstallFilterResponse>;
274
-
275
- type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
276
- type ReplacementResponse<TChain extends Chain = Chain> = {
277
- reason: ReplacementReason;
278
- replacedTransaction: Transaction;
279
- transaction: Transaction;
280
- transactionReceipt: GetTransactionReceiptResponse<TChain>;
281
- };
282
- type WaitForTransactionReceiptResponse<TChain extends Chain = Chain> = GetTransactionReceiptResponse<TChain>;
283
- type WaitForTransactionReceiptArgs<TChain extends Chain = Chain> = {
284
- /** The number of confirmations (blocks that have passed) to wait before resolving. */
285
- confirmations?: number;
286
- /** The hash of the transaction. */
287
- hash: Hash;
288
- onReplaced?: (response: ReplacementResponse<TChain>) => void;
289
- /** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
290
- pollingInterval?: number;
291
- /** Optional timeout (in milliseconds) to wait before stopping polling. */
292
- timeout?: number;
293
- };
294
- declare function waitForTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptArgs<TChain>): Promise<WaitForTransactionReceiptResponse<TChain>>;
295
-
296
- type OnBlockNumberResponse = GetBlockNumberResponse;
297
- type OnBlockNumber = (blockNumber: OnBlockNumberResponse, prevBlockNumber: OnBlockNumberResponse | undefined) => void;
298
- type WatchBlockNumberArgs = {
299
- /** Whether or not to emit the missed block numbers to the callback. */
300
- emitMissed?: boolean;
301
- /** Whether or not to emit the latest block number to the callback when the subscription opens. */
302
- emitOnBegin?: boolean;
303
- /** The callback to call when a new block number is received. */
304
- onBlockNumber: OnBlockNumber;
305
- /** The callback to call when an error occurred when trying to get for a new block. */
306
- onError?: (error: Error) => void;
307
- /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
308
- pollingInterval?: number;
309
- };
310
- /** @description Watches and returns incoming block numbers. */
311
- declare function watchBlockNumber(client: PublicClient, { emitOnBegin, emitMissed, onBlockNumber, onError, pollingInterval, }: WatchBlockNumberArgs): () => void;
312
-
313
- type OnBlockResponse<TChain extends Chain = Chain, TIncludeTransactions = false> = Omit<GetBlockResponse<TChain>, TIncludeTransactions extends false ? 'transactions' : ''>;
314
- type OnBlock<TChain extends Chain = Chain, TIncludeTransactions = false> = (block: OnBlockResponse<TChain, TIncludeTransactions>, prevBlock: OnBlockResponse<TChain, TIncludeTransactions> | undefined) => void;
315
- type WatchBlocksArgs<TChain extends Chain = Chain> = {
316
- /** The block tag. Defaults to "latest". */
317
- blockTag?: BlockTag;
318
- /** Whether or not to emit the missed blocks to the callback. */
319
- emitMissed?: boolean;
320
- /** Whether or not to emit the block to the callback when the subscription opens. */
321
- emitOnBegin?: boolean;
322
- /** The callback to call when an error occurred when trying to get for a new block. */
323
- onError?: (error: Error) => void;
324
- /** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
325
- pollingInterval?: number;
326
- } & ({
327
- /** Whether or not to include transaction data in the response. */
328
- includeTransactions: true;
329
- /** The callback to call when a new block is received. */
330
- onBlock: OnBlock<TChain, true>;
331
- } | {
332
- /** Whether or not to include transaction data in the response. */
333
- includeTransactions?: false;
334
- /** The callback to call when a new block is received. */
335
- onBlock: OnBlock<TChain>;
336
- });
337
- /** @description Watches and returns information for incoming blocks. */
338
- declare function watchBlocks<TChain extends Chain, TWatchBlocksArgs extends WatchBlocksArgs<TChain>>(client: PublicClient<any, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, pollingInterval, }: TWatchBlocksArgs): () => void;
339
-
340
- type OnTransactionsResponse = Hash[];
341
- type OnTransactions = (transactions: OnTransactionsResponse) => void;
342
- type WatchPendingTransactionsArgs = {
343
- /** Whether or not the transaction hashes should be batched on each invocation. */
344
- batch?: boolean;
345
- /** The callback to call when an error occurred when trying to get for a new block. */
346
- onError?: (error: Error) => void;
347
- /** The callback to call when new transactions are received. */
348
- onTransactions: OnTransactions;
349
- /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
350
- pollingInterval?: number;
351
- };
352
- declare function watchPendingTransactions(client: PublicClient, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsArgs): () => void;
353
-
354
- export { CreateBlockFilterResponse, CreatePendingTransactionFilterResponse, EstimateGasArgs, EstimateGasResponse, GetBalanceArgs, GetBalanceResponse, GetBlockArgs, GetBlockNumberArgs, GetBlockNumberResponse, GetBlockResponse, GetBlockTransactionCountArgs, GetBlockTransactionCountResponse, GetFeeHistoryArgs, GetFeeHistoryResponse, GetFilterChangesArgs, GetFilterChangesResponse, GetFilterLogsArgs, GetFilterLogsResponse, GetGasPriceResponse, GetTransactionArgs, GetTransactionConfirmationsArgs, GetTransactionConfirmationsResponse, GetTransactionCountArgs, GetTransactionCountResponse, GetTransactionReceiptArgs, GetTransactionReceiptResponse, GetTransactionResponse, OnBlock, OnBlockNumber, OnBlockNumberResponse, OnBlockResponse, OnTransactions, OnTransactionsResponse, ReplacementReason, ReplacementResponse, UninstallFilterArgs, UninstallFilterResponse, WaitForTransactionReceiptArgs, WaitForTransactionReceiptResponse, WatchBlockNumberArgs, WatchBlocksArgs, WatchPendingTransactionsArgs, createBlockFilter, createPendingTransactionFilter, estimateGas, getBalance, getBlock, getBlockNumber, getBlockNumberCache, getBlockTransactionCount, getChainId, getFeeHistory, getFilterChanges, getFilterLogs, getGasPrice, getLogs, getTransaction, getTransactionConfirmations, getTransactionCount, getTransactionReceipt, uninstallFilter, waitForTransactionReceipt, watchBlockNumber, watchBlocks, watchPendingTransactions };
31
+ export { GetTransactionCountArgs, GetTransactionCountResponse, getTransactionCount };
package/dist/public.js CHANGED
@@ -25,9 +25,9 @@
25
25
 
26
26
 
27
27
 
28
- var _chunkJY7JGKSAjs = require('./chunk-JY7JGKSA.js');
29
- require('./chunk-W7KWIGWO.js');
30
28
 
29
+ var _chunk4VQKZYE2js = require('./chunk-4VQKZYE2.js');
30
+ require('./chunk-EYORBAD4.js');
31
31
 
32
32
 
33
33
 
@@ -54,5 +54,7 @@ require('./chunk-W7KWIGWO.js');
54
54
 
55
55
 
56
56
 
57
- exports.call = _chunkJY7JGKSAjs.call; exports.createBlockFilter = _chunkJY7JGKSAjs.createBlockFilter; exports.createPendingTransactionFilter = _chunkJY7JGKSAjs.createPendingTransactionFilter; exports.estimateGas = _chunkJY7JGKSAjs.estimateGas; exports.getBalance = _chunkJY7JGKSAjs.getBalance; exports.getBlock = _chunkJY7JGKSAjs.getBlock; exports.getBlockNumber = _chunkJY7JGKSAjs.getBlockNumber; exports.getBlockNumberCache = _chunkJY7JGKSAjs.getBlockNumberCache; exports.getBlockTransactionCount = _chunkJY7JGKSAjs.getBlockTransactionCount; exports.getBytecode = _chunkJY7JGKSAjs.getBytecode; exports.getChainId = _chunkJY7JGKSAjs.getChainId; exports.getFeeHistory = _chunkJY7JGKSAjs.getFeeHistory; exports.getFilterChanges = _chunkJY7JGKSAjs.getFilterChanges; exports.getFilterLogs = _chunkJY7JGKSAjs.getFilterLogs; exports.getGasPrice = _chunkJY7JGKSAjs.getGasPrice; exports.getLogs = _chunkJY7JGKSAjs.getLogs; exports.getTransaction = _chunkJY7JGKSAjs.getTransaction; exports.getTransactionConfirmations = _chunkJY7JGKSAjs.getTransactionConfirmations; exports.getTransactionCount = _chunkJY7JGKSAjs.getTransactionCount; exports.getTransactionReceipt = _chunkJY7JGKSAjs.getTransactionReceipt; exports.uninstallFilter = _chunkJY7JGKSAjs.uninstallFilter; exports.waitForTransactionReceipt = _chunkJY7JGKSAjs.waitForTransactionReceipt; exports.watchBlockNumber = _chunkJY7JGKSAjs.watchBlockNumber; exports.watchBlocks = _chunkJY7JGKSAjs.watchBlocks; exports.watchEvent = _chunkJY7JGKSAjs.watchEvent; exports.watchPendingTransactions = _chunkJY7JGKSAjs.watchPendingTransactions;
57
+
58
+
59
+ exports.call = _chunk4VQKZYE2js.call; exports.createBlockFilter = _chunk4VQKZYE2js.createBlockFilter; exports.createEventFilter = _chunk4VQKZYE2js.createEventFilter; exports.createPendingTransactionFilter = _chunk4VQKZYE2js.createPendingTransactionFilter; exports.estimateGas = _chunk4VQKZYE2js.estimateGas; exports.getBalance = _chunk4VQKZYE2js.getBalance; exports.getBlock = _chunk4VQKZYE2js.getBlock; exports.getBlockNumber = _chunk4VQKZYE2js.getBlockNumber; exports.getBlockNumberCache = _chunk4VQKZYE2js.getBlockNumberCache; exports.getBlockTransactionCount = _chunk4VQKZYE2js.getBlockTransactionCount; exports.getBytecode = _chunk4VQKZYE2js.getBytecode; exports.getChainId = _chunk4VQKZYE2js.getChainId; exports.getFeeHistory = _chunk4VQKZYE2js.getFeeHistory; exports.getFilterChanges = _chunk4VQKZYE2js.getFilterChanges; exports.getFilterLogs = _chunk4VQKZYE2js.getFilterLogs; exports.getGasPrice = _chunk4VQKZYE2js.getGasPrice; exports.getLogs = _chunk4VQKZYE2js.getLogs; exports.getTransaction = _chunk4VQKZYE2js.getTransaction; exports.getTransactionConfirmations = _chunk4VQKZYE2js.getTransactionConfirmations; exports.getTransactionCount = _chunk4VQKZYE2js.getTransactionCount; exports.getTransactionReceipt = _chunk4VQKZYE2js.getTransactionReceipt; exports.uninstallFilter = _chunk4VQKZYE2js.uninstallFilter; exports.waitForTransactionReceipt = _chunk4VQKZYE2js.waitForTransactionReceipt; exports.watchBlockNumber = _chunk4VQKZYE2js.watchBlockNumber; exports.watchBlocks = _chunk4VQKZYE2js.watchBlocks; exports.watchEvent = _chunk4VQKZYE2js.watchEvent; exports.watchPendingTransactions = _chunk4VQKZYE2js.watchPendingTransactions;
58
60
  //# sourceMappingURL=public.js.map
package/dist/public.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  call,
3
3
  createBlockFilter,
4
+ createEventFilter,
4
5
  createPendingTransactionFilter,
5
6
  estimateGas,
6
7
  getBalance,
@@ -25,11 +26,12 @@ import {
25
26
  watchBlocks,
26
27
  watchEvent,
27
28
  watchPendingTransactions
28
- } from "./chunk-BJJH7RYH.mjs";
29
- import "./chunk-AKGXRZDN.mjs";
29
+ } from "./chunk-TQC7KZ24.mjs";
30
+ import "./chunk-RR4MGS6O.mjs";
30
31
  export {
31
32
  call,
32
33
  createBlockFilter,
34
+ createEventFilter,
33
35
  createPendingTransactionFilter,
34
36
  estimateGas,
35
37
  getBalance,
@@ -0,0 +1,213 @@
1
+ import { a as Hash, q as RpcTransaction, A as Address$1, a2 as Quantity, u as TransactionRequest, H as Hex, C as Chain } from './chain-4d46a747.js';
2
+ import { T as TestRequests } from './eip1193-f09a55af.js';
3
+ import { a as Transport, b as ClientConfig, C as Client } from './createClient-5d5c14d6.js';
4
+ import { Address } from 'abitype';
5
+
6
+ type DropTransactionArgs = {
7
+ /** The hash of the transaction to drop. */
8
+ hash: Hash;
9
+ };
10
+ declare function dropTransaction(client: TestClient, { hash }: DropTransactionArgs): Promise<void>;
11
+
12
+ type GetAutomineResponse = boolean;
13
+ declare function getAutomine(client: TestClient): Promise<GetAutomineResponse>;
14
+
15
+ type GetTxPoolContentResponse = {
16
+ pending: Record<Address, Record<string, RpcTransaction>>;
17
+ queued: Record<Address, Record<string, RpcTransaction>>;
18
+ };
19
+ declare function getTxpoolContent(client: TestClient): Promise<GetTxPoolContentResponse>;
20
+
21
+ type GetTxPoolStatusResponse = {
22
+ pending: number;
23
+ queued: number;
24
+ };
25
+ declare function getTxpoolStatus(client: TestClient): Promise<GetTxPoolStatusResponse>;
26
+
27
+ type ImpersonateAccountArgs = {
28
+ /** The account to impersonate. */
29
+ address: Address$1;
30
+ };
31
+ declare function impersonateAccount(client: TestClient, { address }: ImpersonateAccountArgs): Promise<void>;
32
+
33
+ type IncreaseTimeArgs = {
34
+ /** The amount of seconds to jump forward in time. */
35
+ seconds: number;
36
+ };
37
+ declare function increaseTime(client: TestClient, { seconds }: IncreaseTimeArgs): Promise<`0x${string}`>;
38
+
39
+ type InspectTxpoolResponse = {
40
+ pending: Record<Address$1, Record<string, string>>;
41
+ queued: Record<Address$1, Record<string, string>>;
42
+ };
43
+ declare function inspectTxpool(client: TestClient): Promise<InspectTxpoolResponse>;
44
+
45
+ type MineArgs = {
46
+ /** Number of blocks to mine. */
47
+ blocks: number;
48
+ /** Interval between each block in seconds. */
49
+ interval?: number;
50
+ };
51
+ declare function mine(client: TestClient, { blocks, interval }: MineArgs): Promise<void>;
52
+
53
+ type ResetArgs = {
54
+ /** The block number to reset from. */
55
+ blockNumber?: bigint;
56
+ /** The JSON RPC URL. */
57
+ jsonRpcUrl?: string;
58
+ };
59
+ declare function reset(client: TestClient, { blockNumber, jsonRpcUrl }?: ResetArgs): Promise<void>;
60
+
61
+ type RevertArgs = {
62
+ /** The snapshot ID to revert to. */
63
+ id: Quantity;
64
+ };
65
+ declare function revert(client: TestClient, { id }: RevertArgs): Promise<void>;
66
+
67
+ type SendUnsignedTransactionArgs = TransactionRequest;
68
+ type SendUnsignedTransactionResponse = Hash;
69
+ declare function sendUnsignedTransaction(client: TestClient, request: SendUnsignedTransactionArgs): Promise<SendUnsignedTransactionResponse>;
70
+
71
+ type SetBalanceArgs = {
72
+ /** The account address. */
73
+ address: Address$1;
74
+ /** Amount (in wei) to set */
75
+ value: bigint;
76
+ };
77
+ declare function setBalance(client: TestClient, { address, value }: SetBalanceArgs): Promise<void>;
78
+
79
+ type SetBlockGasLimitArgs = {
80
+ /** Gas limit (in wei). */
81
+ gasLimit: bigint;
82
+ };
83
+ declare function setBlockGasLimit(client: TestClient, { gasLimit }: SetBlockGasLimitArgs): Promise<void>;
84
+
85
+ type SetBlockTimestampIntervalArgs = {
86
+ /** The interval (in seconds). */
87
+ interval: number;
88
+ };
89
+ declare function setBlockTimestampInterval(client: TestClient, { interval }: SetBlockTimestampIntervalArgs): Promise<void>;
90
+
91
+ type SetCodeArgs = {
92
+ /** The account address. */
93
+ address: Address$1;
94
+ /** The bytecode to set */
95
+ bytecode: Hex;
96
+ };
97
+ declare function setCode(client: TestClient, { address, bytecode }: SetCodeArgs): Promise<void>;
98
+
99
+ type SetCoinbaseArgs = {
100
+ /** The coinbase address. */
101
+ address: Address$1;
102
+ };
103
+ declare function setCoinbase(client: TestClient, { address }: SetCoinbaseArgs): Promise<void>;
104
+
105
+ type SetIntervalMiningArgs = {
106
+ /** The mining interval. */
107
+ interval: number;
108
+ };
109
+ declare function setIntervalMining(client: TestClient, { interval }: SetIntervalMiningArgs): Promise<void>;
110
+
111
+ type SetMinGasPriceArgs = {
112
+ /** The gas price. */
113
+ gasPrice: bigint;
114
+ };
115
+ declare function setMinGasPrice(client: TestClient, { gasPrice }: SetMinGasPriceArgs): Promise<void>;
116
+
117
+ type SetNextBlockBaseFeePerGasArgs = {
118
+ /** Base fee per gas (in wei). */
119
+ baseFeePerGas: bigint;
120
+ };
121
+ declare function setNextBlockBaseFeePerGas(client: TestClient, { baseFeePerGas }: SetNextBlockBaseFeePerGasArgs): Promise<void>;
122
+
123
+ type SetNextBlockTimestampArgs = {
124
+ /** The timestamp (in seconds). */
125
+ timestamp: bigint;
126
+ };
127
+ declare function setNextBlockTimestamp(client: TestClient, { timestamp }: SetNextBlockTimestampArgs): Promise<void>;
128
+
129
+ type SetNonceArgs = {
130
+ /** The account address. */
131
+ address: Address$1;
132
+ /** The nonce to set. */
133
+ nonce: number;
134
+ };
135
+ declare function setNonce(client: TestClient, { address, nonce }: SetNonceArgs): Promise<void>;
136
+
137
+ type SetStorageAtArgs = {
138
+ /** The account address. */
139
+ address: Address$1;
140
+ /** The storage slot (index). Can either be a number or hash value. */
141
+ index: number | Hash;
142
+ /** The value to store as a 32 byte hex string. */
143
+ value: Hex;
144
+ };
145
+ declare function setStorageAt(client: TestClient, { address, index, value }: SetStorageAtArgs): Promise<void>;
146
+
147
+ type StopImpersonatingAccountArgs = {
148
+ /** The account to impersonate. */
149
+ address: Address$1;
150
+ };
151
+ declare function stopImpersonatingAccount(client: TestClient, { address }: StopImpersonatingAccountArgs): Promise<void>;
152
+
153
+ type TestClientModes = 'anvil' | 'hardhat';
154
+ type TestClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain, TMode extends TestClientModes = TestClientModes> = {
155
+ chain?: ClientConfig<TTransport, TChain>['chain'];
156
+ /** The key of the client. */
157
+ key?: ClientConfig['key'];
158
+ /** Mode of the test client. Available: "anvil" | "hardhat" */
159
+ mode: TMode;
160
+ /** The name of the client. */
161
+ name?: ClientConfig['name'];
162
+ /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */
163
+ pollingInterval?: ClientConfig['pollingInterval'];
164
+ transport: ClientConfig<TTransport, TChain>['transport'];
165
+ };
166
+ type TestClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TMode extends TestClientModes = TestClientModes, TIncludeActions extends boolean = true> = Client<TTransport, TChain, TestRequests<TMode>> & {
167
+ mode: TMode;
168
+ } & (TIncludeActions extends true ? TestActions<TChain> : {});
169
+ /**
170
+ * @description Creates a test client with a given transport.
171
+ *
172
+ * - Only has access to "test" RPC methods (ie. `anvil_setBalance`,
173
+ * `evm_mine`, etc).
174
+ *
175
+ * @example
176
+ * import { createTestClient, http } from 'viem'
177
+ * import { local } from 'viem/chains'
178
+ * const client = createTestClient({ chain: local, mode: 'anvil', transport: http() })
179
+ */
180
+ declare function createTestClient<TTransport extends Transport, TChain extends Chain, TMode extends TestClientModes>({ chain, key, name, mode, pollingInterval, transport, }: TestClientConfig<TTransport, TChain, TMode>): TestClient<TTransport, TChain, TMode, true>;
181
+
182
+ type TestActions<TChain extends Chain = Chain> = {
183
+ dropTransaction: (args: DropTransactionArgs) => Promise<void>;
184
+ getAutomine: () => Promise<GetAutomineResponse>;
185
+ getTxPoolContent: () => Promise<GetTxPoolContentResponse>;
186
+ getTxPoolStatus: () => Promise<GetTxPoolStatusResponse>;
187
+ impersonateAccount: (args: ImpersonateAccountArgs) => Promise<void>;
188
+ increaseTime: (args: IncreaseTimeArgs) => Promise<Quantity>;
189
+ inspectTxpool: () => Promise<InspectTxpoolResponse>;
190
+ mine: (args: MineArgs) => Promise<void>;
191
+ removeBlockTimestampInterval: () => Promise<void>;
192
+ reset: (args: ResetArgs) => Promise<void>;
193
+ revert: (args: RevertArgs) => Promise<void>;
194
+ sendUnsignedTransaction: (args: SendUnsignedTransactionArgs) => Promise<SendUnsignedTransactionResponse>;
195
+ setAutomine: (args: boolean) => Promise<void>;
196
+ setBalance: (args: SetBalanceArgs) => Promise<void>;
197
+ setBlockGasLimit: (args: SetBlockGasLimitArgs) => Promise<void>;
198
+ setBlockTimestampInterval: (args: SetBlockTimestampIntervalArgs) => Promise<void>;
199
+ setCode: (args: SetCodeArgs) => Promise<void>;
200
+ setCoinbase: (args: SetCoinbaseArgs) => Promise<void>;
201
+ setIntervalMining: (args: SetIntervalMiningArgs) => Promise<void>;
202
+ setLoggingEnabled: (args: boolean) => Promise<void>;
203
+ setMinGasPrice: (args: SetMinGasPriceArgs) => Promise<void>;
204
+ setNextBlockBaseFeePerGas: (args: SetNextBlockBaseFeePerGasArgs) => Promise<void>;
205
+ setNextBlockTimestamp: (args: SetNextBlockTimestampArgs) => Promise<void>;
206
+ setNonce: (args: SetNonceArgs) => Promise<void>;
207
+ setRpcUrl: (args: string) => Promise<void>;
208
+ setStorageAt: (args: SetStorageAtArgs) => Promise<void>;
209
+ snapshot: () => Promise<Quantity>;
210
+ stopImpersonatingAccount: (args: StopImpersonatingAccountArgs) => Promise<void>;
211
+ };
212
+
213
+ export { RevertArgs as A, SendUnsignedTransactionResponse as B, SetBalanceArgs as C, DropTransactionArgs as D, SetBlockGasLimitArgs as E, SetBlockTimestampIntervalArgs as F, SetCodeArgs as G, SetCoinbaseArgs as H, ImpersonateAccountArgs as I, SetIntervalMiningArgs as J, SetMinGasPriceArgs as K, SetNextBlockBaseFeePerGasArgs as L, MineArgs as M, SetNextBlockTimestampArgs as N, SetNonceArgs as O, SetStorageAtArgs as P, StopImpersonatingAccountArgs as Q, ResetArgs as R, SendUnsignedTransactionArgs as S, TestClient as T, TestClientConfig as a, getTxpoolContent as b, createTestClient as c, dropTransaction as d, getTxpoolStatus as e, increaseTime as f, getAutomine as g, inspectTxpool as h, impersonateAccount as i, revert as j, setBalance as k, setBlockGasLimit as l, mine as m, setBlockTimestampInterval as n, setCode as o, setCoinbase as p, setIntervalMining as q, reset as r, sendUnsignedTransaction as s, setMinGasPrice as t, setNextBlockBaseFeePerGas as u, setNextBlockTimestamp as v, setNonce as w, setStorageAt as x, stopImpersonatingAccount as y, IncreaseTimeArgs as z };