viem 0.2.0-0-2-0.20230320T235312 → 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.
- package/accounts/package.json +4 -0
- package/dist/abi.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/accounts/index.d.ts +90 -0
- package/dist/accounts/index.js +152 -0
- package/dist/accounts/index.js.map +1 -0
- package/dist/accounts/index.mjs +152 -0
- package/dist/accounts/index.mjs.map +1 -0
- package/dist/{chain-c4f924cf.d.ts → chain-40443542.d.ts} +1 -1
- package/dist/{chain-b2e88e30.d.ts → chain-4af995bf.d.ts} +121 -85
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +63 -63
- package/dist/chains.mjs +1 -1
- package/dist/chunk-43HQD3IL.js +31 -0
- package/dist/chunk-43HQD3IL.js.map +1 -0
- package/dist/{chunk-4DIN6KDM.mjs → chunk-DFMQLPHS.mjs} +2 -2
- package/dist/chunk-DFMQLPHS.mjs.map +1 -0
- package/dist/{chunk-BLB7NERO.js → chunk-FZPFAAOJ.js} +19 -19
- package/dist/chunk-FZPFAAOJ.js.map +1 -0
- package/dist/{chunk-KOAJUBTN.mjs → chunk-HYEOQX7O.mjs} +802 -193
- package/dist/chunk-HYEOQX7O.mjs.map +1 -0
- package/dist/{chunk-T4AH4Y6Y.js → chunk-OW7TKT7L.js} +812 -203
- package/dist/chunk-OW7TKT7L.js.map +1 -0
- package/dist/chunk-UK6FAD4V.mjs +31 -0
- package/dist/chunk-UK6FAD4V.mjs.map +1 -0
- package/dist/contract.d.ts +9 -8
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createClient-d4f1dea1.d.ts → createClient-1f19be8d.d.ts} +23 -9
- package/dist/{createPublicClient-3a714a8d.d.ts → createPublicClient-fd8b1349.d.ts} +166 -126
- package/dist/{eip1193-cd3e872a.d.ts → eip1193-210ab776.d.ts} +1 -1
- package/dist/{encodeFunctionResult-750c9055.d.ts → encodeFunctionResult-a252fba1.d.ts} +1 -1
- package/dist/{encodePacked-de74201f.d.ts → encodePacked-a9464e97.d.ts} +1 -1
- package/dist/ens.d.ts +6 -5
- package/dist/ens.js +3 -3
- package/dist/ens.mjs +2 -2
- package/dist/ethers.d.ts +5 -4
- package/dist/ethers.js +7 -5
- package/dist/ethers.js.map +1 -1
- package/dist/ethers.mjs +7 -5
- package/dist/ethers.mjs.map +1 -1
- package/dist/{formatAbiItem-fdbdda39.d.ts → formatAbiItem-6ed70dbd.d.ts} +1 -1
- package/dist/{getAbiItem-9d709e3b.d.ts → getAbiItem-1ff0f41a.d.ts} +1 -1
- package/dist/index.d.ts +22 -15
- package/dist/index.js +130 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -45
- package/dist/index.mjs.map +1 -1
- package/dist/parseAccount-8e131c73.d.ts +6 -0
- package/dist/{parseGwei-f930d155.d.ts → parseGwei-5e2a8e87.d.ts} +61 -18
- package/dist/public.d.ts +6 -5
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/test-e28db435.d.ts +198 -0
- package/dist/test.d.ts +11 -11
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/{account-07d04222.d.ts → typedData-848139b1.d.ts} +46 -27
- package/dist/utils/index.d.ts +17 -35
- package/dist/utils/index.js +18 -2
- package/dist/utils/index.mjs +19 -3
- package/dist/wallet.d.ts +6 -5
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +9 -1
- package/dist/chunk-4DIN6KDM.mjs.map +0 -1
- package/dist/chunk-BLB7NERO.js.map +0 -1
- package/dist/chunk-KOAJUBTN.mjs.map +0 -1
- package/dist/chunk-T4AH4Y6Y.js.map +0 -1
- package/dist/test-c70126a6.d.ts +0 -206
@@ -1,8 +1,8 @@
|
|
1
|
-
import { W as WalletPermission, a as WatchAssetParams, P as PublicRequests } from './eip1193-
|
2
|
-
import { a as Transport, b as ClientConfig, C as Client } from './createClient-
|
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
3
|
import { Address, Abi, Narrow, TypedData, AbiEvent, ExtractAbiEvent } from 'abitype';
|
4
|
-
import {
|
5
|
-
import {
|
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';
|
6
6
|
|
7
7
|
type BlockFormatter<TChain extends Chain | undefined = Chain> = TChain extends Chain ? ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>> : Formatters['block'];
|
8
8
|
type FormattedBlock<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Block>;
|
@@ -40,7 +40,7 @@ declare const defineTransactionRequest: <TFormat extends Formatter<Partial<Trans
|
|
40
40
|
}) => RpcTransactionRequest & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
|
41
41
|
|
42
42
|
type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
43
|
-
type CallParameters<TChain extends Chain | undefined = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
43
|
+
type CallParameters<TChain extends Chain | undefined = Chain | undefined> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
44
44
|
account?: Account | Address;
|
45
45
|
} & ({
|
46
46
|
/** The balance of the account at a block number. */
|
@@ -54,31 +54,31 @@ type CallParameters<TChain extends Chain | undefined = Chain> = FormattedCall<Tr
|
|
54
54
|
type CallReturnType = {
|
55
55
|
data: Hex | undefined;
|
56
56
|
};
|
57
|
-
declare function call<TChain extends Chain | undefined>(client:
|
57
|
+
declare function call<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, args: CallParameters<TChain>): Promise<CallReturnType>;
|
58
58
|
|
59
59
|
type AddChainParameters = {
|
60
60
|
chain: Chain;
|
61
61
|
};
|
62
|
-
declare function addChain(client:
|
62
|
+
declare function addChain<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: WalletClient<Transport, TChain, TAccount>, { chain }: AddChainParameters): Promise<void>;
|
63
63
|
|
64
|
-
type DeployContractParameters<
|
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
65
|
abi: Narrow<TAbi>;
|
66
66
|
bytecode: Hex;
|
67
67
|
} & GetChain<TChain, TChainOverride> & ExtractConstructorArgsFromAbi<TAbi>;
|
68
68
|
type DeployContractReturnType = SendTransactionReturnType;
|
69
|
-
declare function deployContract<
|
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
70
|
|
71
71
|
type GetAddressesReturnType = Address[];
|
72
|
-
declare function getAddresses(client:
|
72
|
+
declare function getAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<GetAddressesReturnType>;
|
73
73
|
|
74
74
|
type GetChainIdReturnType = number;
|
75
|
-
declare function getChainId(client:
|
75
|
+
declare function getChainId<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>): Promise<GetChainIdReturnType>;
|
76
76
|
|
77
77
|
type GetPermissionsReturnType = WalletPermission[];
|
78
|
-
declare function getPermissions(client:
|
78
|
+
declare function getPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<WalletPermission[]>;
|
79
79
|
|
80
80
|
type RequestAddressesReturnType = Address[];
|
81
|
-
declare function requestAddresses(client:
|
81
|
+
declare function requestAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<RequestAddressesReturnType>;
|
82
82
|
|
83
83
|
type RequestPermissionsParameters = {
|
84
84
|
eth_accounts: Record<string, any>;
|
@@ -86,14 +86,14 @@ type RequestPermissionsParameters = {
|
|
86
86
|
[key: string]: Record<string, any>;
|
87
87
|
};
|
88
88
|
type RequestPermissionsReturnType = WalletPermission[];
|
89
|
-
declare function requestPermissions(client:
|
89
|
+
declare function requestPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, permissions: RequestPermissionsParameters): Promise<WalletPermission[]>;
|
90
90
|
|
91
91
|
type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
92
|
-
type SendTransactionParameters<TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = undefined, TChainOverride extends Chain | undefined =
|
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
93
|
type SendTransactionReturnType = Hash;
|
94
|
-
declare function sendTransaction<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined
|
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
95
|
|
96
|
-
type SignMessageParameters<TAccount extends Account | undefined = undefined> = GetAccountParameter<TAccount> & ({
|
96
|
+
type SignMessageParameters<TAccount extends Account | undefined = Account | undefined> = GetAccountParameter<TAccount> & ({
|
97
97
|
/** @deprecated – `data` will be removed in 0.2.0; use `message` instead. */
|
98
98
|
data: string;
|
99
99
|
message?: never;
|
@@ -102,7 +102,7 @@ type SignMessageParameters<TAccount extends Account | undefined = undefined> = G
|
|
102
102
|
message: string;
|
103
103
|
});
|
104
104
|
type SignMessageReturnType = Hex;
|
105
|
-
declare function signMessage<TAccount extends Account | undefined>(client:
|
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
106
|
|
107
107
|
type SignTypedDataParameters<TTypedData extends TypedData | {
|
108
108
|
[key: string]: unknown;
|
@@ -110,41 +110,41 @@ type SignTypedDataParameters<TTypedData extends TypedData | {
|
|
110
110
|
type SignTypedDataReturnType = Hex;
|
111
111
|
declare function signTypedData<TTypedData extends TypedData | {
|
112
112
|
[key: string]: unknown;
|
113
|
-
}, TPrimaryType extends string
|
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
114
|
|
115
115
|
type SwitchChainParameters = {
|
116
116
|
id: Chain['id'];
|
117
117
|
};
|
118
|
-
declare function switchChain(client:
|
118
|
+
declare function switchChain<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, { id }: SwitchChainParameters): Promise<void>;
|
119
119
|
|
120
120
|
type WatchAssetParameters = WatchAssetParams;
|
121
121
|
type WatchAssetReturnType = boolean;
|
122
|
-
declare function watchAsset(client:
|
122
|
+
declare function watchAsset<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
|
123
123
|
|
124
|
-
type WriteContractParameters<
|
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
125
|
value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
|
126
126
|
} & GetChain<TChain, TChainOverride> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
127
127
|
type WriteContractReturnType = SendTransactionReturnType;
|
128
|
-
declare function writeContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string,
|
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
129
|
|
130
|
-
type SimulateContractParameters<
|
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'> & {
|
131
131
|
chain?: TChainOverride;
|
132
132
|
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
|
133
133
|
value?: GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
|
134
134
|
};
|
135
|
-
type SimulateContractReturnType<
|
135
|
+
type SimulateContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = {
|
136
136
|
result: ExtractResultFromAbi<TAbi, TFunctionName>;
|
137
|
-
request: Omit<WriteContractParameters<
|
137
|
+
request: Omit<WriteContractParameters<TAbi, TFunctionName, TChain, undefined, TChainOverride>, 'chain'> & {
|
138
138
|
chain: TChainOverride;
|
139
139
|
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
140
140
|
};
|
141
|
-
declare function simulateContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client:
|
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>>;
|
142
142
|
|
143
143
|
type CreatePendingTransactionFilterReturnType = Filter<'transaction'>;
|
144
|
-
declare function createPendingTransactionFilter(client:
|
144
|
+
declare function createPendingTransactionFilter<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>): Promise<CreatePendingTransactionFilterReturnType>;
|
145
145
|
|
146
146
|
type CreateBlockFilterReturnType = Filter<'block'>;
|
147
|
-
declare function createBlockFilter(client:
|
147
|
+
declare function createBlockFilter<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>): Promise<CreateBlockFilterReturnType>;
|
148
148
|
|
149
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> = {
|
150
150
|
address?: Address | Address[];
|
@@ -164,7 +164,7 @@ type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefi
|
|
164
164
|
event?: never;
|
165
165
|
});
|
166
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>;
|
167
|
-
declare function createEventFilter<TAbiEvent extends AbiEvent | undefined,
|
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>>;
|
168
168
|
|
169
169
|
type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
|
170
170
|
address?: Address | Address[];
|
@@ -180,10 +180,10 @@ type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] =
|
|
180
180
|
args?: never;
|
181
181
|
});
|
182
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>;
|
183
|
-
declare function createContractEventFilter<TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(client:
|
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>>;
|
184
184
|
|
185
185
|
type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
186
|
-
type EstimateGasParameters<TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = undefined> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & GetAccountParameter<TAccount> & ({
|
186
|
+
type EstimateGasParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = undefined> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & GetAccountParameter<TAccount> & ({
|
187
187
|
/** The balance of the account at a block number. */
|
188
188
|
blockNumber?: bigint;
|
189
189
|
blockTag?: never;
|
@@ -196,13 +196,13 @@ type EstimateGasReturnType = bigint;
|
|
196
196
|
/**
|
197
197
|
* @description Estimates the gas necessary to complete a transaction without submitting it to the network.
|
198
198
|
*/
|
199
|
-
declare function estimateGas<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client:
|
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>;
|
200
200
|
|
201
|
-
type EstimateContractGasParameters<
|
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'> & {
|
202
202
|
value?: GetValue<TAbi, TFunctionName, EstimateGasParameters<TChain>['value']>;
|
203
203
|
};
|
204
204
|
type EstimateContractGasReturnType = bigint;
|
205
|
-
declare function estimateContractGas<
|
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>;
|
206
206
|
|
207
207
|
type GetBalanceParameters = {
|
208
208
|
/** The address of the account. */
|
@@ -220,7 +220,7 @@ type GetBalanceReturnType = bigint;
|
|
220
220
|
/**
|
221
221
|
* @description Returns the balance of an address in wei.
|
222
222
|
*/
|
223
|
-
declare function getBalance(client:
|
223
|
+
declare function getBalance<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag }: GetBalanceParameters): Promise<GetBalanceReturnType>;
|
224
224
|
|
225
225
|
type GetBlockParameters = {
|
226
226
|
/** Whether or not to include transaction data in the response. */
|
@@ -241,8 +241,8 @@ type GetBlockParameters = {
|
|
241
241
|
/** The block tag. Defaults to 'latest'. */
|
242
242
|
blockTag?: BlockTag;
|
243
243
|
});
|
244
|
-
type GetBlockReturnType<TChain extends Chain | undefined = Chain> = FormattedBlock<BlockFormatter<TChain>>;
|
245
|
-
declare function getBlock<TChain extends Chain | undefined>(client:
|
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>>;
|
246
246
|
|
247
247
|
type GetBlockNumberParameters = {
|
248
248
|
/** The maximum age (in ms) of the cached value. */
|
@@ -260,13 +260,22 @@ declare function getBlockNumberCache(id: string): {
|
|
260
260
|
clear: () => boolean;
|
261
261
|
get: () => {
|
262
262
|
created: Date;
|
263
|
+
/**
|
264
|
+
* @description Returns the number of the most recent block seen.
|
265
|
+
*/
|
263
266
|
data: unknown;
|
264
267
|
} | undefined;
|
265
268
|
set: (data: {
|
266
269
|
created: Date;
|
270
|
+
/**
|
271
|
+
* @description Returns the number of the most recent block seen.
|
272
|
+
*/
|
267
273
|
data: unknown;
|
268
274
|
}) => Map<string, {
|
269
275
|
created: Date;
|
276
|
+
/**
|
277
|
+
* @description Returns the number of the most recent block seen.
|
278
|
+
*/
|
270
279
|
data: unknown;
|
271
280
|
}>;
|
272
281
|
};
|
@@ -274,7 +283,7 @@ declare function getBlockNumberCache(id: string): {
|
|
274
283
|
/**
|
275
284
|
* @description Returns the number of the most recent block seen.
|
276
285
|
*/
|
277
|
-
declare function getBlockNumber(client:
|
286
|
+
declare function getBlockNumber<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { maxAge }?: GetBlockNumberParameters): Promise<GetBlockNumberReturnType>;
|
278
287
|
|
279
288
|
type GetBlockTransactionCountParameters = {
|
280
289
|
/** Hash of the block. */
|
@@ -293,7 +302,7 @@ type GetBlockTransactionCountParameters = {
|
|
293
302
|
blockTag?: BlockTag;
|
294
303
|
};
|
295
304
|
type GetBlockTransactionCountReturnType = number;
|
296
|
-
declare function getBlockTransactionCount<TChain extends Chain | undefined>(client:
|
305
|
+
declare function getBlockTransactionCount<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountParameters): Promise<GetBlockTransactionCountReturnType>;
|
297
306
|
|
298
307
|
type GetBytecodeParameters = {
|
299
308
|
address: Address;
|
@@ -305,7 +314,7 @@ type GetBytecodeParameters = {
|
|
305
314
|
blockTag?: never;
|
306
315
|
});
|
307
316
|
type GetBytecodeReturnType = Hex | undefined;
|
308
|
-
declare function getBytecode(client:
|
317
|
+
declare function getBytecode<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag }: GetBytecodeParameters): Promise<GetBytecodeReturnType>;
|
309
318
|
|
310
319
|
type GetFeeHistoryParameters = {
|
311
320
|
blockCount: number;
|
@@ -321,25 +330,25 @@ type GetFeeHistoryReturnType = FeeHistory;
|
|
321
330
|
/**
|
322
331
|
* @description Returns a collection of historical gas information.
|
323
332
|
*/
|
324
|
-
declare function getFeeHistory(client:
|
333
|
+
declare function getFeeHistory<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockCount, blockNumber, blockTag, rewardPercentiles, }: GetFeeHistoryParameters): Promise<GetFeeHistoryReturnType>;
|
325
334
|
|
326
335
|
type GetFilterChangesParameters<TFilterType extends FilterType = FilterType, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
327
336
|
filter: Filter<TFilterType, TAbi, TEventName, any>;
|
328
337
|
};
|
329
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[];
|
330
|
-
declare function getFilterChanges<TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client:
|
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>>;
|
331
340
|
|
332
341
|
type GetFilterLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
333
342
|
filter: Filter<'event', TAbi, TEventName, any>;
|
334
343
|
};
|
335
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>[];
|
336
|
-
declare function getFilterLogs<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client:
|
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>>;
|
337
346
|
|
338
347
|
type GetGasPriceReturnType = bigint;
|
339
348
|
/**
|
340
349
|
* @description Returns the current price of gas (in wei).
|
341
350
|
*/
|
342
|
-
declare function getGasPrice(client:
|
351
|
+
declare function getGasPrice<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: PublicClient<Transport, TChain> | WalletClient<Transport, TChain, TAccount>): Promise<GetGasPriceReturnType>;
|
343
352
|
|
344
353
|
type GetLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
345
354
|
/** Address or list of addresses from which logs originated */
|
@@ -366,7 +375,7 @@ type GetLogsReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TEven
|
|
366
375
|
/**
|
367
376
|
* @description Returns a collection of event logs.
|
368
377
|
*/
|
369
|
-
declare function getLogs<TAbiEvent extends AbiEvent | undefined>(client:
|
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>>;
|
370
379
|
|
371
380
|
type GetStorageAtParameters = {
|
372
381
|
address: Address;
|
@@ -379,7 +388,7 @@ type GetStorageAtParameters = {
|
|
379
388
|
blockTag?: never;
|
380
389
|
});
|
381
390
|
type GetStorageAtReturnType = Hex | undefined;
|
382
|
-
declare function getStorageAt(client:
|
391
|
+
declare function getStorageAt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, slot }: GetStorageAtParameters): Promise<GetStorageAtReturnType>;
|
383
392
|
|
384
393
|
type GetTransactionParameters = {
|
385
394
|
/** The block hash */
|
@@ -415,7 +424,7 @@ type GetTransactionParameters = {
|
|
415
424
|
};
|
416
425
|
type GetTransactionReturnType<TChain extends Chain | undefined = Chain> = FormattedTransaction<TransactionFormatter<TChain>>;
|
417
426
|
/** @description Returns information about a transaction given a hash or block identifier. */
|
418
|
-
declare function getTransaction<TChain extends Chain | undefined>(client:
|
427
|
+
declare function getTransaction<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockHash, blockNumber, blockTag, hash, index, }: GetTransactionParameters): Promise<GetTransactionReturnType<TChain>>;
|
419
428
|
|
420
429
|
type GetTransactionConfirmationsParameters<TChain extends Chain | undefined = Chain> = {
|
421
430
|
/** The transaction hash. */
|
@@ -427,7 +436,7 @@ type GetTransactionConfirmationsParameters<TChain extends Chain | undefined = Ch
|
|
427
436
|
transactionReceipt: FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
428
437
|
};
|
429
438
|
type GetTransactionConfirmationsReturnType = bigint;
|
430
|
-
declare function getTransactionConfirmations<TChain extends Chain | undefined>(client:
|
439
|
+
declare function getTransactionConfirmations<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { hash, transactionReceipt }: GetTransactionConfirmationsParameters<TChain>): Promise<GetTransactionConfirmationsReturnType>;
|
431
440
|
|
432
441
|
type GetTransactionCountParameters = {
|
433
442
|
/** The account address. */
|
@@ -445,14 +454,14 @@ type GetTransactionCountReturnType = number;
|
|
445
454
|
/**
|
446
455
|
* @description Returns the number of transactions an account has broadcast / sent.
|
447
456
|
*/
|
448
|
-
declare function getTransactionCount(client:
|
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>;
|
449
458
|
|
450
459
|
type GetTransactionReceiptParameters = {
|
451
460
|
/** The hash of the transaction. */
|
452
461
|
hash: Hash;
|
453
462
|
};
|
454
|
-
type GetTransactionReceiptReturnType<TChain extends Chain | undefined = Chain> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
455
|
-
declare function getTransactionReceipt<TChain extends Chain | undefined>(client:
|
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>>;
|
456
465
|
|
457
466
|
type MAXIMUM_DEPTH = 20;
|
458
467
|
type Contract<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TFunctionName extends string = string> = {
|
@@ -502,27 +511,27 @@ type MulticallParameters<TContracts extends ContractConfig[] = ContractConfig[],
|
|
502
511
|
multicallAddress?: Address;
|
503
512
|
};
|
504
513
|
type MulticallReturnType<TContracts extends ContractConfig[] = ContractConfig[], TAllowFailure extends boolean = true> = MulticallResults<TContracts, TAllowFailure>;
|
505
|
-
declare function multicall<TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(client:
|
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>>;
|
506
515
|
|
507
516
|
type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & ContractConfig<TAbi, TFunctionName, 'view' | 'pure'>;
|
508
517
|
type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
|
509
|
-
declare function readContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client:
|
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>>;
|
510
519
|
|
511
520
|
type UninstallFilterParameters = {
|
512
521
|
filter: Filter<any>;
|
513
522
|
};
|
514
523
|
type UninstallFilterReturnType = boolean;
|
515
|
-
declare function uninstallFilter(client:
|
524
|
+
declare function uninstallFilter<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
|
516
525
|
|
517
526
|
type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
|
518
|
-
type ReplacementReturnType<TChain extends Chain | undefined = Chain> = {
|
527
|
+
type ReplacementReturnType<TChain extends Chain | undefined = Chain | undefined> = {
|
519
528
|
reason: ReplacementReason;
|
520
529
|
replacedTransaction: Transaction;
|
521
530
|
transaction: Transaction;
|
522
531
|
transactionReceipt: GetTransactionReceiptReturnType<TChain>;
|
523
532
|
};
|
524
|
-
type WaitForTransactionReceiptReturnType<TChain extends Chain | undefined = Chain> = GetTransactionReceiptReturnType<TChain>;
|
525
|
-
type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chain> = {
|
533
|
+
type WaitForTransactionReceiptReturnType<TChain extends Chain | undefined = Chain | undefined> = GetTransactionReceiptReturnType<TChain>;
|
534
|
+
type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chain | undefined> = {
|
526
535
|
/** The number of confirmations (blocks that have passed) to wait before resolving. */
|
527
536
|
confirmations?: number;
|
528
537
|
/** The hash of the transaction. */
|
@@ -533,51 +542,75 @@ type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chai
|
|
533
542
|
/** Optional timeout (in milliseconds) to wait before stopping polling. */
|
534
543
|
timeout?: number;
|
535
544
|
};
|
536
|
-
declare function waitForTransactionReceipt<TChain extends Chain | undefined>(client:
|
545
|
+
declare function waitForTransactionReceipt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptParameters<TChain>): Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
537
546
|
|
538
547
|
type OnBlockNumberParameter = GetBlockNumberReturnType;
|
539
548
|
type OnBlockNumberFn = (blockNumber: OnBlockNumberParameter, prevBlockNumber: OnBlockNumberParameter | undefined) => void;
|
540
|
-
type
|
549
|
+
type PollOptions$2 = {
|
541
550
|
/** Whether or not to emit the missed block numbers to the callback. */
|
542
551
|
emitMissed?: boolean;
|
543
552
|
/** Whether or not to emit the latest block number to the callback when the subscription opens. */
|
544
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> = {
|
545
558
|
/** The callback to call when a new block number is received. */
|
546
559
|
onBlockNumber: OnBlockNumberFn;
|
547
560
|
/** The callback to call when an error occurred when trying to get for a new block. */
|
548
561
|
onError?: (error: Error) => void;
|
549
|
-
|
550
|
-
|
551
|
-
|
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;
|
552
574
|
/** @description Watches and returns incoming block numbers. */
|
553
|
-
declare function watchBlockNumber(client:
|
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;
|
554
576
|
|
555
|
-
type OnBlockParameter<TChain extends Chain | undefined = Chain
|
556
|
-
type OnBlock<TChain extends Chain | undefined = Chain
|
557
|
-
type
|
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 = {
|
558
580
|
/** The block tag. Defaults to "latest". */
|
559
581
|
blockTag?: BlockTag;
|
560
582
|
/** Whether or not to emit the missed blocks to the callback. */
|
561
583
|
emitMissed?: boolean;
|
562
584
|
/** Whether or not to emit the block to the callback when the subscription opens. */
|
563
585
|
emitOnBegin?: boolean;
|
564
|
-
/**
|
565
|
-
|
586
|
+
/** Whether or not to include transaction data in the response. */
|
587
|
+
includeTransactions?: boolean;
|
566
588
|
/** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
|
567
589
|
pollingInterval?: number;
|
568
|
-
}
|
569
|
-
|
570
|
-
includeTransactions: true;
|
571
|
-
/** The callback to call when a new block is received. */
|
572
|
-
onBlock: OnBlock<TChain, true>;
|
573
|
-
} | {
|
574
|
-
/** Whether or not to include transaction data in the response. */
|
575
|
-
includeTransactions?: false;
|
590
|
+
};
|
591
|
+
type WatchBlocksParameters<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain> = {
|
576
592
|
/** The callback to call when a new block is received. */
|
577
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;
|
578
608
|
});
|
579
|
-
|
580
|
-
|
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;
|
581
614
|
|
582
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[];
|
583
616
|
type OnLogsFn$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = (logs: OnLogsParameter$1<TAbi, TEventName>) => void;
|
@@ -598,7 +631,8 @@ type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readon
|
|
598
631
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
599
632
|
pollingInterval?: number;
|
600
633
|
};
|
601
|
-
|
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;
|
602
636
|
|
603
637
|
type OnLogsParameter<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, [TAbiEvent], TEventName>[];
|
604
638
|
type OnLogsFn<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: OnLogsParameter<TAbiEvent, TEventName>) => void;
|
@@ -620,21 +654,41 @@ type WatchEventParameters<TAbiEvent extends AbiEvent | undefined = undefined, TE
|
|
620
654
|
event?: never;
|
621
655
|
args?: never;
|
622
656
|
});
|
623
|
-
|
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;
|
624
659
|
|
625
660
|
type OnTransactionsParameter = Hash[];
|
626
661
|
type OnTransactionsFn = (transactions: OnTransactionsParameter) => void;
|
627
|
-
type
|
662
|
+
type PollOptions = {
|
628
663
|
/** Whether or not the transaction hashes should be batched on each invocation. */
|
629
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> = {
|
630
669
|
/** The callback to call when an error occurred when trying to get for a new block. */
|
631
670
|
onError?: (error: Error) => void;
|
632
671
|
/** The callback to call when new transactions are received. */
|
633
672
|
onTransactions: OnTransactionsFn;
|
634
|
-
|
635
|
-
|
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;
|
682
|
+
});
|
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;
|
685
|
+
|
686
|
+
type GetAccountParameter<TAccount extends Account | undefined = Account | undefined> = IsUndefined<TAccount> extends true ? {
|
687
|
+
account: Account | Address;
|
688
|
+
} : {
|
689
|
+
account?: Account | Address;
|
636
690
|
};
|
637
|
-
|
691
|
+
type ParseAccount<TAccount extends Account | Address | undefined> = (TAccount extends Account ? TAccount : never) | (TAccount extends Address ? JsonRpcAccount : never) | (TAccount extends undefined ? undefined : never);
|
638
692
|
|
639
693
|
type FilterType = 'transaction' | 'block' | 'event';
|
640
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>> = {
|
@@ -658,6 +712,8 @@ type Filter<TFilterType extends FilterType = 'event', TAbi extends Abi | readonl
|
|
658
712
|
eventName?: never;
|
659
713
|
} : {});
|
660
714
|
|
715
|
+
type GetTransportConfig<TTransport extends Transport> = ReturnType<TTransport>['config'];
|
716
|
+
|
661
717
|
type GetEnsAddressParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
662
718
|
/** ENS name to get address. */
|
663
719
|
name: string;
|
@@ -670,16 +726,8 @@ type GetEnsAddressReturnType = Address;
|
|
670
726
|
*
|
671
727
|
* - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
672
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.
|
673
|
-
*
|
674
|
-
* @example
|
675
|
-
* import { normalize } from 'viem/ens'
|
676
|
-
*
|
677
|
-
* const ensAddress = await getEnsAddress(publicClient, {
|
678
|
-
* name: normalize('wagmi-dev.eth'),
|
679
|
-
* })
|
680
|
-
* // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
|
681
729
|
*/
|
682
|
-
declare function getEnsAddress(client:
|
730
|
+
declare function getEnsAddress<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
|
683
731
|
|
684
732
|
type GetEnsNameParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
685
733
|
/** Address to get ENS name for. */
|
@@ -699,15 +747,15 @@ type GetEnsNameReturnType = string | null;
|
|
699
747
|
* })
|
700
748
|
* // 'wagmi-dev.eth'
|
701
749
|
*/
|
702
|
-
declare function getEnsName(client:
|
750
|
+
declare function getEnsName<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
|
703
751
|
|
704
|
-
type PublicActions<TChain extends Chain | undefined = Chain> = {
|
752
|
+
type PublicActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = {
|
705
753
|
call: (args: CallParameters<TChain>) => Promise<CallReturnType>;
|
706
754
|
createBlockFilter: () => Promise<CreateBlockFilterReturnType>;
|
707
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>>;
|
708
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>>;
|
709
757
|
createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>;
|
710
|
-
estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<
|
758
|
+
estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain>) => Promise<EstimateContractGasReturnType>;
|
711
759
|
estimateGas: (args: EstimateGasParameters<TChain>) => Promise<EstimateGasReturnType>;
|
712
760
|
getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
|
713
761
|
getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>;
|
@@ -729,39 +777,32 @@ type PublicActions<TChain extends Chain | undefined = Chain> = {
|
|
729
777
|
getTransactionReceipt: (args: GetTransactionReceiptParameters) => Promise<GetTransactionReceiptReturnType<TChain>>;
|
730
778
|
multicall: <TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
731
779
|
readContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>;
|
732
|
-
simulateContract: <TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined>(args: SimulateContractParameters<
|
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>>;
|
733
781
|
uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType>;
|
734
782
|
waitForTransactionReceipt: (args: WaitForTransactionReceiptParameters<TChain>) => Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
735
|
-
watchBlockNumber: (args: WatchBlockNumberParameters) =>
|
736
|
-
watchBlocks: (args: WatchBlocksParameters<TChain>) =>
|
737
|
-
watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) =>
|
738
|
-
watchEvent: <TAbiEvent extends AbiEvent | undefined
|
739
|
-
watchPendingTransactions: (args: WatchPendingTransactionsParameters) =>
|
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;
|
740
788
|
};
|
741
789
|
|
742
|
-
type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain,
|
743
|
-
account
|
744
|
-
|
745
|
-
/** The key of the Wallet Client. */
|
746
|
-
key?: ClientConfig['key'];
|
747
|
-
/** The name of the Wallet Client. */
|
748
|
-
name?: ClientConfig['name'];
|
749
|
-
/** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */
|
750
|
-
pollingInterval?: ClientConfig['pollingInterval'];
|
751
|
-
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;
|
752
793
|
};
|
753
|
-
type WalletClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = undefined, TAccount extends Account | undefined = undefined, TIncludeActions extends boolean = true> = Client<TTransport, 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. */
|
754
796
|
account: TAccount;
|
755
|
-
}
|
756
|
-
type WalletClientArg<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TIncludeActions extends boolean = boolean> = WalletClient<TTransport, TChain, TAccount, TIncludeActions>;
|
797
|
+
}>;
|
757
798
|
/**
|
758
799
|
* @description Creates a wallet client with a given transport.
|
759
800
|
*/
|
760
|
-
declare function createWalletClient<TTransport extends Transport, TChain extends Chain | undefined = undefined, TAccountOrAddress extends Account | Address | undefined = undefined
|
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>;
|
761
802
|
|
762
|
-
type WalletActions<TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = undefined> = {
|
803
|
+
type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
|
763
804
|
addChain: (args: AddChainParameters) => Promise<void>;
|
764
|
-
deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<
|
805
|
+
deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
|
765
806
|
getAddresses: () => Promise<GetAddressesReturnType>;
|
766
807
|
getChainId: () => Promise<GetChainIdReturnType>;
|
767
808
|
getPermissions: () => Promise<GetPermissionsReturnType>;
|
@@ -771,18 +812,17 @@ type WalletActions<TChain extends Chain | undefined = Chain, TAccount extends Ac
|
|
771
812
|
signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
|
772
813
|
signTypedData: <TTypedData extends TypedData | {
|
773
814
|
[key: string]: unknown;
|
774
|
-
}, TPrimaryType extends string
|
815
|
+
}, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
|
775
816
|
switchChain: (args: SwitchChainParameters) => Promise<void>;
|
776
817
|
watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
|
777
|
-
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<
|
818
|
+
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
|
778
819
|
};
|
779
820
|
|
780
|
-
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
|
781
|
-
type PublicClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain, TIncludeActions extends boolean = true> = Client<TTransport,
|
782
|
-
type PublicClientArg<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TIncludeActions extends boolean = boolean> = PublicClient<TTransport, TChain, TIncludeActions>;
|
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)>;
|
783
823
|
/**
|
784
824
|
* @description Creates a public client with a given transport.
|
785
825
|
*/
|
786
|
-
declare function createPublicClient<TTransport extends Transport, TChain extends Chain | undefined>({ 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>;
|
787
827
|
|
788
|
-
export {
|
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 };
|