// biome-ignore lint/performance/noBarrelFile: export { type FromRpcBlockErrorType, type FormattedBlock, type ToRpcBlockErrorType, fromRpcBlock, /** @alias fromRpcBlock */ fromRpcBlock as fromRpc, toRpcBlock, /** @alias toRpcBlock */ toRpcBlock as toRpc, } from './internal/formatter/block.js' export type { Block, BlockIdentifier, BlockNumber, BlockTag, RpcBlock, RpcBlockIdentifier, RpcBlockNumber, RpcUncle, Uncle, } from './internal/types/block.js' //////////////////////////////////////////////////////////////////////////////////////////////// import { fromRpcBlock } from './internal/formatter/block.js' import type { Block, RpcBlock } from './internal/types/block.js' import type { OneOf, Prettify } from './internal/types/utils.js' /** * Instantiates a typed {@link Block} object from a {@link RpcBlock} or {@link Block}. * * @example * ```ts * import { Block } from 'viem' * const block = Block.from({ ... }) * ``` */ export function from>( block: block, ): block extends Block ? block : Prettify { if (typeof block.timestamp === 'bigint') return block as any return fromRpcBlock(block) as any }