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
package/dist/index.d.ts
CHANGED
@@ -1,22 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
export { B as BaseError, C as CallExecutionError, a as ContractFunctionExecutionError, b as ContractFunctionRevertedError, c as ContractFunctionZeroDataError, E as EstimateGasExecutionError, d as ExecutionRevertedError, F as FeeCapTooHighError, e as FeeCapTooLowError, G as GetContractAddressOptions, p as GetCreate2AddressOptions, q as GetCreateAddressOptions, r as GetSerializedTransactionType, s as GetTransactionType, t as HashTypedDataParameters, u as HashTypedDataReturnType, I as InsufficientFundsError, f as IntrinsicGasTooHighError, g as IntrinsicGasTooLowError, h as InvalidLegacyVError, N as NonceMaxValueError, i as NonceTooHighError, j as NonceTooLowError, k as RawContractError, v as RecoverAddressParameters, w as RecoverAddressReturnType, x as RecoverMessageAddressParameters, y as RecoverMessageAddressReturnType, z as RecoverTypedDataAddressParameters, A as RecoverTypedDataAddressReturnType, T as TipAboveFeeCapError, D as ToRlpReturnType, l as TransactionExecutionError, n as TransactionNotFoundError, o as TransactionReceiptNotFoundError, m as TransactionTypeNotSupportedError, U as UnknownNodeError, V as VerifyMessageParameters, J as VerifyMessageReturnType, K as VerifyTypedDataParameters, L as VerifyTypedDataReturnType, W as WaitForTransactionReceiptTimeoutError, M as assertRequest, O as assertTransactionEIP1559, P as assertTransactionEIP2930, Q as assertTransactionLegacy, S as boolToBytes, X as boolToHex, Y as bytesToBigint, Z as bytesToBool, _ as bytesToHex, $ as bytesToNumber, a0 as bytesToString, a1 as concat, a2 as concatBytes, a3 as concatHex, a4 as formatEther, a5 as formatGwei, a6 as formatUnits, a7 as fromBytes, a8 as fromHex, a9 as fromRlp, aa as getAddress, ab as getContractAddress, ac as getContractError, ad as getCreate2Address, ae as getCreateAddress, af as getEventSelector, ag as getFunctionSelector, ah as getSerializedTransactionType, ai as getTransactionType, aj as hashMessage, ak as hashTypedData, al as hexToBigInt, am as hexToBool, an as hexToBytes, ao as hexToNumber, ap as hexToString, aq as isAddress, ar as isAddressEqual, as as isBytes, at as isHash, au as isHex, av as keccak256, aw as numberToBytes, ax as numberToHex, ay as pad, az as padBytes, aA as padHex, aB as parseEther, aC as parseGwei, aD as parseTransaction, aE as parseUnits, aF as prepareRequest, aG as recoverAddress, aH as recoverMessageAddress, aI as recoverTypedDataAddress, aJ as serializeTransaction, aK as size, aL as slice, aM as sliceBytes, aN as sliceHex, aO as stringToBytes, aP as stringToHex, aQ as stringify, aR as toBytes, aS as toHex, aT as toRlp, aU as trim, aV as validateTypedData, aW as verifyMessage, aX as verifyTypedData } from './parseGwei-f14525ab.js';
|
1
|
+
import { P as PublicClient, W as WalletClient, R as ReadContractParameters, a as ReadContractReturnType, E as EstimateContractGasParameters, b as EstimateContractGasReturnType, S as SimulateContractParameters, c as SimulateContractReturnType, d as WriteContractParameters, e as WriteContractReturnType, C as CreateContractEventFilterParameters, f as CreateContractEventFilterReturnType, g as WatchContractEventParameters, h as WatchContractEventReturnType } from './getEnsResolver-9e26c596.js';
|
2
|
+
export { A as AddChainParameters, aN as AssetGateway, aO as AssetGatewayUrls, aU as BlockFormatter, i as CallParameters, j as CallReturnType, k as CreateBlockFilterReturnType, C as CreateContractEventFilterParameters, f as CreateContractEventFilterReturnType, l as CreateEventFilterParameters, m as CreateEventFilterReturnType, n as CreatePendingTransactionFilterReturnType, D as DeployContractParameters, o as DeployContractReturnType, p as EstimateGasParameters, q as EstimateGasReturnType, aV as FormattedBlock, aW as FormattedTransactionReceipt, aX as FormattedTransactionRequest, G as GetAddressesReturnType, r as GetBalanceParameters, s as GetBalanceReturnType, t as GetBlockNumberParameters, u as GetBlockNumberReturnType, v as GetBlockParameters, w as GetBlockReturnType, x as GetBlockTransactionCountParameters, y as GetBlockTransactionCountReturnType, z as GetBytecodeParameters, B as GetBytecodeReturnType, F as GetChainIdReturnType, H as GetEnsAddressParameters, I as GetEnsAddressReturnType, J as GetEnsNameParameters, K as GetEnsNameReturnType, L as GetEnsResolverParameters, M as GetEnsResolverReturnType, N as GetFeeHistoryParameters, O as GetFeeHistoryReturnType, Q as GetFilterChangesParameters, T as GetFilterChangesReturnType, U as GetFilterLogsParameters, V as GetFilterLogsReturnType, X as GetGasPriceReturnType, Y as GetLogsParameters, Z as GetLogsReturnType, _ as GetPermissionsReturnType, $ as GetStorageAtParameters, a0 as GetStorageAtReturnType, a1 as GetTransactionConfirmationsParameters, a3 as GetTransactionConfirmationsReturnType, a2 as GetTransactionCountParameters, a4 as GetTransactionCountReturnType, a5 as GetTransactionParameters, a6 as GetTransactionReceiptParameters, a7 as GetTransactionReceiptReturnType, a8 as GetTransactionReturnType, aP as GetTransportConfig, aQ as MulticallContracts, a9 as MulticallParameters, aR as MulticallResult, aS as MulticallResults, aa as MulticallReturnType, ab as OnBlock, ac as OnBlockNumberFn, ad as OnBlockNumberParameter, ae as OnBlockParameter, af as OnLogsFn, ag as OnLogsParameter, ah as OnTransactionsFn, ai as OnTransactionsParameter, aT as ParseAccount, P as PublicClient, aJ as PublicClientConfig, R as ReadContractParameters, a as ReadContractReturnType, aj as ReplacementReason, ak as ReplacementReturnType, al as RequestAddressesReturnType, an as RequestPermissionsParameters, am as RequestPermissionsReturnType, ao as SendTransactionParameters, ap as SendTransactionReturnType, aq as SignMessageParameters, ar as SignMessageReturnType, as as SignTypedDataParameters, at as SignTypedDataReturnType, S as SimulateContractParameters, c as SimulateContractReturnType, au as SwitchChainParameters, aY as TransactionReceiptFormatter, aZ as TransactionRequestFormatter, av as UninstallFilterParameters, aw as UninstallFilterReturnType, ax as WaitForTransactionReceiptParameters, ay as WaitForTransactionReceiptReturnType, W as WalletClient, aK as WalletClientConfig, az as WatchAssetParameters, aA as WatchAssetReturnType, aB as WatchBlockNumberParameters, aC as WatchBlockNumberReturnType, aD as WatchBlocksParameters, aE as WatchBlocksReturnType, g as WatchContractEventParameters, h as WatchContractEventReturnType, aF as WatchEventParameters, aG as WatchEventReturnType, aH as WatchPendingTransactionsParameters, aI as WatchPendingTransactionsReturnType, d as WriteContractParameters, e as WriteContractReturnType, aL as createPublicClient, aM as createWalletClient, a_ as defineBlock, a$ as defineTransactionReceipt, b0 as defineTransactionRequest, b1 as formatBlock, b2 as formatTransactionRequest } from './getEnsResolver-9e26c596.js';
|
3
|
+
import { T as TransportConfig, a as Transport, B as BaseRpcRequests } from './createTransport-21a0d2b3.js';
|
4
|
+
export { C as Client, b as ClientConfig, a as Transport, T as TransportConfig, c as createClient, d as createTransport } from './createTransport-21a0d2b3.js';
|
5
|
+
import { B as BaseError, H as HttpOptions, R as RpcResponse } from './parseGwei-d2147f8b.js';
|
6
|
+
export { B as BaseError, C as CallExecutionError, a as ContractFunctionExecutionError, b as ContractFunctionRevertedError, c as ContractFunctionZeroDataError, E as EstimateGasExecutionError, d as ExecutionRevertedError, F as FeeCapTooHighError, e as FeeCapTooLowError, G as GetContractAddressOptions, p as GetCreate2AddressOptions, q as GetCreateAddressOptions, r as GetSerializedTransactionType, s as GetTransactionType, t as HashTypedDataParameters, u as HashTypedDataReturnType, I as InsufficientFundsError, f as IntrinsicGasTooHighError, g as IntrinsicGasTooLowError, h as InvalidLegacyVError, N as NonceMaxValueError, i as NonceTooHighError, j as NonceTooLowError, k as RawContractError, v as RecoverAddressParameters, w as RecoverAddressReturnType, x as RecoverMessageAddressParameters, y as RecoverMessageAddressReturnType, z as RecoverTypedDataAddressParameters, A as RecoverTypedDataAddressReturnType, T as TipAboveFeeCapError, D as ToRlpReturnType, l as TransactionExecutionError, n as TransactionNotFoundError, o as TransactionReceiptNotFoundError, m as TransactionTypeNotSupportedError, U as UnknownNodeError, V as VerifyMessageParameters, J as VerifyMessageReturnType, K as VerifyTypedDataParameters, L as VerifyTypedDataReturnType, W as WaitForTransactionReceiptTimeoutError, M as assertRequest, O as assertTransactionEIP1559, P as assertTransactionEIP2930, Q as assertTransactionLegacy, S as boolToBytes, X as boolToHex, Y as bytesToBigint, Z as bytesToBool, _ as bytesToHex, $ as bytesToNumber, a0 as bytesToString, a1 as concat, a2 as concatBytes, a3 as concatHex, a4 as formatEther, a5 as formatGwei, a6 as formatUnits, a7 as fromBytes, a8 as fromHex, a9 as fromRlp, aa as getAddress, ab as getContractAddress, ac as getContractError, ad as getCreate2Address, ae as getCreateAddress, af as getEventSelector, ag as getFunctionSelector, ah as getSerializedTransactionType, ai as getTransactionType, aj as hashMessage, ak as hashTypedData, al as hexToBigInt, am as hexToBool, an as hexToBytes, ao as hexToNumber, ap as hexToString, aq as isAddress, ar as isAddressEqual, as as isBytes, at as isHash, au as isHex, av as keccak256, aw as numberToBytes, ax as numberToHex, ay as pad, az as padBytes, aA as padHex, aB as parseEther, aC as parseGwei, aD as parseTransaction, aE as parseUnits, aF as prepareRequest, aG as recoverAddress, aH as recoverMessageAddress, aI as recoverTypedDataAddress, aJ as serializeTransaction, aK as size, aL as slice, aM as sliceBytes, aN as sliceHex, aO as stringToBytes, aP as stringToHex, aQ as stringify, aR as toBytes, aS as toHex, aT as toRlp, aU as trim, aV as validateTypedData, aW as verifyMessage, aX as verifyTypedData } from './parseGwei-d2147f8b.js';
|
8
7
|
import WebSocket from 'isomorphic-ws';
|
9
|
-
import { H as Hex, A as AbiItem, a as Hash, C as Chain, B as ByteArray } from './chain-
|
10
|
-
export { A as AbiItem,
|
11
|
-
export { D as DropTransactionParameters, I as ImpersonateAccountParameters, a as IncreaseTimeParameters, M as MineParameters, R as ResetParameters, b as RevertParameters, S as SendUnsignedTransactionParameters, c as SendUnsignedTransactionReturnType, d as SetBalanceParameters, e as SetBlockGasLimitParameters, f as SetBlockTimestampIntervalParameters, g as SetCodeParameters, h as SetCoinbaseParameters, i as SetIntervalMiningParameters, j as SetMinGasPriceParameters, k as SetNextBlockBaseFeePerGasParameters, l as SetNextBlockTimestampParameters, m as SetNonceParameters, n as SetStorageAtParameters, o as StopImpersonatingAccountParameters, T as TestClient, p as TestClientConfig, q as createTestClient } from './test-
|
8
|
+
import { H as Hex, A as AbiItem, a as Hash, C as Chain, B as ByteArray, I as IsNarrowable, P as Prettify, b as IsNever, c as IsUndefined, d as AbiEventParametersToPrimitiveTypes, M as MaybeExtractEventArgsFromAbi } from './chain-5507c6f0.js';
|
9
|
+
export { A as AbiItem, e as AccessList, f as Block, g as BlockIdentifier, h as BlockNumber, i as BlockTag, B as ByteArray, C as Chain, j as ContractFunctionConfig, k as ContractFunctionResult, aa as ExtractFormatter, F as FeeHistory, l as FeeValues, m as FeeValuesEIP1559, n as FeeValuesLegacy, ab as Formatted, ac as FormattedTransaction, G as GetConstructorArgs, o as GetErrorArgs, p as GetEventArgs, q as GetEventArgsFromTopics, r as GetFunctionArgs, a as Hash, H as Hex, s as InferErrorName, t as InferEventName, u as InferFunctionName, v as InferItemName, L as Log, R as RpcBlock, w as RpcBlockIdentifier, x as RpcBlockNumber, y as RpcFeeHistory, z as RpcFeeValues, D as RpcLog, E as RpcTransaction, J as RpcTransactionReceipt, K as RpcTransactionRequest, N as RpcUncle, T as Transaction, O as TransactionBase, Q as TransactionEIP1559, S as TransactionEIP2930, ad as TransactionFormatter, U as TransactionLegacy, V as TransactionReceipt, W as TransactionRequest, X as TransactionRequestBase, Y as TransactionRequestEIP1559, Z as TransactionRequestEIP2930, _ as TransactionRequestLegacy, $ as TransactionSerializable, a0 as TransactionSerializableBase, a1 as TransactionSerializableEIP1559, a2 as TransactionSerializableEIP2930, a3 as TransactionSerializableLegacy, a4 as TransactionSerialized, a5 as TransactionSerializedEIP1559, a6 as TransactionSerializedEIP2930, a7 as TransactionSerializedLegacy, a8 as TransactionType, a9 as Uncle, ae as defineTransaction, af as formatTransaction, ag as transactionType } from './chain-5507c6f0.js';
|
10
|
+
export { D as DropTransactionParameters, I as ImpersonateAccountParameters, a as IncreaseTimeParameters, M as MineParameters, R as ResetParameters, b as RevertParameters, S as SendUnsignedTransactionParameters, c as SendUnsignedTransactionReturnType, d as SetBalanceParameters, e as SetBlockGasLimitParameters, f as SetBlockTimestampIntervalParameters, g as SetCodeParameters, h as SetCoinbaseParameters, i as SetIntervalMiningParameters, j as SetMinGasPriceParameters, k as SetNextBlockBaseFeePerGasParameters, l as SetNextBlockTimestampParameters, m as SetNonceParameters, n as SetStorageAtParameters, o as StopImpersonatingAccountParameters, T as TestClient, p as TestClientConfig, q as createTestClient } from './test-b67569fe.js';
|
11
|
+
import { AbiParameter, Abi, Narrow, Address, ExtractAbiEventNames, ExtractAbiFunctionNames, AbiFunction, ExtractAbiFunction, AbiParametersToPrimitiveTypes, AbiEvent, ExtractAbiEvent } from 'abitype';
|
12
|
+
export { Address, ParseAbi, ParseAbiItem, ParseAbiParameter, ParseAbiParameters, parseAbi, parseAbiItem, parseAbiParameter, parseAbiParameters } from 'abitype';
|
13
|
+
import { A as Account } from './typedData-46b4d81f.js';
|
14
|
+
export { A as Account, a as AccountSource, C as CustomSource, H as HDAccount, b as HDOptions, J as JsonRpcAccount, L as LocalAccount } from './typedData-46b4d81f.js';
|
12
15
|
export { l as labelhash, n as namehash } from './namehash-afff0feb.js';
|
13
|
-
export { D as DecodeAbiParametersReturnType, E as EncodeAbiParametersReturnType, G as GetAbiItemParameters, d as decodeAbiParameters, e as encodeAbiParameters, g as getAbiItem } from './getAbiItem-
|
14
|
-
export { D as DecodeErrorResultParameters, a as DecodeErrorResultReturnType, b as DecodeEventLogParameters, c as DecodeEventLogReturnType, d as DecodeFunctionDataParameters, e as DecodeFunctionResultParameters, f as DecodeFunctionResultReturnType, E as EncodeDeployDataParameters, g as EncodeErrorResultParameters, h as EncodeEventTopicsParameters, i as EncodeFunctionDataParameters, j as EncodeFunctionResultParameters, k as decodeErrorResult, l as decodeEventLog, m as decodeFunctionData, n as decodeFunctionResult, o as encodeDeployData, p as encodeErrorResult, q as encodeEventTopics, r as encodeFunctionData, s as encodeFunctionResult } from './encodeFunctionResult-
|
15
|
-
export { e as encodePacked } from './encodePacked-
|
16
|
-
export {
|
17
|
-
export { d as defineChain } from './chain-e9b996ff.js';
|
16
|
+
export { D as DecodeAbiParametersReturnType, E as EncodeAbiParametersReturnType, G as GetAbiItemParameters, d as decodeAbiParameters, e as encodeAbiParameters, g as getAbiItem } from './getAbiItem-bfba73d1.js';
|
17
|
+
export { D as DecodeErrorResultParameters, a as DecodeErrorResultReturnType, b as DecodeEventLogParameters, c as DecodeEventLogReturnType, d as DecodeFunctionDataParameters, e as DecodeFunctionResultParameters, f as DecodeFunctionResultReturnType, E as EncodeDeployDataParameters, g as EncodeErrorResultParameters, h as EncodeEventTopicsParameters, i as EncodeFunctionDataParameters, j as EncodeFunctionResultParameters, k as decodeErrorResult, l as decodeEventLog, m as decodeFunctionData, n as decodeFunctionResult, o as encodeDeployData, p as encodeErrorResult, q as encodeEventTopics, r as encodeFunctionData, s as encodeFunctionResult } from './encodeFunctionResult-c5185b98.js';
|
18
|
+
export { e as encodePacked } from './encodePacked-98f67d09.js';
|
19
|
+
export { d as defineChain } from './chain-fe47467d.js';
|
18
20
|
export { HDKey } from '@scure/bip32';
|
19
|
-
import './eip1193-
|
21
|
+
import './eip1193-2f3a9cd2.js';
|
20
22
|
import '@wagmi/chains';
|
21
23
|
|
22
24
|
declare class AbiConstructorNotFoundError extends BaseError {
|
@@ -214,6 +216,13 @@ declare class OffsetOutOfBoundsError extends BaseError {
|
|
214
216
|
});
|
215
217
|
}
|
216
218
|
|
219
|
+
declare class EnsAvatarUriResolutionError extends BaseError {
|
220
|
+
name: string;
|
221
|
+
constructor({ uri }: {
|
222
|
+
uri: string;
|
223
|
+
});
|
224
|
+
}
|
225
|
+
|
217
226
|
declare class FilterTypeNotSupportedError extends BaseError {
|
218
227
|
name: string;
|
219
228
|
constructor(type: string);
|
@@ -383,11 +392,45 @@ type CustomTransport = Transport<'custom', EthereumProvider['request']>;
|
|
383
392
|
*/
|
384
393
|
declare function custom<TProvider extends EthereumProvider>(provider: TProvider, config?: CustomTransportConfig): CustomTransport;
|
385
394
|
|
395
|
+
type RankOptions = {
|
396
|
+
/**
|
397
|
+
* The polling interval (in ms) at which the ranker should ping the RPC URL.
|
398
|
+
* @default client.pollingInterval
|
399
|
+
*/
|
400
|
+
interval?: number;
|
401
|
+
/**
|
402
|
+
* The number of previous samples to perform ranking on.
|
403
|
+
* @default 10
|
404
|
+
*/
|
405
|
+
sampleCount?: number;
|
406
|
+
/**
|
407
|
+
* Timeout when sampling transports.
|
408
|
+
* @default 1_000
|
409
|
+
*/
|
410
|
+
timeout?: number;
|
411
|
+
/**
|
412
|
+
* Weights to apply to the scores. Weight values are proportional.
|
413
|
+
*/
|
414
|
+
weights?: {
|
415
|
+
/**
|
416
|
+
* The weight to apply to the latency score.
|
417
|
+
* @default 0.3
|
418
|
+
*/
|
419
|
+
latency?: number;
|
420
|
+
/**
|
421
|
+
* The weight to apply to the stability score.
|
422
|
+
* @default 0.7
|
423
|
+
*/
|
424
|
+
stability?: number;
|
425
|
+
};
|
426
|
+
};
|
386
427
|
type FallbackTransportConfig = {
|
387
428
|
/** The key of the Fallback transport. */
|
388
429
|
key?: TransportConfig['key'];
|
389
430
|
/** The name of the Fallback transport. */
|
390
431
|
name?: TransportConfig['name'];
|
432
|
+
/** Toggle to enable ranking, or rank options. */
|
433
|
+
rank?: boolean | RankOptions;
|
391
434
|
/** The max number of times to retry. */
|
392
435
|
retryCount?: TransportConfig['retryCount'];
|
393
436
|
/** The base delay (in ms) between retries. */
|
@@ -396,7 +439,7 @@ type FallbackTransportConfig = {
|
|
396
439
|
type FallbackTransport = Transport<'fallback', {
|
397
440
|
transports: Transport[];
|
398
441
|
}>;
|
399
|
-
declare function fallback(
|
442
|
+
declare function fallback(transports_: Transport[], config?: FallbackTransportConfig): FallbackTransport;
|
400
443
|
|
401
444
|
type HttpTransportConfig = {
|
402
445
|
/**
|
@@ -465,6 +508,106 @@ declare function webSocket(
|
|
465
508
|
/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
|
466
509
|
url?: string, config?: WebSocketTransportConfig): WebSocketTransport;
|
467
510
|
|
511
|
+
type GetContractParameters<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TAbi extends Abi | readonly unknown[] = Abi, TPublicClient extends PublicClient<TTransport, TChain> | unknown = unknown, TWalletClient extends WalletClient<TTransport, TChain, TAccount> | unknown = unknown> = {
|
512
|
+
/** Contract ABI */
|
513
|
+
abi: Narrow<TAbi>;
|
514
|
+
/** Contract address */
|
515
|
+
address: Address;
|
516
|
+
/** Public client */
|
517
|
+
publicClient?: TPublicClient;
|
518
|
+
/** Wallet client */
|
519
|
+
walletClient?: TWalletClient;
|
520
|
+
};
|
521
|
+
type GetContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TPublicClient extends PublicClient | unknown = unknown, TWalletClient extends WalletClient | unknown = unknown, _EventNames extends string = TAbi extends Abi ? Abi extends TAbi ? string : ExtractAbiEventNames<TAbi> : string, _ReadFunctionNames extends string = TAbi extends Abi ? Abi extends TAbi ? string : ExtractAbiFunctionNames<TAbi, 'pure' | 'view'> : string, _WriteFunctionNames extends string = TAbi extends Abi ? Abi extends TAbi ? string : ExtractAbiFunctionNames<TAbi, 'nonpayable' | 'payable'> : string, _Narrowable extends boolean = IsNarrowable<TAbi, Abi>> = Prettify<(TPublicClient extends PublicClient ? (IsNever<_ReadFunctionNames> extends true ? unknown : {
|
522
|
+
/**
|
523
|
+
* Calls a read-only function on a contract, and returns the response.
|
524
|
+
*
|
525
|
+
* A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
|
526
|
+
*
|
527
|
+
* Internally, `read` uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
528
|
+
*/
|
529
|
+
read: {
|
530
|
+
[FunctionName in _ReadFunctionNames]: GetReadFunction<_Narrowable, TAbi, FunctionName>;
|
531
|
+
};
|
532
|
+
}) & (IsNever<_WriteFunctionNames> extends true ? unknown : {
|
533
|
+
/**
|
534
|
+
* Estimates the gas necessary to complete a transaction without submitting it to the network.
|
535
|
+
*/
|
536
|
+
estimateGas: {
|
537
|
+
[FunctionName in _WriteFunctionNames]: GetEstimateFunction<_Narrowable, TPublicClient extends PublicClient ? TPublicClient['chain'] : undefined, TAbi, FunctionName>;
|
538
|
+
};
|
539
|
+
/**
|
540
|
+
* Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions.
|
541
|
+
*
|
542
|
+
* This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract.html), but also supports contract write functions.
|
543
|
+
*
|
544
|
+
* Internally, `simulate` uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
545
|
+
*/
|
546
|
+
simulate: {
|
547
|
+
[FunctionName in _WriteFunctionNames]: GetSimulateFunction<_Narrowable, TPublicClient extends PublicClient ? TPublicClient['chain'] : undefined, TAbi, FunctionName>;
|
548
|
+
};
|
549
|
+
}) & (IsNever<_EventNames> extends true ? unknown : {
|
550
|
+
/**
|
551
|
+
* Creates a Filter to retrieve event logs that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges.html) or [`getFilterLogs`](https://viem.sh/docs/actions/public/getFilterLogs.html).
|
552
|
+
*/
|
553
|
+
createEventFilter: {
|
554
|
+
[EventName in _EventNames]: GetEventFilter<_Narrowable, TAbi, EventName>;
|
555
|
+
};
|
556
|
+
/**
|
557
|
+
* Watches and returns emitted contract event logs.
|
558
|
+
*
|
559
|
+
* This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent.html#onLogs).
|
560
|
+
*
|
561
|
+
* `watchEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter.html) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs.html) instead.
|
562
|
+
*/
|
563
|
+
watchEvent: {
|
564
|
+
[EventName in _EventNames]: GetWatchEvent<_Narrowable, TAbi, EventName>;
|
565
|
+
};
|
566
|
+
}) : unknown) & (TWalletClient extends WalletClient ? IsNever<_WriteFunctionNames> extends true ? unknown : {
|
567
|
+
/**
|
568
|
+
* Executes a write function on a contract.
|
569
|
+
*
|
570
|
+
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms.html) is needed to be broadcast in order to change the state.
|
571
|
+
*
|
572
|
+
* Internally, `write` uses a [Wallet Client](https://viem.sh/docs/clients/wallet.html) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
573
|
+
*
|
574
|
+
* Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract.html#usage) before you execute it.
|
575
|
+
*/
|
576
|
+
write: {
|
577
|
+
[FunctionName in _WriteFunctionNames]: GetWriteFunction<_Narrowable, TWalletClient extends WalletClient ? TWalletClient['chain'] : undefined, TWalletClient extends WalletClient ? TWalletClient['account'] : undefined, TAbi, FunctionName>;
|
578
|
+
};
|
579
|
+
} : unknown)>;
|
580
|
+
/**
|
581
|
+
* Gets type-safe contract instance.
|
582
|
+
*/
|
583
|
+
declare function getContract<TTransport extends Transport, TAbi extends Abi | readonly unknown[], TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TPublicClient extends PublicClient<TTransport, TChain> | undefined = PublicClient<TTransport, TChain> | undefined, TWalletClient extends WalletClient<TTransport, TChain, TAccount> | undefined = WalletClient<TTransport, TChain, TAccount> | undefined>({ abi, address, publicClient, walletClient, }: GetContractParameters<TTransport, TChain, TAccount, TAbi, TPublicClient, TWalletClient>): GetContractReturnType<TAbi, TPublicClient, TWalletClient>;
|
584
|
+
type GetReadFunction<Narrowable extends boolean, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction, Args = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, Options = Prettify<Omit<ReadContractParameters<TAbi, TFunctionName>, 'abi' | 'address' | 'args' | 'functionName'>>> = Narrowable extends true ? (...parameters: Args extends readonly [] ? [options?: Options] : [args: Args, options?: Options]) => Promise<ReadContractReturnType<TAbi, TFunctionName>> : (...parameters: [options?: Options] | [args: readonly unknown[], options?: Options]) => Promise<ReadContractReturnType>;
|
585
|
+
type GetEstimateFunction<Narrowable extends boolean, TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction, Args = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, Options = Prettify<Omit<EstimateContractGasParameters<TAbi, TFunctionName, TChain>, 'abi' | 'address' | 'args' | 'functionName'>>> = Narrowable extends true ? (...parameters: Args extends readonly [] ? [options?: Options] : [args: Args, options?: Options]) => Promise<EstimateContractGasReturnType> : (...parameters: [options?: Options] | [args: readonly unknown[], options?: Options]) => Promise<EstimateContractGasReturnType>;
|
586
|
+
type GetSimulateFunction<Narrowable extends boolean, TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction, Args = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>> = Narrowable extends true ? <TChainOverride extends Chain | undefined, Options extends Prettify<Omit<SimulateContractParameters<TAbi, TFunctionName, TChain, TChainOverride>, 'abi' | 'address' | 'args' | 'functionName'>>>(...parameters: Args extends readonly [] ? [options?: Options] : [args: Args, options?: Options]) => Promise<SimulateContractReturnType<TAbi, TFunctionName, TChain, TChainOverride>> : <TChainOverride extends Chain | undefined, Options extends Prettify<Omit<SimulateContractParameters<TAbi, TFunctionName, TChain, TChainOverride>, 'abi' | 'address' | 'args' | 'functionName'>>>(...parameters: [options?: Options] | [args: readonly unknown[], options?: Options]) => Promise<SimulateContractReturnType>;
|
587
|
+
type GetWriteFunction<Narrowable extends boolean, TChain extends Chain | undefined, TAccount extends Account | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction, Args = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, IsOptionsRequired = [IsUndefined<TAccount>, IsUndefined<TChain>] extends [true, false] | [false, true] ? true : false> = Narrowable extends true ? <TChainOverride extends Chain | undefined, Options extends Prettify<Omit<WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>, 'abi' | 'address' | 'args' | 'functionName'>>, Rest extends IsOptionsRequired extends true ? [options: Options] : [options?: Options]>(...parameters: Args extends readonly [] ? Rest : [args: Args, ...parameters: Rest]) => Promise<WriteContractReturnType> : <TChainOverride extends Chain | undefined, Options extends Prettify<Omit<WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>, 'abi' | 'address' | 'args' | 'functionName'>>, Rest extends unknown[] = IsOptionsRequired extends true ? [options: Options] : [options?: Options]>(...parameters: Rest | [args: readonly unknown[], ...parameters: Rest]) => Promise<WriteContractReturnType>;
|
588
|
+
type GetEventFilter<Narrowable extends boolean, TAbi extends Abi | readonly unknown[], TEventName extends string, TAbiEvent extends AbiEvent = TAbi extends Abi ? ExtractAbiEvent<TAbi, TEventName> : AbiEvent, Args = AbiEventParametersToPrimitiveTypes<TAbiEvent['inputs']>, Options = Prettify<Omit<CreateContractEventFilterParameters<TAbi, TEventName>, 'abi' | 'address' | 'args' | 'eventName'>>, IndexedInputs = Extract<TAbiEvent['inputs'][number], {
|
589
|
+
indexed: true;
|
590
|
+
}>> = Narrowable extends true ? <TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(...parameters: IsNever<IndexedInputs> extends true ? [options?: Options] : [
|
591
|
+
args: Args | (Args extends Narrow<TArgs> ? Narrow<TArgs> : never),
|
592
|
+
options?: Options
|
593
|
+
]) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>> : (...parameters: [options?: Options] | [
|
594
|
+
args: readonly unknown[] | CreateContractFilterOptions,
|
595
|
+
options?: Options
|
596
|
+
]) => Promise<CreateContractEventFilterReturnType>;
|
597
|
+
type GetWatchEvent<Narrowable extends boolean, TAbi extends Abi | readonly unknown[], TEventName extends string, TAbiEvent extends AbiEvent = TAbi extends Abi ? ExtractAbiEvent<TAbi, TEventName> : AbiEvent, Args = AbiEventParametersToPrimitiveTypes<TAbiEvent['inputs']>, Options = Prettify<Omit<WatchContractEventParameters<TAbi, TEventName>, 'abi' | 'address' | 'args' | 'eventName'>>, IndexedInputs = Extract<TAbiEvent['inputs'][number], {
|
598
|
+
indexed: true;
|
599
|
+
}>> = Narrowable extends true ? (...parameters: IsNever<IndexedInputs> extends true ? [options: Options] : [args: Args, options: Options]) => WatchContractEventReturnType : (...parameters: [options?: Options] | [
|
600
|
+
args: readonly unknown[] | WatchContractEventOptions,
|
601
|
+
options?: Options
|
602
|
+
]) => WatchContractEventReturnType;
|
603
|
+
type CreateContractFilterOptions = RemoveProperties<CreateContractEventFilterParameters>;
|
604
|
+
type WatchContractEventOptions = RemoveProperties<WatchContractEventParameters>;
|
605
|
+
type RemoveProperties<T extends object> = Prettify<{
|
606
|
+
[key: string]: unknown;
|
607
|
+
} & {
|
608
|
+
[_ in keyof T]?: never;
|
609
|
+
}>;
|
610
|
+
|
468
611
|
declare const multicall3Abi: readonly [{
|
469
612
|
readonly inputs: readonly [{
|
470
613
|
readonly components: readonly [{
|
@@ -509,4 +652,4 @@ declare const weiUnits: {
|
|
509
652
|
gwei: number;
|
510
653
|
};
|
511
654
|
|
512
|
-
export { AbiConstructorNotFoundError, AbiConstructorParamsNotFoundError, AbiDecodingDataSizeInvalidError, AbiDecodingZeroDataError, AbiEncodingArrayLengthMismatchError, AbiEncodingLengthMismatchError, AbiErrorInputsNotFoundError, AbiErrorNotFoundError, AbiErrorSignatureNotFoundError, AbiEventNotFoundError, AbiEventSignatureEmptyTopicsError, AbiEventSignatureNotFoundError, AbiFunctionNotFoundError, AbiFunctionOutputsNotFoundError, AbiFunctionSignatureNotFoundError, BlockNotFoundError, ChainDoesNotSupportContract, CustomTransport, CustomTransportConfig, DataLengthTooLongError, DataLengthTooShortError, DecodeLogTopicsMismatch, FallbackTransport, FallbackTransportConfig, FilterTypeNotSupportedError, HttpRequestError, HttpTransport, HttpTransportConfig, InternalRpcError, InvalidAbiDecodingTypeError, InvalidAbiEncodingTypeError, InvalidAddressError, InvalidArrayError, InvalidBytesBooleanError, InvalidChainIdError, InvalidDefinitionTypeError, InvalidHexBooleanError, InvalidHexValueError, InvalidInputRpcError, InvalidParamsRpcError, InvalidRequestRpcError, JsonRpcVersionUnsupportedError, LimitExceededRpcError, MethodNotFoundRpcError, MethodNotSupportedRpcError, OffsetOutOfBoundsError, ParseRpcError, RequestError, ResourceNotFoundRpcError, ResourceUnavailableRpcError, RpcError, RpcRequestError, SizeExceedsPaddingSizeError, SwitchChainError, TimeoutError, TransactionRejectedRpcError, UnknownRpcError, UrlRequiredError, UserRejectedRequestError, WebSocketRequestError, WebSocketTransport, WebSocketTransportConfig, custom, etherUnits, fallback, gweiUnits, http, multicall3Abi, webSocket, weiUnits };
|
655
|
+
export { AbiConstructorNotFoundError, AbiConstructorParamsNotFoundError, AbiDecodingDataSizeInvalidError, AbiDecodingZeroDataError, AbiEncodingArrayLengthMismatchError, AbiEncodingLengthMismatchError, AbiErrorInputsNotFoundError, AbiErrorNotFoundError, AbiErrorSignatureNotFoundError, AbiEventNotFoundError, AbiEventSignatureEmptyTopicsError, AbiEventSignatureNotFoundError, AbiFunctionNotFoundError, AbiFunctionOutputsNotFoundError, AbiFunctionSignatureNotFoundError, BlockNotFoundError, ChainDoesNotSupportContract, CustomTransport, CustomTransportConfig, DataLengthTooLongError, DataLengthTooShortError, DecodeLogTopicsMismatch, EnsAvatarUriResolutionError, FallbackTransport, FallbackTransportConfig, FilterTypeNotSupportedError, GetContractParameters, GetContractReturnType, HttpRequestError, HttpTransport, HttpTransportConfig, InternalRpcError, InvalidAbiDecodingTypeError, InvalidAbiEncodingTypeError, InvalidAddressError, InvalidArrayError, InvalidBytesBooleanError, InvalidChainIdError, InvalidDefinitionTypeError, InvalidHexBooleanError, InvalidHexValueError, InvalidInputRpcError, InvalidParamsRpcError, InvalidRequestRpcError, JsonRpcVersionUnsupportedError, LimitExceededRpcError, MethodNotFoundRpcError, MethodNotSupportedRpcError, OffsetOutOfBoundsError, ParseRpcError, RequestError, ResourceNotFoundRpcError, ResourceUnavailableRpcError, RpcError, RpcRequestError, SizeExceedsPaddingSizeError, SwitchChainError, TimeoutError, TransactionRejectedRpcError, UnknownRpcError, UrlRequiredError, UserRejectedRequestError, WebSocketRequestError, WebSocketTransport, WebSocketTransportConfig, custom, etherUnits, fallback, getContract, gweiUnits, http, multicall3Abi, webSocket, weiUnits };
|