viem 0.2.0-0-2-0.20230329T025357 → 0.2.0-0-2-0.20230403T055238
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 +5 -14
- package/dist/accounts/index.js +20 -30
- package/dist/accounts/index.js.map +1 -1
- package/dist/accounts/index.mjs +14 -24
- package/dist/accounts/index.mjs.map +1 -1
- package/dist/{chain-5b28fc53.d.ts → chain-5507c6f0.d.ts} +143 -120
- package/dist/{chain-e9b996ff.d.ts → chain-fe47467d.d.ts} +1 -1
- package/dist/chains.d.ts +867 -99
- package/dist/chains.js +115 -63
- package/dist/chains.js.map +1 -1
- package/dist/chains.mjs +58 -6
- package/dist/chains.mjs.map +1 -1
- package/dist/{chunk-7QEOFHC7.mjs → chunk-EMXJKA5P.mjs} +2 -2
- package/dist/{chunk-UCZWRYV5.mjs → chunk-KILBOPDD.mjs} +754 -33
- package/dist/chunk-KILBOPDD.mjs.map +1 -0
- package/dist/{chunk-D3ALNUWN.js → chunk-KQOOAYBY.js} +6 -6
- package/dist/{chunk-564BCC7H.js → chunk-PWUNCH5G.js} +777 -56
- package/dist/chunk-PWUNCH5G.js.map +1 -0
- package/dist/contract.d.ts +8 -8
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createClient-e52de308.d.ts → createTransport-21a0d2b3.d.ts} +36 -34
- package/dist/{eip1193-9080db42.d.ts → eip1193-2f3a9cd2.d.ts} +1 -1
- package/dist/{encodeFunctionResult-47ad60ed.d.ts → encodeFunctionResult-c5185b98.d.ts} +15 -15
- package/dist/{encodePacked-35c796fb.d.ts → encodePacked-98f67d09.d.ts} +1 -1
- package/dist/ens.d.ts +5 -5
- package/dist/ens.js +8 -3
- package/dist/ens.js.map +1 -1
- package/dist/ens.mjs +7 -2
- package/dist/ens.mjs.map +1 -1
- package/dist/ethers.d.ts +2 -2
- package/dist/ethers.js +4 -4
- package/dist/ethers.mjs +2 -2
- package/dist/{formatAbiItem-d9e801dd.d.ts → formatAbiItem-56dff508.d.ts} +1 -1
- package/dist/{getAbiItem-1d94ae0e.d.ts → getAbiItem-bfba73d1.d.ts} +3 -3
- package/dist/{watchPendingTransactions-468f53f2.d.ts → getEnsResolver-9e26c596.d.ts} +203 -150
- package/dist/index.d.ts +161 -18
- package/dist/index.js +222 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -52
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-f14525ab.d.ts → parseGwei-d2147f8b.d.ts} +5 -5
- package/dist/public.d.ts +5 -5
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/publicKeyToAddress-623eb398.d.ts +16 -0
- package/dist/{test-f3d06763.d.ts → test-b67569fe.d.ts} +3 -3
- package/dist/test.d.ts +5 -5
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/{typedData-42b43450.d.ts → typedData-46b4d81f.d.ts} +1 -1
- package/dist/utils/index.d.ts +15 -15
- package/dist/utils/index.js +4 -2
- package/dist/utils/index.mjs +3 -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 +4 -3
- package/dist/chunk-564BCC7H.js.map +0 -1
- package/dist/chunk-BJ5KRDTG.mjs +0 -186
- package/dist/chunk-BJ5KRDTG.mjs.map +0 -1
- package/dist/chunk-CXE4XSMF.js +0 -186
- package/dist/chunk-CXE4XSMF.js.map +0 -1
- package/dist/chunk-UCZWRYV5.mjs.map +0 -1
- package/dist/parseAccount-4209fa24.d.ts +0 -6
- /package/dist/{chunk-7QEOFHC7.mjs.map → chunk-EMXJKA5P.mjs.map} +0 -0
- /package/dist/{chunk-D3ALNUWN.js.map → chunk-KQOOAYBY.js.map} +0 -0
@@ -1,8 +1,8 @@
|
|
1
|
-
import { a as Transport, b as ClientConfig, C as Client } from './
|
2
|
-
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, H as Hex, ad as GetChain, h as ExtractConstructorArgsFromAbi, ae as MergeIntersectionProperties, a as Hash, af as GetValue, g as ContractConfig, ag as IsUndefined, ah as MaybeExtractEventArgsFromAbi, p as ExtractResultFromAbi, ai as Prettify, f as BlockTag, aj as MaybeAbiEventName, e as BlockNumber, m as ExtractEventNameFromAbi, F as FeeHistory, L as Log, a6 as FormattedTransaction, a7 as TransactionFormatter, k as ExtractEventArgsFromAbi } from './chain-5b28fc53.js';
|
3
|
-
import { W as WalletPermission, a as WatchAssetParams, R as Requests, P as PublicRequests } from './eip1193-9080db42.js';
|
1
|
+
import { a as Transport, b as ClientConfig, C as Client } from './createTransport-21a0d2b3.js';
|
4
2
|
import { Abi, Narrow, Address, TypedData, AbiEvent, ExtractAbiEvent } from 'abitype';
|
5
|
-
import {
|
3
|
+
import { C as Chain, aa as ExtractFormatter, ah as Formatters, ai as Formatter, ab as Formatted, f as Block, R as RpcBlock, T as Transaction, V as TransactionReceipt, J as RpcTransactionReceipt, a8 as TransactionType, K as RpcTransactionRequest, W as TransactionRequest, H as Hex, aj as GetChain, G as GetConstructorArgs, ak as MergeIntersectionProperties, a as Hash, j as ContractFunctionConfig, al as GetValue, c as IsUndefined, M as MaybeExtractEventArgsFromAbi, k as ContractFunctionResult, i as BlockTag, am as MaybeAbiEventName, h as BlockNumber, P as Prettify, t as InferEventName, F as FeeHistory, L as Log, ac as FormattedTransaction, ad as TransactionFormatter, p as GetEventArgs } from './chain-5507c6f0.js';
|
4
|
+
import { A as Account, T as TypedDataDefinition, J as JsonRpcAccount } from './typedData-46b4d81f.js';
|
5
|
+
import { W as WalletPermission, a as WatchAssetParams, R as Requests, P as PublicRequests } from './eip1193-2f3a9cd2.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>;
|
@@ -32,7 +32,7 @@ type FormattedTransactionRequest$1<TFormatter extends Formatter | undefined = Fo
|
|
32
32
|
declare function formatTransactionRequest(transactionRequest: Partial<TransactionRequest>): RpcTransactionRequest;
|
33
33
|
declare const defineTransactionRequest: <TFormat extends Formatter<Partial<TransactionRequest<bigint, number>>, Partial<RpcTransactionRequest> & {
|
34
34
|
[key: string]: unknown;
|
35
|
-
}>, TExclude extends ("value" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "from" | "accessList" | "to" | "
|
35
|
+
}>, TExclude extends ("value" | "data" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "from" | "accessList" | "to" | "gas" | "nonce")[] = []>({ exclude, format: formatOverride, }: {
|
36
36
|
exclude?: TExclude | undefined;
|
37
37
|
format?: TFormat | undefined;
|
38
38
|
}) => (data: Partial<TransactionRequest<bigint, number>> & {
|
@@ -47,7 +47,7 @@ declare function addChain<TChain extends Chain | undefined, TAccount extends Acc
|
|
47
47
|
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'> & {
|
48
48
|
abi: Narrow<TAbi>;
|
49
49
|
bytecode: Hex;
|
50
|
-
} & GetChain<TChain, TChainOverride> &
|
50
|
+
} & GetChain<TChain, TChainOverride> & GetConstructorArgs<TAbi>;
|
51
51
|
type DeployContractReturnType = SendTransactionReturnType;
|
52
52
|
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>;
|
53
53
|
|
@@ -99,9 +99,7 @@ type WatchAssetParameters = WatchAssetParams;
|
|
99
99
|
type WatchAssetReturnType = boolean;
|
100
100
|
declare function watchAsset<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: WalletClient<Transport, TChain, TAccount>, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
|
101
101
|
|
102
|
-
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'> &
|
103
|
-
value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
|
104
|
-
} & GetChain<TChain, TChainOverride> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
102
|
+
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> = ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & Omit<SendTransactionParameters<TChain, TAccount, TChainOverride>, 'chain' | 'to' | 'data' | 'value'> & GetChain<TChain, TChainOverride> & GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
|
105
103
|
type WriteContractReturnType = SendTransactionReturnType;
|
106
104
|
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>;
|
107
105
|
|
@@ -112,6 +110,11 @@ type GetAccountParameter<TAccount extends Account | undefined = Account | undefi
|
|
112
110
|
};
|
113
111
|
type ParseAccount<TAccount extends Account | Address | undefined> = (TAccount extends Account ? TAccount : never) | (TAccount extends Address ? JsonRpcAccount : never) | (TAccount extends undefined ? undefined : never);
|
114
112
|
|
113
|
+
type AssetGateway = 'ipfs' | 'arweave';
|
114
|
+
type AssetGatewayUrls = {
|
115
|
+
[key in AssetGateway]?: string;
|
116
|
+
};
|
117
|
+
|
115
118
|
type FilterType = 'transaction' | 'block' | 'event';
|
116
119
|
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>> = {
|
117
120
|
id: Hex;
|
@@ -139,9 +142,9 @@ type Contract<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[],
|
|
139
142
|
abi: TAbi;
|
140
143
|
functionName: TFunctionName;
|
141
144
|
};
|
142
|
-
type MulticallContracts<TContracts extends Contract[], TProperties extends Record<string, any> = object, Result extends any[] = [], Depth extends
|
145
|
+
type MulticallContracts<TContracts extends Contract[], TProperties extends Record<string, any> = object, Result extends any[] = [], Depth extends readonly number[] = []> = Depth['length'] extends MAXIMUM_DEPTH ? (ContractFunctionConfig & TProperties)[] : TContracts extends [] ? [] : TContracts extends [infer Head extends Contract] ? [
|
143
146
|
...Result,
|
144
|
-
|
147
|
+
ContractFunctionConfig<Head['abi'], Head['functionName']> & TProperties
|
145
148
|
] : TContracts extends [
|
146
149
|
infer Head extends Contract,
|
147
150
|
...infer Tail extends Contract[]
|
@@ -149,12 +152,12 @@ type MulticallContracts<TContracts extends Contract[], TProperties extends Recor
|
|
149
152
|
...Tail
|
150
153
|
], TProperties, [
|
151
154
|
...Result,
|
152
|
-
|
155
|
+
ContractFunctionConfig<Head['abi'], Head['functionName']> & TProperties
|
153
156
|
], [
|
154
157
|
...Depth,
|
155
158
|
1
|
156
|
-
]> : unknown[] extends TContracts ? TContracts : TContracts extends
|
157
|
-
type MulticallResult<Result, TAllowFailure extends boolean = true> = TAllowFailure extends true ?
|
159
|
+
]> : unknown[] extends TContracts ? TContracts : TContracts extends ContractFunctionConfig<infer TAbi, infer TFunctionName>[] ? (ContractFunctionConfig<TAbi, TFunctionName> & TProperties)[] : (ContractFunctionConfig & TProperties)[];
|
160
|
+
type MulticallResult<Result, TAllowFailure extends boolean = true> = TAllowFailure extends true ? {
|
158
161
|
error?: undefined;
|
159
162
|
result: Result;
|
160
163
|
status: 'success';
|
@@ -162,133 +165,25 @@ type MulticallResult<Result, TAllowFailure extends boolean = true> = TAllowFailu
|
|
162
165
|
error: Error;
|
163
166
|
result?: undefined;
|
164
167
|
status: 'error';
|
165
|
-
}
|
166
|
-
type MulticallResults<TContracts extends Contract[], TAllowFailure extends boolean = true, Result extends any[] = [], Depth extends
|
168
|
+
} : Result;
|
169
|
+
type MulticallResults<TContracts extends Contract[], TAllowFailure extends boolean = true, Result extends any[] = [], Depth extends readonly number[] = []> = Depth['length'] extends MAXIMUM_DEPTH ? MulticallResult<ContractFunctionResult, TAllowFailure>[] : TContracts extends [] ? [] : TContracts extends [infer Head extends Contract] ? [
|
170
|
+
...Result,
|
171
|
+
MulticallResult<ContractFunctionResult<Head['abi'], Head['functionName']>, TAllowFailure>
|
172
|
+
] : TContracts extends [
|
167
173
|
infer Head extends Contract,
|
168
174
|
...infer Tail extends Contract[]
|
169
175
|
] ? MulticallResults<[
|
170
176
|
...Tail
|
171
177
|
], TAllowFailure, [
|
172
178
|
...Result,
|
173
|
-
MulticallResult<
|
179
|
+
MulticallResult<ContractFunctionResult<Head['abi'], Head['functionName']>, TAllowFailure>
|
174
180
|
], [
|
175
181
|
...Depth,
|
176
182
|
1
|
177
|
-
]> : TContracts extends
|
183
|
+
]> : TContracts extends ContractFunctionConfig<infer TAbi, infer TFunctionName>[] ? MulticallResult<ContractFunctionResult<TAbi, TFunctionName>, TAllowFailure>[] : MulticallResult<ContractFunctionResult, TAllowFailure>[];
|
178
184
|
|
179
185
|
type GetTransportConfig<TTransport extends Transport> = ReturnType<TTransport>['config'];
|
180
186
|
|
181
|
-
type GetEnsAddressParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
182
|
-
/** ENS name to get address. */
|
183
|
-
name: string;
|
184
|
-
/** Address of ENS Universal Resolver Contract */
|
185
|
-
universalResolverAddress?: Address;
|
186
|
-
}>;
|
187
|
-
type GetEnsAddressReturnType = Address;
|
188
|
-
/**
|
189
|
-
* @description Gets address for ENS name.
|
190
|
-
*
|
191
|
-
* - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
192
|
-
* - 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.
|
193
|
-
*/
|
194
|
-
declare function getEnsAddress<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
|
195
|
-
|
196
|
-
type GetEnsNameParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
197
|
-
/** Address to get ENS name for. */
|
198
|
-
address: Address;
|
199
|
-
/** Address of ENS Universal Resolver Contract. */
|
200
|
-
universalResolverAddress?: Address;
|
201
|
-
}>;
|
202
|
-
type GetEnsNameReturnType = string | null;
|
203
|
-
/**
|
204
|
-
* @description Gets primary name for specified address.
|
205
|
-
*
|
206
|
-
* - Calls `reverse(bytes)` on ENS Universal Resolver Contract.
|
207
|
-
*
|
208
|
-
* @example
|
209
|
-
* const ensName = await getEnsName(publicClient, {
|
210
|
-
* address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
|
211
|
-
* })
|
212
|
-
* // 'wagmi-dev.eth'
|
213
|
-
*/
|
214
|
-
declare function getEnsName<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
|
215
|
-
|
216
|
-
type PublicActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = {
|
217
|
-
call: (args: CallParameters<TChain>) => Promise<CallReturnType>;
|
218
|
-
createBlockFilter: () => Promise<CreateBlockFilterReturnType>;
|
219
|
-
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>>;
|
220
|
-
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>>;
|
221
|
-
createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>;
|
222
|
-
estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain>) => Promise<EstimateContractGasReturnType>;
|
223
|
-
estimateGas: (args: EstimateGasParameters<TChain>) => Promise<EstimateGasReturnType>;
|
224
|
-
getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
|
225
|
-
getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>;
|
226
|
-
getBlockNumber: (args?: GetBlockNumberParameters) => Promise<GetBlockNumberReturnType>;
|
227
|
-
getBlockTransactionCount: (args?: GetBlockTransactionCountParameters) => Promise<GetBlockTransactionCountReturnType>;
|
228
|
-
getBytecode: (args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>;
|
229
|
-
getChainId: () => Promise<GetChainIdReturnType>;
|
230
|
-
getEnsAddress: (args: GetEnsAddressParameters) => Promise<GetEnsAddressReturnType>;
|
231
|
-
getEnsName: (args: GetEnsNameParameters) => Promise<GetEnsNameReturnType>;
|
232
|
-
getFeeHistory: (args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>;
|
233
|
-
getFilterChanges: <TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(args: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>) => Promise<GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>>;
|
234
|
-
getFilterLogs: <TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(args: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>) => Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>>;
|
235
|
-
getGasPrice: () => Promise<GetGasPriceReturnType>;
|
236
|
-
getLogs: <TAbiEvent extends AbiEvent | undefined>(args?: GetLogsParameters<TAbiEvent>) => Promise<GetLogsReturnType<TAbiEvent>>;
|
237
|
-
getStorageAt: (args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>;
|
238
|
-
getTransaction: (args: GetTransactionParameters) => Promise<GetTransactionReturnType<TChain>>;
|
239
|
-
getTransactionConfirmations: (args: GetTransactionConfirmationsParameters<TChain>) => Promise<GetTransactionConfirmationsReturnType>;
|
240
|
-
getTransactionCount: (args: GetTransactionCountParameters) => Promise<GetTransactionCountReturnType>;
|
241
|
-
getTransactionReceipt: (args: GetTransactionReceiptParameters) => Promise<GetTransactionReceiptReturnType<TChain>>;
|
242
|
-
multicall: <TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
243
|
-
readContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>;
|
244
|
-
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>>;
|
245
|
-
uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType>;
|
246
|
-
waitForTransactionReceipt: (args: WaitForTransactionReceiptParameters<TChain>) => Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
247
|
-
watchBlockNumber: (args: WatchBlockNumberParameters) => WatchBlockNumberReturnType;
|
248
|
-
watchBlocks: (args: WatchBlocksParameters<TTransport, TChain>) => WatchBlocksReturnType;
|
249
|
-
watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) => WatchContractEventReturnType;
|
250
|
-
watchEvent: <TAbiEvent extends AbiEvent | undefined>(args: WatchEventParameters<TAbiEvent>) => WatchEventReturnType;
|
251
|
-
watchPendingTransactions: (args: WatchPendingTransactionsParameters<TTransport>) => WatchPendingTransactionsReturnType;
|
252
|
-
};
|
253
|
-
|
254
|
-
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'> & {
|
255
|
-
/** The Account to use for the Wallet Client. This will be used for Actions that require an account as an argument. */
|
256
|
-
account?: TAccountOrAddress;
|
257
|
-
};
|
258
|
-
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) & {
|
259
|
-
/** The Account to use for the Wallet Client. */
|
260
|
-
account: TAccount;
|
261
|
-
}>;
|
262
|
-
/**
|
263
|
-
* @description Creates a wallet client with a given transport.
|
264
|
-
*/
|
265
|
-
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>;
|
266
|
-
|
267
|
-
type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
|
268
|
-
addChain: (args: AddChainParameters) => Promise<void>;
|
269
|
-
deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
|
270
|
-
getAddresses: () => Promise<GetAddressesReturnType>;
|
271
|
-
getChainId: () => Promise<GetChainIdReturnType>;
|
272
|
-
getPermissions: () => Promise<GetPermissionsReturnType>;
|
273
|
-
requestAddresses: () => Promise<RequestAddressesReturnType>;
|
274
|
-
requestPermissions: (args: RequestPermissionsParameters) => Promise<RequestPermissionsReturnType>;
|
275
|
-
sendTransaction: <TChainOverride extends Chain | undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>) => Promise<SendTransactionReturnType>;
|
276
|
-
signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
|
277
|
-
signTypedData: <TTypedData extends TypedData | {
|
278
|
-
[key: string]: unknown;
|
279
|
-
}, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
|
280
|
-
switchChain: (args: SwitchChainParameters) => Promise<void>;
|
281
|
-
watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
|
282
|
-
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
|
283
|
-
};
|
284
|
-
|
285
|
-
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
|
286
|
-
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)>;
|
287
|
-
/**
|
288
|
-
* @description Creates a public client with a given transport.
|
289
|
-
*/
|
290
|
-
declare function createPublicClient<TTransport extends Transport, TChain extends Chain | undefined = undefined>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
|
291
|
-
|
292
187
|
type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
293
188
|
type CallParameters<TChain extends Chain | undefined = Chain | undefined> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
294
189
|
account?: Account | Address;
|
@@ -306,16 +201,14 @@ type CallReturnType = {
|
|
306
201
|
};
|
307
202
|
declare function call<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, args: CallParameters<TChain>): Promise<CallReturnType>;
|
308
203
|
|
309
|
-
type SimulateContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> =
|
204
|
+
type SimulateContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = {
|
310
205
|
chain?: TChainOverride;
|
311
|
-
} &
|
312
|
-
value?: GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
|
313
|
-
};
|
206
|
+
} & ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & Omit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'to' | 'data' | 'value'> & GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
|
314
207
|
type SimulateContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = {
|
315
|
-
result:
|
208
|
+
result: ContractFunctionResult<TAbi, TFunctionName>;
|
316
209
|
request: Omit<WriteContractParameters<TAbi, TFunctionName, TChain, undefined, TChainOverride>, 'chain'> & {
|
317
210
|
chain: TChainOverride;
|
318
|
-
} &
|
211
|
+
} & ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
319
212
|
};
|
320
213
|
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>>;
|
321
214
|
|
@@ -331,10 +224,10 @@ type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefi
|
|
331
224
|
toBlock?: BlockNumber | BlockTag;
|
332
225
|
} & (MaybeExtractEventArgsFromAbi<TAbi, TEventName> extends infer TEventFilterArgs ? {
|
333
226
|
args: TEventFilterArgs | (TArgs extends TEventFilterArgs ? TArgs : never);
|
334
|
-
event: TAbiEvent
|
227
|
+
event: Narrow<TAbiEvent>;
|
335
228
|
} | {
|
336
229
|
args?: never;
|
337
|
-
event?: TAbiEvent
|
230
|
+
event?: Narrow<TAbiEvent>;
|
338
231
|
} | {
|
339
232
|
args?: never;
|
340
233
|
event?: never;
|
@@ -342,13 +235,13 @@ type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefi
|
|
342
235
|
args?: never;
|
343
236
|
event?: never;
|
344
237
|
});
|
345
|
-
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
|
238
|
+
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> = Prettify<Filter<'event', TAbi, TEventName, TArgs>>;
|
346
239
|
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>>;
|
347
240
|
|
348
241
|
type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
|
349
242
|
address?: Address | Address[];
|
350
243
|
abi: Narrow<TAbi>;
|
351
|
-
eventName?:
|
244
|
+
eventName?: InferEventName<TAbi, TEventName>;
|
352
245
|
fromBlock?: BlockNumber | BlockTag;
|
353
246
|
toBlock?: BlockNumber | BlockTag;
|
354
247
|
} & (undefined extends TEventName ? {
|
@@ -377,9 +270,7 @@ type EstimateGasReturnType = bigint;
|
|
377
270
|
*/
|
378
271
|
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>;
|
379
272
|
|
380
|
-
type EstimateContractGasParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined> = Omit<EstimateGasParameters<TChain>, 'data' | 'to' | 'value'> &
|
381
|
-
value?: GetValue<TAbi, TFunctionName, EstimateGasParameters<TChain>['value']>;
|
382
|
-
};
|
273
|
+
type EstimateContractGasParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined> = ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & Omit<EstimateGasParameters<TChain>, 'data' | 'to' | 'value'> & GetValue<TAbi, TFunctionName, EstimateGasParameters<TChain>['value']>;
|
383
274
|
type EstimateContractGasReturnType = bigint;
|
384
275
|
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>;
|
385
276
|
|
@@ -642,16 +533,16 @@ type GetTransactionReceiptParameters = {
|
|
642
533
|
type GetTransactionReceiptReturnType<TChain extends Chain | undefined = Chain | undefined> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
643
534
|
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>>;
|
644
535
|
|
645
|
-
type MulticallParameters<TContracts extends
|
536
|
+
type MulticallParameters<TContracts extends ContractFunctionConfig[] = ContractFunctionConfig[], TAllowFailure extends boolean = true> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & {
|
646
537
|
allowFailure?: TAllowFailure;
|
647
538
|
contracts: Narrow<readonly [...MulticallContracts<TContracts>]>;
|
648
539
|
multicallAddress?: Address;
|
649
540
|
};
|
650
|
-
type MulticallReturnType<TContracts extends
|
651
|
-
declare function multicall<TChain extends Chain | undefined, TContracts extends
|
541
|
+
type MulticallReturnType<TContracts extends ContractFunctionConfig[] = ContractFunctionConfig[], TAllowFailure extends boolean = true> = MulticallResults<TContracts, TAllowFailure>;
|
542
|
+
declare function multicall<TChain extends Chain | undefined, TContracts extends ContractFunctionConfig[], TAllowFailure extends boolean = true>(client: PublicClient<Transport, TChain>, args: MulticallParameters<TContracts, TAllowFailure>): Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
652
543
|
|
653
|
-
type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> &
|
654
|
-
type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> =
|
544
|
+
type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & ContractFunctionConfig<TAbi, TFunctionName, 'view' | 'pure'>;
|
545
|
+
type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ContractFunctionResult<TAbi, TFunctionName>;
|
655
546
|
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>>;
|
656
547
|
|
657
548
|
type UninstallFilterParameters = {
|
@@ -756,11 +647,11 @@ type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readon
|
|
756
647
|
address?: Address | Address[];
|
757
648
|
/** Contract ABI. */
|
758
649
|
abi: Narrow<TAbi>;
|
759
|
-
args?:
|
650
|
+
args?: GetEventArgs<TAbi, TEventName>;
|
760
651
|
/** Whether or not the event logs should be batched on each invocation. */
|
761
652
|
batch?: boolean;
|
762
653
|
/** Contract event. */
|
763
|
-
eventName?:
|
654
|
+
eventName?: InferEventName<TAbi, TEventName>;
|
764
655
|
/** The callback to call when an error occurred when trying to get for a new block. */
|
765
656
|
onError?: (error: Error) => void;
|
766
657
|
/** The callback to call when new event logs are received. */
|
@@ -820,4 +711,166 @@ type WatchPendingTransactionsParameters<TTransport extends Transport = Transport
|
|
820
711
|
type WatchPendingTransactionsReturnType = () => void;
|
821
712
|
declare function watchPendingTransactions<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { batch, onError, onTransactions, poll: poll_, pollingInterval, }: WatchPendingTransactionsParameters<TTransport>): () => void;
|
822
713
|
|
823
|
-
|
714
|
+
type PublicActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = {
|
715
|
+
call: (args: CallParameters<TChain>) => Promise<CallReturnType>;
|
716
|
+
createBlockFilter: () => Promise<CreateBlockFilterReturnType>;
|
717
|
+
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>>;
|
718
|
+
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>>;
|
719
|
+
createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>;
|
720
|
+
estimateContractGas: <TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain>) => Promise<EstimateContractGasReturnType>;
|
721
|
+
estimateGas: (args: EstimateGasParameters<TChain>) => Promise<EstimateGasReturnType>;
|
722
|
+
getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
|
723
|
+
getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>;
|
724
|
+
getBlockNumber: (args?: GetBlockNumberParameters) => Promise<GetBlockNumberReturnType>;
|
725
|
+
getBlockTransactionCount: (args?: GetBlockTransactionCountParameters) => Promise<GetBlockTransactionCountReturnType>;
|
726
|
+
getBytecode: (args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>;
|
727
|
+
getChainId: () => Promise<GetChainIdReturnType>;
|
728
|
+
getEnsAddress: (args: GetEnsAddressParameters) => Promise<GetEnsAddressReturnType>;
|
729
|
+
getEnsAvatar: (args: GetEnsAvatarParameters) => Promise<GetEnsAvatarReturnType>;
|
730
|
+
getEnsName: (args: GetEnsNameParameters) => Promise<GetEnsNameReturnType>;
|
731
|
+
getEnsResolver: (args: GetEnsResolverParameters) => Promise<GetEnsResolverReturnType>;
|
732
|
+
getEnsText: (args: GetEnsTextParameters) => Promise<GetEnsTextReturnType>;
|
733
|
+
getFeeHistory: (args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>;
|
734
|
+
getFilterChanges: <TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(args: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>) => Promise<GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>>;
|
735
|
+
getFilterLogs: <TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(args: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>) => Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>>;
|
736
|
+
getGasPrice: () => Promise<GetGasPriceReturnType>;
|
737
|
+
getLogs: <TAbiEvent extends AbiEvent | undefined>(args?: GetLogsParameters<TAbiEvent>) => Promise<GetLogsReturnType<TAbiEvent>>;
|
738
|
+
getStorageAt: (args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>;
|
739
|
+
getTransaction: (args: GetTransactionParameters) => Promise<GetTransactionReturnType<TChain>>;
|
740
|
+
getTransactionConfirmations: (args: GetTransactionConfirmationsParameters<TChain>) => Promise<GetTransactionConfirmationsReturnType>;
|
741
|
+
getTransactionCount: (args: GetTransactionCountParameters) => Promise<GetTransactionCountReturnType>;
|
742
|
+
getTransactionReceipt: (args: GetTransactionReceiptParameters) => Promise<GetTransactionReceiptReturnType<TChain>>;
|
743
|
+
multicall: <TContracts extends ContractFunctionConfig[], TAllowFailure extends boolean = true>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
744
|
+
readContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>;
|
745
|
+
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>>;
|
746
|
+
uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType>;
|
747
|
+
waitForTransactionReceipt: (args: WaitForTransactionReceiptParameters<TChain>) => Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
748
|
+
watchBlockNumber: (args: WatchBlockNumberParameters) => WatchBlockNumberReturnType;
|
749
|
+
watchBlocks: (args: WatchBlocksParameters<TTransport, TChain>) => WatchBlocksReturnType;
|
750
|
+
watchContractEvent: <TAbi extends Abi | readonly unknown[], TEventName extends string>(args: WatchContractEventParameters<TAbi, TEventName>) => WatchContractEventReturnType;
|
751
|
+
watchEvent: <TAbiEvent extends AbiEvent | undefined>(args: WatchEventParameters<TAbiEvent>) => WatchEventReturnType;
|
752
|
+
watchPendingTransactions: (args: WatchPendingTransactionsParameters<TTransport>) => WatchPendingTransactionsReturnType;
|
753
|
+
};
|
754
|
+
|
755
|
+
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'> & {
|
756
|
+
/** The Account to use for the Wallet Client. This will be used for Actions that require an account as an argument. */
|
757
|
+
account?: TAccountOrAddress;
|
758
|
+
};
|
759
|
+
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) & {
|
760
|
+
/** The Account to use for the Wallet Client. */
|
761
|
+
account: TAccount;
|
762
|
+
}>;
|
763
|
+
/**
|
764
|
+
* @description Creates a wallet client with a given transport.
|
765
|
+
*/
|
766
|
+
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>;
|
767
|
+
|
768
|
+
type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
|
769
|
+
addChain: (args: AddChainParameters) => Promise<void>;
|
770
|
+
deployContract: <TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
|
771
|
+
getAddresses: () => Promise<GetAddressesReturnType>;
|
772
|
+
getChainId: () => Promise<GetChainIdReturnType>;
|
773
|
+
getPermissions: () => Promise<GetPermissionsReturnType>;
|
774
|
+
requestAddresses: () => Promise<RequestAddressesReturnType>;
|
775
|
+
requestPermissions: (args: RequestPermissionsParameters) => Promise<RequestPermissionsReturnType>;
|
776
|
+
sendTransaction: <TChainOverride extends Chain | undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>) => Promise<SendTransactionReturnType>;
|
777
|
+
signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
|
778
|
+
signTypedData: <TTypedData extends TypedData | {
|
779
|
+
[key: string]: unknown;
|
780
|
+
}, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
|
781
|
+
switchChain: (args: SwitchChainParameters) => Promise<void>;
|
782
|
+
watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
|
783
|
+
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
|
784
|
+
};
|
785
|
+
|
786
|
+
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
|
787
|
+
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)>;
|
788
|
+
/**
|
789
|
+
* @description Creates a public client with a given transport.
|
790
|
+
*/
|
791
|
+
declare function createPublicClient<TTransport extends Transport, TChain extends Chain | undefined = undefined>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
|
792
|
+
|
793
|
+
type GetEnsAddressParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
794
|
+
/** ENS name to get address. */
|
795
|
+
name: string;
|
796
|
+
/** Address of ENS Universal Resolver Contract */
|
797
|
+
universalResolverAddress?: Address;
|
798
|
+
}>;
|
799
|
+
type GetEnsAddressReturnType = Address;
|
800
|
+
/**
|
801
|
+
* @description Gets address for ENS name.
|
802
|
+
*
|
803
|
+
* - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
804
|
+
* - 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.
|
805
|
+
*/
|
806
|
+
declare function getEnsAddress<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
|
807
|
+
|
808
|
+
type GetEnsTextParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
809
|
+
/** ENS name to get ENS avatar for. */
|
810
|
+
name: string;
|
811
|
+
/** Text record to retrieve */
|
812
|
+
key: string;
|
813
|
+
/** Address of ENS Universal Resolver Contract. */
|
814
|
+
universalResolverAddress?: Address;
|
815
|
+
}>;
|
816
|
+
type GetEnsTextReturnType = string | null;
|
817
|
+
/**
|
818
|
+
* @description Gets text record for ENS name.
|
819
|
+
*
|
820
|
+
* - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
|
821
|
+
* - 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.
|
822
|
+
*
|
823
|
+
* @example
|
824
|
+
* import { normalize } from 'viem/ens'
|
825
|
+
*
|
826
|
+
* const twitterRecord = await getEnsText(publicClient, {
|
827
|
+
* name: normalize('wagmi-dev.eth'),
|
828
|
+
* key: 'com.twitter',
|
829
|
+
* })
|
830
|
+
* // 'wagmi_sh'
|
831
|
+
*/
|
832
|
+
declare function getEnsText<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, key, universalResolverAddress: universalResolverAddress_, }: GetEnsTextParameters): Promise<GetEnsTextReturnType>;
|
833
|
+
|
834
|
+
type GetEnsAvatarParameters = Prettify<Omit<GetEnsTextParameters, 'key'> & {
|
835
|
+
/** Custom gateways to use */
|
836
|
+
gatewayUrls?: AssetGatewayUrls;
|
837
|
+
}>;
|
838
|
+
type GetEnsAvatarReturnType = string | null;
|
839
|
+
/**
|
840
|
+
* @description Gets avatar URI for ENS name.
|
841
|
+
*/
|
842
|
+
declare function getEnsAvatar<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, gatewayUrls, name, universalResolverAddress, }: GetEnsAvatarParameters): Promise<GetEnsAvatarReturnType>;
|
843
|
+
|
844
|
+
type GetEnsNameParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
845
|
+
/** Address to get ENS name for. */
|
846
|
+
address: Address;
|
847
|
+
/** Address of ENS Universal Resolver Contract. */
|
848
|
+
universalResolverAddress?: Address;
|
849
|
+
}>;
|
850
|
+
type GetEnsNameReturnType = string | null;
|
851
|
+
/**
|
852
|
+
* @description Gets primary name for specified address.
|
853
|
+
*
|
854
|
+
* - Calls `reverse(bytes)` on ENS Universal Resolver Contract.
|
855
|
+
*
|
856
|
+
* @example
|
857
|
+
* const ensName = await getEnsName(publicClient, {
|
858
|
+
* address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
|
859
|
+
* })
|
860
|
+
* // 'wagmi-dev.eth'
|
861
|
+
*/
|
862
|
+
declare function getEnsName<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
|
863
|
+
|
864
|
+
type GetEnsResolverParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
865
|
+
/** ENS name to get resolver. */
|
866
|
+
name: string;
|
867
|
+
/** Address of ENS Universal Resolver Contract */
|
868
|
+
universalResolverAddress?: Address;
|
869
|
+
}>;
|
870
|
+
type GetEnsResolverReturnType = Address;
|
871
|
+
/**
|
872
|
+
* @description Gets resolver for ENS name.
|
873
|
+
*/
|
874
|
+
declare function getEnsResolver<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsResolverParameters): Promise<`0x${string}`>;
|
875
|
+
|
876
|
+
export { GetStorageAtParameters as $, AddChainParameters as A, GetBytecodeReturnType as B, CreateContractEventFilterParameters as C, DeployContractParameters as D, EstimateContractGasParameters as E, GetChainIdReturnType as F, GetAddressesReturnType as G, GetEnsAddressParameters as H, GetEnsAddressReturnType as I, GetEnsNameParameters as J, GetEnsNameReturnType as K, GetEnsResolverParameters as L, GetEnsResolverReturnType as M, GetFeeHistoryParameters as N, GetFeeHistoryReturnType as O, PublicClient as P, GetFilterChangesParameters as Q, ReadContractParameters as R, SimulateContractParameters as S, GetFilterChangesReturnType as T, GetFilterLogsParameters as U, GetFilterLogsReturnType as V, WalletClient as W, GetGasPriceReturnType as X, GetLogsParameters as Y, GetLogsReturnType as Z, GetPermissionsReturnType as _, ReadContractReturnType as a, defineTransactionReceipt as a$, GetStorageAtReturnType as a0, GetTransactionConfirmationsParameters as a1, GetTransactionCountParameters as a2, GetTransactionConfirmationsReturnType as a3, GetTransactionCountReturnType as a4, GetTransactionParameters as a5, GetTransactionReceiptParameters as a6, GetTransactionReceiptReturnType as a7, GetTransactionReturnType as a8, MulticallParameters as a9, WatchAssetReturnType as aA, WatchBlockNumberParameters as aB, WatchBlockNumberReturnType as aC, WatchBlocksParameters as aD, WatchBlocksReturnType as aE, WatchEventParameters as aF, WatchEventReturnType as aG, WatchPendingTransactionsParameters as aH, WatchPendingTransactionsReturnType as aI, PublicClientConfig as aJ, WalletClientConfig as aK, createPublicClient as aL, createWalletClient as aM, AssetGateway as aN, AssetGatewayUrls as aO, GetTransportConfig as aP, MulticallContracts as aQ, MulticallResult as aR, MulticallResults as aS, ParseAccount as aT, BlockFormatter as aU, FormattedBlock as aV, FormattedTransactionReceipt as aW, FormattedTransactionRequest$1 as aX, TransactionReceiptFormatter as aY, TransactionRequestFormatter as aZ, defineBlock as a_, MulticallReturnType as aa, OnBlock as ab, OnBlockNumberFn as ac, OnBlockNumberParameter as ad, OnBlockParameter as ae, OnLogsFn as af, OnLogsParameter as ag, OnTransactionsFn as ah, OnTransactionsParameter as ai, ReplacementReason as aj, ReplacementReturnType as ak, RequestAddressesReturnType as al, RequestPermissionsReturnType as am, RequestPermissionsParameters as an, SendTransactionParameters as ao, SendTransactionReturnType as ap, SignMessageParameters as aq, SignMessageReturnType as ar, SignTypedDataParameters as as, SignTypedDataReturnType as at, SwitchChainParameters as au, UninstallFilterParameters as av, UninstallFilterReturnType as aw, WaitForTransactionReceiptParameters as ax, WaitForTransactionReceiptReturnType as ay, WatchAssetParameters as az, EstimateContractGasReturnType as b, defineTransactionRequest as b0, formatBlock as b1, formatTransactionRequest as b2, GetAccountParameter as b3, createContractEventFilter as b4, estimateContractGas as b5, getBytecode as b6, getStorageAt as b7, multicall as b8, readContract as b9, getFilterLogs as bA, getLogs as bB, getGasPrice as bC, getTransaction as bD, getTransactionConfirmations as bE, getTransactionCount as bF, getTransactionReceipt as bG, uninstallFilter as bH, waitForTransactionReceipt as bI, watchBlockNumber as bJ, watchBlocks as bK, watchEvent as bL, watchPendingTransactions as bM, addChain as bN, getAddresses as bO, getPermissions as bP, requestAddresses as bQ, requestPermissions as bR, sendTransaction as bS, signMessage as bT, signTypedData as bU, switchChain as bV, watchAsset as bW, FormattedTransactionRequest as bX, simulateContract as ba, watchContractEvent as bb, deployContract as bc, writeContract as bd, GetEnsAvatarParameters as be, GetEnsAvatarReturnType as bf, GetEnsTextParameters as bg, GetEnsTextReturnType as bh, getEnsAddress as bi, getEnsAvatar as bj, getEnsName as bk, getEnsResolver as bl, getEnsText as bm, call as bn, createBlockFilter as bo, createEventFilter as bp, createPendingTransactionFilter as bq, estimateGas as br, getBalance as bs, getBlock as bt, getBlockNumber as bu, getBlockNumberCache as bv, getBlockTransactionCount as bw, getChainId as bx, getFeeHistory as by, getFilterChanges as bz, SimulateContractReturnType as c, WriteContractParameters as d, WriteContractReturnType as e, CreateContractEventFilterReturnType as f, WatchContractEventParameters as g, WatchContractEventReturnType as h, CallParameters as i, CallReturnType as j, CreateBlockFilterReturnType as k, CreateEventFilterParameters as l, CreateEventFilterReturnType as m, CreatePendingTransactionFilterReturnType as n, DeployContractReturnType as o, EstimateGasParameters as p, EstimateGasReturnType as q, GetBalanceParameters as r, GetBalanceReturnType as s, GetBlockNumberParameters as t, GetBlockNumberReturnType as u, GetBlockParameters as v, GetBlockReturnType as w, GetBlockTransactionCountParameters as x, GetBlockTransactionCountReturnType as y, GetBytecodeParameters as z };
|