@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
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as R,c as S,f as d,g as b,h as O,i as $,j as T,k,l as V}from"./TXGZ6NWN.js";import{c as j}from"./SCG5HWMN.js";import{c as h,e as C,g as A}from"./NWNYJ26T.js";import{b as P}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{concat as U,encodeAbiParameters as H,encodeFunctionData as E,keccak256 as M,parseAbi as F,parseAbiParameters as q}from"viem";var _=F(["function allocation(address) view returns (address token,uint256 amountTotal,uint256 amountClaimed,uint256 lockupEndTime,uint256 vestingEndTime,address admin)","function amountAvailableToClaim(address) view returns (uint256)","function claim(address)","function editAllocationAdmin(address,address)"]),D=F(["function airdrops(address) view returns (address admin,bytes32 merkleRoot,uint256 totalSupply,uint256 totalClaimed,uint256 lockupEndTime,uint256 vestingEndTime,uint256 adminClaimTime,bool adminClaimed)","function amountAvailableToClaim(address,address,uint256) view returns (uint256)","function claim(address,address,uint256,bytes32[])","function updateAdmin(address,address)","function updateMerkleRoot(address,bytes32)","function adminClaim(address,address)"]),L={bps:{type:"integer",minimum:1,maximum:9e3,description:"Share of the token supply sent to this extension, in basis points (1000 = 10%). Vault and airdrop together may not exceed 9000."},admin:{...h,description:"Address that administers this allocation. Defaults to the launching wallet."},lockupDuration:{...R,description:"Lockup before anything can be claimed, in seconds, as a decimal string (604800 = 7 days; airdrop minimum 86400 = 1 day)."},vestingDuration:{...R,description:"Linear vesting period after the lockup ends, in seconds, as a decimal string (0 = fully unlocked at lockup end)."}},W={vault:{type:"object",properties:L,required:["bps","lockupDuration","vestingDuration"],additionalProperties:!1},airdrop:{type:"object",properties:{...L,merkleRoot:{...S,description:"Merkle root of the airdrop allocations, as 0x followed by 64 hex digits (from clanker_airdrop_tree)."}},required:["bps","lockupDuration","vestingDuration","merkleRoot"],additionalProperties:!1}};function X(m,f){let g=[];for(let p of["vault","airdrop"]){let l=m[p];if(l===void 0)continue;if(!C(l))throw new r(`Provide ${p} configuration as an object.`);$(l,["bps","admin","lockupDuration","vestingDuration",...p==="airdrop"?["merkleRoot"]:[]]);let w=d(l.admin??f),v=b(l.lockupDuration),e=b(l.vestingDuration);if(v<BigInt(p==="vault"?604800:86400))throw new r(`${p} lockup is below the contract minimum.`);if(v+e+1209600n>=1n<<256n)throw new r("Extension duration exceeds uint256.");g.push({extension:y[p].address,msgValue:0n,extensionBps:O(l.bps,1,9e3),extensionData:p==="vault"?H(q("(address,uint256,uint256)"),[[w,v,e]]):H(q("(address,bytes32,uint256,uint256)"),[[w,T(l.merkleRoot),v,e]])})}if(g.reduce((p,l)=>p+l.extensionBps,0)>9e3)throw new r("Extensions must leave at least 10% of supply for liquidity.");return g}function N(m,f){return M(M(H(q("address,uint256"),[m,f])))}function I(m,f){return M(U(BigInt(m)<BigInt(f)?[m,f]:[f,m]))}var Z=m=>{let f=()=>m.clientFor(P),g=async(e,t)=>{if(!(await V(m,e)).extensions.some(a=>A(a,y[t].address)))throw new r(`This token has no verified Clanker ${t} extension.`)},p=async e=>{await g(e,"vault");let t=await f().readContract({address:y.vault.address,abi:_,functionName:"allocation",args:[e]});if(!Array.isArray(t)||t.length!==6||!A(d(t[0]),e))throw new r("Clanker returned an invalid vault allocation.");return{token:e,amountTotal:k(t[1]),amountClaimed:k(t[2]),lockupEndTime:k(t[3]),vestingEndTime:k(t[4]),admin:d(t[5]),claimable:k(await f().readContract({address:y.vault.address,abi:_,functionName:"amountAvailableToClaim",args:[e]}))}},l=async e=>{await g(e,"airdrop");let t=await f().readContract({address:y.airdrop.address,abi:D,functionName:"airdrops",args:[e]});if(!Array.isArray(t)||t.length!==8||typeof t[7]!="boolean")throw new r("Clanker returned invalid airdrop state.");return{token:e,admin:d(t[0]),merkleRoot:T(t[1]),totalSupply:k(t[2]),totalClaimed:k(t[3]),lockupEndTime:k(t[4]),vestingEndTime:k(t[5]),adminClaimTime:k(t[6]),adminClaimed:t[7]}},w=(e,t,o,a)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(s,n)=>{try{return $(s,Object.keys(t)),await a(s,d(n))}catch(i){throw new r(m.plainError(i))}}}),v=async(e,t,o,a)=>{let s=[m.unsignedTx({to:e,data:t,chainId:P,value:"0",description:o})],n=await m.preview(s,a);return{txs:s,preview:n,summary:`${o} ${n.summary}`}};return{tools:[w("airdrop_proofs",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await l(o),s=new URL("https://www.clanker.world/api/airdrops/claim");s.searchParams.set("tokenAddress",o),s.searchParams.set("claimerAddress",t);let i=(await j(m.http,s.toString(),{method:"GET"},u=>C(u)&&Array.isArray(u.proofs))).proofs;if(i.length>200)throw new r("Clanker returned too many airdrop proofs.");let c=i.map(u=>{if(!C(u)||!C(u.entry)||!Array.isArray(u.proof)||u.proof.length>64||!A(d(u.entry.account),t))throw new r("Clanker returned invalid airdrop proofs.");let x=b(u.entry.amount),B=u.proof.map(T);if(!x||!A(B.reduce(I,N(t,x)),a.merkleRoot))throw new r("The indexed airdrop proof does not match the active onchain root.");return{allocatedAmount:x.toString(),proof:B}});return{token:o,chainId:P,recipient:t,proofs:c,summary:"Verified against the onchain airdrop root. An empty indexer response does not prove ineligibility; use saved allocation proofs if the tree was not published."}}),w("vault_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],e=>p(d(e.token))),w("vault_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await p(o);if(a.claimable==="0")throw new r("No vested Clanker tokens are available to claim.");return v(y.vault.address,E({abi:_,functionName:"claim",args:[o]}),`Claim ${a.claimable} base units of ${o} (18 decimals) to vault admin ${a.admin}.`,t)}),w("vault_update_admin",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},admin:{...h,description:"Address of the new vault administrator, who then receives all future claims."}},["token","admin"],async(e,t)=>{let o=d(e.token),a=await p(o);if(!A(a.admin,t))throw new r("Only the vault administrator can transfer its allocation.");return v(y.vault.address,E({abi:_,functionName:"editAllocationAdmin",args:[o,d(e.admin)]}),`Transfer all future Clanker vault claims for ${o} to ${d(e.admin)}.`,t)}),w("airdrop_tree",{allocations:{type:"array",minItems:1,maxItems:200,description:"Airdrop recipients and amounts, 1 to 200 rows with unique recipients. Returns the Merkle root and each proof.",items:{type:"object",properties:{recipient:{...h,description:"Address of the wallet eligible to claim this allocation."},amount:{...R,description:'Amount of the launched token allocated to this recipient, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'}},required:["recipient","amount"],additionalProperties:!1}}},["allocations"],async e=>{if(!Array.isArray(e.allocations)||!e.allocations.length||e.allocations.length>200)throw new r("Provide 1 to 200 airdrop allocations.");let t=new Set,o=e.allocations.map(n=>{if(!C(n))throw new r("Provide allocation objects.");$(n,["recipient","amount"]);let i=d(n.recipient),c=b(n.amount);if(!c||t.has(i))throw new r("Airdrop allocations require positive amounts and unique recipients.");return t.add(i),{recipient:i,amount:c.toString(),hash:N(i,c)}}).sort((n,i)=>n.hash.localeCompare(i.hash)),a=[o.map(n=>n.hash)];for(;a.at(-1).length>1;){let n=a.at(-1),i=[];for(let c=0;c<n.length;c+=2)i.push(c+1<n.length?I(n[c],n[c+1]):n[c]);a.push(i)}let s=o.reduce((n,i)=>n+BigInt(i.amount),0n);if(s>=1n<<256n)throw new r("Airdrop total exceeds uint256.");return{merkleRoot:a.at(-1)[0],total:s.toString(),allocations:o.map((n,i)=>{let c=[],u=i;for(let x of a.slice(0,-1))x[u^1]&&c.push(x[u^1]),u=Math.floor(u/2);return{recipient:n.recipient,amount:n.amount,proof:c}}),summary:"Double-hashed ABI(address,uint256) leaves; sorted hash pairs. Save these public proofs. Allocations are token base units, 18 decimals; match their total to the launch extension supply."}}),w("airdrop_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Optional: your allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. Adds the claimable amount to the result.'}},["token"],async(e,t)=>{let o=d(e.token);return{...await l(o),...e.allocatedAmount===void 0?{}:{claimable:k(await f().readContract({address:y.airdrop.address,abi:D,functionName:"amountAvailableToClaim",args:[o,t,b(e.allocatedAmount)]}))}}}),w("airdrop_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Your full allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'},proof:{type:"array",maxItems:64,description:"Merkle proof for your wallet and allocation, as 0x-prefixed 32-byte hex strings (from clanker_airdrop_proofs).",items:S}},["token","allocatedAmount","proof"],async(e,t)=>{let o=d(e.token),a=await l(o),s=b(e.allocatedAmount);if(!s||!Array.isArray(e.proof)||e.proof.length>64)throw new r("Provide a positive allocation and Merkle proof.");let n=e.proof.map(T),i=n.reduce(I,N(t,s));if(!A(i,a.merkleRoot))throw new r("The airdrop proof does not match the active root for this wallet and allocation.");return v(y.airdrop.address,E({abi:D,functionName:"claim",args:[o,t,s,n]}),`Claim vested allocation of ${s} base units of ${o} (18 decimals) to ${t}. Preview determines currently unlocked receipts.`,t)}),w("airdrop_manage",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},operation:{enum:["admin","root","reclaim"],description:"admin: hand administration to a new address (give admin); root: replace the Merkle root (give merkleRoot); reclaim: send unclaimed tokens to recipient and close claims."},admin:{...h,description:"New airdrop administrator address, for operation admin."},merkleRoot:{...S,description:"New Merkle root as 0x followed by 64 hex digits, for operation root."},recipient:{...h,description:"Address that receives the reclaimed tokens, for operation reclaim."}},["token","operation"],async(e,t)=>{let o=d(e.token),a=await l(o);if(!A(a.admin,t))throw new r("Only the airdrop administrator may manage it.");let s=e.operation==="admin"?"admin":e.operation==="root"?"merkleRoot":"recipient";for(let i of["admin","merkleRoot","recipient"])if(e[i]!==void 0&&i!==s)throw new r(`Input ${i} does not match this airdrop operation.`);let n;if(e.operation==="admin")n=E({abi:D,functionName:"updateAdmin",args:[o,d(e.admin)]});else if(e.operation==="root")n=E({abi:D,functionName:"updateMerkleRoot",args:[o,T(e.merkleRoot)]});else if(e.operation==="reclaim")n=E({abi:D,functionName:"adminClaim",args:[o,d(e.recipient)]});else throw new r("Choose admin, root or reclaim.");return v(y.airdrop.address,n,`Clanker airdrop ${String(e.operation)} for ${o}; ${String(e.admin??e.merkleRoot??e.recipient)}. Reclaim permanently closes recipient claims; contract timing and zero-claim guards apply.`,t)})]}};export{W as a,X as b,Z as c};
|
|
1
|
+
import{a as y,b as R,c as S,f as d,g as b,h as O,i as $,j as T,k,l as V}from"./PG7HZIZL.js";import{c as j}from"./SCG5HWMN.js";import{c as h,e as C,g as A}from"./NWNYJ26T.js";import{b as P}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{concat as U,encodeAbiParameters as H,encodeFunctionData as E,keccak256 as M,parseAbi as F,parseAbiParameters as q}from"viem";var _=F(["function allocation(address) view returns (address token,uint256 amountTotal,uint256 amountClaimed,uint256 lockupEndTime,uint256 vestingEndTime,address admin)","function amountAvailableToClaim(address) view returns (uint256)","function claim(address)","function editAllocationAdmin(address,address)"]),D=F(["function airdrops(address) view returns (address admin,bytes32 merkleRoot,uint256 totalSupply,uint256 totalClaimed,uint256 lockupEndTime,uint256 vestingEndTime,uint256 adminClaimTime,bool adminClaimed)","function amountAvailableToClaim(address,address,uint256) view returns (uint256)","function claim(address,address,uint256,bytes32[])","function updateAdmin(address,address)","function updateMerkleRoot(address,bytes32)","function adminClaim(address,address)"]),L={bps:{type:"integer",minimum:1,maximum:9e3,description:"Share of the token supply sent to this extension, in basis points (1000 = 10%). Vault and airdrop together may not exceed 9000."},admin:{...h,description:"Address that administers this allocation. Defaults to the launching wallet."},lockupDuration:{...R,description:"Lockup before anything can be claimed, in seconds, as a decimal string (604800 = 7 days; airdrop minimum 86400 = 1 day)."},vestingDuration:{...R,description:"Linear vesting period after the lockup ends, in seconds, as a decimal string (0 = fully unlocked at lockup end)."}},W={vault:{type:"object",properties:L,required:["bps","lockupDuration","vestingDuration"],additionalProperties:!1},airdrop:{type:"object",properties:{...L,merkleRoot:{...S,description:"Merkle root of the airdrop allocations, as 0x followed by 64 hex digits (from clanker_airdrop_tree)."}},required:["bps","lockupDuration","vestingDuration","merkleRoot"],additionalProperties:!1}};function X(m,f){let g=[];for(let p of["vault","airdrop"]){let l=m[p];if(l===void 0)continue;if(!C(l))throw new r(`Provide ${p} configuration as an object.`);$(l,["bps","admin","lockupDuration","vestingDuration",...p==="airdrop"?["merkleRoot"]:[]]);let w=d(l.admin??f),v=b(l.lockupDuration),e=b(l.vestingDuration);if(v<BigInt(p==="vault"?604800:86400))throw new r(`${p} lockup is below the contract minimum.`);if(v+e+1209600n>=1n<<256n)throw new r("Extension duration exceeds uint256.");g.push({extension:y[p].address,msgValue:0n,extensionBps:O(l.bps,1,9e3),extensionData:p==="vault"?H(q("(address,uint256,uint256)"),[[w,v,e]]):H(q("(address,bytes32,uint256,uint256)"),[[w,T(l.merkleRoot),v,e]])})}if(g.reduce((p,l)=>p+l.extensionBps,0)>9e3)throw new r("Extensions must leave at least 10% of supply for liquidity.");return g}function N(m,f){return M(M(H(q("address,uint256"),[m,f])))}function I(m,f){return M(U(BigInt(m)<BigInt(f)?[m,f]:[f,m]))}var Z=m=>{let f=()=>m.clientFor(P),g=async(e,t)=>{if(!(await V(m,e)).extensions.some(a=>A(a,y[t].address)))throw new r(`This token has no verified Clanker ${t} extension.`)},p=async e=>{await g(e,"vault");let t=await f().readContract({address:y.vault.address,abi:_,functionName:"allocation",args:[e]});if(!Array.isArray(t)||t.length!==6||!A(d(t[0]),e))throw new r("Clanker returned an invalid vault allocation.");return{token:e,amountTotal:k(t[1]),amountClaimed:k(t[2]),lockupEndTime:k(t[3]),vestingEndTime:k(t[4]),admin:d(t[5]),claimable:k(await f().readContract({address:y.vault.address,abi:_,functionName:"amountAvailableToClaim",args:[e]}))}},l=async e=>{await g(e,"airdrop");let t=await f().readContract({address:y.airdrop.address,abi:D,functionName:"airdrops",args:[e]});if(!Array.isArray(t)||t.length!==8||typeof t[7]!="boolean")throw new r("Clanker returned invalid airdrop state.");return{token:e,admin:d(t[0]),merkleRoot:T(t[1]),totalSupply:k(t[2]),totalClaimed:k(t[3]),lockupEndTime:k(t[4]),vestingEndTime:k(t[5]),adminClaimTime:k(t[6]),adminClaimed:t[7]}},w=(e,t,o,a)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(s,n)=>{try{return $(s,Object.keys(t)),await a(s,d(n))}catch(i){throw new r(m.plainError(i))}}}),v=async(e,t,o,a)=>{let s=[m.unsignedTx({to:e,data:t,chainId:P,value:"0",description:o})],n=await m.preview(s,a);return{txs:s,preview:n,summary:`${o} ${n.summary}`}};return{tools:[w("airdrop_proofs",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await l(o),s=new URL("https://www.clanker.world/api/airdrops/claim");s.searchParams.set("tokenAddress",o),s.searchParams.set("claimerAddress",t);let i=(await j(m.http,s.toString(),{method:"GET"},u=>C(u)&&Array.isArray(u.proofs))).proofs;if(i.length>200)throw new r("Clanker returned too many airdrop proofs.");let c=i.map(u=>{if(!C(u)||!C(u.entry)||!Array.isArray(u.proof)||u.proof.length>64||!A(d(u.entry.account),t))throw new r("Clanker returned invalid airdrop proofs.");let x=b(u.entry.amount),B=u.proof.map(T);if(!x||!A(B.reduce(I,N(t,x)),a.merkleRoot))throw new r("The indexed airdrop proof does not match the active onchain root.");return{allocatedAmount:x.toString(),proof:B}});return{token:o,chainId:P,recipient:t,proofs:c,summary:"Verified against the onchain airdrop root. An empty indexer response does not prove ineligibility; use saved allocation proofs if the tree was not published."}}),w("vault_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],e=>p(d(e.token))),w("vault_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."}},["token"],async(e,t)=>{let o=d(e.token),a=await p(o);if(a.claimable==="0")throw new r("No vested Clanker tokens are available to claim.");return v(y.vault.address,E({abi:_,functionName:"claim",args:[o]}),`Claim ${a.claimable} base units of ${o} (18 decimals) to vault admin ${a.admin}.`,t)}),w("vault_update_admin",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},admin:{...h,description:"Address of the new vault administrator, who then receives all future claims."}},["token","admin"],async(e,t)=>{let o=d(e.token),a=await p(o);if(!A(a.admin,t))throw new r("Only the vault administrator can transfer its allocation.");return v(y.vault.address,E({abi:_,functionName:"editAllocationAdmin",args:[o,d(e.admin)]}),`Transfer all future Clanker vault claims for ${o} to ${d(e.admin)}.`,t)}),w("airdrop_tree",{allocations:{type:"array",minItems:1,maxItems:200,description:"Airdrop recipients and amounts, 1 to 200 rows with unique recipients. Returns the Merkle root and each proof.",items:{type:"object",properties:{recipient:{...h,description:"Address of the wallet eligible to claim this allocation."},amount:{...R,description:'Amount of the launched token allocated to this recipient, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'}},required:["recipient","amount"],additionalProperties:!1}}},["allocations"],async e=>{if(!Array.isArray(e.allocations)||!e.allocations.length||e.allocations.length>200)throw new r("Provide 1 to 200 airdrop allocations.");let t=new Set,o=e.allocations.map(n=>{if(!C(n))throw new r("Provide allocation objects.");$(n,["recipient","amount"]);let i=d(n.recipient),c=b(n.amount);if(!c||t.has(i))throw new r("Airdrop allocations require positive amounts and unique recipients.");return t.add(i),{recipient:i,amount:c.toString(),hash:N(i,c)}}).sort((n,i)=>n.hash.localeCompare(i.hash)),a=[o.map(n=>n.hash)];for(;a.at(-1).length>1;){let n=a.at(-1),i=[];for(let c=0;c<n.length;c+=2)i.push(c+1<n.length?I(n[c],n[c+1]):n[c]);a.push(i)}let s=o.reduce((n,i)=>n+BigInt(i.amount),0n);if(s>=1n<<256n)throw new r("Airdrop total exceeds uint256.");return{merkleRoot:a.at(-1)[0],total:s.toString(),allocations:o.map((n,i)=>{let c=[],u=i;for(let x of a.slice(0,-1))x[u^1]&&c.push(x[u^1]),u=Math.floor(u/2);return{recipient:n.recipient,amount:n.amount,proof:c}}),summary:"Double-hashed ABI(address,uint256) leaves; sorted hash pairs. Save these public proofs. Allocations are token base units, 18 decimals; match their total to the launch extension supply."}}),w("airdrop_status",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Optional: your allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token. Adds the claimable amount to the result.'}},["token"],async(e,t)=>{let o=d(e.token);return{...await l(o),...e.allocatedAmount===void 0?{}:{claimable:k(await f().readContract({address:y.airdrop.address,abi:D,functionName:"amountAvailableToClaim",args:[o,t,b(e.allocatedAmount)]}))}}}),w("airdrop_claim",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},allocatedAmount:{...R,description:'Your full allocation in the airdrop tree, in base units (Clanker tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'},proof:{type:"array",maxItems:64,description:"Merkle proof for your wallet and allocation, as 0x-prefixed 32-byte hex strings (from clanker_airdrop_proofs).",items:S}},["token","allocatedAmount","proof"],async(e,t)=>{let o=d(e.token),a=await l(o),s=b(e.allocatedAmount);if(!s||!Array.isArray(e.proof)||e.proof.length>64)throw new r("Provide a positive allocation and Merkle proof.");let n=e.proof.map(T),i=n.reduce(I,N(t,s));if(!A(i,a.merkleRoot))throw new r("The airdrop proof does not match the active root for this wallet and allocation.");return v(y.airdrop.address,E({abi:D,functionName:"claim",args:[o,t,s,n]}),`Claim vested allocation of ${s} base units of ${o} (18 decimals) to ${t}. Preview determines currently unlocked receipts.`,t)}),w("airdrop_manage",{token:{...h,description:"Address of the launched Clanker token (ERC-20) on chain 4663."},operation:{enum:["admin","root","reclaim"],description:"admin: hand administration to a new address (give admin); root: replace the Merkle root (give merkleRoot); reclaim: send unclaimed tokens to recipient and close claims."},admin:{...h,description:"New airdrop administrator address, for operation admin."},merkleRoot:{...S,description:"New Merkle root as 0x followed by 64 hex digits, for operation root."},recipient:{...h,description:"Address that receives the reclaimed tokens, for operation reclaim."}},["token","operation"],async(e,t)=>{let o=d(e.token),a=await l(o);if(!A(a.admin,t))throw new r("Only the airdrop administrator may manage it.");let s=e.operation==="admin"?"admin":e.operation==="root"?"merkleRoot":"recipient";for(let i of["admin","merkleRoot","recipient"])if(e[i]!==void 0&&i!==s)throw new r(`Input ${i} does not match this airdrop operation.`);let n;if(e.operation==="admin")n=E({abi:D,functionName:"updateAdmin",args:[o,d(e.admin)]});else if(e.operation==="root")n=E({abi:D,functionName:"updateMerkleRoot",args:[o,T(e.merkleRoot)]});else if(e.operation==="reclaim")n=E({abi:D,functionName:"adminClaim",args:[o,d(e.recipient)]});else throw new r("Choose admin, root or reclaim.");return v(y.airdrop.address,n,`Clanker airdrop ${String(e.operation)} for ${o}; ${String(e.admin??e.merkleRoot??e.recipient)}. Reclaim permanently closes recipient claims; contract timing and zero-claim guards apply.`,t)})]}};export{W as a,X as b,Z as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k}from"./G2LAO23N.js";import{g as f,h as v}from"./3RGED2KO.js";import{c as p}from"./NWNYJ26T.js";import{b as u}from"./EWZFZUVF.js";import{a as t}from"./XSD5NL7J.js";import{getAddress as y}from"viem";var g={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},b=[["hookr_release",{},[],"Read verified release contracts, block and recapture lane."],["hookr_blocks",{},[],"Read all Hook Blocks and their current availability."],["hookr_kings",{poolId:g},[],"Read King of the Pool rounds, leaders, pots and endings."],["hookr_claims",{poolId:g},[],"Read the signing wallet's prizes, royalties, recapture and PoolManager claims."],["hookr_revenue_tokens",{limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of revenue tokens to return, 1 to 50."},cursor:{type:"string",pattern:"^(v1|v1:[1-9][0-9]{0,19}|v2:[1-9][0-9]{0,19})$",description:"Paging cursor: the nextCursor string from the previous page (v1, v1:N or v2:N); omit for the first page."}},[],"Read revenue tokens, tokenizer provenance, streams and income, page by page."],["hookr_revenue_token",{token:{...p,description:k.address("revenue token")}},["token"],"Read a revenue token, stream endings, income, drops and the signing wallet's claims."],["hookr_hook",{address:{...p,description:k.address("Hookr hook contract")}},["address"],"Read shared or owned hook provenance, ownership, allowed blocks, opening and pools."]],T=[...b.map(c=>c[0]),"hookr_contracts","hookr_read","hookr_revenue_read","hookr_addon_read","hookr_api_read"];function I(c){return[...b.map(([o,n,i,s])=>({name:o,inputSchema:{type:"object",description:s,properties:n,required:i,additionalProperties:!1},execute:async(l,w)=>{if(Object.keys(l).some(r=>!Object.hasOwn(n,r))||i.some(r=>l[r]===void 0))throw new t(`Provide the documented arguments for ${o}.`);let m={};for(let[r,a]of Object.entries(l)){let d=n[r];if(d.type==="integer"){if(typeof a!="number"||!Number.isInteger(a)||a<Number(d.minimum)||a>Number(d.maximum))throw new t("Hookr revenue page limit must be an integer from 1 to 50.")}else if(typeof a!="string"||!new RegExp(String(d.pattern)).test(a))throw new t(`Provide a valid Hookr ${r}.`);m[r]=r==="token"||r==="address"?y(String(a)):a}return(o==="hookr_claims"||o==="hookr_revenue_token")&&(m.account=w),{...await f(c,o,m),chainId:u,source:"https://hookr.fun/api/mcp"}}})),_(c)]}var h={catalog:"/api/hooks/catalog",stats:"/api/protocol-stats",poolApr:"/api/pool-apr",revenueTokens:"/api/revenue-tokens",revenueIncome:"/api/revenue-tokens/income"};function _(c){return{name:"hookr_api_read",inputSchema:{type:"object",description:"Read Hookr public catalog, protocol stats, pool APR, revenue directory/income, or one token's doors/mark. Marks are project metadata, not investment or security endorsements.",properties:{resource:{type:"string",enum:[...Object.keys(h),"revenueDoors","revenueMark"],description:"Public feed to read: catalog, stats, poolApr, revenueTokens, revenueIncome; revenueDoors and revenueMark also need token (that token's doors, or its mark image URL)."},token:{...p,description:k.address("revenue token, only for revenueDoors and revenueMark")}},required:["resource"],additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(s=>!["resource","token"].includes(s))||typeof e.resource!="string")throw new t("Choose a documented Hookr public resource.");let o=["revenueDoors","revenueMark"].includes(e.resource);if(!o&&e.token!==void 0||o&&typeof e.token!="string")throw new t("Only the revenueDoors and revenueMark resources take a token address.");let n;if(o){let s;try{s=y(String(e.token))}catch{throw new t("Provide a valid revenue token address.")}n=`/api/revenue-tokens/${s}/${e.resource==="revenueDoors"?"doors":"mark"}`}else{if(!Object.hasOwn(h,e.resource))throw new t("Choose a documented Hookr public resource.");n=h[e.resource]}let i=`https://hookr.fun${n}`;try{let s=await v(c,n,e.resource==="revenueMark");return e.resource==="revenueMark"?{chainId:u,source:i,imageUrl:i,pngUrl:`${i}.png`,note:"Official SVG mark URL; SVG code is not executed or returned. The PNG URL has not been fetched."}:{chainId:u,source:i,data:s}}catch{throw new t("Hookr public resource is unavailable. Retry later; no empty or zero result is implied.")}}}}export{T as a,I as b,_ as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as O}from"./
|
|
1
|
+
import{a as C,b as O}from"./CLHA557R.js";import{a as y,c as w}from"./LFSJDFMY.js";import{a as f,b as k}from"./266VIESP.js";import{d as i}from"./XV6F3RET.js";import{b as d}from"./EWZFZUVF.js";import{a}from"./XSD5NL7J.js";var x=r=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(i),description:"Card program to read: turbo (card collection), blackjack or feed."},method:{type:"string",description:"Exact read-only ABI signature from the catalog. Omit to list all available reads."},values:{type:"array",maxItems:16,description:"Ordered inputs for the chosen method: decimal strings for integers, 0x addresses or hex bytes, booleans, or arrays/tuples of them."}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(i,t.program))throw new a("Choose turbo, blackjack or feed.");let o=i[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new a("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let n=u.find(e=>f(e)===t.method),m=t.values??[];if(!n||!Array.isArray(m)||m.length!==n.inputs.length)throw new a("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let l=r.clientFor(d);if(await l.getChainId()!==d)throw new a("NetNet cards require chain 4663.");let p=await l.getBlock(),c=n.inputs.map((e,s)=>k(e,m[s])),E=await l.readContract({address:o.address,abi:[n],functionName:n.name,args:c,blockNumber:p.number}),g=t.program==="turbo"&&n.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(n.name)?[c[0]]:n.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(g.length){let e=await l.readContract({address:i.turbo.address,abi:i.turbo.abi,functionName:"seriesCount",blockNumber:p.number});b=[...new Set(g)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:i.turbo.address,contract:o.address,blockNumber:String(p.number),blockHash:p.hash,method:t.method,outputs:n.outputs,...b?{seriesStatus:b}:{},data:h(E)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new a("Card capabilities takes no arguments.");return{chainId:d,collection:i.turbo.address,blackjack:i.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...y],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(r,t=0){if(t>12)throw new a("Card read result exceeds the supported nesting.");if(typeof r=="bigint")return r.toString();if(typeof r=="string"){if(r.length>8194)throw new a("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(r)?r:`untrusted ${JSON.stringify(r)}`}if(Array.isArray(r)){if(r.length>4096)throw new a("Choose a bounded card read.");return r.map(o=>h(o,t+1))}return r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,u])=>[o,h(u,t+1)])):r}export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as B}from"./
|
|
1
|
+
import{b as B}from"./MSQNOK3I.js";import{a as u,b,c,e as k,f as m,g as l,h as w}from"./5KKAN7XQ.js";import{e as y,m as o}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as x}from"viem";var a="LayerBank returned a malformed reserve read. Please try again.";function N(r){let s=o(r,a);if(s>=1n<<128n)throw new n(a);return s}async function I(r,s){try{let e=s??await r.getBlockNumber({cacheTime:0}),p=await B(r,e),[f,h,R,v]=await Promise.all([r.readContract({address:u,abi:l,functionName:"getConfiguration",args:[c.address],blockNumber:e}),r.readContract({address:c.address,abi:L,functionName:"balanceOf",args:[b],blockNumber:e}),r.readContract({address:b,abi:w,functionName:"scaledTotalSupply",blockNumber:e}),r.readContract({address:u,abi:l,functionName:"getReserveNormalizedIncome",args:[c.address],blockNumber:e})]);if(!y(f))throw new n(a);let t=o(f.data,a);if((t>>48n&255n)!==6n)throw new n(a);let C=N(p.currentLiquidityRate),P=N(p.accruedToTreasury),T=o(R,a),g=o(v,a);if(g===0n)throw new n(a);let d=((T+P)*g+m/2n)/m,i=(t>>116n&(1n<<36n)-1n)*10n**6n;return{blockNumber:e,active:(t&1n<<56n)!==0n,frozen:(t&1n<<57n)!==0n,paused:(t&1n<<60n)!==0n,supplyCapBase:i,suppliedBase:d,capRoomBase:i===0n?k:d>=i?0n:i-d,cashUsdgBase:o(h,a),rateBasePct:Number(x(C,25))}}catch(e){throw e instanceof n?e:new n("LayerBank reserve could not be read. Please try again.")}}export{I as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as u,f as l}from"./UMY6SP7C.js";import{a as s}from"./XSD5NL7J.js";var c={id:"buy-sell-block",fields:["buyPause","sellLock"]};function d(o,e){u(e,["id","buyPause","sellLock"],["id","buyPause","sellLock"]);let n=l(e.buyPause,16),t=l(e.sellLock,8);if(e.id!==c.id||n>300n||t>5n||!(n||t)||!o.guardEndBlock)throw new s("Buy/Sell Block needs a guard and at least one window: buyPause 0\u2013300, sellLock 0\u20135.");let r=511n<<85n|7n<<94n;if(o.potEveryNBuys&1<<23||o.potMinBuyQuote&r)throw new s("Buy/Sell Block windows are already set.");return{...o,potEveryNBuys:o.potEveryNBuys|1<<30|1<<23,potMinBuyQuote:o.potMinBuyQuote|n<<85n|t<<94n}}function a(o){let e=o.potMinBuyQuote>>85n&511n,n=o.potMinBuyQuote>>94n&7n;return`Buy/Sell Block: buys paused for ${e*12n} seconds and sells locked for ${n*12n} seconds from launch, subject to the parent-block guard; the launch's own buy and initial liquidity are exempt. No fee is charged. Same-block round-trip blocking is not included.`}export{c as a,d as b,a as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as w}from"./2GXHYI23.js";import{c as A,d as B}from"./
|
|
1
|
+
import{h as w}from"./2GXHYI23.js";import{c as A,d as B}from"./Z5WRTISY.js";import{a as g,c as v,d}from"./4CEV4FDG.js";import{ia as u}from"./HHYE42JG.js";import{h as y}from"./NWNYJ26T.js";import{a as c}from"./XSD5NL7J.js";import{erc20Abi as C}from"viem";async function I(a,n,o,l){if(!o.length)return[];let t=await a.multicall({allowFailure:!1,contracts:o.map(p=>({address:p,abi:C,functionName:"balanceOf",args:[n]})),blockNumber:l});if(!Array.isArray(t)||t.length!==o.length)throw new c("Borro share balances could not be read completely. Please try again.");return t.map(d)}async function T(a,n,o={}){v(n);let l=()=>{if(o.signal?.aborted)throw new c("Borro read was cancelled.")};l();let t=a.clientFor(4663),s=await(o.discoverVaults??A(a,o).discoverVaults)(t,{wallet:n,heldOnly:!0,...o.signal?{signal:o.signal}:{}});if(s.incomplete)throw new c("Borro discovery is incomplete, so these positions cannot be shown as complete. Please try again.");let h=s.shareBalances?.map(e=>e.vault)??[...new Set([...s.vaults.map(e=>e.vault),...s.refused.flatMap(e=>e.vault?[e.vault]:[])])],b=s.shareBalances?.map(e=>d(BigInt(e.amount)))??await I(t,n,h,BigInt(s.measuredAtBlock));l();let P=h.flatMap((e,i)=>b[i]>0n?[{vault:e,balance:b[i]}]:[]);return Promise.all(P.map(async({vault:e,balance:i})=>{let r=s.vaults.find(O=>y(O.vault,e));if(!r)throw new c("This wallet holds Borro shares whose vault could not be verified. Check the vault address before withdrawing.");let m=d(await t.readContract({address:e,abi:g,functionName:"convertToAssets",args:[i],blockNumber:BigInt(s.measuredAtBlock)}));l();let k={address:e,symbol:r.vaultSymbol,decimals:18,chainId:4663},f={address:r.asset,symbol:r.symbol,decimals:r.assetDecimals,chainId:4663};return{module:"borro",id:`4663:${e}`,chainId:4663,assets:[B(k,i)],oakNotice:u(),economics:{principal:m===0n?[]:[w("redeemable",{token:f,amount:m.toString(),source:"borro.convertToAssets",heldAs:e,measuredAtBlock:s.measuredAtBlock})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`${a.formatAmount(i.toString(),18)} ${r.vaultSymbol} = about ${a.formatAmount(m.toString(),r.assetDecimals)} ${f.symbol} lent through Borro. ${u()}`}}))}export{I as a,T as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as m,f as T,g as d,h as i,i as l}from"./
|
|
1
|
+
import{a as c,b as m,f as T,g as d,h as i,i as l}from"./PG7HZIZL.js";import{c as P,e as p}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{encodeAbiParameters as y,parseAbiParameters as h,zeroAddress as B}from"viem";var A={type:"object",properties:{pairedToken:{...P,description:"Address of the token paired against the launched token in the pool. Defaults to WETH."},startingTick:{type:"integer",minimum:-887272,maximum:887272,description:"Initial pool price as a tick (when the launched token is token0). Default -230400."},tickSpacing:{type:"integer",minimum:1,maximum:32767,description:"Pool tick spacing; position ticks must be multiples of it. Default 200."},positions:{type:"array",minItems:1,maxItems:7,description:"Liquidity positions, 1 to 7, whose bps allocations total 10000. Default: one position from -230400 to -120000.",items:{type:"object",properties:{tickLower:{type:"integer",description:"Lower tick of the position; at or above the starting tick and a multiple of tick spacing."},tickUpper:{type:"integer",description:"Upper tick of the position; above tickLower and a multiple of tick spacing."},bps:{type:"integer",minimum:1,maximum:1e4,description:"Share of the pool liquidity supply in this position, in basis points (5000 = 50%)."}},required:["tickLower","tickUpper","bps"],additionalProperties:!1}},dynamicFee:{type:"object",description:"Optional dynamic LP fee settings; cannot be combined with feeBps.",properties:{baseFeeBps:{type:"integer",minimum:25,maximum:1e3,description:"Minimum LP fee in basis points (100 = 1%)."},maxFeeBps:{type:"integer",minimum:25,maximum:1e3,description:"Maximum LP fee in basis points (100 = 1%); at least baseFeeBps."},referenceTickFilterPeriod:{...m,description:"Seconds during which the reference tick is held before it may update, as a decimal string."},resetPeriod:{...m,description:"Seconds of inactivity after which the dynamic fee resets to base, as a decimal string."},resetTickFilter:{type:"integer",minimum:-887272,maximum:887272,description:"Tick distance from the reference tick that triggers a fee reset."},feeControlNumerator:{...m,description:"Numerator scaling how fast the fee rises with price movement, as a decimal string."},decayFilterBps:{type:"integer",minimum:0,maximum:3e4,description:"Decay rate of the reference-tick filter in basis points (50 = 0.5%)."}},required:["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"],additionalProperties:!1}},additionalProperties:!1};function D(f){let o=f.pool??{};if(!p(o))throw new r("Provide pool configuration as an object.");l(o,["pairedToken","startingTick","tickSpacing","positions","dynamicFee"]);let x=T(o.pairedToken??c.paired_weth.address),g=i(o.startingTick??-230400,-887272,887272),u=i(o.tickSpacing??200,1,32767),n=o.positions??[{tickLower:-230400,tickUpper:-12e4,bps:1e4}];if(!Array.isArray(n)||!n.length||n.length>7)throw new r("Provide one to seven liquidity positions.");let a=n.map(e=>{if(!p(e))throw new r("Provide liquidity position objects.");l(e,["tickLower","tickUpper","bps"]);let t=i(e.tickLower,-887272,887272),s=i(e.tickUpper,-887272,887272);if(t>=s||t<g||t%u||s%u)throw new r("Liquidity ticks must ascend from the starting tick and be multiples of tick spacing.");return{lower:t,upper:s,bps:i(e.bps,1,1e4)}});if(a.reduce((e,t)=>e+t.bps,0)!==1e4)throw new r("Liquidity position allocations must total 10000 bps.");let k=i(f.feeBps??100,0,1e3)*100,b=c.fee_static_hook_v2.address,w=y(h("uint24,uint24"),[k,k]),F=`Static LP fee ${k/100} bps`;if(o.dynamicFee!==void 0){let e=o.dynamicFee;if(!p(e)||f.feeBps!==void 0)throw new r("Provide dynamic fee configuration without a static feeBps override.");l(e,["baseFeeBps","maxFeeBps","referenceTickFilterPeriod","resetPeriod","resetTickFilter","feeControlNumerator","decayFilterBps"]);let t=i(e.baseFeeBps,25,1e3),s=i(e.maxFeeBps,t,1e3);b=c.fee_dynamic_hook_v2.address,w=y(h("(uint24,uint24,uint256,uint256,int24,uint256,uint24)"),[[t*100,s*100,d(e.referenceTickFilterPeriod),d(e.resetPeriod),i(e.resetTickFilter,-887272,887272),d(e.feeControlNumerator),i(e.decayFilterBps,0,3e4)]]),F=`Dynamic LP fee ${t} to ${s} bps; parameters ${JSON.stringify(e)}`}return{feeSummary:F,poolConfig:{hook:b,pairedToken:x,tickIfToken0IsClanker:g,tickSpacing:u,poolData:y(h("(address,bytes,bytes)"),[[B,"0x",w]])},tickLower:a.map(e=>e.lower),tickUpper:a.map(e=>e.upper),positionBps:a.map(e=>e.bps)}}export{A as a,D as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,k as m,m as d,o as p,p as u,q as x,r as f}from"./UMY6SP7C.js";import{a as t}from"./XSD5NL7J.js";import{decodeFunctionData as P,keccak256 as T,parseAbi as y}from"viem";async function A(o,s,e,n,a){if(s<0n||!Number.isInteger(n)||!n||(n&~e.phaseMask)!==0)throw new t("Hookr advisory phases are outside the reviewed profile.");let[h,H,b,g]=await Promise.all([o.getCode({address:e.address,blockNumber:s}),u(o,f,p("registry"),"admission",[x,e.address],s),u(o,e.address,y(["function configSchemaHash() view returns (bytes32)"]),"configSchemaHash",[],s),u(o,f,p("registry"),"isRevokedAdmission",[x,e.address],s)]),i=d(H),k=d(i.caps),l=r(i.gasLimit,32),w=r(i.phaseMask,8),c={maxLpFeePips:r(k.maxLpFeePips,24),maxQuoteTakePips:r(k.maxQuoteTakePips,24),maxSubjectTakeBps:r(k.maxSubjectTakeBps,16)};if(!h||h==="0x"||T(h)!==e.codeHash||i.implementation!==e.address||r(i.kind,8)!==1n||i.codeHash!==e.codeHash||i.schemaHash!==e.schemaHash||b!==e.schemaHash||m(g)||m(i.feeOnly)!==e.feeOnly||(BigInt(n)&~w)!==0n||l<BigInt(e.gasMin??1)||l>BigInt(e.gasMax??2e6)||c.maxLpFeePips>600000n||c.maxQuoteTakePips>=1000000n||c.maxSubjectTakeBps!==0n||a.maxSubjectTakeBps!==0n||a.maxLpFeePips>c.maxLpFeePips||a.maxQuoteTakePips>c.maxQuoteTakePips)throw new t("Hookr advisory runtime, admission, schema, gas, phases or fee caps differ from the reviewed profile.");return{address:e.address,schemaHash:e.schemaHash,codeHash:e.codeHash,gasLimit:Number(l),phases:n,failOpen:!1,admissionFailOpen:m(i.failOpen),caps:c}}function L(o){let s;try{s=P({abi:p("launcherV1"),data:o})}catch{throw new t("Hookr launch refused: Oak could not decode its own launch transaction, so the advisory fail-open choice is unchecked.")}if(s.functionName!=="launchAdvised")throw new t("Hookr launch refused: the transaction is not a launchAdvised call.");let e=s.args?.[2];if(!Array.isArray(e)||!e.length)throw new t("Hookr launch refused: the launchAdvised call has no pool member to check.");for(let n of e)if(d(d(n).config).advisoryFailOpen!==!1)throw new t("Hookr launch refused: it would bind the advisory fail open, so swaps would keep trading when the advisory fails instead of stopping. Oak only launches fail-closed pools.")}function S(o,s,e,n=0n){let a={maxLpFeePips:o.maxLpFeePips+s.maxLpFeePips,maxQuoteTakePips:o.maxQuoteTakePips+s.maxQuoteTakePips,maxSubjectTakeBps:o.maxSubjectTakeBps};if(s.maxSubjectTakeBps!==0n||a.maxLpFeePips>600000n||a.maxLpFeePips>e.maxLpFeePips||a.maxQuoteTakePips>=1000000n||a.maxQuoteTakePips>e.maxQuoteTakePips||a.maxSubjectTakeBps>1000n||a.maxSubjectTakeBps>e.maxSubjectTakeBps)throw new t("Hookr selected blocks plus the full advisory reservation exceed the live core fee caps. Lower their rates.");if(n>a.maxQuoteTakePips&&(a.maxQuoteTakePips=n),a.maxQuoteTakePips>=1000000n)throw new t("Hookr combined pool quote cap must remain below one million pips.");return a}export{A as a,L as b,S as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as O}from"./35DTANJW.js";import{a as F}from"./S432S6NA.js";import{a as j}from"./JFYC2LVI.js";import{j as E}from"./2GXHYI23.js";import{b as D}from"./SPJCSEKP.js";import{a as R}from"./43LI5NKJ.js";import{c as H}from"./SCG5HWMN.js";import{c as b,e as h,g as v,i as _,l as B}from"./NWNYJ26T.js";import{b as L}from"./IX3GZMTM.js";import{b as u,j as M}from"./EWZFZUVF.js";import{a as p}from"./XSD5NL7J.js";import{a as z}from"./JXOEJPJ4.js";import{encodeFunctionData as S,parseAbi as oe,zeroAddress as P}from"viem";import{encodeAbiParameters as U,encodeFunctionData as Y,keccak256 as W,parseAbi as ee}from"viem";var I=M[u].merkl.distributor.address,A="Claim rewards on Merkl (Powered by Merkl \u2014 https://app.merkl.xyz)",Z=`${A}. No claimable rewards on Robinhood Chain. Pending rewards must settle into a Merkle root before they can be claimed.`,C=ee(["function claimed(address user,address token) view returns (uint208 amount,uint48 timestamp,bytes32 merkleRoot)","function getMerkleRoot() view returns (bytes32)","function claim(address[] users,address[] tokens,uint256[] amounts,bytes32[][] proofs)"]);function K(a){return typeof a=="string"&&/^0x[0-9a-fA-F]{64}$/.test(a)}function k(){throw new p("Merkl returned an unexpected response. Please refetch rewards.")}function T(a){typeof a!="string"&&k();let d=L(a);if(d>=1n<<256n)throw new p("The Merkl reward amount exceeds the uint256 range.");return d.toString()}function re(a){let d=[],m=new Set;for(let c of a)if((!h(c)||!h(c.chain)||!Number.isSafeInteger(c.chain.id))&&k(),c.chain.id===u){Array.isArray(c.rewards)||k();for(let r of c.rewards){if((!h(r)||typeof r.distributionLayer!="string"||!h(r.token))&&k(),r.distributionLayer!=="TREE"||(Number.isSafeInteger(r.token.chainId)||k(),r.token.chainId!==u)||(Array.isArray(r.proofs)||k(),!r.proofs.length))continue;(!r.proofs.every(K)||typeof r.token.address!="string"||typeof r.token.symbol!="string"||!r.token.symbol.trim()||typeof r.token.decimals!="number"||!Number.isInteger(r.token.decimals)||r.token.decimals<0||r.token.decimals>255)&&k(),R(r.token.address);let t=T(r.amount),n=T(r.pending);if(BigInt(t)===0n)continue;let e=r.token.address.toLowerCase();if(m.has(e))throw new p("Merkl returned duplicate token leaves. Please refetch rewards.");m.add(e),d.push({token:{address:r.token.address,chainId:u,decimals:r.token.decimals,symbol:r.token.symbol},amount:t,pending:n,proofs:r.proofs})}}return d}function te(a,d,m){let c=W(U([{type:"address"},{type:"address"},{type:"uint256"}],[a,d.token.address,BigInt(d.amount)]));for(let r of d.proofs){let t=BigInt(c)<BigInt(r)?[c,r]:[r,c];c=W(U([{type:"bytes32"},{type:"bytes32"}],t))}if(!v(c,m))throw new p("The Merkl proof does not match the active root. Please refetch rewards.")}function q(a){if(!h(a)||Object.keys(a).length)throw new p("This Merkl tool takes no arguments and uses the connected wallet.")}async function G(a,d){let m=await Q(a,d),c=new Map,r=[],t=new Set;for(let n of m)if((!h(n)||!h(n.chain)||!Number.isSafeInteger(n.chain.id))&&k(),n.chain.id===u){Array.isArray(n.rewards)||k();for(let e of n.rewards){if((!h(e)||typeof e.distributionLayer!="string"||!h(e.token)||!Number.isSafeInteger(e.token.chainId))&&k(),e.token.chainId!==u)continue;(typeof e.token.address!="string"||typeof e.token.symbol!="string"||!e.token.symbol.trim()||typeof e.token.decimals!="number"||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)&&k(),R(e.token.address);let s=T(e.amount),i=T(e.pending),o=`${e.distributionLayer}:${e.token.address.toLowerCase()}`;if(t.has(o))throw new p("Merkl returned duplicate earning rows. Please refetch rewards.");t.add(o);let l={address:e.token.address,symbol:e.token.symbol,decimals:e.token.decimals,chainId:u},f="0";if(e.distributionLayer==="TREE"){let g=await a.clientFor(u).readContract({address:I,abi:C,functionName:"claimed",args:[d,l.address]});(!Array.isArray(g)||typeof g[0]!="bigint"||g[0]<0n||g[0]>=1n<<208n)&&k(),f=g[0].toString(),c.set(l.address.toLowerCase(),f)}r.push({token:l,amount:s,pending:i,claimed:f,claimable:"0",distributionLayer:e.distributionLayer,status:e.distributionLayer!=="TREE"?"unsupported_distribution_layer":BigInt(s)>BigInt(f)?"awaiting_verified_proof":BigInt(i)>0n?"pending_settlement":"settled"})}}return{body:m,earnings:r,claimedSnapshot:c}}async function Q(a,d){return R(d),H(a.http,`https://api.merkl.xyz/v4/users/${d}/rewards/summary?chainId=${u}`,{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},m=>Array.isArray(m))}async function x(a,d,m){return N(a,d,m)}async function N(a,d,m,c){R(d);let r=re(m??await Q(a,d)),t=a.clientFor(u),n=[];for(let s of r){let i=c?.get(s.token.address.toLowerCase());if(i===void 0){let o=await t.readContract({address:I,abi:C,functionName:"claimed",args:[d,s.token.address]});if(!Array.isArray(o)||typeof o[0]!="bigint"||o[0]<0n||o[0]>=1n<<208n)throw new p("The Merkl claimed balance could not be read. Please try again.");i=o[0].toString()}BigInt(s.amount)<=BigInt(i)||n.push({...s,claimed:i,claimable:(BigInt(s.amount)-BigInt(i)).toString()})}if(!n.length)return[];let e=await t.readContract({address:I,abi:C,functionName:"getMerkleRoot"});if(!K(e))throw new p("The active Merkl root could not be read. Please try again.");for(let s of n)te(d,s,e);return n}var ne=a=>{async function d(t){try{return await t()}catch(n){throw new p(a.plainError(n))}}function m(t){let n=t.amount.startsWith("-"),e=n?t.amount.slice(1):t.amount;return`${n?"-":""}${a.formatAmount(e,t.token.decimals)} ${z(t.token.symbol)} (${t.token.address}, chain ${t.token.chainId}, ${t.token.decimals} decimals)`}let c=t=>x(a,t);return{tools:[{name:"merkl_rewards",description:"Read claimable rewards (Powered by Merkl \u2014 https://app.merkl.xyz).",inputSchema:{type:"object",properties:{},additionalProperties:!1,description:"Read rewards (Powered by Merkl \u2014 https://app.merkl.xyz)."},execute:(t,n)=>d(async()=>{q(t);let{body:e,earnings:s,claimedSnapshot:i}=await G(a,n),o=await N(a,n,e,i);for(let l of s){let f=o.find(g=>v(g.token.address,l.token.address)&&l.distributionLayer==="TREE");f&&(l.claimed=f.claimed,l.claimable=f.claimable,l.status="claimable")}return{earnings:s,rewards:o.map(({proofs:l,...f})=>f),summary:o.length?`${A}. Claimable reward leaves: ${o.map(l=>m({token:l.token,amount:l.claimable})).join("; ")}. Wrapped leaves may transfer underlying tokens; claim preview shows the received assets. Pending rewards appear separately in earnings and are excluded from claimable amounts.`:`${Z} Earnings include pending-only and unsupported distribution layers; an unverified amount is never presented as claimable.`}})},{name:"merkl_claim",description:A,inputSchema:{type:"object",properties:{},additionalProperties:!1,description:A},execute:(t,n)=>d(async()=>{q(t);let e=await c(n);if(!e.length)return{txs:[],summary:Z};let s=[a.unsignedTx({to:I,chainId:u,value:"0",description:A,data:Y({abi:C,functionName:"claim",args:[e.map(()=>n),e.map(o=>o.token.address),e.map(o=>BigInt(o.amount)),e.map(o=>o.proofs)]})})],i=await a.preview(s,n);return{txs:s,summary:`${A}. Prepared unsigned claim. Expected wallet changes: ${i.changes.length?i.changes.map(m).join("; "):"no token transfers in simulation"}. ${i.summary}`}})}],positions:t=>d(async()=>{let{body:n,earnings:e,claimedSnapshot:s}=await G(a,t),i=await N(a,t,n,s);return e.flatMap(o=>{let l=o.distributionLayer==="TREE"?i.find(X=>v(X.token.address,o.token.address)):void 0,f=BigInt(o.pending)>0n;if(!l&&!f)return[];let g="Merkl pending rewards are not yet claimable and are excluded from valuation.";return[{module:"merkl",id:`${u}:${o.token.address.toLowerCase()}${o.distributionLayer==="TREE"?"":`:${o.distributionLayer}`}`,chainId:u,assets:l?[{token:l.token,amount:l.claimable}]:[],economics:{principal:[],debt:[],backing:[],coverage:f?{complete:!1,reason:g}:{complete:!0},rewards:[...l?[E("claimable",{token:l.token,amount:l.claimable,source:"merkl.claimable",claim:{tool:"merkl_claim",args:{}}})]:[],...f?[E("unpaid",{token:o.token,amount:null,source:"merkl.pending",unknownReason:g})]:[]]},description:`${A}. Unclaimed reward leaf; wrapped rewards may transfer underlying assets. Pending rewards are excluded from valuation.`}]})})}},he=a=>D("merkl",[ne(a),O(a),j(a),J(a),F(a)]);var $=M[u].merkl.distributor.address,w=oe(["function operators(address,address) view returns (uint256)","function claimRecipient(address,address) view returns (address)","function toggleOperator(address,address)","function setClaimRecipient(address,address)","function claim(address[],address[],uint256[],bytes32[][])","function claimWithRecipient(address[],address[],uint256[],bytes32[][],address[],bytes[])"]),V="Provide a valid address.";function y(a,d=!1){let m=_(a,V);return d?m:B(m,V)}var J=a=>{let d=()=>a.clientFor(u),m=async(r,t,n)=>{let e=[a.unsignedTx({to:$,chainId:u,value:"0",data:r,description:t})],s=await a.preview(e,n);return{txs:e,preview:s,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${t} ${s.summary}`}},c=(r,t,n,e)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:t,required:n,additionalProperties:!1},execute:async(s,i)=>{try{let o=Object.keys(s).find(l=>!Object.hasOwn(t,l));if(o)throw new p(`Unsupported Merkl input: ${o}.`);return await e(s,y(i))}catch(o){throw new p(a.plainError(o))}}});return{tools:[c("claim_config",{token:{...b,description:"Reward token address; zero address selects the global setting where supported."},operator:{...b,description:"Address of the operator whose claim permission is read or changed."}},[],async(r,t)=>{let n=y(r.token??P,!0),e=y(await d().readContract({address:$,abi:w,functionName:"claimRecipient",args:[t,P]}),!0),s=y(await d().readContract({address:$,abi:w,functionName:"claimRecipient",args:[t,n]}),!0),i;if(r.operator!==void 0){let o=await d().readContract({address:$,abi:w,functionName:"operators",args:[t,y(r.operator,!0)]});if(o!==0n&&o!==1n)throw new p("Merkl returned invalid operator authorization.");i=o===1n}return{chainId:u,wallet:t,token:n,defaultRecipient:e,tokenRecipient:s,effectiveRecipient:s!==P?s:e!==P?e:t,...i===void 0?{}:{operatorEnabled:i},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Zero recipient restores self-claims. Token overrides take precedence over the global recipient."}}),c("set_operator",{operator:{...b,description:"Address of the operator whose claim permission is read or changed."},enabled:{type:"boolean",description:"true grants claim permission; false revokes it."}},["operator","enabled"],async(r,t)=>{let n=y(r.operator,!0);if(typeof r.enabled!="boolean")throw new p("Provide enabled as boolean.");let e=await d().readContract({address:$,abi:w,functionName:"operators",args:[t,n]});if(e!==0n&&e!==1n)throw new p("Merkl returned invalid operator authorization.");return e===1n===r.enabled?{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Operator already has the requested state; no transaction needed."}:m(S({abi:w,functionName:"toggleOperator",args:[t,n]}),`${r.enabled?"Authorize":"Revoke"} Merkl claims by ${n} for ${t}. Zero operator grants permissionless claiming; configured recipients still apply. The contract toggles the observed state; preview and confirmation must remain current.`,t)}),c("set_recipient",{recipient:{...b,description:"Address to receive rewards; zero restores the default where supported."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."}},["recipient"],async(r,t)=>{let n=y(r.recipient,!0),e=y(r.token??P,!0);return m(S({abi:w,functionName:"setClaimRecipient",args:[n,e]}),`Set Merkl reward recipient for ${e===P?"all tokens":e} to ${n===P?`self (${t})`:n}. This redirects future claims; token-specific overrides remain authoritative.`,t)}),c("claim_to",{recipient:{...b,description:"Address to receive rewards; zero restores the default where supported."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."},data:{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:16386,description:"Optional recipient callback data as 0x-prefixed hex bytes."}},["recipient"],async(r,t)=>{let n=y(r.recipient),e=r.token===void 0?void 0:y(r.token),s=r.data??"0x";if(typeof s!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(s)||s.length>16386)throw new p("Provide callback data as at most 8192 hexadecimal bytes.");let i=(await x(a,t)).filter(o=>!e||v(o.token.address,e));return i.length?m(S({abi:w,functionName:"claimWithRecipient",args:[i.map(()=>t),i.map(o=>o.token.address),i.map(o=>BigInt(o.amount)),i.map(o=>o.proofs),i.map(()=>n),i.map(()=>s)]}),`Claim ${i.map(o=>`${o.claimable} ${o.token.symbol} base units (token ${o.token.address}, decimals ${o.token.decimals})`).join("; ")} to ${n}, overriding saved claim recipients for this claim only. Callback data for each leaf: ${s}. Inspect all callback effects in preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for the selected token."}}),c("claim_for",{user:{...b,description:"Address of the user whose rewards are claimed."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."}},["user"],async(r,t)=>{let n=y(r.user),e=r.token===void 0?void 0:y(r.token),s=(await x(a,n)).filter(i=>!e||v(i.token.address,e));return s.length?m(S({abi:w,functionName:"claim",args:[s.map(()=>n),s.map(i=>i.token.address),s.map(i=>BigInt(i.amount)),s.map(i=>i.proofs)]}),`Claim Merkl rewards for ${n}; caller ${t} pays gas. The user's saved recipients control payment. Claim authorization and actual receipts must pass preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for this user."}})]}};export{J as a,x as b,ne as c,he as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ie,b as le,c as de,d as Z}from"./VST6LFUB.js";import{a as D,b as Y}from"./3PHJUFU2.js";import{c as ae}from"./SCG5HWMN.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as re,e as h,g,i as oe}from"./NWNYJ26T.js";import{b as v,j as ne,m as F,o as se}from"./TI727O2H.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as E,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,re)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(s=>O(s,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,d])=>[s,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function W(e,t,o){let s=e.clientFor(v),[d,a]=await Promise.all([s.readContract({address:t,abi:E,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:E,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),r=e.clientFor(v),m=await r.getBlockNumber({cacheTime:0}),k=await D(e,o,m),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(se),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([W(e,o,n),r.readContract({address:o,abi:E,functionName:"totalSupply",blockNumber:n})]),J=c=>1+R.filter(b=>BigInt(b.balance)>BigInt(c)).length,B=async(c,b)=>{let M=await r.readContract({address:o,abi:E,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:b,indexedRank:b===null||_.has(c)?null:J(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(M.toString(),q.toString()),balance:{token:G,amount:M.toString()},matchesIndex:b===null?null:M.toString()===b}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=s?i.rows.find(c=>g(c.wallet,s)):void 0,H=s?{...await B(s,V?.balance??null),excluded:_.get(s)??null,rankStatus:_.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(b=>g(b.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>g(b.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await D(e,u,r);let[w,_]=await Promise.all([W(e,u,r),a.readContract({address:u,abi:E,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),d=s.items.filter(r=>g(r.launch.factory,F)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:p(r.volumeUsd),trades:p(r.trades),traders:p(r.traders),change:p(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>g(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(s.generatedAt),latestDay:p(s.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:p(r.block),time:p(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&C.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:p(r.decimals),usd:p(r.usd),counterparty:typeof r.counterparty=="string"&&C.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=r.items.filter(i=>g(i.factory,F)&&g(i.deployer,s)).slice(0,d);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),r=await D(e,s,l),m=ne[v].pons.buybackVault.address,k=[],i=async(y,K)=>{try{return await K()}catch{return k.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),w=y=>i(y,()=>a.readContract({address:m,abi:ue,functionName:y,args:[s],blockNumber:l})),[_,R,G,q,J,B,A,V,H,c,b,M,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),W(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(J),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(b),vestingStart:S(M),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),s=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await D(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?r>=pe?r-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>r||r>a||r-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:be,fromBlock:m,toBlock:r,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await W(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,d){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await d(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{description:'Choose "overview" for totals, "burn" for burns or "buyback" for buybacks; defaults to overview.',type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:{...P,description:"Wallet address to inspect; defaults to the signing wallet."},cursor:{description:"Pagination cursor returned by the previous call to this tool.",type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."}},(o,s)=>_e(e,o,s)),t("pons_trades",{token:{...P,description:"Address of the token to inspect or use."},fromBlock:X("First block number of the scan, as a decimal string; inclusive."),toBlock:X("Last block number of the scan, as a decimal string; inclusive."),limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:{...P,description:"Wallet profile address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,xe as b,Le as c};
|
|
1
|
+
import{a as ie,b as le,c as de,d as Z}from"./VST6LFUB.js";import{a as D,b as Y}from"./QFUSCK5C.js";import{c as ae}from"./SCG5HWMN.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as re,e as h,g,i as oe}from"./NWNYJ26T.js";import{b as v,j as ne,m as F,o as se}from"./EWZFZUVF.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as E,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,re)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(s=>O(s,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,d])=>[s,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function W(e,t,o){let s=e.clientFor(v),[d,a]=await Promise.all([s.readContract({address:t,abi:E,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:E,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),r=e.clientFor(v),m=await r.getBlockNumber({cacheTime:0}),k=await D(e,o,m),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(se),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([W(e,o,n),r.readContract({address:o,abi:E,functionName:"totalSupply",blockNumber:n})]),J=c=>1+R.filter(b=>BigInt(b.balance)>BigInt(c)).length,B=async(c,b)=>{let M=await r.readContract({address:o,abi:E,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:b,indexedRank:b===null||_.has(c)?null:J(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(M.toString(),q.toString()),balance:{token:G,amount:M.toString()},matchesIndex:b===null?null:M.toString()===b}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=s?i.rows.find(c=>g(c.wallet,s)):void 0,H=s?{...await B(s,V?.balance??null),excluded:_.get(s)??null,rankStatus:_.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(b=>g(b.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>g(b.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await D(e,u,r);let[w,_]=await Promise.all([W(e,u,r),a.readContract({address:u,abi:E,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),d=s.items.filter(r=>g(r.launch.factory,F)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:p(r.volumeUsd),trades:p(r.trades),traders:p(r.traders),change:p(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>g(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(s.generatedAt),latestDay:p(s.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:p(r.block),time:p(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&C.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:p(r.decimals),usd:p(r.usd),counterparty:typeof r.counterparty=="string"&&C.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=r.items.filter(i=>g(i.factory,F)&&g(i.deployer,s)).slice(0,d);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),r=await D(e,s,l),m=ne[v].pons.buybackVault.address,k=[],i=async(y,K)=>{try{return await K()}catch{return k.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),w=y=>i(y,()=>a.readContract({address:m,abi:ue,functionName:y,args:[s],blockNumber:l})),[_,R,G,q,J,B,A,V,H,c,b,M,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),W(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(J),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(b),vestingStart:S(M),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),s=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await D(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?r>=pe?r-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>r||r>a||r-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:be,fromBlock:m,toBlock:r,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await W(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,d){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await d(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{description:'Choose "overview" for totals, "burn" for burns or "buyback" for buybacks; defaults to overview.',type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:{...P,description:"Wallet address to inspect; defaults to the signing wallet."},cursor:{description:"Pagination cursor returned by the previous call to this tool.",type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."}},(o,s)=>_e(e,o,s)),t("pons_trades",{token:{...P,description:"Address of the token to inspect or use."},fromBlock:X("First block number of the scan, as a decimal string; inclusive."),toBlock:X("Last block number of the scan, as a decimal string; inclusive."),limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:{...P,description:"Wallet profile address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,xe as b,Le as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./43LI5NKJ.js";import{b as Q}from"./IX3GZMTM.js";import{b as x,j as J}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as se,encodeAbiParameters as Z,encodeFunctionData as F,erc20Abi as O,getAddress as g,keccak256 as ee,parseAbi as L,parseAbiParameters as oe,zeroAddress as te}from"viem";var I=10n**18n,$=(1n<<256n)-1n,q=g(J[x].morpho.morpho_blue.address),_=oe("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),w=L(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function forceDeallocatePenalty(address) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function owner() view returns (address)","function curator() view returns (address)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function forceDeallocate(address adapter,bytes data,uint256 assets,address onBehalf) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function multicall(bytes[] data)"]),v=L(["function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)"]),ne=L(["function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),M=(e,t)=>e<t?e:t,T=(e,t)=>(e+t-1n)/t;function p(e){if(typeof e!="bigint"||e<0n||e>$)throw new r("Invalid Morpho V2 integer read.");return e}function he(e){if(typeof e!="string")throw new r("Provide maxPenaltyAssets as a USDG base-unit integer string, including 0 for no penalty.");let t=Q(e);if(t>$)throw new r("Penalty limit exceeds uint256.");return t}function h(e){if(typeof e!="string")throw new r("Invalid Morpho V2 address read.");return D(e),g(e)}async function ae(e,t,n){if(await e.getChainId()!==x||n.chainId!==x)throw new r("Vault exit requires chain 4663.");let c=await e.getBlockNumber({cacheTime:0}),a=(m,y,k,S=[])=>e.readContract({address:m,abi:y,functionName:k,args:S,blockNumber:c}),[d,o,i,l,u]=await Promise.all([a(t,w,"adaptersLength"),a(t,w,"liquidityAdapter"),a(t,w,"liquidityData"),a(g(n.address),O,"balanceOf",[t]),a(g(n.address),O,"balanceOf",[q])]);if(p(d)!==1n)throw new r("Force exit requires exactly one verified MorphoMarketV1AdapterV2. This vault needs a separately qualified adapter plan.");let s=h(await a(t,w,"adapters",[0n])),C=h(o);if(C!==te&&C!==s)throw new r("The liquidity adapter is not the supported market adapter.");let[A,N,P,f,B]=await Promise.all([a(s,v,"parentVault"),a(s,v,"asset"),a(s,v,"morpho"),a(s,v,"marketIdsLength"),a(t,w,"forceDeallocatePenalty",[s])]);if(h(A)!==g(t)||h(N)!==g(n.address)||h(P)!==q)throw new r("The adapter does not match this vault and pinned Morpho Blue deployment.");let b=p(f);if(b>64n)throw new r("The adapter market inventory exceeds this reader\u2019s supported size.");let E=p(B);if(E>I/50n)throw new r("The force-deallocation penalty exceeds the documented 2% maximum.");let H;if(C!==te){if(typeof i!="string")throw new r("Invalid liquidity-market data.");let[m]=se(_,i);H=ee(Z(_,[m])).toLowerCase()}let V=await Promise.all(Array.from({length:Number(b)},(m,y)=>a(s,v,"marketIds",[BigInt(y)])));if(V.some(m=>typeof m!="string"||!/^0x[0-9a-f]{64}$/i.test(m))||new Set(V.map(m=>String(m).toLowerCase())).size!==V.length)throw new r("The adapter returned an invalid or duplicate market ID.");let R=await Promise.all(V.map(async m=>{let y=m,[k,S,ie]=await Promise.all([a(q,ne,"idToMarketParams",[y]),a(q,ne,"market",[y]),a(s,v,"expectedSupplyAssets",[y])]);if(!Array.isArray(k)||k.length!==5||!Array.isArray(S)||S.length!==6)throw new r("Invalid Morpho market state.");let z={loanToken:h(k[0]),collateralToken:h(k[1]),oracle:h(k[2]),irm:h(k[3]),lltv:p(k[4])},j=Z(_,[z]);if(ee(j).toLowerCase()!==y.toLowerCase()||z.loanToken!==g(n.address))throw new r("Morpho market identity or loan asset does not match the vault.");let G=p(S[0]),X=p(S[2]);if(X>G)throw new r("Invalid Morpho market liquidity.");let Y=p(ie),K=G-X;return{id:y,adapter:s,data:j,supplied:Y,liquidity:K,capacity:M(Y,K),penalty:E,normal:y.toLowerCase()===H}})),U=p(l),W=p(u),re=U+M(W,R.filter(m=>m.normal).reduce((m,y)=>m+y.capacity,0n));return{vault:t,blockNumber:c,idle:U,blueCash:W,normalCapacity:re,markets:R}}function de(e,t){if(t<=0n||t>$)throw new r("Force exit needs a positive position value.");let n=t>e.normalCapacity?t-e.normalCapacity:0n,c=[],a=e.blueCash-(e.normalCapacity-e.idle);for(let d of e.markets.filter(o=>!o.normal).sort((o,i)=>o.capacity===i.capacity?o.id.localeCompare(i.id):o.capacity>i.capacity?-1:1)){if(n===0n)break;let o=M(d.capacity,a);if(o===0n)continue;let i=s=>s+T(s*d.penalty,I),l=o;i(o)>=n&&(l=T(n*I,I+d.penalty),l>0n&&i(l-1n)>=n&&(l-=1n),l=M(o,l+(T(t,10000n)||1n)));let u=T(l*d.penalty,I);c.push({...d,amount:l,penaltyAssets:u}),a-=l,n=i(l)>=n?0n:n-i(l)}if(n>0n)throw new r("Underlying market liquidity cannot cover this force exit. Request a partial withdrawal or use a separately supported in-kind exit; force deallocation cannot create liquidity.");return{requestedAssets:t,normalCapacity:e.normalCapacity,legs:c,penaltyAssets:c.reduce((d,o)=>d+o.penaltyAssets,0n)}}async function we(e,t,n,c,a,d,o){let i=await ae(t,n,o),l=p(await t.readContract({address:n,abi:O,functionName:"balanceOf",args:[c],blockNumber:i.blockNumber}));if(a<=0n||a>l)throw new r("The fresh share balance cannot cover this exit.");let u=p(await t.readContract({address:n,abi:w,functionName:"previewRedeem",args:[a],blockNumber:i.blockNumber})),s=de(i,u);if(s.penaltyAssets>d)throw new r("The force-exit penalty exceeds maxPenaltyAssets. Inspect a fresh plan before authorizing a larger penalty.");let A=(await Promise.all(s.legs.map(b=>t.readContract({address:n,abi:w,functionName:"previewWithdraw",args:[b.penaltyAssets],blockNumber:i.blockNumber})))).reduce((b,E)=>b+p(E),0n);if(A>=a)throw new r("The penalty would consume the share balance.");let N=a-A,P=s.legs.map(b=>F({abi:w,functionName:"forceDeallocate",args:[b.adapter,b.data,b.amount,c]})),f=F({abi:w,functionName:"redeem",args:[N,c,c]});return P.push(f),{tx:e.unsignedTx({to:n,chainId:x,value:"0",data:s.legs.length?F({abi:w,functionName:"multicall",args:[P]}):f,description:`Exit this wallet\u2019s Morpho V2 shares; estimated penalty ${s.penaltyAssets} ${o.symbol} base units. No approvals.`}),plan:s,penaltyShares:A,redeemShares:N,blockNumber:i.blockNumber}}var ye="This vault lists no lending markets right now, and Morpho's index shows 0% over this window. On these numbers it earns nothing.";async function be(e,t){try{let n=p(await e.readContract({address:t,abi:w,functionName:"adaptersLength"}));if(n>8n)return;let c=await Promise.all(Array.from({length:Number(n)},(d,o)=>e.readContract({address:t,abi:w,functionName:"adapters",args:[BigInt(o)]})));return(await Promise.all(c.map(d=>e.readContract({address:h(d),abi:v,functionName:"marketIdsLength"})))).every(d=>p(d)===0n)}catch{return}}var ce="In-kind exits transfer supported market positions rather than cash; use the project in_kind_exit tool.";function ge(e,t,n,c,a=ce){return{name:t,inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(d,o)=>{try{if(D(o),Object.keys(d).length)throw new r("Vault details takes no arguments.");let i=e.clientFor(x);if(await i.getChainId()!==x)throw new r("Vault details requires chain 4663.");let l=await i.readContract({address:n,abi:L(["function asset() view returns (address)"]),functionName:"asset"});if(h(l)!==g(c.address))throw new r("The vault does not use the pinned underlying asset.");let u=await ae(i,n,c),[s,C,A,N]=await Promise.all(["performanceFee","managementFee","owner","curator"].map(f=>i.readContract({address:n,abi:w,functionName:f,blockNumber:u.blockNumber}))),P={...c,address:g(c.address)};return{vault:n,chainId:x,blockNumber:u.blockNumber.toString(),asset:P,owner:h(A),curator:h(N),idleAssets:u.idle.toString(),normalCapacityAssets:u.normalCapacity.toString(),markets:u.markets.map(f=>({marketId:f.id,adapter:f.adapter,suppliedAssets:f.supplied.toString(),marketLiquidityAssets:f.liquidity.toString(),capacityAssets:f.capacity.toString(),liquidityMarket:f.normal,penaltyWad:f.penalty.toString()})),fees:{performanceFeeWad:p(s).toString(),managementFeePerSecondWad:p(C).toString(),scale:I.toString()},apy:null,apyStatus:"This onchain snapshot does not include APY. Use the module analytics tool for indexed historical APY; maxRate is an accrual ceiling.",capacityCaveat:`Snapshot estimates; gates, price accrual, liquidity and penalties can change. Preview the exact action. Force exits may leave share rounding dust. ${a}`}}catch(i){throw new r(e.plainError(i))}}}}function ke(e,t){return`Force-exit estimate: position ${e.requestedAssets} ${t} base units; penalty ${e.penaltyAssets}; net estimate ${e.requestedAssets-e.penaltyAssets}; effective penalty ${T(e.penaltyAssets*10000n,e.requestedAssets)} bps (rounded up). Penalty limit is a local preview check, not a calldata bound. Re-preview before signing and recheck positions for rounding dust.`}function xe(e,t,n,c,a){let d=(i,l)=>e.filter(u=>u.token.chainId===x&&u.token.address.toLowerCase()===i.toLowerCase()).reduce((u,s)=>{if(s.token.decimals!==l||!/^-?\d+$/.test(s.amount))throw new r("Invalid force-exit preview metadata.");return u+BigInt(s.amount)},0n),o=-d(t,18);if(o<=0n||o>n||d(g(a.address),a.decimals)<c)throw new r("The force-exit preview exceeds the share balance or returns less than minAmountOut.")}export{w as a,p as b,he as c,ae as d,de as e,we as f,ye as g,be as h,ge as i,ke as j,xe as k};
|
|
1
|
+
import{a as D}from"./43LI5NKJ.js";import{b as Q}from"./IX3GZMTM.js";import{b as x,j as J}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as se,encodeAbiParameters as Z,encodeFunctionData as F,erc20Abi as O,getAddress as g,keccak256 as ee,parseAbi as L,parseAbiParameters as oe,zeroAddress as te}from"viem";var I=10n**18n,$=(1n<<256n)-1n,q=g(J[x].morpho.morpho_blue.address),_=oe("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),w=L(["function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function liquidityAdapter() view returns (address)","function liquidityData() view returns (bytes)","function forceDeallocatePenalty(address) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function owner() view returns (address)","function curator() view returns (address)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function forceDeallocate(address adapter,bytes data,uint256 assets,address onBehalf) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function multicall(bytes[] data)"]),v=L(["function parentVault() view returns (address)","function asset() view returns (address)","function morpho() view returns (address)","function marketIdsLength() view returns (uint256)","function marketIds(uint256) view returns (bytes32)","function expectedSupplyAssets(bytes32) view returns (uint256)"]),ne=L(["function idToMarketParams(bytes32) view returns (address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)","function market(bytes32) view returns (uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee)"]),M=(e,t)=>e<t?e:t,T=(e,t)=>(e+t-1n)/t;function p(e){if(typeof e!="bigint"||e<0n||e>$)throw new r("Invalid Morpho V2 integer read.");return e}function he(e){if(typeof e!="string")throw new r("Provide maxPenaltyAssets as a USDG base-unit integer string, including 0 for no penalty.");let t=Q(e);if(t>$)throw new r("Penalty limit exceeds uint256.");return t}function h(e){if(typeof e!="string")throw new r("Invalid Morpho V2 address read.");return D(e),g(e)}async function ae(e,t,n){if(await e.getChainId()!==x||n.chainId!==x)throw new r("Vault exit requires chain 4663.");let c=await e.getBlockNumber({cacheTime:0}),a=(m,y,k,S=[])=>e.readContract({address:m,abi:y,functionName:k,args:S,blockNumber:c}),[d,o,i,l,u]=await Promise.all([a(t,w,"adaptersLength"),a(t,w,"liquidityAdapter"),a(t,w,"liquidityData"),a(g(n.address),O,"balanceOf",[t]),a(g(n.address),O,"balanceOf",[q])]);if(p(d)!==1n)throw new r("Force exit requires exactly one verified MorphoMarketV1AdapterV2. This vault needs a separately qualified adapter plan.");let s=h(await a(t,w,"adapters",[0n])),C=h(o);if(C!==te&&C!==s)throw new r("The liquidity adapter is not the supported market adapter.");let[A,N,P,f,B]=await Promise.all([a(s,v,"parentVault"),a(s,v,"asset"),a(s,v,"morpho"),a(s,v,"marketIdsLength"),a(t,w,"forceDeallocatePenalty",[s])]);if(h(A)!==g(t)||h(N)!==g(n.address)||h(P)!==q)throw new r("The adapter does not match this vault and pinned Morpho Blue deployment.");let b=p(f);if(b>64n)throw new r("The adapter market inventory exceeds this reader\u2019s supported size.");let E=p(B);if(E>I/50n)throw new r("The force-deallocation penalty exceeds the documented 2% maximum.");let H;if(C!==te){if(typeof i!="string")throw new r("Invalid liquidity-market data.");let[m]=se(_,i);H=ee(Z(_,[m])).toLowerCase()}let V=await Promise.all(Array.from({length:Number(b)},(m,y)=>a(s,v,"marketIds",[BigInt(y)])));if(V.some(m=>typeof m!="string"||!/^0x[0-9a-f]{64}$/i.test(m))||new Set(V.map(m=>String(m).toLowerCase())).size!==V.length)throw new r("The adapter returned an invalid or duplicate market ID.");let R=await Promise.all(V.map(async m=>{let y=m,[k,S,ie]=await Promise.all([a(q,ne,"idToMarketParams",[y]),a(q,ne,"market",[y]),a(s,v,"expectedSupplyAssets",[y])]);if(!Array.isArray(k)||k.length!==5||!Array.isArray(S)||S.length!==6)throw new r("Invalid Morpho market state.");let z={loanToken:h(k[0]),collateralToken:h(k[1]),oracle:h(k[2]),irm:h(k[3]),lltv:p(k[4])},j=Z(_,[z]);if(ee(j).toLowerCase()!==y.toLowerCase()||z.loanToken!==g(n.address))throw new r("Morpho market identity or loan asset does not match the vault.");let G=p(S[0]),X=p(S[2]);if(X>G)throw new r("Invalid Morpho market liquidity.");let Y=p(ie),K=G-X;return{id:y,adapter:s,data:j,supplied:Y,liquidity:K,capacity:M(Y,K),penalty:E,normal:y.toLowerCase()===H}})),U=p(l),W=p(u),re=U+M(W,R.filter(m=>m.normal).reduce((m,y)=>m+y.capacity,0n));return{vault:t,blockNumber:c,idle:U,blueCash:W,normalCapacity:re,markets:R}}function de(e,t){if(t<=0n||t>$)throw new r("Force exit needs a positive position value.");let n=t>e.normalCapacity?t-e.normalCapacity:0n,c=[],a=e.blueCash-(e.normalCapacity-e.idle);for(let d of e.markets.filter(o=>!o.normal).sort((o,i)=>o.capacity===i.capacity?o.id.localeCompare(i.id):o.capacity>i.capacity?-1:1)){if(n===0n)break;let o=M(d.capacity,a);if(o===0n)continue;let i=s=>s+T(s*d.penalty,I),l=o;i(o)>=n&&(l=T(n*I,I+d.penalty),l>0n&&i(l-1n)>=n&&(l-=1n),l=M(o,l+(T(t,10000n)||1n)));let u=T(l*d.penalty,I);c.push({...d,amount:l,penaltyAssets:u}),a-=l,n=i(l)>=n?0n:n-i(l)}if(n>0n)throw new r("Underlying market liquidity cannot cover this force exit. Request a partial withdrawal or use a separately supported in-kind exit; force deallocation cannot create liquidity.");return{requestedAssets:t,normalCapacity:e.normalCapacity,legs:c,penaltyAssets:c.reduce((d,o)=>d+o.penaltyAssets,0n)}}async function we(e,t,n,c,a,d,o){let i=await ae(t,n,o),l=p(await t.readContract({address:n,abi:O,functionName:"balanceOf",args:[c],blockNumber:i.blockNumber}));if(a<=0n||a>l)throw new r("The fresh share balance cannot cover this exit.");let u=p(await t.readContract({address:n,abi:w,functionName:"previewRedeem",args:[a],blockNumber:i.blockNumber})),s=de(i,u);if(s.penaltyAssets>d)throw new r("The force-exit penalty exceeds maxPenaltyAssets. Inspect a fresh plan before authorizing a larger penalty.");let A=(await Promise.all(s.legs.map(b=>t.readContract({address:n,abi:w,functionName:"previewWithdraw",args:[b.penaltyAssets],blockNumber:i.blockNumber})))).reduce((b,E)=>b+p(E),0n);if(A>=a)throw new r("The penalty would consume the share balance.");let N=a-A,P=s.legs.map(b=>F({abi:w,functionName:"forceDeallocate",args:[b.adapter,b.data,b.amount,c]})),f=F({abi:w,functionName:"redeem",args:[N,c,c]});return P.push(f),{tx:e.unsignedTx({to:n,chainId:x,value:"0",data:s.legs.length?F({abi:w,functionName:"multicall",args:[P]}):f,description:`Exit this wallet\u2019s Morpho V2 shares; estimated penalty ${s.penaltyAssets} ${o.symbol} base units. No approvals.`}),plan:s,penaltyShares:A,redeemShares:N,blockNumber:i.blockNumber}}var ye="This vault lists no lending markets right now, and Morpho's index shows 0% over this window. On these numbers it earns nothing.";async function be(e,t){try{let n=p(await e.readContract({address:t,abi:w,functionName:"adaptersLength"}));if(n>8n)return;let c=await Promise.all(Array.from({length:Number(n)},(d,o)=>e.readContract({address:t,abi:w,functionName:"adapters",args:[BigInt(o)]})));return(await Promise.all(c.map(d=>e.readContract({address:h(d),abi:v,functionName:"marketIdsLength"})))).every(d=>p(d)===0n)}catch{return}}var ce="In-kind exits transfer supported market positions rather than cash; use the project in_kind_exit tool.";function ge(e,t,n,c,a=ce){return{name:t,inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(d,o)=>{try{if(D(o),Object.keys(d).length)throw new r("Vault details takes no arguments.");let i=e.clientFor(x);if(await i.getChainId()!==x)throw new r("Vault details requires chain 4663.");let l=await i.readContract({address:n,abi:L(["function asset() view returns (address)"]),functionName:"asset"});if(h(l)!==g(c.address))throw new r("The vault does not use the pinned underlying asset.");let u=await ae(i,n,c),[s,C,A,N]=await Promise.all(["performanceFee","managementFee","owner","curator"].map(f=>i.readContract({address:n,abi:w,functionName:f,blockNumber:u.blockNumber}))),P={...c,address:g(c.address)};return{vault:n,chainId:x,blockNumber:u.blockNumber.toString(),asset:P,owner:h(A),curator:h(N),idleAssets:u.idle.toString(),normalCapacityAssets:u.normalCapacity.toString(),markets:u.markets.map(f=>({marketId:f.id,adapter:f.adapter,suppliedAssets:f.supplied.toString(),marketLiquidityAssets:f.liquidity.toString(),capacityAssets:f.capacity.toString(),liquidityMarket:f.normal,penaltyWad:f.penalty.toString()})),fees:{performanceFeeWad:p(s).toString(),managementFeePerSecondWad:p(C).toString(),scale:I.toString()},apy:null,apyStatus:"This onchain snapshot does not include APY. Use the module analytics tool for indexed historical APY; maxRate is an accrual ceiling.",capacityCaveat:`Snapshot estimates; gates, price accrual, liquidity and penalties can change. Preview the exact action. Force exits may leave share rounding dust. ${a}`}}catch(i){throw new r(e.plainError(i))}}}}function ke(e,t){return`Force-exit estimate: position ${e.requestedAssets} ${t} base units; penalty ${e.penaltyAssets}; net estimate ${e.requestedAssets-e.penaltyAssets}; effective penalty ${T(e.penaltyAssets*10000n,e.requestedAssets)} bps (rounded up). Penalty limit is a local preview check, not a calldata bound. Re-preview before signing and recheck positions for rounding dust.`}function xe(e,t,n,c,a){let d=(i,l)=>e.filter(u=>u.token.chainId===x&&u.token.address.toLowerCase()===i.toLowerCase()).reduce((u,s)=>{if(s.token.decimals!==l||!/^-?\d+$/.test(s.amount))throw new r("Invalid force-exit preview metadata.");return u+BigInt(s.amount)},0n),o=-d(t,18);if(o<=0n||o>n||d(g(a.address),a.decimals)<c)throw new r("The force-exit preview exceeds the share balance or returns less than minAmountOut.")}export{w as a,p as b,he as c,ae as d,de as e,we as f,ye as g,be as h,ge as i,ke as j,xe as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"./
|
|
1
|
+
import{a as B}from"./WG7PMGTJ.js";import{c as P}from"./5O67QQIY.js";import{b as M}from"./QCPJZBEO.js";import{c as V}from"./FYWK3UK6.js";import{c as x}from"./YBLJ2MCR.js";import{k as F}from"./QBHY2QRC.js";import{a as _}from"./A3PN3PK3.js";import{b as O,o as R}from"./TTBB6EFN.js";import{b as I}from"./SPJCSEKP.js";import{a as S}from"./43LI5NKJ.js";import{a as H}from"./66F5ZH34.js";import{g as A,m as N,n as W}from"./NWNYJ26T.js";import{b as m,j as G}from"./EWZFZUVF.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as L,getAddress as b,parseAbi as z}from"viem";var c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)","function balanceOf(address) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),Q=z(["function deposit() payable"]),p=G[m],T=[{key:"core",name:"Longbow Core USDG",vault:p.vaults.longbowCore.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"frontier",name:"Longbow Frontier USDG",vault:p.vaults.longbowFrontier.address,asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"eth",name:"Longbow ETH",vault:p.vaults.longbowEth.address,asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}],D=[{key:"v1-usdg",name:"Longbow USDG Core V1 (legacy)",vault:b("0x8cb8AA35228c96C1C4E956E69AbAEBCc2aA7Dcfe"),asset:p.tokens.USDG.address,symbol:"USDG",decimals:6},{key:"v1-weth",name:"Longbow WETH Core V1 (legacy)",vault:b("0x93777a9b917be3c8259c84456222f43a01dd6492"),asset:p.tokens.WETH.address,symbol:"WETH",decimals:18}];function j(s,i){return W(s,`${i} must be positive and within the uint256 range.`,{notString:`${i} must be a positive integer string in base units.`,positive:!0})}function h(s){return N(s,"Longbow returned an invalid integer response.")}function q(s,i=!1){if(typeof s!="string")throw new u("Provide the address of a current Longbow vault.");let w=D.find(y=>A(y.vault,s));if(w&&!i)throw new u("Longbow V1 vaults are withdraw-only; deposit into a current V2 vault from longbow_list instead.");let g=w??T.find(y=>A(y.vault,s));if(!g)throw new u("Provide the address of a current Longbow vault, or a Longbow V1 vault to withdraw from. Other vaults are not supported.");return g}function C(s,i){if(Object.keys(s).some(w=>!i.includes(w)))throw new u("Unsupported Longbow input. Use the fields in the tool schema.")}var X=s=>{async function i(e){try{return await e()}catch(t){throw new u(s.plainError(t))}}async function w(){let e=s.clientFor(m);if(await e.getChainId()!==m)throw new u("Longbow requires a client on chain 4663.");return e}async function g(e,t){let[o,r,a,n]=await Promise.all([e.readContract({address:t.vault,abi:c,functionName:"asset"}),e.readContract({address:t.vault,abi:c,functionName:"decimals"}),e.readContract({address:t.asset,abi:c,functionName:"decimals"}),_(e,t.vault)]);if(typeof o!="string"||!A(o,t.asset))throw new u("Longbow vault asset does not match the recorded deployment.");if(r!==18||a!==t.decimals)throw new u("Longbow token decimals do not match the recorded deployment.");return{vault:t.vault,key:t.key,name:t.name,asset:{address:b(t.asset),symbol:t.symbol,decimals:a,chainId:m},share:{address:t.vault,symbol:n,decimals:r,chainId:m}}}async function y(e,t,o,r){let a=R(o.amount,O);if(BigInt(a)===0n)throw new u("The expected output is too small for a nonzero simulation minimum.");let n=await s.preview(e,t);if(n.changes.filter(l=>l.token.chainId===o.token.chainId&&A(l.token.address,o.token.address)&&l.token.decimals===o.token.decimals).reduce((l,v)=>l+BigInt(v.amount),0n)<BigInt(a))throw new u("Longbow simulated output is below the expected minimum.");let d=n.changes.map(({token:l,amount:v})=>{let U=v.startsWith("-");return`${U?"-":"+"}${s.formatAmount(U?v.slice(1):v,l.decimals)} ${l.symbol} (${l.address}, chain ${l.chainId})`}).join("; ");return{txs:e,preview:n,expectedOutput:o,minimumOutput:{token:o.token,amount:a},minimumEnforcedOnchain:!1,summary:`${r} ${d}. Simulation only; no on-chain minimum is enforced by these ERC-4626 calls. ${n.summary}`}}async function Y(e){C(e,[]);let t=await w();return Promise.all(T.map(async o=>{let[r,a,n,f]=await Promise.all([g(t,o),t.readContract({address:o.vault,abi:c,functionName:"totalAssets"}),t.readContract({address:o.vault,abi:c,functionName:"performanceFee"}),t.readContract({address:o.vault,abi:c,functionName:"managementFee"})]);return{...r,totalAssets:{token:r.asset,amount:h(a).toString()},fees:{performanceFeeE18:h(n).toString(),managementFeeE18:h(f).toString()},caveat:"Morpho V2 max views can be zero even when writes succeed. Simulate the requested action; listing does not prove availability."}}))}async function K(e,t){C(e,["vault","amount","wrapEth"]),S(t);let o=q(e.vault),r=j(e.amount,"Deposit amount");if(e.wrapEth!==void 0&&typeof e.wrapEth!="boolean")throw new u("wrapEth must be a boolean.");if(e.wrapEth&&!A(o.asset,p.tokens.WETH.address))throw new u("Only a WETH vault accepts explicit ETH wrapping.");let a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"previewDeposit",args:[r]})),d=[];return e.wrapEth&&d.push(s.unsignedTx({to:n.asset.address,data:L({abi:Q,functionName:"deposit"}),value:r.toString(),chainId:m,description:`Wrap ${s.formatAmount(r.toString(),18)} ETH into WETH for ${n.name}.`})),d.push(s.approval(n.asset.address,n.vault,r.toString(),m)),d.push(s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"deposit",args:[r,b(t)]}),value:"0",chainId:m,description:`Deposit ${s.formatAmount(r.toString(),n.asset.decimals)} ${n.asset.symbol} into ${n.name}.`})),y(d,t,{token:n.share,amount:f.toString()},`Deposit into ${n.name}.`)}async function J(e,t){C(e,["vault","shares"]),S(t);let o=q(e.vault,!0),r=e.shares==="all"?void 0:j(e.shares,"Redeem shares"),a=await w(),n=await g(a,o),f=h(await a.readContract({address:n.vault,abi:c,functionName:"balanceOf",args:[t]})),d=r??f;if(d===0n||d>f)throw new u("The wallet has insufficient Longbow shares for this redemption.");let l=h(await a.readContract({address:n.vault,abi:c,functionName:"previewRedeem",args:[d]})),v=[s.unsignedTx({to:n.vault,data:L({abi:c,functionName:"redeem",args:[d,b(t),b(t)]}),value:"0",chainId:m,description:`Redeem ${s.formatAmount(d.toString(),n.share.decimals)} shares from ${n.name} into ${n.asset.symbol}.`})];return y(v,t,{token:n.asset,amount:l.toString()},`Redeem from ${n.name}.`)}let E={type:"string",enum:T.map(e=>e.vault),description:"Current vault address on chain 4663."},$=H('Positive amount of the vault asset in base units, never a human-unit decimal (USDG has 6 decimals, WETH 18). Example: "1000000" = 1 USDG.'),k=(e,t,o,r)=>({name:e,inputSchema:{type:"object",description:e==="longbow_deposit"?"Deposit the selected vault\u2019s USDG (6 decimals) or WETH (18 decimals) in base units for shares. Exit with longbow_withdraw; check positions after confirmation.":e==="longbow_withdraw"?"Redeem shares in 18-decimal base units, or shares all for a full exit. Returns USDG or WETH according to the selected vault.":"List current Longbow vault assets and shares; exit existing shares with longbow_withdraw.",properties:t,required:o,additionalProperties:!1},execute:(a,n)=>i(()=>r(a,n))});return{tools:[k("longbow_list",{},[],Y),k("longbow_deposit",{vault:E,amount:$,wrapEth:{type:"boolean",default:!1,description:"Explicitly wrap this amount of native ETH before depositing into the WETH vault."}},["vault","amount"],K),k("longbow_withdraw",{vault:{...E,enum:[...E.enum,...D.map(e=>e.vault)],description:"Current vault address, or a Longbow V1 vault (withdraw-only) on chain 4663."},shares:{anyOf:[$,{const:"all"}],description:"Share base units (18 decimals), or all for the fresh wallet share balance. Returns the underlying asset, including WETH."}},["vault","shares"],J)],positions:e=>i(async()=>{S(e);let t=await w();return(await Promise.all([...T,...D].map(async r=>{let a=await g(t,r),n=h(await t.readContract({address:a.vault,abi:c,functionName:"balanceOf",args:[e]}));if(n===0n)return[];let f=h(await t.readContract({address:a.vault,abi:c,functionName:"previewRedeem",args:[n]}));return[{module:"longbow",id:`${m}:${a.vault.toLowerCase()}`,chainId:m,assets:[{token:a.asset,amount:f.toString()}],description:`${a.name}: ${s.formatAmount(n.toString(),a.share.decimals)} shares (${a.share.address}, ${a.share.decimals} decimals). Underlying is a preview, not a guaranteed redemption.`}]}))).flat()})}};function he(s){return I("longbow",[X(s),P(s),F(s),x(s),M(s),V(s),{tools:B(s,"longbow",T.map(i=>({vault:i.vault,asset:{address:b(i.asset),symbol:i.symbol,decimals:i.decimals,chainId:m}})))}])}export{D as a,X as b,he as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as m}from"./RKS3M7L5.js";import{e as c,f as u}from"./UMY6SP7C.js";import{a as i}from"./XSD5NL7J.js";import{decodeAbiParameters as f,encodeAbiParameters as g}from"viem";import{formatUnits as H}from"viem";var T={id:"holder-pot",supported:!0,refusal:"Holder Pot requires the reviewed metered new HookrToken and its explicit pot-directed funding profile."},y=[{type:"uint32"},{type:"uint128"}],p=["epoch","ageCap","boost","sellRule","bounty"];function h(e){let o=c(e,p,p),[t,r,n,s,a]=p.map(l=>Number(u(o[l],8)));if(t>1||r<1||r>56||n>20||s>1||a<1||a>20)throw new i("Holder Pot carrier requires epoch and sellRule 0\u20131, ageCap 1\u201356, boost 0\u201320 and bounty 1\u201320.");return{epoch:t,ageCap:r,boost:n,sellRule:s,bounty:a}}function k(e){let o=h(e);return g(y,[1<<30|1<<21,BigInt(o.epoch)<<45n|BigInt(o.ageCap)<<46n|BigInt(o.boost)<<52n|BigInt(o.sellRule)<<57n|BigInt(o.bounty)<<58n])}function w(e){if(e.length!==130)throw new i("Holder Pot needs exactly two ABI words.");let[o,t]=f(y,e),r=h({epoch:String(t>>45n&1n),ageCap:String(t>>46n&63n),boost:String(t>>52n&31n),sellRule:String(t>>57n&1n),bounty:String(t>>58n&31n)});if(o!==(1<<30|1<<21)||k(Object.fromEntries(Object.entries(r).map(([n,s])=>[n,String(s)]))).toLowerCase()!==e.toLowerCase())throw new i("Holder Pot words are not canonical isolated settings.");return r}function R(e){let o=w(e);return`Holder Pot carrier: epoch ${o.epoch}, age cap ${o.ageCap}, boost ${o.boost}, sell rule ${o.sellRule}, bounty ${o.bounty}; current core validates these legacy fields but does not apply them to payouts or pay a bounty. A separately funded pot pays closed UTC days as floor(day pot \xD7 wallet balance-seconds / total eligible-wallet supply balance-seconds) in quote claims; contract balances earn zero. Swaps process up to 2 days and public pokes up to 16 forward and 16 backward. A pinned metered HookrToken and explicit pot funding are required.`}function $(e,o){if(e<0n||!Number.isInteger(o)||o<2e3||o>5e3)throw new i("Holder Pot funding needs a nonnegative carved charge and protocol share 2000\u20135000 bps.");let t=(e*BigInt(o)+9999n)/10000n;return{protocol:t,pot:e-t}}function C(e,o){let t=c(o,["id","buy","sell"],["id","buy","sell"]);if(t.id!=="holder-pot")throw new i("Choose Hook Block holder-pot.");let r=u(t.buy,8),n=u(t.sell,8),s=(1n<<18n)-1n<<45n;if(!r&&!n||r>100n||n>100n||(e.potEveryNBuys&(1<<21|131071|7<<24))!==0||(e.potMinBuyQuote&s)!==0n)throw new i("Holder Pot needs a positive buy or sell rate of at most 100 and an unoccupied funding carrier.");return{...e,potEveryNBuys:e.potEveryNBuys|1<<30|1<<21|Number(r)|Number(n<<7n)|32768,potMinBuyQuote:e.potMinBuyQuote|1n<<46n|1n<<58n}}function E(e,o){let t=e.potEveryNBuys,r=e.potMinBuyQuote;if(!(t&1<<21)||(t>>14&7)!==2||!(t&16383)||(t>>24&7)!==0||(r>>45n&(1n<<18n)-1n)!==(1n<<1n|1n<<13n))throw new i("Holder Pot funding destination or carrier does not match the supported profile.");return`Holder Pot: buy ${(t&127)*1e3} and sell ${(t>>7&127)*1e3} gross quote pips fund the pot. Each carved charge is floor(total Rules quote fee \xD7 charge pips / final quote-take pips); Hookr ${o} receives ceil(carved charge \xD7 ${e.protocolShareBps}/10000), and the remainder funds the pot, subject to uint128 capacity; excess stays with Hookr. Closed UTC days pay floor(day pot \xD7 wallet balance-seconds / total eligible-wallet supply balance-seconds) as quote claims. Contract balances earn zero. Swaps process up to 2 days; public pokes up to 16 forward and 16 backward. Legacy carrier values are inert and no bounty is paid. The subject must be the pinned metered HookrToken.`}function x(e,o,t=3e3){let r=BigInt(e.protocolShareBps),n=BigInt(Math.max(e.maxFeePips-t,0)),s=r!==0n&&(e.lpBps!==0||e.burnBps!==0||n*r>=10000n||BigInt(e.snipeTaxPips)*r>=10000n);if(o<=0n||s||!(e.potEveryNBuys&m))return null;let a=l=>{let d=BigInt(l)*1000n,b=d*r/10000n;return d+(b<o?o-b:0n)};return{minimum:o,buy:a(e.potEveryNBuys&127),sell:a(e.potEveryNBuys>>7&127)}}function S(e,o,t,r=3e3){let n=x(e,o,r);if(!n)return"";let s=l=>`${l} pips (${H(l,4)}%)`,a=(e.potEveryNBuys&(1<<17|1<<20|1<<22))!==0;return n.buy===n.minimum&&n.sell===n.minimum&&!a?`Hookr ${t} takes ${s(n.minimum)} of every buy and sell, in quote, frozen at launch.`:`Hookr ${t} takes at least ${s(n.minimum)} of every buy and sell, in quote, frozen at launch, even where a block below shows a smaller Hookr share. Including this pool's fixed block charge: total buy take = ${s(n.buy)}, total sell take = ${s(n.sell)}.${a?" Storm Fee, Exit Clock and Sandwich Guard charges, when they apply, come on top of these totals; the Hookr share of them counts toward the minimum.":""}`}export{T as a,k as b,w as c,R as d,$ as e,C as f,E as g,x as h,S as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as $}from"./GV6FZ6UG.js";import{c as T}from"./SCG5HWMN.js";import{e as m,h as u}from"./NWNYJ26T.js";import{b as l,k as S}from"./EWZFZUVF.js";import{a as b}from"./XSD5NL7J.js";import{a as v}from"./JXOEJPJ4.js";import{getAddress as F,isAddress as N}from"viem";var R="https://api.merkl.xyz/v4/opportunities",w=100,O=10,y=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0,I=e=>y(e)&&Number.isSafeInteger(e)&&e<=253402300799,x=(e,p)=>typeof e=="string"&&e.trim()?e.slice(0,200):p;function C(e,p){if(!Array.isArray(e)||e.length!==2)return;let o=[];for(let n of e){if(!m(n)||n.chainId!==l||typeof n.address!="string"||!N(n.address,{strict:!1})||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)return;let a=p.find(d=>d.chainId===l&&u(d.address,n.address));o.push({address:F(n.address),chainId:l,decimals:a?.decimals??n.decimals,symbol:a?.symbol??x(n.symbol,n.address),...a?.name?{name:a.name}:{},verified:!!a})}return o.some(n=>n.verified)&&!u(o[0].address,o[1].address)?o:void 0}function L(e,p,o){if(e.chainId!==l||!m(e.protocol)||e.protocol.id!=="uniswap"||e.action!=="POOL"||e.status!=="LIVE"||e.type!=="UNISWAP_V4"&&e.type!=="UNISWAP_V3"||!y(e.tvl)||e.tvl===0||!Array.isArray(e.campaigns))return;let n=e.type==="UNISWAP_V4"?"v4":"v3";if(typeof e.identifier!="string"||!(n==="v4"?/^0x[\da-fA-F]{64}$/.test(e.identifier):N(e.identifier,{strict:!1})))return;let a=C(e.tokens,p);if(!a)return;let d=[],k=new Set,c;for(let t of e.campaigns){if(!m(t)||t.computeChainId!==l||t.distributionChainId!==l||t.type!==e.type||!m(t.rewardToken)||t.rewardToken.chainId!==l||t.rewardToken.decimals!==6||!u(t.rewardToken.address,S)||!I(t.startTimestamp)||!I(t.endTimestamp)||t.startTimestamp>o||t.endTimestamp<=o||!y(t.apr)||typeof t.id!="string"||!m(t.params))continue;let r=t.params;if(n==="v4"&&(!u(r.poolId,e.identifier)||!a.some(s=>u(s.address,r.currency0))||!a.some(s=>u(s.address,r.currency1))||u(r.currency0,r.currency1))||!y(r.lpFee)||!Number.isInteger(r.lpFee)||r.lpFee>8388608||r.lpFee>1e6&&r.lpFee!==8388608||n==="v3"&&r.lpFee>1e6)continue;let i=typeof t.campaignId=="string"?t.campaignId.toLowerCase():t.id;if(!k.has(i)){if(k.add(i),c!==void 0&&c!==r.lpFee)return;c=r.lpFee,d.push({id:t.id,onChainId:typeof t.campaignId=="string"?t.campaignId:null,rewardAprPercent:t.apr,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp,endsAt:new Date(t.endTimestamp*1e3).toISOString(),requiresInRange:typeof r.isOutOfRangeIncentivized=="boolean"?!r.isOutOfRangeIncentivized:null,feeWeightPercent:y(r.weightFees)&&r.weightFees<=1e4?r.weightFees/100:null,hasOverrides:typeof t.hasOverrides=="boolean"?t.hasOverrides:null,eligibility:"Not checked for this wallet. Inspect merkl_campaigns for whitelists, blacklists, hooks, forwarding and overrides before adding liquidity."})}}if(!d.length||c===void 0)return;let g=d.reduce((t,r)=>t+r.rewardAprPercent,0);if(!Number.isFinite(g))return;let f=m(e.aprRecord)?Number(e.aprRecord.timestamp):NaN;return{opportunityId:String(e.id),poolId:e.identifier,version:n,tokens:a,pair:a.map(t=>`${t.symbol}${t.verified?"":" (unverified)"}`).join("/"),feeTier:c===8388608?"dynamic":`${c/1e4}%`,feeTierPercent:c===8388608?null:c/1e4,rewardAprPercent:g,rewardUsdPer1000PerDay:g*(10/365),tvlUsd:e.tvl,endsAt:new Date(Math.min(...d.map(t=>t.endTimestamp))*1e3).toISOString(),campaigns:d,reportedAt:I(f)?new Date(f*1e3).toISOString():null,feeAprPercent:null,feeAprNote:"Separate pool trading-fee APR is unavailable from this source. Fee tier and campaign fee weight are not fee APR."}}var j=e=>({tools:[{name:"merkl_stock_lp_rewards",inputSchema:{type:"object",additionalProperties:!1,properties:{limit:{type:"integer",minimum:1,maximum:20,description:"Maximum ranked stock LP pools to return, 1 to 20; default 4."}}},execute:async p=>{if(Object.keys(p).some(i=>i!=="limit"))throw new b("Only limit is accepted for stock LP rewards.");let o=p.limit??4;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>20)throw new b("Choose limit as an integer from 1 to 20.");let n;try{n=await $({http:e.http,includeNames:!0})}catch{throw new b("Official stock list is unavailable. Retry when the issuer list is available; stock LP ranking was not checked.")}let a=new Map,d=!1;for(let i=0;i<O;i++){let s=new URL(R);s.search=new URLSearchParams({chainId:String(l),campaigns:"true",items:String(w),page:String(i)}).toString();let A=await T(e.http,s.toString(),{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},h=>Array.isArray(h)&&h.every(P=>m(P)&&typeof P.id=="string"&&Number.isSafeInteger(P.chainId)));for(let h of A)a.has(String(h.id))||a.set(String(h.id),h);if(A.length<w){d=!0;break}}let k=Math.floor(Date.now()/1e3),c=new Map;for(let i of a.values()){let s=L(i,n,k);s&&!c.has(`${s.version}:${s.poolId.toLowerCase()}`)&&c.set(`${s.version}:${s.poolId.toLowerCase()}`,s)}let g=[...c.values()].sort((i,s)=>s.rewardAprPercent-i.rewardAprPercent||i.poolId.localeCompare(s.poolId)),f=g.slice(0,o),t=["Pool-wide USDG reward APR is reported by Merkl, not a promise by Oak or an estimate for your chosen range. USD per $1,000 per day is APR / 100 / 365 \xD7 1,000, without compounding.","Merkl data can lag. Campaign eligibility is not checked for this wallet; inspect every campaign before preparing liquidity. Missing range rules mean unknown, not out-of-range eligibility.","Fee-weighted rewards depend on position activity. LP can lose value versus holding (impermanent loss); gas, trading costs and fees can exceed rewards.",...d?[]:[`Partial scan: stopped after ${O} pages of ${w}; these are the highest reported rates among scanned pools only.`]],r=`${d?"":"Partial ranking. "}${f.length?`Top ${f.length} of ${g.length} matched stock LP pools by active USDG reward APR reported by Merkl: ${f.map(i=>`${v(i.pair)} (${i.version}, fee ${i.feeTier}): ${i.rewardAprPercent.toFixed(2)}% APR, $${i.rewardUsdPer1000PerDay.toFixed(2)} per $1,000 per day; next campaign ends ${i.endsAt}; range requirement: ${i.campaigns.every(s=>s.requiresInRange===!0)?"in range":"see individual campaigns"}`).join("; ")}.`:"No matching active stock LP USDG campaigns with readable rates were reported by Merkl in the scanned data."} Not a promise by Oak. Pool fee APR is unavailable. Check campaign eligibility and range rules; LP can lose value versus holding.`;return{source:"reported by Merkl",endpoint:R,chainId:l,fetchedAt:new Date().toISOString(),complete:d,rankedPools:g.length,pools:f,warnings:t,summary:r}}}]});export{j as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as k}from"./RKS3M7L5.js";import{a as s}from"./XSD5NL7J.js";import{zeroAddress as B}from"viem";function q(e){let o=e.potEveryNBuys&~k,n=e.potMinBuyQuote;if(o===0&&n===0n){if(e.royaltyTo!==B)throw new s("Hookr payment terms include an unsupported recipient.");return}let d=o&127,l=o>>7&127,c=d!==0||l!==0,u=!!(o&1<<19),a=!!(o&1<<20),p=!!(o&1<<21),f=!!(o&1<<22),h=!!(o&1<<23),w=!!(o&1<<17),y=1<<30|131071|1<<17|1<<19|1<<20|1<<21|1<<22|1<<23;if(o>>>30!==1||(o&~y)!==0||!(c||u||a||p||f||h||w))throw new s("Unsupported or noncanonical packed Hook Block settings.");let r=0n;if(c?d>100||l>100||(o>>14&7)!==(p?2:4):(o>>14&7)!==0)throw new s("Swap Cut supports rates 0\u2013100 and one explicit named recipient.");if(u){r|=(1n<<19n)-1n;let t=n&16383n,i=n>>14n&31n;if(!e.guardEndBlock||!t||i!==0n&&t*10n<16384n)throw new s("Wallet Cap requires a guard and the exact smallest-exponent cap.")}if(a){r|=(1n<<26n)-1n<<19n;let t=n>>19n&127n,i=n>>26n&127n,m=n>>33n&63n,g=n>>39n&1n,x=n>>40n&3n,H=n>>42n&7n;if(!t||t>100n||i>=t||(g===0n?!m:m<3n||m>30n)||x>2n||H!==0n)throw new s("Exit Clock settings exceed the reviewed LP-fee profile.")}if(p&&(r|=(1n<<18n)-1n<<45n,!c||(n>>45n&(1n<<18n)-1n)!==(1n<<1n|1n<<13n)))throw new s("Holder Pot requires an explicit pot-directed charge and canonical inert carrier fields.");if(f){r|=(1n<<22n)-1n<<63n;let t=n>>63n&255n,i=n>>71n&255n;if(!t||t>200n||i>t||(n>>79n&63n)!==0n||e.dynamicFeeSens!==0||t*500n*BigInt(e.protocolShareBps)<10000n)throw new s("Storm Fee supports only tempo 0, LP fees, and no Dynamic Fees block.")}if(h){r|=4095n<<85n;let t=n>>85n&511n,i=n>>94n&7n;if(!e.guardEndBlock||t>300n||i>5n||!(t||i))throw new s("Buy/Sell Block windows require a guard and a positive bounded window.")}if(w){r|=511n<<114n;let t=n>>116n&15n,i=n>>120n&7n;if(t<5n||t>15n||i!==4n)throw new s("Sandwich Guard supports one explicit named recipient and maximum 5\u201315.")}if((n&~r)!==0n)throw new s("Unsupported or inactive packed Hook Block fields.");if((c&&!p||w)!==(e.royaltyTo!==B))throw new s("Packed Hook Block recipient is missing or unbound.");if(e.protocolShareBps<2e3||e.protocolShareBps>5e3)throw new s("Packed Hook Blocks require protocol share 2000\u20135000 bps.");if(BigInt(l)*1000n+(a?(n>>19n&127n)*1000n:0n)+(f?(n>>63n&255n)*500n:0n)+(w?(n>>116n&15n)*10000n:0n)>200000n)throw new s("Combined Hook Block sell charges exceed the core limit of 200000 pips.")}function C(e){let o=e.potEveryNBuys,n=e.potMinBuyQuote,d=BigInt(e.protocolShareBps),l=o&1<<20?(n>>19n&127n)*1000n:0n,c=o&1<<22?(n>>63n&255n)*500n:0n,u=BigInt(o&127)*1000n,a=BigInt(o>>7&127)*1000n,p=o&1<<17?(n>>116n&15n)*10000n:0n;return{lp:l+c,quote:(u>a?u:a)+p+l*d/10000n+c*d/10000n}}export{q as a,C as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as l,e as N,f as T}from"./
|
|
1
|
+
import{d as l,e as N,f as T}from"./UL4DY6GX.js";import{a as D}from"./HPBTSJW7.js";import{a as w,c as o,d as u,e as y,g as b}from"./5KKAN7XQ.js";import{a as U}from"./43LI5NKJ.js";import{b as A}from"./66F5ZH34.js";import{h as S,n as x}from"./NWNYJ26T.js";import{b as p}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as G}from"viem";function $(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new n("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new n("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=$(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new n("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new n("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new n("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:o,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new n("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new n("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new n("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(o,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new n("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new n("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),L=t?G({abi:b,functionName:"withdraw",args:[o.address,m==="max"?y:a,d]}):G({abi:b,functionName:"supply",args:[o.address,a,d,0]}),B=[...t?[]:[e.approval(o.address,w,a.toString(),p)],e.unsignedTx({to:w,data:L,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,o)<a:k(h,o)!==-a||k(h,u)<a-1n)throw new n("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(o,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new n(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A('Positive USDG amount in base units (6 decimals): "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'USDG amount in base units (6 decimals): "1000000" = 1 USDG; max withdraws the full balance.'}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as te,b as ie,i as ne,j as ae,l as re,m as se,p as ce,q as de}from"./NCCKCGKL.js";import{B as oe}from"./2ZYFBBOE.js";import{a as m,e as C,f as q,h as I,i as E,j as n,k as ee,l as B,m as x,n as F,o as P,p as A,q as O,r as N}from"./UMY6SP7C.js";import{h as Y,k as Z}from"./CJMVRV34.js";import{a as J}from"./7WXAS54T.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as me,zeroAddress as $}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],ye=t=>le.includes(t),U=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=te.oneOf[0],ue={hookr_lp_add:{...U({target:{...U({position:j}),description:"Where to add liquidity: the existing Hookr family position."},liquidity:{...m,description:"Liquidity to add, in v4 liquidity base units (not a token amount); positive, and the position total stays below 2^127."},amount0Max:{...m,description:`Maximum of the pool's currency0 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Max:{...m,description:`Maximum of the pool's currency1 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})},hookr_lp_remove:U({position:j,liquidity:{...m,description:"Liquidity to remove, in v4 liquidity base units (not a token amount); positive and at most the position remaining liquidity."},amount0Min:{...m,description:`Minimum of the pool's currency0 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Min:{...m,description:`Minimum of the pool's currency1 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}}),hookr_lp_collect:U({position:j,deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})};function he(t,a){if(!ye(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=C(a,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=ie(e?C(i.target,["position"],["position"]).position:i.position),r=l?0n:q(i.liquidity,127);if(!l&&!r)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),h=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:r,bound0:v,bound1:h,deadline:q(i.deadline,64)}}async function fe(t,a,d){let{block:i,poolId:e,position:l,pc:o,core:r,role:v}=a,h=(p,L=[])=>A(t,r,P(v),p,L,i.number),[M,S,H,R]=await Promise.all([h("config",[e]),A(t,N,P("registry"),"admission",[O,r],i.number),h("configSchemaHash"),h("recaptureConfig",[e])]),k=x(M),y=x(S),u=x(y.caps),g=x(o.caps);if(y.implementation!==r||y.codeHash!==Y(r).codeHash||y.schemaHash!==I(H)||n(y.kind,8)!==0n||!n(y.gasLimit,32)||n(u.maxLpFeePips,24)>600000n||n(u.maxQuoteTakePips,24)>=1000000n||n(u.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let f=n(g.maxLpFeePips,24),T=n(g.maxQuoteTakePips,24),b=n(g.maxSubjectTakeBps,16),c=n(k.burnBps,16),w=n(k.lpBps,16),D=n(k.protocolShareBps,16);if(f>600000n||f>n(u.maxLpFeePips,24)||n(o.baseLpFeePips,24)>f||n(k.maxFeePips,24)>f||T>n(u.maxQuoteTakePips,24)||b>n(u.maxSubjectTakeBps,16)||c+w>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let _=E(o.advisory),z={gated:!1},G="";if(_!==$){if(o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");let p=await ce(t,i.number,d,e,_,o),L=await de(t,i.number,e,l.launcher,_,o);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let pe=x(L.terms),X=q(pe.tierPips,24);if(X>50000n||n(o.baseLpFeePips,24)+X>f||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L,G=` Gate ${_}; ${p.listed?"listed by Oak":"new gate, Oak has not read its code"}.`}let V=x(B(R,3)[0]);ee(V.on);let K=null,Q=BigInt(I(await t.getStorageAt({address:O,slot:ae(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(Q&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let W=(Q>>200n&255n)!==0n;if(W){let p=B(await A(t,N,P("registry"),"activeLaneOf",[O],i.number),4);if(E(p[0]),I(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");K=F({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return{terms:F({config:k,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:W,lane:K}),summary:G}}async function ke(t,a,d,i){let e=he(t,d);if(a.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=a.clientFor(4663),o=await re(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let r=oe({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!r.amount0&&!r.amount1||r.amount0>=1n<<127n||r.amount1>=1n<<127n||r.amount0>e.bound0||r.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let h=e.adding?await fe(l,o,i):null,M=h?.terms??null,S=null,H=null;try{S=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let R=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",k=`${o.key.currency0} / ${o.key.currency1}`,y=`${R} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${k} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${r.amount0}/${r.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${r.amount0}/${r.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.${h?.summary??""}`,u=[],g=[],f=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(f.push({token:c===$?J:c,amount:w,...c===$?{to:e.position.launcher}:{}}),c!==$&&(u.push(a.approval(c,e.position.launcher,"0",4663),a.approval(c,e.position.launcher,w.toString(),4663)),g.push(a.approval(c,e.position.launcher,"0",4663))))}let T=u.length;return u.push(a.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===$?e.bound0.toString():"0",description:y,data:me({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...g),await Z(l,o.block),{txs:u,inputs:f,summary:y,state:o,request:e,actionIndex:T,terms:F({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:r,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:S,coreCreditsReason:H,locks:v,entry:M,exactApprovals:u.filter((b,c)=>c!==T),refunds:e.adding?[e.bound0-r.amount0,e.bound1-r.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function ge(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let a of t)C(a,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function Ae(t,a){if(ge(t),t.length!==a.length||t.some((d,i)=>d.to!==a[i].to||d.data!==a[i].data||d.value!==a[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function $e(t){return le.map(a=>({name:a,inputSchema:ue[a],execute:async(d,i)=>{let e=await ke(a,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,ye as b,ue as c,he as d,ke as e,ge as f,Ae as g,$e as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Z}from"./
|
|
1
|
+
import{b as Z}from"./4WYTIM4T.js";import{a as I,b as J,d as V}from"./OHZHQSCA.js";import{a as Q}from"./CEQNXF6A.js";import{a as E}from"./QYKXWBZC.js";import{L as y}from"./R5UOFPDO.js";import{c as $}from"./GV6FZ6UG.js";import{a as H}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{d as M,g as O,i as K}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as Y,erc20Abi as X,getAddress as W,parseAbi as ee,zeroAddress as te}from"viem";var v={address:W("0xCeF73866b088766DeD46Ba71d9Bd7591B5e931d2"),symbol:"tNET",decimals:9,chainId:b},_={pair_oracle:["checkpoint"],futures:["open","close","marginCall","accrueCarry","sweepCarrySkim"],underwriting:["subscribe","redeem"],prize:["enter","enterWithNet","exit","exitToUsdg","lockTranche","earlyUnlock","pokeRebase"]},fe=x=>({tools:[{name:"netnet_desk_action",inputSchema:{type:"object",additionalProperties:!1,required:["program","operation"],properties:{program:{type:"string",enum:Object.keys(_),description:"Desk program: pair_oracle (price checkpoint), futures, underwriting or prize (WinNET)."},operation:{type:"string",enum:[...new Set(Object.values(_).flat())],description:"Action to run; it must be one the chosen program supports (see the program list in this tool)."},amount:N('Amount in base units of the token the operation spends or moves: tNET 9 decimals for futures and underwriting, USDG 6 or NET 9 for prize. Example: "1000000000" = 1 NET.'),minAmountOut:N('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9, underwriting shares). Example: "1000000" = 1 USDG.'),maxPayment:N('Most tNET you will pay for futures open (margin plus fee), in tNET base units (9 decimals). Example: "1000000000" = 1 tNET.'),sizeUsdWad:N('Futures position notional in USD as an 18-decimal wad in base units (1e18 = 1 USD). Example: "100000000000000000000" = 100 USD.'),isLong:{type:"boolean",description:"Futures open only: true for a long position, false for a short."},account:{type:"string",description:"Futures marginCall only: address of the trader to margin-call; they must be liquidatable."},referrer:{type:"string",description:"Prize enter only: optional referrer address recorded at the first deposit; cannot be your own wallet."},trancheIndex:N('Zero-based index of your WinNET tranche to lock or unlock early, as a decimal string. Example: "0".'),lockDraws:{enum:["7","30"],description:"Prize lockTranche only: commit the tranche for 7 or 30 draws."},maxPenaltyAssets:N('Prize earlyUnlock only: highest forfeited principal you accept, in NET base units (9 decimals). Example: "1000000000" = 1 NET.')}},execute:async(t,m)=>{try{if(H(m),typeof t.program!="string"||!Object.hasOwn(_,t.program)||typeof t.operation!="string"||!_[t.program].includes(t.operation))throw new e("Choose a supported finite NetNet desk operation.");let p=t.program,r=t.operation,P=E[p],z=Q[p],T=x.clientFor(b);if(await T.getChainId()!==b)throw new e("NetNet desk actions require chain 4663.");let D=await T.getBlock(),q=new Set(["program","operation"]),u=(n,s=[])=>T.readContract({address:P.address,abi:z,functionName:n,args:s,blockNumber:D.number}),h=(...n)=>n.forEach(s=>q.add(s)),A=()=>(h("amount"),y(t.amount)),S=()=>(h("minAmountOut"),y(t.minAmountOut)),d=n=>K(n,"Provide an explicit checksummed account.",M),l=[],a,c=0n,w="",g;if(p==="pair_oracle"){if(d(await u("pairContract"))!==Z)throw new e("The oracle does not use the pinned canonical pair.");w="Permissionless oracle checkpoint; it sends no reward to this wallet and may not yet produce a valid TWAP."}else if(p==="futures"||p==="underwriting"){if(d(await u("token"))!==v.address||await T.readContract({address:v.address,abi:X,functionName:"decimals",blockNumber:D.number})!==9)throw new e("This desk does not use the pinned valueless 9-decimal tNET test collateral.");let n=E.futures.address,s=E.underwriting.address;if(p==="futures"?d(await u("vault"))!==s:d(await u("clearinghouse"))!==n)throw new e("Futures and underwriting counterparties do not match the published pins.");if(w="Experimental tNET test program; tNET has no monetary value. Futures margin and underwriting capital can be lost. Utilization/ADL can prevent redemption. Prices and fees are read from the contract oracle; these calls encode no price floor.",r==="open"){if(h("isLong","sizeUsdWad","maxPayment"),typeof t.isLong!="boolean")throw new e("Provide isLong as a boolean.");let o=A(),f=y(t.sizeUsdWad);if(o>=1n<<128n||f>=1n<<128n)throw new e("Position margin and notional must fit uint128.");let k=d(await u("oracle"));if(k!==W("0xc8a11E8793F8714a159061369173dc86A0A5E23F"))throw new e("The futures oracle is not the published deployment.");let C=await T.readContract({address:k,abi:ee(["function marginPriceWad() view returns (uint256)"]),functionName:"marginPriceWad",blockNumber:D.number});if(C<=0n)throw new e("Futures margin price is unavailable.");let i=f*5n/10000n*1000000000n/C;if(c=o+i,a=v,c>y(t.maxPayment))throw new e("Margin plus taker fee exceeds maxPayment.");l=[t.isLong,f,o],w+=` Entry fee ${i} tNET base units; exact approval caps price drift and may require a fresh preview.`}else if(r==="marginCall"){h("account");let o=d(t.account);if(await u("liquidatable",[o])!==!0)throw new e("The selected futures trader is not liquidatable.");l=[o]}else if(r==="subscribe"){c=A(),a=v,l=[c];let[o,f]=await Promise.all([u("totalShares"),u("equityTokens")]);if(typeof o!="bigint"||typeof f!="bigint"||o>0n&&f===0n)throw new e("Underwriting share price is invalid.");let k=o===0n?c:c*o/f;if(k===0n||k<S())throw new e("Underwriting subscription rounds to zero or misses the local share minimum.");w+=` Current quote ${k} underwriting share units; the share minimum is a local check, not encoded calldata.`}else if(r==="redeem"){let o=A();if(o>await u("sharesOf",[m]))throw new e("The wallet has insufficient underwriting shares.");l=[o],g={token:v,amount:S()}}}else{let[n,s,o,f,k,C]=await Promise.all(["net","usdg","staking","sNet","controller","book"].map(i=>u(i)));if(d(n)!==I.address||d(s)!==$.address||d(o)!==V||d(f)!==J.address||d(k)!==E.draw.address||d(C)!==E.bonus.address)throw new e("WinNET token, staking, book or controller does not match its published pins.");if(w="WinNET principal is a fixed NET claim, exposed to NET price changes. Entry commits through three staking epochs; locks commit for 7 or 30 draws. Early unlock forfeits 1% of principal and cancels streak credits. Pair buys and sells each incur the NET trading tax; no prize or return is guaranteed.",r==="enter"||r==="enterWithNet"){h("referrer");let i=t.referrer===void 0?te:d(t.referrer);if(i===W(m))throw new e("WinNET does not permit self-referral.");c=A(),a=r==="enter"?$:I,l=r==="enter"?[c,S(),i]:[c,i],w+=` Referrer ${i} is recorded at the first deposit and cannot later be changed.`}else if(r==="exit"||r==="exitToUsdg"){let i=A();if(i>await u("principalOf",[m]))throw new e("WinNET exit exceeds this wallet\u2019s fixed principal.");l=r==="exit"?[i,m]:[i,S(),m],g={token:r==="exit"?I:$,amount:r==="exit"?i:y(t.minAmountOut)}}else if(r==="lockTranche"||r==="earlyUnlock"){h("trancheIndex");let i=y(t.trancheIndex,!0),U=await u("trancheAt",[m,i]);if(!Array.isArray(U)||typeof U[0]!="bigint"||U[0]===0n)throw new e("Choose a nonempty WinNET tranche.");if(r==="lockTranche"){if(h("lockDraws"),t.lockDraws!=="7"&&t.lockDraws!=="30")throw new e("Choose a 7- or 30-draw lock.");l=[i,BigInt(t.lockDraws)]}else{h("maxPenaltyAssets");let j=(U[0]+99n)/100n;if(j>y(t.maxPenaltyAssets,!0))throw new e("Early unlock exceeds maxPenaltyAssets in NET base units.");l=[i],w+=` Current irreversible forfeiture ${j} NET base units.`}}}if(Object.keys(t).some(n=>!q.has(n)))throw new e("Unexpected fields for this desk operation.");if(a&&await T.readContract({address:a.address,abi:X,functionName:"balanceOf",args:[m],blockNumber:D.number})<c)throw new e(`Top up ${a.symbol}; this action needs ${c} base units.`);let F=`NetNet ${p}.${r}, contract ${P.address}, chain ${b}, ordered values ${JSON.stringify(l,(n,s)=>typeof s=="bigint"?String(s):s)}. ${a?`Approve exactly ${c} ${a.symbol} base units (token ${a.address}, decimals ${a.decimals}). `:""}${w}`,L=[...a?[x.approval(a.address,P.address,c.toString(),b)]:[],x.unsignedTx({to:P.address,data:Y({abi:z,functionName:r,args:l}),value:"0",chainId:b,description:F})],R=await x.preview(L,m),B=0n,G=0n;for(let n of R.changes){if(n.token.chainId!==b||!/^-?\d+$/.test(n.amount))throw new e("Invalid desk preview metadata.");let s=BigInt(n.amount);if(s<0n){if(!a||!O(n.token.address,a.address)||n.token.decimals!==a.decimals)throw new e("Desk preview spends an unexpected wallet asset.");B-=s}if(g&&O(n.token.address,g.token.address)){if(n.token.decimals!==g.token.decimals)throw new e("Desk receipt decimals mismatch.");G+=s}}if(B>c||g&&G<g.amount)throw new e("Desk preview exceeds its input budget or misses the requested receipt minimum.");return{txs:L,preview:R,summary:F}}catch(p){throw new e(x.plainError(p))}}}]});export{v as a,fe as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"./43LI5NKJ.js";import{m as b}from"./NWNYJ26T.js";import{b as i,j as w,k as l}from"./
|
|
1
|
+
import{a as y}from"./43LI5NKJ.js";import{m as b}from"./NWNYJ26T.js";import{b as i,j as w,k as l}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{erc20Abi as v,getAddress as u,parseAbi as G}from"viem";var d=10n**27n,I=1000000021979553151239153027n,a=u(w[i].vaults.spark.address),U="https://docs.spark.finance/dev/savings/spark-vaults-v2",g=G(["function asset() view returns (address)","function vsr() view returns (uint256)","function totalAssets() view returns (uint256)","function depositCap() view returns (uint256)","function minVsr() view returns (uint256)","function maxVsr() view returns (uint256)","function convertToAssets(uint256) view returns (uint256)"]);function n(e){return b(e,"Spark returned an invalid unsigned integer.")}function q(e){if(e<d||e>I)throw new c("Spark savings rate is outside the documented bounds.");let r=31536000n,s=e,t=d;for(;r>0n;)r%2n&&(t=t*s/d),r/=2n,r>0n&&(s=s*s/d);return t-d}function j(e){return{name:"spark_details",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async(r,s)=>{try{if(y(s),Object.keys(r).length)throw new c("Spark details takes no arguments.");let t=e.clientFor(i);if(await t.getChainId()!==i)throw new c("Spark details requires chain 4663.");let o=await t.getBlockNumber({cacheTime:0}),h=await t.readContract({address:a,abi:g,functionName:"asset",blockNumber:o});if(typeof h!="string"||u(h)!==u(l))throw new c("Spark does not report canonical USDG.");let[k,A,C,D,x,N,R]=await Promise.all([...["vsr","totalAssets","depositCap","minVsr","maxVsr"].map(V=>t.readContract({address:a,abi:g,functionName:V,blockNumber:o})),t.readContract({address:u(l),abi:v,functionName:"balanceOf",args:[a],blockNumber:o}),t.readContract({address:a,abi:v,functionName:"balanceOf",args:[s],blockNumber:o})]),f=n(k),p=n(A),m=n(N),S=n(R),T=n(await t.readContract({address:a,abi:g,functionName:"convertToAssets",args:[S],blockNumber:o}));return{chainId:i,vault:a,blockNumber:o.toString(),asset:{address:u(l),symbol:"USDG",decimals:6,chainId:i},shareToken:{address:a,symbol:"spUSDG",decimals:6,chainId:i},rate:{vsrRay:f.toString(),scale:d.toString(),annualYieldRay:q(f).toString(),secondsPerYear:"31536000",minVsrRay:n(D).toString(),maxVsrRay:n(x).toString(),caveat:"Projection with the current per-second rate held constant; governance can change it. Not a promised return."},totalAssets:p.toString(),idleAssets:m.toString(),depositCapAssets:n(C).toString(),outstandingAssets:(p>m?p-m:0n).toString(),heldShares:S.toString(),positionAssets:T.toString(),backing:{source:U,mechanism:"The permissioned taker deploys liquidity through the Spark Liquidity Layer. totalAssets is share-implied accounting; idle USDG alone funds immediate redemptions.",composition:null,compositionStatus:"Current strategy-by-strategy backing was not measured on this chain; inspect the official Spark app."},risk:["Liquidity deployed by the taker may be unavailable for immediate withdrawal.","Vault upgrades and role-controlled rate/cap changes affect behavior.","Share value and the USDG peg can change; conversion does not prove exit liquidity."]}}catch(t){throw new c(e.plainError(t))}}}}export{q as a,j as b};
|