viem 2.7.15 → 2.7.18
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 +30 -0
- package/_cjs/chains/definitions/ancient8.js +46 -0
- package/_cjs/chains/definitions/ancient8.js.map +1 -0
- package/_cjs/chains/definitions/ancient8Sepolia.js +46 -0
- package/_cjs/chains/definitions/ancient8Sepolia.js.map +1 -0
- package/_cjs/chains/definitions/apexTestnet.js +29 -0
- package/_cjs/chains/definitions/apexTestnet.js.map +1 -0
- package/_cjs/chains/definitions/auroria.js +27 -0
- package/_cjs/chains/definitions/auroria.js.map +1 -0
- package/_cjs/chains/definitions/avalancheFuji.js +3 -3
- package/_cjs/chains/definitions/avalancheFuji.js.map +1 -1
- package/_cjs/chains/definitions/blast.js +28 -0
- package/_cjs/chains/definitions/blast.js.map +1 -0
- package/_cjs/chains/definitions/bscGreenfield.js +24 -0
- package/_cjs/chains/definitions/bscGreenfield.js.map +1 -0
- package/_cjs/chains/definitions/fraxtal.js +49 -0
- package/_cjs/chains/definitions/fraxtal.js.map +1 -0
- package/_cjs/chains/definitions/fraxtalTestnet.js +49 -0
- package/_cjs/chains/definitions/fraxtalTestnet.js.map +1 -0
- package/_cjs/chains/definitions/liskSepolia.js +49 -0
- package/_cjs/chains/definitions/liskSepolia.js.map +1 -0
- package/_cjs/chains/definitions/merlin.js +24 -0
- package/_cjs/chains/definitions/merlin.js.map +1 -0
- package/_cjs/chains/index.js +25 -5
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/chains/opStack/actions/getL1BaseFee.js +27 -0
- package/_cjs/chains/opStack/actions/getL1BaseFee.js.map +1 -0
- package/_cjs/chains/opStack/chains.js +9 -1
- package/_cjs/chains/opStack/chains.js.map +1 -1
- package/_cjs/chains/opStack/decorators/publicL2.js +2 -0
- package/_cjs/chains/opStack/decorators/publicL2.js.map +1 -1
- package/_cjs/chains/opStack/index.js +3 -1
- package/_cjs/chains/opStack/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
- package/_cjs/utils/address/isAddress.js +5 -5
- package/_cjs/utils/address/isAddress.js.map +1 -1
- package/_esm/chains/definitions/ancient8.js +43 -0
- package/_esm/chains/definitions/ancient8.js.map +1 -0
- package/_esm/chains/definitions/ancient8Sepolia.js +43 -0
- package/_esm/chains/definitions/ancient8Sepolia.js.map +1 -0
- package/_esm/chains/definitions/apexTestnet.js +26 -0
- package/_esm/chains/definitions/apexTestnet.js.map +1 -0
- package/_esm/chains/definitions/auroria.js +24 -0
- package/_esm/chains/definitions/auroria.js.map +1 -0
- package/_esm/chains/definitions/avalancheFuji.js +3 -3
- package/_esm/chains/definitions/avalancheFuji.js.map +1 -1
- package/_esm/chains/definitions/blast.js +25 -0
- package/_esm/chains/definitions/blast.js.map +1 -0
- package/_esm/chains/definitions/bscGreenfield.js +21 -0
- package/_esm/chains/definitions/bscGreenfield.js.map +1 -0
- package/_esm/chains/definitions/fraxtal.js +46 -0
- package/_esm/chains/definitions/fraxtal.js.map +1 -0
- package/_esm/chains/definitions/fraxtalTestnet.js +46 -0
- package/_esm/chains/definitions/fraxtalTestnet.js.map +1 -0
- package/_esm/chains/definitions/liskSepolia.js +46 -0
- package/_esm/chains/definitions/liskSepolia.js.map +1 -0
- package/_esm/chains/definitions/merlin.js +21 -0
- package/_esm/chains/definitions/merlin.js.map +1 -0
- package/_esm/chains/index.js +10 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/chains/opStack/actions/getL1BaseFee.js +44 -0
- package/_esm/chains/opStack/actions/getL1BaseFee.js.map +1 -0
- package/_esm/chains/opStack/chains.js +4 -0
- package/_esm/chains/opStack/chains.js.map +1 -1
- package/_esm/chains/opStack/decorators/publicL2.js +2 -0
- package/_esm/chains/opStack/decorators/publicL2.js.map +1 -1
- package/_esm/chains/opStack/index.js +1 -0
- package/_esm/chains/opStack/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/utils/abi/encodeAbiParameters.js +32 -0
- package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
- package/_esm/utils/address/isAddress.js +1 -1
- package/_esm/utils/address/isAddress.js.map +1 -1
- package/_types/chains/definitions/ancient8.d.ts +813 -0
- package/_types/chains/definitions/ancient8.d.ts.map +1 -0
- package/_types/chains/definitions/ancient8Sepolia.d.ts +813 -0
- package/_types/chains/definitions/ancient8Sepolia.d.ts.map +1 -0
- package/_types/chains/definitions/apexTestnet.d.ts +34 -0
- package/_types/chains/definitions/apexTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/auroria.d.ts +36 -0
- package/_types/chains/definitions/auroria.d.ts.map +1 -0
- package/_types/chains/definitions/avalancheFuji.d.ts +3 -3
- package/_types/chains/definitions/blast.d.ts +33 -0
- package/_types/chains/definitions/blast.d.ts.map +1 -0
- package/_types/chains/definitions/bscGreenfield.d.ts +35 -0
- package/_types/chains/definitions/bscGreenfield.d.ts.map +1 -0
- package/_types/chains/definitions/fraxtal.d.ts +816 -0
- package/_types/chains/definitions/fraxtal.d.ts.map +1 -0
- package/_types/chains/definitions/fraxtalTestnet.d.ts +816 -0
- package/_types/chains/definitions/fraxtalTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/liskSepolia.d.ts +815 -0
- package/_types/chains/definitions/liskSepolia.d.ts.map +1 -0
- package/_types/chains/definitions/merlin.d.ts +36 -0
- package/_types/chains/definitions/merlin.d.ts.map +1 -0
- package/_types/chains/index.d.ts +10 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/chains/opStack/actions/getL1BaseFee.d.ts +35 -0
- package/_types/chains/opStack/actions/getL1BaseFee.d.ts.map +1 -0
- package/_types/chains/opStack/chains.d.ts +4 -0
- package/_types/chains/opStack/chains.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/publicL2.d.ts +21 -0
- package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -1
- package/_types/chains/opStack/index.d.ts +1 -0
- package/_types/chains/opStack/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/utils/abi/encodeAbiParameters.d.ts +32 -0
- package/_types/utils/abi/encodeAbiParameters.d.ts.map +1 -1
- package/_types/utils/address/isAddress.d.ts +2 -0
- package/_types/utils/address/isAddress.d.ts.map +1 -1
- package/chains/definitions/ancient8.ts +44 -0
- package/chains/definitions/ancient8Sepolia.ts +44 -0
- package/chains/definitions/apexTestnet.ts +26 -0
- package/chains/definitions/auroria.ts +24 -0
- package/chains/definitions/avalancheFuji.ts +3 -3
- package/chains/definitions/blast.ts +26 -0
- package/chains/definitions/bscGreenfield.ts +21 -0
- package/chains/definitions/fraxtal.ts +47 -0
- package/chains/definitions/fraxtalTestnet.ts +47 -0
- package/chains/definitions/liskSepolia.ts +47 -0
- package/chains/definitions/merlin.ts +21 -0
- package/chains/index.ts +10 -0
- package/chains/opStack/actions/getL1BaseFee.ts +81 -0
- package/chains/opStack/chains.ts +4 -0
- package/chains/opStack/decorators/publicL2.ts +29 -0
- package/chains/opStack/index.ts +6 -0
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/utils/abi/encodeAbiParameters.ts +32 -0
- package/utils/address/isAddress.ts +1 -1
@@ -0,0 +1,47 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
import { chainConfig } from '../opStack/chainConfig.js'
|
3
|
+
|
4
|
+
const sourceId = 17000 // holesky
|
5
|
+
|
6
|
+
export const fraxtalTestnet = /*#__PURE__*/ defineChain({
|
7
|
+
...chainConfig,
|
8
|
+
id: 2522,
|
9
|
+
name: 'Fraxtal Testnet',
|
10
|
+
nativeCurrency: { name: 'Frax Ether', symbol: 'frxETH', decimals: 18 },
|
11
|
+
rpcUrls: {
|
12
|
+
default: {
|
13
|
+
http: ['https://rpc.testnet.frax.com'],
|
14
|
+
},
|
15
|
+
},
|
16
|
+
blockExplorers: {
|
17
|
+
default: {
|
18
|
+
name: 'fraxscan testnet',
|
19
|
+
url: 'https://holesky.fraxscan.com',
|
20
|
+
apiUrl: 'https://api-holesky.fraxscan.com/api',
|
21
|
+
},
|
22
|
+
},
|
23
|
+
contracts: {
|
24
|
+
...chainConfig.contracts,
|
25
|
+
l2OutputOracle: {
|
26
|
+
[sourceId]: {
|
27
|
+
address: '0x715EA64DA13F4d0831ece4Ad3E8c1aa013167F32',
|
28
|
+
},
|
29
|
+
},
|
30
|
+
multicall3: {
|
31
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
32
|
+
},
|
33
|
+
portal: {
|
34
|
+
[sourceId]: {
|
35
|
+
address: '0xB9c64BfA498d5b9a8398Ed6f46eb76d90dE5505d',
|
36
|
+
blockCreated: 318416,
|
37
|
+
},
|
38
|
+
},
|
39
|
+
l1StandardBridge: {
|
40
|
+
[sourceId]: {
|
41
|
+
address: '0x0BaafC217162f64930909aD9f2B27125121d6332',
|
42
|
+
blockCreated: 318416,
|
43
|
+
},
|
44
|
+
},
|
45
|
+
},
|
46
|
+
sourceId,
|
47
|
+
})
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
import { chainConfig } from '../opStack/chainConfig.js'
|
3
|
+
|
4
|
+
const sourceId = 11_155_111 // sepolia
|
5
|
+
|
6
|
+
export const liskSepolia = /*#__PURE__*/ defineChain({
|
7
|
+
...chainConfig,
|
8
|
+
id: 4202,
|
9
|
+
network: 'lisk-sepolia',
|
10
|
+
name: 'Lisk Sepolia',
|
11
|
+
nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
|
12
|
+
rpcUrls: {
|
13
|
+
default: {
|
14
|
+
http: ['https://rpc.sepolia-api.lisk.com'],
|
15
|
+
},
|
16
|
+
},
|
17
|
+
blockExplorers: {
|
18
|
+
default: {
|
19
|
+
name: 'Blockscout',
|
20
|
+
url: 'https://sepolia-blockscout.lisk.com',
|
21
|
+
apiUrl: 'https://sepolia-blockscout.lisk.com/api',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
contracts: {
|
25
|
+
...chainConfig.contracts,
|
26
|
+
l2OutputOracle: {
|
27
|
+
[sourceId]: {
|
28
|
+
address: '0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348',
|
29
|
+
},
|
30
|
+
},
|
31
|
+
multicall3: {
|
32
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
33
|
+
},
|
34
|
+
portal: {
|
35
|
+
[sourceId]: {
|
36
|
+
address: '0xe3d90F21490686Ec7eF37BE788E02dfC12787264',
|
37
|
+
},
|
38
|
+
},
|
39
|
+
l1StandardBridge: {
|
40
|
+
[sourceId]: {
|
41
|
+
address: '0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5',
|
42
|
+
},
|
43
|
+
},
|
44
|
+
},
|
45
|
+
testnet: true,
|
46
|
+
sourceId,
|
47
|
+
})
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const merlin = /*#__PURE__*/ defineChain({
|
4
|
+
id: 4200,
|
5
|
+
name: 'Merlin',
|
6
|
+
nativeCurrency: {
|
7
|
+
name: 'BTC',
|
8
|
+
symbol: 'BTC',
|
9
|
+
decimals: 18,
|
10
|
+
},
|
11
|
+
rpcUrls: {
|
12
|
+
default: { http: ['https://rpc.merlinchain.io'] },
|
13
|
+
},
|
14
|
+
blockExplorers: {
|
15
|
+
default: {
|
16
|
+
name: 'blockscout',
|
17
|
+
url: 'https://scan.merlinchain.io',
|
18
|
+
apiUrl: 'https://scan.merlinchain.io/api',
|
19
|
+
},
|
20
|
+
},
|
21
|
+
})
|
package/chains/index.ts
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
export type { Chain } from '../types/chain.js'
|
2
2
|
|
3
3
|
export { acala } from './definitions/acala.js'
|
4
|
+
export { ancient8 } from './definitions/ancient8.js'
|
5
|
+
export { ancient8Sepolia } from './definitions/ancient8Sepolia.js'
|
4
6
|
export { anvil } from './definitions/anvil.js'
|
7
|
+
export { apexTestnet } from './definitions/apexTestnet.js'
|
5
8
|
export { arbitrum } from './definitions/arbitrum.js'
|
6
9
|
export { arbitrumGoerli } from './definitions/arbitrumGoerli.js'
|
7
10
|
export { arbitrumNova } from './definitions/arbitrumNova.js'
|
@@ -10,6 +13,7 @@ export { arbitrumSepolia } from './definitions/arbitrumSepolia.js'
|
|
10
13
|
export { astarZkatana } from './definitions/astarZkatana.js'
|
11
14
|
export { aurora } from './definitions/aurora.js'
|
12
15
|
export { auroraTestnet } from './definitions/auroraTestnet.js'
|
16
|
+
export { auroria } from './definitions/auroria.js'
|
13
17
|
export { avalanche } from './definitions/avalanche.js'
|
14
18
|
export { avalancheFuji } from './definitions/avalancheFuji.js'
|
15
19
|
export { bahamut } from './definitions/bahamut.js'
|
@@ -21,12 +25,14 @@ export { bearNetworkChainTestnet } from './definitions/bearNetworkChainTestnet.j
|
|
21
25
|
export { berachainTestnet } from './definitions/berachainTestnet.js'
|
22
26
|
export { bitTorrent } from './definitions/bitTorrent.js'
|
23
27
|
export { bitTorrentTestnet } from './definitions/bitTorrentTestnet.js'
|
28
|
+
export { blast } from './definitions/blast.js'
|
24
29
|
export { blastSepolia } from './definitions/blastSepolia.js'
|
25
30
|
export { boba } from './definitions/boba.js'
|
26
31
|
export { bronos } from './definitions/bronos.js'
|
27
32
|
export { bronosTestnet } from './definitions/bronosTestnet.js'
|
28
33
|
export { bsc } from './definitions/bsc.js'
|
29
34
|
export { bscTestnet } from './definitions/bscTestnet.js'
|
35
|
+
export { bscGreenfield } from './definitions/bscGreenfield.js'
|
30
36
|
export { bxn } from './definitions/bxn.js'
|
31
37
|
export { bxnTestnet } from './definitions/bxnTestnet.js'
|
32
38
|
export { canto } from './definitions/canto.js'
|
@@ -64,6 +70,8 @@ export { flare } from './definitions/flare.js'
|
|
64
70
|
export { flareTestnet } from './definitions/flareTestnet.js'
|
65
71
|
/** @deprecated Use `anvil` instead. */
|
66
72
|
export { foundry } from './definitions/foundry.js'
|
73
|
+
export { fraxtal } from './definitions/fraxtal.js'
|
74
|
+
export { fraxtalTestnet } from './definitions/fraxtalTestnet.js'
|
67
75
|
export { fuse } from './definitions/fuse.js'
|
68
76
|
export { fuseSparknet } from './definitions/fuseSparknet.js'
|
69
77
|
export { iotex } from './definitions/iotex.js'
|
@@ -94,6 +102,7 @@ export { lightlinkPegasus } from './definitions/lightlinkPegasus.js'
|
|
94
102
|
export { lightlinkPhoenix } from './definitions/lightlinkPhoenix.js'
|
95
103
|
export { linea } from './definitions/linea.js'
|
96
104
|
export { lineaTestnet } from './definitions/lineaTestnet.js'
|
105
|
+
export { liskSepolia } from './definitions/liskSepolia.js'
|
97
106
|
export { localhost } from './definitions/localhost.js'
|
98
107
|
export { lukso } from './definitions/lukso.js'
|
99
108
|
export { mainnet } from './definitions/mainnet.js'
|
@@ -102,6 +111,7 @@ export { manta } from './definitions/manta.js'
|
|
102
111
|
export { mantaTestnet } from './definitions/mantaTestnet.js'
|
103
112
|
export { mantle } from './definitions/mantle.js'
|
104
113
|
export { mantleTestnet } from './definitions/mantleTestnet.js'
|
114
|
+
export { merlin } from './definitions/merlin.js'
|
105
115
|
export { metachain } from './definitions/metachain.js'
|
106
116
|
export { metachainIstanbul } from './definitions/metachainIstanbul.js'
|
107
117
|
export { meter } from './definitions/meter.js'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
2
|
+
|
3
|
+
import {
|
4
|
+
type ReadContractErrorType,
|
5
|
+
readContract,
|
6
|
+
} from '../../../actions/public/readContract.js'
|
7
|
+
import { type PrepareTransactionRequestErrorType } from '../../../actions/wallet/prepareTransactionRequest.js'
|
8
|
+
import type { Client } from '../../../clients/createClient.js'
|
9
|
+
import type { Transport } from '../../../clients/transports/createTransport.js'
|
10
|
+
import type { ErrorType } from '../../../errors/utils.js'
|
11
|
+
import { type Chain, type GetChainParameter } from '../../../types/chain.js'
|
12
|
+
import type { RequestErrorType } from '../../../utils/buildRequest.js'
|
13
|
+
import { getChainContractAddress } from '../../../utils/chain/getChainContractAddress.js'
|
14
|
+
import { type HexToNumberErrorType } from '../../../utils/encoding/fromHex.js'
|
15
|
+
|
16
|
+
import { gasPriceOracleAbi } from '../abis.js'
|
17
|
+
import { contracts } from '../contracts.js'
|
18
|
+
|
19
|
+
export type GetL1BaseFeeParameters<
|
20
|
+
TChain extends Chain | undefined = Chain | undefined,
|
21
|
+
TChainOverride extends Chain | undefined = undefined,
|
22
|
+
> = GetChainParameter<TChain, TChainOverride> & {
|
23
|
+
/** Gas price oracle address. */
|
24
|
+
gasPriceOracleAddress?: Address
|
25
|
+
}
|
26
|
+
|
27
|
+
export type GetL1BaseFeeReturnType = bigint
|
28
|
+
|
29
|
+
export type GetL1BaseFeeErrorType =
|
30
|
+
| RequestErrorType
|
31
|
+
| PrepareTransactionRequestErrorType
|
32
|
+
| HexToNumberErrorType
|
33
|
+
| ReadContractErrorType
|
34
|
+
| ErrorType
|
35
|
+
|
36
|
+
/**
|
37
|
+
* get the L1 base fee
|
38
|
+
*
|
39
|
+
* @param client - Client to use
|
40
|
+
* @param parameters - {@link GetL1BaseFeeParameters}
|
41
|
+
* @returns The basefee (in wei). {@link GetL1BaseFeeReturnType}
|
42
|
+
*
|
43
|
+
* @example
|
44
|
+
* import { createPublicClient, http, parseEther } from 'viem'
|
45
|
+
* import { optimism } from 'viem/chains'
|
46
|
+
* import { getL1BaseFee } from 'viem/chains/optimism'
|
47
|
+
*
|
48
|
+
* const client = createPublicClient({
|
49
|
+
* chain: optimism,
|
50
|
+
* transport: http(),
|
51
|
+
* })
|
52
|
+
* const l1BaseFee = await getL1BaseFee(client)
|
53
|
+
*/
|
54
|
+
export async function getL1BaseFee<
|
55
|
+
TChain extends Chain | undefined,
|
56
|
+
TChainOverride extends Chain | undefined = undefined,
|
57
|
+
>(
|
58
|
+
client: Client<Transport, TChain>,
|
59
|
+
args?: GetL1BaseFeeParameters<TChain, TChainOverride>,
|
60
|
+
): Promise<GetL1BaseFeeReturnType> {
|
61
|
+
const {
|
62
|
+
chain = client.chain,
|
63
|
+
gasPriceOracleAddress: gasPriceOracleAddress_,
|
64
|
+
} = args || {}
|
65
|
+
|
66
|
+
const gasPriceOracleAddress = (() => {
|
67
|
+
if (gasPriceOracleAddress_) return gasPriceOracleAddress_
|
68
|
+
if (chain)
|
69
|
+
return getChainContractAddress({
|
70
|
+
chain,
|
71
|
+
contract: 'gasPriceOracle',
|
72
|
+
})
|
73
|
+
return contracts.gasPriceOracle.address
|
74
|
+
})()
|
75
|
+
|
76
|
+
return readContract(client, {
|
77
|
+
abi: gasPriceOracleAbi,
|
78
|
+
address: gasPriceOracleAddress,
|
79
|
+
functionName: 'l1BaseFee',
|
80
|
+
})
|
81
|
+
}
|
package/chains/opStack/chains.ts
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
export { ancient8 } from '../definitions/ancient8.js'
|
2
|
+
export { ancient8Sepolia } from '../definitions/ancient8Sepolia.js'
|
1
3
|
export { base } from '../definitions/base.js'
|
2
4
|
export { baseGoerli } from '../definitions/baseGoerli.js'
|
3
5
|
export { baseSepolia } from '../definitions/baseSepolia.js'
|
6
|
+
export { fraxtal } from '../definitions/fraxtal.js'
|
7
|
+
export { fraxtalTestnet } from '../definitions/fraxtalTestnet.js'
|
4
8
|
export { optimism } from '../definitions/optimism.js'
|
5
9
|
export { optimismGoerli } from '../definitions/optimismGoerli.js'
|
6
10
|
export { optimismSepolia } from '../definitions/optimismSepolia.js'
|
@@ -62,6 +62,11 @@ import {
|
|
62
62
|
type EstimateTotalGasReturnType,
|
63
63
|
estimateTotalGas,
|
64
64
|
} from '../actions/estimateTotalGas.js'
|
65
|
+
import {
|
66
|
+
type GetL1BaseFeeParameters,
|
67
|
+
type GetL1BaseFeeReturnType,
|
68
|
+
getL1BaseFee,
|
69
|
+
} from '../actions/getL1BaseFee.js'
|
65
70
|
|
66
71
|
export type PublicActionsL2<
|
67
72
|
chain extends Chain | undefined = Chain | undefined,
|
@@ -364,6 +369,29 @@ export type PublicActionsL2<
|
|
364
369
|
estimateL1Fee: <chainOverride extends Chain | undefined = undefined>(
|
365
370
|
parameters: EstimateL1FeeParameters<chain, account, chainOverride>,
|
366
371
|
) => Promise<EstimateL1FeeReturnType>
|
372
|
+
|
373
|
+
/**
|
374
|
+
* Get the L1 basefee
|
375
|
+
*
|
376
|
+
* @param client - Client to use
|
377
|
+
* @param parameters - {@link GetL1BaseFeeParameters}
|
378
|
+
* @returns The fee (in wei). {@link GetL1BaseFeeReturnType}
|
379
|
+
*
|
380
|
+
* @example
|
381
|
+
* import { createPublicClient, http, parseEther } from 'viem'
|
382
|
+
* import { optimism } from 'viem/chains'
|
383
|
+
* import { publicActionsL2 } from 'viem/op-stack'
|
384
|
+
*
|
385
|
+
* const client = createPublicClient({
|
386
|
+
* chain: optimism,
|
387
|
+
* transport: http(),
|
388
|
+
* }).extend(publicActionsL2())
|
389
|
+
*
|
390
|
+
* const l1BaseFee = await client.getL1BaseFee()
|
391
|
+
*/
|
392
|
+
getL1BaseFee: <chainOverride extends Chain | undefined = undefined>(
|
393
|
+
parameters?: GetL1BaseFeeParameters<chain, chainOverride>,
|
394
|
+
) => Promise<GetL1BaseFeeReturnType>
|
367
395
|
/**
|
368
396
|
* Estimates the amount of L1 data gas required to execute an L2 transaction.
|
369
397
|
*
|
@@ -479,6 +507,7 @@ export function publicActionsL2() {
|
|
479
507
|
estimateInitiateWithdrawalGas: (args) =>
|
480
508
|
estimateInitiateWithdrawalGas(client, args),
|
481
509
|
estimateL1Fee: (args) => estimateL1Fee(client, args),
|
510
|
+
getL1BaseFee: (args) => getL1BaseFee(client, args),
|
482
511
|
estimateL1Gas: (args) => estimateL1Gas(client, args),
|
483
512
|
estimateTotalFee: (args) => estimateTotalFee(client, args),
|
484
513
|
estimateTotalGas: (args) => estimateTotalGas(client, args),
|
package/chains/opStack/index.ts
CHANGED
@@ -52,6 +52,12 @@ export {
|
|
52
52
|
type EstimateL1FeeParameters,
|
53
53
|
type EstimateL1FeeReturnType,
|
54
54
|
} from './actions/estimateL1Fee.js'
|
55
|
+
export {
|
56
|
+
getL1BaseFee,
|
57
|
+
type GetL1BaseFeeErrorType,
|
58
|
+
type GetL1BaseFeeParameters,
|
59
|
+
type GetL1BaseFeeReturnType,
|
60
|
+
} from './actions/getL1BaseFee.js'
|
55
61
|
export {
|
56
62
|
estimateL1Gas,
|
57
63
|
type EstimateL1GasErrorType,
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.7.
|
1
|
+
export const version = '2.7.18'
|
package/package.json
CHANGED
@@ -46,6 +46,38 @@ export type EncodeAbiParametersErrorType =
|
|
46
46
|
|
47
47
|
/**
|
48
48
|
* @description Encodes a list of primitive values into an ABI-encoded hex value.
|
49
|
+
*
|
50
|
+
* - Docs: https://viem.sh/docs/abi/encodeAbiParameters#encodeabiparameters
|
51
|
+
*
|
52
|
+
* Generates ABI encoded data using the [ABI specification](https://docs.soliditylang.org/en/latest/abi-spec), given a set of ABI parameters (inputs/outputs) and their corresponding values.
|
53
|
+
*
|
54
|
+
* @param params - a set of ABI Parameters (params), that can be in the shape of the inputs or outputs attribute of an ABI Item.
|
55
|
+
* @param values - a set of values (values) that correspond to the given params.
|
56
|
+
* @example
|
57
|
+
* ```typescript
|
58
|
+
* import { encodeAbiParameters } from 'viem'
|
59
|
+
*
|
60
|
+
* const encodedData = encodeAbiParameters(
|
61
|
+
* [
|
62
|
+
* { name: 'x', type: 'string' },
|
63
|
+
* { name: 'y', type: 'uint' },
|
64
|
+
* { name: 'z', type: 'bool' }
|
65
|
+
* ],
|
66
|
+
* ['wagmi', 420n, true]
|
67
|
+
* )
|
68
|
+
* ```
|
69
|
+
*
|
70
|
+
* You can also pass in Human Readable parameters with the parseAbiParameters utility.
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* ```typescript
|
74
|
+
* import { encodeAbiParameters, parseAbiParameters } from 'viem'
|
75
|
+
*
|
76
|
+
* const encodedData = encodeAbiParameters(
|
77
|
+
* parseAbiParameters('string x, uint y, bool z'),
|
78
|
+
* ['wagmi', 420n, true]
|
79
|
+
* )
|
80
|
+
* ```
|
49
81
|
*/
|
50
82
|
export function encodeAbiParameters<
|
51
83
|
const TParams extends readonly AbiParameter[] | readonly unknown[],
|
@@ -5,7 +5,7 @@ import { checksumAddress } from './getAddress.js'
|
|
5
5
|
|
6
6
|
const addressRegex = /^0x[a-fA-F0-9]{40}$/
|
7
7
|
|
8
|
-
const isAddressCache = /*#__PURE__*/ new LruMap<boolean>(8192)
|
8
|
+
export const isAddressCache = /*#__PURE__*/ new LruMap<boolean>(8192)
|
9
9
|
|
10
10
|
export type IsAddressOptions = {
|
11
11
|
/**
|