viem 0.2.0-jxom-local-accounts.20230325T211645 → 0.2.0-jxom-local-accounts.20230327T004031
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abi.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/accounts/index.d.ts +4 -4
- package/dist/accounts/index.js +45 -16
- package/dist/accounts/index.js.map +1 -1
- package/dist/accounts/index.mjs +39 -10
- package/dist/accounts/index.mjs.map +1 -1
- package/dist/{chain-f8db473f.d.ts → chain-40443542.d.ts} +1 -1
- package/dist/{chain-75b0942e.d.ts → chain-4af995bf.d.ts} +63 -27
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +63 -63
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-NJSAEA2H.js → chunk-CGTZNR2R.js} +507 -3
- package/dist/chunk-CGTZNR2R.js.map +1 -0
- package/dist/{chunk-IVRML3IK.mjs → chunk-HWVZ6VEQ.mjs} +506 -2
- package/dist/chunk-HWVZ6VEQ.mjs.map +1 -0
- package/dist/{chunk-ZHKTGT4Q.mjs → chunk-PVK5TA2L.mjs} +2 -2
- package/dist/{chunk-6UKHPIXX.mjs → chunk-UCNDS4FE.mjs} +2 -2
- package/dist/chunk-UCNDS4FE.mjs.map +1 -0
- package/dist/{chunk-LYQKHD7R.js → chunk-VSAG2LPH.js} +19 -19
- package/dist/chunk-VSAG2LPH.js.map +1 -0
- package/dist/{chunk-35AQXWIB.js → chunk-XLIQDCZW.js} +6 -6
- package/dist/contract.d.ts +8 -8
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createClient-f87255c1.d.ts → createClient-1f19be8d.d.ts} +23 -9
- package/dist/{createPublicClient-f876dff3.d.ts → createPublicClient-b53e3c3d.d.ts} +116 -116
- package/dist/{eip1193-ae706fd8.d.ts → eip1193-210ab776.d.ts} +1 -1
- package/dist/{encodeFunctionResult-4792a6a3.d.ts → encodeFunctionResult-a252fba1.d.ts} +1 -1
- package/dist/{encodePacked-3fcdd54b.d.ts → encodePacked-a9464e97.d.ts} +1 -1
- package/dist/ens.d.ts +5 -5
- package/dist/ens.js +3 -3
- package/dist/ens.mjs +2 -2
- package/dist/ethers.d.ts +3 -3
- package/dist/ethers.js +4 -4
- package/dist/ethers.mjs +2 -2
- package/dist/{formatAbiItem-765ebc53.d.ts → formatAbiItem-6ed70dbd.d.ts} +1 -1
- package/dist/{getAbiItem-693e6e1b.d.ts → getAbiItem-1ff0f41a.d.ts} +1 -1
- package/dist/index.d.ts +21 -15
- package/dist/index.js +127 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -42
- package/dist/index.mjs.map +1 -1
- package/dist/{parseAccount-b6e8bc40.d.ts → parseAccount-8e131c73.d.ts} +1 -1
- package/dist/{parseGwei-1030ed5a.d.ts → parseGwei-b3a175f7.d.ts} +51 -7
- package/dist/public.d.ts +5 -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/{typedData-7cfe4bb6.d.ts → typedData-848139b1.d.ts} +7 -11
- package/dist/utils/index.d.ts +16 -36
- package/dist/utils/index.js +18 -2
- package/dist/utils/index.mjs +17 -1
- package/dist/wallet.d.ts +5 -5
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-6UKHPIXX.mjs.map +0 -1
- package/dist/chunk-IVRML3IK.mjs.map +0 -1
- package/dist/chunk-LYQKHD7R.js.map +0 -1
- package/dist/chunk-NJSAEA2H.js.map +0 -1
- package/dist/test-98c0b642.d.ts +0 -206
- /package/dist/{chunk-ZHKTGT4Q.mjs.map → chunk-PVK5TA2L.mjs.map} +0 -0
- /package/dist/{chunk-35AQXWIB.js.map → chunk-XLIQDCZW.js.map} +0 -0
@@ -1,15 +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 {
|
6
|
-
|
7
|
-
type GetAccountParameter<TAccount extends Account | undefined = undefined> = TAccount extends undefined ? {
|
8
|
-
account: Account | Address;
|
9
|
-
} : {
|
10
|
-
account?: Account | Address;
|
11
|
-
};
|
12
|
-
type ParseAccount<TAccount extends Account | Address | undefined> = (TAccount extends Account ? TAccount : never) | (TAccount extends Address ? JsonRpcAccount : never) | (TAccount extends undefined ? undefined : never);
|
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';
|
13
6
|
|
14
7
|
type BlockFormatter<TChain extends Chain | undefined = Chain> = TChain extends Chain ? ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>> : Formatters['block'];
|
15
8
|
type FormattedBlock<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Block>;
|
@@ -47,7 +40,7 @@ declare const defineTransactionRequest: <TFormat extends Formatter<Partial<Trans
|
|
47
40
|
}) => RpcTransactionRequest & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
|
48
41
|
|
49
42
|
type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
50
|
-
type CallParameters<TChain extends Chain | undefined = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
43
|
+
type CallParameters<TChain extends Chain | undefined = Chain | undefined> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
51
44
|
account?: Account | Address;
|
52
45
|
} & ({
|
53
46
|
/** The balance of the account at a block number. */
|
@@ -61,31 +54,31 @@ type CallParameters<TChain extends Chain | undefined = Chain> = FormattedCall<Tr
|
|
61
54
|
type CallReturnType = {
|
62
55
|
data: Hex | undefined;
|
63
56
|
};
|
64
|
-
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>;
|
65
58
|
|
66
59
|
type AddChainParameters = {
|
67
60
|
chain: Chain;
|
68
61
|
};
|
69
|
-
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>;
|
70
63
|
|
71
|
-
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'> & {
|
72
65
|
abi: Narrow<TAbi>;
|
73
66
|
bytecode: Hex;
|
74
67
|
} & GetChain<TChain, TChainOverride> & ExtractConstructorArgsFromAbi<TAbi>;
|
75
68
|
type DeployContractReturnType = SendTransactionReturnType;
|
76
|
-
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>;
|
77
70
|
|
78
71
|
type GetAddressesReturnType = Address[];
|
79
|
-
declare function getAddresses(client:
|
72
|
+
declare function getAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<GetAddressesReturnType>;
|
80
73
|
|
81
74
|
type GetChainIdReturnType = number;
|
82
|
-
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>;
|
83
76
|
|
84
77
|
type GetPermissionsReturnType = WalletPermission[];
|
85
|
-
declare function getPermissions(client:
|
78
|
+
declare function getPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<WalletPermission[]>;
|
86
79
|
|
87
80
|
type RequestAddressesReturnType = Address[];
|
88
|
-
declare function requestAddresses(client:
|
81
|
+
declare function requestAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>): Promise<RequestAddressesReturnType>;
|
89
82
|
|
90
83
|
type RequestPermissionsParameters = {
|
91
84
|
eth_accounts: Record<string, any>;
|
@@ -93,14 +86,14 @@ type RequestPermissionsParameters = {
|
|
93
86
|
[key: string]: Record<string, any>;
|
94
87
|
};
|
95
88
|
type RequestPermissionsReturnType = WalletPermission[];
|
96
|
-
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[]>;
|
97
90
|
|
98
91
|
type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
99
|
-
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>;
|
100
93
|
type SendTransactionReturnType = Hash;
|
101
|
-
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>;
|
102
95
|
|
103
|
-
type SignMessageParameters<TAccount extends Account | undefined = undefined> = GetAccountParameter<TAccount> & ({
|
96
|
+
type SignMessageParameters<TAccount extends Account | undefined = Account | undefined> = GetAccountParameter<TAccount> & ({
|
104
97
|
/** @deprecated – `data` will be removed in 0.2.0; use `message` instead. */
|
105
98
|
data: string;
|
106
99
|
message?: never;
|
@@ -109,7 +102,7 @@ type SignMessageParameters<TAccount extends Account | undefined = undefined> = G
|
|
109
102
|
message: string;
|
110
103
|
});
|
111
104
|
type SignMessageReturnType = Hex;
|
112
|
-
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>;
|
113
106
|
|
114
107
|
type SignTypedDataParameters<TTypedData extends TypedData | {
|
115
108
|
[key: string]: unknown;
|
@@ -117,41 +110,41 @@ type SignTypedDataParameters<TTypedData extends TypedData | {
|
|
117
110
|
type SignTypedDataReturnType = Hex;
|
118
111
|
declare function signTypedData<TTypedData extends TypedData | {
|
119
112
|
[key: string]: unknown;
|
120
|
-
}, 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>;
|
121
114
|
|
122
115
|
type SwitchChainParameters = {
|
123
116
|
id: Chain['id'];
|
124
117
|
};
|
125
|
-
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>;
|
126
119
|
|
127
120
|
type WatchAssetParameters = WatchAssetParams;
|
128
121
|
type WatchAssetReturnType = boolean;
|
129
|
-
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>;
|
130
123
|
|
131
|
-
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'> & {
|
132
125
|
value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
|
133
126
|
} & GetChain<TChain, TChainOverride> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
134
127
|
type WriteContractReturnType = SendTransactionReturnType;
|
135
|
-
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>;
|
136
129
|
|
137
|
-
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'> & {
|
138
131
|
chain?: TChainOverride;
|
139
132
|
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
|
140
133
|
value?: GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
|
141
134
|
};
|
142
|
-
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> = {
|
143
136
|
result: ExtractResultFromAbi<TAbi, TFunctionName>;
|
144
|
-
request: Omit<WriteContractParameters<
|
137
|
+
request: Omit<WriteContractParameters<TAbi, TFunctionName, TChain, undefined, TChainOverride>, 'chain'> & {
|
145
138
|
chain: TChainOverride;
|
146
139
|
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
147
140
|
};
|
148
|
-
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>>;
|
149
142
|
|
150
143
|
type CreatePendingTransactionFilterReturnType = Filter<'transaction'>;
|
151
|
-
declare function createPendingTransactionFilter(client:
|
144
|
+
declare function createPendingTransactionFilter<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>): Promise<CreatePendingTransactionFilterReturnType>;
|
152
145
|
|
153
146
|
type CreateBlockFilterReturnType = Filter<'block'>;
|
154
|
-
declare function createBlockFilter(client:
|
147
|
+
declare function createBlockFilter<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>): Promise<CreateBlockFilterReturnType>;
|
155
148
|
|
156
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> = {
|
157
150
|
address?: Address | Address[];
|
@@ -171,7 +164,7 @@ type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefi
|
|
171
164
|
event?: never;
|
172
165
|
});
|
173
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>;
|
174
|
-
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>>;
|
175
168
|
|
176
169
|
type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
|
177
170
|
address?: Address | Address[];
|
@@ -187,10 +180,10 @@ type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] =
|
|
187
180
|
args?: never;
|
188
181
|
});
|
189
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>;
|
190
|
-
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>>;
|
191
184
|
|
192
185
|
type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
193
|
-
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> & ({
|
194
187
|
/** The balance of the account at a block number. */
|
195
188
|
blockNumber?: bigint;
|
196
189
|
blockTag?: never;
|
@@ -203,13 +196,13 @@ type EstimateGasReturnType = bigint;
|
|
203
196
|
/**
|
204
197
|
* @description Estimates the gas necessary to complete a transaction without submitting it to the network.
|
205
198
|
*/
|
206
|
-
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>;
|
207
200
|
|
208
|
-
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'> & {
|
209
202
|
value?: GetValue<TAbi, TFunctionName, EstimateGasParameters<TChain>['value']>;
|
210
203
|
};
|
211
204
|
type EstimateContractGasReturnType = bigint;
|
212
|
-
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>;
|
213
206
|
|
214
207
|
type GetBalanceParameters = {
|
215
208
|
/** The address of the account. */
|
@@ -227,7 +220,7 @@ type GetBalanceReturnType = bigint;
|
|
227
220
|
/**
|
228
221
|
* @description Returns the balance of an address in wei.
|
229
222
|
*/
|
230
|
-
declare function getBalance(client:
|
223
|
+
declare function getBalance<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag }: GetBalanceParameters): Promise<GetBalanceReturnType>;
|
231
224
|
|
232
225
|
type GetBlockParameters = {
|
233
226
|
/** Whether or not to include transaction data in the response. */
|
@@ -248,8 +241,8 @@ type GetBlockParameters = {
|
|
248
241
|
/** The block tag. Defaults to 'latest'. */
|
249
242
|
blockTag?: BlockTag;
|
250
243
|
});
|
251
|
-
type GetBlockReturnType<TChain extends Chain | undefined = Chain> = FormattedBlock<BlockFormatter<TChain>>;
|
252
|
-
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>>;
|
253
246
|
|
254
247
|
type GetBlockNumberParameters = {
|
255
248
|
/** The maximum age (in ms) of the cached value. */
|
@@ -267,13 +260,22 @@ declare function getBlockNumberCache(id: string): {
|
|
267
260
|
clear: () => boolean;
|
268
261
|
get: () => {
|
269
262
|
created: Date;
|
263
|
+
/**
|
264
|
+
* @description Returns the number of the most recent block seen.
|
265
|
+
*/
|
270
266
|
data: unknown;
|
271
267
|
} | undefined;
|
272
268
|
set: (data: {
|
273
269
|
created: Date;
|
270
|
+
/**
|
271
|
+
* @description Returns the number of the most recent block seen.
|
272
|
+
*/
|
274
273
|
data: unknown;
|
275
274
|
}) => Map<string, {
|
276
275
|
created: Date;
|
276
|
+
/**
|
277
|
+
* @description Returns the number of the most recent block seen.
|
278
|
+
*/
|
277
279
|
data: unknown;
|
278
280
|
}>;
|
279
281
|
};
|
@@ -281,7 +283,7 @@ declare function getBlockNumberCache(id: string): {
|
|
281
283
|
/**
|
282
284
|
* @description Returns the number of the most recent block seen.
|
283
285
|
*/
|
284
|
-
declare function getBlockNumber(client:
|
286
|
+
declare function getBlockNumber<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { maxAge }?: GetBlockNumberParameters): Promise<GetBlockNumberReturnType>;
|
285
287
|
|
286
288
|
type GetBlockTransactionCountParameters = {
|
287
289
|
/** Hash of the block. */
|
@@ -300,7 +302,7 @@ type GetBlockTransactionCountParameters = {
|
|
300
302
|
blockTag?: BlockTag;
|
301
303
|
};
|
302
304
|
type GetBlockTransactionCountReturnType = number;
|
303
|
-
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>;
|
304
306
|
|
305
307
|
type GetBytecodeParameters = {
|
306
308
|
address: Address;
|
@@ -312,7 +314,7 @@ type GetBytecodeParameters = {
|
|
312
314
|
blockTag?: never;
|
313
315
|
});
|
314
316
|
type GetBytecodeReturnType = Hex | undefined;
|
315
|
-
declare function getBytecode(client:
|
317
|
+
declare function getBytecode<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag }: GetBytecodeParameters): Promise<GetBytecodeReturnType>;
|
316
318
|
|
317
319
|
type GetFeeHistoryParameters = {
|
318
320
|
blockCount: number;
|
@@ -328,25 +330,25 @@ type GetFeeHistoryReturnType = FeeHistory;
|
|
328
330
|
/**
|
329
331
|
* @description Returns a collection of historical gas information.
|
330
332
|
*/
|
331
|
-
declare function getFeeHistory(client:
|
333
|
+
declare function getFeeHistory<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockCount, blockNumber, blockTag, rewardPercentiles, }: GetFeeHistoryParameters): Promise<GetFeeHistoryReturnType>;
|
332
334
|
|
333
335
|
type GetFilterChangesParameters<TFilterType extends FilterType = FilterType, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
334
336
|
filter: Filter<TFilterType, TAbi, TEventName, any>;
|
335
337
|
};
|
336
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[];
|
337
|
-
declare function getFilterChanges<TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client:
|
339
|
+
declare function getFilterChanges<TChain extends Chain | undefined, TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient<Transport, TChain>, { filter, }: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>): Promise<GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>>;
|
338
340
|
|
339
341
|
type GetFilterLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
340
342
|
filter: Filter<'event', TAbi, TEventName, any>;
|
341
343
|
};
|
342
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>[];
|
343
|
-
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>>;
|
344
346
|
|
345
347
|
type GetGasPriceReturnType = bigint;
|
346
348
|
/**
|
347
349
|
* @description Returns the current price of gas (in wei).
|
348
350
|
*/
|
349
|
-
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>;
|
350
352
|
|
351
353
|
type GetLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
352
354
|
/** Address or list of addresses from which logs originated */
|
@@ -373,7 +375,7 @@ type GetLogsReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TEven
|
|
373
375
|
/**
|
374
376
|
* @description Returns a collection of event logs.
|
375
377
|
*/
|
376
|
-
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>>;
|
377
379
|
|
378
380
|
type GetStorageAtParameters = {
|
379
381
|
address: Address;
|
@@ -386,7 +388,7 @@ type GetStorageAtParameters = {
|
|
386
388
|
blockTag?: never;
|
387
389
|
});
|
388
390
|
type GetStorageAtReturnType = Hex | undefined;
|
389
|
-
declare function getStorageAt(client:
|
391
|
+
declare function getStorageAt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, slot }: GetStorageAtParameters): Promise<GetStorageAtReturnType>;
|
390
392
|
|
391
393
|
type GetTransactionParameters = {
|
392
394
|
/** The block hash */
|
@@ -422,7 +424,7 @@ type GetTransactionParameters = {
|
|
422
424
|
};
|
423
425
|
type GetTransactionReturnType<TChain extends Chain | undefined = Chain> = FormattedTransaction<TransactionFormatter<TChain>>;
|
424
426
|
/** @description Returns information about a transaction given a hash or block identifier. */
|
425
|
-
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>>;
|
426
428
|
|
427
429
|
type GetTransactionConfirmationsParameters<TChain extends Chain | undefined = Chain> = {
|
428
430
|
/** The transaction hash. */
|
@@ -434,7 +436,7 @@ type GetTransactionConfirmationsParameters<TChain extends Chain | undefined = Ch
|
|
434
436
|
transactionReceipt: FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
435
437
|
};
|
436
438
|
type GetTransactionConfirmationsReturnType = bigint;
|
437
|
-
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>;
|
438
440
|
|
439
441
|
type GetTransactionCountParameters = {
|
440
442
|
/** The account address. */
|
@@ -452,14 +454,14 @@ type GetTransactionCountReturnType = number;
|
|
452
454
|
/**
|
453
455
|
* @description Returns the number of transactions an account has broadcast / sent.
|
454
456
|
*/
|
455
|
-
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>;
|
456
458
|
|
457
459
|
type GetTransactionReceiptParameters = {
|
458
460
|
/** The hash of the transaction. */
|
459
461
|
hash: Hash;
|
460
462
|
};
|
461
|
-
type GetTransactionReceiptReturnType<TChain extends Chain | undefined = Chain> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
462
|
-
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>>;
|
463
465
|
|
464
466
|
type MAXIMUM_DEPTH = 20;
|
465
467
|
type Contract<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TFunctionName extends string = string> = {
|
@@ -509,27 +511,27 @@ type MulticallParameters<TContracts extends ContractConfig[] = ContractConfig[],
|
|
509
511
|
multicallAddress?: Address;
|
510
512
|
};
|
511
513
|
type MulticallReturnType<TContracts extends ContractConfig[] = ContractConfig[], TAllowFailure extends boolean = true> = MulticallResults<TContracts, TAllowFailure>;
|
512
|
-
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>>;
|
513
515
|
|
514
516
|
type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & ContractConfig<TAbi, TFunctionName, 'view' | 'pure'>;
|
515
517
|
type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
|
516
|
-
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>>;
|
517
519
|
|
518
520
|
type UninstallFilterParameters = {
|
519
521
|
filter: Filter<any>;
|
520
522
|
};
|
521
523
|
type UninstallFilterReturnType = boolean;
|
522
|
-
declare function uninstallFilter(client:
|
524
|
+
declare function uninstallFilter<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
|
523
525
|
|
524
526
|
type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
|
525
|
-
type ReplacementReturnType<TChain extends Chain | undefined = Chain> = {
|
527
|
+
type ReplacementReturnType<TChain extends Chain | undefined = Chain | undefined> = {
|
526
528
|
reason: ReplacementReason;
|
527
529
|
replacedTransaction: Transaction;
|
528
530
|
transaction: Transaction;
|
529
531
|
transactionReceipt: GetTransactionReceiptReturnType<TChain>;
|
530
532
|
};
|
531
|
-
type WaitForTransactionReceiptReturnType<TChain extends Chain | undefined = Chain> = GetTransactionReceiptReturnType<TChain>;
|
532
|
-
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> = {
|
533
535
|
/** The number of confirmations (blocks that have passed) to wait before resolving. */
|
534
536
|
confirmations?: number;
|
535
537
|
/** The hash of the transaction. */
|
@@ -540,7 +542,7 @@ type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chai
|
|
540
542
|
/** Optional timeout (in milliseconds) to wait before stopping polling. */
|
541
543
|
timeout?: number;
|
542
544
|
};
|
543
|
-
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>>;
|
544
546
|
|
545
547
|
type OnBlockNumberParameter = GetBlockNumberReturnType;
|
546
548
|
type OnBlockNumberFn = (blockNumber: OnBlockNumberParameter, prevBlockNumber: OnBlockNumberParameter | undefined) => void;
|
@@ -556,12 +558,13 @@ type WatchBlockNumberParameters = {
|
|
556
558
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
557
559
|
pollingInterval?: number;
|
558
560
|
};
|
561
|
+
type WatchBlockNumberReturnType = () => void;
|
559
562
|
/** @description Watches and returns incoming block numbers. */
|
560
|
-
declare function watchBlockNumber(client:
|
563
|
+
declare function watchBlockNumber<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { emitOnBegin, emitMissed, onBlockNumber, onError, pollingInterval, }: WatchBlockNumberParameters): WatchBlockNumberReturnType;
|
561
564
|
|
562
|
-
type OnBlockParameter<TChain extends Chain | undefined = Chain, TIncludeTransactions = false> = Omit<GetBlockReturnType<TChain>, TIncludeTransactions extends false ? 'transactions' : ''>;
|
563
|
-
type OnBlock<TChain extends Chain | undefined = Chain, TIncludeTransactions = false> = (block: OnBlockParameter<TChain, TIncludeTransactions>, prevBlock: OnBlockParameter<TChain, TIncludeTransactions> | undefined) => void;
|
564
|
-
type WatchBlocksParameters<TChain extends Chain | undefined = Chain> = {
|
565
|
+
type OnBlockParameter<TChain extends Chain | undefined = Chain | undefined, TIncludeTransactions = false> = Omit<GetBlockReturnType<TChain>, TIncludeTransactions extends false ? 'transactions' : ''>;
|
566
|
+
type OnBlock<TChain extends Chain | undefined = Chain | undefined, TIncludeTransactions = false> = (block: OnBlockParameter<TChain, TIncludeTransactions>, prevBlock: OnBlockParameter<TChain, TIncludeTransactions> | undefined) => void;
|
567
|
+
type WatchBlocksParameters<TChain extends Chain | undefined = Chain | undefined> = {
|
565
568
|
/** The block tag. Defaults to "latest". */
|
566
569
|
blockTag?: BlockTag;
|
567
570
|
/** Whether or not to emit the missed blocks to the callback. */
|
@@ -583,8 +586,11 @@ type WatchBlocksParameters<TChain extends Chain | undefined = Chain> = {
|
|
583
586
|
/** The callback to call when a new block is received. */
|
584
587
|
onBlock: OnBlock<TChain>;
|
585
588
|
});
|
586
|
-
|
587
|
-
|
589
|
+
type WatchBlocksReturnType = () => void;
|
590
|
+
/**
|
591
|
+
* @description Watches and returns information for incoming blocks.
|
592
|
+
*/
|
593
|
+
declare function watchBlocks<TChain extends Chain | undefined, TWatchBlocksParameters extends WatchBlocksParameters<TChain>>(client: PublicClient<Transport, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, pollingInterval, }: TWatchBlocksParameters): WatchBlocksReturnType;
|
588
594
|
|
589
595
|
type OnLogsParameter$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = TAbi extends Abi ? Log<bigint, number, ExtractAbiEvent<TAbi, TEventName>>[] : Log[];
|
590
596
|
type OnLogsFn$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = (logs: OnLogsParameter$1<TAbi, TEventName>) => void;
|
@@ -605,7 +611,8 @@ type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readon
|
|
605
611
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
606
612
|
pollingInterval?: number;
|
607
613
|
};
|
608
|
-
|
614
|
+
type WatchContractEventReturnType = () => void;
|
615
|
+
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;
|
609
616
|
|
610
617
|
type OnLogsParameter<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, [TAbiEvent], TEventName>[];
|
611
618
|
type OnLogsFn<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: OnLogsParameter<TAbiEvent, TEventName>) => void;
|
@@ -627,7 +634,8 @@ type WatchEventParameters<TAbiEvent extends AbiEvent | undefined = undefined, TE
|
|
627
634
|
event?: never;
|
628
635
|
args?: never;
|
629
636
|
});
|
630
|
-
|
637
|
+
type WatchEventReturnType = () => void;
|
638
|
+
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;
|
631
639
|
|
632
640
|
type OnTransactionsParameter = Hash[];
|
633
641
|
type OnTransactionsFn = (transactions: OnTransactionsParameter) => void;
|
@@ -641,7 +649,15 @@ type WatchPendingTransactionsParameters = {
|
|
641
649
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
642
650
|
pollingInterval?: number;
|
643
651
|
};
|
644
|
-
|
652
|
+
type WatchPendingTransactionsReturnType = () => void;
|
653
|
+
declare function watchPendingTransactions<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsParameters): WatchPendingTransactionsReturnType;
|
654
|
+
|
655
|
+
type GetAccountParameter<TAccount extends Account | undefined = Account | undefined> = IsUndefined<TAccount> extends true ? {
|
656
|
+
account: Account | Address;
|
657
|
+
} : {
|
658
|
+
account?: Account | Address;
|
659
|
+
};
|
660
|
+
type ParseAccount<TAccount extends Account | Address | undefined> = (TAccount extends Account ? TAccount : never) | (TAccount extends Address ? JsonRpcAccount : never) | (TAccount extends undefined ? undefined : never);
|
645
661
|
|
646
662
|
type FilterType = 'transaction' | 'block' | 'event';
|
647
663
|
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>> = {
|
@@ -677,16 +693,8 @@ type GetEnsAddressReturnType = Address;
|
|
677
693
|
*
|
678
694
|
* - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
679
695
|
* - 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.
|
680
|
-
*
|
681
|
-
* @example
|
682
|
-
* import { normalize } from 'viem/ens'
|
683
|
-
*
|
684
|
-
* const ensAddress = await getEnsAddress(publicClient, {
|
685
|
-
* name: normalize('wagmi-dev.eth'),
|
686
|
-
* })
|
687
|
-
* // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
|
688
696
|
*/
|
689
|
-
declare function getEnsAddress(client:
|
697
|
+
declare function getEnsAddress<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
|
690
698
|
|
691
699
|
type GetEnsNameParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
692
700
|
/** Address to get ENS name for. */
|
@@ -706,15 +714,15 @@ type GetEnsNameReturnType = string | null;
|
|
706
714
|
* })
|
707
715
|
* // 'wagmi-dev.eth'
|
708
716
|
*/
|
709
|
-
declare function getEnsName(client:
|
717
|
+
declare function getEnsName<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
|
710
718
|
|
711
|
-
type PublicActions<TChain extends Chain | undefined = Chain> = {
|
719
|
+
type PublicActions<TChain extends Chain | undefined = Chain | undefined> = {
|
712
720
|
call: (args: CallParameters<TChain>) => Promise<CallReturnType>;
|
713
721
|
createBlockFilter: () => Promise<CreateBlockFilterReturnType>;
|
714
722
|
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>>;
|
715
723
|
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>>;
|
716
724
|
createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>;
|
717
|
-
estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<
|
725
|
+
estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain>) => Promise<EstimateContractGasReturnType>;
|
718
726
|
estimateGas: (args: EstimateGasParameters<TChain>) => Promise<EstimateGasReturnType>;
|
719
727
|
getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
|
720
728
|
getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>;
|
@@ -736,39 +744,32 @@ type PublicActions<TChain extends Chain | undefined = Chain> = {
|
|
736
744
|
getTransactionReceipt: (args: GetTransactionReceiptParameters) => Promise<GetTransactionReceiptReturnType<TChain>>;
|
737
745
|
multicall: <TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
738
746
|
readContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>;
|
739
|
-
simulateContract: <TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined>(args: SimulateContractParameters<
|
747
|
+
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>>;
|
740
748
|
uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType>;
|
741
749
|
waitForTransactionReceipt: (args: WaitForTransactionReceiptParameters<TChain>) => Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
742
|
-
watchBlockNumber: (args: WatchBlockNumberParameters) =>
|
743
|
-
watchBlocks: (args: WatchBlocksParameters<TChain>) =>
|
744
|
-
watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) =>
|
745
|
-
watchEvent: <TAbiEvent extends AbiEvent | undefined
|
746
|
-
watchPendingTransactions: (args: WatchPendingTransactionsParameters) =>
|
750
|
+
watchBlockNumber: (args: WatchBlockNumberParameters) => WatchBlockNumberReturnType;
|
751
|
+
watchBlocks: (args: WatchBlocksParameters<TChain>) => WatchBlocksReturnType;
|
752
|
+
watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) => WatchContractEventReturnType;
|
753
|
+
watchEvent: <TAbiEvent extends AbiEvent | undefined>(args: WatchEventParameters<TAbiEvent>) => WatchEventReturnType;
|
754
|
+
watchPendingTransactions: (args: WatchPendingTransactionsParameters) => WatchPendingTransactionsReturnType;
|
747
755
|
};
|
748
756
|
|
749
|
-
type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain,
|
750
|
-
account
|
751
|
-
|
752
|
-
/** The key of the Wallet Client. */
|
753
|
-
key?: ClientConfig['key'];
|
754
|
-
/** The name of the Wallet Client. */
|
755
|
-
name?: ClientConfig['name'];
|
756
|
-
/** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */
|
757
|
-
pollingInterval?: ClientConfig['pollingInterval'];
|
758
|
-
transport: ClientConfig<TTransport, TChain>['transport'];
|
757
|
+
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'> & {
|
758
|
+
/** The Account to use for the Wallet Client. This will be used for Actions that require an account as an argument. */
|
759
|
+
account?: TAccountOrAddress;
|
759
760
|
};
|
760
|
-
type WalletClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = undefined, TAccount extends Account | undefined = undefined, TIncludeActions extends boolean = true> = Client<TTransport, TChain> & {
|
761
|
+
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) & {
|
762
|
+
/** The Account to use for the Wallet Client. */
|
761
763
|
account: TAccount;
|
762
|
-
}
|
763
|
-
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>;
|
764
|
+
}>;
|
764
765
|
/**
|
765
766
|
* @description Creates a wallet client with a given transport.
|
766
767
|
*/
|
767
|
-
declare function createWalletClient<TTransport extends Transport, TChain extends Chain | undefined = undefined, TAccountOrAddress extends Account | Address | undefined = undefined
|
768
|
+
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>;
|
768
769
|
|
769
|
-
type WalletActions<TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = undefined> = {
|
770
|
+
type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
|
770
771
|
addChain: (args: AddChainParameters) => Promise<void>;
|
771
|
-
deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<
|
772
|
+
deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
|
772
773
|
getAddresses: () => Promise<GetAddressesReturnType>;
|
773
774
|
getChainId: () => Promise<GetChainIdReturnType>;
|
774
775
|
getPermissions: () => Promise<GetPermissionsReturnType>;
|
@@ -778,18 +779,17 @@ type WalletActions<TChain extends Chain | undefined = Chain, TAccount extends Ac
|
|
778
779
|
signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
|
779
780
|
signTypedData: <TTypedData extends TypedData | {
|
780
781
|
[key: string]: unknown;
|
781
|
-
}, TPrimaryType extends string
|
782
|
+
}, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
|
782
783
|
switchChain: (args: SwitchChainParameters) => Promise<void>;
|
783
784
|
watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
|
784
|
-
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<
|
785
|
+
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
|
785
786
|
};
|
786
787
|
|
787
|
-
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
|
788
|
-
type PublicClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain, TIncludeActions extends boolean = true> = Client<TTransport,
|
789
|
-
type PublicClientArg<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TIncludeActions extends boolean = boolean> = PublicClient<TTransport, TChain, TIncludeActions>;
|
788
|
+
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
|
789
|
+
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<TChain> : unknown)>;
|
790
790
|
/**
|
791
791
|
* @description Creates a public client with a given transport.
|
792
792
|
*/
|
793
|
-
declare function createPublicClient<TTransport extends Transport, TChain extends Chain | undefined>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
|
793
|
+
declare function createPublicClient<TTransport extends Transport, TChain extends Chain | undefined = undefined>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
|
794
794
|
|
795
|
-
export {
|
795
|
+
export { GetEnsAddressParameters as $, WatchContractEventParameters as A, BlockFormatter as B, CallParameters as C, createContractEventFilter as D, EstimateGasParameters as E, FormattedBlock as F, GetAccountParameter as G, estimateContractGas as H, getBytecode as I, getStorageAt as J, multicall as K, readContract as L, MulticallParameters as M, simulateContract as N, OnLogsFn as O, PublicClient as P, watchContractEvent as Q, ReadContractParameters as R, SendTransactionParameters as S, TransactionReceiptFormatter as T, DeployContractParameters as U, DeployContractReturnType as V, WalletClient as W, WriteContractParameters as X, WriteContractReturnType as Y, deployContract as Z, writeContract as _, PublicClientConfig as a, OnTransactionsParameter as a$, GetEnsNameParameters as a0, getEnsAddress as a1, getEnsName as a2, call as a3, createBlockFilter as a4, createEventFilter as a5, createPendingTransactionFilter as a6, estimateGas as a7, getBalance as a8, getBlock as a9, GetBalanceReturnType as aA, GetBlockParameters as aB, GetBlockNumberParameters as aC, GetBlockNumberReturnType as aD, GetBlockReturnType as aE, GetBlockTransactionCountParameters as aF, GetBlockTransactionCountReturnType as aG, GetFeeHistoryParameters as aH, GetFeeHistoryReturnType as aI, GetFilterChangesParameters as aJ, GetFilterChangesReturnType as aK, GetFilterLogsParameters as aL, GetFilterLogsReturnType as aM, GetGasPriceReturnType as aN, GetTransactionParameters as aO, GetTransactionConfirmationsParameters as aP, GetTransactionConfirmationsReturnType as aQ, GetTransactionCountParameters as aR, GetTransactionCountReturnType as aS, GetTransactionReceiptParameters as aT, GetTransactionReceiptReturnType as aU, GetTransactionReturnType as aV, OnBlock as aW, OnBlockNumberFn as aX, OnBlockNumberParameter as aY, OnBlockParameter as aZ, OnTransactionsFn as a_, getBlockNumber as aa, getBlockNumberCache as ab, getBlockTransactionCount as ac, getChainId as ad, getFeeHistory as ae, getFilterChanges as af, getFilterLogs as ag, getLogs as ah, getGasPrice as ai, getTransaction as aj, getTransactionConfirmations as ak, getTransactionCount as al, getTransactionReceipt as am, uninstallFilter as an, waitForTransactionReceipt as ao, watchBlockNumber as ap, watchBlocks as aq, watchEvent as ar, watchPendingTransactions as as, CallReturnType as at, CreateBlockFilterReturnType as au, CreateEventFilterParameters as av, CreateEventFilterReturnType as aw, CreatePendingTransactionFilterReturnType as ax, EstimateGasReturnType as ay, GetBalanceParameters as az, WalletClientConfig as b, ReplacementReason as b0, ReplacementReturnType as b1, UninstallFilterParameters as b2, UninstallFilterReturnType as b3, WaitForTransactionReceiptParameters as b4, WaitForTransactionReceiptReturnType as b5, WatchBlockNumberParameters as b6, WatchBlocksParameters as b7, WatchPendingTransactionsParameters as b8, addChain as b9, getAddresses as ba, getPermissions as bb, requestAddresses as bc, requestPermissions as bd, sendTransaction as be, signMessage as bf, signTypedData as bg, switchChain as bh, watchAsset as bi, AddChainParameters as bj, FormattedTransactionRequest as bk, GetPermissionsReturnType as bl, GetAddressesReturnType as bm, RequestAddressesReturnType as bn, RequestPermissionsReturnType as bo, SendTransactionReturnType as bp, SignMessageParameters as bq, SignMessageReturnType as br, SignTypedDataParameters as bs, SignTypedDataReturnType as bt, SwitchChainParameters as bu, WatchAssetParameters as bv, WatchAssetReturnType as bw, 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, CreateContractEventFilterParameters as n, CreateContractEventFilterReturnType as o, EstimateContractGasParameters as p, EstimateContractGasReturnType as q, GetBytecodeParameters as r, GetBytecodeReturnType as s, GetStorageAtParameters as t, GetStorageAtReturnType as u, MulticallReturnType as v, OnLogsParameter as w, ReadContractReturnType as x, SimulateContractParameters as y, SimulateContractReturnType as z };
|