@masterpeach/launchpad-sdk 0.0.0-experimental-20260818121657
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +262 -0
- package/README.zh-CN.md +242 -0
- package/dist/abi/index.cjs +2786 -0
- package/dist/abi/index.cjs.map +1 -0
- package/dist/abi/index.d.cts +2121 -0
- package/dist/abi/index.d.ts +2121 -0
- package/dist/abi/index.js +19 -0
- package/dist/abi/index.js.map +1 -0
- package/dist/chunk-PGZCTPUB.js +127 -0
- package/dist/chunk-PGZCTPUB.js.map +1 -0
- package/dist/chunk-SH2Y5F5L.js +2754 -0
- package/dist/chunk-SH2Y5F5L.js.map +1 -0
- package/dist/core.cjs +163 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +48 -0
- package/dist/core.d.ts +48 -0
- package/dist/core.js +27 -0
- package/dist/core.js.map +1 -0
- package/dist/index.cjs +4420 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1273 -0
- package/dist/index.d.ts +1273 -0
- package/dist/index.js +1840 -0
- package/dist/index.js.map +1 -0
- package/dist/transaction-BiLcoXyx.d.cts +13 -0
- package/dist/transaction-BiLcoXyx.d.ts +13 -0
- package/package.json +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/actions/read.ts","../src/abi/generated/constant-product-curve.ts","../src/abi/generated/liquidity-locker.ts","../src/abi/generated/portal.ts","../src/abi/generated/token-factory.ts","../src/abi/generated/v3-migrator.ts","../src/converters/state.ts","../src/math/protection.ts","../src/actions/approval.ts","../src/math/slippage.ts","../src/math/curve.ts","../src/math/price.ts","../src/actions/curve.ts","../../core/src/errors.ts","../../core/src/chain.ts","../../core/src/transaction.ts","../src/events.ts","../src/actions/transaction.ts","../src/actions/write.ts","../src/errors.ts","../src/chains.ts","../src/deployment.ts","../src/client.ts","../src/deployments/arc-testnet.ts","../src/metadata.ts","../src/portal-client.ts","../src/verify.ts"],"sourcesContent":["export * from \"./actions\";\nexport * from \"./chains\";\nexport * from \"./client\";\nexport * from \"./converters\";\nexport * from \"./deployment\";\nexport * from \"./deployments\";\nexport * from \"./errors\";\nexport * from \"./events\";\nexport * from \"./math\";\nexport * from \"./metadata\";\nexport * from \"./portal-client\";\nexport * from \"./types\";\nexport * from \"./verify\";\n","import {\n type Address,\n encodeAbiParameters,\n erc20Abi,\n getAddress,\n type Hex,\n isAddressEqual,\n keccak256,\n zeroAddress,\n} from \"viem\";\n\nimport { liquidityLockerAbi, portalAbi, tokenFactoryAbi } from \"../abi/generated\";\nimport { toLaunchpadTokenState } from \"../converters/state\";\nimport { toLaunchpadTradeAvailability } from \"../math/protection\";\nimport type {\n BuyQuote,\n LaunchpadActionContext,\n LaunchpadErc20Metadata,\n LaunchpadLockedPosition,\n LaunchpadPrice,\n LaunchpadReadOptions,\n LaunchpadTokenState,\n LaunchpadTradeAvailability,\n PredictedLaunchpadToken,\n SellQuote,\n} from \"../types\";\n\n/** Raised when a read is attempted with an input the Portal would reject outright. */\nexport class InvalidLaunchpadReadInputError extends Error {\n readonly field: string;\n\n constructor(field: string, message: string) {\n super(message);\n this.name = \"InvalidLaunchpadReadInputError\";\n this.field = field;\n }\n}\n\n/** Narrows read options to the block selector viem accepts, omitting absent keys entirely. */\nfunction blockSelector(options: LaunchpadReadOptions = {}) {\n if (options.blockNumber !== undefined) return { blockNumber: options.blockNumber };\n if (options.blockTag !== undefined) return { blockTag: options.blockTag };\n return {};\n}\n\n/**\n * Raised when a composite read that must observe one block is asked to use a tag with no stable\n * height. `pending` names a block that does not exist yet, so nothing can be pinned to it.\n */\nexport class UnpinnableBlockTagError extends Error {\n readonly blockTag: string;\n\n constructor(blockTag: string) {\n super(\n `Block tag \"${blockTag}\" has no stable height, so a same-block read cannot be pinned to it. Pass an explicit blockNumber, or use \"latest\", \"safe\", or \"finalized\".`,\n );\n this.name = \"UnpinnableBlockTagError\";\n this.blockTag = blockTag;\n }\n}\n\n/**\n * Resolves a concrete height that every part of a composite read can be pinned to.\n *\n * Reads that combine several calls must not each resolve `latest` independently: the chain head can\n * advance between them, silently mixing one block's state with another block's height or pause\n * flag. This collapses the caller's intent to a single number up front, so `latest`, `safe`,\n * `finalized`, and an explicit height all carry the same \"one observed block\" guarantee.\n *\n * Exported so callers composing their own multi-read views get the same guarantee instead of\n * resolving `latest` per call.\n */\nexport async function resolvePinnedBlockNumber(\n context: LaunchpadActionContext,\n options?: LaunchpadReadOptions,\n): Promise<bigint> {\n if (options?.blockNumber !== undefined) return options.blockNumber;\n if (options?.blockTag === undefined || options.blockTag === \"latest\") {\n return context.publicClient.getBlockNumber();\n }\n // A pending block is still being built, so it has no height to pin the other reads to.\n if (options.blockTag === \"pending\") throw new UnpinnableBlockTagError(options.blockTag);\n\n const block = await context.publicClient.getBlock({ blockTag: options.blockTag });\n if (block.number === null || block.number === undefined) {\n throw new UnpinnableBlockTagError(options.blockTag);\n }\n return block.number;\n}\n\nfunction assertPositiveAmount(field: string, value: bigint): void {\n if (value <= 0n) {\n throw new InvalidLaunchpadReadInputError(field, `${field} must be a positive bigint.`);\n }\n}\n\n/** Reads the Portal's token state and converts it to the stable domain shape. */\nexport async function getLaunchpadTokenState(\n context: LaunchpadActionContext,\n token: Address,\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadTokenState> {\n const raw = await context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"getTokenState\",\n args: [token],\n ...blockSelector(options),\n });\n\n return toLaunchpadTokenState(\n { chainId: context.deployment.chainId, address: getAddress(token) },\n raw,\n );\n}\n\n/** Reads the raw, untrusted metadata string. Parsing is the caller's choice. */\nexport function getLaunchpadTokenMetadata(\n context: LaunchpadActionContext,\n token: Address,\n options?: LaunchpadReadOptions,\n): Promise<string> {\n return context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"metadata\",\n args: [token],\n ...blockSelector(options),\n });\n}\n\n/**\n * Reads the bonding-curve reference price, tagged with its source and the phase observed at the\n * same block. This is never an executable quote and must not be used to derive a `minOut`; after\n * graduation it remains a curve value and does not track the V3 pool.\n *\n * The price and the phase are pinned to one resolved height, so a `graduated` phase can never be\n * reported alongside a price read from an earlier block (or the reverse).\n */\nexport async function getLaunchpadPrice(\n context: LaunchpadActionContext,\n token: Address,\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadPrice> {\n const blockNumber = await resolvePinnedBlockNumber(context, options);\n const [valueWad, state] = await Promise.all([\n context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"priceWad\",\n args: [token],\n blockNumber,\n }),\n getLaunchpadTokenState(context, token, { blockNumber }),\n ]);\n\n return Object.freeze({ valueWad, source: \"bondingCurveReference\" as const, phase: state.phase });\n}\n\n/** Quotes a curve buy. `quoteSpent` may be below `quoteIn` when the buy reaches graduation. */\nexport async function quoteLaunchpadBuy(\n context: LaunchpadActionContext,\n token: Address,\n quoteIn: bigint,\n options?: LaunchpadReadOptions,\n): Promise<BuyQuote> {\n assertPositiveAmount(\"quoteIn\", quoteIn);\n\n const [tokenOut, quoteSpent, fee, reachesThreshold] = await context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"quoteBuy\",\n args: [token, quoteIn],\n ...blockSelector(options),\n });\n\n return Object.freeze({ tokenOut, quoteSpent, fee, reachesGraduation: reachesThreshold });\n}\n\n/** Quotes a curve sell. `quoteOut` is already net of the trade fee. */\nexport async function quoteLaunchpadSell(\n context: LaunchpadActionContext,\n token: Address,\n tokenIn: bigint,\n options?: LaunchpadReadOptions,\n): Promise<SellQuote> {\n assertPositiveAmount(\"tokenIn\", tokenIn);\n\n const [quoteOut, fee] = await context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"quoteSell\",\n args: [token, tokenIn],\n ...blockSelector(options),\n });\n\n return Object.freeze({ quoteOut, fee });\n}\n\n/**\n * Combines token state, the global pause flag, and the block height into a single availability\n * view, so a UI renders the fee, reason, and next tradable block without duplicating rules.\n *\n * The height is resolved **first**, then the state and pause flag are both pinned to it. Resolving\n * them concurrently against `latest` would let the chain head advance mid-read and compute the\n * protection-fee ladder for one block from another block's state — reporting the wrong fee and,\n * inside the launch window, wrongly showing a banned token as tradable.\n */\nexport async function getLaunchpadTradeAvailability(\n context: LaunchpadActionContext,\n token: Address,\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadTradeAvailability> {\n const blockNumber = await resolvePinnedBlockNumber(context, options);\n const [state, protocolPaused] = await Promise.all([\n getLaunchpadTokenState(context, token, { blockNumber }),\n context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"paused\",\n blockNumber,\n }),\n ]);\n\n return toLaunchpadTradeAvailability(state, blockNumber, protocolPaused);\n}\n\n/** Reads an ERC-20 balance at the given block. */\nexport function getErc20Balance(\n context: LaunchpadActionContext,\n asset: Address,\n account: Address,\n options?: LaunchpadReadOptions,\n): Promise<bigint> {\n return context.publicClient.readContract({\n address: asset,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [account],\n ...blockSelector(options),\n });\n}\n\n/**\n * Reads a token's name, symbol, and decimals together at one block.\n *\n * The frontend integration guide lists these as required for any token screen, and reading them\n * as one pinned batch keeps a header from pairing one token's symbol with another's decimals\n * mid-render. Decimals matter most: formatting an amount with the wrong scale misstates it by\n * orders of magnitude.\n */\nexport async function getErc20Metadata(\n context: LaunchpadActionContext,\n asset: Address,\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadErc20Metadata> {\n const selector = blockSelector(options);\n const [name, symbol, decimals] = await Promise.all([\n context.publicClient.readContract({\n address: asset,\n abi: erc20Abi,\n functionName: \"name\",\n ...selector,\n }),\n context.publicClient.readContract({\n address: asset,\n abi: erc20Abi,\n functionName: \"symbol\",\n ...selector,\n }),\n context.publicClient.readContract({\n address: asset,\n abi: erc20Abi,\n functionName: \"decimals\",\n ...selector,\n }),\n ]);\n\n return Object.freeze({ address: asset, name, symbol, decimals });\n}\n\n/** Reads an ERC-20 allowance at the given block. */\nexport function getErc20Allowance(\n context: LaunchpadActionContext,\n asset: Address,\n owner: Address,\n spender: Address,\n options?: LaunchpadReadOptions,\n): Promise<bigint> {\n return context.publicClient.readContract({\n address: asset,\n abi: erc20Abi,\n functionName: \"allowance\",\n args: [owner, spender],\n ...blockSelector(options),\n });\n}\n\n/**\n * Reads a caller's claimable Locker reward for one asset. The Locker only ever exposes the\n * caller's own balance, so `account` is a lookup key, not an authorization bypass.\n */\nexport function getClaimableLaunchpadReward(\n context: LaunchpadActionContext,\n account: Address,\n asset: Address,\n options?: LaunchpadReadOptions,\n): Promise<bigint> {\n return context.publicClient.readContract({\n address: context.deployment.contracts.liquidityLocker,\n abi: liquidityLockerAbi,\n functionName: \"pendingRewards\",\n args: [account, asset],\n ...blockSelector(options),\n });\n}\n\n/**\n * Reads a locked V3 position by its LP NFT id, or `undefined` when nothing is registered.\n *\n * `tokenId` is the Uniswap V3 position NFT id minted during migration — not a token address. The\n * Locker stores only `tokenId -> position`, with no reverse index, and this SDK does not scan logs\n * to build one: `DATA_INDEXING_SPEC.md` assigns `PositionLocked`/`PositionMinted` to the indexing\n * service and forbids browsers from scanning `eth_getLogs` from the deployment block. Callers\n * therefore obtain `tokenId` from that service (or from the migration receipt) and pass it in.\n */\nexport async function getLockedLaunchpadPosition(\n context: LaunchpadActionContext,\n tokenId: bigint,\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadLockedPosition | undefined> {\n if (tokenId < 0n) throw new RangeError(\"tokenId must not be negative.\");\n\n const [token0, token1, creator, platformFeeBps] = await context.publicClient.readContract({\n address: context.deployment.contracts.liquidityLocker,\n abi: liquidityLockerAbi,\n functionName: \"positions\",\n args: [tokenId],\n ...blockSelector(options),\n });\n\n // An unregistered id reads back as a zero struct rather than reverting.\n if (isAddressEqual(creator, zeroAddress)) return undefined;\n\n return Object.freeze({ tokenId, token0, token1, creator, platformFeeBps });\n}\n\n/**\n * Predicts the CREATE2 address a token would receive if `creator` launched it right now.\n *\n * The Portal does not use `userSalt` directly — it derives the factory salt from the creator, an\n * auto-incrementing per-creator nonce, and `userSalt`:\n *\n * ```solidity\n * salt = keccak256(abi.encode(msg.sender, creatorNonces[msg.sender]++, params.userSalt));\n * ```\n *\n * Reproducing that by hand is easy to get subtly wrong, so it lives here. The returned\n * `creatorNonce` is part of the result rather than an internal detail: because the nonce increments\n * on every successful creation, a prediction is only valid until this creator launches their next\n * token. A UI offering to \"reserve\" an address must either create before that happens or re-check.\n *\n * This is a preview, not a reservation — nothing on-chain holds the address. Always take the real\n * address from the `TokenCreated` event in the receipt.\n */\nexport async function predictLaunchpadTokenAddress(\n context: LaunchpadActionContext,\n input: {\n readonly creator: Address;\n readonly name: string;\n readonly symbol: string;\n readonly userSalt: Hex;\n },\n options?: LaunchpadReadOptions,\n): Promise<PredictedLaunchpadToken> {\n if (input.name.length === 0 || input.symbol.length === 0) {\n throw new InvalidLaunchpadReadInputError(\n \"name\",\n \"Token name and symbol must not be empty; the prediction depends on both.\",\n );\n }\n\n const selector = blockSelector(options);\n const [creatorNonce, totalSupply] = await Promise.all([\n context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"creatorNonces\",\n args: [input.creator],\n ...selector,\n }),\n context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"TOTAL_SUPPLY\",\n ...selector,\n }),\n ]);\n\n const salt = keccak256(\n encodeAbiParameters(\n [{ type: \"address\" }, { type: \"uint256\" }, { type: \"bytes32\" }],\n [input.creator, creatorNonce, input.userSalt],\n ),\n );\n\n const address = await context.publicClient.readContract({\n address: context.deployment.contracts.tokenFactory,\n abi: tokenFactoryAbi,\n functionName: \"predictAddress\",\n args: [input.name, input.symbol, totalSupply, salt],\n ...selector,\n });\n\n return Object.freeze({\n address,\n creator: input.creator,\n creatorNonce,\n userSalt: input.userSalt,\n salt,\n });\n}\n","// This file is generated. Do not edit it manually.\nexport const constantProductCurveAbi = [\n {\n type: \"function\",\n name: \"quoteBuy\",\n inputs: [\n {\n name: \"state\",\n type: \"tuple\",\n internalType: \"struct ICurve.State\",\n components: [\n {\n name: \"totalSupply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"circulatingSupply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"quoteReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"virtualTokenReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"virtualQuoteReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"k\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"quoteIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"tokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"pure\",\n },\n {\n type: \"function\",\n name: \"quoteBuyExactOut\",\n inputs: [\n {\n name: \"state\",\n type: \"tuple\",\n internalType: \"struct ICurve.State\",\n components: [\n {\n name: \"totalSupply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"circulatingSupply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"quoteReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"virtualTokenReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"virtualQuoteReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"k\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"tokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"quoteIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"pure\",\n },\n {\n type: \"function\",\n name: \"quoteSell\",\n inputs: [\n {\n name: \"state\",\n type: \"tuple\",\n internalType: \"struct ICurve.State\",\n components: [\n {\n name: \"totalSupply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"circulatingSupply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"quoteReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"virtualTokenReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"virtualQuoteReserve\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"k\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"tokenIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"quoteOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"pure\",\n },\n {\n type: \"error\",\n name: \"InvalidAmount\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidState\",\n inputs: [],\n },\n] as const;\n","// This file is generated. Do not edit it manually.\nexport const liquidityLockerAbi = [\n {\n type: \"constructor\",\n inputs: [\n {\n name: \"owner_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"positionManager_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"platformTreasury_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"BPS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"MAX_PLATFORM_FEE_BPS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"acceptOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"claim\",\n inputs: [\n {\n name: \"asset\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"recipient\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"collectFees\",\n inputs: [\n {\n name: \"tokenId\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"amount0\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"amount1\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"creditMigrationDust\",\n inputs: [\n {\n name: \"asset\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"creator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"platformBps\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"migrators\",\n inputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onERC721Received\",\n inputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingRewards\",\n inputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"platformTreasury\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"positionManager\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"positions\",\n inputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"token0\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"token1\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"creator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"platformFeeBps\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"registerPosition\",\n inputs: [\n {\n name: \"tokenId\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"token0\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"token1\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"creator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"platformFeeBps\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setMigrator\",\n inputs: [\n {\n name: \"migrator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"allowed\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setPlatformTreasury\",\n inputs: [\n {\n name: \"treasury\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [\n {\n name: \"newOwner\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"FeesCollected\",\n inputs: [\n {\n name: \"tokenId\",\n type: \"uint256\",\n indexed: true,\n internalType: \"uint256\",\n },\n {\n name: \"amount0\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"amount1\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"MigrationDustCredited\",\n inputs: [\n {\n name: \"creator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"asset\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"MigratorSet\",\n inputs: [\n {\n name: \"migrator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"allowed\",\n type: \"bool\",\n indexed: false,\n internalType: \"bool\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n {\n name: \"owner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"pendingOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n {\n name: \"oldOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PlatformTreasurySet\",\n inputs: [\n {\n name: \"treasury\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PositionLocked\",\n inputs: [\n {\n name: \"tokenId\",\n type: \"uint256\",\n indexed: true,\n internalType: \"uint256\",\n },\n {\n name: \"creator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"platformFeeBps\",\n type: \"uint16\",\n indexed: false,\n internalType: \"uint16\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"RewardsClaimed\",\n inputs: [\n {\n name: \"account\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"asset\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"recipient\",\n type: \"address\",\n indexed: false,\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"InvalidConfig\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"NothingToClaim\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"PositionAlreadyRegistered\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"TransferFailed\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"Unauthorized\",\n inputs: [],\n },\n] as const;\n","// This file is generated. Do not edit it manually.\nexport const portalAbi = [\n {\n type: \"constructor\",\n inputs: [\n {\n name: \"owner_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"factory_\",\n type: \"address\",\n internalType: \"contract TokenFactory\",\n },\n {\n name: \"quoteToken_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"lpRecipient_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"BPS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"CURVE_K\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"DEFAULT_CURVE_ID\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"DEFAULT_MIGRATOR_ID\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"DEFAULT_PROTECTION_BLOCKS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"DEX_SUPPLY_THRESHOLD\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"MAX_PROTECTION_BLOCKS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"PLATFORM_LP_FEE_BPS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"TOTAL_SUPPLY\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"TRADE_FEE_BPS\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"VIRTUAL_QUOTE_RESERVE\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"VIRTUAL_TOKEN_RESERVE\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"acceptOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"buy\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"quoteIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"minTokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"deadline\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"tokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"quoteSpent\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"createToken\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n internalType: \"struct Portal.CreateParams\",\n components: [\n {\n name: \"name\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"symbol\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"metadata\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"userSalt\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n {\n name: \"initialQuoteIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"minInitialTokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"deadline\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"createTokenV2\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n internalType: \"struct Portal.CreateParams\",\n components: [\n {\n name: \"name\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"symbol\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"metadata\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"userSalt\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n {\n name: \"initialQuoteIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"minInitialTokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"deadline\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"protectionBlocks\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n outputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"creatorNonces\",\n inputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"curves\",\n inputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getTokenState\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"tuple\",\n internalType: \"struct Portal.TokenState\",\n components: [\n {\n name: \"status\",\n type: \"uint8\",\n internalType: \"enum Portal.Status\",\n },\n {\n name: \"tokenVersion\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"curveId\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"migratorId\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"quoteReserve\",\n type: \"uint128\",\n internalType: \"uint128\",\n },\n {\n name: \"circulatingSupply\",\n type: \"uint128\",\n internalType: \"uint128\",\n },\n {\n name: \"creator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"dexPool\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"launchBlock\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"protectionBlocks\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"pauseMode\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"lpRecipient\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"metadata\",\n inputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"migrate\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"pool\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"migrators\",\n inputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"paused\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"priceWad\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"protocolFees\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"quoteBuy\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"quoteIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"tokenOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"quoteSpent\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"fee\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"reachesThreshold\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"quoteSell\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"tokenIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"quoteOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"fee\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"quoteToken\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"registerCurve\",\n inputs: [\n {\n name: \"id\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"curve\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"registerMigrator\",\n inputs: [\n {\n name: \"id\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"migrator\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"sell\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"tokenIn\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"minQuoteOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"deadline\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"quoteOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setPaused\",\n inputs: [\n {\n name: \"paused_\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setTokenPause\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"mode\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"tokenFactory\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"contract TokenFactory\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [\n {\n name: \"newOwner\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"withdrawProtocolFees\",\n inputs: [\n {\n name: \"recipient\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"CurveRegistered\",\n inputs: [\n {\n name: \"id\",\n type: \"uint16\",\n indexed: true,\n internalType: \"uint16\",\n },\n {\n name: \"curve\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"MigrationCompleted\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"pool\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"liquidity\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"lpRecipient\",\n type: \"address\",\n indexed: false,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"MigrationStarted\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"tokenAmount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"quoteAmount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"MigratorRegistered\",\n inputs: [\n {\n name: \"id\",\n type: \"uint16\",\n indexed: true,\n internalType: \"uint16\",\n },\n {\n name: \"migrator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n {\n name: \"currentOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"pendingOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Paused\",\n inputs: [\n {\n name: \"paused\",\n type: \"bool\",\n indexed: false,\n internalType: \"bool\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"ProtocolFeesWithdrawn\",\n inputs: [\n {\n name: \"recipient\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"TokenCreated\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"creator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"name\",\n type: \"string\",\n indexed: false,\n internalType: \"string\",\n },\n {\n name: \"symbol\",\n type: \"string\",\n indexed: false,\n internalType: \"string\",\n },\n {\n name: \"metadata\",\n type: \"string\",\n indexed: false,\n internalType: \"string\",\n },\n {\n name: \"curveId\",\n type: \"uint16\",\n indexed: false,\n internalType: \"uint16\",\n },\n {\n name: \"migratorId\",\n type: \"uint16\",\n indexed: false,\n internalType: \"uint16\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"TokenPauseSet\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"mode\",\n type: \"uint8\",\n indexed: false,\n internalType: \"uint8\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Trade\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"trader\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"isBuy\",\n type: \"bool\",\n indexed: true,\n internalType: \"bool\",\n },\n {\n name: \"tokenAmount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"quoteAmount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"fee\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AccountingOverflow\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"DeadlineExpired\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidAmount\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidConfig\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidStatus\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"LaunchBlockTradingDisabled\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"ProtocolPaused\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"Reentrancy\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"SlippageExceeded\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"TransferFailed\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"Unauthorized\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"UnknownModule\",\n inputs: [],\n },\n] as const;\n","// This file is generated. Do not edit it manually.\nexport const tokenFactoryAbi = [\n {\n type: \"constructor\",\n inputs: [\n {\n name: \"owner_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"create\",\n inputs: [\n {\n name: \"name\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"symbol\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"supply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"salt\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"portal\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"predictAddress\",\n inputs: [\n {\n name: \"name\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"symbol\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"supply\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"salt\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"predicted\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"setPortal\",\n inputs: [\n {\n name: \"portal_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"error\",\n name: \"PortalAlreadySet\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"Unauthorized\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"ZeroAddress\",\n inputs: [],\n },\n] as const;\n","// This file is generated. Do not edit it manually.\nexport const v3MigratorAbi = [\n {\n type: \"constructor\",\n inputs: [\n {\n name: \"portal_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"factory_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"positionManager_\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"fee_\",\n type: \"uint24\",\n internalType: \"uint24\",\n },\n {\n name: \"locker_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"SQRT_RATIO_TOKEN0_LOWER_X96\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint160\",\n internalType: \"uint160\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"SQRT_RATIO_TOKEN0_UPPER_X96\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint160\",\n internalType: \"uint160\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"TOKEN0_TICK_LOWER\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"int24\",\n internalType: \"int24\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"TOKEN0_TICK_UPPER\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"int24\",\n internalType: \"int24\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"encodeSqrtRatioX96\",\n inputs: [\n {\n name: \"amount1\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"amount0\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"uint160\",\n internalType: \"uint160\",\n },\n ],\n stateMutability: \"pure\",\n },\n {\n type: \"function\",\n name: \"factory\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"fee\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint24\",\n internalType: \"uint24\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"locker\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"migrate\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"quoteToken\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"tokenAmount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"quoteAmount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"lpRecipient\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"pool\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"liquidityOut\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"portal\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"positionManager\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"preparePool\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"quoteToken\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"graduationPriceWad\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"pool\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"MigrationDust\",\n inputs: [\n {\n name: \"asset\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"recipient\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PositionMinted\",\n inputs: [\n {\n name: \"pool\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"tokenId\",\n type: \"uint256\",\n indexed: true,\n internalType: \"uint256\",\n },\n {\n name: \"liquidity\",\n type: \"uint128\",\n indexed: false,\n internalType: \"uint128\",\n },\n {\n name: \"amount0\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"amount1\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"InvalidAmount\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidConfig\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"PoolAlreadyInitialized\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"PoolNotPrepared\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"TransferFailed\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"Unauthorized\",\n inputs: [],\n },\n] as const;\n","import { type Address, getAddress, isAddressEqual, zeroAddress } from \"viem\";\n\nimport type {\n LaunchpadPauseMode,\n LaunchpadPhase,\n LaunchpadTokenId,\n LaunchpadTokenState,\n} from \"../types\";\n\n/** Raw `Portal.getTokenState` tuple. Consumers must never index this positionally. */\nexport interface RawLaunchpadTokenState {\n readonly status: number;\n readonly tokenVersion: number;\n readonly curveId: number;\n readonly migratorId: number;\n readonly quoteReserve: bigint;\n readonly circulatingSupply: bigint;\n readonly creator: Address;\n readonly dexPool: Address;\n readonly launchBlock: bigint;\n readonly protectionBlocks: number;\n readonly pauseMode: number;\n}\n\nexport class InvalidLaunchpadStateError extends Error {\n readonly field: string;\n\n constructor(field: string, message: string) {\n super(message);\n this.name = \"InvalidLaunchpadStateError\";\n this.field = field;\n }\n}\n\nconst phasesByStatus: readonly LaunchpadPhase[] = [\"invalid\", \"bonding\", \"migrating\", \"graduated\"];\nconst pauseModes: readonly LaunchpadPauseMode[] = [\"active\", \"buyPaused\", \"tradingPaused\"];\n\n/** Maps `Portal.Status` to a stable phase name. */\nexport function toLaunchpadPhase(status: number): LaunchpadPhase {\n const phase = phasesByStatus[status];\n if (phase === undefined) {\n throw new InvalidLaunchpadStateError(\"status\", `Unknown Portal token status: ${status}.`);\n }\n return phase;\n}\n\n/** Maps `Portal.TokenState.pauseMode` to a stable pause name. */\nexport function toLaunchpadPauseMode(pauseMode: number): LaunchpadPauseMode {\n const mode = pauseModes[pauseMode];\n if (mode === undefined) {\n throw new InvalidLaunchpadStateError(\"pauseMode\", `Unknown Portal pause mode: ${pauseMode}.`);\n }\n return mode;\n}\n\n/**\n * Converts the raw Portal state tuple into the stable domain shape.\n *\n * `dexPool` is omitted rather than reported as the zero address, so a caller can never mistake an\n * unprepared pool for a tradable one. The pool is only meaningful once the token has graduated;\n * it is populated at creation time for the migrator, so it is suppressed while `invalid`.\n */\nexport function toLaunchpadTokenState(\n id: LaunchpadTokenId,\n raw: RawLaunchpadTokenState,\n): LaunchpadTokenState {\n const phase = toLaunchpadPhase(raw.status);\n const hasPool = phase !== \"invalid\" && !isAddressEqual(raw.dexPool, zeroAddress);\n\n return Object.freeze({\n id,\n phase,\n tokenVersion: raw.tokenVersion,\n curveId: raw.curveId,\n migratorId: raw.migratorId,\n quoteReserve: raw.quoteReserve,\n circulatingSupply: raw.circulatingSupply,\n creator: getAddress(raw.creator),\n ...(hasPool ? { dexPool: getAddress(raw.dexPool) } : {}),\n launchBlock: raw.launchBlock,\n protectionBlocks: raw.protectionBlocks,\n pauseMode: toLaunchpadPauseMode(raw.pauseMode),\n });\n}\n","import type {\n LaunchpadTokenState,\n LaunchpadTradeAvailability,\n LaunchpadTradeBlockedReason,\n} from \"../types\";\n\n/** Regular curve trade fee once the protection window has elapsed (`Portal.TRADE_FEE_BPS`). */\nexport const TRADE_FEE_BPS = 100;\n\n/** `Portal.BPS`. A fee of exactly this value means trading is disabled, not a 100% fee. */\nexport const BPS = 10_000;\n\n/** `Portal.MAX_PROTECTION_BLOCKS`. Creators may choose fewer, so never assume this value. */\nexport const MAX_PROTECTION_BLOCKS = 6;\n\n/**\n * Anti-sniper fee ladder from `Portal._tradeFeeBps`, indexed by `block.number - launchBlock`.\n * Index 0 is `BPS`, which the Portal treats as \"trading disabled\" rather than a chargeable fee.\n */\nconst protectionFeeLadder: readonly number[] = [BPS, 5_000, 2_500, 1_500, 1_000, 500];\n\n/**\n * Reproduces `Portal._tradeFeeBps(state)` for a given block.\n *\n * Returns `BPS` (10000) only for the launch block itself, which the Portal rejects with\n * `LaunchBlockTradingDisabled`. Use {@link isLaunchBlockTradingDisabled} rather than comparing\n * the returned fee to 10000 at call sites.\n */\nexport function tradeFeeBpsAt(\n launchBlock: bigint,\n protectionBlocks: number,\n blockNumber: bigint,\n): number {\n if (blockNumber < launchBlock) {\n throw new RangeError(\"blockNumber must not precede the token's launch block.\");\n }\n const blockDelta = blockNumber - launchBlock;\n if (blockDelta >= BigInt(protectionBlocks)) return TRADE_FEE_BPS;\n // blockDelta < protectionBlocks <= MAX_PROTECTION_BLOCKS, so this index is always in range.\n return protectionFeeLadder[Number(blockDelta)] ?? TRADE_FEE_BPS;\n}\n\n/** True when the Portal would revert with `LaunchBlockTradingDisabled` at this block. */\nexport function isLaunchBlockTradingDisabled(\n launchBlock: bigint,\n protectionBlocks: number,\n blockNumber: bigint,\n): boolean {\n return tradeFeeBpsAt(launchBlock, protectionBlocks, blockNumber) === BPS;\n}\n\n/**\n * First block at which curve trading is permitted. With `protectionBlocks === 0` the ladder is\n * skipped entirely and the launch block itself is tradable.\n */\nexport function firstTradableBlock(launchBlock: bigint, protectionBlocks: number): bigint {\n return protectionBlocks === 0 ? launchBlock : launchBlock + 1n;\n}\n\n/**\n * Derives trade availability from already-read state, so a UI can render the fee, the reason\n * trading is blocked, and the next tradable block without duplicating protection rules.\n */\nexport function toLaunchpadTradeAvailability(\n state: LaunchpadTokenState,\n blockNumber: bigint,\n protocolPaused: boolean,\n): LaunchpadTradeAvailability {\n const feeBps =\n state.phase === \"bonding\"\n ? tradeFeeBpsAt(state.launchBlock, state.protectionBlocks, blockNumber)\n : TRADE_FEE_BPS;\n const launchBlocked = state.phase === \"bonding\" && feeBps === BPS;\n\n const blockedReason = ((): LaunchpadTradeBlockedReason | undefined => {\n if (state.phase === \"invalid\") return \"invalidToken\";\n if (state.phase === \"migrating\") return \"migrating\";\n if (state.phase === \"graduated\") return \"graduated\";\n if (protocolPaused) return \"protocolPaused\";\n if (state.pauseMode === \"tradingPaused\") return \"tradingPaused\";\n if (launchBlocked) return \"launchBlock\";\n if (state.pauseMode === \"buyPaused\") return \"buyPaused\";\n return undefined;\n })();\n\n const tradable = state.phase === \"bonding\" && !protocolPaused && !launchBlocked;\n\n return Object.freeze({\n phase: state.phase,\n protocolPaused,\n pauseMode: state.pauseMode,\n // `_buy` rejects any non-zero pauseMode; `sell` only rejects mode 2.\n canBuy: tradable && state.pauseMode === \"active\",\n canSell: tradable && state.pauseMode !== \"tradingPaused\",\n feeBps,\n blockNumber,\n ...(launchBlocked\n ? { nextTradableBlock: firstTradableBlock(state.launchBlock, state.protectionBlocks) }\n : {}),\n ...(blockedReason ? { blockedReason } : {}),\n });\n}\n","import type { Address } from \"viem\";\n\nimport type { LaunchpadActionContext, LaunchpadReadOptions } from \"../types\";\n\nimport { getErc20Allowance } from \"./read\";\n\n/** Allowance status for one asset/spender pair, resolved at a single block. */\nexport interface LaunchpadApprovalStatus {\n readonly asset: Address;\n readonly owner: Address;\n readonly spender: Address;\n readonly allowance: bigint;\n readonly requiredAmount: bigint;\n readonly sufficient: boolean;\n /** Exactly the shortfall, so a caller can approve the precise amount still needed. */\n readonly missingAmount: bigint;\n}\n\n/**\n * Resolves whether an exact-amount approval is still required.\n *\n * The spender for both buy and sell is always the Portal — never a pool and never a future DEX\n * router. For a buy, `requiredAmount` should be the quote's `quoteSpent` rather than the user's\n * typed input, because a graduating buy spends less than requested.\n */\nexport async function getLaunchpadApprovalStatus(\n context: LaunchpadActionContext,\n input: {\n readonly asset: Address;\n readonly owner: Address;\n readonly requiredAmount: bigint;\n readonly spender?: Address;\n },\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadApprovalStatus> {\n if (input.requiredAmount < 0n) {\n throw new RangeError(\"requiredAmount must not be negative.\");\n }\n\n const spender = input.spender ?? context.deployment.contracts.portal;\n const allowance = await getErc20Allowance(context, input.asset, input.owner, spender, options);\n const sufficient = allowance >= input.requiredAmount;\n\n return Object.freeze({\n asset: input.asset,\n owner: input.owner,\n spender,\n allowance,\n requiredAmount: input.requiredAmount,\n sufficient,\n missingAmount: sufficient ? 0n : input.requiredAmount - allowance,\n });\n}\n","import type { Slippage } from \"../types\";\n\nimport { BPS } from \"./protection\";\n\n/** Hard ceiling on caller-supplied slippage. Anything above this is rejected outright. */\nexport const MAX_SLIPPAGE_BPS = 1_000;\n\n/** Default deadline horizon: ten minutes from the reference chain time. */\nexport const DEFAULT_DEADLINE_SECONDS = 600n;\n\nexport class InvalidSlippageError extends Error {\n readonly bps: number;\n\n constructor(bps: number, message: string) {\n super(message);\n this.name = \"InvalidSlippageError\";\n this.bps = bps;\n }\n}\n\nexport class InvalidDeadlineError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidDeadlineError\";\n }\n}\n\n/** Validates a slippage tolerance against the 0..10% range. */\nexport function assertSlippage(slippage: Slippage): number {\n const { bps } = slippage;\n if (!Number.isSafeInteger(bps)) {\n throw new InvalidSlippageError(bps, \"Slippage bps must be an integer.\");\n }\n if (bps < 0) {\n throw new InvalidSlippageError(bps, \"Slippage bps must not be negative.\");\n }\n if (bps > MAX_SLIPPAGE_BPS) {\n throw new InvalidSlippageError(\n bps,\n `Slippage bps must not exceed ${MAX_SLIPPAGE_BPS} (${MAX_SLIPPAGE_BPS / 100}%).`,\n );\n }\n return bps;\n}\n\n/**\n * Applies slippage to a quoted output, rounding **down** so the on-chain minimum is never more\n * optimistic than the quote. Rejects a zero expected output, because a zero `minOut` would\n * disable the contract's own slippage guard.\n */\nexport function applySlippageToMinimumOut(expectedOut: bigint, slippage: Slippage): bigint {\n const bps = assertSlippage(slippage);\n if (expectedOut <= 0n) {\n throw new InvalidSlippageError(\n bps,\n \"Cannot derive a minimum output from a zero or negative quote.\",\n );\n }\n // Floor division: (expected * (10000 - bps)) / 10000.\n const minimumOut = (expectedOut * BigInt(BPS - bps)) / BigInt(BPS);\n if (minimumOut <= 0n) {\n throw new InvalidSlippageError(\n bps,\n \"Slippage tolerance reduces the minimum output to zero; lower the tolerance or raise the amount.\",\n );\n }\n return minimumOut;\n}\n\n/**\n * Builds a transaction deadline from a reference chain timestamp. The reference must come from a\n * block, not the client clock, because the Portal compares against `block.timestamp`.\n */\nexport function toDeadline(\n referenceTimestamp: bigint,\n seconds: bigint = DEFAULT_DEADLINE_SECONDS,\n): bigint {\n if (referenceTimestamp <= 0n) {\n throw new InvalidDeadlineError(\"Reference timestamp must be a positive bigint.\");\n }\n if (seconds <= 0n) {\n throw new InvalidDeadlineError(\"Deadline horizon must be a positive number of seconds.\");\n }\n return referenceTimestamp + seconds;\n}\n\n/** Rounds up `x * y / denominator`, mirroring `Portal._mulDivUp`. */\nexport function mulDivUp(x: bigint, y: bigint, denominator: bigint): bigint {\n if (denominator <= 0n) {\n throw new RangeError(\"mulDivUp denominator must be positive.\");\n }\n const product = x * y;\n const result = product / denominator;\n return product % denominator === 0n ? result : result + 1n;\n}\n","import type { BuyQuote } from \"../types\";\nimport { BPS, TRADE_FEE_BPS } from \"./protection\";\nimport { mulDivUp } from \"./slippage\";\n\n/**\n * `ICurve.State` as the Portal builds it in `_curveState`. Every field is read from the deployed\n * Portal's constants rather than hardcoded, so a redeployment with different curve parameters\n * cannot silently produce wrong quotes.\n */\nexport interface LaunchpadCurveState {\n readonly totalSupply: bigint;\n readonly circulatingSupply: bigint;\n readonly quoteReserve: bigint;\n readonly virtualTokenReserve: bigint;\n readonly virtualQuoteReserve: bigint;\n readonly k: bigint;\n}\n\n/** Portal curve constants, read once per deployment. */\nexport interface LaunchpadCurveConstants {\n readonly totalSupply: bigint;\n readonly dexSupplyThreshold: bigint;\n readonly virtualTokenReserve: bigint;\n readonly virtualQuoteReserve: bigint;\n readonly curveK: bigint;\n}\n\n/**\n * Builds the curve state the Portal would pass at token creation: nothing circulating and no\n * quote reserve yet. Identical to `Portal._curveState()` for a freshly created token.\n */\nexport function initialCurveState(constants: LaunchpadCurveConstants): LaunchpadCurveState {\n return Object.freeze({\n totalSupply: constants.totalSupply,\n circulatingSupply: 0n,\n quoteReserve: 0n,\n virtualTokenReserve: constants.virtualTokenReserve,\n virtualQuoteReserve: constants.virtualQuoteReserve,\n k: constants.curveK,\n });\n}\n\n/**\n * Fee applied to a creator's atomic first buy. `Portal._createToken` calls\n * `_buy(..., creatorFirstBuy = true)`, which pins the fee to `TRADE_FEE_BPS` and bypasses the\n * anti-sniper ladder entirely — the creator is never charged the launch-block rate.\n */\nexport function creatorFirstBuyFee(quoteIn: bigint): bigint {\n return (quoteIn * BigInt(TRADE_FEE_BPS)) / BigInt(BPS);\n}\n\n/**\n * Assembles a creator first-buy quote from the curve's own outputs.\n *\n * This mirrors `Portal._quoteBuy(state, quoteIn, creatorFirstBuy = true)` exactly. The two curve\n * results must come from `eth_call`s against the deployed `ConstantProductCurve` — the SDK never\n * reimplements the bonding-curve math in JavaScript. Only the flat fee and the `mulDivUp`\n * gross-up run locally, and both are exact in `bigint`.\n *\n * @param quoteIn Total quote the creator commits, fee inclusive.\n * @param tokenOutFromCurve `curve.quoteBuy(initialState, quoteIn - fee)`.\n * @param netRequiredForThreshold `curve.quoteBuyExactOut(initialState, dexSupplyThreshold)`,\n * required only when the first buy alone would reach graduation.\n */\nexport function toCreatorFirstBuyQuote(\n constants: LaunchpadCurveConstants,\n quoteIn: bigint,\n tokenOutFromCurve: bigint,\n netRequiredForThreshold?: bigint,\n): BuyQuote {\n if (quoteIn <= 0n) {\n throw new RangeError(\"Creator first buy requires a positive quoteIn.\");\n }\n\n const fee = creatorFirstBuyFee(quoteIn);\n // A fresh token has zero circulating supply, so the whole threshold is still available.\n const remaining = constants.dexSupplyThreshold;\n\n if (tokenOutFromCurve < remaining) {\n return Object.freeze({\n tokenOut: tokenOutFromCurve,\n quoteSpent: quoteIn,\n fee,\n reachesGraduation: false,\n });\n }\n\n if (netRequiredForThreshold === undefined) {\n throw new RangeError(\n \"The first buy reaches graduation; quoteBuyExactOut for the threshold is required.\",\n );\n }\n\n // Portal: quoteSpent = mulDivUp(netRequired, BPS, BPS - feeBps); fee = quoteSpent * feeBps / BPS.\n const quoteSpent = mulDivUp(netRequiredForThreshold, BigInt(BPS), BigInt(BPS - TRADE_FEE_BPS));\n return Object.freeze({\n tokenOut: remaining,\n quoteSpent,\n fee: (quoteSpent * BigInt(TRADE_FEE_BPS)) / BigInt(BPS),\n reachesGraduation: true,\n });\n}\n","import type { BuyQuote, SellQuote } from \"../types\";\nimport type { LaunchpadCurveConstants } from \"./curve\";\nimport { BPS, TRADE_FEE_BPS } from \"./protection\";\n\n/**\n * Scale factor baked into `Portal.priceWad`.\n *\n * The Portal computes `CURVE_K * 1e30 / effectiveBase²`, and `CURVE_K` is\n * `VIRTUAL_QUOTE_RESERVE * (TOTAL_SUPPLY + VIRTUAL_TOKEN_RESERVE)` — a product of one amount in the\n * quote's smallest unit and one in the token's. The quoted price is therefore\n * `(quote smallest unit / token smallest unit) * 1e30`, independent of either token's decimals.\n * Ratios against it need no decimals conversion, which is why nothing here takes one.\n */\nexport const PRICE_WAD_SCALE = 10n ** 30n;\n\n/**\n * Price impact in basis points: how far the average execution price sits from the spot price.\n *\n * Positive means the trade executed worse than spot (a buy pushing up the curve), negative means\n * better (a sell pushing down). Callers rendering a single figure usually want the magnitude.\n *\n * Both prices are expressed as quote-per-token, so the {@link PRICE_WAD_SCALE} cancels and no\n * decimals are involved.\n *\n * @param spotPriceWad `Portal.priceWad` observed at the same block as the quote.\n * @param quoteAmount Quote that actually moves along the curve, fee excluded.\n * @param tokenAmount Token that moves in the same trade.\n */\nexport function priceImpactBps(\n spotPriceWad: bigint,\n quoteAmount: bigint,\n tokenAmount: bigint,\n): number {\n if (spotPriceWad <= 0n) throw new RangeError(\"spotPriceWad must be positive.\");\n if (tokenAmount <= 0n) throw new RangeError(\"tokenAmount must be positive.\");\n if (quoteAmount < 0n) throw new RangeError(\"quoteAmount must not be negative.\");\n\n // executionWad = (quoteAmount / tokenAmount) * PRICE_WAD_SCALE, kept in one expression so the\n // division happens once, at the end.\n const executionWad = (quoteAmount * PRICE_WAD_SCALE) / tokenAmount;\n return Number(((executionWad - spotPriceWad) * BigInt(BPS)) / spotPriceWad);\n}\n\n/**\n * Price impact of a buy, with the protocol fee removed.\n *\n * `quoteSpent` is fee-inclusive but only `quoteSpent - fee` reaches the curve, so charging the fee\n * to price impact would overstate it — the fee is a separate, flat cost a UI shows on its own line.\n */\nexport function buyPriceImpactBps(spotPriceWad: bigint, quote: BuyQuote): number {\n return priceImpactBps(spotPriceWad, quote.quoteSpent - quote.fee, quote.tokenOut);\n}\n\n/**\n * Price impact of a sell, with the protocol fee added back.\n *\n * `quoteOut` is already net of the fee, so the gross amount the curve produced is `quoteOut + fee`.\n * The result is negative: a sell moves the price down.\n */\nexport function sellPriceImpactBps(\n spotPriceWad: bigint,\n quote: SellQuote,\n tokenIn: bigint,\n): number {\n return priceImpactBps(spotPriceWad, quote.quoteOut + quote.fee, tokenIn);\n}\n\n/**\n * Converts `Portal.priceWad` into quote-per-whole-token, scaled to 1e18 for display.\n *\n * `priceWad` is a ratio of smallest units, so rendering it directly is only correct for one\n * specific decimals pairing — with a 6-decimal quote and an 18-decimal token it happens to equal\n * this result, which is why `formatUnits(priceWad, 18)` appears to work. Against an 18-decimal\n * quote such as BNB or ETH that shortcut is off by twelve orders of magnitude, so the conversion\n * is made explicit here rather than left to a coincidence.\n */\nexport function priceWadPerWholeToken(\n priceWad: bigint,\n quoteDecimals: number,\n tokenDecimals = 18,\n): bigint {\n if (quoteDecimals < 0 || tokenDecimals < 0) {\n throw new RangeError(\"Decimals must not be negative.\");\n }\n return (\n (priceWad * 10n ** BigInt(tokenDecimals) * 10n ** 18n) /\n (PRICE_WAD_SCALE * 10n ** BigInt(quoteDecimals))\n );\n}\n\n/**\n * Fully diluted market capitalisation, in the quote token's smallest unit.\n *\n * Uses `totalSupply` rather than circulating supply: the whole supply is minted at creation, with\n * the un-sold remainder held by the Portal for the curve and the eventual V3 position.\n */\nexport function marketCapQuote(priceWad: bigint, totalSupply: bigint): bigint {\n return (priceWad * totalSupply) / PRICE_WAD_SCALE;\n}\n\n/**\n * Reproduces `Portal._priceWad` for an arbitrary circulating supply.\n *\n * Lets a caller price a point the curve has not reached yet — the graduation price, or a series\n * for a curve chart — without a round trip per point.\n */\nexport function curvePriceWadAt(\n circulatingSupply: bigint,\n constants: LaunchpadCurveConstants,\n): bigint {\n if (circulatingSupply < 0n || circulatingSupply > constants.totalSupply) {\n throw new RangeError(\"circulatingSupply must be between zero and the total supply.\");\n }\n const effectiveBase = constants.totalSupply - circulatingSupply + constants.virtualTokenReserve;\n return (constants.curveK * PRICE_WAD_SCALE) / (effectiveBase * effectiveBase);\n}\n\n/**\n * Market cap the token will have when it graduates, in the quote's smallest unit.\n *\n * This is the figure behind a \"migrates at X\" label. It is derived from the deployment's own curve\n * constants rather than hard-coded, so it stays correct if a deployment is configured differently\n * — and it is denominated in the quote token, not USD. Converting to USD needs an external price\n * for the quote, which is the application's concern, not the SDK's.\n */\nexport function graduationMarketCapQuote(constants: LaunchpadCurveConstants): bigint {\n return marketCapQuote(\n curvePriceWadAt(constants.dexSupplyThreshold, constants),\n constants.totalSupply,\n );\n}\n\n/** Graduation progress of a bonding token, derived from supply rather than reserve. */\nexport interface LaunchpadGraduationProgress {\n /** Token still purchasable on the curve before graduation, in the token's smallest unit. */\n readonly tokensRemaining: bigint;\n /** Progress toward the threshold, 0–10000. */\n readonly progressBps: number;\n /** True once the curve allocation is exhausted and the token is at or past graduation. */\n readonly reachedThreshold: boolean;\n}\n\n/**\n * Progress toward graduation, measured in supply.\n *\n * Supply is the condition the Portal actually tests (`tokenOut >= dexSupplyThreshold -\n * circulatingSupply`), so this needs no hard-coded quote target and stays exact. A UI that\n * displays \"X / Y quote raised\" can still show `quoteReserve` beside it, but the percentage\n * belongs to supply.\n *\n * Already-graduated tokens report 100%: their reserve is moved into the V3 position at migration\n * and reads back as zero, which would otherwise render as 0%.\n */\nexport function graduationProgress(\n circulatingSupply: bigint,\n constants: LaunchpadCurveConstants,\n): LaunchpadGraduationProgress {\n const threshold = constants.dexSupplyThreshold;\n if (threshold <= 0n) throw new RangeError(\"dexSupplyThreshold must be positive.\");\n\n if (circulatingSupply >= threshold) {\n return Object.freeze({ tokensRemaining: 0n, progressBps: BPS, reachedThreshold: true });\n }\n\n return Object.freeze({\n tokensRemaining: threshold - circulatingSupply,\n progressBps: Number((circulatingSupply * BigInt(BPS)) / threshold),\n reachedThreshold: false,\n });\n}\n\n/** Fee a plain (non-creator) trade pays at the standard rate, in the quote's smallest unit. */\nexport function tradeFee(quoteAmount: bigint): bigint {\n return (quoteAmount * BigInt(TRADE_FEE_BPS)) / BigInt(BPS);\n}\n","import type { Address } from \"viem\";\n\nimport { constantProductCurveAbi, portalAbi } from \"../abi/generated\";\nimport {\n creatorFirstBuyFee,\n initialCurveState,\n type LaunchpadCurveConstants,\n toCreatorFirstBuyQuote,\n} from \"../math/curve\";\nimport {\n graduationMarketCapQuote,\n graduationProgress,\n type LaunchpadGraduationProgress,\n marketCapQuote,\n} from \"../math/price\";\nimport type {\n BuyQuote,\n LaunchpadActionContext,\n LaunchpadPhase,\n LaunchpadReadOptions,\n} from \"../types\";\n\nimport {\n getLaunchpadTokenState,\n InvalidLaunchpadReadInputError,\n resolvePinnedBlockNumber,\n} from \"./read\";\n\n/** Narrows read options to the block selector viem accepts, omitting absent keys entirely. */\nfunction blockSelector(options: LaunchpadReadOptions = {}) {\n if (options.blockNumber !== undefined) return { blockNumber: options.blockNumber };\n if (options.blockTag !== undefined) return { blockTag: options.blockTag };\n return {};\n}\n\n/**\n * Reads the Portal's curve constants.\n *\n * These are `immutable`/`constant` on a given Portal, so a caller may read them once per\n * deployment and reuse the result. They are read from the contract rather than hardcoded so a\n * redeployment with different curve parameters cannot silently produce wrong quotes.\n */\nexport async function getLaunchpadCurveConstants(\n context: LaunchpadActionContext,\n options?: LaunchpadReadOptions,\n): Promise<LaunchpadCurveConstants> {\n const selector = blockSelector(options);\n const read = (\n functionName:\n | \"TOTAL_SUPPLY\"\n | \"DEX_SUPPLY_THRESHOLD\"\n | \"VIRTUAL_TOKEN_RESERVE\"\n | \"VIRTUAL_QUOTE_RESERVE\"\n | \"CURVE_K\",\n ) =>\n context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName,\n ...selector,\n }) as Promise<bigint>;\n\n const [totalSupply, dexSupplyThreshold, virtualTokenReserve, virtualQuoteReserve, curveK] =\n await Promise.all([\n read(\"TOTAL_SUPPLY\"),\n read(\"DEX_SUPPLY_THRESHOLD\"),\n read(\"VIRTUAL_TOKEN_RESERVE\"),\n read(\"VIRTUAL_QUOTE_RESERVE\"),\n read(\"CURVE_K\"),\n ]);\n\n return Object.freeze({\n totalSupply,\n dexSupplyThreshold,\n virtualTokenReserve,\n virtualQuoteReserve,\n curveK,\n });\n}\n\n/**\n * Quotes the creator's atomic first buy, so `prepareCreateToken` can be given a non-zero\n * `minInitialTokenOut` instead of the unsafe `0`.\n *\n * The Portal exposes no public creator-first-buy view: `_quoteBuy(..., creatorFirstBuy = true)` is\n * internal, and simulating `createTokenV2` only returns the new token address. However the\n * registered `ConstantProductCurve` is a deployed, stateless `pure` contract, so this reproduces\n * the Portal's own arithmetic by calling that contract with the state a freshly created token\n * would have. The bonding-curve math therefore runs as real Solidity, never as a JavaScript\n * re-implementation; only the flat 1% fee and the `mulDivUp` gross-up happen locally, both exact\n * in `bigint`.\n *\n * Pass `constants` to skip re-reading the Portal's immutable curve parameters on every quote.\n */\nexport async function quoteCreatorFirstBuy(\n context: LaunchpadActionContext,\n quoteIn: bigint,\n options?: LaunchpadReadOptions & { readonly constants?: LaunchpadCurveConstants },\n): Promise<BuyQuote> {\n if (quoteIn <= 0n) {\n throw new InvalidLaunchpadReadInputError(\"quoteIn\", \"quoteIn must be a positive bigint.\");\n }\n\n const constants = options?.constants ?? (await getLaunchpadCurveConstants(context, options));\n const fee = creatorFirstBuyFee(quoteIn);\n const netQuoteIn = quoteIn - fee;\n if (netQuoteIn <= 0n) {\n throw new InvalidLaunchpadReadInputError(\n \"quoteIn\",\n \"quoteIn is too small to buy anything once the 1% creator fee is deducted.\",\n );\n }\n\n const state = initialCurveState(constants);\n const curve: Address = context.deployment.contracts.curve;\n const selector = blockSelector(options);\n\n const tokenOutFromCurve = (await context.publicClient.readContract({\n address: curve,\n abi: constantProductCurveAbi,\n functionName: \"quoteBuy\",\n args: [state, netQuoteIn],\n ...selector,\n })) as bigint;\n\n // Only the graduating branch needs the exact-out vector, so it is read lazily.\n if (tokenOutFromCurve < constants.dexSupplyThreshold) {\n return toCreatorFirstBuyQuote(constants, quoteIn, tokenOutFromCurve);\n }\n\n const netRequiredForThreshold = (await context.publicClient.readContract({\n address: curve,\n abi: constantProductCurveAbi,\n functionName: \"quoteBuyExactOut\",\n args: [state, constants.dexSupplyThreshold],\n ...selector,\n })) as bigint;\n\n return toCreatorFirstBuyQuote(constants, quoteIn, tokenOutFromCurve, netRequiredForThreshold);\n}\n\n/**\n * Everything a token screen needs to render curve progress, resolved at one block.\n *\n * `apps/web` derived this from a hard-coded quote target and separate unpinned reads. Here the\n * threshold comes from the deployment's own constants and every figure shares a block, so the\n * headline market cap can never disagree with the progress bar beside it.\n */\nexport interface LaunchpadCurveProgress extends LaunchpadGraduationProgress {\n readonly blockNumber: bigint;\n readonly phase: LaunchpadPhase;\n readonly circulatingSupply: bigint;\n /** Quote raised on the curve. Reads back as zero once migrated — the reserve moved into V3. */\n readonly quoteReserve: bigint;\n readonly priceWad: bigint;\n /** Fully diluted market cap in the quote token's smallest unit. */\n readonly marketCapQuote: bigint;\n /**\n * Market cap this token graduates at, in the quote's smallest unit.\n *\n * Derived from the deployment's curve constants, never hard-coded, and denominated in the quote\n * token — a USD figure needs an external quote price, which the application owns.\n */\n readonly graduationMarketCapQuote: bigint;\n}\n\n/**\n * Reads curve progress for one token: tokens remaining, percentage, and market cap.\n *\n * Constants are immutable per deployment, so a caller holding them may pass them in to save a\n * round trip; otherwise they are read alongside everything else.\n */\nexport async function getLaunchpadCurveProgress(\n context: LaunchpadActionContext,\n token: Address,\n options?: LaunchpadReadOptions & { readonly constants?: LaunchpadCurveConstants },\n): Promise<LaunchpadCurveProgress> {\n const blockNumber = await resolvePinnedBlockNumber(context, options);\n // `getLaunchpadPrice` re-reads the token state to tag the price with a phase, which this already\n // has — so the raw `priceWad` is read directly to keep the call count down.\n const [state, priceWad, constants] = await Promise.all([\n getLaunchpadTokenState(context, token, { blockNumber }),\n context.publicClient.readContract({\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"priceWad\",\n args: [token],\n blockNumber,\n }),\n options?.constants\n ? Promise.resolve(options.constants)\n : getLaunchpadCurveConstants(context, { blockNumber }),\n ]);\n\n // A graduated token has already crossed the threshold, but its circulating supply is not what\n // reports that — the reserve and supply both settle at migration. Trust the phase.\n const progress =\n state.phase === \"graduated\" || state.phase === \"migrating\"\n ? { tokensRemaining: 0n, progressBps: 10_000, reachedThreshold: true }\n : graduationProgress(state.circulatingSupply, constants);\n\n return Object.freeze({\n ...progress,\n blockNumber,\n phase: state.phase,\n circulatingSupply: state.circulatingSupply,\n quoteReserve: state.quoteReserve,\n priceWad,\n marketCapQuote: marketCapQuote(priceWad, constants.totalSupply),\n graduationMarketCapQuote: graduationMarketCapQuote(constants),\n });\n}\n","import { UserRejectedRequestError } from \"viem\";\n\nexport type PeachSdkErrorCode =\n | \"INVALID_AMOUNT\"\n | \"MISSING_ACCOUNT\"\n | \"MISSING_CHAIN\"\n | \"UNSUPPORTED_CHAIN\"\n | \"USER_REJECTED\"\n | \"TRANSPORT_ERROR\"\n | \"CONTRACT_ERROR\"\n | \"UNKNOWN_ERROR\";\n\n/**\n * Cross-copy brand for shared SDK errors.\n *\n * Every product SDK bundles its own copy of these primitives, so an error thrown by\n * `@masterpeach/launchpad-sdk` is not an `instanceof` the class of the same name exported by\n * `@masterpeach/lending-sdk`. `Symbol.for` resolves through the runtime-wide symbol registry, so\n * each copy brands its errors with the identical key and can recognize the others'.\n */\nconst PEACH_SDK_ERROR_BRAND = Symbol.for(\"masterpeach.sdk-core.PeachSdkError\");\n\n/** Base error carrying a stable machine-readable code and structured diagnostic metadata. */\nexport class PeachSdkError extends Error {\n readonly code: PeachSdkErrorCode;\n readonly metadata: Readonly<Record<string, unknown>>;\n\n constructor(\n code: PeachSdkErrorCode,\n message: string,\n options: { cause?: unknown; metadata?: Readonly<Record<string, unknown>> } = {},\n ) {\n super(message, { cause: options.cause });\n this.name = \"PeachSdkError\";\n this.code = code;\n this.metadata = options.metadata ?? {};\n // Non-enumerable so the brand stays out of structured clones and JSON diagnostics.\n Object.defineProperty(this, PEACH_SDK_ERROR_BRAND, { value: true });\n }\n}\n\nexport class UnsupportedChainError extends PeachSdkError {\n constructor(chainId: number) {\n super(\"UNSUPPORTED_CHAIN\", `Unsupported chain: ${chainId}`, {\n metadata: { chainId },\n });\n this.name = \"UnsupportedChainError\";\n }\n}\n\nexport class MissingChainError extends PeachSdkError {\n constructor() {\n super(\"MISSING_CHAIN\", \"A chain ID is required for this operation.\");\n this.name = \"MissingChainError\";\n }\n}\n\nexport class MissingAccountError extends PeachSdkError {\n constructor() {\n super(\"MISSING_ACCOUNT\", \"A wallet account is required for this operation.\");\n this.name = \"MissingAccountError\";\n }\n}\n\n/**\n * Recognizes a shared SDK error regardless of which product SDK created it.\n *\n * Prefer this over `instanceof PeachSdkError` whenever an application depends on more than one\n * MasterPeach SDK: each package carries its own copy of the class, so `instanceof` only matches\n * errors that happened to originate from the same package. Pass a `code` to narrow in one step.\n */\nexport function isPeachSdkError(value: unknown): value is PeachSdkError;\nexport function isPeachSdkError<TCode extends PeachSdkErrorCode>(\n value: unknown,\n code: TCode,\n): value is PeachSdkError & { readonly code: TCode };\nexport function isPeachSdkError(value: unknown, code?: PeachSdkErrorCode): boolean {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n if ((value as Record<symbol, unknown>)[PEACH_SDK_ERROR_BRAND] !== true) {\n return false;\n }\n return code === undefined || (value as PeachSdkError).code === code;\n}\n\n/** Normalizes wallet rejection and unknown failures at a shared SDK boundary. */\nexport function toPeachSdkError(error: unknown): PeachSdkError {\n // Brand check rather than `instanceof`, so an error raised by a sibling SDK keeps its code\n // instead of being flattened into UNKNOWN_ERROR.\n if (isPeachSdkError(error)) {\n return error;\n }\n\n if (error instanceof UserRejectedRequestError) {\n return new PeachSdkError(\"USER_REJECTED\", \"The wallet request was rejected.\", {\n cause: error,\n });\n }\n\n return new PeachSdkError(\"UNKNOWN_ERROR\", \"An unknown SDK error occurred.\", {\n cause: error,\n });\n}\n","import type { WalletClient } from \"viem\";\n\nimport { MissingAccountError, UnsupportedChainError } from \"./errors\";\n\nexport type ChainRegistry<T> = Readonly<Record<number, T>>;\n\n/** Resolves a chain-scoped configuration value or throws a stable unsupported-chain error. */\nexport function resolveChainValue<T>(registry: ChainRegistry<T>, chainId: number): T {\n const value = registry[chainId];\n if (value === undefined) {\n throw new UnsupportedChainError(chainId);\n }\n return value;\n}\n\n/** Requires a Wallet Client with an attached account before a signing or write operation. */\nexport function requireWalletClient(walletClient: WalletClient | undefined): WalletClient {\n if (!walletClient?.account) {\n throw new MissingAccountError();\n }\n return walletClient;\n}\n","import type { Hash, TransactionReceipt } from \"viem\";\n\nexport type SdkTransactionStatus = \"pending\" | \"confirmed\" | \"reverted\";\n\n/** Framework-neutral transaction result shared by product SDK packages. */\nexport interface SdkTransactionResult {\n readonly hash: Hash;\n readonly status: SdkTransactionStatus;\n readonly receipt?: TransactionReceipt;\n}\n\n/** Converts a Viem receipt into the stable shared transaction result shape. */\nexport function transactionResultFromReceipt(receipt: TransactionReceipt): SdkTransactionResult {\n return {\n hash: receipt.transactionHash,\n status: receipt.status === \"success\" ? \"confirmed\" : \"reverted\",\n receipt,\n };\n}\n","import {\n type Address,\n decodeEventLog,\n isAddressEqual,\n type Log,\n type TransactionReceipt,\n} from \"viem\";\n\nimport { liquidityLockerAbi, portalAbi } from \"./abi/generated\";\nimport type { LaunchpadDeployment } from \"./deployment\";\n\nexport interface LaunchpadTokenCreatedEvent {\n readonly token: Address;\n readonly creator: Address;\n readonly name: string;\n readonly symbol: string;\n readonly metadata: string;\n readonly curveId: number;\n readonly migratorId: number;\n}\n\n/**\n * Direction-normalized trade event.\n *\n * The on-chain `quoteAmount` is asymmetric — the Portal emits the **net** quote on a buy and the\n * **gross** quote on a sell — so the raw value alone cannot be summed into volume. `raw` is\n * preserved for auditability while the derived deltas state, unambiguously, what the trader paid\n * or received and how the curve reserve moved.\n */\nexport interface LaunchpadTradeEvent {\n readonly token: Address;\n readonly trader: Address;\n readonly side: \"buy\" | \"sell\";\n readonly tokenAmount: bigint;\n readonly quoteAmountRaw: bigint;\n readonly fee: bigint;\n /** Signed change in the trader's quote balance: buy is negative, sell positive. */\n readonly traderQuoteDelta: bigint;\n /** Signed change in the curve's quote reserve. */\n readonly reserveQuoteDelta: bigint;\n}\n\nexport interface LaunchpadMigrationStartedEvent {\n readonly token: Address;\n readonly tokenAmount: bigint;\n readonly quoteAmount: bigint;\n}\n\nexport interface LaunchpadMigrationCompletedEvent {\n readonly token: Address;\n readonly pool: Address;\n readonly liquidity: bigint;\n readonly lpRecipient: Address;\n}\n\nexport interface LaunchpadRewardsClaimedEvent {\n readonly account: Address;\n readonly asset: Address;\n readonly recipient: Address;\n readonly amount: bigint;\n}\n\n/** Everything the SDK could decode from one receipt, scoped to a single deployment. */\nexport interface LaunchpadReceiptEvents {\n readonly tokenCreated: readonly LaunchpadTokenCreatedEvent[];\n readonly trades: readonly LaunchpadTradeEvent[];\n readonly migrationStarted: readonly LaunchpadMigrationStartedEvent[];\n readonly migrationCompleted: readonly LaunchpadMigrationCompletedEvent[];\n readonly rewardsClaimed: readonly LaunchpadRewardsClaimedEvent[];\n}\n\nfunction decodeFrom<Abi extends readonly unknown[]>(abi: Abi, log: Log) {\n try {\n return decodeEventLog({ abi, data: log.data, topics: log.topics } as never) as {\n eventName: string;\n args: Record<string, unknown>;\n };\n } catch {\n // Unrelated logs from the same transaction are expected; skip anything this ABI cannot decode.\n return undefined;\n }\n}\n\n/** Normalizes a `Trade` log's asymmetric quote semantics into explicit signed deltas. */\nfunction toTradeEvent(args: Record<string, unknown>): LaunchpadTradeEvent {\n const isBuy = args.isBuy as boolean;\n const quoteAmountRaw = args.quoteAmount as bigint;\n const fee = args.fee as bigint;\n\n return Object.freeze({\n token: args.token as Address,\n trader: args.trader as Address,\n side: isBuy ? (\"buy\" as const) : (\"sell\" as const),\n tokenAmount: args.tokenAmount as bigint,\n quoteAmountRaw,\n fee,\n // Buy emits netQuote, so the trader actually paid net + fee.\n // Sell emits grossQuote, so the trader actually received gross - fee.\n traderQuoteDelta: isBuy ? -(quoteAmountRaw + fee) : quoteAmountRaw - fee,\n reserveQuoteDelta: isBuy ? quoteAmountRaw : -quoteAmountRaw,\n });\n}\n\n/**\n * Decodes the Launchpad events in a receipt.\n *\n * Logs are filtered by emitting address against the deployment, so a transaction that also touches\n * unrelated contracts — or a look-alike contract emitting the same topic — cannot inject events\n * that appear to come from this Portal.\n */\nexport function parseLaunchpadReceiptEvents(\n deployment: LaunchpadDeployment,\n receipt: TransactionReceipt,\n): LaunchpadReceiptEvents {\n const tokenCreated: LaunchpadTokenCreatedEvent[] = [];\n const trades: LaunchpadTradeEvent[] = [];\n const migrationStarted: LaunchpadMigrationStartedEvent[] = [];\n const migrationCompleted: LaunchpadMigrationCompletedEvent[] = [];\n const rewardsClaimed: LaunchpadRewardsClaimedEvent[] = [];\n\n for (const log of receipt.logs) {\n if (isAddressEqual(log.address, deployment.contracts.portal)) {\n const decoded = decodeFrom(portalAbi, log);\n if (!decoded) continue;\n const args = decoded.args;\n\n switch (decoded.eventName) {\n case \"TokenCreated\":\n tokenCreated.push(\n Object.freeze({\n token: args.token as Address,\n creator: args.creator as Address,\n name: args.name as string,\n symbol: args.symbol as string,\n metadata: args.metadata as string,\n curveId: args.curveId as number,\n migratorId: args.migratorId as number,\n }),\n );\n break;\n case \"Trade\":\n trades.push(toTradeEvent(args));\n break;\n case \"MigrationStarted\":\n migrationStarted.push(\n Object.freeze({\n token: args.token as Address,\n tokenAmount: args.tokenAmount as bigint,\n quoteAmount: args.quoteAmount as bigint,\n }),\n );\n break;\n case \"MigrationCompleted\":\n migrationCompleted.push(\n Object.freeze({\n token: args.token as Address,\n pool: args.pool as Address,\n liquidity: args.liquidity as bigint,\n lpRecipient: args.lpRecipient as Address,\n }),\n );\n break;\n default:\n break;\n }\n continue;\n }\n\n if (isAddressEqual(log.address, deployment.contracts.liquidityLocker)) {\n const decoded = decodeFrom(liquidityLockerAbi, log);\n if (decoded?.eventName === \"RewardsClaimed\") {\n rewardsClaimed.push(\n Object.freeze({\n account: decoded.args.account as Address,\n asset: decoded.args.asset as Address,\n recipient: decoded.args.recipient as Address,\n amount: decoded.args.amount as bigint,\n }),\n );\n }\n }\n }\n\n return Object.freeze({\n tokenCreated: Object.freeze(tokenCreated),\n trades: Object.freeze(trades),\n migrationStarted: Object.freeze(migrationStarted),\n migrationCompleted: Object.freeze(migrationCompleted),\n rewardsClaimed: Object.freeze(rewardsClaimed),\n });\n}\n\n/**\n * Resolves the created token address from a receipt. The `TokenCreated` event is the only\n * authority — `TokenFactory.predictAddress` is a preview, never a success signal.\n */\nexport function createdTokenAddress(\n deployment: LaunchpadDeployment,\n receipt: TransactionReceipt,\n): Address | undefined {\n return parseLaunchpadReceiptEvents(deployment, receipt).tokenCreated[0]?.token;\n}\n","import type { Hash } from \"viem\";\nimport { type SdkTransactionResult, transactionResultFromReceipt } from \"../core\";\nimport { type LaunchpadReceiptEvents, parseLaunchpadReceiptEvents } from \"../events\";\nimport type { LaunchpadActionContext } from \"../types\";\n\n/** Confirmed transaction plus the Launchpad events decoded from its receipt. */\nexport interface LaunchpadTransactionResult extends SdkTransactionResult {\n readonly events: LaunchpadReceiptEvents;\n}\n\n/**\n * Waits for a transaction and decodes its Launchpad events.\n *\n * A reverted receipt is reported as `status: \"reverted\"` rather than thrown, so a caller can tell\n * \"the chain rejected this\" apart from \"the request never landed\". Events are still parsed, which\n * is empty for a revert.\n */\nexport async function waitForLaunchpadTransaction(\n context: LaunchpadActionContext,\n hash: Hash,\n options: { readonly confirmations?: number } = {},\n): Promise<LaunchpadTransactionResult> {\n const receipt = await context.publicClient.waitForTransactionReceipt({\n hash,\n ...(options.confirmations === undefined ? {} : { confirmations: options.confirmations }),\n });\n\n return Object.freeze({\n ...transactionResultFromReceipt(receipt),\n events: parseLaunchpadReceiptEvents(context.deployment, receipt),\n });\n}\n","import { type Account, type Address, erc20Abi, type Hash, type Hex, isAddressEqual } from \"viem\";\nimport { parseAccount } from \"viem/accounts\";\nimport { liquidityLockerAbi, portalAbi } from \"../abi/generated\";\nimport { MissingAccountError, requireWalletClient } from \"../core\";\nimport {\n ForgedPreparedTransactionError,\n LaunchpadApprovalRequiredError,\n LaunchpadInsufficientBalanceError,\n LaunchpadNothingToClaimError,\n LaunchpadPhaseUnavailableError,\n LaunchpadUnknownPositionError,\n PreparedAccountMismatchError,\n toLaunchpadError,\n WrongWalletChainError,\n} from \"../errors\";\nimport { MAX_PROTECTION_BLOCKS } from \"../math/protection\";\nimport { applySlippageToMinimumOut } from \"../math/slippage\";\nimport type { BuyQuote, LaunchpadWriteActionContext, SellQuote, Slippage } from \"../types\";\n\nimport { getLaunchpadApprovalStatus } from \"./approval\";\nimport { quoteCreatorFirstBuy } from \"./curve\";\nimport {\n getClaimableLaunchpadReward,\n getErc20Balance,\n getLaunchpadTokenState,\n getLockedLaunchpadPosition,\n quoteLaunchpadBuy,\n quoteLaunchpadSell,\n} from \"./read\";\n\n/**\n * Compile-time brand. It exists only in the type system, so application code cannot construct a\n * `PreparedLaunchpadTransaction` by writing an object literal — every value must come from one of\n * this module's `prepare*` functions. Runtime provenance is enforced separately (see\n * `assertPreparedProvenance` and the typed client's registry).\n */\ndeclare const preparedLaunchpadTransactionBrand: unique symbol;\n\n/** Canonical simulation requests, kept private so the public inspection copy cannot alter them. */\nconst canonicalPreparedRequests = new WeakMap<object, Record<string, unknown>>();\n\n/**\n * Copies and freezes the plain data Viem returns from `simulateContract`.\n *\n * Freezing only the prepared wrapper is insufficient: `request.args`, `request.account`, or the\n * ABI could otherwise be changed after simulation while the wrapper still passes provenance\n * checks. Functions on local accounts are immutable values and are intentionally retained.\n */\nfunction immutableClone<Value>(value: Value, seen = new WeakMap<object, unknown>()): Value {\n if (value === null || typeof value !== \"object\") return value;\n\n const source = value as object;\n const existing = seen.get(source);\n if (existing !== undefined) return existing as Value;\n\n const clone: object = Array.isArray(value)\n ? []\n : Object.create(Object.getPrototypeOf(source) as object | null);\n seen.set(source, clone);\n\n for (const key of Reflect.ownKeys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key);\n if (!descriptor) continue;\n if (\"value\" in descriptor) {\n descriptor.value = immutableClone(descriptor.value, seen);\n descriptor.writable = false;\n }\n descriptor.configurable = false;\n Object.defineProperty(clone, key, descriptor);\n }\n\n return Object.freeze(clone) as Value;\n}\n\n/**\n * The wallet and deployment context a prepared transaction was simulated under.\n *\n * Carried on the prepared value so the broadcast step can prove the wallet has not switched chain\n * or account, and that the request belongs to the deployment now in use.\n */\nexport interface PreparedLaunchpadTransactionContext {\n readonly chainId: number;\n readonly account: Address;\n readonly portal: Address;\n}\n\n/**\n * A simulated, ready-to-broadcast transaction plus the preview the simulation was based on.\n * Holding these together stops a caller from submitting one intent while showing another.\n */\nexport interface PreparedLaunchpadTransaction<Preview> {\n readonly [preparedLaunchpadTransactionBrand]: true;\n /** Frozen inspection copy; `send` uses a separate canonical snapshot retained by the SDK. */\n readonly request: Readonly<Record<string, unknown>>;\n readonly preview: Preview;\n readonly context: PreparedLaunchpadTransactionContext;\n}\n\n/** Mints a branded prepared transaction. Internal: the brand is unforgeable from outside. */\nfunction toPrepared<Preview>(\n request: Record<string, unknown>,\n preview: Preview,\n context: PreparedLaunchpadTransactionContext,\n): PreparedLaunchpadTransaction<Preview> {\n // Keep two independent immutable snapshots: one is public for inspection, while the canonical\n // request remains reachable only through the module-private WeakMap used by send().\n const canonicalRequest = immutableClone(request);\n const prepared = Object.freeze({\n request: immutableClone(request),\n preview,\n context,\n }) as unknown as PreparedLaunchpadTransaction<Preview>;\n canonicalPreparedRequests.set(prepared, canonicalRequest);\n return prepared;\n}\n\n/** Builds the prepared-transaction context from a validated write account. */\nfunction preparedContext(\n context: LaunchpadWriteActionContext,\n account: Account,\n): PreparedLaunchpadTransactionContext {\n return Object.freeze({\n chainId: context.deployment.chainId,\n account: account.address,\n portal: context.deployment.contracts.portal,\n });\n}\n\nexport interface CreateTokenPreview {\n /** The full creator first-buy quote, or `undefined` when no first buy is made. */\n readonly firstBuy?: BuyQuote;\n readonly initialQuoteIn: bigint;\n readonly minInitialTokenOut: bigint;\n readonly protectionBlocks: number;\n readonly deadline: bigint;\n}\n\nexport interface MigrationPreview {\n readonly token: Address;\n}\n\nexport interface ClaimPreview {\n readonly asset: Address;\n readonly recipient: Address;\n readonly amount: bigint;\n}\n\n/**\n * Outcome of collecting a locked V3 position's fees, simulated before broadcast.\n *\n * `amount0`/`amount1` are the gross amounts the Locker pulls from the position manager; the\n * creator's share is what lands in `pendingRewards` after `platformFeeBps` is taken.\n */\nexport interface CollectFeesPreview {\n readonly tokenId: bigint;\n readonly token0: Address;\n readonly token1: Address;\n readonly creator: Address;\n readonly platformFeeBps: number;\n readonly amount0: bigint;\n readonly amount1: bigint;\n}\n\nexport interface ApprovalPreview {\n readonly asset: Address;\n readonly spender: Address;\n readonly amount: bigint;\n}\n\n/**\n * Resolves the signing account and asserts the wallet's live chain matches the deployment.\n *\n * The chain is re-read from the wallet on every write rather than trusted from client\n * construction, because a user can switch networks at any time.\n */\nasync function requireWriteAccount(context: LaunchpadWriteActionContext): Promise<Account> {\n const walletClient = requireWalletClient(context.walletClient);\n const chainId = await walletClient.getChainId();\n if (chainId !== context.deployment.chainId) {\n throw new WrongWalletChainError(context.deployment.chainId, chainId);\n }\n // `walletClient.account` is a construction-time snapshot for JSON-RPC wallets. `eth_accounts`\n // reflects the wallet's currently selected account, including a switch that happened after this\n // Client was created but before the application rebuilt it.\n const [liveAddress] = await walletClient.getAddresses();\n if (!liveAddress) throw new MissingAccountError();\n\n const configuredAccount = walletClient.account;\n if (!configuredAccount) throw new MissingAccountError();\n return isAddressEqual(configuredAccount.address, liveAddress)\n ? configuredAccount\n : parseAccount(liveAddress);\n}\n\n/** Simulates a contract call and normalizes any revert into a stable Launchpad error. */\nasync function simulate(\n context: LaunchpadWriteActionContext,\n parameters: Record<string, unknown>,\n): Promise<{ request: Record<string, unknown>; result: unknown }> {\n try {\n const { request, result } = await context.publicClient.simulateContract(parameters as never);\n return { request: request as unknown as Record<string, unknown>, result };\n } catch (error) {\n throw toLaunchpadError(error);\n }\n}\n\n/**\n * Asserts an account can actually part with `requiredAmount` of `asset`.\n *\n * Balance and allowance are read together and reported separately, because they need different\n * fixes: an allowance shortfall is one approval away, an empty balance is not. Balance is reported\n * first for the same reason — approving funds the account does not hold only defers the failure.\n *\n * Both are checked before simulating, since the Portal moves funds via `SafeTransferLib`, whose\n * `TransferFailed()` erases which of the two conditions actually failed.\n */\nasync function assertCanSpend(\n context: LaunchpadWriteActionContext,\n input: {\n readonly asset: Address;\n readonly owner: Address;\n readonly requiredAmount: bigint;\n },\n): Promise<void> {\n const [balance, approval] = await Promise.all([\n getErc20Balance(context, input.asset, input.owner),\n getLaunchpadApprovalStatus(context, {\n asset: input.asset,\n owner: input.owner,\n requiredAmount: input.requiredAmount,\n }),\n ]);\n\n if (balance < input.requiredAmount) {\n throw new LaunchpadInsufficientBalanceError(\n input.asset,\n input.owner,\n input.requiredAmount,\n balance,\n );\n }\n if (!approval.sufficient) {\n throw new LaunchpadApprovalRequiredError(\n approval.asset,\n approval.spender,\n approval.requiredAmount,\n );\n }\n}\n\n/**\n * Prepares an ERC-20 approval for an exact amount.\n *\n * The SDK never widens this to an unlimited allowance on the caller's behalf; a UI wanting\n * `maxUint256` must pass it explicitly and show its own risk confirmation.\n */\nexport async function prepareApproveErc20(\n context: LaunchpadWriteActionContext,\n input: { readonly asset: Address; readonly amount: bigint; readonly spender?: Address },\n): Promise<PreparedLaunchpadTransaction<ApprovalPreview>> {\n const account = await requireWriteAccount(context);\n const spender = input.spender ?? context.deployment.contracts.portal;\n if (input.amount < 0n) throw new RangeError(\"Approval amount must not be negative.\");\n\n const { request } = await simulate(context, {\n account,\n address: input.asset,\n abi: erc20Abi,\n functionName: \"approve\",\n args: [spender, input.amount],\n });\n\n return toPrepared(\n request,\n { asset: input.asset, spender, amount: input.amount },\n preparedContext(context, account),\n );\n}\n\n/**\n * Prepares a bonding-curve buy: refreshes the quote, derives a non-zero `minTokenOut` from the\n * caller's slippage, verifies the allowance covers `quoteSpent`, then simulates.\n */\nexport async function prepareLaunchpadBuy(\n context: LaunchpadWriteActionContext,\n input: {\n readonly token: Address;\n readonly quoteIn: bigint;\n readonly slippage: Slippage;\n readonly deadline: bigint;\n },\n): Promise<PreparedLaunchpadTransaction<BuyQuote>> {\n const account = await requireWriteAccount(context);\n const quote = await quoteLaunchpadBuy(context, input.token, input.quoteIn);\n const minTokenOut = applySlippageToMinimumOut(quote.tokenOut, input.slippage);\n\n // A graduating buy spends less than requested, so check against quoteSpent, not quoteIn.\n await assertCanSpend(context, {\n asset: context.deployment.contracts.quoteToken,\n owner: account.address,\n requiredAmount: quote.quoteSpent,\n });\n\n const { request } = await simulate(context, {\n account,\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"buy\",\n args: [input.token, input.quoteIn, minTokenOut, input.deadline],\n });\n\n return toPrepared(request, quote, preparedContext(context, account));\n}\n\n/** Prepares a bonding-curve sell with a non-zero `minQuoteOut` and a Portal-scoped allowance. */\nexport async function prepareLaunchpadSell(\n context: LaunchpadWriteActionContext,\n input: {\n readonly token: Address;\n readonly tokenIn: bigint;\n readonly slippage: Slippage;\n readonly deadline: bigint;\n },\n): Promise<PreparedLaunchpadTransaction<SellQuote>> {\n const account = await requireWriteAccount(context);\n const quote = await quoteLaunchpadSell(context, input.token, input.tokenIn);\n const minQuoteOut = applySlippageToMinimumOut(quote.quoteOut, input.slippage);\n\n // The spender is always the Portal, never a pool or a future router.\n await assertCanSpend(context, {\n asset: input.token,\n owner: account.address,\n requiredAmount: input.tokenIn,\n });\n\n const { request } = await simulate(context, {\n account,\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"sell\",\n args: [input.token, input.tokenIn, minQuoteOut, input.deadline],\n });\n\n return toPrepared(request, quote, preparedContext(context, account));\n}\n\n/** Input for {@link prepareCreateToken}. */\nexport interface CreateTokenInput {\n readonly name: string;\n readonly symbol: string;\n readonly metadata: string;\n readonly userSalt: Hex;\n /** Quote committed to the creator's atomic first buy. Zero means no first buy. */\n readonly initialQuoteIn: bigint;\n readonly deadline: bigint;\n readonly protectionBlocks: number;\n /**\n * Slippage tolerance used to derive `minInitialTokenOut` from the creator first-buy quote.\n * Required when `initialQuoteIn > 0`, unless `minInitialTokenOut` is supplied instead.\n */\n readonly slippage?: Slippage;\n /**\n * Advanced escape hatch: an explicit minimum that overrides the slippage-derived value.\n *\n * Kept only for callers who compute the minimum themselves against their own quote. It must be\n * positive whenever a first buy is made and must not exceed the SDK's own fresh quote (which\n * would revert on-chain). It is never a way to opt out of slippage protection: passing `0` with\n * a first buy is rejected, so there is no unsafe default path.\n */\n readonly minInitialTokenOut?: bigint;\n}\n\n/**\n * Prepares token creation, deriving a safe non-zero `minInitialTokenOut` for the creator's atomic\n * first buy.\n *\n * When `initialQuoteIn > 0` the SDK prices the first buy itself via the deployed curve\n * ({@link quoteCreatorFirstBuy}) and applies the caller's slippage, so a caller never has to invent\n * a minimum. Two contract details drive the rest:\n *\n * - The allowance is checked against `quote.quoteSpent`, not `initialQuoteIn`. A first buy large\n * enough to graduate is truncated at the threshold and the Portal transfers only `quoteSpent`, so\n * requiring the full input would demand an allowance the transaction never uses.\n * - The simulation still passes the caller's raw `initialQuoteIn`, because the Portal performs that\n * truncation itself; passing `quoteSpent` would change the intent.\n *\n * When `initialQuoteIn` is zero, `minInitialTokenOut` must also be zero — the Portal rejects any\n * other combination.\n */\nexport async function prepareCreateToken(\n context: LaunchpadWriteActionContext,\n input: CreateTokenInput,\n): Promise<PreparedLaunchpadTransaction<CreateTokenPreview>> {\n const account = await requireWriteAccount(context);\n\n if (input.name.length === 0 || input.symbol.length === 0) {\n throw new RangeError(\"Token name and symbol must not be empty.\");\n }\n // The Portal reverts with InvalidConfig above MAX_PROTECTION_BLOCKS; reject it here so the\n // caller gets a precise error instead of an opaque revert, and so the SDK's own fee ladder\n // never has to reason about an out-of-range window.\n if (\n !Number.isSafeInteger(input.protectionBlocks) ||\n input.protectionBlocks < 0 ||\n input.protectionBlocks > MAX_PROTECTION_BLOCKS\n ) {\n throw new RangeError(\n `protectionBlocks must be an integer between 0 and ${MAX_PROTECTION_BLOCKS}.`,\n );\n }\n if (input.initialQuoteIn < 0n) {\n throw new RangeError(\"initialQuoteIn must not be negative.\");\n }\n\n let firstBuy: BuyQuote | undefined;\n let minInitialTokenOut = 0n;\n\n if (input.initialQuoteIn === 0n) {\n if (input.minInitialTokenOut !== undefined && input.minInitialTokenOut !== 0n) {\n throw new RangeError(\"minInitialTokenOut must be zero when no initial buy is made.\");\n }\n if (input.slippage !== undefined) {\n throw new RangeError(\"slippage is meaningless when no initial buy is made.\");\n }\n } else {\n if (input.slippage === undefined && input.minInitialTokenOut === undefined) {\n throw new RangeError(\n \"A creator first buy requires either slippage (recommended) or an explicit minInitialTokenOut.\",\n );\n }\n\n // Price the first buy through the deployed curve so the minimum is derived, never guessed.\n firstBuy = await quoteCreatorFirstBuy(context, input.initialQuoteIn);\n\n if (input.minInitialTokenOut === undefined) {\n // slippage is defined here: the branch above rejects the case where both are absent.\n minInitialTokenOut = applySlippageToMinimumOut(firstBuy.tokenOut, input.slippage as Slippage);\n } else {\n if (input.minInitialTokenOut <= 0n) {\n throw new RangeError(\n \"A creator first buy requires a positive minInitialTokenOut; pass slippage to derive one.\",\n );\n }\n if (input.minInitialTokenOut > firstBuy.tokenOut) {\n throw new RangeError(\n `minInitialTokenOut ${input.minInitialTokenOut} exceeds the quoted first-buy output ${firstBuy.tokenOut} and would revert.`,\n );\n }\n minInitialTokenOut = input.minInitialTokenOut;\n }\n\n // The Portal transfers only quoteSpent, which is below initialQuoteIn for a graduating buy.\n await assertCanSpend(context, {\n asset: context.deployment.contracts.quoteToken,\n owner: account.address,\n requiredAmount: firstBuy.quoteSpent,\n });\n }\n\n const { request } = await simulate(context, {\n account,\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"createTokenV2\",\n args: [\n {\n name: input.name,\n symbol: input.symbol,\n metadata: input.metadata,\n userSalt: input.userSalt,\n },\n // Raw input, not quoteSpent: the Portal truncates a graduating buy itself.\n input.initialQuoteIn,\n minInitialTokenOut,\n input.deadline,\n input.protectionBlocks,\n ],\n });\n\n return toPrepared(\n request,\n {\n ...(firstBuy ? { firstBuy } : {}),\n initialQuoteIn: input.initialQuoteIn,\n minInitialTokenOut,\n protectionBlocks: input.protectionBlocks,\n deadline: input.deadline,\n },\n preparedContext(context, account),\n );\n}\n\n/** Prepares the permissionless migration. Only valid while the token is `migrating`. */\nexport async function prepareLaunchpadMigration(\n context: LaunchpadWriteActionContext,\n token: Address,\n): Promise<PreparedLaunchpadTransaction<MigrationPreview>> {\n const account = await requireWriteAccount(context);\n const state = await getLaunchpadTokenState(context, token);\n if (state.phase !== \"migrating\") {\n throw new LaunchpadPhaseUnavailableError(state.phase);\n }\n\n const { request } = await simulate(context, {\n account,\n address: context.deployment.contracts.portal,\n abi: portalAbi,\n functionName: \"migrate\",\n args: [token],\n });\n\n return toPrepared(request, { token }, preparedContext(context, account));\n}\n\n/**\n * Prepares a fee collection for a locked V3 position.\n *\n * This is the step that funds a claim: it pulls the position's accrued V3 fees into the Locker and\n * credits the creator's share to `pendingRewards`. Until it runs there is nothing to claim, so a\n * rewards UI that only exposes `prepareClaimReward` can never pay anyone out.\n *\n * Permissionless by design — the Locker credits `positions[tokenId].creator`, never the caller, so\n * anyone may trigger collection and it is deliberately *not* behind the `rewards` capability.\n * Gating it would let a disabled capability strand fees that belong to creators.\n *\n * `tokenId` is the Uniswap V3 position NFT id, obtained from the indexing service or the migration\n * receipt; see {@link getLockedLaunchpadPosition} for why the SDK cannot resolve it from a token\n * address.\n */\nexport async function prepareCollectLaunchpadFees(\n context: LaunchpadWriteActionContext,\n tokenId: bigint,\n): Promise<PreparedLaunchpadTransaction<CollectFeesPreview>> {\n const account = await requireWriteAccount(context);\n\n // The Locker reverts with InvalidConfig for an unregistered id; resolve it first so the caller\n // learns the id is unknown rather than decoding a generic config revert.\n const position = await getLockedLaunchpadPosition(context, tokenId);\n if (!position) {\n throw new LaunchpadUnknownPositionError(tokenId);\n }\n\n const { request, result } = await simulate(context, {\n account,\n address: context.deployment.contracts.liquidityLocker,\n abi: liquidityLockerAbi,\n functionName: \"collectFees\",\n args: [tokenId],\n });\n\n const [amount0, amount1] = result as readonly [bigint, bigint];\n\n return toPrepared(\n request,\n {\n tokenId,\n token0: position.token0,\n token1: position.token1,\n creator: position.creator,\n platformFeeBps: position.platformFeeBps,\n amount0,\n amount1,\n },\n preparedContext(context, account),\n );\n}\n\n/**\n * Prepares a Locker reward claim.\n *\n * The Locker only ever pays out `pendingRewards[msg.sender]`, so a claim can never drain another\n * account. Callers must gate this behind the deployment's `rewards` capability, which is off by\n * default until the product confirms the claim surface.\n *\n * A claim only pays out what {@link prepareCollectLaunchpadFees} has already credited.\n */\nexport async function prepareClaimLaunchpadReward(\n context: LaunchpadWriteActionContext,\n input: { readonly asset: Address; readonly recipient?: Address },\n): Promise<PreparedLaunchpadTransaction<ClaimPreview>> {\n const account = await requireWriteAccount(context);\n const recipient = input.recipient ?? account.address;\n\n const amount = await getClaimableLaunchpadReward(context, account.address, input.asset);\n if (amount <= 0n) {\n throw new LaunchpadNothingToClaimError(input.asset, account.address);\n }\n\n const { request } = await simulate(context, {\n account,\n address: context.deployment.contracts.liquidityLocker,\n abi: liquidityLockerAbi,\n functionName: \"claim\",\n args: [input.asset, recipient],\n });\n\n return toPrepared(\n request,\n { asset: input.asset, recipient, amount },\n preparedContext(context, account),\n );\n}\n\n/**\n * Re-validates a prepared transaction against the live wallet and the deployment in use.\n *\n * Preparation and broadcast are separate user-visible steps, and a wallet can switch chain or\n * account in between — so the checks made during `prepare` are re-run here rather than trusted.\n * The deployment is compared too, so a request simulated for one Portal can never be broadcast\n * through a client bound to another.\n */\nasync function assertPreparedStillValid(\n context: LaunchpadWriteActionContext,\n prepared: PreparedLaunchpadTransaction<unknown>,\n): Promise<void> {\n if (\n prepared === null ||\n typeof prepared !== \"object\" ||\n typeof prepared.request !== \"object\" ||\n prepared.request === null ||\n typeof prepared.context !== \"object\" ||\n prepared.context === null\n ) {\n throw new ForgedPreparedTransactionError(\n \"The prepared transaction is malformed; obtain it from a prepare* call.\",\n );\n }\n\n if (!canonicalPreparedRequests.has(prepared)) {\n throw new ForgedPreparedTransactionError(\n \"The prepared transaction did not originate from this SDK process; obtain it from a prepare* call.\",\n );\n }\n\n // The deployment must match before the wallet is touched: a cross-deployment request is a\n // programming error, not a user action to be re-confirmed.\n if (prepared.context.chainId !== context.deployment.chainId) {\n throw new ForgedPreparedTransactionError(\n `The prepared transaction targets chain ${prepared.context.chainId} but this client is bound to chain ${context.deployment.chainId}.`,\n );\n }\n if (!isAddressEqual(prepared.context.portal, context.deployment.contracts.portal)) {\n throw new ForgedPreparedTransactionError(\n `The prepared transaction targets Portal ${prepared.context.portal} but this client is bound to ${context.deployment.contracts.portal}.`,\n );\n }\n\n // Re-read both the live chain and `eth_accounts`; neither WalletClient field is assumed current.\n const account = await requireWriteAccount(context);\n if (!isAddressEqual(account.address, prepared.context.account)) {\n throw new PreparedAccountMismatchError(prepared.context.account, account.address);\n }\n}\n\n/**\n * Broadcasts an already-simulated transaction. Never simulates or mutates the request here.\n *\n * The module-private canonical-request registry also protects this standalone action: structural\n * copies and hand-built values have no canonical simulation request and are rejected.\n */\nexport async function sendPreparedLaunchpadTransaction(\n context: LaunchpadWriteActionContext,\n prepared: PreparedLaunchpadTransaction<unknown>,\n): Promise<Hash> {\n await assertPreparedStillValid(context, prepared);\n const walletClient = requireWalletClient(context.walletClient);\n const canonicalRequest = canonicalPreparedRequests.get(prepared);\n if (!canonicalRequest) {\n // Defensive duplicate of the provenance check above, keeping the value narrowed at use.\n throw new ForgedPreparedTransactionError(\n \"The prepared transaction has no canonical simulated request; prepare it again.\",\n );\n }\n try {\n return await walletClient.writeContract(canonicalRequest as never);\n } catch (error) {\n throw toLaunchpadError(error);\n }\n}\n","import { type Address, BaseError, ContractFunctionRevertedError } from \"viem\";\nimport { toPeachSdkError } from \"./core\";\n\nimport type { LaunchpadPauseMode, LaunchpadPhase } from \"./types\";\n\n/** Base class for every stable Launchpad failure, so callers can branch on one instanceof. */\nexport class LaunchpadError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"LaunchpadError\";\n }\n}\n\n/** The token is not in a phase that permits the attempted operation. */\nexport class LaunchpadPhaseUnavailableError extends LaunchpadError {\n readonly phase?: LaunchpadPhase;\n\n constructor(phase?: LaunchpadPhase, options?: { cause?: unknown }) {\n super(\n phase\n ? `The Launchpad token is in the ${phase} phase and cannot service this operation.`\n : \"The Launchpad token is not in a phase that permits this operation.\",\n options,\n );\n this.name = \"LaunchpadPhaseUnavailableError\";\n this.phase = phase;\n }\n}\n\n/** Trading is paused, either protocol-wide or for this token. */\nexport class LaunchpadTradingPausedError extends LaunchpadError {\n readonly scope: \"protocol\" | \"token\";\n readonly mode?: LaunchpadPauseMode;\n\n constructor(\n scope: \"protocol\" | \"token\",\n mode?: LaunchpadPauseMode,\n options?: { cause?: unknown },\n ) {\n super(`Launchpad trading is paused (${scope}).`, options);\n this.name = \"LaunchpadTradingPausedError\";\n this.scope = scope;\n this.mode = mode;\n }\n}\n\n/** The launch block forbids trading; retry from `nextEligibleBlock`. */\nexport class LaunchpadProtectionError extends LaunchpadError {\n readonly nextEligibleBlock?: bigint;\n\n constructor(nextEligibleBlock?: bigint, options?: { cause?: unknown }) {\n super(\"Trading is disabled during the token's launch block.\", options);\n this.name = \"LaunchpadProtectionError\";\n this.nextEligibleBlock = nextEligibleBlock;\n }\n}\n\n/** The quote moved past the caller's tolerance; re-quote before retrying. */\nexport class LaunchpadSlippageError extends LaunchpadError {\n constructor(options?: { cause?: unknown }) {\n super(\"The trade would exceed the requested slippage tolerance; refresh the quote.\", options);\n this.name = \"LaunchpadSlippageError\";\n }\n}\n\n/** The deadline elapsed. The transaction must be rebuilt, never replayed. */\nexport class LaunchpadDeadlineExpiredError extends LaunchpadError {\n constructor(options?: { cause?: unknown }) {\n super(\n \"The transaction deadline expired; rebuild the transaction with a new deadline.\",\n options,\n );\n this.name = \"LaunchpadDeadlineExpiredError\";\n }\n}\n\n/** An ERC-20 approval is required before the operation can succeed. */\nexport class LaunchpadApprovalRequiredError extends LaunchpadError {\n readonly asset: Address;\n readonly spender: Address;\n readonly requiredAmount: bigint;\n\n constructor(asset: Address, spender: Address, requiredAmount: bigint) {\n super(`Approve at least ${requiredAmount} of ${asset} for ${spender} before continuing.`);\n this.name = \"LaunchpadApprovalRequiredError\";\n this.asset = asset;\n this.spender = spender;\n this.requiredAmount = requiredAmount;\n }\n}\n\n/**\n * The account cannot cover the amount a transfer would move.\n *\n * Checked alongside the allowance during `prepare*`, because the Portal moves funds through\n * `SafeTransferLib`, which collapses every underlying failure into an opaque `TransferFailed()`.\n * Without this check an insufficient balance surfaces as an unmapped revert that gives the caller\n * no way to tell \"top up\" apart from a genuine contract fault.\n */\nexport class LaunchpadInsufficientBalanceError extends LaunchpadError {\n readonly asset: Address;\n readonly account: Address;\n readonly requiredAmount: bigint;\n readonly balance: bigint;\n\n constructor(asset: Address, account: Address, requiredAmount: bigint, balance: bigint) {\n super(\n `Account ${account} holds ${balance} of ${asset} but needs ${requiredAmount} for this transaction.`,\n );\n this.name = \"LaunchpadInsufficientBalanceError\";\n this.asset = asset;\n this.account = account;\n this.requiredAmount = requiredAmount;\n this.balance = balance;\n }\n}\n\n/**\n * The wallet switched accounts between preparing and broadcasting.\n *\n * The simulated request is bound to the account it was prepared for — allowances, balances, and the\n * `from` address were all resolved against it — so it must not be sent from a different account.\n */\nexport class PreparedAccountMismatchError extends LaunchpadError {\n readonly expectedAccount: Address;\n readonly actualAccount: Address;\n\n constructor(expectedAccount: Address, actualAccount: Address) {\n super(\n `This transaction was prepared for account ${expectedAccount} but the wallet is now using ${actualAccount}. Prepare it again.`,\n );\n this.name = \"PreparedAccountMismatchError\";\n this.expectedAccount = expectedAccount;\n this.actualAccount = actualAccount;\n }\n}\n\n/**\n * The value passed to a send call did not originate from this SDK's prepare pipeline, or belongs to\n * a different deployment. Broadcasting it would skip simulation and the safety checks around it.\n */\nexport class ForgedPreparedTransactionError extends LaunchpadError {\n constructor(message: string) {\n super(message);\n this.name = \"ForgedPreparedTransactionError\";\n }\n}\n\n/** A write was attempted on a client constructed without a Wallet Client. */\nexport class MissingWalletClientError extends LaunchpadError {\n constructor() {\n super(\"A Wallet Client is required for Launchpad write operations.\");\n this.name = \"MissingWalletClientError\";\n }\n}\n\n/** There is no claimable balance for this account and asset; the Locker would revert. */\nexport class LaunchpadNothingToClaimError extends LaunchpadError {\n readonly asset: Address;\n readonly account: Address;\n\n constructor(asset: Address, account: Address) {\n super(`No claimable ${asset} rewards are available for ${account}.`);\n this.name = \"LaunchpadNothingToClaimError\";\n this.asset = asset;\n this.account = account;\n }\n}\n\n/**\n * No locked position is registered under the given LP NFT id.\n *\n * Usually means the id came from the wrong source: it is a Uniswap V3 position NFT id, not a token\n * address, and only ids minted by this deployment's migrator are registered here.\n */\nexport class LaunchpadUnknownPositionError extends LaunchpadError {\n readonly tokenId: bigint;\n\n constructor(tokenId: bigint) {\n super(`No locked liquidity position is registered for LP NFT id ${tokenId}.`);\n this.name = \"LaunchpadUnknownPositionError\";\n this.tokenId = tokenId;\n }\n}\n\n/**\n * The official V3 pool rejects liquidity operations before graduation.\n *\n * `LaunchToken` keeps its official pool locked until the Portal migrates it, so an attempt to seed\n * or trade that pool early reverts here rather than silently competing with the bonding curve.\n */\nexport class LaunchpadOfficialPoolLockedError extends LaunchpadError {\n constructor(options: { cause?: unknown } = {}) {\n super(\"The official V3 pool is locked until this token graduates.\", options);\n this.name = \"LaunchpadOfficialPoolLockedError\";\n }\n}\n\n/** The wallet is connected to a different chain than the requested deployment. */\nexport class WrongWalletChainError extends LaunchpadError {\n readonly expectedChainId: number;\n readonly actualChainId?: number;\n\n constructor(expectedChainId: number, actualChainId?: number) {\n super(\n `The wallet is on chain ${actualChainId ?? \"unknown\"} but this operation requires chain ${expectedChainId}.`,\n );\n this.name = \"WrongWalletChainError\";\n this.expectedChainId = expectedChainId;\n this.actualChainId = actualChainId;\n }\n}\n\n/** Portal and LaunchToken custom errors mapped to stable SDK errors, keyed by ABI error name. */\nconst revertNameToError: Readonly<Record<string, (cause: unknown) => LaunchpadError | undefined>> =\n {\n InvalidStatus: (cause) => new LaunchpadPhaseUnavailableError(undefined, { cause }),\n ProtocolPaused: (cause) => new LaunchpadTradingPausedError(\"protocol\", undefined, { cause }),\n LaunchBlockTradingDisabled: (cause) => new LaunchpadProtectionError(undefined, { cause }),\n SlippageExceeded: (cause) => new LaunchpadSlippageError({ cause }),\n DeadlineExpired: (cause) => new LaunchpadDeadlineExpiredError({ cause }),\n OfficialPoolLocked: (cause) => new LaunchpadOfficialPoolLockedError({ cause }),\n };\n\n/** Extracts the reverted custom-error name from a viem error chain, if present. */\nexport function revertErrorName(error: unknown): string | undefined {\n if (!(error instanceof BaseError)) return undefined;\n const reverted = error.walk((cause) => cause instanceof ContractFunctionRevertedError);\n return reverted instanceof ContractFunctionRevertedError ? reverted.data?.errorName : undefined;\n}\n\n/**\n * Maps a contract failure onto a stable SDK error using the decoded custom-error name, never the\n * message text. Unrecognized failures fall back to the shared core error codes, preserving the\n * original cause and request metadata.\n */\nexport function toLaunchpadError(error: unknown): Error {\n if (error instanceof LaunchpadError) return error;\n\n const name = revertErrorName(error);\n const mapped = name ? revertNameToError[name]?.(error) : undefined;\n return mapped ?? toPeachSdkError(error);\n}\n","import { type Address, getAddress, isAddress, isAddressEqual, zeroAddress } from \"viem\";\n\nimport { defineLaunchpadDeployment } from \"./deployment\";\nimport type {\n LaunchpadCapability,\n LaunchpadChainConfig,\n LaunchpadQuoteTokenConfig,\n LaunchpadTokenId,\n} from \"./types\";\n\nexport class InvalidLaunchpadChainConfigError extends Error {\n readonly field: string;\n\n constructor(field: string, message: string) {\n super(message);\n this.name = \"InvalidLaunchpadChainConfigError\";\n this.field = field;\n }\n}\n\nfunction invalid(field: string, message: string): never {\n throw new InvalidLaunchpadChainConfigError(field, message);\n}\n\nfunction normalizeAddress(field: string, address: Address): Address {\n if (!isAddress(address) || isAddressEqual(address, zeroAddress)) {\n return invalid(field, `${field} must be a non-zero EVM address.`);\n }\n return getAddress(address);\n}\n\nfunction normalizeUrl(field: string, value: string): string {\n try {\n const url = new URL(value);\n if (url.protocol !== \"https:\" && url.protocol !== \"wss:\") {\n return invalid(field, `${field} must use HTTPS or WSS.`);\n }\n return url.toString().replace(/\\/$/, \"\");\n } catch {\n return invalid(field, `${field} must be an absolute URL.`);\n }\n}\n\nfunction normalizeQuoteToken(\n input: LaunchpadQuoteTokenConfig,\n index: number,\n): LaunchpadQuoteTokenConfig {\n const field = `quoteTokens[${index}]`;\n if (!Number.isSafeInteger(input.decimals) || input.decimals < 0 || input.decimals > 255) {\n invalid(`${field}.decimals`, \"Quote token decimals must be an integer between 0 and 255.\");\n }\n if (input.symbol.trim().length === 0) {\n invalid(`${field}.symbol`, \"Quote token symbol must not be empty.\");\n }\n return Object.freeze({ ...input, address: normalizeAddress(`${field}.address`, input.address) });\n}\n\nconst capabilities: readonly LaunchpadCapability[] = [\n \"create\",\n \"bondingTrade\",\n \"graduatedTrade\",\n \"antiFarmer\",\n \"earlySellTax\",\n \"rewards\",\n \"referral\",\n];\n\n/** Validates, normalizes, and freezes a caller-supplied chain configuration. */\nexport function defineLaunchpadChain(input: LaunchpadChainConfig): Readonly<LaunchpadChainConfig> {\n if (!Number.isSafeInteger(input.chainId) || input.chainId <= 0) {\n invalid(\"chainId\", \"chainId must be a positive safe integer.\");\n }\n if (!/^[a-z0-9-]+$/.test(input.slug)) {\n invalid(\"slug\", \"slug must be lowercase and contain only letters, numbers, and hyphens.\");\n }\n if (input.deployment.chainId !== input.chainId) {\n invalid(\n \"deployment.chainId\",\n `deployment.chainId (${input.deployment.chainId}) must match the chain's chainId (${input.chainId}).`,\n );\n }\n if (!Number.isSafeInteger(input.nativeCurrency.decimals) || input.nativeCurrency.decimals < 0) {\n invalid(\"nativeCurrency.decimals\", \"Native currency decimals must be a non-negative integer.\");\n }\n if (input.nativeCurrency.symbol.trim().length === 0) {\n invalid(\"nativeCurrency.symbol\", \"Native currency symbol must not be empty.\");\n }\n if (input.rpcUrls.length === 0) {\n invalid(\"rpcUrls\", \"At least one RPC URL is required.\");\n }\n if (!Number.isSafeInteger(input.confirmations) || input.confirmations < 0) {\n invalid(\"confirmations\", \"confirmations must be a non-negative safe integer.\");\n }\n\n const quoteTokens = input.quoteTokens.map(normalizeQuoteToken);\n const quoteAddresses = new Set(quoteTokens.map((token) => token.address.toLowerCase()));\n if (quoteAddresses.size !== quoteTokens.length) {\n invalid(\"quoteTokens\", \"Quote token addresses must be unique for a chain.\");\n }\n for (const capability of capabilities) {\n if (typeof input.capabilities[capability] !== \"boolean\") {\n invalid(\n `capabilities.${capability}`,\n \"Every Launchpad capability must be declared as a boolean.\",\n );\n }\n }\n\n return Object.freeze({\n ...input,\n apiBaseUrl: normalizeUrl(\"apiBaseUrl\", input.apiBaseUrl),\n capabilities: Object.freeze({ ...input.capabilities }),\n // Validation and freezing are delegated to the deployment's own definer rather than\n // duplicated here, so a chain config can never carry an under-validated deployment.\n deployment: defineLaunchpadDeployment(input.deployment),\n explorerUrl: normalizeUrl(\"explorerUrl\", input.explorerUrl),\n nativeCurrency: Object.freeze({ ...input.nativeCurrency }),\n quoteTokens: Object.freeze(quoteTokens),\n realtimeUrl: normalizeUrl(\"realtimeUrl\", input.realtimeUrl),\n rpcUrls: Object.freeze(\n input.rpcUrls.map((url, index) => normalizeUrl(`rpcUrls[${index}]`, url)),\n ),\n });\n}\n\n/** Normalizes an EVM token address while preserving its chain-scoped identity. */\nexport function defineLaunchpadTokenId(input: LaunchpadTokenId): Readonly<LaunchpadTokenId> {\n if (!Number.isSafeInteger(input.chainId) || input.chainId <= 0) {\n invalid(\"chainId\", \"chainId must be a positive safe integer.\");\n }\n return Object.freeze({\n chainId: input.chainId,\n address: normalizeAddress(\"address\", input.address),\n });\n}\n","import { type Address, getAddress, type Hex, isAddress, isAddressEqual, zeroAddress } from \"viem\";\n// Re-exported from the `./core` subpath only, never from the root entry point: an application\n// installing more than one MasterPeach SDK would otherwise see this name twice.\nimport { UnsupportedChainError } from \"./core\";\n\n/**\n * Addresses of a single, version-scoped Launchpad deployment. Every field is scoped to one\n * `chainId + portal`; a Portal redeployment is a new deployment, never an in-place upgrade.\n * The bonding curve, migrator, and future DEX router are distinct modules and must not be\n * conflated into a single \"router\" slot.\n */\nexport interface LaunchpadContracts {\n readonly portal: Address;\n readonly tokenFactory: Address;\n readonly curve: Address;\n readonly migrator: Address;\n readonly liquidityLocker: Address;\n readonly quoteToken: Address;\n readonly v3Factory?: Address;\n readonly positionManager?: Address;\n /** Only configured once a graduated-execution router adapter has been audited. */\n readonly dexRouter?: Address;\n}\n\n/**\n * A Launchpad protocol deployment traceable to an exact contract revision. The runtime code hash\n * and commits let {@link verifyLaunchpadDeployment} prove the registered addresses match on-chain\n * state before any read or write is trusted.\n */\nexport interface LaunchpadDeployment {\n readonly chainId: number;\n readonly contractVersion: string;\n readonly contracts: LaunchpadContracts;\n readonly deploymentBlock: bigint;\n readonly artifactCommit: string;\n readonly sourceCommit: string;\n readonly portalRuntimeCodeHash: Hex;\n}\n\nexport type LaunchpadDeploymentRegistry = Readonly<Record<number, LaunchpadDeployment>>;\n\nconst gitCommitPattern = /^[0-9a-f]{40}$/;\nconst runtimeCodeHashPattern = /^0x[0-9a-f]{64}$/;\n\nconst requiredContractFields = [\n \"portal\",\n \"tokenFactory\",\n \"curve\",\n \"migrator\",\n \"liquidityLocker\",\n \"quoteToken\",\n] as const satisfies readonly (keyof LaunchpadContracts)[];\n\nconst optionalContractFields = [\n \"v3Factory\",\n \"positionManager\",\n \"dexRouter\",\n] as const satisfies readonly (keyof LaunchpadContracts)[];\n\n/**\n * Raised when supplied deployment material fails structural validation. Mirrors the plain-`Error`\n * shape of `InvalidLendingDomainError` and `InvalidLaunchpadChainConfigError`; chain resolution\n * reuses the shared `UnsupportedChainError` instead.\n */\nexport class InvalidLaunchpadDeploymentError extends Error {\n readonly field: string;\n\n constructor(field: string, message: string) {\n super(message);\n this.name = \"InvalidLaunchpadDeploymentError\";\n this.field = field;\n }\n}\n\nfunction invalid(field: string, message: string): never {\n throw new InvalidLaunchpadDeploymentError(field, message);\n}\n\nfunction normalizeAddress(field: string, address: Address): Address {\n if (typeof address !== \"string\" || !isAddress(address) || isAddressEqual(address, zeroAddress)) {\n return invalid(field, `${field} must be a non-zero EVM address.`);\n }\n return getAddress(address);\n}\n\nfunction normalizeContracts(input: LaunchpadContracts): Readonly<LaunchpadContracts> {\n const normalized: Record<string, Address> = {};\n for (const field of requiredContractFields) {\n normalized[field] = normalizeAddress(`contracts.${field}`, input[field] as Address);\n }\n for (const field of optionalContractFields) {\n const value = input[field];\n if (value !== undefined) {\n normalized[field] = normalizeAddress(`contracts.${field}`, value);\n }\n }\n return Object.freeze(normalized) as Readonly<LaunchpadContracts>;\n}\n\n/** Validates, normalizes, and deep-freezes a caller-supplied Launchpad deployment. */\nexport function defineLaunchpadDeployment(\n input: LaunchpadDeployment,\n): Readonly<LaunchpadDeployment> {\n if (!Number.isSafeInteger(input.chainId) || input.chainId <= 0) {\n invalid(\"chainId\", \"chainId must be a positive safe integer.\");\n }\n if (input.contractVersion.trim().length === 0) {\n invalid(\"contractVersion\", \"contractVersion must not be empty.\");\n }\n if (typeof input.deploymentBlock !== \"bigint\" || input.deploymentBlock <= 0n) {\n invalid(\"deploymentBlock\", \"deploymentBlock must be a positive bigint.\");\n }\n if (!gitCommitPattern.test(input.artifactCommit)) {\n invalid(\"artifactCommit\", \"artifactCommit must be a lowercase 40-character Git commit.\");\n }\n if (!gitCommitPattern.test(input.sourceCommit)) {\n invalid(\"sourceCommit\", \"sourceCommit must be a lowercase 40-character Git commit.\");\n }\n if (!runtimeCodeHashPattern.test(input.portalRuntimeCodeHash)) {\n invalid(\n \"portalRuntimeCodeHash\",\n \"portalRuntimeCodeHash must be a lowercase 32-byte hex hash (0x + 64 hex chars).\",\n );\n }\n\n return Object.freeze({\n chainId: input.chainId,\n contractVersion: input.contractVersion,\n contracts: normalizeContracts(input.contracts),\n deploymentBlock: input.deploymentBlock,\n artifactCommit: input.artifactCommit,\n sourceCommit: input.sourceCommit,\n portalRuntimeCodeHash: input.portalRuntimeCodeHash,\n });\n}\n\n/**\n * Validates and freezes a chainId-keyed deployment registry, rejecting any entry whose key does\n * not match its own `chainId`.\n */\nexport function defineLaunchpadDeploymentRegistry(\n input: Readonly<Record<number, LaunchpadDeployment>>,\n): LaunchpadDeploymentRegistry {\n const entries = Object.entries(input).map(([key, deployment]) => {\n const defined = defineLaunchpadDeployment(deployment);\n if (Number(key) !== defined.chainId) {\n invalid(\n `registry[${key}]`,\n `Registry key ${key} does not match deployment chainId ${defined.chainId}.`,\n );\n }\n return [defined.chainId, defined] as const;\n });\n return Object.freeze(Object.fromEntries(entries));\n}\n\n/**\n * Built-in registry of production Launchpad deployments. It stays empty until a deployment has\n * passed RPC bytecode and binding verification; testnet material is exported separately as an\n * explicitly named development configuration.\n */\nexport const launchpadDeploymentRegistry: LaunchpadDeploymentRegistry =\n defineLaunchpadDeploymentRegistry({});\n\n/** Resolves a verified deployment or throws {@link UnsupportedChainError}. */\nexport function resolveLaunchpadDeployment(\n registry: LaunchpadDeploymentRegistry,\n chainId: number,\n): Readonly<LaunchpadDeployment> {\n const deployment = registry[chainId];\n if (deployment === undefined) throw new UnsupportedChainError(chainId);\n return deployment;\n}\n","import { defineLaunchpadChain } from \"./chains\";\nimport { MissingChainError, requireWalletClient, resolveChainValue } from \"./core\";\nimport type {\n LaunchpadChainConfig,\n LaunchpadClient,\n LaunchpadClientConfig,\n LaunchpadContractAdapter,\n LaunchpadReadRequest,\n LaunchpadWriteRequest,\n} from \"./types\";\n\n/** Creates a chain-scoped, ABI-neutral Launchpad client around caller-provided adapters. */\nexport function createLaunchpadClient(config: LaunchpadClientConfig): LaunchpadClient {\n const chains = Object.freeze(\n Object.fromEntries(\n Object.entries(config.chains).map(([chainId, chain]) => [\n chainId,\n defineLaunchpadChain(chain),\n ]),\n ),\n );\n const resolveChain = (chainId?: number): LaunchpadChainConfig => {\n const resolvedChainId = chainId ?? config.publicClient.chain?.id;\n if (resolvedChainId === undefined) throw new MissingChainError();\n const chain = resolveChainValue(chains, resolvedChainId);\n if (chain.chainId !== resolvedChainId) {\n throw new TypeError(\n `Launchpad chain ${chain.chainId} does not match registry chain ${resolvedChainId}.`,\n );\n }\n return chain;\n };\n const resolveAdapter = (chainId?: number): LaunchpadContractAdapter => {\n const chain = resolveChain(chainId);\n return resolveChainValue(config.adapters ?? {}, chain.chainId);\n };\n\n return Object.freeze({\n publicClient: config.publicClient,\n walletClient: config.walletClient,\n getChain: resolveChain,\n getAdapter: resolveAdapter,\n read: <Result>(request: LaunchpadReadRequest, chainId?: number) => {\n const chain = resolveChain(chainId);\n return resolveAdapter(chain.chainId).read<Result>(\n { chain, publicClient: config.publicClient },\n request,\n );\n },\n write: <Result>(request: LaunchpadWriteRequest, chainId?: number) => {\n const chain = resolveChain(chainId);\n if (!chain.capabilities[request.requiredCapability]) {\n throw new UnsupportedLaunchpadCapabilityError(chain.chainId, request.requiredCapability);\n }\n return resolveAdapter(chain.chainId).write<Result>(\n {\n chain,\n publicClient: config.publicClient,\n walletClient: requireWalletClient(config.walletClient),\n },\n request,\n );\n },\n });\n}\n\nexport class UnsupportedLaunchpadCapabilityError extends Error {\n readonly chainId: number;\n readonly capability: LaunchpadWriteRequest[\"requiredCapability\"];\n\n constructor(chainId: number, capability: LaunchpadWriteRequest[\"requiredCapability\"]) {\n super(`Launchpad capability ${capability} is not supported on chain ${chainId}.`);\n this.name = \"UnsupportedLaunchpadCapabilityError\";\n this.chainId = chainId;\n this.capability = capability;\n }\n}\n","import { defineLaunchpadDeployment, type LaunchpadDeployment } from \"../deployment\";\n\n/** Arc Testnet chain id. Testnet-only; never treated as a production default. */\nexport const arcTestnetChainId = 5_042_002;\n\n/**\n * Explicitly named Arc Testnet V2 development deployment (deployed 2026-08-13).\n *\n * This is a development configuration, not a production default: it is deliberately excluded from\n * `launchpadDeploymentRegistry`, and consumers must opt in by name. Addresses, the Portal runtime\n * code hash, and the deployment block were read from Arc Testnet and cross-checked against the\n * contract repository's deployment record at the pinned revision. Callers should still run\n * `verifyLaunchpadDeployment` before trusting it.\n */\nexport const arcTestnetLaunchpadDeployment: Readonly<LaunchpadDeployment> =\n defineLaunchpadDeployment({\n chainId: arcTestnetChainId,\n contractVersion: \"v2\",\n contracts: {\n portal: \"0x068E0fD38cb2D91264A8590a922A7f30F32A52FC\",\n tokenFactory: \"0x86C0617e718082949C613AB3a31B5d89c7632C38\",\n curve: \"0xC56485723B3015c9020De94A3D81C5071c791132\",\n migrator: \"0x27079FB023F051AB18AD5D441D0AFd5bE0F83E95\",\n liquidityLocker: \"0xfC285E5FD969381798C9Eb1b6bFF8ddaBB7ee243\",\n quoteToken: \"0xa93A87359D6c824b2Dad1184d523Da8DCcaaBcD7\",\n v3Factory: \"0xf2134DBAF02aB5Da16bfF6BddE87d79ad6A41753\",\n positionManager: \"0xb09CD98B83cC46e5da2CB9CEF7988DBA8238c803\",\n // dexRouter is intentionally unset: no audited graduated-execution router adapter exists.\n },\n deploymentBlock: 56_732_456n,\n artifactCommit: \"33dd9f1cd51304ebe84375774dcbee3b1181f3bb\",\n sourceCommit: \"33dd9f1cd51304ebe84375774dcbee3b1181f3bb\",\n portalRuntimeCodeHash: \"0x4a9960f8e62928be2a163cc78ec14f1609ad72bb910c997c0135e14812cfc50d\",\n });\n","/**\n * Parsed view of `CreateParams.metadata`. Every field is optional because the on-chain value is an\n * opaque, untrusted string that any creator can set to anything.\n *\n * The SDK deliberately does not validate URL schemes, fetch images, sanitize HTML, or moderate\n * content — that belongs to the application and its metadata service. `raw` is always preserved so\n * callers can apply their own policy.\n */\nexport interface LaunchpadMetadata {\n readonly raw: string;\n /** True only when `raw` parsed as a JSON object. */\n readonly valid: boolean;\n readonly description?: string;\n readonly image?: string;\n readonly website?: string;\n /** Any other top-level keys, preserved without interpretation. */\n readonly extra: Readonly<Record<string, unknown>>;\n}\n\nconst knownStringFields = [\"description\", \"image\", \"website\"] as const;\n\nfunction readStringField(source: Record<string, unknown>, key: string): string | undefined {\n const value = source[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Parses token metadata without ever throwing. Invalid JSON, JSON primitives, arrays, `null`, and\n * unexpected field types all degrade to `valid: false` (or a missing field) rather than an error,\n * so a single malformed token can never break a list render.\n */\nexport function parseLaunchpadMetadata(raw: string): LaunchpadMetadata {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return Object.freeze({ raw, valid: false, extra: Object.freeze({}) });\n }\n\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return Object.freeze({ raw, valid: false, extra: Object.freeze({}) });\n }\n\n const source = parsed as Record<string, unknown>;\n const extra = Object.fromEntries(\n Object.entries(source).filter(\n ([key]) => !(knownStringFields as readonly string[]).includes(key),\n ),\n );\n\n const fields = Object.fromEntries(\n knownStringFields\n .map((key) => [key, readStringField(source, key)] as const)\n .filter(([, value]) => value !== undefined),\n );\n\n return Object.freeze({\n raw,\n valid: true,\n ...fields,\n extra: Object.freeze(extra),\n });\n}\n","import type { Address, Hash, Hex, PublicClient, WalletClient } from \"viem\";\n\nimport {\n type ApprovalPreview,\n type ClaimPreview,\n type CollectFeesPreview,\n type CreateTokenInput,\n type CreateTokenPreview,\n getClaimableLaunchpadReward,\n getErc20Allowance,\n getErc20Balance,\n getErc20Metadata,\n getLaunchpadApprovalStatus,\n getLaunchpadCurveConstants,\n getLaunchpadCurveProgress,\n getLaunchpadPrice,\n getLaunchpadTokenMetadata,\n getLaunchpadTokenState,\n getLaunchpadTradeAvailability,\n getLockedLaunchpadPosition,\n type LaunchpadApprovalStatus,\n type LaunchpadCurveProgress,\n type LaunchpadTransactionResult,\n type MigrationPreview,\n type PreparedLaunchpadTransaction,\n predictLaunchpadTokenAddress,\n prepareApproveErc20,\n prepareClaimLaunchpadReward,\n prepareCollectLaunchpadFees,\n prepareCreateToken,\n prepareLaunchpadBuy,\n prepareLaunchpadMigration,\n prepareLaunchpadSell,\n quoteCreatorFirstBuy,\n quoteLaunchpadBuy,\n quoteLaunchpadSell,\n sendPreparedLaunchpadTransaction,\n waitForLaunchpadTransaction,\n} from \"./actions\";\nimport { defineLaunchpadChain } from \"./chains\";\nimport { UnsupportedLaunchpadCapabilityError } from \"./client\";\nimport type { LaunchpadDeployment } from \"./deployment\";\nimport { ForgedPreparedTransactionError, MissingWalletClientError } from \"./errors\";\nimport type { LaunchpadCurveConstants } from \"./math/curve\";\nimport type {\n BuyQuote,\n LaunchpadActionContext,\n LaunchpadCapability,\n LaunchpadChainConfig,\n LaunchpadErc20Metadata,\n LaunchpadLockedPosition,\n LaunchpadPrice,\n LaunchpadReadOptions,\n LaunchpadTokenState,\n LaunchpadTradeAvailability,\n LaunchpadWriteActionContext,\n PredictedLaunchpadToken,\n SellQuote,\n Slippage,\n} from \"./types\";\n\n/**\n * Typed client configuration.\n *\n * The client is configured from a single {@link LaunchpadChainConfig}, which already carries the\n * verified {@link LaunchpadDeployment} plus the product `capabilities`. Taking one object avoids the\n * drift that two parallel sources (a deployment here, capabilities elsewhere) would allow, and it\n * makes the capability gate impossible to omit.\n */\nexport interface LaunchpadPortalClientConfig {\n readonly publicClient: PublicClient;\n readonly walletClient?: WalletClient;\n readonly chain: LaunchpadChainConfig;\n}\n\n/**\n * Strongly typed client bound to one verified deployment.\n *\n * This is the primary business API. The ABI-neutral `adapter.read/write` client remains available\n * for versions this SDK does not yet cover and for test adapters, but production call sites should\n * use these methods.\n *\n * Write paths are gated by the chain's declared capabilities, so a product that has not enabled\n * rewards (the default) cannot prepare a claim even by mistake. Reads are never gated: a page must\n * be able to render state without a signer and regardless of which writes are enabled.\n */\nexport interface LaunchpadPortalClient {\n readonly chain: LaunchpadChainConfig;\n readonly deployment: LaunchpadDeployment;\n readonly publicClient: PublicClient;\n readonly walletClient?: WalletClient;\n\n getTokenState(token: Address, options?: LaunchpadReadOptions): Promise<LaunchpadTokenState>;\n getTokenMetadata(token: Address, options?: LaunchpadReadOptions): Promise<string>;\n getPrice(token: Address, options?: LaunchpadReadOptions): Promise<LaunchpadPrice>;\n quoteBuy(token: Address, quoteIn: bigint, options?: LaunchpadReadOptions): Promise<BuyQuote>;\n quoteSell(token: Address, tokenIn: bigint, options?: LaunchpadReadOptions): Promise<SellQuote>;\n /** Curve constants for this deployment; immutable, so callers may cache the result. */\n getCurveConstants(options?: LaunchpadReadOptions): Promise<LaunchpadCurveConstants>;\n /**\n * Prices a creator's atomic first buy. `prepareCreateToken` calls this internally, so a caller\n * only needs it to preview a first buy before committing to one.\n */\n quoteCreatorFirstBuy(\n quoteIn: bigint,\n options?: LaunchpadReadOptions & { readonly constants?: LaunchpadCurveConstants },\n ): Promise<BuyQuote>;\n getTradeAvailability(\n token: Address,\n options?: LaunchpadReadOptions,\n ): Promise<LaunchpadTradeAvailability>;\n getBalance(asset: Address, account: Address, options?: LaunchpadReadOptions): Promise<bigint>;\n getAllowance(\n asset: Address,\n owner: Address,\n spender: Address,\n options?: LaunchpadReadOptions,\n ): Promise<bigint>;\n getApprovalStatus(\n input: {\n readonly asset: Address;\n readonly owner: Address;\n readonly requiredAmount: bigint;\n readonly spender?: Address;\n },\n options?: LaunchpadReadOptions,\n ): Promise<LaunchpadApprovalStatus>;\n getClaimableReward(\n account: Address,\n asset: Address,\n options?: LaunchpadReadOptions,\n ): Promise<bigint>;\n /** Token name, symbol, and decimals, read together at one block. */\n getErc20Metadata(asset: Address, options?: LaunchpadReadOptions): Promise<LaunchpadErc20Metadata>;\n /**\n * Looks up a locked V3 position by its LP NFT id, or `undefined` when unregistered.\n *\n * The id comes from the indexing service or a migration receipt — the Locker keeps no reverse\n * index from token address to `tokenId`.\n */\n getLockedPosition(\n tokenId: bigint,\n options?: LaunchpadReadOptions,\n ): Promise<LaunchpadLockedPosition | undefined>;\n /**\n * Curve progress for a token screen: tokens remaining, percentage, and market cap, all pinned to\n * one block. Pass `constants` to reuse an already-read copy.\n */\n getCurveProgress(\n token: Address,\n options?: LaunchpadReadOptions & { readonly constants?: LaunchpadCurveConstants },\n ): Promise<LaunchpadCurveProgress>;\n /**\n * Previews the CREATE2 address a token would get if this creator launched it now.\n *\n * A preview, not a reservation: the Portal mixes an auto-incrementing per-creator nonce into the\n * salt, so the prediction stops holding once this creator launches anything. Take the real\n * address from the receipt's `TokenCreated` event.\n */\n predictTokenAddress(\n input: {\n readonly creator: Address;\n readonly name: string;\n readonly symbol: string;\n readonly userSalt: Hex;\n },\n options?: LaunchpadReadOptions,\n ): Promise<PredictedLaunchpadToken>;\n\n /** ERC-20 approval. Ungated: a plain token approval is not a Launchpad protocol write. */\n prepareApprove(input: {\n readonly asset: Address;\n readonly amount: bigint;\n readonly spender?: Address;\n }): Promise<PreparedLaunchpadTransaction<ApprovalPreview>>;\n /** Requires the `create` capability. */\n prepareCreateToken(\n input: CreateTokenInput,\n ): Promise<PreparedLaunchpadTransaction<CreateTokenPreview>>;\n /** Requires the `bondingTrade` capability. */\n prepareBuy(input: {\n readonly token: Address;\n readonly quoteIn: bigint;\n readonly slippage: Slippage;\n readonly deadline: bigint;\n }): Promise<PreparedLaunchpadTransaction<BuyQuote>>;\n /** Requires the `bondingTrade` capability. */\n prepareSell(input: {\n readonly token: Address;\n readonly tokenIn: bigint;\n readonly slippage: Slippage;\n readonly deadline: bigint;\n }): Promise<PreparedLaunchpadTransaction<SellQuote>>;\n /**\n * Migration is permissionless on-chain and completes a token that has already graduated, so it is\n * deliberately **not** gated by a product capability — disabling it would leave graduated tokens\n * stranded even though anyone can call `migrate`.\n */\n prepareMigration(token: Address): Promise<PreparedLaunchpadTransaction<MigrationPreview>>;\n /**\n * Collects a locked position's V3 fees into the Locker, crediting the creator's share.\n *\n * Permissionless like migration, and likewise **not** gated by `rewards`: the Locker always\n * credits `positions[tokenId].creator` rather than the caller, and gating it would strand fees\n * that belong to creators whenever the capability is off. It is the step that makes\n * `prepareClaimReward` able to pay out anything at all.\n */\n prepareCollectFees(tokenId: bigint): Promise<PreparedLaunchpadTransaction<CollectFeesPreview>>;\n /** Requires the `rewards` capability, which defaults to off. */\n prepareClaimReward(input: {\n readonly asset: Address;\n readonly recipient?: Address;\n }): Promise<PreparedLaunchpadTransaction<ClaimPreview>>;\n send(prepared: PreparedLaunchpadTransaction<unknown>): Promise<Hash>;\n wait(\n hash: Hash,\n options?: { readonly confirmations?: number },\n ): Promise<LaunchpadTransactionResult>;\n}\n\n/** Creates a typed client for one verified Launchpad deployment. */\nexport function createLaunchpadPortalClient(\n config: LaunchpadPortalClientConfig,\n): LaunchpadPortalClient {\n // Re-validating here means a hand-built chain object cannot slip past the same checks a\n // registry-sourced one goes through, and it normalizes/deep-freezes the config in place.\n const chain = defineLaunchpadChain(config.chain);\n const deployment = chain.deployment;\n const readContext: LaunchpadActionContext = {\n publicClient: config.publicClient,\n deployment,\n };\n\n /**\n * Prepared transactions minted by *this* client instance.\n *\n * The compile-time brand stops application code from writing a prepared-transaction literal, and\n * this registry closes the runtime gap: a value from another client, another deployment, or a\n * structural copy is rejected even though it satisfies the type. A `WeakSet` keeps no strong\n * reference, so nothing here delays collection.\n */\n const minted = new WeakSet<object>();\n\n const mint = <Preview>(\n prepared: PreparedLaunchpadTransaction<Preview>,\n ): PreparedLaunchpadTransaction<Preview> => {\n minted.add(prepared);\n return prepared;\n };\n\n // Built per call rather than up front so read-only usage never requires a signer. The Wallet\n // Client itself is fixed at construction: to follow a wallet connect/disconnect or an account\n // change, rebuild the client (an app should key its memo on chainId + portal + account).\n const writeContext = (): LaunchpadWriteActionContext => {\n if (!config.walletClient) throw new MissingWalletClientError();\n return { ...readContext, walletClient: config.walletClient };\n };\n\n const requireCapability = (capability: LaunchpadCapability): void => {\n if (!chain.capabilities[capability]) {\n throw new UnsupportedLaunchpadCapabilityError(chain.chainId, capability);\n }\n };\n\n const client: LaunchpadPortalClient = {\n chain,\n deployment,\n publicClient: config.publicClient,\n walletClient: config.walletClient,\n\n getTokenState: (token, options) => getLaunchpadTokenState(readContext, token, options),\n getTokenMetadata: (token, options) => getLaunchpadTokenMetadata(readContext, token, options),\n getPrice: (token, options) => getLaunchpadPrice(readContext, token, options),\n quoteBuy: (token, quoteIn, options) => quoteLaunchpadBuy(readContext, token, quoteIn, options),\n quoteSell: (token, tokenIn, options) =>\n quoteLaunchpadSell(readContext, token, tokenIn, options),\n getCurveConstants: (options) => getLaunchpadCurveConstants(readContext, options),\n getErc20Metadata: (asset, options) => getErc20Metadata(readContext, asset, options),\n getLockedPosition: (tokenId, options) =>\n getLockedLaunchpadPosition(readContext, tokenId, options),\n getCurveProgress: (token, options) => getLaunchpadCurveProgress(readContext, token, options),\n predictTokenAddress: (input, options) =>\n predictLaunchpadTokenAddress(readContext, input, options),\n quoteCreatorFirstBuy: (quoteIn, options) => quoteCreatorFirstBuy(readContext, quoteIn, options),\n getTradeAvailability: (token, options) =>\n getLaunchpadTradeAvailability(readContext, token, options),\n getBalance: (asset, account, options) => getErc20Balance(readContext, asset, account, options),\n getAllowance: (asset, owner, spender, options) =>\n getErc20Allowance(readContext, asset, owner, spender, options),\n getApprovalStatus: (input, options) => getLaunchpadApprovalStatus(readContext, input, options),\n getClaimableReward: (account, asset, options) =>\n getClaimableLaunchpadReward(readContext, account, asset, options),\n\n // `async` so a missing Wallet Client or a disabled capability surfaces as a rejected promise\n // rather than a synchronous throw, keeping every write path uniformly awaitable.\n prepareApprove: async (input) => mint(await prepareApproveErc20(writeContext(), input)),\n prepareCreateToken: async (input) => {\n requireCapability(\"create\");\n return mint(await prepareCreateToken(writeContext(), input));\n },\n prepareBuy: async (input) => {\n requireCapability(\"bondingTrade\");\n return mint(await prepareLaunchpadBuy(writeContext(), input));\n },\n prepareSell: async (input) => {\n requireCapability(\"bondingTrade\");\n return mint(await prepareLaunchpadSell(writeContext(), input));\n },\n prepareMigration: async (token) => mint(await prepareLaunchpadMigration(writeContext(), token)),\n prepareCollectFees: async (tokenId) =>\n mint(await prepareCollectLaunchpadFees(writeContext(), tokenId)),\n prepareClaimReward: async (input) => {\n requireCapability(\"rewards\");\n return mint(await prepareClaimLaunchpadReward(writeContext(), input));\n },\n send: async (prepared) => {\n if (!minted.has(prepared)) {\n throw new ForgedPreparedTransactionError(\n \"This prepared transaction was not created by this client. Prepare it again through the client you are sending from.\",\n );\n }\n // The standalone action re-checks live wallet chain/account and deployment metadata too.\n return sendPreparedLaunchpadTransaction(writeContext(), prepared);\n },\n wait: (hash, options) => waitForLaunchpadTransaction(readContext, hash, options),\n };\n\n return Object.freeze(client);\n}\n","import { type Address, isAddressEqual, keccak256, type PublicClient } from \"viem\";\n\nimport { liquidityLockerAbi, portalAbi, v3MigratorAbi } from \"./abi/generated\";\nimport type { LaunchpadContracts, LaunchpadDeployment } from \"./deployment\";\n\n/** Registered module ids the Portal assigns to its default curve and migrator. */\nconst DEFAULT_CURVE_ID = 1;\nconst DEFAULT_MIGRATOR_ID = 1;\n\n/** Raised when on-chain state contradicts a registered deployment. */\nexport class LaunchpadDeploymentVerificationError extends Error {\n readonly field: string;\n readonly expected: string;\n readonly actual: string;\n\n constructor(field: string, expected: string, actual: string) {\n super(\n `Launchpad deployment verification failed for ${field}: expected ${expected}, got ${actual}.`,\n );\n this.name = \"LaunchpadDeploymentVerificationError\";\n this.field = field;\n this.expected = expected;\n this.actual = actual;\n }\n}\n\nfunction assertAddress(field: string, expected: Address, actual: Address): void {\n if (!isAddressEqual(expected, actual)) {\n throw new LaunchpadDeploymentVerificationError(field, expected, actual);\n }\n}\n\n/**\n * Verifies that a registered {@link LaunchpadDeployment} matches live chain state before it is\n * trusted: the connected chain id, the Portal runtime bytecode hash, the Portal's core bindings\n * and default module registrations, and the Migrator/Locker cross-bindings. Throws\n * {@link LaunchpadDeploymentVerificationError} on the first mismatch. This performs read-only\n * calls; it never writes or broadcasts.\n */\nexport async function verifyLaunchpadDeployment(\n publicClient: PublicClient,\n deployment: LaunchpadDeployment,\n): Promise<void> {\n const contracts: LaunchpadContracts = deployment.contracts;\n\n const chainId = await publicClient.getChainId();\n if (chainId !== deployment.chainId) {\n throw new LaunchpadDeploymentVerificationError(\n \"chainId\",\n String(deployment.chainId),\n String(chainId),\n );\n }\n\n const code = await publicClient.getCode({ address: contracts.portal });\n if (!code || code === \"0x\") {\n throw new LaunchpadDeploymentVerificationError(\n \"portalRuntimeCode\",\n deployment.portalRuntimeCodeHash,\n \"0x\",\n );\n }\n const runtimeCodeHash = keccak256(code).toLowerCase();\n if (runtimeCodeHash !== deployment.portalRuntimeCodeHash.toLowerCase()) {\n throw new LaunchpadDeploymentVerificationError(\n \"portalRuntimeCodeHash\",\n deployment.portalRuntimeCodeHash,\n runtimeCodeHash,\n );\n }\n\n const readPortal = (functionName: \"tokenFactory\" | \"quoteToken\" | \"lpRecipient\") =>\n publicClient.readContract({\n address: contracts.portal,\n abi: portalAbi,\n functionName,\n }) as Promise<Address>;\n\n const [portalFactory, portalQuoteToken, portalLpRecipient, portalCurve, portalMigrator] =\n await Promise.all([\n readPortal(\"tokenFactory\"),\n readPortal(\"quoteToken\"),\n readPortal(\"lpRecipient\"),\n publicClient.readContract({\n address: contracts.portal,\n abi: portalAbi,\n functionName: \"curves\",\n args: [DEFAULT_CURVE_ID],\n }) as Promise<Address>,\n publicClient.readContract({\n address: contracts.portal,\n abi: portalAbi,\n functionName: \"migrators\",\n args: [DEFAULT_MIGRATOR_ID],\n }) as Promise<Address>,\n ]);\n\n assertAddress(\"portal.tokenFactory\", contracts.tokenFactory, portalFactory);\n assertAddress(\"portal.quoteToken\", contracts.quoteToken, portalQuoteToken);\n assertAddress(\"portal.lpRecipient\", contracts.liquidityLocker, portalLpRecipient);\n assertAddress(\"portal.curves(1)\", contracts.curve, portalCurve);\n assertAddress(\"portal.migrators(1)\", contracts.migrator, portalMigrator);\n\n const readMigrator = (functionName: \"portal\" | \"locker\" | \"factory\" | \"positionManager\") =>\n publicClient.readContract({\n address: contracts.migrator,\n abi: v3MigratorAbi,\n functionName,\n }) as Promise<Address>;\n\n const [migratorPortal, migratorLocker] = await Promise.all([\n readMigrator(\"portal\"),\n readMigrator(\"locker\"),\n ]);\n assertAddress(\"migrator.portal\", contracts.portal, migratorPortal);\n assertAddress(\"migrator.locker\", contracts.liquidityLocker, migratorLocker);\n\n if (contracts.v3Factory !== undefined) {\n assertAddress(\"migrator.factory\", contracts.v3Factory, await readMigrator(\"factory\"));\n }\n if (contracts.positionManager !== undefined) {\n const [migratorPositionManager, lockerPositionManager] = await Promise.all([\n readMigrator(\"positionManager\"),\n publicClient.readContract({\n address: contracts.liquidityLocker,\n abi: liquidityLockerAbi,\n functionName: \"positionManager\",\n }) as Promise<Address>,\n ]);\n assertAddress(\"migrator.positionManager\", contracts.positionManager, migratorPositionManager);\n assertAddress(\"locker.positionManager\", contracts.positionManager, lockerPositionManager);\n }\n\n const lockerAllowsMigrator = (await publicClient.readContract({\n address: contracts.liquidityLocker,\n abi: liquidityLockerAbi,\n functionName: \"migrators\",\n args: [contracts.migrator],\n })) as boolean;\n if (lockerAllowsMigrator !== true) {\n throw new LaunchpadDeploymentVerificationError(\n \"locker.migrators(migrator)\",\n \"true\",\n String(lockerAllowsMigrator),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AChF,gBAAc,oBAAoB,UAAU,OAAO,WAAW;AAC9D,gBAAc,uBAAuB,UAAU,UAAU,cAAc;AAEvE,QAAM,eAAe,CAAC,iBACpB,aAAa,aAAa;AAAA,IACxB,SAAS,UAAU;AAAA,IACnB,KAAK;AAAA,IACL;AAAA,EACF,CAAC;AAEH,QAAM,CAAC,gBAAgB,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,IACzD,aAAa,QAAQ;AAAA,IACrB,aAAa,QAAQ;AAAA,EACvB,CAAC;AACD,gBAAc,mBAAmB,UAAU,QAAQ,cAAc;AACjE,gBAAc,mBAAmB,UAAU,iBAAiB,cAAc;AAE1E,MAAI,UAAU,cAAc,QAAW;AACrC,kBAAc,oBAAoB,UAAU,WAAW,MAAM,aAAa,SAAS,CAAC;AAAA,EACtF;AACA,MAAI,UAAU,oBAAoB,QAAW;AAC3C,UAAM,CAAC,yBAAyB,qBAAqB,IAAI,MAAM,QAAQ,IAAI;AAAA,MACzE,aAAa,iBAAiB;AAAA,MAC9B,aAAa,aAAa;AAAA,QACxB,SAAS,UAAU;AAAA,QACnB,KAAK;AAAA,QACL,cAAc;AAAA,MAChB,CAAC;AAAA,IACH,CAAC;AACD,kBAAc,4BAA4B,UAAU,iBAAiB,uBAAuB;AAC5F,kBAAc,0BAA0B,UAAU,iBAAiB,qBAAqB;AAAA,EAC1F;AAEA,QAAM,uBAAwB,MAAM,aAAa,aAAa;AAAA,IAC5D,SAAS,UAAU;AAAA,IACnB,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,UAAU,QAAQ;AAAA,EAC3B,CAAC;AACD,MAAI,yBAAyB,MAAM;AACjC,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,OAAO,oBAAoB;AAAA,IAC7B;AAAA,EACF;AACF;","names":["import_viem","blockSelector","import_viem","import_viem","import_viem","import_viem","import_viem","import_viem","invalid","normalizeAddress","import_viem"]}
|