viem 2.8.5 → 2.8.9
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 +32 -0
 - package/_cjs/actions/public/call.js +1 -1
 - package/_cjs/actions/public/call.js.map +1 -1
 - package/_cjs/chains/definitions/beam.js +2 -0
 - package/_cjs/chains/definitions/beam.js.map +1 -1
 - package/_cjs/chains/definitions/beamTestnet.js +2 -0
 - package/_cjs/chains/definitions/beamTestnet.js.map +1 -1
 - package/_cjs/chains/definitions/flowMainnet.js +25 -0
 - package/_cjs/chains/definitions/flowMainnet.js.map +1 -0
 - package/_cjs/chains/definitions/flowPreviewnet.js +25 -0
 - package/_cjs/chains/definitions/flowPreviewnet.js.map +1 -0
 - package/_cjs/chains/definitions/morphSepolia.js +23 -0
 - package/_cjs/chains/definitions/morphSepolia.js.map +1 -0
 - package/_cjs/chains/definitions/optimism.js +1 -1
 - package/_cjs/chains/definitions/optimism.js.map +1 -1
 - package/_cjs/chains/definitions/stratis.js +26 -0
 - package/_cjs/chains/definitions/stratis.js.map +1 -0
 - package/_cjs/chains/index.js +12 -4
 - package/_cjs/chains/index.js.map +1 -1
 - package/_cjs/chains/opStack/utils/getSourceHash.js +1 -1
 - 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/_esm/actions/public/call.js +1 -1
 - package/_esm/actions/public/call.js.map +1 -1
 - package/_esm/chains/definitions/beam.js +2 -0
 - package/_esm/chains/definitions/beam.js.map +1 -1
 - package/_esm/chains/definitions/beamTestnet.js +2 -0
 - package/_esm/chains/definitions/beamTestnet.js.map +1 -1
 - package/_esm/chains/definitions/flowMainnet.js +22 -0
 - package/_esm/chains/definitions/flowMainnet.js.map +1 -0
 - package/_esm/chains/definitions/flowPreviewnet.js +22 -0
 - package/_esm/chains/definitions/flowPreviewnet.js.map +1 -0
 - package/_esm/chains/definitions/morphSepolia.js +20 -0
 - package/_esm/chains/definitions/morphSepolia.js.map +1 -0
 - package/_esm/chains/definitions/optimism.js +1 -1
 - package/_esm/chains/definitions/optimism.js.map +1 -1
 - package/_esm/chains/definitions/stratis.js +23 -0
 - package/_esm/chains/definitions/stratis.js.map +1 -0
 - package/_esm/chains/index.js +4 -0
 - package/_esm/chains/index.js.map +1 -1
 - package/_esm/chains/opStack/utils/getSourceHash.js +1 -1
 - 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/_types/chains/definitions/beam.d.ts +2 -0
 - package/_types/chains/definitions/beam.d.ts.map +1 -1
 - package/_types/chains/definitions/beamTestnet.d.ts +2 -0
 - package/_types/chains/definitions/beamTestnet.d.ts.map +1 -1
 - package/_types/chains/definitions/flowMainnet.d.ts +35 -0
 - package/_types/chains/definitions/flowMainnet.d.ts.map +1 -0
 - package/_types/chains/definitions/flowPreviewnet.d.ts +35 -0
 - package/_types/chains/definitions/flowPreviewnet.d.ts.map +1 -0
 - package/_types/chains/definitions/morphSepolia.d.ts +36 -0
 - package/_types/chains/definitions/morphSepolia.d.ts.map +1 -0
 - package/_types/chains/definitions/optimism.d.ts +1 -1
 - package/_types/chains/definitions/stratis.d.ts +36 -0
 - package/_types/chains/definitions/stratis.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/decorators/public.d.ts +22 -0
 - package/_types/clients/decorators/public.d.ts.map +1 -1
 - package/_types/errors/version.d.ts +1 -1
 - package/actions/public/call.ts +1 -1
 - package/chains/definitions/beam.ts +2 -0
 - package/chains/definitions/beamTestnet.ts +2 -0
 - package/chains/definitions/flowMainnet.ts +22 -0
 - package/chains/definitions/flowPreviewnet.ts +22 -0
 - package/chains/definitions/morphSepolia.ts +20 -0
 - package/chains/definitions/optimism.ts +1 -1
 - package/chains/definitions/stratis.ts +23 -0
 - package/chains/index.ts +4 -0
 - package/chains/opStack/utils/getSourceHash.ts +1 -1
 - package/clients/decorators/public.ts +26 -0
 - package/errors/version.ts +1 -1
 - package/package.json +1 -1
 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { defineChain } from '../../utils/chain/defineChain.js'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            export const flowMainnet = /*#__PURE__*/ defineChain({
         
     | 
| 
      
 4 
     | 
    
         
            +
              id: 747,
         
     | 
| 
      
 5 
     | 
    
         
            +
              name: 'FlowEVM Mainnet',
         
     | 
| 
      
 6 
     | 
    
         
            +
              nativeCurrency: {
         
     | 
| 
      
 7 
     | 
    
         
            +
                decimals: 18,
         
     | 
| 
      
 8 
     | 
    
         
            +
                name: 'Flow',
         
     | 
| 
      
 9 
     | 
    
         
            +
                symbol: 'FLOW',
         
     | 
| 
      
 10 
     | 
    
         
            +
              },
         
     | 
| 
      
 11 
     | 
    
         
            +
              rpcUrls: {
         
     | 
| 
      
 12 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  http: ['https://mainnet.evm.nodes.onflow.org'],
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
              },
         
     | 
| 
      
 16 
     | 
    
         
            +
              blockExplorers: {
         
     | 
| 
      
 17 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 18 
     | 
    
         
            +
                  name: 'Mainnet Explorer',
         
     | 
| 
      
 19 
     | 
    
         
            +
                  url: 'https://flowdiver.io',
         
     | 
| 
      
 20 
     | 
    
         
            +
                },
         
     | 
| 
      
 21 
     | 
    
         
            +
              },
         
     | 
| 
      
 22 
     | 
    
         
            +
            })
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { defineChain } from '../../utils/chain/defineChain.js'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            export const flowPreviewnet = /*#__PURE__*/ defineChain({
         
     | 
| 
      
 4 
     | 
    
         
            +
              id: 646,
         
     | 
| 
      
 5 
     | 
    
         
            +
              name: 'FlowEVM Previewnet',
         
     | 
| 
      
 6 
     | 
    
         
            +
              nativeCurrency: {
         
     | 
| 
      
 7 
     | 
    
         
            +
                decimals: 18,
         
     | 
| 
      
 8 
     | 
    
         
            +
                name: 'Flow',
         
     | 
| 
      
 9 
     | 
    
         
            +
                symbol: 'FLOW',
         
     | 
| 
      
 10 
     | 
    
         
            +
              },
         
     | 
| 
      
 11 
     | 
    
         
            +
              rpcUrls: {
         
     | 
| 
      
 12 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  http: ['https://previewnet.evm.nodes.onflow.org'],
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
              },
         
     | 
| 
      
 16 
     | 
    
         
            +
              blockExplorers: {
         
     | 
| 
      
 17 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 18 
     | 
    
         
            +
                  name: 'Previewnet Explorer',
         
     | 
| 
      
 19 
     | 
    
         
            +
                  url: 'https://previewnet.flowdiver.io',
         
     | 
| 
      
 20 
     | 
    
         
            +
                },
         
     | 
| 
      
 21 
     | 
    
         
            +
              },
         
     | 
| 
      
 22 
     | 
    
         
            +
            })
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { defineChain } from '../../utils/chain/defineChain.js'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            export const morphSepolia = /*#__PURE__*/ defineChain({
         
     | 
| 
      
 4 
     | 
    
         
            +
              id: 2710,
         
     | 
| 
      
 5 
     | 
    
         
            +
              name: 'Morph Sepolia',
         
     | 
| 
      
 6 
     | 
    
         
            +
              nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
         
     | 
| 
      
 7 
     | 
    
         
            +
              rpcUrls: {
         
     | 
| 
      
 8 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 9 
     | 
    
         
            +
                  http: ['https://rpc-testnet.morphl2.io'],
         
     | 
| 
      
 10 
     | 
    
         
            +
                },
         
     | 
| 
      
 11 
     | 
    
         
            +
              },
         
     | 
| 
      
 12 
     | 
    
         
            +
              blockExplorers: {
         
     | 
| 
      
 13 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 14 
     | 
    
         
            +
                  name: 'Morph Testnet Explorer',
         
     | 
| 
      
 15 
     | 
    
         
            +
                  url: 'https://explorer-testnet.morphl2.io',
         
     | 
| 
      
 16 
     | 
    
         
            +
                  apiUrl: 'https://explorer-api-testnet.morphl2.io/api',
         
     | 
| 
      
 17 
     | 
    
         
            +
                },
         
     | 
| 
      
 18 
     | 
    
         
            +
              },
         
     | 
| 
      
 19 
     | 
    
         
            +
              testnet: true,
         
     | 
| 
      
 20 
     | 
    
         
            +
            })
         
     | 
| 
         @@ -17,7 +17,7 @@ export const optimism = /*#__PURE__*/ defineChain({ 
     | 
|
| 
       17 
17 
     | 
    
         
             
                default: {
         
     | 
| 
       18 
18 
     | 
    
         
             
                  name: 'Optimism Explorer',
         
     | 
| 
       19 
19 
     | 
    
         
             
                  url: 'https://optimistic.etherscan.io',
         
     | 
| 
       20 
     | 
    
         
            -
                  apiUrl: 'https://api-optimistic.etherscan.io',
         
     | 
| 
      
 20 
     | 
    
         
            +
                  apiUrl: 'https://api-optimistic.etherscan.io/api',
         
     | 
| 
       21 
21 
     | 
    
         
             
                },
         
     | 
| 
       22 
22 
     | 
    
         
             
              },
         
     | 
| 
       23 
23 
     | 
    
         
             
              contracts: {
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { defineChain } from '../../utils/chain/defineChain.js'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            export const stratis = /*#__PURE__*/ defineChain({
         
     | 
| 
      
 4 
     | 
    
         
            +
              id: 105105,
         
     | 
| 
      
 5 
     | 
    
         
            +
              name: 'Stratis Mainnet',
         
     | 
| 
      
 6 
     | 
    
         
            +
              network: 'stratis',
         
     | 
| 
      
 7 
     | 
    
         
            +
              nativeCurrency: {
         
     | 
| 
      
 8 
     | 
    
         
            +
                name: 'Stratis',
         
     | 
| 
      
 9 
     | 
    
         
            +
                symbol: 'STRAX',
         
     | 
| 
      
 10 
     | 
    
         
            +
                decimals: 18,
         
     | 
| 
      
 11 
     | 
    
         
            +
              },
         
     | 
| 
      
 12 
     | 
    
         
            +
              rpcUrls: {
         
     | 
| 
      
 13 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 14 
     | 
    
         
            +
                  http: ['https://rpc.stratisevm.com'],
         
     | 
| 
      
 15 
     | 
    
         
            +
                },
         
     | 
| 
      
 16 
     | 
    
         
            +
              },
         
     | 
| 
      
 17 
     | 
    
         
            +
              blockExplorers: {
         
     | 
| 
      
 18 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 19 
     | 
    
         
            +
                  name: 'Stratis Explorer',
         
     | 
| 
      
 20 
     | 
    
         
            +
                  url: 'https://explorer.stratisevm.com',
         
     | 
| 
      
 21 
     | 
    
         
            +
                },
         
     | 
| 
      
 22 
     | 
    
         
            +
              },
         
     | 
| 
      
 23 
     | 
    
         
            +
            })
         
     | 
    
        package/chains/index.ts
    CHANGED
    
    | 
         @@ -72,6 +72,8 @@ export { filecoinCalibration } from './definitions/filecoinCalibration.js' 
     | 
|
| 
       72 
72 
     | 
    
         
             
            export { filecoinHyperspace } from './definitions/filecoinHyperspace.js'
         
     | 
| 
       73 
73 
     | 
    
         
             
            export { flare } from './definitions/flare.js'
         
     | 
| 
       74 
74 
     | 
    
         
             
            export { flareTestnet } from './definitions/flareTestnet.js'
         
     | 
| 
      
 75 
     | 
    
         
            +
            export { flowPreviewnet } from './definitions/flowPreviewnet.js'
         
     | 
| 
      
 76 
     | 
    
         
            +
            export { flowMainnet } from './definitions/flowMainnet.js'
         
     | 
| 
       75 
77 
     | 
    
         
             
            /** @deprecated Use `anvil` instead. */
         
     | 
| 
       76 
78 
     | 
    
         
             
            export { foundry } from './definitions/foundry.js'
         
     | 
| 
       77 
79 
     | 
    
         
             
            export { fraxtal } from './definitions/fraxtal.js'
         
     | 
| 
         @@ -131,6 +133,7 @@ export { moonbaseAlpha } from './definitions/moonbaseAlpha.js' 
     | 
|
| 
       131 
133 
     | 
    
         
             
            export { moonbeam } from './definitions/moonbeam.js'
         
     | 
| 
       132 
134 
     | 
    
         
             
            export { moonbeamDev } from './definitions/moonbeamDev.js'
         
     | 
| 
       133 
135 
     | 
    
         
             
            export { moonriver } from './definitions/moonriver.js'
         
     | 
| 
      
 136 
     | 
    
         
            +
            export { morphSepolia } from './definitions/morphSepolia.js'
         
     | 
| 
       134 
137 
     | 
    
         
             
            export { neonDevnet } from './definitions/neonDevnet.js'
         
     | 
| 
       135 
138 
     | 
    
         
             
            export { neonMainnet } from './definitions/neonMainnet.js'
         
     | 
| 
       136 
139 
     | 
    
         
             
            export { nexi } from './definitions/nexi.js'
         
     | 
| 
         @@ -194,6 +197,7 @@ export { songbirdTestnet } from './definitions/songbirdTestnet.js' 
     | 
|
| 
       194 
197 
     | 
    
         
             
            export { spicy } from './definitions/spicy.js'
         
     | 
| 
       195 
198 
     | 
    
         
             
            export { shardeumSphinx } from './definitions/shardeumSphinx.js'
         
     | 
| 
       196 
199 
     | 
    
         
             
            export { shibarium } from './definitions/shibarium.js'
         
     | 
| 
      
 200 
     | 
    
         
            +
            export { stratis } from './definitions/stratis.js'
         
     | 
| 
       197 
201 
     | 
    
         
             
            export { syscoin } from './definitions/syscoin.js'
         
     | 
| 
       198 
202 
     | 
    
         
             
            export { syscoinTestnet } from './definitions/syscoinTestnet.js'
         
     | 
| 
       199 
203 
     | 
    
         
             
            export { taraxa } from './definitions/taraxa.js'
         
     | 
| 
         @@ -52,7 +52,7 @@ export function getSourceHash({ 
     | 
|
| 
       52 
52 
     | 
    
         
             
              l1BlockHash,
         
     | 
| 
       53 
53 
     | 
    
         
             
              sequenceNumber,
         
     | 
| 
       54 
54 
     | 
    
         
             
            }: GetSourceHashParameters) {
         
     | 
| 
       55 
     | 
    
         
            -
              const marker = toHex(l1LogIndex!  
     | 
| 
      
 55 
     | 
    
         
            +
              const marker = toHex(l1LogIndex! ?? sequenceNumber!)
         
     | 
| 
       56 
56 
     | 
    
         
             
              const input = concat([l1BlockHash, pad(marker, { size: 32 })])
         
     | 
| 
       57 
57 
     | 
    
         
             
              const depositIdHash = keccak256(input)
         
     | 
| 
       58 
58 
     | 
    
         
             
              const domainHex = toHex(sourceHashDomainMap[domain])
         
     | 
| 
         @@ -73,6 +73,10 @@ import { 
     | 
|
| 
       73 
73 
     | 
    
         
             
              type GetBalanceReturnType,
         
     | 
| 
       74 
74 
     | 
    
         
             
              getBalance,
         
     | 
| 
       75 
75 
     | 
    
         
             
            } from '../../actions/public/getBalance.js'
         
     | 
| 
      
 76 
     | 
    
         
            +
            import {
         
     | 
| 
      
 77 
     | 
    
         
            +
              type GetBlobBaseFeeReturnType,
         
     | 
| 
      
 78 
     | 
    
         
            +
              getBlobBaseFee,
         
     | 
| 
      
 79 
     | 
    
         
            +
            } from '../../actions/public/getBlobBaseFee.js'
         
     | 
| 
       76 
80 
     | 
    
         
             
            import {
         
     | 
| 
       77 
81 
     | 
    
         
             
              type GetBlockParameters,
         
     | 
| 
       78 
82 
     | 
    
         
             
              type GetBlockReturnType,
         
     | 
| 
         @@ -511,6 +515,27 @@ export type PublicActions< 
     | 
|
| 
       511 
515 
     | 
    
         
             
               * // 10000000000000000000000n (wei)
         
     | 
| 
       512 
516 
     | 
    
         
             
               */
         
     | 
| 
       513 
517 
     | 
    
         
             
              getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>
         
     | 
| 
      
 518 
     | 
    
         
            +
              /**
         
     | 
| 
      
 519 
     | 
    
         
            +
               * Returns the base fee per blob gas in wei.
         
     | 
| 
      
 520 
     | 
    
         
            +
               *
         
     | 
| 
      
 521 
     | 
    
         
            +
               * - Docs: https://viem.sh/docs/actions/public/getBlobBaseFee
         
     | 
| 
      
 522 
     | 
    
         
            +
               * - JSON-RPC Methods: [`eth_blobBaseFee`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blobBaseFee)
         
     | 
| 
      
 523 
     | 
    
         
            +
               *
         
     | 
| 
      
 524 
     | 
    
         
            +
               * @param client - Client to use
         
     | 
| 
      
 525 
     | 
    
         
            +
               * @returns The blob base fee (in wei). {@link GetBlobBaseFeeReturnType}
         
     | 
| 
      
 526 
     | 
    
         
            +
               *
         
     | 
| 
      
 527 
     | 
    
         
            +
               * @example
         
     | 
| 
      
 528 
     | 
    
         
            +
               * import { createPublicClient, http } from 'viem'
         
     | 
| 
      
 529 
     | 
    
         
            +
               * import { mainnet } from 'viem/chains'
         
     | 
| 
      
 530 
     | 
    
         
            +
               * import { getBlobBaseFee } from 'viem/public'
         
     | 
| 
      
 531 
     | 
    
         
            +
               *
         
     | 
| 
      
 532 
     | 
    
         
            +
               * const client = createPublicClient({
         
     | 
| 
      
 533 
     | 
    
         
            +
               *   chain: mainnet,
         
     | 
| 
      
 534 
     | 
    
         
            +
               *   transport: http(),
         
     | 
| 
      
 535 
     | 
    
         
            +
               * })
         
     | 
| 
      
 536 
     | 
    
         
            +
               * const blobBaseFee = await client.getBlobBaseFee()
         
     | 
| 
      
 537 
     | 
    
         
            +
               */
         
     | 
| 
      
 538 
     | 
    
         
            +
              getBlobBaseFee: () => Promise<GetBlobBaseFeeReturnType>
         
     | 
| 
       514 
539 
     | 
    
         
             
              /**
         
     | 
| 
       515 
540 
     | 
    
         
             
               * Returns information about a block at a block number, hash, or tag.
         
     | 
| 
       516 
541 
     | 
    
         
             
               *
         
     | 
| 
         @@ -1746,6 +1771,7 @@ export function publicActions< 
     | 
|
| 
       1746 
1771 
     | 
    
         
             
                estimateContractGas: (args) => estimateContractGas(client, args as any),
         
     | 
| 
       1747 
1772 
     | 
    
         
             
                estimateGas: (args) => estimateGas(client, args),
         
     | 
| 
       1748 
1773 
     | 
    
         
             
                getBalance: (args) => getBalance(client, args),
         
     | 
| 
      
 1774 
     | 
    
         
            +
                getBlobBaseFee: () => getBlobBaseFee(client),
         
     | 
| 
       1749 
1775 
     | 
    
         
             
                getBlock: (args) => getBlock(client, args),
         
     | 
| 
       1750 
1776 
     | 
    
         
             
                getBlockNumber: (args) => getBlockNumber(client, args),
         
     | 
| 
       1751 
1777 
     | 
    
         
             
                getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
         
     | 
    
        package/errors/version.ts
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export const version = '2.8. 
     | 
| 
      
 1 
     | 
    
         
            +
            export const version = '2.8.9'
         
     |