viem 0.1.23 → 0.2.0-0-2-0.20230328T054201

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 (72) hide show
  1. package/accounts/package.json +4 -0
  2. package/dist/abi.d.ts +3 -3
  3. package/dist/abi.js +2 -2
  4. package/dist/abi.mjs +1 -1
  5. package/dist/accounts/index.d.ts +90 -0
  6. package/dist/accounts/index.js +152 -0
  7. package/dist/accounts/index.js.map +1 -0
  8. package/dist/accounts/index.mjs +152 -0
  9. package/dist/accounts/index.mjs.map +1 -0
  10. package/dist/{chain-ec8c485d.d.ts → chain-40443542.d.ts} +1 -1
  11. package/dist/{chain-1b53ef88.d.ts → chain-4af995bf.d.ts} +77 -36
  12. package/dist/chains.d.ts +3 -3
  13. package/dist/chains.js +63 -63
  14. package/dist/chains.mjs +1 -1
  15. package/dist/chunk-43HQD3IL.js +31 -0
  16. package/dist/chunk-43HQD3IL.js.map +1 -0
  17. package/dist/{chunk-HRVPAYH7.mjs → chunk-DFMQLPHS.mjs} +2 -2
  18. package/dist/chunk-DFMQLPHS.mjs.map +1 -0
  19. package/dist/{chunk-66PXETQB.js → chunk-FZPFAAOJ.js} +19 -19
  20. package/dist/chunk-FZPFAAOJ.js.map +1 -0
  21. package/dist/{chunk-JG6MI5ZV.mjs → chunk-HYEOQX7O.mjs} +1106 -199
  22. package/dist/chunk-HYEOQX7O.mjs.map +1 -0
  23. package/dist/{chunk-Z54YSSBJ.js → chunk-OW7TKT7L.js} +1168 -261
  24. package/dist/chunk-OW7TKT7L.js.map +1 -0
  25. package/dist/chunk-UK6FAD4V.mjs +31 -0
  26. package/dist/chunk-UK6FAD4V.mjs.map +1 -0
  27. package/dist/contract.d.ts +9 -7
  28. package/dist/contract.js +2 -2
  29. package/dist/contract.mjs +1 -1
  30. package/dist/{createClient-a28317a9.d.ts → createClient-1f19be8d.d.ts} +24 -10
  31. package/dist/{createPublicClient-b250a534.d.ts → createPublicClient-fd8b1349.d.ts} +229 -242
  32. package/dist/{eip1193-4f4e240c.d.ts → eip1193-210ab776.d.ts} +1 -1
  33. package/dist/{encodeFunctionResult-1f324375.d.ts → encodeFunctionResult-a252fba1.d.ts} +1 -1
  34. package/dist/{encodePacked-d5d5264a.d.ts → encodePacked-a9464e97.d.ts} +1 -1
  35. package/dist/ens.d.ts +6 -4
  36. package/dist/ens.js +3 -3
  37. package/dist/ens.mjs +2 -2
  38. package/dist/ethers.d.ts +5 -6
  39. package/dist/ethers.js +7 -5
  40. package/dist/ethers.js.map +1 -1
  41. package/dist/ethers.mjs +7 -5
  42. package/dist/ethers.mjs.map +1 -1
  43. package/dist/{formatAbiItem-15e8817d.d.ts → formatAbiItem-6ed70dbd.d.ts} +1 -1
  44. package/dist/{getAbiItem-3e809ff9.d.ts → getAbiItem-1ff0f41a.d.ts} +1 -1
  45. package/dist/index.d.ts +22 -14
  46. package/dist/index.js +136 -101
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +78 -43
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/parseAccount-8e131c73.d.ts +6 -0
  51. package/dist/{parseGwei-bd0eea6c.d.ts → parseGwei-5e2a8e87.d.ts} +95 -15
  52. package/dist/public.d.ts +6 -4
  53. package/dist/public.js +2 -2
  54. package/dist/public.mjs +1 -1
  55. package/dist/test-e28db435.d.ts +198 -0
  56. package/dist/test.d.ts +11 -11
  57. package/dist/test.js +2 -2
  58. package/dist/test.mjs +1 -1
  59. package/dist/typedData-848139b1.d.ts +93 -0
  60. package/dist/utils/index.d.ts +22 -30
  61. package/dist/utils/index.js +26 -2
  62. package/dist/utils/index.mjs +29 -5
  63. package/dist/wallet.d.ts +6 -4
  64. package/dist/wallet.js +2 -2
  65. package/dist/wallet.mjs +1 -1
  66. package/dist/window.d.ts +2 -2
  67. package/package.json +10 -2
  68. package/dist/chunk-66PXETQB.js.map +0 -1
  69. package/dist/chunk-HRVPAYH7.mjs.map +0 -1
  70. package/dist/chunk-JG6MI5ZV.mjs.map +0 -1
  71. package/dist/chunk-Z54YSSBJ.js.map +0 -1
  72. package/dist/test-2bd23d7e.d.ts +0 -205
@@ -1,27 +1,10 @@
1
- import { W as WalletPermission, a as WatchAssetParams, P as PublicRequests } from './eip1193-4f4e240c.js';
2
- import { a as Transport, b as ClientConfig, C as Client } from './createClient-a28317a9.js';
3
- import { Abi, Narrow, Address, AbiEvent, ExtractAbiEvent, TypedData, TypedDataDomain, TypedDataToPrimitiveTypes } from 'abitype';
4
- import { C as Chain, H as Hex, h as ExtractConstructorArgsFromAbi, W as ExtractFormatter, a1 as Formatters, a2 as Formatter, X as Formatted, c as Block, R as RpcBlock, O as Transaction, T as TransactionReceipt, z as RpcTransactionReceipt, a3 as TransactionType, D as RpcTransactionRequest, I as TransactionRequest, f as BlockTag, a4 as MergeIntersectionProperties, g as ContractConfig, a5 as GetValue, p as ExtractResultFromAbi, a6 as MaybeAbiEventName, a7 as MaybeExtractEventArgsFromAbi, e as BlockNumber, m as ExtractEventNameFromAbi, a as Hash, F as FeeHistory, L as Log, Y as FormattedTransaction, Z as TransactionFormatter, k as ExtractEventArgsFromAbi, a8 as Prettify } from './chain-1b53ef88.js';
1
+ import { W as WalletPermission, a as WatchAssetParams, R as Requests, P as PublicRequests } from './eip1193-210ab776.js';
2
+ import { a as Transport, b as ClientConfig, C as Client } from './createClient-1f19be8d.js';
3
+ import { Address, Abi, Narrow, TypedData, AbiEvent, ExtractAbiEvent } from 'abitype';
4
+ import { C as Chain, a4 as ExtractFormatter, ab as Formatters, ac as Formatter, a5 as Formatted, c as Block, R as RpcBlock, T as Transaction, O as TransactionReceipt, z as RpcTransactionReceipt, I as TransactionType, D as RpcTransactionRequest, P as TransactionRequest, f as BlockTag, H as Hex, ad as MergeIntersectionProperties, ae as GetChain, h as ExtractConstructorArgsFromAbi, a as Hash, af as GetValue, g as ContractConfig, p as ExtractResultFromAbi, ag as MaybeAbiEventName, ah as MaybeExtractEventArgsFromAbi, e as BlockNumber, m as ExtractEventNameFromAbi, F as FeeHistory, L as Log, a6 as FormattedTransaction, a7 as TransactionFormatter, k as ExtractEventArgsFromAbi, ai as IsUndefined, aj as Prettify } from './chain-4af995bf.js';
5
+ import { A as Account, T as TypedDataDefinition, J as JsonRpcAccount } from './typedData-848139b1.js';
5
6
 
6
- type AddChainParameters = {
7
- chain: Chain;
8
- };
9
- declare function addChain(client: WalletClient, { chain }: AddChainParameters): Promise<void>;
10
-
11
- type DeployContractParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi> = Omit<SendTransactionParameters<TChain>, 'accessList' | 'to' | 'data' | 'value'> & {
12
- abi: Narrow<TAbi>;
13
- bytecode: Hex;
14
- } & ExtractConstructorArgsFromAbi<TAbi>;
15
- type DeployContractReturnType = SendTransactionReturnType;
16
- declare function deployContract<TChain extends Chain, TAbi extends Abi | readonly unknown[]>(walletClient: WalletClient, { abi, args, bytecode, ...request }: DeployContractParameters<TChain, TAbi>): Promise<DeployContractReturnType>;
17
-
18
- type GetAddressesReturnType = Address[];
19
- declare function getAddresses(client: WalletClient): Promise<GetAddressesReturnType>;
20
-
21
- type GetChainIdReturnType = number;
22
- declare function getChainId(client: PublicClient | WalletClient): Promise<GetChainIdReturnType>;
23
-
24
- type BlockFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>>;
7
+ type BlockFormatter<TChain extends Chain | undefined = Chain> = TChain extends Chain ? ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>> : Formatters['block'];
25
8
  type FormattedBlock<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Block>;
26
9
  declare function formatBlock(block: Partial<RpcBlock>): Block<bigint, Transaction<bigint, number>>;
27
10
  declare const defineBlock: <TFormat extends Formatter<Partial<RpcBlock>, Partial<Block<bigint, Transaction<bigint, number>>> & {
@@ -33,7 +16,7 @@ declare const defineBlock: <TFormat extends Formatter<Partial<RpcBlock>, Partial
33
16
  [key: string]: unknown;
34
17
  }) => Block<bigint, Transaction<bigint, number>> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
35
18
 
36
- type TransactionReceiptFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionReceipt', NonNullable<Formatters['transactionReceipt']>>;
19
+ type TransactionReceiptFormatter<TChain extends Chain | undefined = Chain> = TChain extends Chain ? ExtractFormatter<TChain, 'transactionReceipt', NonNullable<Formatters['transactionReceipt']>> : Formatters['transactionReceipt'];
37
20
  type FormattedTransactionReceipt<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, TransactionReceipt>;
38
21
  declare const defineTransactionReceipt: <TFormat extends Formatter<Partial<RpcTransactionReceipt>, Partial<TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>> & {
39
22
  [key: string]: unknown;
@@ -44,7 +27,7 @@ declare const defineTransactionReceipt: <TFormat extends Formatter<Partial<RpcTr
44
27
  [key: string]: unknown;
45
28
  }) => TransactionReceipt<bigint, number, "success" | "reverted", TransactionType> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
46
29
 
47
- type TransactionRequestFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionRequest', NonNullable<Formatters['transactionRequest']>>;
30
+ type TransactionRequestFormatter<TChain extends Chain | undefined = Chain> = TChain extends Chain ? ExtractFormatter<TChain, 'transactionRequest', NonNullable<Formatters['transactionRequest']>> : Formatters['transactionRequest'];
48
31
  type FormattedTransactionRequest$1<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, RpcTransactionRequest>;
49
32
  declare function formatTransactionRequest(transactionRequest: Partial<TransactionRequest>): RpcTransactionRequest;
50
33
  declare const defineTransactionRequest: <TFormat extends Formatter<Partial<TransactionRequest<bigint, number>>, Partial<RpcTransactionRequest> & {
@@ -57,8 +40,8 @@ declare const defineTransactionRequest: <TFormat extends Formatter<Partial<Trans
57
40
  }) => RpcTransactionRequest & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
58
41
 
59
42
  type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
60
- type CallParameters<TChain extends Chain = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
61
- account?: Account;
43
+ type CallParameters<TChain extends Chain | undefined = Chain | undefined> = FormattedCall<TransactionRequestFormatter<TChain>> & {
44
+ account?: Account | Address;
62
45
  } & ({
63
46
  /** The balance of the account at a block number. */
64
47
  blockNumber?: bigint;
@@ -71,24 +54,97 @@ type CallParameters<TChain extends Chain = Chain> = FormattedCall<TransactionReq
71
54
  type CallReturnType = {
72
55
  data: Hex | undefined;
73
56
  };
74
- declare function call<TChain extends Chain>(client: PublicClient<any, TChain>, args: CallParameters<TChain>): Promise<CallReturnType>;
57
+ declare function call<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, args: CallParameters<TChain>): Promise<CallReturnType>;
58
+
59
+ type AddChainParameters = {
60
+ chain: Chain;
61
+ };
62
+ declare function addChain<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: WalletClient<Transport, TChain, TAccount>, { chain }: AddChainParameters): Promise<void>;
63
+
64
+ type DeployContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = undefined> = Omit<SendTransactionParameters<TChain, TAccount, TChainOverride>, 'accessList' | 'chain' | 'to' | 'data' | 'value'> & {
65
+ abi: Narrow<TAbi>;
66
+ bytecode: Hex;
67
+ } & GetChain<TChain, TChainOverride> & ExtractConstructorArgsFromAbi<TAbi>;
68
+ type DeployContractReturnType = SendTransactionReturnType;
69
+ declare function deployContract<TAbi extends Abi | readonly unknown[], TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined>(walletClient: WalletClient<Transport, TChain, TAccount>, { abi, args, bytecode, ...request }: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>): Promise<DeployContractReturnType>;
70
+
71
+ type GetAddressesReturnType = Address[];
72
+ declare function getAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<GetAddressesReturnType>;
73
+
74
+ type GetChainIdReturnType = number;
75
+ declare function getChainId<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>): Promise<GetChainIdReturnType>;
76
+
77
+ type GetPermissionsReturnType = WalletPermission[];
78
+ declare function getPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<WalletPermission[]>;
79
+
80
+ type RequestAddressesReturnType = Address[];
81
+ declare function requestAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<RequestAddressesReturnType>;
82
+
83
+ type RequestPermissionsParameters = {
84
+ eth_accounts: Record<string, any>;
85
+ } & {
86
+ [key: string]: Record<string, any>;
87
+ };
88
+ type RequestPermissionsReturnType = WalletPermission[];
89
+ declare function requestPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, permissions: RequestPermissionsParameters): Promise<WalletPermission[]>;
90
+
91
+ type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
92
+ type SendTransactionParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain> = FormattedTransactionRequest<TransactionRequestFormatter<TChainOverride>> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride>;
93
+ type SendTransactionReturnType = Hash;
94
+ declare function sendTransaction<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined>(client: WalletClient<Transport, TChain, TAccount>, args: SendTransactionParameters<TChain, TAccount, TChainOverride>): Promise<SendTransactionReturnType>;
95
+
96
+ type SignMessageParameters<TAccount extends Account | undefined = Account | undefined> = GetAccountParameter<TAccount> & ({
97
+ /** @deprecated – `data` will be removed in 0.2.0; use `message` instead. */
98
+ data: string;
99
+ message?: never;
100
+ } | {
101
+ data?: never;
102
+ message: string;
103
+ });
104
+ type SignMessageReturnType = Hex;
105
+ declare function signMessage<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: WalletClient<Transport, TChain, TAccount>, { account: account_, data, message, }: SignMessageParameters<TAccount>): Promise<SignMessageReturnType>;
106
+
107
+ type SignTypedDataParameters<TTypedData extends TypedData | {
108
+ [key: string]: unknown;
109
+ } = TypedData, TPrimaryType extends string = string, TAccount extends Account | undefined = undefined> = GetAccountParameter<TAccount> & TypedDataDefinition<TTypedData, TPrimaryType>;
110
+ type SignTypedDataReturnType = Hex;
111
+ declare function signTypedData<TTypedData extends TypedData | {
112
+ [key: string]: unknown;
113
+ }, TPrimaryType extends string, TChain extends Chain | undefined, TAccount extends Account | undefined>(client: WalletClient<Transport, TChain, TAccount>, { account: account_, domain, message, primaryType, types: types_, }: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>): Promise<SignTypedDataReturnType>;
114
+
115
+ type SwitchChainParameters = {
116
+ id: Chain['id'];
117
+ };
118
+ declare function switchChain<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, { id }: SwitchChainParameters): Promise<void>;
75
119
 
76
- type SimulateContractParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined> = Omit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'to' | 'data' | 'value'> & {
120
+ type WatchAssetParameters = WatchAssetParams;
121
+ type WatchAssetReturnType = boolean;
122
+ declare function watchAsset<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
123
+
124
+ type WriteContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = undefined, TChainOverride extends Chain | undefined = undefined> = Omit<SendTransactionParameters<TChain, TAccount, TChainOverride>, 'chain' | 'to' | 'data' | 'value'> & {
125
+ value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
126
+ } & GetChain<TChain, TChainOverride> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
127
+ type WriteContractReturnType = SendTransactionReturnType;
128
+ declare function writeContract<TChain extends Chain | undefined, TAccount extends Account | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, { abi, address, args, functionName, ...request }: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>): Promise<WriteContractReturnType>;
129
+
130
+ type SimulateContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = Omit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'to' | 'data' | 'value'> & {
77
131
  chain?: TChainOverride;
78
132
  } & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
79
133
  value?: GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
80
134
  };
81
- type SimulateContractReturnType<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
135
+ type SimulateContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = {
82
136
  result: ExtractResultFromAbi<TAbi, TFunctionName>;
83
- request: WriteContractParameters<TChain, TAbi, TFunctionName> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
137
+ request: Omit<WriteContractParameters<TAbi, TFunctionName, TChain, undefined, TChainOverride>, 'chain'> & {
138
+ chain: TChainOverride;
139
+ } & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
84
140
  };
85
- declare function simulateContract<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client: PublicClient<any, TChain>, { abi, address, args, functionName, ...callRequest }: SimulateContractParameters<TChain, TAbi, TFunctionName, TChainOverride>): Promise<SimulateContractReturnType<TChainOverride extends Chain ? TChainOverride : TChain, TAbi, TFunctionName>>;
141
+ declare function simulateContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client: PublicClient<Transport, TChain>, { abi, address, args, functionName, ...callRequest }: SimulateContractParameters<TAbi, TFunctionName, TChain, TChainOverride>): Promise<SimulateContractReturnType<TAbi, TFunctionName, TChain, TChainOverride>>;
86
142
 
87
143
  type CreatePendingTransactionFilterReturnType = Filter<'transaction'>;
88
- declare function createPendingTransactionFilter(client: PublicClient): Promise<CreatePendingTransactionFilterReturnType>;
144
+ declare function createPendingTransactionFilter<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>): Promise<CreatePendingTransactionFilterReturnType>;
89
145
 
90
146
  type CreateBlockFilterReturnType = Filter<'block'>;
91
- declare function createBlockFilter(client: PublicClient): Promise<CreateBlockFilterReturnType>;
147
+ declare function createBlockFilter<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>): Promise<CreateBlockFilterReturnType>;
92
148
 
93
149
  type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
94
150
  address?: Address | Address[];
@@ -108,7 +164,7 @@ type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefi
108
164
  event?: never;
109
165
  });
110
166
  type CreateEventFilterReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = Filter<'event', TAbi, TEventName, TArgs>;
111
- declare function createEventFilter<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined>(client: PublicClient, { address, args, event, fromBlock, toBlock, }?: CreateEventFilterParameters<TAbiEvent, TAbi, TEventName, TArgs>): Promise<CreateEventFilterReturnType<TAbiEvent, TAbi, TEventName, TArgs>>;
167
+ declare function createEventFilter<TChain extends Chain | undefined, TAbiEvent extends AbiEvent | undefined, _Abi extends Abi | readonly unknown[] = [TAbiEvent], _EventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, _Args extends MaybeExtractEventArgsFromAbi<_Abi, _EventName> | undefined = undefined>(client: PublicClient<Transport, TChain>, { address, args, event, fromBlock, toBlock, }?: CreateEventFilterParameters<TAbiEvent, _Abi, _EventName, _Args>): Promise<CreateEventFilterReturnType<TAbiEvent, _Abi, _EventName, _Args>>;
112
168
 
113
169
  type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
114
170
  address?: Address | Address[];
@@ -124,12 +180,10 @@ type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] =
124
180
  args?: never;
125
181
  });
126
182
  type CreateContractEventFilterReturnType<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = Filter<'event', TAbi, TEventName, TArgs>;
127
- declare function createContractEventFilter<TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(client: PublicClient, { address, abi, args, eventName, fromBlock, toBlock, }: CreateContractEventFilterParameters<TAbi, TEventName, TArgs>): Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>>;
183
+ declare function createContractEventFilter<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(client: PublicClient<Transport, TChain>, { address, abi, args, eventName, fromBlock, toBlock, }: CreateContractEventFilterParameters<TAbi, TEventName, TArgs>): Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>>;
128
184
 
129
185
  type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
130
- type EstimateGasParameters<TChain extends Chain = Chain> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & {
131
- account: Account;
132
- } & ({
186
+ type EstimateGasParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = undefined> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & GetAccountParameter<TAccount> & ({
133
187
  /** The balance of the account at a block number. */
134
188
  blockNumber?: bigint;
135
189
  blockTag?: never;
@@ -142,13 +196,13 @@ type EstimateGasReturnType = bigint;
142
196
  /**
143
197
  * @description Estimates the gas necessary to complete a transaction without submitting it to the network.
144
198
  */
145
- declare function estimateGas<TChain extends Chain>(client: PublicClient<any, TChain> | WalletClient, args: EstimateGasParameters<TChain>): Promise<EstimateGasReturnType>;
199
+ declare function estimateGas<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>, args: EstimateGasParameters<TChain, TAccount>): Promise<EstimateGasReturnType>;
146
200
 
147
- type EstimateContractGasParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<EstimateGasParameters<TChain>, 'data' | 'to' | 'value'> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
201
+ type EstimateContractGasParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined> = Omit<EstimateGasParameters<TChain>, 'data' | 'to' | 'value'> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
148
202
  value?: GetValue<TAbi, TFunctionName, EstimateGasParameters<TChain>['value']>;
149
203
  };
150
204
  type EstimateContractGasReturnType = bigint;
151
- declare function estimateContractGas<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient<any, TChain>, { abi, address, args, functionName, ...request }: EstimateContractGasParameters<TChain, TAbi, TFunctionName>): Promise<EstimateContractGasReturnType>;
205
+ declare function estimateContractGas<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { abi, address, args, functionName, ...request }: EstimateContractGasParameters<TAbi, TFunctionName, TChain>): Promise<EstimateContractGasReturnType>;
152
206
 
153
207
  type GetBalanceParameters = {
154
208
  /** The address of the account. */
@@ -166,7 +220,7 @@ type GetBalanceReturnType = bigint;
166
220
  /**
167
221
  * @description Returns the balance of an address in wei.
168
222
  */
169
- declare function getBalance(client: PublicClient, { address, blockNumber, blockTag }: GetBalanceParameters): Promise<GetBalanceReturnType>;
223
+ declare function getBalance<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag }: GetBalanceParameters): Promise<GetBalanceReturnType>;
170
224
 
171
225
  type GetBlockParameters = {
172
226
  /** Whether or not to include transaction data in the response. */
@@ -187,8 +241,8 @@ type GetBlockParameters = {
187
241
  /** The block tag. Defaults to 'latest'. */
188
242
  blockTag?: BlockTag;
189
243
  });
190
- type GetBlockReturnType<TChain extends Chain = Chain> = FormattedBlock<BlockFormatter<TChain>>;
191
- declare function getBlock<TChain extends Chain>(client: PublicClient<any, TChain> | WalletClient, { blockHash, blockNumber, blockTag, includeTransactions, }?: GetBlockParameters): Promise<GetBlockReturnType<TChain>>;
244
+ type GetBlockReturnType<TChain extends Chain | undefined = Chain | undefined> = FormattedBlock<BlockFormatter<TChain>>;
245
+ declare function getBlock<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>, { blockHash, blockNumber, blockTag, includeTransactions, }?: GetBlockParameters): Promise<GetBlockReturnType<TChain>>;
192
246
 
193
247
  type GetBlockNumberParameters = {
194
248
  /** The maximum age (in ms) of the cached value. */
@@ -206,13 +260,22 @@ declare function getBlockNumberCache(id: string): {
206
260
  clear: () => boolean;
207
261
  get: () => {
208
262
  created: Date;
263
+ /**
264
+ * @description Returns the number of the most recent block seen.
265
+ */
209
266
  data: unknown;
210
267
  } | undefined;
211
268
  set: (data: {
212
269
  created: Date;
270
+ /**
271
+ * @description Returns the number of the most recent block seen.
272
+ */
213
273
  data: unknown;
214
274
  }) => Map<string, {
215
275
  created: Date;
276
+ /**
277
+ * @description Returns the number of the most recent block seen.
278
+ */
216
279
  data: unknown;
217
280
  }>;
218
281
  };
@@ -220,7 +283,7 @@ declare function getBlockNumberCache(id: string): {
220
283
  /**
221
284
  * @description Returns the number of the most recent block seen.
222
285
  */
223
- declare function getBlockNumber(client: PublicClient<any, any, any>, { maxAge }?: GetBlockNumberParameters): Promise<GetBlockNumberReturnType>;
286
+ declare function getBlockNumber<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { maxAge }?: GetBlockNumberParameters): Promise<GetBlockNumberReturnType>;
224
287
 
225
288
  type GetBlockTransactionCountParameters = {
226
289
  /** Hash of the block. */
@@ -239,7 +302,7 @@ type GetBlockTransactionCountParameters = {
239
302
  blockTag?: BlockTag;
240
303
  };
241
304
  type GetBlockTransactionCountReturnType = number;
242
- declare function getBlockTransactionCount<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountParameters): Promise<GetBlockTransactionCountReturnType>;
305
+ declare function getBlockTransactionCount<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountParameters): Promise<GetBlockTransactionCountReturnType>;
243
306
 
244
307
  type GetBytecodeParameters = {
245
308
  address: Address;
@@ -251,7 +314,7 @@ type GetBytecodeParameters = {
251
314
  blockTag?: never;
252
315
  });
253
316
  type GetBytecodeReturnType = Hex | undefined;
254
- declare function getBytecode(client: PublicClient, { address, blockNumber, blockTag }: GetBytecodeParameters): Promise<GetBytecodeReturnType>;
317
+ declare function getBytecode<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag }: GetBytecodeParameters): Promise<GetBytecodeReturnType>;
255
318
 
256
319
  type GetFeeHistoryParameters = {
257
320
  blockCount: number;
@@ -267,25 +330,25 @@ type GetFeeHistoryReturnType = FeeHistory;
267
330
  /**
268
331
  * @description Returns a collection of historical gas information.
269
332
  */
270
- declare function getFeeHistory(client: PublicClient, { blockCount, blockNumber, blockTag, rewardPercentiles, }: GetFeeHistoryParameters): Promise<GetFeeHistoryReturnType>;
333
+ declare function getFeeHistory<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockCount, blockNumber, blockTag, rewardPercentiles, }: GetFeeHistoryParameters): Promise<GetFeeHistoryReturnType>;
271
334
 
272
335
  type GetFilterChangesParameters<TFilterType extends FilterType = FilterType, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
273
336
  filter: Filter<TFilterType, TAbi, TEventName, any>;
274
337
  };
275
338
  type GetFilterChangesReturnType<TFilterType extends FilterType = FilterType, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = TFilterType extends 'event' ? Log<bigint, number, TAbiEvent, TAbi, TEventName>[] : Hash[];
276
- declare function getFilterChanges<TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient, { filter, }: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>): Promise<GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>>;
339
+ declare function getFilterChanges<TTransport extends Transport, TChain extends Chain | undefined, TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient<TTransport, TChain>, { filter, }: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>): Promise<GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>>;
277
340
 
278
341
  type GetFilterLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
279
342
  filter: Filter<'event', TAbi, TEventName, any>;
280
343
  };
281
344
  type GetFilterLogsReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, TAbi, TEventName>[];
282
- declare function getFilterLogs<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient, { filter }: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>): Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>>;
345
+ declare function getFilterLogs<TChain extends Chain | undefined, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient<Transport, TChain>, { filter }: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>): Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>>;
283
346
 
284
347
  type GetGasPriceReturnType = bigint;
285
348
  /**
286
349
  * @description Returns the current price of gas (in wei).
287
350
  */
288
- declare function getGasPrice(client: PublicClient | WalletClient): Promise<GetGasPriceReturnType>;
351
+ declare function getGasPrice<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>): Promise<GetGasPriceReturnType>;
289
352
 
290
353
  type GetLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
291
354
  /** Address or list of addresses from which logs originated */
@@ -312,7 +375,7 @@ type GetLogsReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TEven
312
375
  /**
313
376
  * @description Returns a collection of event logs.
314
377
  */
315
- declare function getLogs<TAbiEvent extends AbiEvent | undefined>(client: PublicClient, { address, blockHash, fromBlock, toBlock, event, args, }?: GetLogsParameters<TAbiEvent>): Promise<GetLogsReturnType<TAbiEvent>>;
378
+ declare function getLogs<TChain extends Chain | undefined, TAbiEvent extends AbiEvent | undefined>(client: PublicClient<Transport, TChain>, { address, blockHash, fromBlock, toBlock, event, args, }?: GetLogsParameters<TAbiEvent>): Promise<GetLogsReturnType<TAbiEvent>>;
316
379
 
317
380
  type GetStorageAtParameters = {
318
381
  address: Address;
@@ -325,7 +388,7 @@ type GetStorageAtParameters = {
325
388
  blockTag?: never;
326
389
  });
327
390
  type GetStorageAtReturnType = Hex | undefined;
328
- declare function getStorageAt(client: PublicClient, { address, blockNumber, blockTag, slot }: GetStorageAtParameters): Promise<GetStorageAtReturnType>;
391
+ declare function getStorageAt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, slot }: GetStorageAtParameters): Promise<GetStorageAtReturnType>;
329
392
 
330
393
  type GetTransactionParameters = {
331
394
  /** The block hash */
@@ -359,11 +422,11 @@ type GetTransactionParameters = {
359
422
  hash: Hash;
360
423
  index?: number;
361
424
  };
362
- type GetTransactionReturnType<TChain extends Chain = Chain> = FormattedTransaction<TransactionFormatter<TChain>>;
425
+ type GetTransactionReturnType<TChain extends Chain | undefined = Chain> = FormattedTransaction<TransactionFormatter<TChain>>;
363
426
  /** @description Returns information about a transaction given a hash or block identifier. */
364
- declare function getTransaction<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, hash, index, }: GetTransactionParameters): Promise<GetTransactionReturnType<TChain>>;
427
+ declare function getTransaction<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockHash, blockNumber, blockTag, hash, index, }: GetTransactionParameters): Promise<GetTransactionReturnType<TChain>>;
365
428
 
366
- type GetTransactionConfirmationsParameters<TChain extends Chain = Chain> = {
429
+ type GetTransactionConfirmationsParameters<TChain extends Chain | undefined = Chain> = {
367
430
  /** The transaction hash. */
368
431
  hash: Hash;
369
432
  transactionReceipt?: never;
@@ -373,7 +436,7 @@ type GetTransactionConfirmationsParameters<TChain extends Chain = Chain> = {
373
436
  transactionReceipt: FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
374
437
  };
375
438
  type GetTransactionConfirmationsReturnType = bigint;
376
- declare function getTransactionConfirmations<TChain extends Chain>(client: PublicClient<any, TChain>, { hash, transactionReceipt }: GetTransactionConfirmationsParameters<TChain>): Promise<GetTransactionConfirmationsReturnType>;
439
+ declare function getTransactionConfirmations<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { hash, transactionReceipt }: GetTransactionConfirmationsParameters<TChain>): Promise<GetTransactionConfirmationsReturnType>;
377
440
 
378
441
  type GetTransactionCountParameters = {
379
442
  /** The account address. */
@@ -391,14 +454,14 @@ type GetTransactionCountReturnType = number;
391
454
  /**
392
455
  * @description Returns the number of transactions an account has broadcast / sent.
393
456
  */
394
- declare function getTransactionCount(client: PublicClient | WalletClient, { address, blockTag, blockNumber }: GetTransactionCountParameters): Promise<GetTransactionCountReturnType>;
457
+ declare function getTransactionCount<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>, { address, blockTag, blockNumber }: GetTransactionCountParameters): Promise<GetTransactionCountReturnType>;
395
458
 
396
459
  type GetTransactionReceiptParameters = {
397
460
  /** The hash of the transaction. */
398
461
  hash: Hash;
399
462
  };
400
- type GetTransactionReceiptReturnType<TChain extends Chain = Chain> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
401
- declare function getTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { hash }: GetTransactionReceiptParameters): Promise<Formatted<ExtractFormatter<TChain, "transactionReceipt", Formatter<RpcTransactionReceipt, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>>>, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>, false, false>>;
463
+ type GetTransactionReceiptReturnType<TChain extends Chain | undefined = Chain | undefined> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
464
+ declare function getTransactionReceipt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { hash }: GetTransactionReceiptParameters): Promise<Formatted<TransactionReceiptFormatter<TChain>, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>, false, false>>;
402
465
 
403
466
  type MAXIMUM_DEPTH = 20;
404
467
  type Contract<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TFunctionName extends string = string> = {
@@ -448,27 +511,27 @@ type MulticallParameters<TContracts extends ContractConfig[] = ContractConfig[],
448
511
  multicallAddress?: Address;
449
512
  };
450
513
  type MulticallReturnType<TContracts extends ContractConfig[] = ContractConfig[], TAllowFailure extends boolean = true> = MulticallResults<TContracts, TAllowFailure>;
451
- declare function multicall<TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(client: PublicClient, args: MulticallParameters<TContracts, TAllowFailure>): Promise<MulticallReturnType<TContracts, TAllowFailure>>;
514
+ declare function multicall<TChain extends Chain | undefined, TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(client: PublicClient<Transport, TChain>, args: MulticallParameters<TContracts, TAllowFailure>): Promise<MulticallReturnType<TContracts, TAllowFailure>>;
452
515
 
453
516
  type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & ContractConfig<TAbi, TFunctionName, 'view' | 'pure'>;
454
517
  type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
455
- declare function readContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient, { abi, address, args, functionName, ...callRequest }: ReadContractParameters<TAbi, TFunctionName>): Promise<ReadContractReturnType<TAbi, TFunctionName>>;
518
+ declare function readContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient<Transport, TChain>, { abi, address, args, functionName, ...callRequest }: ReadContractParameters<TAbi, TFunctionName>): Promise<ReadContractReturnType<TAbi, TFunctionName>>;
456
519
 
457
520
  type UninstallFilterParameters = {
458
521
  filter: Filter<any>;
459
522
  };
460
523
  type UninstallFilterReturnType = boolean;
461
- declare function uninstallFilter(client: PublicClient, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
524
+ declare function uninstallFilter<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
462
525
 
463
526
  type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
464
- type ReplacementReturnType<TChain extends Chain = Chain> = {
527
+ type ReplacementReturnType<TChain extends Chain | undefined = Chain | undefined> = {
465
528
  reason: ReplacementReason;
466
529
  replacedTransaction: Transaction;
467
530
  transaction: Transaction;
468
531
  transactionReceipt: GetTransactionReceiptReturnType<TChain>;
469
532
  };
470
- type WaitForTransactionReceiptReturnType<TChain extends Chain = Chain> = GetTransactionReceiptReturnType<TChain>;
471
- type WaitForTransactionReceiptParameters<TChain extends Chain = Chain> = {
533
+ type WaitForTransactionReceiptReturnType<TChain extends Chain | undefined = Chain | undefined> = GetTransactionReceiptReturnType<TChain>;
534
+ type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chain | undefined> = {
472
535
  /** The number of confirmations (blocks that have passed) to wait before resolving. */
473
536
  confirmations?: number;
474
537
  /** The hash of the transaction. */
@@ -479,51 +542,75 @@ type WaitForTransactionReceiptParameters<TChain extends Chain = Chain> = {
479
542
  /** Optional timeout (in milliseconds) to wait before stopping polling. */
480
543
  timeout?: number;
481
544
  };
482
- declare function waitForTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptParameters<TChain>): Promise<WaitForTransactionReceiptReturnType<TChain>>;
545
+ declare function waitForTransactionReceipt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptParameters<TChain>): Promise<WaitForTransactionReceiptReturnType<TChain>>;
483
546
 
484
547
  type OnBlockNumberParameter = GetBlockNumberReturnType;
485
548
  type OnBlockNumberFn = (blockNumber: OnBlockNumberParameter, prevBlockNumber: OnBlockNumberParameter | undefined) => void;
486
- type WatchBlockNumberParameters = {
549
+ type PollOptions$2 = {
487
550
  /** Whether or not to emit the missed block numbers to the callback. */
488
551
  emitMissed?: boolean;
489
552
  /** Whether or not to emit the latest block number to the callback when the subscription opens. */
490
553
  emitOnBegin?: boolean;
554
+ /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
555
+ pollingInterval?: number;
556
+ };
557
+ type WatchBlockNumberParameters<TTransport extends Transport = Transport> = {
491
558
  /** The callback to call when a new block number is received. */
492
559
  onBlockNumber: OnBlockNumberFn;
493
560
  /** The callback to call when an error occurred when trying to get for a new block. */
494
561
  onError?: (error: Error) => void;
495
- /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
496
- pollingInterval?: number;
497
- };
562
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
563
+ emitMissed?: never;
564
+ emitOnBegin?: never;
565
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
566
+ poll?: false;
567
+ pollingInterval?: never;
568
+ } | (PollOptions$2 & {
569
+ poll: true;
570
+ }) : PollOptions$2 & {
571
+ poll?: true;
572
+ });
573
+ type WatchBlockNumberReturnType = () => void;
498
574
  /** @description Watches and returns incoming block numbers. */
499
- declare function watchBlockNumber(client: PublicClient<any, any, any>, { emitOnBegin, emitMissed, onBlockNumber, onError, pollingInterval, }: WatchBlockNumberParameters): () => void;
575
+ declare function watchBlockNumber<TChain extends Chain | undefined, TTransport extends Transport>(client: PublicClient<TTransport, TChain>, { emitOnBegin, emitMissed, onBlockNumber, onError, poll: poll_, pollingInterval, }: WatchBlockNumberParameters<TTransport>): WatchBlockNumberReturnType;
500
576
 
501
- type OnBlockParameter<TChain extends Chain = Chain, TIncludeTransactions = false> = Omit<GetBlockReturnType<TChain>, TIncludeTransactions extends false ? 'transactions' : ''>;
502
- type OnBlock<TChain extends Chain = Chain, TIncludeTransactions = false> = (block: OnBlockParameter<TChain, TIncludeTransactions>, prevBlock: OnBlockParameter<TChain, TIncludeTransactions> | undefined) => void;
503
- type WatchBlocksParameters<TChain extends Chain = Chain> = {
577
+ type OnBlockParameter<TChain extends Chain | undefined = Chain> = GetBlockReturnType<TChain>;
578
+ type OnBlock<TChain extends Chain | undefined = Chain> = (block: OnBlockParameter<TChain>, prevBlock: OnBlockParameter<TChain> | undefined) => void;
579
+ type PollOptions$1 = {
504
580
  /** The block tag. Defaults to "latest". */
505
581
  blockTag?: BlockTag;
506
582
  /** Whether or not to emit the missed blocks to the callback. */
507
583
  emitMissed?: boolean;
508
584
  /** Whether or not to emit the block to the callback when the subscription opens. */
509
585
  emitOnBegin?: boolean;
510
- /** The callback to call when an error occurred when trying to get for a new block. */
511
- onError?: (error: Error) => void;
586
+ /** Whether or not to include transaction data in the response. */
587
+ includeTransactions?: boolean;
512
588
  /** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
513
589
  pollingInterval?: number;
514
- } & ({
515
- /** Whether or not to include transaction data in the response. */
516
- includeTransactions: true;
517
- /** The callback to call when a new block is received. */
518
- onBlock: OnBlock<TChain, true>;
519
- } | {
520
- /** Whether or not to include transaction data in the response. */
521
- includeTransactions?: false;
590
+ };
591
+ type WatchBlocksParameters<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain> = {
522
592
  /** The callback to call when a new block is received. */
523
593
  onBlock: OnBlock<TChain>;
594
+ /** The callback to call when an error occurred when trying to get for a new block. */
595
+ onError?: (error: Error) => void;
596
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
597
+ blockTag?: never;
598
+ emitMissed?: never;
599
+ emitOnBegin?: never;
600
+ includeTransactions?: never;
601
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
602
+ poll?: false;
603
+ pollingInterval?: never;
604
+ } | (PollOptions$1 & {
605
+ poll: true;
606
+ }) : PollOptions$1 & {
607
+ poll?: true;
524
608
  });
525
- /** @description Watches and returns information for incoming blocks. */
526
- declare function watchBlocks<TChain extends Chain, TWatchBlocksParameters extends WatchBlocksParameters<TChain>>(client: PublicClient<any, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, pollingInterval, }: TWatchBlocksParameters): () => void;
609
+ type WatchBlocksReturnType = () => void;
610
+ /**
611
+ * @description Watches and returns information for incoming blocks.
612
+ */
613
+ declare function watchBlocks<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, poll: poll_, pollingInterval, }: WatchBlocksParameters<TTransport, TChain>): WatchBlocksReturnType;
527
614
 
528
615
  type OnLogsParameter$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = TAbi extends Abi ? Log<bigint, number, ExtractAbiEvent<TAbi, TEventName>>[] : Log[];
529
616
  type OnLogsFn$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = (logs: OnLogsParameter$1<TAbi, TEventName>) => void;
@@ -544,7 +631,8 @@ type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readon
544
631
  /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
545
632
  pollingInterval?: number;
546
633
  };
547
- declare function watchContractEvent<TAbi extends Abi | readonly unknown[], TEventName extends string>(client: PublicClient, { abi, address, args, batch, eventName, onError, onLogs, pollingInterval, }: WatchContractEventParameters<TAbi, TEventName>): () => void;
634
+ type WatchContractEventReturnType = () => void;
635
+ declare function watchContractEvent<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string>(client: PublicClient<Transport, TChain>, { abi, address, args, batch, eventName, onError, onLogs, pollingInterval, }: WatchContractEventParameters<TAbi, TEventName>): WatchContractEventReturnType;
548
636
 
549
637
  type OnLogsParameter<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, [TAbiEvent], TEventName>[];
550
638
  type OnLogsFn<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: OnLogsParameter<TAbiEvent, TEventName>) => void;
@@ -566,133 +654,41 @@ type WatchEventParameters<TAbiEvent extends AbiEvent | undefined = undefined, TE
566
654
  event?: never;
567
655
  args?: never;
568
656
  });
569
- declare function watchEvent<TAbiEvent extends AbiEvent | undefined, TEventName extends string | undefined>(client: PublicClient, { address, args, batch, event, onError, onLogs, pollingInterval, }: WatchEventParameters<TAbiEvent>): () => void;
657
+ type WatchEventReturnType = () => void;
658
+ declare function watchEvent<TChain extends Chain | undefined, TAbiEvent extends AbiEvent | undefined, TEventName extends string | undefined>(client: PublicClient<Transport, TChain>, { address, args, batch, event, onError, onLogs, pollingInterval, }: WatchEventParameters<TAbiEvent>): WatchEventReturnType;
570
659
 
571
660
  type OnTransactionsParameter = Hash[];
572
661
  type OnTransactionsFn = (transactions: OnTransactionsParameter) => void;
573
- type WatchPendingTransactionsParameters = {
662
+ type PollOptions = {
574
663
  /** Whether or not the transaction hashes should be batched on each invocation. */
575
664
  batch?: boolean;
665
+ /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
666
+ pollingInterval?: number;
667
+ };
668
+ type WatchPendingTransactionsParameters<TTransport extends Transport = Transport> = {
576
669
  /** The callback to call when an error occurred when trying to get for a new block. */
577
670
  onError?: (error: Error) => void;
578
671
  /** The callback to call when new transactions are received. */
579
672
  onTransactions: OnTransactionsFn;
580
- /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
581
- pollingInterval?: number;
582
- };
583
- declare function watchPendingTransactions(client: PublicClient, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsParameters): () => void;
584
-
585
- type GetPermissionsReturnType = WalletPermission[];
586
- declare function getPermissions(client: WalletClient): Promise<WalletPermission[]>;
587
-
588
- type RequestAddressesReturnType = Address[];
589
- declare function requestAddresses(client: WalletClient): Promise<RequestAddressesReturnType>;
590
-
591
- type RequestPermissionsParameters = {
592
- eth_accounts: Record<string, any>;
593
- } & {
594
- [key: string]: Record<string, any>;
595
- };
596
- type RequestPermissionsReturnType = WalletPermission[];
597
- declare function requestPermissions(client: WalletClient, permissions: RequestPermissionsParameters): Promise<WalletPermission[]>;
598
-
599
- type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
600
- type SendTransactionParameters<TChain extends Chain = Chain> = FormattedTransactionRequest<TransactionRequestFormatter<TChain>> & {
601
- account: Account;
602
- } & ({
603
- assertChain?: false;
604
- chain?: TChain;
605
- } | {
606
- assertChain: true;
607
- chain: TChain;
673
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
674
+ batch?: never;
675
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
676
+ poll?: false;
677
+ pollingInterval?: never;
678
+ } | (PollOptions & {
679
+ poll: true;
680
+ }) : PollOptions & {
681
+ poll?: true;
608
682
  });
609
- type SendTransactionReturnType = Hash;
610
- declare function sendTransaction<TChain extends Chain>(client: WalletClient<any, any>, args: SendTransactionParameters<TChain>): Promise<SendTransactionReturnType>;
683
+ type WatchPendingTransactionsReturnType = () => void;
684
+ declare function watchPendingTransactions<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { batch, onError, onTransactions, poll: poll_, pollingInterval, }: WatchPendingTransactionsParameters<TTransport>): () => void;
611
685
 
612
- type SignMessageParameters = {
613
- account: Account;
614
- } & ({
615
- /** @deprecated – `data` will be removed in 0.2.0; use `message` instead. */
616
- data: string;
617
- message?: never;
618
- } | {
619
- data?: never;
620
- message: string;
621
- });
622
- type SignMessageReturnType = Hex;
623
- declare function signMessage(client: WalletClient, { account, data, message }: SignMessageParameters): Promise<SignMessageReturnType>;
624
-
625
- type SignTypedDataParameters<TTypedData extends TypedData | {
626
- [key: string]: unknown;
627
- } = TypedData, TPrimaryType extends string = string> = {
628
- account: Account;
629
- } & TypedDataDefinition<TTypedData, TPrimaryType>;
630
- type TypedDataDefinition<TTypedData extends TypedData | {
631
- [key: string]: unknown;
632
- } = TypedData, TPrimaryType extends string = string> = {
633
- domain?: TypedDataDomain;
634
- types: Narrow<TTypedData>;
635
- primaryType: GetPrimaryType<TTypedData, TPrimaryType>;
636
- } & GetMessage<TTypedData, TPrimaryType>;
637
- type GetPrimaryType<TTypedData extends TypedData | {
638
- [key: string]: unknown;
639
- } = TypedData, TPrimaryType extends string = string> = TTypedData extends TypedData ? keyof TTypedData extends infer AbiFunctionNames ? AbiFunctionNames | (TPrimaryType extends AbiFunctionNames ? TPrimaryType : never) | (TypedData extends TTypedData ? string : never) : never : TPrimaryType;
640
- type GetMessage<TTypedData extends TypedData | {
641
- [key: string]: unknown;
642
- } = TypedData, TPrimaryType extends string = string, TSchema = TTypedData extends TypedData ? TypedDataToPrimitiveTypes<TTypedData> : {
643
- [key: string]: any;
644
- }, TMessage = TSchema[TPrimaryType extends keyof TSchema ? TPrimaryType : keyof TSchema]> = {
645
- [key: string]: any;
646
- } extends TMessage ? {
647
- /**
648
- * Data to sign
649
- *
650
- * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference.
651
- */
652
- message: {
653
- [key: string]: unknown;
654
- };
686
+ type GetAccountParameter<TAccount extends Account | undefined = Account | undefined> = IsUndefined<TAccount> extends true ? {
687
+ account: Account | Address;
655
688
  } : {
656
- /** Data to sign */
657
- message: TMessage;
658
- };
659
- type SignTypedDataReturnType = Hex;
660
- declare function signTypedData<TTypedData extends TypedData | {
661
- [key: string]: unknown;
662
- }, TPrimaryType extends string>(client: WalletClient, { account, domain, message, primaryType, types: types_, }: SignTypedDataParameters<TTypedData, TPrimaryType>): Promise<SignTypedDataReturnType>;
663
-
664
- type SwitchChainParameters = {
665
- id: Chain['id'];
666
- };
667
- declare function switchChain(client: WalletClient, { id }: SwitchChainParameters): Promise<void>;
668
-
669
- type WatchAssetParameters = WatchAssetParams;
670
- type WatchAssetReturnType = boolean;
671
- declare function watchAsset(client: WalletClient, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
672
-
673
- type WriteContractParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Omit<SendTransactionParameters<TChain>, 'to' | 'data' | 'value'> & {
674
- value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
675
- } & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
676
- type WriteContractReturnType = SendTransactionReturnType;
677
- declare function writeContract<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: WalletClient, { abi, address, args, functionName, ...request }: WriteContractParameters<TChain, TAbi, TFunctionName>): Promise<WriteContractReturnType>;
678
-
679
- type Account = JsonRpcAccount | LocalAccount;
680
- type JsonRpcAccount = {
681
- address: Address;
682
- type: 'json-rpc';
683
- };
684
- type LocalAccount = {
685
- address: Address;
686
- signMessage: (message: string) => Promise<Hash>;
687
- signTransaction: (transaction: Omit<TransactionRequest, 'from'> & {
688
- chainId: number;
689
- from: Address;
690
- }) => Promise<Hash>;
691
- signTypedData: <TTypedData extends TypedData | {
692
- [key: string]: unknown;
693
- }, TPrimaryType extends string = string>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hash>;
694
- type: 'local';
689
+ account?: Account | Address;
695
690
  };
691
+ type ParseAccount<TAccount extends Account | Address | undefined> = (TAccount extends Account ? TAccount : never) | (TAccount extends Address ? JsonRpcAccount : never) | (TAccount extends undefined ? undefined : never);
696
692
 
697
693
  type FilterType = 'transaction' | 'block' | 'event';
698
694
  type Filter<TFilterType extends FilterType = 'event', TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = MaybeExtractEventArgsFromAbi<TAbi, TEventName>> = {
@@ -716,6 +712,8 @@ type Filter<TFilterType extends FilterType = 'event', TAbi extends Abi | readonl
716
712
  eventName?: never;
717
713
  } : {});
718
714
 
715
+ type GetTransportConfig<TTransport extends Transport> = ReturnType<TTransport>['config'];
716
+
719
717
  type GetEnsAddressParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
720
718
  /** ENS name to get address. */
721
719
  name: string;
@@ -728,16 +726,8 @@ type GetEnsAddressReturnType = Address;
728
726
  *
729
727
  * - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
730
728
  * - Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
731
- *
732
- * @example
733
- * import { normalize } from 'viem/ens'
734
- *
735
- * const ensAddress = await getEnsAddress(publicClient, {
736
- * name: normalize('wagmi-dev.eth'),
737
- * })
738
- * // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
739
729
  */
740
- declare function getEnsAddress(client: PublicClient, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
730
+ declare function getEnsAddress<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
741
731
 
742
732
  type GetEnsNameParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
743
733
  /** Address to get ENS name for. */
@@ -757,15 +747,15 @@ type GetEnsNameReturnType = string | null;
757
747
  * })
758
748
  * // 'wagmi-dev.eth'
759
749
  */
760
- declare function getEnsName(client: PublicClient, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
750
+ declare function getEnsName<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
761
751
 
762
- type PublicActions<TChain extends Chain = Chain> = {
752
+ type PublicActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = {
763
753
  call: (args: CallParameters<TChain>) => Promise<CallReturnType>;
764
754
  createBlockFilter: () => Promise<CreateBlockFilterReturnType>;
765
755
  createContractEventFilter: <TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>>;
766
756
  createEventFilter: <TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(args?: CreateEventFilterParameters<TAbiEvent, TAbi, TEventName, TArgs>) => Promise<CreateEventFilterReturnType<TAbiEvent, TAbi, TEventName, TArgs>>;
767
757
  createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>;
768
- estimateContractGas: <TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TChain, TAbi, TFunctionName>) => Promise<EstimateContractGasReturnType>;
758
+ estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain>) => Promise<EstimateContractGasReturnType>;
769
759
  estimateGas: (args: EstimateGasParameters<TChain>) => Promise<EstimateGasReturnType>;
770
760
  getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
771
761
  getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>;
@@ -787,55 +777,52 @@ type PublicActions<TChain extends Chain = Chain> = {
787
777
  getTransactionReceipt: (args: GetTransactionReceiptParameters) => Promise<GetTransactionReceiptReturnType<TChain>>;
788
778
  multicall: <TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>;
789
779
  readContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>;
790
- simulateContract: <TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined>(args: SimulateContractParameters<TChain, TAbi, TFunctionName, TChainOverride>) => Promise<SimulateContractReturnType<TChainOverride extends Chain ? TChainOverride : TChain, TAbi, TFunctionName>>;
780
+ simulateContract: <TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined>(args: SimulateContractParameters<TAbi, TFunctionName, TChain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, TChain, TChainOverride>>;
791
781
  uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType>;
792
782
  waitForTransactionReceipt: (args: WaitForTransactionReceiptParameters<TChain>) => Promise<WaitForTransactionReceiptReturnType<TChain>>;
793
- watchBlockNumber: (args: WatchBlockNumberParameters) => ReturnType<typeof watchBlockNumber>;
794
- watchBlocks: (args: WatchBlocksParameters<TChain>) => ReturnType<typeof watchBlocks>;
795
- watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) => ReturnType<typeof watchContractEvent>;
796
- watchEvent: <TAbiEvent extends AbiEvent | undefined, TEventName extends string | undefined>(args: WatchEventParameters<TAbiEvent>) => ReturnType<typeof watchEvent>;
797
- watchPendingTransactions: (args: WatchPendingTransactionsParameters) => ReturnType<typeof watchPendingTransactions>;
783
+ watchBlockNumber: (args: WatchBlockNumberParameters) => WatchBlockNumberReturnType;
784
+ watchBlocks: (args: WatchBlocksParameters<TTransport, TChain>) => WatchBlocksReturnType;
785
+ watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) => WatchContractEventReturnType;
786
+ watchEvent: <TAbiEvent extends AbiEvent | undefined>(args: WatchEventParameters<TAbiEvent>) => WatchEventReturnType;
787
+ watchPendingTransactions: (args: WatchPendingTransactionsParameters<TTransport>) => WatchPendingTransactionsReturnType;
798
788
  };
799
789
 
800
- type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain> = {
801
- chain?: ClientConfig<TTransport, TChain>['chain'];
802
- /** The key of the Wallet Client. */
803
- key?: ClientConfig['key'];
804
- /** The name of the Wallet Client. */
805
- name?: ClientConfig['name'];
806
- /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */
807
- pollingInterval?: ClientConfig['pollingInterval'];
808
- transport: ClientConfig<TTransport, TChain>['transport'];
790
+ type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccountOrAddress extends Account | Address | undefined = Account | Address | undefined> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'> & {
791
+ /** The Account to use for the Wallet Client. This will be used for Actions that require an account as an argument. */
792
+ account?: TAccountOrAddress;
809
793
  };
810
- type WalletClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TIncludeActions extends boolean = true> = Client<TTransport, TChain> & (TIncludeActions extends true ? WalletActions<TChain> : {});
794
+ type WalletClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TIncludeActions extends boolean = true> = Prettify<Client<TTransport, Requests, TChain> & (TIncludeActions extends true ? WalletActions<TChain, TAccount> : unknown) & {
795
+ /** The Account to use for the Wallet Client. */
796
+ account: TAccount;
797
+ }>;
811
798
  /**
812
799
  * @description Creates a wallet client with a given transport.
813
800
  */
814
- declare function createWalletClient<TTransport extends Transport, TChain extends Chain>({ chain, transport, key, name, pollingInterval, }: WalletClientConfig<TTransport, TChain>): WalletClient<TTransport, TChain, true>;
801
+ declare function createWalletClient<TTransport extends Transport, TChain extends Chain | undefined = undefined, TAccountOrAddress extends Account | Address | undefined = undefined>({ account, chain, transport, key, name, pollingInterval, }: WalletClientConfig<TTransport, TChain, TAccountOrAddress>): WalletClient<TTransport, TChain, TAccountOrAddress extends Address ? Prettify<JsonRpcAccount<TAccountOrAddress>> : TAccountOrAddress, true>;
815
802
 
816
- type WalletActions<TChain extends Chain = Chain> = {
803
+ type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
817
804
  addChain: (args: AddChainParameters) => Promise<void>;
818
- deployContract: <TAbi extends Abi | readonly unknown[]>(args: DeployContractParameters<TChain, TAbi>) => Promise<DeployContractReturnType>;
805
+ deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
819
806
  getAddresses: () => Promise<GetAddressesReturnType>;
820
807
  getChainId: () => Promise<GetChainIdReturnType>;
821
808
  getPermissions: () => Promise<GetPermissionsReturnType>;
822
809
  requestAddresses: () => Promise<RequestAddressesReturnType>;
823
810
  requestPermissions: (args: RequestPermissionsParameters) => Promise<RequestPermissionsReturnType>;
824
- sendTransaction: <TChainOverride extends Chain>(args: SendTransactionParameters<TChainOverride>) => Promise<SendTransactionReturnType>;
825
- signMessage: (args: SignMessageParameters) => Promise<SignMessageReturnType>;
811
+ sendTransaction: <TChainOverride extends Chain | undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>) => Promise<SendTransactionReturnType>;
812
+ signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
826
813
  signTypedData: <TTypedData extends TypedData | {
827
814
  [key: string]: unknown;
828
- }, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType>) => Promise<SignTypedDataReturnType>;
815
+ }, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
829
816
  switchChain: (args: SwitchChainParameters) => Promise<void>;
830
817
  watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
831
- writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain>(args: WriteContractParameters<TChainOverride, TAbi, TFunctionName>) => Promise<WriteContractReturnType>;
818
+ writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
832
819
  };
833
820
 
834
- type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
835
- type PublicClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TIncludeActions extends boolean = true> = Client<TTransport, TChain, PublicRequests> & (TIncludeActions extends true ? PublicActions<TChain> : {});
821
+ type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
822
+ type PublicClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TIncludeActions extends boolean = true> = Prettify<Client<TTransport, PublicRequests, TChain> & (TIncludeActions extends true ? PublicActions<TTransport, TChain> : unknown)>;
836
823
  /**
837
824
  * @description Creates a public client with a given transport.
838
825
  */
839
- declare function createPublicClient<TTransport extends Transport, TChain extends Chain>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
826
+ declare function createPublicClient<TTransport extends Transport, TChain extends Chain | undefined = undefined>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
840
827
 
841
- export { writeContract as $, Account as A, BlockFormatter as B, CallParameters as C, estimateContractGas as D, EstimateGasParameters as E, FormattedBlock as F, GetBytecodeParameters as G, getBytecode as H, getStorageAt as I, JsonRpcAccount as J, multicall as K, LocalAccount as L, MulticallParameters as M, readContract as N, OnLogsFn as O, PublicClient as P, simulateContract as Q, ReadContractParameters as R, SendTransactionParameters as S, TransactionReceiptFormatter as T, watchContractEvent as U, DeployContractParameters as V, WalletClient as W, DeployContractReturnType as X, WriteContractParameters as Y, WriteContractReturnType as Z, deployContract as _, PublicClientConfig as a, OnTransactionsFn as a$, GetEnsAddressParameters as a0, GetEnsNameParameters as a1, getEnsAddress as a2, getEnsName as a3, call as a4, createBlockFilter as a5, createEventFilter as a6, createPendingTransactionFilter as a7, estimateGas as a8, getBalance as a9, GetBalanceParameters as aA, GetBalanceReturnType as aB, GetBlockParameters as aC, GetBlockNumberParameters as aD, GetBlockNumberReturnType as aE, GetBlockReturnType as aF, GetBlockTransactionCountParameters as aG, GetBlockTransactionCountReturnType as aH, GetFeeHistoryParameters as aI, GetFeeHistoryReturnType as aJ, GetFilterChangesParameters as aK, GetFilterChangesReturnType as aL, GetFilterLogsParameters as aM, GetFilterLogsReturnType as aN, GetGasPriceReturnType as aO, GetTransactionParameters as aP, GetTransactionConfirmationsParameters as aQ, GetTransactionConfirmationsReturnType as aR, GetTransactionCountParameters as aS, GetTransactionCountReturnType as aT, GetTransactionReceiptParameters as aU, GetTransactionReceiptReturnType as aV, GetTransactionReturnType as aW, OnBlock as aX, OnBlockNumberFn as aY, OnBlockNumberParameter as aZ, OnBlockParameter as a_, getBlock as aa, getBlockNumber as ab, getBlockNumberCache as ac, getBlockTransactionCount as ad, getChainId as ae, getFeeHistory as af, getFilterChanges as ag, getFilterLogs as ah, getLogs as ai, getGasPrice as aj, getTransaction as ak, getTransactionConfirmations as al, getTransactionCount as am, getTransactionReceipt as an, uninstallFilter as ao, waitForTransactionReceipt as ap, watchBlockNumber as aq, watchBlocks as ar, watchEvent as as, watchPendingTransactions as at, CallReturnType as au, CreateBlockFilterReturnType as av, CreateEventFilterParameters as aw, CreateEventFilterReturnType as ax, CreatePendingTransactionFilterReturnType as ay, EstimateGasReturnType as az, WalletClientConfig as b, OnTransactionsParameter as b0, ReplacementReason as b1, ReplacementReturnType as b2, UninstallFilterParameters as b3, UninstallFilterReturnType as b4, WaitForTransactionReceiptParameters as b5, WaitForTransactionReceiptReturnType as b6, WatchBlockNumberParameters as b7, WatchBlocksParameters as b8, WatchPendingTransactionsParameters as b9, addChain as ba, getAddresses as bb, getPermissions as bc, requestAddresses as bd, requestPermissions as be, sendTransaction as bf, signMessage as bg, signTypedData as bh, switchChain as bi, watchAsset as bj, AddChainParameters as bk, FormattedTransactionRequest as bl, GetPermissionsReturnType as bm, GetAddressesReturnType as bn, RequestAddressesReturnType as bo, RequestPermissionsReturnType as bp, SendTransactionReturnType as bq, SignMessageParameters as br, SignMessageReturnType as bs, SignTypedDataParameters as bt, SignTypedDataReturnType as bu, SwitchChainParameters as bv, WatchAssetParameters as bw, WatchAssetReturnType as bx, createPublicClient as c, createWalletClient as d, FormattedTransactionReceipt as e, FormattedTransactionRequest$1 as f, TransactionRequestFormatter as g, defineBlock as h, defineTransactionReceipt as i, defineTransactionRequest as j, formatBlock as k, formatTransactionRequest as l, CreateContractEventFilterParameters as m, CreateContractEventFilterReturnType as n, EstimateContractGasParameters as o, EstimateContractGasReturnType as p, GetBytecodeReturnType as q, GetStorageAtParameters as r, GetStorageAtReturnType as s, MulticallReturnType as t, OnLogsParameter as u, ReadContractReturnType as v, SimulateContractParameters as w, SimulateContractReturnType as x, WatchContractEventParameters as y, createContractEventFilter as z };
828
+ export { writeContract as $, SimulateContractReturnType as A, BlockFormatter as B, CallParameters as C, WatchContractEventParameters as D, EstimateGasParameters as E, FormattedBlock as F, GetTransportConfig as G, createContractEventFilter as H, estimateContractGas as I, getBytecode as J, getStorageAt as K, multicall as L, MulticallParameters as M, readContract as N, OnLogsFn as O, PublicClient as P, simulateContract as Q, ReadContractParameters as R, SendTransactionParameters as S, TransactionReceiptFormatter as T, watchContractEvent as U, DeployContractParameters as V, WalletClient as W, DeployContractReturnType as X, WriteContractParameters as Y, WriteContractReturnType as Z, deployContract as _, PublicClientConfig as a, OnTransactionsFn as a$, GetEnsAddressParameters as a0, GetEnsNameParameters as a1, getEnsAddress as a2, getEnsName as a3, call as a4, createBlockFilter as a5, createEventFilter as a6, createPendingTransactionFilter as a7, estimateGas as a8, getBalance as a9, GetBalanceParameters as aA, GetBalanceReturnType as aB, GetBlockParameters as aC, GetBlockNumberParameters as aD, GetBlockNumberReturnType as aE, GetBlockReturnType as aF, GetBlockTransactionCountParameters as aG, GetBlockTransactionCountReturnType as aH, GetFeeHistoryParameters as aI, GetFeeHistoryReturnType as aJ, GetFilterChangesParameters as aK, GetFilterChangesReturnType as aL, GetFilterLogsParameters as aM, GetFilterLogsReturnType as aN, GetGasPriceReturnType as aO, GetTransactionParameters as aP, GetTransactionConfirmationsParameters as aQ, GetTransactionConfirmationsReturnType as aR, GetTransactionCountParameters as aS, GetTransactionCountReturnType as aT, GetTransactionReceiptParameters as aU, GetTransactionReceiptReturnType as aV, GetTransactionReturnType as aW, OnBlock as aX, OnBlockNumberFn as aY, OnBlockNumberParameter as aZ, OnBlockParameter as a_, getBlock as aa, getBlockNumber as ab, getBlockNumberCache as ac, getBlockTransactionCount as ad, getChainId as ae, getFeeHistory as af, getFilterChanges as ag, getFilterLogs as ah, getLogs as ai, getGasPrice as aj, getTransaction as ak, getTransactionConfirmations as al, getTransactionCount as am, getTransactionReceipt as an, uninstallFilter as ao, waitForTransactionReceipt as ap, watchBlockNumber as aq, watchBlocks as ar, watchEvent as as, watchPendingTransactions as at, CallReturnType as au, CreateBlockFilterReturnType as av, CreateEventFilterParameters as aw, CreateEventFilterReturnType as ax, CreatePendingTransactionFilterReturnType as ay, EstimateGasReturnType as az, WalletClientConfig as b, OnTransactionsParameter as b0, ReplacementReason as b1, ReplacementReturnType as b2, UninstallFilterParameters as b3, UninstallFilterReturnType as b4, WaitForTransactionReceiptParameters as b5, WaitForTransactionReceiptReturnType as b6, WatchBlockNumberParameters as b7, WatchBlocksParameters as b8, WatchPendingTransactionsParameters as b9, addChain as ba, getAddresses as bb, getPermissions as bc, requestAddresses as bd, requestPermissions as be, sendTransaction as bf, signMessage as bg, signTypedData as bh, switchChain as bi, watchAsset as bj, AddChainParameters as bk, FormattedTransactionRequest as bl, GetPermissionsReturnType as bm, GetAddressesReturnType as bn, RequestAddressesReturnType as bo, RequestPermissionsReturnType as bp, SendTransactionReturnType as bq, SignMessageParameters as br, SignMessageReturnType as bs, SignTypedDataParameters as bt, SignTypedDataReturnType as bu, SwitchChainParameters as bv, WatchAssetParameters as bw, WatchAssetReturnType as bx, createPublicClient as c, createWalletClient as d, ParseAccount as e, FormattedTransactionReceipt as f, FormattedTransactionRequest$1 as g, TransactionRequestFormatter as h, defineBlock as i, defineTransactionReceipt as j, defineTransactionRequest as k, formatBlock as l, formatTransactionRequest as m, GetAccountParameter as n, CreateContractEventFilterParameters as o, CreateContractEventFilterReturnType as p, EstimateContractGasParameters as q, EstimateContractGasReturnType as r, GetBytecodeParameters as s, GetBytecodeReturnType as t, GetStorageAtParameters as u, GetStorageAtReturnType as v, MulticallReturnType as w, OnLogsParameter as x, ReadContractReturnType as y, SimulateContractParameters as z };