import { Bt as isHex, C as InvalidStorageKeySizeError, F as createCursor, J as isAddress, Q as InvalidAddressError, Rt as BaseError, S as InvalidSerializableTransactionError, U as slice, a as InvalidChainIdError, at as bytesToHex, c as maxUint256, ct as toHex, ft as hexToNumber, ot as numberToHex, pt as trim, q as concatHex, rt as toBytes, tt as hexToBytes, u as FeeCapTooHighError, v as TipAboveFeeCapError, x as InvalidLegacyVError, zt as size } from "./chain-CFT4ZwjV.mjs";
import { t as sha256$2 } from "./sha2-C-CD3oOX.mjs";
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/encoding/toRlp.js
function toRlp(bytes, to = "hex") {
	const encodable = getEncodable(bytes);
	const cursor = createCursor(new Uint8Array(encodable.length));
	encodable.encode(cursor);
	if (to === "hex") return bytesToHex(cursor.bytes);
	return cursor.bytes;
}
function getEncodable(bytes) {
	if (Array.isArray(bytes)) return getEncodableList(bytes.map((x) => getEncodable(x)));
	return getEncodableBytes(bytes);
}
function getEncodableList(list) {
	const bodyLength = list.reduce((acc, x) => acc + x.length, 0);
	const sizeOfBodyLength = getSizeOfLength(bodyLength);
	return {
		length: (() => {
			if (bodyLength <= 55) return 1 + bodyLength;
			return 1 + sizeOfBodyLength + bodyLength;
		})(),
		encode(cursor) {
			if (bodyLength <= 55) cursor.pushByte(192 + bodyLength);
			else {
				cursor.pushByte(247 + sizeOfBodyLength);
				if (sizeOfBodyLength === 1) cursor.pushUint8(bodyLength);
				else if (sizeOfBodyLength === 2) cursor.pushUint16(bodyLength);
				else if (sizeOfBodyLength === 3) cursor.pushUint24(bodyLength);
				else cursor.pushUint32(bodyLength);
			}
			for (const { encode } of list) encode(cursor);
		}
	};
}
function getEncodableBytes(bytesOrHex) {
	const bytes = typeof bytesOrHex === "string" ? hexToBytes(bytesOrHex) : bytesOrHex;
	const sizeOfBytesLength = getSizeOfLength(bytes.length);
	return {
		length: (() => {
			if (bytes.length === 1 && bytes[0] < 128) return 1;
			if (bytes.length <= 55) return 1 + bytes.length;
			return 1 + sizeOfBytesLength + bytes.length;
		})(),
		encode(cursor) {
			if (bytes.length === 1 && bytes[0] < 128) cursor.pushBytes(bytes);
			else if (bytes.length <= 55) {
				cursor.pushByte(128 + bytes.length);
				cursor.pushBytes(bytes);
			} else {
				cursor.pushByte(183 + sizeOfBytesLength);
				if (sizeOfBytesLength === 1) cursor.pushUint8(bytes.length);
				else if (sizeOfBytesLength === 2) cursor.pushUint16(bytes.length);
				else if (sizeOfBytesLength === 3) cursor.pushUint24(bytes.length);
				else cursor.pushUint32(bytes.length);
				cursor.pushBytes(bytes);
			}
		}
	};
}
function getSizeOfLength(length) {
	if (length < 2 ** 8) return 1;
	if (length < 2 ** 16) return 2;
	if (length < 2 ** 24) return 3;
	if (length < 2 ** 32) return 4;
	throw new BaseError("Length is too large.");
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/blob/blobsToCommitments.js
/**
* Compute commitments from a list of blobs.
*
* @example
* ```ts
* import { blobsToCommitments, toBlobs } from 'viem'
* import { kzg } from './kzg'
*
* const blobs = toBlobs({ data: '0x1234' })
* const commitments = blobsToCommitments({ blobs, kzg })
* ```
*/
function blobsToCommitments(parameters) {
	const { kzg } = parameters;
	const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
	const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
	const commitments = [];
	for (const blob of blobs) commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
	return to === "bytes" ? commitments : commitments.map((x) => bytesToHex(x));
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/blob/blobsToProofs.js
/**
* Compute the proofs for a list of blobs and their commitments.
*
* @example
* ```ts
* import {
*   blobsToCommitments,
*   toBlobs
* } from 'viem'
* import { kzg } from './kzg'
*
* const blobs = toBlobs({ data: '0x1234' })
* const commitments = blobsToCommitments({ blobs, kzg })
* const proofs = blobsToProofs({ blobs, commitments, kzg })
* ```
*/
function blobsToProofs(parameters) {
	const { kzg } = parameters;
	const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
	const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
	const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes(x)) : parameters.commitments;
	const proofs = [];
	for (let i = 0; i < blobs.length; i++) {
		const blob = blobs[i];
		const commitment = commitments[i];
		proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
	}
	return to === "bytes" ? proofs : proofs.map((x) => bytesToHex(x));
}
//#endregion
//#region node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js
/**
* SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
*
* To break sha256 using birthday attack, attackers need to try 2^128 hashes.
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
*
* Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
* @module
* @deprecated
*/
/** @deprecated Use import from `noble/hashes/sha2` module */
const sha256$1 = sha256$2;
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/hash/sha256.js
function sha256(value, to_) {
	const to = to_ || "hex";
	const bytes = sha256$1(isHex(value, { strict: false }) ? toBytes(value) : value);
	if (to === "bytes") return bytes;
	return toHex(bytes);
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
/**
* Transform a commitment to it's versioned hash.
*
* @example
* ```ts
* import {
*   blobsToCommitments,
*   commitmentToVersionedHash,
*   toBlobs
* } from 'viem'
* import { kzg } from './kzg'
*
* const blobs = toBlobs({ data: '0x1234' })
* const [commitment] = blobsToCommitments({ blobs, kzg })
* const versionedHash = commitmentToVersionedHash({ commitment })
* ```
*/
function commitmentToVersionedHash(parameters) {
	const { commitment, version = 1 } = parameters;
	const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
	const versionedHash = sha256(commitment, "bytes");
	versionedHash.set([version], 0);
	return to === "bytes" ? versionedHash : bytesToHex(versionedHash);
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js
/**
* Transform a list of commitments to their versioned hashes.
*
* @example
* ```ts
* import {
*   blobsToCommitments,
*   commitmentsToVersionedHashes,
*   toBlobs
* } from 'viem'
* import { kzg } from './kzg'
*
* const blobs = toBlobs({ data: '0x1234' })
* const commitments = blobsToCommitments({ blobs, kzg })
* const versionedHashes = commitmentsToVersionedHashes({ commitments })
* ```
*/
function commitmentsToVersionedHashes(parameters) {
	const { commitments, version } = parameters;
	const to = parameters.to ?? (typeof commitments[0] === "string" ? "hex" : "bytes");
	const hashes = [];
	for (const commitment of commitments) hashes.push(commitmentToVersionedHash({
		commitment,
		to,
		version
	}));
	return hashes;
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/constants/blob.js
/** Blob limit per transaction. */
const blobsPerTransaction = 6;
/** The number of field elements in a blob. */
const fieldElementsPerBlob = 4096;
/** The number of bytes in a blob. */
const bytesPerBlob = 32 * fieldElementsPerBlob;
/** Blob bytes limit per transaction. */
const maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - 1 - 1 * fieldElementsPerBlob * blobsPerTransaction;
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/errors/blob.js
var BlobSizeTooLargeError = class extends BaseError {
	constructor({ maxSize, size }) {
		super("Blob size is too large.", {
			metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size} bytes`],
			name: "BlobSizeTooLargeError"
		});
	}
};
var EmptyBlobError = class extends BaseError {
	constructor() {
		super("Blob data must not be empty.", { name: "EmptyBlobError" });
	}
};
var InvalidVersionedHashSizeError = class extends BaseError {
	constructor({ hash, size }) {
		super(`Versioned hash "${hash}" size is invalid.`, {
			metaMessages: ["Expected: 32", `Received: ${size}`],
			name: "InvalidVersionedHashSizeError"
		});
	}
};
var InvalidVersionedHashVersionError = class extends BaseError {
	constructor({ hash, version }) {
		super(`Versioned hash "${hash}" version is invalid.`, {
			metaMessages: [`Expected: 1`, `Received: ${version}`],
			name: "InvalidVersionedHashVersionError"
		});
	}
};
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/blob/toBlobs.js
/**
* Transforms arbitrary data to blobs.
*
* @example
* ```ts
* import { toBlobs, stringToHex } from 'viem'
*
* const blobs = toBlobs({ data: stringToHex('hello world') })
* ```
*/
function toBlobs(parameters) {
	const to = parameters.to ?? (typeof parameters.data === "string" ? "hex" : "bytes");
	const data = typeof parameters.data === "string" ? hexToBytes(parameters.data) : parameters.data;
	const size_ = size(data);
	if (!size_) throw new EmptyBlobError();
	if (size_ > 761855) throw new BlobSizeTooLargeError({
		maxSize: maxBytesPerTransaction,
		size: size_
	});
	const blobs = [];
	let active = true;
	let position = 0;
	while (active) {
		const blob = createCursor(new Uint8Array(bytesPerBlob));
		let size = 0;
		while (size < fieldElementsPerBlob) {
			const bytes = data.slice(position, position + 31);
			blob.pushByte(0);
			blob.pushBytes(bytes);
			if (bytes.length < 31) {
				blob.pushByte(128);
				active = false;
				break;
			}
			size++;
			position += 31;
		}
		blobs.push(blob);
	}
	return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex(x.bytes));
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/blob/toBlobSidecars.js
/**
* Transforms arbitrary data (or blobs, commitments, & proofs) into a sidecar array.
*
* @example
* ```ts
* import { toBlobSidecars, stringToHex } from 'viem'
*
* const sidecars = toBlobSidecars({ data: stringToHex('hello world') })
* ```
*
* @example
* ```ts
* import {
*   blobsToCommitments,
*   toBlobs,
*   blobsToProofs,
*   toBlobSidecars,
*   stringToHex
* } from 'viem'
*
* const blobs = toBlobs({ data: stringToHex('hello world') })
* const commitments = blobsToCommitments({ blobs, kzg })
* const proofs = blobsToProofs({ blobs, commitments, kzg })
*
* const sidecars = toBlobSidecars({ blobs, commitments, proofs })
* ```
*/
function toBlobSidecars(parameters) {
	const { data, kzg, to } = parameters;
	const blobs = parameters.blobs ?? toBlobs({
		data,
		to
	});
	const commitments = parameters.commitments ?? blobsToCommitments({
		blobs,
		kzg,
		to
	});
	const proofs = parameters.proofs ?? blobsToProofs({
		blobs,
		commitments,
		kzg,
		to
	});
	const sidecars = [];
	for (let i = 0; i < blobs.length; i++) sidecars.push({
		blob: blobs[i],
		commitment: commitments[i],
		proof: proofs[i]
	});
	return sidecars;
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/transaction/getTransactionType.js
function getTransactionType(transaction) {
	if (transaction.type) return transaction.type;
	if (typeof transaction.authorizationList !== "undefined") return "eip7702";
	if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined") return "eip4844";
	if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") return "eip1559";
	if (typeof transaction.gasPrice !== "undefined") {
		if (typeof transaction.accessList !== "undefined") return "eip2930";
		return "legacy";
	}
	throw new InvalidSerializableTransactionError({ transaction });
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/transaction/assertTransaction.js
function assertTransactionEIP7702(transaction) {
	const { authorizationList } = transaction;
	if (authorizationList) for (const authorization of authorizationList) {
		const { chainId } = authorization;
		const address = authorization.address;
		if (!isAddress(address)) throw new InvalidAddressError({ address });
		if (chainId < 0) throw new InvalidChainIdError({ chainId });
	}
	assertTransactionEIP1559(transaction);
}
function assertTransactionEIP4844(transaction) {
	const { blobVersionedHashes } = transaction;
	if (blobVersionedHashes) {
		if (blobVersionedHashes.length === 0) throw new EmptyBlobError();
		for (const hash of blobVersionedHashes) {
			const size_ = size(hash);
			const version = hexToNumber(slice(hash, 0, 1));
			if (size_ !== 32) throw new InvalidVersionedHashSizeError({
				hash,
				size: size_
			});
			if (version !== 1) throw new InvalidVersionedHashVersionError({
				hash,
				version
			});
		}
	}
	assertTransactionEIP1559(transaction);
}
function assertTransactionEIP1559(transaction) {
	const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction;
	if (chainId <= 0) throw new InvalidChainIdError({ chainId });
	if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
	if (maxFeePerGas && maxFeePerGas > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas });
	if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas) throw new TipAboveFeeCapError({
		maxFeePerGas,
		maxPriorityFeePerGas
	});
}
function assertTransactionEIP2930(transaction) {
	const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
	if (chainId <= 0) throw new InvalidChainIdError({ chainId });
	if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
	if (maxPriorityFeePerGas || maxFeePerGas) throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
	if (gasPrice && gasPrice > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
}
function assertTransactionLegacy(transaction) {
	const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
	if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
	if (typeof chainId !== "undefined" && chainId <= 0) throw new InvalidChainIdError({ chainId });
	if (maxPriorityFeePerGas || maxFeePerGas) throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
	if (gasPrice && gasPrice > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/transaction/serializeAccessList.js
function serializeAccessList(accessList) {
	if (!accessList || accessList.length === 0) return [];
	const serializedAccessList = [];
	for (let i = 0; i < accessList.length; i++) {
		const { address, storageKeys } = accessList[i];
		for (let j = 0; j < storageKeys.length; j++) if (storageKeys[j].length - 2 !== 64) throw new InvalidStorageKeySizeError({ storageKey: storageKeys[j] });
		if (!isAddress(address, { strict: false })) throw new InvalidAddressError({ address });
		serializedAccessList.push([address, storageKeys]);
	}
	return serializedAccessList;
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/transaction/serializeTransaction.js
function serializeTransaction(transaction, signature) {
	const type = getTransactionType(transaction);
	if (type === "eip1559") return serializeTransactionEIP1559(transaction, signature);
	if (type === "eip2930") return serializeTransactionEIP2930(transaction, signature);
	if (type === "eip4844") return serializeTransactionEIP4844(transaction, signature);
	if (type === "eip7702") return serializeTransactionEIP7702(transaction, signature);
	return serializeTransactionLegacy(transaction, signature);
}
function serializeTransactionEIP7702(transaction, signature) {
	const { authorizationList, chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
	assertTransactionEIP7702(transaction);
	const serializedAccessList = serializeAccessList(accessList);
	const serializedAuthorizationList = serializeAuthorizationList(authorizationList);
	return concatHex(["0x04", toRlp([
		numberToHex(chainId),
		nonce ? numberToHex(nonce) : "0x",
		maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
		maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
		gas ? numberToHex(gas) : "0x",
		to ?? "0x",
		value ? numberToHex(value) : "0x",
		data ?? "0x",
		serializedAccessList,
		serializedAuthorizationList,
		...toYParitySignatureArray(transaction, signature)
	])]);
}
function serializeTransactionEIP4844(transaction, signature) {
	const { chainId, gas, nonce, to, value, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
	assertTransactionEIP4844(transaction);
	let blobVersionedHashes = transaction.blobVersionedHashes;
	let sidecars = transaction.sidecars;
	if (transaction.blobs && (typeof blobVersionedHashes === "undefined" || typeof sidecars === "undefined")) {
		const blobs = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex(x));
		const kzg = transaction.kzg;
		const commitments = blobsToCommitments({
			blobs,
			kzg
		});
		if (typeof blobVersionedHashes === "undefined") blobVersionedHashes = commitmentsToVersionedHashes({ commitments });
		if (typeof sidecars === "undefined") sidecars = toBlobSidecars({
			blobs,
			commitments,
			proofs: blobsToProofs({
				blobs,
				commitments,
				kzg
			})
		});
	}
	const serializedAccessList = serializeAccessList(accessList);
	const serializedTransaction = [
		numberToHex(chainId),
		nonce ? numberToHex(nonce) : "0x",
		maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
		maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
		gas ? numberToHex(gas) : "0x",
		to ?? "0x",
		value ? numberToHex(value) : "0x",
		data ?? "0x",
		serializedAccessList,
		maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : "0x",
		blobVersionedHashes ?? [],
		...toYParitySignatureArray(transaction, signature)
	];
	const blobs = [];
	const commitments = [];
	const proofs = [];
	if (sidecars) for (let i = 0; i < sidecars.length; i++) {
		const { blob, commitment, proof } = sidecars[i];
		blobs.push(blob);
		commitments.push(commitment);
		proofs.push(proof);
	}
	return concatHex(["0x03", sidecars ? toRlp([
		serializedTransaction,
		blobs,
		commitments,
		proofs
	]) : toRlp(serializedTransaction)]);
}
function serializeTransactionEIP1559(transaction, signature) {
	const { chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
	assertTransactionEIP1559(transaction);
	const serializedAccessList = serializeAccessList(accessList);
	return concatHex(["0x02", toRlp([
		numberToHex(chainId),
		nonce ? numberToHex(nonce) : "0x",
		maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
		maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
		gas ? numberToHex(gas) : "0x",
		to ?? "0x",
		value ? numberToHex(value) : "0x",
		data ?? "0x",
		serializedAccessList,
		...toYParitySignatureArray(transaction, signature)
	])]);
}
function serializeTransactionEIP2930(transaction, signature) {
	const { chainId, gas, data, nonce, to, value, accessList, gasPrice } = transaction;
	assertTransactionEIP2930(transaction);
	const serializedAccessList = serializeAccessList(accessList);
	return concatHex(["0x01", toRlp([
		numberToHex(chainId),
		nonce ? numberToHex(nonce) : "0x",
		gasPrice ? numberToHex(gasPrice) : "0x",
		gas ? numberToHex(gas) : "0x",
		to ?? "0x",
		value ? numberToHex(value) : "0x",
		data ?? "0x",
		serializedAccessList,
		...toYParitySignatureArray(transaction, signature)
	])]);
}
function serializeTransactionLegacy(transaction, signature) {
	const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
	assertTransactionLegacy(transaction);
	let serializedTransaction = [
		nonce ? numberToHex(nonce) : "0x",
		gasPrice ? numberToHex(gasPrice) : "0x",
		gas ? numberToHex(gas) : "0x",
		to ?? "0x",
		value ? numberToHex(value) : "0x",
		data ?? "0x"
	];
	if (signature) {
		const v = (() => {
			if (signature.v >= 35n) {
				if ((signature.v - 35n) / 2n > 0) return signature.v;
				return 27n + (signature.v === 35n ? 0n : 1n);
			}
			if (chainId > 0) return BigInt(chainId * 2) + BigInt(35n + signature.v - 27n);
			const v = 27n + (signature.v === 27n ? 0n : 1n);
			if (signature.v !== v) throw new InvalidLegacyVError({ v: signature.v });
			return v;
		})();
		const r = trim(signature.r);
		const s = trim(signature.s);
		serializedTransaction = [
			...serializedTransaction,
			numberToHex(v),
			r === "0x00" ? "0x" : r,
			s === "0x00" ? "0x" : s
		];
	} else if (chainId > 0) serializedTransaction = [
		...serializedTransaction,
		numberToHex(chainId),
		"0x",
		"0x"
	];
	return toRlp(serializedTransaction);
}
function toYParitySignatureArray(transaction, signature_) {
	const signature = signature_ ?? transaction;
	const { v, yParity } = signature;
	if (typeof signature.r === "undefined") return [];
	if (typeof signature.s === "undefined") return [];
	if (typeof v === "undefined" && typeof yParity === "undefined") return [];
	const r = trim(signature.r);
	const s = trim(signature.s);
	return [
		(() => {
			if (typeof yParity === "number") return yParity ? numberToHex(1) : "0x";
			if (v === 0n) return "0x";
			if (v === 1n) return numberToHex(1);
			return v === 27n ? "0x" : numberToHex(1);
		})(),
		r === "0x00" ? "0x" : r,
		s === "0x00" ? "0x" : s
	];
}
//#endregion
//#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js
function serializeAuthorizationList(authorizationList) {
	if (!authorizationList || authorizationList.length === 0) return [];
	const serializedAuthorizationList = [];
	for (const authorization of authorizationList) {
		const { chainId, nonce, ...signature } = authorization;
		const contractAddress = authorization.address;
		serializedAuthorizationList.push([
			chainId ? toHex(chainId) : "0x",
			contractAddress,
			nonce ? toHex(nonce) : "0x",
			...toYParitySignatureArray({}, signature)
		]);
	}
	return serializedAuthorizationList;
}
//#endregion
export { blobsToProofs as a, commitmentsToVersionedHashes as i, getTransactionType as n, blobsToCommitments as o, toBlobSidecars as r, toRlp as s, serializeTransaction as t };

//# sourceMappingURL=serializeAuthorizationList-BmtEpRnQ.mjs.map