@fazedotfun/sdk 0.5.0 → 0.5.1
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 +4 -3
- package/dist/chain.d.mts +3 -2
- package/dist/chain.mjs +1 -1
- package/dist/{index-DiWbmSpu.d.mts → index-C23bmaL-.d.mts} +37 -1
- package/dist/public.d.mts +15 -8
- package/dist/public.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ launch, watchlist write, or server-built trade.
|
|
|
57
57
|
```ts
|
|
58
58
|
const { termsVersion } = await client.getLaunchConfig();
|
|
59
59
|
|
|
60
|
-
const { message } = await client.walletChallenge();
|
|
60
|
+
const { message } = await client.walletChallenge({ publicKey: address });
|
|
61
61
|
const signature = await wallet.signMessage({ message }); // EIP-191 personal_sign
|
|
62
62
|
await client.walletLink({ publicKey: address, signature, acceptedTermsVersion: termsVersion });
|
|
63
63
|
```
|
|
@@ -67,8 +67,9 @@ await client.walletLink({ publicKey: address, signature, acceptedTermsVersion: t
|
|
|
67
67
|
rather than hardcoding it: it changes when the terms do, and the 403 that a stale one earns carries the current version,
|
|
68
68
|
so a client can self-heal without re-reading the config.
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
Naming the address makes the challenge an EIP-4361 (Sign-In with Ethereum) message bound to the site, that address and a
|
|
71
|
+
five-minute expiry; sign it as it is, and link from the same address. The challenge is single-use: a second `walletLink`
|
|
72
|
+
against the same message is a 409, so retry from `walletChallenge`, not from the signature.
|
|
72
73
|
|
|
73
74
|
Server-side consumers have no cookie jar; pass the session through `createClient({ headers })`.
|
|
74
75
|
|
package/dist/chain.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as TradeSide, Dt as CurveRelease, M as EvmTxRequest, Ot as EvmCurveProtocolAddresses, Q as TradeQuote, R as LaunchLifecycleState, j as CurveContracts, z as LaunchProviderMeta } from "./index-
|
|
1
|
+
import { $ as TradeSide, Dt as CurveRelease, M as EvmTxRequest, Ot as EvmCurveProtocolAddresses, Q as TradeQuote, R as LaunchLifecycleState, j as CurveContracts, z as LaunchProviderMeta } from "./index-C23bmaL-.mjs";
|
|
2
2
|
import { PublicClient } from "viem";
|
|
3
3
|
export declare class ProtocolError extends Error {
|
|
4
4
|
constructor(message: string, options?: ErrorOptions);
|
|
@@ -103,7 +103,8 @@ interface TraderOptions {
|
|
|
103
103
|
interface TradeRequest {
|
|
104
104
|
mint: string;
|
|
105
105
|
side: TradeSide;
|
|
106
|
-
/** buy:
|
|
106
|
+
/** buy: base units of the coin's QUOTE asset to spend - native wei for most coins, the quote asset's own units
|
|
107
|
+
* (its decimals) for a coin raised in one. sell: base units of the COIN to sell. */
|
|
107
108
|
amountIn: bigint;
|
|
108
109
|
/** Overrides the trader's default for this trade. */
|
|
109
110
|
slippageBps?: number;
|
package/dist/chain.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPublicClient as e,createWalletClient as t,defineChain as n,encodeAbiParameters as r,encodeFunctionData as i,encodePacked as a,erc20Abi as o,http as s,keccak256 as c,parseAbi as l,zeroAddress as u}from"viem";import{privateKeyToAccount as d}from"viem/accounts";function f(e){return{chainId:e.chainId,addresses:{bondingCurveV4:e.bondingCurveV4,v4Quoter:e.v4Quoter,stateView:e.stateView,universalRouter:e.universalRouter,permit2:e.permit2,positionManager:e.positionManager??null,launchpadHook:e.launchpadHook,legacyBondingCurveV4:e.legacyBondingCurveV4,legacyLaunchpadHook:e.legacyLaunchpadHook,activeCurveRelease:e.activeCurveRelease,liquidityMigratorV4:null,legacyLiquidityMigratorV4:null,uniswapV4PoolManager:null}}}const p={totalSupply:10n**27n,sellableSupply:8n*10n**26n,reserveSupply:2n*10n**26n,tokenOffset:8n*10n**26n/4n,graduatedFeeTierBps:1e4},m={totalSupply:p.totalSupply,sellableSupply:p.sellableSupply,reserveSupply:p.reserveSupply,tokenOffset:p.tokenOffset},h={totalSupply:p.totalSupply,sellableSupply:777777778n*10n**18n,reserveSupply:p.totalSupply-777777778n*10n**18n,tokenOffset:311111111n*10n**18n};function g(e){return e===`9.0`?h:m}const _={poolFeeBps:[30,50,100,150,200,250],sellWindowFeeBps:[500,1e3,1500,2e3],sellWindowDecayS:[300,900,1800,2700,3600,7200],buyWindowFeeBps:[500,1e3,1500,2e3],buyWindowDecayS:[60,300,600,900,1800],earlyBuyFeeBps:[0,1250,2500],poolFeeBps:[30,50,100,150,200,250,300,400,500],compoundCommitBps:[1250,2500,3750,5e3],buyWindowDecayS:[15,30,45,60,90,150,300,600,900,1800]};_.sellWindowFeeBps,_.sellWindowDecayS,_.buyWindowFeeBps,_.buyWindowDecayS;var v=class extends Error{constructor(e,t){super(e,t),this.name=`ProtocolError`}};function y(e){let t=e.quoteToken;return t==null||/^0x0{40}$/i.test(t)?null:t}function b(e){let t=e.addresses.bondingCurveV4;if(t===null)throw new v(`This chain has no launch stack deployed yet - launching is unavailable here.`);return t}function x(e){if(e.curveKind===`v3`)throw new v(`This coin launched on the retired v3 stack and can no longer be traded here.`)}function S(e,t){return e.curveAddress??e.stampedCurveAddress??b(t)}function C(e,t){if(e.curveRelease!==void 0)return e.curveRelease;let n=S(e,t).toLowerCase(),r=t.addresses.legacyBondingCurveV4;if(r!==null&&n===r.toLowerCase())return t.addresses.legacyCurveRelease??`2.0`;let i=t.addresses.bondingCurveV4;return i!==null&&n===i.toLowerCase()?t.addresses.activeCurveRelease:`2.0`}const ee=new Set([`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]);function w(e,t){let n=C(e,t);if(!ee.has(n))throw new v(`This coin launched on decommissioned release ${n} and cannot be served right now.`);return n}function te(e,t){if(e.hookAddress!==void 0&&e.hookAddress!==null)return e.hookAddress;let n=t.addresses.legacyBondingCurveV4;return n!==null&&S(e,t).toLowerCase()===n.toLowerCase()?t.addresses.legacyLaunchpadHook??t.addresses.launchpadHook:t.addresses.launchpadHook}const T=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`function predictToken(address launcher, TokenMetadata meta, bytes32 salt) view returns (address)`,`function feeBps() view returns (uint16)`,`function migrationFeeBps() view returns (uint16)`,`function launchFee() view returns (uint256)`,`function launchesPaused() view returns (bool)`,`function buy(address token, uint256 minTokensOut) payable returns (uint256)`,`function sell(address token, uint256 tokensIn, uint256 minEthOut) returns (uint256)`,`function quoteSell(address token, uint256 tokensIn) view returns (uint256 ethOut, uint256 ethGross, uint256 fee)`,`function graduate(address token) returns (uint256)`,`error UnknownCoin()`,`error CurveComplete()`,`error CurveNotActive()`,`error CurveNotComplete()`,`error AlreadyGraduated()`,`error AmountTooSmall()`,`error SlippageExceeded()`,`error MigratorUnset()`,`error LaunchesPaused()`,`error LaunchFeeNotPaid()`,`error LaunchFeeTooHigh()`,`error TargetTooSmall()`,`error TargetTooLarge()`,`error EthTransferFailed()`]),E=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; uint16 poolFeeBps; uint16 launchFeeBps; uint32 launchFeeDecay; bool compounding; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 windowFeeBps; uint32 windowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function maxLaunchWindowFeeBps() view returns (uint16)`,`function launchWindowEnabled() view returns (bool)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`]),D=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; bool compounding; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function maxSellWindowFeeBps() view returns (uint16)`,`function maxBuyWindowFeeBps() view returns (uint16)`,`function sellWindowEnabled() view returns (bool)`,`function buyWindowEnabled() view returns (bool)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`,`error SellWindowDisabled()`,`error BuyWindowDisabled()`]),O=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; uint16 compoundCommitBps; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; uint16 compoundCommitBps; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function maxSellWindowFeeBps() view returns (uint16)`,`function maxBuyWindowFeeBps() view returns (uint16)`,`function sellWindowEnabled() view returns (bool)`,`function buyWindowEnabled() view returns (bool)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`,`error SellWindowDisabled()`,`error BuyWindowDisabled()`]),k=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; bool creatorCurveFees; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; uint16 compoundCommitBps; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; uint16 compoundCommitBps; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function maxSellWindowFeeBps() view returns (uint16)`,`function maxBuyWindowFeeBps() view returns (uint16)`,`function sellWindowEnabled() view returns (bool)`,`function buyWindowEnabled() view returns (bool)`,`function earlyBuyEnabled() view returns (bool)`,`function creatorCurveFeesEnabled() view returns (bool)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error EarlyBuyDisabled()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`,`error SellWindowDisabled()`,`error BuyWindowDisabled()`]),A=l(`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }.struct Coin { address creator; address devBuyer; address migrator; address quoteToken; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; bool abandoned; bool creatorCurveFees; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; uint16 compoundCommitBps; uint32 sniperTaxWindow; uint64 openedAt; uint64 completedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 accrued; }.struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; bool completes; }.struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; address quoteToken; uint256 devBuyQuoteIn; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; uint16 compoundCommitBps; address[] sniperExempt; }.function launch(LaunchParams params) payable returns (address).function getCoin(address token) view returns (Coin coin).function quoteBuyFor(address token, address buyer, uint256 ethGross) view returns (BuyQuote quote).function quoteSell(address token, uint256 tokensIn) view returns (uint256 ethOut, uint256 ethGross, uint256 fee).function buy(address token, uint256 quoteIn, uint256 minTokensOut) payable returns (uint256 tokensOut).function sell(address token, uint256 tokensIn, uint256 minEthOut) returns (uint256 ethOut).function quoteAssets(address quote) view returns (bool approved, uint8 decimals, uint256 minTarget, uint256 maxTarget).function approveQuote(address quote, uint8 decimals, uint256 minTarget, uint256 maxTarget).function revokeQuote(address quote).function setQuoteBand(address quote, uint256 minTarget, uint256 maxTarget).function maxSellWindowFeeBps() view returns (uint16).function maxBuyWindowFeeBps() view returns (uint16).function sellWindowEnabled() view returns (bool).function buyWindowEnabled() view returns (bool).function creatorCurveFeesEnabled() view returns (bool).function curveCreatorShareBps() view returns (uint16).function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount).function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount).function owed(address quote, address recipient) view returns (uint256).function totalOwed(address quote) view returns (uint256).function withdrawOwed(address quote) returns (uint256 amount).function payOut(address quote, address to) returns (uint256 amount).function payoutRecipient(address token) view returns (address).function setPayoutRecipient(address token, address recipient).function pendingCreators(address token) view returns (address).function proposeCreator(address token, address proposed).function acceptCreator(address token).function passFactory() view returns (address).function setPassFactory(address factory).function commitSeat(address token, address clone).event PassFactorySet(address indexed factory).function sniperTaxWindow() view returns (uint32).function setSniperTaxWindow(uint32 sniperTaxWindow).function accruedQuoteFees(address quote) view returns (uint256).function ABANDON_DELAY() view returns (uint256).function abandon(address token).function graduate(address token) returns (uint256 liquidity).function operators(address operator) view returns (bool).function sniperExempt(address token, address wallet) view returns (bool).function SNIPER_TAX_BPS() view returns (uint16).function MAX_SNIPER_TAX_WINDOW() view returns (uint32).function MAX_SNIPER_EXEMPTIONS() view returns (uint256).error UnknownCoin().error CurveComplete().error CurveNotActive().error AmountTooSmall().error SlippageExceeded().error PoolTermsRejected().error InvalidDevBuyer().error SellWindowDisabled().error BuyWindowDisabled().error QuoteNotApproved().error QuoteInvalid().error QuoteDecimalsMismatch(uint8 expected, uint8 actual).error NativeValueMismatch().error UnexpectedNativeValue().error NotPassFactory().error CoinNotActive().error TargetTooSmall().error TargetTooLarge().error TooManyExemptions().error SniperWindowTooLong()`.split(`.`));l([`function description() view returns (string)`,`function logo() view returns (string)`]);const ne=l([`struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }`,`struct QuoteExactSingleParams { PoolKey poolKey; bool zeroForOne; uint128 exactAmount; bytes hookData; }`,`function quoteExactInputSingle(QuoteExactSingleParams params) returns (uint256 amountOut, uint256 gasEstimate)`]),j=l([`function execute(bytes commands, bytes[] inputs, uint256 deadline) payable`]),M=l([`function allowance(address owner, address token, address spender) view returns (uint160 amount, uint48 expiration, uint48 nonce)`,`function approve(address token, address spender, uint160 amount, uint48 expiration)`]),re=l([`function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)`]);l([`function creatorShareBps() view returns (uint16)`,`function compoundCreatorShareBps() view returns (uint16)`,`function compoundShareBps() view returns (uint16)`,`function mandatoryCompounding() view returns (bool)`,`function settleThresholdWei() view returns (uint256)`,`function defaultFeeBps() view returns (uint16)`,`function currentSellFeeBps(bytes32 poolId) view returns (uint16)`,`function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchFeeBps, uint32 launchFeeDecay, uint64 graduatedAt, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot)`,`function pendingCreators(bytes32 poolId) view returns (address)`,`function proposeCreator(bytes32 poolId, address proposed)`,`function acceptCreator(bytes32 poolId)`,`function lowerFee(bytes32 poolId, uint16 feeBps)`]),l([`function creatorShareBps() view returns (uint16)`,`function compoundCreatorShareBps() view returns (uint16)`,`function compoundShareBps() view returns (uint16)`,`function mandatoryCompounding() view returns (bool)`,`function settleThresholdWei() view returns (uint256)`,`function defaultFeeBps() view returns (uint16)`,`function graduationSurchargeEnabled() view returns (bool)`,`function GRADUATION_SURCHARGE_BPS() view returns (uint16)`,`function currentSellFeeBps(bytes32 poolId) view returns (uint16)`,`function currentBuyFeeBps(bytes32 poolId) view returns (uint16)`,`function quoteFees(bytes32 poolId) view returns (uint16 buyFeeBps, uint16 sellFeeBps, uint64 buyWindowEndsAt, uint64 sellWindowEndsAt)`,`function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint64 graduatedAt, uint64 graduationBlock, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot)`,`function pendingCreators(bytes32 poolId) view returns (address)`,`function proposeCreator(bytes32 poolId, address proposed)`,`function acceptCreator(bytes32 poolId)`,`function cancelBuyWindow(bytes32 poolId)`,`function cancelSellWindow(bytes32 poolId)`,`function enableCompounding(bytes32 poolId)`,`function lowerFee(bytes32 poolId, uint16 feeBps)`,`error NoWindow()`,`error AlreadyCompounding()`,`error Unauthorized()`]),l([`event BuyWindowCancelled(bytes32 indexed poolId)`,`event SellWindowCancelled(bytes32 indexed poolId)`,`event CompoundingEnabled(bytes32 indexed poolId)`]),l(`function creatorShareBps() view returns (uint16).function mandatoryCommitBps() view returns (uint16).function compoundingPaused() view returns (bool).function compoundCommitBps(bytes32 poolId) view returns (uint16).function isAllowedCompoundCommit(uint16 commitBps) view returns (bool).function settleThresholdWei() view returns (uint256).function defaultFeeBps() view returns (uint16).function graduationSurchargeEnabled() view returns (bool).function GRADUATION_SURCHARGE_BPS() view returns (uint16).function currentSellFeeBps(bytes32 poolId) view returns (uint16).function currentBuyFeeBps(bytes32 poolId) view returns (uint16).function quoteFees(bytes32 poolId) view returns (uint16 buyFeeBps, uint16 sellFeeBps, uint64 buyWindowEndsAt, uint64 sellWindowEndsAt).function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint64 graduatedAt, uint64 graduationBlock, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot).function pendingCreators(bytes32 poolId) view returns (address).function proposeCreator(bytes32 poolId, address proposed).function acceptCreator(bytes32 poolId).function cancelBuyWindow(bytes32 poolId).function cancelSellWindow(bytes32 poolId).function raiseCompoundCommit(bytes32 poolId, uint16 commitBps).function lowerFee(bytes32 poolId, uint16 feeBps).error NoWindow().error CommitOffMenu().error CommitNotRaised().error Unauthorized()`.split(`.`)),l([`event BuyWindowCancelled(bytes32 indexed poolId)`,`event SellWindowCancelled(bytes32 indexed poolId)`,`event CompoundCommitRaised(bytes32 indexed poolId, uint16 fromBps, uint16 toBps)`]),l(`function creatorShareBps() view returns (uint16).function mandatoryCommitBps() view returns (uint16).function compoundingPaused() view returns (bool).function compoundCommitBps(bytes32 poolId) view returns (uint16).function isAllowedCompoundCommit(uint16 commitBps) view returns (bool).function isAllowedPoolFeeBps(uint16 feeBps) view returns (bool).function settleThresholdWei() view returns (uint256).function quoteSettleThreshold(address quote) view returns (uint256).function setQuoteSettleThreshold(address quote, uint256 threshold).function settleThresholdFor(address quote) view returns (uint256).function defaultFeeBps() view returns (uint16).function graduationSurchargeEnabled() view returns (bool).function GRADUATION_SURCHARGE_BPS() view returns (uint16).function currentSellFeeBps(bytes32 poolId) view returns (uint16).function currentBuyFeeBps(bytes32 poolId) view returns (uint16).function quoteFees(bytes32 poolId) view returns (uint16 buyFeeBps, uint16 sellFeeBps, uint64 buyWindowEndsAt, uint64 sellWindowEndsAt).function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint64 graduatedAt, uint64 graduationBlock, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot).function poolQuote(bytes32 poolId) view returns (address).function pendingCreators(bytes32 poolId) view returns (address).function proposeCreator(bytes32 poolId, address proposed).function acceptCreator(bytes32 poolId).function payoutRecipient(bytes32 poolId) view returns (address).function setPayoutRecipient(bytes32 poolId, address recipient).function owed(address quote, address recipient) view returns (uint256).function withdrawOwed(address quote) returns (uint256 amount).function payOut(address quote, address to) returns (uint256 amount).function cancelBuyWindow(bytes32 poolId).function cancelSellWindow(bytes32 poolId).function raiseCompoundCommit(bytes32 poolId, uint16 commitBps).function lowerFee(bytes32 poolId, uint16 feeBps).function setPassFactory(address factory).function passFactory() view returns (address).function creatorRecoveries(bytes32 poolId) view returns (address creator, uint64 eta).function CREATOR_RECOVERY_DELAY() view returns (uint64).function CREATOR_RECOVERY_WINDOW() view returns (uint64).function proposeCreatorRecovery(bytes32 poolId, address creator).function executeCreatorRecovery(bytes32 poolId).function cancelCreatorRecovery(bytes32 poolId).function allowedMigrators(address migrator) view returns (bool).function collectMany(bytes32[] poolIds).function operators(address operator) view returns (bool).error NoWindow().error CommitOffMenu().error CommitNotRaised().error Unauthorized()`.split(`.`)),l([`event BuyWindowCancelled(bytes32 indexed poolId)`,`event SellWindowCancelled(bytes32 indexed poolId)`,`event CompoundCommitRaised(bytes32 indexed poolId, uint16 fromBps, uint16 toBps)`,`event PayoutRecipientSet(bytes32 indexed poolId, address indexed creator, address indexed recipient)`,`event SeatCommitted(bytes32 indexed poolId, address indexed creator, address indexed clone)`,`event PassFactorySet(address indexed factory)`]),l(`function deployBurner(address hook, bytes32 poolId) returns (address).function deploySplitter(address hook, bytes32 poolId, uint16 burnShareBps) returns (address).function deployBurnerForCoin(address curve, address token) returns (address).function deploySplitterForCoin(address curve, address token, uint16 burnShareBps) returns (address).function burnerFor(bytes32 poolId) view returns (address).function splitterFor(bytes32 poolId) view returns (address).function predictBurner(bytes32 poolId) view returns (address).function predictSplitter(bytes32 poolId) view returns (address).function isFactoryClone(address candidate) view returns (bool).function isFactoryBurner(address candidate) view returns (bool).function isFactorySplitter(address candidate) view returns (bool).function allowedCurves(address curve) view returns (bool).function allowedHooks(address hook) view returns (bool).function quoteBoundsSet(address quote) view returns (bool).function setCurveAllowed(address curve, bool allowed).function distributorRegistry() view returns (address).function setDistributorRegistry(address registry).function distributorFor(bytes32 poolId) view returns (address distributor).function BURN_SHARE_MIN_BPS() view returns (uint16).function BURN_SHARE_MAX_BPS() view returns (uint16).error CurveNotAllowed().error CoinNotOnCurve().error HookNotAllowed().error AllocationExceedsPie().error NotPoolCreator().error BurnShareOutOfBounds().error SplitterExists().error BurnerExists().error QuoteBoundsUnset().event BurnerDeployed(bytes32 indexed poolId, address indexed burner, address indexed creatorAdmin, address hook).event SplitterDeployed(bytes32 indexed poolId, address indexed splitter, address indexed creatorAdmin, uint16 burnShareBps).event CurveAllowed(address indexed curve, bool allowed).event DistributorRegistrySet(address indexed registry)`.split(`.`)),l(`function claimSeat().function burnShareBps() view returns (uint16).function allocation() view returns (uint16 compoundBps, uint16 burnBps, uint16 holderBps, uint16 creatorBps).function holderShareBps() view returns (uint16).function raiseHolderShare(uint16 newShareBps).function heldHolders() view returns (uint256).function totalToHolders() view returns (uint256).function BURN_SHARE_MIN_BPS() view returns (uint16).event HolderShareRaised(uint16 fromBps, uint16 toBps).event HoldersFlushed(address indexed distributor, uint256 toHolders, uint256 heldHolders).error ShareBelowFloor().error DistributionNotLive().function curve() view returns (address).function pullOwedFromCurve() returns (uint256).function fuel() view returns (uint256).function balance() view returns (uint256).function totalEthBurned() view returns (uint256).function totalTokensBurned() view returns (uint256).function checkpoint().function burn() returns (uint256).function flush().function pullOwed() returns (uint256).function checkpointAt() view returns (uint64).function lastBurnAt() view returns (uint64).function burnThresholdWei() view returns (uint256).function maxBurnPerCallWei() view returns (uint256).function burnCooldownSec() view returns (uint64).function bountyBps() view returns (uint16).function slippageBandBps() view returns (uint16).function setBurnConfig(uint256 thresholdWei, uint256 maxPerCallWei, uint64 cooldownSec, uint16 bountyBps, uint16 bandBps).function raiseBurnShare(uint16 newShareBps).function raiseCompoundCommit(uint16 commitBps).function creatorAdmin() view returns (address).function pendingCreatorAdmin() view returns (address).function recoveryProposedAdmin() view returns (address).function recoveryEta() view returns (uint64).function ADMIN_RECOVERY_DELAY_SEC() view returns (uint64).function ADMIN_RECOVERY_WINDOW_SEC() view returns (uint64).function proposeAdminRecovery(address newAdmin).function executeAdminRecovery().function cancelAdminRecovery().error NotRecoveryAuthority().error NoRecoveryPending().error RecoveryNotReady().error RecoveryExpired().function moneyBounds() view returns ((uint256 thresholdMinWei, uint256 thresholdMaxWei, uint256 clipMinWei, uint256 clipMaxWei, uint256 defaultThresholdWei, uint256 defaultClipWei)).function COOLDOWN_MAX_SEC() view returns (uint64).function BOUNTY_MAX_BPS() view returns (uint16).function BAND_MIN_BPS() view returns (uint16).function BAND_MAX_BPS() view returns (uint16).function CHECKPOINT_MIN_AGE_SEC() view returns (uint64).function CHECKPOINT_MAX_AGE_SEC() view returns (uint64).function CHECKPOINT_COOLDOWN_SEC() view returns (uint64)`.split(`.`)),l([`function sweepStranded(address quote) returns (uint256 amount)`,`function positionTokenIds(bytes32 poolId) view returns (uint256)`,`error NothingToSweep()`,`error EthTransferFailed()`]),l([`event Bought(address indexed token, address indexed buyer, uint256 ethGross, uint256 fee, uint256 tokensOut, uint256 ethReserve, uint256 tokenReserve)`,`event Sold(address indexed token, address indexed seller, uint256 tokensIn, uint256 fee, uint256 ethOut, uint256 ethReserve, uint256 tokenReserve)`]);async function N(e,t,n){x(n);let r=w(n,t),i=S(n,t);return r===`9.0`?e.readContract({address:i,abi:A,functionName:`getCoin`,args:[n.mint]}):r===`8.0`?e.readContract({address:i,abi:k,functionName:`getCoin`,args:[n.mint]}):r===`7.0`||r===`7.1`?e.readContract({address:i,abi:O,functionName:`getCoin`,args:[n.mint]}):r===`4.0`?e.readContract({address:i,abi:E,functionName:`getCoin`,args:[n.mint]}):e.readContract({address:i,abi:D,functionName:`getCoin`,args:[n.mint]})}const P=1e4;function ie(e){return!Number.isFinite(e)||e<0?0:e>P?P:Math.trunc(e)}function F(e,t){let n=ie(t);return e*BigInt(P-n)/BigInt(P)}function I(e,t,n=null){let r=n??`0x0000000000000000000000000000000000000000`,[i,a]=BigInt(r)<BigInt(e)?[r,e]:[e,r];return{currency0:i,currency1:a,fee:0,tickSpacing:200,hooks:t}}function L(e,t){return e.currency0.toLowerCase()!==t.toLowerCase()}const ae=[{type:`tuple`,components:[{name:`currency0`,type:`address`},{name:`currency1`,type:`address`},{name:`fee`,type:`uint24`},{name:`tickSpacing`,type:`int24`},{name:`hooks`,type:`address`}]}];function oe(e){return c(r(ae,[e]))}const se=[{type:`tuple`,components:[{name:`poolKey`,type:`tuple`,components:[{name:`currency0`,type:`address`},{name:`currency1`,type:`address`},{name:`fee`,type:`uint24`},{name:`tickSpacing`,type:`int24`},{name:`hooks`,type:`address`}]},{name:`zeroForOne`,type:`bool`},{name:`amountIn`,type:`uint128`},{name:`amountOutMinimum`,type:`uint128`},{name:`hookData`,type:`bytes`}]}];function R(e){let{universalRouter:t,permit2:n,v4Quoter:r,stateView:i}=e.addresses;if(t===null||n===null||r===null)throw new v(`This chain has no v4 graduated trade path deployed yet - trading is unavailable here.`);return{universalRouter:t,permit2:n,v4Quoter:r,stateView:i}}function z(e,t){let n=te(e,t);if(n===null)throw new v(`This chain has no v4 launch hook deployed yet - trading is unavailable here.`);return I(e.mint,n,y(e))}function B(e,t,n){let r=L(t,e.mint),i=n===`buy`,a=r?t.currency0:t.currency1;return{zeroForOne:i===r,currencyIn:i?a:e.mint,currencyOut:i?e.mint:a,isQuoteFirst:r}}async function V(e,t,n,r){let{v4Quoter:i}=R(t),a=z(n,t),o;try{let{result:t}=await e.simulateContract({address:i,abi:ne,functionName:`quoteExactInputSingle`,args:[{poolKey:a,zeroForOne:B(n,a,r.side).zeroForOne,exactAmount:r.amountIn,hookData:`0x`}]});o=t[0]}catch(e){throw new v(`Could not quote this trade.`,{cause:e})}if(o<=0n)throw new v(`This trade quotes to zero output - try a larger amount.`);return o}async function H(e,t,n){try{let{stateView:r}=R(t);if(r===null)return null;let i=z(n,t),[a]=await e.readContract({address:r,abi:re,functionName:`getSlot0`,args:[oe(i)]}),o=Number(a)/2**96,s=o*o;return s<=0?null:L(i,n.mint)?1/s:s}catch{return null}}function U(e){let t=a([`uint8`,`uint8`,`uint8`],[6,12,15]),n=r(se,[{poolKey:e.poolKey,zeroForOne:e.zeroForOne,amountIn:e.amountIn,amountOutMinimum:e.minimumOut,hookData:`0x`}]),o=r([{type:`address`},{type:`uint256`}],[e.currencyIn,e.amountIn]),s=r([{type:`address`},{type:`uint256`}],[e.currencyOut,e.minimumOut]),c=r([{type:`bytes`},{type:`bytes[]`}],[t,[n,o,s]]);return i({abi:j,functionName:`execute`,args:[`0x10`,[c],e.deadlineSeconds]})}async function W(e,t,n,r,a,s,c){let{universalRouter:l,permit2:u}=R(t),[d,f]=await Promise.all([e.readContract({address:n,abi:o,functionName:`allowance`,args:[r,u]}),e.readContract({address:u,abi:M,functionName:`allowance`,args:[r,n,l]})]),p=[];d<a&&p.push({from:r,to:n,data:i({abi:o,functionName:`approve`,args:[u,a]}),value:`0`,chainId:t.chainId,gas:null});let[m,h]=f,g=BigInt(Math.floor(c/1e3));return(m<a||BigInt(h)<=g)&&p.push({from:r,to:u,data:i({abi:M,functionName:`approve`,args:[n,l,a,Number(s)]}),value:`0`,chainId:t.chainId,gas:null}),p}function G(e,t,n,r,i,a,o){return W(e,t,n.mint,r,i,a,o)}function ce(e,t,n,r,i,a,o){let s=y(n);return s===null?Promise.resolve([]):W(e,t,s,r,i,a,o)}function le(e,t,n,r,i,a){let{universalRouter:o}=R(e),s=z(t,e),{zeroForOne:c,currencyIn:l,currencyOut:u}=B(t,s,r.side),d=r.side===`buy`&&y(t)===null;return{from:n,to:o,data:U({poolKey:s,zeroForOne:c,currencyIn:l,currencyOut:u,amountIn:r.amountIn,minimumOut:i,deadlineSeconds:a}),value:d?r.amountIn.toString():`0`,chainId:e.chainId,gas:null}}function K(e){return e instanceof Error?`${e.message} ${K(e.cause)}`:typeof e==`string`?e:``}function ue(e){let t=K(e);return t.includes(`CurveComplete`)?new v(`This curve is complete - trading is frozen until the coin graduates.`):t.includes(`UnknownCoin`)?new v(`This coin has not landed on the curve yet.`):t.includes(`AmountTooSmall`)?new v(`This trade is too small to quote - try a larger amount.`):new v(`Could not quote this trade.`,{cause:e})}function de(e){return e===`4.0`?E:e===`8.0`?k:e===`7.0`||e===`7.1`?O:D}async function fe(e,t,n,r){let i=await e.readContract({address:t,abi:A,functionName:`quoteBuyFor`,args:[n,r.buyer??u,r.amountIn]});return{expectedOut:i.tokensOut,amountUsed:i.ethUsed,willCompleteCurve:i.completes}}async function pe(e,t,n,r){x(n);let i=w(n,t),a=S(n,t),o=n.mint;try{if(r.side===`buy`){if(i===`9.0`)return await fe(e,a,o,r);let t=await e.readContract({address:a,abi:de(i),functionName:`quoteBuy`,args:[o,r.amountIn]});return{expectedOut:t.tokensOut,amountUsed:t.ethUsed,willCompleteCurve:t.completes}}let[t]=await e.readContract({address:a,abi:T,functionName:`quoteSell`,args:[o,r.amountIn]});return{expectedOut:t,amountUsed:r.amountIn,willCompleteCurve:!1}}catch(e){throw ue(e)}}async function q(e,t,n,r){return r.venue===`curve`?pe(e,t,n,r):(x(n),{expectedOut:await V(e,t,n,r),amountUsed:r.amountIn,willCompleteCurve:!1})}async function J(e,t,n,r){try{if(r===`dex`)return await H(e,t,n);let i=await N(e,t,n),{tokenOffset:a}=g(C(n,t)),o=Number(a+i.tokenReserve);return o>0?Number(i.ethOffset+i.ethReserve)/o:null}catch{return null}}function me(e,t,n){if(n===null||n<=0)return null;let r=Number(t.expectedOut);return r<=0?null:e.side===`buy`?(Number(t.amountUsed)/r/n-1)*1e4:(1-r/Number(e.amountIn)/n)*1e4}function Y(e,t,n){return{venue:e.venue,side:e.side,amountIn:e.amountIn.toString(),expectedOut:t.expectedOut.toString(),minimumOut:F(t.expectedOut,e.slippageBps).toString(),amountUsed:t.amountUsed.toString(),completesCurve:t.willCompleteCurve,slippageBps:e.slippageBps,priceImpactBps:me(e,t,n)}}async function X(e,t,n,r){let[i,a]=await Promise.all([q(e,t,n,r),J(e,t,n,r.venue)]);return Y(r,i,a)}function he(e,t,n,r,a=`8.0`){return i(e===`buy`?a===`9.0`?{abi:A,functionName:`buy`,args:[t,n,r]}:{abi:T,functionName:`buy`,args:[t,r]}:{abi:T,functionName:`sell`,args:[t,n,r]})}function Z(e,t){return i({abi:o,functionName:`approve`,args:[e,t]})}async function ge(e,t,n,r,i,a){return await e.readContract({address:n,abi:o,functionName:`allowance`,args:[r,i]})>=a?null:{from:r,to:n,data:Z(i,a),value:`0`,chainId:t.chainId,gas:null}}async function Q(e,t,n,r){if(r.venue===`dex`)return _e(e,t,n,r);let i=r.owner,a=n.mint;x(n);let o=w(n,t),s=S(n,t),c=y(n),l=r.side===`sell`?a:c,[u,d,f]=await Promise.all([q(e,t,n,{...r,buyer:r.owner}),J(e,t,n,r.venue),l===null?Promise.resolve(null):ge(e,t,l,i,s,r.amountIn)]),p=Y(r,u,d),m=f===null?[]:[f];return m.push({from:i,to:s,data:he(r.side,a,r.amountIn,BigInt(p.minimumOut),o),value:r.side===`buy`&&c===null?r.amountIn.toString():`0`,chainId:t.chainId,gas:null}),{txRequests:m,quote:p}}async function _e(e,t,n,r){x(n);let i=r.owner,a=BigInt(Math.floor(r.nowMs/1e3)+1200),[o,s,c]=await Promise.all([V(e,t,n,r),H(e,t,n),r.side===`sell`?G(e,t,n,i,r.amountIn,a,r.nowMs):ce(e,t,n,i,r.amountIn,a,r.nowMs)]),l=Y(r,{expectedOut:o,amountUsed:r.amountIn,willCompleteCurve:!1},s),u=BigInt(l.minimumOut);return{txRequests:[...c,le(t,n,i,r,u,a)],quote:l}}function ve(){}function $(e){return n({id:e,name:`eip155-${String(e)}`,nativeCurrency:{name:`Native currency`,symbol:`NATIVE`,decimals:18},rpcUrls:{default:{http:[]}}})}const ye=[{type:`function`,name:`balanceOf`,stateMutability:`view`,inputs:[{name:`account`,type:`address`}],outputs:[{name:``,type:`uint256`}]}],be=new Set([`curve-trading`,`dormant`,`awaiting-dev-buy`,`abandoned`]);function xe(e){return e.lifecycleState===`graduated`?e.providerMeta.graduatedPoolAddress===null?null:`dex`:be.has(e.lifecycleState)?e.providerMeta.curveAddress===null?null:`curve`:null}function Se(n){let r=d(n.privateKey),i=n.slippageBps??100,a=n.confirmTimeoutMs??12e4,o=n.confirmPollMs??1e3,c=s(n.rpcUrl,{batch:!0,timeout:15e3,retryCount:1}),l=e({transport:c});async function u(){let e=(await n.client.getLaunchConfig()).curveContracts;if(e==null)throw Error(`This deployment does not serve its contract set (getLaunchConfig().curveContracts is null), so trades cannot be built. It is too old for client-side trading, or its launch surface is disabled.`);return f(e)}let p=null;async function m(){p??=u();try{return await p}catch(e){throw p=null,e}}let h=new Map;function g(e){let n=h.get(e);if(n!==void 0)return n;let i=t({account:r,chain:$(e),transport:c});return h.set(e,i),i}async function _(e,t){let[r,i]=await Promise.all([m(),n.client.getLaunch(e)]),a=xe(i);if(a===null)throw Error(`Coin ${e} is not tradable right now (lifecycle state ${i.lifecycleState}).`);if(i.lifecycleState===`abandoned`&&t===`buy`)throw Error(`Coin ${e} was abandoned - it filled its curve but never graduated, and was reopened sell-only. It accepts sells back into the raise and nothing else.`);let o=i.providerMeta;return{config:r,venue:a,ref:{mint:i.mint,curveAddress:o.curveAddress,...o.curveKind!==void 0&&{curveKind:o.curveKind},...o.curveRelease!==void 0&&{curveRelease:o.curveRelease},...o.hookAddress!==void 0&&{hookAddress:o.hookAddress},...o.quoteToken!==void 0&&{quoteToken:o.quoteToken}}}}async function v(e){let t=$(e.chainId),n=await g(e.chainId).sendTransaction({account:r,chain:t,to:e.to,data:e.data,value:BigInt(e.value),...e.gas!==null&&{gas:BigInt(e.gas)}});return{hash:n,status:(await l.waitForTransactionReceipt({hash:n,timeout:a,pollingInterval:o})).status===`success`?`confirmed`:`reverted`}}let y=Promise.resolve();async function b(e){let t=y,n=ve;y=new Promise(e=>{n=e}),await t;try{return await e()}finally{n()}}return{address:r.address,chainClient:l,async quote(e){let{config:t,venue:n,ref:a}=await _(e.mint,e.side);return X(l,t,a,{venue:n,side:e.side,amountIn:e.amountIn,slippageBps:e.slippageBps??i,buyer:r.address})},async trade(e){return b(async()=>{let{config:t,venue:n,ref:a}=await _(e.mint,e.side),o=await Q(l,t,a,{venue:n,side:e.side,amountIn:e.amountIn,slippageBps:e.slippageBps??i,owner:r.address,nowMs:Date.now()}),s=[];for(let e of o.txRequests){let t=await v(e);if(s.push(t.hash),t.status===`reverted`)return{quote:o.quote,venue:n,hashes:s,status:`reverted`}}return{quote:o.quote,venue:n,hashes:s,status:`confirmed`}})},async nativeBalance(){return l.getBalance({address:r.address})},async coinBalance(e){return l.readContract({address:e,abi:ye,functionName:`balanceOf`,args:[r.address]})}}}export{v as ProtocolError,F as applySlippageFloor,Q as buildCurveTrade,S as coinBondingCurve,C as coinCurveRelease,Se as createTrader,f as curveConfigFrom,X as quoteCurveTrade,N as readCurveCoinState};
|
|
1
|
+
import{createPublicClient as e,createWalletClient as t,defineChain as n,encodeAbiParameters as r,encodeFunctionData as i,encodePacked as a,erc20Abi as o,http as s,keccak256 as c,parseAbi as l,zeroAddress as u}from"viem";import{privateKeyToAccount as d}from"viem/accounts";function f(e){return{chainId:e.chainId,addresses:{bondingCurveV4:e.bondingCurveV4,v4Quoter:e.v4Quoter,stateView:e.stateView,universalRouter:e.universalRouter,permit2:e.permit2,positionManager:e.positionManager??null,launchpadHook:e.launchpadHook,legacyBondingCurveV4:e.legacyBondingCurveV4,legacyLaunchpadHook:e.legacyLaunchpadHook,activeCurveRelease:e.activeCurveRelease,legacyCurveRelease:e.legacyCurveRelease??null,liquidityMigratorV4:null,legacyLiquidityMigratorV4:null,uniswapV4PoolManager:null}}}const p={totalSupply:10n**27n,sellableSupply:8n*10n**26n,reserveSupply:2n*10n**26n,tokenOffset:8n*10n**26n/4n,graduatedFeeTierBps:1e4},m={totalSupply:p.totalSupply,sellableSupply:p.sellableSupply,reserveSupply:p.reserveSupply,tokenOffset:p.tokenOffset},h={totalSupply:p.totalSupply,sellableSupply:777777778n*10n**18n,reserveSupply:p.totalSupply-777777778n*10n**18n,tokenOffset:311111111n*10n**18n};function g(e){return e===`9.0`?h:m}const _={poolFeeBps:[30,50,100,150,200,250],sellWindowFeeBps:[500,1e3,1500,2e3],sellWindowDecayS:[300,900,1800,2700,3600,7200],buyWindowFeeBps:[500,1e3,1500,2e3],buyWindowDecayS:[60,300,600,900,1800],earlyBuyFeeBps:[0,1250,2500],poolFeeBps:[30,50,100,150,200,250,300,400,500],compoundCommitBps:[1250,2500,3750,5e3],buyWindowDecayS:[15,30,45,60,90,150,300,600,900,1800]};_.sellWindowFeeBps,_.sellWindowDecayS,_.buyWindowFeeBps,_.buyWindowDecayS;function v(e,t){let n=e?.legacyBondingCurveV4??null;return n!==null&&typeof t==`string`&&t.toLowerCase()===n.toLowerCase()?`legacy`:`active`}var y=class extends Error{constructor(e,t){super(e,t),this.name=`ProtocolError`}};function b(e){let t=e.quoteToken;return t==null||/^0x0{40}$/i.test(t)?null:t}function ee(e){let t=e.addresses.bondingCurveV4;if(t===null)throw new y(`This chain has no launch stack deployed yet - launching is unavailable here.`);return t}function x(e){if(e.curveKind===`v3`)throw new y(`This coin launched on the retired v3 stack and can no longer be traded here.`)}function S(e,t){return e.curveAddress??e.stampedCurveAddress??ee(t)}function te(e,t){return v(t.addresses,S(e,t))}function C(e,t){if(e.curveRelease!==void 0)return e.curveRelease;let n=S(e,t).toLowerCase(),r=t.addresses.legacyBondingCurveV4;if(r!==null&&n===r.toLowerCase())return t.addresses.legacyCurveRelease??`2.0`;let i=t.addresses.bondingCurveV4;return i!==null&&n===i.toLowerCase()?t.addresses.activeCurveRelease:`2.0`}const w=new Set([`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]);function T(e,t){let n=C(e,t);if(!w.has(n))throw new y(`This coin launched on decommissioned release ${n} and cannot be served right now.`);return n}function ne(e,t){return e.hookAddress!==void 0&&e.hookAddress!==null?e.hookAddress:te(e,t)===`legacy`?t.addresses.legacyLaunchpadHook??t.addresses.launchpadHook:t.addresses.launchpadHook}const E=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`function predictToken(address launcher, TokenMetadata meta, bytes32 salt) view returns (address)`,`function feeBps() view returns (uint16)`,`function migrationFeeBps() view returns (uint16)`,`function launchFee() view returns (uint256)`,`function launchesPaused() view returns (bool)`,`function buy(address token, uint256 minTokensOut) payable returns (uint256)`,`function sell(address token, uint256 tokensIn, uint256 minEthOut) returns (uint256)`,`function quoteSell(address token, uint256 tokensIn) view returns (uint256 ethOut, uint256 ethGross, uint256 fee)`,`function graduate(address token) returns (uint256)`,`error UnknownCoin()`,`error CurveComplete()`,`error CurveNotActive()`,`error CurveNotComplete()`,`error AlreadyGraduated()`,`error AmountTooSmall()`,`error SlippageExceeded()`,`error MigratorUnset()`,`error LaunchesPaused()`,`error LaunchFeeNotPaid()`,`error LaunchFeeTooHigh()`,`error TargetTooSmall()`,`error TargetTooLarge()`,`error EthTransferFailed()`]),D=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; uint16 poolFeeBps; uint16 launchFeeBps; uint32 launchFeeDecay; bool compounding; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 windowFeeBps; uint32 windowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function maxLaunchWindowFeeBps() view returns (uint16)`,`function launchWindowEnabled() view returns (bool)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`]),O=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; bool compounding; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function maxSellWindowFeeBps() view returns (uint16)`,`function maxBuyWindowFeeBps() view returns (uint16)`,`function sellWindowEnabled() view returns (bool)`,`function buyWindowEnabled() view returns (bool)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`,`error SellWindowDisabled()`,`error BuyWindowDisabled()`]),k=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; uint16 compoundCommitBps; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; uint16 compoundCommitBps; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function maxSellWindowFeeBps() view returns (uint16)`,`function maxBuyWindowFeeBps() view returns (uint16)`,`function sellWindowEnabled() view returns (bool)`,`function buyWindowEnabled() view returns (bool)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`,`error SellWindowDisabled()`,`error BuyWindowDisabled()`]),A=l([`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }`,`struct Coin { address creator; address devBuyer; address migrator; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; bool creatorCurveFees; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; uint16 compoundCommitBps; uint16 earlyBuyFeeBps; uint64 activatedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 soldHighWater; uint256 accrued; uint256 earlyBuyAccrued; }`,`struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; uint256 earlyBuyFee; uint16 earlyBuyRateBps; bool completes; }`,`struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; uint16 earlyBuyFeeBps; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; uint16 compoundCommitBps; }`,`function launch(LaunchParams params) payable returns (address)`,`function getCoin(address token) view returns (Coin coin)`,`function quoteBuy(address token, uint256 ethGross) view returns (BuyQuote quote)`,`function lowerEarlyBuyFee(address token, uint16 earlyBuyFeeBps)`,`function maxSellWindowFeeBps() view returns (uint16)`,`function maxBuyWindowFeeBps() view returns (uint16)`,`function sellWindowEnabled() view returns (bool)`,`function buyWindowEnabled() view returns (bool)`,`function earlyBuyEnabled() view returns (bool)`,`function creatorCurveFeesEnabled() view returns (bool)`,`function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount)`,`function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount)`,`error EarlyBuyFeeOffMenu()`,`error EarlyBuyDisabled()`,`error PoolTermsRejected()`,`error InvalidDevBuyer()`,`error SellWindowDisabled()`,`error BuyWindowDisabled()`]),j=l(`struct TokenMetadata { string name; string symbol; string tokenURI; string logo; string description; }.struct Coin { address creator; address devBuyer; address migrator; address quoteToken; uint16 feeBps; uint16 migrationFeeBps; bool complete; bool graduated; bool active; bool abandoned; bool creatorCurveFees; uint16 poolFeeBps; uint16 launchSellFeeBps; uint32 launchSellFeeDecay; uint16 launchBuyFeeBps; uint32 launchBuyFeeDecay; uint16 compoundCommitBps; uint32 sniperTaxWindow; uint64 openedAt; uint64 completedAt; uint256 ethOffset; uint256 ethReserve; uint256 tokenReserve; uint256 bondingTarget; uint256 accrued; }.struct BuyQuote { uint256 tokensOut; uint256 ethUsed; uint256 tradeFee; bool completes; }.struct LaunchParams { TokenMetadata meta; bytes32 salt; uint256 bondingTarget; bool awaitDevBuy; uint256 devBuyMinTokens; address quoteToken; uint256 devBuyQuoteIn; uint16 poolFeeBps; uint16 sellWindowFeeBps; uint32 sellWindowDecay; bool compounding; address devBuyer; uint16 buyWindowFeeBps; uint32 buyWindowDecay; uint16 compoundCommitBps; address[] sniperExempt; }.function launch(LaunchParams params) payable returns (address).function getCoin(address token) view returns (Coin coin).function quoteBuyFor(address token, address buyer, uint256 ethGross) view returns (BuyQuote quote).function quoteSell(address token, uint256 tokensIn) view returns (uint256 ethOut, uint256 ethGross, uint256 fee).function buy(address token, uint256 quoteIn, uint256 minTokensOut) payable returns (uint256 tokensOut).function sell(address token, uint256 tokensIn, uint256 minEthOut) returns (uint256 ethOut).function quoteAssets(address quote) view returns (bool approved, uint8 decimals, uint256 minTarget, uint256 maxTarget).function approveQuote(address quote, uint8 decimals, uint256 minTarget, uint256 maxTarget).function revokeQuote(address quote).function setQuoteBand(address quote, uint256 minTarget, uint256 maxTarget).function maxSellWindowFeeBps() view returns (uint16).function maxBuyWindowFeeBps() view returns (uint16).function sellWindowEnabled() view returns (bool).function buyWindowEnabled() view returns (bool).function creatorCurveFeesEnabled() view returns (bool).function curveCreatorShareBps() view returns (uint16).function pendingFees(address token) view returns (uint256 creatorAmount, uint256 treasuryAmount).function collect(address token) returns (uint256 creatorAmount, uint256 treasuryAmount).function owed(address quote, address recipient) view returns (uint256).function totalOwed(address quote) view returns (uint256).function withdrawOwed(address quote) returns (uint256 amount).function payOut(address quote, address to) returns (uint256 amount).function payoutRecipient(address token) view returns (address).function setPayoutRecipient(address token, address recipient).function pendingCreators(address token) view returns (address).function proposeCreator(address token, address proposed).function acceptCreator(address token).function passFactory() view returns (address).function setPassFactory(address factory).function commitSeat(address token, address clone).event PassFactorySet(address indexed factory).function sniperTaxWindow() view returns (uint32).function setSniperTaxWindow(uint32 sniperTaxWindow).function accruedQuoteFees(address quote) view returns (uint256).function ABANDON_DELAY() view returns (uint256).function abandon(address token).function graduate(address token) returns (uint256 liquidity).function operators(address operator) view returns (bool).function sniperExempt(address token, address wallet) view returns (bool).function SNIPER_TAX_BPS() view returns (uint16).function MAX_SNIPER_TAX_WINDOW() view returns (uint32).function MAX_SNIPER_EXEMPTIONS() view returns (uint256).error UnknownCoin().error CurveComplete().error CurveNotActive().error AmountTooSmall().error SlippageExceeded().error PoolTermsRejected().error InvalidDevBuyer().error SellWindowDisabled().error BuyWindowDisabled().error QuoteNotApproved().error QuoteInvalid().error QuoteDecimalsMismatch(uint8 expected, uint8 actual).error NativeValueMismatch().error UnexpectedNativeValue().error NotPassFactory().error CoinNotActive().error TargetTooSmall().error TargetTooLarge().error TooManyExemptions().error SniperWindowTooLong()`.split(`.`));l([`function description() view returns (string)`,`function logo() view returns (string)`]);const re=l([`struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }`,`struct QuoteExactSingleParams { PoolKey poolKey; bool zeroForOne; uint128 exactAmount; bytes hookData; }`,`function quoteExactInputSingle(QuoteExactSingleParams params) returns (uint256 amountOut, uint256 gasEstimate)`,`struct PathKey { address intermediateCurrency; uint24 fee; int24 tickSpacing; address hooks; bytes hookData; }`,`struct QuoteExactParams { address exactCurrency; PathKey[] path; uint128 exactAmount; }`,`function quoteExactInput(QuoteExactParams params) returns (uint256 amountOut, uint256 gasEstimate)`]),M=l([`function execute(bytes commands, bytes[] inputs, uint256 deadline) payable`]),N=l([`function allowance(address owner, address token, address spender) view returns (uint160 amount, uint48 expiration, uint48 nonce)`,`function approve(address token, address spender, uint160 amount, uint48 expiration)`]),ie=l([`function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)`]);l([`function creatorShareBps() view returns (uint16)`,`function compoundCreatorShareBps() view returns (uint16)`,`function compoundShareBps() view returns (uint16)`,`function mandatoryCompounding() view returns (bool)`,`function settleThresholdWei() view returns (uint256)`,`function defaultFeeBps() view returns (uint16)`,`function currentSellFeeBps(bytes32 poolId) view returns (uint16)`,`function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchFeeBps, uint32 launchFeeDecay, uint64 graduatedAt, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot)`,`function pendingCreators(bytes32 poolId) view returns (address)`,`function proposeCreator(bytes32 poolId, address proposed)`,`function acceptCreator(bytes32 poolId)`,`function lowerFee(bytes32 poolId, uint16 feeBps)`]),l([`function creatorShareBps() view returns (uint16)`,`function compoundCreatorShareBps() view returns (uint16)`,`function compoundShareBps() view returns (uint16)`,`function mandatoryCompounding() view returns (bool)`,`function settleThresholdWei() view returns (uint256)`,`function defaultFeeBps() view returns (uint16)`,`function graduationSurchargeEnabled() view returns (bool)`,`function GRADUATION_SURCHARGE_BPS() view returns (uint16)`,`function currentSellFeeBps(bytes32 poolId) view returns (uint16)`,`function currentBuyFeeBps(bytes32 poolId) view returns (uint16)`,`function quoteFees(bytes32 poolId) view returns (uint16 buyFeeBps, uint16 sellFeeBps, uint64 buyWindowEndsAt, uint64 sellWindowEndsAt)`,`function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount)`,`function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint64 graduatedAt, uint64 graduationBlock, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot)`,`function pendingCreators(bytes32 poolId) view returns (address)`,`function proposeCreator(bytes32 poolId, address proposed)`,`function acceptCreator(bytes32 poolId)`,`function cancelBuyWindow(bytes32 poolId)`,`function cancelSellWindow(bytes32 poolId)`,`function enableCompounding(bytes32 poolId)`,`function lowerFee(bytes32 poolId, uint16 feeBps)`,`error NoWindow()`,`error AlreadyCompounding()`,`error Unauthorized()`]),l([`event BuyWindowCancelled(bytes32 indexed poolId)`,`event SellWindowCancelled(bytes32 indexed poolId)`,`event CompoundingEnabled(bytes32 indexed poolId)`]),l(`function creatorShareBps() view returns (uint16).function mandatoryCommitBps() view returns (uint16).function compoundingPaused() view returns (bool).function compoundCommitBps(bytes32 poolId) view returns (uint16).function isAllowedCompoundCommit(uint16 commitBps) view returns (bool).function settleThresholdWei() view returns (uint256).function defaultFeeBps() view returns (uint16).function graduationSurchargeEnabled() view returns (bool).function GRADUATION_SURCHARGE_BPS() view returns (uint16).function currentSellFeeBps(bytes32 poolId) view returns (uint16).function currentBuyFeeBps(bytes32 poolId) view returns (uint16).function quoteFees(bytes32 poolId) view returns (uint16 buyFeeBps, uint16 sellFeeBps, uint64 buyWindowEndsAt, uint64 sellWindowEndsAt).function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint64 graduatedAt, uint64 graduationBlock, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot).function pendingCreators(bytes32 poolId) view returns (address).function proposeCreator(bytes32 poolId, address proposed).function acceptCreator(bytes32 poolId).function cancelBuyWindow(bytes32 poolId).function cancelSellWindow(bytes32 poolId).function raiseCompoundCommit(bytes32 poolId, uint16 commitBps).function lowerFee(bytes32 poolId, uint16 feeBps).error NoWindow().error CommitOffMenu().error CommitNotRaised().error Unauthorized()`.split(`.`)),l([`event BuyWindowCancelled(bytes32 indexed poolId)`,`event SellWindowCancelled(bytes32 indexed poolId)`,`event CompoundCommitRaised(bytes32 indexed poolId, uint16 fromBps, uint16 toBps)`]),l(`function creatorShareBps() view returns (uint16).function mandatoryCommitBps() view returns (uint16).function compoundingPaused() view returns (bool).function compoundCommitBps(bytes32 poolId) view returns (uint16).function isAllowedCompoundCommit(uint16 commitBps) view returns (bool).function isAllowedPoolFeeBps(uint16 feeBps) view returns (bool).function settleThresholdWei() view returns (uint256).function quoteSettleThreshold(address quote) view returns (uint256).function setQuoteSettleThreshold(address quote, uint256 threshold).function settleThresholdFor(address quote) view returns (uint256).function defaultFeeBps() view returns (uint16).function graduationSurchargeEnabled() view returns (bool).function GRADUATION_SURCHARGE_BPS() view returns (uint16).function currentSellFeeBps(bytes32 poolId) view returns (uint16).function currentBuyFeeBps(bytes32 poolId) view returns (uint16).function quoteFees(bytes32 poolId) view returns (uint16 buyFeeBps, uint16 sellFeeBps, uint64 buyWindowEndsAt, uint64 sellWindowEndsAt).function pendingFees(bytes32 poolId) view returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function collect(bytes32 poolId) returns (uint256 creatorAmount, uint256 compoundAmount, uint256 treasuryAmount).function pools(bytes32 poolId) view returns (address creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint64 graduatedAt, uint64 graduationBlock, address asset, int24 tickSpacing, bool compounding, uint256 accrued, uint256 compoundPot).function poolQuote(bytes32 poolId) view returns (address).function pendingCreators(bytes32 poolId) view returns (address).function proposeCreator(bytes32 poolId, address proposed).function acceptCreator(bytes32 poolId).function payoutRecipient(bytes32 poolId) view returns (address).function setPayoutRecipient(bytes32 poolId, address recipient).function owed(address quote, address recipient) view returns (uint256).function withdrawOwed(address quote) returns (uint256 amount).function payOut(address quote, address to) returns (uint256 amount).function cancelBuyWindow(bytes32 poolId).function cancelSellWindow(bytes32 poolId).function raiseCompoundCommit(bytes32 poolId, uint16 commitBps).function lowerFee(bytes32 poolId, uint16 feeBps).function setPassFactory(address factory).function passFactory() view returns (address).function creatorRecoveries(bytes32 poolId) view returns (address creator, uint64 eta).function CREATOR_RECOVERY_DELAY() view returns (uint64).function CREATOR_RECOVERY_WINDOW() view returns (uint64).function proposeCreatorRecovery(bytes32 poolId, address creator).function executeCreatorRecovery(bytes32 poolId).function cancelCreatorRecovery(bytes32 poolId).function allowedMigrators(address migrator) view returns (bool).function collectMany(bytes32[] poolIds).function operators(address operator) view returns (bool).error NoWindow().error CommitOffMenu().error CommitNotRaised().error Unauthorized()`.split(`.`)),l([`event BuyWindowCancelled(bytes32 indexed poolId)`,`event SellWindowCancelled(bytes32 indexed poolId)`,`event CompoundCommitRaised(bytes32 indexed poolId, uint16 fromBps, uint16 toBps)`,`event PayoutRecipientSet(bytes32 indexed poolId, address indexed creator, address indexed recipient)`,`event SeatCommitted(bytes32 indexed poolId, address indexed creator, address indexed clone)`,`event PassFactorySet(address indexed factory)`]),l(`function deployBurner(address hook, bytes32 poolId) returns (address).function deploySplitter(address hook, bytes32 poolId, uint16 burnShareBps) returns (address).function deployBurnerForCoin(address curve, address token) returns (address).function deploySplitterForCoin(address curve, address token, uint16 burnShareBps) returns (address).function burnerFor(bytes32 poolId) view returns (address).function splitterFor(bytes32 poolId) view returns (address).function predictBurner(bytes32 poolId) view returns (address).function predictSplitter(bytes32 poolId) view returns (address).function isFactoryClone(address candidate) view returns (bool).function isFactoryBurner(address candidate) view returns (bool).function isFactorySplitter(address candidate) view returns (bool).function allowedCurves(address curve) view returns (bool).function allowedHooks(address hook) view returns (bool).function quoteBoundsSet(address quote) view returns (bool).function setCurveAllowed(address curve, bool allowed).function distributorRegistry() view returns (address).function setDistributorRegistry(address registry).function distributorFor(bytes32 poolId) view returns (address distributor).function BURN_SHARE_MIN_BPS() view returns (uint16).function BURN_SHARE_MAX_BPS() view returns (uint16).error CurveNotAllowed().error CoinNotOnCurve().error HookNotAllowed().error AllocationExceedsPie().error NotPoolCreator().error BurnShareOutOfBounds().error SplitterExists().error BurnerExists().error QuoteBoundsUnset().event BurnerDeployed(bytes32 indexed poolId, address indexed burner, address indexed creatorAdmin, address hook).event SplitterDeployed(bytes32 indexed poolId, address indexed splitter, address indexed creatorAdmin, uint16 burnShareBps).event CurveAllowed(address indexed curve, bool allowed).event DistributorRegistrySet(address indexed registry)`.split(`.`)),l(`function claimSeat().function burnShareBps() view returns (uint16).function allocation() view returns (uint16 compoundBps, uint16 burnBps, uint16 holderBps, uint16 creatorBps).function holderShareBps() view returns (uint16).function raiseHolderShare(uint16 newShareBps).function heldHolders() view returns (uint256).function totalToHolders() view returns (uint256).function BURN_SHARE_MIN_BPS() view returns (uint16).event HolderShareRaised(uint16 fromBps, uint16 toBps).event HoldersFlushed(address indexed distributor, uint256 toHolders, uint256 heldHolders).error ShareBelowFloor().error DistributionNotLive().function curve() view returns (address).function pullOwedFromCurve() returns (uint256).function fuel() view returns (uint256).function balance() view returns (uint256).function totalEthBurned() view returns (uint256).function totalTokensBurned() view returns (uint256).function checkpoint().function burn() returns (uint256).error BurnsPaused().error AdapterNotAllowed().error BelowThreshold().error CoolingDown().error NoCheckpoint().error CheckpointTooFresh().error CheckpointCoolingDown().error CheckpointStale().error PriceOutOfBand().error MinOutZero().error PoolTooShallow().error PoolNotInitialized().function flush().function pullOwed() returns (uint256).function checkpointAt() view returns (uint64).function lastBurnAt() view returns (uint64).function burnThresholdWei() view returns (uint256).function maxBurnPerCallWei() view returns (uint256).function burnCooldownSec() view returns (uint64).function bountyBps() view returns (uint16).function slippageBandBps() view returns (uint16).function setBurnConfig(uint256 thresholdWei, uint256 maxPerCallWei, uint64 cooldownSec, uint16 bountyBps, uint16 bandBps).function raiseBurnShare(uint16 newShareBps).function raiseCompoundCommit(uint16 commitBps).function creatorAdmin() view returns (address).function pendingCreatorAdmin() view returns (address).function recoveryProposedAdmin() view returns (address).function recoveryEta() view returns (uint64).function ADMIN_RECOVERY_DELAY_SEC() view returns (uint64).function ADMIN_RECOVERY_WINDOW_SEC() view returns (uint64).function proposeAdminRecovery(address newAdmin).function executeAdminRecovery().function cancelAdminRecovery().error NotRecoveryAuthority().error NoRecoveryPending().error RecoveryNotReady().error RecoveryExpired().function moneyBounds() view returns ((uint256 thresholdMinWei, uint256 thresholdMaxWei, uint256 clipMinWei, uint256 clipMaxWei, uint256 defaultThresholdWei, uint256 defaultClipWei)).function COOLDOWN_MAX_SEC() view returns (uint64).function BOUNTY_MAX_BPS() view returns (uint16).function BAND_MIN_BPS() view returns (uint16).function BAND_MAX_BPS() view returns (uint16).function CHECKPOINT_MIN_AGE_SEC() view returns (uint64).function CHECKPOINT_MAX_AGE_SEC() view returns (uint64).function CHECKPOINT_COOLDOWN_SEC() view returns (uint64)`.split(`.`)),l([`function sweepStranded(address quote) returns (uint256 amount)`,`function positionTokenIds(bytes32 poolId) view returns (uint256)`,`error NothingToSweep()`,`error EthTransferFailed()`]),l([`event Bought(address indexed token, address indexed buyer, uint256 ethGross, uint256 fee, uint256 tokensOut, uint256 ethReserve, uint256 tokenReserve)`,`event Sold(address indexed token, address indexed seller, uint256 tokensIn, uint256 fee, uint256 ethOut, uint256 ethReserve, uint256 tokenReserve)`]);async function P(e,t,n){x(n);let r=T(n,t),i=S(n,t);return r===`9.0`?e.readContract({address:i,abi:j,functionName:`getCoin`,args:[n.mint]}):r===`8.0`?e.readContract({address:i,abi:A,functionName:`getCoin`,args:[n.mint]}):r===`7.0`||r===`7.1`?e.readContract({address:i,abi:k,functionName:`getCoin`,args:[n.mint]}):r===`4.0`?e.readContract({address:i,abi:D,functionName:`getCoin`,args:[n.mint]}):e.readContract({address:i,abi:O,functionName:`getCoin`,args:[n.mint]})}const F=1e4;function I(e){return!Number.isFinite(e)||e<0?0:e>F?F:Math.trunc(e)}function L(e,t){let n=I(t);return e*BigInt(F-n)/BigInt(F)}function ae(e,t,n=null){let r=n??`0x0000000000000000000000000000000000000000`,[i,a]=BigInt(r)<BigInt(e)?[r,e]:[e,r];return{currency0:i,currency1:a,fee:0,tickSpacing:200,hooks:t}}function R(e,t){return e.currency0.toLowerCase()!==t.toLowerCase()}const oe=[{type:`tuple`,components:[{name:`currency0`,type:`address`},{name:`currency1`,type:`address`},{name:`fee`,type:`uint24`},{name:`tickSpacing`,type:`int24`},{name:`hooks`,type:`address`}]}];function se(e){return c(r(oe,[e]))}const ce=[{type:`tuple`,components:[{name:`poolKey`,type:`tuple`,components:[{name:`currency0`,type:`address`},{name:`currency1`,type:`address`},{name:`fee`,type:`uint24`},{name:`tickSpacing`,type:`int24`},{name:`hooks`,type:`address`}]},{name:`zeroForOne`,type:`bool`},{name:`amountIn`,type:`uint128`},{name:`amountOutMinimum`,type:`uint128`},{name:`minHopPriceX36`,type:`uint256`},{name:`hookData`,type:`bytes`}]}];function z(e){let{universalRouter:t,permit2:n,v4Quoter:r,stateView:i}=e.addresses;if(t===null||n===null||r===null)throw new y(`This chain has no v4 graduated trade path deployed yet - trading is unavailable here.`);return{universalRouter:t,permit2:n,v4Quoter:r,stateView:i}}function B(e,t){let n=ne(e,t);if(n===null)throw new y(`This chain has no v4 launch hook deployed yet - trading is unavailable here.`);return ae(e.mint,n,b(e))}function V(e,t,n){let r=R(t,e.mint),i=n===`buy`,a=r?t.currency0:t.currency1;return{zeroForOne:i===r,currencyIn:i?a:e.mint,currencyOut:i?e.mint:a,isQuoteFirst:r}}async function H(e,t,n,r){let{v4Quoter:i}=z(t),a=B(n,t),o;try{let{result:t}=await e.simulateContract({address:i,abi:re,functionName:`quoteExactInputSingle`,args:[{poolKey:a,zeroForOne:V(n,a,r.side).zeroForOne,exactAmount:r.amountIn,hookData:`0x`}]});o=t[0]}catch(e){throw new y(`Could not quote this trade.`,{cause:e})}if(o<=0n)throw new y(`This trade quotes to zero output - try a larger amount.`);return o}async function U(e,t,n){try{let{stateView:r}=z(t);if(r===null)return null;let i=B(n,t),[a]=await e.readContract({address:r,abi:ie,functionName:`getSlot0`,args:[se(i)]}),o=Number(a)/2**96,s=o*o;return s<=0?null:R(i,n.mint)?1/s:s}catch{return null}}function W(e){let t=a([`uint8`,`uint8`,`uint8`],[6,12,15]),n=r(ce,[{poolKey:e.poolKey,zeroForOne:e.zeroForOne,amountIn:e.amountIn,amountOutMinimum:e.minimumOut,minHopPriceX36:320n,hookData:`0x`}]),o=r([{type:`address`},{type:`uint256`}],[e.currencyIn,e.amountIn]),s=r([{type:`address`},{type:`uint256`}],[e.currencyOut,e.minimumOut]),c=r([{type:`bytes`},{type:`bytes[]`}],[t,[n,o,s]]);return i({abi:M,functionName:`execute`,args:[`0x10`,[c],e.deadlineSeconds]})}async function G(e,t,n,r,a,s,c){let{universalRouter:l,permit2:u}=z(t),[d,f]=await Promise.all([e.readContract({address:n,abi:o,functionName:`allowance`,args:[r,u]}),e.readContract({address:u,abi:N,functionName:`allowance`,args:[r,n,l]})]),p=[];d<a&&p.push({from:r,to:n,data:i({abi:o,functionName:`approve`,args:[u,a]}),value:`0`,chainId:t.chainId,gas:null});let[m,h]=f,g=BigInt(Math.floor(c/1e3));return(m<a||BigInt(h)<=g)&&p.push({from:r,to:u,data:i({abi:N,functionName:`approve`,args:[n,l,a,Number(s)]}),value:`0`,chainId:t.chainId,gas:null}),p}function le(e,t,n,r,i,a,o){return G(e,t,n.mint,r,i,a,o)}function ue(e,t,n,r,i,a,o){let s=b(n);return s===null?Promise.resolve([]):G(e,t,s,r,i,a,o)}function de(e,t,n,r,i,a){let{universalRouter:o}=z(e),s=B(t,e),{zeroForOne:c,currencyIn:l,currencyOut:u}=V(t,s,r.side),d=r.side===`buy`&&b(t)===null;return{from:n,to:o,data:W({poolKey:s,zeroForOne:c,currencyIn:l,currencyOut:u,amountIn:r.amountIn,minimumOut:i,deadlineSeconds:a}),value:d?r.amountIn.toString():`0`,chainId:e.chainId,gas:null}}function K(e){return e instanceof Error?`${e.message} ${K(e.cause)}`:typeof e==`string`?e:``}function fe(e){let t=K(e);return t.includes(`CurveComplete`)?new y(`This curve is complete - trading is frozen until the coin graduates.`):t.includes(`UnknownCoin`)?new y(`This coin has not landed on the curve yet.`):t.includes(`AmountTooSmall`)?new y(`This trade is too small to quote - try a larger amount.`):new y(`Could not quote this trade.`,{cause:e})}function pe(e){return e===`4.0`?D:e===`8.0`?A:e===`7.0`||e===`7.1`?k:O}async function me(e,t,n,r){let i=await e.readContract({address:t,abi:j,functionName:`quoteBuyFor`,args:[n,r.buyer??u,r.amountIn]});return{expectedOut:i.tokensOut,amountUsed:i.ethUsed,willCompleteCurve:i.completes}}async function he(e,t,n,r){x(n);let i=T(n,t),a=S(n,t),o=n.mint;try{if(r.side===`buy`){if(i===`9.0`)return await me(e,a,o,r);let t=await e.readContract({address:a,abi:pe(i),functionName:`quoteBuy`,args:[o,r.amountIn]});return{expectedOut:t.tokensOut,amountUsed:t.ethUsed,willCompleteCurve:t.completes}}let[t]=await e.readContract({address:a,abi:E,functionName:`quoteSell`,args:[o,r.amountIn]});return{expectedOut:t,amountUsed:r.amountIn,willCompleteCurve:!1}}catch(e){throw fe(e)}}async function q(e,t,n,r){return r.venue===`curve`?he(e,t,n,r):(x(n),{expectedOut:await H(e,t,n,r),amountUsed:r.amountIn,willCompleteCurve:!1})}async function J(e,t,n,r){try{if(r===`dex`)return await U(e,t,n);let i=await P(e,t,n),{tokenOffset:a}=g(C(n,t)),o=Number(a+i.tokenReserve);return o>0?Number(i.ethOffset+i.ethReserve)/o:null}catch{return null}}function ge(e,t,n){if(n===null||n<=0)return null;let r=Number(t.expectedOut);return r<=0?null:e.side===`buy`?(Number(t.amountUsed)/r/n-1)*1e4:(1-r/Number(e.amountIn)/n)*1e4}function Y(e,t,n){return{venue:e.venue,side:e.side,amountIn:e.amountIn.toString(),expectedOut:t.expectedOut.toString(),minimumOut:L(t.expectedOut,e.slippageBps).toString(),amountUsed:t.amountUsed.toString(),completesCurve:t.willCompleteCurve,slippageBps:e.slippageBps,priceImpactBps:ge(e,t,n)}}async function X(e,t,n,r){let[i,a]=await Promise.all([q(e,t,n,r),J(e,t,n,r.venue)]);return Y(r,i,a)}function _e(e,t,n,r,a=`8.0`){return i(e===`buy`?a===`9.0`?{abi:j,functionName:`buy`,args:[t,n,r]}:{abi:E,functionName:`buy`,args:[t,r]}:{abi:E,functionName:`sell`,args:[t,n,r]})}function ve(e,t){return i({abi:o,functionName:`approve`,args:[e,t]})}async function ye(e,t,n,r,i,a){return await e.readContract({address:n,abi:o,functionName:`allowance`,args:[r,i]})>=a?null:{from:r,to:n,data:ve(i,a),value:`0`,chainId:t.chainId,gas:null}}async function Z(e,t,n,r){if(r.venue===`dex`)return be(e,t,n,r);let i=r.owner,a=n.mint;x(n);let o=T(n,t),s=S(n,t),c=b(n),l=r.side===`sell`?a:c,[u,d,f]=await Promise.all([q(e,t,n,{...r,buyer:r.owner}),J(e,t,n,r.venue),l===null?Promise.resolve(null):ye(e,t,l,i,s,r.amountIn)]),p=Y(r,u,d),m=f===null?[]:[f];return m.push({from:i,to:s,data:_e(r.side,a,r.amountIn,BigInt(p.minimumOut),o),value:r.side===`buy`&&c===null?r.amountIn.toString():`0`,chainId:t.chainId,gas:null}),{txRequests:m,quote:p}}async function be(e,t,n,r){x(n);let i=r.owner,a=BigInt(Math.floor(r.nowMs/1e3)+1200),[o,s,c]=await Promise.all([H(e,t,n,r),U(e,t,n),r.side===`sell`?le(e,t,n,i,r.amountIn,a,r.nowMs):ue(e,t,n,i,r.amountIn,a,r.nowMs)]),l=Y(r,{expectedOut:o,amountUsed:r.amountIn,willCompleteCurve:!1},s),u=BigInt(l.minimumOut);return{txRequests:[...c,de(t,n,i,r,u,a)],quote:l}}function Q(){}function $(e){return n({id:e,name:`eip155-${String(e)}`,nativeCurrency:{name:`Native currency`,symbol:`NATIVE`,decimals:18},rpcUrls:{default:{http:[]}}})}const xe=[{type:`function`,name:`balanceOf`,stateMutability:`view`,inputs:[{name:`account`,type:`address`}],outputs:[{name:``,type:`uint256`}]}],Se=new Set([`curve-trading`,`dormant`,`awaiting-dev-buy`,`abandoned`]);function Ce(e){return e.lifecycleState===`graduated`?e.providerMeta.graduatedPoolAddress===null?null:`dex`:Se.has(e.lifecycleState)?e.providerMeta.curveAddress===null?null:`curve`:null}function we(n){let r=d(n.privateKey),i=n.slippageBps??100,a=n.confirmTimeoutMs??12e4,o=n.confirmPollMs??1e3,c=s(n.rpcUrl,{batch:!0,timeout:15e3,retryCount:1}),l=e({transport:c});async function u(){let e=(await n.client.getLaunchConfig()).curveContracts;if(e==null)throw Error(`This deployment does not serve its contract set (getLaunchConfig().curveContracts is null), so trades cannot be built. It is too old for client-side trading, or its launch surface is disabled.`);return f(e)}let p=null;async function m(){p??=u();try{return await p}catch(e){throw p=null,e}}let h=new Map;function g(e){let n=h.get(e);if(n!==void 0)return n;let i=t({account:r,chain:$(e),transport:c});return h.set(e,i),i}async function _(e,t){let[r,i]=await Promise.all([m(),n.client.getLaunch(e)]),a=Ce(i);if(a===null)throw Error(`Coin ${e} is not tradable right now (lifecycle state ${i.lifecycleState}).`);if(i.lifecycleState===`abandoned`&&t===`buy`)throw Error(`Coin ${e} was abandoned - it filled its curve but never graduated, and was reopened sell-only. It accepts sells back into the raise and nothing else.`);let o=i.providerMeta;return{config:r,venue:a,ref:{mint:i.mint,curveAddress:o.curveAddress,...o.curveKind!==void 0&&{curveKind:o.curveKind},...o.curveRelease!==void 0&&{curveRelease:o.curveRelease},...o.hookAddress!==void 0&&{hookAddress:o.hookAddress},...o.quoteToken!==void 0&&{quoteToken:o.quoteToken}}}}async function v(e){let t=$(e.chainId),n=await g(e.chainId).sendTransaction({account:r,chain:t,to:e.to,data:e.data,value:BigInt(e.value),...e.gas!==null&&{gas:BigInt(e.gas)}});return{hash:n,status:(await l.waitForTransactionReceipt({hash:n,timeout:a,pollingInterval:o})).status===`success`?`confirmed`:`reverted`}}let y=Promise.resolve();async function b(e){let t=y,n=Q;y=new Promise(e=>{n=e}),await t;try{return await e()}finally{n()}}return{address:r.address,chainClient:l,async quote(e){let{config:t,venue:n,ref:a}=await _(e.mint,e.side);return X(l,t,a,{venue:n,side:e.side,amountIn:e.amountIn,slippageBps:e.slippageBps??i,buyer:r.address})},async trade(e){return b(async()=>{let{config:t,venue:n,ref:a}=await _(e.mint,e.side),o=await Z(l,t,a,{venue:n,side:e.side,amountIn:e.amountIn,slippageBps:e.slippageBps??i,owner:r.address,nowMs:Date.now()}),s=[];for(let e of o.txRequests){let t=await v(e);if(s.push(t.hash),t.status===`reverted`)return{quote:o.quote,venue:n,hashes:s,status:`reverted`}}return{quote:o.quote,venue:n,hashes:s,status:`confirmed`}})},async nativeBalance(){return l.getBalance({address:r.address})},async coinBalance(e){return l.readContract({address:e,abi:xe,functionName:`balanceOf`,args:[r.address]})}}}export{y as ProtocolError,L as applySlippageFloor,Z as buildCurveTrade,S as coinBondingCurve,C as coinCurveRelease,we as createTrader,f as curveConfigFrom,X as quoteCurveTrade,P as readCurveCoinState};
|
|
@@ -25,8 +25,15 @@ interface EvmCurveProtocolAddresses {
|
|
|
25
25
|
legacyLiquidityMigratorV4: string | null;
|
|
26
26
|
activeCurveRelease: CurveRelease;
|
|
27
27
|
legacyCurveRelease?: CurveRelease | null | undefined;
|
|
28
|
+
activeContractVersion?: string | undefined;
|
|
29
|
+
legacyContractVersion?: string | null | undefined;
|
|
30
|
+
curveMinViableTarget?: bigint | undefined;
|
|
31
|
+
legacyCurveMinViableTarget?: bigint | undefined;
|
|
32
|
+
quoteBandGuard?: string | null | undefined;
|
|
28
33
|
dedicatedV4PoolManager?: boolean | undefined;
|
|
29
34
|
passBurnerFactory?: string | undefined;
|
|
35
|
+
holderDistributorRegistry?: string | undefined;
|
|
36
|
+
holderDistributorImplementation?: string | undefined;
|
|
30
37
|
}
|
|
31
38
|
interface ChainFunding {
|
|
32
39
|
card?: boolean | undefined;
|
|
@@ -35,6 +42,13 @@ interface ChainFunding {
|
|
|
35
42
|
asset: string;
|
|
36
43
|
}
|
|
37
44
|
type LaunchLifecycleState = 'launched' | 'awaiting-dev-buy' | 'curve-trading' | 'dormant' | 'graduating' | 'graduated' | 'abandoned' | 'launch-failed';
|
|
45
|
+
interface QuoteAssetPoolKey {
|
|
46
|
+
currency0: string;
|
|
47
|
+
currency1: string;
|
|
48
|
+
fee: number;
|
|
49
|
+
tickSpacing: number;
|
|
50
|
+
hooks: string;
|
|
51
|
+
}
|
|
38
52
|
interface QuoteAssetListing {
|
|
39
53
|
address: string;
|
|
40
54
|
symbol: string;
|
|
@@ -53,6 +67,7 @@ interface QuoteAssetListing {
|
|
|
53
67
|
pegMaxAgeHours: number;
|
|
54
68
|
sortOrder: number;
|
|
55
69
|
raiseMenuEnabled: boolean;
|
|
70
|
+
zapRoute?: QuoteAssetPoolKey | null | undefined;
|
|
56
71
|
}
|
|
57
72
|
interface LaunchConfig {
|
|
58
73
|
evmLaunchChain: string | null;
|
|
@@ -84,6 +99,7 @@ interface LaunchConfig {
|
|
|
84
99
|
earlyBuyEnabled?: boolean | null | undefined;
|
|
85
100
|
curveCreatorFeesEnabled?: boolean | null | undefined;
|
|
86
101
|
burnCommitEnabled?: boolean | null | undefined;
|
|
102
|
+
holderShareEnabled?: boolean | null | undefined;
|
|
87
103
|
sniperTaxWindowSeconds?: number | null | undefined;
|
|
88
104
|
sellWindowEnabled?: boolean | null | undefined;
|
|
89
105
|
quoteAssets?: QuoteAssetListing[] | null | undefined;
|
|
@@ -94,6 +110,8 @@ interface LaunchConfig {
|
|
|
94
110
|
agentAccessEnabled: boolean;
|
|
95
111
|
worldEnabled?: boolean | undefined;
|
|
96
112
|
fundingEnabled?: boolean | undefined;
|
|
113
|
+
externalWalletsEnabled?: boolean | undefined;
|
|
114
|
+
compoundPotKeeperEnabled?: boolean | undefined;
|
|
97
115
|
}
|
|
98
116
|
interface CurveContracts {
|
|
99
117
|
chainId: number;
|
|
@@ -113,6 +131,8 @@ interface CurveContracts {
|
|
|
113
131
|
legacyLaunchpadHook: string | null;
|
|
114
132
|
activeCurveRelease: CurveRelease;
|
|
115
133
|
legacyCurveRelease?: CurveRelease | null | undefined;
|
|
134
|
+
activeContractVersion?: string | null | undefined;
|
|
135
|
+
legacyContractVersion?: string | null | undefined;
|
|
116
136
|
passBurnerFactory: string | null;
|
|
117
137
|
}
|
|
118
138
|
interface MomentumSignals {
|
|
@@ -134,6 +154,7 @@ interface LaunchProviderMeta {
|
|
|
134
154
|
compounding?: boolean | undefined;
|
|
135
155
|
compoundCommitBps?: number | undefined;
|
|
136
156
|
burnShareBps?: number | undefined;
|
|
157
|
+
holderShareBps?: number | undefined;
|
|
137
158
|
launchWindow?: {
|
|
138
159
|
feeBps: number;
|
|
139
160
|
decaySeconds: number;
|
|
@@ -194,6 +215,7 @@ interface LaunchBuildRequest {
|
|
|
194
215
|
compounding?: boolean | undefined;
|
|
195
216
|
compoundCommitBps?: number | undefined;
|
|
196
217
|
burnShareBps?: number | undefined;
|
|
218
|
+
holderShareBps?: number | undefined;
|
|
197
219
|
devBuyer?: string | undefined;
|
|
198
220
|
sniperExempt?: string[] | undefined;
|
|
199
221
|
website?: string | undefined;
|
|
@@ -220,6 +242,7 @@ interface AdVenuePulse {
|
|
|
220
242
|
}
|
|
221
243
|
type StallTier = 'recency' | 'momentum';
|
|
222
244
|
type TradeDirection = 'buy' | 'sell';
|
|
245
|
+
type SwapKind = 'trade' | 'burn';
|
|
223
246
|
type TradeVenue = 'curve' | 'dex';
|
|
224
247
|
type MetricWindow = 'm5' | 'h1' | 'h6' | 'h24';
|
|
225
248
|
interface CoinQuoteAssetRef {
|
|
@@ -286,6 +309,7 @@ interface CoinMetricsView {
|
|
|
286
309
|
graduation: GraduationView | null;
|
|
287
310
|
external: ExternalCoinStatsView | null;
|
|
288
311
|
computedAtMs: number | null;
|
|
312
|
+
quoteAsset?: CoinQuoteAssetRef | null | undefined;
|
|
289
313
|
generatedAt: string;
|
|
290
314
|
}
|
|
291
315
|
interface CoinHolderView {
|
|
@@ -293,6 +317,7 @@ interface CoinHolderView {
|
|
|
293
317
|
avatarUrl?: string | null | undefined;
|
|
294
318
|
isKol?: boolean | undefined;
|
|
295
319
|
isVerified?: boolean | undefined;
|
|
320
|
+
isRegistered?: boolean | undefined;
|
|
296
321
|
wallet: string;
|
|
297
322
|
balance: string;
|
|
298
323
|
pct: number;
|
|
@@ -346,11 +371,13 @@ interface CoinTradeView {
|
|
|
346
371
|
isKol?: boolean | undefined;
|
|
347
372
|
isVerified?: boolean | undefined;
|
|
348
373
|
avatarUrl?: string | null | undefined;
|
|
374
|
+
isRegistered?: boolean | undefined;
|
|
349
375
|
wallet: string;
|
|
350
376
|
amountNative: string;
|
|
351
377
|
tokenAmount: string;
|
|
352
378
|
price: number;
|
|
353
379
|
venue: TradeVenue;
|
|
380
|
+
kind?: SwapKind | undefined;
|
|
354
381
|
}
|
|
355
382
|
interface CoinTradesView {
|
|
356
383
|
mint: string;
|
|
@@ -433,7 +460,9 @@ interface Profile {
|
|
|
433
460
|
avatarKey: string | null;
|
|
434
461
|
avatarUrl: string | null;
|
|
435
462
|
twitterHandle: string | null;
|
|
463
|
+
isVerified?: boolean | undefined;
|
|
436
464
|
telegramHandle: string | null;
|
|
465
|
+
isTelegramVerified?: boolean | undefined;
|
|
437
466
|
bio: string | null;
|
|
438
467
|
showsStats: boolean;
|
|
439
468
|
isKol: boolean;
|
|
@@ -456,6 +485,7 @@ interface UsernameAvailability {
|
|
|
456
485
|
}
|
|
457
486
|
interface WalletChallengeRequest {
|
|
458
487
|
namespace?: AddressNamespace | undefined;
|
|
488
|
+
publicKey?: string | undefined;
|
|
459
489
|
}
|
|
460
490
|
interface WalletChallenge {
|
|
461
491
|
message: string;
|
|
@@ -489,6 +519,7 @@ interface WatchlistEntryView {
|
|
|
489
519
|
curveProgressPct: number;
|
|
490
520
|
holders: number;
|
|
491
521
|
nativeDecimals: number;
|
|
522
|
+
quoteAsset?: CoinQuoteAssetRef | null | undefined;
|
|
492
523
|
}
|
|
493
524
|
interface WatchlistView {
|
|
494
525
|
entries: WatchlistEntryView[];
|
|
@@ -513,7 +544,7 @@ type CoinListSort = 'new' | 'rank' | 'trending' | 'fdv' | 'volume' | 'change' |
|
|
|
513
544
|
type CoinListDirection = 'asc' | 'desc';
|
|
514
545
|
declare const COIN_LINKS_FILTER_VALUES: readonly ["any", "website", "twitter", "telegram", "discord"];
|
|
515
546
|
type CoinLinksFilter = (typeof COIN_LINKS_FILTER_VALUES)[number];
|
|
516
|
-
declare const COIN_MECHANICS_FILTER_VALUES: readonly ["
|
|
547
|
+
declare const COIN_MECHANICS_FILTER_VALUES: readonly ["feeBurn", "compounding", "holders", "earlyBuyFee", "flipperFee", "buyWindow", "none"];
|
|
517
548
|
type CoinMechanicsFilter = (typeof COIN_MECHANICS_FILTER_VALUES)[number];
|
|
518
549
|
interface CoinListQuery {
|
|
519
550
|
sort?: CoinListSort | undefined;
|
|
@@ -557,6 +588,7 @@ interface CoinListQuery {
|
|
|
557
588
|
links?: CoinLinksFilter[] | undefined;
|
|
558
589
|
mechanics?: CoinMechanicsFilter[] | undefined;
|
|
559
590
|
poolFees?: number[] | undefined;
|
|
591
|
+
quotes?: string[] | undefined;
|
|
560
592
|
graveyard?: boolean | undefined;
|
|
561
593
|
mapPlaced?: boolean | undefined;
|
|
562
594
|
limit?: number | undefined;
|
|
@@ -568,6 +600,7 @@ interface CoinFeeBurn {
|
|
|
568
600
|
ethBurnedWei: string;
|
|
569
601
|
tokensBurned: string;
|
|
570
602
|
burnCount: number;
|
|
603
|
+
holderShareBps?: number | undefined;
|
|
571
604
|
}
|
|
572
605
|
interface CoinListItem {
|
|
573
606
|
id: string;
|
|
@@ -590,6 +623,7 @@ interface CoinListItem {
|
|
|
590
623
|
compounding?: boolean | undefined;
|
|
591
624
|
compoundCommitBps?: number | undefined;
|
|
592
625
|
burnShareBps?: number | undefined;
|
|
626
|
+
holderShareBps?: number | undefined;
|
|
593
627
|
launchWindow?: {
|
|
594
628
|
feeBps: number;
|
|
595
629
|
decaySeconds: number;
|
|
@@ -671,6 +705,7 @@ interface WalletPnlView {
|
|
|
671
705
|
interface ActivityTradeView extends CoinTradeView {
|
|
672
706
|
mint: string;
|
|
673
707
|
chain: string;
|
|
708
|
+
quoteAsset?: CoinQuoteAssetRef | null | undefined;
|
|
674
709
|
}
|
|
675
710
|
interface WalletTradesView {
|
|
676
711
|
wallet: string;
|
|
@@ -716,6 +751,7 @@ interface CoinTraderView {
|
|
|
716
751
|
}
|
|
717
752
|
interface CoinTradersList {
|
|
718
753
|
mint: string;
|
|
754
|
+
quoteAsset?: CoinQuoteAssetRef | null | undefined;
|
|
719
755
|
traders: CoinTraderView[];
|
|
720
756
|
nextCursor: string | null;
|
|
721
757
|
generatedAt: string;
|
package/dist/public.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as TradeSide, A as CreatorStatsView, B as LaunchSort, C as CoinTraderDirection, Ct as WorldPlayerSearch, D as CoinTradersQuery, E as CoinTradersList, Et as AddressNamespace, F as LaunchBuildRequest, G as NativeUsdRates, H as MetricWindow, I as LaunchConfig, J as ProfileUpdateRequest, K as PoolFeeView, L as LaunchConfirmRequest, M as EvmTxRequest, N as GraduationView, O as CoinTradesView, P as Health, Q as TradeQuote, R as LaunchLifecycleState, S as CoinTradeView, St as WorldMapPlayers, T as CoinTraderView, Tt as WorldProp, U as MomentumSignals, V as MediaUpload, W as NativeUsdRate, X as SentimentVote, Y as RingTier, Z as StallTier, _ as CoinListQuery, _t as WalletUnlinkRequest, a as CandleSeries, at as WalletHoldingsView, b as CoinMetricsWindows, bt as WatchlistView, c as CandleView, ct as WalletPnlCurvePoint, d as CoinHiddenMarker, dt as WalletStatsCoinRef, et as UsernameAvailability, f as CoinHolderView, ft as WalletTradesQuery, g as CoinListItem, gt as WalletUnlink, h as CoinListDirection, ht as WalletTradingWindowStats, i as AdVenuePulse, it as WalletHoldingView, j as CurveContracts, k as CreatorBestLaunch, kt as NativeCurrency, l as CoinBurnsView, lt as WalletPnlCurveView, m as CoinList, mt as WalletTradingStatsView, n as ActivityQuery, nt as WalletChallengeRequest, o as CandleTimeframe, ot as WalletLink, p as CoinHoldersView, pt as WalletTradesView, q as Profile, r as ActivityTradeView, rt as WalletCoinPnlView, s as CandleTimeframeRequest, st as WalletModeration, t as ActivityFeedView, tt as WalletChallenge, u as CoinDetailsEditRequest, ut as WalletPnlView, v as CoinListSort, vt as WatchlistEntryView, w as CoinTraderSort, wt as WorldPlayerSearchResult, x as CoinSentimentView, xt as WindowMetrics, y as CoinMetricsView, yt as WatchlistToggleView, z as LaunchProviderMeta } from "./index-
|
|
1
|
+
import { $ as TradeSide, A as CreatorStatsView, B as LaunchSort, C as CoinTraderDirection, Ct as WorldPlayerSearch, D as CoinTradersQuery, E as CoinTradersList, Et as AddressNamespace, F as LaunchBuildRequest, G as NativeUsdRates, H as MetricWindow, I as LaunchConfig, J as ProfileUpdateRequest, K as PoolFeeView, L as LaunchConfirmRequest, M as EvmTxRequest, N as GraduationView, O as CoinTradesView, P as Health, Q as TradeQuote, R as LaunchLifecycleState, S as CoinTradeView, St as WorldMapPlayers, T as CoinTraderView, Tt as WorldProp, U as MomentumSignals, V as MediaUpload, W as NativeUsdRate, X as SentimentVote, Y as RingTier, Z as StallTier, _ as CoinListQuery, _t as WalletUnlinkRequest, a as CandleSeries, at as WalletHoldingsView, b as CoinMetricsWindows, bt as WatchlistView, c as CandleView, ct as WalletPnlCurvePoint, d as CoinHiddenMarker, dt as WalletStatsCoinRef, et as UsernameAvailability, f as CoinHolderView, ft as WalletTradesQuery, g as CoinListItem, gt as WalletUnlink, h as CoinListDirection, ht as WalletTradingWindowStats, i as AdVenuePulse, it as WalletHoldingView, j as CurveContracts, k as CreatorBestLaunch, kt as NativeCurrency, l as CoinBurnsView, lt as WalletPnlCurveView, m as CoinList, mt as WalletTradingStatsView, n as ActivityQuery, nt as WalletChallengeRequest, o as CandleTimeframe, ot as WalletLink, p as CoinHoldersView, pt as WalletTradesView, q as Profile, r as ActivityTradeView, rt as WalletCoinPnlView, s as CandleTimeframeRequest, st as WalletModeration, t as ActivityFeedView, tt as WalletChallenge, u as CoinDetailsEditRequest, ut as WalletPnlView, v as CoinListSort, vt as WatchlistEntryView, w as CoinTraderSort, wt as WorldPlayerSearchResult, x as CoinSentimentView, xt as WindowMetrics, y as CoinMetricsView, yt as WatchlistToggleView, z as LaunchProviderMeta } from "./index-C23bmaL-.mjs";
|
|
2
2
|
import "zod";
|
|
3
3
|
/**
|
|
4
4
|
* Thrown on HTTP 429 so a caller can DISTINGUISH throttling from other failures and resume on the server's schedule
|
|
@@ -412,16 +412,22 @@ export interface PlatformClient {
|
|
|
412
412
|
* are absent; find them through `listCoins`. */
|
|
413
413
|
getPlacements(): Promise<MapPlacementsSnapshot>;
|
|
414
414
|
/**
|
|
415
|
-
* The gas-token/USD rates the PLATFORM is using - one per native symbol the deployment serves. Convert
|
|
416
|
-
*
|
|
417
|
-
* against the rows on the same screen. A null `priceUsd` means the platform itself has no
|
|
418
|
-
* rather than substituting a zero.
|
|
415
|
+
* The gas-token/USD rates the PLATFORM is using - one per native symbol the deployment serves. Convert NATIVE
|
|
416
|
+
* figures with these and no other oracle: a native coin's USD fields were computed from exactly this rate, so
|
|
417
|
+
* another source drifts against the rows on the same screen. A null `priceUsd` means the platform itself has no
|
|
418
|
+
* fresh rate - hide USD rather than substituting a zero.
|
|
419
|
+
*
|
|
420
|
+
* These rates do NOT apply to a coin raised in a quote asset (its `quoteAsset` is set): that coin's figures are in
|
|
421
|
+
* the quote asset's units and convert at `quoteAsset.unitPriceUsd`, never at the gas token's rate.
|
|
419
422
|
*/
|
|
420
423
|
getNativeUsdRates(): Promise<NativeUsdRates>;
|
|
421
|
-
/** Every launchpad coin a wallet holds (balance > 0),
|
|
424
|
+
/** Every launchpad coin a wallet holds (balance > 0), largest worth first. Public by wallet - it is all on-chain.
|
|
425
|
+
* Each row's `valueNative` is in ITS coin's quote asset (`quoteAsset`; null = native): convert each row before
|
|
426
|
+
* summing a portfolio. */
|
|
422
427
|
getWalletHoldings(wallet: string): Promise<WalletHoldingsView>;
|
|
423
428
|
/** A wallet's realized and unrealized PnL across every coin it has ever traded, held and exited alike.
|
|
424
|
-
* `totalPnlPct` is null when nothing was spent - a zero basis has no percent.
|
|
429
|
+
* `totalPnlPct` is null when nothing was spent - a zero basis has no percent. Each coin's figures are in ITS
|
|
430
|
+
* quote asset (`quoteAsset`; null = native), so a total across coins converts each row first. */
|
|
425
431
|
getWalletPnl(wallet: string): Promise<WalletPnlView>;
|
|
426
432
|
/** Every trade a wallet has made, newest first. `mint` narrows to one coin; page with the last row's `timeMs` as
|
|
427
433
|
* `before`. */
|
|
@@ -532,7 +538,8 @@ export interface PlatformClient {
|
|
|
532
538
|
* verifier owns that. Requires the caller to own the launch. */
|
|
533
539
|
confirmLaunch(mint: string, request: LaunchConfirmRequest): Promise<LaunchRecord>;
|
|
534
540
|
/** Start linking a wallet to the caller's session: returns the exact single-use, short-lived challenge message the
|
|
535
|
-
* wallet must sign.
|
|
541
|
+
* wallet must sign. Pass `publicKey` (the address that will sign) to get an EIP-4361 Sign-In with Ethereum
|
|
542
|
+
* message bound to the site and that address. Requires a live session - the API answers 401 otherwise. */
|
|
536
543
|
walletChallenge(request?: WalletChallengeRequest): Promise<WalletChallenge>;
|
|
537
544
|
/** Complete the link with the wallet's address and its EIP-191 `personal_sign` signature over the challenge. */
|
|
538
545
|
walletLink(request: WalletLinkRequest): Promise<WalletLink>;
|
package/dist/public.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"zod";const t=[`sort`,`window`,`dir`,`q`,`chain`,`world`,`creator`,`cursor`],n=[`minFdv`,`maxFdv`,`minVolume`,`maxVolume`,`minFdvUsd`,`maxFdvUsd`,`minHolders`,`maxHolders`,`minTrades`,`maxTrades`,`minTraders`,`maxTraders`,`minProgressPct`,`maxProgressPct`,`minTop10HolderPct`,`maxTop10HolderPct`,`minChangePct`,`maxChangePct`,`minAgeMinutes`,`maxAgeMinutes`,`minBurned`,`maxBurned`],r=[`burn`,`devSold`,`devSoldAll`,`graveyard`,`mapPlaced`],i=[`states`,`keywords`,`excludeKeywords`,`links`];function a(e,t){return Math.min(t,Math.max(1,Math.trunc(e)))}function o(e,t,n,r){for(let i of n){let n=t[i];n!==void 0&&e.set(i,r(n))}}function s(e){let s=new URLSearchParams;return o(s,e,t,e=>e),o(s,e,n,String),o(s,e,r,e=>e?`true`:`false`),o(s,e,i,e=>e.join(`,`)),e.limit!==void 0&&Number.isFinite(e.limit)&&s.set(`limit`,String(a(e.limit,100))),s}function c(e){let t=new URLSearchParams;return e.limit!==void 0&&Number.isFinite(e.limit)&&t.set(`limit`,String(a(e.limit,100))),e.before!==void 0&&Number.isFinite(e.before)&&t.set(`before`,String(e.before)),t}function ee(e){let t=c(e);return e.mint!==void 0&&t.set(`mint`,e.mint),t}function te(e){let t=c(e);return e.chain!==void 0&&t.set(`chain`,e.chain),t}function ne(e){let t=new URLSearchParams;return e.sort!==void 0&&t.set(`sort`,e.sort),e.dir!==void 0&&t.set(`dir`,e.dir),e.limit!==void 0&&Number.isFinite(e.limit)&&t.set(`limit`,String(a(e.limit,100))),e.cursor!==void 0&&t.set(`cursor`,e.cursor),t}function l(e,t){let n=t.toString();return n?`${e}?${n}`:e}const u={health:`/health`,coins:`/launchpad/coins`,launches:`/launchpad/launches`,config:`/launchpad/config`,placements:`/launchpad/placements`,bazaar:`/launchpad/bazaar`,ring:`/launchpad/ring`,rates:`/launchpad/rates`,activity:`/launchpad/activity`,wallets:`/launchpad/wallets`,watchlist:`/launchpad/watchlist`,launchBuild:`/launchpad/launch/build`,walletChallenge:`/wallet/challenge`,walletLink:`/wallet/link`,walletUnlink:`/wallet/unlink`,walletModeration:`/wallet/moderation`,profile:`/profile`,profileMe:`/profile/me`,profileHandleCheck:`/profile/handle-check`,garageAsset:`/garage/asset`,media:`/media`,worldProps:`/world/props`,worldPlayers:`/world/players`,worldPlayerSearch:`/world/players/search`,worldAdBoards:`/world/ad-boards`,adsPulse:`/ads/pulse`},d=e.iso.datetime(),f=e.number().int().nonnegative(),p=f,m=e.string().regex(/^\d+$/,`must be a non-negative integer string`),h=e.string().regex(/^0x[0-9a-fA-F]{40}$/,`must be a 0x address`),g=e.string().min(1),_=e.number().min(0).max(100),v=e.enum([`launched`,`awaiting-dev-buy`,`curve-trading`,`dormant`,`graduating`,`graduated`,`abandoned`,`launch-failed`]),y=e.object({feeBps:e.number().int().min(0).max(1e4),decaySeconds:f}),b=e.enum([`v3`,`v4`]),re=e.object({curveAddress:g.nullable(),graduatedPoolAddress:g.nullable(),curveKind:b.optional(),curveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).optional(),hookAddress:g.nullable().optional(),quoteToken:g.nullable().optional(),quoteDecimals:e.number().int().min(0).max(255).optional(),graduatedPoolId:e.string().regex(/^0x[0-9a-fA-F]{64}$/,`must be a bytes32 hex string`).nullable().optional(),poolFeeBps:e.number().int().min(0).max(1e4).optional(),earlyBuyFeeBps:e.number().int().min(0).max(1e4).optional(),compounding:e.boolean().optional(),compoundCommitBps:e.number().int().min(0).max(1e4).optional(),burnShareBps:e.number().int().min(0).max(1e4).optional(),creatorCurveFees:e.boolean().optional(),launchWindow:y.nullable().optional(),buyWindow:y.nullable().optional()}),ie=e.object({momentum:e.number().nonnegative(),uniqueBuyers:f,buyVolumeWei:m,windowMs:e.number().int().positive(),computedAt:d}),x=e.object({at:d,reason:e.string().nullable()}),S=e.enum([`recency`,`momentum`]),ae=e.enum([`recency`,`performance`]),oe=e.object({status:e.literal(`ok`)}),se=e.object({message:g}),ce=e.object({wallet:g}),le=e.object({unlinked:e.boolean()}),ue=e.object({banned:e.boolean(),muted:e.boolean()}),C=e.object({wallet:g,username:g.nullable(),avatarKey:e.string().regex(/^[0-9a-f]{64}$/,`must be a sha256 content-address`).nullable(),avatarUrl:g.nullable(),twitterHandle:g.nullable(),telegramHandle:g.nullable(),bio:e.string().nullable(),showsStats:e.boolean(),isKol:e.boolean(),isRegistered:e.boolean().optional(),createdAt:d,updatedAt:d}),de=e.object({handle:g,available:e.boolean(),reason:e.enum([`invalid`,`reserved`,`taken`]).nullable()}),w=e.object({key:e.string().regex(/^[0-9a-f]{64}$/,`must be a sha256 content-address`),kind:e.enum([`image`,`video`]),status:e.enum([`pending`,`processing`,`ready`,`failed`]),url:g.nullable(),posterUrl:g.nullable(),thumbUrl:g.nullable(),thumbMotionUrl:g.nullable(),width:e.number().int().positive().nullable(),height:e.number().int().positive().nullable(),durationMs:f.nullable(),failureReason:g.nullable()}),fe=e.enum([`buy`,`sell`]),T=e.enum([`curve`,`dex`]),E=e.object({id:g,timeMs:p,blockRef:f,direction:fe,username:g,wallet:g,amountNative:m,tokenAmount:m,price:e.number().nonnegative(),venue:T,isKol:e.boolean().optional(),isVerified:e.boolean().optional(),avatarUrl:e.string().nullable().optional()}),pe=e.object({mint:g,trades:e.array(E),generatedAt:d}),me=e.object({id:g,timeMs:p.nullable(),blockRef:f,txHash:g,caller:g,username:g,isKol:e.boolean().optional(),isVerified:e.boolean().optional(),avatarUrl:e.string().nullable().optional(),amountNative:m,tokenAmount:m,bountyNative:m}),he=e.object({tokenAmount:m,txHash:g,timeMs:p.nullable(),blockRef:f,isExact:e.boolean()}),ge=e.object({mint:g,burns:e.array(me),graduationBurn:he.nullable().optional(),generatedAt:d}),D=E.extend({mint:g,chain:g}),_e=e.object({trades:e.array(D),windowStartMs:p,generatedAt:d}),ve=e.object({wallet:g,trades:e.array(D),generatedAt:d}),ye=e.object({username:g,wallet:g,buyCount:f,sellCount:f,spentNative:m,receivedNative:m,volumeNative:m,realizedPnlNative:e.number(),tokensBought:m,tokensSold:m,firstTradeAtMs:p,lastTradeAtMs:p}),O=e.object({mint:g,traders:e.array(ye),nextCursor:e.string().nullable(),generatedAt:d}),k=e.object({buys:f,sells:f,buyVolume:m,sellVolume:m,buyers:f,sellers:f,priceChangePct:e.number().nullable()}),A=e.object({m5:k,h1:k,h6:k,h24:k}),j=e.object({mint:h,chain:g,pool:h,txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/,`must be a 0x tx hash`),blockNumber:f,blockTimeMs:p,caller:h,ethMigrated:m,migrationFee:m,liquidity:m,feeTierBps:f,closingPriceNative:e.number().nonnegative().nullable()}),M=e.object({source:g,priceNative:e.number().nonnegative().nullable(),priceUsd:e.number().nonnegative().nullable(),fdvUsd:e.number().nonnegative().nullable(),volume24hUsd:e.number().nonnegative().nullable(),priceChange24hPct:e.number().nullable(),holders:f.nullable(),fetchedAtMs:p}),N=e.object({mint:g,chain:g,priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),curveProgressPct:_,feesTotal:m,creatorFeesNative:m,creatorFeesToken:m,holders:f,top10HolderPct:_.nullable(),watcherCount:f,creatorHoldingPct:_.nullable(),creatorSold:e.boolean(),athPriceNative:e.number().nonnegative(),athAtMs:p.nullable(),lastTradeAtMs:p.nullable(),lastTradeDirection:e.enum([`buy`,`sell`]).nullable().default(null),windows:A,graduation:j.nullable(),external:M.nullable(),computedAtMs:p.nullable(),generatedAt:d}),P=e.object({username:g,avatarUrl:e.string().nullable().optional(),isKol:e.boolean().optional(),isVerified:e.boolean().optional(),wallet:g,balance:m,pct:_}),be=e.object({wallet:g,kind:e.enum([`curve`,`pool`,`burn`]),balance:m,pct:_}),xe=e.object({mint:g,holderCount:f,holders:e.array(P),venues:e.array(be),nextCursor:e.string().nullable(),generatedAt:d}),F=e.object({mint:g,rocket:f,shit:f,myVote:e.enum([`rocket`,`shit`]).nullable(),canVote:e.boolean(),minBuyUsd:e.number().nonnegative(),generatedAt:d}),Se=e.object({mint:g,curveKind:b,baseFeeBps:e.number().int().nonnegative().max(1e4).nullable(),generatedAt:d}),Ce=e.enum([`1m`,`1h`,`4h`,`1d`]),we=e.object({bucketStartMs:p,open:e.number().nonnegative(),high:e.number().nonnegative(),low:e.number().nonnegative(),close:e.number().nonnegative(),volumeWei:m,tradeCount:f,venue:T}),Te=e.object({mint:g,timeframe:Ce,candles:e.array(we),generatedAt:d,changePercent:e.number().nullable(),linkOutUrl:e.string().nullable(),coverageThroughMs:e.number().nullable()}),Ee=e.object({m5:e.number().nullable(),h1:e.number().nullable(),h6:e.number().nullable(),h24:e.number().nullable()}),I=e.object({address:g,symbol:g,name:g,decimals:e.number().int().min(0).max(255),thumbUrl:e.string().nullable(),unitPriceUsd:e.number().nonnegative().nullable().optional()}),De=e.object({id:e.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`must be a ULID`),mint:g,chain:g,ticker:e.string(),name:e.string(),metadataUri:e.string(),creatorWallet:g,lifecycleState:v,createdAtMs:p,graduatedAtMs:p.nullable(),feeBurn:e.object({shareBps:e.number().int().min(0).max(1e4),active:e.boolean(),ethBurnedWei:m,tokensBurned:m,burnCount:e.number().int().nonnegative()}).nullable().optional(),bondingTarget:m,poolFeeBps:e.number().int().min(0).max(1e4).optional(),earlyBuyFeeBps:e.number().int().min(0).max(1e4).optional(),quoteToken:g.nullable().optional(),quoteAsset:I.nullable().optional(),curveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).optional(),compounding:e.boolean().optional(),compoundCommitBps:e.number().int().optional(),burnShareBps:e.number().int().optional(),launchWindow:e.object({feeBps:e.number().int().positive(),decaySeconds:e.number().int().positive()}).nullable().optional(),buyWindow:e.object({feeBps:e.number().int().positive(),decaySeconds:e.number().int().positive()}).nullable().optional(),priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),curveProgressPct:_,volume24h:m,buyVolume24h:m,sellVolume24h:m,changePct:Ee,trades24h:f,traders24h:f,holders:f,creatorSold:e.boolean(),creatorHoldingPct:_.nullable(),top10HolderPct:_.nullable(),athPriceNative:e.number().nonnegative(),lastTradeAtMs:p.nullable(),lastTradeDirection:e.enum([`buy`,`sell`]).nullable().default(null),momentum:e.number().nonnegative(),priceUsd:e.number().nonnegative().nullable(),fdvUsd:e.number().nonnegative().nullable(),volumeUsd:e.string().regex(/^\d+(?:\.\d+)?$/,`must be a non-negative decimal string`).nullable(),nativeUsdPrice:e.number().nonnegative().nullable(),nativeUsdAtMs:p.nullable(),mapRank:e.number().int().positive().nullable(),graveyard:e.boolean(),computedAtMs:p.nullable()}),Oe=e.object({coins:e.array(De),nextCursor:e.string().nullable(),generatedAt:d}),ke=e.object({symbol:g,priceUsd:e.number().positive().nullable(),feedUpdatedAtMs:p.nullable(),stalenessBoundMs:e.number().int().positive().nullable(),sourceNetwork:g.nullable()}),Ae=e.object({rates:e.array(ke),generatedAt:d}),je=e.object({mint:g,chain:g,ticker:e.string(),name:e.string(),metadataUri:e.string(),lifecycleState:g,balance:m,tokens:e.number().nonnegative(),priceNative:e.number().nonnegative(),valueNative:e.number().nonnegative(),valuation:e.enum([`exit`,`mark`]),quoteAsset:I.nullable().optional()}),Me=e.object({wallet:g,holdings:e.array(je),generatedAt:d}),Ne=e.object({mint:g,chain:g,ticker:e.string(),name:e.string(),lifecycleState:v,spentNative:m,receivedNative:m,tokensBought:m,tokensSold:m,balance:m,priceNative:e.number().nonnegative(),currentValueNative:e.number().nonnegative(),valuation:e.enum([`exit`,`mark`]),costBasisNative:e.number().nonnegative(),realizedPnlNative:e.number(),unrealizedPnlNative:e.number(),totalPnlNative:e.number(),totalPnlPct:e.number().nullable(),firstTradeAtMs:p,lastTradeAtMs:p,quoteAsset:I.nullable().optional()}),Pe=e.object({wallet:g,coins:e.array(Ne),generatedAt:d}),L=e.object({trades:f,buys:f,sells:f,buyVolumeNative:m,sellVolumeNative:m,volumeNative:m,feesNative:m,avgTradeNative:e.number().nonnegative().nullable(),largestTradeNative:e.number().nonnegative()}),R=e.object({mint:g,ticker:e.string(),name:e.string(),metadataUri:e.string().nullable(),realizedPnlNative:e.number()}),Fe=e.object({wallet:g,coinsTraded:f,coinsWithSells:f,winningCoins:f,winRatePct:e.number().nonnegative().nullable(),realizedPnlNative:e.number(),unrealizedPnlNative:e.number(),totalPnlNative:e.number(),spentNative:m,receivedNative:m,roiPct:e.number().nullable(),grossWinsNative:e.number().nonnegative(),grossLossesNative:e.number().nonnegative(),profitFactor:e.number().nonnegative().nullable(),avgWinNative:e.number().nonnegative().nullable(),avgLossNative:e.number().nonnegative().nullable(),bestCoin:R.nullable(),worstCoin:R.nullable(),avgHoldTimeMs:e.number().nonnegative().nullable(),graduationsBacked:f,tradingSinceMs:p.nullable(),mostActiveDay:e.object({date:g,trades:e.number().int().positive()}).nullable(),windows:e.object({"24h":L,"7d":L,"30d":L,all:L}),generatedAt:d}),Ie=e.object({t:p,realizedPnlNative:e.number()}),Le=e.object({wallet:g,points:e.array(Ie),tradeCount:f,complete:e.boolean(),baselineRealizedNative:e.number(),generatedAt:d}),Re=e.object({mint:g,ticker:e.string(),name:e.string(),metadataUri:e.string().nullable(),athFdvNative:e.number().nonnegative()}),ze=e.object({wallet:g,coinsCreated:f,coinsGraduated:f,coinsInBonding:f,coinsFailed:f,graduationRatePct:e.number().nonnegative().nullable(),creatorFeesNative:m,creatorFeesToken:m,combinedFdvNative:e.number().nonnegative(),bestLaunch:Re.nullable(),volumeNative:m,uniqueTraders:f,totalHolders:f,coinsCreatorStillHolding:f,handoffsGiven:f,handoffsReceived:f,generatedAt:d}),Be=e.object({mint:g,chain:g,ticker:g,name:g,metadataUri:e.string().nullable(),lifecycleState:v,watchedAtMs:p,priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),fdvUsd:e.number().nonnegative().nullable(),volume24h:m,changePct:e.object({m5:e.number().nullable(),h1:e.number().nullable(),h6:e.number().nullable(),h24:e.number().nullable()}),curveProgressPct:_,holders:f,nativeDecimals:f}),Ve=e.object({entries:e.array(Be),generatedAt:d}),z=e.object({mint:g,watching:e.boolean(),watcherCount:f}),B=e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a kebab-case chain profile id`),He=e.number().int().min(1).max(1e4),Ue=e.object({chainId:e.number().int().positive(),publicRpcUrl:g.nullable().optional(),explorer:e.object({addressUrlTemplate:g,txUrlTemplate:g}).nullable().optional(),bondingCurveV4:g.nullable(),v4Quoter:g.nullable(),stateView:g.nullable(),universalRouter:g.nullable(),permit2:g.nullable(),positionManager:g.nullable().optional(),launchpadHook:g.nullable(),legacyBondingCurveV4:g.nullable(),legacyLaunchpadHook:g.nullable(),activeCurveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]),legacyCurveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).nullable().optional(),passBurnerFactory:g.nullable()}),We=e.object({address:g,symbol:g,name:g,decimals:e.number().int().min(0).max(36),description:e.string().nullable(),imageUrl:e.string().nullable(),thumbUrl:e.string().nullable(),minTarget:m,maxTarget:m,minTargetUsd:e.number().nullable(),maxTargetUsd:e.number().nullable(),defaultTarget:m.nullable(),unitPriceUsd:e.number().nullable(),priceUpdatedAt:d.nullable(),pegMaxAgeHours:e.number().int().min(1).max(72),sortOrder:e.number().int(),raiseMenuEnabled:e.boolean()}),V=e.number().positive(),Ge=e.object({usd:e.tuple([V,V,V,V,V]),defaultIndex:e.number().int().min(0).max(4)}),Ke=e.object({card:e.boolean().optional(),bank:e.boolean().optional(),deposit:e.boolean().optional(),asset:g}),qe=e.object({evmLaunchChain:B.nullable(),enabledChains:e.array(B).nonempty(),creatorFeeShareBps:e.number().int().min(0).max(1e4).nullable(),landFeeShareBps:e.number().int().min(0).max(1e4).nullable(),compounding:e.object({creatorShareBps:e.number().int().min(0).max(1e4),compoundShareBps:e.number().int().min(0).max(1e4).optional(),mandatory:e.boolean().optional(),commitMenu:e.array(He).optional(),mandatoryCommitBps:e.number().int().min(0).max(1e4).optional()}).nullable(),launchFeeWei:m.nullable(),tradeFeeBps:e.number().int().min(0).max(1e4).nullable(),migrationFeeBps:e.number().int().min(0).max(1e4).nullable(),ctoFeeWei:m.nullable(),launchWindow:y.nullable().optional(),buyWindow:y.nullable().optional(),graduationSurchargeEnabled:e.boolean().nullable().optional(),earlyBuyEnabled:e.boolean().nullable().optional(),sellWindowEnabled:e.boolean().nullable().optional(),curveCreatorFeesEnabled:e.boolean().nullable().optional(),burnCommitEnabled:e.boolean().nullable().optional(),sniperTaxWindowSeconds:e.number().int().min(0).nullable().optional(),quoteAssets:e.array(We).nullable().optional(),raiseLadder:Ge.nullable().optional(),curveContracts:Ue.nullable().optional(),termsVersion:g,agentAccessEnabled:e.boolean(),worldEnabled:e.boolean().optional(),funding:Ke.optional(),fundingEnabled:e.boolean().optional()}),Je=e.object({from:h,to:h,data:e.string().regex(/^0x(?:[0-9a-fA-F]{2})*$/,`must be 0x hex bytes`),value:m,chainId:e.number().int().positive(),gas:m.nullable()}),Ye=e.object({id:e.uuid(),worldId:g,model:g,x:e.number(),z:e.number(),y:e.number().nullable(),yaw:e.number(),scale:e.number().positive(),updatedAtMs:p}),Xe=e.tuple([e.number(),e.number()]),Ze=e.object({players:e.array(Xe),total:f}),Qe=e.object({peerId:e.string().nullable(),name:e.string(),wallet:g.nullable(),username:e.string().nullable(),online:e.boolean()}),$e=e.object({players:e.array(Qe)}),et=e.object({volume24hWei:m,volume24hUsd:e.number().nullable(),trades24h:f,activeTraders24h:f,playersOnline:f,boardsActive:f,boardsOccupied:f,generatedAt:d});var H=class extends Error{retryAfterMs;limit;remaining;resetAt;constructor(e,t){super(e),this.name=`RateLimitError`,this.retryAfterMs=t.retryAfterMs,this.limit=t.limit,this.remaining=t.remaining,this.resetAt=t.resetAt}},U=class extends Error{status;apiError;details;constructor(e,t){super(e),this.name=`ApiError`,this.status=t.status,this.apiError=t.apiError,this.details=t.details}};async function tt(e){try{let t=await e.json();if(typeof t==`object`&&t)return{apiError:`error`in t&&typeof t.error==`string`?t.error:void 0,details:nt(t)}}catch{}return{apiError:void 0,details:void 0}}function nt(e){if(!(`details`in e)||!Array.isArray(e.details))return;let t=e.details.filter(e=>typeof e==`object`&&!!e&&`field`in e&&typeof e.field==`string`&&`reason`in e&&typeof e.reason==`string`);return t.length>0?t:void 0}function W(e,t){let n=e.headers.get(t);if(n===null||n.trim()===``)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function rt(e){let t=e.headers.get(`retry-after`);if(t===null||t.trim()===``)return;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n*1e3);let r=Date.parse(t);return Number.isNaN(r)?void 0:Math.max(0,r-Date.now())}function it(e){let t=e.fetch??fetch,n=e.baseUrl.replace(/\/+$/,``),r=e.headers??{};async function i(e,t,n){if(n.status===429){let e=W(n,`x-ratelimit-reset`);return new H(`API rate limit exceeded (${t})`,{retryAfterMs:rt(n)??0,limit:W(n,`x-ratelimit-limit`),remaining:W(n,`x-ratelimit-remaining`),resetAt:e===void 0?void 0:Date.now()+e*1e3})}return new U(`API request failed: ${n.status} ${n.statusText} (${e} ${t})`,{status:n.status,...await tt(n)})}return{async request(e,a,o){let s=await t(`${n}${a}`,{method:e,credentials:`include`,headers:{...r,...o!==void 0&&{"content-type":`application/json`}},...o!==void 0&&{body:JSON.stringify(o)}});if(!s.ok)throw await i(e,a,s);if(s.status!==204)return await s.json()},async requestRaw(e,a,o){let s=await t(`${n}${e}`,{method:`POST`,credentials:`include`,headers:{...r,"content-type":o},body:a});if(!s.ok)throw await i(`POST`,e,s);return await s.json()}}}const at=e.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`must be a ULID`),ot=e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a kebab-case chain profile id`),G=e.string().min(1),K=e.iso.datetime(),q=e.number().int().nonnegative(),J=q,Y=e.string().regex(/^\d+$/,`must be a non-negative integer string`),X=e.object({id:at,mint:G,chain:ot,provider:e.string().min(1),providerMeta:re,bondingTarget:Y,creatorWallet:G,ticker:e.string().min(1),name:e.string().min(1),metadataUri:e.string().min(1),lifecycleState:v,createdAt:K,confirmedAt:K.nullable(),curveCompletedAt:K.nullable(),graduatedAt:K.nullable(),signals:ie.nullable(),curveProgress:e.number().min(0).max(1).nullable(),decimals:e.number().int().nonnegative().nullable(),createdAtMs:J,curveCompletedAtMs:J.nullable(),graduatedAtMs:J.nullable(),hidden:x.optional()}),st=e.object({launches:e.array(X),nextCursor:e.string().nullable()}),ct=e.object({shareBps:e.number().int().min(0).max(1e4),active:e.boolean(),ethBurnedWei:Y,tokensBurned:Y,burnCount:e.number().int().nonnegative()}),lt=e.object({launch:X,metrics:N,feeBurn:ct.nullable().optional(),thesisCount:e.number().int().nonnegative().optional()}),ut=e.object({slotIndex:q,tier:S.nullable(),coin:X.nullable()}),dt=e.object({slots:e.array(ut),generatedAt:K}),ft=e.object({slotIndex:q,tier:ae.nullable(),coin:X.nullable()}),pt=e.object({slots:e.array(ft),generatedAt:K}),mt=e.object({mint:G,rank:e.number().int().positive(),districtId:e.string().min(1),stallIndex:q,scoreAtAssign:e.number().nonnegative(),assignedAtMs:J,coin:X}),Z=e.object({placements:e.array(mt),generatedAt:K}),ht=e.object({launch:X,txRequests:e.array(Je).min(1),launchTxIndex:e.number().int().min(0).optional(),burnAwaitsFirstBuy:e.literal(!0).optional(),devBuyTokensOut:Y.optional()}),gt=e.object({launch:X}),Q=e.number(),_t=e.object({id:e.string().min(1),worldId:e.string().min(1),x:Q,z:Q,y:Q.nullable(),yaw:Q,tier:e.enum([`small`,`medium`,`large`]),status:e.enum([`active`,`disabled`]),slotCount:e.number().int().positive()}),vt=e.object({boardId:e.string().min(1),slotIndex:q,assetUrl:e.string().min(1),posterUrl:e.string().min(1).nullable(),contentType:e.string().min(1),kind:e.enum([`image`,`video`]),durationMs:e.number().nonnegative().nullable(),clickUrl:e.string().min(1),endsAtMs:J}),yt=e.object({feedId:e.string().min(1),propIds:e.array(e.uuid())}),bt=e.object({worldId:e.string().min(1),props:e.array(Ye),feedBindings:e.array(yt).optional(),generatedAt:K}),xt=e.object({worldId:e.string().min(1),boards:e.array(_t),placements:e.array(vt),publicBookingEnabled:e.boolean().optional(),generatedAt:K});function $(e){return e.status===`ready`||e.status===`failed`}async function St(e){return new Promise(t=>{setTimeout(t,e)})}function Ct(e){let t=it(e),n=async e=>t.request(`GET`,e),r=async(e,n)=>t.request(`POST`,e,n),i=e=>`${u.coins}/${encodeURIComponent(e)}`,a=e=>`${u.wallets}/${encodeURIComponent(e)}`;return{async health(){return oe.parse(await n(u.health))},async listCoins(e){let t=e?s(e):new URLSearchParams,r=l(u.coins,t);return Oe.parse(await n(r))},async getCoinSummary(e){return lt.parse(await n(i(e)))},async getCoinMetrics(e){return N.parse(await n(`${i(e)}/metrics`))},async getCoinHolders(e,t){let r=new URLSearchParams;t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.cursor!==void 0&&r.set(`cursor`,t.cursor);let a=l(`${i(e)}/holders`,r);return xe.parse(await n(a))},async getCoinTraders(e,t){let r=t?ne(t):new URLSearchParams,a=l(`${i(e)}/traders`,r);return O.parse(await n(a))},async getCoinTrades(e,t){let r=c(t??{}),a=l(`${i(e)}/trades`,r);return pe.parse(await n(a))},async getCoinBurns(e,t){let r=c(t??{}),a=l(`${i(e)}/burns`,r);return ge.parse(await n(a))},async getCandles(e,t){let r=new URLSearchParams;t?.timeframe!==void 0&&r.set(`tf`,t.timeframe),t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.before!==void 0&&r.set(`before`,String(t.before));let a=l(`${i(e)}/candles`,r);return Te.parse(await n(a))},async getCoinSentiment(e){return F.parse(await n(`${i(e)}/sentiment`))},async setCoinSentiment(e,n){return F.parse(await t.request(`PUT`,`${i(e)}/sentiment`,{vote:n}))},async editCoinDetails(e,n){return gt.parse(await t.request(`PUT`,`${i(e)}/details`,n))},async getPoolFee(e){return Se.parse(await n(`${i(e)}/pool-fee`))},async getActivity(e){let t=e?te(e):new URLSearchParams,r=l(u.activity,t);return _e.parse(await n(r))},async getLaunch(e){return X.parse(await n(`${u.launches}/${encodeURIComponent(e)}`))},async listLaunches(e){let t=new URLSearchParams;e?.cursor!==void 0&&t.set(`cursor`,e.cursor),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.sort!==void 0&&t.set(`sort`,e.sort),e?.state!==void 0&&t.set(`state`,e.state),e?.world!==void 0&&t.set(`world`,e.world),e?.q!==void 0&&t.set(`q`,e.q);let r=l(u.launches,t);return st.parse(await n(r))},async getLaunchConfig(){return qe.parse(await n(u.config))},async getPlacements(){return Z.parse(await n(u.placements))},async getNativeUsdRates(){return Ae.parse(await n(u.rates))},async getWalletHoldings(e){return Me.parse(await n(`${a(e)}/holdings`))},async getWalletPnl(e){return Pe.parse(await n(`${a(e)}/pnl`))},async getWalletTrades(e,t){let r=t?ee(t):new URLSearchParams,i=l(`${a(e)}/trades`,r);return ve.parse(await n(i))},async getWalletTradingStats(e){return Fe.parse(await n(`${a(e)}/trading-stats`))},async getWalletPnlCurve(e){return Le.parse(await n(`${a(e)}/pnl-curve`))},async getCreatorStats(e){return ze.parse(await n(`${a(e)}/creator-stats`))},async uploadAsset(e,n){return w.parse(await t.requestRaw(u.garageAsset,e,n))},async getMedia(e){return w.parse(await n(`${u.media}/${encodeURIComponent(e)}`))},async uploadAndAwaitReady(e,r,i){let a=i?.intervalMs??1e3,o=i?.timeoutMs??6e4,s=w.parse(await t.requestRaw(u.garageAsset,e,r));if($(s))return s;let c=Date.now()+o;for(;Date.now()<c;)if(await St(a),s=w.parse(await n(`${u.media}/${encodeURIComponent(s.key)}`)),$(s))return s;throw Error(`Media ${s.key} was still ${s.status} after ${String(o)}ms`)},async getWatchlist(){return Ve.parse(await n(u.watchlist))},async watchCoin(e){let n=`${u.watchlist}/${encodeURIComponent(e)}`;return z.parse(await t.request(`PUT`,n))},async unwatchCoin(e){let n=`${u.watchlist}/${encodeURIComponent(e)}`;return z.parse(await t.request(`DELETE`,n))},async getProfile(e){return C.parse(await n(`${u.profile}/${encodeURIComponent(e)}`))},async getMyProfile(){return C.parse(await n(u.profileMe))},async updateProfile(e){return C.parse(await t.request(`PUT`,u.profile,e))},async checkHandle(e){let t=l(u.profileHandleCheck,new URLSearchParams({handle:e}));return de.parse(await n(t))},async getWorldProps(){return bt.parse(await n(u.worldProps))},async getWorldPlayers(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.worldPlayers,t);return Ze.parse(await n(r))},async searchWorldPlayers(e,t){let r=new URLSearchParams({q:e});t!==void 0&&r.set(`world`,t);let i=l(u.worldPlayerSearch,r);return $e.parse(await n(i))},async getBazaar(){return dt.parse(await n(u.bazaar))},async getRing(){return pt.parse(await n(u.ring))},async getAdBoards(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.worldAdBoards,t);return xt.parse(await n(r))},async getAdPulse(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.adsPulse,t);return et.parse(await n(r))},async buildLaunch(e){return ht.parse(await r(u.launchBuild,e))},async confirmLaunch(e,t){return X.parse(await r(`${u.launches}/${encodeURIComponent(e)}/confirm`,t))},async walletChallenge(e){return se.parse(await r(u.walletChallenge,e??{}))},async walletLink(e){return ce.parse(await r(u.walletLink,e))},async walletUnlink(e){return le.parse(await r(u.walletUnlink,e??{}))},async walletModeration(){return ue.parse(await n(u.walletModeration))}}}export{U as ApiError,H as RateLimitError,Ct as createClient};
|
|
1
|
+
import*as e from"zod";const t=[`sort`,`window`,`dir`,`q`,`chain`,`world`,`creator`,`cursor`],n=[`minFdv`,`maxFdv`,`minVolume`,`maxVolume`,`minFdvUsd`,`maxFdvUsd`,`minHolders`,`maxHolders`,`minTrades`,`maxTrades`,`minTraders`,`maxTraders`,`minProgressPct`,`maxProgressPct`,`minTop10HolderPct`,`maxTop10HolderPct`,`minChangePct`,`maxChangePct`,`minAgeMinutes`,`maxAgeMinutes`,`minBurned`,`maxBurned`],r=[`burn`,`devSold`,`devSoldAll`,`graveyard`,`mapPlaced`],i=[`states`,`keywords`,`excludeKeywords`,`links`];function a(e,t){return Math.min(t,Math.max(1,Math.trunc(e)))}function o(e,t,n,r){for(let i of n){let n=t[i];n!==void 0&&e.set(i,r(n))}}function s(e){let s=new URLSearchParams;return o(s,e,t,e=>e),o(s,e,n,String),o(s,e,r,e=>e?`true`:`false`),o(s,e,i,e=>e.join(`,`)),e.limit!==void 0&&Number.isFinite(e.limit)&&s.set(`limit`,String(a(e.limit,100))),s}function c(e){let t=new URLSearchParams;return e.limit!==void 0&&Number.isFinite(e.limit)&&t.set(`limit`,String(a(e.limit,100))),e.before!==void 0&&Number.isFinite(e.before)&&t.set(`before`,String(e.before)),t}function ee(e){let t=c(e);return e.mint!==void 0&&t.set(`mint`,e.mint),t}function te(e){let t=c(e);return e.chain!==void 0&&t.set(`chain`,e.chain),t}function ne(e){let t=new URLSearchParams;return e.sort!==void 0&&t.set(`sort`,e.sort),e.dir!==void 0&&t.set(`dir`,e.dir),e.limit!==void 0&&Number.isFinite(e.limit)&&t.set(`limit`,String(a(e.limit,100))),e.cursor!==void 0&&t.set(`cursor`,e.cursor),t}function l(e,t){let n=t.toString();return n?`${e}?${n}`:e}const u={health:`/health`,coins:`/launchpad/coins`,launches:`/launchpad/launches`,config:`/launchpad/config`,placements:`/launchpad/placements`,bazaar:`/launchpad/bazaar`,ring:`/launchpad/ring`,rates:`/launchpad/rates`,activity:`/launchpad/activity`,wallets:`/launchpad/wallets`,watchlist:`/launchpad/watchlist`,launchBuild:`/launchpad/launch/build`,walletChallenge:`/wallet/challenge`,walletLink:`/wallet/link`,walletUnlink:`/wallet/unlink`,walletModeration:`/wallet/moderation`,profile:`/profile`,profileMe:`/profile/me`,profileHandleCheck:`/profile/handle-check`,garageAsset:`/garage/asset`,media:`/media`,worldProps:`/world/props`,worldPlayers:`/world/players`,worldPlayerSearch:`/world/players/search`,worldAdBoards:`/world/ad-boards`,adsPulse:`/ads/pulse`},d=e.iso.datetime(),f=e.number().int().nonnegative(),p=f,m=e.string().regex(/^\d+$/,`must be a non-negative integer string`),h=e.string().regex(/^0x[0-9a-fA-F]{40}$/,`must be a 0x address`),g=e.string().min(1),_=e.number().min(0).max(100),v=e.enum([`launched`,`awaiting-dev-buy`,`curve-trading`,`dormant`,`graduating`,`graduated`,`abandoned`,`launch-failed`]),y=e.object({feeBps:e.number().int().min(0).max(1e4),decaySeconds:f}),b=e.enum([`v3`,`v4`]),re=e.object({curveAddress:g.nullable(),graduatedPoolAddress:g.nullable(),curveKind:b.optional(),curveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).optional(),hookAddress:g.nullable().optional(),quoteToken:g.nullable().optional(),quoteDecimals:e.number().int().min(0).max(255).optional(),graduatedPoolId:e.string().regex(/^0x[0-9a-fA-F]{64}$/,`must be a bytes32 hex string`).nullable().optional(),poolFeeBps:e.number().int().min(0).max(1e4).optional(),earlyBuyFeeBps:e.number().int().min(0).max(1e4).optional(),compounding:e.boolean().optional(),compoundCommitBps:e.number().int().min(0).max(1e4).optional(),burnShareBps:e.number().int().min(0).max(1e4).optional(),holderShareBps:e.number().int().min(0).max(1e4).optional(),creatorCurveFees:e.boolean().optional(),launchWindow:y.nullable().optional(),buyWindow:y.nullable().optional()}),ie=e.object({momentum:e.number().nonnegative(),uniqueBuyers:f,buyVolumeWei:m,windowMs:e.number().int().positive(),computedAt:d}),ae=e.object({at:d,reason:e.string().nullable()}),x=e.enum([`recency`,`momentum`]),oe=e.enum([`recency`,`performance`]),se=e.object({status:e.literal(`ok`)}),ce=e.object({message:g}),le=e.object({wallet:g}),ue=e.object({unlinked:e.boolean()}),de=e.object({banned:e.boolean(),muted:e.boolean()}),S=e.object({wallet:g,username:g.nullable(),avatarKey:e.string().regex(/^[0-9a-f]{64}$/,`must be a sha256 content-address`).nullable(),avatarUrl:g.nullable(),twitterHandle:g.nullable(),isVerified:e.boolean().optional(),telegramHandle:g.nullable(),isTelegramVerified:e.boolean().optional(),bio:e.string().nullable(),showsStats:e.boolean(),isKol:e.boolean(),isRegistered:e.boolean().optional(),createdAt:d,updatedAt:d}),fe=e.object({handle:g,available:e.boolean(),reason:e.enum([`invalid`,`reserved`,`taken`]).nullable()}),C=e.object({key:e.string().regex(/^[0-9a-f]{64}$/,`must be a sha256 content-address`),kind:e.enum([`image`,`video`]),status:e.enum([`pending`,`processing`,`ready`,`failed`]),url:g.nullable(),posterUrl:g.nullable(),thumbUrl:g.nullable(),thumbMotionUrl:g.nullable(),width:e.number().int().positive().nullable(),height:e.number().int().positive().nullable(),durationMs:f.nullable(),failureReason:g.nullable()}),pe=e.enum([`buy`,`sell`]),w=e.enum([`curve`,`dex`]),me=e.enum([`trade`,`burn`]),T=e.object({id:g,timeMs:p,blockRef:f,direction:pe,username:g,wallet:g,amountNative:m,tokenAmount:m,price:e.number().nonnegative(),venue:w,isKol:e.boolean().optional(),isVerified:e.boolean().optional(),avatarUrl:e.string().nullable().optional(),isRegistered:e.boolean().optional(),kind:me.optional()}),he=e.object({mint:g,trades:e.array(T),generatedAt:d}),ge=e.object({id:g,timeMs:p.nullable(),blockRef:f,txHash:g,caller:g,username:g,isKol:e.boolean().optional(),isVerified:e.boolean().optional(),avatarUrl:e.string().nullable().optional(),amountNative:m,tokenAmount:m,bountyNative:m}),_e=e.object({tokenAmount:m,txHash:g,timeMs:p.nullable(),blockRef:f,isExact:e.boolean()}),ve=e.object({mint:g,burns:e.array(ge),graduationBurn:_e.nullable().optional(),generatedAt:d}),E=e.object({address:g,symbol:g,name:g,decimals:e.number().int().min(0).max(255),thumbUrl:e.string().nullable(),unitPriceUsd:e.number().nonnegative().nullable().optional()}),D=T.extend({mint:g,chain:g,quoteAsset:E.nullable().optional()}),ye=e.object({trades:e.array(D),windowStartMs:p,generatedAt:d}),O=e.object({wallet:g,trades:e.array(D),generatedAt:d}),k=e.object({username:g,wallet:g,buyCount:f,sellCount:f,spentNative:m,receivedNative:m,volumeNative:m,realizedPnlNative:e.number(),tokensBought:m,tokensSold:m,firstTradeAtMs:p,lastTradeAtMs:p}),A=e.object({mint:g,quoteAsset:E.nullable().optional(),traders:e.array(k),nextCursor:e.string().nullable(),generatedAt:d}),j=e.object({buys:f,sells:f,buyVolume:m,sellVolume:m,buyers:f,sellers:f,priceChangePct:e.number().nullable()}),M=e.object({m5:j,h1:j,h6:j,h24:j}),N=e.object({mint:h,chain:g,pool:h,txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/,`must be a 0x tx hash`),blockNumber:f,blockTimeMs:p,caller:h,ethMigrated:m,migrationFee:m,liquidity:m,feeTierBps:f,closingPriceNative:e.number().nonnegative().nullable()}),P=e.object({source:g,priceNative:e.number().nonnegative().nullable(),priceUsd:e.number().nonnegative().nullable(),fdvUsd:e.number().nonnegative().nullable(),volume24hUsd:e.number().nonnegative().nullable(),priceChange24hPct:e.number().nullable(),holders:f.nullable(),fetchedAtMs:p}),F=e.object({mint:g,chain:g,priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),curveProgressPct:_,feesTotal:m,creatorFeesNative:m,creatorFeesToken:m,holders:f,top10HolderPct:_.nullable(),watcherCount:f,creatorHoldingPct:_.nullable(),creatorSold:e.boolean(),athPriceNative:e.number().nonnegative(),athAtMs:p.nullable(),lastTradeAtMs:p.nullable(),lastTradeDirection:e.enum([`buy`,`sell`]).nullable().default(null),windows:M,graduation:N.nullable(),external:P.nullable(),computedAtMs:p.nullable(),quoteAsset:E.nullable().optional(),generatedAt:d}),be=e.object({username:g,avatarUrl:e.string().nullable().optional(),isKol:e.boolean().optional(),isVerified:e.boolean().optional(),isRegistered:e.boolean().optional(),wallet:g,balance:m,pct:_}),xe=e.object({wallet:g,kind:e.enum([`curve`,`pool`,`burn`]),balance:m,pct:_}),Se=e.object({mint:g,holderCount:f,holders:e.array(be),venues:e.array(xe),nextCursor:e.string().nullable(),generatedAt:d}),I=e.object({mint:g,rocket:f,shit:f,myVote:e.enum([`rocket`,`shit`]).nullable(),canVote:e.boolean(),minBuyUsd:e.number().nonnegative(),generatedAt:d}),Ce=e.object({mint:g,curveKind:b,baseFeeBps:e.number().int().nonnegative().max(1e4).nullable(),generatedAt:d}),we=e.enum([`1m`,`1h`,`4h`,`1d`]),Te=e.object({bucketStartMs:p,open:e.number().nonnegative(),high:e.number().nonnegative(),low:e.number().nonnegative(),close:e.number().nonnegative(),volumeWei:m,tradeCount:f,venue:w}),Ee=e.object({mint:g,timeframe:we,candles:e.array(Te),generatedAt:d,changePercent:e.number().nullable(),linkOutUrl:e.string().nullable(),coverageThroughMs:e.number().nullable()}),De=e.object({m5:e.number().nullable(),h1:e.number().nullable(),h6:e.number().nullable(),h24:e.number().nullable()}),Oe=e.object({id:e.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`must be a ULID`),mint:g,chain:g,ticker:e.string(),name:e.string(),metadataUri:e.string(),creatorWallet:g,lifecycleState:v,createdAtMs:p,graduatedAtMs:p.nullable(),feeBurn:e.object({shareBps:e.number().int().min(0).max(1e4),active:e.boolean(),ethBurnedWei:m,tokensBurned:m,burnCount:e.number().int().nonnegative(),holderShareBps:e.number().int().min(0).max(1e4).optional()}).nullable().optional(),bondingTarget:m,poolFeeBps:e.number().int().min(0).max(1e4).optional(),earlyBuyFeeBps:e.number().int().min(0).max(1e4).optional(),quoteToken:g.nullable().optional(),quoteAsset:E.nullable().optional(),curveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).optional(),compounding:e.boolean().optional(),compoundCommitBps:e.number().int().optional(),burnShareBps:e.number().int().optional(),holderShareBps:e.number().int().optional(),launchWindow:e.object({feeBps:e.number().int().positive(),decaySeconds:e.number().int().positive()}).nullable().optional(),buyWindow:e.object({feeBps:e.number().int().positive(),decaySeconds:e.number().int().positive()}).nullable().optional(),priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),curveProgressPct:_,volume24h:m,buyVolume24h:m,sellVolume24h:m,changePct:De,trades24h:f,traders24h:f,holders:f,creatorSold:e.boolean(),creatorHoldingPct:_.nullable(),top10HolderPct:_.nullable(),athPriceNative:e.number().nonnegative(),lastTradeAtMs:p.nullable(),lastTradeDirection:e.enum([`buy`,`sell`]).nullable().default(null),momentum:e.number().nonnegative(),priceUsd:e.number().nonnegative().nullable(),fdvUsd:e.number().nonnegative().nullable(),volumeUsd:e.string().regex(/^\d+(?:\.\d+)?$/,`must be a non-negative decimal string`).nullable(),nativeUsdPrice:e.number().nonnegative().nullable(),nativeUsdAtMs:p.nullable(),mapRank:e.number().int().positive().nullable(),graveyard:e.boolean(),computedAtMs:p.nullable()}),ke=e.object({coins:e.array(Oe),nextCursor:e.string().nullable(),generatedAt:d}),Ae=e.object({symbol:g,priceUsd:e.number().positive().nullable(),feedUpdatedAtMs:p.nullable(),stalenessBoundMs:e.number().int().positive().nullable(),sourceNetwork:g.nullable()}),je=e.object({rates:e.array(Ae),generatedAt:d}),Me=e.object({mint:g,chain:g,ticker:e.string(),name:e.string(),metadataUri:e.string(),lifecycleState:g,balance:m,tokens:e.number().nonnegative(),priceNative:e.number().nonnegative(),valueNative:e.number().nonnegative(),valuation:e.enum([`exit`,`mark`]),quoteAsset:E.nullable().optional()}),Ne=e.object({wallet:g,holdings:e.array(Me),generatedAt:d}),Pe=e.object({mint:g,chain:g,ticker:e.string(),name:e.string(),lifecycleState:v,spentNative:m,receivedNative:m,tokensBought:m,tokensSold:m,balance:m,priceNative:e.number().nonnegative(),currentValueNative:e.number().nonnegative(),valuation:e.enum([`exit`,`mark`]),costBasisNative:e.number().nonnegative(),realizedPnlNative:e.number(),unrealizedPnlNative:e.number(),totalPnlNative:e.number(),totalPnlPct:e.number().nullable(),firstTradeAtMs:p,lastTradeAtMs:p,quoteAsset:E.nullable().optional()}),Fe=e.object({wallet:g,coins:e.array(Pe),generatedAt:d}),L=e.object({trades:f,buys:f,sells:f,buyVolumeNative:m,sellVolumeNative:m,volumeNative:m,feesNative:m,avgTradeNative:e.number().nonnegative().nullable(),largestTradeNative:e.number().nonnegative()}),R=e.object({mint:g,ticker:e.string(),name:e.string(),metadataUri:e.string().nullable(),realizedPnlNative:e.number()}),Ie=e.object({wallet:g,coinsTraded:f,coinsWithSells:f,winningCoins:f,winRatePct:e.number().nonnegative().nullable(),realizedPnlNative:e.number(),unrealizedPnlNative:e.number(),totalPnlNative:e.number(),spentNative:m,receivedNative:m,roiPct:e.number().nullable(),grossWinsNative:e.number().nonnegative(),grossLossesNative:e.number().nonnegative(),profitFactor:e.number().nonnegative().nullable(),avgWinNative:e.number().nonnegative().nullable(),avgLossNative:e.number().nonnegative().nullable(),bestCoin:R.nullable(),worstCoin:R.nullable(),avgHoldTimeMs:e.number().nonnegative().nullable(),graduationsBacked:f,tradingSinceMs:p.nullable(),mostActiveDay:e.object({date:g,trades:e.number().int().positive()}).nullable(),windows:e.object({"24h":L,"7d":L,"30d":L,all:L}),generatedAt:d}),Le=e.object({t:p,realizedPnlNative:e.number()}),Re=e.object({wallet:g,points:e.array(Le),tradeCount:f,complete:e.boolean(),baselineRealizedNative:e.number(),generatedAt:d}),ze=e.object({mint:g,ticker:e.string(),name:e.string(),metadataUri:e.string().nullable(),athFdvNative:e.number().nonnegative()}),Be=e.object({wallet:g,coinsCreated:f,coinsGraduated:f,coinsInBonding:f,coinsFailed:f,graduationRatePct:e.number().nonnegative().nullable(),creatorFeesNative:m,creatorFeesToken:m,combinedFdvNative:e.number().nonnegative(),bestLaunch:ze.nullable(),volumeNative:m,uniqueTraders:f,totalHolders:f,coinsCreatorStillHolding:f,handoffsGiven:f,handoffsReceived:f,generatedAt:d}),Ve=e.object({mint:g,chain:g,ticker:g,name:g,metadataUri:e.string().nullable(),lifecycleState:v,watchedAtMs:p,priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),fdvUsd:e.number().nonnegative().nullable(),volume24h:m,changePct:e.object({m5:e.number().nullable(),h1:e.number().nullable(),h6:e.number().nullable(),h24:e.number().nullable()}),curveProgressPct:_,holders:f,nativeDecimals:f,quoteAsset:E.nullable().optional()}),He=e.object({entries:e.array(Ve),generatedAt:d}),z=e.object({mint:g,watching:e.boolean(),watcherCount:f}),B=e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a kebab-case chain profile id`),Ue=e.number().int().min(1).max(1e4),We=e.object({chainId:e.number().int().positive(),publicRpcUrl:g.nullable().optional(),explorer:e.object({addressUrlTemplate:g,txUrlTemplate:g}).nullable().optional(),bondingCurveV4:g.nullable(),v4Quoter:g.nullable(),stateView:g.nullable(),universalRouter:g.nullable(),permit2:g.nullable(),positionManager:g.nullable().optional(),launchpadHook:g.nullable(),legacyBondingCurveV4:g.nullable(),legacyLaunchpadHook:g.nullable(),activeCurveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]),legacyCurveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).nullable().optional(),activeContractVersion:g.nullable().optional(),legacyContractVersion:g.nullable().optional(),passBurnerFactory:g.nullable()}),Ge=e.object({address:g,symbol:g,name:g,decimals:e.number().int().min(0).max(36),description:e.string().nullable(),imageUrl:e.string().nullable(),thumbUrl:e.string().nullable(),minTarget:m,maxTarget:m,minTargetUsd:e.number().nullable(),maxTargetUsd:e.number().nullable(),defaultTarget:m.nullable(),unitPriceUsd:e.number().nullable(),priceUpdatedAt:d.nullable(),pegMaxAgeHours:e.number().int().min(1).max(72),sortOrder:e.number().int(),raiseMenuEnabled:e.boolean(),zapRoute:e.object({currency0:g,currency1:g,fee:e.number().int(),tickSpacing:e.number().int(),hooks:g}).nullable().optional()}),V=e.number().positive(),Ke=e.object({usd:e.tuple([V,V,V,V,V]),defaultIndex:e.number().int().min(0).max(4)}),qe=e.object({card:e.boolean().optional(),bank:e.boolean().optional(),deposit:e.boolean().optional(),asset:g}),Je=e.object({evmLaunchChain:B.nullable(),enabledChains:e.array(B).nonempty(),creatorFeeShareBps:e.number().int().min(0).max(1e4).nullable(),landFeeShareBps:e.number().int().min(0).max(1e4).nullable(),compounding:e.object({creatorShareBps:e.number().int().min(0).max(1e4),compoundShareBps:e.number().int().min(0).max(1e4).optional(),mandatory:e.boolean().optional(),commitMenu:e.array(Ue).optional(),mandatoryCommitBps:e.number().int().min(0).max(1e4).optional()}).nullable(),launchFeeWei:m.nullable(),tradeFeeBps:e.number().int().min(0).max(1e4).nullable(),migrationFeeBps:e.number().int().min(0).max(1e4).nullable(),ctoFeeWei:m.nullable(),launchWindow:y.nullable().optional(),buyWindow:y.nullable().optional(),graduationSurchargeEnabled:e.boolean().nullable().optional(),earlyBuyEnabled:e.boolean().nullable().optional(),sellWindowEnabled:e.boolean().nullable().optional(),curveCreatorFeesEnabled:e.boolean().nullable().optional(),burnCommitEnabled:e.boolean().nullable().optional(),holderShareEnabled:e.boolean().nullable().optional(),sniperTaxWindowSeconds:e.number().int().min(0).nullable().optional(),quoteAssets:e.array(Ge).nullable().optional(),raiseLadder:Ke.nullable().optional(),curveContracts:We.nullable().optional(),termsVersion:g,agentAccessEnabled:e.boolean(),worldEnabled:e.boolean().optional(),funding:qe.optional(),fundingEnabled:e.boolean().optional(),externalWalletsEnabled:e.boolean().optional(),compoundPotKeeperEnabled:e.boolean().optional()}),Ye=e.object({from:h,to:h,data:e.string().regex(/^0x(?:[0-9a-fA-F]{2})*$/,`must be 0x hex bytes`),value:m,chainId:e.number().int().positive(),gas:m.nullable()}),Xe=e.object({id:e.uuid(),worldId:g,model:g,x:e.number(),z:e.number(),y:e.number().nullable(),yaw:e.number(),scale:e.number().positive(),updatedAtMs:p}),Ze=e.tuple([e.number(),e.number()]),Qe=e.object({players:e.array(Ze),total:f}),$e=e.object({peerId:e.string().nullable(),name:e.string(),wallet:g.nullable(),username:e.string().nullable(),online:e.boolean()}),et=e.object({players:e.array($e)}),tt=e.object({volume24hWei:m,volume24hUsd:e.number().nullable(),trades24h:f,activeTraders24h:f,playersOnline:f,boardsActive:f,boardsOccupied:f,generatedAt:d});var H=class extends Error{retryAfterMs;limit;remaining;resetAt;constructor(e,t){super(e),this.name=`RateLimitError`,this.retryAfterMs=t.retryAfterMs,this.limit=t.limit,this.remaining=t.remaining,this.resetAt=t.resetAt}},U=class extends Error{status;apiError;details;constructor(e,t){super(e),this.name=`ApiError`,this.status=t.status,this.apiError=t.apiError,this.details=t.details}};async function nt(e){try{let t=await e.json();if(typeof t==`object`&&t)return{apiError:`error`in t&&typeof t.error==`string`?t.error:void 0,details:rt(t)}}catch{}return{apiError:void 0,details:void 0}}function rt(e){if(!(`details`in e)||!Array.isArray(e.details))return;let t=e.details.filter(e=>typeof e==`object`&&!!e&&`field`in e&&typeof e.field==`string`&&`reason`in e&&typeof e.reason==`string`);return t.length>0?t:void 0}function W(e,t){let n=e.headers.get(t);if(n===null||n.trim()===``)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function it(e){let t=e.headers.get(`retry-after`);if(t===null||t.trim()===``)return;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n*1e3);let r=Date.parse(t);return Number.isNaN(r)?void 0:Math.max(0,r-Date.now())}function at(e){let t=e.fetch??fetch,n=e.baseUrl.replace(/\/+$/,``),r=e.headers??{};async function i(e,t,n){if(n.status===429){let e=W(n,`x-ratelimit-reset`);return new H(`API rate limit exceeded (${t})`,{retryAfterMs:it(n)??0,limit:W(n,`x-ratelimit-limit`),remaining:W(n,`x-ratelimit-remaining`),resetAt:e===void 0?void 0:Date.now()+e*1e3})}return new U(`API request failed: ${n.status} ${n.statusText} (${e} ${t})`,{status:n.status,...await nt(n)})}return{async request(e,a,o){let s=await t(`${n}${a}`,{method:e,credentials:`include`,headers:{...r,...o!==void 0&&{"content-type":`application/json`}},...o!==void 0&&{body:JSON.stringify(o)}});if(!s.ok)throw await i(e,a,s);if(s.status!==204)return await s.json()},async requestRaw(e,a,o){let s=await t(`${n}${e}`,{method:`POST`,credentials:`include`,headers:{...r,"content-type":o},body:a});if(!s.ok)throw await i(`POST`,e,s);return await s.json()}}}const ot=e.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`must be a ULID`),st=e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a kebab-case chain profile id`),G=e.string().min(1),K=e.iso.datetime(),q=e.number().int().nonnegative(),J=q,Y=e.string().regex(/^\d+$/,`must be a non-negative integer string`),X=e.object({id:ot,mint:G,chain:st,provider:e.string().min(1),providerMeta:re,bondingTarget:Y,creatorWallet:G,ticker:e.string().min(1),name:e.string().min(1),metadataUri:e.string().min(1),lifecycleState:v,createdAt:K,confirmedAt:K.nullable(),curveCompletedAt:K.nullable(),graduatedAt:K.nullable(),signals:ie.nullable(),curveProgress:e.number().min(0).max(1).nullable(),decimals:e.number().int().nonnegative().nullable(),createdAtMs:J,curveCompletedAtMs:J.nullable(),graduatedAtMs:J.nullable(),hidden:ae.optional()}),ct=e.object({launches:e.array(X),nextCursor:e.string().nullable()}),lt=e.object({shareBps:e.number().int().min(0).max(1e4),active:e.boolean(),ethBurnedWei:Y,tokensBurned:Y,burnCount:e.number().int().nonnegative()}),ut=e.object({launch:X,metrics:F,feeBurn:lt.nullable().optional(),thesisCount:e.number().int().nonnegative().optional()}),dt=e.object({slotIndex:q,tier:x.nullable(),coin:X.nullable()}),ft=e.object({slots:e.array(dt),generatedAt:K}),pt=e.object({slotIndex:q,tier:oe.nullable(),coin:X.nullable()}),mt=e.object({slots:e.array(pt),generatedAt:K}),ht=e.object({mint:G,rank:e.number().int().positive(),districtId:e.string().min(1),stallIndex:q,scoreAtAssign:e.number().nonnegative(),assignedAtMs:J,coin:X}),gt=e.object({placements:e.array(ht),generatedAt:K}),_t=e.object({launch:X,txRequests:e.array(Ye).min(1),launchTxIndex:e.number().int().min(0).optional(),burnAwaitsFirstBuy:e.literal(!0).optional(),devBuyTokensOut:Y.optional()}),vt=e.object({launch:X}),Z=e.number(),yt=e.object({id:e.string().min(1),worldId:e.string().min(1),x:Z,z:Z,y:Z.nullable(),yaw:Z,tier:e.enum([`small`,`medium`,`large`]),status:e.enum([`active`,`disabled`]),slotCount:e.number().int().positive()}),Q=e.object({boardId:e.string().min(1),slotIndex:q,assetUrl:e.string().min(1),posterUrl:e.string().min(1).nullable(),contentType:e.string().min(1),kind:e.enum([`image`,`video`]),durationMs:e.number().nonnegative().nullable(),clickUrl:e.string().min(1),endsAtMs:J}),bt=e.object({feedId:e.string().min(1),propIds:e.array(e.uuid())}),xt=e.object({worldId:e.string().min(1),props:e.array(Xe),feedBindings:e.array(bt).optional(),generatedAt:K}),St=e.object({worldId:e.string().min(1),boards:e.array(yt),placements:e.array(Q),publicBookingEnabled:e.boolean().optional(),generatedAt:K});function $(e){return e.status===`ready`||e.status===`failed`}async function Ct(e){return new Promise(t=>{setTimeout(t,e)})}function wt(e){let t=at(e),n=async e=>t.request(`GET`,e),r=async(e,n)=>t.request(`POST`,e,n),i=e=>`${u.coins}/${encodeURIComponent(e)}`,a=e=>`${u.wallets}/${encodeURIComponent(e)}`;return{async health(){return se.parse(await n(u.health))},async listCoins(e){let t=e?s(e):new URLSearchParams,r=l(u.coins,t);return ke.parse(await n(r))},async getCoinSummary(e){return ut.parse(await n(i(e)))},async getCoinMetrics(e){return F.parse(await n(`${i(e)}/metrics`))},async getCoinHolders(e,t){let r=new URLSearchParams;t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.cursor!==void 0&&r.set(`cursor`,t.cursor);let a=l(`${i(e)}/holders`,r);return Se.parse(await n(a))},async getCoinTraders(e,t){let r=t?ne(t):new URLSearchParams,a=l(`${i(e)}/traders`,r);return A.parse(await n(a))},async getCoinTrades(e,t){let r=c(t??{}),a=l(`${i(e)}/trades`,r);return he.parse(await n(a))},async getCoinBurns(e,t){let r=c(t??{}),a=l(`${i(e)}/burns`,r);return ve.parse(await n(a))},async getCandles(e,t){let r=new URLSearchParams;t?.timeframe!==void 0&&r.set(`tf`,t.timeframe),t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.before!==void 0&&r.set(`before`,String(t.before));let a=l(`${i(e)}/candles`,r);return Ee.parse(await n(a))},async getCoinSentiment(e){return I.parse(await n(`${i(e)}/sentiment`))},async setCoinSentiment(e,n){return I.parse(await t.request(`PUT`,`${i(e)}/sentiment`,{vote:n}))},async editCoinDetails(e,n){return vt.parse(await t.request(`PUT`,`${i(e)}/details`,n))},async getPoolFee(e){return Ce.parse(await n(`${i(e)}/pool-fee`))},async getActivity(e){let t=e?te(e):new URLSearchParams,r=l(u.activity,t);return ye.parse(await n(r))},async getLaunch(e){return X.parse(await n(`${u.launches}/${encodeURIComponent(e)}`))},async listLaunches(e){let t=new URLSearchParams;e?.cursor!==void 0&&t.set(`cursor`,e.cursor),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.sort!==void 0&&t.set(`sort`,e.sort),e?.state!==void 0&&t.set(`state`,e.state),e?.world!==void 0&&t.set(`world`,e.world),e?.q!==void 0&&t.set(`q`,e.q);let r=l(u.launches,t);return ct.parse(await n(r))},async getLaunchConfig(){return Je.parse(await n(u.config))},async getPlacements(){return gt.parse(await n(u.placements))},async getNativeUsdRates(){return je.parse(await n(u.rates))},async getWalletHoldings(e){return Ne.parse(await n(`${a(e)}/holdings`))},async getWalletPnl(e){return Fe.parse(await n(`${a(e)}/pnl`))},async getWalletTrades(e,t){let r=t?ee(t):new URLSearchParams,i=l(`${a(e)}/trades`,r);return O.parse(await n(i))},async getWalletTradingStats(e){return Ie.parse(await n(`${a(e)}/trading-stats`))},async getWalletPnlCurve(e){return Re.parse(await n(`${a(e)}/pnl-curve`))},async getCreatorStats(e){return Be.parse(await n(`${a(e)}/creator-stats`))},async uploadAsset(e,n){return C.parse(await t.requestRaw(u.garageAsset,e,n))},async getMedia(e){return C.parse(await n(`${u.media}/${encodeURIComponent(e)}`))},async uploadAndAwaitReady(e,r,i){let a=i?.intervalMs??1e3,o=i?.timeoutMs??6e4,s=C.parse(await t.requestRaw(u.garageAsset,e,r));if($(s))return s;let c=Date.now()+o;for(;Date.now()<c;)if(await Ct(a),s=C.parse(await n(`${u.media}/${encodeURIComponent(s.key)}`)),$(s))return s;throw Error(`Media ${s.key} was still ${s.status} after ${String(o)}ms`)},async getWatchlist(){return He.parse(await n(u.watchlist))},async watchCoin(e){let n=`${u.watchlist}/${encodeURIComponent(e)}`;return z.parse(await t.request(`PUT`,n))},async unwatchCoin(e){let n=`${u.watchlist}/${encodeURIComponent(e)}`;return z.parse(await t.request(`DELETE`,n))},async getProfile(e){return S.parse(await n(`${u.profile}/${encodeURIComponent(e)}`))},async getMyProfile(){return S.parse(await n(u.profileMe))},async updateProfile(e){return S.parse(await t.request(`PUT`,u.profile,e))},async checkHandle(e){let t=l(u.profileHandleCheck,new URLSearchParams({handle:e}));return fe.parse(await n(t))},async getWorldProps(){return xt.parse(await n(u.worldProps))},async getWorldPlayers(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.worldPlayers,t);return Qe.parse(await n(r))},async searchWorldPlayers(e,t){let r=new URLSearchParams({q:e});t!==void 0&&r.set(`world`,t);let i=l(u.worldPlayerSearch,r);return et.parse(await n(i))},async getBazaar(){return ft.parse(await n(u.bazaar))},async getRing(){return mt.parse(await n(u.ring))},async getAdBoards(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.worldAdBoards,t);return St.parse(await n(r))},async getAdPulse(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.adsPulse,t);return tt.parse(await n(r))},async buildLaunch(e){return _t.parse(await r(u.launchBuild,e))},async confirmLaunch(e,t){return X.parse(await r(`${u.launches}/${encodeURIComponent(e)}/confirm`,t))},async walletChallenge(e){return ce.parse(await r(u.walletChallenge,e??{}))},async walletLink(e){return le.parse(await r(u.walletLink,e))},async walletUnlink(e){return ue.parse(await r(u.walletUnlink,e??{}))},async walletModeration(){return de.parse(await n(u.walletModeration))}}}export{U as ApiError,H as RateLimitError,wt as createClient};
|