@oakagentkit/core 0.2.5 → 0.2.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/abort-scope.d.ts +2 -0
- package/build/dist/api/abort-scope.js +1 -0
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/http.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/checks.js +1 -1
- package/build/dist/api/modules/borro/copy.d.ts +17 -12
- package/build/dist/api/modules/borro/copy.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.d.ts +6 -2
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/borro/types.d.ts +6 -0
- package/build/dist/api/modules/chop/abi.d.ts +558 -0
- package/build/dist/api/modules/chop/abi.js +1 -0
- package/build/dist/api/modules/chop/actions.d.ts +24 -0
- package/build/dist/api/modules/chop/actions.js +1 -0
- package/build/dist/api/modules/chop/checks.d.ts +34 -0
- package/build/dist/api/modules/chop/checks.js +1 -0
- package/build/dist/api/modules/chop/copy.d.ts +15 -0
- package/build/dist/api/modules/chop/copy.js +1 -0
- package/build/dist/api/modules/chop/guard.d.ts +13 -0
- package/build/dist/api/modules/chop/guard.js +1 -0
- package/build/dist/api/modules/chop/index.d.ts +3 -0
- package/build/dist/api/modules/chop/index.js +1 -0
- package/build/dist/api/modules/chop/pins.d.ts +53 -0
- package/build/dist/api/modules/chop/pins.js +1 -0
- package/build/dist/api/modules/chop/positions.d.ts +3 -0
- package/build/dist/api/modules/chop/positions.js +1 -0
- package/build/dist/api/modules/chop/reader.d.ts +195 -0
- package/build/dist/api/modules/chop/reader.js +1 -0
- package/build/dist/api/modules/chop/types.d.ts +44 -0
- package/build/dist/api/modules/chop/types.js +0 -0
- package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
- 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.d.ts +15 -0
- 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/earn/copy.d.ts +32 -10
- package/build/dist/api/modules/earn/copy.js +1 -1
- package/build/dist/api/modules/earn/cost.d.ts +11 -1
- package/build/dist/api/modules/earn/cost.js +1 -1
- package/build/dist/api/modules/earn/index.js +1 -1
- package/build/dist/api/modules/earn/lp.d.ts +14 -1
- package/build/dist/api/modules/earn/lp.js +1 -1
- package/build/dist/api/modules/earn/options.d.ts +6 -4
- package/build/dist/api/modules/earn/options.js +1 -1
- package/build/dist/api/modules/erc8004/common.d.ts +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/validation.js +1 -1
- package/build/dist/api/modules/factor/abi.d.ts +642 -0
- package/build/dist/api/modules/factor/abi.js +1 -0
- package/build/dist/api/modules/factor/actions.d.ts +15 -0
- package/build/dist/api/modules/factor/actions.js +1 -0
- package/build/dist/api/modules/factor/api.d.ts +7 -0
- package/build/dist/api/modules/factor/api.js +1 -0
- package/build/dist/api/modules/factor/checks.d.ts +11 -0
- package/build/dist/api/modules/factor/checks.js +1 -0
- package/build/dist/api/modules/factor/copy.d.ts +33 -0
- package/build/dist/api/modules/factor/copy.js +1 -0
- package/build/dist/api/modules/factor/guard.d.ts +12 -0
- package/build/dist/api/modules/factor/guard.js +1 -0
- package/build/dist/api/modules/factor/index.d.ts +16 -0
- package/build/dist/api/modules/factor/index.js +8 -0
- package/build/dist/api/modules/factor/messages.d.ts +46 -0
- package/build/dist/api/modules/factor/messages.js +1 -0
- package/build/dist/api/modules/factor/pins.d.ts +64 -0
- package/build/dist/api/modules/factor/pins.js +1 -0
- package/build/dist/api/modules/factor/reader.d.ts +17 -0
- package/build/dist/api/modules/factor/reader.js +1 -0
- package/build/dist/api/modules/factor/types.d.ts +18 -0
- package/build/dist/api/modules/factor/types.js +0 -0
- package/build/dist/api/modules/gloam/abi.d.ts +89 -0
- package/build/dist/api/modules/gloam/abi.js +1 -0
- package/build/dist/api/modules/gloam/actions.d.ts +5 -0
- package/build/dist/api/modules/gloam/actions.js +1 -0
- package/build/dist/api/modules/gloam/checks.d.ts +17 -0
- package/build/dist/api/modules/gloam/checks.js +1 -0
- package/build/dist/api/modules/gloam/copy.d.ts +23 -0
- package/build/dist/api/modules/gloam/copy.js +2 -0
- package/build/dist/api/modules/gloam/index.d.ts +6 -0
- package/build/dist/api/modules/gloam/index.js +1 -0
- package/build/dist/api/modules/gloam/pins.d.ts +41 -0
- package/build/dist/api/modules/gloam/pins.js +1 -0
- package/build/dist/api/modules/gloam/types.d.ts +308 -0
- package/build/dist/api/modules/gloam/types.js +1 -0
- 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.d.ts +29 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/scan.js +1 -1
- package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
- package/build/dist/api/modules/heyresearch/status-labels.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/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.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.d.ts +2 -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.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- 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.d.ts +2 -0
- 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.js +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.js +1 -1
- 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/actions.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/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.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/perps-batch.js +1 -1
- package/build/dist/api/modules/meridian/perps-stream.js +1 -1
- package/build/dist/api/modules/meridian/perps.js +1 -1
- package/build/dist/api/modules/meridian/predict-read.js +1 -1
- package/build/dist/api/modules/meridian/rfq.js +1 -1
- package/build/dist/api/modules/merkl/discovery.js +1 -1
- package/build/dist/api/modules/merkl/index.js +1 -1
- package/build/dist/api/modules/merkl/manage.js +1 -1
- package/build/dist/api/modules/merkl/protocol.js +1 -1
- package/build/dist/api/modules/morpho/allocator.js +1 -1
- package/build/dist/api/modules/morpho/bundles.js +1 -1
- package/build/dist/api/modules/morpho/in-kind.js +1 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.js +1 -1
- package/build/dist/api/modules/morpho/midnight.js +1 -1
- package/build/dist/api/modules/morpho/protocol.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
- 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/gateway.js +1 -1
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/pendle/convert.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/pons/claim.js +1 -1
- package/build/dist/api/modules/pons/holder-directory.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.d.ts +1 -0
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/trade.d.ts +3 -2
- 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.d.ts +1 -0
- 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/stock-swap.js +1 -1
- package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
- package/build/dist/api/modules/raeto/authorization.js +1 -0
- package/build/dist/api/modules/raeto/copy.d.ts +46 -0
- package/build/dist/api/modules/raeto/copy.js +1 -0
- package/build/dist/api/modules/raeto/errors.d.ts +4 -0
- package/build/dist/api/modules/raeto/errors.js +1 -0
- package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
- package/build/dist/api/modules/raeto/estimate.js +1 -0
- package/build/dist/api/modules/raeto/index.d.ts +16 -0
- package/build/dist/api/modules/raeto/index.js +1 -0
- package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
- package/build/dist/api/modules/raeto/pairing.js +1 -0
- package/build/dist/api/modules/raeto/pins.d.ts +24 -0
- package/build/dist/api/modules/raeto/pins.js +1 -0
- package/build/dist/api/modules/raeto/templates.d.ts +22 -0
- package/build/dist/api/modules/raeto/templates.js +1 -0
- package/build/dist/api/modules/raeto/terms.d.ts +8 -0
- package/build/dist/api/modules/raeto/terms.js +1 -0
- package/build/dist/api/modules/raeto/types.d.ts +64 -0
- package/build/dist/api/modules/raeto/types.js +0 -0
- package/build/dist/api/modules/relay/api.d.ts +16 -0
- package/build/dist/api/modules/relay/api.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.d.ts +1 -0
- package/build/dist/api/modules/relay/index.js +1 -1
- package/build/dist/api/modules/relay/order.js +1 -1
- package/build/dist/api/modules/relay/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/readiness.d.ts +1 -0
- package/build/dist/api/modules/relay/readiness.js +1 -1
- package/build/dist/api/modules/relay/reads.js +1 -1
- package/build/dist/api/modules/relay/vaults.js +1 -1
- package/build/dist/api/modules/spark/actions.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/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.d.ts +1 -0
- 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/fee-percent.d.ts +4 -0
- package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
- 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.d.ts +2 -0
- 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.d.ts +2 -0
- 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.d.ts +38 -0
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
- 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.d.ts +10 -3
- 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.d.ts +6 -0
- 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/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.d.ts +3 -0
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/scan-text.js +1 -1
- package/build/dist/api/modules/wormhole/swap-token-verdict.d.ts +11 -0
- package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -0
- package/build/dist/api/modules/wormhole/third-party-text.d.ts +24 -0
- package/build/dist/api/modules/wormhole/third-party-text.js +1 -0
- package/build/dist/api/modules/wormhole/token-check.d.ts +2 -0
- package/build/dist/api/modules/wormhole/token-check.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +36 -0
- package/build/dist/api/modules/wormhole/x402-client.js +1 -0
- package/build/dist/api/oak-fee.d.ts +12 -0
- package/build/dist/api/oak-fee.js +1 -0
- package/build/dist/api/param-text.d.ts +22 -0
- package/build/dist/api/param-text.js +1 -0
- package/build/dist/api/position-economics.d.ts +70 -0
- package/build/dist/api/position-economics.js +1 -0
- package/build/dist/api/positions.d.ts +8 -5
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/prices.d.ts +3 -0
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/progress.d.ts +7 -0
- package/build/dist/api/progress.js +1 -0
- package/build/dist/api/read-budgets.d.ts +4 -0
- package/build/dist/api/read-budgets.js +1 -0
- package/build/dist/api/read-shape.d.ts +45 -0
- package/build/dist/api/read-shape.js +1 -0
- package/build/dist/api/revert.d.ts +23 -0
- package/build/dist/api/revert.js +1 -0
- package/build/dist/api/routes.js +1 -1
- package/build/dist/api/rpc.d.ts +1 -0
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/secret-fields.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.d.ts +8 -0
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.d.ts +4 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.d.ts +1 -0
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/types.d.ts +9 -1
- package/build/dist/api/untrusted-unwrap.d.ts +1 -0
- package/build/dist/api/untrusted-unwrap.js +1 -0
- package/build/dist/api/usd-estimate.d.ts +23 -0
- package/build/dist/api/usd-estimate.js +1 -0
- package/build/dist/api/vendor-limits.js +1 -1
- package/build/dist/chunks/{JVLLVNF2.js → 2E4I7CJ7.js} +1 -1
- package/build/dist/chunks/2FHELZ7Y.js +1 -0
- package/build/dist/chunks/2GXHYI23.js +1 -0
- package/build/dist/chunks/2LWBN35N.js +1 -0
- package/build/dist/chunks/{4HG6FRVH.js → 2OKYXT25.js} +1 -1
- package/build/dist/chunks/2SUHQWND.js +1 -0
- package/build/dist/chunks/2ZWKIBJT.js +1 -0
- package/build/dist/chunks/32RXFUOH.js +1 -0
- package/build/dist/chunks/3CH2IPQL.js +1 -0
- package/build/dist/chunks/3DNJTJ2X.js +1 -0
- package/build/dist/chunks/3K2N5VFH.js +1 -0
- package/build/dist/chunks/3VBIRLU3.js +1 -0
- package/build/dist/chunks/3VWVW7PX.js +1 -0
- package/build/dist/chunks/3ZABD6ZF.js +2 -0
- package/build/dist/chunks/44MB6SA6.js +1 -0
- package/build/dist/chunks/4D4ZRZUW.js +1 -0
- package/build/dist/chunks/{KIFSRO5K.js → 4FPV4CRC.js} +1 -1
- package/build/dist/chunks/4GNUXN4K.js +1 -0
- package/build/dist/chunks/{K4DHHQBI.js → 4JRXEN7C.js} +2 -2
- package/build/dist/chunks/4JTTA3BX.js +1 -0
- package/build/dist/chunks/4OVIMYNH.js +2 -0
- package/build/dist/chunks/{326QMOTR.js → 4Q2ZBZXM.js} +1 -1
- package/build/dist/chunks/4RQAOOO2.js +1 -0
- package/build/dist/chunks/4TTDAF4B.js +1 -0
- package/build/dist/chunks/523ZIR3J.js +1 -0
- package/build/dist/chunks/5DPJQCKJ.js +68 -0
- package/build/dist/chunks/5HIHUYA4.js +1 -0
- package/build/dist/chunks/5PI57UC2.js +1 -0
- package/build/dist/chunks/5RXALTDT.js +1 -0
- package/build/dist/chunks/5TUXSOMI.js +1 -0
- package/build/dist/chunks/5UAXLWJ2.js +1 -0
- package/build/dist/chunks/5XAXJEWM.js +5 -0
- package/build/dist/chunks/67BWOVET.js +1 -0
- package/build/dist/chunks/6NUNCD5J.js +1 -0
- package/build/dist/chunks/6PZGDVHV.js +1 -0
- package/build/dist/chunks/{OKUO3BVM.js → 6UVGQYZ3.js} +1 -1
- package/build/dist/chunks/753HZZTY.js +1 -0
- package/build/dist/chunks/77CLMPM7.js +1 -0
- package/build/dist/chunks/7D73A6KS.js +1 -0
- package/build/dist/chunks/7MBVTNLU.js +1 -0
- package/build/dist/chunks/7QKYDNF6.js +18 -0
- package/build/dist/chunks/7VC53B5X.js +70 -0
- package/build/dist/chunks/{QSHCBASA.js → 7VNO46LV.js} +1 -1
- package/build/dist/chunks/ACH4BSME.js +3 -0
- package/build/dist/chunks/AHUCYDBC.js +1 -0
- package/build/dist/chunks/AI3VAPA3.js +1 -0
- package/build/dist/chunks/AMTRDPVO.js +1 -0
- package/build/dist/chunks/APHNOGNS.js +1 -0
- package/build/dist/chunks/APQYLJGS.js +1 -0
- package/build/dist/chunks/{WDK6VOG4.js → ARI72OYT.js} +1 -1
- package/build/dist/chunks/ARLGF5MU.js +1 -0
- package/build/dist/chunks/BAIY32AV.js +1 -0
- package/build/dist/chunks/BB765L75.js +3 -0
- package/build/dist/chunks/BE3A7677.js +1 -0
- package/build/dist/chunks/BX46C5ZP.js +1 -0
- package/build/dist/chunks/{IY7BXLT4.js → BZ34ZR65.js} +1 -1
- package/build/dist/chunks/C3WBHFLX.js +1 -0
- package/build/dist/chunks/C75MT5SD.js +1 -0
- package/build/dist/chunks/CAWTAR5V.js +1 -0
- package/build/dist/chunks/CNLL4NCR.js +1 -0
- package/build/dist/chunks/CO4GCF4L.js +1 -0
- package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
- package/build/dist/chunks/{SJJR4ZBZ.js → CSDN4MYP.js} +1 -1
- package/build/dist/chunks/CSOO4SW7.js +1 -0
- package/build/dist/chunks/CZL6T2ZQ.js +1 -0
- package/build/dist/chunks/D742AYEV.js +1 -0
- package/build/dist/chunks/DGCJZ3HO.js +1 -0
- package/build/dist/chunks/DNNFKDZR.js +1 -0
- package/build/dist/chunks/DPE7SPW7.js +1 -0
- package/build/dist/chunks/DSTMEY5F.js +1 -0
- package/build/dist/chunks/{X3BYCOWS.js → DYYEA5HB.js} +1 -1
- package/build/dist/chunks/EFESPGA2.js +1 -0
- package/build/dist/chunks/EGZREEG2.js +1 -0
- package/build/dist/chunks/EH5G4O3U.js +1 -0
- package/build/dist/chunks/EI6GGPDS.js +20 -0
- package/build/dist/chunks/EVBHQQQG.js +1 -0
- package/build/dist/chunks/EZZM2GQT.js +2 -0
- package/build/dist/chunks/F3VDVTMS.js +1 -0
- package/build/dist/chunks/F4UQEPJT.js +1 -0
- package/build/dist/chunks/FHTNMGFR.js +1 -0
- package/build/dist/chunks/FIO6VC2J.js +1 -0
- package/build/dist/chunks/FJLJ7ZQ5.js +1 -0
- package/build/dist/chunks/{WP6RHXGN.js → FL5SSHUL.js} +1 -1
- package/build/dist/chunks/FNGIJKMZ.js +1 -0
- package/build/dist/chunks/{KIFZ5ZSK.js → FOD34G2H.js} +1 -1
- package/build/dist/chunks/{WV3A3OUU.js → FOKEFXGP.js} +1 -1
- package/build/dist/chunks/FV4WZOTD.js +1 -0
- package/build/dist/chunks/FWIFTPSE.js +2 -0
- package/build/dist/chunks/FZ6IJZZM.js +1 -0
- package/build/dist/chunks/G2LAO23N.js +1 -0
- package/build/dist/chunks/GDRQ2ANN.js +1 -0
- package/build/dist/chunks/GG24LO2R.js +1 -0
- package/build/dist/chunks/GLF7WEY2.js +1 -0
- package/build/dist/chunks/GQ3XZFRL.js +1 -0
- package/build/dist/chunks/{QU5XKRGK.js → GQYV4TFO.js} +1 -1
- package/build/dist/chunks/GRSXWQWD.js +1 -0
- package/build/dist/chunks/{3GOHSYHW.js → GSFHM5L3.js} +1 -1
- package/build/dist/chunks/H5DY7CNB.js +1 -0
- package/build/dist/chunks/HCBX4NFM.js +1 -0
- package/build/dist/chunks/HHO5ISMM.js +1 -0
- package/build/dist/chunks/HIX5N25Z.js +1 -0
- package/build/dist/chunks/HKVQ646Q.js +1 -0
- package/build/dist/chunks/HS4DZPYT.js +1 -0
- package/build/dist/chunks/I6PQW2JI.js +1 -0
- package/build/dist/chunks/IEG6GLFR.js +1 -0
- package/build/dist/chunks/INOYMBWE.js +1 -0
- package/build/dist/chunks/IV4K7FMD.js +1 -0
- package/build/dist/chunks/{T2WHOZXM.js → J73ATSEQ.js} +1 -1
- package/build/dist/chunks/JBTOZ6IH.js +1 -0
- package/build/dist/chunks/JESMX2UC.js +1 -0
- package/build/dist/chunks/JJGZ7W3V.js +1 -0
- package/build/dist/chunks/JKRBGAX2.js +1 -0
- package/build/dist/chunks/JLRHM2DQ.js +1 -0
- package/build/dist/chunks/JOKL5L6X.js +1 -0
- package/build/dist/chunks/JS53DQVT.js +1 -0
- package/build/dist/chunks/{WIRBCS4W.js → JWR5XVP2.js} +1 -1
- package/build/dist/chunks/K6D6SDIG.js +1 -0
- package/build/dist/chunks/K7HTDKAT.js +1 -0
- package/build/dist/chunks/{GQ5GYUEH.js → KDGSYNOP.js} +1 -1
- package/build/dist/chunks/KKPMOAVI.js +1 -0
- package/build/dist/chunks/KREBNL2D.js +1 -0
- package/build/dist/chunks/L646YWDP.js +1 -0
- package/build/dist/chunks/{2MAMJJJC.js → LR4XTZ37.js} +1 -1
- package/build/dist/chunks/LVFI74ST.js +1 -0
- package/build/dist/chunks/{Z4FZVJ5Z.js → M7ZXDLKM.js} +1 -1
- package/build/dist/chunks/MVD3KWPP.js +1 -0
- package/build/dist/chunks/N245WC5R.js +1 -0
- package/build/dist/chunks/{WTXC3XKW.js → N4XNNXOJ.js} +1 -1
- package/build/dist/chunks/N6GIC7HJ.js +1 -0
- package/build/dist/chunks/{RUC7KH7A.js → NA424YAL.js} +1 -1
- package/build/dist/chunks/NUFZUKYS.js +1 -0
- package/build/dist/chunks/O3JWCJIF.js +1 -0
- package/build/dist/chunks/OARVU3RC.js +1 -0
- package/build/dist/chunks/OEZ7FCLF.js +1 -0
- package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
- package/build/dist/chunks/{3FUVMSCF.js → OYJFXEDU.js} +1 -1
- package/build/dist/chunks/OYPAVXGQ.js +1 -0
- package/build/dist/chunks/{SMYWWIE6.js → OZ5MDUD2.js} +1 -1
- package/build/dist/chunks/P6OMKZMR.js +3 -0
- package/build/dist/chunks/PV4AK32X.js +1 -0
- package/build/dist/chunks/{HKEMQBFA.js → PXVREXCS.js} +1 -1
- package/build/dist/chunks/PZEF5LBL.js +2 -0
- package/build/dist/chunks/Q2ACLVWR.js +1 -0
- package/build/dist/chunks/QFSBDPLN.js +1 -0
- package/build/dist/chunks/QJNLLI6N.js +1 -0
- package/build/dist/chunks/QMZEGT5B.js +1 -0
- package/build/dist/chunks/{HSCQZ66A.js → REWXG6X6.js} +1 -1
- package/build/dist/chunks/{6B3VVISQ.js → RLI4JDOL.js} +1 -1
- package/build/dist/chunks/{4MXM6Q4W.js → RLMVA575.js} +1 -1
- package/build/dist/chunks/RPB46QAC.js +1 -0
- package/build/dist/chunks/{Q42YI3EP.js → RT7IU6TI.js} +1 -1
- package/build/dist/chunks/{ER47KGRM.js → SBY4RJ7I.js} +1 -1
- package/build/dist/chunks/SCG5HWMN.js +1 -0
- package/build/dist/chunks/SENOU5JR.js +1 -0
- package/build/dist/chunks/SKEKXEUU.js +1 -0
- package/build/dist/chunks/SOTYQGPT.js +1 -0
- package/build/dist/chunks/SZ466I5X.js +1 -0
- package/build/dist/chunks/{GNC6RXLT.js → TDZTC5WR.js} +1 -1
- package/build/dist/chunks/TE6D3OIX.js +1 -0
- package/build/dist/chunks/TID4C2KC.js +1 -0
- package/build/dist/chunks/TK55VASJ.js +2 -0
- package/build/dist/chunks/TM7Z5SA4.js +1 -0
- package/build/dist/chunks/TNJTET4G.js +1 -0
- package/build/dist/chunks/TPEKCXVE.js +1 -0
- package/build/dist/chunks/TVIMP5CK.js +1 -0
- package/build/dist/chunks/U2YCQWZK.js +1 -0
- package/build/dist/chunks/U363GQTF.js +1 -0
- package/build/dist/chunks/{U4JGEMKT.js → UEDGYZOC.js} +1 -1
- package/build/dist/chunks/UOCRYXAB.js +1 -0
- package/build/dist/chunks/UQEEF5W5.js +1 -0
- package/build/dist/chunks/{QQECG3WP.js → UUID2E22.js} +1 -1
- package/build/dist/chunks/UWBKAWX3.js +7 -0
- package/build/dist/chunks/V37L4DU4.js +1 -0
- package/build/dist/chunks/VR344DAZ.js +1 -0
- package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
- package/build/dist/chunks/VTPT5544.js +1 -0
- package/build/dist/chunks/VVWFB53Q.js +1 -0
- package/build/dist/chunks/WHTRPRRD.js +1 -0
- package/build/dist/chunks/WHVZ372B.js +1 -0
- package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
- package/build/dist/chunks/WOGWLFAL.js +3 -0
- package/build/dist/chunks/WUT7TZYM.js +1 -0
- package/build/dist/chunks/XCKTE4ON.js +1 -0
- package/build/dist/chunks/XEPCDGN2.js +1 -0
- package/build/dist/chunks/XHYFISVV.js +1 -0
- package/build/dist/chunks/XPEDQBLI.js +1 -0
- package/build/dist/chunks/{D3YLXQPW.js → XQ24RSEI.js} +1 -1
- package/build/dist/chunks/XRDXFHIK.js +1 -0
- package/build/dist/chunks/XTFRPI4G.js +1 -0
- package/build/dist/chunks/XVJ7ILKK.js +1 -0
- package/build/dist/chunks/XWKK75TO.js +1 -0
- package/build/dist/chunks/{74Y2KDNR.js → XYPGLG6A.js} +1 -1
- package/build/dist/chunks/Y77EVVT4.js +1 -0
- package/build/dist/chunks/YEIM6BZQ.js +1 -0
- package/build/dist/chunks/{S47VUTHM.js → YMV5TL5C.js} +1 -1
- package/build/dist/chunks/YSMWCKIX.js +1 -0
- package/build/dist/chunks/YTLH4M4Y.js +1 -0
- package/build/dist/chunks/YUHNPUNK.js +1 -0
- package/build/dist/chunks/YWZQJJYY.js +1 -0
- package/build/dist/chunks/{UMIZMJWW.js → ZF2VPDRQ.js} +1 -1
- package/build/dist/chunks/ZFU65MB4.js +1 -0
- package/build/dist/chunks/ZKZUS3QU.js +1 -0
- package/build/dist/chunks/ZOMFHTB2.js +1 -0
- package/build/dist/chunks/{BTD5SMOW.js → ZP36DSOD.js} +1 -1
- package/build/dist/chunks/ZQ6AF3VX.js +1 -0
- package/package.json +1 -1
- package/build/dist/chunks/2KYAMXTS.js +0 -1
- package/build/dist/chunks/2TK3ETUO.js +0 -1
- package/build/dist/chunks/3MLUCYCB.js +0 -1
- package/build/dist/chunks/3NJ5KQ3Q.js +0 -1
- package/build/dist/chunks/3XNZUIRU.js +0 -1
- package/build/dist/chunks/3XXBLNEX.js +0 -1
- package/build/dist/chunks/45BRW2ZF.js +0 -1
- package/build/dist/chunks/46547QT3.js +0 -1
- package/build/dist/chunks/4PY3UFNR.js +0 -1
- package/build/dist/chunks/52ELWNXJ.js +0 -2
- package/build/dist/chunks/553UE2ZQ.js +0 -1
- package/build/dist/chunks/57MEFFCU.js +0 -1
- package/build/dist/chunks/5APS4T2D.js +0 -1
- package/build/dist/chunks/5SMVQCAP.js +0 -1
- package/build/dist/chunks/64GOINYS.js +0 -1
- package/build/dist/chunks/6D5DJA5B.js +0 -1
- package/build/dist/chunks/6I4NTKB2.js +0 -1
- package/build/dist/chunks/6OGDTEGH.js +0 -1
- package/build/dist/chunks/6PBGEPUK.js +0 -20
- package/build/dist/chunks/6WZX7C4T.js +0 -2
- package/build/dist/chunks/7WSHW7KW.js +0 -1
- package/build/dist/chunks/ABPL3ZZI.js +0 -1
- package/build/dist/chunks/AKYF5264.js +0 -7
- package/build/dist/chunks/APGLZXIW.js +0 -1
- package/build/dist/chunks/AVG4W3Y7.js +0 -1
- package/build/dist/chunks/B3RXD5ET.js +0 -1
- package/build/dist/chunks/BBS3ODWZ.js +0 -1
- package/build/dist/chunks/BJ2VGRF4.js +0 -1
- package/build/dist/chunks/BTPXJAUX.js +0 -1
- package/build/dist/chunks/C36BFZH6.js +0 -1
- package/build/dist/chunks/C7AXJHBT.js +0 -1
- package/build/dist/chunks/CBG5HARQ.js +0 -2
- package/build/dist/chunks/CCTXCMH4.js +0 -1
- package/build/dist/chunks/CHXBOXOD.js +0 -1
- package/build/dist/chunks/DJN3JAWB.js +0 -1
- package/build/dist/chunks/E674J2MD.js +0 -1
- package/build/dist/chunks/EE64JSLY.js +0 -1
- package/build/dist/chunks/EJ7O75A7.js +0 -1
- package/build/dist/chunks/ELSXLZN5.js +0 -1
- package/build/dist/chunks/FQ6UZCM6.js +0 -1
- package/build/dist/chunks/GEIFITAQ.js +0 -1
- package/build/dist/chunks/GGSAKCND.js +0 -1
- package/build/dist/chunks/GL4NCUMH.js +0 -1
- package/build/dist/chunks/GW626GG2.js +0 -1
- package/build/dist/chunks/H2XDMFQQ.js +0 -1
- package/build/dist/chunks/HAQPIBYR.js +0 -1
- package/build/dist/chunks/HCUHMCBW.js +0 -1
- package/build/dist/chunks/I26DMNJG.js +0 -1
- package/build/dist/chunks/IMO3GDA5.js +0 -1
- package/build/dist/chunks/INOZIE55.js +0 -1
- package/build/dist/chunks/J2OT4KAH.js +0 -1
- package/build/dist/chunks/JUZ5JU6D.js +0 -70
- package/build/dist/chunks/K3RDPI5J.js +0 -1
- package/build/dist/chunks/KBKK7UNY.js +0 -1
- package/build/dist/chunks/KPCY5V35.js +0 -1
- package/build/dist/chunks/L4N2RSK2.js +0 -1
- package/build/dist/chunks/L5BLHY34.js +0 -1
- package/build/dist/chunks/LSXUAHOE.js +0 -1
- package/build/dist/chunks/M37654RL.js +0 -1
- package/build/dist/chunks/MJ6WEWMI.js +0 -3
- package/build/dist/chunks/MR5L7V6Z.js +0 -1
- package/build/dist/chunks/N4Q6GN65.js +0 -1
- package/build/dist/chunks/NAZPDRIF.js +0 -1
- package/build/dist/chunks/NDCLTVIU.js +0 -1
- package/build/dist/chunks/NEEZBJBC.js +0 -1
- package/build/dist/chunks/NKX3FE34.js +0 -1
- package/build/dist/chunks/NKZKKCK2.js +0 -1
- package/build/dist/chunks/OJ4WJUPP.js +0 -1
- package/build/dist/chunks/OJPG45AC.js +0 -1
- package/build/dist/chunks/OTXSKFUD.js +0 -1
- package/build/dist/chunks/P3S4BR5G.js +0 -1
- package/build/dist/chunks/P56RZC2M.js +0 -1
- package/build/dist/chunks/P7I62KFR.js +0 -1
- package/build/dist/chunks/PK66GCDT.js +0 -1
- package/build/dist/chunks/PSBQWDYI.js +0 -1
- package/build/dist/chunks/PXT5YTWU.js +0 -1
- package/build/dist/chunks/QA3UHEO3.js +0 -1
- package/build/dist/chunks/QC3HH5UD.js +0 -3
- package/build/dist/chunks/QF52OIBS.js +0 -1
- package/build/dist/chunks/QO3KCJMP.js +0 -1
- package/build/dist/chunks/QZZ4O34L.js +0 -1
- package/build/dist/chunks/RQ4GHJXE.js +0 -1
- package/build/dist/chunks/RUX3RY7Y.js +0 -1
- package/build/dist/chunks/RVDUSNWW.js +0 -1
- package/build/dist/chunks/S7IFAQPG.js +0 -1
- package/build/dist/chunks/SIYUNOLI.js +0 -1
- package/build/dist/chunks/SSHCD6RZ.js +0 -18
- package/build/dist/chunks/T3AJSQYT.js +0 -1
- package/build/dist/chunks/TEJ7W534.js +0 -1
- package/build/dist/chunks/TM2XCRU7.js +0 -1
- package/build/dist/chunks/TVWMTMEF.js +0 -1
- package/build/dist/chunks/U5PMVP56.js +0 -1
- package/build/dist/chunks/U67J4BCH.js +0 -1
- package/build/dist/chunks/UHTRW2R6.js +0 -1
- package/build/dist/chunks/UHVSINR5.js +0 -1
- package/build/dist/chunks/VEQBHI6O.js +0 -1
- package/build/dist/chunks/VJS4DHQQ.js +0 -1
- package/build/dist/chunks/VOMGT5SG.js +0 -1
- package/build/dist/chunks/VY7XRHZQ.js +0 -1
- package/build/dist/chunks/VYAJXLND.js +0 -1
- package/build/dist/chunks/VYN2NRAP.js +0 -1
- package/build/dist/chunks/W2BYU5JQ.js +0 -2
- package/build/dist/chunks/W6BS3T7S.js +0 -1
- package/build/dist/chunks/WCNHZYQQ.js +0 -1
- package/build/dist/chunks/X2KFXCVD.js +0 -1
- package/build/dist/chunks/X3PQMS4N.js +0 -1
- package/build/dist/chunks/XBE3B6Y2.js +0 -1
- package/build/dist/chunks/XLOYBLFI.js +0 -1
- package/build/dist/chunks/XR7VK24E.js +0 -1
- package/build/dist/chunks/XSRIJUFU.js +0 -1
- package/build/dist/chunks/Y25EXZCO.js +0 -1
- package/build/dist/chunks/YCZPSMZ5.js +0 -1
- package/build/dist/chunks/YN56C7PN.js +0 -1
- package/build/dist/chunks/YWRDZQI6.js +0 -1
- package/build/dist/chunks/YXTSWRV5.js +0 -1
- package/build/dist/chunks/Z43BTOTE.js +0 -1
- package/build/dist/chunks/ZMFRMWHR.js +0 -1
- package/build/dist/chunks/ZSN4IRI5.js +0 -1
- package/build/dist/chunks/ZV5HIQXC.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as Y}from"./U2YCQWZK.js";import{b as V,c as W,d as G}from"./DNNFKDZR.js";import{d as de,e as L}from"./CAWTAR5V.js";import{a as B}from"./H5DY7CNB.js";import{a as N}from"./43LI5NKJ.js";import{b as H,c as se,d as ae,e as j}from"./IX3GZMTM.js";import{a as x,i as D}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as S}from"./JXOEJPJ4.js";import{decodeEventLog as $e,encodeAbiParameters as pe,encodeFunctionData as ye,erc20Abi as Z,getAddress as l,isAddress as E,keccak256 as Ee,parseAbi as _e,parseAbiParameters as we,toEventSelector as ge}from"viem";var A=l(D[4663].hookr.HookrLimitOrders.address),ve=l(D[4663].hookr.HookrRoot.address),Ne=l(D[4663].hookr.HookrRouter.address),It=l(D[4663].hookr.HookrRegistry.address),Be=l(D[4663].hookr.HookrForwarder.address),Fe=l(D[4663].hookr.PoolManager.address),At=l(D[4663].hookr.HOOKR_Token.address),Me=l("0x000000000000000000000000000000000000dEaD"),ze=8388608,qe=200,ce=60n,Xe=604800n,ue=31536000n,ht=10,St=100,xt="500000000000000",Ct="10000000000000000",me=4096n,Q=32n,Ke=1e4,Ue=(1n<<127n)-1n,le=(1n<<128n)-1n,je=(1n<<160n)-1n,Ve=(1n<<40n)-1n,We=16777215,Ge=8388607,fe=1n<<192n,ee=0,M=1,Ye=2,Qe=3,Ze=ge("OrderCreated(uint256,address,bytes32,bool,uint128,uint128,uint128,uint40,address)"),Dt=ge("OrderCancelled(uint256,address,address,uint256,uint256)"),P=_e(["function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function createOrder(((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint160 sqrtPriceLimitX96, address recipient, uint40 expiry, uint128 bounty) params) payable returns (uint256 orderId)","function cancel(uint256 orderId, address to)","function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)","function router() view returns (address)","function registry() view returns (address)","function poolManager() view returns (address)","function forwarder() view returns (address)","event OrderCreated(uint256 indexed orderId, address indexed owner, bytes32 indexed poolId, bool zeroForOne, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint40 expiry, address recipient)","event OrderCancelled(uint256 indexed orderId, address indexed owner, address indexed to, uint256 amountIn, uint256 bounty)"]);function F(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ke(e){let t=e.toLowerCase();return t===L.toLowerCase()||t===B.toLowerCase()||t===de.toLowerCase()}function $(e,t){if(typeof e!="string"||!e.trim())throw new o(`Provide a valid contract address for ${t}. Identify tokens by chain and address, never by symbol.`);let n=e.trim();if(!E(n,{strict:!1}))throw new o(`Invalid token address "${n}" for ${t}. Identify tokens by chain and address, never by symbol.`);return ke(n)?L:l(n)}function be(e){let t=e===void 0?x:Number(e);if(!Number.isSafeInteger(t)||t!==x)throw new o(`Hookr limit orders are only supported on Robinhood Chain (${x}).`);return x}function Je(e){switch(e){case ee:return"None";case M:return"Open";case Ye:return"Filled";case Qe:return"Cancelled";default:return"Unknown"}}function et(e,t,n=ae){if(typeof e!="string"||!/^-?\d+$/.test(e.trim()))throw new o("Signed amount must be an integer string in base units.");let r=e.trim();if(r.startsWith("-")){let i=r.slice(1),u=n(i,t);return u==="0"?"0":`-${u}`}return n(r,t)}function Pt(e,t,n="floor"){return se(e,t,n)}function Oe(e){return Ee(pe(we("address, address, uint24, int24, address"),[l(e.currency0),l(e.currency1),e.fee,e.tickSpacing,l(e.hooks)]))}function Ie(e,t){let n=e.toLowerCase();if(new Set([L.toLowerCase(),Me.toLowerCase(),A.toLowerCase(),Ne.toLowerCase(),Be.toLowerCase(),Fe.toLowerCase(),t.toLowerCase()]).has(n))throw new o(`Recipient ${e} is a reserved address and cannot receive Hookr limit order funds.`)}async function J(e,t,n,r){if(ke(e))return{address:B,symbol:V.symbol,decimals:V.decimals,chainId:t};let i=l(e),u=i.toLowerCase();if(F(r)){let s=typeof r.decimals=="number"&&Number.isInteger(r.decimals)&&r.decimals>=0&&r.decimals<=255?r.decimals:void 0,a=typeof r.symbol=="string"&&r.symbol.trim()?r.symbol.trim():void 0;if(s!==void 0&&a!==void 0)return{address:i,symbol:a,decimals:s,chainId:t}}if(u===W.address.toLowerCase())return{...W,chainId:t};if(u===G.address.toLowerCase())return{...G,chainId:t};try{let[s,a]=await Promise.all([n.readContract({address:i,abi:Z,functionName:"symbol"}),n.readContract({address:i,abi:Z,functionName:"decimals"})]);if(typeof s!="string"||!s.trim()||typeof a!="number"||!Number.isInteger(a)||a<0||a>255)throw new o(`Invalid token metadata for ${i}.`);return{address:i,symbol:s.trim(),decimals:a,chainId:t}}catch{throw new o(`Could not read valid token metadata for ${i}. Refusing to guess token decimals.`)}}function tt(e){let t=F(e.key)?e.key:F(e.poolKey)?e.poolKey:void 0,n=t?.fee??e.fee??ze,r=(typeof n=="string"&&/^\d+$/.test(n),Number(n));if(!Number.isInteger(r)||r<0||r>We)throw new o("Pool fee must be a valid uint24 integer (default 8388608 for Hookr dynamic fee pools).");let i=t?.tickSpacing??e.tickSpacing??qe,u=(typeof i=="string"&&/^-?\d+$/.test(i),Number(i));if(!Number.isInteger(u)||u<=0||u>Ge)throw new o("Pool tickSpacing must be a positive int24 integer.");let s=t?.hooks??e.hooks??ve;if(typeof s!="string"||!E(s,{strict:!1}))throw new o("Provide a valid Hookr root contract address for hooks.");let a=l(s);if(t?.currency0!==void 0&&t?.currency1!==void 0||e.currency0!==void 0&&e.currency1!==void 0){let m=$(t?.currency0??e.currency0,"currency0"),I=$(t?.currency1??e.currency1,"currency1");if(m.toLowerCase()===I.toLowerCase())throw new o("Pool currency0 and currency1 must be distinct token addresses.");if(BigInt(m)>=BigInt(I))throw new o("Pool currency0 must sort strictly before currency1 by address.");let b;if(typeof e.zeroForOne=="boolean")b=e.zeroForOne;else if(e.tokenIn!==void 0||e.from!==void 0){let C=$(e.tokenIn??e.from,"tokenIn");if(C.toLowerCase()===m.toLowerCase())b=!0;else if(C.toLowerCase()===I.toLowerCase())b=!1;else throw new o("tokenIn does not match currency0 or currency1 of the pool key.")}else throw new o("Provide zeroForOne (boolean) or tokenIn when specifying a pool key.");return{key:{currency0:m,currency1:I,fee:r,tickSpacing:u,hooks:a},zeroForOne:b}}let w=e.tokenIn??e.from,f=e.tokenOut??e.to;if(w===void 0||f===void 0)throw new o("Provide either key ({ currency0, currency1, fee, tickSpacing, hooks }) with zeroForOne or tokenIn and tokenOut addresses.");let g=$(w,"tokenIn"),k=$(f,"tokenOut");if(g.toLowerCase()===k.toLowerCase())throw new o("Input and output tokens must have distinct addresses.");let p=BigInt(g)<BigInt(k),y=p?g:k,d=p?k:g;if(typeof e.zeroForOne=="boolean"&&e.zeroForOne!==p)throw new o("zeroForOne conflicts with the canonical sorting of tokenIn and tokenOut.");return{key:{currency0:y,currency1:d,fee:r,tickSpacing:u,hooks:a},zeroForOne:p}}function nt(e,t,n){let r=Y(t),i=r*r;if(n){let s=j(e.toString(),i.toString(),fe.toString(),"ceil");return BigInt(s)}let u=j(e.toString(),fe.toString(),i.toString(),"ceil");return BigInt(u)}function R(e,t){if(typeof e=="bigint"){if(e<0n)throw new o(`${t} must be a non-negative integer.`);return e}if(typeof e=="number"){if(!Number.isSafeInteger(e)||e<0)throw new o(`${t} must be a non-negative safe integer.`);return BigInt(e)}if(typeof e=="string")return H(e.trim());throw new o(`Provide ${t} as a decimal base-unit string.`)}async function ot(e,t){if(t!==void 0)return R(t,"now");if(typeof e.getBlock=="function"){let n=await e.getBlock().catch(()=>{throw new o("Could not read the chain timestamp for Hookr order expiry.")});return BigInt(n.timestamp)}throw new o("Could not read the chain timestamp for Hookr order expiry.")}function Ae(e,t){return!e.changes||e.changes.length===0?"no net ERC-20 transfer deltas":e.changes.map(n=>`${et(n.amount,n.token.decimals,t.formatAmount)} ${S(n.token.symbol)}`).join(", ")}function rt(e,t,n,r){if(!e||!Array.isArray(e.logs))throw new o("Provide a transaction receipt with a logs array.");for(let i of e.logs){if(!i||typeof i.address!="string"||!E(i.address,{strict:!1})||!Array.isArray(i.topics)||typeof i.data!="string"||i.topics.some(u=>typeof u!="string"||!/^0x[0-9a-fA-F]{64}$/.test(u)))throw new o(`Malformed Hookr ${t} receipt log.`);if(i.address.toLowerCase()===A.toLowerCase()&&i.topics[0]?.toLowerCase()===n.toLowerCase()){if(i.topics.length!==4||!/^0x0{24}/i.test(i.topics[2])||t==="OrderCancelled"&&!/^0x0{24}/i.test(i.topics[3])||!/^0x[0-9a-fA-F]*$/.test(i.data)||i.data.length!==2+r*64)throw new o(`Malformed Hookr ${t} receipt log.`);return{topics:i.topics,data:i.data}}}throw new o(`Could not find Hookr ${t} event in transaction receipt logs.`)}function he(e){if(e.receipt!==void 0){if(!F(e.receipt)||!Array.isArray(e.receipt.logs))throw new o("Provide a transaction receipt with a logs array.");return st({logs:e.receipt.logs})}if(e.logs!==void 0){if(!Array.isArray(e.logs))throw new o("Provide receipt logs as an array.");return it(e.logs)}}function Se(e){let t=rt(e,"OrderCreated",Ze,6);try{let n=$e({abi:P,eventName:"OrderCreated",...t,strict:!0});if(pe(we("bool, uint128, uint128, uint128, uint40, address"),[n.args.zeroForOne,n.args.amountIn,n.args.minAmountOut,n.args.bounty,n.args.expiry,n.args.recipient]).toLowerCase()!==t.data.toLowerCase())throw new o("Noncanonical Hookr OrderCreated event data.");return{orderId:n.args.orderId.toString(),owner:l(n.args.owner),poolId:n.args.poolId,zeroForOne:n.args.zeroForOne,amountIn:n.args.amountIn.toString(),minAmountOut:n.args.minAmountOut.toString(),bounty:n.args.bounty.toString(),expiry:n.args.expiry.toString(),recipient:l(n.args.recipient)}}catch{throw new o("Malformed Hookr OrderCreated receipt log.")}}function it(e){return Se({logs:e}).orderId}function st(e){return Se(e).orderId}function xe(e){if(Array.isArray(e)){let[n,r,i,u,s,a,c,w,f,g,k]=e;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:r,createdAt:i,expiry:u,zeroForOne:s,status:a,recipient:c,amountIn:BigInt(w),minAmountOut:BigInt(f),bounty:BigInt(g),sqrtPriceLimitX96:BigInt(k)}}let t=e;return{key:{currency0:t.key.currency0,currency1:t.key.currency1,fee:Number(t.key.fee),tickSpacing:Number(t.key.tickSpacing),hooks:t.key.hooks},owner:t.owner,createdAt:t.createdAt,expiry:t.expiry,zeroForOne:!!t.zeroForOne,status:Number(t.status),recipient:t.recipient,amountIn:BigInt(t.amountIn),minAmountOut:BigInt(t.minAmountOut),bounty:BigInt(t.bounty),sqrtPriceLimitX96:BigInt(t.sqrtPriceLimitX96)}}async function Ce(e,t,n){let r=R(t,"orderId");if(r<=0n)throw new o("Order ID must be a positive integer.");let i=e.clientFor(x),u=n?.order??await i.readContract({address:A,abi:P,functionName:"getOrder",args:[r]}).catch(()=>{throw new o(`Could not read Hookr order #${r}. Order coverage is incomplete.`)}),s=xe(u),a=Number(s.status);if(s.owner.toLowerCase()===L.toLowerCase()||a===ee)throw new o(`Hookr order #${r} does not exist.`);let c={currency0:l(s.key.currency0),currency1:l(s.key.currency1),fee:Number(s.key.fee),tickSpacing:Number(s.key.tickSpacing),hooks:l(s.key.hooks)},w=s.zeroForOne?c.currency0:c.currency1,f=s.zeroForOne?c.currency1:c.currency0,g=m=>{let I=m.toLowerCase(),b=n?.tokens.get(I);if(b)return b;let C=J(m,x,i);return n?.tokens.set(I,C),C},[k,p]=await Promise.all([g(w),g(f)]),y=!1,d=0n;if(a===M)try{let m=await i.readContract({address:A,abi:P,functionName:"quoteFill",args:[r]});if(typeof m[0]!="boolean"||typeof m[1]!="bigint"||m[1]<0n)throw new o(`Invalid quote for Hookr order #${r}.`);y=m[0],d=m[1]}catch{throw new o(`Could not quote Hookr order #${r}. Fillability and output amount are unknown.`)}return{orderId:r.toString(),poolId:Oe(c),key:c,owner:l(s.owner),recipient:l(s.recipient),createdAt:BigInt(s.createdAt).toString(),expiry:BigInt(s.expiry).toString(),zeroForOne:s.zeroForOne,status:a,statusLabel:Je(a),amountIn:s.amountIn.toString(),minAmountOut:s.minAmountOut.toString(),bounty:s.bounty.toString(),sqrtPriceLimitX96:s.sqrtPriceLimitX96.toString(),tokenIn:k,tokenOut:p,fillable:y,quotedAmountOut:d.toString()}}function at(e){return{name:"hookr_create",inputSchema:{type:"object",properties:{key:{type:"object",description:"Uniswap v4 PoolKey of the pool to place the order in; omitted fee, tickSpacing and hooks use Hookr defaults. tokenIn or zeroForOne picks the direction.",properties:{currency0:{type:"string",description:"Lower-sorted pool token address (0x followed by 40 hex digits)."},currency1:{type:"string",description:"Higher-sorted pool token address (0x followed by 40 hex digits)."},fee:{type:"number",description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%); default 8388608, the v4 dynamic-fee flag of Hookr pools."},tickSpacing:{type:"number",description:"Pool tick spacing, a positive integer; defaults to the Hookr pool spacing."},hooks:{type:"string",description:"Address of the pool hook contract; defaults to the Hookr root hook."}}},tokenIn:{type:"string",description:"Input token address on chain 4663."},tokenOut:{type:"string",description:"Output token address on chain 4663."},zeroForOne:{type:"boolean",description:"True when selling currency0 for currency1."},amountIn:{type:"string",description:"Input amount in base units (uint128)."},minAmountOut:{type:"string",description:"Minimum net output amount in base units (uint128)."},tick:{type:"number",description:"Optional limit tick in [-887272, 887272]."},expiry:{type:"string",description:"Order expiry unix timestamp in seconds (uint40)."},deadline:{type:"string",description:"Alias for expiry unix timestamp in seconds."},bounty:{type:"string",description:"Keeper bounty in native ETH wei (uint128)."},recipient:{type:"string",description:"Order output recipient address (must be the signing wallet)."},sqrtPriceLimitX96:{type:"string",description:"Optional sqrtPriceLimitX96 (defaults to 0)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["amountIn"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=e.clientFor(i),s=he(t),{key:a,zeroForOne:c}=tt(t),w=c?a.currency0:a.currency1,f=c?a.currency1:a.currency0,[g,k]=await Promise.all([J(w,i,u,t.tokenInMeta),J(f,i,u,t.tokenOutMeta)]),p=t.recipient??r;if(typeof p!="string"||!E(p,{strict:!1}))throw new o("Provide a valid recipient address for the Hookr limit order.");let y=l(p);if(Ie(y,a.hooks),y!==r)throw new o("Hookr recipient must be the signing wallet.");if(typeof t.amountIn!="string")throw new o("Provide amountIn as an integer string in base units.");let d=H(t.amountIn);if(d<=0n||d>Ue)throw new o("amountIn must be between 1 and int128.max base units.");if(t.tick!==void 0){let T=Number(t.tick);Y(T)}let m;if(t.minAmountOut!==void 0){if(typeof t.minAmountOut!="string")throw new o("Provide minAmountOut as an integer string in base units.");m=H(t.minAmountOut)}else if(t.tick!==void 0)m=nt(d,Number(t.tick),c);else throw new o("Provide minAmountOut in base units (or tick to derive minAmountOut).");if(m<=0n||m>le)throw new o("minAmountOut must be between 1 and uint128.max base units.");let I=t.sqrtPriceLimitX96!==void 0?R(t.sqrtPriceLimitX96,"sqrtPriceLimitX96"):0n;if(I>je)throw new o("sqrtPriceLimitX96 exceeds uint160 bounds.");let b=await ot(u,t.now),C=t.expiry??t.deadline,O;if(C!==void 0)O=R(C,"expiry");else if(t.lifetime!==void 0||t.ttlSeconds!==void 0){let T=R(t.lifetime??t.ttlSeconds,"lifetime");O=b+T}else O=b+Xe;if(O<b+ce)throw new o(`Order expiry (${O}) is expired or below the minimum lifetime of ${ce} seconds from block timestamp ${b}.`);if(O>b+ue||O>Ve)throw new o(`Order expiry (${O}) exceeds the maximum lifetime of ${ue} seconds (365 days).`);let z=await u.readContract({address:A,abi:P,functionName:"bountyBounds",args:[a,c,d,m]}).catch(()=>{throw new o("Could not read Hookr bounty bounds.")}),_=BigInt(z[0]),q=BigInt(z[1]),X=BigInt(z[2]);if(t.bounty!==void 0&&typeof t.bounty!="string")throw new o("Provide bounty as an integer string in base units.");let h=t.bounty!==void 0?H(t.bounty):q,K=_>0n?_:q;if(h<_||K>0n&&h<K)throw new o(`Order keeper bounty (${h} wei) is underbounty: must be at least ${K} wei (default keeper bounty floor).`);if(h>X||h>le)throw new o(`Order keeper bounty (${h} wei) exceeds the maximum allowed bounty of ${X} wei.`);let te=w.toLowerCase()===L.toLowerCase(),v=[];if(!te){let T;try{let U=await u.readContract({address:w,abi:Z,functionName:"allowance",args:[r,A]});if(typeof U!="bigint"||U<0n)throw new o("Invalid token allowance.");T=U}catch{throw new o(`Could not read token allowance for ${w}. No approval was prepared.`)}T<d&&v.push(e.approval(w,A,d.toString(),i))}let Pe=te?d+h:h,Le=ye({abi:P,functionName:"createOrder",args:[{key:a,zeroForOne:c,amountIn:d,minAmountOut:m,sqrtPriceLimitX96:I,recipient:y,expiry:Number(O),bounty:h}]}),ne=e.formatAmount(d.toString(),g.decimals),oe=e.formatAmount(m.toString(),k.decimals),re=e.formatAmount(h.toString(),18),Te=e.unsignedTx({to:A,data:Le,value:Pe.toString(),chainId:i,description:`Create Hookr limit order on ${A}: sell ${ne} ${S(g.symbol)} (${g.address}) for at least ${oe} ${S(k.symbol)} (${k.address}) with ${re} ETH keeper bounty (fee=${a.fee}, tickSpacing=${a.tickSpacing}, expiry=${O}).`});v.push(Te);let ie=await e.preview(v,r),Re=Ae(ie,e),He=Oe(a);return{txs:v,summary:`Hookr limit order prepared: sell ${ne} ${S(g.symbol)} for at least ${oe} ${S(k.symbol)} (bounty ${re} ETH, expiry ${O}; preview deltas: ${Re}).`,preview:ie,poolId:He,key:a,zeroForOne:c,amountIn:d.toString(),minAmountOut:m.toString(),bounty:h.toString(),bountyBounds:{minBounty:_.toString(),defaultBounty:q.toString(),maxBounty:X.toString()},expiry:O.toString(),recipient:y,sqrtPriceLimitX96:I.toString(),tokenIn:g,tokenOut:k,...s!==void 0?{orderId:s}:{}}}}}function dt(e){return{name:"hookr_cancel",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"Hookr order ID to cancel (uint256 decimal string)."},to:{type:"string",description:"Recipient address for the refunded principal and bounty (must be the signing wallet)."},chainId:{type:"number",description:"Must be 4663 (Robinhood Chain)."}},required:["orderId"]},async execute(t,n){N(n);let r=l(n),i=be(t.chainId),u=he(t),s=t.orderId??t.id??u;if(s===void 0)throw new o("Provide orderId to cancel a Hookr limit order.");let a=R(s,"orderId");if(a<=0n)throw new o("orderId must be a positive integer.");let c=await Ce(e,a);if(c.owner.toLowerCase()!==r.toLowerCase())throw new o(`Unauthorized cancellation: only the order owner (${c.owner}) can cancel Hookr order #${a} (caller is ${r}).`);if(c.status!==M)throw new o(`Hookr order #${a} is not open (current status: ${c.statusLabel}).`);let w=t.to??r;if(typeof w!="string"||!E(w,{strict:!1}))throw new o("Provide a valid refund recipient address for cancel.");let f=l(w);if(Ie(f,c.key.hooks),f!==r)throw new o("Hookr refund recipient must be the signing wallet.");let g=ye({abi:P,functionName:"cancel",args:[a,f]}),k=e.formatAmount(c.amountIn,c.tokenIn.decimals),p=e.formatAmount(c.bounty,18),y=e.unsignedTx({to:A,data:g,value:"0",chainId:i,description:`Cancel Hookr limit order #${a} on ${A} and refund ${k} ${S(c.tokenIn.symbol)} plus ${p} ETH bounty to ${f}.`}),d=await e.preview([y],r),m=Ae(d,e);return{txs:[y],summary:`Cancel Hookr limit order #${a}: refund ${k} ${S(c.tokenIn.symbol)} and ${p} ETH bounty to ${f} (preview deltas: ${m}).`,preview:d,orderId:a.toString(),to:f,refundedAmountIn:c.amountIn,refundedBounty:c.bounty,tokenIn:c.tokenIn,tokenOut:c.tokenOut}}}}function ct(e){let t=performance.now()+Ke;return new Proxy(e,{get(n,r,i){return r!=="readContract"?Reflect.get(n,r,i):async(...u)=>{let s=t-performance.now(),a=()=>new o("Hookr scan deadline exceeded. Order coverage is incomplete; retry later.");if(s<=0)throw a();let c;try{return await Promise.race([n.readContract(...u),new Promise((w,f)=>{c=setTimeout(()=>f(a()),s)})])}finally{c!==void 0&&clearTimeout(c)}}}})}function ut(e){return async t=>{N(t);let n=l(t),r=ct(e.clientFor(x)),i={...e,clientFor:()=>r},u=await r.readContract({address:A,abi:P,functionName:"lastOrderId"}).catch(()=>{throw new o("Could not read the last Hookr order ID. Order coverage is incomplete.")});if(typeof u!="bigint"||u<0n)throw new o("Could not read a valid last Hookr order ID. Order coverage is incomplete.");let s=u,a=s>me?s-me+1n:1n;if(s<=0n)return[];let c=[],w=new Map;for(let f=a;f<=s;f+=Q){let g=Array.from({length:Number(s-f+1n<Q?s-f+1n:Q)},(p,y)=>f+BigInt(y)),k=await Promise.all(g.map(async p=>{let y=await r.readContract({address:A,abi:P,functionName:"getOrder",args:[p]}).catch(()=>{throw new o(`Could not read Hookr order #${p}. Order coverage is incomplete.`)}),d=xe(y);if(d.owner.toLowerCase()===L||Number(d.status)===ee)throw new o(`Hookr order #${p} does not exist. Order coverage is incomplete.`);return{id:p,order:d}}));for(let{id:p,order:y}of k){if(y.owner.toLowerCase()!==n.toLowerCase()||Number(y.status)!==M)continue;let d=await Ce(i,p,{order:y,tokens:w}),m=[{token:d.tokenIn,amount:d.amountIn}];BigInt(d.bounty)>0n&&m.push({token:{address:B,symbol:"ETH",decimals:18,chainId:x},amount:d.bounty});let I=e.formatAmount(d.amountIn,d.tokenIn.decimals),b=e.formatAmount(d.minAmountOut,d.tokenOut.decimals),C=e.formatAmount(d.bounty,18),O=e.formatAmount(d.quotedAmountOut,d.tokenOut.decimals);c.push({module:"hookr",id:d.orderId,chainId:x,assets:m,description:`Hookr open limit order #${d.orderId}: sell ${I} ${S(d.tokenIn.symbol)} (${d.tokenIn.address}) for at least ${b} ${S(d.tokenOut.symbol)} (${d.tokenOut.address}), bounty ${C} ETH, expiry ${d.expiry}, fillable=${d.fillable} (quoted output ${O} ${S(d.tokenOut.symbol)}).`})}}return a>1n&&c.push({module:"hookr",id:"coverage",chainId:x,assets:[],description:`Hookr order coverage is incomplete: scanned IDs ${a}-${s}. Older orders require an explicit order ID.`}),c}}var De=e=>{let t=[at(e),dt(e)],n=ut(e);return{tools:t,positions:n}},Lt=De,Tt=De;export{A as a,ve as b,Ne as c,It as d,Be as e,Fe as f,At as g,Me as h,ze as i,qe as j,ce as k,Xe as l,ue as m,ht as n,St as o,xt as p,Ct as q,me as r,Ke as s,ee as t,M as u,Ye as v,Qe as w,Ze as x,Dt as y,P as z,et as A,Pt as B,Oe as C,rt as D,Se as E,it as F,st as G,xe as H,Ce as I,at as J,dt as K,ct as L,ut as M,De as N,Lt as O,Tt as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A}from"./5HCXZWUH.js";import{
|
|
1
|
+
import{c as A}from"./5HCXZWUH.js";import{o as y}from"./6NUNCD5J.js";import{a as b}from"./XSD5NL7J.js";import{erc20Abi as F,getAddress as $}from"viem";var P=new WeakMap,E=3e3,k=new WeakMap;async function q(C,h,u,m,c){u=$(u);let n=A(C),e=P.get(n);e||(e=new Map,P.set(n,e));let i=`${h}:${u.toLowerCase()}:${m}:${c??"latest"}`,t=e.get(i);if(t&&(e.delete(i),e.set(i,t)),!t){for(t=new Promise((s,T)=>{let a=k.get(n);a||(a=new Map,k.set(n,a));let f=`${h}:${c??"latest"}`,l=a.get(f);if(!l){l=[],a.set(f,l);let d=l;queueMicrotask(async()=>{a.delete(f);let w=d.map(r=>({address:r.address,abi:F,functionName:r.field}));try{if(d.length>1&&n.chain?.contracts?.multicall3&&typeof n.multicall=="function"){let r=await y(()=>n.multicall({contracts:w,blockNumber:c,allowFailure:!0}));d.forEach((o,p)=>{let g=r[p];g?.status==="success"?o.resolve(g.result):o.reject(g?.error??new b("Token metadata could not be read."))})}else await Promise.all(d.map(async(r,o)=>{try{r.resolve(await y(()=>n.readContract({...w[o],blockNumber:c})))}catch(p){r.reject(p)}}))}catch(r){d.forEach(o=>o.reject(r))}})}l.push({address:u,field:m,resolve:s,reject:T})}).then(s=>{if(m==="decimals"?!Number.isInteger(s)||Number(s)<0||Number(s)>255:typeof s!="string"||!s.trim())throw new b("The contract returned invalid token metadata.");return s});e.size>=E;)e.delete(e.keys().next().value);e.set(i,t);let M=t;t.catch(()=>{e.get(i)===M&&e.delete(i)})}try{return await t}finally{c!==void 0&&e.get(i)===t&&e.delete(i)}}export{q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as H,c as N}from"./NUFZUKYS.js";import{a as S}from"./LT5P6PZW.js";import{a as O}from"./G2LAO23N.js";import{a as D}from"./H5DY7CNB.js";import{a as C}from"./66F5ZH34.js";import{c as _,f as I}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as x,erc20Abi as L,getAddress as c,parseAbi as q,zeroAddress as M}from"viem";var k={timeShares:{factory:"timeFactory",abi:[{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ASSETS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"FOREVER",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint32"}]},{name:"MAX_LOCK_AMOUNT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MIN_LOCK_DIVISOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"minLockAmount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"MIN_TIP_GROWTH",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_ISSUE_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_CLAIM_DAYS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"currencyAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"address"}]},{name:"lockedTotal",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pendingLocks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"amount"},{type:"uint256",name:"tick"},{type:"uint256",name:"firstLock"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"heldAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},{name:"lockEpochs",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"uint256",name:"joinEpoch"},{type:"uint256",name:"leaveEpoch"}]},{name:"sweepable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"from"},{type:"uint256",name:"max"}],outputs:[{type:"uint256[]",name:"ids"},{type:"uint256",name:"next"}]},{name:"lockCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"lockAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"}],outputs:[{type:"tuple",components:[{type:"address",name:"owner"},{type:"uint64",name:"lockedAt"},{type:"uint32",name:"firstDay"},{type:"uint128",name:"amount"},{type:"uint32",name:"lastDay"},{type:"uint64",name:"unlockedAt"}]}]},{name:"isIssued",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"}],outputs:[{type:"bool"}]},{name:"unitSupply",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"}],outputs:[{type:"uint256"}]},{name:"currentDay",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"pointAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"k"}],outputs:[{type:"uint64",name:"timestamp"},{type:"uint256[]",name:"indexes"}]},{name:"index",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"carry",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"pulled",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"paid",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"held",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"dayIndex",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"holder"},{type:"uint256",name:"day"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lockClaimable",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"lock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"uint32",name:"numberOfDays"}],outputs:[{type:"uint256",name:"lockId"}]},{name:"issue",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"day"},{type:"address",name:"to"}],outputs:[]},{name:"issueRange",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"firstDay"},{type:"uint256",name:"lastDay"},{type:"address",name:"to"}],outputs:[]},{name:"unlock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"address",name:"to"}],outputs:[]},{name:"syncAssets",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"catchUp",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"max"}],outputs:[{type:"bool",name:"done"}]},{name:"settle",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"roll",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"sweepDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"},{type:"uint256",name:"claimGas"}],outputs:[{type:"uint256[]",name:"amounts"}]},{name:"claim",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"day"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimMany",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"days_"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"claimLock",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"lockId"},{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"allowance",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"id"}],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"receiver"},{type:"uint256",name:"id"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},dayWrapper:{factory:"wrapperFactory",abi:[{name:"shares",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"day",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"assetCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"basket",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"previewRedeem",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"amount"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"deposit",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"redeemShort",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"amount"},{type:"address",name:"to"}],outputs:[{type:"uint256[]",name:"cash"}]},{name:"owedTo",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"},{type:"uint256",name:"asset"}],outputs:[{type:"uint256"}]},{name:"claimOwed",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"asset"},{type:"address",name:"to"}],outputs:[]},{name:"collect",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]},compounder:{factory:"compoundFactory",abi:[{name:"MIN_SHARES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BANDS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_BAND_TICKS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"MAX_TIP_BPS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ADD_GAS_FLOOR",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_DRIFT",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_PERIOD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"ANCHOR_TOLERANCE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"DROP_SCAN",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DROP_CLAIM_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"parked",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"dropId"}],outputs:[{type:"bool"}]},{name:"syncSides",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"count"}]},{name:"token",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolManager",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"poolId",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{name:"poolKey",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"currency0"},{type:"address",name:"currency1"},{type:"uint24",name:"fee"},{type:"int24",name:"tickSpacing"},{type:"address",name:"hooks"}]}]},{name:"quote",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"tokenIsCurrency0",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"bool"}]},{name:"bandTicks",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"int24"}]},{name:"tipBps",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint16"}]},{name:"tipCap",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint128"}]},{name:"reserve",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"bands",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple[]",components:[{type:"int24",name:"tickLower"},{type:"int24",name:"tickUpper"},{type:"uint128",name:"liquidity"}]}]},{name:"anchor",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"tuple",components:[{type:"int24",name:"high"},{type:"int24",name:"low"},{type:"uint40",name:"lookedAt"}]}]},{name:"creator",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"nextDrop",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"holdings",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"deposit",type:"function",stateMutability:"payable",inputs:[{type:"uint256",name:"tokensMax"},{type:"uint256",name:"quoteMax"},{type:"address",name:"to"},{type:"uint256",name:"minShares"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"shares"},{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeem",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"redeemUnlocked",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"shares"},{type:"address",name:"to"},{type:"uint256",name:"minTokens"},{type:"uint256",name:"minQuote"},{type:"uint256",name:"deadline"}],outputs:[{type:"uint256",name:"tokens"},{type:"uint256",name:"quote"}]},{name:"poke",type:"function",stateMutability:"nonpayable",inputs:[],outputs:[{type:"uint256",name:"tip"}]},{name:"claimDrops",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256[]",name:"dropIds"}],outputs:[{type:"uint256",name:"tip"}]},{name:"listSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"asset"}],outputs:[{type:"uint256",name:"side"}]},{name:"SCALE",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"MAX_SIDES",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"SIDE_READ_GAS",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"DEAD",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"sideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"fixedSideCount",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideAt",type:"function",stateMutability:"view",inputs:[{type:"uint256",name:"side"}],outputs:[{type:"tuple",components:[{type:"address",name:"currency"},{type:"uint256",name:"index"},{type:"uint256",name:"carry"},{type:"uint128",name:"recognized"},{type:"uint128",name:"paid"},{type:"uint128",name:"dropped"},{type:"uint40",name:"droppedAt"}]}]},{name:"sideOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"currency"}],outputs:[{type:"bool",name:"listed"},{type:"uint256",name:"side"}]},{name:"dropStream",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"earningSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"sideClaimable",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"side"}],outputs:[{type:"uint256"}]},{name:"claimSide",type:"function",stateMutability:"nonpayable",inputs:[{type:"uint256",name:"side"},{type:"address",name:"to"}],outputs:[{type:"uint256",name:"amount"}]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{name:"totalSupply",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{name:"transfer",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[{type:"bool"}]}]}};var W=q(["function approve(address spender,uint256 id,uint256 amount) returns (bool)"]),R=t=>I(t,"Provide the documented Hookr add-on parameters."),X=t=>["view","pure"].includes(t.stateMutability);function E(t){return Object.entries(k).flatMap(([e,n])=>n.abi.filter(i=>X(i)===t).map(i=>({role:e,fn:i})))}var B={timeShares:"time-share locker of a revenue token",dayWrapper:"one-day wrapper of time shares",compounder:"compounding vault of a revenue token"};function T(t){return{type:"object",oneOf:E(t).map(({role:e,fn:n})=>({type:"object",properties:{addon:{const:e,description:`Add-on kind "${e}": the ${B[e]??e}.`},token:{..._,description:O.address("Hookr revenue token whose add-on is used")},...e==="dayWrapper"?{day:{...C(),description:'Day number that selects the day wrapper, as a decimal string. Example: "42".'}}:{},function:{const:n.name,description:`Add-on function to call: ${n.name}.`},params:{...H(n.inputs,n.name),description:`Arguments of ${e}.${n.name}; integers are decimal strings.`}},required:["addon","token",...e==="dayWrapper"?["day"]:[],"function","params"],additionalProperties:!1}))}}function P(t,e){let n=E(e).find(a=>a.role===t.addon&&a.fn.name===t.function);if(!n)throw new r("Choose a documented Hookr add-on function.");let i=["addon","token","function","params",...n.role==="dayWrapper"?["day"]:[]];if(Object.keys(t).length!==i.length||Object.keys(t).some(a=>!i.includes(a)))throw new r("Provide exactly the documented Hookr add-on arguments.");let s;try{s=c(String(t.token))}catch{throw new r("Provide a valid revenue token address.")}let p=0n;if(n.role==="dayWrapper"){if(typeof t.day!="string"||!/^(0|[1-9][0-9]*)$/.test(t.day)||t.day.length>78||BigInt(t.day)>=1n<<256n)throw new r("Provide a wrapper day as a decimal integer string.");p=BigInt(t.day)}return{...n,token:s,day:p,...N(n.fn,R(t.params))}}async function $(t,e,n,i){let s=t.clientFor(d),p=async(f,b,v=[])=>s.readContract({address:c(S[f].address),abi:S[f].abi,functionName:b,args:v}),a=R(await p("tokenizer","tokenizations",[n]));if(typeof a.createdAt!="bigint"||a.createdAt<=0n||c(String(a.creator))===M)throw new r("Current Hookr tokenizer has no matching token record; legacy add-ons need their generation-specific route.");let m=e==="compounder"?void 0:c(String(await p("timeFactory","sharesOf",[n]))),u=e==="timeShares"?m:e==="compounder"?c(String(await p("compoundFactory","vaultOf",[n]))):c(String(await p("wrapperFactory","wrapperOf",[m,i])));if(u===M||m===M)throw new r("Hookr add-on is not open yet. Open it with its pinned factory through hookr_action first.");let y=k[e].abi,l=await s.readContract({address:u,abi:y,functionName:e==="dayWrapper"?"shares":"token"});if(c(String(l))!==(e==="dayWrapper"?m:n))throw new r("Hookr add-on disagrees with its factory record.");if(e==="dayWrapper"&&await s.readContract({address:u,abi:y,functionName:"day"})!==i)throw new r("Hookr day wrapper disagrees with its factory day.");return{target:u,shares:m}}async function K(t,e,n){if(t.network==="testnet")throw new r("Hookr add-ons require mainnet, chain 4663.");let{role:i,token:s,day:p,fn:a,values:m,params:u}=P(e,!1),{target:y,shares:l}=await $(t,i,s,p),f=[],b=[],v=0n,h=t.clientFor(d),A=async(o,w)=>{if(w<0n||w>=1n<<128n)throw new r("Hookr add-on funding exceeds its bounded exact approval.");if(!w)return;if(o===M){v+=w,b.push({token:D,amount:w,to:y});return}let g=await h.readContract({address:o,abi:L,functionName:"allowance",args:[n,y]});g>0n&&g!==w&&f.push(t.approval(o,y,"0",d)),f.push(t.approval(o,y,w.toString(),d)),b.push({token:o,amount:w})};if(i==="timeShares"&&a.name==="lock"&&await A(s,u.amount),i==="dayWrapper"&&a.name==="deposit"){let o=u.amount;if(o<=0n||o>=1n<<128n)throw new r("Hookr wrapper deposit needs a positive bounded share amount.");f.push(t.unsignedTx({chainId:d,to:l,value:"0",data:x({abi:W,functionName:"approve",args:[y,p,o]}),description:`Approve exactly ${o} time shares of day ${p} to the factory-recorded wrapper ${y}.`})),b.push({token:l,id:p,amount:o,to:y})}if(i==="compounder"&&a.name==="deposit"){let o=c(String(await h.readContract({address:y,abi:k.compounder.abi,functionName:"quote"})));await A(s,u.tokensMax),await A(o,u.quoteMax)}if(["redeem","redeemShort","redeemUnlocked"].includes(a.name)&&b.push({token:y,amount:u.shares??u.amount,to:M}),a.name==="transfer"&&b.push({token:y,amount:u.amount,to:c(String(u.receiver??u.to)),...i==="timeShares"?{id:u.id}:{}}),u.deadline!==void 0){let o=await h.getBlock();if(typeof o.timestamp!="bigint"||u.deadline<o.timestamp)throw new r("Hookr add-on deadline expired or chain time is unavailable.")}return f.push(t.unsignedTx({chainId:d,to:y,value:v.toString(),data:x({abi:[a],functionName:a.name,args:m}),description:`Hookr ${i}.${a.name}: ${JSON.stringify(e.params)}. Token ${s}${i==="dayWrapper"?`; day ${p}`:""}. Review lock duration, recipients and minimum outputs.`})),{txs:f,inputs:b}}function nt(t){return[{name:"hookr_addon_read",inputSchema:{...T(!0),description:"Read factory-verified current Hookr revenue time shares, day wrappers or compounders: locks, day income, unwrap baskets, bands and side assets. Open factories via hookr_action."},execute:async e=>{let{role:n,token:i,day:s,fn:p,values:a}=P(e,!0),{target:m}=await $(t,n,i,s),u=await t.clientFor(d).readContract({address:m,abi:[p],functionName:p.name,args:a});return{chainId:d,token:i,contract:m,function:p.name,result:JSON.parse(JSON.stringify(u,(y,l)=>typeof l=="bigint"?l.toString():l))}}},{name:"hookr_addon_action",inputSchema:{...T(!1),description:"Preview current Hookr time-share lock/issue/unlock/roll/claims, day wrap/unwrap/owed claims, or compound deposit/redeem/poke/side claims. Exact approvals, factory provenance and local human confirmation required."},execute:async(e,n)=>{let{txs:i}=await K(t,e,n),s=await t.preview(i,n);return{txs:i,preview:s,summary:`Hookr ${e.addon}.${e.function}; verify the receipt and read the resulting lock or balances.`}}}]}export{K as a,nt as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as w,d as A,i as T,m as C}from"./NWNYJ26T.js";import{a as c,i as _}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as O,getAddress as x,keccak256 as D,parseAbi as P}from"viem";var g=x("0x03695edcfcf2c62a4dc36b032eb2513cd1d928a2"),S="0x0b3d9287f6788f70f8f32597eb50d8aaf791742819ecf58053f3e22fd96cb76b",$=["beefy_vault_manage"],I=P(["function owner() view returns(address)","function want() view returns(address)","function vault() view returns(address)","function strategy() view returns(address)","function approvalDelay() view returns(uint256)","function stratCandidate() view returns(address implementation,uint256 proposedTime)","function earn()","function proposeStrat(address)","function upgradeStrat()","function inCaseTokensGetStuck(address)","function transferOwnership(address)","function renounceOwnership()"]),i=x(_[c].vaults.beefyTestedLpVault.address);function d(p){return T(p,"Provide a contract or wallet address.",A)}function m(p){return C(p,"Invalid Beefy administration integer.")}var F=p=>{async function v(e){try{return await e()}catch(t){throw new r(p.plainError(t))}}function b(e,t){if(e.chainId!==void 0&&e.chainId!==c)throw new r("Beefy requires chain 4663.");for(let u of Object.keys(e))if(!["chainId","vault",...t].includes(u))throw new r(`Unsupported Beefy input: ${u}.`);if(d(e.vault)!==i)throw new r("Administration is qualified only for the measured up33-weth-up vault.")}async function k(){let e=p.clientFor(c);if(await e.getChainId()!==c)throw new r("The Beefy endpoint must report chain 4663.");let t=m(await e.getBlockNumber()),[u,n]=await Promise.all([e.getCode({address:i,blockNumber:t}),e.getCode({address:g,blockNumber:t})]),o=`0x363d3d373d3d3d363d73${g.slice(2).toLowerCase()}5af43d82803e903d91602b57fd5bf3`;if(u?.toLowerCase()!==o||!n||D(n)!==S)throw new r("The Beefy vault implementation no longer matches its qualified code hash.");let a=(E,N)=>e.readContract({address:E,abi:I,functionName:N,blockNumber:t}),[f,h,y,s,l,B]=await Promise.all([a(i,"owner"),a(i,"want"),a(i,"strategy"),a(i,"approvalDelay"),a(i,"stratCandidate"),e.getBlock({blockNumber:t})]);if(!Array.isArray(l)||l.length!==2)throw new r("Invalid Beefy strategy candidate.");return{client:e,blockNumber:t,owner:d(f),want:d(h),strategy:d(y),approvalDelay:m(s),candidate:{implementation:d(l[0]),proposedTime:m(l[1])},timestamp:m(B.timestamp),read:a}}return{tools:[{name:"beefy_vault_admin",inputSchema:{type:"object",properties:{vault:{...w,description:"Address of the Beefy vault contract; only the qualified up33-weth-up vault is supported."},chainId:{const:c,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault"],additionalProperties:!1},execute:e=>v(async()=>{b(e,[]);let t=await k();return{vault:i,chainId:c,owner:t.owner,want:t.want,strategy:t.strategy,candidate:{implementation:t.candidate.implementation,proposedTime:t.candidate.proposedTime.toString()},approvalDelay:t.approvalDelay.toString(),block:t.blockNumber.toString(),implementation:g,codeHash:S}})},{name:"beefy_vault_manage",inputSchema:{type:"object",properties:{vault:{...w,description:"Address of the Beefy vault contract; only the qualified up33-weth-up vault is supported."},action:{enum:["earn","propose_strategy","upgrade_strategy","rescue_tokens","transfer_ownership","renounce_ownership"],description:"earn: put idle want to work; propose_strategy then upgrade_strategy after the approval delay; rescue stuck tokens; transfer or permanently renounce ownership. Owner only except earn."},strategy:{...w,description:"Address of the new strategy contract to propose, deployed for this vault and its want token."},token:{...w,description:"Address of the stuck token to rescue to the owner wallet; the want token cannot be rescued."},recipient:{...w,description:"Address of the new owner for transfer_ownership; must not be the zero address."},chainId:{const:c,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["vault","action"],additionalProperties:!1},execute:(e,t)=>v(async()=>{let u={earn:[],propose_strategy:["strategy"],upgrade_strategy:[],rescue_tokens:["token"],transfer_ownership:["recipient"],renounce_ownership:[]},n=String(e.action);if(!Object.hasOwn(u,n))throw new r("Choose a documented Beefy vault management action.");b(e,["action",...u[n]]),t=d(t);let o=await k();if(n!=="earn"&&o.owner!==t)throw new r("This wallet is not the Beefy vault owner.");let a,f=[];if(n==="earn")a="earn";else if(n==="propose_strategy"){let s=d(e.strategy),l=await o.client.getCode({address:s,blockNumber:o.blockNumber});if(!l||l==="0x"||d(await o.read(s,"vault"))!==i||d(await o.read(s,"want"))!==o.want)throw new r("The proposed strategy must be deployed for this exact vault and want token.");a="proposeStrat",f=[s]}else if(n==="upgrade_strategy"){if(o.candidate.implementation==="0x0000000000000000000000000000000000000000"||o.candidate.proposedTime+o.approvalDelay>=o.timestamp)throw new r("Propose a strategy first and wait until the on-chain approval delay has fully passed.");a="upgradeStrat"}else if(n==="rescue_tokens"){let s=d(e.token);if(s===o.want)throw new r("The vault owner cannot rescue the want token.");a="inCaseTokensGetStuck",f=[s]}else if(n==="transfer_ownership"){let s=d(e.recipient);if(s==="0x0000000000000000000000000000000000000000")throw new r("Ownership transfer needs a nonzero recipient.");a="transferOwnership",f=[s]}else a="renounceOwnership";let h=[p.unsignedTx({to:i,data:O({abi:I,functionName:a,args:f}),value:"0",chainId:c,description:`Beefy vault ${n}.`})],y=n==="renounce_ownership"?" This permanently gives up owner administration.":n==="rescue_tokens"?" Rescued tokens go to the calling owner wallet; want is excluded.":n==="propose_strategy"||n==="upgrade_strategy"?" Strategy changes affect all vault depositors.":"";return{txs:h,inputs:[],preview:await p.preview(h,t),summary:`Beefy vault action ${n} on ${i}.${y} Inspect the preview before local human confirmation.`}})}]}};export{g as a,S as b,$ as c,I as d,F as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as pe,c as me}from"./WV3A3OUU.js";import{a as ue}from"./SPJCSEKP.js";import{a as be}from"./43LI5NKJ.js";import{c as le}from"./VEQBHI6O.js";import{a as O}from"./66F5ZH34.js";import{c as Y,d as oe,g as I,i as fe,m as re,n as se}from"./NWNYJ26T.js";import{a as S,i as de,j as ie}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{decodeFunctionData as J,encodeFunctionData as T,erc20Abi as te,getAddress as Ce,keccak256 as he,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-11-04T21:56:26.556Z",block:"106231118",routeBlock:"106231118",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a","0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6":"0xd6f09e63327b36d3c498f8de8768bd3e4336894cd00ddb36aa9e0a1e4a4c911e"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"},qualificationHistory:[{observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",implementationHash:"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c"}],blockHash:"0xcb0e2862c6e22ca5854fb9264995749e497eb26f05a3370202db69909b891c47"};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],X=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ce=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),Fe=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),ge={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ye=P(["function deposit() payable"]),Z={vault:Y,chainId:{const:S},slippageBps:{type:"integer",minimum:0,maximum:500}},Be=10n**36n,z=Ce(de[S].uniswap.WETH.address),ve="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ke=Object.fromEntries(Object.entries(q.codeHashes).map(([d,s])=>[d.toLowerCase(),s])),Ae=Object.fromEntries(Object.entries(q.delegates).map(([d,s])=>[d.toLowerCase(),s]));function f(d){return fe(d,"Provide a token or vault address.",oe)}function F(d){return re(d,"Invalid Beefy CLM integer.")}function G(d,s=!1){return se(d,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!s})}function K(d){let s=d??50;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>500)throw new o("Use integer slippageBps from 0 to 500.");return BigInt(s)}function Q(d,s){let m=d*(10000n-s)/10000n;if(m<=0n)throw new o("This CLM amount is too small for a positive output minimum.");return m}function ne(d,s){if(!Array.isArray(d)||d.length!==s)throw new o("Invalid Beefy CLM quote.");return d.map(F)}function Se(d){let s=f(d),m=De.find(b=>I(b.vault,s));if(!m)throw new o("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return m}function Me(d,s,m,b,C){if(d<=0n||m<=0n||b<0n||C<0n)throw new o("The CLM price or budget is invalid.");let E=s?d*m/Be:d;if(E===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=C>e?C-e:e-C,a=E<t?E:t,r=(E-a)/2n,c=d*(C>e?a+r:r)/E;return[c,d-c]}var Ee=d=>{async function s(e){try{return await e()}catch(t){throw new o(d.plainError(t))}}function m(e,t){if(e.chainId!==void 0&&e.chainId!==S)throw new o("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new o(`Unsupported Beefy CLM input: ${a}.`);return Se(e.vault)}async function b(e,t){be(t);let a=d.clientFor(S);if(await a.getChainId()!==S)throw new o("The Beefy CLM endpoint must report chain 4663.");let r=F(await a.getBlockNumber()),c=await a.getBlock({blockNumber:r}),n=(B,p,A=[])=>a.readContract({address:f(B),abi:X,functionName:p,args:A,blockNumber:r}),i=new Set;async function l(B){let p=B.toLowerCase();if(i.has(p))return;let A=ke[p];if(!A)throw new o("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:r});if(!D||he(D)!==A)throw new o("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");i.add(p),Ae[p]&&await l(Ae[p])}await me(a,f(e.vault),r);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await l(B);let[g,u,y,x,h,k,w,M,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(g)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,p)=>f(B)!==e.wants[p])||f(y)!==e.strategy||f(x)!==e.implementation||f(h)!==e.pool||f(k)!==e.manager||f(w)!==e.wants[0]||f(M)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new o("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>F(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:r}));async function ae(B){let p=f(B),[A,D]=await Promise.all([a.readContract({address:p,abi:te,functionName:"symbol",blockNumber:r}),a.readContract({address:p,abi:te,functionName:"decimals",blockNumber:r})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new o("Invalid CLM token metadata.");return{address:p,symbol:A,decimals:D,chainId:S}}async function U(){let p=(await le(d.http,"https://api.beefy.finance/vaults",{},v=>Array.isArray(v)&&v.every($=>$!==null&&typeof $=="object"))).filter(v=>v.chain==="robinhood"&&typeof v.earnContractAddress=="string"&&I(v.earnContractAddress,e.vault)),A=p[0],D=pe(f(e.vault));if(p.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new o("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new o(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),_=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(_.some(v=>typeof v!="boolean"))throw new o("Invalid Beefy strategy pause flag.");if(_.some(Boolean))throw new o("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new o("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,p){let A=new Set([...e.wants,f(ie),z]);if(!A.has(B)||!A.has(p)||B===p)throw new o("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=q.routes.find(H=>H.from===B&&H.to===p&&(H.pools[0]===e.pool||H.kind==="v3"));if(!D)throw new o("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=q.markets[D.kind];for(let H of[L.router,L.quoter,L.factory,...D.pools])await l(H);let _=D.path;if(_.length!==88||f(_.slice(0,42))!==B||f(`0x${_.slice(-40)}`)!==p)throw new o("Invalid qualified CLM swap path.");let v=Number.parseInt(_.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:ge[D.kind],functionName:"getPool",args:[B,p,v],blockNumber:r});if(f($)!==D.pools[0])throw new o("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new o("The CLM quoter factory differs from its pin.");return D}async function j(B,p,A){let D=await N(B,p),L=q.markets[D.kind],_=await a.simulateContract({address:f(L.quoter),abi:Fe,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:r}),v=F(_.result[0]);if(v===0n)throw new o("No positive quote for this CLM swap.");return{selected:D,market:L,out:v}}return{client:a,blockNumber:r,deadline:c.timestamp+600n,read:n,balance:V,token:ae,code:l,entryAvailable:U,quote:j}}function C(e,t,a,r="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:r,chainId:S})}async function E(e,t,a){let r=await d.preview(e,t);return{txs:e,preview:r,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...Z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount","slippageBps"]),r=K(e.slippageBps),c=await b(a,t),[n,i,l,g,u,y,x,h]=await Promise.all([c.token(a.wants[0]),c.token(a.wants[1]),c.token(a.manager),c.balance(a.wants[0]),c.balance(a.wants[1]),c.balance(a.manager),c.read(a.manager,"balances"),c.read(a.strategy,"price")]),k;if(e.amount!==void 0){await c.entryAvailable();let w=G(e.amount),[M,R]=ne(x,2),ee=Me(w,a.bridge===n.address,F(h),M,R),V=[];for(let[ae,U]of[n,i].entries()){let N=ee[ae],j=N===0n||U.address===a.bridge?N:(await c.quote(f(a.bridge),U.address,N)).out;V.push({token:U,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":Q(j,r).toString(),swapRequired:N>0n&&U.address!==a.bridge})}k={bridge:await c.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:S,vault:a.vault,manager:a.manager,bridge:await c.token(a.bridge),constituents:[{token:n,balance:g.toString()},{token:i,balance:u.toString()}],shares:{token:l,amount:y.toString()},entryPlan:k,block:c.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...Z,from:Y,to:Y,amount:O()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["from","to","amount","slippageBps"]),r=K(e.slippageBps),c=f(e.from),n=f(e.to),i=G(e.amount),l=c.toLowerCase()===ve,g=l?z:c,u=await b(a,t);if((l?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(c))<i)throw new o("Insufficient CLM swap balance; keep ETH for gas.");let y=[];l&&(await u.code(z),y.push(C(z,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",i.toString())));let x=i,h=i;if(g!==n){let w=await u.quote(g,n,i);x=w.out,h=Q(x,r),y.push(d.approval(g,f(w.market.router),i.toString(),S));let M={path:w.selected.path,recipient:t,amountIn:i,amountOutMinimum:h},R=w.selected.kind==="cl"?T({abi:ce,functionName:"exactInput",args:[{...M,deadline:u.deadline}]}):T({abi:W,functionName:"multicall",args:[u.deadline,[T({abi:W,functionName:"exactInput",args:[M]})]]});y.push(C(w.market.router,R,`Swap exact input with at least ${h} output base units to the calling wallet.`))}else if(!l)throw new o("The CLM swap requires different input and output tokens.");let k=await u.token(n);return{...await E(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:k,amount:x.toString()},minimumOutput:{token:k,amount:h.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...Z,amount0:O(),amount1:O()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount0","amount1","slippageBps"]),r=K(e.slippageBps),c=G(e.amount0,!0),n=G(e.amount1,!0);if(c===0n&&n===0n)throw new o("At least one CLM deposit amount must be positive.");let i=await b(a,t);if(await i.entryAvailable(),await i.balance(a.wants[0])<c||await i.balance(a.wants[1])<n)throw new o("Acquire the CLM constituents first and retry with their mined balances.");let[l,g,u,y,x]=ne(await i.read(a.manager,"previewDeposit",[c,n]),5);if(g>c||u>n||g+u===0n||y>g||x>u)throw new o("The CLM returned invalid deposit amounts or fees.");let h=Q(l,r),k=[];for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),M.toString(),S));k.push(C(a.manager,T({abi:X,functionName:"deposit",args:[c,n,h]}),`Mint at least ${h} CLM share base units to the calling wallet.`));for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),"0",S));return{...await E(k,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await i.token(a.manager),amount:l.toString()},minimumShares:h.toString(),usedAmounts:[g.toString(),u.toString()],fees:[y.toString(),x.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...Z,shares:{anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["shares","slippageBps"]),r=K(e.slippageBps),c=e.shares==="all"?void 0:G(e.shares),n=await b(a,t),i=await n.balance(a.manager),l=c??i;if(l===0n||l>i)throw new o("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[l]),2).map(x=>x===0n?0n:Q(x,r));if(u.every(x=>x===0n))throw new o("No positive CLM withdrawal output is available.");let y=[C(a.manager,T({abi:X,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await E(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(x,h)=>({token:await n.token(a.wants[h]),amount:x.toString()})))}})}]}};async function je(d,s,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let C=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},E=ue({clientFor:()=>b,http:fetch,quoteSwap:C,buildSwap:C,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await Ee(E).tools.find(t=>t.name===d).execute(s,m)).txs}function Ge(d,s,m){let b=()=>{throw new o("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function C(E,e,t){if(E===e)return;let a=J({abi:t,data:E}),r=J({abi:t,data:e});(a.functionName!==r.functionName||!a.args||!r.args)&&b();let c=[...a.args],n=[...r.args];if(I(T({abi:t,functionName:a.functionName,args:c}),E)||b(),a.functionName==="deposit"||a.functionName==="withdraw")for(let i of a.functionName==="deposit"?[2]:[1,2])F(c[i])<F(n[i])&&b(),c[i]=n[i];else if(a.functionName==="multicall"){let i=F(c[0]);(i<=m||i>F(n[0]))&&b(),(!Array.isArray(c[1])||!Array.isArray(n[1])||c[1].length!==1||n[1].length!==1)&&b(),C(c[1][0],n[1][0],W),c[0]=n[0],c[1]=n[1]}else if(a.functionName==="exactInput"){let i={...c[0]},l=n[0];F(i.amountOutMinimum)<F(l.amountOutMinimum)&&b(),i.amountOutMinimum=l.amountOutMinimum,"deadline"in i&&((F(i.deadline)<=m||F(i.deadline)>F(l.deadline))&&b(),i.deadline=l.deadline),c[0]=i}else b();I(T({abi:t,functionName:a.functionName,args:c}),e)||b()}(!s.length||d.length!==s.length)&&b();for(let[E,e]of d.entries()){let t=s[E];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&b();try{if(I(t.to,q.markets.cl.router))J({abi:ce,data:t.data}).args[0].deadline<=m&&b();else if(I(t.to,q.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=m)&&b()}}catch{b()}if(!I(e.data,t.data))try{let a=De.find(r=>I(r.manager,t.to));C(e.data,t.data,a?X:I(t.to,q.markets.cl.router)?ce:W)}catch{b()}}}var We=d=>({tools:Ee(d).tools.slice(1)});export{De as a,we as b,X as c,ce as d,W as e,Se as f,Me as g,Ee as h,je as i,Ge as j,We as k};
|
|
1
|
+
import{b as pe,c as me}from"./FOKEFXGP.js";import{a as ue}from"./SPJCSEKP.js";import{a as be}from"./43LI5NKJ.js";import{c as le}from"./SCG5HWMN.js";import{a as O}from"./66F5ZH34.js";import{c as Y,d as oe,g as I,i as fe,m as se,n as re}from"./NWNYJ26T.js";import{a as M,i as de,j as ce}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{decodeFunctionData as J,encodeFunctionData as T,erc20Abi as te,getAddress as he,keccak256 as Ce,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-11-04T21:56:26.556Z",block:"106231118",routeBlock:"106231118",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a","0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6":"0xd6f09e63327b36d3c498f8de8768bd3e4336894cd00ddb36aa9e0a1e4a4c911e"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"},qualificationHistory:[{observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",implementationHash:"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c"}],blockHash:"0xcb0e2862c6e22ca5854fb9264995749e497eb26f05a3370202db69909b891c47"};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],X=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ie=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),ge=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),Fe={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ye=P(["function deposit() payable"]),Z={vault:{...Y,description:"Address of the Beefy CLM vault contract (from beefy_list)."},chainId:{const:M,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},Be=10n**36n,z=he(de[M].uniswap.WETH.address),ke="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ve=Object.fromEntries(Object.entries(q.codeHashes).map(([d,r])=>[d.toLowerCase(),r])),Ae=Object.fromEntries(Object.entries(q.delegates).map(([d,r])=>[d.toLowerCase(),r]));function f(d){return fe(d,"Provide a token or vault address.",oe)}function g(d){return se(d,"Invalid Beefy CLM integer.")}function G(d,r=!1){return re(d,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!r})}function K(d){let r=d??50;if(typeof r!="number"||!Number.isInteger(r)||r<0||r>500)throw new o("Use integer slippageBps from 0 to 500.");return BigInt(r)}function Q(d,r){let m=d*(10000n-r)/10000n;if(m<=0n)throw new o("This CLM amount is too small for a positive output minimum.");return m}function ne(d,r){if(!Array.isArray(d)||d.length!==r)throw new o("Invalid Beefy CLM quote.");return d.map(g)}function Me(d){let r=f(d),m=De.find(b=>I(b.vault,r));if(!m)throw new o("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return m}function Se(d,r,m,b,h){if(d<=0n||m<=0n||b<0n||h<0n)throw new o("The CLM price or budget is invalid.");let E=r?d*m/Be:d;if(E===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=h>e?h-e:e-h,a=E<t?E:t,s=(E-a)/2n,i=d*(h>e?a+s:s)/E;return[i,d-i]}var Ee=d=>{async function r(e){try{return await e()}catch(t){throw new o(d.plainError(t))}}function m(e,t){if(e.chainId!==void 0&&e.chainId!==M)throw new o("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new o(`Unsupported Beefy CLM input: ${a}.`);return Me(e.vault)}async function b(e,t){be(t);let a=d.clientFor(M);if(await a.getChainId()!==M)throw new o("The Beefy CLM endpoint must report chain 4663.");let s=g(await a.getBlockNumber()),i=await a.getBlock({blockNumber:s}),n=(B,p,A=[])=>a.readContract({address:f(B),abi:X,functionName:p,args:A,blockNumber:s}),c=new Set;async function l(B){let p=B.toLowerCase();if(c.has(p))return;let A=ve[p];if(!A)throw new o("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:s});if(!D||Ce(D)!==A)throw new o("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");c.add(p),Ae[p]&&await l(Ae[p])}await me(a,f(e.vault),s);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await l(B);let[F,u,y,x,C,v,w,S,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(F)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,p)=>f(B)!==e.wants[p])||f(y)!==e.strategy||f(x)!==e.implementation||f(C)!==e.pool||f(v)!==e.manager||f(w)!==e.wants[0]||f(S)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new o("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>g(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:s}));async function ae(B){let p=f(B),[A,D]=await Promise.all([a.readContract({address:p,abi:te,functionName:"symbol",blockNumber:s}),a.readContract({address:p,abi:te,functionName:"decimals",blockNumber:s})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new o("Invalid CLM token metadata.");return{address:p,symbol:A,decimals:D,chainId:M}}async function H(){let p=(await le(d.http,"https://api.beefy.finance/vaults",{},k=>Array.isArray(k)&&k.every($=>$!==null&&typeof $=="object"))).filter(k=>k.chain==="robinhood"&&typeof k.earnContractAddress=="string"&&I(k.earnContractAddress,e.vault)),A=p[0],D=pe(f(e.vault));if(p.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new o("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new o(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),_=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(_.some(k=>typeof k!="boolean"))throw new o("Invalid Beefy strategy pause flag.");if(_.some(Boolean))throw new o("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new o("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,p){let A=new Set([...e.wants,f(ce),z]);if(!A.has(B)||!A.has(p)||B===p)throw new o("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=q.routes.find(U=>U.from===B&&U.to===p&&(U.pools[0]===e.pool||U.kind==="v3"));if(!D)throw new o("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=q.markets[D.kind];for(let U of[L.router,L.quoter,L.factory,...D.pools])await l(U);let _=D.path;if(_.length!==88||f(_.slice(0,42))!==B||f(`0x${_.slice(-40)}`)!==p)throw new o("Invalid qualified CLM swap path.");let k=Number.parseInt(_.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:Fe[D.kind],functionName:"getPool",args:[B,p,k],blockNumber:s});if(f($)!==D.pools[0])throw new o("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new o("The CLM quoter factory differs from its pin.");return D}async function j(B,p,A){let D=await N(B,p),L=q.markets[D.kind],_=await a.simulateContract({address:f(L.quoter),abi:ge,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:s}),k=g(_.result[0]);if(k===0n)throw new o("No positive quote for this CLM swap.");return{selected:D,market:L,out:k}}return{client:a,blockNumber:s,deadline:i.timestamp+600n,read:n,balance:V,token:ae,code:l,entryAvailable:H,quote:j}}function h(e,t,a,s="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:s,chainId:M})}async function E(e,t,a){let s=await d.preview(e,t);return{txs:e,preview:s,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...Z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["amount","slippageBps"]),s=K(e.slippageBps),i=await b(a,t),[n,c,l,F,u,y,x,C]=await Promise.all([i.token(a.wants[0]),i.token(a.wants[1]),i.token(a.manager),i.balance(a.wants[0]),i.balance(a.wants[1]),i.balance(a.manager),i.read(a.manager,"balances"),i.read(a.strategy,"price")]),v;if(e.amount!==void 0){await i.entryAvailable();let w=G(e.amount),[S,R]=ne(x,2),ee=Se(w,a.bridge===n.address,g(C),S,R),V=[];for(let[ae,H]of[n,c].entries()){let N=ee[ae],j=N===0n||H.address===a.bridge?N:(await i.quote(f(a.bridge),H.address,N)).out;V.push({token:H,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":Q(j,s).toString(),swapRequired:N>0n&&H.address!==a.bridge})}v={bridge:await i.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:M,vault:a.vault,manager:a.manager,bridge:await i.token(a.bridge),constituents:[{token:n,balance:F.toString()},{token:c,balance:u.toString()}],shares:{token:l,amount:y.toString()},entryPlan:v,block:i.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...Z,from:{...Y,description:"Address of the token to sell: native ETH placeholder, or a CLM constituent or bridge token (USDG or WETH)."},to:{...Y,description:"Address of the token to receive, different from the input token: a CLM constituent or the bridge token."},amount:O('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["from","to","amount","slippageBps"]),s=K(e.slippageBps),i=f(e.from),n=f(e.to),c=G(e.amount),l=i.toLowerCase()===ke,F=l?z:i,u=await b(a,t);if((l?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(i))<c)throw new o("Insufficient CLM swap balance; keep ETH for gas.");let y=[];l&&(await u.code(z),y.push(h(z,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",c.toString())));let x=c,C=c;if(F!==n){let w=await u.quote(F,n,c);x=w.out,C=Q(x,s),y.push(d.approval(F,f(w.market.router),c.toString(),M));let S={path:w.selected.path,recipient:t,amountIn:c,amountOutMinimum:C},R=w.selected.kind==="cl"?T({abi:ie,functionName:"exactInput",args:[{...S,deadline:u.deadline}]}):T({abi:W,functionName:"multicall",args:[u.deadline,[T({abi:W,functionName:"exactInput",args:[S]})]]});y.push(h(w.market.router,R,`Swap exact input with at least ${C} output base units to the calling wallet.`))}else if(!l)throw new o("The CLM swap requires different input and output tokens.");let v=await u.token(n);return{...await E(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:v,amount:x.toString()},minimumOutput:{token:v,amount:C.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...Z,amount0:O(`Amount of the CLM vault's first token (token0) to deposit, in base units of that token (read its decimals). May be "0" if amount1 is positive.`),amount1:O(`Amount of the CLM vault's second token (token1) to deposit, in base units of that token (read its decimals). May be "0" if amount0 is positive.`)},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["amount0","amount1","slippageBps"]),s=K(e.slippageBps),i=G(e.amount0,!0),n=G(e.amount1,!0);if(i===0n&&n===0n)throw new o("At least one CLM deposit amount must be positive.");let c=await b(a,t);if(await c.entryAvailable(),await c.balance(a.wants[0])<i||await c.balance(a.wants[1])<n)throw new o("Acquire the CLM constituents first and retry with their mined balances.");let[l,F,u,y,x]=ne(await c.read(a.manager,"previewDeposit",[i,n]),5);if(F>i||u>n||F+u===0n||y>F||x>u)throw new o("The CLM returned invalid deposit amounts or fees.");let C=Q(l,s),v=[];for(let[w,S]of[i,n].entries())S>0n&&v.push(d.approval(f(a.wants[w]),f(a.manager),S.toString(),M));v.push(h(a.manager,T({abi:X,functionName:"deposit",args:[i,n,C]}),`Mint at least ${C} CLM share base units to the calling wallet.`));for(let[w,S]of[i,n].entries())S>0n&&v.push(d.approval(f(a.wants[w]),f(a.manager),"0",M));return{...await E(v,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await c.token(a.manager),amount:l.toString()},minimumShares:C.toString(),usedAmounts:[F.toString(),u.toString()],fees:[y.toString(),x.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...Z,shares:{description:'CLM shares to redeem for the pair tokens, in base units of the CLM share token (read its decimals). "all" redeems your full CLM share balance.',anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["shares","slippageBps"]),s=K(e.slippageBps),i=e.shares==="all"?void 0:G(e.shares),n=await b(a,t),c=await n.balance(a.manager),l=i??c;if(l===0n||l>c)throw new o("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[l]),2).map(x=>x===0n?0n:Q(x,s));if(u.every(x=>x===0n))throw new o("No positive CLM withdrawal output is available.");let y=[h(a.manager,T({abi:X,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await E(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(x,C)=>({token:await n.token(a.wants[C]),amount:x.toString()})))}})}]}};async function je(d,r,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let h=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},E=ue({clientFor:()=>b,http:fetch,quoteSwap:h,buildSwap:h,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await Ee(E).tools.find(t=>t.name===d).execute(r,m)).txs}function Ge(d,r,m){let b=()=>{throw new o("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function h(E,e,t){if(E===e)return;let a=J({abi:t,data:E}),s=J({abi:t,data:e});(a.functionName!==s.functionName||!a.args||!s.args)&&b();let i=[...a.args],n=[...s.args];if(I(T({abi:t,functionName:a.functionName,args:i}),E)||b(),a.functionName==="deposit"||a.functionName==="withdraw")for(let c of a.functionName==="deposit"?[2]:[1,2])g(i[c])<g(n[c])&&b(),i[c]=n[c];else if(a.functionName==="multicall"){let c=g(i[0]);(c<=m||c>g(n[0]))&&b(),(!Array.isArray(i[1])||!Array.isArray(n[1])||i[1].length!==1||n[1].length!==1)&&b(),h(i[1][0],n[1][0],W),i[0]=n[0],i[1]=n[1]}else if(a.functionName==="exactInput"){let c={...i[0]},l=n[0];g(c.amountOutMinimum)<g(l.amountOutMinimum)&&b(),c.amountOutMinimum=l.amountOutMinimum,"deadline"in c&&((g(c.deadline)<=m||g(c.deadline)>g(l.deadline))&&b(),c.deadline=l.deadline),i[0]=c}else b();I(T({abi:t,functionName:a.functionName,args:i}),e)||b()}(!r.length||d.length!==r.length)&&b();for(let[E,e]of d.entries()){let t=r[E];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&b();try{if(I(t.to,q.markets.cl.router))J({abi:ie,data:t.data}).args[0].deadline<=m&&b();else if(I(t.to,q.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=m)&&b()}}catch{b()}if(!I(e.data,t.data))try{let a=De.find(s=>I(s.manager,t.to));h(e.data,t.data,a?X:I(t.to,q.markets.cl.router)?ie:W)}catch{b()}}}var We=d=>({tools:Ee(d).tools.slice(1)});export{De as a,we as b,X as c,ie as d,W as e,Me as f,Se as g,Ee as h,je as i,Ge as j,We as k};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{b as P,f as B,g as H,j as fe,k as $,l as pe,m as F,n as c,o as S,p as j,q as _e,r as I,s as ge}from"./RPB46QAC.js";import{Q as ae,R as ie,S as de,T as ue,U as w,V as ce,X as le,b as o,c as T,d as y,e as Y,f as Z,g as Q,m as V,n as v,o as J,p as W,q as R,r as D,s as X,t as ee,u as ne,v as te,w as se,x as oe,y as re}from"./7VC53B5X.js";import{a as C}from"./XSD5NL7J.js";var x=6,Ue=/^[A-Za-z0-9._-]{1,12}$/;function Ae(e){return Ue.test(e)?e:"the stock token"}function G(e){return e instanceof C?e.message:"unexpected error"}function O(e,n=x){return $({redeemOutBase:e,amountBase:0n,decimals:n})}function me(e,n,i){let d={amount_usd:c(n),gross_usd:c(e.grossUsd),horizon:i,costs_usd:c(e.costsUsd),net_usd:c(e.netUsd)};return e.suggestUsd===void 0?o(ie,d):o(ae,{...d,suggest_usd:`$${e.suggestUsd}`})}function M(e){return`${Number.isInteger(e)?e.toString():e.toFixed(2)} USDG`}function Ee(e,n,i,d){let u={id:"A",project:"layerbank"},s=O(n);if(!Number.isFinite(e.rateBasePct)||e.rateBasePct<0)return d.push("LayerBank rate was malformed"),{option:{...u,offered:!1,reason:"cant_check"},block:o(R,{})};if(!e.open)return{option:{...u,offered:!1,reason:"closed"},block:o(X,{})};if(e.capRoomBase<n)return{option:{...u,offered:!1,reason:"no_room"},block:o(ee,{cap_room_usd:c(O(e.capRoomBase)),amount_usd:c(s)})};let r=e.bonus,l=r!==void 0&&Number.isFinite(r.ratePct)&&r.ratePct>0&&r.endsAt>i,f=e.rateBasePct+(l?r.ratePct:0),b=l?F(i,r.endsAt):0,p=B(e.gasInUsd),_=B(e.gasOutUsd),g=p.usd+_.usd,h=p.estimatedHigh||_.estimatedHigh,m=fe({amountUsd:s,baseRatePct:e.rateBasePct,bonusRatePct:l?r.ratePct:0,bonusDays:b,days:30}),a=H({gross:m,costs:g,amount:s}),U=o(V,{lb_base_rate:S(e.rateBasePct),bonus_clause:l?o(v,{lb_bonus_rate:S(r.ratePct),bonus_days:I(b),lb_base_rate:S(e.rateBasePct)}):"",lb_cash_usd:c(O(e.cashUsdgBase)),lb_gas_in_usd:c(p.usd),lb_gas_out_usd:c(_.usd)});return h&&(U+=`
|
|
2
|
+
${o(w,{})}`),a.tooSmall&&(U+=`
|
|
3
|
+
${me(a,s,I(30))}`),{option:{...u,offered:!0,amountUsd:s,ratePct:f,grossUsd:m,costsUsd:g,netUsd:a.netUsd,tooSmall:a.tooSmall,...a.suggestUsd===void 0?{}:{suggestUsd:a.suggestUsd},estimatedHigh:h},block:U,gross30d:m,horizonEndsAt:i+30*86400}}function he(e,n,i){return e.filter(s=>s.kind==="stable"&&!s.matured&&s.endsAt>n).filter(s=>s.unitDecimals===x&&Number.isFinite(s.ratePct)?!0:(i.push(`Pendle term ${s.market} skipped: its USDG figures were not in the expected form`),!1)).sort((s,r)=>r.liquidityUsd-s.liquidityUsd||s.endsAt-r.endsAt)[0]}async function Oe(e,n,i,d,u){let s={id:"B",project:"pendle"};if(!n)return{option:{...s,offered:!1,reason:"no_term"},block:o(W,{})};let r={option:{...s,offered:!1,reason:"cant_check"},block:o(D,{})},l=O(i),f;try{f=await e.pendleQuoteCosts(n.market,i)}catch(z){return u.push(`Pendle quote failed: ${G(z)}`),r}if(typeof f.ptOutBase!="bigint"||f.ptOutBase<=0n)return u.push("Pendle quote was malformed"),r;let b=f.ptOutBase,p=$({redeemOutBase:b,amountBase:i,decimals:x}),_=B(n.gasInUsd),g=B(n.gasOutUsd),h=Number.isFinite(f.feeUsd)&&f.feeUsd>0?f.feeUsd:0,m=_.usd+g.usd,a=_.estimatedHigh||g.estimatedHigh,U=F(d,n.endsAt),E=H({gross:p,costs:m,amount:l}),N=j(n.endsAt),A=o(J,{pendle_end_date:N,pendle_rate:S(n.ratePct),pendle_payout_usd:c(O(b)),pendle_unit_usd:c(l),pendle_cost_in_usd:c(h+_.usd),pendle_gas_out_usd:c(g.usd)});return a&&(A+=`
|
|
4
|
+
${o(w,{})}`),E.tooSmall&&(A+=`
|
|
5
|
+
${me(E,l,`the ${I(U)} until ${N}`)}`),{option:{...s,offered:!0,amountUsd:l,ratePct:n.ratePct,market:n.market,endsAt:n.endsAt,grossUsd:p,costsUsd:m,netUsd:E.netUsd,tooSmall:E.tooSmall,...E.suggestUsd===void 0?{}:{suggestUsd:E.suggestUsd},estimatedHigh:a},block:A,gross30d:U>30?p*(30/U):p,horizonEndsAt:n.endsAt}}function ke(e){return e.filter(n=>n.matured&&n.ptBalanceBase>0n).map(n=>{let i=j(n.endsAt);if(n.kind==="stock")return o(le,{stock_symbol:Ae(n.unitSymbol),pendle_end_date:i});let d=ge(n.ptBalanceBase,n.unitDecimals);return o(ce,{pendle_end_date:i,pt_amount:d,usdg_out:d})})}function Pe(e){if(e!==void 0){if(!/^[0-9]+$/.test(e))throw new C("The amount must be a whole number of USDG base units (6 decimals), for example 50000000 for 50 USDG.");return BigInt(e)}}async function ye(e,n,i,d={}){let u=Pe(d.amount),s=n.nowSec(),r=[],[l,f]=await Promise.allSettled([e.layerbank(i),e.pendleTerms(i)]),b=l.status==="fulfilled"?l.value:void 0,p=f.status==="fulfilled"?f.value:void 0;l.status==="rejected"&&r.push(`LayerBank could not be read: ${G(l.reason)}`),f.status==="rejected"&&r.push(`Pendle could not be read: ${G(f.reason)}`),r.push(...b?.checks??[],...p?.flatMap(t=>t.checks)??[]);let _=b?.walletUsdgBase;if(_===void 0)try{_=await n.usdgBalance(i)}catch{r.push("wallet USDG balance could not be read")}let g=u??_,h=p?ke(p):[],m=(t,be)=>({card:[...h,...t].join(`
|
|
6
|
+
|
|
7
|
+
`),options:be,notices:h,checks:[...new Set(r)]}),a=await Be(n,i,r),U=t=>a&&a.paidUntil<=s&&!(a.freeUntil!==void 0&&a.freeUntil>s)?[o(re,{plan_price:M(a.priceUsd),project_site:t.join(" or ")})]:[];if(g===void 0)return m([o(R,{}),o(D,{})],[{id:"A",project:"layerbank",offered:!1,reason:"cant_check"},{id:"B",project:"pendle",offered:!1,reason:"cant_check"}]);if(g===0n){let t=0n;try{t=await n.ethBalance(i)}catch{r.push("wallet ETH balance could not be read")}return t>0n?m([o(se,{}),...U([T,y])],[]):m([o(oe,{})],[])}let E=b?Ee(b,g,s,r):{option:{id:"A",project:"layerbank",offered:!1,reason:"cant_check"},block:o(R,{})},N=p?await Oe(e,he(p,s,r),g,s,r):{option:{id:"B",project:"pendle",offered:!1,reason:"cant_check"},block:o(D,{})},A=[E,N],k=[u===void 0||u===_?o(Y,{amount_usd:c(O(g))}):o(_!==void 0&&u<_?Z:Q,{amount_usd:c(O(g))}),...A.map(t=>t.block)],K=a?A.flatMap(t=>t.option.offered&&t.gross30d!==void 0&&t.horizonEndsAt!==void 0?[pe({gross30d:t.gross30d,planPriceUsd:a.priceUsd,paidUntil:a.paidUntil,...a.freeUntil===void 0?{}:{freeUntil:a.freeUntil},horizonEndsAt:t.horizonEndsAt,nowSec:s})]:[]):[];a&&K.includes("fee")?k.push(o(de,{plan_price:M(a.priceUsd)})):a?.freeUntil!==void 0&&K.includes("free_until")&&k.push(o(ue,{free_until:_e(a.freeUntil),plan_price:M(a.priceUsd)}));let L=A.filter(t=>t.option.offered&&!t.option.tooSmall).map(t=>t.option.id);if(L.length>0){let t=L.length===2?"A, B, or neither":`${L[0]}, or neither`;k.push(o(ne,{choices:t}))}else A.some(t=>t.option.offered)&&k.push(o(te,{}));let q=A.filter(t=>t.option.offered).map(t=>t.option.project==="layerbank"?T:y);return k.push(...U(q.length>0?q:[T,y])),m(k,A.map(t=>t.option))}async function Be(e,n,i){let d;try{d=await e.plan?.(n)}catch{d=void 0}if(!d||!Number.isFinite(d.priceUsd)||d.priceUsd<=0||!Number.isFinite(d.paidUntil)){i.push("plan price unavailable");return}let{freeUntil:u,...s}=d;return typeof u=="number"&&Number.isFinite(u)?{...s,freeUntil:u}:s}export{ye as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g}from"./X5V2Z2NM.js";import{a as m}from"./43LI5NKJ.js";import{a as k}from"./66F5ZH34.js";import{e as A,g as u,i as b}from"./NWNYJ26T.js";import{a as l,i as x,s as y}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{b as w}from"./JXOEJPJ4.js";import{Buffer as v}from"node:buffer";import{decodeEventLog as $}from"viem";var R="Profile contents and oak.registrar are mutable, self-asserted metadata, not registry-validated claims or proof of provenance. Oak registration always writes the public oak.registrar = oak marker on Robinhood Chain. Anyone can see it, and the transaction stays in the public history even if the marker is changed later.",B="oak.registrar",D="0x6f616b",L=k("Agent ID as a decimal uint256 integer string."),j={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},q={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"32-byte hex value."},z={type:"string",pattern:"^0x([0-9a-fA-F]{2})*$"},T="0x0000000000000000000000000000000000000000";function h(t){let e=t.network??"mainnet",{chainId:n,identityRegistry:r}=y[e],s=e==="mainnet"?x[l].identity:void 0;return{network:e,chainId:n,registry:r,registryId:`eip155:${n}:${r}`,reputation:s?.reputationRegistry.address,validation:s?.validationRegistry.address}}function K(t){let{chainId:e,reputation:n}=h(t);if(!n)throw new o("Oak has no pinned ERC-8004 reputation registry for this network.");return{chainId:e,address:n}}function V(t){let{chainId:e,validation:n}=h(t);if(!n)throw new o("Oak has no pinned ERC-8004 validation registry for this network.");return{chainId:e,address:n}}function Z(t){return u(t,T)}function G(t){if(typeof t!="string"||!/^[0-9]+$/.test(t)||t.length>78||BigInt(t)>=2n**256n)throw new o("Provide an agent ID as a decimal uint256 integer string.");return BigInt(t)}function J(t,e){return b(t,`Provide a valid ${e} address.`)}function Q(t,e){let n=h(t).chainId;if(e!==void 0&&e!==n)throw new o(`ERC-8004 actions are supported only on chain ${n}.`)}function X(t,e){if(typeof t!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t))throw new o(`Provide ${e} as 32-byte hex.`);return t.toLowerCase()}function I(t,e,n,r=!0){if(t===void 0){if(r)return"";throw new o(`Provide ${e}.`)}if(typeof t!="string"||!r&&!t.trim()||t.length>n||w(t))throw new o(`${e} must be plain text of at most ${n} characters.`);return t}function Y(t,e){if(typeof t!="string"||!t.trim()||t.length>2048)throw new o(`Provide a valid ${e}.`);try{let n=new URL(t);if(!["https:","ipfs:"].includes(n.protocol)||!n.hostname||n.username||n.password||w(t))throw new Error}catch{throw new o(`${e} must be an HTTPS or IPFS URI without credentials.`)}return t}function tt(t){let e=/^data:application\/json;base64,([A-Za-z0-9+/=]+)$/.exec(t);if(e)try{let n=JSON.parse(v.from(e[1],"base64").toString("utf8"));return A(n)?n:void 0}catch{return}}async function C(t,e,n,r,s=!0){let i=await t.preview(e,n),a=i.changes.map(({amount:d,token:f})=>{let c=d.startsWith("-");return`${c?"-":""}${t.formatAmount(c?d.slice(1):d,f.decimals)} ${f.symbol} (${f.address}, chain ${f.chainId})`});return{txs:e,summary:`${i.summary} ${a.join("; ")} ${s?`${R} `:""}${r}`}}async function et(t,e,n,r="update this profile"){let{chainId:s,registry:i}=h(t),a=t.clientFor(s),d=await a.readContract({address:i,abi:g,functionName:"ownerOf",args:[e]});if(m(d),u(d,n))return d;let[f,c]=await Promise.all([a.readContract({address:i,abi:g,functionName:"getApproved",args:[e]}),a.readContract({address:i,abi:g,functionName:"isApprovedForAll",args:[d,n]})]);if(m(f),typeof c!="boolean")throw new o("The registry returned invalid operator approval data.");if(!u(f,n)&&!c)throw new o(`Only the agent owner or an approved operator can ${r}.`);return d}async function nt(t,e,n){let{chainId:r,registry:s}=h(t),i=t.clientFor(r),a=await i.readContract({address:s,abi:g,functionName:"ownerOf",args:[e]});if(m(a),u(a,n))return a;if(await i.readContract({address:s,abi:g,functionName:"isApprovedForAll",args:[a,n]})!==!0)throw new o("Only the agent owner or an operator approved for all of its agents can change the token approval.");return a}async function H(t,e,n,r,s){let{chainId:i,registry:a}=h(t),d=s??a;if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new o("Provide the mined transaction hash.");let f=t.clientFor(i),c=await f.getTransactionReceipt({hash:e});if(!c)throw new o("The transaction is not mined yet. Try again after confirmation.");if(c.status!=="success"||!c.to||!u(c.to,d)||!u(c.from,n)||!u(c.transactionHash,e))throw new o("The receipt is not a successful matching registry transaction.");let p=await f.getTransaction({hash:e});if(p.chainId!==i||p.value!==0n||!p.to||!u(p.to,d)||!u(p.from,n))throw new o("The transaction does not match this chain, registry and wallet.");if(!(typeof r=="function"?typeof p.input=="string"&&r(p.input):typeof p.input=="string"&&u(p.input,r)))throw new o("The mined transaction calldata does not match the exact operation Oak built.");return c}function rt(t,e,n,r){let s=t.logs.filter(i=>u(i.address,e)&&!i.removed).flatMap(i=>{try{let a=$({abi:n,topics:i.topics,data:i.data,strict:!0});return a.eventName===r?[a.args]:[]}catch{return[]}});if(s.length!==1)throw new o(`The receipt must contain one matching ${r} event.`);return s[0]}function ot(t){let e=I(t,"metadata key",128,!1);if(e==="agentWallet")throw new o("The key agentWallet is reserved: use erc8004_set_wallet / erc8004_unset_wallet, which prove control of the wallet.");return e}function it(t){if(t.value===void 0==(t.text===void 0))throw new o("Provide exactly one of value (0x hex bytes) or text (UTF-8).");let e;if(t.value!==void 0){if(typeof t.value!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(t.value))throw new o("Metadata value must be 0x-prefixed hex bytes.");e=t.value}else{if(typeof t.text!="string")throw new o("Metadata text must be a string.");e=`0x${v.from(t.text,"utf8").toString("hex")}`}if((e.length-2)/2>4096)throw new o("Metadata values are limited to 4096 bytes.");return e}async function at(t,e,n,r){let{chainId:s}=h(t);if(n.transactionHash!==void 0){let a=await H(t,n.transactionHash,e,r.matcher??r.data,r.to);return r.verify(a)}await r.authority();let i=t.unsignedTx({to:r.to,data:r.data,value:"0",chainId:s,description:r.description});return C(t,[i],e,r.summary,!1)}export{R as a,B as b,D as c,L as d,j as e,q as f,z as g,h,K as i,V as j,Z as k,G as l,J as m,Q as n,X as o,I as p,Y as q,tt as r,C as s,et as t,nt as u,H as v,rt as w,ot as x,it as y,at as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b}from"./NUFZUKYS.js";import{a as v}from"./G2LAO23N.js";import{a as k}from"./66F5ZH34.js";import{c as l}from"./NWNYJ26T.js";import{a as p}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as S,getAddress as m,parseAbi as f,zeroAddress as y}from"viem";var C=f(["function tokenizations(address token) view returns ((address creator,address forwarder,bytes32 marketFamilyId,uint64 createdAt))"]),I=f(["function tokenizations(address token) view returns ((address creator,uint8 way,address forwarder,address adapter,address door,bytes32 familyId,bytes32 marketFamilyId,uint64 unlockBlock,uint16 legBps))"]),A=f(["function name() view returns (string)","function symbol() view returns (string)","function decimals() view returns (uint8)","function balanceOf(address account) view returns (uint256)","function totalSupply() view returns (uint256)","function assetCount() view returns (uint256)","function claimable(address account,uint256 asset) view returns (uint256)","function streamSeconds() view returns (uint32)","function tipBps() view returns (uint16)","function doorCount() view returns (uint256)","function dropBox() view returns (address)","function bridge() view returns (address)","function claim(uint256 asset,address to) returns (uint256 amount)","function claimAll(address to) returns (uint256[] amounts)","function sync() returns (uint256 tip)","function syncRange(uint256 start,uint256 count) returns (uint256 tip)","function syncSome(uint256[] doorIds) returns (uint256 tip)"]),O=f(["function dropCount() view returns (uint256)","function claimable(uint256 dropId,address holder) view returns (uint256)","function claim(uint256[] dropIds,address to) returns (uint256[] amounts)"]),w=["0x522723A7a09684515881568Ab8247f3846D66F43","0xfb3c1501c727f30883cd7B36Ec380381af7412Ef"].map(m),P={token:A,drops:O};function R(t){let r=e=>{let o=b(e.type,e.name,`argument of ${t.name}`);return e.type==="address"?{...l,description:o}:e.type==="uint256[]"?{type:"array",items:k(),maxItems:128,description:o}:{...k(),description:o}};return{type:"object",properties:Object.fromEntries(t.inputs.map(e=>[e.name,r(e)])),required:t.inputs.map(e=>e.name),additionalProperties:!1}}function g(t){return Object.entries(P).flatMap(([r,e])=>e.filter(o=>o.stateMutability==="view"===t).map(o=>({target:r,fn:o})))}var j={token:"the revenue token itself",drops:"its derived drop box"};function h(t){return{type:"object",oneOf:g(t).map(({target:r,fn:e})=>({type:"object",properties:{token:{...l,description:v.address("registered Hookr revenue token")},target:{const:r,description:`Contract to call: "${r}", ${j[r]}.`},function:{const:e.name,description:`Function to call: ${e.name}.`},params:{...R(e),description:`Arguments of ${r}.${e.name}; integers are decimal strings.`}},required:["token","target","function","params"],additionalProperties:!1}))}}function H(t,r){if(Object.keys(t).length!==4||Object.keys(t).some(n=>!["token","target","function","params"].includes(n)))throw new s("Provide token, target, function and params for the Hookr revenue operation.");let e=g(r).find(n=>n.target===t.target&&n.fn.name===t.function);if(!e||!t.params||typeof t.params!="object"||Array.isArray(t.params))throw new s("Choose a documented Hookr revenue function and parameter object.");let o;try{o=m(String(t.token))}catch{throw new s("Provide a valid Hookr revenue token address.")}let i=t.params,a=e.fn;if(Object.keys(i).length!==a.inputs.length||Object.keys(i).some(n=>!a.inputs.some(u=>u.name===n)))throw new s("Provide exactly the documented Hookr revenue parameters.");let c=n=>{if(typeof n!="string"||!/^(0|[1-9][0-9]*)$/.test(n)||n.length>78||BigInt(n)>=1n<<256n)throw new s("Revenue token indices and amounts must be decimal base-unit strings.");return BigInt(n)},d=a.inputs.map(n=>{let u=i[n.name];if(n.type==="address")try{return m(String(u))}catch{throw new s("Provide a valid Hookr revenue address.")}if(n.type==="uint256[]"){if(!Array.isArray(u)||u.length>128)throw new s("Provide at most 128 Hookr revenue indices.");return u.map(c)}return c(u)});return{token:o,fn:a,values:d,operation:e}}async function x(t,r,e){let o=t.clientFor(p),i;for(let c of w){let d=c===w[0],n=await o.readContract({address:c,abi:d?C:I,functionName:"tokenizations",args:[r]});if(!n||typeof n.creator!="string"||d&&(!("createdAt"in n)||typeof n.createdAt!="bigint"||n.createdAt<0n||n.createdAt>=1n<<64n))throw new s("Hookr token provenance is unavailable.");if(m(n.creator)!==y&&(!d||"createdAt"in n&&n.createdAt>0n)){i=c;break}}if(!i)throw new s("This token has no record on a pinned Hookr tokenizer.");let a=e?m(await o.readContract({address:r,abi:A,functionName:"dropBox"})):r;if(a===y)throw new s("Hookr revenue drop box is unavailable.");return{to:a,tokenizer:i}}async function F(t,r,e){if(t.network==="testnet")throw new s("Hookr revenue actions require mainnet, chain 4663.");let{token:o,fn:i,values:a}=H(r,!1),{to:c}=await x(t,o,r.target==="drops"),d=i.inputs.findIndex(n=>n.name==="to");if(d>=0&&[y,o,c].includes(a[d]))throw new s("Choose a valid revenue claim recipient.");return{txs:[t.unsignedTx({chainId:p,to:c,value:"0",data:S({abi:[i],functionName:i.name,args:a}),description:`Hookr revenue ${r.target}.${i.name}: ${JSON.stringify(r.params)}. No token approval or principal deposit.`})],inputs:[]}}function D(t){return[{name:"hookr_revenue_read",inputSchema:{...h(!0),description:"Read a registered Hookr revenue token or its derived drop box: balance, claimable, terms and indices. Checks tokenizer provenance on chain."},execute:async r=>{let{token:e,fn:o,values:i}=H(r,!0),{to:a,tokenizer:c}=await x(t,e,r.target==="drops"),d=await t.clientFor(p).readContract({address:a,abi:[o],functionName:o.name,args:i});return{chainId:p,token:e,tokenizer:c,contract:a,function:o.name,result:JSON.parse(JSON.stringify(d,(n,u)=>typeof u=="bigint"?u.toString():u))}}},{name:"hookr_revenue_action",inputSchema:{...h(!1),description:"Preview holder income/drop claims or permissionless sync/syncRange/syncSome on a registered Hookr revenue token. No approvals; local human confirmation required. Claims and syncs are separate actions."},execute:async(r,e)=>{let{txs:o}=await F(t,r,e),i=await t.preview(o,e);return{txs:o,preview:i,summary:`Hookr revenue ${r.function}; verify receipt and holder balances after confirmation.`}}}]}export{w as a,F as b,D as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as B}from"./
|
|
1
|
+
import{c as B}from"./SCG5HWMN.js";import{b as x,e as d,g as k}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{getAddress as C,keccak256 as I,toHex as D}from"viem";var R="https://balancesapi.ponsfamily.com/v1",P=/^(0|[1-9][0-9]{0,77})$/,$=/^[0-9A-Za-z_.-]{1,128}$/,y=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,p=e=>typeof e=="string"&&P.test(e),S=e=>typeof e=="string"&&x.test(e);function M(e){return d(e)&&S(e.token)&&y(e.holders)&&p(e.supply)&&p(e.burned)&&p(e.circulating)&&d(e.as_of)&&y(e.as_of.rollup_bucket)&&y(e.as_of.tail_from_block)&&(e.next_cursor===null||e.next_cursor===void 0||typeof e.next_cursor=="string"&&$.test(e.next_cursor))&&Array.isArray(e.page)&&e.page.length<=50&&e.page.every(t=>d(t)&&S(t.wallet)&&p(t.balance)&&(t.label===void 0||t.label===null||typeof t.label=="string"))}var A=new WeakMap,c=()=>new l("The Pons holder index changed or returned an incomplete directory. Retry pons_holders without a cursor.");async function T(e,t){let n=A.get(e);n||(n=new Map,A.set(e,n));let f=n.get(t);if(f&&f.expires>Date.now())return f.directory;let o,g,m=new Set,_=new Set,s=[];for(let b=0;b<2e3;b++){let h=new URL(`${R}/tokens/${t.toLowerCase()}/holders`);h.searchParams.set("limit","50"),g&&h.searchParams.set("cursor",g);let r=await B(e.http,h.toString(),{method:"GET",redirect:"error",headers:{accept:"application/json"}},M);if(!k(r.token,t))throw c();if(r.holders>1e5)throw new l("The Pons holder directory exceeds 100000 indexed holders. No total or rank was computed.");if(o??=r,r.holders!==o.holders||r.supply!==o.supply||r.burned!==o.burned||r.circulating!==o.circulating||r.as_of.rollup_bucket!==o.as_of.rollup_bucket||r.as_of.tail_from_block!==o.as_of.tail_from_block)throw c();for(let u of r.page){let i=C(u.wallet);if(_.has(i)||BigInt(u.balance)===0n)throw c();_.add(i),s.push({...u,wallet:i})}if(s.length>o.holders)throw c();if(!r.next_cursor){if(s.length!==o.holders)throw c();s.sort((a,w)=>BigInt(a.balance)>BigInt(w.balance)?-1:BigInt(a.balance)<BigInt(w.balance)?1:a.wallet.toLowerCase().localeCompare(w.wallet.toLowerCase()));let u=I(D(JSON.stringify([t,o.as_of,s.map(a=>[a.wallet,a.balance])]))).slice(2,18),i={body:o,rows:s,fingerprint:u,fetchedAt:new Date().toISOString()};return n.delete(t),n.size>=4&&n.delete(n.keys().next().value),n.set(t,{directory:i,expires:Date.now()+15e3}),i}if(!r.page.length||m.has(r.next_cursor))throw c();m.add(r.next_cursor),g=r.next_cursor}throw new l("The Pons holder directory exceeds 100000 indexed holders. No total or rank was computed.")}function U(e){if(e===void 0)return{offset:0};if(typeof e!="string")throw new l("Use the nextCursor returned by the previous pons_holders page.");let t=/^holders_([0-9]{1,6})_([0-9a-f]{16})$/.exec(e);if(!t)throw new l("Use the nextCursor returned by the previous pons_holders page.");return{offset:Number(t[1]),fingerprint:t[2]}}function z(e,t){if(BigInt(t)===0n)return null;let n=BigInt(e)*10n**18n/BigInt(t);return`${n/10n**18n}.${(n%10n**18n).toString().padStart(18,"0")}`}export{R as a,T as b,U as c,z as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as w,i as T,l as O,m as x,n as R}from"./NWNYJ26T.js";import{a as f,i as S}from"./FWD4L3CJ.js";import{a as c}from"./XSD5NL7J.js";import{a as P}from"./JXOEJPJ4.js";import{encodeFunctionData as $,erc20Abi as E,parseAbi as z,zeroAddress as j}from"viem";var g=S[f].merkl.distributor.address,H=["function accessControlManager() view returns (address)","function isGovernor(address) view returns (bool)","function isGovernorOrGuardian(address) view returns (bool)","function canUpdateMerkleRoot(address) view returns (uint256)","function mainOperators(address,address) view returns (uint256)","function disputeToken() view returns (address)","function disputeAmount() view returns (uint256)","function disputer() view returns (address)","function endOfDisputePeriod() view returns (uint48)","function getMerkleRoot() view returns (bytes32)","function getEpochDuration() view returns (uint32)","function disputePeriod() view returns (uint48)","function upgradeabilityDeactivated() view returns (uint256)","function disputeTree(string)","function updateTree((bytes32 merkleRoot,bytes32 ipfsHash))","function toggleTrusted(address)","function toggleMainOperatorStatus(address,address)","function revokeUpgradeability()","function setEpochDuration(uint32)","function resolveDispute(bool)","function revokeTree()","function recoverERC20(address,address,uint256)","function setDisputePeriod(uint48)","function setDisputeToken(address)","function setDisputeAmount(uint256)"],y=z(H),F={type:"string",pattern:"^\\d+$"},C={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},G="Provide a valid address.";function m(o,l=!1){let n=T(o,G);return l?n:O(n,G)}function _(o,l=256){return R(o,`Value exceeds uint${l}.`,{bits:l})}function k(o){return x(o,"Merkl returned invalid protocol state.")}function I(o){return typeof o=="number"&&Number.isSafeInteger(o)&&o>=0?String(o):k(o).toString()}var D={updateTree:["merkleRoot","ipfsHash"],toggleTrusted:["target","enabled"],toggleMainOperatorStatus:["target","token","enabled"],revokeUpgradeability:[],setEpochDuration:["amount"],resolveDispute:["valid"],revokeTree:[],recoverERC20:["token","recipient","amount"],setDisputePeriod:["amount"],setDisputeToken:["token"],setDisputeAmount:["amount"]},W=o=>{let l=()=>o.clientFor(f),n=(r,i=[],e=g)=>l().readContract({address:e,abi:y,functionName:r,args:i}),b=(r,i,e,p)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:i,required:e,additionalProperties:!1},execute:async(u,s)=>{try{let a=Object.keys(u).find(d=>!Object.hasOwn(i,d));if(a)throw new c(`Unsupported Merkl input: ${a}.`);return await p(u,m(s))}catch(a){throw new c(o.plainError(a))}}}),U=async(r,i,e,p)=>{let u=[o.unsignedTx({to:g,data:$({abi:y,functionName:r,args:i}),value:"0",chainId:f,description:e})],s=await o.preview(u,p);return{txs:u,preview:s,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${e} ${s.summary}`}};return{tools:[b("distributor_status",{},[],async(r,i)=>{let[e,p,u,s,a,d,t,h,N]=await Promise.all([n("getMerkleRoot"),n("disputeToken"),n("disputeAmount"),n("disputer"),n("endOfDisputePeriod"),n("getEpochDuration"),n("disputePeriod"),n("upgradeabilityDeactivated"),n("accessControlManager")]);if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e)||typeof d!="number"||!Number.isInteger(d)||d<0||d>4294967295)throw new c("Merkl returned invalid Distributor state.");let v=m(N),[M,A]=await Promise.all([n("isGovernor",[i],v),n("isGovernorOrGuardian",[i],v)]);if(typeof M!="boolean"||typeof A!="boolean")throw new c("Merkl returned invalid governance roles.");return{chainId:f,distributor:g,root:e,disputeToken:m(p,!0),disputeAmount:k(u).toString(),disputer:m(s,!0),endOfDisputePeriod:I(a),epochDuration:String(d),disputePeriod:I(t),upgradeabilityDeactivated:k(h).toString(),accessControlManager:v,governor:M,governorOrGuardian:A,summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Dispute amounts are token base units. Opening a dispute locks collateral until governor resolution; a rejected dispute forfeits it."}}),b("dispute",{reason:{type:"string",minLength:1,maxLength:2e3,description:"Public reason for disputing the Merkl tree, from 1 to 2000 characters."}},["reason"],async(r,i)=>{if(typeof r.reason!="string"||!r.reason.trim()||r.reason.length>2e3)throw new c("Provide a public dispute reason of 1 to 2000 characters.");let e=m(await n("disputeToken")),p=k(await n("disputeAmount")),[u,s]=await Promise.all([l().readContract({address:e,abi:E,functionName:"symbol"}),l().readContract({address:e,abi:E,functionName:"decimals"})]);if(typeof u!="string"||!u.trim()||typeof s!="number"||!Number.isInteger(s)||s<0||s>255)throw new c("Merkl dispute token metadata is invalid.");let a=`Dispute Merkl's tree: ${r.reason}. Lock ${p} ${P(u)} base units (token ${e}, decimals ${s}) until governor resolution; rejection forfeits the deposit. There is no unilateral withdrawal.`,d=[...p?[o.approval(e,g,p.toString(),f)]:[],o.unsignedTx({to:g,data:$({abi:y,functionName:"disputeTree",args:[r.reason]}),value:"0",chainId:f,description:a})],t=await o.preview(d,i);return{txs:d,preview:t,deposit:{token:{address:e,symbol:u,decimals:s,chainId:f},amount:p.toString()},summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${a} ${t.summary}`}}),b("distributor_admin",{operation:{enum:Object.keys(D),description:"Distributor admin operation: tree updates/revocation, trust/operator changes, epoch/dispute settings, resolution, token recovery or upgradeability revocation."},target:{...w,description:"Address whose trusted or operator status is changed."},token:{...w,description:"Reward or recovery token contract address."},recipient:{...w,description:"Address to receive recovered tokens."},amount:{...F,description:'Admin amount: Unix seconds for durations, otherwise token base units using recovery/dispute token decimals (USDG has 6: "1000000" = 1 USDG).'},enabled:{type:"boolean",description:"true enables the selected role; false disables it."},valid:{type:"boolean",description:"Whether the disputed tree is valid."},merkleRoot:{...C,description:"New reward tree root as a 0x-prefixed 32-byte hex string."},ipfsHash:{...C,description:"New tree IPFS content hash as a 0x-prefixed 32-byte hex string."}},["operation"],async(r,i)=>{let e=String(r.operation);if(!Object.hasOwn(D,e))throw new c("Choose a supported Distributor operation.");let p=D[e];for(let t of Object.keys(r))if(t!=="operation"&&!p.includes(t))throw new c(`Input ${t} does not match this Distributor operation.`);let u=m(await n("accessControlManager")),s=await n("isGovernor",[i],u);if(typeof s!="boolean")throw new c("Merkl returned invalid governor status.");if(!s&&!(e==="updateTree"?await n("canUpdateMerkleRoot",[i])===1n:e==="toggleMainOperatorStatus"&&r.token!==j?await n("isGovernorOrGuardian",[i],u)===!0:!1))throw new c("The connected wallet lacks the required Merkl governance role.");let a=p.map(t=>{if(t==="enabled"||t==="valid"){if(typeof r[t]!="boolean")throw new c(`Provide ${t} as boolean.`);return r[t]}if(t==="amount"){let h=_(r[t],e==="setEpochDuration"?32:e==="setDisputePeriod"?48:256);return e==="setEpochDuration"?Number(h):h}if(t==="merkleRoot"||t==="ipfsHash"){if(typeof r[t]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r[t]))throw new c("Provide a bytes32 root and IPFS hash.");return r[t]}return m(r[t],t==="token"&&e==="toggleMainOperatorStatus")}),d=a;if(e==="updateTree"&&(d=[{merkleRoot:a[0],ipfsHash:a[1]}]),e==="toggleTrusted"||e==="toggleMainOperatorStatus"){let t=await n(e==="toggleTrusted"?"canUpdateMerkleRoot":"mainOperators",e==="toggleTrusted"?[a[0]]:a.slice(0,2));if(t!==0n&&t!==1n)throw new c("Merkl returned invalid authorization state.");if(t===1n===r.enabled)return{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Authorization already has the requested state."};d=a.slice(0,-1)}return U(e,d,`Merkl Distributor ${e} ${JSON.stringify(r)}. Governance affects every claimant. Upgradeability revocation is permanent; dispute resolution returns or forfeits collateral. Authorization operations toggle the observed state; re-preview if state changes.`,i)})]}};export{W as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as y}from"./3CH2IPQL.js";import{getTypesForEIP712Domain as P,hashTypedData as I,isAddress as T}from"viem";function E(t,s,r,f){let m=/^Sign in to raeto as an agent\n\nWallet: (0x[0-9a-fA-F]{40})\nNonce: ([0-9a-f]{32})\n\nThis gives this wallet an API key for its own raeto account\. It costs nothing and moves no funds\.$/.exec(t),n=Date.parse(r);if(!m||m[0]!==t||m[1].toLowerCase()!==s.toLowerCase()||!Number.isFinite(f)||!Number.isFinite(n)||n<=f)throw new Error("Raeto sign-in message changed or expired. Oak did not sign anything.")}function R(t,s,r){throw new Error("pairing template not pinned")}var k="Raeto pairing request changed. Oak did not sign anything.",p=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function b(t,s=0){if(s>32)throw new Error;if(!(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"&&Number.isSafeInteger(t))){if(Array.isArray(t)){for(let r of t)b(r,s+1);return}if(!p(t)||![Object.prototype,null].includes(Object.getPrototypeOf(t)))throw new Error;for(let r of Object.values(Object.getOwnPropertyDescriptors(t))){if(!r.enumerable||!Object.hasOwn(r,"value"))throw new Error;b(r.value,s+1)}}}function j(t,{wallet:s,agentId:r},f){let m={rule:"typedData must contain only plain JSON values within 32 levels",observed:t},n=(c,g)=>{throw m={rule:c,observed:g},new Error(k)};try{b(t);let c=JSON.stringify(t),g=Buffer.byteLength(c,"utf8");g>64*1024&&n("typedData UTF-8 size must be at most 65536 bytes",g),/sk-raeto-/.test(c)&&n("typedData must not contain a Raeto API key",t);let e=JSON.parse(c);if(!p(e))return n("typedData must be an object",e);if(e.primaryType!==y.primaryType&&n(`primaryType must equal ${y.primaryType}`,e.primaryType),!p(e.domain))return n("domain must be an object",e.domain);if(e.domain.name!==y.domainName&&n(`domain.name must equal ${y.domainName}`,e.domain.name),e.domain.chainId!==void 0&&e.domain.chainId!==4663&&n("domain.chainId must be absent or equal 4663",e.domain.chainId),!p(e.types))return n("types must be an object",e.types);if(!p(e.message))return n("message must be an object",e.message);T(s,{strict:!1})||n("local wallet must be an address",s),/^[1-9]\d{0,29}$/.test(r)||n("verified agentId must be a positive decimal of at most 30 digits",r);let l=e.types;for(let[i,a]of Object.entries(l)){if(!Array.isArray(a)||!a.length)return n("each types entry must be a nonempty array",{type:i,fields:a});let d=new Set;for(let o of a){if(!p(o)||typeof o.name!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(o.name)||typeof o.type!="string"||!o.type||d.has(o.name))return n("type fields must have unique identifier names and nonempty string types",{type:i,field:o});d.add(o.name)}}m={rule:"domain must support EIP-712 domain field derivation",observed:e.domain};let A=P({domain:e.domain}),u=l.EIP712Domain;u!==void 0&&(!Array.isArray(u)||u.length!==A.length||A.some(i=>!u.some(a=>a.name===i.name&&a.type===i.type)))&&n("types.EIP712Domain must sign every advertised domain field with its derived type",u);let v=!1,w=i=>{if(Array.isArray(i)){i.forEach(w);return}if(p(i))for(let[a,d]of Object.entries(i)){let o=a.replace(/_/g,"").toLowerCase();o==="agentid"&&(String(d)!==r&&n("every message agent ID must equal the verified agentId",{field:a,value:d,expected:r}),v=!0),/^(wallet|address|signer|owner|agentwallet|agentaddress|signerwallet|signeraddress|ownerwallet|owneraddress|walletaddress)$/.test(o)&&(typeof d!="string"||d.toLowerCase()!==s.toLowerCase())&&n("every message signer or wallet field must equal the local wallet",{field:a,value:d,expected:s}),w(d)}};w(e.message);let h=l[y.primaryType];return v||n("message must contain the verified agentId",e.message),(!Array.isArray(h)||!h.some(i=>p(i)&&typeof i.name=="string"&&i.name.replace(/_/g,"").toLowerCase()==="agentid"))&&n("primary type must declare a signed agentId field",h),m={rule:"typedData must be encodable as EIP-712",observed:e},I(e),{untrusted:!0,primaryType:e.primaryType,domain:e.domain,types:l,message:e.message}}catch{throw f?.(m),new Error(k)}}export{E as a,R as b,k as c,j as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as X}from"./YSMWCKIX.js";import{b as Z}from"./NA424YAL.js";import{a as Y}from"./FZ6IJZZM.js";import{b as z}from"./JWR5XVP2.js";import{c as Q}from"./JLRHM2DQ.js";import{a as D,b as k,c as R,d as N,g as V,h as I,k as _,l as x,n as B,p as W,r as $,s as U,t as q,v as E,x as J,y as G}from"./V37L4DU4.js";import{a as y}from"./X5V2Z2NM.js";import{b as K}from"./SPJCSEKP.js";import{a as O}from"./43LI5NKJ.js";import{c as L,e as T,g as w}from"./NWNYJ26T.js";import{a as g,d as j}from"./XSD5NL7J.js";import{a as A}from"./JXOEJPJ4.js";import{Buffer as ee}from"node:buffer";import{decodeEventLog as ne,encodeFunctionData as H,getAddress as oe,hexToString as se,parseAbiItem as de,toEventSelector as re}from"viem";var je={register:"erc8004_register"},ce="Oak now always adds the public oak.registrar marker when it registers an agent, so tag: false and --no-tag are no longer available. Remove the option and register again. To use an agent ID you already own without the marker, link it with oak setup link <agentId>.",ge="The registration went through, but Oak could not find its oak.registrar marker on Robinhood Chain. Nothing else was sent. Ask me to check the agent with erc8004_identity.",fe="One transaction registers your agent and writes the public marker oak.registrar = oak. Anyone can see on Robinhood Chain that this agent was registered through Oak. The marker is self-reported, not proof of anything, and the transaction stays in the public history even if the marker is changed later. It needs gas.",F="https://eips.ethereum.org/EIPS/eip-8004#registration-v1",le={type:"object",required:["type","name","description","image","services","x402Support","active","registrations"],properties:{type:{const:F,description:"ERC-8004 registration-v1 profile type URI."},name:{type:"string",minLength:1,description:"Short public name for the agent."},description:{type:"string",description:"Public text describing what the agent does; may be empty."},image:{type:"string",description:"Public HTTPS or IPFS image URI without credentials."},services:{type:"array",items:{type:"object",required:["name","endpoint"]},description:"Service endpoint objects with name and endpoint; use an empty list for none."},x402Support:{type:"boolean",description:"Whether the agent supports x402 payments."},active:{type:"boolean",description:"Whether this agent is active."},registrations:{type:"array",description:"Registry references with agentRegistry and agentId; leave empty before first registration."},tags:{type:"array",items:{type:"string"},description:"Optional public text labels for the agent."},supportedTrust:{type:"array",items:{type:"string"},description:"Optional trust mechanism labels supported by the agent."}}};function ue(t){if(typeof t!="string"||!t.trim())return!1;try{let e=new URL(t);return["https:","ipfs:"].includes(e.protocol)&&!!e.hostname&&!e.username&&!e.password}catch{return!1}}var pe=t=>Array.isArray(t)&&t.every(e=>typeof e=="string"&&e.trim()),me=t=>t.replace(/\.$/,"");function he(t,e,a,n){let{registryId:d}=I(t);if(!T(e))throw new g("Provide a registration-v1 profile object.");if(a!==void 0&&typeof a!="boolean")throw new g("The tag option must be a boolean.");let o=[],r=(i,c)=>o.push(`${i}: ${c}`);e.type!==F&&r("type",`use "${F}"`),(typeof e.name!="string"||!e.name.trim())&&r("name",'a short name for your agent, such as "Oak Agent 1"'),typeof e.description!="string"&&r("description","a sentence about what your agent does (it may be empty text)"),ue(e.image)||r("image","an HTTPS or IPFS link to a picture, with no username or password in it"),typeof e.active!="boolean"&&r("active","true or false"),typeof e.x402Support!="boolean"&&r("x402Support","true or false"),Array.isArray(e.services)?e.services.forEach((i,c)=>{try{Z(i)}catch(p){if(!(p instanceof g))throw p;r(`services item ${c+1}`,me(p.message))}}):r("services","a list of endpoints, or [] for none");for(let i of["tags","supportedTrust"])e[i]!==void 0&&!pe(e[i])&&r(i,"a list of nonempty text labels, or leave it out");if(Array.isArray(e.registrations)?e.registrations.forEach((i,c)=>{let p=`registrations item ${c+1}`;if(!T(i)||typeof i.agentRegistry!="string"||!/^eip155:[1-9][0-9]*:0x[0-9a-fA-F]{40}$/.test(i.agentRegistry))return r(p,"an agentRegistry such as eip155:4663:0x\u2026 and its agentId");let f=typeof i.agentId=="number"&&Number.isSafeInteger(i.agentId)?String(i.agentId):i.agentId,b;try{b=x(f)}catch{return r(p,'an agentId as a whole number, such as "1"')}w(i.agentRegistry,d)&&(n===void 0?r(p,"remove the entry for this registry; its ID comes from the mined Registered receipt, and erc8004_update adds it afterwards"):b!==n&&r(p,`the agentId does not match the agent being updated; use "${n}" or remove the entry`))}):r("registrations","a list, or [] before the first registration"),o.length)throw new g(`This profile needs: ${o.join("; ")}. Fix all of these and try again.`);let u=e.registrations.map(i=>({...i}));n!==void 0&&!u.some(i=>w(i.agentRegistry,d))&&u.push({agentId:n.toString(),agentRegistry:d});let s=[...new Set((e.tags??[]).filter(i=>i!==k))];a!==!1&&s.push(k);let m={...e,registrations:u,...s.length?{tags:s}:{}};s.length||delete m.tags;let l;try{if(l=JSON.stringify(m),ee.byteLength(l)>65536)throw new Error;JSON.parse(l)}catch{throw new g("Profile must be JSON data no larger than 64 KiB.")}return`data:application/json;base64,${ee.from(l,"utf8").toString("base64")}`}async function M(t,e){try{let{chainId:a,registry:n}=I(t),d=x(e),o=t.clientFor(a),r=await o.readContract({address:n,abi:y,functionName:"ownerOf",args:[d]}).catch(l=>{throw j(l)?new g(`Agent ${d} does not exist in this ERC-8004 registry: the owner lookup reverted. Check the agent ID.`):l});O(r);let[u,s,m]=await Promise.all([o.readContract({address:n,abi:y,functionName:"tokenURI",args:[d]}),o.readContract({address:n,abi:y,functionName:"getAgentWallet",args:[d]}),o.readContract({address:n,abi:y,functionName:"getMetadata",args:[d,k]})]);if(O(s),typeof u!="string"||typeof m!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(m))throw new g("The registry returned invalid identity data.");return{agentId:d.toString(),chainId:a,registry:n,owner:r,uri:u,agentWallet:s,registrarMetadata:m,registryValidated:!1,summary:D}}catch(a){throw new g(t.plainError(a))}}async function Le(t,e){let a=await M(t,e);return{...a,uri:A(a.uri)}}async function ye(t,e,a,n,d,o){let{registry:r}=I(t),u=await E(t,e,a,d),s=o===void 0?"Registered":"URIUpdated",m=re(o===void 0?"Registered(uint256,string,address)":"URIUpdated(uint256,string,address)"),l=u.logs.filter(v=>w(v.address,r)&&v.topics[0]===m&&!v.removed);if(l.length!==1)throw new g(`The receipt must contain one matching ${s} event.`);let i=l[0],c=ne({abi:y,eventName:s,topics:i.topics,data:i.data,strict:!0}),p=c.args.agentId,f=c.eventName==="Registered"?c.args.agentURI:c.args.newURI,b=c.eventName==="Registered"?c.args.owner:c.args.updatedBy;if(o!==void 0&&p!==o||f!==n||!w(b,a))throw new g("The registry event does not match the expected agent, URI and wallet.");let h=await M(t,p.toString());if(h.uri!==n||o===void 0&&!w(h.owner,a))throw new g("The current agent owner or URI does not match the confirmed operation.");return h}function we(t,e){let{chainId:a,registry:n}=I(t);return t.unsignedTx({to:n,chainId:a,value:"0",data:H({abi:y,functionName:"setMetadata",args:[e,k,R]}),description:`Set mutable oak.registrar metadata to oak for agent ${e}.`})}async function te(t,e,a,n){let{registry:d}=I(t),o=x(n.agentId),r=await E(t,e,a,H({abi:y,functionName:"setMetadata",args:[o,k,R]})),u=re("MetadataSet(uint256,string,string,bytes)"),s=r.logs.filter(c=>w(c.address,d)&&c.topics[0]===u&&!c.removed);if(s.length!==1)throw new g("The receipt must contain one matching MetadataSet event.");let m=s[0],{args:l}=ne({abi:y,eventName:"MetadataSet",topics:m.topics,data:m.data,strict:!0});if(l.agentId!==o||l.metadataKey!==k||l.metadataValue!==R)throw new g("The metadata event does not match this agent and registrar marker.");let i=await M(t,n.agentId);if(i.registrarMetadata!==R||i.uri!==n.uri||!w(i.owner,n.owner))throw new g("The current agent metadata, owner or URI does not match the confirmed operation.");return i}async function be(t,e){let{chainId:a,registry:n}=I(t),d=t.clientFor(a),o=await d.readContract({address:n,abi:y,functionName:"balanceOf",args:[e]});if(o===0n)return;if(typeof o!="bigint"||o<0n)throw new g("Registry balance is unavailable; registration was not built.");let r=await d.getBlockNumber({cacheTime:0}),u=new Set;for(;;){let s=r>9999999n?r-9999999n:0n,m=await d.getLogs({address:n,event:de("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:s,toBlock:r,strict:!0});for(let l of m){let i=l.args.tokenId.toString();if(l.removed||u.has(i))continue;u.add(i);let c=await M(t,i);if(w(c.owner,e))return c}if(s===0n)throw new g("Owned identity could not be located; registration was not built. Run oak setup link <agentId>.");r=s-1n}}function ke(t){if(t===void 0)return[];if(!Array.isArray(t)||t.length>15)throw new g("Provide at most 15 user metadata entries as { key, value } with value as 0x hex or text.");let e=new Set;return t.map(a=>{if(!T(a))throw new g("Provide each metadata entry as { key, value } or { key, text }.");let n=J(a.key);if(n===k)throw new g("The key oak.registrar is reserved for the registration marker. Remove that metadata entry.");if(e.has(n))throw new g(`Metadata key ${A(n)} is repeated.`);return e.add(n),{metadataKey:n,metadataValue:G(a)}})}function ie(t,e,a){let n=$(e);if(!n)return;let{registryId:d}=I(t);return Array.isArray(n.registrations)&&n.registrations.some(o=>T(o)&&typeof o.agentRegistry=="string"&&w(o.agentRegistry,d)&&String(o.agentId)===a.toString())}function Ie(t,e,a){let n=ie(t,e.uri,BigInt(e.agentId));return n===!0?{...e,profileComplete:!0}:{...e,profileComplete:n===void 0?null:!1,nextStep:{tool:"erc8004_update",arguments:{agentId:e.agentId,profile:a??"a registration-v1 profile object"},why:"The minted profile does not list its own registry and agent ID yet (registrations is empty). erc8004_update appends it automatically. It is a normal action: it needs a verified identity link and an active subscription, so link with oak_setup first."}}}async function ae(t,e,a,n){let{chainId:d,registry:o}=I(t);O(n),B(t,a.chainId);let r=e?x(a.agentId):void 0;if(!e&&(a.tag===!1||a.noTag!==void 0||a["--no-tag"]!==void 0))throw new g(ce);if(a.tag!==void 0&&typeof a.tag!="boolean")throw new g("The tag option must be a boolean.");let s=!e&&a.profile===void 0?"":he(t,a.profile,a.tag,r),m=e?[]:ke(a.metadata),l=a.tag!==!1;if(e&&a.metadataTransactionHash!==void 0&&(!l||a.transactionHash===void 0))throw new g("A metadata transaction hash requires tagging and the profile transaction hash.");let i=r!==void 0?H({abi:y,functionName:"setAgentURI",args:[r,s]}):H({abi:y,functionName:"register",args:[s,[...m,{metadataKey:k,metadataValue:R}]]}),c=f=>r===void 0?Ie(t,f,a.profile):f;if(a.transactionHash!==void 0){let f=await ye(t,a.transactionHash,n,s,i,r);if(!e){if(!w(f.registrarMetadata,R))throw new g(ge);if(a.metadataTransactionHash!==void 0)throw new g("Registration already writes oak.registrar in one transaction. Omit metadataTransactionHash.");return c(f)}return l&&a.metadataTransactionHash!==void 0?c(await te(t,a.metadataTransactionHash,n,f)):c(f)}if(!e){let f=await be(t,n);if(f){let b={...f,registrationResumed:!0},h=$(f.uri),v=Array.isArray(h?.tags)&&h.tags.includes(k);if(a.metadataTransactionHash!==void 0){if(!v)throw new g("Only a legacy Oak profile can resume its registrar metadata. Link this agent with oak setup link <agentId>.");return c({...await te(t,a.metadataTransactionHash,n,f),registrationResumed:!0})}if(!v||f.registrarMetadata!=="0x")return c(b);let S=await U(t,[we(t,x(f.agentId))],n,`Resume registrar metadata for legacy Oak agent ${f.agentId}; no new identity will be minted. Submit locally, then repeat these arguments with metadataTransactionHash to verify the marker receipt.`);return{...b,...S}}if(a.metadataTransactionHash!==void 0)throw new g("No owned legacy Oak identity was found; no metadata transaction was built.")}r!==void 0&&await q(t,r,n);let p=[t.unsignedTx({to:o,data:i,value:"0",chainId:d,description:r===void 0?"Register an ERC-8004 agent profile.":`Update ERC-8004 agent ${r} profile.`})];return e?U(t,p,n,"Submit locally, then repeat the original arguments with transactionHash to verify the profile receipt and URI. The tag option changes the profile tag only; existing onchain metadata is unchanged."):U(t,p,n,`${fe} Submit locally, then repeat the original arguments with transactionHash to verify the registration receipt, URI and marker. Update the profile registrations with the mined ID afterward.`)}async function ve(t,e){let a=await M(t,e.agentId),{chainId:n,registry:d}=I(t),o=t.clientFor(n),r=BigInt(a.agentId),u=e.metadataKeys===void 0?[]:(()=>{if(!Array.isArray(e.metadataKeys)||e.metadataKeys.length>16)throw new g("Provide at most 16 metadata keys.");return e.metadataKeys.map(h=>W(h,"metadata key",128,!1))})(),s=e.operator===void 0?void 0:oe(String(e.operator)),[m,l,...i]=await Promise.allSettled([o.readContract({address:d,abi:y,functionName:"getApproved",args:[r]}),s?o.readContract({address:d,abi:y,functionName:"isApprovedForAll",args:[a.owner,s]}):Promise.resolve(void 0),...u.map(h=>o.readContract({address:d,abi:y,functionName:"getMetadata",args:[r,h]}))]),c=h=>h.status==="fulfilled"?h.value:void 0,p=c(m),f=_(a.agentWallet)?"unset":w(a.agentWallet,a.owner)?"owner":"verified-other",b=ie(t,a.uri,r);return{...a,approved:typeof p=="string"&&_(p)?null:p??"unavailable",...s?{operator:s,operatorApproved:c(l)??"unavailable"}:{},walletState:f,walletNote:f==="unset"?"No verified payment wallet: it starts as the minting owner, and any NFT transfer or erc8004_unset_wallet clears it. Re-verify with erc8004_wallet_proof then erc8004_set_wallet.":f==="owner"?"The payment wallet is the current owner.":"The payment wallet was proven by a signature from that wallet and is not the owner.",profile:{selfRegistered:b??null,fetched:!1,note:b===void 0?"The URI is external or not decodable; Oak does not fetch it.":void 0},...u.length?{metadata:Object.fromEntries(u.map((h,v)=>{let S=c(i[v]),P=typeof S=="string"&&/^0x([0-9a-fA-F]{2})*$/.test(S)?S:void 0,C;if(P&&P!=="0x")try{C=A(se(P))}catch{C=void 0}return[A(h),{hex:P??"unavailable",...C?{text:C}:{}}]}))}:{}}}var Re={type:"object",additionalProperties:!1,required:["key"],properties:{key:{type:"string",minLength:1,maxLength:128,description:"Metadata key; agentWallet and oak.registrar are reserved during registration."},value:{...V,description:"Metadata bytes as 0x-prefixed hex; provide value or text."},text:{type:"string",description:"Metadata as UTF-8 text; provide text or value."}}},Ae=t=>{let e=(n,d,o)=>({name:n,inputSchema:d,execute:async(r,u)=>{try{let s=await o(r,u);return T(s)&&typeof s.uri=="string"?{...s,uri:A(s.uri)}:s}catch(s){throw new g(t.plainError(s))}}}),a=n=>({type:"object",additionalProperties:!1,required:n?["agentId","profile"]:[],properties:{profile:{...le,description:n?"Registration-v1 profile object to publish for this agent.":"Omit for an empty URI; register(uri, metadata[]) still writes the public oak.registrar marker. Attach a profile later with erc8004_update."},tag:{type:"boolean",default:!0,description:n?"Set false to remove the profile tag. Profile updates leave existing onchain metadata unchanged.":"Accepted only as true. Oak always adds the oak.registrar marker when it registers."},transactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:n?"Verify the exact profile transaction, event and URI.":"After local submission, verify exact registration calldata, event, URI and oak.registrar marker."},metadataTransactionHash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:n?"Optional legacy metadata transaction hash, supplied with transactionHash to verify a previously sent two-transaction update.":"Only for a resumed legacy Oak profile: verify its separate metadata transaction without transactionHash."},...n?{agentId:N}:{noTag:{type:"boolean",description:"Removed option: omit it and register again."},"--no-tag":{type:"boolean",description:"Removed option: omit it and register again."},metadata:{type:"array",maxItems:15,items:Re,description:"Up to 15 user entries plus the mandatory oak.registrar marker. The keys agentWallet and oak.registrar are reserved."}}}});return{tools:[e("erc8004_register",a(!1),(n,d)=>ae(t,!1,n,d)),e("erc8004_update",a(!0),(n,d)=>ae(t,!0,n,d)),e("erc8004_identity",{type:"object",additionalProperties:!1,required:["agentId"],properties:{agentId:N,metadataKeys:{type:"array",maxItems:16,items:{type:"string",minLength:1,maxLength:128},description:"Also read these onchain metadata keys."},operator:{...L,description:"Also report whether this address is approved for all of the owner's agents."}}},n=>ve(t,n))]}},Ke=t=>K("erc8004",[Ae(t),Q(t),X(t),Y(t),z(t)]);export{je as a,Le as b,ie as c,Ae as d,Ke as e};
|
|
@@ -0,0 +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{a as u,i as $,j as I}from"./FWD4L3CJ.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 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as h}from"./GQ3XZFRL.js";import{a as H}from"./HOEQVPY7.js";import{a as E}from"./SCG5HWMN.js";import{a as m}from"./XSD5NL7J.js";var O="https://heyresearch.xyz/api/v1/scan",T=2500,D=6e4,S=64,L=32768,x=/^0x[0-9a-fA-F]{40}$/,$=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;function R(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var f=class extends m{};function j(e,t){return e===401||e===403?new f(`HEY Research Lab refused access (HTTP ${e}). Ask the Oak operator to check HEY access and allowance.`):(e===400||e===422)&&(/^\/api\/v1\/(?:scan|builder)\?/.test(t)||t.startsWith("/api/agent/research_project?address="))?new f(`HEY Research Lab rejected this token identity on chain 4663 (HTTP ${e}). Check the token contract address.`):new f(`HEY Research Lab rejected the request (HTTP ${e}). Check the project, token address and selectors.`)}var z=/\.(?:localhost|local|localdomain|internal|intranet|lan|home|corp|private|home\.arpa)$/;function P(e){let t=e.toLowerCase().replace(/\.$/,"");return!t||t.startsWith("[")||/^[\d.]+$/.test(t)||!t.includes(".")||t==="localhost"||z.test(t)?!1:/^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/.test(t)&&/[a-z]/.test(t.slice(t.lastIndexOf(".")+1))}function A(e,t=!1){if(typeof e!="string"||e.length>2048||/[\s<>\\]/.test(e)||$.test(e))return!1;try{let r=new URL(e);return r.protocol==="https:"&&!r.username&&!r.password&&(t?r.origin==="https://heyresearch.xyz"&&r.pathname.startsWith("/project/"):P(r.hostname))}catch{return!1}}function I(e){return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number.isFinite(Date.parse(e))&&new Date(e).toISOString().slice(0,10)===e&&e<=new Date(Date.now()+864e5).toISOString().slice(0,10)}function Y(e){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/.test(e))return!1;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString().slice(0,19)===e.slice(0,19)&&t<=Date.now()+3e5}function v(e,t,r){if(t!==4663||!x.test(r)||!R(e)||e.chainId!==t||typeof e.contractAddress!="string"||e.contractAddress.toLowerCase()!==r.toLowerCase())return;let a={chainId:4663,contractAddress:e.contractAddress};if(e.found===!1)return Object.freeze({found:!1,...a});if(e.found!==!0||!h(e.status_label,80)||!h(e.status_help,300)||typeof e.verified_builder!="boolean"||typeof e.activity_applies_to_token!="boolean"||typeof e.token_verification!="string"||!/^[A-Z][A-Z_]{0,63}$/.test(e.token_verification)||!A(e.project_link,!0)||!R(e.activity))return;let s=e.activity.last_ship,o=e.activity.last_ship_url;if(s!=null&&!I(s)||o!=null&&!A(o))return;let i=e.as_of;if(!(i!==void 0&&!Y(i))&&s!=null==(o!=null))return Object.freeze({found:!0,...a,status_label:e.status_label,status_help:e.status_help,verified_builder:e.verified_builder,token_verification:e.token_verification,activity_applies_to_token:e.activity_applies_to_token,project_link:e.project_link,...i===void 0?{}:{as_of:i},activity:Object.freeze({last_ship:s??null,last_ship_url:o??null})})}async function N(e,t){if(!e.ok||!e.body)throw new Error("HEY unavailable");let r=e.body.getReader(),a=()=>{r.cancel().catch(()=>{})};t.addEventListener("abort",a,{once:!0}),t.aborted&&a();let s=new TextDecoder("utf-8",{fatal:!0}),o="",i=0;try{for(;;){let{done:c,value:d}=await r.read();if(c)break;if(i+=d.byteLength,i>L)throw new Error("HEY response too large");o+=s.decode(d,{stream:!0})}return JSON.parse(o+s.decode())}finally{t.removeEventListener("abort",a),a()}}function U(e,t=fetch){if(!/^[0-9A-Za-z.+-]{1,64}$/.test(e))throw new Error("Invalid integration version");let r=new Map,a=new Map,s=H();return async(o,i)=>{if(o!==4663||!x.test(i)||/^0x(?:0{40}|e{40})$/i.test(i))return{status:"unavailable"};if(s.blocked())return{status:"unavailable"};let c=`${o}:${i.toLowerCase()}`,d=r.get(c);if(d&&d.expires>Date.now())return d.result;r.delete(c);let _=a.get(c);if(_)return _;if(a.size>=S)return{status:"unavailable"};let b=(async()=>{let p=new AbortController,w;try{let u=new Promise((l,n)=>{w=setTimeout(()=>{s.defer(null),p.abort(),n(new Error("HEY deadline"))},T)}),C=(async()=>{let l=new URL(O);l.searchParams.set("chain",String(o)),l.searchParams.set("token",i);let n;try{n=await t(l,{method:"GET",headers:{"x-hey-integration":`oak-agent-kit/${e}`},signal:p.signal,credentials:"omit",redirect:"error",referrerPolicy:"no-referrer"})}catch(y){if(y instanceof E)n=y.response;else throw s.defer(null),y}if(n.status===429||n.status>=500)throw s.defer(n.headers.get("retry-after")),n.body?.cancel().catch(()=>{}),new Error("HEY unavailable");if(n.status>=400&&n.status<500)throw n.body?.cancel().catch(()=>{}),j(n.status,"/api/v1/scan?");let k=v(await N(n,p.signal),o,i);if(!k)throw new Error("Invalid HEY response");return Object.freeze({status:"ok",card:k})})(),g=await Promise.race([C,u]);for(let[l,n]of r)n.expires<=Date.now()&&r.delete(l);return r.size>=S&&r.delete(r.keys().next().value),r.set(c,{expires:Date.now()+D,result:g}),g}catch(u){if(u instanceof f)throw u;return{status:"unavailable"}}finally{clearTimeout(w)}})();a.set(c,b);try{return await b}finally{a.delete(c)}}}export{j as a,v as b,U as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{d as F,e as M}from"./ACH4BSME.js";import{g as H,j as R}from"./PZEF5LBL.js";import{a as y,b as x,c,f as $,j as L,l as S,m as O,n as U}from"./CSOO4SW7.js";import{a as r}from"./I6PQW2JI.js";import{a as N}from"./K6D6SDIG.js";import{c as q}from"./43LI5NKJ.js";import{g as _}from"./NWNYJ26T.js";import{a as h}from"./XSD5NL7J.js";import{encodeFunctionData as W}from"viem";var j={chop_wrap:["log","underlying","amount","minLogOut"],chop_unwrap:["log","amount","quotedNet"],chop_farm:["log","amount","pairedAmount","minPaired","minStakedLp","slippageBps","deadline"],chop_unfarm:["log","amount","minLogOut","minPairedOut","deadline"],chop_harvest:["log"]};function z(l,o){if(Object.keys(l).some(n=>!o.includes(n)))throw new h("Unexpected Chop argument.");if(o.some(n=>l[n]===void 0))throw new h("Provide every required Chop input.")}async function V(l,o,n){let d=c(o),p=await l.getBlock({blockNumber:BigInt(n.measuredAtBlock)});if(p.number!==BigInt(n.measuredAtBlock)||d<=x(p.timestamp)||d>p.timestamp+1200n)throw new h("Chop deadline must be in the next 20 minutes.");return d}async function D(l,o,n,d){if(z(n,j[o]),y(d),l.network==="testnet")throw new h("Chop requires chain 4663.");let p=y(n.log),u=l.clientFor(4663),i=await S(u,p,o==="chop_wrap"||o==="chop_farm"?"enter":"exit"),s=BigInt(i.measuredAtBlock),f=[],g=[],C=(e,t,a)=>{f.push(q(e.address,t,a.toString(),4663)),g.push(l.approval(e.address,t,a.toString(),4663))},P=(e,t,a)=>{let m={to:e,data:W({abi:N,functionName:t,args:a}),value:"0",chainId:4663,description:`${o} on verified log ${p}.`,...o==="chop_harvest"?{gasLimit:"1000000"}:{}};f.push(m),g.push({...l.unsignedTx(m),...m.gasLimit===void 0?{}:{gasLimit:m.gasLimit}})},A=[],v=(e,t,a=!0)=>A.push({token:e,min:-t,max:a?-t:-1n}),w=(e,t)=>A.push({token:e,min:t}),T=async(e,t)=>{if(x(await $(u,e.address,"balanceOf",[d],s))<t)throw new h("This wallet does not hold enough tokens for the Chop action.")},k;if(o==="chop_wrap"){let e=c(n.amount),t=c(n.minLogOut);if(!_(y(n.underlying),i.underlying.address))throw new h("The underlying token does not match the verified Chop log.");await T(i.underlying,e),C(i.underlying,p,e),P(p,"bond",[i.underlying.address,e,t]),v(i.underlying,e,!1),w(i.log,t),k=`Wrap at most ${e} underlying base units; on-chain minimum ${t} log base units.`}else if(o==="chop_unwrap"){let e=c(n.amount),t=c(n.quotedNet);await T(i.log,e);let a=await M(u,i,d,e);if(BigInt(a.net.amount)<t)throw new h("Chop unwrap no longer meets the quoted net amount. Request a fresh quote.");let m=F(i,e);f.push(m),g.push(l.unsignedTx(m)),v(i.log,e),w(i.underlying,t),k=`Unwrap ${e} log base units; preview must return at least quoted ${t} underlying base units.`}else if(o==="chop_farm"){await L(u,r.helper,s);let e=c(n.amount),t=c(n.pairedAmount),a=c(n.minPaired),m=c(n.minStakedLp),I=await V(u,n.deadline,i),b=n.slippageBps;if(typeof b!="number"||!Number.isInteger(b)||b<0||b>1e3||b%10!==0||a>t)throw new h("Chop LP slippage must be 0\u20131000 basis points in multiples of 10; the paired minimum cannot exceed its input.");await Promise.all([T(i.log,e),T(i.paired,t)]),C(i.log,r.helper.address,e),C(i.paired,r.helper.address,t),P(r.helper.address,"addLPAndStake",[p,e,i.paired.address,t,a,BigInt(b/10),I]),v(i.log,e,!1),A.push({token:i.paired,min:-t,max:-a}),w(i.staking,m),k=`Farm up to ${e} log + ${t} paired base units; slippage ${b} bps; deadline ${I}. Staked LP minimum ${m} is checked in simulation; two-sided token minimums from slippage are enforced on chain. Paired consumption must also meet ${a} base units in the preview. This tool does not zap; the helper's paired minimum alone has no on-chain effect for a direct pair.`}else if(o==="chop_unfarm"){await L(u,r.helper,s);let e=c(n.amount),t=c(n.minLogOut),a=c(n.minPairedOut),m=await V(u,n.deadline,i);if(x(await $(u,i.staking.address,"withdrawableStake",[d],s))<e)throw new h("Chop stake is still locked or too small. Wait at least 10 minutes after staking.");C(i.staking,r.helper.address,e),P(r.helper.address,"unstakeAndRemoveLP",[p,e,t,a,m]),v(i.staking,e),w(i.log,t),w(i.paired,a),k=`Unfarm ${e} staked LP base units; on-chain minimums ${t} log and ${a} paired base units; deadline ${m}.`}else{if(await L(u,r.whitelist,s),await $(u,r.whitelist.address,"paused",[r.chop],s)!==!1)throw new h("Chop rewards are paused or their pause state is unavailable.");let e=x(await $(u,i.rewards,"getClaimable",[r.chop,d],s));if(e===0n)throw new h("No CHOP is claimable now. Rewards may still be inside the 10-minute maturity lock.");P(i.rewards,"claimReward",[d]),w({address:y(r.chop),symbol:"CHOP",decimals:18,chainId:4663},e),k=`Harvest at least ${e} CHOP base units to ${d} in the preview. ${H} Allow at least 1,000,000 gas for this call.`}return(o==="chop_farm"||o==="chop_unfarm")&&!A.some(e=>_(e.token.address,r.chop))&&w({address:y(r.chop),symbol:"CHOP",decimals:18,chainId:4663},0n),O(g,f),{built:g,expected:f,rules:A,details:k,facts:i,log:p}}async function ie(l,o,n,d){let{built:p,expected:u,rules:B,details:i,facts:s,log:f}=await D(l,o,n,d),g=await l.preview(p,d);return O(g.txs,u,!0),U(g,B),{txs:p,preview:g,log:f,measuredAtBlock:s.measuredAtBlock,summary:`${R(s)}
|
|
2
|
+
${i}
|
|
3
|
+
Underlying ${s.underlying.address} (decimals ${s.underlying.decimals}); log ${f} (decimals ${s.log.decimals}); paired ${s.paired.address} (decimals ${s.paired.decimals}).`}}export{j as a,z as b,D as c,ie as d};
|