viem 2.56.8 → 2.57.0
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/CHANGELOG.md +78 -0
- package/README.md +0 -1
- package/_cjs/actions/index.js +5 -3
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/getStorageValues.js +17 -0
- package/_cjs/actions/public/getStorageValues.js.map +1 -0
- package/_cjs/actions/public/simulateBlocks.js +2 -0
- package/_cjs/actions/public/simulateBlocks.js.map +1 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js +12 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/chains/definitions/blockdag.js +23 -0
- package/_cjs/chains/definitions/blockdag.js.map +1 -0
- package/_cjs/chains/definitions/candyChain.js +29 -0
- package/_cjs/chains/definitions/candyChain.js.map +1 -0
- package/_cjs/chains/definitions/creditCoin3Devnet.js +6 -0
- package/_cjs/chains/definitions/creditCoin3Devnet.js.map +1 -1
- package/_cjs/chains/definitions/creditCoin3Mainnet.js +6 -0
- package/_cjs/chains/definitions/creditCoin3Mainnet.js.map +1 -1
- package/_cjs/chains/definitions/creditCoin3Testnet.js +6 -0
- package/_cjs/chains/definitions/creditCoin3Testnet.js.map +1 -1
- package/_cjs/chains/definitions/kortana.js +23 -0
- package/_cjs/chains/definitions/kortana.js.map +1 -0
- package/_cjs/chains/definitions/rabbitChainTestnet.js +24 -0
- package/_cjs/chains/definitions/rabbitChainTestnet.js.map +1 -0
- package/_cjs/chains/index.js +22 -14
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClientResolver.js +45 -0
- package/_cjs/clients/createClientResolver.js.map +1 -0
- package/_cjs/clients/decorators/public.js +2 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +13 -9
- package/_cjs/index.js.map +1 -1
- package/_cjs/op-stack/actions/getGame.js +1 -1
- package/_cjs/op-stack/actions/getGame.js.map +1 -1
- package/_cjs/op-stack/actions/getGames.js +1 -1
- package/_cjs/op-stack/actions/getGames.js.map +1 -1
- package/_cjs/op-stack/actions/getTimeToNextGame.js +1 -1
- package/_cjs/op-stack/actions/getTimeToNextGame.js.map +1 -1
- package/_cjs/op-stack/actions/getTimeToNextL2Output.js +1 -1
- package/_cjs/op-stack/actions/getTimeToNextL2Output.js.map +1 -1
- package/_cjs/tempo/Abis.js +1211 -32
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Client.js +2 -10
- package/_cjs/tempo/Client.js.map +1 -1
- package/_cjs/tempo/Decorator.js +12 -0
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/ExecutionError.js +290 -0
- package/_cjs/tempo/ExecutionError.js.map +1 -0
- package/_cjs/tempo/Relay.js +88 -0
- package/_cjs/tempo/Relay.js.map +1 -0
- package/_cjs/tempo/Selectors.js +7 -4
- package/_cjs/tempo/Selectors.js.map +1 -1
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/Transport.js +21 -12
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/actions/index.js +2 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/propAmm.js +349 -0
- package/_cjs/tempo/actions/propAmm.js.map +1 -0
- package/_cjs/tempo/chainConfig.js +3 -0
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +3 -3
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/relay/cache.js +74 -0
- package/_cjs/tempo/internal/relay/cache.js.map +1 -0
- package/_cjs/tempo/internal/relay/deadline.js +35 -0
- package/_cjs/tempo/internal/relay/deadline.js.map +1 -0
- package/_cjs/tempo/internal/relay/error.js +102 -0
- package/_cjs/tempo/internal/relay/error.js.map +1 -0
- package/_cjs/tempo/internal/relay/feePayer.js +426 -0
- package/_cjs/tempo/internal/relay/feePayer.js.map +1 -0
- package/_cjs/tempo/internal/relay/feeToken.js +143 -0
- package/_cjs/tempo/internal/relay/feeToken.js.map +1 -0
- package/_cjs/tempo/{Multisig.js → internal/relay/multisig.js} +132 -122
- package/_cjs/tempo/internal/relay/multisig.js.map +1 -0
- package/_cjs/tempo/internal/relay/plugin.js +13 -0
- package/_cjs/tempo/internal/relay/plugin.js.map +1 -0
- package/_cjs/tempo/internal/relay/preflight.js +58 -0
- package/_cjs/tempo/internal/relay/preflight.js.map +1 -0
- package/_cjs/tempo/internal/relay/request.js +319 -0
- package/_cjs/tempo/internal/relay/request.js.map +1 -0
- package/_cjs/tempo/internal/relay/simulate.js +267 -0
- package/_cjs/tempo/internal/relay/simulate.js.map +1 -0
- package/_cjs/tempo/internal/relay/utils.js +174 -0
- package/_cjs/tempo/internal/relay/utils.js.map +1 -0
- package/_cjs/tempo/internal/relay/virtualAddress.js +78 -0
- package/_cjs/tempo/internal/relay/virtualAddress.js.map +1 -0
- package/_cjs/tempo/internal/relay.js +139 -0
- package/_cjs/tempo/internal/relay.js.map +1 -0
- package/_cjs/tempo/multisig/Config.js +0 -2
- package/_cjs/tempo/multisig/Config.js.map +1 -1
- package/_cjs/tempo/multisig/Operation.js +1 -2
- package/_cjs/tempo/multisig/Operation.js.map +1 -1
- package/_cjs/tokens/definitions/eurc.js +1 -0
- package/_cjs/tokens/definitions/eurc.js.map +1 -1
- package/_cjs/tokens/definitions/usdc.js +1 -0
- package/_cjs/tokens/definitions/usdc.js.map +1 -1
- package/_cjs/utils/siwe/parseSiweMessage.js +3 -3
- package/_cjs/utils/siwe/parseSiweMessage.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/getStorageValues.js +39 -0
- package/_esm/actions/public/getStorageValues.js.map +1 -0
- package/_esm/actions/public/simulateBlocks.js +4 -0
- package/_esm/actions/public/simulateBlocks.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +15 -1
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/chains/definitions/blockdag.js +20 -0
- package/_esm/chains/definitions/blockdag.js.map +1 -0
- package/_esm/chains/definitions/candyChain.js +26 -0
- package/_esm/chains/definitions/candyChain.js.map +1 -0
- package/_esm/chains/definitions/creditCoin3Devnet.js +6 -0
- package/_esm/chains/definitions/creditCoin3Devnet.js.map +1 -1
- package/_esm/chains/definitions/creditCoin3Mainnet.js +6 -0
- package/_esm/chains/definitions/creditCoin3Mainnet.js.map +1 -1
- package/_esm/chains/definitions/creditCoin3Testnet.js +6 -0
- package/_esm/chains/definitions/creditCoin3Testnet.js.map +1 -1
- package/_esm/chains/definitions/kortana.js +20 -0
- package/_esm/chains/definitions/kortana.js.map +1 -0
- package/_esm/chains/definitions/rabbitChainTestnet.js +21 -0
- package/_esm/chains/definitions/rabbitChainTestnet.js.map +1 -0
- package/_esm/chains/index.js +4 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClientResolver.js +64 -0
- package/_esm/clients/createClientResolver.js.map +1 -0
- package/_esm/clients/decorators/public.js +2 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +2 -0
- package/_esm/index.js.map +1 -1
- package/_esm/op-stack/actions/getGame.js +1 -1
- package/_esm/op-stack/actions/getGame.js.map +1 -1
- package/_esm/op-stack/actions/getGames.js +1 -1
- package/_esm/op-stack/actions/getGames.js.map +1 -1
- package/_esm/op-stack/actions/getTimeToNextGame.js +2 -2
- package/_esm/op-stack/actions/getTimeToNextGame.js.map +1 -1
- package/_esm/op-stack/actions/getTimeToNextL2Output.js +2 -2
- package/_esm/op-stack/actions/getTimeToNextL2Output.js.map +1 -1
- package/_esm/tempo/Abis.js +1214 -34
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Addresses.js +2 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Client.js +8 -14
- package/_esm/tempo/Client.js.map +1 -1
- package/_esm/tempo/Decorator.js +12 -0
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/ExecutionError.js +306 -0
- package/_esm/tempo/ExecutionError.js.map +1 -0
- package/_esm/tempo/Relay.js +170 -0
- package/_esm/tempo/Relay.js.map +1 -0
- package/_esm/tempo/Selectors.js +6 -3
- package/_esm/tempo/Selectors.js.map +1 -1
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/Transport.js +21 -46
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/actions/index.js +1 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/propAmm.js +539 -0
- package/_esm/tempo/actions/propAmm.js.map +1 -0
- package/_esm/tempo/chainConfig.js +4 -0
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +8 -3
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/relay/cache.js +72 -0
- package/_esm/tempo/internal/relay/cache.js.map +1 -0
- package/_esm/tempo/internal/relay/deadline.js +34 -0
- package/_esm/tempo/internal/relay/deadline.js.map +1 -0
- package/_esm/tempo/internal/relay/error.js +101 -0
- package/_esm/tempo/internal/relay/error.js.map +1 -0
- package/_esm/tempo/internal/relay/feePayer.js +442 -0
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -0
- package/_esm/tempo/internal/relay/feeToken.js +143 -0
- package/_esm/tempo/internal/relay/feeToken.js.map +1 -0
- package/_esm/tempo/{Multisig.js → internal/relay/multisig.js} +133 -129
- package/_esm/tempo/internal/relay/multisig.js.map +1 -0
- package/_esm/tempo/internal/relay/plugin.js +10 -0
- package/_esm/tempo/internal/relay/plugin.js.map +1 -0
- package/_esm/tempo/internal/relay/preflight.js +57 -0
- package/_esm/tempo/internal/relay/preflight.js.map +1 -0
- package/_esm/tempo/internal/relay/request.js +321 -0
- package/_esm/tempo/internal/relay/request.js.map +1 -0
- package/_esm/tempo/internal/relay/simulate.js +277 -0
- package/_esm/tempo/internal/relay/simulate.js.map +1 -0
- package/_esm/tempo/internal/relay/utils.js +174 -0
- package/_esm/tempo/internal/relay/utils.js.map +1 -0
- package/_esm/tempo/internal/relay/virtualAddress.js +73 -0
- package/_esm/tempo/internal/relay/virtualAddress.js.map +1 -0
- package/_esm/tempo/internal/relay.js +138 -0
- package/_esm/tempo/internal/relay.js.map +1 -0
- package/_esm/tempo/multisig/Config.js +2 -1
- package/_esm/tempo/multisig/Config.js.map +1 -1
- package/_esm/tempo/multisig/Operation.js +1 -1
- package/_esm/tempo/multisig/Operation.js.map +1 -1
- package/_esm/tokens/definitions/eurc.js +1 -0
- package/_esm/tokens/definitions/eurc.js.map +1 -1
- package/_esm/tokens/definitions/usdc.js +1 -0
- package/_esm/tokens/definitions/usdc.js.map +1 -1
- package/_esm/utils/siwe/parseSiweMessage.js +3 -3
- package/_esm/utils/siwe/parseSiweMessage.js.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/getStorageValues.d.ts +59 -0
- package/_types/actions/public/getStorageValues.d.ts.map +1 -0
- package/_types/actions/public/simulateBlocks.d.ts +8 -0
- package/_types/actions/public/simulateBlocks.d.ts.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/chains/definitions/blockdag.d.ts +51 -0
- package/_types/chains/definitions/blockdag.d.ts.map +1 -0
- package/_types/chains/definitions/candyChain.d.ts +48 -0
- package/_types/chains/definitions/candyChain.d.ts.map +1 -0
- package/_types/chains/definitions/creditCoin3Devnet.d.ts +6 -9
- package/_types/chains/definitions/creditCoin3Devnet.d.ts.map +1 -1
- package/_types/chains/definitions/creditCoin3Mainnet.d.ts +6 -9
- package/_types/chains/definitions/creditCoin3Mainnet.d.ts.map +1 -1
- package/_types/chains/definitions/creditCoin3Testnet.d.ts +6 -9
- package/_types/chains/definitions/creditCoin3Testnet.d.ts.map +1 -1
- package/_types/chains/definitions/kortana.d.ts +51 -0
- package/_types/chains/definitions/kortana.d.ts.map +1 -0
- package/_types/chains/definitions/rabbitChainTestnet.d.ts +51 -0
- package/_types/chains/definitions/rabbitChainTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +4 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClientResolver.d.ts +76 -0
- package/_types/clients/createClientResolver.d.ts.map +1 -0
- package/_types/clients/decorators/public.d.ts +11 -0
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +3 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/actions/getGame.d.ts.map +1 -1
- package/_types/tempo/Abis.d.ts +14686 -9568
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +2 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Capabilities.d.ts +7 -28
- package/_types/tempo/Capabilities.d.ts.map +1 -1
- package/_types/tempo/Client.d.ts +6 -15
- package/_types/tempo/Client.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +205 -1
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/ExecutionError.d.ts +79 -0
- package/_types/tempo/ExecutionError.d.ts.map +1 -0
- package/_types/tempo/Relay.d.ts +302 -0
- package/_types/tempo/Relay.d.ts.map +1 -0
- package/_types/tempo/Selectors.d.ts +6 -3
- package/_types/tempo/Selectors.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +2 -1
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts +15 -29
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/actions/earn.d.ts +621 -1
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/index.d.ts +1 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/propAmm.d.ts +2228 -0
- package/_types/tempo/actions/propAmm.d.ts.map +1 -0
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +8 -3
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/relay/cache.d.ts +9 -0
- package/_types/tempo/internal/relay/cache.d.ts.map +1 -0
- package/_types/tempo/internal/relay/deadline.d.ts +4 -0
- package/_types/tempo/internal/relay/deadline.d.ts.map +1 -0
- package/_types/tempo/internal/relay/error.d.ts +47 -0
- package/_types/tempo/internal/relay/error.d.ts.map +1 -0
- package/_types/tempo/internal/relay/feePayer.d.ts +70 -0
- package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -0
- package/_types/tempo/internal/relay/feeToken.d.ts +38 -0
- package/_types/tempo/internal/relay/feeToken.d.ts.map +1 -0
- package/_types/tempo/internal/relay/multisig.d.ts +4 -0
- package/_types/tempo/internal/relay/multisig.d.ts.map +1 -0
- package/_types/tempo/internal/relay/plugin.d.ts +5 -0
- package/_types/tempo/internal/relay/plugin.d.ts.map +1 -0
- package/_types/tempo/internal/relay/preflight.d.ts +17 -0
- package/_types/tempo/internal/relay/preflight.d.ts.map +1 -0
- package/_types/tempo/internal/relay/request.d.ts +16 -0
- package/_types/tempo/internal/relay/request.d.ts.map +1 -0
- package/_types/tempo/internal/relay/simulate.d.ts +59 -0
- package/_types/tempo/internal/relay/simulate.d.ts.map +1 -0
- package/_types/tempo/internal/relay/utils.d.ts +294 -0
- package/_types/tempo/internal/relay/utils.d.ts.map +1 -0
- package/_types/tempo/internal/relay/virtualAddress.d.ts +9 -0
- package/_types/tempo/internal/relay/virtualAddress.d.ts.map +1 -0
- package/_types/tempo/internal/relay.d.ts +4 -0
- package/_types/tempo/internal/relay.d.ts.map +1 -0
- package/_types/tempo/multisig/Config.d.ts +0 -13
- package/_types/tempo/multisig/Config.d.ts.map +1 -1
- package/_types/tempo/multisig/Operation.d.ts +0 -5
- package/_types/tempo/multisig/Operation.d.ts.map +1 -1
- package/_types/tokens/definitions/eurc.d.ts +1 -0
- package/_types/tokens/definitions/eurc.d.ts.map +1 -1
- package/_types/tokens/definitions/usdc.d.ts +1 -0
- package/_types/tokens/definitions/usdc.d.ts.map +1 -1
- package/_types/tokens/sets.d.ts +3 -0
- package/_types/tokens/sets.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +20 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/utils/siwe/parseSiweMessage.d.ts.map +1 -1
- package/actions/index.ts +6 -0
- package/actions/public/getStorageValues.ts +93 -0
- package/actions/public/simulateBlocks.ts +13 -0
- package/actions/public/waitForTransactionReceipt.ts +16 -2
- package/chains/definitions/blockdag.ts +20 -0
- package/chains/definitions/candyChain.ts +26 -0
- package/chains/definitions/creditCoin3Devnet.ts +6 -0
- package/chains/definitions/creditCoin3Mainnet.ts +6 -0
- package/chains/definitions/creditCoin3Testnet.ts +6 -0
- package/chains/definitions/kortana.ts +20 -0
- package/chains/definitions/rabbitChainTestnet.ts +21 -0
- package/chains/index.ts +4 -0
- package/clients/createClientResolver.ts +191 -0
- package/clients/decorators/public.ts +18 -0
- package/errors/version.ts +1 -1
- package/index.ts +11 -0
- package/op-stack/actions/getGame.ts +3 -1
- package/op-stack/actions/getGames.ts +1 -1
- package/op-stack/actions/getTimeToNextGame.ts +2 -2
- package/op-stack/actions/getTimeToNextL2Output.ts +2 -2
- package/package.json +1 -1
- package/tempo/Abis.ts +1218 -34
- package/tempo/Addresses.ts +2 -0
- package/tempo/Capabilities.ts +7 -29
- package/tempo/Client.ts +8 -38
- package/tempo/Decorator.ts +239 -3
- package/tempo/ExecutionError.ts +418 -0
- package/tempo/Relay.ts +428 -0
- package/tempo/Selectors.ts +10 -4
- package/tempo/Transaction.ts +2 -1
- package/tempo/Transport.ts +69 -60
- package/tempo/actions/index.ts +1 -0
- package/tempo/actions/propAmm.ts +998 -0
- package/tempo/chainConfig.ts +4 -0
- package/tempo/index.ts +7 -3
- package/tempo/internal/relay/cache.ts +82 -0
- package/tempo/internal/relay/deadline.ts +45 -0
- package/tempo/internal/relay/error.ts +128 -0
- package/tempo/internal/relay/feePayer.ts +692 -0
- package/tempo/internal/relay/feeToken.ts +190 -0
- package/tempo/{Multisig.ts → internal/relay/multisig.ts} +162 -193
- package/tempo/internal/relay/plugin.ts +13 -0
- package/tempo/internal/relay/preflight.ts +81 -0
- package/tempo/internal/relay/request.ts +391 -0
- package/tempo/internal/relay/simulate.ts +367 -0
- package/tempo/internal/relay/utils.ts +202 -0
- package/tempo/internal/relay/virtualAddress.ts +95 -0
- package/tempo/internal/relay.ts +158 -0
- package/tempo/multisig/Config.ts +3 -2
- package/tempo/multisig/Operation.ts +1 -1
- package/tokens/definitions/eurc.ts +1 -0
- package/tokens/definitions/usdc.ts +1 -0
- package/types/eip1193.ts +20 -0
- package/utils/siwe/parseSiweMessage.ts +21 -13
- package/_cjs/tempo/Multisig.js.map +0 -1
- package/_esm/tempo/Multisig.js.map +0 -1
- package/_types/tempo/Multisig.d.ts +0 -37
- package/_types/tempo/Multisig.d.ts.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Address } from 'abitype'
|
|
2
|
+
|
|
3
|
+
import type { Client } from '../../clients/createClient.js'
|
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
5
|
+
import type { ErrorType } from '../../errors/utils.js'
|
|
6
|
+
import type { BlockTag } from '../../types/block.js'
|
|
7
|
+
import type { Chain } from '../../types/chain.js'
|
|
8
|
+
import type { Hash, Hex } from '../../types/misc.js'
|
|
9
|
+
import {
|
|
10
|
+
type FormatBlockParameterErrorType,
|
|
11
|
+
formatBlockParameter,
|
|
12
|
+
} from '../../utils/block/formatBlockParameter.js'
|
|
13
|
+
import type { RequestErrorType } from '../../utils/buildRequest.js'
|
|
14
|
+
|
|
15
|
+
export type GetStorageValuesParameters = {
|
|
16
|
+
/** Mapping of contract addresses to storage slot keys. */
|
|
17
|
+
requests: Record<Address, readonly Hex[]>
|
|
18
|
+
} & (
|
|
19
|
+
| {
|
|
20
|
+
blockNumber?: undefined
|
|
21
|
+
blockTag?: BlockTag | undefined
|
|
22
|
+
blockHash?: undefined
|
|
23
|
+
requireCanonical?: undefined
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
blockNumber?: bigint | undefined
|
|
27
|
+
blockTag?: undefined
|
|
28
|
+
blockHash?: undefined
|
|
29
|
+
requireCanonical?: undefined
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
blockNumber?: undefined
|
|
33
|
+
blockTag?: undefined
|
|
34
|
+
/** The storage values at a block specified by block hash. */
|
|
35
|
+
blockHash: Hash
|
|
36
|
+
/** Whether or not to throw an error if the block is not in the canonical chain. Only allowed in conjunction with `blockHash`. */
|
|
37
|
+
requireCanonical?: boolean | undefined
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
export type GetStorageValuesReturnType = Record<Address, Hex[]>
|
|
42
|
+
|
|
43
|
+
export type GetStorageValuesErrorType =
|
|
44
|
+
| FormatBlockParameterErrorType
|
|
45
|
+
| RequestErrorType
|
|
46
|
+
| ErrorType
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns values from multiple storage slots for multiple adddresses at a given block.
|
|
50
|
+
*
|
|
51
|
+
* - Docs: https://viem.sh/docs/actions/public/getStorageValues
|
|
52
|
+
* - JSON-RPC Methods: [`eth_getStorageValues`](https://github.com/ethereum/execution-apis/issues/752)
|
|
53
|
+
*
|
|
54
|
+
* @param client - Client to use
|
|
55
|
+
* @param parameters - {@link GetStorageValuesParameters}
|
|
56
|
+
* @returns The values of the requested storage slots. {@link GetStorageValuesReturnType}
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* import { createPublicClient, http, toHex } from 'viem'
|
|
60
|
+
* import { mainnet } from 'viem/chains'
|
|
61
|
+
* import { getStorageValues } from 'viem/actions'
|
|
62
|
+
*
|
|
63
|
+
* const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
64
|
+
* const values = await getStorageValues(client, {
|
|
65
|
+
* requests: {
|
|
66
|
+
* '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2': [
|
|
67
|
+
* toHex(0, { size: 32 }),
|
|
68
|
+
* toHex(1, { size: 32 }),
|
|
69
|
+
* ],
|
|
70
|
+
* },
|
|
71
|
+
* })
|
|
72
|
+
*/
|
|
73
|
+
export async function getStorageValues<chain extends Chain | undefined>(
|
|
74
|
+
client: Client<Transport, chain>,
|
|
75
|
+
{
|
|
76
|
+
blockHash,
|
|
77
|
+
blockNumber,
|
|
78
|
+
blockTag = 'latest',
|
|
79
|
+
requireCanonical,
|
|
80
|
+
requests,
|
|
81
|
+
}: GetStorageValuesParameters,
|
|
82
|
+
): Promise<GetStorageValuesReturnType> {
|
|
83
|
+
const block = formatBlockParameter({
|
|
84
|
+
blockHash,
|
|
85
|
+
blockNumber,
|
|
86
|
+
blockTag,
|
|
87
|
+
requireCanonical,
|
|
88
|
+
})
|
|
89
|
+
return client.request({
|
|
90
|
+
method: 'eth_getStorageValues',
|
|
91
|
+
params: [requests, block],
|
|
92
|
+
})
|
|
93
|
+
}
|
|
@@ -115,6 +115,14 @@ export type SimulateBlocksReturnType<
|
|
|
115
115
|
data: Hex
|
|
116
116
|
gasUsed: bigint
|
|
117
117
|
logs?: Log[] | undefined
|
|
118
|
+
/**
|
|
119
|
+
* Gas used by the call as measured by the node before gas refunds are
|
|
120
|
+
* applied. `undefined` when the node does not report it.
|
|
121
|
+
*
|
|
122
|
+
* Note: this is a measurement of gas usage, not a guaranteed minimum
|
|
123
|
+
* sufficient gas limit for the call.
|
|
124
|
+
*/
|
|
125
|
+
maxUsedGas?: bigint | undefined
|
|
118
126
|
}
|
|
119
127
|
error: Error
|
|
120
128
|
mutability: AbiStateMutability
|
|
@@ -247,6 +255,8 @@ export async function simulateBlocks<
|
|
|
247
255
|
|
|
248
256
|
const data = call.error?.data ?? call.returnData
|
|
249
257
|
const gasUsed = BigInt(call.gasUsed)
|
|
258
|
+
const maxUsedGas =
|
|
259
|
+
call.maxUsedGas === undefined ? undefined : BigInt(call.maxUsedGas)
|
|
250
260
|
const logs = call.logs?.map((log) => formatLog(log))
|
|
251
261
|
const status = call.status === '0x1' ? 'success' : 'failure'
|
|
252
262
|
|
|
@@ -279,6 +289,9 @@ export async function simulateBlocks<
|
|
|
279
289
|
data,
|
|
280
290
|
gasUsed,
|
|
281
291
|
logs,
|
|
292
|
+
// only present when reported by the node, so existing consumers
|
|
293
|
+
// (and snapshots) are unaffected on nodes that omit it.
|
|
294
|
+
...(maxUsedGas === undefined ? {} : { maxUsedGas }),
|
|
282
295
|
status,
|
|
283
296
|
...(status === 'success'
|
|
284
297
|
? {
|
|
@@ -153,8 +153,6 @@ export async function waitForTransactionReceipt<
|
|
|
153
153
|
timeout = 180_000,
|
|
154
154
|
} = parameters
|
|
155
155
|
|
|
156
|
-
const observerId = stringify(['waitForTransactionReceipt', client.uid, hash])
|
|
157
|
-
|
|
158
156
|
const pollingInterval = (() => {
|
|
159
157
|
if (parameters.pollingInterval) return parameters.pollingInterval
|
|
160
158
|
if (client.chain?.experimental_preconfirmationTime)
|
|
@@ -162,6 +160,22 @@ export async function waitForTransactionReceipt<
|
|
|
162
160
|
return client.pollingInterval
|
|
163
161
|
})()
|
|
164
162
|
|
|
163
|
+
const observerId = stringify([
|
|
164
|
+
'waitForTransactionReceipt',
|
|
165
|
+
client.uid,
|
|
166
|
+
hash,
|
|
167
|
+
// Concurrent calls with different behavior-defining options must not
|
|
168
|
+
// share an observer: the first call's polling closure decides timeout,
|
|
169
|
+
// confirmations, polling interval and replacement checks for everyone.
|
|
170
|
+
{
|
|
171
|
+
checkReplacement,
|
|
172
|
+
confirmations,
|
|
173
|
+
pollingInterval,
|
|
174
|
+
retryCount,
|
|
175
|
+
timeout,
|
|
176
|
+
},
|
|
177
|
+
])
|
|
178
|
+
|
|
165
179
|
let transaction: GetTransactionReturnType<chain> | undefined
|
|
166
180
|
let replacedTransaction: GetTransactionReturnType<chain> | undefined
|
|
167
181
|
let receipt: GetTransactionReceiptReturnType<chain> | undefined
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const blockdag = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 1404,
|
|
5
|
+
name: 'BlockDAG',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'BlockDAG',
|
|
9
|
+
symbol: 'BDAG',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ['https://rpc.bdagexplorer.com/'] },
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'BDAG Explorer',
|
|
17
|
+
url: 'https://explorer.bdagexplorer.com',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const candyChain = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 2828,
|
|
5
|
+
name: 'CandyChain',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'CANDY',
|
|
9
|
+
symbol: 'CANDY',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ['https://publicrpc.candychain.io'] },
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'CandyChain Explorer',
|
|
17
|
+
url: 'https://streams.candychain.io',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
contracts: {
|
|
21
|
+
multicall3: {
|
|
22
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
|
23
|
+
blockCreated: 2039339,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
})
|
|
@@ -17,5 +17,11 @@ export const creditCoin3Devnet = /*#__PURE__*/ defineChain({
|
|
|
17
17
|
apiUrl: 'https://creditcoin3-dev.subscan.io',
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
+
contracts: {
|
|
21
|
+
multicall3: {
|
|
22
|
+
address: '0x47b51dC7b7Bbb3d9eB12080e3DA6E26125e8D75e',
|
|
23
|
+
blockCreated: 16_352_786,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
20
26
|
testnet: true,
|
|
21
27
|
})
|
|
@@ -17,5 +17,11 @@ export const creditCoin3Mainnet = /*#__PURE__*/ defineChain({
|
|
|
17
17
|
apiUrl: 'https://creditcoin.blockscout.com/api',
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
+
contracts: {
|
|
21
|
+
multicall3: {
|
|
22
|
+
address: '0x47b51dC7b7Bbb3d9eB12080e3DA6E26125e8D75e',
|
|
23
|
+
blockCreated: 4_373_631,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
20
26
|
testnet: false,
|
|
21
27
|
})
|
|
@@ -17,5 +17,11 @@ export const creditCoin3Testnet = /*#__PURE__*/ defineChain({
|
|
|
17
17
|
apiUrl: 'https://creditcoin-testnet.blockscout.com/api',
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
+
contracts: {
|
|
21
|
+
multicall3: {
|
|
22
|
+
address: '0x47b51dC7b7Bbb3d9eB12080e3DA6E26125e8D75e',
|
|
23
|
+
blockCreated: 5_566_188,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
20
26
|
testnet: true,
|
|
21
27
|
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const kortana = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 9002,
|
|
5
|
+
name: 'Kortana',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'Dinar',
|
|
9
|
+
symbol: 'DNR',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ['https://zeus-rpc.mainnet.kortana.xyz'] },
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'Kortana Explorer',
|
|
17
|
+
url: 'https://explorer.mainnet.kortana.xyz',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const rabbitChainTestnet = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 9280,
|
|
5
|
+
name: 'Rabbit Chain Testnet',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'Test Rabbit',
|
|
9
|
+
symbol: 'tRAB',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ['https://rpc-testnet.rabbitchain.org'] },
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'Rabbit Chain Testnet Explorer',
|
|
17
|
+
url: 'https://explorer-testnet.rabbitchain.org',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
testnet: true,
|
|
21
|
+
})
|
package/chains/index.ts
CHANGED
|
@@ -86,6 +86,7 @@ export { bitTorrent } from './definitions/bitTorrent.js'
|
|
|
86
86
|
export { bitTorrentTestnet } from './definitions/bitTorrentTestnet.js'
|
|
87
87
|
export { blast } from './definitions/blast.js'
|
|
88
88
|
export { blastSepolia } from './definitions/blastSepolia.js'
|
|
89
|
+
export { blockdag } from './definitions/blockdag.js'
|
|
89
90
|
export { bob } from './definitions/bob.js'
|
|
90
91
|
export { boba } from './definitions/boba.js'
|
|
91
92
|
export { bobaSepolia } from './definitions/bobaSepolia.js'
|
|
@@ -106,6 +107,7 @@ export { btr } from './definitions/btr.js'
|
|
|
106
107
|
export { btrTestnet } from './definitions/btrTestnet.js'
|
|
107
108
|
export { bxn } from './definitions/bxn.js'
|
|
108
109
|
export { bxnTestnet } from './definitions/bxnTestnet.js'
|
|
110
|
+
export { candyChain } from './definitions/candyChain.js'
|
|
109
111
|
export { cannon } from './definitions/cannon.js'
|
|
110
112
|
export { canto } from './definitions/canto.js'
|
|
111
113
|
export { celo } from './definitions/celo.js'
|
|
@@ -353,6 +355,7 @@ export { klaytn } from './definitions/klaytn.js'
|
|
|
353
355
|
/** @deprecated Use `kairos` instead. */
|
|
354
356
|
export { klaytnBaobab } from './definitions/klaytnBaobab.js'
|
|
355
357
|
export { koi } from './definitions/koi.js'
|
|
358
|
+
export { kortana } from './definitions/kortana.js'
|
|
356
359
|
export { kroma } from './definitions/kroma.js'
|
|
357
360
|
export { kromaSepolia } from './definitions/kromaSepolia.js'
|
|
358
361
|
export { krown } from './definitions/krown.js'
|
|
@@ -517,6 +520,7 @@ export { qMainnet } from './definitions/qMainnet.js'
|
|
|
517
520
|
export { qTestnet } from './definitions/qTestnet.js'
|
|
518
521
|
export { quai } from './definitions/quai.js'
|
|
519
522
|
export { quaiTestnet } from './definitions/quaiTestnet.js'
|
|
523
|
+
export { rabbitChainTestnet } from './definitions/rabbitChainTestnet.js'
|
|
520
524
|
export { radius } from './definitions/radius.js'
|
|
521
525
|
export { radiusTestnet } from './definitions/radiusTestnet.js'
|
|
522
526
|
export { reactiveTestnet } from './definitions/reactiveTestnet.js'
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { Address } from 'abitype'
|
|
2
|
+
|
|
3
|
+
import type { JsonRpcAccount } from '../accounts/types.js'
|
|
4
|
+
import { BaseError } from '../errors/base.js'
|
|
5
|
+
import type { Tokens } from '../tokens/defineToken.js'
|
|
6
|
+
import type { Account } from '../types/account.js'
|
|
7
|
+
import type { Chain } from '../types/chain.js'
|
|
8
|
+
import type { RpcSchema } from '../types/eip1193.js'
|
|
9
|
+
import type { Prettify } from '../types/utils.js'
|
|
10
|
+
import {
|
|
11
|
+
type Client,
|
|
12
|
+
type ClientConfig,
|
|
13
|
+
type CreateClientErrorType,
|
|
14
|
+
createClient,
|
|
15
|
+
} from './createClient.js'
|
|
16
|
+
import type { Transport } from './transports/createTransport.js'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a resolver that lazily constructs and caches a Client for each configured chain.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { createClientResolver, http } from 'viem'
|
|
24
|
+
* import { mainnet, optimism } from 'viem/chains'
|
|
25
|
+
*
|
|
26
|
+
* const resolver = createClientResolver({
|
|
27
|
+
* chains: [mainnet, optimism],
|
|
28
|
+
* transport: {
|
|
29
|
+
* [mainnet.id]: http(),
|
|
30
|
+
* [optimism.id]: http(),
|
|
31
|
+
* },
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* const client = resolver.getClient({ chainId: optimism.id })
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param options - Resolver options, including shared Client configuration.
|
|
38
|
+
* @returns A resolver for the configured chains.
|
|
39
|
+
*/
|
|
40
|
+
export function createClientResolver<
|
|
41
|
+
const chains extends Chains,
|
|
42
|
+
accountOrAddress extends Account | Address | undefined = undefined,
|
|
43
|
+
const transport extends TransportConfig<NoInfer<chains>> = TransportConfig<
|
|
44
|
+
NoInfer<chains>
|
|
45
|
+
>,
|
|
46
|
+
const tokens extends Tokens | undefined = undefined,
|
|
47
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
|
48
|
+
>(
|
|
49
|
+
options: createClientResolver.Options<
|
|
50
|
+
chains,
|
|
51
|
+
accountOrAddress,
|
|
52
|
+
transport,
|
|
53
|
+
tokens,
|
|
54
|
+
rpcSchema
|
|
55
|
+
>,
|
|
56
|
+
): createClientResolver.ReturnType<
|
|
57
|
+
chains,
|
|
58
|
+
accountOrAddress,
|
|
59
|
+
transport,
|
|
60
|
+
tokens,
|
|
61
|
+
rpcSchema
|
|
62
|
+
> {
|
|
63
|
+
const { chains, transport, ...rest } = options
|
|
64
|
+
const clients = new Map<number, unknown>()
|
|
65
|
+
|
|
66
|
+
// The chain and transport are selected from the same chain ID.
|
|
67
|
+
return {
|
|
68
|
+
getClient({ chainId }) {
|
|
69
|
+
const cached = clients.get(chainId)
|
|
70
|
+
if (cached) return cached
|
|
71
|
+
|
|
72
|
+
const chain = chains.find((chain) => chain.id === chainId)
|
|
73
|
+
if (!chain) throw new ChainNotConfiguredError({ chainId })
|
|
74
|
+
const transport_ =
|
|
75
|
+
typeof transport === 'function'
|
|
76
|
+
? transport({ chainId })
|
|
77
|
+
: (transport as TransportMap<chains>)[chainId]
|
|
78
|
+
if (!transport_) throw new TransportNotConfiguredError({ chainId })
|
|
79
|
+
const client = createClient({ ...rest, chain, transport: transport_ })
|
|
80
|
+
clients.set(chainId, client)
|
|
81
|
+
return client
|
|
82
|
+
},
|
|
83
|
+
} as createClientResolver.ReturnType<
|
|
84
|
+
chains,
|
|
85
|
+
accountOrAddress,
|
|
86
|
+
transport,
|
|
87
|
+
tokens,
|
|
88
|
+
rpcSchema
|
|
89
|
+
>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare namespace createClientResolver {
|
|
93
|
+
/** Errors thrown while resolving a Client. */
|
|
94
|
+
type ErrorType =
|
|
95
|
+
| ChainNotConfiguredError
|
|
96
|
+
| CreateClientErrorType
|
|
97
|
+
| TransportNotConfiguredError
|
|
98
|
+
|
|
99
|
+
/** Options for {@link createClientResolver}. */
|
|
100
|
+
type Options<
|
|
101
|
+
chains extends Chains = Chains,
|
|
102
|
+
accountOrAddress extends Account | Address | undefined =
|
|
103
|
+
| Account
|
|
104
|
+
| Address
|
|
105
|
+
| undefined,
|
|
106
|
+
transport extends TransportConfig<chains> = TransportConfig<chains>,
|
|
107
|
+
tokens extends Tokens | undefined = Tokens | undefined,
|
|
108
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
|
109
|
+
> = Prettify<
|
|
110
|
+
Omit<
|
|
111
|
+
ClientConfig<Transport, undefined, accountOrAddress, rpcSchema, tokens>,
|
|
112
|
+
'chain' | 'transport'
|
|
113
|
+
> & {
|
|
114
|
+
/** Chains available to the resolver. Must contain at least one chain. */
|
|
115
|
+
chains: chains
|
|
116
|
+
/** Transports indexed or resolved by chain ID. */
|
|
117
|
+
transport: transport
|
|
118
|
+
}
|
|
119
|
+
>
|
|
120
|
+
|
|
121
|
+
/** Return type of {@link createClientResolver}. */
|
|
122
|
+
type ReturnType<
|
|
123
|
+
chains extends Chains = Chains,
|
|
124
|
+
accountOrAddress extends Account | Address | undefined =
|
|
125
|
+
| Account
|
|
126
|
+
| Address
|
|
127
|
+
| undefined,
|
|
128
|
+
transport extends TransportConfig<chains> = TransportConfig<chains>,
|
|
129
|
+
tokens extends Tokens | undefined = Tokens | undefined,
|
|
130
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
|
131
|
+
> = {
|
|
132
|
+
/** Returns the cached Client configured for `chainId`, creating it on first use. */
|
|
133
|
+
getClient<const chainId extends chains[number]['id']>(options: {
|
|
134
|
+
/** ID of a configured chain. */
|
|
135
|
+
chainId: chainId
|
|
136
|
+
}): Client<
|
|
137
|
+
ResolvedTransport<chains, transport, chainId>,
|
|
138
|
+
number extends chains[number]['id']
|
|
139
|
+
? chains[number]
|
|
140
|
+
: Extract<chains[number], { id: chainId }>,
|
|
141
|
+
accountOrAddress extends Address
|
|
142
|
+
? Prettify<JsonRpcAccount<accountOrAddress>>
|
|
143
|
+
: accountOrAddress,
|
|
144
|
+
rpcSchema,
|
|
145
|
+
undefined,
|
|
146
|
+
tokens
|
|
147
|
+
>
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
type Chains = readonly [Chain, ...Chain[]]
|
|
152
|
+
|
|
153
|
+
type TransportConfig<chains extends Chains> =
|
|
154
|
+
| TransportMap<chains>
|
|
155
|
+
| ((options: { chainId: chains[number]['id'] }) => Transport)
|
|
156
|
+
|
|
157
|
+
type TransportMap<chains extends Chains> = {
|
|
158
|
+
readonly [chainId in chains[number]['id']]: Transport
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
type ResolvedTransport<
|
|
162
|
+
chains extends Chains,
|
|
163
|
+
transport extends TransportConfig<chains>,
|
|
164
|
+
chainId extends chains[number]['id'],
|
|
165
|
+
> = transport extends (...args: never[]) => infer resolved
|
|
166
|
+
? resolved extends Transport
|
|
167
|
+
? resolved
|
|
168
|
+
: never
|
|
169
|
+
: transport extends Record<chainId, infer resolved>
|
|
170
|
+
? resolved extends Transport
|
|
171
|
+
? resolved
|
|
172
|
+
: never
|
|
173
|
+
: never
|
|
174
|
+
|
|
175
|
+
/** Thrown when a Client is requested for an unconfigured chain. */
|
|
176
|
+
export class ChainNotConfiguredError extends BaseError {
|
|
177
|
+
constructor({ chainId }: { chainId: number }) {
|
|
178
|
+
super(`Chain with id ${chainId} is not configured.`, {
|
|
179
|
+
name: 'createClientResolver.ChainNotConfiguredError',
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Thrown when a configured chain has no transport. */
|
|
185
|
+
export class TransportNotConfiguredError extends BaseError {
|
|
186
|
+
constructor({ chainId }: { chainId: number }) {
|
|
187
|
+
super(`Transport for chain with id ${chainId} is not configured.`, {
|
|
188
|
+
name: 'createClientResolver.TransportNotConfiguredError',
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -170,6 +170,11 @@ import {
|
|
|
170
170
|
type GetStorageAtReturnType,
|
|
171
171
|
getStorageAt,
|
|
172
172
|
} from '../../actions/public/getStorageAt.js'
|
|
173
|
+
import {
|
|
174
|
+
type GetStorageValuesParameters,
|
|
175
|
+
type GetStorageValuesReturnType,
|
|
176
|
+
getStorageValues,
|
|
177
|
+
} from '../../actions/public/getStorageValues.js'
|
|
173
178
|
import {
|
|
174
179
|
type GetTransactionParameters,
|
|
175
180
|
type GetTransactionReturnType,
|
|
@@ -1413,6 +1418,18 @@ export type PublicActions<
|
|
|
1413
1418
|
getStorageAt: (
|
|
1414
1419
|
args: GetStorageAtParameters,
|
|
1415
1420
|
) => Promise<GetStorageAtReturnType>
|
|
1421
|
+
/**
|
|
1422
|
+
* Returns values from multiple storage slots at a given address and block.
|
|
1423
|
+
*
|
|
1424
|
+
* - Docs: https://viem.sh/docs/actions/public/getStorageValues
|
|
1425
|
+
* - JSON-RPC Methods: [`eth_getStorageValues`](https://github.com/ethereum/execution-apis/issues/752)
|
|
1426
|
+
*
|
|
1427
|
+
* @param args - {@link GetStorageValuesParameters}
|
|
1428
|
+
* @returns The values of the requested storage slots. {@link GetStorageValuesReturnType}
|
|
1429
|
+
*/
|
|
1430
|
+
getStorageValues: (
|
|
1431
|
+
args: GetStorageValuesParameters,
|
|
1432
|
+
) => Promise<GetStorageValuesReturnType>
|
|
1416
1433
|
/**
|
|
1417
1434
|
* Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
|
|
1418
1435
|
*
|
|
@@ -2347,6 +2364,7 @@ export function publicActions<
|
|
|
2347
2364
|
fillTransaction: (args) => fillTransaction(client, args),
|
|
2348
2365
|
getRawTransaction: (args) => getRawTransaction(client, args),
|
|
2349
2366
|
getStorageAt: (args) => getStorageAt(client, args),
|
|
2367
|
+
getStorageValues: (args) => getStorageValues(client, args),
|
|
2350
2368
|
getTransaction: (args) => getTransaction(client, args),
|
|
2351
2369
|
getTransactionConfirmations: (args) =>
|
|
2352
2370
|
getTransactionConfirmations(client, args),
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.57.0'
|
package/index.ts
CHANGED
|
@@ -247,6 +247,11 @@ export type {
|
|
|
247
247
|
GetStorageAtParameters,
|
|
248
248
|
GetStorageAtReturnType,
|
|
249
249
|
} from './actions/public/getStorageAt.js'
|
|
250
|
+
export type {
|
|
251
|
+
GetStorageValuesErrorType,
|
|
252
|
+
GetStorageValuesParameters,
|
|
253
|
+
GetStorageValuesReturnType,
|
|
254
|
+
} from './actions/public/getStorageValues.js'
|
|
250
255
|
export type {
|
|
251
256
|
GetTransactionErrorType,
|
|
252
257
|
GetTransactionParameters,
|
|
@@ -604,6 +609,12 @@ export {
|
|
|
604
609
|
type MulticallBatchOptions,
|
|
605
610
|
rpcSchema,
|
|
606
611
|
} from './clients/createClient.js'
|
|
612
|
+
/** Lazily resolves and caches typed Clients across configured chains. */
|
|
613
|
+
export {
|
|
614
|
+
ChainNotConfiguredError,
|
|
615
|
+
createClientResolver,
|
|
616
|
+
TransportNotConfiguredError,
|
|
617
|
+
} from './clients/createClientResolver.js'
|
|
607
618
|
export {
|
|
608
619
|
type CreatePublicClientErrorType,
|
|
609
620
|
createPublicClient,
|
|
@@ -93,7 +93,9 @@ export async function getGame<
|
|
|
93
93
|
|
|
94
94
|
const latestGames = await getGames(client, parameters)
|
|
95
95
|
|
|
96
|
-
const games = latestGames.filter(
|
|
96
|
+
const games = latestGames.filter(
|
|
97
|
+
(game) => game.l2BlockNumber >= l2BlockNumber,
|
|
98
|
+
)
|
|
97
99
|
|
|
98
100
|
const game = (() => {
|
|
99
101
|
if (strategy === 'random')
|
|
@@ -145,7 +145,7 @@ export async function getGames<
|
|
|
145
145
|
const games = rawGames
|
|
146
146
|
.map((game, i) => {
|
|
147
147
|
const blockNumber = l2SequenceNumbers[i] as bigint
|
|
148
|
-
return !l2BlockNumber || blockNumber
|
|
148
|
+
return !l2BlockNumber || blockNumber >= l2BlockNumber
|
|
149
149
|
? { ...game, l2BlockNumber: blockNumber, usesSuperRoots }
|
|
150
150
|
: null
|
|
151
151
|
})
|
|
@@ -133,9 +133,9 @@ export async function getTimeToNextGame<
|
|
|
133
133
|
// then we assume that the dispute game has already been submitted.
|
|
134
134
|
if (now < latestGameTimestamp) return 0
|
|
135
135
|
|
|
136
|
-
// If the latest dispute game
|
|
136
|
+
// If the latest dispute game covers the provided block number,
|
|
137
137
|
// then we assume that the dispute game has already been submitted.
|
|
138
|
-
if (latestGame.l2BlockNumber
|
|
138
|
+
if (latestGame.l2BlockNumber >= l2BlockNumber) return 0
|
|
139
139
|
|
|
140
140
|
// If there is only a single game, no interval data
|
|
141
141
|
if (intervalWithBuffer === 0) return 0
|
|
@@ -141,9 +141,9 @@ export async function getTimeToNextL2Output<
|
|
|
141
141
|
// then we assume that the L2 output has already been submitted.
|
|
142
142
|
if (now < latestOutputTimestamp) return 0
|
|
143
143
|
|
|
144
|
-
// If the latest L2 output
|
|
144
|
+
// If the latest L2 output covers the provided L2 block number,
|
|
145
145
|
// then we assume that the L2 output has already been submitted.
|
|
146
|
-
if (latestOutput.l2BlockNumber
|
|
146
|
+
if (latestOutput.l2BlockNumber >= l2BlockNumber) return 0
|
|
147
147
|
|
|
148
148
|
const elapsedBlocks = Number(l2BlockNumber - latestOutput.l2BlockNumber)
|
|
149
149
|
|