@oakagentkit/core 0.3.5 → 0.3.6
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/build/dist/api/addresses.d.ts +14 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.d.ts +2 -0
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/identity-link.js +1 -1
- package/build/dist/api/metadata.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.js +1 -1
- package/build/dist/api/modules/beefy/guard.js +1 -1
- package/build/dist/api/modules/beefy/index.js +1 -1
- package/build/dist/api/modules/beefy/liquidity.js +1 -1
- package/build/dist/api/modules/beefy/management.js +1 -1
- package/build/dist/api/modules/beefy/vaults.js +1 -1
- package/build/dist/api/modules/borro/actions.js +1 -1
- package/build/dist/api/modules/borro/index.js +1 -1
- package/build/dist/api/modules/borro/liquidity.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/chop/display.js +1 -1
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- package/build/dist/api/modules/clanker/extensions.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/clanker/manage.js +1 -1
- package/build/dist/api/modules/clanker/pool-config.js +1 -1
- package/build/dist/api/modules/clanker/protocol.js +1 -1
- package/build/dist/api/modules/clanker/state.js +1 -1
- package/build/dist/api/modules/earn/index.js +1 -1
- package/build/dist/api/modules/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/thesis.js +1 -1
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/fobo/index.js +1 -1
- package/build/dist/api/modules/fobo/intent.js +1 -1
- package/build/dist/api/modules/fobo/steps.js +1 -1
- package/build/dist/api/modules/fobo/verify.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/buyback.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.d.ts +39 -2
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.d.ts +14 -2
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/agent-link.d.ts +17 -0
- package/build/dist/api/modules/hookr/agent-link.js +1 -0
- package/build/dist/api/modules/hookr/api-client.d.ts +9 -0
- package/build/dist/api/modules/hookr/api-client.js +1 -0
- package/build/dist/api/modules/hookr/blocks/advisory.d.ts +41 -0
- package/build/dist/api/modules/hookr/blocks/advisory.js +1 -0
- package/build/dist/api/modules/hookr/blocks/buy-sell-block.d.ts +7 -0
- package/build/dist/api/modules/hookr/blocks/buy-sell-block.js +1 -0
- package/build/dist/api/modules/hookr/blocks/core-settings.d.ts +6 -0
- package/build/dist/api/modules/hookr/blocks/core-settings.js +1 -0
- package/build/dist/api/modules/hookr/blocks/exit-clock.d.ts +14 -0
- package/build/dist/api/modules/hookr/blocks/exit-clock.js +1 -0
- package/build/dist/api/modules/hookr/blocks/holder-pot.d.ts +30 -0
- package/build/dist/api/modules/hookr/blocks/holder-pot.js +1 -0
- package/build/dist/api/modules/hookr/blocks/managed-fee.d.ts +96 -0
- package/build/dist/api/modules/hookr/blocks/managed-fee.js +1 -0
- package/build/dist/api/modules/hookr/blocks/market-guard.d.ts +116 -0
- package/build/dist/api/modules/hookr/blocks/market-guard.js +1 -0
- package/build/dist/api/modules/hookr/blocks/market-hours-fee.d.ts +87 -0
- package/build/dist/api/modules/hookr/blocks/market-hours-fee.js +1 -0
- package/build/dist/api/modules/hookr/blocks/pay-later.d.ts +199 -0
- package/build/dist/api/modules/hookr/blocks/pay-later.js +1 -0
- package/build/dist/api/modules/hookr/blocks/sandwich-guard.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/sandwich-guard.js +1 -0
- package/build/dist/api/modules/hookr/blocks/storm-fee.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/storm-fee.js +1 -0
- package/build/dist/api/modules/hookr/blocks/swap-cut.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/swap-cut.js +1 -0
- package/build/dist/api/modules/hookr/blocks/swap-reward-mint.d.ts +125 -0
- package/build/dist/api/modules/hookr/blocks/swap-reward-mint.js +1 -0
- package/build/dist/api/modules/hookr/blocks/wallet-cap.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/wallet-cap.js +1 -0
- package/build/dist/api/modules/hookr/blocks/zap-source.d.ts +161 -0
- package/build/dist/api/modules/hookr/blocks/zap-source.js +1 -0
- package/build/dist/api/modules/hookr/blocks/zap-target.d.ts +51 -0
- package/build/dist/api/modules/hookr/blocks/zap-target.js +1 -0
- package/build/dist/api/modules/hookr/claims.d.ts +53 -0
- package/build/dist/api/modules/hookr/claims.js +1 -0
- package/build/dist/api/modules/hookr/contracts.d.ts +3 -1
- package/build/dist/api/modules/hookr/contracts.js +1 -1
- package/build/dist/api/modules/hookr/create-cancel.js +1 -1
- package/build/dist/api/modules/hookr/discovery.d.ts +2 -2
- package/build/dist/api/modules/hookr/discovery.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.d.ts +2 -0
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/gas.d.ts +48 -0
- package/build/dist/api/modules/hookr/gas.js +1 -0
- package/build/dist/api/modules/hookr/gates.d.ts +51 -0
- package/build/dist/api/modules/hookr/gates.js +1 -0
- package/build/dist/api/modules/hookr/hook-blocks.d.ts +304 -0
- package/build/dist/api/modules/hookr/hook-blocks.js +1 -0
- package/build/dist/api/modules/hookr/index.d.ts +4 -2
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/jobs.d.ts +7 -0
- package/build/dist/api/modules/hookr/jobs.js +1 -0
- package/build/dist/api/modules/hookr/launch-options.d.ts +52 -3
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-profile.d.ts +8 -0
- package/build/dist/api/modules/hookr/launch-profile.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- package/build/dist/api/modules/hookr/launch.d.ts +24 -0
- package/build/dist/api/modules/hookr/launch.js +1 -1
- package/build/dist/api/modules/hookr/liquidity.js +1 -1
- package/build/dist/api/modules/hookr/lp-positions.js +1 -1
- package/build/dist/api/modules/hookr/lp-reads.js +1 -1
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
- package/build/dist/api/modules/hookr/lp-state.d.ts +90 -2
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/pay-later-actions.d.ts +52 -0
- package/build/dist/api/modules/hookr/pay-later-actions.js +1 -0
- package/build/dist/api/modules/hookr/pins.d.ts +5 -0
- package/build/dist/api/modules/hookr/pins.js +1 -1
- package/build/dist/api/modules/hookr/pm-liquidity.d.ts +215 -0
- package/build/dist/api/modules/hookr/pm-liquidity.js +1 -0
- package/build/dist/api/modules/hookr/public-reads.d.ts +1 -1
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/read-utils.js +1 -1
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/hookr/revenue.d.ts +4 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/hookr/scan.d.ts +25 -0
- package/build/dist/api/modules/hookr/scan.js +1 -0
- package/build/dist/api/modules/hookr/swap.d.ts +161 -0
- package/build/dist/api/modules/hookr/swap.js +1 -0
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/abi.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/checks.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/merkl.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/layerbank/reserve.js +1 -1
- package/build/dist/api/modules/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/analytics.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/longbow/nft.js +1 -1
- package/build/dist/api/modules/longbow/rebates.js +1 -1
- package/build/dist/api/modules/longbow/staking.js +1 -1
- package/build/dist/api/modules/meridian/index.js +1 -1
- package/build/dist/api/modules/meridian/markets.js +1 -1
- package/build/dist/api/modules/meridian/rfq.js +1 -1
- package/build/dist/api/modules/merkl/discovery.js +1 -1
- package/build/dist/api/modules/merkl/index.js +1 -1
- package/build/dist/api/modules/merkl/manage.js +1 -1
- package/build/dist/api/modules/merkl/protocol.js +1 -1
- package/build/dist/api/modules/morpho/allocator.js +1 -1
- package/build/dist/api/modules/morpho/bundles.js +1 -1
- package/build/dist/api/modules/morpho/in-kind.js +1 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.js +1 -1
- package/build/dist/api/modules/morpho/midnight.js +1 -1
- package/build/dist/api/modules/morpho/protocol.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/desk-read.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/validate.js +1 -1
- package/build/dist/api/modules/pendle/verify.js +1 -1
- package/build/dist/api/modules/pons/claim.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/prices.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.js +1 -1
- package/build/dist/api/modules/pons/trade.js +1 -1
- package/build/dist/api/modules/poolstrade/index.js +1 -1
- package/build/dist/api/modules/priors/coverage.js +1 -1
- package/build/dist/api/modules/priors/discovery.js +1 -1
- package/build/dist/api/modules/priors/features.js +1 -1
- package/build/dist/api/modules/priors/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/raeto/index.js +1 -1
- package/build/dist/api/modules/relay/bootstrap.js +1 -1
- package/build/dist/api/modules/relay/discovery.js +1 -1
- package/build/dist/api/modules/relay/inbound.js +1 -1
- package/build/dist/api/modules/relay/index.js +1 -1
- package/build/dist/api/modules/relay/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/reads.js +1 -1
- package/build/dist/api/modules/spark/actions.js +1 -1
- package/build/dist/api/modules/spark/details.js +1 -1
- package/build/dist/api/modules/spark/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/discovery.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.js +1 -1
- package/build/dist/api/modules/tickerspring/ladder.js +1 -1
- package/build/dist/api/modules/tickerspring/maker.js +1 -1
- package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
- package/build/dist/api/modules/tickerspring/research.js +1 -1
- package/build/dist/api/modules/tickerspring/strategies.js +1 -1
- package/build/dist/api/modules/uniswap/auction-create.js +1 -1
- package/build/dist/api/modules/uniswap/auction.js +1 -1
- package/build/dist/api/modules/uniswap/batch.js +1 -1
- package/build/dist/api/modules/uniswap/common.js +1 -1
- package/build/dist/api/modules/uniswap/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- package/build/dist/api/modules/uniswap/local-guard.js +1 -1
- package/build/dist/api/modules/uniswap/oracle.js +1 -1
- package/build/dist/api/modules/uniswap/pool-math.js +1 -1
- package/build/dist/api/modules/uniswap/pools.js +1 -1
- package/build/dist/api/modules/uniswap/position.js +1 -1
- package/build/dist/api/modules/uniswap/protocol.js +1 -1
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
- package/build/dist/api/modules/uniswap/stock-prices.d.ts +25 -0
- package/build/dist/api/modules/uniswap/stock-prices.js +1 -1
- package/build/dist/api/modules/uniswap/stocks.js +1 -1
- package/build/dist/api/modules/uniswap/token-jar.js +1 -1
- package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
- package/build/dist/api/modules/uniswap/trade.js +1 -1
- package/build/dist/api/modules/uniswap/v2.js +1 -1
- package/build/dist/api/modules/uniswap/v3.js +1 -1
- package/build/dist/api/modules/uniswap/v4.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/upoch/index.js +1 -1
- package/build/dist/api/modules/upoch/reads.js +1 -1
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/scan-text.d.ts +1 -1
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/signing.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.d.ts +2 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.d.ts +9 -1
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/universal-router.js +1 -1
- package/build/dist/api/usd-estimate.js +1 -1
- package/build/dist/chunks/{DMDOSHV7.js → 266VIESP.js} +1 -1
- package/build/dist/chunks/{R66NSNNQ.js → 2BKZLF5A.js} +1 -1
- package/build/dist/chunks/{HFVXNKA5.js → 2BM2WX2G.js} +1 -1
- package/build/dist/chunks/{OY5W7ZSL.js → 2H2OZE6X.js} +1 -1
- package/build/dist/chunks/{E76Z2TT4.js → 2QQ5CGQI.js} +1 -1
- package/build/dist/chunks/{4PLLS6CT.js → 2VYA6WIN.js} +1 -1
- package/build/dist/chunks/{LCH6F5HT.js → 342OZP53.js} +1 -1
- package/build/dist/chunks/{C57DITTF.js → 3HF6WE4L.js} +1 -1
- package/build/dist/chunks/3M7RMROZ.js +1 -0
- package/build/dist/chunks/3RGED2KO.js +1 -0
- package/build/dist/chunks/{4HQEJHCD.js → 3XIJCHT7.js} +1 -1
- package/build/dist/chunks/3XY44BP5.js +1 -0
- package/build/dist/chunks/3YNXQ3EZ.js +1 -0
- package/build/dist/chunks/45QP74CE.js +1 -0
- package/build/dist/chunks/{SX5YNFHG.js → 4GAU3JLN.js} +1 -1
- package/build/dist/chunks/{Y2QADJOB.js → 4P6DRKY3.js} +1 -1
- package/build/dist/chunks/{W3DGFMQE.js → 4RTXP2YP.js} +1 -1
- package/build/dist/chunks/{QMIH6HXH.js → 4SXRXNHG.js} +1 -1
- package/build/dist/chunks/{ZTKT3ZQK.js → 53VBLEYS.js} +1 -1
- package/build/dist/chunks/{FRT6AC6M.js → 5677LZOV.js} +1 -1
- package/build/dist/chunks/{ADIPEGNN.js → 5AO2QPWE.js} +1 -1
- package/build/dist/chunks/{GQITAJVF.js → 5BPFF7NX.js} +1 -1
- package/build/dist/chunks/{JDHPMS7X.js → 5DWQUEBA.js} +1 -1
- package/build/dist/chunks/{WAKZWSHB.js → 5KKAN7XQ.js} +1 -1
- package/build/dist/chunks/{VVAM3EAK.js → 5N6YJFFA.js} +1 -1
- package/build/dist/chunks/{QIB6OMQV.js → 5O67QQIY.js} +1 -1
- package/build/dist/chunks/5PNFV7HH.js +1 -0
- package/build/dist/chunks/5RAZFRO4.js +1 -0
- package/build/dist/chunks/{FAH7FKUT.js → 5UWVXEPD.js} +1 -1
- package/build/dist/chunks/5VKVAUFQ.js +1 -0
- package/build/dist/chunks/5Y457HYC.js +1 -0
- package/build/dist/chunks/64LAWFBE.js +1 -0
- package/build/dist/chunks/{3BQ5XHDJ.js → 6EWSLHXL.js} +1 -1
- package/build/dist/chunks/{6F527FLN.js → 6HNQAYBM.js} +1 -1
- package/build/dist/chunks/{FUP53K6G.js → 6LDC5D2S.js} +1 -1
- package/build/dist/chunks/{TZ7S5KRB.js → 6QXTL65K.js} +1 -1
- package/build/dist/chunks/6RVAV6BB.js +1 -0
- package/build/dist/chunks/{WSILNJS2.js → 6STUQOFL.js} +1 -1
- package/build/dist/chunks/{RUHNLNVX.js → 6Y2546JA.js} +1 -1
- package/build/dist/chunks/{4Z3IGMU6.js → 7AYP4ATZ.js} +1 -1
- package/build/dist/chunks/{YGW4ODAP.js → 7EPU3XGY.js} +1 -1
- package/build/dist/chunks/7GL547YZ.js +1 -0
- package/build/dist/chunks/7JTXYMNP.js +1 -0
- package/build/dist/chunks/{A3BJSQ23.js → 7VU5VCTL.js} +1 -1
- package/build/dist/chunks/{Z7FGEWO2.js → 7WXAS54T.js} +1 -1
- package/build/dist/chunks/{WQ2XTDHO.js → 7X5JVF3F.js} +1 -1
- package/build/dist/chunks/{DRLBTB4E.js → A72ADVYF.js} +1 -1
- package/build/dist/chunks/{ANIF3JMV.js → AG66NM3J.js} +1 -1
- package/build/dist/chunks/AODUTN65.js +1 -0
- package/build/dist/chunks/{DBOGRUPS.js → AONO47JX.js} +1 -1
- package/build/dist/chunks/{JTPHZCO3.js → AQJLEG6B.js} +1 -1
- package/build/dist/chunks/AZBTNUXF.js +1 -0
- package/build/dist/chunks/{TOIKOIY6.js → B5BU645H.js} +1 -1
- package/build/dist/chunks/{ZX43P4BK.js → B75SS7H6.js} +1 -1
- package/build/dist/chunks/{GBIBRYOV.js → B7HVPHSS.js} +1 -1
- package/build/dist/chunks/{LT5P6PZW.js → B7WZJHIJ.js} +1 -1
- package/build/dist/chunks/{3A2IKFTV.js → BIFANUTV.js} +1 -1
- package/build/dist/chunks/BM4KHOFB.js +1 -0
- package/build/dist/chunks/{N65J3L2H.js → BSV65PCA.js} +1 -1
- package/build/dist/chunks/{ZVY7GGSP.js → BW755PNH.js} +1 -1
- package/build/dist/chunks/{VXCGMALF.js → BWE5PXRE.js} +1 -1
- package/build/dist/chunks/{7U62MMUQ.js → BY2OWKZB.js} +1 -1
- package/build/dist/chunks/{CNDIAF3P.js → C2H3BWN5.js} +1 -1
- package/build/dist/chunks/{F7MGYRPU.js → CCPG6PRL.js} +1 -1
- package/build/dist/chunks/{OI3N4EW4.js → CG7ABZXH.js} +1 -1
- package/build/dist/chunks/CJMVRV34.js +1 -0
- package/build/dist/chunks/CQPIR6ER.js +1 -0
- package/build/dist/chunks/{A4K5GXVO.js → CR7DPGI6.js} +1 -1
- package/build/dist/chunks/{UUF4Z6K6.js → CVVNAFUE.js} +1 -1
- package/build/dist/chunks/{MI5HZDMH.js → D6JOXK7Q.js} +1 -1
- package/build/dist/chunks/{2PS4GCOZ.js → DJRS3TR5.js} +1 -1
- package/build/dist/chunks/{IZFED3R2.js → DLNDJZR4.js} +1 -1
- package/build/dist/chunks/{MQXSCNUL.js → DPSFR3ZS.js} +1 -1
- package/build/dist/chunks/{LKUZAJPZ.js → DV2HVFTM.js} +1 -1
- package/build/dist/chunks/{NMJVQX5M.js → DWRRIFXS.js} +1 -1
- package/build/dist/chunks/{3ZH5SOC2.js → EFOC337C.js} +1 -1
- package/build/dist/chunks/EHQRAA3R.js +1 -0
- package/build/dist/chunks/{A4FLWHLP.js → EJIP7RBG.js} +1 -1
- package/build/dist/chunks/EWZFZUVF.js +1 -0
- package/build/dist/chunks/{OB7BFDOV.js → EYE3ZAJB.js} +1 -1
- package/build/dist/chunks/{MQ5F2VOK.js → EZUQMTLE.js} +1 -1
- package/build/dist/chunks/{O2QBSINK.js → F36IA5RI.js} +1 -1
- package/build/dist/chunks/{XTXXWRN2.js → F74ARK4H.js} +1 -1
- package/build/dist/chunks/{HPS4KOU4.js → FGGDAAHW.js} +1 -1
- package/build/dist/chunks/FMEO7RX7.js +1 -0
- package/build/dist/chunks/{FHB7QYJO.js → FN6XY6ET.js} +1 -1
- package/build/dist/chunks/G4IX4CYN.js +1 -0
- package/build/dist/chunks/G53U6Y4L.js +1 -0
- package/build/dist/chunks/{HDBZZOHJ.js → GBIL2I2K.js} +1 -1
- package/build/dist/chunks/{MJGEGNDU.js → GCFHKJIO.js} +1 -1
- package/build/dist/chunks/{O5QTITN6.js → GRHBE4MQ.js} +1 -1
- package/build/dist/chunks/GTJ6LBGB.js +1 -0
- package/build/dist/chunks/GV6Z3MET.js +1 -0
- package/build/dist/chunks/{GK3D7OKG.js → GVCNTGLC.js} +1 -1
- package/build/dist/chunks/GX2RCAHG.js +1 -0
- package/build/dist/chunks/{7TRO6MBQ.js → H5KU4DUU.js} +1 -1
- package/build/dist/chunks/H7ZJ7LAB.js +1 -0
- package/build/dist/chunks/{DCGNVMKG.js → HC3QFA5I.js} +1 -1
- package/build/dist/chunks/{6CKCZJ3F.js → HEQBTHFS.js} +1 -1
- package/build/dist/chunks/{C76D54YG.js → HGSFRN57.js} +1 -1
- package/build/dist/chunks/HJI7KO6F.js +1 -0
- package/build/dist/chunks/{KO7ANIKY.js → HNBYPHTA.js} +1 -1
- package/build/dist/chunks/{MSRCJ2BS.js → HPBTSJW7.js} +1 -1
- package/build/dist/chunks/HPO673QQ.js +1 -0
- package/build/dist/chunks/{4IOHSX3Z.js → HRGLFGFL.js} +1 -1
- package/build/dist/chunks/{DGDMRATN.js → ICHT3H3W.js} +1 -1
- package/build/dist/chunks/IJVBCEA2.js +1 -0
- package/build/dist/chunks/{N742W5KX.js → IKVRFAUP.js} +1 -1
- package/build/dist/chunks/IM7ZF7XZ.js +1 -0
- package/build/dist/chunks/{I4473OC6.js → IMD33NQS.js} +1 -1
- package/build/dist/chunks/IR7KDBFU.js +1 -0
- package/build/dist/chunks/{X24YTJST.js → IY7FWTAL.js} +1 -1
- package/build/dist/chunks/IYOWMW5B.js +1 -0
- package/build/dist/chunks/J2J73XYU.js +1 -0
- package/build/dist/chunks/JCS24YBB.js +1 -0
- package/build/dist/chunks/JQVTHPUO.js +1 -0
- package/build/dist/chunks/{USGMGKAG.js → JTWJT2O3.js} +1 -1
- package/build/dist/chunks/{W7BFM6CK.js → K4CYAWNL.js} +1 -1
- package/build/dist/chunks/{7VH6JQ2H.js → K5C6QBOO.js} +1 -1
- package/build/dist/chunks/K5OXLIPK.js +1 -0
- package/build/dist/chunks/{ZKBOPZH5.js → K6GECT3F.js} +1 -1
- package/build/dist/chunks/{6LVHN33V.js → KB2JWQZ4.js} +1 -1
- package/build/dist/chunks/{YW4W3LPQ.js → KHLM6NIZ.js} +1 -1
- package/build/dist/chunks/{OIQTZOBN.js → KKGHXNM4.js} +1 -1
- package/build/dist/chunks/{SUNTJ6IU.js → KYANIEPX.js} +1 -1
- package/build/dist/chunks/{JJSCDDQO.js → L3IAEXQR.js} +1 -1
- package/build/dist/chunks/{ZZ6FZGHF.js → L4UFGM7M.js} +1 -1
- package/build/dist/chunks/{YWVPK3DV.js → L76P6WIH.js} +1 -1
- package/build/dist/chunks/{QMNUB2GM.js → LBT6WR4U.js} +1 -1
- package/build/dist/chunks/LD3A2KLN.js +1 -0
- package/build/dist/chunks/{WRUTW6CG.js → LFSNAQ7V.js} +1 -1
- package/build/dist/chunks/{ZQPC54J5.js → LKRAUTYI.js} +1 -1
- package/build/dist/chunks/{23HNDJ76.js → M2SWILNG.js} +1 -1
- package/build/dist/chunks/{IT2JLILU.js → MFKDNAHB.js} +1 -1
- package/build/dist/chunks/MFQTBUSD.js +1 -0
- package/build/dist/chunks/{V4UJMUIB.js → MLN5KTG7.js} +1 -1
- package/build/dist/chunks/{S4JUFCT4.js → MSQNOK3I.js} +1 -1
- package/build/dist/chunks/{O4P5IQCP.js → MXI7LX2F.js} +1 -1
- package/build/dist/chunks/N6YNJGEF.js +1 -0
- package/build/dist/chunks/{DXAPKN7H.js → NLC36QHL.js} +1 -1
- package/build/dist/chunks/NUTTPUYJ.js +1 -0
- package/build/dist/chunks/{O4S6XAYV.js → O7L55XM3.js} +1 -1
- package/build/dist/chunks/{NAO7VWZF.js → OCIEVYPR.js} +1 -1
- package/build/dist/chunks/{4NBXBKOX.js → OD7CY6BY.js} +1 -1
- package/build/dist/chunks/{RUTSEGGD.js → OHZHQSCA.js} +1 -1
- package/build/dist/chunks/{E47UYYK4.js → OIGTTRN5.js} +1 -1
- package/build/dist/chunks/{2I7XHRTI.js → P6JE2NRA.js} +1 -1
- package/build/dist/chunks/PD5NXIRT.js +1 -0
- package/build/dist/chunks/{TXGZ6NWN.js → PG7HZIZL.js} +1 -1
- package/build/dist/chunks/{VREGY7E6.js → PMFR47H3.js} +1 -1
- package/build/dist/chunks/{PV7FEVBD.js → PXVF2SHU.js} +1 -1
- package/build/dist/chunks/{2FOI2625.js → Q43WPRYU.js} +1 -1
- package/build/dist/chunks/QAAKUIWE.js +1 -0
- package/build/dist/chunks/{ZXFJKW6H.js → QAVP3CWL.js} +1 -1
- package/build/dist/chunks/{YXXK6EPI.js → QBHY2QRC.js} +1 -1
- package/build/dist/chunks/{ELHRXA5U.js → QFK335LC.js} +1 -1
- package/build/dist/chunks/{3PHJUFU2.js → QFUSCK5C.js} +1 -1
- package/build/dist/chunks/{IPU656WB.js → QKH7ED6B.js} +1 -1
- package/build/dist/chunks/{XW3VGWXK.js → QMWHQRYC.js} +1 -1
- package/build/dist/chunks/{ZXRIJG6H.js → QP2B7AYX.js} +1 -1
- package/build/dist/chunks/{TJU644I7.js → QZ6V6J6W.js} +1 -1
- package/build/dist/chunks/{MDLJFCT4.js → R5Z4HPCA.js} +1 -1
- package/build/dist/chunks/RKJFSDGV.js +1 -0
- package/build/dist/chunks/RKS3M7L5.js +1 -0
- package/build/dist/chunks/{GDOHHXNH.js → RLX6YTNT.js} +1 -1
- package/build/dist/chunks/{IZP3EKKS.js → RYEQIZ2H.js} +1 -1
- package/build/dist/chunks/{USEF3QKG.js → S432S6NA.js} +1 -1
- package/build/dist/chunks/{2OVJ2BTJ.js → SEXKWYUM.js} +1 -1
- package/build/dist/chunks/{KKTOBXIT.js → SRYX65GZ.js} +1 -1
- package/build/dist/chunks/{GKUPC4DO.js → TMENUIBC.js} +1 -1
- package/build/dist/chunks/{BSX4LFYI.js → TNHU5UBQ.js} +1 -1
- package/build/dist/chunks/{PDPTJMTJ.js → TT2ST3Q3.js} +1 -1
- package/build/dist/chunks/TTBB6EFN.js +1 -0
- package/build/dist/chunks/{FRVCSDKU.js → TWVDWNTG.js} +1 -1
- package/build/dist/chunks/TZG7HTVM.js +1 -0
- package/build/dist/chunks/{OVM4QIET.js → U4MSIH4G.js} +1 -1
- package/build/dist/chunks/{G5AMH4IP.js → UGFRBJDQ.js} +1 -1
- package/build/dist/chunks/{OB3YMTDI.js → UIVOYAO2.js} +1 -1
- package/build/dist/chunks/{XRDLMTBJ.js → UMY6SP7C.js} +1 -1
- package/build/dist/chunks/UNBRUWSV.js +1 -0
- package/build/dist/chunks/{LGLWEGPY.js → UPX3OWKA.js} +1 -1
- package/build/dist/chunks/{TGXEKBLV.js → URTQNYWU.js} +1 -1
- package/build/dist/chunks/{4RCYYN6O.js → V7HTGO23.js} +1 -1
- package/build/dist/chunks/{HZSYMGJ2.js → VS7ZA4OF.js} +1 -1
- package/build/dist/chunks/{BJ2U2VXJ.js → VTWAVH74.js} +1 -1
- package/build/dist/chunks/{LZM3DO5Q.js → W5GWK72I.js} +1 -1
- package/build/dist/chunks/{65OITTDL.js → W73SLWBT.js} +1 -1
- package/build/dist/chunks/{3YH5B5NQ.js → WUONMIA2.js} +1 -1
- package/build/dist/chunks/{XL3W7DAQ.js → X3BB6WME.js} +1 -1
- package/build/dist/chunks/{XADHV2DT.js → X53QVHBC.js} +1 -1
- package/build/dist/chunks/{GBPB7JIB.js → XSQJOOEY.js} +1 -1
- package/build/dist/chunks/XUDQYSPU.js +1 -0
- package/build/dist/chunks/{S37D7HOK.js → XWZ5SL5Q.js} +1 -1
- package/build/dist/chunks/{NIWAVMDR.js → XXLQDQEX.js} +1 -1
- package/build/dist/chunks/{QBNASL3T.js → Y5T36EEU.js} +1 -1
- package/build/dist/chunks/{R73R4KN3.js → YBLJ2MCR.js} +1 -1
- package/build/dist/chunks/ZSGW2ZSO.js +1 -0
- package/build/dist/chunks/{HRAHGYNK.js → ZTNBX4VH.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/5H7NVE6O.js +0 -1
- package/build/dist/chunks/7OOCAZBE.js +0 -1
- package/build/dist/chunks/DFM4T6ZE.js +0 -1
- package/build/dist/chunks/FCVH4FYH.js +0 -1
- package/build/dist/chunks/GDUKZYE2.js +0 -1
- package/build/dist/chunks/GYPMUYB5.js +0 -1
- package/build/dist/chunks/J7OZLXSG.js +0 -1
- package/build/dist/chunks/JFC2QCMW.js +0 -1
- package/build/dist/chunks/M6JNGU4E.js +0 -1
- package/build/dist/chunks/M7OVMIIE.js +0 -1
- package/build/dist/chunks/MQK6OP7S.js +0 -1
- package/build/dist/chunks/N624NR7Y.js +0 -1
- package/build/dist/chunks/OSMOBKRQ.js +0 -1
- package/build/dist/chunks/Q3Q3YHEX.js +0 -1
- package/build/dist/chunks/QQD4PV64.js +0 -1
- package/build/dist/chunks/RN3WUJIO.js +0 -1
- package/build/dist/chunks/RP5VCG54.js +0 -1
- package/build/dist/chunks/TI727O2H.js +0 -1
- package/build/dist/chunks/UHIJMDD2.js +0 -1
- package/build/dist/chunks/W32UECOL.js +0 -1
- package/build/dist/chunks/WWNAGOCD.js +0 -1
- package/build/dist/chunks/XWC6IC5E.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as he,f as pt,h as lt,i as mt,u as ht,w as kt}from"./EHQRAA3R.js";import{a as ve,c as ct}from"./3M7RMROZ.js";import{i as dt}from"./JCS24YBB.js";import{k as rt}from"./G4IX4CYN.js";import{B as nt,t as Re,y as ot}from"./5677LZOV.js";import{c as me,h as Ze,k as et,l as tt}from"./7GL547YZ.js";import{b as ut}from"./IJVBCEA2.js";import{a as l,b as it,c as at,e as st}from"./RKS3M7L5.js";import{a as le}from"./G2LAO23N.js";import{m as Le}from"./IR7KDBFU.js";import{a as Ve}from"./3RGED2KO.js";import{a as w,b as Se,d as Je,e as _,f as m,h as pe,i as A,j as h,k as Q,l as M,m as G,n as Be,o as T,p,q as W,r as He,s as Ye}from"./UMY6SP7C.js";import{b as de,i as qe,j as Qe,k as We}from"./CJMVRV34.js";import{a as Xe}from"./7WXAS54T.js";import{t as De}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as Lt,erc20Abi as Rt,formatUnits as J,getAddress as $e,parseAbi as fe,zeroAddress as k,zeroHash as ge}from"viem";var vt="hookr_launch",y=$e(de.launcherV1),Y=$e(de.rulesV1),At=720*60*60,ke=(i,t=Object.keys(i))=>({type:"object",properties:i,required:t,additionalProperties:!1}),ft={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},Ae={...ke({launchProfile:{type:"string",enum:["agents-only","open"],description:"Choose agents-only (default, requires agentGate) or open (requires one advisory Hook Block and omits agentGate)."},token:{description:'Token to launch: kind "new" creates a fresh token; kind "existing" is reserved and currently refused.',oneOf:[ke({kind:{const:"new",type:"string",description:le.enumValues({new:"create and launch a fresh token"})},name:{type:"string",minLength:1,maxLength:48,description:"Public token name, 1 to 48 UTF-8 bytes, no control characters."},symbol:{type:"string",minLength:1,maxLength:12,description:"Public token ticker symbol, 1 to 12 UTF-8 bytes, no control characters."},supply:{...w,description:'Total supply of the new token in base units (18 decimals: "1000000000000000000" = 1 token); positive, below 2^108.'},salt:{...Se,description:"Bytes32 hex salt (0x plus 64 hex digits) that fixes the new token address."}}),ke({kind:{const:"existing",type:"string",description:le.enumValues({existing:"reserved for an already deployed token; launching it is not supported yet"})},address:{...ft,description:le.address("existing token contract")}})]},quote:{...ft,description:"Qualified ETH (zero address) or pinned USDG quote. Other quote funding routes await qualification."},sqrtPriceX96:{...w,description:"Integer sqrt(currency1/currency0) times 2^96 for the sorted PoolKey."},tickLower:{type:"integer",minimum:-887272,maximum:887272,description:"Lower tick of the launch range, a signed integer and a multiple of the tick spacing 200; below tickUpper."},tickUpper:{type:"integer",minimum:-887272,maximum:887272,description:"Upper tick of the launch range, a signed integer and a multiple of the tick spacing 200; above tickLower."},liquidity:{...w,description:"Set the initial liquidity in v4 liquidity units, positive and below 2^127, with rounded-up token debts within both funding caps."},amount0Max:{...w,description:"Set the maximum currency0 funding in that token\u2019s base units, using its decimals."},amount1Max:{...w,description:"Set the maximum currency1 funding in that token\u2019s base units, using its decimals."},agentGate:{description:"Set identity and score requirements for entrants; creator family liquidity is exempt from score and age requirements.",...ke({minAgeSeconds:{...w,description:"Explicit minimum live link age in seconds for buys and other LPs, 0 to 2592000; the creator family liquidity is exempt."},minScore:{...w,description:"Minimum agent reputation score required to buy; 0 means no minimum."},tierScore:{...w,description:"Set the score at which the base fee applies, or 0 when tierPips is 0; lower scores pay the surcharge."},tierPips:{...w,description:"LP fee surcharge in pips for agents below tierScore (3000 = 0.3%); at most 50000, and 0 only when tierScore is 0."},reviewerSetId:{...Se,description:"Bytes32 id of a registered reviewer set that scores agents; all zeros unless the gate uses a score."}})},hookBlocks:pt,lpRewardsBps:{...w,description:"Set the LP Rewards rate in basis points (50 = 0.5%), at most 1000; this profile has zero burn."},arbRecapture:{type:"boolean",description:"Arb recapture, permanent either way: true turns it on (25% executor, 15% Hookr, 60% LPs; swaps need a high gas limit), false launches without it. Defaults to true when omitted."},deadline:{...w,description:"Set the latest launch execution time in Unix seconds, within the next 300 seconds of chain time."}},["token","quote","sqrtPriceX96","tickLower","tickUpper","liquidity","amount0Max","amount1Max","lpRewardsBps","deadline"]),allOf:[{if:{properties:{launchProfile:{const:"open",description:"Select the open launch profile."}},required:["launchProfile"]},then:{not:{required:["agentGate"]}},else:{required:["agentGate"]}}]};function $t(i){let t=_(i,Object.keys(Ae.properties),Ae.required),a=mt(t.hookBlocks),e=st(t.launchProfile,t.agentGate,a),o=G(t.token);if(o.kind==="existing")throw _(o,["kind","address"],["kind","address"]),A(o.address),new r("Existing-token Hookr launches await a qualified funding route. Use token.kind new.");if(_(o,["kind","name","symbol","supply","salt"],["kind","name","symbol","supply","salt"]),o.kind!=="new")throw new r("Choose token.kind new; existing tokens are not supported yet.");let n=(R,oe)=>{if(typeof R!="string"||!R.trim()||new TextEncoder().encode(R).length>oe||[...R].some(we=>we.codePointAt(0)<32)||/[\u007f-\u009f\u2028-\u202e\u2066-\u2069\ud800-\udfff]/u.test(R))throw new r(`Use nonempty public token text within ${oe} UTF-8 bytes without control characters.`);return R},x=m(o.supply,108);if(!x)throw new r("Hookr new-token supply must be positive and at most 2^108-1 base units.");let q=A(t.quote);if(![k,$e(De.mainnet.usdg)].includes(q))throw new r("Use native ETH (zero address) or the pinned USDG quote; other quote funding routes await qualification.");let s=t.tickLower,c=t.tickUpper;if(typeof s!="number"||typeof c!="number")throw new r("Provide integer aligned Hookr ticks.");ot(s,c,l.tickSpacing);let u=m(t.sqrtPriceX96,160);if(u<=Le(s)||u>=Le(c))throw new r("Hookr opening price must be strictly inside the aligned tick range.");let S=m(t.liquidity,127);if(!S)throw new r("Hookr liquidity must be positive and at most int128 max.");let P=m(t.amount0Max,128),$=m(t.amount1Max,128),B=nt({liquidity:S,tickLower:s,tickUpper:c,sqrtPriceX96:u,roundUp:!0});if(B.amount0>=1n<<127n||B.amount1>=1n<<127n||!B.amount0||!B.amount1||B.amount0>P||B.amount1>$)throw new r("Hookr exact rounded-up debts must be positive and fit both approved funding caps. Reduce liquidity or increase the caps.");let f=e.kind==="agents-only"?_(t.agentGate,["minAgeSeconds","minScore","tierScore","tierPips","reviewerSetId"],["minAgeSeconds","minScore","tierScore","tierPips","reviewerSetId"]):{minAgeSeconds:"0",minScore:"0",tierScore:"0",tierPips:"0",reviewerSetId:ge},K=Number(m(f.minScore,32)),C=Number(m(f.tierScore,32)),N=Number(m(f.tierPips,24)),Z=pe(f.reviewerSetId),ee=Number(m(f.minAgeSeconds,32));if(ee>At)throw new r("Hookr minAgeSeconds must be at most 2592000.");if(N>5e4||N===0!=(C===0)||Z===ge!=(K===0&&C===0))throw new r("Hookr gate scores, tier and reviewer set must agree; tier surcharge is at most 50000 pips.");let te=Number(m(t.lpRewardsBps,16));if(te>1e3)throw new r("Hookr LP Rewards plus burn must not exceed 1000 bps; this profile has zero burn.");if(t.arbRecapture!==void 0&&typeof t.arbRecapture!="boolean")throw new r("Use arbRecapture true or false; omitted defaults to true.");return{token:{existing:k,name:n(o.name,48),symbol:n(o.symbol,12),supply:x,salt:pe(o.salt)},quote:q,sqrtPriceX96:u,tickLower:s,tickUpper:c,liquidity:S,amount0Max:P,amount1Max:$,debts:B,launchProfile:e.kind,gateTerms:{flags:e.kind==="agents-only"?1:0,minScore:K,tierScore:C,tierPips:N,reviewers:Z,minAge:ee},hookBlocks:a,lpRewardsBps:te,arbRecapture:t.arbRecapture!==!1,arbRecaptureOmitted:t.arbRecapture===void 0,deadline:m(t.deadline,64)}}async function Ot(i,t,a,e){return A(await p(i,y,T("launcherV1"),"predictToken",[t,a],e))}async function Ft(i,t,a,e,o){let n=a.gate;if(!n.walletAgent||!(e?n.healthyForScores:n.healthyIdentityOnly))throw new r("Hookr needs a healthy on-chain agent identity. Own an ERC-8004 identity or link its current agent wallet on the Hookr gate; Oak setup linking alone is insufficient.");let x=(c,u)=>p(i,n.identity,fe(["function balanceOf(address) view returns (uint256)","function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),c,u,o),q=h(await x("balanceOf",[t])),s=!1;if(n.link.linked){let c=BigInt(n.link.agentId);s=A(await x("getAgentWallet",[c]))===t,!s&&q>0n&&(s=A(await x("ownerOf",[c]))===t)}if(!q&&!s)throw new r("Hookr on-chain identity ownership or gate link is missing or stale. Own an ERC-8004 identity or link its current agent wallet on the Hookr gate before launching.")}function to(i){let t=JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:"hookr_blocks",arguments:{}}});return(async(a,e)=>{if(a!==Ve||e?.method!=="POST"||e.body!==t)throw new r("The local Hookr launch rebuild may only read the public Hook Block catalog.");return i(a,{...e,headers:{"content-type":"application/json","user-agent":"Mozilla/5.0"}})})}async function It(i,t,a){let e=$t(t);if(i.network==="testnet")throw new r("Hookr launch requires Robinhood Chain 4663.");let o=i.clientFor(4663),n=await Qe(o);if(e.deadline<=n.timestamp||e.deadline>n.timestamp+l.deadlineSeconds)throw new r("Set a fresh Hookr deadline within the next 300 seconds of chain time.");let x=[],q="";try{x=await lt(i)}catch(d){if(e.hookBlocks.length)throw d;q="Hookr gate hint unavailable; checking the shipped current gate against the chain."}let s,c=null;if(e.launchProfile==="agents-only"){let d=e.gateTerms.reviewers!==ge,L=x.find(I=>I.id==="agent-gate"&&I.openToNewPools)?.address??me,ue=d?[e.gateTerms.reviewers]:[],F;try{F=await ve(o,a,n.number,ue,L)}catch(I){if(L===me)throw I;F=await ve(o,a,n.number,ue,me),q=`Hookr gate hint ${L} refused by the chain; using the listed gate.`}await Ft(o,a,F,d,n.number),s=F,c=F.gate}else s=await ct(o,a,n.number);if(!s.rootOpenForWallet||s.newMarketsPaused||!s.launcherAdmitted)throw new r("Hookr new markets or the reviewed Launcher are closed. Retry only after registry admission is restored.");let u=await Ot(o,a,e.token,n.number);if(u===k||u===e.quote)throw new r("Hookr predicted token collides with its quote. Choose a fresh salt.");let S={currency0:BigInt(u)<BigInt(e.quote)?u:e.quote,currency1:BigInt(u)<BigInt(e.quote)?e.quote:u,fee:8388608,tickSpacing:l.tickSpacing,hooks:W},P=Re(S),$=S.currency0===u,B=$?e.amount0Max:e.amount1Max,f=$?e.amount1Max:e.amount0Max,K=$?e.debts.amount0:e.debts.amount1,C=$?e.debts.amount1:e.debts.amount0;if(B>e.token.supply)throw new r("Hookr new-token deposit cap exceeds its fixed supply.");let[N,Z,ee,te,R,oe,we,gt]=await Promise.all([o.getCode({address:u,blockNumber:n.number}),o.getTransactionCount({address:u,blockNumber:n.number}),p(o,y,T("launcherV1"),"memberKey",[u,e.quote,l.tickSpacing,W],n.number),p(o,W,T("rootV1"),"knownPool",[P],n.number),p(o,y,T("launcherV1"),"SKIP_TAKEN",[],n.number),p(o,He,T("registry"),"isQuote",[e.quote],n.number),p(o,He,T("registry"),"quoteIsBraked",[e.quote],n.number),p(o,Y,T("rulesV1"),"minProtocolShareBps",[],n.number)]),[wt,yt]=M(ee,2);if(e.token.salt===pe(R))throw new r("SKIP_TAKEN is unsupported. Choose an ordinary new-token salt.");if(N&&N!=="0x"||Z!==0||Q(te)||!Q(yt)||Re(G(wt))!==P)throw new r("Hookr token address or pool is already taken or its predicted key differs. Choose a fresh salt and rebuild.");if(!Q(oe)||Q(M(we,2)[0]))throw new r("The Hookr quote is not currently qualified or is braked. Choose an admitted quote.");let ye=c?G(c.admission):null,z=ye?m(G(ye.caps).maxLpFeePips,24):0n,be=BigInt(s.coreAdmission.caps.maxLpFeePips);if(c&&(BigInt(e.gateTerms.tierPips)>z||BigInt(l.baseLpFeePips)+z>be))throw new r("Hookr gate tier or total LP fee exceeds the live admission cap. Lower the tier or wait for compatible admission.");let U=A(await p(o,Y,T("rulesV1"),"protocolRecipient",[],n.number));await qe(o,n.number,[U]);let xe=fe(["function feeTerms(address,bool,bytes32) view returns (uint16,uint16,uint16)","function integrator(address) view returns (uint16,uint16,uint256)","function integratorMinFee(address) view returns (uint16,uint16,uint256)","function MAX_INTEGRATOR_BPS() view returns (uint16)"]),Oe=async d=>M(await p(o,U,xe,"feeTerms",[d,e.arbRecapture,P],n.number),3),[Fe,Ie]=await Promise.all([Oe(k),Oe(he)]),b=h(Ie[1],16);if(b!==0n){let d=async j=>M(await p(o,U,xe,j,[he],n.number),3),[L,ue,F]=await Promise.all([d("integrator"),d("integratorMinFee"),p(o,U,xe,"MAX_INTEGRATOR_BPS",[],n.number)]);if(h(L[0],16)!==b)throw new r("Hookr's listing for Oak and its fee terms for this pool disagree on Oak's rate. Request a fresh launch preview.");let I=h(F,16);if(b>I)throw new r(`Hookr lists Oak at ${b} bps, above its on-chain maximum integrator rate of ${I} bps. Oak will not launch on a listing outside Hookr's own limit.`);if([L[2],ue[2]].map(j=>h(j)).some(j=>j!==0n&&j<=e.deadline))throw new r("Oak's Hookr listing has a change that can take effect before this launch opens. Request a fresh launch preview after it settles.")}let E=b===0n?k:he,[bt,xt,Pt]=b===0n?Fe:Ie,Me=h(bt,16),ne=h(Pt,16);if(h(Fe[1],16)!==0n||h(xt,16)!==b||ne>10000n)throw new r("Hookr treasury minimum or integrator terms exceed the reviewed profile.");let Ce=h(gt,16),re=Me>Ce?Me:Ce;if(re<2000n||re>5000n)throw new r("Hookr protocol share is outside the reviewed 2000\u20135000 bps profile.");let Tt={guardEndBlock:0,maxFeePips:l.baseLpFeePips,snipeTaxPips:0,snipeFloorPips:0,snipeDecaySeconds:0,dynamicFeeSens:0,burnBps:0,lpBps:e.lpRewardsBps,potBps:0,royaltyBps:0,protocolShareBps:Number(re),potEveryNBuys:e.arbRecapture?0:at,maxBuyQuoteAmount:0n,potMinBuyQuote:0n,royaltyTo:k,integrator:E},g=await kt(i,{launchProfile:e.launchProfile,...c?{agentGate:t.agentGate}:{},hookBlocks:e.hookBlocks},Tt,{poolId:P,subject:u,quote:e.quote,tickSpacing:l.tickSpacing,sqrtPriceX96:e.sqrtPriceX96,rules:Y,launcher:y,wallet:a},n,{maxLpFeePips:be,maxQuoteTakePips:BigInt(s.coreAdmission.caps.maxQuoteTakePips),maxSubjectTakeBps:BigInt(s.coreAdmission.caps.maxSubjectTakeBps)},e.arbRecapture?0n:ne,x),{rules:H,blockTerms:Ne,bounds:ie}=g;if(H.guardEndBlock){let d=await rt(o,n);if(BigInt(H.guardEndBlock)<=d+4n||BigInt(H.guardEndBlock)>d+100000n)throw new r("Anti-Snipe guardEndBlock must be more than four and at most 100000 parent blocks ahead.")}let D=ie.maxLpFeePips+z,ae=ie.maxQuoteTakePips;if(D>be||D>600000n||c&&(ae>BigInt(s.coreAdmission.caps.maxQuoteTakePips)||ie.maxSubjectTakeBps>BigInt(s.coreAdmission.caps.maxSubjectTakeBps)))throw new r("Hookr selected blocks exceed the live core fee caps. Lower their rates.");let X=d=>`${J(BigInt(d),4)}%`,Ue=dt(H,e.arbRecapture?0n:ne,U,l.baseLpFeePips),qt=Ue?` ${Ue}`:"",Ee=ht(Ne,U,E===k?void 0:b).join(" "),se=`${J(b,2)}%`,St=E===k?"":` Oak receives ${se} of Hookr's cut on this pool, paid to Oak's wallet ${E}: ${se} of everything Hookr is paid from this pool's fees${e.arbRecapture?`, and ${se} of Hookr's 15% arb recapture cut (${J(b*15n,4)}% of recaptured profit)`:""}. Oak read the ${se} rate on chain; it is frozen when the pool opens. That it comes out of Hookr's part, so traders and LPs pay the same, is Hookr's published rule, not read by Oak.`,ce={on:e.arbRecapture,traderBps:0,lpBps:e.arbRecapture?1e4:0,period:0,maxPrizeBps:0,potReleaseBps:0,minBuyQuote:0n,releaseBlocks:0},je=null;if(e.arbRecapture){let[d,L]=await Promise.all([p(o,Y,fe(["function recaptureDefaults() view returns ((bool on,uint16 traderBps,uint16 lpBps,uint32 period,uint16 maxPrizeBps,uint16 potReleaseBps,uint128 minBuyQuote,uint32 releaseBlocks) rc,uint16 potBps)"]),"recaptureDefaults",[],n.number),tt(o,n.number,{required:!0})]);if(ce.releaseBlocks=Number(h(G(M(d,2)[0]).releaseBlocks,32)),!ce.releaseBlocks)throw new r("Hookr recapture release schedule is unavailable. Use arbRecapture false.");if(L.partnerBps!=="2500")throw new r("Hookr recapture split differs from the disclosed 25% executor profile. Use arbRecapture false.");je=Be(L)}let _e={quote:e.quote,tickSpacing:l.tickSpacing,sqrtPriceX96:e.sqrtPriceX96,tickLower:e.tickLower,tickUpper:e.tickUpper,liquidity:e.liquidity,amount0Max:e.amount0Max,amount1Max:e.amount1Max,config:{subject:u,quote:e.quote,rules:Y,advisory:g.advisory?.address??c.address,liquidityOwner:y,baseLpFeePips:l.baseLpFeePips,caps:{maxLpFeePips:Number(D),maxQuoteTakePips:Number(ae),maxSubjectTakeBps:Number(ie.maxSubjectTakeBps)},rulesGasLimit:Number(s.coreAdmission.gasLimit),advisoryGasLimit:g.advisory?Number(g.advisory.gasLimit):Number(m(ye.gasLimit,32)),advisoryPhases:g.advisory?.phases??1,advisoryFailOpen:g.advisory?g.advisory.failOpen:!1,policyId:ge},rules:H,recapture:ce},O=BigInt(s.launchFee.amount);if(O>10000000000000000n)throw new r("Hookr launch fee exceeds the reviewed 0.01 ETH maximum.");let v=k;if(O&&(await qe(o,n.number,[s.launchFee.treasury]),v=A(await p(o,s.launchFee.treasury,fe(["function target() view returns (address)"]),"target",[],n.number)),v===k||v===y||v===a||v===Ye))throw new r("Hookr launch fee recipient is outside the reviewed payment profile.");let Pe=O+(e.quote===k?f:0n),Te=[],V=[];if(e.quote!==k){let d=h(await p(o,e.quote,Rt,"allowance",[a,y],n.number));d!==0n&&d!==f&&V.push(i.approval(e.quote,y,"0",4663)),V.push(i.approval(e.quote,y,f.toString(),4663)),Te.push({token:e.quote,amount:f})}Pe&&Te.push({token:Xe,amount:Pe,to:y});let Ge=`Launch public, permanent token ${JSON.stringify(e.token.name)} (${JSON.stringify(e.token.symbol)}), fixed supply ${J(e.token.supply,18)} (18 decimals). ${c?c.listed?"Create one agents-only pool (identity check on every buy).":`Create one pool behind a gate Oak has not read: that gate alone decides who may buy and what surcharge applies. Oak knows only its frozen caps: LP fee surcharge at most ${z} pips (${X(z)}), zero quote and subject take.`:g.summaryLines.join(" ")} Price currency1/currency0 = ${e.sqrtPriceX96*e.sqrtPriceX96}/${1n<<192n}; sqrtPriceX96 ${e.sqrtPriceX96}, ticks ${e.tickLower} to ${e.tickUpper}, spacing ${l.tickSpacing}. Deposit at most ${e.amount0Max} currency0 and ${e.amount1Max} currency1 base units; exact launch debts ${e.debts.amount0} and ${e.debts.amount1}. Currency0 ${S.currency0}; currency1 ${S.currency1}. Launch fee ${O} wei to ${v} (${J(O,18)} ETH). Unused quote funding (${f-C} base units) and retained token supply (${e.token.supply-K} base units) return to ${a} in this transaction. Family owner ${a}; token ${u}; pool ${P}. LP base fee ${l.baseLpFeePips} pips (${X(l.baseLpFeePips)}); total LP fee cap ${D} pips (${X(D)}), frozen at launch; ${c?`gate flags 1, scores ${e.gateTerms.minScore}/${e.gateTerms.tierScore}, tier surcharge ${e.gateTerms.tierPips} pips (${X(e.gateTerms.tierPips)}) below tier score, paid to in-range LPs; reviewer set ${e.gateTerms.reviewers}; gate takes zero quote and subject.`:""} LP Rewards ${H.lpBps} bps; configured burn ${H.burnBps} bps; quote-take cap ${ae} pips (${X(ae)}); protocol share ${re} bps.${qt}${St} ${c?`${q} Gate ${c.address}: ${c.listed?"listed":"new gate, Oak has not read its code; it can refuse trades at any time"}. Minimum link age ${e.gateTerms.minAge} seconds (creator family liquidity exempt).`:""} ${it(e.arbRecapture)}${e.arbRecapture?`; recapture pot releases over ${ce.releaseBlocks} blocks`:""}; deadline ${e.deadline}.${e.arbRecaptureOmitted?" Arb recapture is on because arbRecapture was left out; pass arbRecapture false to launch without it.":""} ${H.guardEndBlock?`Principal locked until parent block ${H.guardEndBlock}.`:"No lock."} ${Ee}`,Ke=Lt({abi:T("launcherV1"),functionName:"launchAdvised",args:[e.token,W,[_e],[g.advisory?g.advisory.data:et(Ze(c.address,c.schemaHash),e.gateTerms)],e.deadline]});ut(Ke),V.push(i.unsignedTx({to:y,data:Ke,value:Pe.toString(),chainId:4663,description:Ge}));let[ze,Bt,Ht]=await Promise.all([o.getCode({address:u}),o.getTransactionCount({address:u}),o.readContract({address:y,abi:Je,functionName:"launchFee"})]);if(ze&&ze!=="0x"||Bt!==0||h(M(Ht,5)[0])!==O)throw new r("Hookr collision state or launch fee changed. Request a fresh launch preview.");return await We(o,n),{txs:V,inputs:Te,summary:Ge,tokenAddress:u,poolId:P,feeTarget:v,feeTreasury:s.launchFee.treasury,terms:Be({request:t,blockNumber:n.number,blockHash:n.hash,owner:a,tokenAddress:u,poolId:P,poolKey:S,member:_e,launchProfile:g.kind,advisory:g.advisory,gateTerms:c?e.gateTerms:null,blockTerms:Ne,blockSummary:Ee,launchFee:O,feeTarget:v,feeTreasury:s.launchFee.treasury,hookrMinimumPips:ne,oakIntegrator:E===k?null:{address:E,rateBps:b},exactApprovals:V.slice(0,-1),refunds:{quote:f-C,retainedSupply:e.token.supply-K},gasEstimate:null,gasEstimateReason:"The local sender estimates the ordered exact calls after funding approvals and confirms the gas limit and maximum fee.",lane:je,pins:de})}}function Mt(i){if(!Array.isArray(i)||i.length<1||i.length>3)throw new r("Hookr launch requires only the locally reconstructed finite approvals and one launch transaction.");for(let t of i)_(t,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function oo(i,t){if(Mt(i),i.length!==t.length||i.some((a,e)=>a.to.toLowerCase()!==t[e].to.toLowerCase()||a.data.toLowerCase()!==t[e].data.toLowerCase()||a.value!==t[e].value||a.chainId!==4663))throw new r("Hookr launch differs from the locally reconstructed exact parameters, approvals and funding.")}function no(i){return[{name:vt,inputSchema:Ae,execute:async(t,a)=>{let e=await It(i,t,a);return{txs:e.txs,preview:await i.preview(e.txs,a),terms:e.terms,summary:e.summary}}}]}export{vt as a,y as b,Y as c,Ae as d,$t as e,to as f,It as g,Mt as h,oo as i,no as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ie,b as le,c as de,d as Z}from"./VST6LFUB.js";import{a as D,b as Y}from"./3PHJUFU2.js";import{c as ae}from"./SCG5HWMN.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as re,e as h,g,i as oe}from"./NWNYJ26T.js";import{b as v,j as ne,m as F,o as se}from"./TI727O2H.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as E,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,re)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(s=>O(s,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,d])=>[s,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function W(e,t,o){let s=e.clientFor(v),[d,a]=await Promise.all([s.readContract({address:t,abi:E,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:E,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),r=e.clientFor(v),m=await r.getBlockNumber({cacheTime:0}),k=await D(e,o,m),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(se),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([W(e,o,n),r.readContract({address:o,abi:E,functionName:"totalSupply",blockNumber:n})]),J=c=>1+R.filter(b=>BigInt(b.balance)>BigInt(c)).length,B=async(c,b)=>{let M=await r.readContract({address:o,abi:E,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:b,indexedRank:b===null||_.has(c)?null:J(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(M.toString(),q.toString()),balance:{token:G,amount:M.toString()},matchesIndex:b===null?null:M.toString()===b}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=s?i.rows.find(c=>g(c.wallet,s)):void 0,H=s?{...await B(s,V?.balance??null),excluded:_.get(s)??null,rankStatus:_.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(b=>g(b.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>g(b.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await D(e,u,r);let[w,_]=await Promise.all([W(e,u,r),a.readContract({address:u,abi:E,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),d=s.items.filter(r=>g(r.launch.factory,F)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:p(r.volumeUsd),trades:p(r.trades),traders:p(r.traders),change:p(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>g(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(s.generatedAt),latestDay:p(s.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:p(r.block),time:p(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&C.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:p(r.decimals),usd:p(r.usd),counterparty:typeof r.counterparty=="string"&&C.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=r.items.filter(i=>g(i.factory,F)&&g(i.deployer,s)).slice(0,d);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),r=await D(e,s,l),m=ne[v].pons.buybackVault.address,k=[],i=async(y,K)=>{try{return await K()}catch{return k.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),w=y=>i(y,()=>a.readContract({address:m,abi:ue,functionName:y,args:[s],blockNumber:l})),[_,R,G,q,J,B,A,V,H,c,b,M,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),W(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(J),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(b),vestingStart:S(M),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),s=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await D(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?r>=pe?r-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>r||r>a||r-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:be,fromBlock:m,toBlock:r,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await W(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,d){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await d(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{description:'Choose "overview" for totals, "burn" for burns or "buyback" for buybacks; defaults to overview.',type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:{...P,description:"Wallet address to inspect; defaults to the signing wallet."},cursor:{description:"Pagination cursor returned by the previous call to this tool.",type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."}},(o,s)=>_e(e,o,s)),t("pons_trades",{token:{...P,description:"Address of the token to inspect or use."},fromBlock:X("First block number of the scan, as a decimal string; inclusive."),toBlock:X("Last block number of the scan, as a decimal string; inclusive."),limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:{...P,description:"Wallet profile address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,xe as b,Le as c};
|
|
1
|
+
import{a as ie,b as le,c as de,d as Z}from"./VST6LFUB.js";import{a as D,b as Y}from"./QFUSCK5C.js";import{c as ae}from"./SCG5HWMN.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as re,e as h,g,i as oe}from"./NWNYJ26T.js";import{b as v,j as ne,m as F,o as se}from"./EWZFZUVF.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as E,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,re)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(s=>O(s,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,d])=>[s,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function W(e,t,o){let s=e.clientFor(v),[d,a]=await Promise.all([s.readContract({address:t,abi:E,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:E,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),r=e.clientFor(v),m=await r.getBlockNumber({cacheTime:0}),k=await D(e,o,m),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(se),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([W(e,o,n),r.readContract({address:o,abi:E,functionName:"totalSupply",blockNumber:n})]),J=c=>1+R.filter(b=>BigInt(b.balance)>BigInt(c)).length,B=async(c,b)=>{let M=await r.readContract({address:o,abi:E,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:b,indexedRank:b===null||_.has(c)?null:J(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(M.toString(),q.toString()),balance:{token:G,amount:M.toString()},matchesIndex:b===null?null:M.toString()===b}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=s?i.rows.find(c=>g(c.wallet,s)):void 0,H=s?{...await B(s,V?.balance??null),excluded:_.get(s)??null,rankStatus:_.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(b=>g(b.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>g(b.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await D(e,u,r);let[w,_]=await Promise.all([W(e,u,r),a.readContract({address:u,abi:E,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),d=s.items.filter(r=>g(r.launch.factory,F)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:p(r.volumeUsd),trades:p(r.trades),traders:p(r.traders),change:p(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>g(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(s.generatedAt),latestDay:p(s.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:p(r.block),time:p(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&C.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:p(r.decimals),usd:p(r.usd),counterparty:typeof r.counterparty=="string"&&C.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=r.items.filter(i=>g(i.factory,F)&&g(i.deployer,s)).slice(0,d);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),r=await D(e,s,l),m=ne[v].pons.buybackVault.address,k=[],i=async(y,K)=>{try{return await K()}catch{return k.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),w=y=>i(y,()=>a.readContract({address:m,abi:ue,functionName:y,args:[s],blockNumber:l})),[_,R,G,q,J,B,A,V,H,c,b,M,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),W(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(J),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(b),vestingStart:S(M),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),s=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await D(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?r>=pe?r-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>r||r>a||r-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:be,fromBlock:m,toBlock:r,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await W(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,d){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await d(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{description:'Choose "overview" for totals, "burn" for burns or "buyback" for buybacks; defaults to overview.',type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:{...P,description:"Wallet address to inspect; defaults to the signing wallet."},cursor:{description:"Pagination cursor returned by the previous call to this tool.",type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."}},(o,s)=>_e(e,o,s)),t("pons_trades",{token:{...P,description:"Address of the token to inspect or use."},fromBlock:X("First block number of the scan, as a decimal string; inclusive."),toBlock:X("Last block number of the scan, as a decimal string; inclusive."),limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:{...P,description:"Wallet profile address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,xe as b,Le as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as O,e as se,h as ae,i as oe,k as de}from"./KHOUBQJK.js";import{m as ie}from"./6STUQOFL.js";import{c as N,d as Y,e as J,f as Z,g as ee,h as te,j as ne}from"./GV6Z3MET.js";import{a as re}from"./4P6DRKY3.js";import{b as ce,e as U,r as ue}from"./5PNFV7HH.js";import{a as g,b as C}from"./7WXAS54T.js";import{a as P}from"./LIUXNOLP.js";import{e as j,f as Q}from"./S65KXMZ7.js";import{f as V,l as z}from"./CW37EGPL.js";import{a as X,c as A}from"./CFPJDLTZ.js";import{a as D}from"./5N6YJFFA.js";import{a as F}from"./SPJCSEKP.js";import{b as $}from"./SCG5HWMN.js";import{b as E}from"./IX3GZMTM.js";import{t as T}from"./EZUQMTLE.js";import{b as m,c as l,d as q,e as v,j as h,k as W,l as B,q as K}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{a as x,b as G}from"./JXOEJPJ4.js";import{getAddress as p,isAddress as le,parseAbi as ye,zeroAddress as fe}from"viem";var me=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];function tt(n){return"source"in n&&n.source==="pool-spot-estimate"?void 0:n}var M=300,xe="1000000000000000000",we=p(h[m].tokens.USDG.address),ge=p(h[l].deployments.test_USDG.address),L=p(h[m].tokens.WETH.address),I=p(h[l].deployments.test_WETH.address),R=p(X.chop);function he(n){return n.chainId===m&&n.address.toLowerCase()===R.toLowerCase()}async function nt(n,e,t,o){let a=o?.find(b=>b.measuredAtBlock===t.toString()&&[b.log.address,b.staking.address].some(y=>y.toLowerCase()===n.address.toLowerCase())),i=n.address;try{a||(i=p(await V(e,n.address,"INDEX_FUND",[],t)))}catch{}let s=a??await z(e,i,"read",t);if(s.drift.length)throw new c("Chop code changed; share backing cannot be estimated.");let r=10n**BigInt(n.decimals),d=n.address.toLowerCase()===s.log.address.toLowerCase(),u=n.address.toLowerCase()===s.staking.address.toLowerCase();if(!d&&!u||n.chainId!==m||n.decimals!==(d?s.log.decimals:s.staking.decimals))throw new c("Chop share identity does not match the verified log.");let f=d?[(await j(e,s,fe,r,t)).net]:(await Q(e,s,fe,r,t)).assets;if(!f.length)throw new c("Chop LP reserves or net log backing could not be verified.");return{assets:f,isLog:d}}function Ee(n){let e=n.address.toLowerCase();return n.chainId===m?e===we.toLowerCase():n.chainId===l?e===ge.toLowerCase():!1}function Te(n){return n.chainId!==m&&n.chainId!==l?!1:C(n.address)===g}function Se(n){let e=n.address.toLowerCase();return n.chainId===m?e===L.toLowerCase():n.chainId===l?e===I.toLowerCase():!1}function ve(n){return Te(n)||Se(n)}var Pe=-887272,Ce=887272,De=(1n<<256n)-1n,Ae=ye(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]),pe=ye(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Ne=1n<<192n;async function Oe(n,e){let t=p(A.stateView),o=A.poolId,[a,i]=await Promise.all([n.readContract({address:t,abi:pe,functionName:"getSlot0",args:[o],blockNumber:e}),n.readContract({address:t,abi:pe,functionName:"getLiquidity",args:[o],blockNumber:e})]),s=a[0],r=Number(a[1]);if(s<=0n||i<=0n||!Number.isInteger(r)||r<Pe||r>Ce)throw new c("The pinned Uniswap v4 WETH/CHOP pool has no active liquidity, and the only other route is a near-empty pool.");return{numerator:Ne,denominator:s*s}}function H(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new c(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new c(`Invalid ${e} timestamp.`)}function rt(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){try{return w(n,e,t),!0}catch{return!1}}function w(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){if(!Number.isInteger(t)||t<0)throw new c("Maximum price age must be a non-negative integer.");let o=H(n,"price"),a=H(e,"current");if(o<=0n)throw new c("Price timestamp must be positive.");if(o>a)throw new c("Price timestamp is in the future.");let i=a-o;if(i>BigInt(t))throw new c(`Price is stale: age ${i}s exceeds ${t}s.`);return o.toString()}function Ue(n){if(!Number.isInteger(n)||n<Pe||n>Ce)throw new c(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=De/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function be(n,e,t,o){let a=async()=>{throw new c("Price identity resolution is read-only.")},i=F({network:e===l?"testnet":"mainnet",clientFor:r=>t.client??T(t.rpcUrl,r),http:t.http??$(),preview:a,quoteSwap:a,buildSwap:a}),s=await ue(n,{context:i,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:o,blockNumber:t.blockNumber,readMetadata:async r=>{let d=t.client??T(t.rpcUrl,e),[u,f]=await Promise.all([D(d,e,r,"symbol",t.blockNumber),D(d,e,r,"decimals",t.blockNumber)]);return{address:r,symbol:u,decimals:f,chainId:e}}});return{address:s.address,symbol:s.kind==="erc20"&&o?o.symbol:s.symbol,decimals:s.decimals,chainId:s.chainId}}async function _e(n,e,t){if(typeof n=="object"&&n!==null){let r=n.chainId??e,d=C(n.address)===g?g:p(n.address),u={address:d,symbol:n.symbol,decimals:n.decimals,chainId:r};return Ee(u)?{address:d,symbol:"USDG",decimals:v,chainId:r}:Te(u)?{address:g,symbol:"ETH",decimals:18,chainId:r}:Se(u)?{address:d,symbol:"WETH",decimals:18,chainId:r}:he(u)?{address:d,symbol:"CHOP",decimals:18,chainId:r}:be(u.address,r,t,u)}let o=n.trim(),a=o.toUpperCase(),i=o.toLowerCase();if(a==="ETH"||le(o,{strict:!1})&&C(o)===g)return{...ce,chainId:e};if(a==="WETH"||e===m&&i===L.toLowerCase()||e===l&&i===I.toLowerCase()){if(e!==m&&e!==l)throw new c(`No canonical WETH address configured for chain ${e}.`);return{address:e===l?I:L,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===m&&i===W.toLowerCase()||e===l&&i===B.toLowerCase()){if(e!==m&&e!==l)throw new c(`No canonical USDG address configured for chain ${e}.`);return{address:e===l?ge:we,symbol:"USDG",decimals:v,chainId:e}}if(e===m&&(a==="USDE"||i===U.address.toLowerCase()))return{...U,chainId:e};if(e===m&&(a==="CHOP"||i===R.toLowerCase()))return{address:R,symbol:"CHOP",decimals:18,chainId:e};let s=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||s&&o.toLowerCase()===s.toLowerCase()){if(!s&&!le(o,{strict:!1}))throw new c("OAK token address is required to price OAK.");return{address:p(s??o),symbol:"OAK",decimals:q,chainId:e}}return be(n,e,t)}async function k(n,e,t){if(e)return(await n.readContract({address:e,abi:me,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:p(K),abi:Ae,functionName:"observe",args:[[O,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new c("ETH/USDG pool observation returned insufficient tick cumulatives.");let i=ae(a[0],a[1],O),s=Ue(i);return oe(s)}async function S(n,e,t,o){if(n.timestamp!==void 0)return w(n.timestamp,t(),o);if(e&&typeof e.getBlock=="function"){let i=await P(e,n.blockNumber);return w(i.timestamp,t(),o)}let a=t();return w(a,a,o)}function _(n){if(n.startsWith("untrusted "))try{let e=JSON.parse(n.slice(10));if(typeof e=="string"&&x(e)===n)return n}catch{}return x(n)}async function it(n,e={}){let t=e.chainId??m,o=e.maxAgeSeconds??M,a=()=>e.now!==void 0?H(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),i=await _e(n,t,e);if((G(i.symbol)||i.symbol.length>256)&&(i.symbol=_(i.symbol)),e.trades){let r=await S(e,e.client,a,o),d=de(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!ie(d,e.spotOakPerEthE18))throw new c("30-minute average is outside the 50% spot guard band.");let u=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await k(e.client??T(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:se(u,d),timestamp:r}}if(e.usdE18!==void 0){let r=await S(e,e.client,a,o),d=E(e.usdE18.toString());if(d<=0n)throw new c("USD price must be positive.");return{token:i,usdE18:d.toString(),timestamp:r}}if(e.resolver){let r=await e.resolver(i),d=w(r.timestamp,a(),o),u=E(r.usdE18);if(u<=0n)throw new c("USD price must be positive.");return{token:i,usdE18:u.toString(),timestamp:d,...r.source==="pool-spot-estimate"?{source:r.source,sourceLabel:N}:{}}}let s=e.client??T(e.rpcUrl,t);if(Ee(i)){let r=await S(e,s,a,o);return{token:i,usdE18:xe,timestamp:r}}if(ve(i)){let r=await S(e,s,a,o),d=await k(s,e.oracleAddress,e.blockNumber);return{token:i,usdE18:d,timestamp:r}}if(he(i)){let r=e.timestamp===void 0&&s&&typeof s.getBlock=="function"?await P(s,e.blockNumber):void 0,d=r?w(r.timestamp,a(),o):await S(e,s,a,o);if(r&&r.number===null)throw new c("CHOP reference requires a mined block.");let u=r?.number??e.blockNumber,[f,b]=await Promise.all([Oe(s,u),e.ethUsdE18!==void 0?Promise.resolve(e.ethUsdE18.toString()):k(s,e.oracleAddress,u)]),y=E(b)*f.numerator/f.denominator;if(y<=0n)throw new c("CHOP USD reference price must be positive.");return{token:i,usdE18:y.toString(),timestamp:d}}if(i.chainId===m)try{let r=await P(s,e.blockNumber),d=w(r.timestamp,a(),o);if(r.number===null)throw new c("Pons reference requires a mined block.");let u=await ne(i,s,r.number);if(u!==void 0&&u>0n)return{token:i,usdE18:u.toString(),timestamp:d,source:"pool-spot-estimate",sourceLabel:N};let[f,b]=await Promise.all([re(i,s,r.number),k(s,e.oracleAddress,r.number)]),y=E(b)*f.numerator/f.denominator;if(y<=0n)throw new c("Pons USD reference price must be positive.");return{token:i,usdE18:y.toString(),timestamp:d}}catch(r){let d=Y(i),u=r instanceof J?Z(r.symbol,r.gap):te(r)?ee:void 0;if(u)throw new c(`Price unavailable for now for ${d?.symbol??_(i.symbol)}: ${u}. Oak has no fresh on-chain trade price for it, so it shows no price.`)}throw new c(`Oak has no fresh on-chain trade price for ${_(i.symbol)}, so it shows no price. balances and positions show a labeled estimate where one exists; an estimate is not a quote.`)}export{tt as a,M as b,xe as c,he as d,nt as e,Ee as f,Te as g,Se as h,ve as i,Oe as j,rt as k,w as l,Ue as m,k as n,it as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./43LI5NKJ.js";import{b as Q}from"./IX3GZMTM.js";import{b as x,j as J}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as se,encodeAbiParameters as Z,encodeFunctionData as F,erc20Abi as O,getAddress as g,keccak256 as ee,parseAbi as L,parseAbiParameters as oe,zeroAddress as te}from"viem";var I=10n**18n,$=(1n<<256n)-1n,q=g(J[x].morpho.morpho_blue.address),_=oe("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),w=L(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function forceDeallocatePenalty(address) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function owner() view returns (address)","function curator() view returns (address)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function forceDeallocate(address adapter,bytes data,uint256 assets,address onBehalf) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function multicall(bytes[] data)"]),v=L(["function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)"]),ne=L(["function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),M=(e,t)=>e<t?e:t,T=(e,t)=>(e+t-1n)/t;function p(e){if(typeof e!="bigint"||e<0n||e>$)throw new r("Invalid Morpho V2 integer read.");return e}function he(e){if(typeof e!="string")throw new r("Provide maxPenaltyAssets as a USDG base-unit integer string, including 0 for no penalty.");let t=Q(e);if(t>$)throw new r("Penalty limit exceeds uint256.");return t}function h(e){if(typeof e!="string")throw new r("Invalid Morpho V2 address read.");return D(e),g(e)}async function ae(e,t,n){if(await e.getChainId()!==x||n.chainId!==x)throw new r("Vault exit requires chain 4663.");let c=await e.getBlockNumber({cacheTime:0}),a=(m,y,k,S=[])=>e.readContract({address:m,abi:y,functionName:k,args:S,blockNumber:c}),[d,o,i,l,u]=await Promise.all([a(t,w,"adaptersLength"),a(t,w,"liquidityAdapter"),a(t,w,"liquidityData"),a(g(n.address),O,"balanceOf",[t]),a(g(n.address),O,"balanceOf",[q])]);if(p(d)!==1n)throw new r("Force exit requires exactly one verified MorphoMarketV1AdapterV2. This vault needs a separately qualified adapter plan.");let s=h(await a(t,w,"adapters",[0n])),C=h(o);if(C!==te&&C!==s)throw new r("The liquidity adapter is not the supported market adapter.");let[A,N,P,f,B]=await Promise.all([a(s,v,"parentVault"),a(s,v,"asset"),a(s,v,"morpho"),a(s,v,"marketIdsLength"),a(t,w,"forceDeallocatePenalty",[s])]);if(h(A)!==g(t)||h(N)!==g(n.address)||h(P)!==q)throw new r("The adapter does not match this vault and pinned Morpho Blue deployment.");let b=p(f);if(b>64n)throw new r("The adapter market inventory exceeds this reader\u2019s supported size.");let E=p(B);if(E>I/50n)throw new r("The force-deallocation penalty exceeds the documented 2% maximum.");let H;if(C!==te){if(typeof i!="string")throw new r("Invalid liquidity-market data.");let[m]=se(_,i);H=ee(Z(_,[m])).toLowerCase()}let V=await Promise.all(Array.from({length:Number(b)},(m,y)=>a(s,v,"marketIds",[BigInt(y)])));if(V.some(m=>typeof m!="string"||!/^0x[0-9a-f]{64}$/i.test(m))||new Set(V.map(m=>String(m).toLowerCase())).size!==V.length)throw new r("The adapter returned an invalid or duplicate market ID.");let R=await Promise.all(V.map(async m=>{let y=m,[k,S,ie]=await Promise.all([a(q,ne,"idToMarketParams",[y]),a(q,ne,"market",[y]),a(s,v,"expectedSupplyAssets",[y])]);if(!Array.isArray(k)||k.length!==5||!Array.isArray(S)||S.length!==6)throw new r("Invalid Morpho market state.");let z={loanToken:h(k[0]),collateralToken:h(k[1]),oracle:h(k[2]),irm:h(k[3]),lltv:p(k[4])},j=Z(_,[z]);if(ee(j).toLowerCase()!==y.toLowerCase()||z.loanToken!==g(n.address))throw new r("Morpho market identity or loan asset does not match the vault.");let G=p(S[0]),X=p(S[2]);if(X>G)throw new r("Invalid Morpho market liquidity.");let Y=p(ie),K=G-X;return{id:y,adapter:s,data:j,supplied:Y,liquidity:K,capacity:M(Y,K),penalty:E,normal:y.toLowerCase()===H}})),U=p(l),W=p(u),re=U+M(W,R.filter(m=>m.normal).reduce((m,y)=>m+y.capacity,0n));return{vault:t,blockNumber:c,idle:U,blueCash:W,normalCapacity:re,markets:R}}function de(e,t){if(t<=0n||t>$)throw new r("Force exit needs a positive position value.");let n=t>e.normalCapacity?t-e.normalCapacity:0n,c=[],a=e.blueCash-(e.normalCapacity-e.idle);for(let d of e.markets.filter(o=>!o.normal).sort((o,i)=>o.capacity===i.capacity?o.id.localeCompare(i.id):o.capacity>i.capacity?-1:1)){if(n===0n)break;let o=M(d.capacity,a);if(o===0n)continue;let i=s=>s+T(s*d.penalty,I),l=o;i(o)>=n&&(l=T(n*I,I+d.penalty),l>0n&&i(l-1n)>=n&&(l-=1n),l=M(o,l+(T(t,10000n)||1n)));let u=T(l*d.penalty,I);c.push({...d,amount:l,penaltyAssets:u}),a-=l,n=i(l)>=n?0n:n-i(l)}if(n>0n)throw new r("Underlying market liquidity cannot cover this force exit. Request a partial withdrawal or use a separately supported in-kind exit; force deallocation cannot create liquidity.");return{requestedAssets:t,normalCapacity:e.normalCapacity,legs:c,penaltyAssets:c.reduce((d,o)=>d+o.penaltyAssets,0n)}}async function we(e,t,n,c,a,d,o){let i=await ae(t,n,o),l=p(await t.readContract({address:n,abi:O,functionName:"balanceOf",args:[c],blockNumber:i.blockNumber}));if(a<=0n||a>l)throw new r("The fresh share balance cannot cover this exit.");let u=p(await t.readContract({address:n,abi:w,functionName:"previewRedeem",args:[a],blockNumber:i.blockNumber})),s=de(i,u);if(s.penaltyAssets>d)throw new r("The force-exit penalty exceeds maxPenaltyAssets. Inspect a fresh plan before authorizing a larger penalty.");let A=(await Promise.all(s.legs.map(b=>t.readContract({address:n,abi:w,functionName:"previewWithdraw",args:[b.penaltyAssets],blockNumber:i.blockNumber})))).reduce((b,E)=>b+p(E),0n);if(A>=a)throw new r("The penalty would consume the share balance.");let N=a-A,P=s.legs.map(b=>F({abi:w,functionName:"forceDeallocate",args:[b.adapter,b.data,b.amount,c]})),f=F({abi:w,functionName:"redeem",args:[N,c,c]});return P.push(f),{tx:e.unsignedTx({to:n,chainId:x,value:"0",data:s.legs.length?F({abi:w,functionName:"multicall",args:[P]}):f,description:`Exit this wallet\u2019s Morpho V2 shares; estimated penalty ${s.penaltyAssets} ${o.symbol} base units. No approvals.`}),plan:s,penaltyShares:A,redeemShares:N,blockNumber:i.blockNumber}}var ye="This vault lists no lending markets right now, and Morpho's index shows 0% over this window. On these numbers it earns nothing.";async function be(e,t){try{let n=p(await e.readContract({address:t,abi:w,functionName:"adaptersLength"}));if(n>8n)return;let c=await Promise.all(Array.from({length:Number(n)},(d,o)=>e.readContract({address:t,abi:w,functionName:"adapters",args:[BigInt(o)]})));return(await Promise.all(c.map(d=>e.readContract({address:h(d),abi:v,functionName:"marketIdsLength"})))).every(d=>p(d)===0n)}catch{return}}var ce="In-kind exits transfer supported market positions rather than cash; use the project in_kind_exit tool.";function ge(e,t,n,c,a=ce){return{name:t,inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(d,o)=>{try{if(D(o),Object.keys(d).length)throw new r("Vault details takes no arguments.");let i=e.clientFor(x);if(await i.getChainId()!==x)throw new r("Vault details requires chain 4663.");let l=await i.readContract({address:n,abi:L(["function asset() view returns (address)"]),functionName:"asset"});if(h(l)!==g(c.address))throw new r("The vault does not use the pinned underlying asset.");let u=await ae(i,n,c),[s,C,A,N]=await Promise.all(["performanceFee","managementFee","owner","curator"].map(f=>i.readContract({address:n,abi:w,functionName:f,blockNumber:u.blockNumber}))),P={...c,address:g(c.address)};return{vault:n,chainId:x,blockNumber:u.blockNumber.toString(),asset:P,owner:h(A),curator:h(N),idleAssets:u.idle.toString(),normalCapacityAssets:u.normalCapacity.toString(),markets:u.markets.map(f=>({marketId:f.id,adapter:f.adapter,suppliedAssets:f.supplied.toString(),marketLiquidityAssets:f.liquidity.toString(),capacityAssets:f.capacity.toString(),liquidityMarket:f.normal,penaltyWad:f.penalty.toString()})),fees:{performanceFeeWad:p(s).toString(),managementFeePerSecondWad:p(C).toString(),scale:I.toString()},apy:null,apyStatus:"This onchain snapshot does not include APY. Use the module analytics tool for indexed historical APY; maxRate is an accrual ceiling.",capacityCaveat:`Snapshot estimates; gates, price accrual, liquidity and penalties can change. Preview the exact action. Force exits may leave share rounding dust. ${a}`}}catch(i){throw new r(e.plainError(i))}}}}function ke(e,t){return`Force-exit estimate: position ${e.requestedAssets} ${t} base units; penalty ${e.penaltyAssets}; net estimate ${e.requestedAssets-e.penaltyAssets}; effective penalty ${T(e.penaltyAssets*10000n,e.requestedAssets)} bps (rounded up). Penalty limit is a local preview check, not a calldata bound. Re-preview before signing and recheck positions for rounding dust.`}function xe(e,t,n,c,a){let d=(i,l)=>e.filter(u=>u.token.chainId===x&&u.token.address.toLowerCase()===i.toLowerCase()).reduce((u,s)=>{if(s.token.decimals!==l||!/^-?\d+$/.test(s.amount))throw new r("Invalid force-exit preview metadata.");return u+BigInt(s.amount)},0n),o=-d(t,18);if(o<=0n||o>n||d(g(a.address),a.decimals)<c)throw new r("The force-exit preview exceeds the share balance or returns less than minAmountOut.")}export{w as a,p as b,he as c,ae as d,de as e,we as f,ye as g,be as h,ge as i,ke as j,xe as k};
|
|
1
|
+
import{a as D}from"./43LI5NKJ.js";import{b as Q}from"./IX3GZMTM.js";import{b as x,j as J}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as se,encodeAbiParameters as Z,encodeFunctionData as F,erc20Abi as O,getAddress as g,keccak256 as ee,parseAbi as L,parseAbiParameters as oe,zeroAddress as te}from"viem";var I=10n**18n,$=(1n<<256n)-1n,q=g(J[x].morpho.morpho_blue.address),_=oe("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),w=L(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function forceDeallocatePenalty(address) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function owner() view returns (address)","function curator() view returns (address)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function forceDeallocate(address adapter,bytes data,uint256 assets,address onBehalf) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function multicall(bytes[] data)"]),v=L(["function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)"]),ne=L(["function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),M=(e,t)=>e<t?e:t,T=(e,t)=>(e+t-1n)/t;function p(e){if(typeof e!="bigint"||e<0n||e>$)throw new r("Invalid Morpho V2 integer read.");return e}function he(e){if(typeof e!="string")throw new r("Provide maxPenaltyAssets as a USDG base-unit integer string, including 0 for no penalty.");let t=Q(e);if(t>$)throw new r("Penalty limit exceeds uint256.");return t}function h(e){if(typeof e!="string")throw new r("Invalid Morpho V2 address read.");return D(e),g(e)}async function ae(e,t,n){if(await e.getChainId()!==x||n.chainId!==x)throw new r("Vault exit requires chain 4663.");let c=await e.getBlockNumber({cacheTime:0}),a=(m,y,k,S=[])=>e.readContract({address:m,abi:y,functionName:k,args:S,blockNumber:c}),[d,o,i,l,u]=await Promise.all([a(t,w,"adaptersLength"),a(t,w,"liquidityAdapter"),a(t,w,"liquidityData"),a(g(n.address),O,"balanceOf",[t]),a(g(n.address),O,"balanceOf",[q])]);if(p(d)!==1n)throw new r("Force exit requires exactly one verified MorphoMarketV1AdapterV2. This vault needs a separately qualified adapter plan.");let s=h(await a(t,w,"adapters",[0n])),C=h(o);if(C!==te&&C!==s)throw new r("The liquidity adapter is not the supported market adapter.");let[A,N,P,f,B]=await Promise.all([a(s,v,"parentVault"),a(s,v,"asset"),a(s,v,"morpho"),a(s,v,"marketIdsLength"),a(t,w,"forceDeallocatePenalty",[s])]);if(h(A)!==g(t)||h(N)!==g(n.address)||h(P)!==q)throw new r("The adapter does not match this vault and pinned Morpho Blue deployment.");let b=p(f);if(b>64n)throw new r("The adapter market inventory exceeds this reader\u2019s supported size.");let E=p(B);if(E>I/50n)throw new r("The force-deallocation penalty exceeds the documented 2% maximum.");let H;if(C!==te){if(typeof i!="string")throw new r("Invalid liquidity-market data.");let[m]=se(_,i);H=ee(Z(_,[m])).toLowerCase()}let V=await Promise.all(Array.from({length:Number(b)},(m,y)=>a(s,v,"marketIds",[BigInt(y)])));if(V.some(m=>typeof m!="string"||!/^0x[0-9a-f]{64}$/i.test(m))||new Set(V.map(m=>String(m).toLowerCase())).size!==V.length)throw new r("The adapter returned an invalid or duplicate market ID.");let R=await Promise.all(V.map(async m=>{let y=m,[k,S,ie]=await Promise.all([a(q,ne,"idToMarketParams",[y]),a(q,ne,"market",[y]),a(s,v,"expectedSupplyAssets",[y])]);if(!Array.isArray(k)||k.length!==5||!Array.isArray(S)||S.length!==6)throw new r("Invalid Morpho market state.");let z={loanToken:h(k[0]),collateralToken:h(k[1]),oracle:h(k[2]),irm:h(k[3]),lltv:p(k[4])},j=Z(_,[z]);if(ee(j).toLowerCase()!==y.toLowerCase()||z.loanToken!==g(n.address))throw new r("Morpho market identity or loan asset does not match the vault.");let G=p(S[0]),X=p(S[2]);if(X>G)throw new r("Invalid Morpho market liquidity.");let Y=p(ie),K=G-X;return{id:y,adapter:s,data:j,supplied:Y,liquidity:K,capacity:M(Y,K),penalty:E,normal:y.toLowerCase()===H}})),U=p(l),W=p(u),re=U+M(W,R.filter(m=>m.normal).reduce((m,y)=>m+y.capacity,0n));return{vault:t,blockNumber:c,idle:U,blueCash:W,normalCapacity:re,markets:R}}function de(e,t){if(t<=0n||t>$)throw new r("Force exit needs a positive position value.");let n=t>e.normalCapacity?t-e.normalCapacity:0n,c=[],a=e.blueCash-(e.normalCapacity-e.idle);for(let d of e.markets.filter(o=>!o.normal).sort((o,i)=>o.capacity===i.capacity?o.id.localeCompare(i.id):o.capacity>i.capacity?-1:1)){if(n===0n)break;let o=M(d.capacity,a);if(o===0n)continue;let i=s=>s+T(s*d.penalty,I),l=o;i(o)>=n&&(l=T(n*I,I+d.penalty),l>0n&&i(l-1n)>=n&&(l-=1n),l=M(o,l+(T(t,10000n)||1n)));let u=T(l*d.penalty,I);c.push({...d,amount:l,penaltyAssets:u}),a-=l,n=i(l)>=n?0n:n-i(l)}if(n>0n)throw new r("Underlying market liquidity cannot cover this force exit. Request a partial withdrawal or use a separately supported in-kind exit; force deallocation cannot create liquidity.");return{requestedAssets:t,normalCapacity:e.normalCapacity,legs:c,penaltyAssets:c.reduce((d,o)=>d+o.penaltyAssets,0n)}}async function we(e,t,n,c,a,d,o){let i=await ae(t,n,o),l=p(await t.readContract({address:n,abi:O,functionName:"balanceOf",args:[c],blockNumber:i.blockNumber}));if(a<=0n||a>l)throw new r("The fresh share balance cannot cover this exit.");let u=p(await t.readContract({address:n,abi:w,functionName:"previewRedeem",args:[a],blockNumber:i.blockNumber})),s=de(i,u);if(s.penaltyAssets>d)throw new r("The force-exit penalty exceeds maxPenaltyAssets. Inspect a fresh plan before authorizing a larger penalty.");let A=(await Promise.all(s.legs.map(b=>t.readContract({address:n,abi:w,functionName:"previewWithdraw",args:[b.penaltyAssets],blockNumber:i.blockNumber})))).reduce((b,E)=>b+p(E),0n);if(A>=a)throw new r("The penalty would consume the share balance.");let N=a-A,P=s.legs.map(b=>F({abi:w,functionName:"forceDeallocate",args:[b.adapter,b.data,b.amount,c]})),f=F({abi:w,functionName:"redeem",args:[N,c,c]});return P.push(f),{tx:e.unsignedTx({to:n,chainId:x,value:"0",data:s.legs.length?F({abi:w,functionName:"multicall",args:[P]}):f,description:`Exit this wallet\u2019s Morpho V2 shares; estimated penalty ${s.penaltyAssets} ${o.symbol} base units. No approvals.`}),plan:s,penaltyShares:A,redeemShares:N,blockNumber:i.blockNumber}}var ye="This vault lists no lending markets right now, and Morpho's index shows 0% over this window. On these numbers it earns nothing.";async function be(e,t){try{let n=p(await e.readContract({address:t,abi:w,functionName:"adaptersLength"}));if(n>8n)return;let c=await Promise.all(Array.from({length:Number(n)},(d,o)=>e.readContract({address:t,abi:w,functionName:"adapters",args:[BigInt(o)]})));return(await Promise.all(c.map(d=>e.readContract({address:h(d),abi:v,functionName:"marketIdsLength"})))).every(d=>p(d)===0n)}catch{return}}var ce="In-kind exits transfer supported market positions rather than cash; use the project in_kind_exit tool.";function ge(e,t,n,c,a=ce){return{name:t,inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(d,o)=>{try{if(D(o),Object.keys(d).length)throw new r("Vault details takes no arguments.");let i=e.clientFor(x);if(await i.getChainId()!==x)throw new r("Vault details requires chain 4663.");let l=await i.readContract({address:n,abi:L(["function asset() view returns (address)"]),functionName:"asset"});if(h(l)!==g(c.address))throw new r("The vault does not use the pinned underlying asset.");let u=await ae(i,n,c),[s,C,A,N]=await Promise.all(["performanceFee","managementFee","owner","curator"].map(f=>i.readContract({address:n,abi:w,functionName:f,blockNumber:u.blockNumber}))),P={...c,address:g(c.address)};return{vault:n,chainId:x,blockNumber:u.blockNumber.toString(),asset:P,owner:h(A),curator:h(N),idleAssets:u.idle.toString(),normalCapacityAssets:u.normalCapacity.toString(),markets:u.markets.map(f=>({marketId:f.id,adapter:f.adapter,suppliedAssets:f.supplied.toString(),marketLiquidityAssets:f.liquidity.toString(),capacityAssets:f.capacity.toString(),liquidityMarket:f.normal,penaltyWad:f.penalty.toString()})),fees:{performanceFeeWad:p(s).toString(),managementFeePerSecondWad:p(C).toString(),scale:I.toString()},apy:null,apyStatus:"This onchain snapshot does not include APY. Use the module analytics tool for indexed historical APY; maxRate is an accrual ceiling.",capacityCaveat:`Snapshot estimates; gates, price accrual, liquidity and penalties can change. Preview the exact action. Force exits may leave share rounding dust. ${a}`}}catch(i){throw new r(e.plainError(i))}}}}function ke(e,t){return`Force-exit estimate: position ${e.requestedAssets} ${t} base units; penalty ${e.penaltyAssets}; net estimate ${e.requestedAssets-e.penaltyAssets}; effective penalty ${T(e.penaltyAssets*10000n,e.requestedAssets)} bps (rounded up). Penalty limit is a local preview check, not a calldata bound. Re-preview before signing and recheck positions for rounding dust.`}function xe(e,t,n,c,a){let d=(i,l)=>e.filter(u=>u.token.chainId===x&&u.token.address.toLowerCase()===i.toLowerCase()).reduce((u,s)=>{if(s.token.decimals!==l||!/^-?\d+$/.test(s.amount))throw new r("Invalid force-exit preview metadata.");return u+BigInt(s.amount)},0n),o=-d(t,18);if(o<=0n||o>n||d(g(a.address),a.decimals)<c)throw new r("The force-exit preview exceeds the share balance or returns less than minAmountOut.")}export{w as a,p as b,he as c,ae as d,de as e,we as f,ye as g,be as h,ge as i,ke as j,xe as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as p,c as F,d as E}from"./5PNFV7HH.js";import{d as rt,f as it,g as st}from"./LD3A2KLN.js";import{a as ot}from"./7WXAS54T.js";import{a as H}from"./43LI5NKJ.js";import{g as nt,i as et}from"./NWNYJ26T.js";import{b as Y,c as tt}from"./IX3GZMTM.js";import{b as c,e as Z,j as O}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{a as T}from"./JXOEJPJ4.js";import{encodeFunctionData as dt,erc20Abi as ut,getAddress as a,parseAbi as xt}from"viem";var Rt="hookr",l=a(O[4663].hookr.HookrLimitOrders.address),Ct=a(O[4663].hookr.HookrRoot.address),Et=a(O[4663].hookr.HookrRouter.address),Dt=a(O[4663].hookr.HookrForwarder.address),Pt=a(O[4663].hookr.PoolManager.address),Lt=a(O[4663].hookr.HOOKR_Token.address),q="0x0000000000000000000000000000000000000000",Nt="0x000000000000000000000000000000000000dEaD",at=(1n<<128n)-1n,Ft=new Set([q.toLowerCase(),Nt.toLowerCase(),l.toLowerCase(),Et.toLowerCase(),Dt.toLowerCase(),Pt.toLowerCase(),Ct.toLowerCase()]),B=xt(["function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function fill(uint256 orderId) returns (uint256 amountOut)","function claimBounty(address to) returns (uint256 amount)","function bountyOf(address keeper) view returns (uint256)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)"]);function _t(t){let n=t.toLowerCase();return n===q.toLowerCase()||n===ot.toLowerCase()}function vt(t,n,i){let r=n.trim();if(r.startsWith("-")){let u=r.slice(1),o=t(u,i);return o==="0"?"0":`-${o}`}return t(r,i)}function sn(t,n,i){return tt(t,n,i)}function ct(t,n){return!t.changes||t.changes.length===0?"no net ERC-20/native transfer delta on caller":t.changes.map(i=>`${vt(n,i.amount,i.token.decimals)} ${T(i.token.symbol)} (${i.token.address})`).join(", ")}function qt(t){if(typeof t=="bigint"){if(t<=0n)throw new s("Hookr orderId must be a positive integer.");return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<=0)throw new s("Hookr orderId must be a positive integer.");return BigInt(t)}if(typeof t=="string"&&/^\d+$/.test(t.trim())){let n=BigInt(t.trim());if(n<=0n)throw new s("Hookr orderId must be a positive integer.");return n}throw new s("Provide a positive integer Hookr orderId.")}function lt(t){if(t==null)return c;if(typeof t!="number"||!Number.isSafeInteger(t)||t!==c)throw new s(`Hookr limit orders are only supported on chain ${c}.`);return c}function Mt(t){switch(t){case 0:return"None";case 1:return"Open";case 2:return"Filled";case 3:return"Cancelled";default:return"Unknown"}}function zt(t){if(Array.isArray(t)){let[n,i,r,u,o,d,k,m,b,e,y]=t;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:i,createdAt:r,expiry:u,zeroForOne:!!o,status:d,recipient:k,amountIn:BigInt(m),minAmountOut:BigInt(b),bounty:BigInt(e),sqrtPriceLimitX96:BigInt(y)}}if(t&&typeof t=="object"){let n=t;if(n.key&&typeof n.key=="object")return{key:{currency0:n.key.currency0,currency1:n.key.currency1,fee:Number(n.key.fee),tickSpacing:Number(n.key.tickSpacing),hooks:n.key.hooks},owner:n.owner,createdAt:n.createdAt,expiry:n.expiry,zeroForOne:!!n.zeroForOne,status:n.status,recipient:n.recipient,amountIn:BigInt(n.amountIn),minAmountOut:BigInt(n.minAmountOut),bounty:BigInt(n.bounty),sqrtPriceLimitX96:BigInt(n.sqrtPriceLimitX96)}}throw new s("HookrLimitOrders returned a malformed order tuple.")}function Kt(t){if(Array.isArray(t)&&t.length>=2)return{fillable:!!t[0],amountOut:BigInt(t[1])};if(t&&typeof t=="object"&&"fillable"in t&&"amountOut"in t){let n=t;return{fillable:!!n.fillable,amountOut:BigInt(n.amountOut)}}throw new s("HookrLimitOrders returned a malformed quoteFill response.")}function jt(t){if(Array.isArray(t)&&t.length>=3)return{minBounty:BigInt(t[0]),defaultBounty:BigInt(t[1]),maxBounty:BigInt(t[2])};if(t&&typeof t=="object"&&"minBounty"in t&&"defaultBounty"in t&&"maxBounty"in t){let n=t;return{minBounty:BigInt(n.minBounty),defaultBounty:BigInt(n.defaultBounty),maxBounty:BigInt(n.maxBounty)}}throw new s("HookrLimitOrders returned a malformed bountyBounds response.")}async function mt(t,n,i=c){if(i!==c)throw new s(`Unsupported token chain ${i}; Hookr requires chain ${c}.`);if(_t(n))return{...p,chainId:i};H(n);let r=a(n),u=r.toLowerCase();if(u===F.address.toLowerCase())return{address:r,symbol:F.symbol,decimals:Z,chainId:i};if(u===E.address.toLowerCase())return{address:r,symbol:E.symbol,decimals:E.decimals,chainId:i};if(u===Lt.toLowerCase())return{address:r,symbol:"HOOKR",decimals:18,chainId:i};let[o,d]=await Promise.all([t.readContract({address:r,abi:ut,functionName:"symbol"}),t.readContract({address:r,abi:ut,functionName:"decimals"})]),k=typeof o=="string"&&o.trim()?o.trim():r,m=Number(d);if(!Number.isInteger(m)||m<0||m>255)throw new s(`Invalid token decimals for ${r} on chain ${i}.`);return{address:r,symbol:k,decimals:m,chainId:i}}async function Ut(t){if(typeof t.getBlock!="function")throw new s("Cannot read the latest block timestamp for Hookr order expiry.");let n=await t.getBlock().catch(()=>{throw new s("Cannot read the latest block timestamp for Hookr order expiry.")});if(!n||typeof n.timestamp!="bigint"||n.timestamp<=0n)throw new s("Hookr requires a usable latest block timestamp to check order expiry.");return n.timestamp}function _(t,n=[]){let i=et(t,"Provide a valid recipient wallet address."),r=i.toLowerCase();if(Ft.has(r)||n.some(u=>u.toLowerCase()===r))throw new s(`Recipient ${i} is a reserved protocol or zero address (invalid recipient).`);return i}function yt(t){if(t.minBountyEth!==void 0||t.minAmountOutDecimal!==void 0||t.rounding!==void 0)throw new s("Use minBounty and minAmountOut as base-unit integer strings.")}function v(t,n){if(t!==void 0){if(typeof t!="string"||!/^\d+$/.test(t))throw new s(`Provide ${n} as a base-unit integer string.`);return Y(t)}}function Wt(t){return{name:"hookr_fill",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"HookrLimitOrders orderId as a positive integer string."},minBounty:{type:"string",description:"Optional minimum keeper bounty in wei (decimal base-unit string)."},minAmountOut:{type:"string",description:"Optional quote pre-check only, in token base-unit integer strings. Not enforced on chain: fill(uint256) enforces only the order minAmountOut."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},required:["orderId"],additionalProperties:!1},async execute(n,i){try{yt(n),H(i);let r=a(i),u=lt(n.chainId),o=qt(n.orderId),d=t.clientFor(u),[k,m,b]=await Promise.all([d.readContract({address:l,abi:B,functionName:"getOrder",args:[o]}),d.readContract({address:l,abi:B,functionName:"quoteFill",args:[o]}),Ut(d)]),e=zt(k),y=Number(e.status),h=Mt(y);if(y===0||nt(e.owner,q))throw new s(`Hookr order #${o} does not exist.`);if(y!==1)throw new s(`Hookr order #${o} is not open (current status: ${h}).`);let A=BigInt(e.expiry);if(A<b)throw new s(`Hookr order #${o} is expired (expiry ${A} < current timestamp ${b}).`);let f=Number(e.key.tickSpacing),x=Number(e.key.fee);if(!Number.isInteger(f)||f<=0)throw new s(`Hookr order #${o} has an invalid pool tickSpacing (${f}).`);if(e.amountIn<=0n||e.amountIn>at)throw new s(`Hookr order #${o} has an invalid amountIn (${e.amountIn}).`);if(e.minAmountOut<=0n||e.minAmountOut>at)throw new s(`Hookr order #${o} has an invalid minAmountOut (${e.minAmountOut}).`);let D=a(e.key.hooks);_(e.recipient,[D]);let bt=await d.readContract({address:l,abi:B,functionName:"bountyBounds",args:[{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:x,tickSpacing:f,hooks:D},e.zeroForOne,e.amountIn,e.minAmountOut]}),w=jt(bt),P=v(n.minBounty,"minBounty"),z=P!==void 0&&P>w.minBounty?P:w.minBounty;if(e.bounty<z)throw new s(`Hookr order #${o} is underbounty: order bounty (${e.bounty} wei) is below the required keeper bounty (${z} wei).`);if(e.bounty>w.maxBounty)throw new s(`Hookr order #${o} bounty (${e.bounty} wei) exceeds maximum bounty bound (${w.maxBounty} wei).`);let I=Kt(m),ft=e.zeroForOne?e.key.currency0:e.key.currency1,gt=e.zeroForOne?e.key.currency1:e.key.currency0,[R,g]=await Promise.all([mt(d,ft,u),mt(d,gt,u)]),$=v(n.minAmountOut,"minAmountOut"),K=$!==void 0&&$>e.minAmountOut?$:e.minAmountOut;if(!I.fillable||I.amountOut<=0n||I.amountOut<K)throw new s(`Hookr order #${o} is not executable: quoted output (${I.amountOut} base units of ${g.address}) does not meet minimum output (${K} base units).`);let j=dt({abi:B,functionName:"fill",args:[o]}),pt=t.formatAmount(e.amountIn.toString(),R.decimals),kt=t.formatAmount(I.amountOut.toString(),g.decimals),At=t.formatAmount(e.minAmountOut.toString(),g.decimals),L=t.formatAmount(e.bounty.toString(),18),wt=$===void 0?"":` Caller minAmountOut ${$} base units is a quote pre-check only, not enforced on chain; fill(uint256) enforces the order minimum of ${e.minAmountOut} base units.`,N=`Fill Hookr order #${o}: maker's escrow pays ${pt} ${T(R.symbol)} (${e.amountIn} base units of ${R.address}); net output goes to ${a(e.recipient)} (quoted ${kt} ${T(g.symbol)}, order minimum ${At} ${T(g.symbol)}, ${e.minAmountOut} base units of ${g.address}). The filler sends no tokens or ETH (value 0), pays gas, and accrues ${L} ETH (${e.bounty} wei) bounty to ${r}, payable only via claimBounty. Pool tickSpacing ${f}; expiry ${A} inclusive.${wt}`,U=await it(t,o),Ot=await d.estimateGas({account:r,to:l,data:j,value:0n}),Bt=rt(Ot,U);if(U<=0n)throw new s("Hookr fill gas floor is unavailable.");let S=await st(d,Bt,e.bounty),C=BigInt(S.netWei),ht=`${C<0n?"-":""}${t.formatAmount((C<0n?-C:C).toString(),18)}`,W=`Reward ${L} ETH; gas limit ${S.gasLimit}, gas ceiling at current gas price ${t.formatAmount(S.gasCostWei,18)} ETH, estimated net ${ht} ETH (excludes the later bounty claim gas). Bounty is paid only on success; someone may get there first.`,It=`Reward ${L} ETH; gas limit ${S.gasLimit} (the later bounty claim costs its own gas). Bounty is paid only on success; someone may get there first.`,X={...t.unsignedTx({to:l,data:j,value:"0",chainId:u,description:`${N} ${W}`}),gasLimit:S.gasLimit},G=await t.preview([X],r),St=ct(G,t.formatAmount),V={token:R,amount:e.amountIn.toString()},Q={token:g,amount:e.minAmountOut.toString()},$t={token:g,amount:I.amountOut.toString()},J={token:{...p,chainId:u},amount:e.bounty.toString()},Tt={orderId:o.toString(),key:{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:x,tickSpacing:f,hooks:D},owner:a(e.owner),recipient:a(e.recipient),createdAt:BigInt(e.createdAt).toString(),expiry:A.toString(),zeroForOne:e.zeroForOne,status:y,statusLabel:h,amountIn:V,minAmountOut:Q,bounty:J,sqrtPriceLimitX96:e.sqrtPriceLimitX96.toString()},Ht={minBounty:{token:{...p,chainId:u},amount:w.minBounty.toString()},defaultBounty:{token:{...p,chainId:u},amount:w.defaultBounty.toString()},maxBounty:{token:{...p,chainId:u},amount:w.maxBounty.toString()}};return{txs:[X],summary:`${N} ${W} Preview deltas: ${St}.`,consent:{summary:`${N} ${It}`,rewardWei:e.bounty.toString(),facts:{orderId:o.toString(),rewardWei:e.bounty.toString(),gasLimit:S.gasLimit}},preview:G,orderId:o.toString(),fillable:!0,amountIn:V,minAmountOut:Q,quotedAmountOut:$t,bounty:J,bountyBounds:Ht,order:Tt}}catch(r){throw new s(t.plainError(r))}}}}function Xt(t){return{name:"hookr_claim_bounty",inputSchema:{type:"object",properties:{to:{type:"string",description:"Optional recipient address for the claimed native ETH bounty (must be the signing wallet)."},minBounty:{type:"string",description:"Optional minimum claimable bounty in wei (decimal base-unit string)."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},additionalProperties:!1},async execute(n,i){try{yt(n),H(i);let r=a(i),u=lt(n.chainId),o=n.to!==void 0&&n.to!==null?_(String(n.to)):_(r);if(o!==r)throw new s("Hookr bounty recipient must be the signing wallet.");let k=await t.clientFor(u).readContract({address:l,abi:B,functionName:"bountyOf",args:[r]}),m=BigInt(k);if(m<=0n)throw new s(`No claimable Hookr keeper bounty for ${r}.`);let b=v(n.minBounty,"minBounty");if(b!==void 0&&m<b)throw new s(`Claimable Hookr bounty (${m} wei) is below the requested minimum (${b} wei).`);let e=dt({abi:B,functionName:"claimBounty",args:[o]}),y=t.formatAmount(m.toString(),18),h=t.unsignedTx({to:l,data:e,value:"0",chainId:u,description:`Claim ${y} ETH (${m} wei) of accrued Hookr keeper bounty from ${l} to ${o}.`}),A=await t.preview([h],r),f=ct(A,t.formatAmount),x={token:{...p,chainId:u},amount:m.toString()};return{txs:[h],summary:`Claim ${y} ETH (${m} wei) Hookr keeper bounty to ${o}. Preview deltas: ${f}.`,preview:A,recipient:o,claimableBounty:x}}catch(r){throw new s(t.plainError(r))}}}}async function Gt(t,n){H(n);let i=a(n),r=t.clientFor(c);try{let u=await r.readContract({address:l,abi:B,functionName:"bountyOf",args:[i]}),o=BigInt(u);if(o<=0n)return[];let d=t.formatAmount(o.toString(),18);return[{module:Rt,id:`hookr:bounty:${i.toLowerCase()}`,chainId:c,assets:[{token:{...p,chainId:c},amount:o.toString()}],description:`Hookr claimable keeper bounty (${d} ETH)`}]}catch(u){throw new s(t.plainError(u))}}var M=t=>({tools:[Wt(t),Xt(t)],positions:n=>Gt(t,n)}),un=M,an=M,mn=M;export{Rt as a,l as b,Ct as c,Et as d,Dt as e,Pt as f,Lt as g,B as h,vt as i,sn as j,Wt as k,Xt as l,Gt as m,M as n,un as o,an as p,mn as q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as R}from"./G2LAO23N.js";import{C as X,H as Y,I as M,L as Z,a as g,z as C}from"./HRGLFGFL.js";import{a as B,g as E}from"./3RGED2KO.js";import{a as W}from"./66F5ZH34.js";import{f as J,g as D}from"./NWNYJ26T.js";import{b as Q,d as V}from"./IX3GZMTM.js";import{b as p}from"./EWZFZUVF.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as ne,erc20Abi as ie,getAddress as w,parseAbi as re}from"viem";var ee=re(["function fill(uint256 orderId) returns (uint256)","function fillGasFloor(uint256 orderId) view returns (uint256)"]),N={type:"string",pattern:"^[1-9][0-9]*$"},oe={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},te={type:"string",enum:["buy","sell"],description:R.enumValues({buy:"spend the pool quote token to receive the listed token",sell:"spend the listed token to receive the quote token"})},se={cursor:{...N,description:"Order ID to start from, scanning downward (newest first). Use nextCursor from the previous page; omit for the latest order."},limit:{type:"integer",minimum:1,maximum:32,description:"Maximum number of order IDs to scan in this page, 1 to 32. Default 16."}};function T(n,h){if(typeof n!="string"||!/^[1-9][0-9]*$/.test(n)||n.length>78||BigInt(n)>=1n<<256n)throw new i(`Provide ${h} as a positive decimal integer string.`);return BigInt(n)}function S(n){return J(n,"Hookr returned an invalid read response. Retry later.")}function H(n,h,e,o){return{name:n,inputSchema:{type:"object",description:`Read ${n.replace("hookr_","Hookr ")}. No signature or transaction.`,properties:h,required:e,additionalProperties:!1},execute:async(t,a)=>{if(Object.keys(t).some(d=>!Object.hasOwn(h,d))||e.some(d=>t[d]===void 0))throw new i(`Provide the documented arguments for ${n}.`);return o(t,a)}}}function $(n){if(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))throw new i("Provide a 32-byte Hookr poolId.");return n}function F(n,h){let e=S(n),o=S(e.key);if(typeof o.fee!="number"||!Number.isInteger(o.fee)||o.fee<0||o.fee>16777215||typeof o.tickSpacing!="number"||!Number.isInteger(o.tickSpacing)||o.tickSpacing<=0||o.tickSpacing>8388607)throw new i("Hookr pool key is invalid.");let t={currency0:w(String(o.currency0)),currency1:w(String(o.currency1)),fee:o.fee,tickSpacing:o.tickSpacing,hooks:w(String(o.hooks))},a=h??$(e.poolId);if(BigInt(t.currency0)>=BigInt(t.currency1)||!D(X(t),a))throw new i("Hookr pool key does not match its PoolId.");let d=S(e.token),s=S(e.quote),u=r=>{let k=w(String(r.address));if(typeof r.symbol!="string"||!r.symbol.trim()||typeof r.decimals!="number"||!Number.isInteger(r.decimals)||r.decimals<0||r.decimals>255||![t.currency0,t.currency1].includes(k))throw new i("Hookr listed token metadata is invalid.");return{...r,address:k,chainId:p}},c=u(d),l=u(s);if(c.address===l.address)throw new i("Hookr listed token pair is invalid.");return{...e,poolId:a,key:t,token:c,quote:l}}var O=E;function be(n){let h=e=>H(e?"hookr_orders":"hookr_open_orders",se,[],async(o,t)=>{let a=o.limit??16;if(typeof a!="number"||!Number.isInteger(a)||a<1||a>32)throw new i("Hookr page limit must be an integer from 1 to 32.");let d=n.clientFor(p),s=await d.getBlock();if(typeof s.number!="bigint"||typeof s.timestamp!="bigint"||s.timestamp<=0n)throw new i("Hookr order reads need a valid chain block and timestamp.");let u=new Proxy(Z(d),{get(b,m,f){return m==="readContract"?y=>b.readContract({...y,blockNumber:s.number}):Reflect.get(b,m,f)}}),c={...n,clientFor:()=>u},l=await u.readContract({address:g,abi:C,functionName:"lastOrderId"});if(typeof l!="bigint"||l<0n)throw new i("Could not read the last Hookr order ID. Coverage is unknown.");let r=o.cursor===void 0?l:T(o.cursor,"cursor");if(r>l)throw new i("Hookr cursor exceeds the latest order ID. Restart pagination.");let k=[],x=new Map,A=r,I=r>BigInt(a)?r-BigInt(a):0n;for(;r>I;){let b=r--,m=Y(await u.readContract({address:g,abi:C,functionName:"getOrder",args:[b]}));if(Number(m.status)===0||BigInt(m.owner)===0n)throw new i(`Hookr order #${b} is missing. Coverage is unknown.`);if(e?!D(m.owner,t):Number(m.status)!==1)continue;let f=await M(c,b,{order:m,tokens:x});if(e){k.push(f);continue}let y=null,G=null,z=null,L=null,U=BigInt(f.expiry)<s.timestamp,j=f.fillable&&!U;if(j)try{let P=await u.readContract({address:g,abi:ee,functionName:"fillGasFloor",args:[BigInt(f.orderId)]}),_=await d.estimateGas({account:t,to:g,data:ne({abi:ee,functionName:"fill",args:[BigInt(f.orderId)]}),blockNumber:s.number}),v=await d.getGasPrice();if(typeof P!="bigint"||P<0n||typeof _!="bigint"||_<=0n||typeof v!="bigint"||v<0n)throw new Error("Invalid gas data");let K=(P*6n+4n)/5n,q=_>K?_:K;y=q.toString(),G=v.toString(),z=(q*v).toString(),L=(BigInt(f.bounty)-q*v).toString()}catch{}k.push({...f,fillable:j,expired:U,economics:{gasLimit:y,gasPrice:G,estimatedGasCost:z,bountyLessEstimatedGas:L,note:"Estimate only; excludes bounty claim gas and competition. Recheck the fill preview."}})}return{chainId:p,book:g,blockNumber:s.number.toString(),chainTime:s.timestamp.toString(),orders:k,scanned:{from:A.toString(),through:(r+1n).toString()},nextCursor:r>0n?r.toString():null,complete:r===0n}});return[h(!1),h(!0),H("hookr_order",{orderId:{...N,description:R.id("Hookr limit order")}},["orderId"],async e=>M(n,T(e.orderId,"orderId"))),H("hookr_pools",{sort:{type:"string",enum:["liquidity","volume","newest"],description:"Sort by USD liquidity, 24-hour volume, or opening block."},includeTests:{type:"boolean",description:"Include pools with test tickers."},agentsOnly:{type:"boolean",description:"Only pools with an agent gate."},token:{type:"string",description:R.address("listed token whose pools to return")},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of pools to return, 1 to 50."},cursor:{type:"string",pattern:"^[0-9]{1,6}$",description:"Paging cursor: the nextCursor from the previous pools page; omit for the first page."}},[],async e=>{if(e.sort!==void 0&&!["liquidity","volume","newest"].includes(String(e.sort)))throw new i("Choose liquidity, volume or newest sorting.");for(let t of["includeTests","agentsOnly"])if(e[t]!==void 0&&typeof e[t]!="boolean")throw new i(`Provide ${t} as a boolean.`);if(e.token!==void 0)try{w(String(e.token))}catch{throw new i("Provide a valid token address.")}if(e.limit!==void 0&&(typeof e.limit!="number"||!Number.isInteger(e.limit)||e.limit<1||e.limit>50))throw new i("Pool page limit must be from 1 to 50.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||!/^[0-9]{1,6}$/.test(e.cursor)))throw new i("Provide the pool nextCursor from the previous page.");let o=await O(n,"hookr_pools",e);if(!Array.isArray(o.pools))throw new i("Hookr pool coverage is unknown. Retry later.");return{...o,pools:o.pools.map(t=>F(t)),chainId:p,source:B}}),H("hookr_pool",{poolId:oe,side:te,amountIn:{...N,description:'Order input amount in base units of the input token (quote token for buy, listed token for sell); read its decimals. Example: "1000000". Give with side and minAmountOut.'},minAmountOut:{...N,description:'Minimum output in base units of the output token (listed token for buy, quote token for sell); read its decimals. Example: "1000000". Give with side and amountIn.'}},["poolId"],async e=>{let o=$(e.poolId),t=[e.side,e.amountIn,e.minAmountOut].some(y=>y!==void 0);if(t&&(e.side!=="buy"&&e.side!=="sell"||e.amountIn===void 0||e.minAmountOut===void 0))throw new i("Provide side, amountIn and minAmountOut together for order-specific bounty bounds.");let a=t?T(e.amountIn,"amountIn"):void 0,d=t?T(e.minAmountOut,"minAmountOut"):void 0;if(a!==void 0&&(a>=1n<<128n||d>=1n<<128n))throw new i("Hookr order amounts must fit uint128 base units.");let s=await O(n,"hookr_pool",{poolId:o}),u=s.listing?F(s.listing,o):void 0,c={...s,...u?{listing:u}:{},chainId:p,source:B};if(!t)return{...c,bountyBounds:{status:"requires-order-terms",note:"The keeper bounty floor depends on the order. Supply side, amountIn and minAmountOut in base units. The batch-1 0.0005 ETH observation is not a permanent floor."}};if(!u)throw new i("Hookr pool key is unavailable; bounty floor is unknown.");let l=u.key,r=S(e.side==="buy"?u.quote:u.token),k=w(String(r.address))===l.currency0,x=n.clientFor(p),A=await x.getBlock(),I=await x.readContract({address:g,abi:C,functionName:"bountyBounds",args:[l,k,a,d],blockNumber:A.number});if(!Array.isArray(I)||I.length!==3||I.some(y=>typeof y!="bigint"||y<0n||y>=1n<<128n))throw new i("Hookr bounty bounds are unavailable; the floor is unknown.");let[b,m,f]=I;return{...c,bountyBounds:{status:"available",blockNumber:A.number.toString(),token:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",symbol:"ETH",decimals:18,chainId:p},minBounty:b.toString(),defaultBounty:m.toString(),maxBounty:f.toString(),effectiveFloor:(b>0n?b:m).toString(),note:"ETH wei for this order at this block. Oak create uses the positive minimum, or the default when minimum is zero; recheck at creation."}}}),H("hookr_quote",{poolId:oe,side:te,amountIn:{...W(),description:'Amount of the input token in base units (quote token for buy, listed token for sell); read its decimals. Example: "1000000" = 1 token with 6 decimals.'}},["poolId","side","amountIn"],async(e,o)=>{let t=$(e.poolId);if(e.side!=="buy"&&e.side!=="sell")throw new i("Hookr side must be buy or sell.");if(typeof e.amountIn!="string"||Q(e.amountIn)<=0n)throw new i("Provide a positive amountIn in base units.");let a=await O(n,"hookr_pool",{poolId:t}),d=F(a.listing,t),s=S(e.side==="buy"?d.quote:d.token),u=w(String(s.address)),c=u==="0x0000000000000000000000000000000000000000"?18:await n.clientFor(p).readContract({address:u,abi:ie,functionName:"decimals"});if(typeof c!="number"||!Number.isInteger(c)||c<0||c>255||typeof s.symbol!="string")throw new i("Hookr input token metadata is unavailable.");let l=V(e.amountIn,c),r=await O(n,"hookr_quote",{poolId:t,side:e.side,amount:l,payer:o}),k=await O(n,"hookr_check_trade",{poolId:t,side:e.side,amount:l,wallet:o});return{chainId:p,source:B,input:{token:{address:u,symbol:s.symbol,decimals:c,chainId:p},amount:e.amountIn},quote:r,check:k,note:"Informational quote. Review pool rules; unknown trade checks do not authorize a trade."}})]}export{be as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as m}from"./RKS3M7L5.js";import{e as c,f as u}from"./UMY6SP7C.js";import{a as i}from"./XSD5NL7J.js";import{decodeAbiParameters as f,encodeAbiParameters as g}from"viem";import{formatUnits as H}from"viem";var T={id:"holder-pot",supported:!0,refusal:"Holder Pot requires the reviewed metered new HookrToken and its explicit pot-directed funding profile."},y=[{type:"uint32"},{type:"uint128"}],p=["epoch","ageCap","boost","sellRule","bounty"];function h(e){let o=c(e,p,p),[t,r,n,s,a]=p.map(l=>Number(u(o[l],8)));if(t>1||r<1||r>56||n>20||s>1||a<1||a>20)throw new i("Holder Pot carrier requires epoch and sellRule 0\u20131, ageCap 1\u201356, boost 0\u201320 and bounty 1\u201320.");return{epoch:t,ageCap:r,boost:n,sellRule:s,bounty:a}}function k(e){let o=h(e);return g(y,[1<<30|1<<21,BigInt(o.epoch)<<45n|BigInt(o.ageCap)<<46n|BigInt(o.boost)<<52n|BigInt(o.sellRule)<<57n|BigInt(o.bounty)<<58n])}function w(e){if(e.length!==130)throw new i("Holder Pot needs exactly two ABI words.");let[o,t]=f(y,e),r=h({epoch:String(t>>45n&1n),ageCap:String(t>>46n&63n),boost:String(t>>52n&31n),sellRule:String(t>>57n&1n),bounty:String(t>>58n&31n)});if(o!==(1<<30|1<<21)||k(Object.fromEntries(Object.entries(r).map(([n,s])=>[n,String(s)]))).toLowerCase()!==e.toLowerCase())throw new i("Holder Pot words are not canonical isolated settings.");return r}function R(e){let o=w(e);return`Holder Pot carrier: epoch ${o.epoch}, age cap ${o.ageCap}, boost ${o.boost}, sell rule ${o.sellRule}, bounty ${o.bounty}; current core validates these legacy fields but does not apply them to payouts or pay a bounty. A separately funded pot pays closed UTC days as floor(day pot \xD7 wallet balance-seconds / total eligible-wallet supply balance-seconds) in quote claims; contract balances earn zero. Swaps process up to 2 days and public pokes up to 16 forward and 16 backward. A pinned metered HookrToken and explicit pot funding are required.`}function $(e,o){if(e<0n||!Number.isInteger(o)||o<2e3||o>5e3)throw new i("Holder Pot funding needs a nonnegative carved charge and protocol share 2000\u20135000 bps.");let t=(e*BigInt(o)+9999n)/10000n;return{protocol:t,pot:e-t}}function C(e,o){let t=c(o,["id","buy","sell"],["id","buy","sell"]);if(t.id!=="holder-pot")throw new i("Choose Hook Block holder-pot.");let r=u(t.buy,8),n=u(t.sell,8),s=(1n<<18n)-1n<<45n;if(!r&&!n||r>100n||n>100n||(e.potEveryNBuys&(1<<21|131071|7<<24))!==0||(e.potMinBuyQuote&s)!==0n)throw new i("Holder Pot needs a positive buy or sell rate of at most 100 and an unoccupied funding carrier.");return{...e,potEveryNBuys:e.potEveryNBuys|1<<30|1<<21|Number(r)|Number(n<<7n)|32768,potMinBuyQuote:e.potMinBuyQuote|1n<<46n|1n<<58n}}function E(e,o){let t=e.potEveryNBuys,r=e.potMinBuyQuote;if(!(t&1<<21)||(t>>14&7)!==2||!(t&16383)||(t>>24&7)!==0||(r>>45n&(1n<<18n)-1n)!==(1n<<1n|1n<<13n))throw new i("Holder Pot funding destination or carrier does not match the supported profile.");return`Holder Pot: buy ${(t&127)*1e3} and sell ${(t>>7&127)*1e3} gross quote pips fund the pot. Each carved charge is floor(total Rules quote fee \xD7 charge pips / final quote-take pips); Hookr ${o} receives ceil(carved charge \xD7 ${e.protocolShareBps}/10000), and the remainder funds the pot, subject to uint128 capacity; excess stays with Hookr. Closed UTC days pay floor(day pot \xD7 wallet balance-seconds / total eligible-wallet supply balance-seconds) as quote claims. Contract balances earn zero. Swaps process up to 2 days; public pokes up to 16 forward and 16 backward. Legacy carrier values are inert and no bounty is paid. The subject must be the pinned metered HookrToken.`}function x(e,o,t=3e3){let r=BigInt(e.protocolShareBps),n=BigInt(Math.max(e.maxFeePips-t,0)),s=r!==0n&&(e.lpBps!==0||e.burnBps!==0||n*r>=10000n||BigInt(e.snipeTaxPips)*r>=10000n);if(o<=0n||s||!(e.potEveryNBuys&m))return null;let a=l=>{let d=BigInt(l)*1000n,b=d*r/10000n;return d+(b<o?o-b:0n)};return{minimum:o,buy:a(e.potEveryNBuys&127),sell:a(e.potEveryNBuys>>7&127)}}function S(e,o,t,r=3e3){let n=x(e,o,r);if(!n)return"";let s=l=>`${l} pips (${H(l,4)}%)`,a=(e.potEveryNBuys&(1<<17|1<<20|1<<22))!==0;return n.buy===n.minimum&&n.sell===n.minimum&&!a?`Hookr ${t} takes ${s(n.minimum)} of every buy and sell, in quote, frozen at launch.`:`Hookr ${t} takes at least ${s(n.minimum)} of every buy and sell, in quote, frozen at launch, even where a block below shows a smaller Hookr share. Including this pool's fixed block charge: total buy take = ${s(n.buy)}, total sell take = ${s(n.sell)}.${a?" Storm Fee, Exit Clock and Sandwich Guard charges, when they apply, come on top of these totals; the Hookr share of them counts toward the minimum.":""}`}export{T as a,k as b,w as c,R as d,$ as e,C as f,E as g,x as h,S as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as k}from"./RKS3M7L5.js";import{a as s}from"./XSD5NL7J.js";import{zeroAddress as B}from"viem";function q(e){let o=e.potEveryNBuys&~k,n=e.potMinBuyQuote;if(o===0&&n===0n){if(e.royaltyTo!==B)throw new s("Hookr payment terms include an unsupported recipient.");return}let d=o&127,l=o>>7&127,c=d!==0||l!==0,u=!!(o&1<<19),a=!!(o&1<<20),p=!!(o&1<<21),f=!!(o&1<<22),h=!!(o&1<<23),w=!!(o&1<<17),y=1<<30|131071|1<<17|1<<19|1<<20|1<<21|1<<22|1<<23;if(o>>>30!==1||(o&~y)!==0||!(c||u||a||p||f||h||w))throw new s("Unsupported or noncanonical packed Hook Block settings.");let r=0n;if(c?d>100||l>100||(o>>14&7)!==(p?2:4):(o>>14&7)!==0)throw new s("Swap Cut supports rates 0\u2013100 and one explicit named recipient.");if(u){r|=(1n<<19n)-1n;let t=n&16383n,i=n>>14n&31n;if(!e.guardEndBlock||!t||i!==0n&&t*10n<16384n)throw new s("Wallet Cap requires a guard and the exact smallest-exponent cap.")}if(a){r|=(1n<<26n)-1n<<19n;let t=n>>19n&127n,i=n>>26n&127n,m=n>>33n&63n,g=n>>39n&1n,x=n>>40n&3n,H=n>>42n&7n;if(!t||t>100n||i>=t||(g===0n?!m:m<3n||m>30n)||x>2n||H!==0n)throw new s("Exit Clock settings exceed the reviewed LP-fee profile.")}if(p&&(r|=(1n<<18n)-1n<<45n,!c||(n>>45n&(1n<<18n)-1n)!==(1n<<1n|1n<<13n)))throw new s("Holder Pot requires an explicit pot-directed charge and canonical inert carrier fields.");if(f){r|=(1n<<22n)-1n<<63n;let t=n>>63n&255n,i=n>>71n&255n;if(!t||t>200n||i>t||(n>>79n&63n)!==0n||e.dynamicFeeSens!==0||t*500n*BigInt(e.protocolShareBps)<10000n)throw new s("Storm Fee supports only tempo 0, LP fees, and no Dynamic Fees block.")}if(h){r|=4095n<<85n;let t=n>>85n&511n,i=n>>94n&7n;if(!e.guardEndBlock||t>300n||i>5n||!(t||i))throw new s("Buy/Sell Block windows require a guard and a positive bounded window.")}if(w){r|=511n<<114n;let t=n>>116n&15n,i=n>>120n&7n;if(t<5n||t>15n||i!==4n)throw new s("Sandwich Guard supports one explicit named recipient and maximum 5\u201315.")}if((n&~r)!==0n)throw new s("Unsupported or inactive packed Hook Block fields.");if((c&&!p||w)!==(e.royaltyTo!==B))throw new s("Packed Hook Block recipient is missing or unbound.");if(e.protocolShareBps<2e3||e.protocolShareBps>5e3)throw new s("Packed Hook Blocks require protocol share 2000\u20135000 bps.");if(BigInt(l)*1000n+(a?(n>>19n&127n)*1000n:0n)+(f?(n>>63n&255n)*500n:0n)+(w?(n>>116n&15n)*10000n:0n)>200000n)throw new s("Combined Hook Block sell charges exceed the core limit of 200000 pips.")}function C(e){let o=e.potEveryNBuys,n=e.potMinBuyQuote,d=BigInt(e.protocolShareBps),l=o&1<<20?(n>>19n&127n)*1000n:0n,c=o&1<<22?(n>>63n&255n)*500n:0n,u=BigInt(o&127)*1000n,a=BigInt(o>>7&127)*1000n,p=o&1<<17?(n>>116n&15n)*10000n:0n;return{lp:l+c,quote:(u>a?u:a)+p+l*d/10000n+c*d/10000n}}export{q as a,C as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as s}from"./
|
|
1
|
+
import{o as s}from"./IR7KDBFU.js";import{formatUnits as c}from"viem";function l(e){return`HoodLock creation fee: ${e.eth} ETH (${e.amount} wei; ${e.usd===null?"USD unavailable: no fresh ETH/USD reference":`approximately $${e.usd} USD`}), not refundable after creation. Paid to ${e.contract}; separate from network gas.`}async function p(e,t,d,r){let o=r===0n?"0":null;if(r>0n)try{let a=await s("ETH",{client:e.clientFor(4663),chainId:4663});BigInt(a.usdE18)>0n&&(o=c(r*BigInt(a.usdE18)/10n**18n,18))}catch{}let n={contract:d,amount:r.toString(),eth:c(r,18),usd:o,refundable:!1},i=l(n);return{...t,summary:`${t.summary} ${i}`,preview:{...t.preview,summary:`${t.preview.summary} ${i}`},protocolFee:n}}export{l as a,p as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./
|
|
1
|
+
import{a as k}from"./OIGTTRN5.js";import{e as P,i as O}from"./5DWQUEBA.js";import{a as g,b as f,f as E,g as S}from"./QP2B7AYX.js";import{a as h,w as M}from"./5677LZOV.js";import{a as y}from"./66F5ZH34.js";import{c as v,g as C}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as l}from"./XSD5NL7J.js";import{encodeFunctionData as c,parseAbi as H,zeroAddress as R}from"viem";var r=H(["function owner() view returns (address)","function feeTo() view returns (address)","function feeToSetter() view returns (address)","function protocolFeeController() view returns (address)","function setFeeTo(address)","function setFeeToSetter(address)","function setOwner(address)","function enableFeeAmount(uint24,int24)","function setFeeProtocol(uint8,uint8)","function collectProtocol(address,uint128,uint128) returns (uint128,uint128)","function transferOwnership(address)","function setProtocolFeeController(address)","function setProtocolFee((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks),uint24)","function collectProtocolFees(address recipient,address currency,uint256 amount) returns (uint256)"]),K=["set_fee_recipient","set_fee_setter","set_owner","enable_fee","set_pool_fee","collect_protocol","set_controller"],V={version:{description:'Uniswap version: "v2" for pairs, "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v2","v3","v4"]},operation:{description:"set_fee_recipient/set_fee_setter: v2 roles; set_owner: owner; enable_fee: v3 tier; set_pool_fee: protocol fees; collect_protocol: collect fees; set_controller: v4 controller.",type:"string",enum:K},target:{...v,description:"Intended fee recipient, fee setter, owner or controller address for the selected administrative operation."},token0:{...v,description:"Lower sorted ERC-20 token address; use WETH for native ETH in v3."},token1:{...v,description:"Higher sorted ERC-20 token address."},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"integer"},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},fee0:{description:"Token0 or zero-for-one protocol fee: v3 divisor 0 (off) or 4\u201310; v4 pips, hundredths of a basis point, from 0 to 1000 (1000 = 0.1%).",type:"integer"},fee1:{description:"Token1 or one-for-zero protocol fee: v3 divisor 0 (off) or 4\u201310; v4 pips, hundredths of a basis point, from 0 to 1000 (1000 = 0.1%).",type:"integer"},currency:{...v,description:"Address of the currency whose protocol fees are collected; the zero address means native ETH."},amount:y('Amount of currency in base units; use currency decimals. Example: "1000000" = 1 currency at 6 decimals.'),amount0Max:y('Maximum amount of token0 in base units; use token0 decimals. Example: "1000000" = 1 token0 at 6 decimals.'),amount1Max:y('Maximum amount of token1 in base units; use token1 decimals. Example: "1000000" = 1 token1 at 6 decimals.'),poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object"}};function G(_){let x=async e=>{let i=_.clientFor(b);if(e==="v2"){let[t,o]=await Promise.all([i.readContract({address:k,abi:r,functionName:"feeToSetter"}),i.readContract({address:k,abi:r,functionName:"feeTo"})]);return{version:e,contract:k,owner:t,feeRecipient:o}}if(e==="v3")return{version:e,contract:P.factory,owner:await i.readContract({address:P.factory,abi:r,functionName:"owner"})};if(e==="v4"){let[t,o]=await Promise.all([i.readContract({address:h,abi:r,functionName:"owner"}),i.readContract({address:h,abi:r,functionName:"protocolFeeController"})]);return{version:e,contract:h,owner:t,controller:o}}throw new l("Provide protocol version v2, v3 or v4.")};return{tools:[{name:"uniswap_protocol_status",inputSchema:{type:"object",additionalProperties:!1,required:["version"],properties:{version:V.version}},async execute(e){return S(e,["version"]),x(e.version)}},{name:"uniswap_protocol_admin",inputSchema:{type:"object",additionalProperties:!1,required:["version","operation"],properties:V},async execute(e,i){let{version:t,operation:o}=e,w=await x(t),I=_.clientFor(b),T=t==="v4"&&["set_pool_fee","collect_protocol"].includes(String(o))?"controller"in w?w.controller:void 0:w.owner;if(!T||!C(T,i))throw new l("The signing wallet does not hold the required Uniswap owner/controller role.");let N=w.contract,s,a,A=()=>{let n=f(e.target);if(n===R)throw new l("Administration target must be nonzero.");return n},d=(n,p,u,m)=>{if(typeof n!="number"||!Number.isInteger(n)||n<u||n>m)throw new l(`${p} must be an integer from ${u} to ${m}.`);return n};if(t==="v2"&&o==="set_fee_recipient")a=["target"],s=c({abi:r,functionName:"setFeeTo",args:[f(e.target)]});else if(t==="v2"&&o==="set_fee_setter")a=["target"],s=c({abi:r,functionName:"setFeeToSetter",args:[A()]});else if(t==="v3"&&o==="set_owner")a=["target"],s=c({abi:r,functionName:"setOwner",args:[A()]});else if(t==="v3"&&o==="enable_fee")a=["fee","tickSpacing"],s=c({abi:r,functionName:"enableFeeAmount",args:[d(e.fee,"fee",0,999999),d(e.tickSpacing,"tickSpacing",1,16383)]});else if(t==="v3"&&["set_pool_fee","collect_protocol"].includes(String(o))){a=["token0","token1","fee",...o==="set_pool_fee"?["fee0","fee1"]:["amount0Max","amount1Max"]];let n=f(e.token0),p=f(e.token1),u=d(e.fee,"fee",0,999999);if(N=await I.readContract({address:P.factory,abi:O,functionName:"getPool",args:[n,p,u]}),N===R)throw new l("No factory-verified v3 pool exists for these tokens and fee.");if(o==="set_pool_fee"){let m=z=>{let F=d(z,"fee divisor",0,10);if(F!==0&&F<4)throw new l("V3 protocol fee divisors must be zero or 4 through 10.");return F};s=c({abi:r,functionName:"setFeeProtocol",args:[m(e.fee0),m(e.fee1)]})}else s=c({abi:r,functionName:"collectProtocol",args:[i,g(e.amount0Max,"amount0Max",128,!0),g(e.amount1Max,"amount1Max",128,!0)]})}else if(t==="v4"&&o==="set_owner")a=["target"],s=c({abi:r,functionName:"transferOwnership",args:[A()]});else if(t==="v4"&&o==="set_controller")a=["target"],s=c({abi:r,functionName:"setProtocolFeeController",args:[f(e.target)]});else if(t==="v4"&&o==="set_pool_fee"){a=["poolKey","fee0","fee1"];let n=M(e.poolKey),p=d(e.fee0,"fee0 pips",0,1e3),u=d(e.fee1,"fee1 pips",0,1e3);s=c({abi:r,functionName:"setProtocolFee",args:[n,p+(u<<12)]})}else if(t==="v4"&&o==="collect_protocol")a=["currency","amount"],s=c({abi:r,functionName:"collectProtocolFees",args:[i,f(e.currency),g(e.amount,"amount",256,!0)]});else throw new l("This operation is not supported by the selected Uniswap protocol version.");return S(e,["version","operation",...a]),E(_,[_.unsignedTx({to:N,data:s,value:"0",chainId:b,description:`Uniswap ${t} protocol administration: ${o}. Role holder ${i}.`})],i,"Privileged protocol operation. Review the exact role/recipient/fee changes. Protocol fee collections pay the signing wallet; no wallet token approval is required.")}}]}}export{r as a,G as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"./43LI5NKJ.js";import{m as b}from"./NWNYJ26T.js";import{b as i,j as w,k as l}from"./
|
|
1
|
+
import{a as y}from"./43LI5NKJ.js";import{m as b}from"./NWNYJ26T.js";import{b as i,j as w,k as l}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{erc20Abi as v,getAddress as u,parseAbi as G}from"viem";var d=10n**27n,I=1000000021979553151239153027n,a=u(w[i].vaults.spark.address),U="https://docs.spark.finance/dev/savings/spark-vaults-v2",g=G(["function asset() view returns (address)","function vsr() view returns (uint256)","function totalAssets() view returns (uint256)","function depositCap() view returns (uint256)","function minVsr() view returns (uint256)","function maxVsr() view returns (uint256)","function convertToAssets(uint256) view returns (uint256)"]);function n(e){return b(e,"Spark returned an invalid unsigned integer.")}function q(e){if(e<d||e>I)throw new c("Spark savings rate is outside the documented bounds.");let r=31536000n,s=e,t=d;for(;r>0n;)r%2n&&(t=t*s/d),r/=2n,r>0n&&(s=s*s/d);return t-d}function j(e){return{name:"spark_details",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(r,s)=>{try{if(y(s),Object.keys(r).length)throw new c("Spark details takes no arguments.");let t=e.clientFor(i);if(await t.getChainId()!==i)throw new c("Spark details requires chain 4663.");let o=await t.getBlockNumber({cacheTime:0}),h=await t.readContract({address:a,abi:g,functionName:"asset",blockNumber:o});if(typeof h!="string"||u(h)!==u(l))throw new c("Spark does not report canonical USDG.");let[k,A,C,D,x,N,R]=await Promise.all([...["vsr","totalAssets","depositCap","minVsr","maxVsr"].map(V=>t.readContract({address:a,abi:g,functionName:V,blockNumber:o})),t.readContract({address:u(l),abi:v,functionName:"balanceOf",args:[a],blockNumber:o}),t.readContract({address:a,abi:v,functionName:"balanceOf",args:[s],blockNumber:o})]),f=n(k),p=n(A),m=n(N),S=n(R),T=n(await t.readContract({address:a,abi:g,functionName:"convertToAssets",args:[S],blockNumber:o}));return{chainId:i,vault:a,blockNumber:o.toString(),asset:{address:u(l),symbol:"USDG",decimals:6,chainId:i},shareToken:{address:a,symbol:"spUSDG",decimals:6,chainId:i},rate:{vsrRay:f.toString(),scale:d.toString(),annualYieldRay:q(f).toString(),secondsPerYear:"31536000",minVsrRay:n(D).toString(),maxVsrRay:n(x).toString(),caveat:"Projection with the current per-second rate held constant; governance can change it. Not a promised return."},totalAssets:p.toString(),idleAssets:m.toString(),depositCapAssets:n(C).toString(),outstandingAssets:(p>m?p-m:0n).toString(),heldShares:S.toString(),positionAssets:T.toString(),backing:{source:U,mechanism:"The permissioned taker deploys liquidity through the Spark Liquidity Layer. totalAssets is share-implied accounting; idle USDG alone funds immediate redemptions.",composition:null,compositionStatus:"Current strategy-by-strategy backing was not measured on this chain; inspect the official Spark app."},risk:["Liquidity deployed by the taker may be unavailable for immediate withdrawal.","Vault upgrades and role-controlled rate/cap changes affect behavior.","Share value and the USDG peg can change; conversion does not prove exit liquidity."]}}catch(t){throw new c(e.plainError(t))}}}}export{q as a,j as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as ee,e as te,f as ne,i as ie,n as re,o as oe}from"./IR7KDBFU.js";import{a as L,d as J,e as Q,f as X,g as F,h as N,i as Y}from"./GV6Z3MET.js";import{a as Z}from"./4P6DRKY3.js";import{a as j,b as z,c as R}from"./CFPJDLTZ.js";import{b as U,j as V}from"./EWZFZUVF.js";import{formatUnits as he,getAddress as ge,parseAbi as ae}from"viem";var b=10n**18n,B=1n<<192n,se=ae(["function slot0() view returns (uint160,int24,uint16,uint16,uint16,uint8,bool)","function liquidity() view returns (uint128)","function getSlot0(bytes32) view returns (uint160,int24,uint24,uint24)","function getLiquidity(bytes32) view returns (uint128)"]),be=ae(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),s=f=>({usdEstimate:null,estimateLabel:"price unavailable",estimateReason:f}),k=f=>`${f.chainId}:${f.address.toLowerCase()}`;async function Ee(f,v,w={}){let P=Number.isFinite(w.budgetMs)?Math.min(3e3,Math.max(0,w.budgetMs)):3e3,C=`Oak stopped pricing after ${P===3e3?"3 seconds":`${P} milliseconds`}`,E=new Map,A=[...new Map(v.map(e=>[k(e.token),e.token])).values()],h=!1,O=0,T=[];async function S(e){if(h)throw new Error(C);if(O>=6?await new Promise(t=>T.push(t)):O++,h)throw new Error(C);try{return await e()}finally{let t=T.shift();t?t():O--}}let q=new Map,H=new Map,$=new Map,M;function g(e){let t=q.get(e);if(!t){let n=f.clientFor(e);t=new Proxy(n,{get(i,r,u){let a=Reflect.get(i,r,u);return["readContract","getCode","multicall"].includes(String(r))?(...d)=>S(async()=>Reflect.apply(a,i,d)):a}}),q.set(e,t)}return t}function y(e){let t=H.get(e);return t||(t=S(()=>g(e).getBlockNumber({cacheTime:0})),H.set(e,t)),t}function I(e,t){return M??=re(e,void 0,t).then(n=>{let i=BigInt(n);if(i<=0n)throw new Error("ETH average unavailable");return i}),M}function ce(e,t){let n=`${e}:${t}`,i=$.get(n);return i||(i=S(()=>g(e).getBlock({blockNumber:t})).then(r=>{if(!(r.number!==t||typeof r.timestamp!="bigint"||r.timestamp<=0n))return r.timestamp.toString()}).catch(()=>{}),$.set(n,i)),i}async function ue(e,t){let n=g(e.chainId),i=await y(e.chainId),r;try{r=await Y(e,n,i)}catch(a){if(a instanceof Q)return s(`price unavailable for now: ${X(a.symbol,a.gap)}`);if(N(a))return s(`price unavailable for now: ${F}`);throw a}if(!r)return s("Oak has no pinned pool with sufficient in-range depth for this token");let u=BigInt(e.address)<BigInt(L.usdg);return{numerator:u?r.sqrt**2n:B,denominator:(u?B:r.sqrt**2n)*10n**6n,source:`current price in the Uniswap USDG/${t.symbol} pool; on-chain trading can differ from the stock market`,block:i}}async function de(e){let t=g(e.chainId),n=await y(e.chainId),{assets:i,isLog:r}=await te(e,t,n,w.chopShareFacts),u=10n**BigInt(e.decimals),a=await Promise.all(i.map(l=>_(l.token,!1))),d=0n,c=1n;for(let l=0;l<i.length;l++){let m=a[l];if(!("numerator"in m))return m;d=d*m.denominator+BigInt(i[l].amount)*m.numerator*c,c*=m.denominator}return{numerator:d,denominator:c*u,block:n,source:`Chop ${r?"log":"LP reserves and log"} net backing estimate; default-caller fees may differ; locks and gas excluded`}}async function _(e,t=!0){if(ne(e))return{numerator:1n,denominator:10n**6n,source:"USDG counted at $1.00"};if(e.chainId!==U)return s("Oak has no source for this token");let n=[j.oakLog.address,z].some(o=>o.toLowerCase()===e.address.toLowerCase()),i=w.chopShareFacts?.some(o=>[o.log.address,o.staking.address].some(p=>p.toLowerCase()===e.address.toLowerCase())),r=n||i;if(!r&&w.chopShareTokens?.some(o=>o.toLowerCase()===e.address.toLowerCase()))return s("chop_logs shows this log's backing");if(t&&r){if(v.filter(o=>k(o.token)===k(e)).every(o=>o.amount==="0"))return{numerator:0n,denominator:1n,source:"zero Chop share balance"};try{return await de(e)}catch{return s("chop_logs shows this log's backing")}}let u=e.symbol;if(u.startsWith("untrusted "))try{let o=JSON.parse(u.slice(10));typeof o=="string"&&(u=o)}catch{}if(ee(e))try{let o=g(e.chainId),p=await y(e.chainId),D=ge(R.stateView),G=R.poolId,[fe,pe]=await Promise.all([o.readContract({address:D,abi:se,functionName:"getSlot0",args:[G],blockNumber:p}),o.readContract({address:D,abi:se,functionName:"getLiquidity",args:[G],blockNumber:p})]),W=fe[0];return W<=0n||pe<=0n?s("The pinned Uniswap v4 WETH/CHOP pool has no active liquidity, and the only other route is a near-empty pool. A quote is a sale for this amount only; Oak never uses it to value a balance."):{numerator:await I(o,p)*B,denominator:b*W**2n*10n**BigInt(e.decimals),source:"current price in the Uniswap v4 WETH/CHOP pool",block:p}}catch{return s("Oak could not verify the pinned Uniswap v4 WETH/CHOP pool for CHOP. A quote is a sale for this amount only; Oak never uses it to value a balance.")}if(u==="CHOP")return s("Oak has no pinned market for CHOP. A quote is a sale for this amount only; Oak never uses it to value a balance.");let a=J(e);if(a)return ue(e,a);if(Object.hasOwn(L.notOffered,u))return s("Oak has no pinned market for this token");let d=g(e.chainId),c=await y(e.chainId);if(ie(e))return{numerator:await I(d,c),denominator:b*b,source:"30-minute average of the Uniswap ETH/USDG pool",block:c};let l=(f.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS)?.toLowerCase()===e.address.toLowerCase();if(l)try{let o=f.resolvePrice?await f.resolvePrice(e,c):await oe(e,{client:d,blockNumber:c,oakTokenAddress:e.address,officialStockTokens:[]}),p=BigInt(o.usdE18);if(p<=0n)throw new Error("OAK price unavailable");return{numerator:p,denominator:b*10n**BigInt(e.decimals),source:"OAK price",block:c}}catch{}if(l&&(await d.readContract({address:V[U].pons.factory.address,abi:be,functionName:"getLaunchedToken",args:[e.address],blockNumber:c})).phase!==2)return s("Oak has no graduated Pons pool price for OAK");let m=await Z(e,d,c);return m.numerator<=0n||m.denominator<=0n?s("Oak has no source for this token"):{numerator:await I(d,c)*m.numerator,denominator:b*m.denominator*10n**BigInt(e.decimals),source:l?"OAK's current Pons pool price; fewer than enough trades in 30 minutes for a price":"current Pons pool price",block:c}}let x=0;async function le(){for(;!h&&x<A.length;){let e=A[x++],t;try{if(!Number.isInteger(e.decimals)||e.decimals<0||e.decimals>255)throw new Error("Invalid decimals");if(t=await _(e),h||E.set(k(e),t),"numerator"in t&&t.block!==void 0){let n=await ce(e.chainId,t.block);h||(t.observedAt=n)}}catch(n){t=s(N(n)?`price unavailable for now: ${F}`:"Oak has no source for this token")}h||E.set(k(e),t)}}let K,me=new Promise(e=>{K=setTimeout(()=>{h=!0;for(let t of T.splice(0))t();e()},P)});try{await Promise.race([Promise.all(Array.from({length:Math.min(6,A.length)},le)),me])}finally{clearTimeout(K),h=!0}return v.map(e=>{let t;try{if(!/^\d+$/.test(e.amount)||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)throw new Error("Invalid amount");t="humanAmount"in e&&typeof e.humanAmount=="string"?e.humanAmount:he(BigInt(e.amount),e.token.decimals);let n=E.get(k(e.token));if(n&&"numerator"in n){let r=(BigInt(e.amount)*n.numerator*100n*2n+n.denominator)/(n.denominator*2n);return{...e,humanAmount:t,usdEstimate:`${r/100n}.${(r%100n).toString().padStart(2,"0")}`,estimateLabel:"estimate, not a quote",estimateSource:n.source,unitUsdE18:(n.numerator*10n**BigInt(e.token.decimals)*b/n.denominator).toString(),...n.observedAt===void 0?{}:{observedAt:n.observedAt},...n.block===void 0?{}:{estimateAsOf:n.block.toString()}}}return{...e,humanAmount:t,...n??s(C)}}catch{return{...e,...t===void 0?{}:{humanAmount:t},...s("Oak cannot format this token amount")}}})}export{Ee as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as g,j as k}from"./
|
|
1
|
+
import{i as g,j as k}from"./GBIL2I2K.js";import{d as p,f}from"./MXI7LX2F.js";import{q as m}from"./PXVF2SHU.js";import{c as u,f as h}from"./D6JOXK7Q.js";import{a as d}from"./SPJCSEKP.js";import{g as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";var w=["hoodlock_lock","hoodlock_burn","hoodlock_airdrop_create","hoodlock_airdrop_claim",...p,...u];async function H(e,r,t,s){if(!w.includes(e))throw new i("Unknown HoodLock action; nothing was signed.");let o=async()=>{throw new i("HoodLock does not require a swap for this action.")},n=d({clientFor:()=>s,http:fetch,preview:async a=>({txs:a,changes:[],summary:"Locally reconstructed HoodLock intent."}),quoteSwap:o,buildSwap:o}),c=await[g(n),k(n),...m(n).tools,...f(n).tools,...h(n).tools].find(a=>a.name===e).execute(r,t);if(!Array.isArray(c.txs)||c.txs.length===0)throw new i("HoodLock action has no transactions; use the read route.");return c.txs.map(a=>({...a}))}function I(e,r){if(!r.length||e.length!==r.length||e.some((t,s)=>{let o=r[s];return t.chainId!==o.chainId||!l(t.to,o.to)||!l(t.data,o.data)||t.value!==o.value}))throw new i("HoodLock transaction differs from the locally reconstructed request; nothing was signed.")}export{w as a,H as b,I as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ne}from"./FRVCSDKU.js";import{b as ee,e as te}from"./E47UYYK4.js";import{a as D,b as W,c as _,d as J,e as z,f as Y,g as Z}from"./ZXRIJG6H.js";import{d as V,e as $,w as U}from"./FRT6AC6M.js";import{a as H}from"./IOYRL6AY.js";import{a as E}from"./66F5ZH34.js";import{c as b,g as G}from"./NWNYJ26T.js";import{b as S,j as N}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as w,encodeFunctionData as oe,encodePacked as he,erc20Abi as be,getAddress as ce,parseAbi as T,parseAbiParameters as g,zeroAddress as v}from"viem";var ie=ce("0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7"),re=ce(N[4663].ponsTrade.quoter.address),xe=T(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),we=T(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),se=T(["function factory() view returns (address)","function quoteExactInput(bytes path,uint256 amountIn) returns (uint256,uint160[],uint32[],uint256)","function quoteExactOutput(bytes path,uint256 amountOut) returns (uint256,uint160[],uint32[],uint256)"]),F="(address intermediateCurrency,uint24 fee,int24 tickSpacing,address hooks,bytes hookData)",M="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",ae=T([`function quoteExactInput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactOutput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactInputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`,`function quoteExactOutputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`]),ke=g(`(address exactCurrency,${F}[] path,uint256[] minHopPriceX36,uint128 amount,uint128 limit)`);function ve(u,t,r,l){let s=[],e=l?r:t,i=new Set([e]);for(let n of l?[...u].reverse():u){let c=n.currency0===e?n.currency1:n.currency1===e?n.currency0:void 0;if(!c||i.has(c))throw new o("V4 poolKeys must form a continuous route without repeated currencies.");s.push({intermediateCurrency:c,fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks,hookData:"0x"}),e=c,i.add(e)}if(e!==(l?t:r))throw new o("V4 route does not end at the requested currency.");return s}var ge=g(`(${M} poolKey,bool zeroForOne,uint128 amount,uint128 limit,uint256 minHopPriceX36,bytes hookData)`),Ae=g("address recipient,uint256 amount,uint256 limit,bytes path,bool payerIsUser,uint256[] minHopPriceX36"),Pe=g("address recipient,uint256 amount,uint256 limit,address[] path,bool payerIsUser,uint256[] minHopPriceX36"),ue=g("address,uint256"),Ie=g("bytes,bytes[]");function Se(u,t,r){let l=r?[...u].reverse():u,s=r?[...t].reverse():t,e=l[0];return s.forEach((i,n)=>{e=`${e}${he(["uint24","address"],[i,l[n+1]]).slice(2)}`}),e}var de={version:{description:'Uniswap version: "v2" for pairs, "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v2","v3","v4"]},tokenIn:{...b,description:"Input token address; the zero address means native ETH for v4."},tokenOut:{...b,description:"Output token address; the zero address means native ETH for v4."},path:{description:"Two to six distinct ERC-20 token addresses in input-to-output order for v2 or v3.",type:"array",minItems:2,maxItems:6,items:b},fees:{type:"array",description:"One v3 pool fee per path hop, in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",items:{type:"integer",minimum:0,maximum:1e6}},poolKeys:{description:"One to five v4 pool keys in input-to-output route order, without repeated currencies.",type:"array",minItems:1,maxItems:5,items:{type:"object",required:["currency0","currency1","fee","tickSpacing","hooks"],properties:{currency0:{...b,description:"Lower sorted currency address; the zero address means native ETH."},currency1:{...b,description:"Higher sorted currency address."},fee:{type:"integer",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},hooks:{...b,description:"Hook contract address; the zero address means no hook."}},additionalProperties:!1}},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object",properties:{currency0:{...b,description:"Lower sorted currency address; the zero address means native ETH."},currency1:{...b,description:"Higher sorted currency address."},fee:{type:"integer",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},hooks:{...b,description:"Hook contract address; the zero address means no hook."}},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},allowHighFeePools:{description:"Allow pools above Oak's usual fee threshold; review the fee warning before confirming.",type:"boolean"},acceptValueLoss:{description:"Acknowledge the quoted value-loss warning; review the measured loss before confirming.",type:"boolean"},amountIn:E('Amount of input token in base units; use input token decimals. Example: "1000000" = 1 input token at 6 decimals.'),amountOut:E('Amount of output token in base units; use output token decimals. Example: "1000000" = 1 output token at 6 decimals.'),minAmountOut:E('Minimum amount of output token in base units; use output token decimals. Example: "1000000" = 1 output token at 6 decimals.'),maxAmountIn:E('Maximum amount of input token in base units; use input token decimals. Example: "1000000" = 1 input token at 6 decimals.'),slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999}};async function Ee(u,t,r,l=!1){Z(t,Object.keys(de));let s=t.version;if(!["v2","v3","v4"].includes(String(s)))throw new o("Provide version v2, v3 or v4.");let e=t.amountOut!==void 0;if(t.amountIn!==void 0===e)throw new o("Provide exactly one of amountIn or amountOut.");if(e&&t.minAmountOut!==void 0||!e&&t.maxAmountIn!==void 0)throw new o("Use maxAmountIn for exact output, minAmountOut for exact input.");let i=D(e?t.amountOut:t.amountIn,e?"amountOut":"amountIn",s==="v4"?128:160),n=_(t.tokenIn),c=_(t.tokenOut);if(n===c)throw new o("Swap requires different input and output currencies.");let x=u.clientFor(S),p=await x.getBlock(),L=J(t.slippageBps),j,I,m,O,A,f,d,C;if(s==="v4"){if(t.path!==void 0||t.fees!==void 0)throw new o("V4 uses poolKey or poolKeys; omit path and fees.");if(t.poolKey===void 0==(t.poolKeys===void 0))throw new o("Provide poolKey or poolKeys, not both.");if(t.poolKeys!==void 0){if(!Array.isArray(t.poolKeys)||t.poolKeys.length<1||t.poolKeys.length>5)throw new o("Provide 1 to 5 v4 poolKeys.");let a=t.poolKeys.map(P=>U(P));j=a,I=ve(a,n,c,e),m=(await x.simulateContract({address:re,abi:ae,functionName:e?"quoteExactOutput":"quoteExactInput",args:[{exactCurrency:e?c:n,path:I,exactAmount:i}],account:r,gas:H,blockNumber:p.number})).result[0]}else{if(f=U(t.poolKey),![f.currency0,f.currency1].includes(n)||![f.currency0,f.currency1].includes(c))throw new o("PoolKey currencies differ from the requested swap.");m=(await x.simulateContract({address:re,abi:ae,functionName:e?"quoteExactOutputSingle":"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:n===f.currency0,exactAmount:i,hookData:"0x"}],account:r,gas:H,blockNumber:p.number})).result[0]}A="0x10"}else{if(t.poolKey!==void 0||t.poolKeys!==void 0||n===v||c===v)throw new o("V2/v3 routes use ERC-20 tokens; wrap ETH to WETH first.");if(d=Array.isArray(t.path)?t.path.map(W):[n,c],d.length<2||d.length>6||d[0]!==n||d.at(-1)!==c||new Set(d).size!==d.length||d.includes(v))throw new o("Path must contain 2 to 6 distinct ERC-20 tokens in input-to-output order.");if(s==="v2"){if(t.fees!==void 0)throw new o("V2 fees are fixed by the pair; omit fees.");let a=await x.readContract({address:ee,abi:te,functionName:e?"getAmountsIn":"getAmountsOut",args:[i,d],blockNumber:p.number});m=e?a[0]:a.at(-1),A=e?"0x09":"0x08"}else{let a=t.fees;if(!Array.isArray(a)||a.length!==d.length-1||a.some(P=>typeof P!="number"||!Number.isInteger(P)||P<0||P>1e6))throw new o("Provide one integer pool fee in hundredths of a basis point (3000 = 0.3%) per v3 path hop.");if(!G(await x.readContract({address:ie,abi:se,functionName:"factory",blockNumber:p.number}),N[4663].uniswap.v3_factory.address))throw new o("V3 quoter is not configured for the pinned factory.");C=Se(d,a,e),m=(await x.simulateContract({address:ie,abi:se,functionName:e?"quoteExactOutput":"quoteExactInput",args:[C,i],account:r,gas:H,blockNumber:p.number})).result[0],A=e?"0x01":"0x00"}}if(m<=0n)throw new o("No positive Uniswap quote is available.");let k=await ne(x,{version:s,input:n,path:d,fees:t.fees,poolKeys:f?[f]:j,exactOutput:e,amount:i,quoted:m,blockNumber:p.number,allowHighFeePools:t.allowHighFeePools===!0,acceptValueLoss:t.acceptValueLoss===!0}),{confirmationWarnings:pe,...me}=k,R=e?t.maxAmountIn:t.minAmountOut;if(!l&&R===void 0)throw new o(`Provide ${e?"maxAmountIn":"minAmountOut"} from uniswap_quote to confirm the trade bound.`);let y=R===void 0?e?(m*BigInt(1e4+L)+9999n)/10000n:m*BigInt(1e4-L)/10000n:D(R,e?"maxAmountIn":"minAmountOut",s==="v4"?128:160);if(y<=0n||(e?y<m:y>m))throw new o("The fresh quote does not satisfy the confirmed swap bound.");let h=e?y:i;if(h>=1n<<160n||s==="v4"&&(h>=1n<<128n||y>=1n<<128n))throw new o("Swap bounds exceed the router amount range.");let[le,fe]=await Promise.all([z(u,n,p.number),z(u,c,p.number)]),X={...me,version:s,input:{token:le,amount:(e?m:i).toString()},output:{token:fe,amount:(e?i:m).toString()},[e?"maxAmountIn":"minAmountOut"]:y.toString(),blockNumber:p.number.toString(),expiresAt:(p.timestamp+60n).toString()};if(l)return{quote:X,...k.warnings?{warnings:k.warnings}:{},summary:"Read-only on-chain quote. Repeat the same route with the returned bound in uniswap_swap; execution gets a fresh quote and preview."};let q=p.timestamp+300n,K=[],B="Native ETH input; no token approvals.";if(n!==v){let a=await x.readContract({address:n,abi:be,functionName:"allowance",args:[r,V],blockNumber:p.number});a!==h&&K.push(u.approval(n,V,h.toString(),S)),B=`${a===h?"Reuse existing exact ERC-20 allowance of":"Set ERC-20 allowance to exactly"} ${h} input base units to Permit2; exact router permit.`,K.push(u.unsignedTx({to:V,data:oe({abi:we,functionName:"approve",args:[n,$,h,Number(q)]}),value:"0",chainId:S,description:`Permit exactly ${h} input base units to Universal Router until ${q}.`}))}if(s==="v4"){let a=I?w(ke,[{exactCurrency:e?c:n,path:I,minHopPriceX36:[],amount:i,limit:y}]):w(ge,[{poolKey:f,zeroForOne:n===f.currency0,amount:i,limit:y,minHopPriceX36:0n,hookData:"0x"}]);O=w(Ie,[I?e?"0x090c0f":"0x070c0f":e?"0x080c0f":"0x060c0f",[a,w(ue,[n,h]),w(ue,[c,e?i:y])]])}else s==="v2"?O=w(Pe,[r,i,y,d,!0,[]]):O=w(Ae,[r,i,y,C,!0,[]]);let Q=[O];return n===v&&e&&(A=`${A}04`,Q.push(w(g("address,address,uint256"),[v,r,0n]))),K.push(u.unsignedTx({to:$,data:oe({abi:xe,functionName:"execute",args:[A,Q,q]}),value:n===v?h.toString():"0",chainId:S,description:`Uniswap ${s} ${e?"exact output":"exact input"} swap; recipient ${r}; deadline ${q}.`})),{...k.warnings?{warnings:k.warnings}:{},confirmationWarnings:pe,...await Y(u,K,r,`${(k.warnings??[]).join(" ")}${k.warnings?.length?" ":""}Swap through Universal Router 2.1.2. ${B} Fixed output/input bound and five-minute on-chain deadline. Venue fees included; gas excluded.`),quote:X}}function Ue(u){return{tools:[!0,!1].map(t=>({name:t?"uniswap_quote":"uniswap_swap",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenIn","tokenOut"],properties:de},execute:(r,l)=>Ee(u,r,l,t)}))}}export{ie as a,re as b,xe as c,we as d,se as e,ae as f,ke as g,ve as h,ge as i,Ae as j,Pe as k,Se as l,Ee as m,Ue as n};
|
|
1
|
+
import{b as ne}from"./TWVDWNTG.js";import{b as ee,e as te}from"./OIGTTRN5.js";import{a as D,b as W,c as _,d as J,e as z,f as Y,g as Z}from"./QP2B7AYX.js";import{d as V,e as $,w as U}from"./5677LZOV.js";import{a as H}from"./IOYRL6AY.js";import{a as E}from"./66F5ZH34.js";import{c as b,g as G}from"./NWNYJ26T.js";import{b as S,j as N}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as x,encodeFunctionData as oe,encodePacked as he,erc20Abi as be,getAddress as ce,parseAbi as T,parseAbiParameters as g,zeroAddress as v}from"viem";var ie=ce("0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7"),re=ce(N[4663].ponsTrade.quoter.address),we=T(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),xe=T(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),ae=T(["function factory() view returns (address)","function quoteExactInput(bytes path,uint256 amountIn) returns (uint256,uint160[],uint32[],uint256)","function quoteExactOutput(bytes path,uint256 amountOut) returns (uint256,uint160[],uint32[],uint256)"]),F="(address intermediateCurrency,uint24 fee,int24 tickSpacing,address hooks,bytes hookData)",M="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",se=T([`function quoteExactInput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactOutput((address exactCurrency,${F}[] path,uint128 exactAmount) params) returns (uint256,uint256)`,`function quoteExactInputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`,`function quoteExactOutputSingle((${M} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256,uint256)`]),ke=g(`(address exactCurrency,${F}[] path,uint256[] minHopPriceX36,uint128 amount,uint128 limit)`);function ve(u,t,r,l){let a=[],e=l?r:t,i=new Set([e]);for(let n of l?[...u].reverse():u){let c=n.currency0===e?n.currency1:n.currency1===e?n.currency0:void 0;if(!c||i.has(c))throw new o("V4 poolKeys must form a continuous route without repeated currencies.");a.push({intermediateCurrency:c,fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks,hookData:"0x"}),e=c,i.add(e)}if(e!==(l?t:r))throw new o("V4 route does not end at the requested currency.");return a}var ge=g(`(${M} poolKey,bool zeroForOne,uint128 amount,uint128 limit,uint256 minHopPriceX36,bytes hookData)`),Ae=g("address recipient,uint256 amount,uint256 limit,bytes path,bool payerIsUser,uint256[] minHopPriceX36"),Pe=g("address recipient,uint256 amount,uint256 limit,address[] path,bool payerIsUser,uint256[] minHopPriceX36"),ue=g("address,uint256"),Ie=g("bytes,bytes[]");function Se(u,t,r){let l=r?[...u].reverse():u,a=r?[...t].reverse():t,e=l[0];return a.forEach((i,n)=>{e=`${e}${he(["uint24","address"],[i,l[n+1]]).slice(2)}`}),e}var de={version:{description:'Uniswap version: "v2" for pairs, "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v2","v3","v4"]},tokenIn:{...b,description:"Input token address; the zero address means native ETH for v4."},tokenOut:{...b,description:"Output token address; the zero address means native ETH for v4."},path:{description:"Two to six distinct ERC-20 token addresses in input-to-output order for v2 or v3.",type:"array",minItems:2,maxItems:6,items:b},fees:{type:"array",description:"One v3 pool fee per path hop, in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",items:{type:"integer",minimum:0,maximum:1e6}},poolKeys:{description:"One to five v4 pool keys in input-to-output route order, without repeated currencies.",type:"array",minItems:1,maxItems:5,items:{type:"object",required:["currency0","currency1","fee","tickSpacing","hooks"],properties:{currency0:{...b,description:"Lower sorted currency address; the zero address means native ETH."},currency1:{...b,description:"Higher sorted currency address."},fee:{type:"integer",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},hooks:{...b,description:"Hook contract address; the zero address means no hook."}},additionalProperties:!1}},poolKey:{description:"V4 pool key: sorted currencies, fee in pips, tick spacing and hook address.",type:"object",properties:{currency0:{...b,description:"Lower sorted currency address; the zero address means native ETH."},currency1:{...b,description:"Higher sorted currency address."},fee:{type:"integer",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%)."},tickSpacing:{description:"Spacing between usable pool ticks, as an integer.",type:"integer"},hooks:{...b,description:"Hook contract address; the zero address means no hook."}},required:["currency0","currency1","fee","tickSpacing","hooks"],additionalProperties:!1},allowHighFeePools:{description:"Allow pools above Oak's usual fee threshold; review the fee warning before confirming.",type:"boolean"},acceptValueLoss:{description:"Acknowledge the quoted value-loss warning; review the measured loss before confirming.",type:"boolean"},amountIn:E('Amount of input token in base units; use input token decimals. Example: "1000000" = 1 input token at 6 decimals.'),amountOut:E('Amount of output token in base units; use output token decimals. Example: "1000000" = 1 output token at 6 decimals.'),minAmountOut:E('Minimum amount of output token in base units; use output token decimals. Example: "1000000" = 1 output token at 6 decimals.'),maxAmountIn:E('Maximum amount of input token in base units; use input token decimals. Example: "1000000" = 1 input token at 6 decimals.'),slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999}};async function Ee(u,t,r,l=!1){Z(t,Object.keys(de));let a=t.version;if(!["v2","v3","v4"].includes(String(a)))throw new o("Provide version v2, v3 or v4.");let e=t.amountOut!==void 0;if(t.amountIn!==void 0===e)throw new o("Provide exactly one of amountIn or amountOut.");if(e&&t.minAmountOut!==void 0||!e&&t.maxAmountIn!==void 0)throw new o("Use maxAmountIn for exact output, minAmountOut for exact input.");let i=D(e?t.amountOut:t.amountIn,e?"amountOut":"amountIn",a==="v4"?128:160),n=_(t.tokenIn),c=_(t.tokenOut);if(n===c)throw new o("Swap requires different input and output currencies.");let w=u.clientFor(S),p=await w.getBlock(),L=J(t.slippageBps),j,I,m,O,A,f,d,C;if(a==="v4"){if(t.path!==void 0||t.fees!==void 0)throw new o("V4 uses poolKey or poolKeys; omit path and fees.");if(t.poolKey===void 0==(t.poolKeys===void 0))throw new o("Provide poolKey or poolKeys, not both.");if(t.poolKeys!==void 0){if(!Array.isArray(t.poolKeys)||t.poolKeys.length<1||t.poolKeys.length>5)throw new o("Provide 1 to 5 v4 poolKeys.");let s=t.poolKeys.map(P=>U(P));j=s,I=ve(s,n,c,e),m=(await w.simulateContract({address:re,abi:se,functionName:e?"quoteExactOutput":"quoteExactInput",args:[{exactCurrency:e?c:n,path:I,exactAmount:i}],account:r,gas:H,blockNumber:p.number})).result[0]}else{if(f=U(t.poolKey),![f.currency0,f.currency1].includes(n)||![f.currency0,f.currency1].includes(c))throw new o("PoolKey currencies differ from the requested swap.");m=(await w.simulateContract({address:re,abi:se,functionName:e?"quoteExactOutputSingle":"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:n===f.currency0,exactAmount:i,hookData:"0x"}],account:r,gas:H,blockNumber:p.number})).result[0]}A="0x10"}else{if(t.poolKey!==void 0||t.poolKeys!==void 0||n===v||c===v)throw new o("V2/v3 routes use ERC-20 tokens; wrap ETH to WETH first.");if(d=Array.isArray(t.path)?t.path.map(W):[n,c],d.length<2||d.length>6||d[0]!==n||d.at(-1)!==c||new Set(d).size!==d.length||d.includes(v))throw new o("Path must contain 2 to 6 distinct ERC-20 tokens in input-to-output order.");if(a==="v2"){if(t.fees!==void 0)throw new o("V2 fees are fixed by the pair; omit fees.");let s=await w.readContract({address:ee,abi:te,functionName:e?"getAmountsIn":"getAmountsOut",args:[i,d],blockNumber:p.number});m=e?s[0]:s.at(-1),A=e?"0x09":"0x08"}else{let s=t.fees;if(!Array.isArray(s)||s.length!==d.length-1||s.some(P=>typeof P!="number"||!Number.isInteger(P)||P<0||P>1e6))throw new o("Provide one integer pool fee in hundredths of a basis point (3000 = 0.3%) per v3 path hop.");if(!G(await w.readContract({address:ie,abi:ae,functionName:"factory",blockNumber:p.number}),N[4663].uniswap.v3_factory.address))throw new o("V3 quoter is not configured for the pinned factory.");C=Se(d,s,e),m=(await w.simulateContract({address:ie,abi:ae,functionName:e?"quoteExactOutput":"quoteExactInput",args:[C,i],account:r,gas:H,blockNumber:p.number})).result[0],A=e?"0x01":"0x00"}}if(m<=0n)throw new o("No positive Uniswap quote is available.");let k=await ne(w,{version:a,input:n,path:d,fees:t.fees,poolKeys:f?[f]:j,exactOutput:e,amount:i,quoted:m,blockNumber:p.number,allowHighFeePools:t.allowHighFeePools===!0,acceptValueLoss:t.acceptValueLoss===!0}),{confirmationWarnings:pe,...me}=k,R=e?t.maxAmountIn:t.minAmountOut;if(!l&&R===void 0)throw new o(`Provide ${e?"maxAmountIn":"minAmountOut"} from uniswap_quote to confirm the trade bound.`);let y=R===void 0?e?(m*BigInt(1e4+L)+9999n)/10000n:m*BigInt(1e4-L)/10000n:D(R,e?"maxAmountIn":"minAmountOut",a==="v4"?128:160);if(y<=0n||(e?y<m:y>m))throw new o("The fresh quote does not satisfy the confirmed swap bound.");let h=e?y:i;if(h>=1n<<160n||a==="v4"&&(h>=1n<<128n||y>=1n<<128n))throw new o("Swap bounds exceed the router amount range.");let[le,fe]=await Promise.all([z(u,n,p.number),z(u,c,p.number)]),X={...me,version:a,input:{token:le,amount:(e?m:i).toString()},output:{token:fe,amount:(e?i:m).toString()},[e?"maxAmountIn":"minAmountOut"]:y.toString(),blockNumber:p.number.toString(),expiresAt:(p.timestamp+60n).toString()};if(l)return{quote:X,...k.warnings?{warnings:k.warnings}:{},summary:"Read-only on-chain quote. Repeat the same route with the returned bound in uniswap_swap; execution gets a fresh quote and preview."};let q=p.timestamp+300n,K=[],B="Native ETH input; no token approvals.";if(n!==v){let s=await w.readContract({address:n,abi:be,functionName:"allowance",args:[r,V],blockNumber:p.number});s!==h&&K.push(u.approval(n,V,h.toString(),S)),B=`${s===h?"Reuse existing exact ERC-20 allowance of":"Set ERC-20 allowance to exactly"} ${h} input base units to Permit2; exact router permit.`,K.push(u.unsignedTx({to:V,data:oe({abi:xe,functionName:"approve",args:[n,$,h,Number(q)]}),value:"0",chainId:S,description:`Permit exactly ${h} input base units to Universal Router until ${q}.`}))}if(a==="v4"){let s=I?x(ke,[{exactCurrency:e?c:n,path:I,minHopPriceX36:[],amount:i,limit:y}]):x(ge,[{poolKey:f,zeroForOne:n===f.currency0,amount:i,limit:y,minHopPriceX36:0n,hookData:"0x"}]);O=x(Ie,[I?e?"0x090c0f":"0x070c0f":e?"0x080c0f":"0x060c0f",[s,x(ue,[n,h]),x(ue,[c,e?i:y])]])}else a==="v2"?O=x(Pe,[r,i,y,d,!0,[]]):O=x(Ae,[r,i,y,C,!0,[]]);let Q=[O];return n===v&&e&&(A=`${A}04`,Q.push(x(g("address,address,uint256"),[v,r,0n]))),K.push(u.unsignedTx({to:$,data:oe({abi:we,functionName:"execute",args:[A,Q,q]}),value:n===v?h.toString():"0",chainId:S,description:`Uniswap ${a} ${e?"exact output":"exact input"} swap; recipient ${r}; deadline ${q}.`})),{...k.warnings?{warnings:k.warnings}:{},confirmationWarnings:pe,...await Y(u,K,r,`${(k.warnings??[]).join(" ")}${k.warnings?.length?" ":""}Swap through Universal Router 2.1.2. ${B} Fixed output/input bound and initial five-minute on-chain deadline; a started multi-step swap may extend only time limits within the ceiling shown in its approval summary. Venue fees included; gas excluded.`),quote:X}}function Ue(u){return{tools:[!0,!1].map(t=>({name:t?"uniswap_quote":"uniswap_swap",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenIn","tokenOut"],properties:de},execute:(r,l)=>Ee(u,r,l,t)}))}}export{ie as a,re as b,we as c,xe as d,ae as e,se as f,ke as g,ve as h,ge as i,Ae as j,Pe as k,Se as l,Ee as m,Ue as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as Ee,a as Be,b as he,g as Z,h as be,i as Oe,m as ee,n as D,y as ke}from"./GYPMUYB5.js";import{b as y,c as qe}from"./GK3D7OKG.js";import{a as fe,b as H}from"./Z7FGEWO2.js";import{a as Q}from"./43LI5NKJ.js";import{a as Ie}from"./IOYRL6AY.js";import{a as $e}from"./66F5ZH34.js";import{c as le,g as P}from"./NWNYJ26T.js";import{b as Se}from"./IX3GZMTM.js";import{b,j as me}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{a as pe}from"./JXOEJPJ4.js";import{randomUUID as ze}from"node:crypto";import{encodeAbiParameters as ne,encodeFunctionData as we,erc20Abi as ge,getAddress as F,parseAbi as X,parseAbiParameters as oe,zeroAddress as K}from"viem";var Re=me[b].pons,C=me[b].ponsTrade,_e=X(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),te=X(["function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)","function feeBps() view returns (uint256)","function creatorTaxBps() view returns (uint256)","function currentSnipeTaxBps(address) view returns (uint256)","function sellableTokens() view returns (uint256)","function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]),He=X(["function quoteExactInputSingle(((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)"]),Ke=X(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),Xe=X(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),je=oe("((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint256 minHopPriceX36,bytes hookData)"),Ge={address:fe,chainId:b,decimals:18,symbol:"ETH"},Qe="There is no on-chain expiry. The signed transaction is protected by its minimum output.",Ve="This trade must be sent within 5 minutes of its quote. If you approve later, Oak shows you fresh terms first.",We=`Quote expiry is enforced by Oak before signing only. ${Qe}`,$=10000n,Te=(1n<<256n)-1n,Ne=(1n<<128n)-1n,I=(n,t)=>({token:n,amount:t.toString()}),Ce=(n,t)=>(n+t-1n)/t,Me="Reuse existing exact allowance";async function Je(n,t,r,o,c){try{let e=await n.readContract({address:t,abi:ge,functionName:"allowance",args:[r,o],blockNumber:c});return typeof e=="bigint"?e:void 0}catch{return}}var Ye={type:"object",additionalProperties:!1,required:["token","amountIn"],properties:{token:{...le,description:"Pons launch token address on chain 4663."},amountIn:$e('Input in base units: pair token for buys (use its decimals), launch token for sells (18 decimals). Examples: "1000000" = 1 pair token at 6 decimals; "1000000000000000000" = 1 launch token.'),pairToken:{...le,description:"The launch pair from pons_status. Required to buy a custom-pair launch, so amountIn is never read in the wrong units; omit or use the zero address for native ETH."},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999,default:he}}};function De(n,t,r,o){if(n===void 0){if(r&&y(t)!==K)throw new d(`This Pons launch is paired with ${o}; amountIn is in that token's base units. Repeat with pairToken "${t}" to confirm the input asset.`);return}if(typeof n!="string")throw new d("pairToken must be a token address.");if(Q(n),!P(y(n),y(t)))throw new Z(`This Pons launch trades only against ${o}.`)}async function Fe(n,t,r,o,{quoteOnly:c=!1,curveOnly:e=!1,blockNumber:p}={}){if(Q(r),Object.keys(t).some(f=>!["token","amountIn","slippageBps","pairToken"].includes(f)))throw new d("Provide only token, amountIn, optional pairToken and optional slippageBps.");if(typeof t.token!="string")throw new d("Provide a launch token address.");Q(t.token);let s=F(t.token),i=Se(t.amountIn);if(i===0n||i>Te)throw new d("Trade amount must be positive and within the uint256 range.");let m=t.slippageBps??he;if(typeof m!="number"||!Number.isInteger(m)||m<0||m>=1e4)throw new d("Slippage must be an integer from 0 to 9999 basis points.");let x=f=>f*($-BigInt(m))/$,a=n.clientFor(b),l=p===void 0?await a.getBlock():await a.getBlock({blockNumber:p});if(p!==void 0&&l.number!==p)throw new d("Pons quote snapshot is unavailable.");let u=await a.readContract({address:Re.factory.address,abi:_e,functionName:"getLaunchedToken",args:[s],blockNumber:l.number});if(!u.exists||!P(u.token,s))throw new d("This address is not a Pons launch token.");if(e&&u.phase!==0)throw new Z("Pons curve quotes are only available before graduation.");if(u.phase===1)throw new d("Pons graduation is pending; the curve is closed and the pool is not ready.");if(u.phase===3)throw new d("This Pons launch was rescued and has no active trade route.");if(u.phase!==0&&u.phase!==2)throw new d("This Pons launch has an unknown trade phase.");let g=y(u.pairToken)===K,M=F(u.pairToken);if(P(M,s))throw new d("This Pons launch has an invalid pair.");let j=f=>Promise.all([a.readContract({address:f,abi:ge,functionName:"symbol",blockNumber:l.number}),a.readContract({address:f,abi:ge,functionName:"decimals",blockNumber:l.number})]),[[B,U],L]=await Promise.all([j(s),g?void 0:j(M)]),w=L?{address:M,chainId:b,symbol:pe(L[0]),decimals:L[1]}:Ge,G=g?"native ETH":`${w.symbol} (${w.address})`;De(t.pairToken,M,o,`${G}, ${w.decimals} decimals`);let V={address:s,chainId:b,symbol:pe(B),decimals:U},se=o?w:V,ie=o?V:w,q=[],re=(f,h,S,A)=>n.unsignedTx({to:f,data:h,value:S.toString(),chainId:b,description:A}),T,k,W,O=i,ve=null,ae,ye="",ue;if(u.phase===0){let f=v=>a.readContract({address:u.curve,abi:te,functionName:v,blockNumber:l.number}),[[h,S],A,R,E,_]=await Promise.all([a.readContract({address:u.curve,abi:te,functionName:"getReserves",blockNumber:l.number}),f("feeBps"),f("creatorTaxBps"),o?a.readContract({address:u.curve,abi:te,functionName:"currentSnipeTaxBps",args:[r],blockNumber:l.number}):Promise.resolve(0n),o?f("sellableTokens"):Promise.resolve(0n)]);if(h<=0n||S<=0n||A+R>$-100n)throw new d("Pons curve reserves or fee settings are unavailable.");let J=$-A-R-100n,N=E<J?E:J,Ae=v=>({base:v*A/$,creator:v*R/$,snipe:v*N/$}),Pe=v=>{let z=Ae(v);return v-z.base-z.creator-z.snipe},Y;if(o){if(_<=0n||_>=S)throw new d("The curve has no available sellable tokens.");let v=Pe(i);if(T=v*S/(h+v),T>=_){T=_;let z=T*h/(S-T)+1n;O=Ce(z*$,$-A-R-N),O>i&&(O=i)}Y=O,k=x(T),W=Ce(k*i,O),g||q.push(n.approval(w.address,u.curve,i.toString(),b))}else Y=i*h/(S+i),T=Pe(Y),k=x(T),q.push(n.approval(s,u.curve,i.toString(),b));let ce=Ae(Y);ve={base:I(w,ce.base),creator:I(w,ce.creator),snipe:I(w,ce.snipe)},ae=`Curve fees included: ${A} base, ${R} creator and ${N} opening-tax basis points, each rounded separately.`,q.push(re(u.curve,we({abi:te,functionName:o?"buy":"sell",args:[i,W??k,r]}),o&&g?i:0n,o?`Buy Pons curve tokens with ${G}.`:`Sell Pons curve tokens for ${G}.`))}else{if(i>Ne)throw new d("Trade amount exceeds the router uint128 range.");let f=qe(u.pairToken,s,u.poolFee,u.tickSpacing),h=o?y(u.pairToken):s,S=o?s:y(u.pairToken),A=P(h,f.currency0);if(T=(await a.simulateContract({address:C.quoter.address,abi:He,functionName:"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:A,exactAmount:i,hookData:"0x"}],account:r,gas:Ie,blockNumber:l.number})).result[0],k=x(T),k>Ne)throw new d("Minimum output exceeds the router uint128 range.");let E=l.timestamp+300n;if(ue=E.toString(),E>=1n<<48n)throw new d("Permit2 expiry exceeds its timestamp range.");if(h!==K){let N=!c&&await Je(a,h,r,C.permit2.address,l.number)===i;N||q.push(n.approval(h,C.permit2.address,i.toString(),b)),ye=N?`${Me}: ${i} input base units already approved to Permit2. `:"",q.push(re(C.permit2.address,we({abi:Xe,functionName:"approve",args:[h,C.universal_router.address,i,Number(E)]}),0n,`${N?`${Me}. `:""}Approve the exact token amount to the Pons router through Permit2 for five minutes.`))}let _=[ne(je,[{poolKey:f,zeroForOne:A,amountIn:i,amountOutMinimum:k,minHopPriceX36:0n,hookData:"0x"}]),ne(oe("address,uint256"),[h,i]),ne(oe("address,uint256"),[S,k])],J=ne(oe("bytes,bytes[]"),["0x060c0f",_]);q.push(re(C.universal_router.address,we({abi:Ke,functionName:"execute",args:["0x10",[J],E]}),h===K?i:0n,"Trade through Pons Universal Router v2.1.2.")),ae="Quoter output is net of Pons hook fees; no additional fee is subtracted."}if(T<=0n||k<=0n||k>Te||(W??k)>Te)throw new d("Trade output or minimum is outside the supported positive range.");let xe=c?{changes:[],summary:"Quote only; preview is required before sending."}:await n.preview(q,r),de=i-O;return{txs:q,changes:xe.changes,...ue===void 0?{}:{expiresAt:ue},summary:`${o?"Buy":"Sell"} ${V.symbol} (${V.address}) on chain ${b}${g?"":` ${o?"with":"for"} ${G}`}. ${ae} ${ye}${u.phase===0?`${Qe} `:`${Ve} `}${de>0n?`Expected ${g?"native refund":"refund"}: ${n.formatAmount(de.toString(),w.decimals)} ${w.symbol}; minimum output uses the expected spend after refund. `:""}${xe.summary}`,pairToken:w,quote:{phase:u.phase,amountIn:I(se,i),amountOut:I(ie,T),minAmountOut:I(ie,k),minimumKind:"absolute",calldataMinAmountOut:I(ie,W??k),expectedSpend:I(se,O),expectedRefund:I(se,de),fees:ve,blockNumber:l.number.toString(),blockTimestamp:l.timestamp.toString()}}}function hn(n){return Ue(n,!0)}function Ue(n,t=!1,r){let o=new Map,c=e=>{if(BigInt(ee())>=BigInt(e.expiresAt))throw new be};return{name:"pons",async quote(e,p){if(e={...e,from:H(e.from),to:H(e.to)},D(e.from)&&D(e.to))throw new Z("Pons quotes require a launch token and its pair token.");let s=D(e.from)||!D(e.to)&&await Ze(n,e.from,e.to,r),i=ee(),m=await Fe(n,{token:s?e.to:e.from,amountIn:e.amountIn,slippageBps:e.slippageBps,pairToken:y(s?e.from:e.to)},p,s,{quoteOnly:!0,curveOnly:t,blockNumber:r}),x=m.txs.at(-1),a=m.quote,l=String(BigInt(r===void 0?i:a.blockTimestamp)+BigInt(Be)),u=a.minAmountOut.amount,g=a.fees,M=D(m.pairToken.address)?"native ETH base units (18 decimals)":`${m.pairToken.symbol} (${m.pairToken.address}) base units (${m.pairToken.decimals} decimals)`,j=g?`Pons curve fees included in net output: ${g.base.amount} base, ${g.creator.amount} creator and ${g.snipe.amount} opening tax, in ${M}. Oak swap fee: 0 (venue fee is never Oak income). ${We}`:"Quoter output is net of Pons hook fees; no additional fee is subtracted. Oak swap fee: 0.",B=Ee({...e,quoteId:`pons:${ze()}`,provider:"pons",wallet:p,chainId:b,router:x.to,spender:a.phase===0?x.to:C.permit2.address,expiresAt:l,data:x.data,value:x.value,amountOut:a.amountOut.amount,minAmountOut:u,blockNumber:a.blockNumber,...a.phase===0?{ponsCurveToken:s?e.to:e.from,calldataMinAmountOut:a.calldataMinAmountOut.amount}:{ponsPoolToken:s?e.to:e.from},expectedSpend:a.expectedSpend.amount,expectedRefund:a.expectedRefund.amount,feeDisclosure:j,oakFee:"0"});ke(x,B),c(B);for(let[U,L]of o)BigInt(ee())>=BigInt(L.quote.expiresAt)&&o.delete(U);for(;o.size>=Oe;)o.delete(o.keys().next().value);return o.set(B.quoteId,{quote:{...B},txs:m.txs.map(U=>({...U})),summary:m.summary}),B},async build(e,p){let s=o.get(e);if(!s)throw new be;if(c(s.quote),Q(p),!P(p,s.quote.wallet))throw new d("Quote was issued for a different wallet.");let i=s.txs.map(a=>({...a}));ke(i.at(-1),s.quote);let m=await n.preview(i,p);if(c(s.quote),m.changes.filter(a=>P(H(a.token.address),H(s.quote.to))).reduce((a,l)=>a+BigInt(l.amount),0n)<BigInt(s.quote.minAmountOut))throw new d("Preview retained output is below the accepted minimum.");return{txs:i,summary:`${s.summary} ${m.summary} ${s.quote.feeDisclosure}`}}}}async function Le(n,t,r){return n.clientFor(b).readContract({address:Re.factory.address,abi:_e,functionName:"getLaunchedToken",args:[F(t)],...r===void 0?{}:{blockNumber:r}})}async function Ze(n,t,r,o){let c=await Le(n,r,o);return c.exists&&P(c.token,r)&&P(y(c.pairToken),y(t))}async function bn(n,t,r,o,c){if(typeof r.token!="string")throw new d("Provide a launch token address.");Q(r.token);let e=F(r.token),p=await Le(n,e,c);if(!p.exists||!P(p.token,e))throw new d("This address is not a Pons launch token.");let s=y(p.pairToken)===K?fe:F(p.pairToken);return De(r.pairToken,F(p.pairToken),t,s),{quote:await Ue(n,!1,c).quote({from:t?s:e,to:t?e:s,amountIn:String(r.amountIn),...r.slippageBps===void 0?{}:{slippageBps:r.slippageBps}},o),input:t?s:e}}var en=n=>({tools:[!0,!1].map(t=>({name:t?"pons_buy":"pons_sell",inputSchema:Ye,async execute(r,o){try{return await Fe(n,r,o,t)}catch(c){throw new d(n.plainError(c))}}}))}),kn=en;export{hn as a,Ue as b,bn as c,en as d,kn as e};
|
|
1
|
+
import{A as Ee,a as Be,b as he,g as Z,h as be,i as Oe,m as ee,n as D,y as ke}from"./TTBB6EFN.js";import{b as y,c as qe}from"./GVCNTGLC.js";import{a as fe,b as H}from"./7WXAS54T.js";import{a as Q}from"./43LI5NKJ.js";import{a as Ie}from"./IOYRL6AY.js";import{a as $e}from"./66F5ZH34.js";import{c as le,g as P}from"./NWNYJ26T.js";import{b as Se}from"./IX3GZMTM.js";import{b,j as me}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";import{a as pe}from"./JXOEJPJ4.js";import{randomUUID as ze}from"node:crypto";import{encodeAbiParameters as ne,encodeFunctionData as we,erc20Abi as ge,getAddress as F,parseAbi as X,parseAbiParameters as oe,zeroAddress as K}from"viem";var Re=me[b].pons,C=me[b].ponsTrade,_e=X(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),te=X(["function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)","function feeBps() view returns (uint256)","function creatorTaxBps() view returns (uint256)","function currentSnipeTaxBps(address) view returns (uint256)","function sellableTokens() view returns (uint256)","function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]),He=X(["function quoteExactInputSingle(((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)"]),Ke=X(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),Xe=X(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),je=oe("((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint256 minHopPriceX36,bytes hookData)"),Ge={address:fe,chainId:b,decimals:18,symbol:"ETH"},Qe="There is no on-chain expiry. The signed transaction is protected by its minimum output.",Ve="This trade must be sent within 5 minutes of its quote. If you approve later, Oak shows you fresh terms first.",We=`Quote expiry is enforced by Oak before signing only. ${Qe}`,$=10000n,Te=(1n<<256n)-1n,Ne=(1n<<128n)-1n,I=(n,t)=>({token:n,amount:t.toString()}),Ce=(n,t)=>(n+t-1n)/t,Me="Reuse existing exact allowance";async function Je(n,t,r,o,c){try{let e=await n.readContract({address:t,abi:ge,functionName:"allowance",args:[r,o],blockNumber:c});return typeof e=="bigint"?e:void 0}catch{return}}var Ye={type:"object",additionalProperties:!1,required:["token","amountIn"],properties:{token:{...le,description:"Pons launch token address on chain 4663."},amountIn:$e('Input in base units: pair token for buys (use its decimals), launch token for sells (18 decimals). Examples: "1000000" = 1 pair token at 6 decimals; "1000000000000000000" = 1 launch token.'),pairToken:{...le,description:"The launch pair from pons_status. Required to buy a custom-pair launch, so amountIn is never read in the wrong units; omit or use the zero address for native ETH."},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999,default:he}}};function De(n,t,r,o){if(n===void 0){if(r&&y(t)!==K)throw new d(`This Pons launch is paired with ${o}; amountIn is in that token's base units. Repeat with pairToken "${t}" to confirm the input asset.`);return}if(typeof n!="string")throw new d("pairToken must be a token address.");if(Q(n),!P(y(n),y(t)))throw new Z(`This Pons launch trades only against ${o}.`)}async function Fe(n,t,r,o,{quoteOnly:c=!1,curveOnly:e=!1,blockNumber:p}={}){if(Q(r),Object.keys(t).some(f=>!["token","amountIn","slippageBps","pairToken"].includes(f)))throw new d("Provide only token, amountIn, optional pairToken and optional slippageBps.");if(typeof t.token!="string")throw new d("Provide a launch token address.");Q(t.token);let s=F(t.token),i=Se(t.amountIn);if(i===0n||i>Te)throw new d("Trade amount must be positive and within the uint256 range.");let m=t.slippageBps??he;if(typeof m!="number"||!Number.isInteger(m)||m<0||m>=1e4)throw new d("Slippage must be an integer from 0 to 9999 basis points.");let x=f=>f*($-BigInt(m))/$,a=n.clientFor(b),l=p===void 0?await a.getBlock():await a.getBlock({blockNumber:p});if(p!==void 0&&l.number!==p)throw new d("Pons quote snapshot is unavailable.");let u=await a.readContract({address:Re.factory.address,abi:_e,functionName:"getLaunchedToken",args:[s],blockNumber:l.number});if(!u.exists||!P(u.token,s))throw new d("This address is not a Pons launch token.");if(e&&u.phase!==0)throw new Z("Pons curve quotes are only available before graduation.");if(u.phase===1)throw new d("Pons graduation is pending; the curve is closed and the pool is not ready.");if(u.phase===3)throw new d("This Pons launch was rescued and has no active trade route.");if(u.phase!==0&&u.phase!==2)throw new d("This Pons launch has an unknown trade phase.");let g=y(u.pairToken)===K,M=F(u.pairToken);if(P(M,s))throw new d("This Pons launch has an invalid pair.");let j=f=>Promise.all([a.readContract({address:f,abi:ge,functionName:"symbol",blockNumber:l.number}),a.readContract({address:f,abi:ge,functionName:"decimals",blockNumber:l.number})]),[[B,U],L]=await Promise.all([j(s),g?void 0:j(M)]),w=L?{address:M,chainId:b,symbol:pe(L[0]),decimals:L[1]}:Ge,G=g?"native ETH":`${w.symbol} (${w.address})`;De(t.pairToken,M,o,`${G}, ${w.decimals} decimals`);let V={address:s,chainId:b,symbol:pe(B),decimals:U},se=o?w:V,ie=o?V:w,q=[],re=(f,h,S,A)=>n.unsignedTx({to:f,data:h,value:S.toString(),chainId:b,description:A}),T,k,W,O=i,ve=null,ae,ye="",ue;if(u.phase===0){let f=v=>a.readContract({address:u.curve,abi:te,functionName:v,blockNumber:l.number}),[[h,S],A,R,E,_]=await Promise.all([a.readContract({address:u.curve,abi:te,functionName:"getReserves",blockNumber:l.number}),f("feeBps"),f("creatorTaxBps"),o?a.readContract({address:u.curve,abi:te,functionName:"currentSnipeTaxBps",args:[r],blockNumber:l.number}):Promise.resolve(0n),o?f("sellableTokens"):Promise.resolve(0n)]);if(h<=0n||S<=0n||A+R>$-100n)throw new d("Pons curve reserves or fee settings are unavailable.");let J=$-A-R-100n,N=E<J?E:J,Ae=v=>({base:v*A/$,creator:v*R/$,snipe:v*N/$}),Pe=v=>{let z=Ae(v);return v-z.base-z.creator-z.snipe},Y;if(o){if(_<=0n||_>=S)throw new d("The curve has no available sellable tokens.");let v=Pe(i);if(T=v*S/(h+v),T>=_){T=_;let z=T*h/(S-T)+1n;O=Ce(z*$,$-A-R-N),O>i&&(O=i)}Y=O,k=x(T),W=Ce(k*i,O),g||q.push(n.approval(w.address,u.curve,i.toString(),b))}else Y=i*h/(S+i),T=Pe(Y),k=x(T),q.push(n.approval(s,u.curve,i.toString(),b));let ce=Ae(Y);ve={base:I(w,ce.base),creator:I(w,ce.creator),snipe:I(w,ce.snipe)},ae=`Curve fees included: ${A} base, ${R} creator and ${N} opening-tax basis points, each rounded separately.`,q.push(re(u.curve,we({abi:te,functionName:o?"buy":"sell",args:[i,W??k,r]}),o&&g?i:0n,o?`Buy Pons curve tokens with ${G}.`:`Sell Pons curve tokens for ${G}.`))}else{if(i>Ne)throw new d("Trade amount exceeds the router uint128 range.");let f=qe(u.pairToken,s,u.poolFee,u.tickSpacing),h=o?y(u.pairToken):s,S=o?s:y(u.pairToken),A=P(h,f.currency0);if(T=(await a.simulateContract({address:C.quoter.address,abi:He,functionName:"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:A,exactAmount:i,hookData:"0x"}],account:r,gas:Ie,blockNumber:l.number})).result[0],k=x(T),k>Ne)throw new d("Minimum output exceeds the router uint128 range.");let E=l.timestamp+300n;if(ue=E.toString(),E>=1n<<48n)throw new d("Permit2 expiry exceeds its timestamp range.");if(h!==K){let N=!c&&await Je(a,h,r,C.permit2.address,l.number)===i;N||q.push(n.approval(h,C.permit2.address,i.toString(),b)),ye=N?`${Me}: ${i} input base units already approved to Permit2. `:"",q.push(re(C.permit2.address,we({abi:Xe,functionName:"approve",args:[h,C.universal_router.address,i,Number(E)]}),0n,`${N?`${Me}. `:""}Approve the exact token amount to the Pons router through Permit2 for five minutes.`))}let _=[ne(je,[{poolKey:f,zeroForOne:A,amountIn:i,amountOutMinimum:k,minHopPriceX36:0n,hookData:"0x"}]),ne(oe("address,uint256"),[h,i]),ne(oe("address,uint256"),[S,k])],J=ne(oe("bytes,bytes[]"),["0x060c0f",_]);q.push(re(C.universal_router.address,we({abi:Ke,functionName:"execute",args:["0x10",[J],E]}),h===K?i:0n,"Trade through Pons Universal Router v2.1.2.")),ae="Quoter output is net of Pons hook fees; no additional fee is subtracted."}if(T<=0n||k<=0n||k>Te||(W??k)>Te)throw new d("Trade output or minimum is outside the supported positive range.");let xe=c?{changes:[],summary:"Quote only; preview is required before sending."}:await n.preview(q,r),de=i-O;return{txs:q,changes:xe.changes,...ue===void 0?{}:{expiresAt:ue},summary:`${o?"Buy":"Sell"} ${V.symbol} (${V.address}) on chain ${b}${g?"":` ${o?"with":"for"} ${G}`}. ${ae} ${ye}${u.phase===0?`${Qe} `:`${Ve} `}${de>0n?`Expected ${g?"native refund":"refund"}: ${n.formatAmount(de.toString(),w.decimals)} ${w.symbol}; minimum output uses the expected spend after refund. `:""}${xe.summary}`,pairToken:w,quote:{phase:u.phase,amountIn:I(se,i),amountOut:I(ie,T),minAmountOut:I(ie,k),minimumKind:"absolute",calldataMinAmountOut:I(ie,W??k),expectedSpend:I(se,O),expectedRefund:I(se,de),fees:ve,blockNumber:l.number.toString(),blockTimestamp:l.timestamp.toString()}}}function hn(n){return Ue(n,!0)}function Ue(n,t=!1,r){let o=new Map,c=e=>{if(BigInt(ee())>=BigInt(e.expiresAt))throw new be};return{name:"pons",async quote(e,p){if(e={...e,from:H(e.from),to:H(e.to)},D(e.from)&&D(e.to))throw new Z("Pons quotes require a launch token and its pair token.");let s=D(e.from)||!D(e.to)&&await Ze(n,e.from,e.to,r),i=ee(),m=await Fe(n,{token:s?e.to:e.from,amountIn:e.amountIn,slippageBps:e.slippageBps,pairToken:y(s?e.from:e.to)},p,s,{quoteOnly:!0,curveOnly:t,blockNumber:r}),x=m.txs.at(-1),a=m.quote,l=String(BigInt(r===void 0?i:a.blockTimestamp)+BigInt(Be)),u=a.minAmountOut.amount,g=a.fees,M=D(m.pairToken.address)?"native ETH base units (18 decimals)":`${m.pairToken.symbol} (${m.pairToken.address}) base units (${m.pairToken.decimals} decimals)`,j=g?`Pons curve fees included in net output: ${g.base.amount} base, ${g.creator.amount} creator and ${g.snipe.amount} opening tax, in ${M}. Oak swap fee: 0 (venue fee is never Oak income). ${We}`:"Quoter output is net of Pons hook fees; no additional fee is subtracted. Oak swap fee: 0.",B=Ee({...e,quoteId:`pons:${ze()}`,provider:"pons",wallet:p,chainId:b,router:x.to,spender:a.phase===0?x.to:C.permit2.address,expiresAt:l,data:x.data,value:x.value,amountOut:a.amountOut.amount,minAmountOut:u,blockNumber:a.blockNumber,...a.phase===0?{ponsCurveToken:s?e.to:e.from,calldataMinAmountOut:a.calldataMinAmountOut.amount}:{ponsPoolToken:s?e.to:e.from},expectedSpend:a.expectedSpend.amount,expectedRefund:a.expectedRefund.amount,feeDisclosure:j,oakFee:"0"});ke(x,B),c(B);for(let[U,L]of o)BigInt(ee())>=BigInt(L.quote.expiresAt)&&o.delete(U);for(;o.size>=Oe;)o.delete(o.keys().next().value);return o.set(B.quoteId,{quote:{...B},txs:m.txs.map(U=>({...U})),summary:m.summary}),B},async build(e,p){let s=o.get(e);if(!s)throw new be;if(c(s.quote),Q(p),!P(p,s.quote.wallet))throw new d("Quote was issued for a different wallet.");let i=s.txs.map(a=>({...a}));ke(i.at(-1),s.quote);let m=await n.preview(i,p);if(c(s.quote),m.changes.filter(a=>P(H(a.token.address),H(s.quote.to))).reduce((a,l)=>a+BigInt(l.amount),0n)<BigInt(s.quote.minAmountOut))throw new d("Preview retained output is below the accepted minimum.");return{txs:i,summary:`${s.summary} ${m.summary} ${s.quote.feeDisclosure}`}}}}async function Le(n,t,r){return n.clientFor(b).readContract({address:Re.factory.address,abi:_e,functionName:"getLaunchedToken",args:[F(t)],...r===void 0?{}:{blockNumber:r}})}async function Ze(n,t,r,o){let c=await Le(n,r,o);return c.exists&&P(c.token,r)&&P(y(c.pairToken),y(t))}async function bn(n,t,r,o,c){if(typeof r.token!="string")throw new d("Provide a launch token address.");Q(r.token);let e=F(r.token),p=await Le(n,e,c);if(!p.exists||!P(p.token,e))throw new d("This address is not a Pons launch token.");let s=y(p.pairToken)===K?fe:F(p.pairToken);return De(r.pairToken,F(p.pairToken),t,s),{quote:await Ue(n,!1,c).quote({from:t?s:e,to:t?e:s,amountIn:String(r.amountIn),...r.slippageBps===void 0?{}:{slippageBps:r.slippageBps}},o),input:t?s:e}}var en=n=>({tools:[!0,!1].map(t=>({name:t?"pons_buy":"pons_sell",inputSchema:Ye,async execute(r,o){try{return await Fe(n,r,o,t)}catch(c){throw new d(n.plainError(c))}}}))}),kn=en;export{hn as a,Ue as b,bn as c,en as d,kn as e};
|