@oakagentkit/core 0.3.5 → 0.3.7
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/merkl/stock-lp.d.ts +51 -0
- package/build/dist/api/modules/merkl/stock-lp.js +1 -0
- 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.d.ts +1 -0
- 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/{HFVXNKA5.js → 2BM2WX2G.js} +1 -1
- package/build/dist/chunks/{HDBZZOHJ.js → 2GYL3N2O.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/{FRT6AC6M.js → 2ZYFBBOE.js} +1 -1
- package/build/dist/chunks/{LCH6F5HT.js → 342OZP53.js} +1 -1
- package/build/dist/chunks/{XADHV2DT.js → 35DTANJW.js} +1 -1
- package/build/dist/chunks/{4IOHSX3Z.js → 37UBQQWL.js} +1 -1
- 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/{JDHPMS7X.js → 4JU23O3Z.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/{CNDIAF3P.js → 4WYTIM4T.js} +1 -1
- package/build/dist/chunks/{HPS4KOU4.js → 52AEVHKJ.js} +1 -1
- package/build/dist/chunks/{ZTKT3ZQK.js → 53VBLEYS.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/5EQTOA5F.js +1 -0
- 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/{FAH7FKUT.js → 5UWVXEPD.js} +1 -1
- package/build/dist/chunks/{KKTOBXIT.js → 5VA66LFF.js} +1 -1
- package/build/dist/chunks/5VKVAUFQ.js +1 -0
- package/build/dist/chunks/5Y457HYC.js +1 -0
- package/build/dist/chunks/627SGCTU.js +1 -0
- package/build/dist/chunks/64LAWFBE.js +1 -0
- package/build/dist/chunks/{6F527FLN.js → 6HNQAYBM.js} +1 -1
- package/build/dist/chunks/{FUP53K6G.js → 6LDC5D2S.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/{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/{E47UYYK4.js → 7KK3OC7Q.js} +1 -1
- package/build/dist/chunks/{IZP3EKKS.js → 7PBCV7VS.js} +1 -1
- package/build/dist/chunks/{A3BJSQ23.js → 7VU5VCTL.js} +1 -1
- package/build/dist/chunks/{Z7FGEWO2.js → 7WXAS54T.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/{2I7XHRTI.js → AOTTQPK7.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/B4U43D5Z.js +1 -0
- package/build/dist/chunks/B5B7U3NZ.js +1 -0
- 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/{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/{F7MGYRPU.js → CCPG6PRL.js} +1 -1
- package/build/dist/chunks/{OI3N4EW4.js → CG7ABZXH.js} +1 -1
- package/build/dist/chunks/{S37D7HOK.js → CITHH7NK.js} +1 -1
- package/build/dist/chunks/CJMVRV34.js +1 -0
- package/build/dist/chunks/{JJSCDDQO.js → CLHA557R.js} +1 -1
- package/build/dist/chunks/CQPIR6ER.js +1 -0
- package/build/dist/chunks/{MI5HZDMH.js → D6JOXK7Q.js} +1 -1
- package/build/dist/chunks/{IZFED3R2.js → DLNDJZR4.js} +1 -1
- package/build/dist/chunks/{UUF4Z6K6.js → DUTAMN3F.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/{2PS4GCOZ.js → EKHNXPWO.js} +1 -1
- package/build/dist/chunks/EWZFZUVF.js +1 -0
- package/build/dist/chunks/EXKV6QJD.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/FMEO7RX7.js +1 -0
- package/build/dist/chunks/{ZQPC54J5.js → FYWK3UK6.js} +1 -1
- package/build/dist/chunks/G53U6Y4L.js +1 -0
- package/build/dist/chunks/{O5QTITN6.js → GRHBE4MQ.js} +1 -1
- package/build/dist/chunks/GV6FZ6UG.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/H5J2LFPZ.js +1 -0
- package/build/dist/chunks/{DCGNVMKG.js → HC3QFA5I.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/{G5AMH4IP.js → HN5RBTNE.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/{C57DITTF.js → HTOP2OKU.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/ILTGXU6G.js +1 -0
- package/build/dist/chunks/{I4473OC6.js → IMD33NQS.js} +1 -1
- package/build/dist/chunks/{X24YTJST.js → IY7FWTAL.js} +1 -1
- package/build/dist/chunks/{TOIKOIY6.js → J5624CVF.js} +1 -1
- package/build/dist/chunks/JCS24YBB.js +1 -0
- package/build/dist/chunks/JFYC2LVI.js +1 -0
- package/build/dist/chunks/JQVTHPUO.js +1 -0
- package/build/dist/chunks/{TGXEKBLV.js → JUVY6PCR.js} +1 -1
- package/build/dist/chunks/JYED2PZ3.js +1 -0
- package/build/dist/chunks/{KO7ANIKY.js → K3HCSCXE.js} +1 -1
- package/build/dist/chunks/{7VH6JQ2H.js → K5C6QBOO.js} +1 -1
- package/build/dist/chunks/{W7BFM6CK.js → KAXLZJU6.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/{TZ7S5KRB.js → KW5LJGNY.js} +1 -1
- package/build/dist/chunks/{SUNTJ6IU.js → KYANIEPX.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/LHC2YV2U.js +1 -0
- package/build/dist/chunks/{R66NSNNQ.js → LHVGWNMW.js} +1 -1
- package/build/dist/chunks/{RUHNLNVX.js → LOH6LUVT.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/MFRKZOU4.js +1 -0
- package/build/dist/chunks/{V4UJMUIB.js → MLN5KTG7.js} +1 -1
- package/build/dist/chunks/{TJU644I7.js → MSIT5Q3M.js} +1 -1
- package/build/dist/chunks/{S4JUFCT4.js → MSQNOK3I.js} +1 -1
- package/build/dist/chunks/NCCKCGKL.js +1 -0
- package/build/dist/chunks/NGHRUNXO.js +1 -0
- package/build/dist/chunks/{N65J3L2H.js → NIGRNLNM.js} +1 -1
- package/build/dist/chunks/{DXAPKN7H.js → NLC36QHL.js} +1 -1
- package/build/dist/chunks/NUTTPUYJ.js +1 -0
- package/build/dist/chunks/{QMIH6HXH.js → NWW6GY5E.js} +1 -1
- 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/{A4K5GXVO.js → ORKXBYVC.js} +1 -1
- package/build/dist/chunks/OUXPOFY2.js +1 -0
- package/build/dist/chunks/{NIWAVMDR.js → OWHXYE2G.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/PLEJPTTK.js +1 -0
- package/build/dist/chunks/{VREGY7E6.js → PMFR47H3.js} +1 -1
- package/build/dist/chunks/{ZXRIJG6H.js → PX2G2H6G.js} +1 -1
- package/build/dist/chunks/QAAKUIWE.js +1 -0
- package/build/dist/chunks/{YXXK6EPI.js → QBHY2QRC.js} +1 -1
- package/build/dist/chunks/{WQ2XTDHO.js → QCPJZBEO.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/QGO4EKXZ.js +1 -0
- package/build/dist/chunks/{IPU656WB.js → QKH7ED6B.js} +1 -1
- package/build/dist/chunks/{XW3VGWXK.js → QMWHQRYC.js} +1 -1
- package/build/dist/chunks/{USGMGKAG.js → QXBQ7WPB.js} +1 -1
- package/build/dist/chunks/{MQXSCNUL.js → R5UOFPDO.js} +1 -1
- package/build/dist/chunks/{MDLJFCT4.js → R5Z4HPCA.js} +1 -1
- package/build/dist/chunks/{A4FLWHLP.js → REXGROOD.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/{PV7FEVBD.js → RWEA4SWP.js} +1 -1
- package/build/dist/chunks/{ZKBOPZH5.js → RWUF6T4I.js} +1 -1
- package/build/dist/chunks/{USEF3QKG.js → S432S6NA.js} +1 -1
- package/build/dist/chunks/{XTXXWRN2.js → SDDYM2H3.js} +1 -1
- package/build/dist/chunks/{2OVJ2BTJ.js → SEXKWYUM.js} +1 -1
- package/build/dist/chunks/TKJ4GFUP.js +1 -0
- 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/{OVM4QIET.js → U4MSIH4G.js} +1 -1
- package/build/dist/chunks/{LKUZAJPZ.js → UCMOQAVD.js} +1 -1
- package/build/dist/chunks/{OB3YMTDI.js → UIVOYAO2.js} +1 -1
- package/build/dist/chunks/{3YH5B5NQ.js → UL4DY6GX.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/{MJGEGNDU.js → UYYYSFMQ.js} +1 -1
- package/build/dist/chunks/{4RCYYN6O.js → V7HTGO23.js} +1 -1
- package/build/dist/chunks/{O2QBSINK.js → V7P4PCLL.js} +1 -1
- package/build/dist/chunks/{FRVCSDKU.js → VMSGNN3D.js} +1 -1
- package/build/dist/chunks/VQMBPY2P.js +1 -0
- package/build/dist/chunks/{HZSYMGJ2.js → VS7ZA4OF.js} +1 -1
- package/build/dist/chunks/{BJ2U2VXJ.js → VTWAVH74.js} +1 -1
- package/build/dist/chunks/W3M4KAPX.js +1 -0
- package/build/dist/chunks/{LZM3DO5Q.js → W5GWK72I.js} +1 -1
- package/build/dist/chunks/{65OITTDL.js → W73SLWBT.js} +1 -1
- package/build/dist/chunks/{2FOI2625.js → W7BTXU3F.js} +1 -1
- package/build/dist/chunks/{6LVHN33V.js → WADRRW3E.js} +1 -1
- package/build/dist/chunks/{ZXFJKW6H.js → WG7PMGTJ.js} +1 -1
- package/build/dist/chunks/{N742W5KX.js → WRNPYW47.js} +1 -1
- package/build/dist/chunks/{XL3W7DAQ.js → X3BB6WME.js} +1 -1
- package/build/dist/chunks/{SX5YNFHG.js → XD4JA43O.js} +1 -1
- package/build/dist/chunks/{GBPB7JIB.js → XSQJOOEY.js} +1 -1
- package/build/dist/chunks/{3BQ5XHDJ.js → Y7SKGRWC.js} +1 -1
- package/build/dist/chunks/{R73R4KN3.js → YBLJ2MCR.js} +1 -1
- package/build/dist/chunks/{6CKCZJ3F.js → YDJHXSS7.js} +1 -1
- package/build/dist/chunks/{GKUPC4DO.js → YLU5JVRI.js} +1 -1
- package/build/dist/chunks/YR6Y6UIR.js +1 -0
- package/build/dist/chunks/{FHB7QYJO.js → Z5WRTISY.js} +1 -1
- package/build/dist/chunks/ZB67QDN2.js +1 -0
- package/build/dist/chunks/{O4P5IQCP.js → ZRG34Y7Q.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/7TRO6MBQ.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/M267JEDO.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/QBNASL3T.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{e as u,f as i}from"./UMY6SP7C.js";import{a}from"./XSD5NL7J.js";function p(e,t){if(u(t,["id","cap"],["id","cap"]),t.id!=="wallet-cap")throw new a("Choose Hook Block wallet-cap.");let o=i(t.cap,128);if(!e.guardEndBlock||!o||(e.potEveryNBuys&1<<19)!==0||(e.potMinBuyQuote&(1n<<19n)-1n)!==0n)throw new a("Wallet Cap requires a launch guard and a positive, unoccupied cap.");let n=1n;for(let r=0;r<=31;r++,n*=10n)if(o%n===0n&&o/n<16384n)return{...e,potEveryNBuys:e.potEveryNBuys|1<<30|1<<19,potMinBuyQuote:e.potMinBuyQuote|o/n|BigInt(r)<<14n};throw new a("Wallet Cap must be exactly representable as a mantissa below 16384 times a power of ten up to 31.")}function l(e){let t=e.potMinBuyQuote;return`Wallet Cap: each wallet may buy at most ${(t&16383n)*10n**(t>>14n&31n)} subject base units during the launch guard; sales do not restore the allowance. unauthenticated trades count tx.origin, and authenticated contract payers also count their transaction signer. The launch buy and qualifying lane executor swaps are exempt. No fee is charged.`}export{p as a,l as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,b as N,c as _}from"./
|
|
1
|
+
import{a as U,b as N,c as _}from"./QMWHQRYC.js";import{e as S}from"./DWRRIFXS.js";import{b as k,c as R}from"./SEXKWYUM.js";import{a as q,c as f,d as h,f as I,g as D}from"./5BPFF7NX.js";import{g as B}from"./OUROA7XR.js";import{a as b,c as O}from"./43LI5NKJ.js";import{b as v}from"./66F5ZH34.js";import{b as A}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as $}from"viem";var K=a=>{function w(e,n){if(Object.keys(e).some(m=>!n.includes(m)))throw new s("Use only the inputs shown for this Pendle tool. YT and LP actions are not supported.")}function j(e){if(typeof e!="string"||!/^[0-9]+$/.test(e)||e.length>78)throw new s("Provide a positive decimal base-unit amount as a string.");return k(BigInt(e),!0)}function C(e,n){let m=e==="stable"?100:200,r=n===void 0?e==="stable"?50:100:n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new s("Slippage must be a whole number of basis points.");if(r>m)throw new s(`Oak won't accept a price move that big. The most it allows is ${m/100}%.`);return r}async function y(e,n,m){w(n,["market","amount","slippageBps"]),f(h(m,a.wallet),"wallet does not match this request"),b(n.market);for(let r=0;r<2;r++){let t=await a.verify(n.market);f(h(t.market,n.market),"verified market does not match the request");let d=await a.client.getBlock();if(t.expired||d.timestamp>=BigInt(t.expiry))throw new s("This Pendle term has ended. Use pendle_redeem to cash out.");let p=C(t.kind,n.slippageBps),o=e==="sell"&&n.amount==="max"?k(await a.client.readContract({address:t.pt,abi:$,functionName:"balanceOf",args:[a.wallet],blockNumber:d.number}),!0):j(n.amount),i=e==="buy"?t.inputToken:t.pt,l=e==="buy"?t.pt:t.inputToken,u=await B(a.http,{inputToken:i,outputToken:l,amount:o,wallet:a.wallet,slippageBps:p}),c=(e==="buy"?I:D)(u.body,{market:t,wallet:a.wallet,amount:o,slippageBps:p});if(Math.abs(c.priceImpact)>.03)throw new s("This is a thin market and your size moves the price too much. Try a smaller amount.");if(Date.now()-u.receivedAt>3e4)continue;await R(a.client,t,e,o,c.amountOut,c.priceImpact);let T=Date.now()-u.receivedAt;if(T<0||T>3e4)continue;let x=e==="sell"?{wallet:a.wallet,market:t.market,pt:t.pt,outputToken:l,amountIn:o.toString(),amountOut:c.amountOut.toString(),minOut:c.minOut.toString(),ptDecimals:t.ptDecimals,outputDecimals:t.inputDecimals,endsAt:t.expiry,feeUsd:c.feeUsd,receivedAt:u.receivedAt,data:c.tx.data}:void 0;return{txs:[O(i,q,o.toString(),A),c.tx],...x?{pendleSellQuote:x}:{},summary:e==="buy"?"Approve the exact input amount, then buy Pendle PT.":"Approve the exact PT amount, then sell early at today\u2019s market price."}}throw new s("Pendle\u2019s quote became too old. Try again for a fresh price.")}async function M(e,n){w(e,["market","minOutBps"]),f(h(n,a.wallet),"wallet does not match this request");let m=U(e.minOutBps),r;if(e.market==="all")try{r=await S(a.client)}catch{throw new s("Oak could not read ended Pendle markets from the chain. Provide one ended market address to cash it out.")}else b(e.market),r=[e.market];let t=[];for(let o of r){let i=await a.verify(o);if(f(h(i.market,o),"verified market does not match the request"),e.market==="all"&&!i.expired)continue;let l=k(await a.client.readContract({address:i.pt,abi:$,functionName:"balanceOf",args:[a.wallet]}));l!==0n&&t.push({verified:i,balance:l})}if(t.length>1)throw new s(`Ended Pendle terms are cashed out one at a time. Run pendle_redeem with one of these market addresses: ${t.map(({verified:o})=>o.market).join(", ")}.`);let d=[],p=[];for(let{verified:o,balance:i}of t){let l=await N(a,o,i,m);d.push(...l.txs);let u=await _(a,o,i,l.expected,m);u&&p.push(u)}return{txs:d,summary:d.length?["Cash out ended Pendle PT balances to each market\u2019s input token.",...p].join(" "):"No PT balance in the selected ended Pendle terms."}}let g={type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Pendle market address returned by pendle_list."},P={type:"integer",minimum:0,maximum:200,description:"USDG: default 50, cap 100 bps. Stock tokens: default 100, cap 200 bps; the verified market determines the cap."};return[{name:"pendle_buy",inputSchema:{type:"object",properties:{market:g,amount:v("Positive decimal base units of the market input token; read its decimals first."),slippageBps:P},required:["market","amount"],additionalProperties:!1},execute:(e,n)=>y("buy",e,n)},{name:"pendle_sell",inputSchema:{type:"object",properties:{market:g,amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:"PT decimal base units, or max for the full PT balance."},slippageBps:P},required:["market","amount"],additionalProperties:!1},execute:(e,n)=>y("sell",e,n)},{name:"pendle_redeem",inputSchema:{type:"object",properties:{market:{type:"string",anyOf:[{pattern:"^0x[0-9a-fA-F]{40}$"},{const:"all"}],description:"Ended market address, or all ended markets held by this wallet."},minOutBps:{type:"integer",minimum:0,maximum:50,default:10,description:"Maximum reduction from the on-chain redemption estimate, in basis points."}},required:["market"],additionalProperties:!1},execute:M}]};export{K as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as v,h as W,i as j,n as z}from"./
|
|
1
|
+
import{e as v,h as W,i as j,n as z}from"./4JU23O3Z.js";import{a as B,e as F,g as R}from"./PX2G2H6G.js";import{A as D,b as C,c as O,t as X}from"./2ZYFBBOE.js";import{a as H}from"./66F5ZH34.js";import{g as U}from"./NWNYJ26T.js";import{b as L}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{decodeEventLog as J,parseAbi as V,toEventSelector as Z,toHex as x}from"viem";var K=V(["function getPositionInfo(bytes32 poolId,address owner,int24 tickLower,int24 tickUpper,bytes32 salt) view returns (uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128)","function getFeeGrowthInside(bytes32 poolId,int24 tickLower,int24 tickUpper) view returns (uint256,uint256)"]),Q=V(["function ownerOf(uint256) view returns (address)","function getPoolAndPositionInfo(uint256) view returns ((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks),uint256)"]),P=V(["function slot0() view returns (uint160,int24,uint16,uint16,uint16,uint8,bool)","function feeGrowthGlobal0X128() view returns (uint256)","function feeGrowthGlobal1X128() view returns (uint256)","function ticks(int24) view returns (uint128,int128,uint256,uint256,int56,uint160,uint32,bool)"]),$=(1n<<256n)-1n,ee=1n<<128n,A=(s,t)=>s-t&$;function G(s,t,r,n=0n){return A(s,t)*r/ee+n}function ue(s){return{tools:[{name:"uniswap_fees",inputSchema:{type:"object",additionalProperties:!1,required:["version","tokenId"],properties:{includeHistory:{type:"boolean",description:"V3 only: read the complete NFT collect/decrease event history for lifetime fees. This can require multiple RPC log windows."},version:{description:'Uniswap version: "v3" for concentrated liquidity or "v4" for PoolManager.',type:"string",enum:["v3","v4"]},tokenId:H('Identifier of the position NFT, as a decimal string. Example: "1".')}},async execute(t){if(R(t,["version","tokenId","includeHistory"]),t.includeHistory!==void 0&&typeof t.includeHistory!="boolean")throw new c("includeHistory must be a boolean.");if(t.includeHistory===!0&&t.version!=="v3")throw new c("V4 position lifetime fees need historical liquidity/fee-growth checkpoints; no verified history source is configured.");let r=B(t.tokenId,"tokenId"),n=s.clientFor(L),i=await n.getBlockNumber();if(t.version!=="v3"&&t.version!=="v4")throw new c("Provide version v3 or v4 for fee reads.");let _=await n.readContract({address:t.version==="v4"?C:v.positionManager,abi:Q,functionName:"ownerOf",args:[r],blockNumber:i}),b,m,a,d,u,w=0n,p=0n;if(t.version==="v4"){let[e,f]=await n.readContract({address:C,abi:Q,functionName:"getPoolAndPositionInfo",args:[r],blockNumber:i}),{tickLower:h,tickUpper:N}=D(f),S=X(e),[k,I]=await Promise.all([n.readContract({address:O,abi:K,functionName:"getPositionInfo",args:[S,C,h,N,x(r,{size:32})],blockNumber:i}),n.readContract({address:O,abi:K,functionName:"getFeeGrowthInside",args:[S,h,N],blockNumber:i})]);[b,m,a]=[e.currency0,e.currency1,k[0]],[d,u]=[G(I[0],k[1],a),G(I[1],k[2],a)]}else if(t.version==="v3"){let e=z(await n.readContract({address:v.positionManager,abi:W,functionName:"positions",args:[r],blockNumber:i})),f=await n.readContract({address:v.factory,abi:j,functionName:"getPool",args:[e.token0,e.token1,e.fee],blockNumber:i}),[h,N,S,k,I]=await Promise.all([n.readContract({address:f,abi:P,functionName:"slot0",blockNumber:i}),n.readContract({address:f,abi:P,functionName:"feeGrowthGlobal0X128",blockNumber:i}),n.readContract({address:f,abi:P,functionName:"feeGrowthGlobal1X128",blockNumber:i}),n.readContract({address:f,abi:P,functionName:"ticks",args:[e.tickLower],blockNumber:i}),n.readContract({address:f,abi:P,functionName:"ticks",args:[e.tickUpper],blockNumber:i})]),M=(q,E,T)=>A(A(q,h[1]>=e.tickLower?E:A(q,E)),h[1]<e.tickUpper?T:A(q,T));[b,m,a]=[e.token0,e.token1,e.liquidity],[w,p]=[e.tokensOwed0,e.tokensOwed1],[d,u]=[G(M(N,k[2],I[2]),e.feeGrowthInside0LastX128,a,e.tokensOwed0),G(M(S,k[3],I[3]),e.feeGrowthInside1LastX128,a,e.tokensOwed1)]}else throw new c('Provide version "v3" or "v4" for fee reads.');let[o,g]=await Promise.all([F(s,b,i),F(s,m,i)]),y=[{token:o,amount:d.toString()},{token:g,amount:u.toString()}],l=t.includeHistory===!0?await te(s,r,i,d,u):void 0;return{version:t.version,tokenId:r.toString(),owner:_,blockNumber:i.toString(),liquidity:a.toString(),...t.version==="v4"?{uncollected:y}:{},collectable:y,feeGrowthAccrual:[{token:o,amount:(d-w).toString()},{token:g,amount:(u-p).toString()}],tokensOwed:[{token:o,amount:w.toString()},{token:g,amount:p.toString()}],...l?{lifetimeFees:[{token:o,amount:l[0].toString()},{token:g,amount:l[1].toString()}]}:{},summary:"One-block collectable estimate, excluding gas. V3 tokensOwed may include withdrawn principal; feeGrowthAccrual excludes those stored amounts. V4 hook accounting can change actual collections. V4 current liquidity times lifetime range growth is not lifetime position earnings."}}}]}}var Y=V(["event IncreaseLiquidity(uint256 indexed tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)","event DecreaseLiquidity(uint256 indexed tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)","event Collect(uint256 indexed tokenId,address recipient,uint256 amount0,uint256 amount1)"]);async function te(s,t,r,n,i){let _=s.clientFor(L),b=Y.map(o=>Z(o)),m=0n,a=0n,d=0n,u=0n,w=0;for(let o=0n;o<=r;o+=10000000n){let g=o+9999999n<r?o+9999999n:r,y=await _.request({method:"eth_getLogs",params:[{address:v.positionManager,topics:[b,x(t,{size:32})],fromBlock:x(o),toBlock:x(g)}]});if(!Array.isArray(y))throw new c("V3 lifetime fee history is unavailable; do not treat missing history as zero earnings.");for(let l of y){if(!U(l.address,v.positionManager))throw new c("Unexpected contract in v3 lifetime fee history.");let e=J({abi:Y,data:l.data,topics:l.topics});if(e.args.tokenId!==t)throw new c("Unexpected NFT in v3 fee history.");e.eventName==="Collect"?(m+=e.args.amount0,a+=e.args.amount1):e.eventName==="DecreaseLiquidity"?(d+=e.args.amount0,u+=e.args.amount1):w++}}if(w===0)throw new c("V3 mint/increase history is missing for this existing NFT; lifetime earnings are unknown.");let p=[m+n-d,a+i-u];if(p.some(o=>o<0n))throw new c("V3 fee history is incomplete or inconsistent; lifetime earnings are unknown.");return p}export{K as a,A as b,G as c,ue as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as ee}from"./NAO7VWZF.js";import{e as ie}from"./4RCYYN6O.js";import{a as ne,i as se,l as re}from"./W3DGFMQE.js";import{a as ae,b as D,c as F}from"./4PLLS6CT.js";import{e as te}from"./PDPTJMTJ.js";import{b as Z}from"./SPJCSEKP.js";import{a as $}from"./43LI5NKJ.js";import{c as B}from"./SCG5HWMN.js";import{b as X}from"./66F5ZH34.js";import{c as A,d as z,e as b,g as N,j as J,m as Q,n as K}from"./NWNYJ26T.js";import{b as l,j as O}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=O[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function R(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function U(a){return N(a,V.address)}function P(a){return ne.some(f=>N(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(s){try{return await s()}catch(i){throw new u(a.plainError(i))}}function S(s,i){if(s.chainId!==void 0&&s.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(s))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let s=await B(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return s.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return B(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(s,i){let d=s[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let s=a.clientFor(l);if(await s.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await s.getBlockNumber()),d=(t,r)=>s.readContract({address:t,abi:q,functionName:r,blockNumber:i}),e=async(t,r)=>T(await s.readContract({address:t,abi:M,functionName:"balanceOf",args:[r],blockNumber:i}));async function n(t){let[r,p]=await Promise.all([s.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),s.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof r!="string"||!r.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:r,decimals:ue(p)}}async function o(t){let r=t.earnContractAddress,p=v(await d(r,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(r),d(r,"strategy"),d(r,"balance"),d(r,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let _=v(m),x=await d(_,"paused");if(typeof x!="boolean")throw new u("The strategy returned an invalid pause flag.");let G=T(w);if(G===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:_,paused:x,managed:T(c),pricePerFullShare:G}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function Y(s){let i=v(s.vault),d=D(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function W(s,i,d,e){let n=j(await H(),e),o=await a.preview(s,i),t=o.changes.map(r=>{let p=r.amount.startsWith("-"),h=p?r.amount.slice(1):r.amount;return`${p?"-":"+"}${a.formatAmount(h,r.token.decimals)} ${g(r.token.symbol)} (${r.token.address}, chain ${r.token.chainId})`}).join("; ");return{txs:s,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let r=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await se(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:r.want,shares:r.shares,vaultTotalWant:{token:r.want,amount:r.managed.toString()},pricePerFullShare:{token:r.want,amount:r.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:r.paused,source:"strategy.paused()",address:r.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:U(t.earnContractAddress),qualification:U(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:D(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!r.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"],description:"Price-history window as candle size_range: 1h_1d = hourly over 1 day, 1h_1w = 1 week, 1h_1M = 1 month, 1d_1M = daily over 1 month (default), 1d_1Y = 1 year, 1d_all = all time."}},required:["vault"],additionalProperties:!1},execute:s=>f(async()=>{S(s,["vault","historyBucket"]);let i=s.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(s.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await B(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},_=>_!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,r,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...r,currency:"USD"},history:p,forkQualified:U(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},token:{...A,description:"Address of the vault's want (LP or CLM share) token being deposited; must equal the vault's want token."},amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Maximum slippage in basis points (50 = 0.5%) used to set the minimum shares if minSharesOut is omitted. Default 50."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","token","amount"],additionalProperties:!1},execute:(s,i)=>f(async()=>{if(S(s,["vault","token","amount","minSharesOut","slippageBps"]),$(i),s.slippageBps!==void 0&&(!Number.isInteger(s.slippageBps)||Number(s.slippageBps)<0||Number(s.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");s.minSharesOut!==void 0&&R(s.minSharesOut);let d=R(s.amount),e=v(s.token),n=await Y(s),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let r=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await W(r,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=s.minSharesOut===void 0?h*BigInt(1e4-Number(s.slippageBps??50))/10000n:R(s.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:O[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},shares:{description:'Vault shares (moo tokens) to redeem for want, in base units of the share token (read its decimals). "all" redeems your full share balance.',anyOf:[E,{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","shares"],additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,["vault","shares"]),$(i);let d=s.shares==="all"?void 0:R(s.shares),e=await Y(s),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let r=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return W(r,i,"Withdraw from",e)})}],positions:s=>f(async()=>{$(s);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,s),t===0n)continue;let r=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:r.want,amount:(t*r.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),r.shares.decimals)} ${g(r.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${r.paused}. ${U(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(r){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(r)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),re(a),ee(a),te(a)])}export{he as a,Te as b};
|
|
1
|
+
import{d as ee}from"./OCIEVYPR.js";import{e as ie}from"./V7HTGO23.js";import{a as ne,i as se,l as re}from"./4RTXP2YP.js";import{a as ae,b as D,c as F}from"./2VYA6WIN.js";import{e as te}from"./TT2ST3Q3.js";import{b as Z}from"./SPJCSEKP.js";import{a as $}from"./43LI5NKJ.js";import{c as B}from"./SCG5HWMN.js";import{b as X}from"./66F5ZH34.js";import{c as A,d as z,e as b,g as N,j as J,m as Q,n as K}from"./NWNYJ26T.js";import{b as l,j as O}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{a as g}from"./JXOEJPJ4.js";import{encodeFunctionData as oe,erc20Abi as M,parseAbi as ce}from"viem";var I="https://api.beefy.finance/vaults",de="https://api.beefy.finance/fees",le="https://api.beefy.finance/apy/breakdown",pe="https://api.beefy.finance/tvl",me="https://databarn.beefy.finance/api/v1/price",V=O[l].vaults.beefyTestedLpVault,q=ce(["function want() view returns (address)","function balance() view returns (uint256)","function getPricePerFullShare() view returns (uint256)","function strategy() view returns (address)","function paused() view returns (bool)","function deposit(uint256 amount)","function withdraw(uint256 shares)"]),E=X("Positive integer string in base units. Send quoted digits, never a JSON number.");function v(a){return J(a,"Provide a valid contract or wallet address.",z)}function T(a){return Q(a,"The contract returned an invalid integer.")}function R(a){return K(a,"Amount must be positive and fit in uint256.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function ue(a){if(typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new u("Invalid token decimals.");return a}function U(a){return N(a,V.address)}function P(a){return ne.some(f=>N(f.vault,a))}function L(a,f=!0){return P(a)&&f?"Use beefy_withdraw to exchange vault shares for CLM shares, redeem them into pair tokens with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.":"Use beefy_withdraw to exchange vault shares for the want token. Redeem that want into its pair tokens through a qualified Oak route or the Beefy app, then swap the received tokens to USDG."}function fe(a){return!b(a)||!b(a.performance)?!1:[a.deposit,a.withdraw,a.performance.total].every(f=>typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<=1)&&typeof a.lastUpdated=="number"&&Number.isSafeInteger(a.lastUpdated)&&a.lastUpdated>=0}var he=a=>{async function f(s){try{return await s()}catch(i){throw new u(a.plainError(i))}}function S(s,i){if(s.chainId!==void 0&&s.chainId!==l)throw new u("Beefy requires chain 4663.");for(let d of Object.keys(s))if(!["chainId",...i].includes(d))throw new u(`Unsupported Beefy input: ${d}.`)}async function C(){let s=await B(a.http,I,{headers:{"User-Agent":"Oak-Beefy/1.0"}},e=>Array.isArray(e)&&e.every(n=>b(n)&&typeof n.chain=="string")),i=new Set,d=new Set;return s.filter(e=>e.chain==="robinhood").map(e=>{if(typeof e.id!="string"||!e.id||typeof e.name!="string"||!e.name||e.type!=="standard"||!["active","paused","eol"].includes(String(e.status)))throw new u("The Beefy API returned an unexpected vault record.");let n=v(e.earnContractAddress);if(i.has(e.id)||d.has(n))throw new u("The Beefy API returned duplicate vault records.");return i.add(e.id),d.add(n),{id:e.id,name:e.name,type:"standard",chain:"robinhood",status:e.status,tokenAddress:v(e.tokenAddress),tokenDecimals:ue(e.tokenDecimals),earnContractAddress:n,assets:Array.isArray(e.assets)&&e.assets.every(o=>typeof o=="string")?e.assets:[],strategyType:typeof e.strategyTypeId=="string"?e.strategyTypeId:null,risks:b(e.risks)?Object.fromEntries(Object.entries(e.risks).filter(o=>typeof o[1]=="boolean")):{},lastHarvest:typeof e.lastHarvest=="number"&&Number.isSafeInteger(e.lastHarvest)&&e.lastHarvest>=0?e.lastHarvest:null}})}async function H(){return B(a.http,de,{headers:{"User-Agent":"Oak-Beefy/1.0"}},b)}function j(s,i){let d=s[i.id];if(!fe(d))throw new u(`Beefy fees are unavailable for ${i.id}.`);return d}async function k(){let s=a.clientFor(l);if(await s.getChainId()!==l)throw new u("The Beefy endpoint must report chain 4663.");let i=T(await s.getBlockNumber()),d=(t,r)=>s.readContract({address:t,abi:q,functionName:r,blockNumber:i}),e=async(t,r)=>T(await s.readContract({address:t,abi:M,functionName:"balanceOf",args:[r],blockNumber:i}));async function n(t){let[r,p]=await Promise.all([s.readContract({address:t,abi:M,functionName:"symbol",blockNumber:i}),s.readContract({address:t,abi:M,functionName:"decimals",blockNumber:i})]);if(typeof r!="string"||!r.trim())throw new u("The contract returned invalid token metadata.");return{address:t,chainId:l,symbol:r,decimals:ue(p)}}async function o(t){let r=t.earnContractAddress,p=v(await d(r,"want"));if(p!==t.tokenAddress)throw new u(`Beefy API token and want() disagree for ${t.id}.`);let[h,y,m,c,w]=await Promise.all([n(p),n(r),d(r,"strategy"),d(r,"balance"),d(r,"getPricePerFullShare")]);if(h.decimals!==t.tokenDecimals)throw new u(`Beefy API and want decimals disagree for ${t.id}.`);let _=v(m),x=await d(_,"paused");if(typeof x!="boolean")throw new u("The strategy returned an invalid pause flag.");let G=T(w);if(G===0n)throw new u("The Beefy share price is zero.");return{want:h,shares:y,strategy:_,paused:x,managed:T(c),pricePerFullShare:G}}return{blockNumber:i,balanceOf:e,vaultState:o}}async function Y(s){let i=v(s.vault),d=D(i),n=(await C()).find(o=>o.earnContractAddress===i);if(!n)throw new u("The selected vault is missing from the current Beefy inventory.");if(n.id!==d.id||n.tokenAddress!==d.tokenAddress.toLowerCase()||n.tokenDecimals!==d.tokenDecimals||n.type!==d.type)throw new u("The Beefy API and pinned vault type or want disagree.");return n}async function W(s,i,d,e){let n=j(await H(),e),o=await a.preview(s,i),t=o.changes.map(r=>{let p=r.amount.startsWith("-"),h=p?r.amount.slice(1):r.amount;return`${p?"-":"+"}${a.formatAmount(h,r.token.decimals)} ${g(r.token.symbol)} (${r.token.address}, chain ${r.token.chainId})`}).join("; ");return{txs:s,preview:o,summary:`${d} ${g(e.name)}. ${t}. ${o.summary} Beefy API fees: deposit ${n.deposit*100}%, withdrawal ${n.withdraw*100}%, performance ${n.performance.total*100}% (updated ${n.lastUpdated} ms). These calls have no on-chain minimum output parameter; preview is an estimate, not a guaranteed amount. LP acquisition and conversion to USDG are separate.`}}return{tools:[{name:"beefy_list",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,[]);let[d,e,n]=await Promise.all([C(),H(),k()]),o=[];for(let t of d){let r=await n.vaultState(t),p=!1,h=null;if(P(t.earnContractAddress))try{await se(a).tools[0].execute({vault:t.earnContractAddress},i),p=!0}catch(y){h=a.plainError(y)}o.push({id:t.id,name:t.name,vault:t.earnContractAddress,chainId:l,want:r.want,shares:r.shares,vaultTotalWant:{token:r.want,amount:r.managed.toString()},pricePerFullShare:{token:r.want,amount:r.pricePerFullShare.toString(),scale:"1000000000000000000",source:"getPricePerFullShare()"},apiStatus:{value:t.status,source:I},strategyPaused:{value:r.paused,source:"strategy.paused()",address:r.strategy,block:n.blockNumber.toString()},fees:{...j(e,t),source:de},forkQualified:U(t.earnContractAddress),qualification:U(t.earnContractAddress)?{source:V.source,block:V.block}:null,depositAvailable:D(t.earnContractAddress,!1)!==void 0&&t.status==="active"&&!r.paused&&(!P(t.earnContractAddress)||p),underlyingRoute:p?{kind:"clm",read:"beefy_lp",acquire:"beefy_clm_deposit",redeem:"beefy_clm_withdraw",swap:"beefy_clm_swap"}:null,underlyingRouteError:h,exitPath:L(t.earnContractAddress,p),block:n.blockNumber.toString()})}return{vaults:o,summary:"Direct want/LP vaults, not ERC-4626 or direct USDG. Use beefy_withdraw to return vault shares to want tokens. CLM routes and deposit availability require a successful live qualification read; unavailable routes require the Beefy app for want redemption. Fork qualification, API status and strategy pause are separate observations."}})},{name:"beefy_vault_info",inputSchema:{type:"object",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},historyBucket:{enum:["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"],description:"Price-history window as candle size_range: 1h_1d = hourly over 1 day, 1h_1w = 1 week, 1h_1M = 1 month, 1d_1M = daily over 1 month (default), 1d_1Y = 1 year, 1d_all = all time."}},required:["vault"],additionalProperties:!1},execute:s=>f(async()=>{S(s,["vault","historyBucket"]);let i=s.historyBucket??"1d_1M";if(!["1h_1d","1h_1w","1h_1M","1d_1M","1d_1Y","1d_all"].includes(String(i)))throw new u("Provide a supported Beefy historyBucket.");let d=v(s.vault),e=(await C()).find(m=>m.earnContractAddress===d);if(!e)throw new u("The selected vault is missing from the current Beefy inventory.");let n=new URL(me);n.searchParams.set("product_key",`beefy:vault:robinhood:${d}`),n.searchParams.set("price_type","share_to_underlying"),n.searchParams.set("time_bucket",String(i));async function o(m,c){try{let w=await B(a.http,m,{headers:{"User-Agent":"Oak-Beefy/1.0"}},_=>_!==void 0);return{status:"available",source:m,value:c(w)}}catch(w){return{status:"unavailable",source:m,error:a.plainError(w)}}}let[t,r,p,h]=await Promise.all([o(le,m=>{if(!b(m))throw new u("Beefy APY is unavailable for this vault.");let c=m[e.id];if(!b(c))throw new u("Beefy APY is unavailable for this vault.");if(!Object.hasOwn(c,"totalApy")||Object.values(c).some(w=>typeof w!="number"||!Number.isFinite(w)||w<0))throw new u("Beefy returned invalid APY data.");return c}),o(pe,m=>{let c=b(m)?m[e.id]:void 0;if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new u("Beefy TVL is unavailable for this vault.");return c}),o(n.toString(),m=>{if(!Array.isArray(m)||m.some(c=>!Array.isArray(c)||c.length<2||typeof c[0]!="string"||!Number.isFinite(Date.parse(c[0]))||typeof c[1]!="string"||!/^\d+(\.\d+)?$/.test(c[1])))throw new u("Beefy returned invalid share-price history.");return m.map(c=>({timestamp:c[0],shareToUnderlying:c[1]}))}),k()]),y=await h.vaultState(e);return{id:e.id,name:e.name,vault:e.earnContractAddress,chainId:l,want:y.want,strategy:{address:y.strategy,type:e.strategyType,assets:e.assets,paused:y.paused,lastHarvest:e.lastHarvest,source:I},risk:{status:Object.keys(e.risks).length?"available":"unavailable",flags:e.risks,source:I,guide:"https://docs.beefy.finance/safety/risk-checklist",summary:"API risk flags are assessments, not guarantees. Uncorrelated LP assets can suffer impermanent loss; vaults also expose strategy, token and contract risks."},apy:t,tvl:{...r,currency:"USD"},history:p,forkQualified:U(e.earnContractAddress),block:h.blockNumber.toString(),app:`https://app.beefy.finance/vault/${encodeURIComponent(e.id)}`,summary:"APY is a fractional annual estimate, not a promised return. Share-price history is not a wallet profit calculation. Missing analytics remain unavailable."}})},{name:"beefy_deposit",inputSchema:{type:"object",description:"Deposit the listed want/LP token to receive vault shares. Exit with beefy_withdraw to receive want tokens; convert them separately using a qualified route or the Beefy app. Check positions after confirmation.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},token:{...A,description:"Address of the vault's want (LP or CLM share) token being deposited; must equal the vault's want token."},amount:E,minSharesOut:E,slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Maximum slippage in basis points (50 = 0.5%) used to set the minimum shares if minSharesOut is omitted. Default 50."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","token","amount"],additionalProperties:!1},execute:(s,i)=>f(async()=>{if(S(s,["vault","token","amount","minSharesOut","slippageBps"]),$(i),s.slippageBps!==void 0&&(!Number.isInteger(s.slippageBps)||Number(s.slippageBps)<0||Number(s.slippageBps)>9999))throw new u("slippageBps must be an integer from 0 to 9999.");s.minSharesOut!==void 0&&R(s.minSharesOut);let d=R(s.amount),e=v(s.token),n=await Y(s),o=await k();await F(a.clientFor(l),n.earnContractAddress,o.blockNumber);let t=await o.vaultState(n);if(n.status!=="active")throw new u(`The Beefy API marks this vault ${n.status}; deposits are unavailable. ${L(n.earnContractAddress)}`);if(t.paused)throw new u(`The Beefy strategy is paused; deposits are unavailable. ${L(n.earnContractAddress)}`);if(e!==t.want.address)throw new u(`This vault needs ${g(t.want.symbol)} (${t.want.address}, chain 4663), not the supplied token. ${P(n.earnContractAddress)?"Read beefy_lp, acquire the pair tokens with beefy_clm_swap and mint the want with beefy_clm_deposit first.":"No USDG zap is provided."}`);if(await o.balanceOf(t.want.address,i)<d)throw new u(`Insufficient ${g(t.want.symbol)} want balance.`);let r=[a.approval(t.want.address,n.earnContractAddress,d.toString(),l),a.unsignedTx({to:n.earnContractAddress,data:oe({abi:q,functionName:"deposit",args:[d]}),value:"0",chainId:l,description:`Deposit ${d} want base units into ${n.name}.`})],p=await W(r,i,"Deposit into",n),h=d*10n**18n/t.pricePerFullShare,y=s.minSharesOut===void 0?h*BigInt(1e4-Number(s.slippageBps??50))/10000n:R(s.minSharesOut);if(y<=0n||y>h)throw new u("Minimum shares must be positive and no greater than the current forecast.");let m={token:{address:O[l].tokens.WETH.address,symbol:"WETH",decimals:18,chainId:l},from:t.strategy,recipient:i,optional:!0,includedInMinimumShares:!1},c=`Share forecast ${h}; minimum ${y} share base units (local pre-sign simulation check only; deposit(uint256) has no on-chain minimum). Optional WETH harvest rewards from strategy ${t.strategy} may vary or be zero and are not part of that floor.`;return{...p,harvestReward:m,minimumShares:y.toString(),summary:`${p.summary} ${c}`,preview:{...p.preview,summary:`${p.preview.summary} ${c}`}}})},{name:"beefy_withdraw",inputSchema:{type:"object",description:"Withdraw shares in base units, or shares all for a full exit. Returns want/LP tokens; redemption to pair tokens and conversion to USDG are separate steps.",properties:{vault:{...A,description:"Address of the Beefy vault contract (from beefy_list)."},shares:{description:'Vault shares (moo tokens) to redeem for want, in base units of the share token (read its decimals). "all" redeems your full share balance.',anyOf:[E,{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","shares"],additionalProperties:!1},execute:(s,i)=>f(async()=>{S(s,["vault","shares"]),$(i);let d=s.shares==="all"?void 0:R(s.shares),e=await Y(s),n=await k();await F(a.clientFor(l),e.earnContractAddress,n.blockNumber),await n.vaultState(e);let o=await n.balanceOf(e.earnContractAddress,i),t=d??o;if(t===0n||t>o)throw new u("Provide a positive share amount no greater than your current Beefy share balance.");let r=[a.unsignedTx({to:e.earnContractAddress,data:oe({abi:q,functionName:"withdraw",args:[t]}),value:"0",chainId:l,description:`Withdraw ${t} share base units from ${e.name} to the calling wallet.`})];return W(r,i,"Withdraw from",e)})}],positions:s=>f(async()=>{$(s);let i,[d,e]=await Promise.all([C().catch(o=>(i=a.plainError(o),ae.map(t=>({...t,type:"standard",chain:"robinhood",status:t.status,tokenAddress:v(t.tokenAddress),earnContractAddress:v(t.earnContractAddress),assets:[],strategyType:null,risks:{},lastHarvest:null})))),k()]),n=[];for(let o of d){let t;try{if(t=await e.balanceOf(o.earnContractAddress,s),t===0n)continue;let r=await e.vaultState(o);n.push({module:"beefy",id:o.earnContractAddress,chainId:l,assets:[{token:r.want,amount:(t*r.pricePerFullShare/10n**18n).toString()}],description:`${g(o.name)}: ${a.formatAmount(t.toString(),r.shares.decimals)} ${g(r.shares.symbol)} shares (${o.earnContractAddress}); want estimate before withdrawal fees at block ${e.blockNumber}. ${i?"API unavailable; inventory from pinned vault table, current API status unknown":`API ${o.status}`}; strategy paused ${r.paused}. ${U(o.earnContractAddress)?"Recorded fork-qualified vault.":P(o.earnContractAddress)?"Direct want/share writes supported; CLM acquisition and redemption have separate qualification.":"Direct want/share writes supported after code/type checks; no recorded fork round trip yet."}`})}catch(r){n.push({module:"beefy",id:`${o.earnContractAddress}:unreadable`,chainId:l,incomplete:!0,assets:[],description:`${g(o.name)} position unreadable: ${a.plainError(r)}${t===void 0?" Share balance is unknown.":` Observed ${t} share base units; want valuation is unavailable.`} No zero holding was inferred.`})}}return i&&n.push({module:"beefy",id:"pinned-inventory-coverage",chainId:l,incomplete:!0,assets:[],description:`Beefy API unavailable: ${i} Checked on-chain balances for ${d.length} pinned vaults only; newer or unpinned vaults may be missing.`}),n})}};function Te(a){return Z("beefy",[he(a),ie(a),re(a),ee(a),te(a)])}export{he as a,Te as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as R,b as K}from"./G2LAO23N.js";import{a as W}from"./7WXAS54T.js";import{a as B}from"./B7WZJHIJ.js";import{c as L,f as U,g as T,i as z}from"./NWNYJ26T.js";import{b as k}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as J,erc20Abi as re,erc721Abi as V,getAddress as ie,parseAbi as se,zeroAddress as q}from"viem";var A=B,G=se(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),g=(t,e)=>t.name==="seed"?"marketSeed":t.name||`arg${e}`,X=t=>"components"in t?t.components:[],ae=t=>{if(typeof t!="string"||!/^(0|[1-9][0-9]*)$/.test(t)||t.length>78||BigInt(t)>=1n<<256n)throw new d("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(t)},p=t=>U(t,"Provide the documented Hookr parameter object."),b=t=>z(t,"Provide a valid Hookr address."),Y=t=>t.stateMutability==="view"||t.stateMutability==="pure";function _(t){return t.abi}var ce=`Base units of the token it counts; read that token's decimals (18 decimals: "1000000000000000000" = 1 token).`,de={type:"string",pattern:"^(0|[1-9][0-9]*)$"};function ue(t,e,a){let r=`${t} ${e} ${a}.`,n=t.replace(/\[[0-9]*\]$/,"");return/^u?int/.test(n)?/divisor|numerator|denominator/i.test(e)?`${r} Plain integer ${/divisor/i.test(e)?"divisor":"ratio component"}; do not scale by token decimals.`:/liquidity/i.test(e)?`${r} Uniswap v4 liquidity units, not a token amount; do not scale by token decimals.`:/gas/i.test(e)?`${r} Integer gas units; do not scale by token decimals.`:/point/i.test(e)&&!/decimals/i.test(e)?`${r} Integer points; do not scale by token decimals.`:/pips$/i.test(e)?`${r} ${R.pips()}`:K(e,de)||e==="walletFeeCap"?`${r} ${ce}`:/bps$/i.test(e)?`${r} ${R.bps()}`:/(deadline|expir|timestamp|time|At)$/.test(e)?`${r} Unix seconds, as a decimal string.`:`${r} Decimal string${n.startsWith("uint")?"":", may be negative"}.`:n==="address"?`${r} 0x followed by 40 hex digits${/^(to|recipient|receiver|owner|spender|wallet|beneficiary)$/i.test(e)?"; use the intended address, never an example address":""}.`:n==="bool"?`${r} true or false.`:n.startsWith("bytes")?`${r} 0x-prefixed hex bytes.`:n==="tuple"?`${r} Object with the listed fields.`:`${r} Plain text.`}function Z(t,e,a,r){let n=ue(t.type,r,e),i=/^(.*)\[([0-9]*)\]$/.exec(t.type);return i?{type:"array",description:n,items:Z({...t,type:i[1]},e,a,r),minItems:i[2]?Number(i[2]):0,maxItems:i[2]?Number(i[2]):128}:t.type==="tuple"?{...E(X(t),a,r),description:n}:t.type==="bool"?{type:"boolean",description:n}:t.type==="address"?{...L,description:n}:/^u?int/.test(t.type)?{type:"string",pattern:t.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:n}:t.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770,description:n}:{type:"string",maxLength:4096,description:n}}function E(t,e,a){let r=a===void 0?`argument of ${e}`:`field of ${a} in ${e}`;return{type:"object",properties:Object.fromEntries(t.map((n,i)=>[g(n,i),Z(n,r,e,g(n,i))])),required:t.map(g),additionalProperties:!1}}function C(t,e){let a=/^(.*)\[([0-9]*)\]$/.exec(t.type);if(a){if(!Array.isArray(e)||e.length>128||a[2]&&e.length!==Number(a[2]))throw new d("Hookr parameter array has an invalid length.");return e.map(n=>C({...t,type:a[1]},n))}if(t.type==="tuple"){let n=p(e),i=X(t);return N(n,i.map(g)),Object.fromEntries(i.map((c,u)=>[c.name||`arg${u}`,C(c,n[g(c,u)])]))}if(t.type==="address")return b(e);if(t.type==="bool"){if(typeof e!="boolean")throw new d("Provide a Hookr boolean.");return e}let r=/^(u?)int([0-9]*)$/.exec(t.type);if(r){if(typeof e!="string"||!/^(0|-?[1-9][0-9]*)$/.test(e)||e.length>79)throw new d("Provide Hookr integers as decimal base-unit strings.");let n=BigInt(e),i=BigInt(r[2]||256),c=!r[1];if(n<(c?-(1n<<i-1n):0n)||n>=1n<<(c?i-1n:i))throw new d("Hookr integer exceeds its ABI range.");return i<=32n?Number(n):n}if(t.type.startsWith("bytes")){let n=Number(t.type.slice(5));if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(e)||e.length>32770||n&&e.length!==2+n*2)throw new d("Provide a valid Hookr hex byte string of the ABI length.");return e}if(t.type!=="string"||typeof e!="string"||new TextEncoder().encode(e).length>4096)throw new d("Provide a valid Hookr string.");return e}function N(t,e){if(Object.keys(t).some(a=>!e.includes(a))||e.some(a=>!Object.hasOwn(t,a)))throw new d("Provide exactly the documented Hookr parameters.")}function ye(t,e){N(e,t.inputs.map(g));let a=t.inputs.map((r,n)=>C(r,e[g(r,n)]));return{values:a,params:Object.fromEntries(t.inputs.map((r,n)=>[g(r,n),a[n]]))}}function ee(t,e){if(N(t,["contract","function","params"]),typeof t.contract!="string"||!Object.hasOwn(A,t.contract))throw new d("Choose a contract from hookr_contracts.");let a=A[t.contract];if(!e&&a.address.toLowerCase()===B.launcherV1.address.toLowerCase())throw new d("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let r=_(a).find(u=>u.name===t.function&&(e?Y(u):a.actions.includes(u.name)));if(!r)throw new d("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let n=p(t.params);N(n,r.inputs.map(g));let i=r.inputs.map((u,f)=>C(u,n[g(u,f)])),c=Object.fromEntries(r.inputs.map((u,f)=>[g(u,f),i[f]]));return{pin:a,fn:r,values:i,params:c,target:b(a.address)}}var te={type:"string",enum:Object.keys(A),description:'Pinned Hookr contract role, as listed by hookr_contracts (for example "launcherV1").'},Q={type:"object",properties:{contract:te,function:{type:"string",description:"Function name on that contract, exactly as hookr_contracts lists it."},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function ne(t){return JSON.parse(JSON.stringify(t,(e,a)=>typeof a=="bigint"?a.toString():a))}async function me(t,e,a){if(t.network==="testnet")throw new d("Hookr actions are configured only on mainnet, chain 4663.");let{pin:r,fn:n,values:i,params:c,target:u}=ee(e,!1),f=e.contract,l=n.name,$=t.clientFor(k),v=[],P=[],w=0n,O=new Map,h=(o,s)=>{let m=b(o),x=typeof s=="bigint"?s:ae(s);if(x<0n||x>=(1n<<256n)-1n)throw new d("Hookr funding must be an exact bounded amount.");x&&(m===q?w+=x:O.set(m,(O.get(m)??0n)+x))},H=(o,s,m=[])=>$.readContract({address:b(A[o].address),abi:A[o].abi,functionName:s,args:m});if(f==="router"&&["swap","swapGated"].includes(l)){let o=p(c.params),s=p(o.key),m=o.amountSpecified;if(m===0n||o.amountBound===0n)throw new d("Hookr swaps require a nonzero amount and bound.");h(o.zeroForOne?s.currency0:s.currency1,m<0n?-m:o.amountBound)}else if(f==="vault"&&l==="deposit"){let o=p(c.params),s=p(o.key);if(h(s.currency0,o.amount0Desired),h(s.currency1,o.amount1Desired),o.amount0Min>o.amount0Desired||o.amount1Min>o.amount1Desired)throw new d("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&l==="transfer")P.push({token:u,id:c.id,amount:c.amount,to:b(c.receiver)});else if(f==="launcher"&&l.startsWith("launch")){let o=l==="launchFamily"?p(c.p):c,s=p(o.token),m=o.members;if(m.length<1||m.length>8)throw new d("Hookr launch needs one to eight members.");if(T(String(s.salt),String(await H("launcher","SKIP_TAKEN"))))throw new d("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=s.existing===q?b(await H("launcher","predictToken",[a,s])):b(s.existing),M=0n;for(let y of m){let I=BigInt(x)<BigInt(String(y.quote)),D=I?y.amount0Max:y.amount1Max;s.existing===q?M+=D:h(x,D),h(y.quote,I?y.amount1Max:y.amount0Max)}if(M>s.supply)throw new d("Hookr launch seeds more new tokens than its supply.");let oe=l==="launchFamily"?o.buys:l==="launchWithBuy"?[p(c.buy)]:[];for(let y of oe){let I=m[Number(y.member)];if(!I)throw new d("Hookr dev buy references an unavailable member.");h(I.quote,y.quoteIn)}let F=await $.readContract({address:u,abi:G,functionName:"launchFee"});if(!Array.isArray(F)||typeof F[0]!="bigint"||F[0]<0n)throw new d("Hookr launch fee is unavailable.");w+=F[0]}else if(f==="launcher"&&l==="addLiquidity"){let o=p(await H("launcher","position",[c.familyId,c.member])),s=p(o.key);h(s.currency0,c.max0),h(s.currency1,c.max1)}else if(f==="ownedFactory"&&l==="deploy"){let o=await H("ownedFactory","deployFee");if(typeof o!="bigint"||o<0n)throw new d("Hookr own-hook deployment fee is unavailable.");w=o}else if(f==="programs"&&l==="createProgram"){let o=p(c.t);if(h(o.rewardToken,o.cashBudget),w)throw new d("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&l==="createCampaign"){let o=p(c.t),s=o.end-o.start;if(s<=0n||s%86400n!==0n||s/86400n>366n)throw new d("Hookr referral campaigns must cover one to 366 whole days.");h(o.currency,o.dailyBudget*(s/86400n))}else if(f==="reserve"&&l==="fundReserve")h(c.token,c.amount);else if(f==="tokenizer"){let o=p(c.arg1);if(o.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(s=>o[s].length>0))throw new d("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let s of o.revenueTokens)h(s.token,s.amount);if(l==="tokenize"&&p(c.arg2).open){let s=await $.readContract({address:b(A.launcher.address),abi:G,functionName:"launchFee"});if(!Array.isArray(s)||typeof s[0]!="bigint"||s[0]<0n)throw new d("Hookr revenue market launch fee is unavailable.");w+=s[0]}}else if(f==="boost"&&["fund","notify"].includes(l)){let o=p(await H("boost","gauge",[c.id]));if(h(p(o.terms).rewardToken,c.amount),w)throw new d("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&l==="stake"){let o=b(await H("boost","positionManager"));if(o!==ie("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new d("Hookr boost position manager disagrees with the published deployment.");let s=await $.readContract({address:o,abi:V,functionName:"ownerOf",args:[c.tokenId]});if(!T(s,a))throw new d("The signing wallet must own the position NFT it stakes.");v.push(t.unsignedTx({to:o,data:J({abi:V,functionName:"approve",args:[u,c.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${c.tokenId} to ${u}.`})),P.push({token:o,id:c.tokenId,amount:1n,to:u})}let j=await $.getBlock();if(typeof j.timestamp!="bigint"||j.timestamp<=0n)throw new d("Hookr chain time is unavailable.");let S=o=>{if(Array.isArray(o)){o.forEach(S);return}if(!(!o||typeof o!="object"))for(let[s,m]of Object.entries(o)){if(s==="deadline"&&typeof m=="bigint"&&m<j.timestamp)throw new d("Hookr deadline expired. Refresh the action terms.");S(m)}};S(c);for(let[o,s]of O){if(s>=(1n<<256n)-1n)throw new d("Hookr aggregate funding exceeds its exact approval bound.");let m=await $.readContract({address:o,abi:re,functionName:"allowance",args:[a,u]});m>0n&&m!==s&&v.push(t.approval(o,u,"0",k)),v.push(t.approval(o,u,s.toString(),k)),P.push({token:o,amount:s})}return w&&P.push({token:W,amount:w,to:u}),v.push(t.unsignedTx({to:u,data:J({abi:[n],functionName:n.name,args:i}),value:w.toString(),chainId:k,description:`Hookr ${f}.${l}: ${JSON.stringify(ne(c))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:v,inputs:P}}function ke(t,e,a={}){let r=(n,i)=>!a.gasLimitCeiling||n===void 0||i===void 0?n===i:/^[1-9][0-9]{0,77}$/.test(n)&&/^[1-9][0-9]{0,77}$/.test(i)&&BigInt(n)<=BigInt(i);if(t.length!==e.length||t.some((n,i)=>n.chainId!==e[i].chainId||!T(n.to,e[i].to)||n.value!==e[i].value||!r(n.gasLimit,e[i].gasLimit)||!T(n.data,e[i].data)))throw new d("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function xe(t){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{...te,description:"Only this pinned contract role; omit for every contract."},function:{type:"string",description:"Only this function name; omit for every function of the selected contracts."}},additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(r=>!["contract","function"].includes(r))||e.contract!==void 0&&(typeof e.contract!="string"||!Object.hasOwn(A,e.contract))||e.function!==void 0&&typeof e.function!="string")throw new d("Choose a documented Hookr contract and function filter.");let a=r=>e.function===void 0||r.name===e.function;return{chainId:k,contracts:Object.entries(A).filter(([r])=>e.contract===void 0||r===e.contract).map(([r,n])=>({role:r,address:b(n.address),source:n.source,match:n.match,reads:_(n).filter(i=>Y(i)&&a(i)).map(i=>({function:i.name,params:E(i.inputs,i.name)})),actions:n.actions.filter(i=>e.function===void 0||i===e.function).map(i=>({function:i,params:E(_(n).find(c=>c.name===i).inputs,i)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...Q,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async e=>{let{pin:a,fn:r,values:n,target:i}=ee(e,!0),c=await t.clientFor(k).readContract({address:i,abi:[r],functionName:r.name,args:n});return{chainId:k,contract:i,function:r.name,result:ne(c),source:a.source}}},{name:"hookr_action",inputSchema:{...Q,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(e,a)=>{let r=await me(t,e,a),n=await t.preview(r.txs,a);return{txs:r.txs,preview:n,summary:`Hookr ${e.contract}.${e.function}; review the preview and human confirmation.`}}}]}export{ue as a,E as b,ye as c,me as d,ke as e,xe as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Se,j as He,l as Re,m as Te}from"./MFQTBUSD.js";import{a as ne,b as ie}from"./AODUTN65.js";import{a as xe,h as Pe}from"./QAAKUIWE.js";import{a as Ae,f as Fe,g as Ee}from"./JCS24YBB.js";import{a as we,g as be}from"./BM4KHOFB.js";import{a as ge,h as ye}from"./ZSGW2ZSO.js";import{a as ke,g as fe}from"./RKJFSDGV.js";import{a as X}from"./H5J2LFPZ.js";import{a as Z,j as N,o as J}from"./5Y457HYC.js";import{a as me,b as he}from"./64LAWFBE.js";import{a as ce,b as pe}from"./G53U6Y4L.js";import{a as ue,b as le}from"./FMEO7RX7.js";import{k as ee}from"./NCCKCGKL.js";import{a as Be,c as ve}from"./IJVBCEA2.js";import{b as re,c as se}from"./HPO673QQ.js";import{a as R,b as Ce}from"./JQVTHPUO.js";import{c as te,d as v,e as oe}from"./RKS3M7L5.js";import{d as ae,e as de}from"./5VKVAUFQ.js";import{g as K}from"./3RGED2KO.js";import{a as S,e as H,f as u,i as D,j as w,k as j,m as B,o as V,p as W,r as Y}from"./UMY6SP7C.js";import{b as f,i as O,j as q,k as L}from"./CJMVRV34.js";import{a as d}from"./XSD5NL7J.js";import{decodeAbiParameters as Ue,encodeAbiParameters as Q,formatUnits as Oe,getAddress as Ge,zeroAddress as qe}from"viem";var T=[{type:"tuple",components:[{name:"guardEndBlock",type:"uint40"},{name:"maxFeePips",type:"uint24"},{name:"snipeTaxPips",type:"uint24"},{name:"snipeFloorPips",type:"uint24"},{name:"snipeDecaySeconds",type:"uint16"},{name:"dynamicFeeSens",type:"uint16"},{name:"burnBps",type:"uint16"},{name:"lpBps",type:"uint16"},{name:"potBps",type:"uint16"},{name:"royaltyBps",type:"uint16"},{name:"protocolShareBps",type:"uint16"},{name:"potEveryNBuys",type:"uint32"},{name:"maxBuyQuoteAmount",type:"uint128"},{name:"potMinBuyQuote",type:"uint128"},{name:"royaltyTo",type:"address"},{name:"integrator",type:"address"}]}],Le=Ge("0x84b1B9e5D1cAfD9543E684BB39E9cbD478189EE2"),Ke=["anti-snipe","dynamic-fees","auto-burn","lp-rewards","arb-recapture","buy-sell-block","agent-gate","market-guard","market-hours-fee","managed-fee","zap-source","zap-target","swap-reward-mint","pay-later","exit-clock","holder-pot","storm-fee","wallet-cap","swap-cut","sandwich-guard"],Ve=["anti-snipe","dynamic-fees","auto-burn","lp-rewards","buy-sell-block","exit-clock","storm-fee","wallet-cap","swap-cut","sandwich-guard","holder-pot"],De=Ve,M={"anti-snipe":["guardEndBlock","taxPips","floorPips","decaySeconds","maxBuyQuoteAmount"],"dynamic-fees":["maxFeePips","sensitivity"],"auto-burn":["burnBps"],"lp-rewards":["lpBps"],"buy-sell-block":["buyPause","sellLock"],"exit-clock":["top","floor","horizon","unit","curve"],"storm-fee":["ceiling","floor"],"wallet-cap":["cap"],"swap-cut":["buy","sell","recipient"],"sandwich-guard":["window","maximum","recipient"],"holder-pot":["buy","sell"]},Ie={"market-guard":ge.wiring+" The launch advisory slot is occupied by the agent gate.","market-hours-fee":ke.wiring+" The launch advisory slot is occupied by the agent gate.","managed-fee":we.wiring+" The launch advisory slot is occupied by the agent gate.","zap-source":Z,"zap-target":xe,"swap-reward-mint":Se,"pay-later":X,"holder-pot":Ae.refusal},We={"buy-sell-block":"buyPause 0\u2013300 and sellLock 0\u20135 are twelve-second steps after launch; at least one positive. Requires an Anti-Snipe guard covering the windows. No fee.","wallet-cap":"cap is cumulative subject base units bought per wallet during the Anti-Snipe guard; it must fit the exact decimal mantissa/exponent codec. Sales do not restore it. No fee.","exit-clock":"LP-fee destination only. top 1\u2013100 and floor below top are ten-basis-point steps. horizon is 1\u201363 hours (unit 0) or 3\u201330 days (unit 1). curve 0 linear, 1 eight-segment halving, 2 eight steps. Pinned new-token lots determine holding age.","storm-fee":"LP-fee destination, tempo zero. ceiling 1\u2013200 and floor 0\u2013ceiling are 500-pip steps (0.05%). Cannot combine with Dynamic Fees.","swap-cut":"buy and sell 0\u2013100 are 1000-pip steps (0.1%); at least one positive. recipient is the checksummed named quote-claim payee after the decoded protocol share, shared with Sandwich Guard if combined.","sandwich-guard":"window 0\u20133 means 1\u20134 execution blocks. maximum 5\u201315 is 10000-pip steps (1%). recipient is the checksummed named quote-claim payee after the decoded protocol share, shared with Swap Cut if combined."},A={"market-guard":["terms"],"market-hours-fee":["terms","owner","lastCoveredYear"],"managed-fee":["terms","keeper","owner"],"zap-source":["takePips","vault","route"],"zap-target":["feeders","routes"],"swap-reward-mint":["minter","terms"]},F={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},Ye=new Set(["feed","factory","poolManager","rules","router","root","gate","sink","quote","subject","protocolRecipient","currency0","currency1","advisory","fixedRecipient","rewardToken","creatorRecipient"]),je={guardEndBlock:"Set the parent block ending the guard.",taxPips:"Set the initial buy surcharge in pips (10000 = 1%).",floorPips:"Set the final buy surcharge in pips (10000 = 1%).",decaySeconds:"Set the surcharge decay duration in seconds.",maxBuyQuoteAmount:"Set the maximum buy amount in quote token base units, using the quote token decimals.",maxFeePips:"Set the maximum pool fee in pips (10000 = 1%).",sensitivity:"Set dynamic fee sensitivity from 1 to 10.",burnBps:"Set the burn rate in basis points (100 = 1%).",lpBps:"Set the LP fee rate in basis points (100 = 1%).",buyPause:"Set the buy pause in twelve-second steps from 0 to 300.",sellLock:"Set the sell lock in twelve-second steps from 0 to 5.",top:"Set the initial LP fee in ten-basis-point steps.",horizon:"Set the exit-clock horizon in the selected unit.",unit:"Choose 0 for hours or 1 for days.",curve:"Choose 0 for linear, 1 for segmented halving, or 2 for stepped decay.",ceiling:"Set the storm fee ceiling in 500-pip steps.",recipient:"Use the intended quote-claim payee address.",window:"Set the sandwich guard window from 0 to 3, representing 1 to 4 execution blocks.",maximum:"Set the sandwich guard maximum in 10000-pip steps.",terms:"Provide the exact configured advisory terms.",route:"Provide the exact configured vault route.",routes:"Provide the exact configured feeder vault routes.",feeders:"Provide the intended feeder vault addresses.",takePips:"Set the quote take in pips (10000 = 1%).",lastCoveredYear:"Provide the last calendar year covered by the advisory.",minDepth:"Set the minimum depth in quote token base units, using the quote token decimals.",threshold:"Provide the vault threshold in quote token base units, using the quote token decimals.",maxPerZap:"Match the vault maximum per zap in quote token base units, or 0 for no cap.",maxRewardPerSwap:"Provide the maximum reward per swap in reward token base units, using the reward token decimals.",lifetimeRewardCap:"Provide the lifetime reward cap in reward token base units, using the reward token decimals.",maxSlicePerSwap:"Provide the maximum quote slice per swap in quote token base units, using the quote token decimals.",rewardPerQuoteWad:"Provide reward token base units per 10^18 quote token base units.",endsAt:"Provide the end timestamp in Unix seconds, or 0 for no time limit."},Ze={feed:"Provide the admitted market price feed address.",bandBps:"Set the market guard band in basis points (100 = 1%).",rampBps:"Set the market guard ramp in basis points (100 = 1%).",staleness:"Set the maximum feed age in seconds.",surchargePips:"Set the maximum market guard surcharge in pips (10000 = 1%).",regularPips:"Set the regular session surcharge in pips (10000 = 1%).",preMarketPips:"Set the pre-market surcharge in pips (10000 = 1%).",afterHoursPips:"Set the after-hours surcharge in pips (10000 = 1%).",overnightPips:"Set the overnight surcharge in pips (10000 = 1%).",closedPips:"Set the closed session surcharge in pips (10000 = 1%).",openRampSeconds:"Set the opening ramp duration in seconds.",closeRampSeconds:"Set the closing ramp duration in seconds.",surcharge:"Set the default managed LP surcharge in pips (10000 = 1%).",premium0:"Set the first directional premium in pips (10000 = 1%).",premium1:"Set the second directional premium in pips (10000 = 1%).",maxStep:"Set the maximum keeper update step in pips (10000 = 1%).",minInterval:"Set the minimum keeper update interval in seconds.",maxTtl:"Set the maximum target lifetime in seconds.",factory:"Provide the factory contract address.",poolManager:"Provide the pool manager contract address.",rules:"Provide the Rules contract address.",router:"Provide the vault router address.",root:"Provide the Hookr root contract address.",gate:"Provide the target gate contract address.",sink:"Provide the intended subject token sink address.",quote:"Provide the quote token address.",subject:"Provide the subject token address.",protocolRecipient:"Provide the intended protocol recipient address.",currency0:"Provide the target pool currency0 address.",currency1:"Provide the target pool currency1 address.",advisory:"Provide the advisory contract address.",fixedRecipient:"Provide the intended fixed reward recipient address, or the zero address in trader mode.",rewardToken:"Provide the reward token address.",creatorRecipient:"Provide the intended creator recipient address.",targetId:"Provide the target pool ID as a 0x-prefixed 32-byte hex string.",poolId:"Provide the pool ID as a 0x-prefixed 32-byte hex string.",accountInitCodeHash:"Provide the account init code hash as a 0x-prefixed 32-byte hex string.",quoteIsCurrency0:"Set whether the quote token is currency0 in the target pool.",tickLower:"Provide the lower liquidity tick as a signed decimal string.",tickUpper:"Provide the upper liquidity tick as a signed decimal string.",tickSpacing:"Provide the target pool tick spacing as a signed decimal string.",fee:"Provide the target pool fee in pips (10000 = 1%).",impactBps:"Provide the vault impact limit in basis points (100 = 1%).",rewardBps:"Provide the zap caller bounty rate in basis points (100 = 1%).",protocolShareBps:"Provide the protocol share in basis points (100 = 1%).",windowBlocks:"Provide the vault impact window in blocks.",windowScope:"Match the existing vault impact-window scope as a decimal uint8 string.",buyTakePips:"Provide the buy quote take in pips (10000 = 1%).",sellTakePips:"Provide the sell quote take in pips (10000 = 1%).",mintGasLimit:"Provide the gas limit for each reward mint."},Je=(e,t)=>e==="mode"?t==="market-guard"?"Choose 1 to refuse or 2 to apply a surcharge.":t==="swap-reward-mint"?"Choose 0 for trader mode or 1 for fixed recipient mode.":"Choose 0 to send bought subject to the sink or 1 for permanent target liquidity.":e==="flags"?t==="market-guard"?"Choose 0 for subject in quote or 1 for quote in subject feed direction.":"Provide schedule flags as a decimal string (0 or 1), controlling weekday surcharges outside calendar coverage.":e==="cap"?"Set the managed LP surcharge cap in pips (10000 = 1%).":Ze[e]??je[e],z=(e,t)=>({type:"object",additionalProperties:!1,required:e,properties:Object.fromEntries(e.map(r=>[r,{...Ye.has(r)?F:["targetId","poolId","accountInitCodeHash"].includes(r)?{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}:r==="quoteIsCurrency0"?{type:"boolean"}:["tickLower","tickUpper","tickSpacing"].includes(r)?{type:"string",pattern:"^(0|-?[1-9][0-9]*)$"}:S,description:Je(r,t)}]))}),Ne=e=>je[e]??{owner:"Provide the advisory owner address.",keeper:"Provide the admitted keeper address.",vault:"Provide the source vault address.",minter:"Provide the reward minter address."}[e],Xe={"market-guard":["feed","mode","flags","bandBps","rampBps","staleness","surchargePips","minDepth"],"market-hours-fee":["regularPips","preMarketPips","afterHoursPips","overnightPips","closedPips","openRampSeconds","closeRampSeconds","flags"],"managed-fee":["cap","surcharge","premium0","premium1","maxStep","minInterval","maxTtl"],"swap-reward-mint":He},P={"swap-reward-mint":{thirdPartyPayees:{type:"array",minItems:1,maxItems:2,uniqueItems:!0,items:F,description:"List up to two distinct third-party creator or fixed reward payee addresses; omit when all payees are the launching wallet."}}};if(Object.keys(P["swap-reward-mint"]).join()!==Re.optional.join())throw new Error("swap-reward-mint optional fields differ from its validator");var et=e=>({type:"object",additionalProperties:!1,properties:{id:{const:e,description:"Select this Hook Block by its ID."},...Object.fromEntries(A[e].map(t=>[t,{...t==="terms"?z(Xe[e],e):t==="route"?z(N,"vault"):t==="routes"?{type:"array",minItems:1,maxItems:4,items:z(N,"vault")}:t==="feeders"?{type:"array",minItems:1,maxItems:4,items:F}:["owner","keeper","vault","minter","factory"].includes(t)?F:S,description:Ne(t)}])),...Object.hasOwn(P,e)?P[e]:{}},required:["id",...A[e]]}),$e=(e,t)=>({type:"object",description:We[e],additionalProperties:!1,properties:{id:{const:e,description:"Select this Hook Block by its ID."},...Object.fromEntries(t.map(r=>[r,{...r==="recipient"?{type:"string",pattern:"^0x[0-9a-fA-F]{40}$"}:S,description:r==="cap"&&e==="wallet-cap"?"Set the cumulative wallet buy cap in subject token base units, using the subject token decimals.":r==="floor"?e==="storm-fee"?"Set the storm fee floor in 500-pip steps.":"Set the exit-clock floor in ten-basis-point steps.":r==="buy"||r==="sell"?`Set the ${r} quote charge in 1000-pip steps (0.1%) for ${e==="holder-pot"?"the holder pot":"the quote-claim payee"}.`:Ne(r)}]))},required:["id",...t]}),zt={type:"array",maxItems:20,items:{oneOf:[$e("anti-snipe",["guardEndBlock","taxPips","floorPips","decaySeconds","maxBuyQuoteAmount"]),...Object.entries(M).filter(([e])=>e!=="anti-snipe").map(([e,t])=>$e(e,t)),...v.map(et),{type:"object",additionalProperties:!1,properties:{id:{type:"string",description:"Select the Hook Block by its ID.",enum:Ke.filter(e=>!De.includes(e)&&!v.includes(e))}},required:["id"]}]},description:"Explicit Hook Blocks. Unsupported codecs are refused. Arb recapture and agent-gate use their dedicated launch fields. Empty means none beyond those fields."};function tt(e){let t=B(e);if(!Array.isArray(t.blocks)||!t.blocks.length||t.blocks.length>64)throw new d("Hookr block list is unavailable or incomplete; no empty catalog is inferred.");let r=new Set;return t.blocks.map(o=>{let s=B(o);if(typeof s.id!="string"||!/^[a-z][a-z-]{0,63}$/.test(s.id)||r.has(s.id)||typeof s.live!="boolean"||s.openToNewPools!==void 0&&typeof s.openToNewPools!="boolean")throw new d("Hookr block list is malformed or duplicated.");r.add(s.id);let a=s.live&&s.openToNewPools!==!1,n=a&&(De.includes(s.id)||v.includes(s.id));return{id:s.id,...s.address===void 0?{}:{address:D(s.address)},live:s.live,openToNewPools:a,supported:n,refusal:n?null:a?Object.hasOwn(Ie,s.id)?Ie[s.id]:`Hook Block ${s.id} needs a verified field codec and payment terms before Oak can launch it. Use its dedicated launch fields when available.`:`Hook Block ${s.id} is not open to new pools.`}})}async function _(e){return tt(await K(e,"hookr_blocks",{}))}function ot(e){if(e===void 0)return[];if(!Array.isArray(e)||e.length>20)throw new d("Choose at most twenty distinct Hook Blocks.");let t=new Set;return e.map(r=>{let o=B(r);if(typeof o.id!="string"||t.has(o.id))throw new d("Choose distinct Hook Block IDs.");if(t.add(o.id),Object.hasOwn(A,o.id)){let a=A[o.id],n=Object.hasOwn(P,o.id)?Object.keys(P[o.id]):[];return H(o,["id",...a,...n],["id",...a]),o}let s=Object.hasOwn(M,o.id)?M[o.id]:[];H(o,["id",...s],["id",...s]);for(let a of s)a==="recipient"?D(o[a]):u(o[a],["maxBuyQuoteAmount","cap"].includes(a)?128:a==="guardEndBlock"?40:24);return o})}function ze(e){if((e.length-2)/2!==512)throw new d("Hookr Rules terms must contain exactly sixteen words.");let[t]=Ue(T,e);if(Q(T,[t]).toLowerCase()!==e.toLowerCase())throw new d("Hookr Rules terms are not canonical.");return t}function rt(e,t){let r=u(t.guardEndBlock,40),o=Number(u(t.taxPips,24)),s=Number(u(t.floorPips,24)),a=Number(u(t.decaySeconds,16)),n=u(t.maxBuyQuoteAmount,128);if(!r||!o||o>597e3||!n||(a===0?s!==0:s>=o)||a>3600)throw new d("Anti-Snipe needs a future parent-block guard, positive buy cap/tax, a lower floor when decaying, and at most 3600 decay seconds.");return{...e,guardEndBlock:Number(r),snipeTaxPips:o,snipeFloorPips:s,snipeDecaySeconds:a,maxBuyQuoteAmount:n}}function st(e,t){let r=Number(u(t.maxFeePips,24)),o=Number(u(t.sensitivity,16));if(r<=3e3||r>6e5||o<1||o>10)throw new d("Dynamic fees need maxFeePips above 3000 and at most 600000, with sensitivity 1 to 10.");return{...e,maxFeePips:r,dynamicFeeSens:o}}function nt(e,t){let r=Number(u(t.burnBps,16));if(r<1||r>1e3)throw new d("Auto Burn needs burnBps between 1 and 1000.");return{...e,burnBps:r}}function it(e,t){let r=Number(u(t.lpBps,16));if(r<1||r>1e3)throw new d("LP Rewards needs lpBps between 1 and 1000.");if(e.lpBps&&e.lpBps!==r)throw new d("LP Rewards conflicts with lpRewardsBps. Choose the same rate in both fields.");return{...e,lpBps:r}}async function at(e,t,r,o,s){if(r.some(i=>v.includes(i.id)))throw new d("The agent gate and an advisory Hook Block cannot share the one advisory slot. Use an explicit open launch profile.");let a=s??(r.length?await _(e):[]),n=t,p=[...r.filter(i=>i.id==="anti-snipe"),...r.filter(i=>i.id!=="anti-snipe")];for(let i of p){let c=a.find(l=>l.id===i.id);if(!c||!c.openToNewPools)throw new d(`Hook Block ${String(i.id)} is not open to new pools.`);if(!c.supported)throw new d(c.refusal);switch(i.id){case"anti-snipe":n=rt(n,i);break;case"dynamic-fees":n=st(n,i);break;case"auto-burn":n=nt(n,i);break;case"lp-rewards":n=it(n,i);break;case"buy-sell-block":n=re(n,i);break;case"wallet-cap":n=ne(n,i);break;case"exit-clock":{let l=Object.fromEntries(Object.entries(i).filter(([m])=>m!=="id"));n=ae(n,l);break}case"storm-fee":n=ce(n,i);break;case"swap-cut":n=ue(n,i);break;case"sandwich-guard":n=me(n,i);break;case"holder-pot":n=Fe(n,i);break}}if(R(n),r.some(i=>Object.hasOwn(Me,String(i.id)))&&await gt(e,n,o),n.burnBps+n.lpBps>1e3)throw new d("Auto Burn plus LP Rewards must not exceed 1000 bps.");return ze(Q(T,[n]))}function dt(e,t=3e3,r=0n){R(e);let o=Ce(e),s=BigInt(e.protocolShareBps),a=g=>(BigInt(g)*s+99n)/100n,n=a(e.lpBps),p=a(e.burnBps),i=BigInt(e.lpBps)*100n-n,c=BigInt(e.maxFeePips-t),l=BigInt(e.snipeTaxPips),m=BigInt(t)+i+c+l+o.lp,E=n+p+c*s/10000n+l*s/10000n,x=e.lpBps!==0||e.burnBps!==0||c*s>=10000n||l*s>=10000n;return{maxLpFeePips:m,maxQuoteTakePips:(E>(x?0n:r)?E:x?0n:r)+o.quote,maxSubjectTakeBps:(BigInt(e.burnBps)*100n-p)/100n}}var b=e=>`${Oe(BigInt(e),4)}%`;function ct(e,t){return`Anti-Snipe: buys before parent block ${e.guardEndBlock} pay up to ${e.snipeTaxPips} surcharge pips (${b(e.snipeTaxPips)}), decaying to ${e.snipeFloorPips} pips (${b(e.snipeFloorPips)}) over ${e.snipeDecaySeconds} seconds; buy cap ${e.maxBuyQuoteAmount} quote base units. Hookr ${t} gets floor(charged pips * ${e.protocolShareBps}/10000) in quote; in-range LPs get the remaining LP fee. Principal locked until parent block ${e.guardEndBlock}.`}function pt(e,t){return`Dynamic fees: maximum ${e.maxFeePips} pips (${b(e.maxFeePips)}), sensitivity ${e.dynamicFeeSens}; Hookr ${t} gets floor(dynamic surcharge pips * ${e.protocolShareBps}/10000) in quote; in-range LPs get the remaining LP fee. Default tempo 30/120 seconds, carry 7500 bps, move 200 ticks; minimum dynamic liquidity is clamp(floor(launch liquidity/100), 1, 2^96-1).`}function ut(e,t){let r=(BigInt(e.burnBps)*BigInt(e.protocolShareBps)+99n)/100n;return`Auto Burn: configured ${e.burnBps} bps; subject output burn ${(BigInt(e.burnBps)*100n-r)/100n} bps after Hookr's slice. Hookr ${t} gets ${r} pips (${b(r)}) of gross buyer spend in quote; burned subject goes to 0x000000000000000000000000000000000000dEaD.`}function lt(e,t,r){let o=(BigInt(e.lpBps)*BigInt(e.protocolShareBps)+99n)/100n;return`LP Rewards: buys pay ${e.lpBps*100} gross pips (${b(e.lpBps*100)}); Hookr ${t} gets ${o} quote pips (${b(o)}), in-range LPs get ${BigInt(e.lpBps)*100n-o} LP fee pips (${b(BigInt(e.lpBps)*100n-o)}); creator royalty 0${e.integrator===Le?`; Oak ${e.integrator} gets ${r===void 0?"the share of Hookr's part that Hookr lists for it":`${Oe(r,2)}% of Hookr's part`}`:`, integrator ${e.integrator===qe?"0":e.integrator}`}.`}function Mt(e,t,r){let o=ze(e);if(R(o),o.integrator!==qe&&o.integrator!==Le||o.royaltyBps||o.potBps)throw new d("Hookr payment terms include an unsupported integrator, royalty or pot.");return[o.guardEndBlock?ct(o,t):"",o.dynamicFeeSens?pt(o,t):"",o.burnBps?ut(o,t):"",o.lpBps?lt(o,t,r):"",o.potEveryNBuys&1<<23?se(o):"",o.potEveryNBuys&1<<19?ie(o):"",o.potEveryNBuys&1<<20?de(o,t):"",o.potEveryNBuys&1<<22?pe(o,t):"",o.potEveryNBuys&1<<21?Ee(o,t):"",o.potEveryNBuys&16383&&!(o.potEveryNBuys&1<<21)?le(o,t):"",o.potEveryNBuys&1<<17?he(o,t):""].filter(Boolean)}function Qt(e){return[{name:"hookr_blocks",inputSchema:{type:"object",additionalProperties:!1,properties:{}},execute:async t=>(H(t,[]),{blocks:await _(e)})}]}var mt="0x4ff3630dd3d4ca59d00c08a7c8be527f6b90ffd700a7cc6a36a837de2ee4565e",ht="0x53a44e55150d75ad35c98d9b48c13a1ab6f4be9657d74083149e7d992e45e46f",Me={"swap-cut":"0x9394881A6Fe570adEC4480471B4D52652d263878","exit-clock":"0x2b6aB976d05Dcc7Cad53bF9324Fe892511036348","storm-fee":"0xD577087cbf9bEC0Ca0392efD8A83C3fE6A09Bd1f","wallet-cap":"0xfe5c29D2d6B7aC383A63291a771197e4D83E1d9c","buy-sell-block":"0xa64be3B5eC9B7310CBd3F77736ca5D6Fa81C5BCb","holder-pot":"0x740b2Da80eBB44613C2b44f380D55ECBECbFf11f","sandwich-guard":"0xa214e747d1a8E767F88ed2170be62E22ED79a269"};async function gt(e,t,r){let o=e.clientFor(4663),s=r??await q(o);await O(o,s.number,[f.rulesV1,f.launcherV1]);let a=[t.potEveryNBuys&16383?"swap-cut":"",...[[21,"holder-pot"],[20,"exit-clock"],[22,"storm-fee"],[19,"wallet-cap"],[23,"buy-sell-block"],[17,"sandwich-guard"]].filter(([n])=>t.potEveryNBuys&1<<Number(n)).map(([,n])=>String(n))].filter(Boolean);for(let n of a){let p=Me[n],i=B(await W(o,Y,V("registry"),"admission",[f.rulesV1,p],s.number)),c=B(i.caps);if(i.implementation!==p||w(i.kind,8)!==0n||i.codeHash!==mt||i.schemaHash!==ht||w(i.gasLimit,32)===0n||w(i.phaseMask,8)!==1n||j(i.failOpen)||j(i.feeOnly)||w(c.maxLpFeePips,24)||w(c.maxQuoteTakePips,24)||w(c.maxSubjectTakeBps,16))throw new d(`Hook Block ${n} is not admitted on the pinned core with its reviewed key terms.`)}if(t.potEveryNBuys&1<<23){let n=await ee(o,s),p=t.potMinBuyQuote>>85n&511n,i=t.potMinBuyQuote>>94n&7n;if(BigInt(t.guardEndBlock)-n-4n<(p>i?p:i))throw new d("The parent-block guard must cover the complete Buy/Sell Block windows plus four spare parent blocks.")}await L(o,s)}async function _t(e,t,r,o,s,a,n=0n,p){let i=ot(t.hookBlocks),c=oe(t.launchProfile,t.agentGate,i),l=i.filter($=>!v.includes($.id)),m=e.clientFor(4663);if((await q(m,s.number)).hash!==s.hash)throw new d("Hookr launch block changed before block validation.");await O(m,s.number,[f.rootV1,f.rulesV1,f.launcherV1]);let x=p??(i.length?await _(e):[]),g=await at(e,r,l,s,x),U=Q(T,[g]),G=dt(g,3e3,n);if(!c.advisory)return{kind:c.kind,rules:g,blockTerms:U,advisory:null,bounds:G,summaryLines:[]};let y=c.advisory,C=x.find($=>$.id===y.id);if(!C?.openToNewPools)throw new d(`Hook Block ${String(y.id)} is not open to new pools.`);let h=await yt(m,s.number,y,o);y.id==="market-guard"&&!(g.potEveryNBuys&te)&&(h.phases=3);let I="requiredCaps"in h?h.requiredCaps:h.bounds,k=await Be(m,s.number,h.descriptor,h.phases,I);if(C.address!==void 0&&C.address!==k.address)throw new d("Hookr catalog advisory address differs from the source-verified selection.");let Qe=y.id==="zap-source"?a.maxQuoteTakePips+I.maxQuoteTakePips:y.id==="swap-reward-mint"?kt(g,n)+I.maxQuoteTakePips:0n,_e=ve(G,k.caps,a,Qe);return await L(m,s),{kind:c.kind,rules:g,blockTerms:U,advisory:{...k,data:h.data,id:String(y.id),summary:h.summary},bounds:_e,summaryLines:[`No agent identity gate. ${y.id==="zap-target"?"Only the frozen feeder vaults may buy; any wallet may sell.":"Wallets need no agent identity; the selected advisory can impose its own decoded restrictions."} ${h.summary}`,`Advisory ${k.address}, phases ${k.phases}, fail closed, gas ${k.gasLimit}; full admitted reservation ${k.caps.maxLpFeePips} LP pips and ${k.caps.maxQuoteTakePips} quote pips.`]}}async function yt(e,t,r,o){let s=Object.fromEntries(Object.entries(r).filter(([n])=>n!=="id")),a;switch(r.id){case"market-guard":a=await ye(e,t,s,o);break;case"market-hours-fee":a=await fe(e,t,s);break;case"managed-fee":a=await be(e,t,s);break;case"zap-source":a=await J(e,t,s,o);break;case"zap-target":a=await Pe(e,t,s,o);break;case"swap-reward-mint":a=await Te(e,t,s,o);break;default:throw new d("Unknown Hookr advisory profile.")}return a}function kt(e,t){let r=BigInt(e.protocolShareBps),o=(BigInt(e.lpBps)*r+99n)/100n,s=(BigInt(e.lpBps)*100n-o)*BigInt(e.royaltyBps)/10000n,a=o+s+(BigInt(e.burnBps)*r+99n)/100n+BigInt(e.maxFeePips-3e3+e.snipeTaxPips)*r/10000n;return a>s+t?a:s+t}export{T as a,Le as b,Ke as c,Ve as d,A as e,zt as f,tt as g,_ as h,ot as i,ze as j,rt as k,st as l,nt as m,it as n,at as o,dt as p,ct as q,pt as r,ut as s,lt as t,Mt as u,Qt as v,_t as w,yt as x,kt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function d(r,t){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(t,"id")}var h=new Map([]),_="find_tool",l="run_tool",w=["merkl_rewards","merkl_opportunities","merkl_campaigns","merkl_earning_status","merkl_claim_config","merkl_distributor_status","merkl_stock_lp_rewards"],k=["upoch_agent","upoch_explorer"],i=["oak_setup","oak_identity_unlink","send","hoodlock_feature_buy","hoodlock_feature_claim","hoodlock_referral_register","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_unfollow","heyresearch_position_context"],p={oak:["account","balances","find_token","price","quote","swap","positions","send","oak_setup","oak_identity_unlink"],kyberswap:[],velora:[],steakhouse:["steakhouse_deposit","steakhouse_withdraw"],spark:["spark_deposit","spark_withdraw"],layerbank:["layerbank_deposit","layerbank_withdraw"],borro:["borro_deposit","borro_withdraw"],chop:["chop_wrap","chop_unwrap"],factor:["factor_sign_up","factor_open_jobs"],raeto:["raeto_status","raeto_join","raeto_ask"],gloam:["gloam_shield","gloam_pay","gloam_claim","gloam_cash_out"],pendle:["pendle_buy","pendle_sell","pendle_redeem"],earn:["earn_options"],netnet:["netnet_deposit","netnet_withdraw"],longbow:["longbow_list","longbow_deposit","longbow_withdraw"],grove:["grove_deposit","grove_withdraw"],beefy:["beefy_list","beefy_deposit","beefy_withdraw"],pons:["pons_browse","pons_buy","pons_sell","pons_launch"],orbio:["orbio_credit_status","orbio_buy_credit"],hoodlock:["hoodlock_list_locks","hoodlock_lock","hoodlock_withdraw"],merkl:["merkl_rewards","merkl_claim"],relay:["relay_bridge_in","relay_bridge_out","relay_status"],lighter:["lighter_funding"],wormhole:[],upoch:[],erc8004:["erc8004_identity"],hoodag:["hoodag_resolve","hoodag_register"],heyresearch:["heyresearch_research_project","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_position_context"],priors:["priors_status","priors_lend","priors_withdraw","priors_borrow","priors_repay"],morpho:["morpho_status","morpho_supply","morpho_withdraw","morpho_supply_collateral","morpho_withdraw_collateral","morpho_borrow","morpho_repay"],uniswap:["uniswap_list_positions","uniswap_add","uniswap_remove","uniswap_collect"],hookr:["hookr_orders","hookr_create","hookr_cancel"],meridian:["meridian_browse","meridian_positions","meridian_sell","meridian_redeem"],tickerspring:["tickerspring_account","tickerspring_create","tickerspring_cancel","tickerspring_claim"],clanker:["clanker_browse","clanker_launch"],poolstrade:["poolstrade_status","poolstrade_buy","poolstrade_sell","poolstrade_launch"]};function u(r,t){let a=new Set(r),s=new Set;for(let[e,n]of Object.entries(p))for(let o of n){if(s.has(o))throw new Error(`Visible tool ${o} is listed twice.`);if(e!=="oak"&&!o.startsWith(`${e}_`))throw new Error(`Visible tool ${o} is filed under ${e}.`);if(i.includes(o)||a.has(o))s.add(o);else if(t==="mainnet")throw new Error(`Visible tool ${o} is not registered.`)}for(let e of[_,l,...i,"oak_playbook"])if(a.has(e))throw new Error(`Tool name ${e} is reserved for the add-on.`);return s}export{d as a,h as b,_ as c,l as d,w as e,k as f,i as g,p as h,u as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as q,o as U}from"./GYPMUYB5.js";import{a as J,b as ue,c as me}from"./C76D54YG.js";import{a as le}from"./ELHRXA5U.js";import{a as pe,b as fe}from"./DGDMRATN.js";import{a as ye}from"./4Z3IGMU6.js";import{e as F,h as L,m as ce}from"./TXGZ6NWN.js";import{b as ae}from"./SPJCSEKP.js";import{a as E}from"./IOYRL6AY.js";import{c as de}from"./SCG5HWMN.js";import{c as O,e as A,g as w,k as ie,l as oe,m as re,n as se}from"./NWNYJ26T.js";import{b as h,j as te}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{decodeFunctionResult as Ce,encodeAbiParameters as j,encodeFunctionData as D,erc20Abi as V,isAddress as Ie,parseAbi as xe,parseAbiParameters as W,toHex as z,zeroAddress as Z}from"viem";var x=te[h].clanker,he=xe(["function deployToken(((address tokenAdmin,string name,string symbol,bytes32 salt,string image,string metadata,string context,uint256 originatingChainId) tokenConfig,(address hook,address pairedToken,int24 tickIfToken0IsClanker,int24 tickSpacing,bytes poolData) poolConfig,(address locker,address[] rewardAdmins,address[] rewardRecipients,uint16[] rewardBps,int24[] tickLower,int24[] tickUpper,uint16[] positionBps,bytes lockerData) lockerConfig,(address mevModule,bytes mevModuleData) mevModuleConfig,(address extension,uint256 msgValue,uint16 extensionBps,bytes extensionData)[] extensionConfigs) config) payable returns (address)","function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),T=xe(["function availableFees(address,address) view returns (uint256)","function claim(address,address)","function collectRewards(address)","function mevModuleEnabled(bytes32) view returns (bool)","function mevModuleOperational(bytes32) returns (bool)"]),P={address:x.paired_weth.address,symbol:"WETH",decimals:18,chainId:h},ve="https://www.clanker.world/api/tokens",be={type:"string",pattern:"^\\d+$"},ge={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"};function C(e){return oe(ie(e,F),F)}function ke(e,t){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r(`Provide an explicit bytes32 ${t}.`);return e}function I(e,t,s=!1){if(e===void 0&&!s)return"";if(typeof e!="string"||s&&!e.trim())throw new r(`Provide ${t} as text.`);return e}function G(e,t=256){return se(e,`Amount exceeds the uint${t} range.`,{bits:t})}function K(e){return re(e,"The contract returned an invalid amount.").toString()}function B(e,t){let s=Object.keys(e).find(u=>!t.includes(u));if(s)throw new r(`Unsupported Clanker input: ${s}.`)}function we(e,t){return t.changes.map(({token:s,amount:u})=>{let g=u.startsWith("-");return`${g?"-":"+"}${e.formatAmount(g?u.slice(1):u,s.decimals)} ${s.symbol} (${s.address}, chain ${s.chainId})`}).join("; ")}function Se(e){return A(e)&&Array.isArray(e.data)&&Number.isSafeInteger(e.total)&&Number(e.total)>=0&&Number.isSafeInteger(e.tokensDeployed)&&Number(e.tokensDeployed)>=0&&(e.cursor===null||e.cursor===void 0||typeof e.cursor=="string")&&e.data.every(t=>A(t)&&typeof t.name=="string"&&typeof t.symbol=="string"&&Number.isSafeInteger(t.chain_id)&&["contract_address","admin","msg_sender","factory_address"].every(s=>typeof t[s]=="string"&&Ie(t[s],{strict:!1})))}function Q(e,t=0){return typeof e=="string"?N(e):e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:t>=4?null:Array.isArray(e)?e.slice(0,20).map(s=>Q(s,t+1)):A(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,u])=>[s,Q(u,t+1)])):null}function _e(e){return{...Q(e),contract_address:e.contract_address,admin:e.admin,msg_sender:e.msg_sender,chain_id:e.chain_id,factory_address:e.factory_address,name:N(e.name),symbol:N(e.symbol)}}function $e(e){try{if(typeof e!="string"||!/^[A-Za-z0-9_-]{1,256}={0,2}$/.test(e))throw new Error;let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));if(!A(t)||typeof t.id!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z?$/.test(t.id)||!Number.isFinite(Date.parse(t.id)))throw new Error;return e}catch{throw new r("Use the cursor returned by the previous clanker_browse page.")}}async function Ne(e,t={}){B(t,["q","limit","cursor","deployer"]);let s=t.limit??10;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>20)throw new r("Choose an indexer limit from 1 to 20.");let u=new URL(ve);u.searchParams.set("chainId",String(h)),u.searchParams.set("limit",String(s)),t.q!==void 0&&u.searchParams.set("q",I(t.q,"search")),t.cursor!==void 0&&u.searchParams.set("cursor",I(t.cursor,"cursor",!0)),t.deployer!==void 0&&u.searchParams.set("msgSender",C(t.deployer));let g=await de(e.http,u.toString(),{headers:{"User-Agent":"Oak-Clanker/1.0"}},Se);return{tokens:g.data.filter(v=>v.chain_id===h&&w(v.factory_address,x.factory.address)),total:g.total,cursor:g.cursor||null,tokensDeployed:g.tokensDeployed}}var Oe=e=>{let t=()=>e.clientFor(h),s=async n=>{try{return await n()}catch(i){throw new r(e.plainError(i))}},u=(n,i,a,c="0")=>e.unsignedTx({to:n,data:i,value:c,chainId:h,description:a}),g=async(n,i)=>K(await t().readContract({address:x.fee_locker.address,abi:T,functionName:"availableFees",args:[n,i]})),v=async n=>{if(w(n,P.address))return P;let[i,a]=await Promise.all([t().readContract({address:n,abi:V,functionName:"symbol"}),t().readContract({address:n,abi:V,functionName:"decimals"})]);if(typeof i!="string"||!i.trim()||!Number.isInteger(a)||a<0||a>255)throw new r("The contract returned invalid token metadata.");return{address:n,chainId:h,symbol:i,decimals:a}},X=async n=>{n.cursor!==void 0&&$e(n.cursor);let i=await Ne(e,n);return{...i,tokens:i.tokens.map(_e)}},Ae=async(n,i)=>{if(B(n,["name","symbol","salt","image","metadata","context","vanity","initialBuy","minAmountOut","slippageBps","rewards","vault","airdrop","feeBps","pool"]),n.vanity!==void 0&&n.vanity!==!1)throw new r("Clanker launches use vanity false and an explicit salt.");let a=I(n.name,"token name",!0),c=I(n.symbol,"token symbol",!0),b=ke(n.salt,"salt"),y=G(n.initialBuy??"0"),l=n.slippageBps??q;if(typeof l!="number")throw new r("Slippage must be an integer from 0 to 9999 bps.");U("0",l);let o=n.minAmountOut===void 0?void 0:G(n.minAmountOut,128);if(o!==void 0&&o<=1n)throw new r("Initial-buy minimum must exceed one base unit.");if(!y&&o!==void 0)throw new r("A minimum requires a positive initial buy.");let m=ue(n,i);L(n.feeBps??100,0,1e3);let p=fe(n);if(y&&!w(p.poolConfig.pairedToken,P.address))throw new r("An initial ETH buy currently requires a WETH-paired pool. Launch without an initial buy and obtain a protected swap quote separately.");let d=n.rewards??[{admin:i,recipient:i,bps:1e4,feePreference:0}];if(!Array.isArray(d)||!d.length||d.length>7)throw new r("Provide one to seven reward allocations.");let k=d.map(f=>{if(!A(f))throw new r("Provide reward allocations as objects.");return B(f,["admin","recipient","bps","feePreference"]),{admin:C(f.admin),recipient:C(f.recipient),bps:L(f.bps,1,1e4),feePreference:L(f.feePreference??0,0,2)}});if(k.reduce((f,S)=>f+S.bps,0)!==1e4)throw new r("Reward allocations must total 10000 bps.");let _={tokenConfig:{tokenAdmin:i,name:a,symbol:c,salt:b,image:I(n.image,"image"),metadata:I(n.metadata,"metadata"),context:n.context===void 0?JSON.stringify({interface:"Oak",platform:"robinhood"}):I(n.context,"context"),originatingChainId:BigInt(h)},poolConfig:p.poolConfig,lockerConfig:{locker:x.locker.address,rewardAdmins:k.map(f=>f.admin),rewardRecipients:k.map(f=>f.recipient),rewardBps:k.map(f=>f.bps),tickLower:p.tickLower,tickUpper:p.tickUpper,positionBps:p.positionBps,lockerData:j(W("(uint8[])"),[[k.map(f=>f.feePreference)]])},mevModuleConfig:{mevModule:x.mev_module.address,mevModuleData:j(W("(uint24,uint24,uint256)"),[[666777,41673,15n]])},extensionConfigs:m},Pe=await t().simulateContract({address:x.factory.address,abi:he,functionName:"deployToken",args:[_],account:i,value:0n,gas:E}),M=C(Pe.result),Y=f=>{let S=[...m,...y?[{extension:x.devbuy.address,msgValue:y,extensionBps:0,extensionData:j(W("(address,address,uint24,int24,address),uint128,address"),[[Z,Z,0,0,Z],f,i])}]:[]];return u(x.factory.address,D({abi:he,functionName:"deployToken",args:[{..._,extensionConfigs:S}]}),`Launch ${a} (${c}); initial buy ${y} native ETH base units.`,y.toString())};if(y&&o===void 0){let S=(await e.preview([Y(0n)],i)).changes.filter($=>$.token.chainId===h&&w($.token.address,M)&&$.token.decimals===18).reduce(($,ne)=>$+(/^-?\d+$/.test(ne.amount)?BigInt(ne.amount):(()=>{throw new r("Invalid initial-buy simulation amount.")})()),0n);if(S<=0n)throw new r("Initial-buy simulation returned no token output.");if(o=G(U(S.toString(),l),128),o<=1n)throw new r("Initial-buy output is too small for a protected minimum.")}let ee=[Y(o??0n)],H=await e.preview(ee,i);return{txs:ee,preview:H,predictedToken:M,token:{address:M,chainId:h,symbol:c,decimals:18},...o!==void 0?{minAmountOut:o.toString()}:{},summary:`Launch ${c} at ${M} (CREATE2 address predicted from simulation); vanity false; salt ${b}. Supply 100000000000000000000000000000 base units (18 decimals). ${p.feeSummary}; protocol adds 20% of LP fees. Pool and LP allocations: ${JSON.stringify(p)}. Reward allocations: ${JSON.stringify(k)}. Extensions: ${JSON.stringify({vault:n.vault,airdrop:n.airdrop})}. Sniper fees 666777 to 41673 over 15 seconds. ${H.summary} ${we(e,H)}`}},Te=async(n,i)=>{if(B(n,["token","poolId","collect"]),n.collect!==void 0&&typeof n.collect!="boolean")throw new r("collect must be boolean.");if(n.collect===!1&&n.poolId!==void 0)throw new r("poolId requires collection.");if(n.collect===!0&&n.token===void 0)throw new r("Collection requires a Clanker token.");if(n.poolId!==void 0&&n.token===void 0)throw new r("A pool ID requires its Clanker token.");let a=[P],c=[];if(n.token!==void 0){let o=C(n.token);if(w(o,P.address))throw new r("Provide the launched Clanker token, not WETH.");if(n.collect!==!1){let m=await ce(e,o),{poolId:p,hook:d,locker:k}=m;if(n.poolId!==void 0&&!w(ke(n.poolId,"pool ID for fee collection"),p))throw new r("The supplied pool ID does not match the onchain Clanker pool.");w(m.pairedToken,P.address)||a.splice(0,1,await v(m.pairedToken));let _=await t().readContract({address:d,abi:T,functionName:"mevModuleEnabled",args:[p]});if(typeof _!="boolean")throw new r("The hook returned an invalid MEV guard state.");_&&c.push(u(d,D({abi:T,functionName:"mevModuleOperational",args:[p]}),"Update the Clanker pool MEV guard before collection.")),c.push(u(k,D({abi:T,functionName:"collectRewards",args:[o]}),"Collect pending LP fees into the fee locker."))}a.push(await v(o))}let b;if(c.length){if(await t().getChainId()!==h)throw new r("Fee simulation endpoint is on the wrong chain.");let o=[...c.map(d=>({from:i,gas:z(E),to:d.to,data:d.data,value:z(BigInt(d.value))})),...a.map(d=>({from:i,gas:z(E),to:x.fee_locker.address,data:D({abi:T,functionName:"availableFees",args:[i,d.address]}),value:"0x0"}))],m=await t().request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:o}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(m)||m.length!==1||!A(m[0])||!Array.isArray(m[0].calls)||m[0].calls.length!==o.length)throw new r("The endpoint returned an unexpected fee simulation response.");let p=m[0].calls;if(!p.every(d=>A(d)&&d.status==="0x1"&&!d.error))throw new r("Clanker fee collection simulation failed.");b=p.slice(c.length).map(d=>{if(!A(d)||typeof d.returnData!="string"||!/^0x[0-9a-fA-F]{64}$/.test(d.returnData))throw new r("The endpoint returned an invalid fee balance.");return K(Ce({abi:T,functionName:"availableFees",data:d.returnData}))})}else b=await Promise.all(a.map(o=>g(i,o.address)));let y=a.flatMap((o,m)=>BigInt(b[m])>0n?[{token:o,amount:b[m]}]:[]);if(!y.length)throw new r("No claimable fees for this wallet; pending LP fees may require the MEV window to end.");for(let{token:o}of y)c.push(u(x.fee_locker.address,D({abi:T,functionName:"claim",args:[i,o.address]}),`Claim ${o.symbol} fees to ${i}.`));let l=await e.preview(c,i);return{txs:c,preview:l,fees:y,summary:`Claim fees to ${i}. WETH fees aggregate across all Clanker launches for this recipient. ${l.summary} ${we(e,l)}`}},R=(n,i,a,c)=>({name:`clanker_${n}`,inputSchema:{type:"object",properties:i,required:a,additionalProperties:!1},execute:(b,y)=>s(async()=>c(b,C(y)))});return{tools:[R("launch",{name:{type:"string",description:"Token name, shown publicly."},symbol:{type:"string",description:"Token ticker symbol, shown publicly."},salt:{...ge,description:"Deployment salt as 0x followed by 64 hex digits; it fixes the predicted token address."},image:{type:"string",description:"Image URL for the token. Public."},metadata:{type:"string",description:"Token metadata as a JSON string (description, social links). Public."},context:{type:"string",description:"Launch context as a JSON string. Defaults to Oak on Robinhood."},vanity:{const:!1,description:"Vanity address mining is not supported; leave false or omit."},initialBuy:{...be,description:"Native ETH base units, 18 decimals."},minAmountOut:{...be,description:"Minimum new token base units, 18 decimals; derived from simulation when omitted."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:q,description:"Slippage in basis points (50 = 0.5%) applied to the initial buy when minAmountOut is omitted."},feeBps:{type:"integer",minimum:0,maximum:1e3,default:100,description:"Static LP fee in basis points (100 = 1%). Not allowed together with pool.dynamicFee."},pool:{...pe,description:"Optional pool setup: paired token, starting tick, tick spacing, liquidity positions and dynamic fee. Defaults to a WETH pool."},rewards:{type:"array",minItems:1,maxItems:7,description:"How LP fees are split, 1 to 7 rows with bps totaling 10000. Default: all to the launching wallet.",items:{type:"object",properties:{admin:{...O,description:"Address that can later change this row."},recipient:{...O,description:"Address that receives this row's share of LP fees."},bps:{type:"integer",minimum:1,maximum:1e4,description:"This row's share of LP fees in basis points (5000 = 50%)."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in: 0 = both tokens (default), 1 = paired token, 2 = launched token."}},required:["admin","recipient","bps"],additionalProperties:!1}},vault:{...J.vault,description:"Optional vault extension: lock part of the supply, then vest it to an admin."},airdrop:{...J.airdrop,description:"Optional airdrop extension: reserve part of the supply for a Merkle-tree airdrop."}},["name","symbol","salt"],async(n,i)=>{let a=await Ae(n,i);return{...a,summary:`${a.summary} After the launch is mined, use clanker_status to inspect ${a.predictedToken} and clanker_claim to collect creator fees.`}}),R("claim",{token:{...O,description:"Launched token; derives its onchain pool and collects pending LP fees before claiming."},poolId:{...ge,description:"Optional assertion against the derived pool ID."},collect:{type:"boolean",default:!0,description:"Set false to claim only already-collected fees."}},[],Te),R("browse",{q:{type:"string",description:"Optional search text matched against token name or symbol."},limit:{type:"integer",minimum:1,maximum:20,description:"Maximum tokens to return, 1 to 20 (default 10)."},cursor:{type:"string",description:"Opaque pagination cursor returned by a previous clanker_browse call."},deployer:{...O,description:"Optional address of the deploying wallet to filter tokens by."}},[],X)],positions:n=>s(async()=>{C(n);let i=new Map,a=new Set,c;do{let l=await X({deployer:n,limit:20,...c?{cursor:c}:{}});for(let o of l.tokens)w(o.msg_sender,n)&&i.set(o.contract_address.toLowerCase(),o);if(l.cursor&&a.has(l.cursor))throw new r("The Clanker indexer repeated a pagination cursor.");l.cursor&&a.add(l.cursor),c=l.cursor??void 0}while(c);let b=[],y=[P];for(let[l,o]of i){let m=await v(o.contract_address),p={...m,symbol:N(m.symbol)},d=K(await t().readContract({address:p.address,abi:V,functionName:"balanceOf",args:[n]}));b.push({module:"clanker",id:`launch:${l}`,chainId:h,assets:[{token:p,amount:d}],description:`Indexed launch ${o.name}; wallet token balance, not locked LP principal.`}),y.some(k=>w(k.address,p.address))||y.push(p)}for(let l of y){let o=await g(n,l.address);BigInt(o)>0n&&b.push({module:"clanker",id:`fees:${l.address.toLowerCase()}`,chainId:h,assets:[{token:l,amount:o}],description:"Collected fees across launches for this recipient. Pending LP fees excluded; token-side discovery covers indexed launches by this wallet."})}return b})}},ze=e=>ae("clanker",[Oe(e),le(e),me(e),ye(e)]);export{Ne as a,Oe as b,ze as c};
|
|
1
|
+
import{b as q,o as U}from"./TTBB6EFN.js";import{a as J,b as ue,c as me}from"./HGSFRN57.js";import{a as le}from"./QFK335LC.js";import{a as pe,b as fe}from"./ICHT3H3W.js";import{a as ye}from"./7AYP4ATZ.js";import{e as F,h as L,m as ce}from"./PG7HZIZL.js";import{b as ae}from"./SPJCSEKP.js";import{a as E}from"./IOYRL6AY.js";import{c as de}from"./SCG5HWMN.js";import{c as O,e as A,g as w,k as ie,l as oe,m as re,n as se}from"./NWNYJ26T.js";import{b as h,j as te}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{a as N}from"./JXOEJPJ4.js";import{decodeFunctionResult as Ce,encodeAbiParameters as j,encodeFunctionData as D,erc20Abi as V,isAddress as Ie,parseAbi as xe,parseAbiParameters as W,toHex as z,zeroAddress as Z}from"viem";var x=te[h].clanker,he=xe(["function deployToken(((address tokenAdmin,string name,string symbol,bytes32 salt,string image,string metadata,string context,uint256 originatingChainId) tokenConfig,(address hook,address pairedToken,int24 tickIfToken0IsClanker,int24 tickSpacing,bytes poolData) poolConfig,(address locker,address[] rewardAdmins,address[] rewardRecipients,uint16[] rewardBps,int24[] tickLower,int24[] tickUpper,uint16[] positionBps,bytes lockerData) lockerConfig,(address mevModule,bytes mevModuleData) mevModuleConfig,(address extension,uint256 msgValue,uint16 extensionBps,bytes extensionData)[] extensionConfigs) config) payable returns (address)","function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),T=xe(["function availableFees(address,address) view returns (uint256)","function claim(address,address)","function collectRewards(address)","function mevModuleEnabled(bytes32) view returns (bool)","function mevModuleOperational(bytes32) returns (bool)"]),P={address:x.paired_weth.address,symbol:"WETH",decimals:18,chainId:h},ve="https://www.clanker.world/api/tokens",be={type:"string",pattern:"^\\d+$"},ge={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"};function C(e){return oe(ie(e,F),F)}function ke(e,t){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r(`Provide an explicit bytes32 ${t}.`);return e}function I(e,t,s=!1){if(e===void 0&&!s)return"";if(typeof e!="string"||s&&!e.trim())throw new r(`Provide ${t} as text.`);return e}function G(e,t=256){return se(e,`Amount exceeds the uint${t} range.`,{bits:t})}function K(e){return re(e,"The contract returned an invalid amount.").toString()}function B(e,t){let s=Object.keys(e).find(u=>!t.includes(u));if(s)throw new r(`Unsupported Clanker input: ${s}.`)}function we(e,t){return t.changes.map(({token:s,amount:u})=>{let g=u.startsWith("-");return`${g?"-":"+"}${e.formatAmount(g?u.slice(1):u,s.decimals)} ${s.symbol} (${s.address}, chain ${s.chainId})`}).join("; ")}function Se(e){return A(e)&&Array.isArray(e.data)&&Number.isSafeInteger(e.total)&&Number(e.total)>=0&&Number.isSafeInteger(e.tokensDeployed)&&Number(e.tokensDeployed)>=0&&(e.cursor===null||e.cursor===void 0||typeof e.cursor=="string")&&e.data.every(t=>A(t)&&typeof t.name=="string"&&typeof t.symbol=="string"&&Number.isSafeInteger(t.chain_id)&&["contract_address","admin","msg_sender","factory_address"].every(s=>typeof t[s]=="string"&&Ie(t[s],{strict:!1})))}function Q(e,t=0){return typeof e=="string"?N(e):e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:t>=4?null:Array.isArray(e)?e.slice(0,20).map(s=>Q(s,t+1)):A(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,u])=>[s,Q(u,t+1)])):null}function _e(e){return{...Q(e),contract_address:e.contract_address,admin:e.admin,msg_sender:e.msg_sender,chain_id:e.chain_id,factory_address:e.factory_address,name:N(e.name),symbol:N(e.symbol)}}function $e(e){try{if(typeof e!="string"||!/^[A-Za-z0-9_-]{1,256}={0,2}$/.test(e))throw new Error;let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));if(!A(t)||typeof t.id!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z?$/.test(t.id)||!Number.isFinite(Date.parse(t.id)))throw new Error;return e}catch{throw new r("Use the cursor returned by the previous clanker_browse page.")}}async function Ne(e,t={}){B(t,["q","limit","cursor","deployer"]);let s=t.limit??10;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>20)throw new r("Choose an indexer limit from 1 to 20.");let u=new URL(ve);u.searchParams.set("chainId",String(h)),u.searchParams.set("limit",String(s)),t.q!==void 0&&u.searchParams.set("q",I(t.q,"search")),t.cursor!==void 0&&u.searchParams.set("cursor",I(t.cursor,"cursor",!0)),t.deployer!==void 0&&u.searchParams.set("msgSender",C(t.deployer));let g=await de(e.http,u.toString(),{headers:{"User-Agent":"Oak-Clanker/1.0"}},Se);return{tokens:g.data.filter(v=>v.chain_id===h&&w(v.factory_address,x.factory.address)),total:g.total,cursor:g.cursor||null,tokensDeployed:g.tokensDeployed}}var Oe=e=>{let t=()=>e.clientFor(h),s=async n=>{try{return await n()}catch(i){throw new r(e.plainError(i))}},u=(n,i,a,c="0")=>e.unsignedTx({to:n,data:i,value:c,chainId:h,description:a}),g=async(n,i)=>K(await t().readContract({address:x.fee_locker.address,abi:T,functionName:"availableFees",args:[n,i]})),v=async n=>{if(w(n,P.address))return P;let[i,a]=await Promise.all([t().readContract({address:n,abi:V,functionName:"symbol"}),t().readContract({address:n,abi:V,functionName:"decimals"})]);if(typeof i!="string"||!i.trim()||!Number.isInteger(a)||a<0||a>255)throw new r("The contract returned invalid token metadata.");return{address:n,chainId:h,symbol:i,decimals:a}},X=async n=>{n.cursor!==void 0&&$e(n.cursor);let i=await Ne(e,n);return{...i,tokens:i.tokens.map(_e)}},Ae=async(n,i)=>{if(B(n,["name","symbol","salt","image","metadata","context","vanity","initialBuy","minAmountOut","slippageBps","rewards","vault","airdrop","feeBps","pool"]),n.vanity!==void 0&&n.vanity!==!1)throw new r("Clanker launches use vanity false and an explicit salt.");let a=I(n.name,"token name",!0),c=I(n.symbol,"token symbol",!0),b=ke(n.salt,"salt"),y=G(n.initialBuy??"0"),l=n.slippageBps??q;if(typeof l!="number")throw new r("Slippage must be an integer from 0 to 9999 bps.");U("0",l);let o=n.minAmountOut===void 0?void 0:G(n.minAmountOut,128);if(o!==void 0&&o<=1n)throw new r("Initial-buy minimum must exceed one base unit.");if(!y&&o!==void 0)throw new r("A minimum requires a positive initial buy.");let m=ue(n,i);L(n.feeBps??100,0,1e3);let p=fe(n);if(y&&!w(p.poolConfig.pairedToken,P.address))throw new r("An initial ETH buy currently requires a WETH-paired pool. Launch without an initial buy and obtain a protected swap quote separately.");let d=n.rewards??[{admin:i,recipient:i,bps:1e4,feePreference:0}];if(!Array.isArray(d)||!d.length||d.length>7)throw new r("Provide one to seven reward allocations.");let k=d.map(f=>{if(!A(f))throw new r("Provide reward allocations as objects.");return B(f,["admin","recipient","bps","feePreference"]),{admin:C(f.admin),recipient:C(f.recipient),bps:L(f.bps,1,1e4),feePreference:L(f.feePreference??0,0,2)}});if(k.reduce((f,S)=>f+S.bps,0)!==1e4)throw new r("Reward allocations must total 10000 bps.");let _={tokenConfig:{tokenAdmin:i,name:a,symbol:c,salt:b,image:I(n.image,"image"),metadata:I(n.metadata,"metadata"),context:n.context===void 0?JSON.stringify({interface:"Oak",platform:"robinhood"}):I(n.context,"context"),originatingChainId:BigInt(h)},poolConfig:p.poolConfig,lockerConfig:{locker:x.locker.address,rewardAdmins:k.map(f=>f.admin),rewardRecipients:k.map(f=>f.recipient),rewardBps:k.map(f=>f.bps),tickLower:p.tickLower,tickUpper:p.tickUpper,positionBps:p.positionBps,lockerData:j(W("(uint8[])"),[[k.map(f=>f.feePreference)]])},mevModuleConfig:{mevModule:x.mev_module.address,mevModuleData:j(W("(uint24,uint24,uint256)"),[[666777,41673,15n]])},extensionConfigs:m},Pe=await t().simulateContract({address:x.factory.address,abi:he,functionName:"deployToken",args:[_],account:i,value:0n,gas:E}),M=C(Pe.result),Y=f=>{let S=[...m,...y?[{extension:x.devbuy.address,msgValue:y,extensionBps:0,extensionData:j(W("(address,address,uint24,int24,address),uint128,address"),[[Z,Z,0,0,Z],f,i])}]:[]];return u(x.factory.address,D({abi:he,functionName:"deployToken",args:[{..._,extensionConfigs:S}]}),`Launch ${a} (${c}); initial buy ${y} native ETH base units.`,y.toString())};if(y&&o===void 0){let S=(await e.preview([Y(0n)],i)).changes.filter($=>$.token.chainId===h&&w($.token.address,M)&&$.token.decimals===18).reduce(($,ne)=>$+(/^-?\d+$/.test(ne.amount)?BigInt(ne.amount):(()=>{throw new r("Invalid initial-buy simulation amount.")})()),0n);if(S<=0n)throw new r("Initial-buy simulation returned no token output.");if(o=G(U(S.toString(),l),128),o<=1n)throw new r("Initial-buy output is too small for a protected minimum.")}let ee=[Y(o??0n)],H=await e.preview(ee,i);return{txs:ee,preview:H,predictedToken:M,token:{address:M,chainId:h,symbol:c,decimals:18},...o!==void 0?{minAmountOut:o.toString()}:{},summary:`Launch ${c} at ${M} (CREATE2 address predicted from simulation); vanity false; salt ${b}. Supply 100000000000000000000000000000 base units (18 decimals). ${p.feeSummary}; protocol adds 20% of LP fees. Pool and LP allocations: ${JSON.stringify(p)}. Reward allocations: ${JSON.stringify(k)}. Extensions: ${JSON.stringify({vault:n.vault,airdrop:n.airdrop})}. Sniper fees 666777 to 41673 over 15 seconds. ${H.summary} ${we(e,H)}`}},Te=async(n,i)=>{if(B(n,["token","poolId","collect"]),n.collect!==void 0&&typeof n.collect!="boolean")throw new r("collect must be boolean.");if(n.collect===!1&&n.poolId!==void 0)throw new r("poolId requires collection.");if(n.collect===!0&&n.token===void 0)throw new r("Collection requires a Clanker token.");if(n.poolId!==void 0&&n.token===void 0)throw new r("A pool ID requires its Clanker token.");let a=[P],c=[];if(n.token!==void 0){let o=C(n.token);if(w(o,P.address))throw new r("Provide the launched Clanker token, not WETH.");if(n.collect!==!1){let m=await ce(e,o),{poolId:p,hook:d,locker:k}=m;if(n.poolId!==void 0&&!w(ke(n.poolId,"pool ID for fee collection"),p))throw new r("The supplied pool ID does not match the onchain Clanker pool.");w(m.pairedToken,P.address)||a.splice(0,1,await v(m.pairedToken));let _=await t().readContract({address:d,abi:T,functionName:"mevModuleEnabled",args:[p]});if(typeof _!="boolean")throw new r("The hook returned an invalid MEV guard state.");_&&c.push(u(d,D({abi:T,functionName:"mevModuleOperational",args:[p]}),"Update the Clanker pool MEV guard before collection.")),c.push(u(k,D({abi:T,functionName:"collectRewards",args:[o]}),"Collect pending LP fees into the fee locker."))}a.push(await v(o))}let b;if(c.length){if(await t().getChainId()!==h)throw new r("Fee simulation endpoint is on the wrong chain.");let o=[...c.map(d=>({from:i,gas:z(E),to:d.to,data:d.data,value:z(BigInt(d.value))})),...a.map(d=>({from:i,gas:z(E),to:x.fee_locker.address,data:D({abi:T,functionName:"availableFees",args:[i,d.address]}),value:"0x0"}))],m=await t().request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:o}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(m)||m.length!==1||!A(m[0])||!Array.isArray(m[0].calls)||m[0].calls.length!==o.length)throw new r("The endpoint returned an unexpected fee simulation response.");let p=m[0].calls;if(!p.every(d=>A(d)&&d.status==="0x1"&&!d.error))throw new r("Clanker fee collection simulation failed.");b=p.slice(c.length).map(d=>{if(!A(d)||typeof d.returnData!="string"||!/^0x[0-9a-fA-F]{64}$/.test(d.returnData))throw new r("The endpoint returned an invalid fee balance.");return K(Ce({abi:T,functionName:"availableFees",data:d.returnData}))})}else b=await Promise.all(a.map(o=>g(i,o.address)));let y=a.flatMap((o,m)=>BigInt(b[m])>0n?[{token:o,amount:b[m]}]:[]);if(!y.length)throw new r("No claimable fees for this wallet; pending LP fees may require the MEV window to end.");for(let{token:o}of y)c.push(u(x.fee_locker.address,D({abi:T,functionName:"claim",args:[i,o.address]}),`Claim ${o.symbol} fees to ${i}.`));let l=await e.preview(c,i);return{txs:c,preview:l,fees:y,summary:`Claim fees to ${i}. WETH fees aggregate across all Clanker launches for this recipient. ${l.summary} ${we(e,l)}`}},R=(n,i,a,c)=>({name:`clanker_${n}`,inputSchema:{type:"object",properties:i,required:a,additionalProperties:!1},execute:(b,y)=>s(async()=>c(b,C(y)))});return{tools:[R("launch",{name:{type:"string",description:"Token name, shown publicly."},symbol:{type:"string",description:"Token ticker symbol, shown publicly."},salt:{...ge,description:"Deployment salt as 0x followed by 64 hex digits; it fixes the predicted token address."},image:{type:"string",description:"Image URL for the token. Public."},metadata:{type:"string",description:"Token metadata as a JSON string (description, social links). Public."},context:{type:"string",description:"Launch context as a JSON string. Defaults to Oak on Robinhood."},vanity:{const:!1,description:"Vanity address mining is not supported; leave false or omit."},initialBuy:{...be,description:"Native ETH base units, 18 decimals."},minAmountOut:{...be,description:"Minimum new token base units, 18 decimals; derived from simulation when omitted."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:q,description:"Slippage in basis points (50 = 0.5%) applied to the initial buy when minAmountOut is omitted."},feeBps:{type:"integer",minimum:0,maximum:1e3,default:100,description:"Static LP fee in basis points (100 = 1%). Not allowed together with pool.dynamicFee."},pool:{...pe,description:"Optional pool setup: paired token, starting tick, tick spacing, liquidity positions and dynamic fee. Defaults to a WETH pool."},rewards:{type:"array",minItems:1,maxItems:7,description:"How LP fees are split, 1 to 7 rows with bps totaling 10000. Default: all to the launching wallet.",items:{type:"object",properties:{admin:{...O,description:"Address that can later change this row."},recipient:{...O,description:"Address that receives this row's share of LP fees."},bps:{type:"integer",minimum:1,maximum:1e4,description:"This row's share of LP fees in basis points (5000 = 50%)."},feePreference:{type:"integer",minimum:0,maximum:2,description:"Which token this row is paid in: 0 = both tokens (default), 1 = paired token, 2 = launched token."}},required:["admin","recipient","bps"],additionalProperties:!1}},vault:{...J.vault,description:"Optional vault extension: lock part of the supply, then vest it to an admin."},airdrop:{...J.airdrop,description:"Optional airdrop extension: reserve part of the supply for a Merkle-tree airdrop."}},["name","symbol","salt"],async(n,i)=>{let a=await Ae(n,i);return{...a,summary:`${a.summary} After the launch is mined, use clanker_status to inspect ${a.predictedToken} and clanker_claim to collect creator fees.`}}),R("claim",{token:{...O,description:"Launched token; derives its onchain pool and collects pending LP fees before claiming."},poolId:{...ge,description:"Optional assertion against the derived pool ID."},collect:{type:"boolean",default:!0,description:"Set false to claim only already-collected fees."}},[],Te),R("browse",{q:{type:"string",description:"Optional search text matched against token name or symbol."},limit:{type:"integer",minimum:1,maximum:20,description:"Maximum tokens to return, 1 to 20 (default 10)."},cursor:{type:"string",description:"Opaque pagination cursor returned by a previous clanker_browse call."},deployer:{...O,description:"Optional address of the deploying wallet to filter tokens by."}},[],X)],positions:n=>s(async()=>{C(n);let i=new Map,a=new Set,c;do{let l=await X({deployer:n,limit:20,...c?{cursor:c}:{}});for(let o of l.tokens)w(o.msg_sender,n)&&i.set(o.contract_address.toLowerCase(),o);if(l.cursor&&a.has(l.cursor))throw new r("The Clanker indexer repeated a pagination cursor.");l.cursor&&a.add(l.cursor),c=l.cursor??void 0}while(c);let b=[],y=[P];for(let[l,o]of i){let m=await v(o.contract_address),p={...m,symbol:N(m.symbol)},d=K(await t().readContract({address:p.address,abi:V,functionName:"balanceOf",args:[n]}));b.push({module:"clanker",id:`launch:${l}`,chainId:h,assets:[{token:p,amount:d}],description:`Indexed launch ${o.name}; wallet token balance, not locked LP principal.`}),y.some(k=>w(k.address,p.address))||y.push(p)}for(let l of y){let o=await g(n,l.address);BigInt(o)>0n&&b.push({module:"clanker",id:`fees:${l.address.toLowerCase()}`,chainId:h,assets:[{token:l,amount:o}],description:"Collected fees across launches for this recipient. Pending LP fees excluded; token-side discovery covers indexed launches by this wallet."})}return b})}},ze=e=>ae("clanker",[Oe(e),le(e),me(e),ye(e)]);export{Ne as a,Oe as b,ze as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as b,h as v,l as I,n as k,r as S}from"./
|
|
1
|
+
import{d as b,h as v,l as I,n as k,r as S}from"./BIFANUTV.js";import{a as T}from"./X5V2Z2NM.js";import{e as c,g as y}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{a as l}from"./JXOEJPJ4.js";import{lookup as C}from"node:dns/promises";import{isIP as p}from"node:net";var N="/.well-known/agent-registration.json",P=262144;function R(n){let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(n);if(r)return R(r[1]);if(p(n)===4){let[e,t]=n.split(".").map(Number);return!(e===0||e===10||e===127||e>=224||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19))}if(p(n)===6){let e=n.toLowerCase();return!(e==="::"||e==="::1"||/^f[cd]/.test(e)||/^fe[89ab]/.test(e)||e.startsWith("ff")||e.startsWith("2001:db8")||e.startsWith("64:ff9b"))}return!1}async function E(n){let r;try{r=new URL(n)}catch{throw new i("Not a valid URL.")}if(r.protocol!=="https:"||r.username||r.password||r.port||p(r.hostname.replace(/^\[|\]$/g,""))!==0||!r.hostname.includes(".")||/\.(?:local|internal|localhost|lan)$/i.test(r.hostname))throw new i("Only public HTTPS hostnames on the default port are checked.");let e=await C(r.hostname,{all:!0});if(!e.length||!e.every(t=>R(t.address)))throw new i("That hostname does not resolve to a public address.");return r.hostname}async function L(n,r){let e=await n.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(8e3)});if(!e.ok)throw new i(`The server answered HTTP ${e.status}.`);if(Number(e.headers.get("content-length")??0)>P)throw new i("The file is larger than 256 KiB.");let a=await e.text();if(a.length>P)throw new i("The file is larger than 256 KiB.");try{return JSON.parse(a)}catch{throw new i("The file is not JSON.")}}function O(n,r,e){return Array.isArray(n)&&n.some(t=>c(t)&&typeof t.agentRegistry=="string"&&y(t.agentRegistry,r)&&(typeof t.agentId=="number"||typeof t.agentId=="string")&&String(t.agentId)===e.toString())}var J=n=>({tools:[{name:"erc8004_verify_domain",inputSchema:{type:"object",additionalProperties:!1,required:["agentId"],description:"Read-only, optional ERC-8004 endpoint-domain verification: for each HTTPS service endpoint in the agent's on-chain profile, fetch https://{domain}/.well-known/agent-registration.json and check it lists this registry and agent ID. Only public HTTPS names are fetched; the profile itself is read only from a data: URI.",properties:{agentId:b,endpoint:{type:"string",description:"Check only this HTTPS endpoint (must be one of the profile's services)."}}},async execute(e){try{k(n,e.chainId);let t=I(e.agentId),{chainId:a,registry:H,registryId:u}=v(n),h=await n.clientFor(a).readContract({address:H,abi:T,functionName:"tokenURI",args:[t]});if(typeof h!="string")throw new i("The registry returned an invalid URI.");let f=S(h);if(!f)return{agentId:t.toString(),verified:null,reason:"The agent profile is not a base64 data: URI, so Oak will not fetch it from an agent-controlled location. Pass the endpoint host check yourself, or update the profile to a data: URI.",uri:l(h)};let g=(Array.isArray(f.services)?f.services.filter(c):[]).map(o=>String(o.endpoint??"")).filter(o=>/^https:\/\//i.test(o)),m=e.endpoint===void 0?g:g.filter(o=>o===e.endpoint);if(e.endpoint!==void 0&&!m.length)throw new i("That endpoint is not an HTTPS service in the agent's profile.");let U=[...new Set(m.map(o=>{try{return new URL(o).hostname}catch{return""}}).filter(Boolean))].slice(0,10),s=[];for(let o of U)try{await E(`https://${o}/`);let d=await L(n,`https://${o}${N}`),A=c(d)?d.registrations:void 0,w=O(A,u,t);s.push({domain:l(o),verified:w,reason:w?"The well-known file lists this registry and agent ID.":"The well-known file does not list this registry and agent ID."})}catch(d){s.push({domain:l(o),verified:!1,reason:n.plainError(d)})}return{agentId:t.toString(),registry:u,domains:s,checked:s.length,note:s.length?"Verified means that domain publishes a file naming this agent; it proves domain control by the agent, not that the endpoint is safe.":"The profile lists no HTTPS service endpoints to verify."}}catch(t){throw new i(n.plainError(t))}}}]});export{R as a,J as b};
|