@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{b as L}from"./
|
|
1
|
+
import{b as L}from"./342OZP53.js";import{h as G,j as x}from"./2GXHYI23.js";import{a as b}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{g as $}from"./NWNYJ26T.js";import{b as P}from"./IX3GZMTM.js";import{b as w,e as R,j as W}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as y,getAddress as E,parseAbi as _}from"viem";var h={address:E("0x451b42a15100c340ca12f7c66de06fac5ea2d751"),symbol:"BOW",decimals:18,chainId:w},c=E("0xeba502e1177f5fad9432c2deb273569d8381e01a"),f={address:W[w].tokens.USDG.address,symbol:"USDG",decimals:R,chainId:w},i=_(["function stakingToken() view returns (address)","function rewardsToken() view returns (address)","function balanceOf(address account) view returns (uint256)","function earned(address account) view returns (uint256)","function stake(uint256 amount)","function withdraw(uint256 amount)","function getReward()","function exit()","function cooldown() view returns (uint256)","function stakedAt(address) view returns (uint256)","function stakePaused() view returns (bool)","function totalSupply() view returns (uint256)","function rewardRate() view returns (uint256)","function rewardsDuration() view returns (uint256)","function periodFinish() view returns (uint256)","function owner() view returns (address)","function rewardsDistribution() view returns (address)","function notifyRewardAmount(uint256 reward)","function setRewardsDistribution(address distribution)","function setRewardsDuration(uint256 duration)","function setCooldown(uint256 cooldown)","function setStakePaused(bool paused)","function recoverERC20(address token,uint256 amount)","function transferOwnership(address newOwner)","function renounceOwnership()"]),tn=l=>{async function U(n){try{return await n()}catch(t){throw new o(l.plainError(t))}}function A(n,t){if(Object.keys(n).some(e=>!t.includes(e)))throw new o("Unsupported Longbow staking input. Use the fields in the tool schema.")}async function T(){let n=l.clientFor(w);if(await n.getChainId()!==w)throw new o("Longbow requires a client on chain 4663.");let[t,e]=await Promise.all([n.readContract({address:c,abi:i,functionName:"stakingToken"}),n.readContract({address:c,abi:i,functionName:"rewardsToken"})]);if(typeof t!="string"||typeof e!="string"||!$(t,h.address)||!$(e,f.address))throw new o("Longbow staking does not report the pinned BOW stake and USDG reward tokens.");return n}async function S(n){let t=await T(),[e,a,s]=await Promise.all([t.readContract({address:c,abi:i,functionName:"balanceOf",args:[n]}),t.readContract({address:c,abi:i,functionName:"earned",args:[n]}),t.readContract({address:h.address,abi:i,functionName:"balanceOf",args:[n]})]);return{staked:e,earned:a,held:s,rpc:t}}async function v(n,t,e){let a=await l.preview(n,t),s=a.changes.map(({token:r,amount:d})=>{let u=d.startsWith("-");return`${u?"-":"+"}${l.formatAmount(u?d.slice(1):d,r.decimals)} ${r.symbol}`}).join(", ");return{txs:n,preview:a,summary:`${e} ${a.summary} ${s?`Estimated changes: ${s}. `:""}No transaction was sent.`}}let O=(n,t)=>l.unsignedTx({to:c,data:n,value:"0",chainId:w,description:t}),g=n=>l.formatAmount(n.toString(),h.decimals);async function I(n,t){if(A(n,["amount"]),b(t),typeof n.amount!="string")throw new o("Provide an integer BOW amount in base units (18 decimals).");let e=P(n.amount),{held:a,rpc:s}=await S(t),[r,d]=await Promise.all([s.readContract({address:c,abi:i,functionName:"cooldown"}),s.readContract({address:c,abi:i,functionName:"stakePaused"})]);if(d)throw new o("Longbow new stakes are paused; withdrawals and claims remain available.");if(e<=0n)throw new o("Stake amount must be positive.");if(e>a)throw new o(`Insufficient BOW: wallet holds ${a.toString()} base units, requested ${e.toString()}.`);return v([l.approval(h.address,c,e.toString(),w),O(y({abi:i,functionName:"stake",args:[e]}),`Stake ${g(e)} BOW in Longbow StakingRewards.`)],t,`Approve exactly ${g(e)} BOW, then stake it for USDG rewards. Current withdrawal cooldown: ${r} seconds; staking restarts that clock.`)}async function F(n,t){A(n,["amount"]),b(t);let{staked:e,earned:a,rpc:s}=await S(t),r=await s.readContract({address:c,abi:i,functionName:"cooldown"});if(r>0n){let[u,p]=await Promise.all([s.readContract({address:c,abi:i,functionName:"stakedAt",args:[t]}),s.getBlock()]);if(p.timestamp<u+r)throw new o(`Longbow unstaking cooldown ends at Unix second ${u+r}. Rewards can still be claimed.`)}if(e===0n)throw new o("This wallet has no BOW staked with Longbow.");if(n.amount==="all")return v([O(y({abi:i,functionName:"exit"}),`Unstake all ${g(e)} BOW and claim USDG rewards.`)],t,`Exit Longbow staking: return all ${g(e)} staked BOW and claim ${l.formatAmount(a.toString(),f.decimals)} USDG of earned rewards in one call.`);if(typeof n.amount!="string")throw new o('Provide an integer BOW amount in base units, or "all".');let d=P(n.amount);if(d<=0n||d>e)throw new o(`Unstake amount must be positive and at most the ${e.toString()} base units staked.`);return v([O(y({abi:i,functionName:"withdraw",args:[d]}),`Unstake ${g(d)} BOW.`)],t,`Unstake ${g(d)} BOW. Earned USDG rewards stay claimable with longbow_claim_rewards.`)}async function j(n,t){A(n,[]),b(t);let{earned:e}=await S(t);if(e===0n)throw new o("No Longbow staking rewards to claim for this wallet.");let a=l.formatAmount(e.toString(),f.decimals);return v([O(y({abi:i,functionName:"getReward"}),`Claim ${a} USDG of Longbow staking rewards.`)],t,`Claim ${a} USDG of earned Longbow staking rewards; staked BOW stays staked.`)}async function q(n){return U(async()=>{b(n);let{staked:t,earned:e}=await S(n);return t===0n&&e===0n?[]:[{module:"longbow",id:`${w}:${c.toLowerCase()}`,chainId:w,assets:[...t>0n?[{token:{...h},amount:t.toString()}]:[],...e>0n?[{token:{...f},amount:e.toString()}]:[]],economics:{principal:t>0n?[G("locked",{token:{...h},amount:t.toString(),source:"longbow.staking.staked"})]:[],debt:[],rewards:e>0n?[x("claimable",{token:{...f},amount:e.toString(),source:"longbow.staking.earned",claim:{tool:"longbow_claim_rewards",args:{}}})]:[],backing:[],coverage:{complete:!0}},description:`Longbow BOW staking: ${g(t)} BOW staked, ${l.formatAmount(e.toString(),f.decimals)} USDG rewards earned and claimable.`}]})}let D=(n,t,e,a)=>({name:n,inputSchema:{type:"object",properties:t,required:e,additionalProperties:!1},execute:(s,r)=>U(()=>a(s,r))});async function M(n,t){A(n,[]),b(t);let{staked:e,earned:a,held:s,rpc:r}=await S(t),d=["cooldown","stakePaused","totalSupply","rewardRate","rewardsDuration","periodFinish","owner","rewardsDistribution"],u=await Promise.all(d.map(m=>r.readContract({address:c,abi:i,functionName:m}))),p=await r.readContract({address:c,abi:i,functionName:"stakedAt",args:[t]});return{chainId:w,staking:c,stakeToken:h,rewardToken:f,staked:e.toString(),earned:a.toString(),walletBalance:s.toString(),stakedAt:p.toString(),...Object.fromEntries(d.map((m,k)=>[m,typeof u[k]=="bigint"?u[k].toString():u[k]])),rewardRateScale:"1000000000000000000",caveat:"rewardRate is USDG base units multiplied by 1e18 per second, not APY. Cooldown and pause state are owner-configurable."}}let C=[["notifyRewardAmount",["uint256"]],["setRewardsDistribution",["address"]],["setRewardsDuration",["uint256"]],["setCooldown",["uint256"]],["setStakePaused",["bool"]],["recoverERC20",["address","uint256"]],["transferOwnership",["address"]],["renounceOwnership",[]]];async function H(n,t){A(n,["operation","values","fund"]),b(t);let e=C.find(([m])=>m===n.operation);if(!e||!Array.isArray(n.values)||n.values.length!==e[1].length)throw new o("Choose a staking operation and its exact ordered values.");let a=e[1].map((m,k)=>L(m,n.values[k])),s=await T(),r=e[0]==="notifyRewardAmount",d=await s.readContract({address:c,abi:i,functionName:r?"rewardsDistribution":"owner"});if(!$(d,t))throw new o("This wallet lacks the Longbow staking owner/distribution role.");if(n.fund!==void 0&&(typeof n.fund!="boolean"||!r))throw new o("fund is a boolean available only for notifyRewardAmount.");let u=`Longbow staking ${e[0]}, values ${JSON.stringify(n.values)}.${e[0]==="renounceOwnership"?" Owner administration is permanently relinquished.":""}`,p=[];if(r&&n.fund===!0){let m=a[0];if(m===0n)throw new o("Reward funding must be positive.");let k=_(["function transfer(address,uint256) returns (bool)"]);p.push(l.unsignedTx({to:f.address,data:y({abi:k,functionName:"transfer",args:[c,m]}),value:"0",chainId:w,description:`Fund exactly ${m} USDG base units before notifying rewards.`}))}return p.push(O(y({abi:i,functionName:e[0],args:a}),u)),v(p,t,`${u} ${n.fund===!0?"Funding and notification are separate transactions. A failed notification leaves funded USDG in the staking contract.":""}`)}let B=N('Positive amount of BOW in base units (BOW has 18 decimals). Example: "1000000000000000000" = 1 BOW.');return{positions:q,tools:[D("longbow_staking_status",{},[],M),D("longbow_manage_staking",{operation:{enum:C.map(([n])=>n),description:"Owner or rewards-distributor call on the staking contract. notifyRewardAmount needs the distributor role; the others need the owner. Amounts are USDG base units (6 decimals)."},values:{type:"array",maxItems:2,description:"Ordered arguments for the operation: uint256 as decimal strings, addresses as 0x strings, bool as true/false. Empty list for renounceOwnership. recoverERC20 takes token address then amount.",items:{oneOf:[{type:"string"},{type:"boolean"}]}},fund:{type:"boolean",description:"Only for notifyRewardAmount: true first transfers that much USDG from this wallet to the staking contract, then notifies. Default false."}},["operation","values"],H),D("longbow_stake",{amount:B},["amount"],I),D("longbow_unstake",{amount:{description:'Amount of BOW to unstake in base units (BOW has 18 decimals). Example: "1000000000000000000" = 1 BOW. Use "all" to exit fully and claim rewards.',anyOf:[B,{const:"all",description:"Unstake everything and claim rewards in one exit() call."}]}},["amount"],F),D("longbow_claim_rewards",{},[],j)]}};export{h as a,c as b,tn as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F,c as y,d as b,f as h,g as N}from"./SK2VBNAU.js";import{g as p}from"./NWNYJ26T.js";import{b as M,j as O,k as _}from"./
|
|
1
|
+
import{a as F,c as y,d as b,f as h,g as N}from"./SK2VBNAU.js";import{g as p}from"./NWNYJ26T.js";import{b as M,j as O,k as _}from"./EWZFZUVF.js";import{a as A}from"./XSD5NL7J.js";import{getAddress as U,isAddress as W}from"viem";var j=O[M].pendle.marketFactory.address,q=O[M].pendle.router.address,J=600,Q=/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/,X=/^(usd.*|dai|w?eth|oak)$/i,ee=t=>X.test(t.replace(/[._-]/g,"")),te=/^PT-(.+)-\d{1,2}[A-Za-z]{3}\d{4}$/,s=t=>{throw new A(`${t} Oak won't use this market.`)},r=()=>s("Oak couldn't read this Pendle market from the chain.");function S(t){return typeof t!="number"||!Number.isInteger(t)||t<0||t>36?s("A token in this market reports unusual decimals."):t}function $(t){return!Array.isArray(t)||t.some(e=>typeof e!="string"||!W(e,{strict:!1}))?r():[...new Set(t.map(e=>U(e)))]}async function B(t,e,c={}){let g=c.now??Math.floor(Date.now()/1e3),[u,o,a,f,l,E,D,P,x,I,v]=await N(t,[{address:j,abi:F,functionName:"isValidMarket",args:[e.market]},{address:e.market,abi:y,functionName:"readTokens"},{address:e.market,abi:y,functionName:"expiry"},{address:e.market,abi:y,functionName:"isExpired"},{address:e.market,abi:y,functionName:"readState",args:[q]},{address:e.sy,abi:b,functionName:"getTokensIn"},{address:e.sy,abi:b,functionName:"getTokensOut"},{address:e.sy,abi:b,functionName:"decimals"},{address:e.sy,abi:b,functionName:"exchangeRate"},{address:e.pt,abi:h,functionName:"decimals"},{address:e.pt,abi:h,functionName:"symbol"}]);if(!u.ok)return r();if(u.value!==!0)return s("This isn't a market the Pendle factory created.");if(!o.ok||!Array.isArray(o.value)||o.value.length!==3)return r();let[z,Y,Z]=o.value;if(!p(z,e.sy)||!p(Y,e.pt)||!p(Z,e.yt))return s("The market's tokens don't match what Pendle's service listed.");if(!a.ok||typeof a.value!="bigint"||!f.ok||typeof f.value!="boolean")return r();if(a.value!==BigInt(e.expiry))return s("The market's end date doesn't match what Pendle's service listed.");let T=f.value;if(T!==g>=e.expiry&&Math.abs(g-e.expiry)>J)return s("The chain and Oak's clock disagree about whether this market has ended.");if(!l.ok||typeof l.value?.lastLnImpliedRate!="bigint"||!P.ok||!I.ok||!x.ok||typeof x.value!="bigint"||!v.ok||typeof v.value!="string"||!E.ok||!D.ok)return r();let i=$(E.value),V=$(D.value);if(i.length===0||V.length===0)return s("This market lists no token to put in or take out.");let H=S(P.value),G=S(I.value),R=i.find(n=>p(n,_)),L=await N(t,i.flatMap(n=>[{address:n,abi:h,functionName:"symbol"},{address:n,abi:h,functionName:"decimals"}])),w=new Map(i.map((n,k)=>[n,{symbol:L[k*2],decimals:L[k*2+1]}])),m;if(R)m=R;else if(i.length===1)m=i[0];else{let n=te.exec(v.value)?.[1],k=i.filter(K=>{let C=w.get(K).symbol;return C.ok&&C.value===n});k.length===1&&(m=k[0])}if(!m)return s("Oak can't tell which token this market takes as input.");let d=w.get(m);return!d.symbol.ok||typeof d.symbol.value!="string"||!d.decimals.ok?r():!Q.test(d.symbol.value)||!R&&ee(d.symbol.value)?s("The market's token name looks unusual."):{verified:{market:e.market,sy:e.sy,pt:e.pt,yt:e.yt,expiry:e.expiry,expired:T,kind:R?"stable":"stock",inputToken:m,inputSymbol:d.symbol.value,inputDecimals:S(d.decimals.value),ptDecimals:G,syDecimals:H,tokensIn:i,tokensOut:V},ptSymbol:v.value,lnImpliedRate:l.value.lastLnImpliedRate,syExchangeRate:x.value}}async function oe(t,e,c={}){return(await B(t,e,c)).verified}async function de(t,e,c={}){let g=await Promise.allSettled(e.map(a=>B(t,a,c))),u=[],o=[];return g.forEach((a,f)=>{let l=e[f];a.status==="fulfilled"?u.push({row:l,facts:a.value}):o.push(`${l.market}: ${a.reason instanceof A?a.reason.message:"Oak couldn't check this market."}`)}),{ok:u,dropped:o}}export{B as a,oe as b,de as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as T}from"./
|
|
1
|
+
import{b as T}from"./LBT6WR4U.js";import{c as A}from"./5UWVXEPD.js";import{i as b}from"./DWRRIFXS.js";import{o as P}from"./OUXPOFY2.js";import{b as f,j as g}from"./EWZFZUVF.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as a,f as c}from"./UMY6SP7C.js";import{a as s}from"./XSD5NL7J.js";import{decodeAbiParameters as p,encodeAbiParameters as f}from"viem";var g="LP fees only, using the pinned new HookrToken lots; no record-mode or arbitrary outflow.",u=[{type:"uint32"},{type:"uint128"}];function m(o){let t=a(o,["top","floor","horizon","unit","curve"],["top","floor","horizon","unit","curve"]),e=Number(c(t.top,8)),r=Number(c(t.floor,8)),i=Number(c(t.horizon,8)),n=Number(c(t.unit,8)),l=Number(c(t.curve,8));if(e<1||e>100||r>=e||n>1||(n===0?i<1||i>63:i<3||i>30)||l>2)throw new s("Exit Clock needs top 1\u2013100, floor below top, horizon 1\u201363 for unit 0 or 3\u201330 for unit 1, and curve 0\u20132.");return{top:e,floor:r,horizon:i,unit:n,curve:l}}function d(o){let t=m(o),e=1<<30|1<<20,r=BigInt(t.top)<<19n|BigInt(t.floor)<<26n|BigInt(t.horizon)<<33n|BigInt(t.unit)<<39n|BigInt(t.curve)<<40n;return f(u,[e,r])}function h(o){if(o.length!==130)throw new s("Exit Clock needs exactly two ABI words.");let[t,e]=p(u,o),r=m({top:String(e>>19n&127n),floor:String(e>>26n&127n),horizon:String(e>>33n&63n),unit:String(e>>39n&1n),curve:String(e>>40n&3n)});if(t!==(1<<30|1<<20)||d(Object.fromEntries(Object.entries(r).map(([i,n])=>[i,String(n)]))).toLowerCase()!==o.toLowerCase())throw new s("Exit Clock words are not canonical isolated LP-fee settings.");return r}function w(o,t){let e=d(t),[r,i]=p(u,e),n=(1n<<26n)-1n<<19n;if((o.potEveryNBuys&1<<20)!==0||(o.potMinBuyQuote&n)!==0n)throw new s("Exit Clock settings already occupy these fields.");return{...o,potEveryNBuys:o.potEveryNBuys|r,potMinBuyQuote:o.potMinBuyQuote|i}}function b(o,t){let e=o.potEveryNBuys,r=o.potMinBuyQuote;if(!(e&1<<20)||(r>>42n&7n)!==0n)throw new s("Exit Clock LP-fee settings are not active.");let i=r&(1n<<26n)-1n<<19n,n=h(f(u,[1<<30|1<<20,i]));return`Exit Clock: sells pay up to ${n.top*10} bps, falling to ${n.floor*10} bps over ${n.horizon} ${n.unit?"days":"hours"} (curve ${n.curve}). For the pinned new HookrToken, authenticated wallet sales use the fresh lot age and aged-bag floor; unknown routers or contract payers pay the top. The surcharge is clipped to available LP fee room. Hookr ${t} receives floor(charged pips * ${o.protocolShareBps}/10000) in quote; in-range LPs receive the remainder as LP fee. A mixed-age sale may reject partial fills.`}export{g as a,d as b,h as c,w as d,b as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as h,f as b,h as I,i as k,k as $,p as y,q as C,s as R}from"./UMY6SP7C.js";import{a as s}from"./XSD5NL7J.js";import{bytesToHex as O,decodeAbiParameters as F,encodeAbiParameters as m,hexToBytes as U,sha256 as E,zeroAddress as N}from"viem";import{keccak256 as _,parseAbi as z}from"viem";var J="Zap Source requires its own advisory and a factory-created route vault; this launch uses the advisory slot for the agent gate.",B=[{type:"tuple",components:[{name:"takePips",type:"uint24"},{name:"vault",type:"address"}]}],H={id:"zap-source",address:"0xA3d07234F6Ecb7012b8f46F277E9BaDae6e55bAD",minGas:15e4};function Z(t){h(t,["takePips","vault"],["takePips","vault"]);let e=Number(b(t.takePips,24)),a=k(t.vault);if(e<1||e>1e5||a===N)throw new s("Zap Source requires a nonzero vault and a buy cut of 1\u2013100000 pips.");return m(B,[{takePips:e,vault:a}])}function j(t){let[e]=F(B,t);if(Z({takePips:String(e.takePips),vault:e.vault}).toLowerCase()!==t.toLowerCase())throw new s("Non-canonical Zap Source terms; session tiers are not supported.");return e}function D(t){let e=j(t);return`Zap Source: ${e.takePips} pips of gross buyer quote is credited as a Rules claim to vault ${e.vault}. The vault's immutable route controls the target buy, protocol share, caller bounty, timing and custody; those terms must be verified separately.`}var V={factory:[1518],poolManager:[70,1230,1945,3114,4382,7843,10323,12312,12365],rules:[1020,3621,3969,7980,9345],router:[122,708,4782,5484],root:[841,8417,8912,11572],gate:[2792,9035,11662],sink:[1450,5206],quote:[965,1751,3921,7503,7925,9286,9836],subject:[1092,4662,7131,10268],targetId:[2674,2998,4349,6694,7810,8871,10359,11612],mode:[4257,7015],impactBps:[2615,4531,12205],rewardBps:[2735,3836],threshold:[4058,6892,8064],maxPerZap:[1308,4123],windowBlocks:[1694,8743],windowScope:[784,11512],protocolShareBps:[6448,6954],protocolRecipient:[1819,7465],tickLower:[2098,2932,3475,10470],tickUpper:[2141,2894,3562,10511],currency0:[2297,8256],currency1:[2343,8293],fee:[8337],tickSpacing:[8376],quoteIsCurrency0:[4472,10401,12170,13590]};function K(t,e,a,d,n){if(!t||t.length!==2+e*2||!/^0x[0-9a-fA-F]+$/.test(t))throw new s("Hookr instance runtime length is incorrect.");let o=U(t);for(let[u,i]of Object.entries(d)){let l=n[u];if(!l||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new s(`Missing immutable ${u}.`);for(let c of i){if(O(o.slice(c,c+32)).toLowerCase()!==l.toLowerCase())throw new s(`Hookr instance immutable ${u} differs from the requested terms.`);o.fill(0,c,c+32)}}if(E(o).toLowerCase()!==a.toLowerCase())throw new s("Hookr instance runtime does not match the pinned compiler output.")}var M={address:H.address,codeHash:"0x1c0dc634a1092cfae32474be9082583e6a94c61a49390e2bd9dfef2152dfff83",schemaHash:"0x15db6c3ca0a513c3e391f86babd70b212f39ba62eaeb11f13bd505dad632ae34",phaseMask:1,feeOnly:!0,gasMin:15e4},g=["factory","poolManager","rules","router","root","gate","sink","quote","subject"],S={mode:8,impactBps:16,rewardBps:16,threshold:128,maxPerZap:128,windowBlocks:32,windowScope:8,protocolShareBps:16},v=[...g,"targetId",...Object.keys(S),"protocolRecipient","tickLower","tickUpper","currency0","currency1","fee","tickSpacing","quoteIsCurrency0"],L=[...[...g,"protocolRecipient"].map(t=>({type:"function",name:t,stateMutability:"view",inputs:[],outputs:[{type:"address"}]})),...Object.entries({...S,tickLower:24,tickUpper:24}).map(([t,e])=>({type:"function",name:t,stateMutability:"view",inputs:[],outputs:[{type:`${t.startsWith("tick")?"int":"uint"}${e}`}]})),{type:"function",name:"targetId",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"targetKey",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{name:"currency0",type:"address"},{name:"currency1",type:"address"},{name:"fee",type:"uint24"},{name:"tickSpacing",type:"int24"},{name:"hooks",type:"address"}]}]},{type:"function",name:"routeLive",stateMutability:"view",inputs:[],outputs:[{type:"bool"}]}],W=z(["function vaultRecord(address) view returns (bool exists,bytes32 target,address gate)"]);function P(t){if(typeof t!="string"||!/^(0|-?[1-9][0-9]*)$/.test(t))throw new s("Provide a signed decimal int24 string.");let e=BigInt(t);if(e<-8388608n||e>8388607n)throw new s("Provide a signed decimal int24 string.");return e}async function G(t,e,a,d){let n=h(d,v,v),o={};for(let r of[...g,"protocolRecipient","currency0","currency1"])o[r]=k(n[r]);o.targetId=I(n.targetId);for(let[r,f]of Object.entries(S))o[r]=b(n[r],f);if(o.tickLower=P(n.tickLower),o.tickUpper=P(n.tickUpper),o.tickSpacing=P(n.tickSpacing),o.fee=b(n.fee,24),typeof n.quoteIsCurrency0!="boolean")throw new s("Provide quoteIsCurrency0 as a boolean.");o.quoteIsCurrency0=n.quoteIsCurrency0;let u=k(H.address),i=[...g,"targetId",...Object.keys(S),"protocolRecipient","tickLower","tickUpper"],[l,c,p,w,x,...T]=await Promise.all([t.getCode({address:a,blockNumber:e}),t.getCode({address:u,blockNumber:e}),y(t,u,W,"vaultRecord",[a],e),y(t,a,L,"targetKey",[],e),y(t,a,L,"routeLive",[],e),...i.map(r=>y(t,a,L,r,[],e))]);if(!c||_(c)!==M.codeHash||!Array.isArray(p)||p.length!==3||p[0]!==!0||String(p[1]).toLowerCase()!==String(o.targetId).toLowerCase()||String(p[2]).toLowerCase()!==String(o.gate).toLowerCase())throw new s("Zap vault factory runtime or attestation differs from the requested route.");for(let r=0;r<i.length;r++)if(String(T[r]).toLowerCase()!==String(o[i[r]]).toLowerCase())throw new s(`Zap vault ${i[r]} differs from the requested route.`);if(!w||typeof w!="object"||Array.isArray(w))throw new s("Zap vault target key is incomplete.");let A=w;for(let r of["currency0","currency1","fee","tickSpacing"])if(String(A[r]).toLowerCase()!==String(o[r]).toLowerCase())throw new s(`Zap vault target ${r} differs from the requested route.`);if(String(A.hooks).toLowerCase()!==String(o.root).toLowerCase()||o.quoteIsCurrency0!==(String(o.quote).toLowerCase()===String(o.currency0).toLowerCase()))throw new s("Zap vault target root or quote ordering is inconsistent.");let q={};for(let r of v){let f=o[r];q[r]=[...g,"protocolRecipient","currency0","currency1"].includes(r)?m([{type:"address"}],[f]):r==="targetId"?f:r==="quoteIsCurrency0"?m([{type:"bool"}],[f]):r.startsWith("tick")?m([{type:"int256"}],[f]):m([{type:"uint256"}],[f])}if(K(l,15790,"0xc003d9e96e322d625b72aa686fae92e005f7da0374189d4079172ca84aaa1dc3",V,q),String(o.factory).toLowerCase()!==u.toLowerCase()||String(o.poolManager).toLowerCase()!==R.toLowerCase()||String(o.root).toLowerCase()!==C.toLowerCase())throw new s("Zap vault factory, pool manager or root differs from the reviewed deployment.");return{terms:o,live:$(x)}}function Q(t,e){return`Vault ${t} holds Rules ${e.rules} quote claims and idle assets; target ${e.targetId}, gate ${e.gate}, quote ${e.quote}, subject ${e.subject}, router ${e.router}, factory ${e.factory}; target key ${e.currency0}/${e.currency1}, fee ${e.fee}, tick spacing ${e.tickSpacing}, liquidity range ${e.tickLower} to ${e.tickUpper}. Mode ${e.mode} ${e.mode===0n?`sends bought subject to ${e.sink}`:"owns permanent target liquidity"}; impact ${e.impactBps} bps over ${e.windowBlocks} blocks, window scope ${e.windowScope}; threshold ${e.threshold}, max per zap ${e.maxPerZap} (zero disables that cap; the swap still has an int128 input limit). A permissionless caller chooses the bounty recipient; bounty is floor((target buy spend minus target Rules refund plus added quote) * ${e.rewardBps} / 10000). Protocol ${e.protocolRecipient} receives floor((claim minus the vault's prior target-buy refunds) * ${e.protocolShareBps} / 10000), when positive.`}async function re(t,e,a,d){h(a,["takePips","vault","route"],["takePips","vault","route"]);let n=Z({takePips:a.takePips,vault:a.vault}),{takePips:o,vault:u}=j(n),{terms:i,live:l}=await G(t,e,u,a.route),c=(w,x)=>String(w).toLowerCase()===String(x).toLowerCase(),p=$(await y(t,C,z(["function knownPool(bytes32) view returns (bool)"]),"knownPool",[i.targetId],e));if(!p||!l)throw new s(`Zap Source refused: target pool ${i.targetId} ${p?"is open, but its frozen settings do not route this vault and can never change":"is not open yet"}. This pool would still send its buyers' cut to vault ${u}, where it would be permanently locked with no recovery: the vault has no owner, rescue or removal path${p?"":", and someone else can open that target pool first without this vault"}. Launch the target pool first with this vault as a feeder, then launch this source pool.`);if(!d.rules||!c(i.rules,d.rules)||!c(i.quote,d.quote)||!c(i.gate,"0x59834ed88E72c59EB4fB0eF3cB0D95eCA98223E3")||c(i.targetId,d.poolId))throw new s("Zap Source vault rules, quote or target route do not match this launch.");return{data:n,descriptor:M,phases:1,bounds:{maxLpFeePips:0n,maxQuoteTakePips:BigInt(o),maxSubjectTakeBps:0n},summary:`${D(n)} ${Q(u,i)} The target route is live at the checked block.`}}export{J as a,B as b,H as c,Z as d,j as e,D as f,V as g,K as h,M as i,v as j,L as k,W as l,G as m,Q as n,re as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as he,f as pt,h as lt,i as mt,u as ht,w as kt}from"./B4U43D5Z.js";import{a as ve,c as ct}from"./TKJ4GFUP.js";import{i as dt}from"./JCS24YBB.js";import{k as rt}from"./NCCKCGKL.js";import{B as nt,t as Re,y as ot}from"./2ZYFBBOE.js";import{c as me,h as Ze,k as et,l as tt}from"./7GL547YZ.js";import{b as ut}from"./IJVBCEA2.js";import{a as l,b as it,c as at,e as st}from"./RKS3M7L5.js";import{a as le}from"./G2LAO23N.js";import{m as Le}from"./OUXPOFY2.js";import{a as Ve}from"./3RGED2KO.js";import{a as w,b as Se,d as Je,e as _,f as m,h as pe,i as A,j as h,k as Q,l as M,m as G,n as Be,o as T,p,q as W,r as He,s as Ye}from"./UMY6SP7C.js";import{b as de,i as qe,j as Qe,k as We}from"./CJMVRV34.js";import{a as Xe}from"./7WXAS54T.js";import{t as De}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as Lt,erc20Abi as Rt,formatUnits as J,getAddress as $e,parseAbi as fe,zeroAddress as k,zeroHash as ge}from"viem";var vt="hookr_launch",y=$e(de.launcherV1),Y=$e(de.rulesV1),At=720*60*60,ke=(i,t=Object.keys(i))=>({type:"object",properties:i,required:t,additionalProperties:!1}),ft={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},Ae={...ke({launchProfile:{type:"string",enum:["agents-only","open"],description:"Choose agents-only (default, requires agentGate) or open (requires one advisory Hook Block and omits agentGate)."},token:{description:'Token to launch: kind "new" creates a fresh token; kind "existing" is reserved and currently refused.',oneOf:[ke({kind:{const:"new",type:"string",description:le.enumValues({new:"create and launch a fresh token"})},name:{type:"string",minLength:1,maxLength:48,description:"Public token name, 1 to 48 UTF-8 bytes, no control characters."},symbol:{type:"string",minLength:1,maxLength:12,description:"Public token ticker symbol, 1 to 12 UTF-8 bytes, no control characters."},supply:{...w,description:'Total supply of the new token in base units (18 decimals: "1000000000000000000" = 1 token); positive, below 2^108.'},salt:{...Se,description:"Bytes32 hex salt (0x plus 64 hex digits) that fixes the new token address."}}),ke({kind:{const:"existing",type:"string",description:le.enumValues({existing:"reserved for an already deployed token; launching it is not supported yet"})},address:{...ft,description:le.address("existing token contract")}})]},quote:{...ft,description:"Qualified ETH (zero address) or pinned USDG quote. Other quote funding routes await qualification."},sqrtPriceX96:{...w,description:"Integer sqrt(currency1/currency0) times 2^96 for the sorted PoolKey."},tickLower:{type:"integer",minimum:-887272,maximum:887272,description:"Lower tick of the launch range, a signed integer and a multiple of the tick spacing 200; below tickUpper."},tickUpper:{type:"integer",minimum:-887272,maximum:887272,description:"Upper tick of the launch range, a signed integer and a multiple of the tick spacing 200; above tickLower."},liquidity:{...w,description:"Set the initial liquidity in v4 liquidity units, positive and below 2^127, with rounded-up token debts within both funding caps."},amount0Max:{...w,description:"Set the maximum currency0 funding in that token\u2019s base units, using its decimals."},amount1Max:{...w,description:"Set the maximum currency1 funding in that token\u2019s base units, using its decimals."},agentGate:{description:"Set identity and score requirements for entrants; creator family liquidity is exempt from score and age requirements.",...ke({minAgeSeconds:{...w,description:"Explicit minimum live link age in seconds for buys and other LPs, 0 to 2592000; the creator family liquidity is exempt."},minScore:{...w,description:"Minimum agent reputation score required to buy; 0 means no minimum."},tierScore:{...w,description:"Set the score at which the base fee applies, or 0 when tierPips is 0; lower scores pay the surcharge."},tierPips:{...w,description:"LP fee surcharge in pips for agents below tierScore (3000 = 0.3%); at most 50000, and 0 only when tierScore is 0."},reviewerSetId:{...Se,description:"Bytes32 id of a registered reviewer set that scores agents; all zeros unless the gate uses a score."}})},hookBlocks:pt,lpRewardsBps:{...w,description:"Set the LP Rewards rate in basis points (50 = 0.5%), at most 1000; this profile has zero burn."},arbRecapture:{type:"boolean",description:"Arb recapture, permanent either way: true turns it on (25% executor, 15% Hookr, 60% LPs; swaps need a high gas limit), false launches without it. Defaults to true when omitted."},deadline:{...w,description:"Set the latest launch execution time in Unix seconds, within the next 300 seconds of chain time."}},["token","quote","sqrtPriceX96","tickLower","tickUpper","liquidity","amount0Max","amount1Max","lpRewardsBps","deadline"]),allOf:[{if:{properties:{launchProfile:{const:"open",description:"Select the open launch profile."}},required:["launchProfile"]},then:{not:{required:["agentGate"]}},else:{required:["agentGate"]}}]};function $t(i){let t=_(i,Object.keys(Ae.properties),Ae.required),a=mt(t.hookBlocks),e=st(t.launchProfile,t.agentGate,a),o=G(t.token);if(o.kind==="existing")throw _(o,["kind","address"],["kind","address"]),A(o.address),new r("Existing-token Hookr launches await a qualified funding route. Use token.kind new.");if(_(o,["kind","name","symbol","supply","salt"],["kind","name","symbol","supply","salt"]),o.kind!=="new")throw new r("Choose token.kind new; existing tokens are not supported yet.");let n=(R,oe)=>{if(typeof R!="string"||!R.trim()||new TextEncoder().encode(R).length>oe||[...R].some(we=>we.codePointAt(0)<32)||/[\u007f-\u009f\u2028-\u202e\u2066-\u2069\ud800-\udfff]/u.test(R))throw new r(`Use nonempty public token text within ${oe} UTF-8 bytes without control characters.`);return R},x=m(o.supply,108);if(!x)throw new r("Hookr new-token supply must be positive and at most 2^108-1 base units.");let q=A(t.quote);if(![k,$e(De.mainnet.usdg)].includes(q))throw new r("Use native ETH (zero address) or the pinned USDG quote; other quote funding routes await qualification.");let s=t.tickLower,c=t.tickUpper;if(typeof s!="number"||typeof c!="number")throw new r("Provide integer aligned Hookr ticks.");ot(s,c,l.tickSpacing);let u=m(t.sqrtPriceX96,160);if(u<=Le(s)||u>=Le(c))throw new r("Hookr opening price must be strictly inside the aligned tick range.");let S=m(t.liquidity,127);if(!S)throw new r("Hookr liquidity must be positive and at most int128 max.");let P=m(t.amount0Max,128),$=m(t.amount1Max,128),B=nt({liquidity:S,tickLower:s,tickUpper:c,sqrtPriceX96:u,roundUp:!0});if(B.amount0>=1n<<127n||B.amount1>=1n<<127n||!B.amount0||!B.amount1||B.amount0>P||B.amount1>$)throw new r("Hookr exact rounded-up debts must be positive and fit both approved funding caps. Reduce liquidity or increase the caps.");let f=e.kind==="agents-only"?_(t.agentGate,["minAgeSeconds","minScore","tierScore","tierPips","reviewerSetId"],["minAgeSeconds","minScore","tierScore","tierPips","reviewerSetId"]):{minAgeSeconds:"0",minScore:"0",tierScore:"0",tierPips:"0",reviewerSetId:ge},K=Number(m(f.minScore,32)),C=Number(m(f.tierScore,32)),N=Number(m(f.tierPips,24)),Z=pe(f.reviewerSetId),ee=Number(m(f.minAgeSeconds,32));if(ee>At)throw new r("Hookr minAgeSeconds must be at most 2592000.");if(N>5e4||N===0!=(C===0)||Z===ge!=(K===0&&C===0))throw new r("Hookr gate scores, tier and reviewer set must agree; tier surcharge is at most 50000 pips.");let te=Number(m(t.lpRewardsBps,16));if(te>1e3)throw new r("Hookr LP Rewards plus burn must not exceed 1000 bps; this profile has zero burn.");if(t.arbRecapture!==void 0&&typeof t.arbRecapture!="boolean")throw new r("Use arbRecapture true or false; omitted defaults to true.");return{token:{existing:k,name:n(o.name,48),symbol:n(o.symbol,12),supply:x,salt:pe(o.salt)},quote:q,sqrtPriceX96:u,tickLower:s,tickUpper:c,liquidity:S,amount0Max:P,amount1Max:$,debts:B,launchProfile:e.kind,gateTerms:{flags:e.kind==="agents-only"?1:0,minScore:K,tierScore:C,tierPips:N,reviewers:Z,minAge:ee},hookBlocks:a,lpRewardsBps:te,arbRecapture:t.arbRecapture!==!1,arbRecaptureOmitted:t.arbRecapture===void 0,deadline:m(t.deadline,64)}}async function Ot(i,t,a,e){return A(await p(i,y,T("launcherV1"),"predictToken",[t,a],e))}async function Ft(i,t,a,e,o){let n=a.gate;if(!n.walletAgent||!(e?n.healthyForScores:n.healthyIdentityOnly))throw new r("Hookr needs a healthy on-chain agent identity. Own an ERC-8004 identity or link its current agent wallet on the Hookr gate; Oak setup linking alone is insufficient.");let x=(c,u)=>p(i,n.identity,fe(["function balanceOf(address) view returns (uint256)","function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),c,u,o),q=h(await x("balanceOf",[t])),s=!1;if(n.link.linked){let c=BigInt(n.link.agentId);s=A(await x("getAgentWallet",[c]))===t,!s&&q>0n&&(s=A(await x("ownerOf",[c]))===t)}if(!q&&!s)throw new r("Hookr on-chain identity ownership or gate link is missing or stale. Own an ERC-8004 identity or link its current agent wallet on the Hookr gate before launching.")}function to(i){let t=JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:"hookr_blocks",arguments:{}}});return(async(a,e)=>{if(a!==Ve||e?.method!=="POST"||e.body!==t)throw new r("The local Hookr launch rebuild may only read the public Hook Block catalog.");return i(a,{...e,headers:{"content-type":"application/json","user-agent":"Mozilla/5.0"}})})}async function It(i,t,a){let e=$t(t);if(i.network==="testnet")throw new r("Hookr launch requires Robinhood Chain 4663.");let o=i.clientFor(4663),n=await Qe(o);if(e.deadline<=n.timestamp||e.deadline>n.timestamp+l.deadlineSeconds)throw new r("Set a fresh Hookr deadline within the next 300 seconds of chain time.");let x=[],q="";try{x=await lt(i)}catch(d){if(e.hookBlocks.length)throw d;q="Hookr gate hint unavailable; checking the shipped current gate against the chain."}let s,c=null;if(e.launchProfile==="agents-only"){let d=e.gateTerms.reviewers!==ge,L=x.find(I=>I.id==="agent-gate"&&I.openToNewPools)?.address??me,ue=d?[e.gateTerms.reviewers]:[],F;try{F=await ve(o,a,n.number,ue,L)}catch(I){if(L===me)throw I;F=await ve(o,a,n.number,ue,me),q=`Hookr gate hint ${L} refused by the chain; using the listed gate.`}await Ft(o,a,F,d,n.number),s=F,c=F.gate}else s=await ct(o,a,n.number);if(!s.rootOpenForWallet||s.newMarketsPaused||!s.launcherAdmitted)throw new r("Hookr new markets or the reviewed Launcher are closed. Retry only after registry admission is restored.");let u=await Ot(o,a,e.token,n.number);if(u===k||u===e.quote)throw new r("Hookr predicted token collides with its quote. Choose a fresh salt.");let S={currency0:BigInt(u)<BigInt(e.quote)?u:e.quote,currency1:BigInt(u)<BigInt(e.quote)?e.quote:u,fee:8388608,tickSpacing:l.tickSpacing,hooks:W},P=Re(S),$=S.currency0===u,B=$?e.amount0Max:e.amount1Max,f=$?e.amount1Max:e.amount0Max,K=$?e.debts.amount0:e.debts.amount1,C=$?e.debts.amount1:e.debts.amount0;if(B>e.token.supply)throw new r("Hookr new-token deposit cap exceeds its fixed supply.");let[N,Z,ee,te,R,oe,we,gt]=await Promise.all([o.getCode({address:u,blockNumber:n.number}),o.getTransactionCount({address:u,blockNumber:n.number}),p(o,y,T("launcherV1"),"memberKey",[u,e.quote,l.tickSpacing,W],n.number),p(o,W,T("rootV1"),"knownPool",[P],n.number),p(o,y,T("launcherV1"),"SKIP_TAKEN",[],n.number),p(o,He,T("registry"),"isQuote",[e.quote],n.number),p(o,He,T("registry"),"quoteIsBraked",[e.quote],n.number),p(o,Y,T("rulesV1"),"minProtocolShareBps",[],n.number)]),[wt,yt]=M(ee,2);if(e.token.salt===pe(R))throw new r("SKIP_TAKEN is unsupported. Choose an ordinary new-token salt.");if(N&&N!=="0x"||Z!==0||Q(te)||!Q(yt)||Re(G(wt))!==P)throw new r("Hookr token address or pool is already taken or its predicted key differs. Choose a fresh salt and rebuild.");if(!Q(oe)||Q(M(we,2)[0]))throw new r("The Hookr quote is not currently qualified or is braked. Choose an admitted quote.");let ye=c?G(c.admission):null,z=ye?m(G(ye.caps).maxLpFeePips,24):0n,be=BigInt(s.coreAdmission.caps.maxLpFeePips);if(c&&(BigInt(e.gateTerms.tierPips)>z||BigInt(l.baseLpFeePips)+z>be))throw new r("Hookr gate tier or total LP fee exceeds the live admission cap. Lower the tier or wait for compatible admission.");let U=A(await p(o,Y,T("rulesV1"),"protocolRecipient",[],n.number));await qe(o,n.number,[U]);let xe=fe(["function feeTerms(address,bool,bytes32) view returns (uint16,uint16,uint16)","function integrator(address) view returns (uint16,uint16,uint256)","function integratorMinFee(address) view returns (uint16,uint16,uint256)","function MAX_INTEGRATOR_BPS() view returns (uint16)"]),Oe=async d=>M(await p(o,U,xe,"feeTerms",[d,e.arbRecapture,P],n.number),3),[Fe,Ie]=await Promise.all([Oe(k),Oe(he)]),b=h(Ie[1],16);if(b!==0n){let d=async j=>M(await p(o,U,xe,j,[he],n.number),3),[L,ue,F]=await Promise.all([d("integrator"),d("integratorMinFee"),p(o,U,xe,"MAX_INTEGRATOR_BPS",[],n.number)]);if(h(L[0],16)!==b)throw new r("Hookr's listing for Oak and its fee terms for this pool disagree on Oak's rate. Request a fresh launch preview.");let I=h(F,16);if(b>I)throw new r(`Hookr lists Oak at ${b} bps, above its on-chain maximum integrator rate of ${I} bps. Oak will not launch on a listing outside Hookr's own limit.`);if([L[2],ue[2]].map(j=>h(j)).some(j=>j!==0n&&j<=e.deadline))throw new r("Oak's Hookr listing has a change that can take effect before this launch opens. Request a fresh launch preview after it settles.")}let E=b===0n?k:he,[bt,xt,Pt]=b===0n?Fe:Ie,Me=h(bt,16),ne=h(Pt,16);if(h(Fe[1],16)!==0n||h(xt,16)!==b||ne>10000n)throw new r("Hookr treasury minimum or integrator terms exceed the reviewed profile.");let Ce=h(gt,16),re=Me>Ce?Me:Ce;if(re<2000n||re>5000n)throw new r("Hookr protocol share is outside the reviewed 2000\u20135000 bps profile.");let Tt={guardEndBlock:0,maxFeePips:l.baseLpFeePips,snipeTaxPips:0,snipeFloorPips:0,snipeDecaySeconds:0,dynamicFeeSens:0,burnBps:0,lpBps:e.lpRewardsBps,potBps:0,royaltyBps:0,protocolShareBps:Number(re),potEveryNBuys:e.arbRecapture?0:at,maxBuyQuoteAmount:0n,potMinBuyQuote:0n,royaltyTo:k,integrator:E},g=await kt(i,{launchProfile:e.launchProfile,...c?{agentGate:t.agentGate}:{},hookBlocks:e.hookBlocks},Tt,{poolId:P,subject:u,quote:e.quote,tickSpacing:l.tickSpacing,sqrtPriceX96:e.sqrtPriceX96,rules:Y,launcher:y,wallet:a},n,{maxLpFeePips:be,maxQuoteTakePips:BigInt(s.coreAdmission.caps.maxQuoteTakePips),maxSubjectTakeBps:BigInt(s.coreAdmission.caps.maxSubjectTakeBps)},e.arbRecapture?0n:ne,x),{rules:H,blockTerms:Ne,bounds:ie}=g;if(H.guardEndBlock){let d=await rt(o,n);if(BigInt(H.guardEndBlock)<=d+4n||BigInt(H.guardEndBlock)>d+100000n)throw new r("Anti-Snipe guardEndBlock must be more than four and at most 100000 parent blocks ahead.")}let D=ie.maxLpFeePips+z,ae=ie.maxQuoteTakePips;if(D>be||D>600000n||c&&(ae>BigInt(s.coreAdmission.caps.maxQuoteTakePips)||ie.maxSubjectTakeBps>BigInt(s.coreAdmission.caps.maxSubjectTakeBps)))throw new r("Hookr selected blocks exceed the live core fee caps. Lower their rates.");let X=d=>`${J(BigInt(d),4)}%`,Ue=dt(H,e.arbRecapture?0n:ne,U,l.baseLpFeePips),qt=Ue?` ${Ue}`:"",Ee=ht(Ne,U,E===k?void 0:b).join(" "),se=`${J(b,2)}%`,St=E===k?"":` Oak receives ${se} of Hookr's cut on this pool, paid to Oak's wallet ${E}: ${se} of everything Hookr is paid from this pool's fees${e.arbRecapture?`, and ${se} of Hookr's 15% arb recapture cut (${J(b*15n,4)}% of recaptured profit)`:""}. Oak read the ${se} rate on chain; it is frozen when the pool opens. That it comes out of Hookr's part, so traders and LPs pay the same, is Hookr's published rule, not read by Oak.`,ce={on:e.arbRecapture,traderBps:0,lpBps:e.arbRecapture?1e4:0,period:0,maxPrizeBps:0,potReleaseBps:0,minBuyQuote:0n,releaseBlocks:0},je=null;if(e.arbRecapture){let[d,L]=await Promise.all([p(o,Y,fe(["function recaptureDefaults() view returns ((bool on,uint16 traderBps,uint16 lpBps,uint32 period,uint16 maxPrizeBps,uint16 potReleaseBps,uint128 minBuyQuote,uint32 releaseBlocks) rc,uint16 potBps)"]),"recaptureDefaults",[],n.number),tt(o,n.number,{required:!0})]);if(ce.releaseBlocks=Number(h(G(M(d,2)[0]).releaseBlocks,32)),!ce.releaseBlocks)throw new r("Hookr recapture release schedule is unavailable. Use arbRecapture false.");if(L.partnerBps!=="2500")throw new r("Hookr recapture split differs from the disclosed 25% executor profile. Use arbRecapture false.");je=Be(L)}let _e={quote:e.quote,tickSpacing:l.tickSpacing,sqrtPriceX96:e.sqrtPriceX96,tickLower:e.tickLower,tickUpper:e.tickUpper,liquidity:e.liquidity,amount0Max:e.amount0Max,amount1Max:e.amount1Max,config:{subject:u,quote:e.quote,rules:Y,advisory:g.advisory?.address??c.address,liquidityOwner:y,baseLpFeePips:l.baseLpFeePips,caps:{maxLpFeePips:Number(D),maxQuoteTakePips:Number(ae),maxSubjectTakeBps:Number(ie.maxSubjectTakeBps)},rulesGasLimit:Number(s.coreAdmission.gasLimit),advisoryGasLimit:g.advisory?Number(g.advisory.gasLimit):Number(m(ye.gasLimit,32)),advisoryPhases:g.advisory?.phases??1,advisoryFailOpen:g.advisory?g.advisory.failOpen:!1,policyId:ge},rules:H,recapture:ce},O=BigInt(s.launchFee.amount);if(O>10000000000000000n)throw new r("Hookr launch fee exceeds the reviewed 0.01 ETH maximum.");let v=k;if(O&&(await qe(o,n.number,[s.launchFee.treasury]),v=A(await p(o,s.launchFee.treasury,fe(["function target() view returns (address)"]),"target",[],n.number)),v===k||v===y||v===a||v===Ye))throw new r("Hookr launch fee recipient is outside the reviewed payment profile.");let Pe=O+(e.quote===k?f:0n),Te=[],V=[];if(e.quote!==k){let d=h(await p(o,e.quote,Rt,"allowance",[a,y],n.number));d!==0n&&d!==f&&V.push(i.approval(e.quote,y,"0",4663)),V.push(i.approval(e.quote,y,f.toString(),4663)),Te.push({token:e.quote,amount:f})}Pe&&Te.push({token:Xe,amount:Pe,to:y});let Ge=`Launch public, permanent token ${JSON.stringify(e.token.name)} (${JSON.stringify(e.token.symbol)}), fixed supply ${J(e.token.supply,18)} (18 decimals). ${c?c.listed?"Create one agents-only pool (identity check on every buy).":`Create one pool behind a gate Oak has not read: that gate alone decides who may buy and what surcharge applies. Oak knows only its frozen caps: LP fee surcharge at most ${z} pips (${X(z)}), zero quote and subject take.`:g.summaryLines.join(" ")} Price currency1/currency0 = ${e.sqrtPriceX96*e.sqrtPriceX96}/${1n<<192n}; sqrtPriceX96 ${e.sqrtPriceX96}, ticks ${e.tickLower} to ${e.tickUpper}, spacing ${l.tickSpacing}. Deposit at most ${e.amount0Max} currency0 and ${e.amount1Max} currency1 base units; exact launch debts ${e.debts.amount0} and ${e.debts.amount1}. Currency0 ${S.currency0}; currency1 ${S.currency1}. Launch fee ${O} wei to ${v} (${J(O,18)} ETH). Unused quote funding (${f-C} base units) and retained token supply (${e.token.supply-K} base units) return to ${a} in this transaction. Family owner ${a}; token ${u}; pool ${P}. LP base fee ${l.baseLpFeePips} pips (${X(l.baseLpFeePips)}); total LP fee cap ${D} pips (${X(D)}), frozen at launch; ${c?`gate flags 1, scores ${e.gateTerms.minScore}/${e.gateTerms.tierScore}, tier surcharge ${e.gateTerms.tierPips} pips (${X(e.gateTerms.tierPips)}) below tier score, paid to in-range LPs; reviewer set ${e.gateTerms.reviewers}; gate takes zero quote and subject.`:""} LP Rewards ${H.lpBps} bps; configured burn ${H.burnBps} bps; quote-take cap ${ae} pips (${X(ae)}); protocol share ${re} bps.${qt}${St} ${c?`${q} Gate ${c.address}: ${c.listed?"listed":"new gate, Oak has not read its code; it can refuse trades at any time"}. Minimum link age ${e.gateTerms.minAge} seconds (creator family liquidity exempt).`:""} ${it(e.arbRecapture)}${e.arbRecapture?`; recapture pot releases over ${ce.releaseBlocks} blocks`:""}; deadline ${e.deadline}.${e.arbRecaptureOmitted?" Arb recapture is on because arbRecapture was left out; pass arbRecapture false to launch without it.":""} ${H.guardEndBlock?`Principal locked until parent block ${H.guardEndBlock}.`:"No lock."} ${Ee}`,Ke=Lt({abi:T("launcherV1"),functionName:"launchAdvised",args:[e.token,W,[_e],[g.advisory?g.advisory.data:et(Ze(c.address,c.schemaHash),e.gateTerms)],e.deadline]});ut(Ke),V.push(i.unsignedTx({to:y,data:Ke,value:Pe.toString(),chainId:4663,description:Ge}));let[ze,Bt,Ht]=await Promise.all([o.getCode({address:u}),o.getTransactionCount({address:u}),o.readContract({address:y,abi:Je,functionName:"launchFee"})]);if(ze&&ze!=="0x"||Bt!==0||h(M(Ht,5)[0])!==O)throw new r("Hookr collision state or launch fee changed. Request a fresh launch preview.");return await We(o,n),{txs:V,inputs:Te,summary:Ge,tokenAddress:u,poolId:P,feeTarget:v,feeTreasury:s.launchFee.treasury,terms:Be({request:t,blockNumber:n.number,blockHash:n.hash,owner:a,tokenAddress:u,poolId:P,poolKey:S,member:_e,launchProfile:g.kind,advisory:g.advisory,gateTerms:c?e.gateTerms:null,blockTerms:Ne,blockSummary:Ee,launchFee:O,feeTarget:v,feeTreasury:s.launchFee.treasury,hookrMinimumPips:ne,oakIntegrator:E===k?null:{address:E,rateBps:b},exactApprovals:V.slice(0,-1),refunds:{quote:f-C,retainedSupply:e.token.supply-K},gasEstimate:null,gasEstimateReason:"The local sender estimates the ordered exact calls after funding approvals and confirms the gas limit and maximum fee.",lane:je,pins:de})}}function Mt(i){if(!Array.isArray(i)||i.length<1||i.length>3)throw new r("Hookr launch requires only the locally reconstructed finite approvals and one launch transaction.");for(let t of i)_(t,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function oo(i,t){if(Mt(i),i.length!==t.length||i.some((a,e)=>a.to.toLowerCase()!==t[e].to.toLowerCase()||a.data.toLowerCase()!==t[e].data.toLowerCase()||a.value!==t[e].value||a.chainId!==4663))throw new r("Hookr launch differs from the locally reconstructed exact parameters, approvals and funding.")}function no(i){return[{name:vt,inputSchema:Ae,execute:async(t,a)=>{let e=await It(i,t,a);return{txs:e.txs,preview:await i.preview(e.txs,a),terms:e.terms,summary:e.summary}}}]}export{vt as a,y as b,Y as c,Ae as d,$t as e,to as f,It as g,Mt as h,oo as i,no as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as s,f as a,i as u}from"./UMY6SP7C.js";import{a as i}from"./XSD5NL7J.js";import{zeroAddress as c}from"viem";function w(e,o){if(s(o,["id","window","maximum","recipient"],["id","window","maximum","recipient"]),o.id!=="sandwich-guard")throw new i("Choose Hook Block sandwich-guard.");let t=a(o.window,8),n=a(o.maximum,8),r=u(o.recipient);if(t>3n||n<5n||n>15n||r===c||e.royaltyTo!==c&&e.royaltyTo.toLowerCase()!==r.toLowerCase()||e.potEveryNBuys&1<<17||e.potMinBuyQuote>>114n&511n)throw new i("Sandwich Guard needs window 0\u20133, maximum 5\u201315, an unoccupied carrier and one compatible nonzero recipient.");return{...e,royaltyTo:r,potEveryNBuys:e.potEveryNBuys|1<<30|1<<17,potMinBuyQuote:e.potMinBuyQuote|t<<114n|n<<116n|4n<<120n}}function l(e,o){let t=e.potMinBuyQuote>>114n&3n,n=e.potMinBuyQuote>>116n&15n;return`Sandwich Guard: window ${t+1n} execution blocks (ArbSys clock on chain 4663) after the launch guard, at most ${n*10000n} gross quote pips on a price reversal toward the window opening; Hookr ${o} receives ceil(final carved charge * ${e.protocolShareBps}/10000) quote base units; ${e.royaltyTo} receives the remainder as a claim. Each carve is floor(total collected Rules quote fee * this charge pips / final quote-take pips); residual rounding stays with Hookr. Settlement can credit an authenticated wallet payer a reprice rebate; no rebate is promised.`}export{w as a,l as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I}from"./43LI5NKJ.js";import{b as G}from"./IX3GZMTM.js";import{b as r,k as p}from"./
|
|
1
|
+
import{a as I}from"./43LI5NKJ.js";import{b as G}from"./IX3GZMTM.js";import{b as r,k as p}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as T,erc20Abi as k,getAddress as h,parseAbi as F}from"viem";var f=F(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256)"]);function N(e){if(typeof e!="string")throw new n("Amount must be a positive base-unit integer string.");let a=G(e);if(a<=0n||a>=1n<<256n)throw new n("Amount must be positive and fit uint256.");return a}function E(e){if(typeof e!="bigint"||e<0n||e>=1n<<256n)throw new n("Invalid vault amount read.");return e}function J(e,a,o){return["mint",a==="steakhouse"?"redeem":"withdraw_assets"].map(v=>{let t=v==="mint",w=v==="redeem",d=t||w?"shares":"amount",q=l=>({type:"string",pattern:"^[0-9]+$",description:l}),M=t?'Exact vault shares to mint, in base units (shares have 18 decimals). Example: "1000000000000000000" = 1 share.':'Vault shares to redeem for USDG, in base units (shares have 18 decimals). Example: "1000000000000000000" = 1 share.',O='Amount of USDG to receive, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.';return{name:`${a}_${v}`,inputSchema:{type:"object",additionalProperties:!1,required:t?["shares","maxAssets"]:[d],properties:{[d]:q(d==="shares"?M:O),...t?{maxAssets:q('Most USDG you will pay for these shares, in base units (USDG has 6 decimals). The call fails if the quote is higher. Example: "1000000" = 1 USDG.')}:{}}},execute:async(l,i)=>{try{if(I(i),Object.keys(l).some(x=>![d,...t?["maxAssets"]:[]].includes(x)))throw new n("Unexpected vault amount argument.");let s=N(l[d]),P=t?N(l.maxAssets):void 0,c=e.clientFor(r);if(await c.getChainId()!==r)throw new n("Vault amount actions require chain 4663.");let[S,R,V]=await Promise.all([c.readContract({address:o,abi:f,functionName:"asset"}),c.readContract({address:o,abi:f,functionName:"decimals"}),c.readContract({address:h(p),abi:k,functionName:"decimals"})]);if(typeof S!="string"||h(S)!==h(p)||R!==18||V!==6)throw new n("Vault amount actions require canonical USDG and the evidenced 18-decimal shares.");let m=E(await c.readContract({address:o,abi:f,functionName:t?"previewMint":w?"previewRedeem":"previewWithdraw",args:[s]}));if(m===0n)throw new n("The vault returned a zero amount quote.");if(t&&m>P)throw new n("The mint quote exceeds maxAssets.");let U=t?void 0:E(await c.readContract({address:o,abi:k,functionName:"balanceOf",args:[i]}));if(!t&&(w?s:m)>U)throw new n("The wallet share balance cannot cover this exit.");let _=t?T({abi:f,functionName:"mint",args:[s,i]}):w?T({abi:f,functionName:"redeem",args:[s,i,i]}):T({abi:f,functionName:"withdraw",args:[s,i,i]}),$=`${v} ${s} ${d==="shares"?"18-decimal share":"6-decimal USDG"} base units from ${a}; beneficiary ${i}.`,C=[...t?[e.approval(h(p),o,m.toString(),r)]:[],e.unsignedTx({to:o,data:_,value:"0",chainId:r,description:$})],y=await e.preview(C,i),D={address:h(p),chainId:r,symbol:"USDG",decimals:6},b={address:h(o),chainId:r,symbol:`${a} shares`,decimals:18},u=x=>y.changes.filter(g=>g.token.chainId===r&&g.token.address.toLowerCase()===x.address.toLowerCase()).reduce((g,A)=>{if(A.token.decimals!==x.decimals||!/^-?\d+$/.test(A.amount))throw new n("Invalid vault preview metadata.");return g+BigInt(A.amount)},0n);if(t?u(D)!==-m||u(b)!==s:w?u(b)!==-s||u(D)<=0n:u(D)!==s||-u(b)<=0n||-u(b)>U)throw new n("The preview does not match the requested vault amount and share balance.");return{txs:C,preview:y,summary:`${$} Quoted counterpart ${m} base units. ${y.summary} Standard ERC-4626 encodes no receipt minimum. Mint approvals use the exact current quote; accrual can require a new quote. Plain exits depend on available liquidity; use a separately previewed full force exit if required.`}}catch(s){throw new n(e.plainError(s))}}}})}export{J as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as W}from"./
|
|
1
|
+
import{b as W}from"./XSQJOOEY.js";import{a as b,b as P}from"./G2AA73ZE.js";import{fa as F,ga as G,ja as A}from"./HHYE42JG.js";import{a as M,b as U}from"./IBL6TL2Q.js";import{g as $,i as T,m as I,n as O}from"./NWNYJ26T.js";import{d as V}from"./IX3GZMTM.js";import{b as v}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as R}from"viem";var j={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; use vault if discovery is unavailable or ambiguous."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address verified on chain on every call; required for a rebuild without HTTP."}};function E(r){return{type:"object",additionalProperties:!1,properties:{...j,amount:{type:"string",pattern:r==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}},required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}}function H(r){return O(r,"Borro amount must be positive and fit uint256.",{positive:!0,notString:"Borro amount must be an integer string in asset base units."})}function B(r){return I(r,"Borro returned an invalid uint256 read.")}var L=r=>r*9950n/10000n,Z=new WeakMap;function oe(r,o){Z.set(r,{...o})}async function K(r,o,h,i=W){let k=await i(r,o).catch(()=>({kind:"unknown"})),f=k.kind!=="unknown"&&"readyBase"in k?k.readyBase:void 0,l=typeof f=="bigint"&&f>=0n&&f<1n<<256n?f:void 0,g=y=>V(y.toString(),o.assetDecimals);return{ready:l,...l!==void 0&&l<h?{refusal:A("too-little-ready",{ready:g(l),requested:g(h),maxNow:g(l),symbol:o.symbol})}:{}}}function z(r,o,h,i,k){let f=0n,l=0n;for(let g of r.changes){let y=g.token;if(typeof g.amount!="string"||!/^-?\d+$/.test(g.amount))throw new n("Borro preview returned invalid token changes. Nothing was signed.");let e=BigInt(g.amount);B(e<0n?-e:e);let d=$(y.address,o.address)?o:$(y.address,i.address)?i:void 0;if(!d||y.chainId!==v||y.decimals!==d.decimals)throw new n("Borro preview showed an unexpected token movement. Nothing was signed.");if(d===o){if(e>0n)throw new n("Borro preview showed a reversed input movement. Nothing was signed.");f-=e}else{if(e<0n)throw new n("Borro preview showed a reversed output movement. Nothing was signed.");l+=e}}if(B(f),B(l),f!==h||l<k||l===0n)throw new n("Borro preview did not match the requested receipt. Nothing was signed.")}var re=r=>{let{client:o,context:h,wallet:i}=r;async function k(e,d,s){if(T(s,"Provide a valid wallet address."),!$(s,i))throw new n("Borro action wallet differs from the signing wallet. Nothing was signed.");if(h.network==="testnet"||await o.getChainId()!==v)throw new n("Borro requires chain 4663. Nothing was signed.");if(Object.keys(e).some(m=>!["asset","vault","amount"].includes(m)))throw new n("Unsupported Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)||/^0x/i.test(e.asset)))throw new n("Provide an asset symbol, or put the vault address in vault.");let w=e.vault===void 0?void 0:T(e.vault,"Provide a valid Borro vault address.");if(!w&&e.asset===void 0)throw new n("Provide an asset symbol or a vault address.");let t=w?await r.verifyVault(o,w,d,{wallet:i}):await r.resolveVault(o,{asset:e.asset},d,i);if(w&&!$(w,t.vault)||e.asset!==void 0&&e.asset.toUpperCase()!==t.symbol.toUpperCase())throw new n("Borro vault and asset selectors do not match. Nothing was signed.");if(T(t.vault,"Borro returned an invalid vault address."),T(t.asset,"Borro returned an invalid asset address."),t.chainId!==v||t.shareDecimals!==18||$(t.asset,t.vault)||!Number.isInteger(t.assetDecimals)||t.assetDecimals<0||t.assetDecimals>255||t.mode!==d)throw new n(A("setup-mismatch",{}));let a=await r.verifySetup(o,t,d);if(!a.ok||d==="deposit"&&(!t.assetAllowed||a.drift.length>0))throw new n(A("setup-mismatch",{}));return{...t,setup:a}}function f(e){let d=e.mode==="withdraw"&&!/^[A-Za-z0-9.$_-]{1,16}$/.test(e.symbol)?"token":e.symbol;return{asset:{address:T(e.asset,"Borro returned an invalid asset."),symbol:d,decimals:e.assetDecimals,chainId:v},share:{address:T(e.vault,"Borro returned an invalid vault."),symbol:e.vaultSymbol,decimals:18,chainId:v}}}let l=(e,d)=>h.formatAmount(e.toString(),d),g="The minimum is checked in the preview; standard ERC-4626 calldata does not enforce it on chain. Re-preview before signing; execution output can change.",y=[{name:"borro_deposit",inputSchema:E("deposit"),execute:async(e,d)=>{let s=H(e.amount),w=await k(e,"deposit",d),{asset:t,share:a}=f(w),m=B(await o.readContract({address:t.address,abi:b,functionName:"balanceOf",args:[i]}));if(s>m)throw new n("This wallet does not hold enough of that asset for the Borro deposit.");let p=B(await o.readContract({address:a.address,abi:b,functionName:"previewDeposit",args:[s]}));if(p===0n)throw new n(A("deposit-would-revert",{}));let c=w.builderEligible===!0,u=Z.get(e);if(u&&(!c||!$(u.token,a.address)||!$(u.recipient,i)||u.minimum<=0n||u.minimum>p))throw new n(A("deposit-would-revert",{}));let S=u?.minimum??L(p),C=c?M.builders.address:a.address,N=[h.approval(t.address,C,s.toString(),v),h.unsignedTx({to:C,data:c?R({abi:P,functionName:"deposit",args:[a.address,s,U,S]}):R({abi:b,functionName:"deposit",args:[s,i]}),value:"0",chainId:v,description:`Deposit ${s} asset base units into Borro vault ${a.address}.`})],x;try{x=await h.preview(N,i),z(x,t,s,a,S)}catch{throw new n(A("deposit-would-revert",{}))}let D=w.deployedAt===void 0?void 0:Date.parse(w.deployedAt)/1e3,_=F({viaBuilder:c,amount:l(s,t.decimals),symbol:t.symbol,kind:t.symbol==="USDG"?"usdg":"stock",shares:l(p,18),sharesMin:l(S,18),vaultSymbol:a.symbol,deployedAtSeconds:D,nowSeconds:Math.floor(Date.now()/1e3)});return{txs:N,preview:x,vault:a.address,asset:t,shareToken:a,amount:s.toString(),shares:p.toString(),shares_min:S.toString(),summary:`${_}
|
|
2
2
|
Base units: amount ${s} (${t.address}, decimals ${t.decimals}); shares ${p} (${a.address}, decimals 18); shares_min ${S}.`}}},{name:"borro_withdraw",inputSchema:E("withdraw"),execute:async(e,d)=>{let s=e.amount==="max",w=s?void 0:H(e.amount),t=await k(e,"withdraw",d),{asset:a,share:m}=f(t),p=B(await o.readContract({address:m.address,abi:b,functionName:"balanceOf",args:[i]}));if(p===0n)throw new n(A("no-shares",{symbol:a.symbol}));let c=s?p:B(await o.readContract({address:m.address,abi:b,functionName:"previewWithdraw",args:[w]}));if(c===0n||c>p)throw new n("This wallet does not hold enough Borro shares for that withdrawal.");let u=w??B(await o.readContract({address:m.address,abi:b,functionName:"previewRedeem",args:[c]}));if(u===0n)throw new n("Borro preview returned no assets for these shares. Nothing was signed.");let{ready:S,refusal:C}=await K(o,{...t,symbol:a.symbol},u,r.readLiquidity);if(C!==void 0)return{txs:[],vault:m.address,asset:a,shareToken:m,amount:u.toString(),shares:c.toString(),max_now:S.toString(),summary:C};let N=s?L(u):u,x=[h.unsignedTx({to:m.address,data:s?R({abi:b,functionName:"redeem",args:[c,i,i]}):R({abi:b,functionName:"withdraw",args:[u,i,i]}),value:"0",chainId:v,description:`Withdraw ${u} asset base units from Borro vault ${m.address}${s?` for ${c} share base units`:""}.`})],D=s?await h.preview(x,i):await h.preview(x,i,{reads:[{to:m.address,data:R({abi:b,functionName:"previewWithdraw",args:[u]}),chainId:v}]});if(!s){let q=D.readResults?.[0];if(D.readResults?.length!==1||typeof q!="string"||!/^0x[0-9a-fA-F]{64}$/.test(q))throw new n("Borro preview returned an invalid share quote. Nothing was signed.");if(c=B(BigInt(q)),c===0n||c>p)throw new n("This wallet does not hold enough Borro shares for that withdrawal.")}z(D,m,c,a,N);let _=G({amount:l(u,a.decimals),isAll:s,symbol:a.symbol,out:l(u,a.decimals),shares:l(c,18),vaultSymbol:m.symbol,drift:t.setup.drift.length>0});return{txs:x,preview:D,vault:m.address,asset:a,shareToken:m,amount:u.toString(),shares:c.toString(),assets_min:N.toString(),isMax:s,setup:t.setup,summary:`${_}
|
|
3
3
|
Base units: amount ${u} (${a.address}, decimals ${a.decimals}); shares ${c} (${m.address}, decimals 18); assets_min ${N}. ${g}`}}}];for(let e of y){let d=e.execute;e.execute=async(s,w)=>{try{return await d(s,w)}catch(t){throw new n(h.plainError(t))}}}return y};export{oe as a,K as b,re as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as q,h as I,i as p,j as P,m as j,n as O,p as f,q as k,v as $}from"./UMY6SP7C.js";import{b as h,i as T,j as A,k as v}from"./CJMVRV34.js";import{a as s}from"./XSD5NL7J.js";import{a as H}from"./JXOEJPJ4.js";import{encodeFunctionData as R,getAddress as F,isAddress as U,parseAbi as M}from"viem";var _=M(["function poolConfig(bytes32 id) view returns ((address subject,address quote,address rules,address advisory,address liquidityOwner,uint24 baseLpFeePips,(uint24 maxLpFeePips,uint24 maxQuoteTakePips,uint16 maxSubjectTakeBps) caps,uint32 rulesGasLimit,uint32 advisoryGasLimit,uint8 advisoryPhases,bool advisoryFailOpen,bytes32 policyId) pc)"]),L=M(["function claimable(address currency,address beneficiary) view returns (uint256)","function claim(address currency) returns (uint256)"]),N={type:"object",additionalProperties:!1,properties:{poolId:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Pool ID on the current Hookr Root and core."},currency:{type:"string",enum:["quote","subject"],description:"Which currency of this pool to claim."}},required:["poolId","currency"]};async function S(t,y,a){let e=q(y,["poolId","currency"],["poolId","currency"]),u=I(e.poolId);if(e.currency!=="quote"&&e.currency!=="subject")throw new s("Choose the Hookr pool quote or subject currency.");if(t.network==="testnet")throw new s("Hookr claims require Robinhood Chain 4663.");if(!U(a))throw new s("A valid signing wallet is required for Hookr claims.");let d=F(a),c=F(h.rulesV1),n=t.clientFor(4663),o=await A(n);await T(n,o.number,[k,c,h.poolManager]);let b=j(await f(n,k,_,"poolConfig",[u],o.number));if(p(b.rules)!==c)throw new s("This pool does not use the reviewed current Hookr core.");let w=p(b.subject),g=p(b.quote);if(w===g)throw new s("Hookr pool currencies are invalid.");let l=e.currency==="quote"?g:w,[B,m]=await Promise.all([f(n,c,L,"claimable",[l,d],o.number),$(n,l,o.number)]),i=P(B),x=(1n<<127n)-1n,r=i>x?x:i,C=`${r?"Claim":"Nothing to claim:"} ${r} base units of ${H(m.symbol)} (${m.address}, ${m.decimals} decimals) for ${d}. Current core claim ledger is per currency and wallet, and can include prizes, royalties and recapture credits from multiple pools. ${i>r?`The remaining ${i-r} base units stay in the ledger.`:""}`,D=r?[t.unsignedTx({to:c,data:R({abi:L,functionName:"claim",args:[l]}),value:"0",chainId:4663,description:C})]:[];return await v(n,o),{txs:D,inputs:[],summary:C,terms:O({poolId:u,poolCurrency:e.currency,currency:l,token:m,beneficiary:d,recipient:d,claimable:i,amount:r,remaining:i-r,blockNumber:o.number,blockHash:o.hash,core:c})}}function Q(t){return{name:"hookr_claim",inputSchema:N,async execute(y,a){let e=await S(t,y,a),u=e.txs.length?await t.preview(e.txs,a):{txs:[],changes:[],summary:e.summary};return{...e,preview:u}}}}export{L as a,N as b,S as c,Q as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as D}from"./IX3GZMTM.js";import{b as d}from"./
|
|
1
|
+
import{b as D}from"./IX3GZMTM.js";import{b as d}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{concat as B,encodeAbiParameters as k,getAddress as v,isAddress as F,keccak256 as g,parseAbiParameters as O,recoverAddress as q,toHex as N}from"viem";import{privateKeyToAccount as U}from"viem/accounts";var T="OakPriceNote",l="1",w=300,E="0x0000000000000000000000000000000000000000",W=g(N("PriceNote(address wallet,uint256 oakPerEthE18,uint64 timestamp,bytes32 nonce)")),L=g(N("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")),M=(1n<<64n)-1n,P=(1n<<256n)-1n,z=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,G=0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;function X(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e))return!1;let n=BigInt(`0x${e.slice(2,66)}`),t=BigInt(`0x${e.slice(66,130)}`),i=Number.parseInt(e.slice(130,132),16);return!(i!==27&&i!==28||n<=0n||n>=z||t<=0n||t>G)}function m(e,n){if(typeof e!="string"||!F(e,{strict:!1}))throw new c(`Invalid ${n} address.`);return v(e)}function p(e,n){let t;if(typeof e=="bigint")t=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new c(`Invalid ${n}.`);t=BigInt(e)}else t=D(e);if(t<0n||t>P)throw new c(`${n} exceeds uint256 bounds.`);return t}function h(e,n){let t=p(e,n);if(t>M)throw new c(`${n} exceeds uint64 bounds.`);return t}function Y(e,n){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new c(`${n} must be a 32-byte hex string.`);return e}function j(e){if(typeof e=="bigint"){if(e<=0n||e>P)throw new c("Private key must be a positive scalar.");return`0x${e.toString(16).padStart(64,"0")}`}if(typeof e=="string"&&/^0x[0-9a-fA-F]{1,64}$/.test(e))return`0x${e.slice(2).padStart(64,"0")}`;throw new c("Invalid private key format.")}function K(e){let n=p(e.chainId,"chainId"),t=m(e.verifyingContract,"verifyingContract");return g(k(O("bytes32, bytes32, bytes32, uint256, address"),[L,g(N(e.name)),g(N(e.version)),n,t]))}function ae(e,n=d,t=l){return{name:T,version:t,chainId:Number(p(n,"chainId")),verifyingContract:m(e,"consumer")}}function J(e,n=d,t=l){return K({name:T,version:t,chainId:n,verifyingContract:e})}function Q(e){let n=m(e.wallet,"wallet"),t=p(e.oakPerEthE18,"oakPerEthE18"),i=h(e.timestamp,"timestamp"),r=Y(e.nonce,"nonce");return g(k(O("bytes32, address, uint256, uint64, bytes32"),[W,n,t,i,r]))}function C(e,n,t=d,i=l){let r=J(n,t,i),o=Q(e);return g(B(["0x1901",r,o]))}async function ce(e,n,t,i=d,r=l){let o=C(e,n,i,r);return typeof t=="object"&&t!==null&&"sign"in t?t.sign({hash:o}):U(j(t)).sign({hash:o})}async function Z(e,n,t,i=d,r=l){if(!X(n))return E;try{let o=C(e,t,i,r),x=await q({hash:o,signature:n});return v(x)}catch{return E}}function ee(e,n){let t=p(e,"oakPerEthE18"),i=p(n,"spotOakPerEthE18");if(i<=0n||t<=0n)return!1;if(t>P/2n||i>P/3n)throw new c("Guard arithmetic overflow.");let r=t*2n;return r>=i&&r<=i*3n}function te(e,n,t,i){if("signature"in e&&"consumer"in e&&"note"in e&&!("average"in e))return e;if("note"in e&&"signature"in e&&"consumer"in e){let a=e,f=n??{};return{...f,note:a.note,signature:a.signature,consumer:f.consumer??a.consumer,expiresAt:f.expiresAt??a.expiresAt}}return{...i??{},note:e,signature:n,consumer:t}}async function fe(e,n,t,i){let r=te(e,n,t,i),{note:o,signature:x,consumer:S}=r,a=h(o.timestamp,"timestamp"),f=p(o.oakPerEthE18,"oakPerEthE18"),y=(a+BigInt(w)).toString(),s=(b,V,H)=>({valid:!1,ok:!1,...H?{signer:H}:{},oakPerEthE18:f.toString(),expiresAt:y,reason:b,error:V}),I=r.wallet??r.boundWallet;if(I===void 0)return s("wrong_wallet","Bound wallet context is required to verify a price note.");if(m(o.wallet,"wallet")!==m(I,"boundWallet"))return s("wrong_wallet","Price note wallet does not match the bound wallet.");if(r.now===void 0)return s("expired","Current time (now) is required to verify price note expiry.");let A=h(r.now,"now");if(a>A)return s("not_yet_valid","Price note timestamp is in the future.");if(A-a>BigInt(w))return s("expired","Price note has expired.");if(r.expiresAt!==void 0){let b=h(r.expiresAt,"expiresAt");if(b!==a+BigInt(w)||A>b)return s("expired","Price note has expired.")}let R=r.chainId??d,$=r.version??l,u=await Z(o,x,S,R,$);if(u===E)return s("bad_signature","Price note signature could not be recovered.");if(r.signer===void 0)return s("bad_signature","Expected oracle signer is required to verify a price note.",u);let _=m(r.signer,"signer");return _===E||u!==_?s("bad_signature","Price note signer does not match the oracle signer.",u):r.spotOakPerEthE18===void 0?s("outside_guard","Spot OAK/ETH price is required to verify the price note guard band.",u):ee(f,r.spotOakPerEthE18)?{valid:!0,ok:!0,signer:u,oakPerEthE18:f.toString(),expiresAt:y}:s("outside_guard","Price note is outside the 50% spot guard band.",u)}export{T as a,l as b,w as c,E as d,W as e,K as f,ae as g,J as h,Q as i,C as j,ce as k,Z as l,ee as m,fe as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,b as T,f as c,g as v,i as E}from"./
|
|
1
|
+
import{a as f,b as T,f as c,g as v,i as E}from"./PG7HZIZL.js";import{c as a,g as O}from"./NWNYJ26T.js";import{b as m}from"./EWZFZUVF.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as $,parseAbi as x}from"viem";var F=["function owner() view returns (address)","function admins(address) view returns (bool)","function allowedDepositors(address) view returns (bool)","function setAdmin(address,bool)","function setDeprecated(bool)","function setTeamFeeRecipient(address)","function claimTeamFees(address)","function setHook(address,bool)","function setLocker(address,address,bool)","function setMevModule(address,bool)","function setExtension(address,bool)","function addDepositor(address)","function storeFees(address,address,uint256)","function claim(address,address)","function withdrawETH(address)","function withdrawERC20(address,address)","function transferOwnership(address)","function renounceOwnership()"],h=x(F),g={setAdmin:{contract:"factory",fields:["target","enabled"],admin:!1},setDeprecated:{contract:"factory",fields:["enabled"],admin:!1},setTeamFeeRecipient:{contract:"factory",fields:["recipient"],admin:!1},claimTeamFees:{contract:"factory",fields:["token"],admin:!0},setHook:{contract:"factory",fields:["target","enabled"],admin:!0},setLocker:{contract:"factory",fields:["target","hook","enabled"],admin:!0},setMevModule:{contract:"factory",fields:["target","enabled"],admin:!0},setExtension:{contract:"factory",fields:["target","enabled"],admin:!0},addDepositor:{contract:"fee_locker",fields:["target"],admin:!1},withdrawETH:{contract:"locker",fields:["recipient"],admin:!1},withdrawERC20:{contract:"locker",fields:["token","recipient"],admin:!1}},N=p=>{let w=()=>p.clientFor(m),k=async(e,t,o)=>({txs:e,preview:await p.preview(e,t),summary:o}),y=(e,t,o,r)=>p.unsignedTx({to:e,chainId:m,data:$({abi:h,functionName:t,args:o}),value:"0",description:r}),_={operation:{enum:[...Object.keys(g),"transferOwnership","renounceOwnership"],description:"Owner or admin call on a pinned Clanker contract: toggle admins, hooks, lockers, MEV modules, extensions or depositors, claim team fees, withdraw assets, or change ownership."},contract:{enum:["factory","locker","fee_locker"],description:"Which pinned Clanker contract to call; required only for transferOwnership and renounceOwnership, otherwise implied by the operation."},target:{...a,description:"Address of the admin, hook, locker, MEV module, extension or depositor being configured."},hook:{...a,description:"Address of the pool hook the locker is enabled for; used by setLocker."},token:{...a,description:"Address of the ERC-20 token to claim team fees on or withdraw."},recipient:{...a,description:"Address that receives funds, the new fee recipient, or the new owner, depending on the operation."},enabled:{type:"boolean",description:"True to enable (or deprecate, for setDeprecated) the target; false to disable."}},b=(e,t,o,r)=>({name:`clanker_${e}`,inputSchema:{type:"object",properties:t,required:o,additionalProperties:!1},execute:async(n,i)=>{try{return E(n,Object.keys(t)),await r(n,c(i))}catch(d){throw new s(p.plainError(d))}}});return{tools:[b("protocol_admin",_,["operation"],async(e,t)=>{let o=String(e.operation),r=o==="transferOwnership"||o==="renounceOwnership";if(!r&&!Object.hasOwn(g,o))throw new s("Choose a supported Clanker protocol operation.");let n=r?void 0:g[o],i=n?.contract??e.contract;if(i!=="factory"&&i!=="locker"&&i!=="fee_locker")throw new s("Select factory, locker or fee_locker for an ownership change.");if(!r&&e.contract!==void 0&&e.contract!==i)throw new s("This operation targets a different pinned contract.");let d=n?.fields??(o==="transferOwnership"?["recipient"]:[]);for(let l of["target","hook","token","recipient","enabled"])if(e[l]!==void 0&&!d.includes(l))throw new s(`Input ${l} does not match this protocol operation.`);let u=f[i].address,D=c(await w().readContract({address:u,abi:h,functionName:"owner"}),!0);if(!O(D,t)&&(n?.admin&&await w().readContract({address:u,abi:h,functionName:"admins",args:[t]}))!==!0)throw new s("The connected wallet lacks the required Clanker protocol owner/admin role.");let A=d.map(l=>{if(l!=="enabled")return c(e[l]);if(typeof e.enabled!="boolean")throw new s("Provide enabled as boolean.");return e.enabled}),C=`Clanker protocol ${i}: ${o} ${JSON.stringify(A)}. Owner/admin operation; renouncing ownership permanently removes owner-only controls. Withdrawals transfer the entire recorded asset balance; team fees go to the configured team recipient.`;return k([y(u,o,A,C)],t,C)}),b("store_fees",{token:{...a,description:"Address of the ERC-20 token whose fees are deposited."},recipient:{...a,description:"Address of the fee owner who can later claim these fees."},amount:{...T,description:'Amount of the token to deposit, in base units of that token (read its decimals). Example: "1000000000000000000" = 1 token at 18 decimals.'}},["token","recipient","amount"],async(e,t)=>{let o=c(e.token),r=c(e.recipient),n=v(e.amount);if(!n)throw new s("Provide a positive fee deposit amount.");if(await w().readContract({address:f.fee_locker.address,abi:h,functionName:"allowedDepositors",args:[t]})!==!0)throw new s("This wallet is not an authorized Clanker fee depositor.");let d=`Deposit exactly ${n} base units of token ${o} into Clanker fees for ${r}. Fee-on-transfer receipts may be smaller; the recorded recipient can later claim them.`,u=[p.approval(o,f.fee_locker.address,n.toString(),m),y(f.fee_locker.address,"storeFees",[r,o,n],d)];return k(u,t,d)}),b("claim_for",{token:{...a,description:"Address of the fee token to claim for the owner."},recipient:{...a,description:"Address of the fee owner whose collected fees are claimed; receipts go to this address."}},["token","recipient"],async(e,t)=>{let o=c(e.token),r=c(e.recipient),n=`Permissionlessly claim already-collected Clanker ${o} fees for ${r}; all receipts go to that fee owner, while ${t} pays gas.`;return k([y(f.fee_locker.address,"claim",[r,o],n)],t,n)})]}};export{N as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as D}from"./
|
|
1
|
+
import{c as D}from"./NLC36QHL.js";import{b as O,g as M,i as A,j as B,k as T,l as P,m as I,n as U,r as k,s as F,v as f,x as z}from"./Y64GFBTA.js";import{a as w,e as _}from"./NWNYJ26T.js";import{b as y}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";function $(u){return{...u,token:{...u.token,symbol:f(u.token.symbol)??"unknown"}}}var Q=u=>{let N=z(u);async function G(t,r){let g=T(r),i=I(t.originChainId),e=I(t.destinationChainId);if(i!==y&&e!==y)throw new d(`A Relay quote must start or end on chain ${y}.`);let h=P(t.originCurrency??O),b=P(t.destinationCurrency??O),c=T(t.recipient??g),a=U(t.amount);if(a==="0")throw new d("Provide a positive bridge amount.");let n=t.tradeType??"EXACT_INPUT";if(!["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"].includes(String(n)))throw new d("Choose EXACT_INPUT, EXACT_OUTPUT or EXPECTED_OUTPUT.");let m={};for(let E of["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"]){let p=t[E];if(p!==void 0){if(!Array.isArray(p)||p.length>100||p.some(j=>typeof j!="string"||!/^[A-Za-z0-9._ -]{1,128}$/.test(j)))throw new d("Provide valid Relay swap source names.");m[E]=p}}let S=await N("/quote/v2",{user:g,recipient:c,originChainId:i,destinationChainId:e,originCurrency:h,destinationCurrency:b,amount:a,tradeType:n,...m}),o=A(S.details),l=$(k(o.currencyIn)),s=$(k(o.currencyOut)),C=U(A(o.currencyOut).minimumAmount);F(T(o.sender)===g&&T(o.recipient)===c&&l.token.chainId===i&&l.token.address===h&&(n==="EXACT_INPUT"?l.amount===a:s.amount===a)&&s.token.chainId===e&&s.token.address===b&&BigInt(C)<=BigInt(s.amount));let H=Object.fromEntries(Object.entries(A(S.fees)).map(([E,p])=>[E,$(k(p))])),R=typeof o.timeEstimate=="number"&&Number.isFinite(o.timeEstimate)&&o.timeEstimate>=0?o.timeEstimate:void 0,v=M(S.fees),X=e===y,x=X?"relay_bridge_in":"relay_bridge_out",q=n==="EXACT_INPUT"&&Object.keys(m).length===0&&i!==e&&(!X||D(i)!==void 0);return{executable:!1,nextAction:q?x:void 0,originChainId:i,destinationChainId:e,recipient:c,tradeType:n,amountIn:l,amountOut:s,minAmountOut:{token:s.token,amount:C},fees:H,...v,slippage:{source:"provider",minimumAmount:C},...R===void 0?{}:{timeEstimateSeconds:R},summary:`${v.feeDisclosure} Read-only Relay estimate: ${l.amount} base units of ${l.token.symbol} (${l.token.decimals} decimals) on chain ${i} for about ${s.amount}, minimum ${C}, base units of ${s.token.symbol} (${s.token.decimals} decimals) on chain ${e} for ${c}. Slippage: selected by Relay; Oak sent no slippage setting. The returned minimum above is the quote floor. Relay fees are already deducted from the output; origin gas is separate. Nothing was built or signed, and this estimate cannot be executed. ${q?`To bridge, call ${x}; it fetches a fresh quote and shows its own preview for human confirmation.`:"This estimate shape has no matching Oak execution path. No action will preserve these trade type or routing options."}`}}async function Z(t){let r=t.chainId===void 0?void 0:I(t.chainId),i=B((await N("/chains")).chains).map(A).flatMap(e=>{if(typeof e.id!="number"||!Number.isSafeInteger(e.id)||e.id<=0)return[];if(r!==void 0&&e.id!==r)return[];let h=e.disabled===!1,b=_(e.currency)?e.currency:{},c={chainId:e.id,name:f(e.displayName,"name")??f(e.name,"name")??String(e.id),vmType:f(e.vmType),nativeCurrency:{symbol:f(b.symbol),decimals:typeof b.decimals=="number"?b.decimals:void 0},bridgeIn:e.id!==y&&h&&D(e.id)!==void 0,bridgeOut:e.id!==y&&h&&e.vmType==="evm"};if(r===void 0)return[c];let a=new Map;for(let n of[...Array.isArray(e.featuredTokens)?e.featuredTokens:[],...Array.isArray(e.erc20Currencies)?e.erc20Currencies:[]]){if(!_(n)||typeof n.address!="string"||!new RegExp(w).test(n.address)||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)continue;let m=T(n.address);a.has(m)||a.set(m,{address:m,symbol:f(n.symbol)??"unknown",decimals:n.decimals,bridgeable:n.supportsBridging===!0})}return[{...c,currencies:[...a.values()]}]});if(r!==void 0&&!i.length)throw new d(`Relay does not list chain ${r}.`);return{chains:i,summary:`${i.length} Relay chain${i.length===1?"":"s"}. bridgeIn marks origins relay_bridge_in can build from; bridgeOut marks destinations relay_bridge_out can reach. Currency lists are Relay-reported display data; bridgeable false means Relay does not bridge that token. Confirm token addresses before bridging.`}}return{tools:[{name:"relay_quote",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","destinationChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{type:"integer",minimum:1,description:"Destination chain ID."},originCurrency:{type:"string",pattern:w,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{type:"string",pattern:w,description:"Destination token address; defaults to the destination chain\u2019s native token."},amount:{type:"string",pattern:"^[1-9][0-9]*$",description:'Input token amount for EXACT_INPUT, otherwise output token amount, in base units using that token\u2019s decimals (USDG has 6: "1000000" = 1 USDG).'},recipient:{type:"string",pattern:w,description:"Destination recipient address; defaults to your wallet."},tradeType:{type:"string",enum:["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"],description:"EXACT_INPUT fixes input; EXACT_OUTPUT fixes output; EXPECTED_OUTPUT targets output."},...Object.fromEntries(["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"].map(t=>[t,{type:"array",description:t==="excludedSwapSources"?"Swap sources to exclude.":t==="includedOriginSwapSources"?"Origin swap sources to include.":t==="includedDestinationSwapSources"?"Destination swap sources to include.":"Swap sources to include.",maxItems:100,items:{type:"string",pattern:"^[A-Za-z0-9._ -]{1,128}$"}}]))}},execute:async(t,r)=>{try{return await G(t,r)}catch(g){throw new d(u.plainError(g))}}},{name:"relay_chains",inputSchema:{type:"object",additionalProperties:!1,properties:{chainId:{type:"integer",minimum:1,description:"Filter by chain ID."}}},execute:async t=>{try{return await Z(t)}catch(r){throw new d(u.plainError(r))}}}]}};export{Q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as s,f as C,i as k}from"./CJMVRV34.js";import{a as x}from"./B7WZJHIJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeAbiParameters as F,getAddress as c,keccak256 as D,parseAbi as Z,zeroAddress as m,zeroHash as E}from"viem";var q="0x167ba3b15d65044b17c87154087d35fc5efde07538be66b804a54e63d6089136",N="0xc6848895ec12bfc54b1d011fdda88ab892250ccd0910f40dcf2025e17ac3225d",U=c(s.agentGateV2),M=c("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),K=c("0x8004BAa17C55a88189AE136b182e5fdA19dE9b63"),L=c("0x58daec3116aae6D93017bAAea7749052E8a04fA7"),j={schemaHash:q,termsBytes:160,healthFunction:"retired",supportsAge:!1,abi:x.agentGateV1.abi},Y={schemaHash:N,termsBytes:192,healthFunction:"suspended",supportsAge:!0,abi:x.agentGateV2.abi},ee=[{...j,address:c(s.agentGateV1),listed:!0,warning:null},{...Y,address:U,listed:!0,warning:null}],$=x.registry.abi,te=Z(["function isRevokedAdmission(address scope,address implementation) view returns (bool)"]),f=e=>{if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e))throw new o("Hookr address read is incomplete.");return c(e)},d=(e,t=256)=>{if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new o("Hookr integer read is incomplete.");let i=BigInt(e);if(i<0n||i>=1n<<BigInt(t))throw new o("Hookr integer read is outside its ABI bounds.");return i},_=e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new o("Hookr admission read is incomplete.");return e},u=e=>{if(typeof e!="boolean")throw new o("Hookr boolean read is incomplete.");return e};function re(e,t){let i=f(e),a=ee.find(n=>n.address===i);if(a){if(t!==void 0&&t!==a.schemaHash)throw new o("Hookr listed gate terms layout changed.");return a}let r=t===q?j:t===N?Y:void 0;if(!r)throw new o("Hookr gate terms layout is unknown. Update Oak before using this gate.");return{...r,address:i,listed:!1,warning:"new gate, Oak has not read its code"}}function ne(e,t,i,a){let r=_(e),n=_(r.caps),g=d(r.gasLimit,32);if(u(a)||f(r.implementation)!==t.address||r.codeHash!==i||r.schemaHash!==t.schemaHash||d(r.kind,8)!==1n||d(r.phaseMask,8)!==1n||u(r.failOpen)||g<400000n||g>2000000n||d(n.maxLpFeePips,24)>50000n||d(n.maxQuoteTakePips,24)!==0n||d(n.maxSubjectTakeBps,16)!==0n)throw new o("Hookr gate admission is revoked or differs from the supported fail-closed BEFORE_SWAP caps.");return u(r.feeOnly),r}async function de(e,t,i=U,a={}){let r=f(i);await k(e,t,[s.registry,s.rootV1]);let n=(w,h=[],v=x.agentGateV2.abi)=>e.readContract({address:r,abi:v,functionName:w,args:h,blockNumber:t}),[g,O]=await Promise.all([e.getCode({address:r,blockNumber:t}),n("configSchemaHash")]);if(!g||g==="0x"||g.startsWith("0xef0100"))throw new o("Hookr gate runtime is unavailable or delegated.");let y=D(g),p=re(r,O),l=C[r];if(l&&l.codeHash!==y)throw new o("Hookr listed gate runtime drifted. Refresh the reviewed pin.");p.listed&&await k(e,t,[r]);let[b,H,z,T,W,Q,G,X,P,J,R,S]=await Promise.all([n("identity"),n("reputation"),n("poolManager"),n(p.healthFunction,[],p.abi),n("MIN_ADVISORY_GAS"),n("MAX_ADVISORY_GAS"),n("linkOf",[m]),n("isAgent",[m]),n("reviewerSet",[E]),n("terms",[s.rootV1,E],p.abi),n("scoreOf",[m,E]),n("explainLiquidity",[s.rootV1,E,m])]);if(f(b)!==M||f(H)!==K||f(z)!==c(s.poolManager)||d(W)!==400000n||d(Q)!==2000000n)throw new o("Hookr gate dependency wiring or gas bounds changed.");if(u(T),u(X),!Array.isArray(G)||G.length!==2||!Array.isArray(P)||P.length!==2||!Array.isArray(P[0])||typeof P[1]!="string"||!Array.isArray(R)||R.length!==2||typeof R[1]!="bigint"||!Array.isArray(S)||S.length!==2)throw new o("Hookr gate expected read is incomplete.");u(G[0]),d(G[1]),u(R[0]),u(S[0]),d(S[1],8);let A=_(J);u(A.bound);for(let[w,h]of[["flags",16],["minScore",32],["tierScore",32],["tierPips",24]])d(A[w],h);if(f(A.launcher),f(A.curatedRouter),typeof A.reviewers!="string"||!/^0x[0-9a-fA-F]{64}$/.test(A.reviewers))throw new o("Hookr gate reviewer ID read is incomplete.");if(p.supportsAge){let[w,h,v]=await Promise.all([n("positionManager"),n("ageOf",[m]),n("pins")]);d(A.minAge,32),d(h);let I=_(v);if(f(w)!==L||["identityCode","identityVersion","reputationCode","reputationVersion"].some(B=>typeof I[B]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(I[B])))throw new o("Hookr gate position manager or registry pins are incomplete.");await k(e,t,[L,M,K])}let V=null;if(a.requireAdmission!==!1||!p.listed){let[w,h]=await Promise.all([e.readContract({address:c(s.registry),abi:$,functionName:"admission",args:[c(s.rootV1),r],blockNumber:t}),e.readContract({address:c(s.registry),abi:te,functionName:"isRevokedAdmission",args:[c(s.rootV1),r],blockNumber:t})]);V=ne(w,p,y,h)}return{profile:p,codeHash:y,admission:V,inactive:u(T),warnings:p.warning?[p.warning]:[]}}function ce(e,t){let i=[{type:"uint16"},{type:"uint32"},{type:"uint32"},{type:"uint24"},{type:"bytes32"}];if(!e.supportsAge&&(t.minAge??0)!==0)throw new o("The legacy Hookr gate has no link-age rule.");return e.supportsAge?F([...i,{type:"uint32"}],[t.flags,t.minScore,t.tierScore,t.tierPips,t.reviewers,t.minAge??0]):F(i,[t.flags,t.minScore,t.tierScore,t.tierPips,t.reviewers])}async function pe(e,t,i={}){await k(e,t,[s.registry,s.rootV1]);let a=await e.readContract({address:c(s.registry),abi:$,functionName:"activeLaneOf",args:[c(s.rootV1)],blockNumber:t});if(!Array.isArray(a)||a.length!==4||typeof a[1]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(a[1]))throw new o("Hookr active executor read is incomplete.");let r=f(a[0]),n=a[1],g=d(a[2],32),O=d(a[3],16),y=C[r],p=r===c(s.recaptureExecutor)&&y?.codeHash===n,l=r!==m&&p&&g>=50000n&&g<=5000000n&&O<=2500n;if(l){let H=await e.getCode({address:r,blockNumber:t});l=!!H&&H!=="0x"&&D(H)===n}let b=i.hint&&f(i.hint)!==r?["Hookr executor hint differs from the chain; the chain result is used."]:[];if(l||b.push("Arb recapture on is unavailable: active executor or its caps are not in Oak\u2019s reviewed list. Recapture off remains available."),i.required&&!l)throw new o(b.join(" "));return{address:r,codeHash:n,gasCap:g.toString(),partnerBps:O.toString(),listed:p,allowed:l,source:"source not public",warnings:b}}export{q as a,N as b,U as c,M as d,K as e,L as f,ee as g,re as h,ne as i,de as j,ce as k,pe as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as P,d as I,e as q,f as T,g as L}from"./
|
|
1
|
+
import{a as y,b as P,d as I,e as q,f as T,g as L}from"./PX2G2H6G.js";import{a as w}from"./66F5ZH34.js";import{c as k,g as D}from"./NWNYJ26T.js";import{b as f}from"./EWZFZUVF.js";import{a as c}from"./XSD5NL7J.js";import{encodeFunctionData as U,erc20Abi as $,getAddress as O,parseAbi as S,zeroAddress as g}from"viem";var _=O("0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f"),h=O("0x89e5db8b5aa49aa85ac63f691524311aeb649eba"),F=S(["function getPair(address,address) view returns (address)"]),N=S(["function token0() view returns (address)","function token1() view returns (address)","function getReserves() view returns (uint112,uint112,uint32)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)"]),E=S(["function factory() view returns (address)","function addLiquidity(address tokenA,address tokenB,uint256 amountADesired,uint256 amountBDesired,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256,uint256)","function removeLiquidity(address tokenA,address tokenB,uint256 liquidity,uint256 amountAMin,uint256 amountBMin,address to,uint256 deadline) returns (uint256,uint256)","function getAmountsOut(uint256 amountIn,address[] path) view returns (uint256[] amounts)","function getAmountsIn(uint256 amountOut,address[] path) view returns (uint256[] amounts)"]);async function z(s,p,t,n){if(p===g||t===g||p===t)throw new c("Provide two different ERC-20 tokens; use WETH for native ETH.");let r=s.clientFor(f),i=await r.getBlockNumber(),a=await r.readContract({address:_,abi:F,functionName:"getPair",args:[p,t],blockNumber:i}),[e,A]=await Promise.all([q(s,p,i),q(s,t,i)]);if(a===g)return{pair:a,tokenA:e,tokenB:A,reserveA:0n,reserveB:0n,supply:0n,balance:0n,blockNumber:i};let[M,l,v,B]=await Promise.all([r.readContract({address:a,abi:N,functionName:"token0",blockNumber:i}),r.readContract({address:a,abi:N,functionName:"getReserves",blockNumber:i}),r.readContract({address:a,abi:N,functionName:"totalSupply",blockNumber:i}),r.readContract({address:a,abi:$,functionName:"balanceOf",args:[n],blockNumber:i})]),[b,o]=D(M,p)?l:[l[1],l[0]];return{pair:a,tokenA:e,tokenB:A,reserveA:b,reserveB:o,supply:v,balance:B,blockNumber:i}}var H={tokenA:{...k,description:"Address of the first ERC-20 token."},tokenB:{...k,description:"Address of the second ERC-20 token."},amountADesired:w('Desired amount of tokenA in base units; use tokenA decimals. Example: "1000000" = 1 tokenA at 6 decimals.'),amountBDesired:w('Desired amount of tokenB in base units; use tokenB decimals. Example: "1000000" = 1 tokenB at 6 decimals.'),liquidity:{description:'LP token amount in base units (18 decimals), or "all" for the wallet balance. Example: "1000000000000000000" = 1 LP token.',type:"string",pattern:"^(?:[0-9]+|all)$"},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999},amountAMin:w('Minimum amount of tokenA in base units; use tokenA decimals. Example: "1000000" = 1 tokenA at 6 decimals.'),amountBMin:w('Minimum amount of tokenB in base units; use tokenB decimals. Example: "1000000" = 1 tokenB at 6 decimals.')};function J(s){let p=async(t,n,r)=>{L(n,t==="pool"?["tokenA","tokenB"]:["tokenA","tokenB","slippageBps","amountAMin","amountBMin",...t==="add"?["amountADesired","amountBDesired"]:["liquidity"]]);let i=P(n.tokenA),a=P(n.tokenB),e=await z(s,i,a,r);if(t==="pool")return{pair:e.pair,tokenA:e.tokenA,tokenB:e.tokenB,reserveA:e.reserveA.toString(),reserveB:e.reserveB.toString(),totalSupply:e.supply.toString(),balance:e.balance.toString(),blockNumber:e.blockNumber.toString(),initialized:e.pair!==g};let A=s.clientFor(f),M=I(n.slippageBps);if(!D(await A.readContract({address:h,abi:E,functionName:"factory"}),_))throw new c("Uniswap v2 router factory differs from its pinned deployment.");let l=(await A.getBlock()).timestamp+300n,v=[],B=(o,d,m)=>{let u=o===void 0?d*BigInt(1e4-M)/10000n:y(o,m,256,!0);if(u>d||d>0n&&u===0n)throw new c(`${m} must be positive and no more than the reserve-ratio estimate.`);return u},b;if(t==="add"){let o=y(n.amountADesired,"amountADesired"),d=y(n.amountBDesired,"amountBDesired");if(e.reserveA===0n!=(e.reserveB===0n))throw new c("Uniswap v2 pair reserves are inconsistent.");let m=o,u=d;if(e.reserveA>0n&&e.reserveB>0n){let R=o*e.reserveB/e.reserveA;R<=d?u=R:m=d*e.reserveA/e.reserveB}if(m===0n||u===0n)throw new c("Liquidity amounts round to zero at the pool reserve ratio.");let x=B(n.amountAMin,m,"amountAMin"),C=B(n.amountBMin,u,"amountBMin");v.push(s.approval(i,h,o.toString(),f),s.approval(a,h,d.toString(),f)),b=U({abi:E,functionName:"addLiquidity",args:[i,a,o,d,x,C,r,l]})}else{if(e.pair===g||e.supply===0n)throw new c("No Uniswap v2 liquidity exists for this pair.");let o=n.liquidity==="all"?e.balance:y(n.liquidity,"liquidity");if(o===0n||o>e.balance)throw new c("Removal exceeds the wallet LP token balance or is zero.");let[d,m]=await Promise.all([i,a].map(C=>A.readContract({address:C,abi:$,functionName:"balanceOf",args:[e.pair]}))),u=B(n.amountAMin,o*d/e.supply,"amountAMin"),x=B(n.amountBMin,o*m/e.supply,"amountBMin");v.push(s.approval(e.pair,h,o.toString(),f)),b=U({abi:E,functionName:"removeLiquidity",args:[i,a,o,u,x,r,l]})}return v.push(s.unsignedTx({to:h,data:b,value:"0",chainId:f,description:`${t} Uniswap v2 liquidity for ${i}/${a}; recipient ${r}; deadline ${l}.`})),T(s,v,r,`${t==="add"?"Add":"Remove"} v2 liquidity. Review exact approvals, token minimums and wallet recipient. The first deposit sets the price; v2 locks MINIMUM_LIQUIDITY permanently.`)};return{tools:["pool","add","remove"].map(t=>({name:`uniswap_v2_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["tokenA","tokenB",...t==="add"?["amountADesired","amountBDesired"]:t==="remove"?["liquidity"]:[]],properties:t==="pool"?{tokenA:{...k,description:"Address of the first ERC-20 token."},tokenB:{...k,description:"Address of the second ERC-20 token."}}:H},execute:(n,r)=>p(t,n,r)}))}}export{_ as a,h as b,F as c,N as d,E as e,z as f,J as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./
|
|
1
|
+
import{a as c}from"./W3M4KAPX.js";import{o as d}from"./S65KXMZ7.js";import{h as r}from"./QA6Z2CYP.js";import{a as i}from"./CFPJDLTZ.js";import{getAddress as h}from"viem";var u=t=>BigInt(t.replace(".","")),C=t=>`${t/100n}.${(t%100n).toString().padStart(2,"0")}`;async function B(t,p,l,m){let e=await d(t,p,l,m),s=await c({clientFor:t.clientFor,oakTokenAddress:h(i.oak)},[e.net,...e.stakedBacking.assets,e.pendingChop,e.claimableChop]),a=s.slice(1,1+e.stakedBacking.assets.length),o=a.length>0&&a.every(n=>n.usdEstimate!==null),g=o?C(a.reduce((n,k)=>n+u(k.usdEstimate),0n)):null;return{...e,net:s[0],chopSwapNotice:r,stakedBacking:{...e.stakedBacking,assets:a},stakedLp:{...e.stakedLp,usdEstimate:g,estimateLabel:o?"estimate, not a quote":"price unavailable",...o?{estimateSource:"Chop LP reserves and caller-bound net log backing; locks and gas excluded"}:{estimateReason:e.stakedBacking.estimateReason??"A Chop LP reserve has no USD estimate."}},pendingChop:s.at(-2),claimableChop:s.at(-1)}}export{B as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./A3PN3PK3.js";import{g as P}from"./NWNYJ26T.js";import{b}from"./
|
|
1
|
+
import{a as k}from"./A3PN3PK3.js";import{g as P}from"./NWNYJ26T.js";import{b}from"./EWZFZUVF.js";import{a as t}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{getAddress as w,parseAbi as L}from"viem";var v={one_hour:3600n,six_hours:21600n,one_day:86400n,seven_days:604800n,thirty_days:2592000n,ninety_days:7776000n,one_year:31536000n},g=L(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewRedeem(uint256) view returns (uint256)"]);async function C(u,o,i){let a=0n,s=i.number,e=await u.getBlock({blockNumber:a});if(e.timestamp>o)throw new t("Longbow has insufficient chain history for this window.");for(let n=0;a+1n<s&&n<64;n++){let r=(a+s)/2n,c=await u.getBlock({blockNumber:r});if(c.number!==r||c.timestamp<e.timestamp||c.timestamp>i.timestamp)throw new t("Longbow historical block response is inconsistent.");c.timestamp<=o?(a=r,e=c):s=r}if(a+1n<s||e.number!==a)throw new t("Longbow historical block search exceeded its bound.");return e}async function _(u,o,i,a="six_hours"){let s=v[a];if(!Object.hasOwn(v,a)||!s)throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let e=u.clientFor(b);if(await e.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let n=await e.getBlock({blockTag:"latest"});if(n.number===null||n.timestamp<s)throw new t("Longbow has insufficient chain history for this window.");let r=await C(e,n.timestamp-s,{number:n.number,timestamp:n.timestamp}),c=10n**27n,d=await Promise.all([r,n].map(async m=>{let[S,N,Y,f]=await Promise.all([e.readContract({address:o,abi:g,functionName:"asset",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:i.address,abi:g,functionName:"decimals",blockNumber:m.number}),e.readContract({address:o,abi:g,functionName:"previewRedeem",args:[c],blockNumber:m.number})]);if(w(S)!==w(i.address)||N!==18||Y!==i.decimals||typeof f!="bigint"||f<0n||f>=1n<<256n)throw new t("Longbow historical share price or token metadata is unavailable or invalid. No zero rate was inferred.");return f})),h=n.timestamp-r.timestamp;if(h<=0n||h>s+300n)throw new t("Longbow historical blocks do not cover the requested APY window within 300 seconds.");if(d[0]===0n)throw new t("Longbow starting share price is zero; a realized APY cannot be calculated.");let l=Number(d[1]-d[0])/Number(d[0]),p=Math.expm1(Math.log1p(l)*31536e3/Number(h));if(!Number.isFinite(p))throw new t("Longbow annualized share-price change is outside the supported numeric range.");let y=await k(e,o,n.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},source:"Oak-computed on-chain",view:"apy",stale:!1,window:{lookback:a,requestedSeconds:s.toString(),elapsedSeconds:h.toString(),fromTimestamp:r.timestamp.toString(),toTimestamp:n.timestamp.toString(),fromBlock:r.number.toString(),toBlock:n.number.toString()},sharePrice:{shareUnits:c.toString(),startAssets:d[0].toString(),endAssets:d[1].toString(),assetDecimals:i.decimals},data:{annualYieldFraction:String(p),annualYieldPercent:String(p*100),lookback:a,basis:"Oak-computed realized APY: (end share price / start share price)^(31536000 / elapsed seconds) - 1, using ERC-4626 previewRedeem at two pinned blocks."},caveat:"Historical share-price change includes what the vault accounts for in previewRedeem, excludes external rewards and gas, and is not a promised return. Archive RPC history is required; missing history is not zero APY."}}async function I(u,o,i,a){if(Object.keys(a).some(d=>!["view","lookback"].includes(d)))throw new t("Longbow APY takes a lookback, not pagination.");let s=a.lookback??"six_hours";if(typeof s!="string"||!Object.hasOwn(v,s))throw new t("Choose a finite Longbow APY lookback from one_hour to one_year; inception is unavailable.");let[e,n]=await Promise.allSettled([O(u,o,i,{view:"published_apy"}),_(u,o,i,s)]),r=e.status==="fulfilled"&&!e.value.stale?e.value:void 0;if(!r&&n.status==="rejected")throw new t(`Longbow APY is unavailable: the vendor figure is unavailable or stale, and the on-chain window could not be measured. ${u.plainError(n.reason)}`);return{...r??(n.status==="fulfilled"?n.value:void 0),view:"apy",shown:r?"Longbow vendor":"Oak-computed on-chain",realized:n.status==="fulfilled"?n.value:null,published:e.status==="fulfilled"?e.value:null,warnings:[...r?[]:["Longbow vendor APY is unavailable or stale; showing Oak-computed realized APY."],...n.status==="rejected"?["Oak-computed APY is unavailable: the archive RPC window could not be measured."]:[]]}}async function O(u,o,i,a){if(Object.keys(a).some(m=>m!=="view")||a.view!=="published_apy")throw new t("published_apy takes no historical lookback, cursor or limit.");let s=u.clientFor(b);if(await s.getChainId()!==b)throw new t("Longbow APY assessment requires chain 4663.");let[e,n]=await Promise.all([s.getBlock(),s.readContract({address:o,abi:L(["function asset() view returns (address)"]),functionName:"asset"})]);if(w(n)!==w(i.address))throw new t("Longbow vault does not use the pinned asset.");let r="https://longbow.credit/api/v2/vaults",c=await u.http(r,{method:"GET",headers:{accept:"application/json"},redirect:"error",signal:AbortSignal.timeout(15e3)});if(!c.ok)throw new t(`Longbow published APY HTTP ${c.status}; the rate is unavailable.`);let d=await c.json();if(!d||typeof d!="object"||!Number.isSafeInteger(d.asOf)||Number(d.asOf)<0||!Array.isArray(d.vaults)||d.vaults.length>100)throw new t("Longbow published APY response has an invalid timestamp or vault inventory.");let h=d.vaults.filter(m=>m&&typeof m=="object"&&typeof m.address=="string"&&P(String(m.address),o));if(h.length!==1)throw new t("Longbow published APY omitted or duplicated this vault; no zero rate is inferred.");let l=h[0];if(l.error||typeof l.asset!="string"||w(l.asset)!==w(i.address)||l.decimals!==i.decimals||typeof l.apy!="number"||!Number.isFinite(l.apy)||l.apy<-100||typeof l.apyBasis!="string"||l.apyBasis.length>64)throw new t("Longbow published APY asset, units, basis or rate is invalid.");let p=BigInt(Number(d.asOf)),y=await k(s,o,e.number);return{chainId:b,vault:o,asset:{...i,address:w(i.address)},shareToken:{address:o,symbol:y,decimals:18,chainId:b},sourceUrl:r,view:"published_apy",asOf:p.toString(),stale:e.timestamp>p+900n||p>e.timestamp+60n,data:{annualYieldPercent:String(l.apy),annualYieldFraction:String(l.apy/100),basis:A(l.apyBasis)},caveat:"Longbow publisher quote, not a realized Morpho lookback series or a promised return. The app formats this field directly as percent (0.03 means 0.03%, not 3%). No bonus, future payout or fee inclusion is inferred. Onchain book and fees remain available through longbow_details."}}export{_ as a,I as b,O as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./
|
|
1
|
+
import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./5N6YJFFA.js";import{a as _,b as D}from"./43LI5NKJ.js";import{b as B,c as G,d as O}from"./IOYRL6AY.js";import{b as R,c as M,j as U,t as E}from"./EWZFZUVF.js";import{a as m,b as H,c as I,e as S}from"./XSD5NL7J.js";import{decodeFunctionResult as ee,encodeFunctionData as te,erc20Abi as V,getAddress as L,isAddress as ne,toEventSelector as re,toHex as T,zeroAddress as se}from"viem";var C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function ae(e){let s=e.toLowerCase();return s===se||s===C?C:e}var oe=re("Transfer(address,address,uint256)"),W="Preview note: simulation transfer-based token changes exclude gas and do not prove external settlement.";function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function x(){throw new m("The endpoint returned an unexpected simulation response.")}function j(e,s,l){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s+l)&&x();let d=e[0].calls,a=d.slice(0,s).map(n=>{if(!p(n)||n.status!=="0x1"||n.error||!Array.isArray(n.logs)||n.logs.length!==0||typeof n.returnData!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n.returnData))throw new m("Preview auxiliary read failed or returned invalid data.");return n.returnData});return{result:[{calls:d.slice(s)}],readResults:a}}async function N(e,s,l,d){let a=await e.getChainId();if(a!==s)throw new m(`Preview is on chain ${s}, but the endpoint reports chain ${a}.`);let n=await z(e),t=await K(e,n);if(n.number===null||typeof n.baseFeePerGas!="bigint"||n.baseFeePerGas<0n||typeof t!="bigint"||t<0n)throw new m("Current block base fee and gas price are unavailable or inconsistent. Retry the preview.");let r=t<n.baseFeePerGas?n.baseFeePerGas:t,A=B(n.gasLimit),c=l.map(u=>({from:d,to:u.to,data:u.data,value:T(BigInt(u.value)),gasPrice:T(r),gas:T(A)})),y=()=>e.request({method:"eth_simulateV1",params:[{blockStateCalls:[{blockOverrides:{baseFeePerGas:T(n.baseFeePerGas)},calls:c}],validation:!1,traceTransfers:!0},T(n.number)]},{retryCount:0});try{return await y()}catch(u){if(!I(u))throw u;let g=await e.getBalance({address:d,blockNumber:n.number}),w=await Promise.all(l.map(o=>e.estimateGas({account:d,to:o.to,data:o.data,value:BigInt(o.value),gas:A,blockNumber:n.number}).catch(()=>{}))),k=g;for(let[o,i]of c.entries()){let f=BigInt(i.value),F=O(B(n.gasLimit,w[o]),k,f,r,d,s),h=w[o];if(h!==void 0&&h>F)throw new m(G(d,s,g-k+f+h*r,g));i.gas=T(F),k-=f}let v=await y();if(Array.isArray(v)&&p(v[0])&&Array.isArray(v[0].calls))for(let[o,i]of v[0].calls.entries()){let f=c[o];if(f&&p(i)&&i.status==="0x0"&&typeof i.gasUsed=="string"&&/^0x[0-9a-f]+$/i.test(i.gasUsed)&&BigInt(i.gasUsed)>=BigInt(f.gas))throw new m(G(d,s,BigInt(f.value)+(BigInt(f.gas)+1n)*r,g))}return v}}function J(e,s,l,d){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s)&&x();let a=new Map;for(let[n,t]of e[0].calls.entries()){if(p(t)||x(),t.status==="0x0")throw new m(`Preview call ${n+1} on chain ${d} reverted. ${S(t.error)}`);(t.status!=="0x1"||t.error||!Array.isArray(t.logs))&&x();for(let r of t.logs){if((!p(r)||!Array.isArray(r.topics))&&x(),typeof r.topics[0]!="string"||r.topics[0].toLowerCase()!==oe||r.topics.length===4)continue;(r.topics.length!==3||typeof r.address!="string"||!ne(r.address,{strict:!1})||typeof r.data!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r.data)||!r.topics.slice(1).every(w=>typeof w=="string"&&/^0x0{24}[0-9a-fA-F]{40}$/.test(w)))&&x();let A=r.topics[1].slice(-40).toLowerCase(),c=r.topics[2].slice(-40).toLowerCase(),y=l.slice(2).toLowerCase(),u=BigInt(r.data),g=(c===y?u:0n)-(A===y?u:0n);if(g!==0n){let w=ae(r.address.toLowerCase());a.set(w,(a.get(w)??0n)+g)}}}return a}async function Q(e,s,l,d){let a=s===R?E.mainnet:s===M?E.testnet:void 0,n=a&&[{address:a.usdg,symbol:"USDG",decimals:6},{address:a.weth,symbol:"WETH",decimals:18},...s===R?[{address:U[4663].meridian.CollateralToken_USDe.address,symbol:"USDe",decimals:18}]:[]].find(r=>r.address.toLowerCase()===e);if(n)return{...n,address:L(e),chainId:s};let t;if(e===C){let r=l.chain?.nativeCurrency??(s===4663?{symbol:"ETH",decimals:18}:void 0);if(!r)throw new m(`Native token metadata is unavailable for chain ${s}.`);t={address:e,chainId:s,symbol:r.symbol,decimals:r.decimals}}else if(d)t=await d(e,s,l);else{let r=await q(l,s,e,"decimals");t={address:e,chainId:s,symbol:e,decimals:r}}if(!t||typeof t.address!="string"||t.address.toLowerCase()!==e||t.chainId!==s||typeof t.symbol!="string"||!t.symbol.trim()||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new m(`Invalid token metadata for ${e} on chain ${s}.`);return{address:e===C?e:L(e),chainId:s,symbol:e===C?t.symbol:L(e),decimals:t.decimals}}function ge(e){return async(s,l,d)=>{_(l);let a=s.map(D),n=(d?.reads??[]).map(c=>D({...c,value:"0",description:"Read before simulated transactions."})),t=a[0]?.chainId;if(t===void 0&&n.length)throw new m("Preview auxiliary reads require a transaction bundle.");if(t===void 0)return{txs:a,changes:[],summary:W};let r=[...n,...a].find(c=>c.chainId!==t);if(r)throw new m(`Preview cannot combine chain ${t} with chain ${r.chainId}. Preview each chain separately.`);let A=n.length?[...n,...a]:a;try{let c=e.clientFor(t),y;try{y=await N(c,t,A,l)}catch(o){if(!H(o,-32601,-32004)||!e.anvilFor)throw o;c=await e.anvilFor(t),y=await N(c,t,A,l)}let u;n.length&&({result:y,readResults:u}=j(y,n.length,a.length));let g=J(y,a.length,l,t),w=new Map,k=[];for(let[o,i]of g)if(i!==0n)try{w.set(o,await Q(o,t,c,e.tokenFor))}catch(f){if(o===C||e.tokenFor||(await c.getCode({address:o})??"0x")!=="0x")throw f;k.push(o)}if(k.length){let o=k.flatMap(h=>["symbol","decimals"].map(b=>D({to:h,data:te({abi:V,functionName:b}),value:"0",chainId:t,description:`Read simulated token ${b}.`}))),i=await N(c,t,[...A,...o],l);if(u){let h=j(i,u.length,a.length+o.length);if(h.readResults.some((b,$)=>b!==u[$]))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");i=h.result}(!Array.isArray(i)||i.length!==1||!p(i[0])||!Array.isArray(i[0].calls)||i[0].calls.length!==a.length+o.length)&&x();let f=i[0].calls,F=J([{calls:f.slice(0,a.length)}],a.length,l,t);if(g.size!==F.size||[...g].some(([h,b])=>F.get(h)!==b))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");for(let[h,b]of k.entries()){let $=(Y,Z)=>{let P=f[a.length+h*2+Z];if(!p(P)||P.status!=="0x1"||P.error||typeof P.returnData!="string"||!/^0x[0-9a-fA-F]+$/.test(P.returnData))throw new m(`Invalid simulated token metadata for ${b} on chain ${t}.`);return ee({abi:V,functionName:Y,data:P.returnData})},X={address:b,chainId:t,symbol:$("symbol",0),decimals:$("decimals",1)};w.set(b,await Q(b,t,c,async()=>X))}}let v=[...g].filter(([,o])=>o!==0n).map(([o,i])=>({token:w.get(o),amount:i.toString()}));return{txs:a,changes:v,summary:W,...u?{readResults:u}:{}}}catch(c){throw new m(`Preview on chain ${t} failed: ${S(c)}`)}}}export{C as a,ae as b,ge as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C}from"./43LI5NKJ.js";import{a as _}from"./66F5ZH34.js";import{g as N,m as T,n as k}from"./NWNYJ26T.js";import{b as u,j as $,k as I}from"./
|
|
1
|
+
import{a as C}from"./43LI5NKJ.js";import{a as _}from"./66F5ZH34.js";import{g as N,m as T,n as k}from"./NWNYJ26T.js";import{b as u,j as $,k as I}from"./EWZFZUVF.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as w,erc20Abi as R,getAddress as y,parseAbi as z}from"viem";var d=y($[u].vaults.spark.address),l={address:y(I),symbol:"USDG",decimals:6,chainId:u},E={address:d,symbol:"spUSDG",decimals:6,chainId:u},c=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function maxMint(address) view returns (uint256)","function maxRedeem(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function mint(uint256 shares,address receiver,uint16 referral) returns (uint256)","function deposit(uint256 assets,address receiver,uint16 referral) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)"]),Q=r=>_(r),J={type:"integer",minimum:0,maximum:65535,description:"Integration referral code, a whole number from 0 to 65535. It is only emitted in an event and has no other effect."},K={shares:'Amount of spUSDG shares in base units (spUSDG has 6 decimals). Example: "1000000" = 1 spUSDG.',maxAssets:'Most USDG you will pay, in base units (USDG has 6 decimals). The call fails if the quote is higher. Example: "1000000" = 1 USDG.',amount:'Amount of USDG in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.'};function M(r){return k(r,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function j(r){return T(r,"Invalid Spark integer read.")}function ee(r){return["mint","redeem","deposit_referral","return_liquidity"].map(n=>{let t=n==="mint",a=n==="redeem",h=n==="deposit_referral",x=t?["shares","maxAssets","referral"]:a?["shares"]:h?["amount","referral"]:["amount"],O=t?["shares","maxAssets"]:a?["shares"]:h?["amount","referral"]:["amount"];return{name:`spark_${n}`,inputSchema:{type:"object",additionalProperties:!1,required:O,properties:Object.fromEntries(x.map(m=>[m,m==="referral"?J:Q(K[m])]))},execute:async(m,o)=>{try{if(C(o),Object.keys(m).some(p=>!x.includes(p)))throw new i("Unexpected Spark action argument.");let e=M(m[t||a?"shares":"amount"]),B=t?M(m.maxAssets):void 0,s=m.referral;if((h||s!==void 0)&&(typeof s!="number"||!Number.isInteger(s)||s<0||s>65535))throw new i("Referral must be a uint16 integer.");let f=r.clientFor(u);if(await f.getChainId()!==u)throw new i("Spark requires chain 4663.");let[U,F,H]=await Promise.all([f.readContract({address:d,abi:c,functionName:"asset"}),f.readContract({address:d,abi:c,functionName:"decimals"}),f.readContract({address:l.address,abi:R,functionName:"decimals"})]);if(typeof U!="string"||y(U)!==l.address||F!==6||H!==6)throw new i("Spark requires the pinned USDG/share metadata.");let v=n==="return_liquidity"?e:j(await f.readContract({address:d,abi:c,functionName:t?"previewMint":a?"previewRedeem":"previewDeposit",args:[e]}));if(v===0n)throw new i("Spark returned a zero action quote.");if(n!=="return_liquidity"){let p=j(await f.readContract({address:d,abi:c,functionName:t?"maxMint":a?"maxRedeem":"maxDeposit",args:[o]}));if(e>p)throw new i("The amount exceeds Spark\u2019s current action capacity.")}if(t&&v>B)throw new i("The mint quote exceeds maxAssets.");let G=t?v:e,P=t?s===void 0?w({abi:c,functionName:"mint",args:[e,o]}):w({abi:c,functionName:"mint",args:[e,o,s]}):a?w({abi:c,functionName:"redeem",args:[e,o,o]}):h?w({abi:c,functionName:"deposit",args:[e,o,s]}):w({abi:R,functionName:"transfer",args:[d,e]}),q=`${n} ${e} ${t||a?"spUSDG share":"USDG asset"} base units; ${n==="return_liquidity"?`USDG goes to ${d}, with no shares minted`:`beneficiary ${o}`}${s===void 0?"":`; event-only referral ${s}`}.`,A=[...t||h?[r.approval(l.address,d,G.toString(),u)]:[],r.unsignedTx({to:n==="return_liquidity"?l.address:d,data:P,value:"0",chainId:u,description:q})],g=await r.preview(A,o),S=p=>g.changes.filter(b=>b.token.chainId===u&&N(b.token.address,p.address)).reduce((b,D)=>{if(D.token.decimals!==p.decimals||!/^-?\d+$/.test(D.amount))throw new i("Invalid Spark preview metadata.");return b+BigInt(D.amount)},0n);if(a?S(E)!==-e||S(l)<=0n:S(l)!==-G||n!=="return_liquidity"&&S(E)<(t?e:1n))throw new i("Spark preview does not match the requested outflow and receipt.");return{txs:A,preview:g,summary:`${q} Quoted ${v} ${a?"USDG asset":t||n==="return_liquidity"?"USDG input":"spUSDG share"} base units. ${g.summary} Standard ERC-4626 encodes no output minimum; the exact mint approval can become insufficient as interest accrues. Re-preview before signing.`}}catch(e){throw new i(r.plainError(e))}}}})}export{ee as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as T,s as E,t as F,v as P,w as S}from"./
|
|
1
|
+
import{h as T,s as E,t as F,v as P,w as S}from"./BIFANUTV.js";import{a as m}from"./X5V2Z2NM.js";import{d as A}from"./2BM2WX2G.js";import{e as g,g as u}from"./NWNYJ26T.js";import{t as v}from"./EWZFZUVF.js";import{a as o}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{encodeFunctionData as k,keccak256 as _,stringToHex as C}from"viem";var x="erc8004_stamp_thesis",q="/v1/agents/thesis",M={type:"object",additionalProperties:!1,required:["text","position"],properties:{text:{type:"string",minLength:1,maxLength:16384,description:"Exact thesis text to hash and publish in the tracker record; up to 16 KiB UTF-8. Only the hash is written on chain."},position:{type:"string",minLength:1,maxLength:256,description:"Canonical position ID, up to 256 UTF-8 bytes. Use oak_plan_run steps [trade, stamp] to approve both together."}}};function b(t,n){if(typeof t!="string"||!t.trim()||Buffer.byteLength(t,"utf8")>16384||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(t))throw new o("Provide nonempty thesis text up to 16 KiB of valid UTF-8.");if(typeof n!="string"||!n.trim()||Buffer.byteLength(n,"utf8")>256||/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(n))throw new o("Provide a nonempty canonical position ID up to 256 UTF-8 bytes.");let e=_(C(t)),r=`oak.thesis.${_(C(JSON.stringify([n,t]))).slice(2)}`;return{text:t,position:n,key:r,hash:e}}function O(t,n){let e=b(n.text,n.position);if(!/^(0|[1-9][0-9]*)$/.test(n.agentId)||e.key!==n.key||e.hash!==n.hash||typeof n.writtenAfterEntry!="boolean")throw new o("The thesis differs from the locally prepared stamp.");let r=k({abi:m,functionName:"setMetadata",args:[BigInt(n.agentId),e.key,e.hash]}),a=t[0];if(t.length!==1||!a||a.chainId!==4663||!u(a.to,v.mainnet.identityRegistry)||a.value!=="0"||!u(a.data,r))throw new o("The transaction differs from the exact zero-value thesis stamp.")}function J(t){if(t.filter(e=>e.action?.name===x).length>1)throw new o("A plan may contain only one thesis stamp.");for(let[e,r]of t.entries()){if(r.action?.name!==x)continue;let a=r.action.oakThesis;if(!a||a.writtenAfterEntry!==(e===0))throw new o("The thesis disclosure differs from its locally prepared plan context.");O(r.txs,a)}}async function V(t,n,e,r,a={}){let{network:d,chainId:i,registry:y}=T(t);if(d!=="mainnet")throw new o("Thesis stamps are available on Robinhood Chain mainnet.");let c=A(e,d);if(!g(r)||Object.keys(r).some(D=>!["text","position"].includes(D)))throw new o("Provide only text and position; the local verified identity supplies the agent ID.");let s=b(r.text,r.position),l=BigInt(c.agentId);await F(t,l,n,"stamp this thesis");let f={...s,agentId:c.agentId,writtenAfterEntry:a.writtenAfterEntry!==!1},h=k({abi:m,functionName:"setMetadata",args:[l,s.key,s.hash]}),w=t.unsignedTx({to:y,chainId:i,value:"0",data:h,description:"Stamp the thesis hash as ERC-8004 metadata."}),p=f.writtenAfterEntry?`Thesis written after entry on ${new Date((a.now??Date.now)()).toISOString().slice(0,10)}.`:"Trade and thesis approved together in one plan.";return{...await E(t,[w],n,`Stamp the thesis hash ${s.hash} for agent ${c.agentId}. Only the hash is written on chain; the exact text and position are sent to Oak's public tracker record after the stamp is mined. ${p}
|
|
2
2
|
Position: ${JSON.stringify(s.position)}
|
|
3
3
|
Thesis:
|
|
4
4
|
${I(s.text)}`,!1),thesis:f}}async function Z(t,n,e,r,a){let d=!1;try{let i=b(e.text,e.position);if(i.key!==e.key||i.hash!==e.hash||typeof e.writtenAfterEntry!="boolean")throw new Error("invalid_bound_thesis");let{registry:y,chainId:c}=T(t);if(c!==4663||!/^(0|[1-9][0-9]*)$/.test(e.agentId))throw new Error("invalid_stamp_identity");let s=BigInt(e.agentId),l=k({abi:m,functionName:"setMetadata",args:[s,i.key,i.hash]}),f=await P(t,r,n,l),h=S(f,y,m,"MetadataSet");if(h.agentId!==s||h.metadataKey!==i.key||typeof h.metadataValue!="string"||!u(h.metadataValue,i.hash))throw new Error("stamp_event_mismatch");let w=await t.clientFor(c).readContract({address:y,abi:m,functionName:"getMetadata",args:[s,i.key],blockNumber:f.blockNumber});if(typeof w!="string"||!u(w,i.hash))throw new Error("stamp_metadata_mismatch");d=!0;let p=await a({agentId:e.agentId,key:i.key,hash:i.hash,text:i.text,txHash:r,position:i.position,writtenAfterEntry:e.writtenAfterEntry});if(!g(p)||p.ok!==!0||!g(p.data)||p.data.verification!=="confirmed")throw new Error("record_not_confirmed");return{txHash:r,stampMined:!0,recorded:!0,summary:"The thesis stamp is mined and its public tracker record is confirmed."}}catch{return{txHash:r,...d?{stampMined:!0}:{},recorded:!1,summary:d?"The thesis stamp is mined, but its tracker record was not confirmed. Retry recording this stamp without sending another transaction.":"The thesis stamp receipt could not be verified. No thesis record was posted; check the transaction before retrying."}}}var z=t=>({tools:t.network==="testnet"?[]:[{name:x,inputSchema:M,execute:async()=>{throw new o("Prepare this action through the local Oak bridge with a verified identity.")}}]});export{x as a,q as b,M as c,b as d,O as e,J as f,V as g,Z as h,z as i};
|