import { M as formatUnits } from "./chain-dTUyiOxD.mjs";
import { c as base, s as baseSepolia } from "./chains-DtOuO1lR.mjs";
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/errors.js
/**
* Clawncher SDK - Structured Error Codes
*
* Provides machine-readable error codes for programmatic error handling.
* All SDK errors use ClawnchDeployError with a specific ClawnchErrorCode,
* making it easy to handle different failure modes in automation.
*/
/**
* Error codes for all SDK operations
*/
var ClawnchErrorCode;
(function(ClawnchErrorCode) {
	ClawnchErrorCode["INVALID_BPS"] = "INVALID_BPS";
	ClawnchErrorCode["INVALID_NAME"] = "INVALID_NAME";
	ClawnchErrorCode["INVALID_SYMBOL"] = "INVALID_SYMBOL";
	ClawnchErrorCode["INVALID_ADDRESS"] = "INVALID_ADDRESS";
	ClawnchErrorCode["WALLET_NOT_CONFIGURED"] = "WALLET_NOT_CONFIGURED";
	ClawnchErrorCode["PUBLIC_CLIENT_NOT_CONFIGURED"] = "PUBLIC_CLIENT_NOT_CONFIGURED";
	ClawnchErrorCode["DEPLOY_FAILED"] = "DEPLOY_FAILED";
	ClawnchErrorCode["TX_REVERTED"] = "TX_REVERTED";
	ClawnchErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
	ClawnchErrorCode["CLAIM_FAILED"] = "CLAIM_FAILED";
	ClawnchErrorCode["NO_FEES_AVAILABLE"] = "NO_FEES_AVAILABLE";
	ClawnchErrorCode["FEATURE_NOT_AVAILABLE"] = "FEATURE_NOT_AVAILABLE";
	ClawnchErrorCode["INVALID_CHAIN"] = "INVALID_CHAIN";
	ClawnchErrorCode["RPC_ERROR"] = "RPC_ERROR";
	ClawnchErrorCode["TIMEOUT"] = "TIMEOUT";
	ClawnchErrorCode["HERD_UNAVAILABLE"] = "HERD_UNAVAILABLE";
})(ClawnchErrorCode || (ClawnchErrorCode = {}));
/**
* Structured error class for Clawncher SDK operations
*
* @example
* ```typescript
* try {
*   const result = await deployer.deploy(options);
* } catch (err) {
*   if (err instanceof ClawnchDeployError) {
*     switch (err.code) {
*       case ClawnchErrorCode.WALLET_NOT_CONFIGURED:
*         console.log('Please configure a wallet');
*         break;
*       case ClawnchErrorCode.INVALID_BPS:
*         console.log('Fix your reward BPS:', err.message);
*         break;
*       case ClawnchErrorCode.DEPLOY_FAILED:
*         console.log('Deployment failed:', err.message);
*         if (err.cause) console.log('Caused by:', err.cause);
*         break;
*     }
*   }
* }
* ```
*/
var ClawnchDeployError = class extends Error {
	code;
	cause;
	name = "ClawnchDeployError";
	constructor(code, message, cause) {
		super(message);
		this.code = code;
		this.cause = cause;
	}
};
/**
* Retry an async operation with exponential backoff.
*
* Only retries on transient errors (network timeouts, 5xx, RPC errors).
* Validation errors, 4xx, and feature-not-available are never retried.
*
* @param fn - Async function to retry
* @param maxRetries - Maximum number of retries (default: 2, so 3 total attempts)
* @param baseDelayMs - Base delay in ms between retries (default: 1000)
* @returns Result of the function
*/
async function withRetry(fn, maxRetries = 2, baseDelayMs = 1e3) {
	let lastError;
	for (let attempt = 0; attempt <= maxRetries; attempt++) try {
		return await fn();
	} catch (err) {
		lastError = err;
		if (err instanceof ClawnchDeployError) {
			if ([
				ClawnchErrorCode.INVALID_BPS,
				ClawnchErrorCode.INVALID_NAME,
				ClawnchErrorCode.INVALID_SYMBOL,
				ClawnchErrorCode.INVALID_ADDRESS,
				ClawnchErrorCode.WALLET_NOT_CONFIGURED,
				ClawnchErrorCode.PUBLIC_CLIENT_NOT_CONFIGURED,
				ClawnchErrorCode.FEATURE_NOT_AVAILABLE,
				ClawnchErrorCode.INVALID_CHAIN,
				ClawnchErrorCode.INSUFFICIENT_FUNDS
			].includes(err.code)) throw err;
		}
		if (attempt === maxRetries) break;
		const delay = baseDelayMs * Math.pow(2, attempt);
		await new Promise((resolve) => setTimeout(resolve, delay));
	}
	throw lastError;
}
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/addresses.js
/**
* Clawncher Contract Addresses (v3 - Clanker-backed)
*
* In v3, Clawncher deploys through Clanker's approved Uniswap V4 infrastructure.
* These addresses point to Clanker's contracts on Base networks.
*
* Our own v2 contracts are preserved in packages/sdk-direct for when our
* Uniswap V4 hook is approved.
*/
/**
* Base Sepolia (testnet) addresses - Clanker's Sepolia deployment
*/
const SEPOLIA_ADDRESSES = {
	clawnch: {
		factory: "0xE85A59c628F7d27878ACeB4bf3b35733630083a9",
		hook: "0x11b51DBC2f7F683b81CeDa83DC0078D57bA328cc",
		locker: "0x824bB048a5EC6e06a09aEd115E9eEA4618DC2c8f",
		feeLocker: "0x42A95190B4088C88Dd904d930c79deC1158bF09D",
		mevModule: "0x261fE99C4D0D41EE8d0e594D11aec740E8354ab0",
		vault: "0xcC80d1226F899a78fC2E459a1500A13C373CE0A5",
		airdropV2: "0x5c68F1560a5913c176Fc5238038098970B567B19",
		devBuy: "0x691f97752E91feAcD7933F32a1FEdCeDae7bB59c",
		vestedDevBuy: "0x0000000000000000000000000000000000000000",
		poolExtensionAllowlist: "0x0000000000000000000000000000000000000000"
	},
	infrastructure: {
		poolManager: "0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408",
		positionManager: "0x4B2C77d209D3405F41a037Ec6c77F7F5b8e2ca80",
		permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
		universalRouter: "0x492E6456D9528771018DeB9E87ef7750EF184104",
		weth: "0x4200000000000000000000000000000000000006"
	}
};
/**
* Base Mainnet addresses - Clanker's v4 deployment
*/
const MAINNET_ADDRESSES = {
	clawnch: {
		factory: "0xE85A59c628F7d27878ACeB4bf3b35733630083a9",
		hook: "0xb429d62f8f3bFFb98CdB9569533eA23bF0Ba28CC",
		locker: "0x63D2DfEA64b3433F4071A98665bcD7Ca14d93496",
		feeLocker: "0xF3622742b1E446D92e45E22923Ef11C2fcD55D68",
		mevModule: "0xebB25BB797D82CB78E1bc70406b13233c0854413",
		vault: "0x8E845EAd15737bF71904A30BdDD3aEE76d6ADF6C",
		airdropV2: "0xf652B3610D75D81871bf96DB50825d9af28391E0",
		devBuy: "0x1331f0788F9c08C8F38D52c7a1752250A9dE00be",
		vestedDevBuy: "0x0000000000000000000000000000000000000000",
		poolExtensionAllowlist: "0x0000000000000000000000000000000000000000"
	},
	infrastructure: {
		poolManager: "0x498581fF718922c3f8e6A244956aF099B2652b2b",
		positionManager: "0x7C5f5A4bBd8fD63184577525326123B519429bDc",
		permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
		universalRouter: "0x6fF5693b99212Da76ad316178A184AB56D299b43",
		weth: "0x4200000000000000000000000000000000000006"
	}
};
function getAddresses(network) {
	switch (network) {
		case "mainnet": return MAINNET_ADDRESSES;
		case "sepolia": return SEPOLIA_ADDRESSES;
		default: throw new Error(`Unknown network: ${network}`);
	}
}
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/abis.js
/**
* Clawncher Contract ABIs
*
* Minimal ABIs for SDK functionality. UI builders may need full ABIs
* which can be generated from contract compilation.
*/
const ClawnchFactoryABI = [
	{
		inputs: [{
			components: [
				{
					components: [
						{
							internalType: "address",
							name: "tokenAdmin",
							type: "address"
						},
						{
							internalType: "string",
							name: "name",
							type: "string"
						},
						{
							internalType: "string",
							name: "symbol",
							type: "string"
						},
						{
							internalType: "bytes32",
							name: "salt",
							type: "bytes32"
						},
						{
							internalType: "string",
							name: "image",
							type: "string"
						},
						{
							internalType: "string",
							name: "metadata",
							type: "string"
						},
						{
							internalType: "string",
							name: "context",
							type: "string"
						},
						{
							internalType: "uint256",
							name: "originatingChainId",
							type: "uint256"
						}
					],
					internalType: "struct IClawnch.TokenConfig",
					name: "tokenConfig",
					type: "tuple"
				},
				{
					components: [
						{
							internalType: "address",
							name: "hook",
							type: "address"
						},
						{
							internalType: "address",
							name: "pairedToken",
							type: "address"
						},
						{
							internalType: "int24",
							name: "tickIfToken0IsClawnch",
							type: "int24"
						},
						{
							internalType: "int24",
							name: "tickSpacing",
							type: "int24"
						},
						{
							internalType: "bytes",
							name: "poolData",
							type: "bytes"
						}
					],
					internalType: "struct IClawnch.PoolConfig",
					name: "poolConfig",
					type: "tuple"
				},
				{
					components: [
						{
							internalType: "address",
							name: "locker",
							type: "address"
						},
						{
							internalType: "address[]",
							name: "rewardAdmins",
							type: "address[]"
						},
						{
							internalType: "address[]",
							name: "rewardRecipients",
							type: "address[]"
						},
						{
							internalType: "uint16[]",
							name: "rewardBps",
							type: "uint16[]"
						},
						{
							internalType: "int24[]",
							name: "tickLower",
							type: "int24[]"
						},
						{
							internalType: "int24[]",
							name: "tickUpper",
							type: "int24[]"
						},
						{
							internalType: "uint16[]",
							name: "positionBps",
							type: "uint16[]"
						},
						{
							internalType: "bytes",
							name: "lockerData",
							type: "bytes"
						}
					],
					internalType: "struct IClawnch.LockerConfig",
					name: "lockerConfig",
					type: "tuple"
				},
				{
					components: [{
						internalType: "address",
						name: "mevModule",
						type: "address"
					}, {
						internalType: "bytes",
						name: "mevModuleData",
						type: "bytes"
					}],
					internalType: "struct IClawnch.MevModuleConfig",
					name: "mevModuleConfig",
					type: "tuple"
				},
				{
					components: [
						{
							internalType: "address",
							name: "extension",
							type: "address"
						},
						{
							internalType: "uint256",
							name: "msgValue",
							type: "uint256"
						},
						{
							internalType: "uint16",
							name: "extensionBps",
							type: "uint16"
						},
						{
							internalType: "bytes",
							name: "extensionData",
							type: "bytes"
						}
					],
					internalType: "struct IClawnch.ExtensionConfig[]",
					name: "extensionConfigs",
					type: "tuple[]"
				}
			],
			internalType: "struct IClawnch.DeploymentConfig",
			name: "deploymentConfig",
			type: "tuple"
		}],
		name: "deployToken",
		outputs: [{
			internalType: "address",
			name: "tokenAddress",
			type: "address"
		}],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "tokenDeploymentInfo",
		outputs: [{
			components: [
				{
					internalType: "address",
					name: "token",
					type: "address"
				},
				{
					internalType: "address",
					name: "hook",
					type: "address"
				},
				{
					internalType: "address",
					name: "locker",
					type: "address"
				},
				{
					internalType: "address[]",
					name: "extensions",
					type: "address[]"
				}
			],
			internalType: "struct IClawnch.DeploymentInfo",
			name: "",
			type: "tuple"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "deprecated",
		outputs: [{
			internalType: "bool",
			name: "",
			type: "bool"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		anonymous: false,
		inputs: [
			{
				indexed: false,
				internalType: "address",
				name: "msgSender",
				type: "address"
			},
			{
				indexed: true,
				internalType: "address",
				name: "tokenAddress",
				type: "address"
			},
			{
				indexed: true,
				internalType: "address",
				name: "tokenAdmin",
				type: "address"
			},
			{
				indexed: false,
				internalType: "string",
				name: "tokenImage",
				type: "string"
			},
			{
				indexed: false,
				internalType: "string",
				name: "tokenName",
				type: "string"
			},
			{
				indexed: false,
				internalType: "string",
				name: "tokenSymbol",
				type: "string"
			},
			{
				indexed: false,
				internalType: "string",
				name: "tokenMetadata",
				type: "string"
			},
			{
				indexed: false,
				internalType: "string",
				name: "tokenContext",
				type: "string"
			},
			{
				indexed: false,
				internalType: "int24",
				name: "startingTick",
				type: "int24"
			},
			{
				indexed: false,
				internalType: "address",
				name: "poolHook",
				type: "address"
			},
			{
				indexed: false,
				internalType: "bytes32",
				name: "poolId",
				type: "bytes32"
			},
			{
				indexed: false,
				internalType: "address",
				name: "pairedToken",
				type: "address"
			},
			{
				indexed: false,
				internalType: "address",
				name: "locker",
				type: "address"
			},
			{
				indexed: false,
				internalType: "address",
				name: "mevModule",
				type: "address"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "extensionsSupply",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "address[]",
				name: "extensions",
				type: "address[]"
			}
		],
		name: "TokenCreated",
		type: "event"
	}
];
const ClawnchFeeLockerABI = [{
	inputs: [{
		internalType: "address",
		name: "feeOwner",
		type: "address"
	}, {
		internalType: "address",
		name: "token",
		type: "address"
	}],
	name: "availableFees",
	outputs: [{
		internalType: "uint256",
		name: "",
		type: "uint256"
	}],
	stateMutability: "view",
	type: "function"
}, {
	inputs: [{
		internalType: "address",
		name: "feeOwner",
		type: "address"
	}, {
		internalType: "address",
		name: "token",
		type: "address"
	}],
	name: "claim",
	outputs: [],
	stateMutability: "nonpayable",
	type: "function"
}];
const ClawnchLpLockerABI = [{
	inputs: [{
		internalType: "address",
		name: "token",
		type: "address"
	}],
	name: "collectRewards",
	outputs: [],
	stateMutability: "nonpayable",
	type: "function"
}, {
	inputs: [{
		internalType: "address",
		name: "token",
		type: "address"
	}],
	name: "tokenRewards",
	outputs: [{
		components: [
			{
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				components: [
					{
						internalType: "address",
						name: "currency0",
						type: "address"
					},
					{
						internalType: "address",
						name: "currency1",
						type: "address"
					},
					{
						internalType: "uint24",
						name: "fee",
						type: "uint24"
					},
					{
						internalType: "int24",
						name: "tickSpacing",
						type: "int24"
					},
					{
						internalType: "address",
						name: "hooks",
						type: "address"
					}
				],
				internalType: "struct PoolKey",
				name: "poolKey",
				type: "tuple"
			},
			{
				internalType: "uint256",
				name: "positionId",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "numPositions",
				type: "uint256"
			},
			{
				internalType: "uint16[]",
				name: "rewardBps",
				type: "uint16[]"
			},
			{
				internalType: "address[]",
				name: "rewardAdmins",
				type: "address[]"
			},
			{
				internalType: "address[]",
				name: "rewardRecipients",
				type: "address[]"
			}
		],
		internalType: "struct IClawnchLpLocker.TokenRewardInfo",
		name: "",
		type: "tuple"
	}],
	stateMutability: "view",
	type: "function"
}];
const ERC20ABI = [
	{
		inputs: [{
			internalType: "address",
			name: "account",
			type: "address"
		}],
		name: "balanceOf",
		outputs: [{
			internalType: "uint256",
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "totalSupply",
		outputs: [{
			internalType: "uint256",
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "name",
		outputs: [{
			internalType: "string",
			name: "",
			type: "string"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "symbol",
		outputs: [{
			internalType: "string",
			name: "",
			type: "string"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "decimals",
		outputs: [{
			internalType: "uint8",
			name: "",
			type: "uint8"
		}],
		stateMutability: "view",
		type: "function"
	}
];
/**
* ClawnchVault ABI - Read vault allocation data
*/
const ClawnchVaultABI = [
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "allocation",
		outputs: [
			{
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				internalType: "uint256",
				name: "amountTotal",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "amountClaimed",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "lockupEndTime",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "vestingEndTime",
				type: "uint256"
			},
			{
				internalType: "address",
				name: "admin",
				type: "address"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "amountAvailableToClaim",
		outputs: [{
			internalType: "uint256",
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "claim",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}, {
			internalType: "address",
			name: "newAdmin",
			type: "address"
		}],
		name: "editAllocationAdmin",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		anonymous: false,
		inputs: [
			{
				indexed: true,
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				indexed: false,
				internalType: "address",
				name: "admin",
				type: "address"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "supply",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "lockupDuration",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "vestingDuration",
				type: "uint256"
			}
		],
		name: "AllocationCreated",
		type: "event"
	},
	{
		anonymous: false,
		inputs: [
			{
				indexed: true,
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "amountClaimed",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "amountRemaining",
				type: "uint256"
			}
		],
		name: "AllocationClaimed",
		type: "event"
	}
];
/**
* ClawncherVestedDevBuy ABI - Read vested dev buy allocation data
*/
const ClawncherVestedDevBuyABI = [
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "allocation",
		outputs: [
			{
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				internalType: "uint256",
				name: "amountTotal",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "amountClaimed",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "lockupEndTime",
				type: "uint256"
			},
			{
				internalType: "uint256",
				name: "vestingEndTime",
				type: "uint256"
			},
			{
				internalType: "address",
				name: "admin",
				type: "address"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "amountAvailableToClaim",
		outputs: [{
			internalType: "uint256",
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}],
		name: "claim",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			internalType: "address",
			name: "token",
			type: "address"
		}, {
			internalType: "address",
			name: "newAdmin",
			type: "address"
		}],
		name: "editAllocationAdmin",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		anonymous: false,
		inputs: [
			{
				indexed: true,
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				indexed: true,
				internalType: "address",
				name: "recipient",
				type: "address"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "ethAmount",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "tokenAmount",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "lockupDuration",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "vestingDuration",
				type: "uint256"
			}
		],
		name: "VestedDevBuy",
		type: "event"
	},
	{
		anonymous: false,
		inputs: [
			{
				indexed: true,
				internalType: "address",
				name: "token",
				type: "address"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "amountClaimed",
				type: "uint256"
			},
			{
				indexed: false,
				internalType: "uint256",
				name: "amountRemaining",
				type: "uint256"
			}
		],
		name: "AllocationClaimed",
		type: "event"
	}
];
/**
* ClawnchMevDescendingFees ABI - Read MEV protection config
*
* Contract function names:
*   feeConfig(bytes32 poolId) - not mevConfig(address)
*   getFee(bytes32 poolId) - not currentFee(address)
*   poolStartTime(bytes32 poolId) - start time for decay calculation
*
* PoolId is bytes32 (Uniswap V4 pool identifier).
* Decay end = poolStartTime + feeConfig.secondsToDecay
*/
const ClawnchMevModuleABI = [
	{
		inputs: [{
			internalType: "PoolId",
			name: "poolId",
			type: "bytes32"
		}],
		name: "feeConfig",
		outputs: [
			{
				internalType: "uint24",
				name: "startingFee",
				type: "uint24"
			},
			{
				internalType: "uint24",
				name: "endingFee",
				type: "uint24"
			},
			{
				internalType: "uint256",
				name: "secondsToDecay",
				type: "uint256"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			internalType: "PoolId",
			name: "poolId",
			type: "bytes32"
		}],
		name: "poolStartTime",
		outputs: [{
			internalType: "uint256",
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			internalType: "PoolId",
			name: "poolId",
			type: "bytes32"
		}],
		name: "getFee",
		outputs: [{
			internalType: "uint24",
			name: "",
			type: "uint24"
		}],
		stateMutability: "view",
		type: "function"
	}
];
/**
* ClawnchToken ABI - Read token-specific data (admin, metadata)
*
* Contract function names:
*   admin() - not tokenAdmin()
*   imageUrl() - not image()
*   allData() - returns all metadata in one call
*/
const ClawnchTokenABI = [
	...ERC20ABI,
	{
		inputs: [],
		name: "admin",
		outputs: [{
			internalType: "address",
			name: "",
			type: "address"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "originalAdmin",
		outputs: [{
			internalType: "address",
			name: "",
			type: "address"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "imageUrl",
		outputs: [{
			internalType: "string",
			name: "",
			type: "string"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "metadata",
		outputs: [{
			internalType: "string",
			name: "",
			type: "string"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "context",
		outputs: [{
			internalType: "string",
			name: "",
			type: "string"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [],
		name: "allData",
		outputs: [
			{
				internalType: "address",
				name: "originalAdmin",
				type: "address"
			},
			{
				internalType: "address",
				name: "admin",
				type: "address"
			},
			{
				internalType: "string",
				name: "image",
				type: "string"
			},
			{
				internalType: "string",
				name: "metadata",
				type: "string"
			},
			{
				internalType: "string",
				name: "context",
				type: "string"
			}
		],
		stateMutability: "view",
		type: "function"
	}
];
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/reader.js
/**
* ClawnchReader - Read on-chain token data from Clanker's contracts
*
* v3: Reads from Clanker's approved infrastructure (same ABI, different addresses).
* Provides read-only access to token deployment info, vault allocations,
* fee configurations, and reward info.
*
* Used by frontends to display token detail pages and admin functionality.
*/
/**
* ClawnchReader - Read on-chain token data
*
* @example
* ```typescript
* import { ClawnchReader } from '@clawnch/clawncher-sdk';
* import { createPublicClient, http } from 'viem';
* import { baseSepolia } from 'viem/chains';
*
* const publicClient = createPublicClient({
*   chain: baseSepolia,
*   transport: http(),
* });
*
* const reader = new ClawnchReader({
*   publicClient,
*   network: 'sepolia',
* });
*
* // Get full token details
* const details = await reader.getTokenDetails('0x...');
*
* // Get vault allocation
* const vault = await reader.getVaultAllocation('0x...');
*
* // Get vested dev buy allocation
* const vested = await reader.getVestedDevBuyAllocation('0x...');
* ```
*/
var ClawnchReader = class {
	publicClient;
	network;
	constructor(config) {
		this.publicClient = config.publicClient;
		this.network = config.network;
	}
	/**
	* Get contract addresses for configured network
	*/
	getAddresses() {
		return getAddresses(this.network);
	}
	/**
	* Get the chain for the configured network
	*/
	getChain() {
		return this.network === "mainnet" ? base : baseSepolia;
	}
	/**
	* Get basic ERC20 token info
	*/
	async getTokenInfo(token) {
		const [name, symbol, decimals, totalSupply] = await Promise.all([
			this.publicClient.readContract({
				address: token,
				abi: ERC20ABI,
				functionName: "name"
			}),
			this.publicClient.readContract({
				address: token,
				abi: ERC20ABI,
				functionName: "symbol"
			}),
			this.publicClient.readContract({
				address: token,
				abi: ERC20ABI,
				functionName: "decimals"
			}),
			this.publicClient.readContract({
				address: token,
				abi: ERC20ABI,
				functionName: "totalSupply"
			})
		]);
		return {
			name,
			symbol,
			decimals,
			totalSupply
		};
	}
	/**
	* Get Clawncher token metadata using allData() single call
	*
	* Returns originalAdmin, admin, imageUrl, metadata, context in one RPC call.
	*/
	async getTokenMetadata(token) {
		try {
			const [originalAdmin, admin, image, metadata, context] = await this.publicClient.readContract({
				address: token,
				abi: ClawnchTokenABI,
				functionName: "allData"
			});
			return {
				tokenAdmin: admin,
				originalAdmin,
				image,
				metadata,
				context
			};
		} catch {
			const [admin, image, metadata, context] = await Promise.all([
				this.publicClient.readContract({
					address: token,
					abi: ClawnchTokenABI,
					functionName: "admin"
				}),
				this.publicClient.readContract({
					address: token,
					abi: ClawnchTokenABI,
					functionName: "imageUrl"
				}).catch(() => ""),
				this.publicClient.readContract({
					address: token,
					abi: ClawnchTokenABI,
					functionName: "metadata"
				}).catch(() => ""),
				this.publicClient.readContract({
					address: token,
					abi: ClawnchTokenABI,
					functionName: "context"
				}).catch(() => "")
			]);
			return {
				tokenAdmin: admin,
				originalAdmin: admin,
				image,
				metadata,
				context
			};
		}
	}
	/**
	* Get token deployment info from factory
	*/
	async getDeploymentInfo(token) {
		const addresses = this.getAddresses();
		try {
			const result = await this.publicClient.readContract({
				address: addresses.clawnch.factory,
				abi: ClawnchFactoryABI,
				functionName: "tokenDeploymentInfo",
				args: [token]
			});
			if (result.token === "0x0000000000000000000000000000000000000000") return null;
			return {
				token: result.token,
				hook: result.hook,
				locker: result.locker,
				extensions: result.extensions
			};
		} catch {
			return null;
		}
	}
	/**
	* Get vault allocation for a token
	*/
	async getVaultAllocation(token) {
		const addresses = this.getAddresses();
		try {
			const [allocation, amountAvailable] = await Promise.all([this.publicClient.readContract({
				address: addresses.clawnch.vault,
				abi: ClawnchVaultABI,
				functionName: "allocation",
				args: [token]
			}), this.publicClient.readContract({
				address: addresses.clawnch.vault,
				abi: ClawnchVaultABI,
				functionName: "amountAvailableToClaim",
				args: [token]
			})]);
			const [tokenAddr, amountTotal, amountClaimed, lockupEndTime, vestingEndTime, admin] = allocation;
			if (lockupEndTime === 0n) return null;
			const now = BigInt(Math.floor(Date.now() / 1e3));
			const isUnlocked = now >= lockupEndTime;
			const isFullyVested = now >= vestingEndTime;
			let percentVested = 0;
			if (isFullyVested) percentVested = 100;
			else if (isUnlocked && vestingEndTime > lockupEndTime) {
				const elapsed = now - lockupEndTime;
				const vestingDuration = vestingEndTime - lockupEndTime;
				percentVested = Number(elapsed * 100n / vestingDuration);
			}
			return {
				token: tokenAddr,
				amountTotal,
				amountClaimed,
				lockupEndTime,
				vestingEndTime,
				admin,
				amountAvailable,
				isUnlocked,
				isFullyVested,
				percentVested
			};
		} catch {
			return null;
		}
	}
	/**
	* Get vested dev buy allocation for a token
	*/
	async getVestedDevBuyAllocation(token) {
		const addresses = this.getAddresses();
		if (addresses.clawnch.vestedDevBuy === "0x0000000000000000000000000000000000000000") return null;
		try {
			const [allocation, amountAvailable] = await Promise.all([this.publicClient.readContract({
				address: addresses.clawnch.vestedDevBuy,
				abi: ClawncherVestedDevBuyABI,
				functionName: "allocation",
				args: [token]
			}), this.publicClient.readContract({
				address: addresses.clawnch.vestedDevBuy,
				abi: ClawncherVestedDevBuyABI,
				functionName: "amountAvailableToClaim",
				args: [token]
			})]);
			const [tokenAddr, amountTotal, amountClaimed, lockupEndTime, vestingEndTime, admin] = allocation;
			if (lockupEndTime === 0n) return null;
			const now = BigInt(Math.floor(Date.now() / 1e3));
			const isUnlocked = now >= lockupEndTime;
			const isFullyVested = now >= vestingEndTime;
			let percentVested = 0;
			if (isFullyVested) percentVested = 100;
			else if (isUnlocked && vestingEndTime > lockupEndTime) {
				const elapsed = now - lockupEndTime;
				const vestingDuration = vestingEndTime - lockupEndTime;
				percentVested = Number(elapsed * 100n / vestingDuration);
			}
			return {
				token: tokenAddr,
				amountTotal,
				amountClaimed,
				lockupEndTime,
				vestingEndTime,
				admin,
				amountAvailable,
				isUnlocked,
				isFullyVested,
				percentVested
			};
		} catch {
			return null;
		}
	}
	/**
	* Get token reward info (recipients, positions) from LP locker
	*/
	async getTokenRewards(token) {
		const addresses = this.getAddresses();
		try {
			const result = await this.publicClient.readContract({
				address: addresses.clawnch.locker,
				abi: ClawnchLpLockerABI,
				functionName: "tokenRewards",
				args: [token]
			});
			return {
				token: result.token,
				poolKey: result.poolKey,
				positionId: result.positionId,
				numPositions: result.numPositions,
				rewardBps: result.rewardBps,
				rewardAdmins: result.rewardAdmins,
				rewardRecipients: result.rewardRecipients
			};
		} catch {
			return null;
		}
	}
	/**
	* Get available fees for a wallet on a specific token
	*/
	async getAvailableFees(wallet, token) {
		const addresses = this.getAddresses();
		try {
			return await this.publicClient.readContract({
				address: addresses.clawnch.feeLocker,
				abi: ClawnchFeeLockerABI,
				functionName: "availableFees",
				args: [wallet, token]
			});
		} catch {
			return 0n;
		}
	}
	/**
	* Get all available fees for a wallet across multiple tokens
	*/
	async getWalletFees(wallet, tokens) {
		const addresses = this.getAddresses();
		const results = await Promise.all(tokens.map(async (token) => {
			const [fees, symbol] = await Promise.all([this.getAvailableFees(wallet, token), this.publicClient.readContract({
				address: token,
				abi: ERC20ABI,
				functionName: "symbol"
			}).catch(() => "UNKNOWN")]);
			return {
				token,
				symbol,
				availableFees: fees,
				formattedFees: formatUnits(fees, 18)
			};
		}));
		const wethFees = await this.getAvailableFees(wallet, addresses.infrastructure.weth);
		return {
			wallet,
			tokens: results,
			totalWeth: wethFees,
			formattedTotalWeth: formatUnits(wethFees, 18)
		};
	}
	/**
	* Get MEV protection config for a pool by its poolId (bytes32)
	*
	* Use `getMevConfigForToken()` if you have a token address instead of poolId.
	*/
	async getMevConfig(poolId) {
		const addresses = this.getAddresses();
		try {
			const [config, startTime, currentFee] = await Promise.all([
				this.publicClient.readContract({
					address: addresses.clawnch.mevModule,
					abi: ClawnchMevModuleABI,
					functionName: "feeConfig",
					args: [poolId]
				}),
				this.publicClient.readContract({
					address: addresses.clawnch.mevModule,
					abi: ClawnchMevModuleABI,
					functionName: "poolStartTime",
					args: [poolId]
				}),
				this.publicClient.readContract({
					address: addresses.clawnch.mevModule,
					abi: ClawnchMevModuleABI,
					functionName: "getFee",
					args: [poolId]
				})
			]);
			const [startingFee, endingFee, secondsToDecay] = config;
			const poolStartTime = startTime;
			if (secondsToDecay === 0n) return null;
			const decayEndTime = poolStartTime + secondsToDecay;
			return {
				startingFee,
				endingFee,
				secondsToDecay,
				poolStartTime,
				decayEndTime,
				currentFee,
				isDecayComplete: BigInt(Math.floor(Date.now() / 1e3)) >= decayEndTime
			};
		} catch {
			return null;
		}
	}
	/**
	* Get MEV protection config for a token (resolves poolId via LP locker first)
	*/
	async getMevConfigForToken(token) {
		const rewards = await this.getTokenRewards(token);
		if (!rewards) return null;
		const { encodeAbiParameters, parseAbiParameters, keccak256 } = await import("./_esm-BrzUp3yp.mjs").then((n) => n.t);
		const poolId = keccak256(encodeAbiParameters(parseAbiParameters("address, address, uint24, int24, address"), [
			rewards.poolKey.currency0,
			rewards.poolKey.currency1,
			rewards.poolKey.fee,
			rewards.poolKey.tickSpacing,
			rewards.poolKey.hooks
		]));
		return this.getMevConfig(poolId);
	}
	/**
	* Get complete token details for UI display
	*
	* Combines basic token info, deployment info, vault, vested dev buy,
	* reward recipients, and MEV config into a single response.
	*/
	async getTokenDetails(token) {
		const deployment = await this.getDeploymentInfo(token);
		if (!deployment) return null;
		const [tokenInfo, tokenMetadata, rewards, vault, vestedDevBuy] = await Promise.all([
			this.getTokenInfo(token),
			this.getTokenMetadata(token),
			this.getTokenRewards(token),
			this.getVaultAllocation(token),
			this.getVestedDevBuyAllocation(token)
		]);
		const mev = await this.getMevConfigForToken(token);
		return {
			address: token,
			...tokenInfo,
			...tokenMetadata,
			deployment,
			rewards,
			vault,
			vestedDevBuy,
			mev
		};
	}
	/**
	* Check if a token was deployed via Clawncher
	*/
	async isClawnchToken(token) {
		return await this.getDeploymentInfo(token) !== null;
	}
};
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/uniswap-addresses.js
/**
* Uniswap V3 & V4 Contract Addresses
*
* Official deployment addresses for Base mainnet and Base Sepolia.
* Source: https://docs.uniswap.org/contracts/v4/deployments
*/
const V4_BASE_MAINNET = {
	poolManager: "0x498581ff718922c3f8e6a244956af099b2652b2b",
	positionManager: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
	positionDescriptor: "0x25d093633990dc94bedeed76c8f3cdaa75f3e7d5",
	stateView: "0xa3c0c9b65bad0b08107aa264b0f3db444b867a71",
	quoter: "0x0d5e0f971ed27fbff6c2837bf31316121532048d",
	universalRouter: "0x6ff5693b99212da76ad316178a184ab56d299b43",
	permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
};
const V4_BASE_SEPOLIA = {
	poolManager: "0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408",
	positionManager: "0x4b2c77d209d3405f41a037ec6c77f7f5b8e2ca80",
	positionDescriptor: "0x0000000000000000000000000000000000000000",
	stateView: "0x571291b572ed32ce6751a2cb2486ebee8defb9b4",
	quoter: "0x4a6513c898fe1b2d0e78d3b0e0a4a151589b1cba",
	universalRouter: "0x492e6456d9528771018deb9e87ef7750ef184104",
	permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
};
const V3_BASE_MAINNET = {
	factory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
	nonfungiblePositionManager: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
	swapRouter: "0x2626664c2603336E57B271c5C0b26F421741e481",
	swapRouter02: "0x2626664c2603336E57B271c5C0b26F421741e481",
	quoterV2: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a"
};
const V3_BASE_SEPOLIA = {
	factory: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
	nonfungiblePositionManager: "0x27F971cb582BF9E50F397e4d29a5C7A34f11faA2",
	swapRouter: "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4",
	swapRouter02: "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4",
	quoterV2: "0xC5290058841028F1614F3A6F0F5816cAd0df5E27"
};
const COMMON_BASE_MAINNET = {
	weth: "0x4200000000000000000000000000000000000006",
	usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
};
const COMMON_BASE_SEPOLIA = {
	weth: "0x4200000000000000000000000000000000000006",
	usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
};
function getUniswapV4Addresses(network = "mainnet") {
	return network === "mainnet" ? V4_BASE_MAINNET : V4_BASE_SEPOLIA;
}
function getUniswapV3Addresses(network = "mainnet") {
	return network === "mainnet" ? V3_BASE_MAINNET : V3_BASE_SEPOLIA;
}
function getCommonAddresses(network = "mainnet") {
	return network === "mainnet" ? COMMON_BASE_MAINNET : COMMON_BASE_SEPOLIA;
}
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/uniswap-abis.js
/**
* Uniswap V3 & V4 ABIs
*
* Minimal ABIs for the contract functions used by ClawnchLiquidity.
* We only include the functions we actually call to keep bundle size small.
*/
const StateViewABI = [
	{
		inputs: [{
			name: "poolId",
			type: "bytes32"
		}],
		name: "getSlot0",
		outputs: [
			{
				name: "sqrtPriceX96",
				type: "uint160"
			},
			{
				name: "tick",
				type: "int24"
			},
			{
				name: "protocolFee",
				type: "uint24"
			},
			{
				name: "lpFee",
				type: "uint24"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "poolId",
			type: "bytes32"
		}],
		name: "getLiquidity",
		outputs: [{
			name: "liquidity",
			type: "uint128"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [
			{
				name: "poolId",
				type: "bytes32"
			},
			{
				name: "owner",
				type: "address"
			},
			{
				name: "tickLower",
				type: "int24"
			},
			{
				name: "tickUpper",
				type: "int24"
			},
			{
				name: "salt",
				type: "bytes32"
			}
		],
		name: "getPositionInfo",
		outputs: [
			{
				name: "liquidity",
				type: "uint128"
			},
			{
				name: "feeGrowthInside0LastX128",
				type: "uint256"
			},
			{
				name: "feeGrowthInside1LastX128",
				type: "uint256"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [
			{
				name: "poolId",
				type: "bytes32"
			},
			{
				name: "tickLower",
				type: "int24"
			},
			{
				name: "tickUpper",
				type: "int24"
			}
		],
		name: "getFeeGrowthInside",
		outputs: [{
			name: "feeGrowthInside0X128",
			type: "uint256"
		}, {
			name: "feeGrowthInside1X128",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	}
];
const V4PositionManagerABI = [
	{
		inputs: [{
			name: "data",
			type: "bytes[]"
		}],
		name: "multicall",
		outputs: [{
			name: "results",
			type: "bytes[]"
		}],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			name: "tokenId",
			type: "uint256"
		}],
		name: "getPoolAndPositionInfo",
		outputs: [{
			name: "poolKey",
			type: "tuple",
			components: [
				{
					name: "currency0",
					type: "address"
				},
				{
					name: "currency1",
					type: "address"
				},
				{
					name: "fee",
					type: "uint24"
				},
				{
					name: "tickSpacing",
					type: "int24"
				},
				{
					name: "hooks",
					type: "address"
				}
			]
		}, {
			name: "info",
			type: "tuple",
			components: [
				{
					name: "tickLower",
					type: "int24"
				},
				{
					name: "tickUpper",
					type: "int24"
				},
				{
					name: "liquidity",
					type: "uint128"
				}
			]
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "tokenId",
			type: "uint256"
		}],
		name: "ownerOf",
		outputs: [{
			name: "",
			type: "address"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "owner",
			type: "address"
		}],
		name: "balanceOf",
		outputs: [{
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	}
];
const V3NonfungiblePositionManagerABI = [
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "token0",
					type: "address"
				},
				{
					name: "token1",
					type: "address"
				},
				{
					name: "fee",
					type: "uint24"
				},
				{
					name: "tickLower",
					type: "int24"
				},
				{
					name: "tickUpper",
					type: "int24"
				},
				{
					name: "amount0Desired",
					type: "uint256"
				},
				{
					name: "amount1Desired",
					type: "uint256"
				},
				{
					name: "amount0Min",
					type: "uint256"
				},
				{
					name: "amount1Min",
					type: "uint256"
				},
				{
					name: "recipient",
					type: "address"
				},
				{
					name: "deadline",
					type: "uint256"
				}
			]
		}],
		name: "mint",
		outputs: [
			{
				name: "tokenId",
				type: "uint256"
			},
			{
				name: "liquidity",
				type: "uint128"
			},
			{
				name: "amount0",
				type: "uint256"
			},
			{
				name: "amount1",
				type: "uint256"
			}
		],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "tokenId",
					type: "uint256"
				},
				{
					name: "amount0Desired",
					type: "uint256"
				},
				{
					name: "amount1Desired",
					type: "uint256"
				},
				{
					name: "amount0Min",
					type: "uint256"
				},
				{
					name: "amount1Min",
					type: "uint256"
				},
				{
					name: "deadline",
					type: "uint256"
				}
			]
		}],
		name: "increaseLiquidity",
		outputs: [
			{
				name: "liquidity",
				type: "uint128"
			},
			{
				name: "amount0",
				type: "uint256"
			},
			{
				name: "amount1",
				type: "uint256"
			}
		],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "tokenId",
					type: "uint256"
				},
				{
					name: "liquidity",
					type: "uint128"
				},
				{
					name: "amount0Min",
					type: "uint256"
				},
				{
					name: "amount1Min",
					type: "uint256"
				},
				{
					name: "deadline",
					type: "uint256"
				}
			]
		}],
		name: "decreaseLiquidity",
		outputs: [{
			name: "amount0",
			type: "uint256"
		}, {
			name: "amount1",
			type: "uint256"
		}],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "tokenId",
					type: "uint256"
				},
				{
					name: "recipient",
					type: "address"
				},
				{
					name: "amount0Max",
					type: "uint128"
				},
				{
					name: "amount1Max",
					type: "uint128"
				}
			]
		}],
		name: "collect",
		outputs: [{
			name: "amount0",
			type: "uint256"
		}, {
			name: "amount1",
			type: "uint256"
		}],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			name: "tokenId",
			type: "uint256"
		}],
		name: "burn",
		outputs: [],
		stateMutability: "payable",
		type: "function"
	},
	{
		inputs: [{
			name: "tokenId",
			type: "uint256"
		}],
		name: "positions",
		outputs: [
			{
				name: "nonce",
				type: "uint96"
			},
			{
				name: "operator",
				type: "address"
			},
			{
				name: "token0",
				type: "address"
			},
			{
				name: "token1",
				type: "address"
			},
			{
				name: "fee",
				type: "uint24"
			},
			{
				name: "tickLower",
				type: "int24"
			},
			{
				name: "tickUpper",
				type: "int24"
			},
			{
				name: "liquidity",
				type: "uint128"
			},
			{
				name: "feeGrowthInside0LastX128",
				type: "uint256"
			},
			{
				name: "feeGrowthInside1LastX128",
				type: "uint256"
			},
			{
				name: "tokensOwed0",
				type: "uint128"
			},
			{
				name: "tokensOwed1",
				type: "uint128"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "owner",
			type: "address"
		}],
		name: "balanceOf",
		outputs: [{
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "owner",
			type: "address"
		}, {
			name: "index",
			type: "uint256"
		}],
		name: "tokenOfOwnerByIndex",
		outputs: [{
			name: "",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "tokenId",
			type: "uint256"
		}],
		name: "ownerOf",
		outputs: [{
			name: "",
			type: "address"
		}],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [{
			name: "data",
			type: "bytes[]"
		}],
		name: "multicall",
		outputs: [{
			name: "results",
			type: "bytes[]"
		}],
		stateMutability: "payable",
		type: "function"
	}
];
const V4QuoterABI = [
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "poolKey",
					type: "tuple",
					components: [
						{
							name: "currency0",
							type: "address"
						},
						{
							name: "currency1",
							type: "address"
						},
						{
							name: "fee",
							type: "uint24"
						},
						{
							name: "tickSpacing",
							type: "int24"
						},
						{
							name: "hooks",
							type: "address"
						}
					]
				},
				{
					name: "zeroForOne",
					type: "bool"
				},
				{
					name: "exactAmount",
					type: "uint128"
				},
				{
					name: "sqrtPriceLimitX96",
					type: "uint160"
				},
				{
					name: "hookData",
					type: "bytes"
				}
			]
		}],
		name: "quoteExactInputSingle",
		outputs: [{
			name: "amountOut",
			type: "uint256"
		}, {
			name: "gasEstimate",
			type: "uint256"
		}],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "poolKey",
					type: "tuple",
					components: [
						{
							name: "currency0",
							type: "address"
						},
						{
							name: "currency1",
							type: "address"
						},
						{
							name: "fee",
							type: "uint24"
						},
						{
							name: "tickSpacing",
							type: "int24"
						},
						{
							name: "hooks",
							type: "address"
						}
					]
				},
				{
					name: "zeroForOne",
					type: "bool"
				},
				{
					name: "exactAmount",
					type: "uint128"
				},
				{
					name: "sqrtPriceLimitX96",
					type: "uint160"
				},
				{
					name: "hookData",
					type: "bytes"
				}
			]
		}],
		name: "quoteExactOutputSingle",
		outputs: [{
			name: "amountIn",
			type: "uint256"
		}, {
			name: "gasEstimate",
			type: "uint256"
		}],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			name: "params",
			type: "tuple",
			components: [
				{
					name: "exactCurrency",
					type: "address"
				},
				{
					name: "path",
					type: "tuple[]",
					components: [
						{
							name: "poolKey",
							type: "tuple",
							components: [
								{
									name: "currency0",
									type: "address"
								},
								{
									name: "currency1",
									type: "address"
								},
								{
									name: "fee",
									type: "uint24"
								},
								{
									name: "tickSpacing",
									type: "int24"
								},
								{
									name: "hooks",
									type: "address"
								}
							]
						},
						{
							name: "zeroForOne",
							type: "bool"
						},
						{
							name: "hookData",
							type: "bytes"
						}
					]
				},
				{
					name: "exactAmount",
					type: "uint128"
				}
			]
		}],
		name: "quoteExactInput",
		outputs: [{
			name: "amountOut",
			type: "uint256"
		}, {
			name: "gasEstimate",
			type: "uint256"
		}],
		stateMutability: "nonpayable",
		type: "function"
	}
];
const Permit2ABI = [
	{
		inputs: [
			{
				name: "owner",
				type: "address"
			},
			{
				name: "token",
				type: "address"
			},
			{
				name: "spender",
				type: "address"
			}
		],
		name: "allowance",
		outputs: [
			{
				name: "amount",
				type: "uint160"
			},
			{
				name: "expiration",
				type: "uint48"
			},
			{
				name: "nonce",
				type: "uint48"
			}
		],
		stateMutability: "view",
		type: "function"
	},
	{
		inputs: [
			{
				name: "token",
				type: "address"
			},
			{
				name: "spender",
				type: "address"
			},
			{
				name: "amount",
				type: "uint160"
			},
			{
				name: "expiration",
				type: "uint48"
			}
		],
		name: "approve",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "owner",
				type: "address"
			},
			{
				name: "permitSingle",
				type: "tuple",
				components: [
					{
						name: "details",
						type: "tuple",
						components: [
							{
								name: "token",
								type: "address"
							},
							{
								name: "amount",
								type: "uint160"
							},
							{
								name: "expiration",
								type: "uint48"
							},
							{
								name: "nonce",
								type: "uint48"
							}
						]
					},
					{
						name: "spender",
						type: "address"
					},
					{
						name: "sigDeadline",
						type: "uint256"
					}
				]
			},
			{
				name: "signature",
				type: "bytes"
			}
		],
		name: "permit",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "owner",
				type: "address"
			},
			{
				name: "permitBatch",
				type: "tuple",
				components: [
					{
						name: "details",
						type: "tuple[]",
						components: [
							{
								name: "token",
								type: "address"
							},
							{
								name: "amount",
								type: "uint160"
							},
							{
								name: "expiration",
								type: "uint48"
							},
							{
								name: "nonce",
								type: "uint48"
							}
						]
					},
					{
						name: "spender",
						type: "address"
					},
					{
						name: "sigDeadline",
						type: "uint256"
					}
				]
			},
			{
				name: "signature",
				type: "bytes"
			}
		],
		name: "permit",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "from",
				type: "address"
			},
			{
				name: "to",
				type: "address"
			},
			{
				name: "amount",
				type: "uint160"
			},
			{
				name: "token",
				type: "address"
			}
		],
		name: "transferFrom",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			name: "transferDetails",
			type: "tuple[]",
			components: [
				{
					name: "from",
					type: "address"
				},
				{
					name: "to",
					type: "address"
				},
				{
					name: "amount",
					type: "uint160"
				},
				{
					name: "token",
					type: "address"
				}
			]
		}],
		name: "transferFrom",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			name: "approvals",
			type: "tuple[]",
			components: [{
				name: "token",
				type: "address"
			}, {
				name: "spender",
				type: "address"
			}]
		}],
		name: "lockdown",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "token",
				type: "address"
			},
			{
				name: "spender",
				type: "address"
			},
			{
				name: "newNonce",
				type: "uint48"
			}
		],
		name: "invalidateNonces",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "permit",
				type: "tuple",
				components: [
					{
						name: "permitted",
						type: "tuple",
						components: [{
							name: "token",
							type: "address"
						}, {
							name: "amount",
							type: "uint256"
						}]
					},
					{
						name: "nonce",
						type: "uint256"
					},
					{
						name: "deadline",
						type: "uint256"
					}
				]
			},
			{
				name: "transferDetails",
				type: "tuple",
				components: [{
					name: "to",
					type: "address"
				}, {
					name: "requestedAmount",
					type: "uint256"
				}]
			},
			{
				name: "owner",
				type: "address"
			},
			{
				name: "signature",
				type: "bytes"
			}
		],
		name: "permitTransferFrom",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "permit",
				type: "tuple",
				components: [
					{
						name: "permitted",
						type: "tuple[]",
						components: [{
							name: "token",
							type: "address"
						}, {
							name: "amount",
							type: "uint256"
						}]
					},
					{
						name: "nonce",
						type: "uint256"
					},
					{
						name: "deadline",
						type: "uint256"
					}
				]
			},
			{
				name: "transferDetails",
				type: "tuple[]",
				components: [{
					name: "to",
					type: "address"
				}, {
					name: "requestedAmount",
					type: "uint256"
				}]
			},
			{
				name: "owner",
				type: "address"
			},
			{
				name: "signature",
				type: "bytes"
			}
		],
		name: "permitTransferFrom",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [
			{
				name: "permit",
				type: "tuple",
				components: [
					{
						name: "permitted",
						type: "tuple",
						components: [{
							name: "token",
							type: "address"
						}, {
							name: "amount",
							type: "uint256"
						}]
					},
					{
						name: "nonce",
						type: "uint256"
					},
					{
						name: "deadline",
						type: "uint256"
					}
				]
			},
			{
				name: "transferDetails",
				type: "tuple",
				components: [{
					name: "to",
					type: "address"
				}, {
					name: "requestedAmount",
					type: "uint256"
				}]
			},
			{
				name: "owner",
				type: "address"
			},
			{
				name: "witness",
				type: "bytes32"
			},
			{
				name: "witnessTypeString",
				type: "string"
			},
			{
				name: "signature",
				type: "bytes"
			}
		],
		name: "permitWitnessTransferFrom",
		outputs: [],
		stateMutability: "nonpayable",
		type: "function"
	},
	{
		inputs: [{
			name: "owner",
			type: "address"
		}, {
			name: "word",
			type: "uint256"
		}],
		name: "nonceBitmap",
		outputs: [{
			name: "bitmap",
			type: "uint256"
		}],
		stateMutability: "view",
		type: "function"
	}
];
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/uniswap-chains.js
/**
* Multi-chain Uniswap contract address registry.
*
* Covers all chains supported by Uniswap V4, V3, and the Trading API.
* Derived from Uniswap AI's uniswap-driver chain references and
* swap-integration Universal Router deployment addresses.
*
* @see https://github.com/Uniswap/uniswap-ai
* @see https://docs.uniswap.org/contracts/v4/deployments
*/
const PERMIT2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
const ZERO = "0x0000000000000000000000000000000000000000";
const CHAINS = {
	1: {
		chainId: 1,
		name: "Ethereum",
		slug: "ethereum",
		v4: true,
		v3: true,
		v2: true,
		tradingApi: true,
		blockTimeSeconds: 12,
		explorer: "https://etherscan.io",
		dexScreenerId: "ethereum",
		weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
		usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
		permit2: PERMIT2,
		v4UniversalRouter: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
		v4PoolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90",
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	8453: (() => {
		const v4 = getUniswapV4Addresses("mainnet");
		const common = getCommonAddresses("mainnet");
		return {
			chainId: 8453,
			name: "Base",
			slug: "base",
			v4: true,
			v3: true,
			v2: false,
			tradingApi: true,
			blockTimeSeconds: 2,
			explorer: "https://basescan.org",
			dexScreenerId: "base",
			weth: common.weth,
			usdc: common.usdc,
			permit2: PERMIT2,
			v4UniversalRouter: v4.universalRouter,
			v4PoolManager: v4.poolManager,
			v4StateView: v4.stateView,
			v4Quoter: v4.quoter,
			v4PositionManager: v4.positionManager
		};
	})(),
	42161: {
		chainId: 42161,
		name: "Arbitrum",
		slug: "arbitrum",
		v4: true,
		v3: true,
		v2: true,
		tradingApi: true,
		blockTimeSeconds: .25,
		explorer: "https://arbiscan.io",
		dexScreenerId: "arbitrum",
		weth: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
		usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
		permit2: PERMIT2,
		v4UniversalRouter: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	10: {
		chainId: 10,
		name: "Optimism",
		slug: "optimism",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://optimistic.etherscan.io",
		dexScreenerId: "optimism",
		weth: "0x4200000000000000000000000000000000000006",
		usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
		permit2: PERMIT2,
		v4UniversalRouter: "0x851116d9223fabed8e56c0e6b8ad0c31d98b3507",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	137: {
		chainId: 137,
		name: "Polygon",
		slug: "polygon",
		v4: false,
		v3: true,
		v2: true,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://polygonscan.com",
		dexScreenerId: "polygon",
		weth: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
		usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
		permit2: PERMIT2,
		v4UniversalRouter: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	56: {
		chainId: 56,
		name: "BNB Chain",
		slug: "bnb",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 3,
		explorer: "https://bscscan.com",
		dexScreenerId: "bsc",
		weth: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
		usdc: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
		permit2: PERMIT2,
		v4UniversalRouter: "0x1906c1d672b88cd1b9ac7593301ca990f94eae07",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	130: {
		chainId: 130,
		name: "Unichain",
		slug: "unichain",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 1,
		explorer: "https://unichain.blockscout.com",
		dexScreenerId: "unichain",
		weth: "0x4200000000000000000000000000000000000006",
		usdc: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
		permit2: PERMIT2,
		v4UniversalRouter: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	43114: {
		chainId: 43114,
		name: "Avalanche",
		slug: "avalanche",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://snowtrace.io",
		dexScreenerId: "avalanche",
		weth: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
		usdc: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
		permit2: PERMIT2,
		v4UniversalRouter: "0x94b75331ae8d42c1b61065089b7d48fe14aa73b7",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	42220: {
		chainId: 42220,
		name: "Celo",
		slug: "celo",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 5,
		explorer: "https://celoscan.io",
		dexScreenerId: "celo",
		weth: "0x471EcE3750Da237f93B8E339c536989b8978a438",
		usdc: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C",
		permit2: PERMIT2,
		v4UniversalRouter: "0xcb695bc5d3aa22cad1e6df07801b061a05a0233a",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	81457: {
		chainId: 81457,
		name: "Blast",
		slug: "blast",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://blastscan.io",
		dexScreenerId: "blast",
		weth: "0x4300000000000000000000000000000000000004",
		usdc: ZERO,
		permit2: PERMIT2,
		v4UniversalRouter: "0xeabbcb3e8e415306207ef514f660a3f820025be3",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	7777777: {
		chainId: 7777777,
		name: "Zora",
		slug: "zora",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://explorer.zora.energy",
		dexScreenerId: "zora",
		weth: "0x4200000000000000000000000000000000000006",
		usdc: ZERO,
		permit2: PERMIT2,
		v4UniversalRouter: "0x3315ef7ca28db74abadc6c44570efdf06b04b020",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	480: {
		chainId: 480,
		name: "World Chain",
		slug: "worldchain",
		v4: true,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://worldchain-mainnet.explorer.alchemy.com",
		dexScreenerId: "worldchain",
		weth: "0x4200000000000000000000000000000000000006",
		usdc: ZERO,
		permit2: PERMIT2,
		v4UniversalRouter: "0x8ac7bee993bb44dab564ea4bc9ea67bf9eb5e743",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	1868: {
		chainId: 1868,
		name: "Soneium",
		slug: "soneium",
		v4: true,
		v3: false,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 2,
		explorer: "https://soneium.blockscout.com",
		dexScreenerId: "soneium",
		weth: "0x4200000000000000000000000000000000000006",
		usdc: ZERO,
		permit2: PERMIT2,
		v4UniversalRouter: "0x4cded7edf52c8aa5259a54ec6a3ce7c6d2a455df",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	324: {
		chainId: 324,
		name: "zkSync Era",
		slug: "zksync",
		v4: false,
		v3: true,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 1,
		explorer: "https://explorer.zksync.io",
		dexScreenerId: "zksync",
		weth: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",
		usdc: "0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4",
		permit2: PERMIT2,
		v4UniversalRouter: ZERO,
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	},
	143: {
		chainId: 143,
		name: "Monad",
		slug: "monad",
		v4: true,
		v3: false,
		v2: false,
		tradingApi: true,
		blockTimeSeconds: 1,
		explorer: "https://monad.blockscout.com",
		dexScreenerId: "monad",
		weth: ZERO,
		usdc: ZERO,
		permit2: PERMIT2,
		v4UniversalRouter: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
		v4PoolManager: ZERO,
		v4StateView: ZERO,
		v4Quoter: ZERO,
		v4PositionManager: ZERO
	}
};
/** Get config for a specific chain ID. Returns undefined if not supported. */
function getUniswapChain(chainId) {
	return CHAINS[chainId];
}
Object.keys(CHAINS).map(Number);
//#endregion
//#region node_modules/.pnpm/@clawnch+clawncher-sdk@0.3.4_@types+node@25.5.2_hardhat@2.28.6_typescript@6.0.2__typesc_a082d605d8b8771f03593b43bf11d8ac/node_modules/@clawnch/clawncher-sdk/dist/uniswap-quoter.js
/**
* UniswapQuoter — On-chain V4 quote simulation + price impact estimation.
*
* Uses the deployed V4 Quoter contract to simulate swaps without executing
* them. This works even without a Trading API key — it's purely on-chain.
*
* Supports:
*   - Single-pool exact input/output quotes
*   - Price impact calculation
*   - Pool discovery for Clawncher tokens
*   - Multi-chain via uniswap-chains registry
*
* @see https://docs.uniswap.org/contracts/v4/reference/periphery/interfaces/IQuoter
*/
const Q96 = 2n ** 96n;
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
const MIN_SQRT_PRICE = 4295128740n;
const MAX_SQRT_PRICE = 1461446703485210103287273052203988822378723970342n - 1n;
var UniswapQuoter = class {
	publicClient;
	chainId;
	network;
	chainConfig;
	constructor(config) {
		this.publicClient = config.publicClient;
		this.chainId = config.chainId ?? 8453;
		this.network = config.network ?? "mainnet";
		this.chainConfig = getUniswapChain(this.chainId);
	}
	/** Get the V4 Quoter address for the current chain */
	getQuoterAddress() {
		if (this.chainId === 8453 || this.chainId === 84532) return getUniswapV4Addresses(this.network).quoter;
		if (this.chainConfig?.v4Quoter && this.chainConfig.v4Quoter !== ZERO_ADDRESS) return this.chainConfig.v4Quoter;
		throw new ClawnchDeployError(ClawnchErrorCode.FEATURE_NOT_AVAILABLE, `V4 Quoter not available on chain ${this.chainId}`);
	}
	/** Get the StateView address for the current chain */
	getStateViewAddress() {
		if (this.chainId === 8453 || this.chainId === 84532) return getUniswapV4Addresses(this.network).stateView;
		if (this.chainConfig?.v4StateView && this.chainConfig.v4StateView !== ZERO_ADDRESS) return this.chainConfig.v4StateView;
		throw new ClawnchDeployError(ClawnchErrorCode.FEATURE_NOT_AVAILABLE, `V4 StateView not available on chain ${this.chainId}`);
	}
	/**
	* Read current pool state from StateView.
	*/
	async getPoolState(poolKey) {
		const stateView = this.getStateViewAddress();
		const poolId = await this.computePoolId(poolKey);
		const [slot0, liquidity] = await Promise.all([this.publicClient.readContract({
			address: stateView,
			abi: StateViewABI,
			functionName: "getSlot0",
			args: [poolId]
		}), this.publicClient.readContract({
			address: stateView,
			abi: StateViewABI,
			functionName: "getLiquidity",
			args: [poolId]
		})]);
		return {
			sqrtPriceX96: slot0[0],
			tick: Number(slot0[1]),
			liquidity,
			protocolFee: Number(slot0[2]),
			lpFee: Number(slot0[3])
		};
	}
	/**
	* Compute pool ID from pool key (keccak256 of abi-encoded key).
	*/
	async computePoolId(poolKey) {
		const { keccak256, encodeAbiParameters } = await import("./_esm-BrzUp3yp.mjs").then((n) => n.t);
		return keccak256(encodeAbiParameters([
			{ type: "address" },
			{ type: "address" },
			{ type: "uint24" },
			{ type: "int24" },
			{ type: "address" }
		], [
			poolKey.currency0,
			poolKey.currency1,
			poolKey.fee,
			poolKey.tickSpacing,
			poolKey.hooks
		]));
	}
	/**
	* Quote an exact input swap (sell a fixed amount, get variable output).
	*
	* Uses the V4 Quoter's `quoteExactInputSingle` via `eth_call` simulation.
	* The Quoter intentionally reverts with the result — viem handles this
	* via `simulateContract` or we catch the revert.
	*/
	async quoteExactInput(params) {
		const quoter = this.getQuoterAddress();
		const sqrtPriceLimit = params.sqrtPriceLimitX96 ?? (params.zeroForOne ? MIN_SQRT_PRICE : MAX_SQRT_PRICE);
		try {
			const result = await this.publicClient.readContract({
				address: quoter,
				abi: V4QuoterABI,
				functionName: "quoteExactInputSingle",
				args: [{
					poolKey: {
						currency0: params.poolKey.currency0,
						currency1: params.poolKey.currency1,
						fee: params.poolKey.fee,
						tickSpacing: params.poolKey.tickSpacing,
						hooks: params.poolKey.hooks
					},
					zeroForOne: params.zeroForOne,
					exactAmount: params.amount,
					sqrtPriceLimitX96: sqrtPriceLimit,
					hookData: params.hookData ?? "0x"
				}]
			});
			const amountOut = result[0];
			return {
				quotedAmount: amountOut,
				gasEstimate: result[1],
				...await this.calculatePriceImpact(params.poolKey, params.zeroForOne, params.amount, amountOut)
			};
		} catch (err) {
			if (err.cause?.data) return this.parseQuoterRevert(err.cause.data, params);
			throw new ClawnchDeployError(ClawnchErrorCode.RPC_ERROR, `V4 Quoter quoteExactInputSingle failed: ${err.message}`);
		}
	}
	/**
	* Quote an exact output swap (buy a fixed amount, pay variable input).
	*/
	async quoteExactOutput(params) {
		const quoter = this.getQuoterAddress();
		const sqrtPriceLimit = params.sqrtPriceLimitX96 ?? (params.zeroForOne ? MIN_SQRT_PRICE : MAX_SQRT_PRICE);
		try {
			const result = await this.publicClient.readContract({
				address: quoter,
				abi: V4QuoterABI,
				functionName: "quoteExactOutputSingle",
				args: [{
					poolKey: {
						currency0: params.poolKey.currency0,
						currency1: params.poolKey.currency1,
						fee: params.poolKey.fee,
						tickSpacing: params.poolKey.tickSpacing,
						hooks: params.poolKey.hooks
					},
					zeroForOne: params.zeroForOne,
					exactAmount: params.amount,
					sqrtPriceLimitX96: sqrtPriceLimit,
					hookData: params.hookData ?? "0x"
				}]
			});
			const amountIn = result[0];
			return {
				quotedAmount: amountIn,
				gasEstimate: result[1],
				...await this.calculatePriceImpact(params.poolKey, params.zeroForOne, amountIn, params.amount)
			};
		} catch (err) {
			if (err.cause?.data) return this.parseQuoterRevert(err.cause.data, params);
			throw new ClawnchDeployError(ClawnchErrorCode.RPC_ERROR, `V4 Quoter quoteExactOutputSingle failed: ${err.message}`);
		}
	}
	/**
	* Calculate price impact for a swap.
	*
	* Price impact = (executionPrice - marketPrice) / marketPrice
	*
	* For exact input: executionPrice = amountOut / amountIn
	* Market price comes from current pool sqrtPriceX96.
	*/
	async calculatePriceImpact(poolKey, zeroForOne, amountIn, amountOut) {
		try {
			const state = await this.getPoolState(poolKey);
			if (state.sqrtPriceX96 === 0n || state.liquidity === 0n) return {
				priceImpact: null,
				currentPrice: null,
				priceAfterSwap: null
			};
			const currentPrice = this.sqrtPriceX96ToPrice(state.sqrtPriceX96);
			let executionPrice;
			if (zeroForOne) executionPrice = Number(amountOut) / Number(amountIn);
			else executionPrice = Number(amountIn) / Number(amountOut);
			return {
				priceImpact: currentPrice > 0 ? (executionPrice - currentPrice) / currentPrice : null,
				currentPrice,
				priceAfterSwap: executionPrice
			};
		} catch {
			return {
				priceImpact: null,
				currentPrice: null,
				priceAfterSwap: null
			};
		}
	}
	/**
	* Get estimated price impact without executing a full quote.
	*
	* Uses the simplified formula:
	*   impact ≈ amountIn / (2 * liquidityInPool)
	*
	* This is a rough estimate — use quoteExactInput for precision.
	*/
	async estimatePriceImpact(poolKey, amountIn) {
		const state = await this.getPoolState(poolKey);
		if (state.liquidity === 0n) return 1;
		return Number(amountIn) / (2 * Number(state.liquidity));
	}
	/** Convert sqrtPriceX96 to a float price (token1/token0) */
	sqrtPriceX96ToPrice(sqrtPriceX96) {
		if (sqrtPriceX96 === 0n) return 0;
		const sqrtPrice = Number(sqrtPriceX96) / Number(Q96);
		return sqrtPrice * sqrtPrice;
	}
	/** Convert a float price to sqrtPriceX96 */
	priceToSqrtPriceX96(price) {
		if (price <= 0) return 0n;
		return BigInt(Math.floor(Math.sqrt(price) * Number(Q96)));
	}
	/**
	* Check if a pool exists and has liquidity.
	*/
	async isPoolActive(poolKey) {
		try {
			const state = await this.getPoolState(poolKey);
			return state.sqrtPriceX96 > 0n && state.liquidity > 0n;
		} catch {
			return false;
		}
	}
	/**
	* Get the WETH address for the current chain.
	*/
	getWethAddress() {
		if (this.chainConfig) return this.chainConfig.weth;
		throw new ClawnchDeployError(ClawnchErrorCode.INVALID_CHAIN, `Cannot determine WETH address for chain ${this.chainId}`);
	}
	/**
	* Build a pool key for a token paired with WETH.
	*
	* Automatically sorts currency0/currency1 (lower address first).
	*/
	buildWethPoolKey(token, fee = 3e3, tickSpacing = 60, hooks = ZERO_ADDRESS) {
		const weth = this.getWethAddress();
		const [currency0, currency1] = token.toLowerCase() < weth.toLowerCase() ? [token, weth] : [weth, token];
		return {
			currency0,
			currency1,
			fee,
			tickSpacing,
			hooks
		};
	}
	/**
	* Get the USDC address for the current chain.
	*/
	getUsdcAddress() {
		if (this.chainConfig?.usdc) return this.chainConfig.usdc;
		if (this.chainId === 8453) return "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
		if (this.chainId === 84532) return "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
		throw new ClawnchDeployError(ClawnchErrorCode.INVALID_CHAIN, `Cannot determine USDC address for chain ${this.chainId}`);
	}
	/**
	* Build a pool key for a token paired with USDC.
	*
	* Automatically sorts currency0/currency1 (lower address first).
	* USDC pairs use 500 fee / 10 tick spacing by default (stablecoin convention).
	*/
	buildUsdcPoolKey(token, fee = 500, tickSpacing = 10, hooks = ZERO_ADDRESS) {
		const usdc = this.getUsdcAddress();
		const [currency0, currency1] = token.toLowerCase() < usdc.toLowerCase() ? [token, usdc] : [usdc, token];
		return {
			currency0,
			currency1,
			fee,
			tickSpacing,
			hooks
		};
	}
	/**
	* Build a pool key for a token paired with either WETH or USDC.
	*
	* @param token - Token address
	* @param pairedWith - 'WETH' (default) or 'USDC'
	*/
	buildPairedPoolKey(token, pairedWith = "WETH", fee, tickSpacing, hooks) {
		if (pairedWith === "USDC") return this.buildUsdcPoolKey(token, fee ?? 500, tickSpacing ?? 10, hooks ?? ZERO_ADDRESS);
		return this.buildWethPoolKey(token, fee ?? 3e3, tickSpacing ?? 60, hooks ?? ZERO_ADDRESS);
	}
	/**
	* Determine if selling token for WETH requires zeroForOne or oneForZero.
	*/
	isTokenCurrency0(token) {
		const weth = this.getWethAddress();
		return token.toLowerCase() < weth.toLowerCase();
	}
	/**
	* Build a pool key for a Clawnch token by reading its deployment data
	* from the LP locker contract.
	*
	* This is the SDK's killer feature — Clawnch tokens have their pool key
	* (including the correct hook address) stored on-chain in the LP locker.
	* No manual configuration needed. This works for ANY token deployed
	* through Clawnch, including tokens with MEV hooks, custom fee tiers,
	* and non-standard tick spacings.
	*
	* Falls back to `buildWethPoolKey()` (zero hook, 3000 fee) if the token
	* is not a Clawnch token.
	*
	* @param token - Token address (must be on Base)
	* @returns Pool key with correct hook, fee, and tick spacing
	*/
	async buildPoolKeyFromToken(token) {
		const rewards = await this.getTokenRewards(token);
		if (rewards) return {
			currency0: rewards.poolKey.currency0,
			currency1: rewards.poolKey.currency1,
			fee: rewards.poolKey.fee,
			tickSpacing: rewards.poolKey.tickSpacing,
			hooks: rewards.poolKey.hooks
		};
		return this.buildWethPoolKey(token);
	}
	/**
	* Get the full token reward info from the Clawnch LP locker.
	*
	* Returns null if the token wasn't deployed through Clawnch.
	*/
	async getTokenRewards(token) {
		if (this.chainId !== 8453 && this.chainId !== 84532) return null;
		try {
			return await new ClawnchReader({
				publicClient: this.publicClient,
				network: this.network
			}).getTokenRewards(token);
		} catch {
			return null;
		}
	}
	/**
	* One-call quote for any Clawnch token: auto-discovers pool key,
	* determines swap direction, and returns the quote.
	*
	* This replaces the 3-step manual flow of:
	*   1. Get pool key from LP locker
	*   2. Determine zeroForOne from paired token position
	*   3. Call quoteExactInput
	*
	* Works for both WETH-paired and USDC-paired tokens — the pool key
	* is read from chain so the correct paired token is auto-detected.
	*
	* @param token - Clawnch token address
	* @param amount - Amount to swap in paired token units (raw units) for buy, or token units for sell
	* @param direction - 'buy' (PairedToken→Token) or 'sell' (Token→PairedToken)
	*/
	async quoteClawnchToken(token, amount, direction = "buy") {
		const poolKey = await this.buildPoolKeyFromToken(token);
		const tokenIsCurrency0 = poolKey.currency0.toLowerCase() === token.toLowerCase();
		const zeroForOne = direction === "buy" ? !tokenIsCurrency0 : tokenIsCurrency0;
		return {
			...await this.quoteExactInput({
				poolKey,
				zeroForOne,
				amount
			}),
			poolKey
		};
	}
	/**
	* Try to parse a quoter revert (the V4 quoter reverts with encoded results).
	*/
	async parseQuoterRevert(data, params) {
		try {
			const { decodeAbiParameters } = await import("./_esm-BrzUp3yp.mjs").then((n) => n.t);
			const decoded = decodeAbiParameters([{ type: "uint256" }, { type: "uint256" }], data);
			return {
				quotedAmount: decoded[0],
				gasEstimate: decoded[1],
				priceImpact: null,
				currentPrice: null,
				priceAfterSwap: null
			};
		} catch {
			throw new ClawnchDeployError(ClawnchErrorCode.RPC_ERROR, "Failed to decode V4 Quoter revert data");
		}
	}
};
//#endregion
export { ClawnchErrorCode as C, ClawnchDeployError as S, UniswapQuoter, ClawncherVestedDevBuyABI as _, V4PositionManagerABI as a, SEPOLIA_ADDRESSES as b, getUniswapV3Addresses as c, ClawnchFactoryABI as d, ClawnchFeeLockerABI as f, ClawnchVaultABI as g, ClawnchTokenABI as h, V3NonfungiblePositionManagerABI as i, getUniswapV4Addresses as l, ClawnchMevModuleABI as m, Permit2ABI as n, V4QuoterABI as o, ClawnchLpLockerABI as p, StateViewABI as r, getCommonAddresses as s, getUniswapChain as t, ClawnchReader as u, ERC20ABI as v, withRetry as w, getAddresses as x, MAINNET_ADDRESSES as y };

//# sourceMappingURL=uniswap-quoter-BAKtkoFM.mjs.map