@oakagentkit/core 0.2.7 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/api/addresses.d.ts +9 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.d.ts +4 -0
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/identity-link.js +1 -1
- package/build/dist/api/metadata.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.d.ts +9 -0
- 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/abi.d.ts +54 -0
- package/build/dist/api/modules/borro/abi.js +1 -1
- package/build/dist/api/modules/borro/actions.d.ts +14 -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 +10 -2
- 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/pins.d.ts +30 -14
- package/build/dist/api/modules/borro/pins.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/borro/types.d.ts +1 -0
- package/build/dist/api/modules/chop/actions.js +1 -1
- package/build/dist/api/modules/chop/checks.js +1 -1
- package/build/dist/api/modules/chop/copy.js +1 -1
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- package/build/dist/api/modules/chop/pins.d.ts +13 -0
- package/build/dist/api/modules/chop/pins.js +1 -1
- package/build/dist/api/modules/chop/positions.js +1 -1
- package/build/dist/api/modules/chop/reader.js +1 -1
- package/build/dist/api/modules/clanker/extensions.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/clanker/manage.js +1 -1
- package/build/dist/api/modules/clanker/pool-config.js +1 -1
- package/build/dist/api/modules/clanker/protocol.js +1 -1
- package/build/dist/api/modules/clanker/state.js +1 -1
- package/build/dist/api/modules/earn/copy.d.ts +6 -6
- package/build/dist/api/modules/earn/copy.js +1 -1
- package/build/dist/api/modules/earn/cost.d.ts +1 -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.js +1 -1
- package/build/dist/api/modules/earn/options.js +1 -1
- package/build/dist/api/modules/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
- package/build/dist/api/modules/erc8004/thesis.js +1 -0
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/fobo/client.d.ts +9 -0
- package/build/dist/api/modules/fobo/client.js +1 -0
- package/build/dist/api/modules/fobo/index.d.ts +16 -0
- package/build/dist/api/modules/fobo/index.js +1 -0
- package/build/dist/api/modules/fobo/intent.d.ts +243 -0
- package/build/dist/api/modules/fobo/intent.js +1 -0
- package/build/dist/api/modules/fobo/pins.d.ts +178 -0
- package/build/dist/api/modules/fobo/pins.js +1 -0
- package/build/dist/api/modules/fobo/steps.d.ts +25 -0
- package/build/dist/api/modules/fobo/steps.js +1 -0
- package/build/dist/api/modules/fobo/verify.d.ts +89 -0
- package/build/dist/api/modules/fobo/verify.js +1 -0
- package/build/dist/api/modules/gloam/copy.d.ts +1 -1
- package/build/dist/api/modules/gloam/copy.js +1 -1
- package/build/dist/api/modules/gloam/index.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.d.ts +12 -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.d.ts +14 -0
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/buyback.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.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.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.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.d.ts +2 -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/abi.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/checks.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/merkl.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/layerbank/reserve.js +1 -1
- package/build/dist/api/modules/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/analytics.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/longbow/nft.js +1 -1
- package/build/dist/api/modules/longbow/rebates.js +1 -1
- package/build/dist/api/modules/longbow/staking.js +1 -1
- package/build/dist/api/modules/meridian/index.js +1 -1
- package/build/dist/api/modules/meridian/markets.js +1 -1
- package/build/dist/api/modules/meridian/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.d.ts +2 -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/surface.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
- package/build/dist/api/modules/netnet/card-policy.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/desk-read.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/index.d.ts +6 -0
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/validate.js +1 -1
- package/build/dist/api/modules/pendle/verify.js +1 -1
- package/build/dist/api/modules/pons/claim.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/prices.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.d.ts +2 -8
- package/build/dist/api/modules/pons/swap-terms.js +1 -1
- package/build/dist/api/modules/pons/trade.js +1 -1
- package/build/dist/api/modules/poolstrade/index.js +1 -1
- package/build/dist/api/modules/priors/coverage.js +1 -1
- package/build/dist/api/modules/priors/discovery.js +1 -1
- package/build/dist/api/modules/priors/features.js +1 -1
- package/build/dist/api/modules/priors/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/relay/api.js +1 -1
- package/build/dist/api/modules/relay/bootstrap.js +1 -1
- package/build/dist/api/modules/relay/discovery.js +1 -1
- package/build/dist/api/modules/relay/inbound.js +1 -1
- package/build/dist/api/modules/relay/index.js +1 -1
- package/build/dist/api/modules/relay/order.js +1 -1
- package/build/dist/api/modules/relay/outbound-status.js +1 -1
- 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/details.js +1 -1
- package/build/dist/api/modules/spark/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/discovery.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.js +1 -1
- package/build/dist/api/modules/tickerspring/ladder.js +1 -1
- package/build/dist/api/modules/tickerspring/maker.js +1 -1
- package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
- package/build/dist/api/modules/tickerspring/research.js +1 -1
- package/build/dist/api/modules/tickerspring/strategies.js +1 -1
- package/build/dist/api/modules/uniswap/auction-create.js +1 -1
- package/build/dist/api/modules/uniswap/auction.js +1 -1
- package/build/dist/api/modules/uniswap/batch.js +1 -1
- package/build/dist/api/modules/uniswap/common.js +1 -1
- package/build/dist/api/modules/uniswap/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- package/build/dist/api/modules/uniswap/local-guard.js +1 -1
- package/build/dist/api/modules/uniswap/oracle.js +1 -1
- package/build/dist/api/modules/uniswap/pool-math.js +1 -1
- package/build/dist/api/modules/uniswap/pools.js +1 -1
- package/build/dist/api/modules/uniswap/position.js +1 -1
- package/build/dist/api/modules/uniswap/protocol.js +1 -1
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
- package/build/dist/api/modules/uniswap/token-jar.js +1 -1
- package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
- package/build/dist/api/modules/uniswap/trade.js +1 -1
- package/build/dist/api/modules/uniswap/v2.js +1 -1
- package/build/dist/api/modules/uniswap/v3.js +1 -1
- package/build/dist/api/modules/uniswap/v4.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/upoch/copy.d.ts +5 -0
- package/build/dist/api/modules/upoch/copy.js +1 -0
- package/build/dist/api/modules/upoch/index.d.ts +8 -0
- package/build/dist/api/modules/upoch/index.js +1 -0
- package/build/dist/api/modules/upoch/pins.d.ts +8 -0
- package/build/dist/api/modules/upoch/pins.js +1 -0
- package/build/dist/api/modules/upoch/reads.d.ts +509 -0
- package/build/dist/api/modules/upoch/reads.js +1 -0
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
- package/build/dist/api/modules/wormhole/x402-client.js +1 -1
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.d.ts +5 -0
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/pricing.js +1 -1
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/secret-fields.d.ts +2 -0
- package/build/dist/api/secret-fields.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/signing.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.d.ts +1 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.d.ts +1 -0
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/universal-router.d.ts +45 -0
- package/build/dist/api/universal-router.js +1 -0
- package/build/dist/api/usd-estimate.js +1 -1
- package/build/dist/chunks/{ZOMFHTB2.js → 22TU5PFT.js} +1 -1
- package/build/dist/chunks/23HNDJ76.js +2 -0
- package/build/dist/chunks/{ZFU65MB4.js → 257N7343.js} +1 -1
- package/build/dist/chunks/{F3VDVTMS.js → 27PVS6BU.js} +1 -1
- package/build/dist/chunks/{N245WC5R.js → 2JWAFLJU.js} +1 -1
- package/build/dist/chunks/{GQYV4TFO.js → 2OVJ2BTJ.js} +1 -1
- package/build/dist/chunks/{JS53DQVT.js → 35LXCSHY.js} +1 -1
- package/build/dist/chunks/{V37L4DU4.js → 3A2IKFTV.js} +1 -1
- package/build/dist/chunks/{OYPAVXGQ.js → 3BMM3V4P.js} +1 -1
- package/build/dist/chunks/{ZKZUS3QU.js → 3FU6XP6S.js} +1 -1
- package/build/dist/chunks/{BB765L75.js → 3PHJUFU2.js} +1 -1
- package/build/dist/chunks/{FWIFTPSE.js → 3PU2SD3U.js} +1 -1
- package/build/dist/chunks/{SBY4RJ7I.js → 3ZH5SOC2.js} +1 -1
- package/build/dist/chunks/43BG2JRB.js +1 -0
- package/build/dist/chunks/{YTLH4M4Y.js → 47HSRR7G.js} +1 -1
- package/build/dist/chunks/4NBXBKOX.js +2 -0
- package/build/dist/chunks/{EZZM2GQT.js → 4NDIYRH5.js} +1 -1
- package/build/dist/chunks/{FOKEFXGP.js → 4PLLS6CT.js} +1 -1
- package/build/dist/chunks/4RCYYN6O.js +1 -0
- package/build/dist/chunks/{XHYFISVV.js → 4Z3IGMU6.js} +1 -1
- package/build/dist/chunks/4ZD5D2UP.js +1 -0
- package/build/dist/chunks/{CSDN4MYP.js → 5GQJVKVY.js} +1 -1
- package/build/dist/chunks/{QFSBDPLN.js → 65OITTDL.js} +1 -1
- package/build/dist/chunks/{4FPV4CRC.js → 6D3XNCOX.js} +1 -1
- package/build/dist/chunks/{DSTMEY5F.js → 6F527FLN.js} +1 -1
- package/build/dist/chunks/{O3JWCJIF.js → 6GWXPQZ6.js} +1 -1
- package/build/dist/chunks/{32RXFUOH.js → 73BZPPRS.js} +1 -1
- package/build/dist/chunks/75SULXNT.js +1 -0
- package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
- package/build/dist/chunks/{SKEKXEUU.js → 7FIEBJOZ.js} +1 -1
- package/build/dist/chunks/{4GNUXN4K.js → 7FZXSYFD.js} +1 -1
- package/build/dist/chunks/{ZP36DSOD.js → 7TSIF3F4.js} +1 -1
- package/build/dist/chunks/{AMTRDPVO.js → 7U62MMUQ.js} +1 -1
- package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
- package/build/dist/chunks/A3BJSQ23.js +1 -0
- package/build/dist/chunks/{YSMWCKIX.js → ADIPEGNN.js} +1 -1
- package/build/dist/chunks/AG2G7BHH.js +6 -0
- package/build/dist/chunks/AIYNFIG6.js +1 -0
- package/build/dist/chunks/ANIF3JMV.js +4 -0
- package/build/dist/chunks/{4JTTA3BX.js → AWV24X7F.js} +1 -1
- package/build/dist/chunks/{7QKYDNF6.js → AXHFNE6L.js} +1 -1
- package/build/dist/chunks/{WOGWLFAL.js → BGVC5NI6.js} +1 -1
- package/build/dist/chunks/BJK75C7G.js +1 -0
- package/build/dist/chunks/BSX4LFYI.js +1 -0
- package/build/dist/chunks/{OYJFXEDU.js → BZPFPQ2I.js} +1 -1
- package/build/dist/chunks/{5PI57UC2.js → C76D54YG.js} +1 -1
- package/build/dist/chunks/{TDZTC5WR.js → DBOGRUPS.js} +1 -1
- package/build/dist/chunks/{HHO5ISMM.js → DCGNVMKG.js} +1 -1
- package/build/dist/chunks/{Y77EVVT4.js → DGDMRATN.js} +1 -1
- package/build/dist/chunks/{EGZREEG2.js → DLNA5272.js} +1 -1
- package/build/dist/chunks/{TM7Z5SA4.js → DMDOSHV7.js} +1 -1
- package/build/dist/chunks/{WHVZ372B.js → DRLBTB4E.js} +1 -1
- package/build/dist/chunks/DXAPKN7H.js +1 -0
- package/build/dist/chunks/{FZ6IJZZM.js → E76Z2TT4.js} +1 -1
- package/build/dist/chunks/{67BWOVET.js → EHGH646D.js} +1 -1
- package/build/dist/chunks/{KKPMOAVI.js → ELHRXA5U.js} +1 -1
- package/build/dist/chunks/{PZEF5LBL.js → ETMD747Y.js} +1 -1
- package/build/dist/chunks/{XCKTE4ON.js → F7MGYRPU.js} +1 -1
- package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
- package/build/dist/chunks/FXOFR432.js +1 -0
- package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
- package/build/dist/chunks/{JWR5XVP2.js → GBIBRYOV.js} +1 -1
- package/build/dist/chunks/{FNGIJKMZ.js → GDOHHXNH.js} +1 -1
- package/build/dist/chunks/{BZ34ZR65.js → GGMVT5A6.js} +1 -1
- package/build/dist/chunks/GK3D7OKG.js +1 -0
- package/build/dist/chunks/{2OKYXT25.js → GQITAJVF.js} +1 -1
- package/build/dist/chunks/GYPMUYB5.js +1 -0
- package/build/dist/chunks/H3E7UD2X.js +1 -0
- package/build/dist/chunks/{GDRQ2ANN.js → H64QC4QR.js} +1 -1
- package/build/dist/chunks/HFVXNKA5.js +1 -0
- package/build/dist/chunks/HHYE42JG.js +21 -0
- package/build/dist/chunks/{U363GQTF.js → HIG7JY3J.js} +1 -1
- package/build/dist/chunks/{XWKK75TO.js → HOBIXKGO.js} +1 -1
- package/build/dist/chunks/HQIS3QI7.js +3 -0
- package/build/dist/chunks/{UOCRYXAB.js → HRAHGYNK.js} +1 -1
- package/build/dist/chunks/{GLF7WEY2.js → HUKDISRE.js} +1 -1
- package/build/dist/chunks/{GSFHM5L3.js → HZSYMGJ2.js} +1 -1
- package/build/dist/chunks/{FJLJ7ZQ5.js → I4473OC6.js} +1 -1
- package/build/dist/chunks/IBL6TL2Q.js +1 -0
- package/build/dist/chunks/{3DNJTJ2X.js → IJ4HZIDG.js} +1 -1
- package/build/dist/chunks/{OARVU3RC.js → IPU656WB.js} +1 -1
- package/build/dist/chunks/{HCBX4NFM.js → IT2JLILU.js} +1 -1
- package/build/dist/chunks/{REWXG6X6.js → JDSSYT6R.js} +1 -1
- package/build/dist/chunks/{XRDXFHIK.js → JFWJBZ7M.js} +1 -1
- package/build/dist/chunks/{TPEKCXVE.js → JTPHZCO3.js} +1 -1
- package/build/dist/chunks/{CSOO4SW7.js → K4GUZ5QS.js} +1 -1
- package/build/dist/chunks/{BAIY32AV.js → KLEJ3W4T.js} +1 -1
- package/build/dist/chunks/{ACH4BSME.js → KOKLM63Q.js} +1 -1
- package/build/dist/chunks/{7D73A6KS.js → KVVBT43U.js} +1 -1
- package/build/dist/chunks/{CO4GCF4L.js → KXX7ZBFY.js} +1 -1
- package/build/dist/chunks/{I6PQW2JI.js → L2AE32SL.js} +1 -1
- package/build/dist/chunks/{WUT7TZYM.js → LCH6F5HT.js} +1 -1
- package/build/dist/chunks/LEV5SNNC.js +3 -0
- package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
- package/build/dist/chunks/{6UVGQYZ3.js → LGLWEGPY.js} +1 -1
- package/build/dist/chunks/{PV4AK32X.js → LQSPWRHN.js} +1 -1
- package/build/dist/chunks/{C3WBHFLX.js → LTDF2LNP.js} +1 -1
- package/build/dist/chunks/{5HIHUYA4.js → M4AGEGWW.js} +1 -1
- package/build/dist/chunks/{ARI72OYT.js → M6SQPOOL.js} +1 -1
- package/build/dist/chunks/{SOTYQGPT.js → M7CQPTRK.js} +1 -1
- package/build/dist/chunks/{XPEDQBLI.js → MGVX5EUH.js} +1 -1
- package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
- package/build/dist/chunks/{APHNOGNS.js → MQ37QX6U.js} +1 -1
- package/build/dist/chunks/MQ5F2VOK.js +1 -0
- package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
- package/build/dist/chunks/{JKRBGAX2.js → NAO7VWZF.js} +1 -1
- package/build/dist/chunks/{RLMVA575.js → NDSNE6PS.js} +1 -1
- package/build/dist/chunks/{RT7IU6TI.js → NMJVQX5M.js} +1 -1
- package/build/dist/chunks/NQ4MTIU3.js +1 -0
- package/build/dist/chunks/{IEG6GLFR.js → NTUXDIY6.js} +1 -1
- package/build/dist/chunks/{F4UQEPJT.js → NUERUFH7.js} +1 -1
- package/build/dist/chunks/NV6FDIYT.js +1 -0
- package/build/dist/chunks/O2J5I4VA.js +1 -0
- package/build/dist/chunks/{XVJ7ILKK.js → O3CC5SRM.js} +1 -1
- package/build/dist/chunks/{2SUHQWND.js → O4S6XAYV.js} +1 -1
- package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
- package/build/dist/chunks/{NA424YAL.js → OB7BFDOV.js} +1 -1
- package/build/dist/chunks/{523ZIR3J.js → ODV3XT5U.js} +1 -1
- package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
- package/build/dist/chunks/{FL5SSHUL.js → OIQTZOBN.js} +1 -1
- package/build/dist/chunks/OLDQV43V.js +1 -0
- package/build/dist/chunks/OOPMZIG7.js +1 -0
- package/build/dist/chunks/{XYPGLG6A.js → OSMOBKRQ.js} +1 -1
- package/build/dist/chunks/{OZ5MDUD2.js → OVM4QIET.js} +1 -1
- package/build/dist/chunks/{N4XNNXOJ.js → OY5W7ZSL.js} +1 -1
- package/build/dist/chunks/{GRSXWQWD.js → PDGYM2WG.js} +1 -1
- package/build/dist/chunks/{UQEEF5W5.js → PDPTJMTJ.js} +1 -1
- package/build/dist/chunks/PEHXHQVA.js +1 -0
- package/build/dist/chunks/{JOKL5L6X.js → PKYQ3XVA.js} +1 -1
- package/build/dist/chunks/PMFR47H3.js +1 -0
- package/build/dist/chunks/{N6GIC7HJ.js → PWJVC2FV.js} +1 -1
- package/build/dist/chunks/{753HZZTY.js → QBYV7NXH.js} +1 -1
- package/build/dist/chunks/QHV5GORV.js +1 -0
- package/build/dist/chunks/{2LWBN35N.js → QIB6OMQV.js} +1 -1
- package/build/dist/chunks/{TK55VASJ.js → QMNUB2GM.js} +1 -1
- package/build/dist/chunks/{HKVQ646Q.js → QN45T4N3.js} +1 -1
- package/build/dist/chunks/{J73ATSEQ.js → QPY6UTLU.js} +1 -1
- package/build/dist/chunks/{YUHNPUNK.js → R73R4KN3.js} +1 -1
- package/build/dist/chunks/{RLI4JDOL.js → RA7DOR7F.js} +1 -1
- package/build/dist/chunks/{VR344DAZ.js → RN3WUJIO.js} +1 -1
- package/build/dist/chunks/RUSXMQSJ.js +1 -0
- package/build/dist/chunks/{D742AYEV.js → RUTSEGGD.js} +1 -1
- package/build/dist/chunks/{4Q2ZBZXM.js → RXP7ZUPY.js} +1 -1
- package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
- package/build/dist/chunks/{DYYEA5HB.js → SMKO7GKX.js} +1 -1
- package/build/dist/chunks/{C75MT5SD.js → SNCV6HV7.js} +1 -1
- package/build/dist/chunks/{HIX5N25Z.js → SOJHYMD7.js} +1 -1
- package/build/dist/chunks/{JLRHM2DQ.js → SUNTJ6IU.js} +1 -1
- package/build/dist/chunks/{4JRXEN7C.js → THL4TMQW.js} +2 -2
- package/build/dist/chunks/TI727O2H.js +1 -0
- package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
- package/build/dist/chunks/{Q2ACLVWR.js → UBI3HBXD.js} +1 -1
- package/build/dist/chunks/{YMV5TL5C.js → UEHN2IDF.js} +1 -1
- package/build/dist/chunks/{ZF2VPDRQ.js → UHIJMDD2.js} +1 -1
- package/build/dist/chunks/UJQYOTO5.js +1 -0
- package/build/dist/chunks/{VTPT5544.js → USEF3QKG.js} +1 -1
- package/build/dist/chunks/{LR4XTZ37.js → UYULQHZJ.js} +1 -1
- package/build/dist/chunks/{YWZQJJYY.js → V4UJMUIB.js} +1 -1
- package/build/dist/chunks/{7VC53B5X.js → V5YSJKRH.js} +13 -13
- package/build/dist/chunks/{INOYMBWE.js → VC5ZCQYZ.js} +1 -1
- package/build/dist/chunks/{M7ZXDLKM.js → VDJPDIBV.js} +1 -1
- package/build/dist/chunks/{2FHELZ7Y.js → VFM2BICB.js} +1 -1
- package/build/dist/chunks/{TE6D3OIX.js → VOJULRNU.js} +1 -1
- package/build/dist/chunks/{UEDGYZOC.js → VVAM3EAK.js} +1 -1
- package/build/dist/chunks/VVJO6OYK.js +1 -0
- package/build/dist/chunks/{JESMX2UC.js → VXCGMALF.js} +1 -1
- package/build/dist/chunks/{NUFZUKYS.js → W32UECOL.js} +1 -1
- package/build/dist/chunks/{UUID2E22.js → W3DGFMQE.js} +1 -1
- package/build/dist/chunks/W7OCS4AM.js +6 -0
- package/build/dist/chunks/{DNNFKDZR.js → W7QNSNOH.js} +1 -1
- package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
- package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
- package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
- package/build/dist/chunks/{L646YWDP.js → X24YTJST.js} +1 -1
- package/build/dist/chunks/{FOD34G2H.js → XL3W7DAQ.js} +1 -1
- package/build/dist/chunks/{2E4I7CJ7.js → XRDLMTBJ.js} +1 -1
- package/build/dist/chunks/{GG24LO2R.js → XVOW6UCI.js} +1 -1
- package/build/dist/chunks/XW3VGWXK.js +1 -0
- package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
- package/build/dist/chunks/Y64GFBTA.js +1 -0
- package/build/dist/chunks/Y7HBFQYG.js +1 -0
- package/build/dist/chunks/{ARLGF5MU.js → YGW4ODAP.js} +1 -1
- package/build/dist/chunks/YRSAZTTC.js +7 -0
- package/build/dist/chunks/YW4W3LPQ.js +1 -0
- package/build/dist/chunks/{3VBIRLU3.js → YXXK6EPI.js} +1 -1
- package/build/dist/chunks/{EH5G4O3U.js → Z2QV6EZY.js} +1 -1
- package/build/dist/chunks/Z3IBPCY4.js +2 -0
- package/build/dist/chunks/{H5DY7CNB.js → Z7FGEWO2.js} +1 -1
- package/build/dist/chunks/{KDGSYNOP.js → ZDCCFEVL.js} +1 -1
- package/build/dist/chunks/{4RQAOOO2.js → ZOLHVZDK.js} +1 -1
- package/build/dist/chunks/{AI3VAPA3.js → ZSVAGOF2.js} +1 -1
- package/build/dist/chunks/{EVBHQQQG.js → ZTKT3ZQK.js} +1 -1
- package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/3K2N5VFH.js +0 -1
- package/build/dist/chunks/3ZABD6ZF.js +0 -2
- package/build/dist/chunks/44MB6SA6.js +0 -1
- package/build/dist/chunks/4D4ZRZUW.js +0 -1
- package/build/dist/chunks/4OVIMYNH.js +0 -2
- package/build/dist/chunks/6NUNCD5J.js +0 -1
- package/build/dist/chunks/6PZGDVHV.js +0 -1
- package/build/dist/chunks/7MBVTNLU.js +0 -1
- package/build/dist/chunks/7VNO46LV.js +0 -1
- package/build/dist/chunks/CAWTAR5V.js +0 -1
- package/build/dist/chunks/DPE7SPW7.js +0 -1
- package/build/dist/chunks/E3RACZUY.js +0 -1
- package/build/dist/chunks/EI6GGPDS.js +0 -20
- package/build/dist/chunks/FV4WZOTD.js +0 -1
- package/build/dist/chunks/FWD4L3CJ.js +0 -1
- package/build/dist/chunks/JBTOZ6IH.js +0 -1
- package/build/dist/chunks/KREBNL2D.js +0 -1
- package/build/dist/chunks/MVD3KWPP.js +0 -1
- package/build/dist/chunks/P6OMKZMR.js +0 -3
- package/build/dist/chunks/PXVREXCS.js +0 -1
- package/build/dist/chunks/QJNLLI6N.js +0 -1
- package/build/dist/chunks/RPB46QAC.js +0 -1
- package/build/dist/chunks/TID4C2KC.js +0 -1
- package/build/dist/chunks/U2YCQWZK.js +0 -1
- package/build/dist/chunks/UWBKAWX3.js +0 -7
- package/build/dist/chunks/V6SDKPZS.js +0 -1
- package/build/dist/chunks/WHTRPRRD.js +0 -1
- package/build/dist/chunks/WLMWWEP7.js +0 -2
- package/build/dist/chunks/XQ24RSEI.js +0 -1
- package/build/dist/chunks/YDNTY67T.js +0 -1
- package/build/dist/chunks/ZQAFFWDK.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,d as T,e as p}from"./
|
|
1
|
+
import{a as d,d as T,e as p}from"./VXCGMALF.js";import{a as g}from"./66F5ZH34.js";import{b as r}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as k,erc20Abi as v,getAddress as m,parseAbi as I}from"viem";var e={router:m("0x888888888889758F76e7103c6CbF23ABbF58F946"),oracle:m("0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2"),market:m("0xc2b89e6eca583e2c232201ac557e9be58af55f4c"),pt:m("0x6982e39521A070a3C40782548bfBED6Dc8F566ef"),yt:m("0xF35Ee6bd9A93fE42BC7e628BFC4DDbdc6DE1f615"),expiry:1805932800n},$="(uint8 swapType,address extRouter,bytes extCalldata,bool needScale)",C="(uint256 salt,uint256 expiry,uint256 nonce,uint8 orderType,address token,address YT,address maker,address receiver,uint256 makingAmount,uint256 lnImpliedRate,uint256 failSafeRate,bytes permit)",w=`(${C} order,bytes signature,uint256 makingAmount)`,D=`(address limitRouter,uint256 epsSkipMarket,${w}[] normalFills,${w}[] flashFills,bytes optData)`,M=`(address tokenIn,uint256 netTokenIn,address tokenMintSy,address pendleSwap,${$} swapData)`,O=`(address tokenOut,uint256 minTokenOut,address tokenRedeemSy,address pendleSwap,${$} swapData)`,U="(uint256 guessMin,uint256 guessMax,uint256 guessOffchain,uint256 maxIteration,uint256 eps)",b=I([`function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,${U} guessPtOut,${M} input,${D} limit) payable returns (uint256 netPtOut,uint256 netSyFee,uint256 netSyInterm)`,`function swapExactPtForToken(address receiver,address market,uint256 exactPtIn,${O} output,${D} limit) returns (uint256 netTokenOut,uint256 netSyFee,uint256 netSyInterm)`,`function redeemPyToToken(address receiver,address YT,uint256 netPyIn,${O} output) returns (uint256 netTokenOut,uint256 netSyInterm)`]),_=I(["function getPtToAssetRate(address market,uint32 duration) view returns (uint256)"]),F={address:e.pt,symbol:"PT-USDG",decimals:6,chainId:r},l="0x0000000000000000000000000000000000000000",h={swapType:0,extRouter:l,extCalldata:"0x",needScale:!1},A={limitRouter:l,epsSkipMarket:0n,normalFills:[],flashFills:[],optData:"0x"},G={guessMin:0n,guessMax:(1n<<256n)-1n,guessOffchain:0n,maxIteration:256n,eps:10n**14n},f=g('Exact USDG or PT-USDG amount in base units (both 6 decimals). Example: "1000000" = 1 USDG.');function Y(i){let y=async()=>{if(i.network==="testnet")throw new u("Priors PT is configured only on chain 4663.");return i.clientFor(r).getBlock()};return{tools:[{name:"priors_pt_quote",inputSchema:{type:"object",properties:{side:{type:"string",enum:["buy","sell"],description:'Choose "buy": USDG in for PT-USDG; "sell": PT-USDG in for USDG.'},amount:f},required:["side","amount"],additionalProperties:!1},async execute(n){let o=await y();if(o.timestamp>=e.expiry)throw new u("This PT market matured; use redemption.");let t=p(n.amount,"amount");if(t===0n||!["buy","sell"].includes(String(n.side)))throw new u("Provide buy or sell and a positive base-unit amount.");let a=await i.clientFor(r).readContract({address:e.oracle,abi:_,functionName:"getPtToAssetRate",args:[e.market,0]});if(a===0n)throw new u("PT oracle returned a zero rate.");return{chainId:r,token:F,market:e.market,blockNumber:o.number?.toString(),amountIn:t.toString(),estimatedOutput:(n.side==="buy"?t*10n**18n/a:t*a/10n**18n).toString(),rateE18:a.toString(),caveat:"Oracle spot estimate excludes own price impact and execution fees. Specify minOut explicitly and inspect the actual swap preview."}}},{name:"priors_pt_position",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(n,o){let t=await y(),a=await i.clientFor(r).readContract({address:e.pt,abi:v,functionName:"balanceOf",args:[m(o)]});return{token:F,balance:a.toString(),market:e.market,expiry:e.expiry.toString(),matured:t.timestamp>=e.expiry}}},...["buy","sell","redeem"].map(n=>({name:`priors_pt_${n}`,inputSchema:{type:"object",properties:{amount:f,minOut:f},required:["amount","minOut"],additionalProperties:!1},async execute(o,t){t=m(t);let a=await y(),S=a.timestamp>=e.expiry;if(n==="redeem"!==S)throw new u(S?"Market matured; redeem PT instead.":"PT redemption opens at maturity.");let s=p(o.amount,"amount"),c=p(o.minOut,"minOut");if(s===0n||c===0n)throw new u("amount and minOut must be positive base units.");let x={tokenOut:d.usdg,minTokenOut:c,tokenRedeemSy:d.usdg,pendleSwap:l,swapData:h},R=n==="buy"?k({abi:b,functionName:"swapExactTokenForPt",args:[t,e.market,c,G,{tokenIn:d.usdg,netTokenIn:s,tokenMintSy:d.usdg,pendleSwap:l,swapData:h},A]}):n==="sell"?k({abi:b,functionName:"swapExactPtForToken",args:[t,e.market,s,x,A]}):k({abi:b,functionName:"redeemPyToToken",args:[t,e.yt,s,x]}),P=[i.approval(n==="buy"?d.usdg:e.pt,e.router,s.toString(),r),i.unsignedTx({to:e.router,data:R,value:"0",chainId:r,description:`${n} PT-USDG, exact input ${s}, minimum output ${c} (6 decimals).`})],E=await i.preview(P,t);return{txs:P,summary:`Pendle PT ${n}: ${s} base units, minimum ${c}, receiver ${t}. No external aggregator. ${E.summary}`,terms:T({expiry:e.expiry,market:e.market})}}}))]}}export{e as a,b,Y as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u,f as I,g}from"./6JCEJ66K.js";import{a as P}from"./43LI5NKJ.js";import{m as B}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{a as u,f as I,g}from"./6JCEJ66K.js";import{a as P}from"./43LI5NKJ.js";import{m as B}from"./NWNYJ26T.js";import{b as e,j as _}from"./TI727O2H.js";import{a as m}from"./XSD5NL7J.js";import{erc20Abi as C,getAddress as l}from"viem";var b=l(u.staking),f=l(u.agentVault),p=l(u.orbio),w={address:l(_[e].orbio.credit.address),chainId:e,symbol:"CREDIT",decimals:6},D=g.find(o=>o.type==="event"&&o.name==="AgentLaunched"),$=10000000n,A=o=>B(o,"Orbio returned an invalid on-chain amount.");async function F(o,N){try{P(N);let i=l(N),n=o.clientFor(e);if(await n.getChainId()!==e)throw new m(`Orbio requires chain ${e}.`);let a=await n.getBlockNumber(),[s,v,E,S,T]=await Promise.all([n.readContract({address:p,abi:C,functionName:"decimals",blockNumber:a}),n.readContract({address:b,abi:I,functionName:"positionOf",args:[i],blockNumber:a}),n.readContract({address:b,abi:I,functionName:"settledOf",args:[i],blockNumber:a}),n.readContract({address:p,abi:C,functionName:"balanceOf",args:[i],blockNumber:a}),n.readContract({address:w.address,abi:C,functionName:"balanceOf",args:[i],blockNumber:a})]);if(typeof s!="number"||!Number.isInteger(s)||s<0||s>36)throw new m("Orbio returned invalid ORBIO decimals.");let h={address:p,chainId:e,symbol:"ORBIO",decimals:s},R=[],d=(t,r,c,k)=>{let O=A(c);O!==0n&&R.push({module:"orbio",id:`${e}:${t}`,chainId:e,assets:[{token:{...r},amount:O.toString()}],description:`${k}: ${O} ${r.symbol} base units (${r.decimals} decimals).`})};d(`${b}:principal`,h,v,"Staked ORBIO principal; withdraw with orbio_unstake"),d(`${b}:credit`,w,E,"Claim settled staking CREDIT with orbio_claim_staking"),d(`${p}:held`,h,S,"Held ORBIO in this wallet"),d(`${w.address}:held`,w,T,"Held unactivated CREDIT in this wallet");let y=new Set;for(let t=0n;t<=a;t+=$){let r=t+$-1n<a?t+$-1n:a,c=await n.getLogs({address:f,event:D,args:{owner:i},fromBlock:t,toBlock:r,strict:!0});for(let k of c)y.add(A(k.args.agentId))}for(let t of y){let[r,c]=await Promise.all([n.readContract({address:f,abi:g,functionName:"stakeOf",args:[t],blockNumber:a}),n.readContract({address:f,abi:g,functionName:"unlocksAt",args:[t],blockNumber:a})]);d(`${f}:agent:${t}`,h,r,`ORBIO principal staked for owned agent ${t}; principal unlock time ${A(c)} (Unix seconds); withdraw with orbio_agent_withdraw_principal`)}return R}catch(i){throw new m(o.plainError(i))}}export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as p}from"./
|
|
1
|
+
import{q as p}from"./3A2IKFTV.js";import{b as c,e as d}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{b as a}from"./JXOEJPJ4.js";var f=/^(?:[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?\.)+[\p{L}]{2,}$/u,m=/^did:[a-z0-9]+:[A-Za-z0-9._%:;=@/?#-]{1,512}$/,u=/^[^\s@<>()[\]\\,;:"]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?\.[A-Za-z]{2,}$/,w=/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}:[-.%a-zA-Z0-9]{1,128}$/,l=["web","a2a","mcp","oasf"],P=["web","A2A","MCP","OASF","ENS","DID","email","agentWallet"];function s(e,r){if(typeof e!="string"||!e.trim()||e.length>2048||a(e))throw new n(`Provide a valid profile ${r}.`);return e}function h(e){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)}function z(e){if(!d(e))throw new n("Provide valid profile services.");let r=s(e.name,"service name"),t=s(e.endpoint,"service endpoint");e.version!==void 0&&s(e.version,"service version");let i=r.toLowerCase(),o=()=>{try{p(t,"Profile service endpoint")}catch{throw new n("Profile service endpoint must be an HTTPS or IPFS URI without credentials.")}};if(l.includes(i))return o();if(i==="ens"){if(!f.test(t))throw new n("An ENS service endpoint must be an ENS name such as agent.eth.");return}if(i==="did"){if(!m.test(t))throw new n("A DID service endpoint must be a DID such as did:web:agent.example.");return}if(i==="email"){if(!u.test(t))throw new n("An email service endpoint must be an email address.");return}if(i==="agentwallet"||i==="wallet"){if(!w.test(t)&&!c.test(t))throw new n("A wallet service endpoint must be a CAIP-10 account such as eip155:4663:0x\u2026 or an 0x address.");return}if(h(t)||/^(?:ipfs|https):/.test(t))return o();if(!(f.test(t)||m.test(t)||u.test(t)||w.test(t)))throw new n("Profile service endpoint must be an HTTPS or IPFS URI, an ENS name, a DID, an email address or a CAIP-10 account.")}export{P as a,z as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as F,e as P,f as T,g as I}from"./
|
|
1
|
+
import{a as c,b as F,e as P,f as T,g as I}from"./QPY6UTLU.js";import{a as l}from"./66F5ZH34.js";import{c as N,g,h as S}from"./NWNYJ26T.js";import{b as h}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as w,getAddress as _,parseAbi as Q,parseAbiItem as j,zeroAddress as H}from"viem";var x=_("0x000000001f26a0044baa66024e7b6599c61963f8"),M=j("event AuctionCreated(address indexed auction,address indexed token,uint256 amount,bytes configData)"),o=Q(["function currency() view returns (address)","function token() view returns (address)","function startBlock() view returns (uint64)","function endBlock() view returns (uint64)","function claimBlock() view returns (uint64)","function validationHook() view returns (address)","function clearingPrice() view returns (uint256)","function isGraduated() view returns (bool)","function bids(uint256) view returns ((uint64 startBlock,uint24 startCumulativeMps,uint64 exitedBlock,uint256 maxPrice,address owner,uint256 amountQ96,uint256 tokensFilled))","function submitBid(uint256 maxPrice,uint128 amount,address owner,uint256 prevTickPrice,bytes hookData) payable returns (uint256)","function exitBid(uint256)","function exitPartiallyFilledBid(uint256,uint64,uint64)","function claimTokens(uint256)","function claimTokensBatch(address,uint256[])","function checkpoint()","function sweepCurrency()","function sweepUnsoldTokens()"]);async function D(s,y){let n=F(y.auction),t=c(y.creationBlock,"creationBlock",64,!0),e=await s.getLogs({address:x,event:M,args:{auction:n},fromBlock:t,toBlock:t,strict:!0});if(e.length!==1||!g(e[0].address,x)||!S(e[0].args.auction,n))throw new u("Auction has no matching AuctionCreated event at the pinned CCA factory and creationBlock.");return n}async function E(s,y){let n=s.clientFor(h),t=await D(n,y),e=await n.getBlockNumber(),[a,b,i,k,m,v,d,B]=await Promise.all([n.readContract({address:t,abi:o,functionName:"currency",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"token",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"startBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"endBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"claimBlock",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"validationHook",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"clearingPrice",blockNumber:e}),n.readContract({address:t,abi:o,functionName:"isGraduated",blockNumber:e})]);return{auction:t,currency:a,saleToken:b,startBlock:i,endBlock:k,claimBlock:m,validationHook:v,clearingPrice:d,graduated:B,blockNumber:e}}var L={auction:{...N,description:"Address of the continuous clearing auction to verify against the pinned factory."},creationBlock:l("Auction creation block number, as a decimal string, used to verify the factory event."),bidId:l('Identifier of the auction bid, as a decimal string. Example: "1".'),amount:l('Amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),maxPrice:l("Maximum bid price in Q96 payment-currency base units per sale-token base unit."),prevTickPrice:l("Previous auction price tick in Q96 payment-currency base units per sale-token base unit; zero for the first tick."),lastFullyFilledCheckpointBlock:l("Last fully filled checkpoint block number for a partial bid exit, as a decimal string."),outbidBlock:l("Block number at which the bid was outbid, as a decimal string."),mode:{description:'Choose "full" to exit a bid, or "partial" to exit using checkpoint and outbid block hints.',type:"string",enum:["full","partial"]},bidIds:{description:'One to fifty unique auction bid identifiers as decimal strings. Example: ["1", "2"].',type:"array",minItems:1,maxItems:50,items:l()}};function R(s){let n=["status","bid","exit","claim","checkpoint","sweep_currency","sweep_tokens"].map(t=>({name:`uniswap_auction_${t}`,inputSchema:{type:"object",additionalProperties:!1,required:["auction","creationBlock",...t==="bid"?["amount","maxPrice","prevTickPrice"]:t==="exit"?["bidId","mode"]:[]],properties:L},async execute(e,a){I(e,["auction","creationBlock",...t==="bid"?["amount","maxPrice","prevTickPrice"]:t==="exit"?["bidId","mode","lastFullyFilledCheckpointBlock","outbidBlock"]:t==="claim"?["bidId","bidIds"]:t==="status"?["bidId"]:[]]);let i=await E(s,e),k=s.clientFor(h),[m,v]=await Promise.all([P(s,i.currency,i.blockNumber),P(s,i.saleToken,i.blockNumber)]),d=e.bidId===void 0?void 0:await k.readContract({address:i.auction,abi:o,functionName:"bids",args:[c(e.bidId,"bidId",256,!0)],blockNumber:i.blockNumber});if(t==="status")return{auction:i.auction,paymentToken:m,saleToken:v,startBlock:i.startBlock.toString(),endBlock:i.endBlock.toString(),claimBlock:i.claimBlock.toString(),validationHook:i.validationHook,clearingPrice:i.clearingPrice.toString(),graduated:i.graduated,...d?{bid:{...d,startBlock:d.startBlock.toString(),exitedBlock:d.exitedBlock.toString(),maxPrice:d.maxPrice.toString(),amountQ96:d.amountQ96.toString(),tokensFilled:d.tokensFilled.toString()}}:{},summary:"CCA prices use currency-base-units per sale-token-base-unit in Q96. Clearing price/graduation reflect the latest checkpoint and may lag the head."};let B=[],f,A=0n;if(t==="bid"){if(i.validationHook!==H)throw new u("This auction has a validation hook. Its validation/signing contract is not configured; do not pass an off-chain signature manually.");if(i.blockNumber<i.startBlock||i.blockNumber>=i.endBlock)throw new u("Auction is not in its bidding window.");let r=c(e.amount,"amount",128),p=c(e.maxPrice,"maxPrice"),C=c(e.prevTickPrice,"prevTickPrice",256,!0);if(p<=i.clearingPrice)throw new u("Bid maxPrice must be above the checkpoint clearing price.");i.currency===H?A=r:B.push(s.approval(i.currency,i.auction,r.toString(),h)),f=w({abi:o,functionName:"submitBid",args:[p,r,a,C,"0x"]})}else if(t==="exit"){if(!d||!g(d.owner,a))throw new u("Only exit a bid owned by the signing wallet.");let r=c(e.bidId,"bidId",256,!0);if(e.mode==="full"){if(e.lastFullyFilledCheckpointBlock!==void 0||e.outbidBlock!==void 0)throw new u("Full exit takes no checkpoint hints.");f=w({abi:o,functionName:"exitBid",args:[r]})}else if(e.mode==="partial")f=w({abi:o,functionName:"exitPartiallyFilledBid",args:[r,c(e.lastFullyFilledCheckpointBlock,"lastFullyFilledCheckpointBlock",64,!0),c(e.outbidBlock,"outbidBlock",64,!0)]});else throw new u("Choose full or partial exit explicitly; partial exits require checkpoint hints.")}else if(t==="claim"){if(e.bidId===void 0==(e.bidIds===void 0))throw new u("Provide bidId or bidIds, not both.");let r=e.bidIds===void 0?[c(e.bidId,"bidId",256,!0)]:Array.isArray(e.bidIds)?e.bidIds.map(p=>c(p,"bidIds",256,!0)):[];if(r.length<1||r.length>50||new Set(r.map(String)).size!==r.length)throw new u("Provide 1 to 50 unique bid IDs.");for(let p of r){let C=await k.readContract({address:i.auction,abi:o,functionName:"bids",args:[p],blockNumber:i.blockNumber});if(!g(C.owner,a))throw new u("Claimed tokens must belong to the signing wallet.")}f=w({abi:o,functionName:"claimTokensBatch",args:[a,r]})}else f=w({abi:o,functionName:t==="checkpoint"?"checkpoint":t==="sweep_currency"?"sweepCurrency":"sweepUnsoldTokens"});return B.push(s.unsignedTx({to:i.auction,data:f,value:A.toString(),chainId:h,description:`CCA ${t} on factory-verified auction ${i.auction}. Bid owner ${a}.`})),T(s,B,a,`CCA ${t}; checkpoint/exit/claim eligibility and creator-only sweeps are checked by the contract in preview. Sweeps pay the auction's immutable funds/tokens recipient, not an arbitrary recipient.`)}}));return n.push({name:"uniswap_auctions",inputSchema:{type:"object",additionalProperties:!1,properties:{fromBlock:l("First block number of the scan, as a decimal string; inclusive."),toBlock:l("Last block number of the scan, as a decimal string; inclusive.")}},async execute(t){I(t,["fromBlock","toBlock"]);let e=s.clientFor(h),a=await e.getBlockNumber(),b=t.fromBlock===void 0?a>9999n?a-9999n:0n:c(t.fromBlock,"fromBlock",64,!0),i=t.toBlock===void 0?a:c(t.toBlock,"toBlock",64,!0);if(b>i||i>a||i-b>=10000n)throw new u("Scan an ordered range of at most 10000 blocks, ending at or before the head.");let k=await e.getLogs({address:x,event:M,fromBlock:b,toBlock:i,strict:!0});return{factory:x,fromBlock:b.toString(),toBlock:i.toString(),auctions:k.map(m=>({auction:m.args.auction,token:m.args.token,amount:m.args.amount.toString(),creationBlock:m.blockNumber.toString()})),summary:"Factory-verified auctions in this block window only. An empty result does not establish that no auctions exist outside it. Scan earlier windows for older launches."}}}),{tools:n}}export{x as a,M as b,o as c,D as d,E as e,R as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as R,s as g}from"./FWD4L3CJ.js";import{a as w}from"./XSD5NL7J.js";import{isDeepStrictEqual as b}from"node:util";import{isAddress as x}from"viem";var O=2592e3,v=1n<<128n,m=new Set(["order","offer","link","consent"]),y=new Set(["order","offer","consent"]),E=new Set(["order","offer","link"]),I=3600,S=1e11;function l(e){return new w(`Local signing guard: ${e}; nothing was signed.`)}var V=e=>m.has(e.class);function T(e,r){let t=new Map,n=(s,a,o)=>{let u=e[s];if(!u||o>8)throw l("typed-data types changed");for(let c of u){let f=c.type.replace(/(\[[0-9]*\])+$/,""),i=`${a}${c.name}${c.type===f?"":"[]"}`;e[f]?n(f,`${i}.`,o+1):t.set(i,c.type)}};return n(r,"",0),t}function N(e,r){let t=new Set,n=s=>{if(!(t.has(s)||!e[s])){t.add(s);for(let a of e[s])n(a.type.replace(/(\[[0-9]*\])+$/,""))}};return n(r),t}function A(e=[]){let r=new Set(e.map(n=>n.toLowerCase())),t=(n,s)=>{if(!(s>12)){if(typeof n=="string"){x(n,{strict:!1})&&r.add(n.toLowerCase());return}if(n&&typeof n=="object")for(let a of Object.values(n))t(a,s+1)}};return t(R,0),t(g,0),r}function j(e,r=A()){let t=[],n=(i,d)=>t.push(`${i} ${e.id}: ${d}`),s=Object.entries(e.fields),a=i=>s.filter(([,d])=>d.role===i),o=i=>s.filter(([,d])=>d.role==="derived"&&d.yields?.includes(i)).length;["order","cancel","link","offer","consent","auth","relayed"].includes(e.class)||n("R5","unknown signature class; link-accept is a display role only"),e.expiryBinding&&!["signed","program-link","auth-window","cancel-only"].includes(e.expiryBinding)&&n("R5","unknown expiry binding"),(!e.id||!/^[a-z0-9]+(?:[.-][a-z0-9]+)+$/.test(e.id))&&n("ID","id must be dotted lower-case"),(!e.tools.length||new Set(e.tools).size!==e.tools.length)&&n("ID","tools must be a non-empty unique list");let u=e.network==="testnet"?g.testnet.chainId:g.mainnet.chainId;if(e.encoding==="eip712"){let i=e.domain;i?(Object.hasOwn(i,"salt")&&n("R1","domain must not carry a salt"),i.name||n("R1","domain name is missing"),!i.version&&e.class!=="relayed"&&n("R1","domain version is missing"),i.chainId!==u&&n("R1",`domain chain must be ${u}`),i.verifyingContract?r.has(i.verifyingContract.toLowerCase())||n("R1","verifying contract is not a pinned address"):e.class!=="cancel"&&e.class!=="auth"&&n("R1","verifying contract is missing")):n("R1","EIP-712 spec has no domain")}else e.domain&&n("R1","only EIP-712 specs carry a domain");if(e.encoding==="eip191-packed-hash"){let i=a("pinned").map(([,d])=>d.value);i.some(d=>d===u||d===String(u))||n("R1","packed layout must pin the chain id"),i.some(d=>typeof d=="string"&&r.has(d.toLowerCase()))||n("R1","packed layout must pin the verifying contract")}let c=new Map,f=e.class==="relayed"&&!Object.keys(e.types).length;if(e.encoding==="eip712"&&!f){Object.hasOwn(e.types,"EIP712Domain")&&n("R2","types must never carry EIP712Domain");try{c=T(e.types,e.primaryType);let i=N(e.types,e.primaryType);for(let d of Object.keys(e.types))i.has(d)||n("R2",`type ${d} is not reachable from ${e.primaryType}`)}catch{n("R2",`types do not resolve from ${e.primaryType}`)}for(let i of c.keys())Object.hasOwn(e.fields,i)||n("R3",`message path ${i} has no role`);for(let[i]of s)c.has(i)||n("R3",`declared field ${i} is not in the typed struct`)}else e.encoding!=="eip712"&&Object.keys(e.types).length&&n("R2","only EIP-712 specs carry types");for(let[i,d]of s)(!d.meaning||d.meaning.length>160)&&n("R3",`field ${i} needs a plain-English meaning`);(e.class==="order"||e.class==="offer")&&!s.some(([,i])=>i.role==="amount"&&i.side==="out")&&!o("amount-out")&&n("R4",`${e.class} must show the most that can leave`);for(let[i,d]of s){if(d.role==="amount"||d.role==="fee"){let h=d.token;(x(h,{strict:!1})?r.has(h.toLowerCase()):e.fields[h]?.role==="token")||n("R4",`amount ${i} does not name a token field or a pinned token`)}c.get(i)==="bytes"&&d.role!=="pinned"&&d.role!=="derived"&&n("R4",`bytes field ${i} must be pinned or derived`)}if(e.maxLifetimeSeconds>0&&e.maxLifetimeSeconds<=O||n("R5","maxLifetimeSeconds must be within 30 days"),y.has(e.class)){let i=a("expiry").length+o("expiry");i!==1&&n("R5",`${e.class} needs exactly one expiry (found ${i})`),e.expiry&&n("R5","API-only expiry is not a signed expiry"),e.expiryBinding&&e.expiryBinding!=="signed"&&n("R5",`${e.class} requires signed expiry`)}if(e.expiryBinding==="program-link"&&e.class!=="link"&&n("R5","only link can use program-link"),e.class==="link"&&e.expiryBinding!=="program-link"&&a("expiry").length+o("expiry")!==1&&n("R5","link needs signed expiry or program-link binding"),e.expiryBinding==="auth-window"){let i=e.authWindow;(e.class!=="auth"||!i||!c.has(i.field)||!Number.isSafeInteger(i.maxAgeSeconds)||i.maxAgeSeconds<=0||i.maxAgeSeconds>e.maxLifetimeSeconds||!Number.isSafeInteger(i.maxFutureSeconds)||i.maxFutureSeconds<0||i.maxFutureSeconds>e.maxLifetimeSeconds)&&n("R5","auth-window needs a signed timestamp and pinned acceptance window")}else e.authWindow&&n("R5","authWindow requires auth-window binding");return e.expiryBinding==="cancel-only"&&(e.class!=="cancel"||!a("nonce").length&&!o("nonce")&&!e.revoke?.staysExecutableUntilExpiry)&&n("R5","cancel-only needs a single-use nonce or targeted non-revoking hide"),(e.class==="auth"||e.class==="cancel")&&(s.some(([,i])=>i.role==="amount"&&i.side==="out")||o("amount-out"))&&n("R4","auth and cancel cannot grant spending authority"),E.has(e.class)&&!(e.revoke?.onchainTool||e.revoke?.offchainSpec)&&!(e.revoke?.none&&e.maxLifetimeSeconds<=I)&&n("R6",`${e.class} needs a revocation path (only a one-shot approval of at most one hour may declare none)`),e.submit.by==="addon"&&(!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(e.submit.host)||!/^\/[A-Za-z0-9/_.-]*$/.test(e.submit.path))&&n("R9","add-on submission needs a bare HTTPS host and a fixed path"),e.submit.by==="server-continuation"&&!e.submit.reason&&n("R9","server-continuation needs its recorded reason"),e.submit.by==="transaction"&&e.class!=="relayed"&&e.class!=="consent"&&n("R9","only relayed and consent signatures are consumed by a transaction"),(!/^[A-Za-z0-9 .'-]{1,40}$/.test(e.program)||!/^[A-Za-z0-9 .'-]{1,60}$/.test(e.purpose))&&n("R10","program and purpose must be short constant text"),m.has(e.class)&&!e.requireHuman&&!e.humanException&&n("C13",`${e.class} must require a human`),!m.has(e.class)&&e.humanException&&n("C13","only a value class can name a human exception"),e.relayedPaths&&e.class!=="relayed"&&n("ID","only relayed specs accept caller signatures"),e.enabled===!1&&!e.disabledReason&&n("ID","a disabled spec states why"),t}function z(e,r=A()){let t=e.filter(a=>a.enabled!==!1).flatMap(a=>j(a,r)),n=new Set,s=new Set;for(let a of e){n.has(a.id)&&t.push(`ID ${a.id}: duplicate spec id`),n.add(a.id);let o=C(a);s.has(o)&&t.push(`ID ${a.id}: another spec already covers ${o}`),s.add(o)}return t}function C(e){return`${e.network??"mainnet"}:${e.encoding}:${(e.domain?.verifyingContract??"-").toLowerCase()}:${e.primaryType}`}function k(e,r,t,n,s){let a=r.replace(/(\[[0-9]*\])+$/,"");if(a!==r){if(!Array.isArray(t))throw l(`message field ${n||r} is not declared`);for(let i of t)k(e,r.replace(/\[[0-9]*\]$/,""),i,`${n}[]`,s+1);return}let o=e[a];if(!o)return;if(s>8||!t||typeof t!="object"||Array.isArray(t))throw l(`message field ${n||r} is not declared`);let u=Object.keys(t),c=o.map(i=>i.name);if(u.find(i=>!c.includes(i))!==void 0)throw l(`an undeclared message field${n?` under ${n}`:""} is present`);for(let i of o){if(!Object.hasOwn(t,i.name))throw l(`message field ${n?`${n}.`:""}${i.name} is missing`);k(e,i.type,t[i.name],`${n?`${n}.`:""}${i.name}`,s+1)}}function W(e,r){if(e.encoding!=="eip712"||!e.domain)throw l("Oak has no signing contract for this request");if(!r||typeof r!="object"||!r.domain||typeof r.domain!="object")throw l("domain, chain or verifying contract is not the pinned one");let t=Object.fromEntries(Object.entries(e.domain).filter(([,n])=>n!==void 0));if(!b(Object.keys(r.domain).sort(),Object.keys(t).sort())||!b({...r.domain},t))throw l("domain, chain or verifying contract is not the pinned one");if(!r.types||typeof r.types!="object"||Object.hasOwn(r.types,"EIP712Domain")||!b(r.types,e.types)||r.primaryType!==e.primaryType)throw l("typed-data types changed");k(e.types,e.primaryType,r.message,"",0)}function p(e,r){let t=e;for(let n of r.split(".")){if(n.endsWith("[]")||!t||typeof t!="object"||Array.isArray(t))return;t=t[n]}return t}var $=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="bigint"?String(e):void 0;function D(e,r){let t={},n=s=>x(s,{strict:!1})?s:$(p(r,s));for(let[s,a]of Object.entries(e.fields)){let o=$(p(r,s));if(o!==void 0)switch(a.role){case"signer":t.signer=o;break;case"account":t.account=o;break;case"recipient":t.recipient=o;break;case"delegate":t.delegate=o;break;case"counterparty":t.counterparty=o;break;case"token":a.side==="out"?t.tokenOut=o:t.tokenIn=o;break;case"amount":a.side==="out"?(t.amountOut=o,t.tokenOut??=n(a.token)):(t.minAmountIn=o,t.tokenIn??=n(a.token));break;case"fee":(t.fees??=[]).push({token:n(a.token)??a.token,value:o});break;case"expiry":t.expiry=/^[0-9]+$/.test(o)?Number(o):Number.NaN;break;case"nonce":t.nonce=o;break;default:break}}return t}function L(e,r,t){let n=Math.min(e.maxLifetimeSeconds,O),s=y.has(e.class)||e.humanException?60:1;if(!Number.isSafeInteger(t)||t<0||!Number.isFinite(n)||n<=0||r===void 0||!Number.isSafeInteger(r)||r<=0||r>=S||r<t+s||r>t+n)throw l(`expiry is missing, past or beyond ${n>=86400?`${Math.floor(n/86400)} days`:`${Math.ceil(n/60)} minutes`}`)}function U(e,r,t,n){if(e.enabled===!1)throw l("Oak has no signing contract for this request");if(!Number.isSafeInteger(t)||t<0||t>=S)throw l("signing time is unavailable");if(e.expiryBinding==="auth-window"){let o=e.authWindow,u=o&&p(r,o.field),c=typeof u=="number"?u:typeof u=="string"&&/^[0-9]+$/.test(u)?Number(u):NaN;if(e.class!=="auth"||!o||!Number.isSafeInteger(c)||c<=0||c>=S||c<t-o.maxAgeSeconds||c>t+o.maxFutureSeconds)throw l("authentication time is outside the pinned window");return c+o.maxAgeSeconds}if(e.expiryBinding==="cancel-only"){if(e.class!=="cancel")throw l("Oak has no signing contract for this request");return n}if(e.expiryBinding==="program-link")throw l("program link authority is not configured");if(y.has(e.class)&&(e.expiry||e.expiryBinding&&e.expiryBinding!=="signed"))throw l("order expiry must be signed");let s=D(e,r).expiry??n,a=Object.values(e.fields).some(o=>o.role==="expiry"||o.role==="derived"&&o.yields?.includes("expiry"));if(y.has(e.class)&&!a)throw l("order expiry must be signed");return(a||m.has(e.class))&&L(e,s,t),s}function H(e){if(e===void 0||!/^[0-9]{1,78}$/.test(e))throw l("open-ended or out-of-range amount");let r=BigInt(e);if(r<=0n||r>=v)throw l("open-ended or out-of-range amount");return r}function J(e,r){return Object.entries(e.fields).map(([t,n])=>{let s=t.includes("[]")?"(each item, listed below)":p(r,t),a=typeof s=="object"&&s!==null?JSON.stringify(s):String(s);a.length>200&&(a=`${a.slice(0,200)}\u2026`);let o=JSON.stringify(a).replace(/[\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g,u=>`\\u${u.charCodeAt(0).toString(16).padStart(4,"0")}`);return`${t} = ${o} - ${n.meaning}`})}export{O as a,v as b,m as c,l as d,V as e,T as f,A as g,j as h,z as i,C as j,W as k,p as l,D as m,L as n,U as o,H as p,J as q};
|
|
1
|
+
import{j as R,t as g}from"./TI727O2H.js";import{a as w}from"./XSD5NL7J.js";import{isDeepStrictEqual as b}from"node:util";import{isAddress as x}from"viem";var O=2592e3,v=1n<<128n,m=new Set(["order","offer","link","consent"]),y=new Set(["order","offer","consent"]),E=new Set(["order","offer","link"]),I=3600,S=1e11;function l(e){return new w(`Local signing guard: ${e}; nothing was signed.`)}var V=e=>m.has(e.class);function T(e,r){let t=new Map,n=(s,a,o)=>{let u=e[s];if(!u||o>8)throw l("typed-data types changed");for(let c of u){let f=c.type.replace(/(\[[0-9]*\])+$/,""),i=`${a}${c.name}${c.type===f?"":"[]"}`;e[f]?n(f,`${i}.`,o+1):t.set(i,c.type)}};return n(r,"",0),t}function N(e,r){let t=new Set,n=s=>{if(!(t.has(s)||!e[s])){t.add(s);for(let a of e[s])n(a.type.replace(/(\[[0-9]*\])+$/,""))}};return n(r),t}function A(e=[]){let r=new Set(e.map(n=>n.toLowerCase())),t=(n,s)=>{if(!(s>12)){if(typeof n=="string"){x(n,{strict:!1})&&r.add(n.toLowerCase());return}if(n&&typeof n=="object")for(let a of Object.values(n))t(a,s+1)}};return t(R,0),t(g,0),r}function j(e,r=A()){let t=[],n=(i,d)=>t.push(`${i} ${e.id}: ${d}`),s=Object.entries(e.fields),a=i=>s.filter(([,d])=>d.role===i),o=i=>s.filter(([,d])=>d.role==="derived"&&d.yields?.includes(i)).length;["order","cancel","link","offer","consent","auth","relayed"].includes(e.class)||n("R5","unknown signature class; link-accept is a display role only"),e.expiryBinding&&!["signed","program-link","auth-window","cancel-only"].includes(e.expiryBinding)&&n("R5","unknown expiry binding"),(!e.id||!/^[a-z0-9]+(?:[.-][a-z0-9]+)+$/.test(e.id))&&n("ID","id must be dotted lower-case"),(!e.tools.length||new Set(e.tools).size!==e.tools.length)&&n("ID","tools must be a non-empty unique list");let u=e.network==="testnet"?g.testnet.chainId:g.mainnet.chainId;if(e.encoding==="eip712"){let i=e.domain;i?(Object.hasOwn(i,"salt")&&n("R1","domain must not carry a salt"),i.name||n("R1","domain name is missing"),!i.version&&e.class!=="relayed"&&n("R1","domain version is missing"),i.chainId!==u&&n("R1",`domain chain must be ${u}`),i.verifyingContract?r.has(i.verifyingContract.toLowerCase())||n("R1","verifying contract is not a pinned address"):e.class!=="cancel"&&e.class!=="auth"&&n("R1","verifying contract is missing")):n("R1","EIP-712 spec has no domain")}else e.domain&&n("R1","only EIP-712 specs carry a domain");if(e.encoding==="eip191-packed-hash"){let i=a("pinned").map(([,d])=>d.value);i.some(d=>d===u||d===String(u))||n("R1","packed layout must pin the chain id"),i.some(d=>typeof d=="string"&&r.has(d.toLowerCase()))||n("R1","packed layout must pin the verifying contract")}let c=new Map,f=e.class==="relayed"&&!Object.keys(e.types).length;if(e.encoding==="eip712"&&!f){Object.hasOwn(e.types,"EIP712Domain")&&n("R2","types must never carry EIP712Domain");try{c=T(e.types,e.primaryType);let i=N(e.types,e.primaryType);for(let d of Object.keys(e.types))i.has(d)||n("R2",`type ${d} is not reachable from ${e.primaryType}`)}catch{n("R2",`types do not resolve from ${e.primaryType}`)}for(let i of c.keys())Object.hasOwn(e.fields,i)||n("R3",`message path ${i} has no role`);for(let[i]of s)c.has(i)||n("R3",`declared field ${i} is not in the typed struct`)}else e.encoding!=="eip712"&&Object.keys(e.types).length&&n("R2","only EIP-712 specs carry types");for(let[i,d]of s)(!d.meaning||d.meaning.length>160)&&n("R3",`field ${i} needs a plain-English meaning`);(e.class==="order"||e.class==="offer")&&!s.some(([,i])=>i.role==="amount"&&i.side==="out")&&!o("amount-out")&&n("R4",`${e.class} must show the most that can leave`);for(let[i,d]of s){if(d.role==="amount"||d.role==="fee"){let h=d.token;(x(h,{strict:!1})?r.has(h.toLowerCase()):e.fields[h]?.role==="token")||n("R4",`amount ${i} does not name a token field or a pinned token`)}c.get(i)==="bytes"&&d.role!=="pinned"&&d.role!=="derived"&&n("R4",`bytes field ${i} must be pinned or derived`)}if(e.maxLifetimeSeconds>0&&e.maxLifetimeSeconds<=O||n("R5","maxLifetimeSeconds must be within 30 days"),y.has(e.class)){let i=a("expiry").length+o("expiry");i!==1&&n("R5",`${e.class} needs exactly one expiry (found ${i})`),e.expiry&&n("R5","API-only expiry is not a signed expiry"),e.expiryBinding&&e.expiryBinding!=="signed"&&n("R5",`${e.class} requires signed expiry`)}if(e.expiryBinding==="program-link"&&e.class!=="link"&&n("R5","only link can use program-link"),e.class==="link"&&e.expiryBinding!=="program-link"&&a("expiry").length+o("expiry")!==1&&n("R5","link needs signed expiry or program-link binding"),e.expiryBinding==="auth-window"){let i=e.authWindow;(e.class!=="auth"||!i||!c.has(i.field)||!Number.isSafeInteger(i.maxAgeSeconds)||i.maxAgeSeconds<=0||i.maxAgeSeconds>e.maxLifetimeSeconds||!Number.isSafeInteger(i.maxFutureSeconds)||i.maxFutureSeconds<0||i.maxFutureSeconds>e.maxLifetimeSeconds)&&n("R5","auth-window needs a signed timestamp and pinned acceptance window")}else e.authWindow&&n("R5","authWindow requires auth-window binding");return e.expiryBinding==="cancel-only"&&(e.class!=="cancel"||!a("nonce").length&&!o("nonce")&&!e.revoke?.staysExecutableUntilExpiry)&&n("R5","cancel-only needs a single-use nonce or targeted non-revoking hide"),(e.class==="auth"||e.class==="cancel")&&(s.some(([,i])=>i.role==="amount"&&i.side==="out")||o("amount-out"))&&n("R4","auth and cancel cannot grant spending authority"),E.has(e.class)&&!(e.revoke?.onchainTool||e.revoke?.offchainSpec)&&!(e.revoke?.none&&e.maxLifetimeSeconds<=I)&&n("R6",`${e.class} needs a revocation path (only a one-shot approval of at most one hour may declare none)`),e.submit.by==="addon"&&(!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(e.submit.host)||!/^\/[A-Za-z0-9/_.-]*$/.test(e.submit.path))&&n("R9","add-on submission needs a bare HTTPS host and a fixed path"),e.submit.by==="server-continuation"&&!e.submit.reason&&n("R9","server-continuation needs its recorded reason"),e.submit.by==="transaction"&&e.class!=="relayed"&&e.class!=="consent"&&n("R9","only relayed and consent signatures are consumed by a transaction"),(!/^[A-Za-z0-9 .'-]{1,40}$/.test(e.program)||!/^[A-Za-z0-9 .'-]{1,60}$/.test(e.purpose))&&n("R10","program and purpose must be short constant text"),m.has(e.class)&&!e.requireHuman&&!e.humanException&&n("C13",`${e.class} must require a human`),!m.has(e.class)&&e.humanException&&n("C13","only a value class can name a human exception"),e.relayedPaths&&e.class!=="relayed"&&n("ID","only relayed specs accept caller signatures"),e.enabled===!1&&!e.disabledReason&&n("ID","a disabled spec states why"),t}function z(e,r=A()){let t=e.filter(a=>a.enabled!==!1).flatMap(a=>j(a,r)),n=new Set,s=new Set;for(let a of e){n.has(a.id)&&t.push(`ID ${a.id}: duplicate spec id`),n.add(a.id);let o=C(a);s.has(o)&&t.push(`ID ${a.id}: another spec already covers ${o}`),s.add(o)}return t}function C(e){return`${e.network??"mainnet"}:${e.encoding}:${(e.domain?.verifyingContract??"-").toLowerCase()}:${e.primaryType}`}function k(e,r,t,n,s){let a=r.replace(/(\[[0-9]*\])+$/,"");if(a!==r){if(!Array.isArray(t))throw l(`message field ${n||r} is not declared`);for(let i of t)k(e,r.replace(/\[[0-9]*\]$/,""),i,`${n}[]`,s+1);return}let o=e[a];if(!o)return;if(s>8||!t||typeof t!="object"||Array.isArray(t))throw l(`message field ${n||r} is not declared`);let u=Object.keys(t),c=o.map(i=>i.name);if(u.find(i=>!c.includes(i))!==void 0)throw l(`an undeclared message field${n?` under ${n}`:""} is present`);for(let i of o){if(!Object.hasOwn(t,i.name))throw l(`message field ${n?`${n}.`:""}${i.name} is missing`);k(e,i.type,t[i.name],`${n?`${n}.`:""}${i.name}`,s+1)}}function W(e,r){if(e.encoding!=="eip712"||!e.domain)throw l("Oak has no signing contract for this request");if(!r||typeof r!="object"||!r.domain||typeof r.domain!="object")throw l("domain, chain or verifying contract is not the pinned one");let t=Object.fromEntries(Object.entries(e.domain).filter(([,n])=>n!==void 0));if(!b(Object.keys(r.domain).sort(),Object.keys(t).sort())||!b({...r.domain},t))throw l("domain, chain or verifying contract is not the pinned one");if(!r.types||typeof r.types!="object"||Object.hasOwn(r.types,"EIP712Domain")||!b(r.types,e.types)||r.primaryType!==e.primaryType)throw l("typed-data types changed");k(e.types,e.primaryType,r.message,"",0)}function p(e,r){let t=e;for(let n of r.split(".")){if(n.endsWith("[]")||!t||typeof t!="object"||Array.isArray(t))return;t=t[n]}return t}var $=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="bigint"?String(e):void 0;function D(e,r){let t={},n=s=>x(s,{strict:!1})?s:$(p(r,s));for(let[s,a]of Object.entries(e.fields)){let o=$(p(r,s));if(o!==void 0)switch(a.role){case"signer":t.signer=o;break;case"account":t.account=o;break;case"recipient":t.recipient=o;break;case"delegate":t.delegate=o;break;case"counterparty":t.counterparty=o;break;case"token":a.side==="out"?t.tokenOut=o:t.tokenIn=o;break;case"amount":a.side==="out"?(t.amountOut=o,t.tokenOut??=n(a.token)):(t.minAmountIn=o,t.tokenIn??=n(a.token));break;case"fee":(t.fees??=[]).push({token:n(a.token)??a.token,value:o});break;case"expiry":t.expiry=/^[0-9]+$/.test(o)?Number(o):Number.NaN;break;case"nonce":t.nonce=o;break;default:break}}return t}function L(e,r,t){let n=Math.min(e.maxLifetimeSeconds,O),s=y.has(e.class)||e.humanException?60:1;if(!Number.isSafeInteger(t)||t<0||!Number.isFinite(n)||n<=0||r===void 0||!Number.isSafeInteger(r)||r<=0||r>=S||r<t+s||r>t+n)throw l(`expiry is missing, past or beyond ${n>=86400?`${Math.floor(n/86400)} days`:`${Math.ceil(n/60)} minutes`}`)}function U(e,r,t,n){if(e.enabled===!1)throw l("Oak has no signing contract for this request");if(!Number.isSafeInteger(t)||t<0||t>=S)throw l("signing time is unavailable");if(e.expiryBinding==="auth-window"){let o=e.authWindow,u=o&&p(r,o.field),c=typeof u=="number"?u:typeof u=="string"&&/^[0-9]+$/.test(u)?Number(u):NaN;if(e.class!=="auth"||!o||!Number.isSafeInteger(c)||c<=0||c>=S||c<t-o.maxAgeSeconds||c>t+o.maxFutureSeconds)throw l("authentication time is outside the pinned window");return c+o.maxAgeSeconds}if(e.expiryBinding==="cancel-only"){if(e.class!=="cancel")throw l("Oak has no signing contract for this request");return n}if(e.expiryBinding==="program-link")throw l("program link authority is not configured");if(y.has(e.class)&&(e.expiry||e.expiryBinding&&e.expiryBinding!=="signed"))throw l("order expiry must be signed");let s=D(e,r).expiry??n,a=Object.values(e.fields).some(o=>o.role==="expiry"||o.role==="derived"&&o.yields?.includes("expiry"));if(y.has(e.class)&&!a)throw l("order expiry must be signed");return(a||m.has(e.class))&&L(e,s,t),s}function H(e){if(e===void 0||!/^[0-9]{1,78}$/.test(e))throw l("open-ended or out-of-range amount");let r=BigInt(e);if(r<=0n||r>=v)throw l("open-ended or out-of-range amount");return r}function J(e,r){return Object.entries(e.fields).map(([t,n])=>{let s=t.includes("[]")?"(each item, listed below)":p(r,t),a=typeof s=="object"&&s!==null?JSON.stringify(s):String(s);a.length>200&&(a=`${a.slice(0,200)}\u2026`);let o=JSON.stringify(a).replace(/[\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g,u=>`\\u${u.charCodeAt(0).toString(16).padStart(4,"0")}`);return`${t} = ${o} - ${n.meaning}`})}export{O as a,v as b,m as c,l as d,V as e,T as f,A as g,j as h,z as i,C as j,W as k,p as l,D as m,L as n,U as o,H as p,J as q};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m,h as t}from"./NWNYJ26T.js";import{c as E}from"./
|
|
1
|
+
import{e as m,h as t}from"./NWNYJ26T.js";import{c as E}from"./MQ5F2VOK.js";import{j as C}from"./TI727O2H.js";import{a as v,b as g}from"./XSD5NL7J.js";import{keccak256 as j,parseAbi as D}from"viem";var A=Object.freeze({robinswapV2:Object.freeze({factory:"0xa95DA9b9fCef09A07F99444fE9304457d6ECdccA",kind:"v2",kyberswap:"robinswap-v2",velora:void 0}),uniswapV2:Object.freeze({factory:"0x8BcEAA40b9aCDfAedf85ADf4fF01f5ad6517937F",kind:"v2",kyberswap:"uniswap",velora:"uniswapv2"}),uniswapV3:Object.freeze({factory:C[4663].uniswap.v3_factory.address,kind:"v3",kyberswap:"uniswapv3",velora:"uniswapv3"})}),L=Object.freeze(Object.fromEntries(Object.entries(A).map(([r,n])=>[r,n.factory])));function V(r){return Object.values(A).flatMap(n=>n[r]??[])}var P=D(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function fee() view returns (uint24)"]),S=D(["function getPair(address,address) view returns (address)","function getPool(address,address,uint24) view returns (address)"]),a=new Map;function M(r,n,i){let d=a.get(j(i));return!!d&&d.expires>Date.now()&&t(d.token,r)&&d.pools.some(u=>t(u,n))}async function B(r,n,i,d,u,z){let w=[...new Set(d.filter(o=>!t(o,u)).map(o=>o.toLowerCase()))];if(!w.length)return;let k=j(z);a.delete(k);let f=await r.getBlockNumber();for(let o of w){let s=e=>new v(`KyberSwap source receiver ${o} is not a verified input pool: ${e}.`),l=Array.isArray(n)?n.map(e=>Array.isArray(e)?e[0]:void 0).find(e=>m(e)&&t(e.pool,o)&&t(e.tokenIn,i)):void 0;if(!m(l)||typeof l.tokenOut!="string")throw s("not named as an input hop in the accepted route");let O=await r.getCode({address:o,blockNumber:f});if(!O||O==="0x")throw s("no deployed code");try{let[e,p,y]=await Promise.all(["token0","token1","factory"].map(c=>r.readContract({address:o,abi:P,functionName:c,blockNumber:f}))),h=t(e,i)?p:t(p,i)?e:void 0;if(!h||!t(h,l.tokenOut))throw s("tokens do not match the input route");let x=Object.values(A).find(c=>t(y,c.factory));if(!x)throw s("factory is not pinned");let b;if(x.kind==="v2")b=await r.readContract({address:y,abi:S,functionName:"getPair",args:[e,p],blockNumber:f});else{let c=await r.readContract({address:o,abi:P,functionName:"fee",blockNumber:f});b=await r.readContract({address:y,abi:S,functionName:"getPool",args:[e,p,c],blockNumber:f})}if(!t(b,o))throw s("not registered by the pinned factory")}catch(e){throw e instanceof v||E(e)?e:g(e,3)?s("pool token or factory read reverted; this pool interface is not supported by Oak"):s("on-chain verification unavailable")}}for(let[o,s]of a)s.expires<=Date.now()&&a.delete(o);a.size>=1e3&&a.delete(a.keys().next().value),a.set(k,{token:i,pools:w,expires:Date.now()+6e4})}export{A as a,L as b,V as c,M as d,B as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as N,b as F,e as b,f as i,k as T,m as O,o as B}from"./W7OCS4AM.js";import{c as I,e as A}from"./HQIS3QI7.js";import{h as x}from"./BSX4LFYI.js";import{a as o,e as k}from"./XSD5NL7J.js";function u(e,s){if(e.version!==1||e.chainId!==4663||!Object.hasOwn(b,e.kind))throw new o("Invalid FOBO pending action. Nothing further was signed.");if(!Number.isSafeInteger(s)||!Number.isSafeInteger(e.quotedAt)||s<e.quotedAt||s-e.quotedAt>=N)throw new o("This FOBO action expired. Nothing further was signed. Ask for a fresh summary, then say yes or no.")}function w(e,s){return typeof e=="string"&&e.toLowerCase()===s.toLowerCase()}function P(e){if(typeof e!="number"&&typeof e!="string"||!/^\d+$/.test(String(e)))throw new o("FOBO returned an invalid Permit2 nonce.");let s=Number(e);if(!Number.isSafeInteger(s)||s<0||s>=2**48)throw new o("FOBO returned an invalid Permit2 nonce.");return s}function _(e,s,n){let t=i(s),m=i(t.domain),c=i(t.message),p=i(c.details);if(!["buy","sell"].includes(e.kind)||![4663,"0x1237"].includes(m.chainId)||!w(m.verifyingContract,F.permit2)||t.primaryType!=="PermitSingle"||!w(c.spender,F.router)||!w(p.token,e.request._currencyIn)||!e.terms.amountIn)throw new o("FOBO permit does not match the approved token, spender or chain. Nothing further was signed.");return I({token:e.request._currencyIn,amount:BigInt(e.terms.amountIn),nonce:P(p.nonce),now:n})}async function*q(e,s,n){let t=structuredClone(s);u(t,n.now());let m=!1,c,p;try{if(t.kind==="launch"){let a=i(await e.call("sign_in_start",{account:t.wallet}));if(u(t,n.now()),typeof a.message!="string"||typeof a.ticket!="string"||!a.ticket||a.ticket.length>2e3)throw new o("FOBO returned an invalid sign-in ticket. Nothing was signed.");A(a.message,t.wallet,n.now());let f=await n.signMessage(a.message);u(t,n.now());let l=i(await e.call("sign_in_finish",{account:t.wallet,ticket:a.ticket,signature:f}));if(l.success===!1||l.ok===!1||l.isError===!0)throw new o("FOBO sign-in was refused. Nothing further was signed.");yield{kind:"signin",status:"signed"}}for(let a=0;a<4;a++){u(t,n.now());let f={...T(t),...c?{permit:c}:{}},h=a===0&&["limitOrder","cancel","claim"].includes(t.kind)&&typeof t.request._prepared=="string"?O({status:"ready",transactions:JSON.parse(String(t.request._prepared)).map(r=>({...r,from:t.wallet,gas:r.gasLimit}))}):O(await e.call(b[t.kind],f));u(t,n.now());let y=await B(t,h,n.now(),c?.message,n.readContract);if(h.status==="needs_approval"){if(m||c)throw new o("FOBO requested a repeated approval. Nothing further was signed. Ask for a fresh summary.");for(let r of y){u(t,n.now());let d=await n.sendTransaction(r);m=!0,await n.waitForReceipt(d),yield{kind:"approval",hash:d,tx:r,status:"mined"}}continue}if(h.status==="needs_signature"){if(c)throw new o("FOBO requested a repeated permit. Nothing further was signed.");p=_(t,h.typedData,n.now()),u(t,n.now());let r=await n.signTypedData(p);c={message:i(p).message,signature:r},yield{kind:"permit",status:"signed"};continue}if(p){let r=i(i(p).message),d=i(r.details);for(let S of y){let g=x(S.data,["0x0Af57F62982D03066ef917AcAd87F771c06528Ec","0x0000000000000000000000000000000000000000"]).permit;if(!g||!w(g.token,d.token)||g.amount!==BigInt(String(d.amount))||g.nonce!==Number(d.nonce)||g.expiration!==Number(d.expiration)||!w(g.spender,r.spender)||g.sigDeadline!==BigInt(String(r.sigDeadline)))throw new o("FOBO changed the exact signed permit in the swap. Nothing further was signed.")}}for(let r of y){u(t,n.now());let d=await n.sendTransaction(r);await n.waitForReceipt(d),yield{kind:"transaction",hash:d,tx:r,status:"mined"}}return}throw new o("FOBO preparation did not finish. Nothing further was signed. Ask for a fresh summary.")}catch(a){let f=m?" An exact approval was already sent; use oak_cleanup_allowances to review any allowance left.":"";throw new o(`${k(a).replaceAll("Nothing was signed.","Nothing further was signed.")} FOBO execution stopped; nothing further was signed.${f}`)}}export{_ as a,q as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function d(r,t){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(t,"id")}var h=new Map([]),_="find_tool",l="run_tool",w=["upoch_agent","upoch_explorer"],i=["oak_setup","oak_identity_unlink","oak_subscribe","oak_renew","oak_redeem","send","hoodlock_feature_buy","hoodlock_feature_claim","hoodlock_referral_register","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_unfollow","heyresearch_position_context"],p={oak:["account","balances","find_token","price","quote","swap","positions","send","oak_setup","oak_subscribe","oak_renew","oak_identity_unlink","oak_redeem"],kyberswap:[],velora:[],steakhouse:["steakhouse_deposit","steakhouse_withdraw"],spark:["spark_deposit","spark_withdraw"],layerbank:["layerbank_deposit","layerbank_withdraw"],borro:["borro_deposit","borro_withdraw"],chop:["chop_wrap","chop_unwrap"],factor:["factor_sign_up","factor_open_jobs"],raeto:["raeto_status","raeto_join","raeto_ask"],gloam:["gloam_shield","gloam_pay","gloam_claim","gloam_cash_out"],pendle:["pendle_buy","pendle_sell","pendle_redeem"],earn:["earn_options"],netnet:["netnet_deposit","netnet_withdraw"],longbow:["longbow_list","longbow_deposit","longbow_withdraw"],grove:["grove_deposit","grove_withdraw"],beefy:["beefy_list","beefy_deposit","beefy_withdraw"],pons:["pons_browse","pons_buy","pons_sell","pons_launch"],orbio:["orbio_credit_status","orbio_buy_credit"],hoodlock:["hoodlock_list_locks","hoodlock_lock","hoodlock_withdraw"],merkl:["merkl_rewards","merkl_claim"],relay:["relay_bridge_in","relay_bridge_out","relay_status"],lighter:["lighter_funding"],wormhole:[],upoch:[],erc8004:["erc8004_identity"],hoodag:["hoodag_resolve","hoodag_register"],heyresearch:["heyresearch_research_project","heyresearch_token_facts","heyresearch_feed","heyresearch_follow","heyresearch_position_context"],priors:["priors_status","priors_lend","priors_withdraw","priors_borrow","priors_repay"],morpho:["morpho_status","morpho_supply","morpho_withdraw","morpho_supply_collateral","morpho_withdraw_collateral","morpho_borrow","morpho_repay"],uniswap:["uniswap_list_positions","uniswap_add","uniswap_remove","uniswap_collect"],hookr:["hookr_orders","hookr_create","hookr_cancel"],meridian:["meridian_browse","meridian_positions","meridian_sell","meridian_redeem"],tickerspring:["tickerspring_account","tickerspring_create","tickerspring_cancel","tickerspring_claim"],clanker:["clanker_browse","clanker_launch"],poolstrade:["poolstrade_status","poolstrade_buy","poolstrade_sell","poolstrade_launch"]};function k(r,t){let a=new Set(r),s=new Set;for(let[e,n]of Object.entries(p))for(let o of n){if(s.has(o))throw new Error(`Visible tool ${o} is listed twice.`);if(e!=="oak"&&!o.startsWith(`${e}_`))throw new Error(`Visible tool ${o} is filed under ${e}.`);if(i.includes(o)||a.has(o))s.add(o);else if(t==="mainnet")throw new Error(`Visible tool ${o} is not registered.`)}for(let e of[_,l,...i,"oak_playbook"])if(a.has(e))throw new Error(`Tool name ${e} is reserved for the add-on.`);return s}export{d as a,h as b,_ as c,l as d,w as e,i as f,p as g,k as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as L,j as i,k as d,l as w,m as y,n as D,o as f,p as l,q as h,r as _,s as q,t as r}from"./
|
|
1
|
+
import{h as L,j as i,k as d,l as w,m as y,n as D,o as f,p as l,q as h,r as _,s as q,t as r}from"./XRDLMTBJ.js";import{a as O,f as F}from"./MQK6OP7S.js";import{a as c}from"./XSD5NL7J.js";import{encodeAbiParameters as M,getAddress as B,keccak256 as j,parseAbi as $,zeroHash as N}from"viem";var Y="0x167ba3b15d65044b17c87154087d35fc5efde07538be66b804a54e63d6089136",z=$(["function getVersion() view returns (string)"]),E=B("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),R=B("0x8004BAa17C55a88189AE136b182e5fdA19dE9b63");function ee(n,s){let e=y(n),o=y(e.caps),t=i(e.gasLimit,32),m=i(o.maxLpFeePips,24);if(s!==Y||e.schemaHash!==Y||e.codeHash!==F(r).codeHash||e.implementation!==r||i(e.kind,8)!==1n||i(e.phaseMask,8)!==1n||d(e.failOpen)||t<400000n||t>2000000n||m>50000n||i(o.maxQuoteTakePips,24)!==0n||i(o.maxSubjectTakeBps,16)!==0n)throw new c("Hookr agent gate admission, schema or execution caps differ from the supported fail-closed BEFORE_SWAP profile. Review the deployment before entry.");return d(e.feeOnly),{...e,caps:o}}async function oe(n,s,e,o=[]){let t=(a,p=[])=>l(n,r,f("agentGateV1"),a,p,s),[m,A,S,g,x,v,k,H,Q,U,W,X]=await Promise.all([t("configSchemaHash"),l(n,_,f("registry"),"admission",[h,r],s),t("retired"),t("identity"),t("reputation"),t("poolManager"),t("isAgent",[e]),t("linkOf",[e]),t("MIN_ADVISORY_GAS"),t("MAX_ADVISORY_GAS"),l(n,E,z,"getVersion",[],s),l(n,R,z,"getVersion",[],s)]),J=ee(A,m);if(g!==E||x!==R||v!==q||i(Q)!==400000n||i(U)!==2000000n)throw new c("Hookr gate dependencies or gas limits differ from the reviewed profile.");let C=a=>{if(typeof a!="string"||new TextEncoder().encode(a).length>32)throw new c("Hookr registry version read is incomplete.");return j(M([{type:"string"}],[a]))},I=C(W)!==O.gateVersions.identity,K=C(X)!==O.gateVersions.reputation,P=I||K,u=d(S),T=w(H,2),Z=await Promise.all(o.map(async a=>{let[p,b]=w(await t("reviewerSet",[a]),2);if(!Array.isArray(p)||p.length===0||p.length>32||typeof b!="string")throw new c("Reviewer set is unregistered or unavailable. Supply an existing registered bytes32 set ID.");let V=p.map(G=>B(String(G)));if(V.some(G=>BigInt(G)===0n)||j(M([{type:"address[]"},{type:"string"}],[V,b]))!==a.toLowerCase())throw new c("Hookr reviewer set does not match its registered ID.");return{id:a,clients:V,tag:b}}));return{address:r,healthy:!u&&!P,healthyIdentityOnly:!u&&!I,healthyForScores:!u&&!P,retired:u,registryVersionDrift:P,schemaHash:m,admission:D(J),identity:E,reputation:R,walletAgent:d(k),link:{linked:d(T[0]),agentId:i(T[1]).toString()},reviewerSets:Z,reviewerSetsComplete:!1,reviewerSetsNotice:"Only explicitly requested registered set IDs are read. This is not an enumeration. No reviewed Priors alias is configured; provide a registered bytes32 set ID.",termsSchema:{flags:"uint16",minScore:"uint32",tierScore:"uint32",tierPips:"uint24",reviewers:"bytes32"},defaults:{flags:"1",minScore:"0",tierScore:"0",tierPips:"0",reviewers:N},maxTierPips:"50000",minGas:"400000",maxGas:"2000000"}}async function ae(n,s,e,o,t){if(BigInt(t)===0n)return{gated:!1,admissionRequiredForCollectOrRemove:!1};if(t!==r)throw new c("This position uses an unreviewed advisory. Gate status is unknown.");let[m,A,S]=await Promise.all([l(n,r,f("agentGateV1"),"terms",[h,e],s),l(n,r,f("agentGateV1"),"explainLiquidity",[h,e,o],s),l(n,r,f("agentGateV1"),"retired",[],s)]),g=y(m),[x,v]=w(A,2);if(!d(g.bound)||g.launcher!==o)throw new c("Hookr gate is not bound to this family Launcher.");for(let[k,H]of[["flags",16],["minScore",32],["tierScore",32],["tierPips",24]])i(g[k],H);return L(g.reviewers),{gated:!0,gate:r,terms:D(g),retired:d(S),liquidityEntryAllowed:d(x),entryReason:i(v,8).toString(),admissionRequiredForCollectOrRemove:!1}}export{Y as a,ee as b,oe as c,ae as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l,c as A}from"./
|
|
1
|
+
import{b as l,c as A}from"./WAKZWSHB.js";import{b as h}from"./SCG5HWMN.js";import{e as o,h as b}from"./NWNYJ26T.js";import{b as f}from"./TI727O2H.js";var c=()=>({bonus:"unavailable",checks:["LayerBank bonus is unavailable. The base rate excludes rewards."]});function d(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function I(e){let n=typeof e=="string"&&/^\d+$/.test(e)?Number(e):e;return typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:void 0}function k(e,n){return Math.abs(e-n)<=1e-8*Math.max(1,e,n)}function L(e,n){let t=e.aprRecord;if(!d(e.apr)||!o(t)||!d(t.cumulated)||!Array.isArray(t.breakdowns)||!t.breakdowns.length||!Array.isArray(e.campaigns))return;let m=e.campaigns,u=new Set,a=0,i=1/0;for(let s of t.breakdowns){if(!o(s)||s.type!=="CAMPAIGN"||!d(s.value)||typeof s.identifier!="string"||u.has(s.identifier))return;u.add(s.identifier);let r=m.find(g=>o(g)&&g.campaignId===s.identifier);if(!o(r)||r.distributionChainId!==f||r.opportunityId!==e.id||!d(r.apr)||!k(r.apr,s.value)||!o(r.params)||!b(r.params.targetToken,l)||!b(r.params.underlyingToken,A.address))return;let y=I(r.startTimestamp),p=I(r.endTimestamp);if(y===void 0||p===void 0||y>n||p<=n||y>=p)return;a+=s.value,i=Math.min(i,p)}if(!(!d(a)||!k(a,e.apr)||!k(a,t.cumulated)))return{bonus:{ratePct:a,endsAt:i},checks:[]}}async function T(e=h(),n=Math.floor(Date.now()/1e3)){try{let t=new URL("https://api.merkl.xyz/v4/opportunities");t.search=new URLSearchParams({chainId:String(f),mainProtocolId:"layerbank",campaigns:"true",items:"100"}).toString();let m=await e(t.toString(),{method:"GET",headers:{"User-Agent":"oak-core/layerbank"}});if(!m.ok)return c();let u=await m.json();if(!Array.isArray(u))return c();let a=u.filter(i=>o(i)&&i.chainId===f&&b(i.explorerAddress,l)&&i.status==="LIVE"&&i.action==="LEND");return a.length!==1||!o(a[0])?c():L(a[0],n)??c()}catch{return c()}}export{T as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as n}from"./VXCGMALF.js";import{a as P}from"./DFM4T6ZE.js";import{g as $}from"./NWNYJ26T.js";import{b as s,e as v}from"./TI727O2H.js";import{getAddress as T,parseAbi as b}from"viem";var m={address:n.priors,symbol:"PRIORS",decimals:18,chainId:s},w=8,E="0x0000000000000000000000000000000000000000",x=b(["function balanceOf(address) view returns (uint256)"]),_=b(["function balanceOf(address) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)"]),y=b(["function getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))","function assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)"]),A=b(["function latestGen(uint256) view returns (uint32)","function position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))"]);async function L(k,d,C,R){let e=k.clientFor(s),g=async(t,i,o,r)=>{try{return await r()}catch(a){return[{module:"priors",id:`priors:unreadable:${t}`,chainId:s,assets:[],incomplete:!0,description:`Priors ${i} read failed (${k.plainError(a)}). It is not zero: ${o}`}]}},l=(t,i)=>k.formatAmount(t.toString(),i),S=()=>g("savings","savings","check it with priors_savings_balance.",async()=>{let t=await e.readContract({address:n.savings,abi:_,functionName:"balanceOf",args:[d]});if(t===0n)return[];let i=await e.readContract({address:n.savings,abi:_,functionName:"previewRedeem",args:[t]});return[{module:"priors",id:`priors:savings:${d.toLowerCase()}`,chainId:s,assets:[{token:R,amount:i.toString()}],description:`Priors savings in the Morpho vault (${n.savings}): ${t} shares, ${l(i,v)} USDG redeemable now. Exit with priors_savings_withdraw or priors_savings_redeem; vault liquidity applies and no immediate exit is promised.`}]}),O=()=>g("priors-token","PRIORS token","check it with balances.",async()=>{let t=await e.readContract({address:n.priors,abi:x,functionName:"balanceOf",args:[d]});return t===0n?[]:[{module:"priors",id:`priors:token:${d.toLowerCase()}`,chainId:s,assets:[{token:m,amount:t.toString()}],description:`${l(t,m.decimals)} PRIORS held by this wallet (${n.priors}). Stock-collateral and backing stake are listed separately.`}]}),N=t=>g(`stock:${t}`,`stock (agent ${t})`,`check it with priors_stock_state {"agentId":"${t}"}.`,async()=>{let i=await e.readContract({address:n.stock,abi:y,functionName:"getPosition",args:[t]});if(i.amount===0n||i.token===E||!$(i.depositor,d))return[];let o=T(i.token),r=(await e.readContract({address:n.stock,abi:y,functionName:"assets",args:[o]}))[2],a=P.tokens.find(p=>$(p.token,o))?.symbol??"STOCK";return[{module:"priors",id:`priors:stock:${t}`,chainId:s,assets:[{token:{address:o,symbol:a,decimals:r,chainId:s},amount:i.amount.toString()}],description:`Priors stock collateral for agent ${t}: ${l(i.amount,r)} ${a} locked in the stock vault (${n.stock})${i.closing?"; the line is closing":""}. Close the line with priors_stock_close to return it, subject to any default or issuer shortfall.`}]}),I=t=>g(`backing:${t}`,`backing (agent ${t})`,`check it with priors_backing_position {"agentId":"${t}"}.`,async()=>{let i=BigInt(await e.readContract({address:n.backing,abi:A,functionName:"latestGen",args:[t]})),o=i>=BigInt(w)?i-BigInt(w-1):0n,r=[];for(let c=o;c<=i;c++)for(let u of[0,1,2])r.push(e.readContract({address:n.backing,abi:A,functionName:"position",args:[t,Number(c),u,d]}));let a=await Promise.all(r),p=a.reduce((c,u)=>c+u.counted,0n),f=a.reduce((c,u)=>c+u.a0+u.a1,0n),h=[];return o>0n&&h.push({module:"priors",id:`priors:unreadable:backing-generations:${t}`,chainId:s,assets:[],incomplete:!0,description:`Agent ${t} has ${i} backing generations; only the latest ${w} were read. Check older ones with priors_backing_position.`}),p+f>0n&&h.push({module:"priors",id:`priors:backing:${t}`,chainId:s,assets:[{token:m,amount:(p+f).toString()}],description:`Priors backing stake for agent ${t}: ${l(p,m.decimals)} PRIORS counted and ${l(f,m.decimals)} PRIORS pending. It is collateral that a default burns, not a return. Stake already leaving or settled is not included; check priors_backing_record and priors_backing_claimable.`}),h});return(await Promise.all([S(),O(),...C.flatMap(t=>[N(t),I(t)])])).flat()}export{m as a,L as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"./G2LAO23N.js";import{C as W,H as X,I as q,L as Y,a as w,z as C}from"./U363GQTF.js";import{a as V}from"./66F5ZH34.js";import{f as Q,g as D}from"./NWNYJ26T.js";import{b as K,d as J}from"./IX3GZMTM.js";import{a as k}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as oe,erc20Abi as ne,getAddress as I,parseAbi as ie}from"viem";var P="https://hookr.fun/api/mcp",Z=ie(["function fill(uint256 orderId) returns (uint256)","function fillGasFloor(uint256 orderId) view returns (uint256)"]),N={type:"string",pattern:"^[1-9][0-9]*$"},ee={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},te={type:"string",enum:["buy","sell"],description:R.enumValues({buy:"spend the pool quote token to receive the listed token",sell:"spend the listed token to receive the quote token"})},re={cursor:{...N,description:"Order ID to start from, scanning downward (newest first). Use nextCursor from the previous page; omit for the latest order."},limit:{type:"integer",minimum:1,maximum:32,description:"Maximum number of order IDs to scan in this page, 1 to 32. Default 16."}};function B(o,m){if(typeof o!="string"||!/^[1-9][0-9]*$/.test(o)||o.length>78||BigInt(o)>=1n<<256n)throw new i(`Provide ${m} as a positive decimal integer string.`);return BigInt(o)}function g(o){return Q(o,"Hookr returned an invalid read response. Retry later.")}function H(o,m,e,t){return{name:o,inputSchema:{type:"object",description:`Read ${o.replace("hookr_","Hookr ")}. No signature or transaction.`,properties:m,required:e,additionalProperties:!1},execute:async(n,s)=>{if(Object.keys(n).some(a=>!Object.hasOwn(m,a))||e.some(a=>n[a]===void 0))throw new i(`Provide the documented arguments for ${o}.`);return t(n,s)}}}function F(o){if(typeof o!="string"||!/^0x[0-9a-fA-F]{64}$/.test(o))throw new i("Provide a 32-byte Hookr poolId.");return o}function $(o,m){let e=g(o),t=g(e.key);if(typeof t.fee!="number"||!Number.isInteger(t.fee)||t.fee<0||t.fee>16777215||typeof t.tickSpacing!="number"||!Number.isInteger(t.tickSpacing)||t.tickSpacing<=0||t.tickSpacing>8388607)throw new i("Hookr pool key is invalid.");let n={currency0:I(String(t.currency0)),currency1:I(String(t.currency1)),fee:t.fee,tickSpacing:t.tickSpacing,hooks:I(String(t.hooks))},s=m??F(e.poolId);if(BigInt(n.currency0)>=BigInt(n.currency1)||!D(W(n),s))throw new i("Hookr pool key does not match its PoolId.");let a=g(e.token),u=g(e.quote),d=r=>{let b=I(String(r.address));if(typeof r.symbol!="string"||!r.symbol.trim()||typeof r.decimals!="number"||!Number.isInteger(r.decimals)||r.decimals<0||r.decimals>255||![n.currency0,n.currency1].includes(b))throw new i("Hookr listed token metadata is invalid.");return{...r,address:b,chainId:k}},c=d(a),l=d(u);if(c.address===l.address)throw new i("Hookr listed token pair is invalid.");return{...e,poolId:s,key:n,token:c,quote:l}}async function se(o,m,e){try{let t=await o.http(P,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:m,arguments:e}}),signal:AbortSignal.timeout(15e3),redirect:"error"});if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=g(await t.json());if(n.error||n.id!==1)throw new Error("RPC failure");let s=g(n.result);if(s.isError)throw new Error("Tool failure");let a=g(s.structuredContent);if(a.status==="unavailable"||a.error)throw new Error("Unavailable");return a}catch{throw new i(`Hookr ${m} read is unavailable. Retry later; unavailable data is not an empty result.`)}}var O=se;function ke(o){let m=e=>H(e?"hookr_orders":"hookr_open_orders",re,[],async(t,n)=>{let s=t.limit??16;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>32)throw new i("Hookr page limit must be an integer from 1 to 32.");let a=o.clientFor(k),u=await a.getBlock();if(typeof u.number!="bigint"||typeof u.timestamp!="bigint"||u.timestamp<=0n)throw new i("Hookr order reads need a valid chain block and timestamp.");let d=new Proxy(Y(a),{get(h,f,p){return f==="readContract"?y=>h.readContract({...y,blockNumber:u.number}):Reflect.get(h,f,p)}}),c={...o,clientFor:()=>d},l=await d.readContract({address:w,abi:C,functionName:"lastOrderId"});if(typeof l!="bigint"||l<0n)throw new i("Could not read the last Hookr order ID. Coverage is unknown.");let r=t.cursor===void 0?l:B(t.cursor,"cursor");if(r>l)throw new i("Hookr cursor exceeds the latest order ID. Restart pagination.");let b=[],A=new Map,x=r,S=r>BigInt(s)?r-BigInt(s):0n;for(;r>S;){let h=r--,f=X(await d.readContract({address:w,abi:C,functionName:"getOrder",args:[h]}));if(Number(f.status)===0||BigInt(f.owner)===0n)throw new i(`Hookr order #${h} is missing. Coverage is unknown.`);if(e?!D(f.owner,n):Number(f.status)!==1)continue;let p=await q(c,h,{order:f,tokens:A});if(e){b.push(p);continue}let y=null,M=null,G=null,j=null,z=BigInt(p.expiry)<u.timestamp,L=p.fillable&&!z;if(L)try{let _=await d.readContract({address:w,abi:Z,functionName:"fillGasFloor",args:[BigInt(p.orderId)]}),T=await a.estimateGas({account:n,to:w,data:oe({abi:Z,functionName:"fill",args:[BigInt(p.orderId)]}),blockNumber:u.number}),v=await a.getGasPrice();if(typeof _!="bigint"||_<0n||typeof T!="bigint"||T<=0n||typeof v!="bigint"||v<0n)throw new Error("Invalid gas data");let U=(_*6n+4n)/5n,E=T>U?T:U;y=E.toString(),M=v.toString(),G=(E*v).toString(),j=(BigInt(p.bounty)-E*v).toString()}catch{}b.push({...p,fillable:L,expired:z,economics:{gasLimit:y,gasPrice:M,estimatedGasCost:G,bountyLessEstimatedGas:j,note:"Estimate only; excludes bounty claim gas and competition. Recheck the fill preview."}})}return{chainId:k,book:w,blockNumber:u.number.toString(),chainTime:u.timestamp.toString(),orders:b,scanned:{from:x.toString(),through:(r+1n).toString()},nextCursor:r>0n?r.toString():null,complete:r===0n}});return[m(!1),m(!0),H("hookr_order",{orderId:{...N,description:R.id("Hookr limit order")}},["orderId"],async e=>q(o,B(e.orderId,"orderId"))),H("hookr_pools",{token:{type:"string",description:R.address("listed token whose pools to return")},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of pools to return, 1 to 50."},cursor:{type:"string",pattern:"^[0-9]{1,6}$",description:"Paging cursor: the nextCursor from the previous pools page; omit for the first page."}},[],async e=>{if(e.token!==void 0)try{I(String(e.token))}catch{throw new i("Provide a valid token address.")}if(e.limit!==void 0&&(typeof e.limit!="number"||!Number.isInteger(e.limit)||e.limit<1||e.limit>50))throw new i("Pool page limit must be from 1 to 50.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||!/^[0-9]{1,6}$/.test(e.cursor)))throw new i("Provide the pool nextCursor from the previous page.");let t=await O(o,"hookr_pools",e);if(!Array.isArray(t.pools))throw new i("Hookr pool coverage is unknown. Retry later.");return{...t,pools:t.pools.map(n=>$(n)),chainId:k,source:P}}),H("hookr_pool",{poolId:ee,side:te,amountIn:{...N,description:'Order input amount in base units of the input token (quote token for buy, listed token for sell); read its decimals. Example: "1000000". Give with side and minAmountOut.'},minAmountOut:{...N,description:'Minimum output in base units of the output token (listed token for buy, quote token for sell); read its decimals. Example: "1000000". Give with side and amountIn.'}},["poolId"],async e=>{let t=F(e.poolId),n=[e.side,e.amountIn,e.minAmountOut].some(y=>y!==void 0);if(n&&(e.side!=="buy"&&e.side!=="sell"||e.amountIn===void 0||e.minAmountOut===void 0))throw new i("Provide side, amountIn and minAmountOut together for order-specific bounty bounds.");let s=n?B(e.amountIn,"amountIn"):void 0,a=n?B(e.minAmountOut,"minAmountOut"):void 0;if(s!==void 0&&(s>=1n<<128n||a>=1n<<128n))throw new i("Hookr order amounts must fit uint128 base units.");let u=await O(o,"hookr_pool",{poolId:t}),d=u.listing?$(u.listing,t):void 0,c={...u,...d?{listing:d}:{},chainId:k,source:P};if(!n)return{...c,bountyBounds:{status:"requires-order-terms",note:"The keeper bounty floor depends on the order. Supply side, amountIn and minAmountOut in base units. The batch-1 0.0005 ETH observation is not a permanent floor."}};if(!d)throw new i("Hookr pool key is unavailable; bounty floor is unknown.");let l=d.key,r=g(e.side==="buy"?d.quote:d.token),b=I(String(r.address))===l.currency0,A=o.clientFor(k),x=await A.getBlock(),S=await A.readContract({address:w,abi:C,functionName:"bountyBounds",args:[l,b,s,a],blockNumber:x.number});if(!Array.isArray(S)||S.length!==3||S.some(y=>typeof y!="bigint"||y<0n||y>=1n<<128n))throw new i("Hookr bounty bounds are unavailable; the floor is unknown.");let[h,f,p]=S;return{...c,bountyBounds:{status:"available",blockNumber:x.number.toString(),token:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",symbol:"ETH",decimals:18,chainId:k},minBounty:h.toString(),defaultBounty:f.toString(),maxBounty:p.toString(),effectiveFloor:(h>0n?h:f).toString(),note:"ETH wei for this order at this block. Oak create uses the positive minimum, or the default when minimum is zero; recheck at creation."}}}),H("hookr_quote",{poolId:ee,side:te,amountIn:{...V(),description:'Amount of the input token in base units (quote token for buy, listed token for sell); read its decimals. Example: "1000000" = 1 token with 6 decimals.'}},["poolId","side","amountIn"],async(e,t)=>{let n=F(e.poolId);if(e.side!=="buy"&&e.side!=="sell")throw new i("Hookr side must be buy or sell.");if(typeof e.amountIn!="string"||K(e.amountIn)<=0n)throw new i("Provide a positive amountIn in base units.");let s=await O(o,"hookr_pool",{poolId:n}),a=$(s.listing,n),u=g(e.side==="buy"?a.quote:a.token),d=I(String(u.address)),c=d==="0x0000000000000000000000000000000000000000"?18:await o.clientFor(k).readContract({address:d,abi:ne,functionName:"decimals"});if(typeof c!="number"||!Number.isInteger(c)||c<0||c>255||typeof u.symbol!="string")throw new i("Hookr input token metadata is unavailable.");let l=J(e.amountIn,c),r=await O(o,"hookr_quote",{poolId:n,side:e.side,amount:l,payer:t}),b=await O(o,"hookr_check_trade",{poolId:n,side:e.side,amount:l,wallet:t});return{chainId:k,source:P,input:{token:{address:d,symbol:u.symbol,decimals:c,chainId:k},amount:e.amountIn},quote:r,check:b,note:"Informational quote. Review pool rules; unknown trade checks do not authorize a trade."}})]}export{se as a,ke as b};
|
|
1
|
+
import{a as R}from"./G2LAO23N.js";import{C as W,H as X,I as q,L as Y,a as w,z as C}from"./HIG7JY3J.js";import{a as V}from"./66F5ZH34.js";import{f as Q,g as D}from"./NWNYJ26T.js";import{b as K,d as J}from"./IX3GZMTM.js";import{b as k}from"./TI727O2H.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as oe,erc20Abi as ne,getAddress as I,parseAbi as ie}from"viem";var P="https://hookr.fun/api/mcp",Z=ie(["function fill(uint256 orderId) returns (uint256)","function fillGasFloor(uint256 orderId) view returns (uint256)"]),N={type:"string",pattern:"^[1-9][0-9]*$"},ee={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},te={type:"string",enum:["buy","sell"],description:R.enumValues({buy:"spend the pool quote token to receive the listed token",sell:"spend the listed token to receive the quote token"})},re={cursor:{...N,description:"Order ID to start from, scanning downward (newest first). Use nextCursor from the previous page; omit for the latest order."},limit:{type:"integer",minimum:1,maximum:32,description:"Maximum number of order IDs to scan in this page, 1 to 32. Default 16."}};function B(o,m){if(typeof o!="string"||!/^[1-9][0-9]*$/.test(o)||o.length>78||BigInt(o)>=1n<<256n)throw new i(`Provide ${m} as a positive decimal integer string.`);return BigInt(o)}function g(o){return Q(o,"Hookr returned an invalid read response. Retry later.")}function H(o,m,e,t){return{name:o,inputSchema:{type:"object",description:`Read ${o.replace("hookr_","Hookr ")}. No signature or transaction.`,properties:m,required:e,additionalProperties:!1},execute:async(n,s)=>{if(Object.keys(n).some(a=>!Object.hasOwn(m,a))||e.some(a=>n[a]===void 0))throw new i(`Provide the documented arguments for ${o}.`);return t(n,s)}}}function F(o){if(typeof o!="string"||!/^0x[0-9a-fA-F]{64}$/.test(o))throw new i("Provide a 32-byte Hookr poolId.");return o}function $(o,m){let e=g(o),t=g(e.key);if(typeof t.fee!="number"||!Number.isInteger(t.fee)||t.fee<0||t.fee>16777215||typeof t.tickSpacing!="number"||!Number.isInteger(t.tickSpacing)||t.tickSpacing<=0||t.tickSpacing>8388607)throw new i("Hookr pool key is invalid.");let n={currency0:I(String(t.currency0)),currency1:I(String(t.currency1)),fee:t.fee,tickSpacing:t.tickSpacing,hooks:I(String(t.hooks))},s=m??F(e.poolId);if(BigInt(n.currency0)>=BigInt(n.currency1)||!D(W(n),s))throw new i("Hookr pool key does not match its PoolId.");let a=g(e.token),u=g(e.quote),d=r=>{let b=I(String(r.address));if(typeof r.symbol!="string"||!r.symbol.trim()||typeof r.decimals!="number"||!Number.isInteger(r.decimals)||r.decimals<0||r.decimals>255||![n.currency0,n.currency1].includes(b))throw new i("Hookr listed token metadata is invalid.");return{...r,address:b,chainId:k}},c=d(a),l=d(u);if(c.address===l.address)throw new i("Hookr listed token pair is invalid.");return{...e,poolId:s,key:n,token:c,quote:l}}async function se(o,m,e){try{let t=await o.http(P,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:m,arguments:e}}),signal:AbortSignal.timeout(15e3),redirect:"error"});if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=g(await t.json());if(n.error||n.id!==1)throw new Error("RPC failure");let s=g(n.result);if(s.isError)throw new Error("Tool failure");let a=g(s.structuredContent);if(a.status==="unavailable"||a.error)throw new Error("Unavailable");return a}catch{throw new i(`Hookr ${m} read is unavailable. Retry later; unavailable data is not an empty result.`)}}var O=se;function ke(o){let m=e=>H(e?"hookr_orders":"hookr_open_orders",re,[],async(t,n)=>{let s=t.limit??16;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>32)throw new i("Hookr page limit must be an integer from 1 to 32.");let a=o.clientFor(k),u=await a.getBlock();if(typeof u.number!="bigint"||typeof u.timestamp!="bigint"||u.timestamp<=0n)throw new i("Hookr order reads need a valid chain block and timestamp.");let d=new Proxy(Y(a),{get(h,f,p){return f==="readContract"?y=>h.readContract({...y,blockNumber:u.number}):Reflect.get(h,f,p)}}),c={...o,clientFor:()=>d},l=await d.readContract({address:w,abi:C,functionName:"lastOrderId"});if(typeof l!="bigint"||l<0n)throw new i("Could not read the last Hookr order ID. Coverage is unknown.");let r=t.cursor===void 0?l:B(t.cursor,"cursor");if(r>l)throw new i("Hookr cursor exceeds the latest order ID. Restart pagination.");let b=[],A=new Map,x=r,S=r>BigInt(s)?r-BigInt(s):0n;for(;r>S;){let h=r--,f=X(await d.readContract({address:w,abi:C,functionName:"getOrder",args:[h]}));if(Number(f.status)===0||BigInt(f.owner)===0n)throw new i(`Hookr order #${h} is missing. Coverage is unknown.`);if(e?!D(f.owner,n):Number(f.status)!==1)continue;let p=await q(c,h,{order:f,tokens:A});if(e){b.push(p);continue}let y=null,M=null,G=null,j=null,z=BigInt(p.expiry)<u.timestamp,L=p.fillable&&!z;if(L)try{let _=await d.readContract({address:w,abi:Z,functionName:"fillGasFloor",args:[BigInt(p.orderId)]}),T=await a.estimateGas({account:n,to:w,data:oe({abi:Z,functionName:"fill",args:[BigInt(p.orderId)]}),blockNumber:u.number}),v=await a.getGasPrice();if(typeof _!="bigint"||_<0n||typeof T!="bigint"||T<=0n||typeof v!="bigint"||v<0n)throw new Error("Invalid gas data");let U=(_*6n+4n)/5n,E=T>U?T:U;y=E.toString(),M=v.toString(),G=(E*v).toString(),j=(BigInt(p.bounty)-E*v).toString()}catch{}b.push({...p,fillable:L,expired:z,economics:{gasLimit:y,gasPrice:M,estimatedGasCost:G,bountyLessEstimatedGas:j,note:"Estimate only; excludes bounty claim gas and competition. Recheck the fill preview."}})}return{chainId:k,book:w,blockNumber:u.number.toString(),chainTime:u.timestamp.toString(),orders:b,scanned:{from:x.toString(),through:(r+1n).toString()},nextCursor:r>0n?r.toString():null,complete:r===0n}});return[m(!1),m(!0),H("hookr_order",{orderId:{...N,description:R.id("Hookr limit order")}},["orderId"],async e=>q(o,B(e.orderId,"orderId"))),H("hookr_pools",{token:{type:"string",description:R.address("listed token whose pools to return")},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of pools to return, 1 to 50."},cursor:{type:"string",pattern:"^[0-9]{1,6}$",description:"Paging cursor: the nextCursor from the previous pools page; omit for the first page."}},[],async e=>{if(e.token!==void 0)try{I(String(e.token))}catch{throw new i("Provide a valid token address.")}if(e.limit!==void 0&&(typeof e.limit!="number"||!Number.isInteger(e.limit)||e.limit<1||e.limit>50))throw new i("Pool page limit must be from 1 to 50.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||!/^[0-9]{1,6}$/.test(e.cursor)))throw new i("Provide the pool nextCursor from the previous page.");let t=await O(o,"hookr_pools",e);if(!Array.isArray(t.pools))throw new i("Hookr pool coverage is unknown. Retry later.");return{...t,pools:t.pools.map(n=>$(n)),chainId:k,source:P}}),H("hookr_pool",{poolId:ee,side:te,amountIn:{...N,description:'Order input amount in base units of the input token (quote token for buy, listed token for sell); read its decimals. Example: "1000000". Give with side and minAmountOut.'},minAmountOut:{...N,description:'Minimum output in base units of the output token (listed token for buy, quote token for sell); read its decimals. Example: "1000000". Give with side and amountIn.'}},["poolId"],async e=>{let t=F(e.poolId),n=[e.side,e.amountIn,e.minAmountOut].some(y=>y!==void 0);if(n&&(e.side!=="buy"&&e.side!=="sell"||e.amountIn===void 0||e.minAmountOut===void 0))throw new i("Provide side, amountIn and minAmountOut together for order-specific bounty bounds.");let s=n?B(e.amountIn,"amountIn"):void 0,a=n?B(e.minAmountOut,"minAmountOut"):void 0;if(s!==void 0&&(s>=1n<<128n||a>=1n<<128n))throw new i("Hookr order amounts must fit uint128 base units.");let u=await O(o,"hookr_pool",{poolId:t}),d=u.listing?$(u.listing,t):void 0,c={...u,...d?{listing:d}:{},chainId:k,source:P};if(!n)return{...c,bountyBounds:{status:"requires-order-terms",note:"The keeper bounty floor depends on the order. Supply side, amountIn and minAmountOut in base units. The batch-1 0.0005 ETH observation is not a permanent floor."}};if(!d)throw new i("Hookr pool key is unavailable; bounty floor is unknown.");let l=d.key,r=g(e.side==="buy"?d.quote:d.token),b=I(String(r.address))===l.currency0,A=o.clientFor(k),x=await A.getBlock(),S=await A.readContract({address:w,abi:C,functionName:"bountyBounds",args:[l,b,s,a],blockNumber:x.number});if(!Array.isArray(S)||S.length!==3||S.some(y=>typeof y!="bigint"||y<0n||y>=1n<<128n))throw new i("Hookr bounty bounds are unavailable; the floor is unknown.");let[h,f,p]=S;return{...c,bountyBounds:{status:"available",blockNumber:x.number.toString(),token:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",symbol:"ETH",decimals:18,chainId:k},minBounty:h.toString(),defaultBounty:f.toString(),maxBounty:p.toString(),effectiveFloor:(h>0n?h:f).toString(),note:"ETH wei for this order at this block. Oak create uses the positive minimum, or the default when minimum is zero; recheck at creation."}}}),H("hookr_quote",{poolId:ee,side:te,amountIn:{...V(),description:'Amount of the input token in base units (quote token for buy, listed token for sell); read its decimals. Example: "1000000" = 1 token with 6 decimals.'}},["poolId","side","amountIn"],async(e,t)=>{let n=F(e.poolId);if(e.side!=="buy"&&e.side!=="sell")throw new i("Hookr side must be buy or sell.");if(typeof e.amountIn!="string"||K(e.amountIn)<=0n)throw new i("Provide a positive amountIn in base units.");let s=await O(o,"hookr_pool",{poolId:n}),a=$(s.listing,n),u=g(e.side==="buy"?a.quote:a.token),d=I(String(u.address)),c=d==="0x0000000000000000000000000000000000000000"?18:await o.clientFor(k).readContract({address:d,abi:ne,functionName:"decimals"});if(typeof c!="number"||!Number.isInteger(c)||c<0||c>255||typeof u.symbol!="string")throw new i("Hookr input token metadata is unavailable.");let l=J(e.amountIn,c),r=await O(o,"hookr_quote",{poolId:n,side:e.side,amount:l,payer:t}),b=await O(o,"hookr_check_trade",{poolId:n,side:e.side,amount:l,wallet:t});return{chainId:k,source:P,input:{token:{address:d,symbol:u.symbol,decimals:c,chainId:k},amount:e.amountIn},quote:r,check:b,note:"Informational quote. Review pool rules; unknown trade checks do not authorize a trade."}})]}export{se as a,ke as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as w,d as A,i as T,m as C}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{c as w,d as A,i as T,m as C}from"./NWNYJ26T.js";import{b as c,j as _}from"./TI727O2H.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./XSD5NL7J.js";function c(t){if(typeof t!="string")return!1;let s=t.trim();return/^(?:0x)?[0-9a-f]{64}$/i.test(s)||/^(?:[a-z]+\s+){11}(?:[a-z]+)(?:(?:\s+[a-z]+){3}){0,4}$/i.test(s)}function d(t){if(c(t))throw new a("Unexpected signing-key environment value. Keep wallet keys local and use a service API key.")}function u(t,s=[]){let o=[{value:t,path:""}];for(;o.length;){let e=o.pop();if(typeof e.value=="string"&&e.value.includes("sk-raeto-"))throw new a("Wallet secrets and signed payloads are not accepted. Sign locally.");if(!(!e.value||typeof e.value!="object"))for(let[n,l]of Object.entries(e.value)){let r=e.path?`${e.path}.${n}`:n,i=n.replace(/[^a-z0-9]/gi,"").toLowerCase();if(/^(?:(?:api|raeto|access|client)key)$/.test(i)||n.includes("sk-raeto-"))throw new a("Wallet secrets and signed payloads are not accepted. Sign locally.");if(/^(?:(?:private|secret|wallet)keys?|mnemonic(?:phrase|words)?|seed(?:phrase|words|hex)?|recovery(?:phrase|words)|passphrase|password|signatures?|(?:raw)?signed(?:tx|transaction)s?|raw(?:tx|transaction)s?|serialized(?:tx|transaction)s?)$/.test(i)&&!(n==="signature"&&s.includes(r)))throw new a("Wallet secrets and signed payloads are not accepted. Sign locally.");o.push({value:l,path:r})}}}export{c as a,d as b,u as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as k,e as w,f as N,g as S}from"./
|
|
1
|
+
import{a as b,b as k,e as w,f as N,g as S}from"./QPY6UTLU.js";import{a as h}from"./66F5ZH34.js";import{c as g,g as E}from"./NWNYJ26T.js";import{b as d}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as v,erc20Abi as O,getAddress as _,parseAbi as I,zeroAddress as T}from"viem";var x=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),n=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=I(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),M={assets:{description:"One to twenty unique asset addresses to release from the Token Jar; the zero address means native ETH.",type:"array",minItems:1,maxItems:20,items:g},nonce:h("Token Jar release nonce from uniswap_token_jar, as a decimal string."),maxResourceAmount:h('Maximum amount of resource token in base units; use resource token decimals. Example: "1000000" = 1 resource token at 6 decimals.')};function D(a){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:M},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(k);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=a.clientFor(d),e=await s.getBlockNumber(),[R,C,u,f]=await Promise.all([s.readContract({address:n,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:n,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:n,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:n,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(C),x)||R===T)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await w(a,k(R),e),J=await Promise.all(c.map(async l=>({token:await w(a,l,e),amount:(l===T?await s.getBalance({address:x,blockNumber:e}):await s.readContract({address:l,abi:O,functionName:"balanceOf",args:[x],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:J,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let P=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>P)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[a.approval(p.address,n,String(u),d),a.unsignedTx({to:n,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(a,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{x as a,n as b,o as c,D as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as I}from"./FXOFR432.js";import{a}from"./O2J5I4VA.js";import{a as w}from"./XSD5NL7J.js";import{a as v}from"./JXOEJPJ4.js";import{isAddress as P,isHex as E,parseAbi as U}from"viem";var x=86400;function H(n){return Math.round((n+Number.EPSILON)*10)/10}function W(n,t,b,l,d,i=Math.floor(Date.now()/1e3)){let u=n.policy,f=(b.length>=1&&u.guardianThreshold>=1?12:0)+(u.timelock>=3600?10:0)+(u.ownerApprovalRequired||u.guardianThreshold>=2?4:0)+(t.length?4:0),p=n.checkpointCount===0n?0:Math.min(30,H(30*Math.log10(Number(n.checkpointCount)+1)/Math.log10(101))),m=n.status!==0||n.checkpointCount===0n||!d?0:i-Number(d.timestamp)<=x?20:i-Number(d.timestamp)<=7*x?12:i-Number(d.timestamp)<=30*x?6:0,r=l?Math.min(20,H(20*Math.max(0,i-Number(l.timestamp))/(30*x))):0,h=Math.round(f+p+m+r);return{total:h,grade:h>=80?"A":h>=60?"B":h>=40?"C":"D",breakdown:{recoveryProtection:{points:f,max:30},checkpointHistory:{points:Math.round(p),rawPoints:p,max:30},activity:{points:m,max:20},timeOnChain:{points:Math.round(r),rawPoints:r,max:20}},note:I}}function R(n){let t=v(n.slice(0,4096)),b,l=/^data:application\/json;base64,([A-Za-z0-9+/]*={0,2})$/.exec(n.slice(0,5500));if(l)try{let i=atob(l[1]);if(i.length<=4096){let u=JSON.parse(new TextDecoder().decode(Uint8Array.from(i,f=>f.charCodeAt(0))));u&&typeof u=="object"&&!Array.isArray(u)&&(b=u)}}catch{}let d=i=>typeof b?.[i]=="string"?v(b[i]):void 0;return{rawUri:t,name:d("name"),agentType:d("agentType"),description:d("description")}}function q(n){if(n===void 0)return 20;if(!Number.isSafeInteger(n)||Number(n)<1||Number(n)>50)throw new w("Explorer limit must be an integer from 1 to 50.");return Number(n)}var c=U(["function workflowCount() view returns (uint256)","function getWorkflow(uint256) view returns ((address owner,address pendingOwner,uint8 status,(uint8 guardianThreshold,bool ownerApprovalRequired,uint32 ownerFallbackDelay,uint32 timelock,uint32 approvalWindow,uint32 executionWindow) policy,uint64 checkpointCount,uint64 headSequence,bytes32 headHash,uint256 activeProposalId,string metadataURI))","function getExecutors(uint256) view returns (address[])","function getGuardians(uint256) view returns (address[])","function getCheckpoint(uint256,uint64) view returns ((bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp))","function getCheckpoints(uint256,uint64,uint256) view returns ((bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp)[])","function getCheckpointById(bytes32) view returns (uint256 workflowId,uint64 sequence,(bytes32 checkpointHash,bytes32 parentHash,uint64 parentSequence,bytes32 stateHash,bytes32 traceHash,bytes32 dataURIHash,address submitter,uint64 timestamp) checkpoint)","function activeProposalId(uint256) view returns (uint256)","function proposalCount(uint256) view returns (uint256)","function rollbackCount(uint256) view returns (uint256)","function recoveryOutcomeCount(uint256) view returns (uint256)","function getRollbackRecords(uint256,uint256,uint256) view returns ((uint256 proposalId,uint64 fromSequence,uint64 toSequence,uint64 executedAt)[])","function getRecoveryOutcomes(uint256,uint256,uint256) view returns ((bytes32 recoveryId,uint64 checkpointSequence,uint8 outcome,bytes32 resultHash,address recorder,uint64 recordedAt)[])"]);function T(n){if(n===void 0)return a.defaultCheckpointLimit;if(!Number.isInteger(n)||Number(n)<1||Number(n)>a.maxCheckpointLimit)throw new w("Checkpoint limit must be an integer from 1 to 25.");return Number(n)}async function D(n,t){if([t.workflowId!==void 0,t.address!==void 0,t.checkpointHash!==void 0].filter(Boolean).length>1)throw new w("Choose one Upoch selector: workflowId, address, or checkpointHash.");if(await n.getChainId()!==a.chainId)throw new w("Upoch reads require Robinhood Chain 4663.");if(t.checkpointHash!==void 0){if(typeof t.checkpointHash!="string"||!E(t.checkpointHash,{strict:!0})||t.checkpointHash.length!==66)throw new w("Provide a 32-byte Upoch checkpoint hash.");let[r]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"getCheckpointById",args:[t.checkpointHash]}]});return{workflowId:r[0],selectedCheckpoint:r[2],matchingWorkflowIds:[r[0]],workflowScanTruncated:!1}}if(t.workflowId!==void 0){if(!Number.isSafeInteger(t.workflowId)||Number(t.workflowId)<1)throw new w("Workflow IDs are positive 1-indexed integers.");let r=BigInt(Number(t.workflowId));return{workflowId:r,matchingWorkflowIds:[r],workflowScanTruncated:!1}}let l=t.address===void 0?t.wallet:t.address;if(typeof l!="string"||!P(l))throw new w("Provide a valid Upoch owner, executor, or guardian address.");let[d]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"workflowCount"}]}),i=Number(d);if(!Number.isSafeInteger(i)||i<0)throw new w("Epoch returned an invalid workflow count.");let u=Math.min(i,a.maxWorkflows);if(!u)throw new w("No Upoch workflow matched this address.");let f=Array.from({length:u},(r,h)=>h+1).flatMap(r=>[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[BigInt(r)]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[BigInt(r)]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[BigInt(r)]}]),p=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:f}),m=[];for(let r=0;r<u;r++){let h=p[r*3],g=p[r*3+1],o=p[r*3+2];[h.owner,...g,...o].some(y=>y.toLowerCase()===l.toLowerCase())&&m.push(BigInt(r+1))}if(!m.length)throw new w(`No Upoch workflow matched address ${l}${i>u?" within the first 100 workflows":""}.`);return{workflowId:m[m.length-1],matchingWorkflowIds:m,workflowScanTruncated:i>u}}async function L(n,t,b,l,d={}){let i=T(b),[u,f,p,m,r,h,g]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[t]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[t]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[t]},{address:a.epoch,abi:c,functionName:"activeProposalId",args:[t]},{address:a.epoch,abi:c,functionName:"proposalCount",args:[t]},{address:a.epoch,abi:c,functionName:"rollbackCount",args:[t]},{address:a.epoch,abi:c,functionName:"recoveryOutcomeCount",args:[t]}]}),o=u,y=o.checkpointCount>0n?[{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[t,0n]},{address:a.epoch,abi:c,functionName:"getCheckpoints",args:[t,o.checkpointCount>BigInt(i)?o.checkpointCount-BigInt(i):0n,BigInt(i)]}]:[],S=[...h>0n?[{address:a.epoch,abi:c,functionName:"getRollbackRecords",args:[t,h>5n?h-5n:0n,5n]}]:[],...g>0n?[{address:a.epoch,abi:c,functionName:"getRecoveryOutcomes",args:[t,g>5n?g-5n:0n,5n]}]:[]],[e,s]=await Promise.all([y.length?n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:y}):Promise.resolve([]),S.length?n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:S}):Promise.resolve([])]),k=e[0],A=e[1]??[];return{workflowId:t.toString(),status:o.status===0?"Active":o.status===1?"Paused":"unknown",owner:o.owner,pendingOwner:o.pendingOwner,executors:f,guardians:p,policy:{guardianThreshold:o.policy.guardianThreshold,ownerApprovalRequired:o.policy.ownerApprovalRequired,ownerFallbackDelaySeconds:o.policy.ownerFallbackDelay,timelockSeconds:o.policy.timelock,approvalWindowSeconds:o.policy.approvalWindow,executionWindowSeconds:o.policy.executionWindow},metadata:R(o.metadataURI),metadataTruncated:o.metadataURI.length>4096,upochScore:W(o,f,p,k,A[A.length-1]??k),checkpoints:{total:o.checkpointCount.toString(),headSequence:o.checkpointCount>0n?o.headSequence.toString():null,headHash:o.checkpointCount>0n?o.headHash:null,firstCheckpointAt:k?k.timestamp.toString():null,recent:A.map(C=>({...C,timestamp:C.timestamp.toString()})),selected:l?{...l,timestamp:l.timestamp.toString()}:void 0},recovery:{activeProposalId:m>0n?m.toString():null,proposalCount:r.toString(),rollbackCount:h.toString(),recoveryOutcomeCount:g.toString(),recent:s},matchingWorkflowIds:(d.matchingWorkflowIds??[t]).map(C=>C.toString()),coverage:{checkpointHistory:"complete",recoveryHistory:S.length?"recent-five":"complete",workflowScan:d.workflowScanTruncated?"partial-first-100":"complete"}}}async function _(n,t={}){let b=q(t.limit);if(t.status!==void 0&&!["all","Active","Paused"].includes(String(t.status)))throw new w("Explorer status must be all, Active, or Paused.");if(await n.getChainId()!==a.chainId)throw new w("Upoch reads require Robinhood Chain 4663.");let[l]=await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:[{address:a.epoch,abi:c,functionName:"workflowCount"}]}),d=Number(l);if(!Number.isSafeInteger(d)||d<0)throw new w("Epoch returned an invalid workflow count.");let i=Math.min(d,a.maxWorkflows),u=Array.from({length:i},(e,s)=>BigInt(s+1)).flatMap(e=>[{address:a.epoch,abi:c,functionName:"getWorkflow",args:[e]},{address:a.epoch,abi:c,functionName:"getExecutors",args:[e]},{address:a.epoch,abi:c,functionName:"getGuardians",args:[e]}]),f=u.length?await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:u}):[],p=Array.from({length:i},(e,s)=>({id:BigInt(s+1),workflow:f[s*3],executors:f[s*3+1],guardians:f[s*3+2]})),m=p.flatMap(({id:e,workflow:s})=>s.checkpointCount>0n?[{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[e,0n]},{address:a.epoch,abi:c,functionName:"getCheckpoint",args:[e,s.headSequence]}]:[]),r=m.length?await n.multicall({multicallAddress:"0xcA11bde05977b3631167028862bE2a173976CA11",allowFailure:!1,batchSize:0,contracts:m}):[],h=0,g=Math.floor(Date.now()/1e3),o=p.map(({id:e,workflow:s,executors:k,guardians:A})=>{let C=s.checkpointCount>0n?r[h++]:void 0,N=s.checkpointCount>0n?r[h++]:void 0;return{id:e,workflow:s,executors:k,guardians:A,first:C,head:N,score:W(s,k,A,C,N,g)}}).filter(e=>t.status===void 0||t.status==="all"||(t.status==="Active"?e.workflow.status===0:e.workflow.status===1));o.sort((e,s)=>s.score.total-e.score.total||Number(e.id-s.id));let y=o.reduce((e,s)=>e+(s.head&&g-Number(s.head.timestamp)<=x?1:0),0),S=o.slice(0,b).map((e,s)=>({rank:s+1,workflowId:e.id.toString(),...R(e.workflow.metadataURI),status:e.workflow.status===0?"Active":"Paused",owner:e.workflow.owner,upochScore:{total:e.score.total,grade:e.score.grade},checkpointCount:e.workflow.checkpointCount.toString(),lastCheckpointAt:e.head?.timestamp.toString()??null,guardianCount:e.guardians.length,executorCount:e.executors.length,agentUrl:`https://upoch.tech/app/agents/${e.id}`}));return{summary:{totalWorkflows:d,scannedWorkflows:i,totalCheckpoints:p.reduce((e,s)=>e+Number(s.workflow.checkpointCount),0),checkpointsLast24h:null,workflowsWithCheckpointLast24h:y,averageScore:o.length?Math.round(o.reduce((e,s)=>e+s.score.total,0)/o.length):0},agents:S,coverage:{workflows:i<d?"partial-first-100":"complete",recentCheckpointCount:"unavailable-head-only-read",statusFilter:t.status??"all"}}}export{W as a,c as b,T as c,D as d,L as e,_ as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ne,b as re,d as ae,e as se,f as ce,g as de}from"./XPEDQBLI.js";import{B as J}from"./BAIY32AV.js";import{c as te,d as ie}from"./XYPGLG6A.js";import{a as m,e as T,f as q,h as _,i as R,j as n,k as oe,l as E,m as x,n as C,o as P,p as A,q as I,r as B,t as N}from"./2E4I7CJ7.js";import{f as Y,g as Z,i as ee}from"./MQK6OP7S.js";import{a as X}from"./H5DY7CNB.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as fe,zeroAddress as S}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],he=t=>le.includes(t),F=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=ce.oneOf[0],ue={hookr_lp_add:{...F({target:{...F({position:j}),description:"Where to add liquidity: the existing Hookr family position."},liquidity:{...m,description:"Liquidity to add, in v4 liquidity base units (not a token amount); positive, and the position total stays below 2^127."},amount0Max:{...m,description:`Maximum of the pool's currency0 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Max:{...m,description:`Maximum of the pool's currency1 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})},hookr_lp_remove:F({position:j,liquidity:{...m,description:"Liquidity to remove, in v4 liquidity base units (not a token amount); positive and at most the position remaining liquidity."},amount0Min:{...m,description:`Minimum of the pool's currency0 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Min:{...m,description:`Minimum of the pool's currency1 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}}),hookr_lp_collect:F({position:j,deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})};function ye(t,r){if(!he(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=T(r,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=de(e?T(i.target,["position"],["position"]).position:i.position),a=l?0n:q(i.liquidity,127);if(!l&&!a)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),k=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:a,bound0:v,bound1:k,deadline:q(i.deadline,64)}}async function ke(t,r,d){let{block:i,poolId:e,position:l,pc:o,core:a,role:v}=r,k=(p,L=[])=>A(t,a,P(v),p,L,i.number),[$,H,U,O]=await Promise.all([k("config",[e]),A(t,B,P("registry"),"admission",[I,a],i.number),k("configSchemaHash"),k("recaptureConfig",[e])]),h=x($),u=x(H),f=x(u.caps),g=x(o.caps);if(u.implementation!==a||u.codeHash!==Y(a).codeHash||u.schemaHash!==_(U)||n(u.kind,8)!==0n||!n(u.gasLimit,32)||n(f.maxLpFeePips,24)>600000n||n(f.maxQuoteTakePips,24)>=1000000n||n(f.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let y=n(g.maxLpFeePips,24),b=n(g.maxQuoteTakePips,24),c=n(g.maxSubjectTakeBps,16),w=n(h.burnBps,16),pe=n(h.lpBps,16),D=n(h.protocolShareBps,16);if(y>600000n||y>n(f.maxLpFeePips,24)||n(o.baseLpFeePips,24)>y||n(h.maxFeePips,24)>y||b>n(f.maxQuoteTakePips,24)||c>n(f.maxSubjectTakeBps,16)||w+pe>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let M=R(o.advisory),z={gated:!1};if(M!==S){if(M!==N||o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");await Z(t,i.number,[N]);let p=await te(t,i.number,d),L=await ie(t,i.number,e,l.launcher,M);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let me=x(L.terms),W=q(me.tierPips,24);if(W>50000n||n(o.baseLpFeePips,24)+W>y||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L}let V=x(E(O,3)[0]);oe(V.on);let G=null,K=BigInt(_(await t.getStorageAt({address:I,slot:re(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(K&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let Q=(K>>200n&255n)!==0n;if(Q){let p=E(await A(t,B,P("registry"),"activeLaneOf",[I],i.number),4);if(R(p[0]),_(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");G=C({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return C({config:h,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:Q,lane:G})}async function ge(t,r,d,i){let e=ye(t,d);if(r.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=r.clientFor(4663),o=await ae(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let a=J({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!a.amount0&&!a.amount1||a.amount0>=1n<<127n||a.amount1>=1n<<127n||a.amount0>e.bound0||a.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let k=e.adding?await ke(l,o,i):null,$=null,H=null;try{$=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let U=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",O=`${o.key.currency0} / ${o.key.currency1}`,h=`${U} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${O} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${a.amount0}/${a.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${a.amount0}/${a.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.`,u=[],f=[],g=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(g.push({token:c===S?X:c,amount:w,...c===S?{to:e.position.launcher}:{}}),c!==S&&(u.push(r.approval(c,e.position.launcher,"0",4663),r.approval(c,e.position.launcher,w.toString(),4663)),f.push(r.approval(c,e.position.launcher,"0",4663))))}let y=u.length;return u.push(r.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===S?e.bound0.toString():"0",description:h,data:fe({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...f),await ee(l,o.block),{txs:u,inputs:g,summary:h,state:o,request:e,actionIndex:y,terms:C({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:a,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:$,coreCreditsReason:H,locks:v,entry:k,exactApprovals:u.filter((b,c)=>c!==y),refunds:e.adding?[e.bound0-a.amount0,e.bound1-a.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function be(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let r of t)T(r,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function $e(t,r){if(be(t),t.length!==r.length||t.some((d,i)=>d.to!==r[i].to||d.data!==r[i].data||d.value!==r[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function Te(t){return le.map(r=>({name:r,inputSchema:ue[r],execute:async(d,i)=>{let e=await ge(r,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,he as b,ue as c,ye as d,ge as e,be as f,$e as g,Te as h};
|
|
1
|
+
import{a as ne,b as re,d as ae,e as se,f as ce,g as de}from"./MGVX5EUH.js";import{B as J}from"./KLEJ3W4T.js";import{c as te,d as ie}from"./OSMOBKRQ.js";import{a as m,e as T,f as q,h as _,i as R,j as n,k as oe,l as E,m as x,n as C,o as P,p as A,q as I,r as B,t as N}from"./XRDLMTBJ.js";import{f as Y,g as Z,i as ee}from"./MQK6OP7S.js";import{a as X}from"./Z7FGEWO2.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as fe,zeroAddress as S}from"viem";var le=["hookr_lp_add","hookr_lp_remove","hookr_lp_collect"],he=t=>le.includes(t),F=t=>({type:"object",additionalProperties:!1,properties:t,required:Object.keys(t)}),j=ce.oneOf[0],ue={hookr_lp_add:{...F({target:{...F({position:j}),description:"Where to add liquidity: the existing Hookr family position."},liquidity:{...m,description:"Liquidity to add, in v4 liquidity base units (not a token amount); positive, and the position total stays below 2^127."},amount0Max:{...m,description:`Maximum of the pool's currency0 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Max:{...m,description:`Maximum of the pool's currency1 to deposit, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})},hookr_lp_remove:F({position:j,liquidity:{...m,description:"Liquidity to remove, in v4 liquidity base units (not a token amount); positive and at most the position remaining liquidity."},amount0Min:{...m,description:`Minimum of the pool's currency0 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},amount1Min:{...m,description:`Minimum of the pool's currency1 to receive, in base units of that token (18 decimals: "1000000000000000000" = 1 token).`},deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}}),hookr_lp_collect:F({position:j,deadline:{...m,description:"Latest time this action may execute, as Unix seconds; must be within the next 300 seconds of chain time."}})};function ye(t,r){if(!he(t))throw new s("Choose a supported Hookr family LP action.");let d=ue[t],i=T(r,Object.keys(d.properties),d.required),e=t==="hookr_lp_add",l=t==="hookr_lp_collect",o=de(e?T(i.target,["position"],["position"]).position:i.position),a=l?0n:q(i.liquidity,127);if(!l&&!a)throw new s("Hookr add/remove liquidity must be an exact positive integer; use collect for fees only.");let v=l?0n:q(i[e?"amount0Max":"amount0Min"],e?128:256),k=l?0n:q(i[e?"amount1Max":"amount1Min"],e?128:256);return{position:o,adding:e,collecting:l,liquidity:a,bound0:v,bound1:k,deadline:q(i.deadline,64)}}async function ke(t,r,d){let{block:i,poolId:e,position:l,pc:o,core:a,role:v}=r,k=(p,L=[])=>A(t,a,P(v),p,L,i.number),[$,H,U,O]=await Promise.all([k("config",[e]),A(t,B,P("registry"),"admission",[I,a],i.number),k("configSchemaHash"),k("recaptureConfig",[e])]),h=x($),u=x(H),f=x(u.caps),g=x(o.caps);if(u.implementation!==a||u.codeHash!==Y(a).codeHash||u.schemaHash!==_(U)||n(u.kind,8)!==0n||!n(u.gasLimit,32)||n(f.maxLpFeePips,24)>600000n||n(f.maxQuoteTakePips,24)>=1000000n||n(f.maxSubjectTakeBps,16)>1000n)throw new s("Hookr core admission or fee caps are unavailable or outside the reviewed limits.");let y=n(g.maxLpFeePips,24),b=n(g.maxQuoteTakePips,24),c=n(g.maxSubjectTakeBps,16),w=n(h.burnBps,16),pe=n(h.lpBps,16),D=n(h.protocolShareBps,16);if(y>600000n||y>n(f.maxLpFeePips,24)||n(o.baseLpFeePips,24)>y||n(h.maxFeePips,24)>y||b>n(f.maxQuoteTakePips,24)||c>n(f.maxSubjectTakeBps,16)||w+pe>1000n||D<2000n||D>5000n)throw new s("Hookr pool fee settings exceed the reviewed entry caps. Exit tools remain available.");let M=R(o.advisory),z={gated:!1};if(M!==S){if(M!==N||o.advisoryFailOpen!==!1||n(o.advisoryPhases,8)!==1n)throw new s("Hookr entry requires the reviewed fail-closed agent gate configuration.");await Z(t,i.number,[N]);let p=await te(t,i.number,d),L=await ie(t,i.number,e,l.launcher,M);if(!p.healthyIdentityOnly||!p.walletAgent||!("liquidityEntryAllowed"in L)||!L.liquidityEntryAllowed)throw new s("Hookr family entry needs a healthy gate and a current on-chain agent identity. Collect/remove do not need Hookr gate eligibility.");let me=x(L.terms),W=q(me.tierPips,24);if(W>50000n||n(o.baseLpFeePips,24)+W>y||n(o.advisoryGasLimit,32)<400000n||n(o.advisoryGasLimit,32)>2000000n)throw new s("Hookr gate surcharge or gas exceeds the pool caps.");z=L}let V=x(E(O,3)[0]);oe(V.on);let G=null,K=BigInt(_(await t.getStorageAt({address:I,slot:re(e),blockNumber:i.number})));if(BigInt(l.launcher)!==(K&(1n<<160n)-1n))throw new s("Hookr frozen Root record differs from the family Launcher.");let Q=(K>>200n&255n)!==0n;if(Q){let p=E(await A(t,B,P("registry"),"activeLaneOf",[I],i.number),4);if(R(p[0]),_(p[1]),n(p[2],32),n(p[3],16)>10000n)throw new s("Hookr recapture switch is malformed.");G=C({activeSwapSwitch:p,swapExecutorUsedByLpAction:!1,liquidityCallbackFloor:300000n+300000n/63n+5000n,floorSource:"Pinned HookrLane._flush; sender estimates the complete transaction, including EIP-150 overhead."})}return C({config:h,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:Q,lane:G})}async function ge(t,r,d,i){let e=ye(t,d);if(r.network==="testnet")throw new s("Hookr family LP actions require Robinhood Chain 4663.");let l=r.clientFor(4663),o=await ae(l,i,e.position);if(e.deadline<=o.block.timestamp||e.deadline>o.block.timestamp+300n)throw new s("Set a fresh Hookr LP deadline within the next 300 seconds of chain time.");if(!e.adding&&e.liquidity>o.liquidity)throw new s("Remove no more than the exact remaining Hookr family liquidity.");if(e.adding&&e.liquidity+o.liquidity>=1n<<127n)throw new s("Hookr resulting liquidity must fit int128 max.");let a=J({liquidity:e.liquidity,tickLower:o.tickLower,tickUpper:o.tickUpper,sqrtPriceX96:o.sqrtPriceX96,roundUp:e.adding});if(e.adding&&(!a.amount0&&!a.amount1||a.amount0>=1n<<127n||a.amount1>=1n<<127n||a.amount0>e.bound0||a.amount1>e.bound1))throw new s("Hookr rounded-up principal debts must fit the exact finite funding caps.");let v=t==="hookr_lp_remove"?await se(l,o):null;if(v?.currentlyLocked)throw new s("Hookr principal is locked on the parent-block clock. Collect fees now or wait until all principal locks expire.");let k=e.adding?await ke(l,o,i):null,$=null,H=null;try{$=(await Promise.all([o.key.currency0,o.key.currency1].map(c=>A(l,o.core,P("rulesV1"),"poolAccrued",[o.poolId,c],o.block.number)))).map((c,w)=>({token:o.tokens[w],amount:n(c).toString()}))}catch{H="Core credit forecast unavailable; receipt verification must identify any core payment separately. No zero is inferred."}let U=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",O=`${o.key.currency0} / ${o.key.currency1}`,h=`${U} Hookr family ${e.position.familyId}, member ${e.position.member}, Launcher ${e.position.launcher}. ${e.adding||!e.collecting?`Exact liquidity ${e.liquidity}; existing ticks ${o.tickLower} to ${o.tickUpper}.`:""} Recipient ${i}. Currencies ${O} (base units; decimals ${o.tokens[0].decimals}/${o.tokens[1].decimals}). ${e.adding?`Deposit caps ${e.bound0}/${e.bound1}; current rounded-up principal debts ${a.amount0}/${a.amount1}. Exact finite approvals are reset first and revoked after the add; unused funding returns to ${i} in the add transaction.`:`Principal minimums ${e.bound0}/${e.bound1}; current principal forecast ${a.amount0}/${a.amount1}. Fees cannot satisfy a principal minimum.`} Uncollected LP fee forecast ${o.fees[0]}/${o.fees[1]}, paid separately from principal. Any family accrual moved into the wallet\u2019s core claim ledger is reported separately after mining; this credit is not a wallet token receipt; pool pending recapture is not earned position fees. ${H??"Core credit forecast is separate in terms."} Deadline ${e.deadline}.`,u=[],f=[],g=[];if(e.adding)for(let[b,c]of[o.key.currency0,o.key.currency1].entries()){let w=b===0?e.bound0:e.bound1;w&&(g.push({token:c===S?X:c,amount:w,...c===S?{to:e.position.launcher}:{}}),c!==S&&(u.push(r.approval(c,e.position.launcher,"0",4663),r.approval(c,e.position.launcher,w.toString(),4663)),f.push(r.approval(c,e.position.launcher,"0",4663))))}let y=u.length;return u.push(r.unsignedTx({to:e.position.launcher,chainId:4663,value:e.adding&&o.key.currency0===S?e.bound0.toString():"0",description:h,data:fe({abi:ne(e.position),functionName:e.adding?"addLiquidity":"withdraw",args:e.adding?[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,e.deadline]:[e.position.familyId,Number(e.position.member),e.liquidity,e.bound0,e.bound1,i,e.deadline]})}),...f),await ee(l,o.block),{txs:u,inputs:g,summary:h,state:o,request:e,actionIndex:y,terms:C({request:d,blockNumber:o.block.number,blockHash:o.block.hash,poolId:o.poolId,poolKey:o.key,owner:i,recipient:i,range:{tickLower:o.tickLower,tickUpper:o.tickUpper},liquidityBefore:o.liquidity,liquidityDelta:e.adding?e.liquidity:-e.liquidity,principal:a,principalBounds:[e.bound0,e.bound1],uncollectedLpFees:o.fees.map((b,c)=>({token:o.tokens[c],amount:b})),coreCredits:$,coreCreditsReason:H,locks:v,entry:k,exactApprovals:u.filter((b,c)=>c!==y),refunds:e.adding?[e.bound0-a.amount0,e.bound1-a.amount1]:null,gasEstimate:null,gasEstimateReason:"Local sender estimates the ordered calls and confirms the maximum network fee."})}}function be(t){if(!Array.isArray(t)||!t.length||t.length>7)throw new s("Hookr LP requires only its exact finite approvals, one family action and cleanup.");for(let r of t)T(r,["to","data","value","chainId","description"],["to","data","value","chainId","description"])}function $e(t,r){if(be(t),t.length!==r.length||t.some((d,i)=>d.to!==r[i].to||d.data!==r[i].data||d.value!==r[i].value||d.chainId!==4663))throw new s("Hookr LP differs from the locally reconstructed exact family action, recipient, bounds, approvals or cleanup.")}function Te(t){return le.map(r=>({name:r,inputSchema:ue[r],execute:async(d,i)=>{let e=await ge(r,t,d,i);return{txs:e.txs,preview:await t.preview(e.txs,i),terms:e.terms,summary:e.summary}}}))}export{le as a,he as b,ue as c,ye as d,ge as e,be as f,$e as g,Te as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as h,m as x,n as l}from"./
|
|
1
|
+
import{k as h,m as x,n as l}from"./Y64GFBTA.js";import{g}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as y,erc20Abi as S,getAddress as f,parseAbi as R}from"viem";var W=[{chainId:1,vault:"0x57b68c4ea221ee8da6eb14ebdfccee5177567771",asset:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",gateway:"0xed8a2a23bf9d6818651527daaf3bf4ffeb53945f"},{chainId:42161,vault:"0xc7273772b87860097373d91b3880fd4cc61fba2d",asset:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",gateway:"0x67defe8d90c8cd013fd527669e76e0be420f1208"}].map(t=>({chainId:t.chainId,vault:f(t.vault),asset:f(t.asset),gateway:f(t.gateway)})),E=R(["function balanceOf(address) view returns (uint256)","function asset() view returns (address)","function yieldPool() view returns (address)","function maxWithdraw(address) view returns (uint256)","function convertToAssets(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function redeem(uint256,address,address) returns (uint256)","function withdraw(uint256,address,address) returns (uint256)"]),O=R(["function redeem(address,uint256,address,uint256) returns (uint256)","function withdraw(address,uint256,address,uint256) returns (uint256)"]),I={type:"string",pattern:"^[1-9][0-9]*$"},A={type:"integer",enum:[1,42161]};function T(t){let o=W.find(i=>i.chainId===x(t));if(!o)throw new r("Relay legacy vault exits support Ethereum (1) and Arbitrum (42161).");return o}function b(t){let o=l(t);if(o==="0")throw new r("Provide a positive Relay vault amount or limit.");return o}function H(t,o){let i=T(t.chainId),s=f(h(o));if(Object.keys(t).some(c=>!["chainId","mode","amount","native","minAssetsOut","maxSharesIn"].includes(c)))throw new r("Provide only the documented Relay vault exit arguments.");if(t.mode!=="redeem"&&t.mode!=="withdraw")throw new r("Choose redeem (shares) or withdraw (WETH amount).");if(t.native!==void 0&&typeof t.native!="boolean")throw new r("Provide native as a boolean.");let e=b(t.amount),n=t.native===!0,a=t.mode==="redeem";if(!a&&!n)throw new r("Direct WETH withdrawals cannot enforce maxSharesIn on-chain. Use native withdraw or redeem a fixed number of shares.");if(t.minAssetsOut!==void 0&&(!n||!a)||t.maxSharesIn!==void 0&&a)throw new r("minAssetsOut applies only to native redeem; maxSharesIn applies only to withdraw.");let d=n&&a?b(t.minAssetsOut):void 0,u=a?e:b(t.maxSharesIn),w=(c,p,v)=>({to:c,data:p,chainId:i.chainId,value:"0",description:v}),m=[];return n?(m.push(w(i.vault,y({abi:S,functionName:"approve",args:[i.gateway,BigInt(u)]}),`Approve exactly ${u} WETH-REL share base units for the Relay native gateway.`)),m.push(w(i.gateway,y({abi:O,functionName:t.mode,args:[i.vault,BigInt(e),s,BigInt(a?d:u)]}),`Relay legacy vault ${t.mode} to native ETH for ${s}.`))):m.push(w(i.vault,y({abi:E,functionName:t.mode,args:[BigInt(e),s,s]}),`Relay legacy vault ${t.mode} to WETH for ${s}.`)),{pin:i,txs:m,wallet:s,redeem:a,native:n,amount:e,maxSharesIn:u,minAssetsOut:d}}function L(t,o,i){let s=H(o,i).txs;if(t.length!==s.length||t.some((e,n)=>e.chainId!==s[n].chainId||h(e.to)!==h(s[n].to)||e.value!=="0"||!g(e.data,s[n].data)))throw new r("Relay vault transactions differ from the requested exit.")}var k=t=>{async function o(i,s){let e=T(i),n;try{n=t.clientFor(e.chainId)}catch(c){throw/No RPC URL configured for chain/.test(t.plainError(c))?new r(`Relay legacy vault reads and exits on chain ${e.chainId} need an RPC. Ask the operator to configure OAK_RPC_URL_${e.chainId} on the server. No vault balances were checked.`):c}if(await n.getChainId()!==e.chainId)throw new r("The RPC chain does not match the Relay vault chain.");let a=(c,p,v=[])=>n.readContract({address:c,abi:E,functionName:p,args:v});if(h(await a(e.vault,"asset"))!==h(e.asset))throw new r("Relay vault asset does not match the pinned WETH.");let d=l(String(await a(e.vault,"balanceOf",[s]))),u=f(h(await a(e.vault,"yieldPool"))),w=l(String(await a(e.vault,"convertToAssets",[BigInt(d)]))),m=l(String(await a(u,"maxWithdraw",[e.vault])));return{pin:e,shares:d,assets:w,liquidAssets:m,read:a}}return{tools:[{name:"relay_vault_status",inputSchema:{type:"object",description:"Read legacy vault shares and shared liquidity. Requires server OAK_RPC_URL_1 or OAK_RPC_URL_42161 for the selected chain; no API key. New deposits are unsupported.",additionalProperties:!1,required:["chainId"],properties:{chainId:{...A,description:"Legacy vault chain ID: 1 for Ethereum or 42161 for Arbitrum."}}},execute:async(i,s)=>{if(Object.keys(i).some(u=>u!=="chainId"))throw new r("Provide only the Relay vault chainId.");let{pin:e,shares:n,assets:a,liquidAssets:d}=await o(i.chainId,s);return{chainId:e.chainId,vault:e.vault,shares:{token:{address:e.vault,chainId:e.chainId,symbol:"WETH-REL",decimals:18},amount:n},assets:{token:{address:e.asset,chainId:e.chainId,symbol:"WETH",decimals:18},amount:a},liquidAssets:d,summary:"Relay legacy vault wind-down: new deposits are unsupported. Available yield-pool liquidity is shared by all LPs and may change. Withdraw with relay_vault_withdraw; gas is paid in ETH on the vault chain."}}},{name:"relay_vault_withdraw",inputSchema:{type:"object",additionalProperties:!1,required:["chainId","mode","amount"],properties:{chainId:{...A,description:"Legacy vault chain ID: 1 for Ethereum or 42161 for Arbitrum."},mode:{type:"string",enum:["redeem","withdraw"],description:"redeem fixes share input; withdraw fixes asset output (WETH or native ETH)."},amount:{...I,description:'Amount in base units: WETH-REL shares for redeem or WETH for withdraw (both 18 decimals: "1000000000000000000" = 1 WETH-REL share or 1 WETH).'},native:{type:"boolean",description:"Receive native ETH through the gateway."},minAssetsOut:{...I,description:'Minimum ETH output in base units for native redeem (18 decimals: "1000000000000000000" = 1 ETH).'},maxSharesIn:{...I,description:'Maximum WETH-REL shares in base units for withdraw (18 decimals: "1000000000000000000" = 1 WETH-REL).'}}},execute:async(i,s)=>{let e=H(i,s),n=await o(i.chainId,s),a=e.redeem?e.amount:l(String(await n.read(e.pin.vault,"previewWithdraw",[BigInt(e.amount)]))),d=e.redeem?l(String(await n.read(e.pin.vault,"previewRedeem",[BigInt(e.amount)]))):e.amount;if(BigInt(a)>BigInt(n.shares)||BigInt(a)>BigInt(e.maxSharesIn))throw new r("Relay vault exit exceeds your shares or maxSharesIn.");if(BigInt(d)>BigInt(n.liquidAssets))throw new r("Relay vault liquidity is insufficient. Withdraw less or retry when liquidity returns.");if(e.minAssetsOut!==void 0&&BigInt(d)<BigInt(e.minAssetsOut))throw new r("Relay vault output is below minAssetsOut.");let u=await t.preview(e.txs,s);return{txs:e.txs,preview:u,chainId:e.pin.chainId,expectedAssets:d,expectedShares:a,summary:`Relay legacy vault exit on chain ${e.pin.chainId}: ${a} share base units for about ${d} ${e.native?"ETH":"WETH"} base units (18 decimals), to ${e.wallet}. ${e.minAssetsOut?`Gateway minimum ${e.minAssetsOut}.`:e.redeem?"Direct ERC-4626 redeem has no calldata minimum output.":`Gateway maximum input ${e.maxSharesIn} share base units.`} Review the local preview and confirm before signing. No destination bridge or future yield is promised.`}}}]}};export{W as a,H as b,L as c,k as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Z}from"./M7CQPTRK.js";import{a as I,b as J,d as V}from"./RUTSEGGD.js";import{a as Q}from"./CEQNXF6A.js";import{a as E}from"./QYKXWBZC.js";import{K as y}from"./AXHFNE6L.js";import{c as $}from"./W7QNSNOH.js";import{a as H}from"./43LI5NKJ.js";import{a as N}from"./66F5ZH34.js";import{d as M,g as O,i as K}from"./NWNYJ26T.js";import{b}from"./TI727O2H.js";import{a as e}from"./XSD5NL7J.js";import{encodeFunctionData as Y,erc20Abi as X,getAddress as W,parseAbi as ee,zeroAddress as te}from"viem";var v={address:W("0xCeF73866b088766DeD46Ba71d9Bd7591B5e931d2"),symbol:"tNET",decimals:9,chainId:b},_={pair_oracle:["checkpoint"],futures:["open","close","marginCall","accrueCarry","sweepCarrySkim"],underwriting:["subscribe","redeem"],prize:["enter","enterWithNet","exit","exitToUsdg","lockTranche","earlyUnlock","pokeRebase"]},fe=x=>({tools:[{name:"netnet_desk_action",inputSchema:{type:"object",additionalProperties:!1,required:["program","operation"],properties:{program:{type:"string",enum:Object.keys(_),description:"Desk program: pair_oracle (price checkpoint), futures, underwriting or prize (WinNET)."},operation:{type:"string",enum:[...new Set(Object.values(_).flat())],description:"Action to run; it must be one the chosen program supports (see the program list in this tool)."},amount:N('Amount in base units of the token the operation spends or moves: tNET 9 decimals for futures and underwriting, USDG 6 or NET 9 for prize. Example: "1000000000" = 1 NET.'),minAmountOut:N('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9, underwriting shares). Example: "1000000" = 1 USDG.'),maxPayment:N('Most tNET you will pay for futures open (margin plus fee), in tNET base units (9 decimals). Example: "1000000000" = 1 tNET.'),sizeUsdWad:N('Futures position notional in USD as an 18-decimal wad in base units (1e18 = 1 USD). Example: "100000000000000000000" = 100 USD.'),isLong:{type:"boolean",description:"Futures open only: true for a long position, false for a short."},account:{type:"string",description:"Futures marginCall only: address of the trader to margin-call; they must be liquidatable."},referrer:{type:"string",description:"Prize enter only: optional referrer address recorded at the first deposit; cannot be your own wallet."},trancheIndex:N('Zero-based index of your WinNET tranche to lock or unlock early, as a decimal string. Example: "0".'),lockDraws:{enum:["7","30"],description:"Prize lockTranche only: commit the tranche for 7 or 30 draws."},maxPenaltyAssets:N('Prize earlyUnlock only: highest forfeited principal you accept, in NET base units (9 decimals). Example: "1000000000" = 1 NET.')}},execute:async(t,m)=>{try{if(H(m),typeof t.program!="string"||!Object.hasOwn(_,t.program)||typeof t.operation!="string"||!_[t.program].includes(t.operation))throw new e("Choose a supported finite NetNet desk operation.");let p=t.program,r=t.operation,P=E[p],z=Q[p],T=x.clientFor(b);if(await T.getChainId()!==b)throw new e("NetNet desk actions require chain 4663.");let D=await T.getBlock(),q=new Set(["program","operation"]),u=(n,s=[])=>T.readContract({address:P.address,abi:z,functionName:n,args:s,blockNumber:D.number}),h=(...n)=>n.forEach(s=>q.add(s)),A=()=>(h("amount"),y(t.amount)),S=()=>(h("minAmountOut"),y(t.minAmountOut)),d=n=>K(n,"Provide an explicit checksummed account.",M),l=[],a,c=0n,w="",g;if(p==="pair_oracle"){if(d(await u("pairContract"))!==Z)throw new e("The oracle does not use the pinned canonical pair.");w="Permissionless oracle checkpoint; it sends no reward to this wallet and may not yet produce a valid TWAP."}else if(p==="futures"||p==="underwriting"){if(d(await u("token"))!==v.address||await T.readContract({address:v.address,abi:X,functionName:"decimals",blockNumber:D.number})!==9)throw new e("This desk does not use the pinned valueless 9-decimal tNET test collateral.");let n=E.futures.address,s=E.underwriting.address;if(p==="futures"?d(await u("vault"))!==s:d(await u("clearinghouse"))!==n)throw new e("Futures and underwriting counterparties do not match the published pins.");if(w="Experimental tNET test program; tNET has no monetary value. Futures margin and underwriting capital can be lost. Utilization/ADL can prevent redemption. Prices and fees are read from the contract oracle; these calls encode no price floor.",r==="open"){if(h("isLong","sizeUsdWad","maxPayment"),typeof t.isLong!="boolean")throw new e("Provide isLong as a boolean.");let o=A(),f=y(t.sizeUsdWad);if(o>=1n<<128n||f>=1n<<128n)throw new e("Position margin and notional must fit uint128.");let k=d(await u("oracle"));if(k!==W("0xc8a11E8793F8714a159061369173dc86A0A5E23F"))throw new e("The futures oracle is not the published deployment.");let C=await T.readContract({address:k,abi:ee(["function marginPriceWad() view returns (uint256)"]),functionName:"marginPriceWad",blockNumber:D.number});if(C<=0n)throw new e("Futures margin price is unavailable.");let i=f*5n/10000n*1000000000n/C;if(c=o+i,a=v,c>y(t.maxPayment))throw new e("Margin plus taker fee exceeds maxPayment.");l=[t.isLong,f,o],w+=` Entry fee ${i} tNET base units; exact approval caps price drift and may require a fresh preview.`}else if(r==="marginCall"){h("account");let o=d(t.account);if(await u("liquidatable",[o])!==!0)throw new e("The selected futures trader is not liquidatable.");l=[o]}else if(r==="subscribe"){c=A(),a=v,l=[c];let[o,f]=await Promise.all([u("totalShares"),u("equityTokens")]);if(typeof o!="bigint"||typeof f!="bigint"||o>0n&&f===0n)throw new e("Underwriting share price is invalid.");let k=o===0n?c:c*o/f;if(k===0n||k<S())throw new e("Underwriting subscription rounds to zero or misses the local share minimum.");w+=` Current quote ${k} underwriting share units; the share minimum is a local check, not encoded calldata.`}else if(r==="redeem"){let o=A();if(o>await u("sharesOf",[m]))throw new e("The wallet has insufficient underwriting shares.");l=[o],g={token:v,amount:S()}}}else{let[n,s,o,f,k,C]=await Promise.all(["net","usdg","staking","sNet","controller","book"].map(i=>u(i)));if(d(n)!==I.address||d(s)!==$.address||d(o)!==V||d(f)!==J.address||d(k)!==E.draw.address||d(C)!==E.bonus.address)throw new e("WinNET token, staking, book or controller does not match its published pins.");if(w="WinNET principal is a fixed NET claim, exposed to NET price changes. Entry commits through three staking epochs; locks commit for 7 or 30 draws. Early unlock forfeits 1% of principal and cancels streak credits. Pair buys and sells each incur the NET trading tax; no prize or return is guaranteed.",r==="enter"||r==="enterWithNet"){h("referrer");let i=t.referrer===void 0?te:d(t.referrer);if(i===W(m))throw new e("WinNET does not permit self-referral.");c=A(),a=r==="enter"?$:I,l=r==="enter"?[c,S(),i]:[c,i],w+=` Referrer ${i} is recorded at the first deposit and cannot later be changed.`}else if(r==="exit"||r==="exitToUsdg"){let i=A();if(i>await u("principalOf",[m]))throw new e("WinNET exit exceeds this wallet\u2019s fixed principal.");l=r==="exit"?[i,m]:[i,S(),m],g={token:r==="exit"?I:$,amount:r==="exit"?i:y(t.minAmountOut)}}else if(r==="lockTranche"||r==="earlyUnlock"){h("trancheIndex");let i=y(t.trancheIndex,!0),U=await u("trancheAt",[m,i]);if(!Array.isArray(U)||typeof U[0]!="bigint"||U[0]===0n)throw new e("Choose a nonempty WinNET tranche.");if(r==="lockTranche"){if(h("lockDraws"),t.lockDraws!=="7"&&t.lockDraws!=="30")throw new e("Choose a 7- or 30-draw lock.");l=[i,BigInt(t.lockDraws)]}else{h("maxPenaltyAssets");let j=(U[0]+99n)/100n;if(j>y(t.maxPenaltyAssets,!0))throw new e("Early unlock exceeds maxPenaltyAssets in NET base units.");l=[i],w+=` Current irreversible forfeiture ${j} NET base units.`}}}if(Object.keys(t).some(n=>!q.has(n)))throw new e("Unexpected fields for this desk operation.");if(a&&await T.readContract({address:a.address,abi:X,functionName:"balanceOf",args:[m],blockNumber:D.number})<c)throw new e(`Top up ${a.symbol}; this action needs ${c} base units.`);let F=`NetNet ${p}.${r}, contract ${P.address}, chain ${b}, ordered values ${JSON.stringify(l,(n,s)=>typeof s=="bigint"?String(s):s)}. ${a?`Approve exactly ${c} ${a.symbol} base units (token ${a.address}, decimals ${a.decimals}). `:""}${w}`,L=[...a?[x.approval(a.address,P.address,c.toString(),b)]:[],x.unsignedTx({to:P.address,data:Y({abi:z,functionName:r,args:l}),value:"0",chainId:b,description:F})],R=await x.preview(L,m),B=0n,G=0n;for(let n of R.changes){if(n.token.chainId!==b||!/^-?\d+$/.test(n.amount))throw new e("Invalid desk preview metadata.");let s=BigInt(n.amount);if(s<0n){if(!a||!O(n.token.address,a.address)||n.token.decimals!==a.decimals)throw new e("Desk preview spends an unexpected wallet asset.");B-=s}if(g&&O(n.token.address,g.token.address)){if(n.token.decimals!==g.token.decimals)throw new e("Desk receipt decimals mismatch.");G+=s}}if(B>c||g&&G<g.amount)throw new e("Desk preview exceeds its input budget or misses the requested receipt minimum.");return{txs:L,preview:R,summary:F}}catch(p){throw new e(x.plainError(p))}}}]});export{v as a,fe as b};
|