import { n as __exportAll } from "./chunk-BEJ448es.mjs";
import { a as extract, n as assertRequest, r as formatTransactionRequest, t as getCallError } from "./getCallError-CUwV9zg3.mjs";
import { J as isAddress, L as parseAccount, Q as InvalidAddressError, ct as toHex, ot as numberToHex, q as concatHex, ut as hexToBigInt } from "./chain-CFT4ZwjV.mjs";
import { s as toRlp, t as serializeTransaction$1 } from "./serializeAuthorizationList-BmtEpRnQ.mjs";
import { a as AccountNotFoundError, c as defineBlock, d as formatTransaction, n as defineTransactionReceipt, t as defineChain, u as defineTransaction } from "./defineChain-DiR0ou4P.mjs";
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/op-stack/contracts.js
/**
* Predeploy contracts for OP Stack.
* @see https://github.com/ethereum-optimism/optimism/blob/develop/specs/predeploys.md
*/
const contracts = {
	gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
	l1Block: { address: "0x4200000000000000000000000000000000000015" },
	l2CrossDomainMessenger: { address: "0x4200000000000000000000000000000000000007" },
	l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
	l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
	l2ToL1MessagePasser: { address: "0x4200000000000000000000000000000000000016" }
};
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/op-stack/formatters.js
const formatters = {
	block: /* @__PURE__ */ defineBlock({ format(args) {
		return {
			transactions: args.transactions?.map((transaction) => {
				if (typeof transaction === "string") return transaction;
				const formatted = formatTransaction(transaction);
				if (formatted.typeHex === "0x7e") {
					formatted.isSystemTx = transaction.isSystemTx;
					formatted.mint = transaction.mint ? hexToBigInt(transaction.mint) : void 0;
					formatted.sourceHash = transaction.sourceHash;
					formatted.type = "deposit";
				}
				return formatted;
			}),
			stateRoot: args.stateRoot
		};
	} }),
	transaction: /* @__PURE__ */ defineTransaction({ format(args) {
		const transaction = {};
		if (args.type === "0x7e") {
			transaction.isSystemTx = args.isSystemTx;
			transaction.mint = args.mint ? hexToBigInt(args.mint) : void 0;
			transaction.sourceHash = args.sourceHash;
			transaction.type = "deposit";
		}
		return transaction;
	} }),
	transactionReceipt: /* @__PURE__ */ defineTransactionReceipt({ format(args) {
		return {
			l1GasPrice: args.l1GasPrice ? hexToBigInt(args.l1GasPrice) : null,
			l1GasUsed: args.l1GasUsed ? hexToBigInt(args.l1GasUsed) : null,
			l1Fee: args.l1Fee ? hexToBigInt(args.l1Fee) : null,
			l1FeeScalar: args.l1FeeScalar ? Number(args.l1FeeScalar) : null
		};
	} })
};
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/op-stack/serializers.js
function serializeTransaction(transaction, signature) {
	if (isDeposit(transaction)) return serializeTransactionDeposit(transaction);
	return serializeTransaction$1(transaction, signature);
}
const serializers = { transaction: serializeTransaction };
function serializeTransactionDeposit(transaction) {
	assertTransactionDeposit(transaction);
	const { sourceHash, data, from, gas, isSystemTx, mint, to, value } = transaction;
	return concatHex(["0x7e", toRlp([
		sourceHash,
		from,
		to ?? "0x",
		mint ? toHex(mint) : "0x",
		value ? toHex(value) : "0x",
		gas ? toHex(gas) : "0x",
		isSystemTx ? "0x1" : "0x",
		data ?? "0x"
	])]);
}
function isDeposit(transaction) {
	if (transaction.type === "deposit") return true;
	if (typeof transaction.sourceHash !== "undefined") return true;
	return false;
}
function assertTransactionDeposit(transaction) {
	const { from, to } = transaction;
	if (from && !isAddress(from)) throw new InvalidAddressError({ address: from });
	if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/op-stack/chainConfig.js
const chainConfig$1 = {
	blockTime: 2e3,
	contracts,
	formatters,
	serializers
};
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/arbitrum.js
const arbitrum = /* @__PURE__ */ defineChain({
	id: 42161,
	name: "Arbitrum One",
	nativeCurrency: {
		name: "Ether",
		symbol: "ETH",
		decimals: 18
	},
	blockTime: 250,
	rpcUrls: { default: { http: ["https://arb1.arbitrum.io/rpc"] } },
	blockExplorers: { default: {
		name: "Arbiscan",
		url: "https://arbiscan.io",
		apiUrl: "https://api.arbiscan.io/api"
	} },
	contracts: { multicall3: {
		address: "0xca11bde05977b3631167028862be2a173976ca11",
		blockCreated: 7654707
	} }
});
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/base.js
const sourceId$2 = 1;
const base = /* @__PURE__ */ defineChain({
	...chainConfig$1,
	id: 8453,
	name: "Base",
	nativeCurrency: {
		name: "Ether",
		symbol: "ETH",
		decimals: 18
	},
	rpcUrls: { default: { http: ["https://mainnet.base.org"] } },
	blockExplorers: { default: {
		name: "Basescan",
		url: "https://basescan.org",
		apiUrl: "https://api.basescan.org/api"
	} },
	contracts: {
		...chainConfig$1.contracts,
		disputeGameFactory: { [sourceId$2]: { address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e" } },
		l2OutputOracle: { [sourceId$2]: { address: "0x56315b90c40730925ec5485cf004d835058518A0" } },
		multicall3: {
			address: "0xca11bde05977b3631167028862be2a173976ca11",
			blockCreated: 5022
		},
		portal: { [sourceId$2]: {
			address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
			blockCreated: 17482143
		} },
		l1StandardBridge: { [sourceId$2]: {
			address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
			blockCreated: 17482143
		} }
	},
	sourceId: sourceId$2
});
({ ...base });
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/baseSepolia.js
const sourceId$1 = 11155111;
const baseSepolia = /* @__PURE__ */ defineChain({
	...chainConfig$1,
	id: 84532,
	network: "base-sepolia",
	name: "Base Sepolia",
	nativeCurrency: {
		name: "Sepolia Ether",
		symbol: "ETH",
		decimals: 18
	},
	rpcUrls: { default: { http: ["https://sepolia.base.org"] } },
	blockExplorers: { default: {
		name: "Basescan",
		url: "https://sepolia.basescan.org",
		apiUrl: "https://api-sepolia.basescan.org/api"
	} },
	contracts: {
		...chainConfig$1.contracts,
		disputeGameFactory: { [sourceId$1]: { address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1" } },
		l2OutputOracle: { [sourceId$1]: { address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254" } },
		portal: { [sourceId$1]: {
			address: "0x49f53e41452c74589e85ca1677426ba426459e85",
			blockCreated: 4446677
		} },
		l1StandardBridge: { [sourceId$1]: {
			address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
			blockCreated: 4446677
		} },
		multicall3: {
			address: "0xca11bde05977b3631167028862be2a173976ca11",
			blockCreated: 1059647
		}
	},
	testnet: true,
	sourceId: sourceId$1
});
({ ...baseSepolia });
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/linea/actions/estimateGas.js
/**
* Estimates the gas and fees per gas necessary to complete a transaction without submitting it to the network.
*
* @param client - Client to use
* @param parameters - {@link EstimateGasParameters}
* @returns A gas estimate and fees per gas (in wei). {@link EstimateGasReturnType}
*
* @example
* import { createPublicClient, http, parseEther } from 'viem'
* import { linea } from 'viem/chains'
* import { estimateGas } from 'viem/linea'
*
* const client = createPublicClient({
*   chain: linea,
*   transport: http(),
* })
* const gasEstimate = await estimateGas(client, {
*   account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
*   to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
*   value: 0n,
* })
*/
async function estimateGas(client, args) {
	const { account: account_ = client.account } = args;
	if (!account_) throw new AccountNotFoundError();
	const account = parseAccount(account_);
	try {
		const { accessList, blockNumber, blockTag, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest } = args;
		const block = (typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0) || blockTag;
		assertRequest(args);
		const chainFormat = client.chain?.formatters?.transactionRequest?.format;
		const request = (chainFormat || formatTransactionRequest)({
			...extract(rest, { format: chainFormat }),
			account,
			accessList,
			data,
			gas,
			gasPrice,
			maxFeePerGas,
			maxPriorityFeePerGas,
			nonce,
			to,
			value
		}, "estimateGas");
		const { baseFeePerGas, gasLimit, priorityFeePerGas } = await client.request({
			method: "linea_estimateGas",
			params: block ? [request, block] : [request]
		});
		return {
			baseFeePerGas: BigInt(baseFeePerGas),
			gasLimit: BigInt(gasLimit),
			priorityFeePerGas: BigInt(priorityFeePerGas)
		};
	} catch (err) {
		throw getCallError(err, {
			...args,
			account,
			chain: client.chain
		});
	}
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/linea/chainConfig.js
const chainConfig = { fees: {
	estimateFeesPerGas,
	async maxPriorityFeePerGas({ block, client, request }) {
		const response = await estimateFeesPerGas({
			block,
			client,
			multiply: (x) => x,
			request,
			type: "eip1559"
		});
		if (!response?.maxPriorityFeePerGas) return null;
		return response.maxPriorityFeePerGas;
	}
} };
async function estimateFeesPerGas({ client, multiply, request, type }) {
	try {
		const response = await estimateGas(client, {
			...request,
			account: request?.account
		});
		const { priorityFeePerGas: maxPriorityFeePerGas } = response;
		const maxFeePerGas = multiply(BigInt(response.baseFeePerGas)) + maxPriorityFeePerGas;
		if (type === "legacy") return { gasPrice: maxFeePerGas };
		return {
			maxFeePerGas,
			maxPriorityFeePerGas
		};
	} catch {
		return null;
	}
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/linea.js
const linea = /* @__PURE__ */ defineChain({
	...chainConfig,
	id: 59144,
	name: "Linea Mainnet",
	blockTime: 2e3,
	nativeCurrency: {
		name: "Linea Ether",
		symbol: "ETH",
		decimals: 18
	},
	rpcUrls: { default: {
		http: ["https://rpc.linea.build"],
		webSocket: ["wss://rpc.linea.build"]
	} },
	blockExplorers: { default: {
		name: "Etherscan",
		url: "https://lineascan.build",
		apiUrl: "https://api.lineascan.build/api"
	} },
	contracts: {
		multicall3: {
			address: "0xcA11bde05977b3631167028862bE2a173976CA11",
			blockCreated: 42
		},
		ensRegistry: {
			address: "0x50130b669B28C339991d8676FA73CF122a121267",
			blockCreated: 6682888
		},
		ensUniversalResolver: {
			address: "0x4D41762915F83c76EcaF6776d9b08076aA32b492",
			blockCreated: 22222151
		}
	},
	ensTlds: [".linea.eth"],
	testnet: false
});
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/mainnet.js
const mainnet = /* @__PURE__ */ defineChain({
	id: 1,
	name: "Ethereum",
	nativeCurrency: {
		name: "Ether",
		symbol: "ETH",
		decimals: 18
	},
	blockTime: 12e3,
	rpcUrls: { default: { http: ["https://eth.merkle.io"] } },
	blockExplorers: { default: {
		name: "Etherscan",
		url: "https://etherscan.io",
		apiUrl: "https://api.etherscan.io/api"
	} },
	contracts: {
		ensUniversalResolver: {
			address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee",
			blockCreated: 23085558
		},
		multicall3: {
			address: "0xca11bde05977b3631167028862be2a173976ca11",
			blockCreated: 14353601
		}
	}
});
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/optimism.js
const sourceId = 1;
const optimism = /* @__PURE__ */ defineChain({
	...chainConfig$1,
	id: 10,
	name: "OP Mainnet",
	nativeCurrency: {
		name: "Ether",
		symbol: "ETH",
		decimals: 18
	},
	rpcUrls: { default: { http: ["https://mainnet.optimism.io"] } },
	blockExplorers: { default: {
		name: "Optimism Explorer",
		url: "https://optimistic.etherscan.io",
		apiUrl: "https://api-optimistic.etherscan.io/api"
	} },
	contracts: {
		...chainConfig$1.contracts,
		disputeGameFactory: { [sourceId]: { address: "0xe5965Ab5962eDc7477C8520243A95517CD252fA9" } },
		l2OutputOracle: { [sourceId]: { address: "0xdfe97868233d1aa22e815a266982f2cf17685a27" } },
		multicall3: {
			address: "0xca11bde05977b3631167028862be2a173976ca11",
			blockCreated: 4286263
		},
		portal: { [sourceId]: { address: "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed" } },
		l1StandardBridge: { [sourceId]: { address: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1" } }
	},
	sourceId
});
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/polygon.js
const polygon = /* @__PURE__ */ defineChain({
	id: 137,
	name: "Polygon",
	blockTime: 2e3,
	nativeCurrency: {
		name: "POL",
		symbol: "POL",
		decimals: 18
	},
	rpcUrls: { default: { http: ["https://polygon.drpc.org"] } },
	blockExplorers: { default: {
		name: "PolygonScan",
		url: "https://polygonscan.com",
		apiUrl: "https://api.etherscan.io/v2/api"
	} },
	contracts: { multicall3: {
		address: "0xca11bde05977b3631167028862be2a173976ca11",
		blockCreated: 25770160
	} }
});
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/definitions/sepolia.js
const sepolia = /* @__PURE__ */ defineChain({
	id: 11155111,
	name: "Sepolia",
	nativeCurrency: {
		name: "Sepolia Ether",
		symbol: "ETH",
		decimals: 18
	},
	rpcUrls: { default: { http: ["https://11155111.rpc.thirdweb.com"] } },
	blockExplorers: { default: {
		name: "Etherscan",
		url: "https://sepolia.etherscan.io",
		apiUrl: "https://api-sepolia.etherscan.io/api"
	} },
	contracts: {
		multicall3: {
			address: "0xca11bde05977b3631167028862be2a173976ca11",
			blockCreated: 751532
		},
		ensUniversalResolver: {
			address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee",
			blockCreated: 8928790
		}
	},
	testnet: true
});
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/chains/index.js
var chains_exports = /* @__PURE__ */ __exportAll({
	base: () => base,
	baseSepolia: () => baseSepolia
});
//#endregion
export { mainnet as a, base as c, optimism as i, arbitrum as l, sepolia as n, linea as o, polygon as r, baseSepolia as s, chains_exports as t };

//# sourceMappingURL=chains-Bx4KIVmV.mjs.map