@oakagentkit/core 0.2.4 → 0.2.6
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/amounts.d.ts +2 -0
- package/build/dist/api/amounts.js +1 -1
- package/build/dist/api/args.js +1 -1
- package/build/dist/api/gas.js +1 -1
- package/build/dist/api/grandfather.js +1 -1
- package/build/dist/api/guards.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/http.js +1 -1
- package/build/dist/api/merkle.js +1 -1
- package/build/dist/api/module.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.js +1 -1
- package/build/dist/api/modules/beefy/guard.js +1 -1
- package/build/dist/api/modules/beefy/index.js +1 -1
- package/build/dist/api/modules/beefy/liquidity.js +1 -1
- package/build/dist/api/modules/beefy/management.js +1 -1
- package/build/dist/api/modules/beefy/vaults.js +1 -1
- package/build/dist/api/modules/borro/abi.d.ts +149 -0
- package/build/dist/api/modules/borro/abi.js +1 -0
- package/build/dist/api/modules/borro/actions.d.ts +2 -0
- package/build/dist/api/modules/borro/actions.js +1 -0
- package/build/dist/api/modules/borro/checks.d.ts +151 -0
- package/build/dist/api/modules/borro/checks.js +1 -0
- package/build/dist/api/modules/borro/copy.d.ts +174 -0
- package/build/dist/api/modules/borro/copy.js +1 -0
- package/build/dist/api/modules/borro/index.d.ts +13 -0
- package/build/dist/api/modules/borro/index.js +1 -0
- package/build/dist/api/modules/borro/liquidity.d.ts +4 -0
- package/build/dist/api/modules/borro/liquidity.js +1 -0
- package/build/dist/api/modules/borro/pins.d.ts +264 -0
- package/build/dist/api/modules/borro/pins.js +1 -0
- package/build/dist/api/modules/borro/positions.d.ts +8 -0
- package/build/dist/api/modules/borro/positions.js +1 -0
- package/build/dist/api/modules/borro/rates.d.ts +20 -0
- package/build/dist/api/modules/borro/rates.js +1 -0
- package/build/dist/api/modules/borro/reader.d.ts +36 -0
- package/build/dist/api/modules/borro/reader.js +1 -0
- package/build/dist/api/modules/borro/types.d.ts +126 -0
- package/build/dist/api/modules/borro/types.js +0 -0
- package/build/dist/api/modules/chop/abi.d.ts +527 -0
- package/build/dist/api/modules/chop/abi.js +1 -0
- package/build/dist/api/modules/chop/actions.d.ts +24 -0
- package/build/dist/api/modules/chop/actions.js +1 -0
- package/build/dist/api/modules/chop/checks.d.ts +26 -0
- package/build/dist/api/modules/chop/checks.js +1 -0
- package/build/dist/api/modules/chop/copy.d.ts +5 -0
- package/build/dist/api/modules/chop/copy.js +1 -0
- package/build/dist/api/modules/chop/guard.d.ts +13 -0
- package/build/dist/api/modules/chop/guard.js +1 -0
- package/build/dist/api/modules/chop/index.d.ts +3 -0
- package/build/dist/api/modules/chop/index.js +1 -0
- package/build/dist/api/modules/chop/pins.d.ts +53 -0
- package/build/dist/api/modules/chop/pins.js +1 -0
- package/build/dist/api/modules/chop/positions.d.ts +3 -0
- package/build/dist/api/modules/chop/positions.js +1 -0
- package/build/dist/api/modules/chop/reader.d.ts +70 -0
- package/build/dist/api/modules/chop/reader.js +1 -0
- package/build/dist/api/modules/chop/types.d.ts +32 -0
- package/build/dist/api/modules/chop/types.js +0 -0
- package/build/dist/api/modules/clanker/extensions.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/clanker/manage.js +1 -1
- package/build/dist/api/modules/clanker/pool-config.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 +2 -2
- package/build/dist/api/modules/earn/copy.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/validation.js +1 -1
- package/build/dist/api/modules/gloam/abi.d.ts +89 -0
- package/build/dist/api/modules/gloam/abi.js +1 -0
- package/build/dist/api/modules/gloam/actions.d.ts +5 -0
- package/build/dist/api/modules/gloam/actions.js +1 -0
- package/build/dist/api/modules/gloam/checks.d.ts +17 -0
- package/build/dist/api/modules/gloam/checks.js +1 -0
- package/build/dist/api/modules/gloam/copy.d.ts +22 -0
- package/build/dist/api/modules/gloam/copy.js +2 -0
- package/build/dist/api/modules/gloam/index.d.ts +6 -0
- package/build/dist/api/modules/gloam/index.js +1 -0
- package/build/dist/api/modules/gloam/pins.d.ts +41 -0
- package/build/dist/api/modules/gloam/pins.js +1 -0
- package/build/dist/api/modules/gloam/types.d.ts +308 -0
- package/build/dist/api/modules/gloam/types.js +1 -0
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/proof-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/scan.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.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.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/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/perps-batch.js +1 -1
- package/build/dist/api/modules/meridian/perps-common.js +1 -1
- package/build/dist/api/modules/meridian/perps-guards.js +1 -1
- package/build/dist/api/modules/meridian/perps-intents.js +1 -1
- package/build/dist/api/modules/meridian/perps-stream.js +1 -1
- package/build/dist/api/modules/meridian/perps.d.ts +1 -0
- package/build/dist/api/modules/meridian/perps.js +1 -1
- package/build/dist/api/modules/meridian/predict-read.js +1 -1
- package/build/dist/api/modules/meridian/rfq.js +1 -1
- package/build/dist/api/modules/merkl/discovery.js +1 -1
- package/build/dist/api/modules/merkl/index.js +1 -1
- package/build/dist/api/modules/merkl/manage.js +1 -1
- package/build/dist/api/modules/merkl/protocol.js +1 -1
- package/build/dist/api/modules/morpho/allocator.js +1 -1
- package/build/dist/api/modules/morpho/bundles.js +1 -1
- package/build/dist/api/modules/morpho/in-kind.js +1 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.js +1 -1
- package/build/dist/api/modules/morpho/midnight.js +1 -1
- package/build/dist/api/modules/morpho/protocol.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/gateway.js +1 -1
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/convert.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/types.d.ts +16 -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/holder-directory.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.d.ts +1 -0
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/prices.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.js +1 -1
- package/build/dist/api/modules/pons/trade.js +1 -1
- package/build/dist/api/modules/poolstrade/index.js +1 -1
- package/build/dist/api/modules/priors/coverage.js +1 -1
- package/build/dist/api/modules/priors/discovery.js +1 -1
- package/build/dist/api/modules/priors/features.js +1 -1
- package/build/dist/api/modules/priors/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/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.d.ts +2 -0
- 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/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/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.d.ts +11 -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/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.d.ts +3 -0
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/scan-text.js +1 -1
- package/build/dist/api/modules/wormhole/swap-token-verdict.d.ts +11 -0
- package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -0
- package/build/dist/api/modules/wormhole/third-party-text.d.ts +13 -0
- package/build/dist/api/modules/wormhole/third-party-text.js +1 -0
- package/build/dist/api/modules/wormhole/token-check.d.ts +2 -0
- package/build/dist/api/modules/wormhole/token-check.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +36 -0
- package/build/dist/api/modules/wormhole/x402-client.js +1 -0
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/pricing.js +1 -1
- package/build/dist/api/routes.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.d.ts +1 -0
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/tx.js +1 -1
- package/build/dist/api/types.d.ts +6 -1
- package/build/dist/api/vendor-limits.js +1 -1
- package/build/dist/chunks/{ALRRW7SF.js → 2MT3G7YZ.js} +1 -1
- package/build/dist/chunks/{WPAF55SP.js → 2THSW4QN.js} +1 -1
- package/build/dist/chunks/{MKAPRRKF.js → 2TK3ETUO.js} +1 -1
- package/build/dist/chunks/{VVA72C6O.js → 2VXLVXIB.js} +1 -1
- package/build/dist/chunks/{ZE7EU2CS.js → 35KR3VSS.js} +1 -1
- package/build/dist/chunks/{ZYH4B2GR.js → 3GQ7A3VB.js} +1 -1
- package/build/dist/chunks/3VWVW7PX.js +1 -0
- package/build/dist/chunks/{WPFAEBE7.js → 3XNZUIRU.js} +1 -1
- package/build/dist/chunks/{PBQSJSZO.js → 43LI5NKJ.js} +1 -1
- package/build/dist/chunks/{QVYCJ6WV.js → 46KWRAYK.js} +1 -1
- package/build/dist/chunks/4DP2VPXR.js +3 -0
- package/build/dist/chunks/{47YN4OUI.js → 4EN6MQEI.js} +1 -1
- package/build/dist/chunks/{UHRCM7AG.js → 4HG6FRVH.js} +1 -1
- package/build/dist/chunks/{E6UU7DL2.js → 4I3OU56B.js} +1 -1
- package/build/dist/chunks/{WIVYKLQM.js → 52ELWNXJ.js} +1 -1
- package/build/dist/chunks/{5WUKOQIJ.js → 5AXWBSPG.js} +1 -1
- package/build/dist/chunks/{D6ZJPNK7.js → 5N3O42X6.js} +1 -1
- package/build/dist/chunks/{UA4O226F.js → 5SMVQCAP.js} +1 -1
- package/build/dist/chunks/{6L5KTE6Y.js → 5SZPNZG4.js} +1 -1
- package/build/dist/chunks/{6PY3IRDS.js → 64GOINYS.js} +1 -1
- package/build/dist/chunks/{5ZLOCQA4.js → 66F5ZH34.js} +1 -1
- package/build/dist/chunks/{XDZRO5JQ.js → 6I4NTKB2.js} +1 -1
- package/build/dist/chunks/{LVLVP5KQ.js → 6JAXZNZ3.js} +1 -1
- package/build/dist/chunks/{BXHNYCH2.js → 6O3Q5B6M.js} +1 -1
- package/build/dist/chunks/{MFCPL6LF.js → 6OGDTEGH.js} +1 -1
- package/build/dist/chunks/{43CSMYDO.js → 6WD4HHID.js} +1 -1
- package/build/dist/chunks/{XJEOEMDS.js → 6WZX7C4T.js} +1 -1
- package/build/dist/chunks/6YB3VOUL.js +1 -0
- package/build/dist/chunks/77CLMPM7.js +1 -0
- package/build/dist/chunks/{EKNSLLJK.js → 7GJ6SLEV.js} +1 -1
- package/build/dist/chunks/{S2TAJHHK.js → 7KWZ5QJU.js} +1 -1
- package/build/dist/chunks/{CTMA4BTM.js → 7QIO77VE.js} +1 -1
- package/build/dist/chunks/7QZOTRSA.js +2 -0
- package/build/dist/chunks/{IKEJCBYU.js → 7WSHW7KW.js} +1 -1
- package/build/dist/chunks/{PQC5635W.js → A7I4IWUB.js} +1 -1
- package/build/dist/chunks/ACW63WIL.js +20 -0
- package/build/dist/chunks/AEL62KCG.js +1 -0
- package/build/dist/chunks/{UPMGGK34.js → AFBEZXNV.js} +1 -1
- package/build/dist/chunks/{AUOXDNUO.js → AKYF5264.js} +1 -1
- package/build/dist/chunks/{HVM2EEXB.js → ALLLYOUG.js} +1 -1
- package/build/dist/chunks/APQYLJGS.js +1 -0
- package/build/dist/chunks/AW7AXQCZ.js +1 -0
- package/build/dist/chunks/{WOEKXQAH.js → AXRL3REN.js} +1 -1
- package/build/dist/chunks/{ECWGKLBW.js → BBTPRZ6T.js} +1 -1
- package/build/dist/chunks/{ALPYEM7B.js → BND2UFVW.js} +1 -1
- package/build/dist/chunks/{GHPREYQK.js → BOVMED7R.js} +1 -1
- package/build/dist/chunks/{57JFKIMK.js → BTPXJAUX.js} +1 -1
- package/build/dist/chunks/{ZGKVXFM5.js → C7AXJHBT.js} +1 -1
- package/build/dist/chunks/{5U7TCKX2.js → CBG5HARQ.js} +1 -1
- package/build/dist/chunks/{NA7R6J5N.js → CBLMQ5UU.js} +1 -1
- package/build/dist/chunks/CDPSMI3Z.js +1 -0
- package/build/dist/chunks/{5N4A5XAW.js → CHXBOXOD.js} +1 -1
- package/build/dist/chunks/{2ZUP7ZEV.js → CQEJSCFQ.js} +1 -1
- package/build/dist/chunks/{6AAARNZ3.js → DBNTZEAJ.js} +1 -1
- package/build/dist/chunks/{IQIWASRD.js → DHUDSOGR.js} +1 -1
- package/build/dist/chunks/{L7OQUHM5.js → DJN3JAWB.js} +1 -1
- package/build/dist/chunks/{YPM2UITD.js → DL6AEWEM.js} +1 -1
- package/build/dist/chunks/{CERNEJ2F.js → DW4V5PUY.js} +1 -1
- package/build/dist/chunks/E3RACZUY.js +1 -0
- package/build/dist/chunks/{MOPETB64.js → EGYVRQUR.js} +1 -1
- package/build/dist/chunks/{IQGY5FW7.js → ER47KGRM.js} +1 -1
- package/build/dist/chunks/{ZSQOMSOC.js → FEYAY6OZ.js} +1 -1
- package/build/dist/chunks/FIO6VC2J.js +1 -0
- package/build/dist/chunks/FJ4S4GHY.js +1 -0
- package/build/dist/chunks/{RPNAFUM5.js → FUDAXV5X.js} +1 -1
- package/build/dist/chunks/{I6KUORFT.js → GG6Y4OCJ.js} +1 -1
- package/build/dist/chunks/{3AXVB23N.js → GGHBFLRC.js} +1 -1
- package/build/dist/chunks/{4ALMYJJV.js → GGSAKCND.js} +1 -1
- package/build/dist/chunks/GNC6RXLT.js +1 -0
- package/build/dist/chunks/{3ESNHZT5.js → GRQYTVNT.js} +1 -1
- package/build/dist/chunks/{WVONJOWN.js → GSBIERZD.js} +1 -1
- package/build/dist/chunks/H43RNCX2.js +1 -0
- package/build/dist/chunks/{NYNJITCM.js → H6T5FXEX.js} +1 -1
- package/build/dist/chunks/HHXBUYHO.js +1 -0
- package/build/dist/chunks/{64WKYWZV.js → HKEMQBFA.js} +1 -1
- package/build/dist/chunks/{4YFVAYKR.js → HM72DH4V.js} +1 -1
- package/build/dist/chunks/{XFKVU46U.js → HQUVB7Z5.js} +1 -1
- package/build/dist/chunks/HS4DZPYT.js +1 -0
- package/build/dist/chunks/{OTIXQZ3X.js → HU7IMNBI.js} +1 -1
- package/build/dist/chunks/{ENX72ARB.js → HWX36XJI.js} +1 -1
- package/build/dist/chunks/{QRC4ZPDA.js → I26DMNJG.js} +1 -1
- package/build/dist/chunks/I55MURSJ.js +1 -0
- package/build/dist/chunks/I6PQW2JI.js +1 -0
- package/build/dist/chunks/{S3FPF537.js → IMO3GDA5.js} +1 -1
- package/build/dist/chunks/{BQICZFLR.js → IOYRL6AY.js} +1 -1
- package/build/dist/chunks/IPN6Z4JM.js +1 -0
- package/build/dist/chunks/{MKBNLGDD.js → IPRVIKYC.js} +1 -1
- package/build/dist/chunks/{EOQYLFXA.js → IVX4R5OL.js} +1 -1
- package/build/dist/chunks/IX3GZMTM.js +1 -0
- package/build/dist/chunks/JFYBH3DX.js +1 -0
- package/build/dist/chunks/{Y7RPSDD2.js → JKD2B6OX.js} +1 -1
- package/build/dist/chunks/JQOQMFWD.js +3 -0
- package/build/dist/chunks/{PSVOVZH7.js → JUZ5JU6D.js} +5 -5
- package/build/dist/chunks/{I4TGMF2C.js → JZS3E66E.js} +1 -1
- package/build/dist/chunks/{SSIENQVU.js → K3RDPI5J.js} +1 -1
- package/build/dist/chunks/{PADWZX7J.js → K4DHHQBI.js} +1 -1
- package/build/dist/chunks/{NB3LYS3G.js → KIFZ5ZSK.js} +1 -1
- package/build/dist/chunks/KVFZKPJT.js +1 -0
- package/build/dist/chunks/{EYFBVQ46.js → L5BLHY34.js} +1 -1
- package/build/dist/chunks/{GVPX5XCL.js → LKXO2BQS.js} +1 -1
- package/build/dist/chunks/{JPNYUEQP.js → LKZX4CAA.js} +1 -1
- package/build/dist/chunks/{LROVANUR.js → LYMNHO5T.js} +1 -1
- package/build/dist/chunks/{QSN6Y2K6.js → M2UXYCKH.js} +1 -1
- package/build/dist/chunks/{BNG2IWZL.js → M37654RL.js} +1 -1
- package/build/dist/chunks/{YAJYDD6C.js → M6LC6DRE.js} +1 -1
- package/build/dist/chunks/{AG67Z3SC.js → MOE3EVAL.js} +1 -1
- package/build/dist/chunks/{DVVFT42J.js → MRMR4QHA.js} +1 -1
- package/build/dist/chunks/{WWHCEMNB.js → N4Q6GN65.js} +1 -1
- package/build/dist/chunks/{S5WICHIS.js → NAZPDRIF.js} +1 -1
- package/build/dist/chunks/{HSFOWJ3Z.js → NKZKKCK2.js} +1 -1
- package/build/dist/chunks/{BAAXGB4K.js → NOFUKKP5.js} +1 -1
- package/build/dist/chunks/{5KUWLUPM.js → NWNYJ26T.js} +1 -1
- package/build/dist/chunks/{7UOOIDR3.js → O6ROOKY2.js} +1 -1
- package/build/dist/chunks/{KBXU7U6Q.js → O7HCEPQY.js} +1 -1
- package/build/dist/chunks/{LDT3QTSY.js → OJ4WJUPP.js} +1 -1
- package/build/dist/chunks/{WD37MEMZ.js → OLSP46ZD.js} +1 -1
- package/build/dist/chunks/{TPL4U3AQ.js → OOZSE2R7.js} +1 -1
- package/build/dist/chunks/OTXSKFUD.js +1 -0
- package/build/dist/chunks/{4TQQH7N6.js → P5AJSLZ7.js} +1 -1
- package/build/dist/chunks/{BK23XJXE.js → P5PYFK7L.js} +1 -1
- package/build/dist/chunks/{A6YQ5H24.js → PACN53TR.js} +1 -1
- package/build/dist/chunks/{K72EYD6R.js → PAHXBLCS.js} +1 -1
- package/build/dist/chunks/PAY5PD4H.js +1 -0
- package/build/dist/chunks/{SGEZIYJW.js → PIIHOXWF.js} +1 -1
- package/build/dist/chunks/{SQL6HD5E.js → PK66GCDT.js} +1 -1
- package/build/dist/chunks/PNA6UIE5.js +1 -0
- package/build/dist/chunks/{6FTYNYGF.js → PSBQWDYI.js} +1 -1
- package/build/dist/chunks/{W76QC2AW.js → PV5FDT6O.js} +1 -1
- package/build/dist/chunks/{42DQTKEO.js → PXT5YTWU.js} +1 -1
- package/build/dist/chunks/{4ISR2U72.js → PZGGE5D3.js} +1 -1
- package/build/dist/chunks/{IMRXZ7JB.js → Q42YI3EP.js} +1 -1
- package/build/dist/chunks/{F3BSEE52.js → QA2RRIES.js} +1 -1
- package/build/dist/chunks/{ZBFKKUNP.js → QA3UHEO3.js} +1 -1
- package/build/dist/chunks/{PWH464CJ.js → QBIY6FQN.js} +1 -1
- package/build/dist/chunks/QFNT73OF.js +1 -0
- package/build/dist/chunks/QHBS3PVU.js +1 -0
- package/build/dist/chunks/QQECG3WP.js +1 -0
- package/build/dist/chunks/{RVO3QK2B.js → QU5XKRGK.js} +1 -1
- package/build/dist/chunks/QW2OPEYJ.js +1 -0
- package/build/dist/chunks/{G7XSFUDL.js → QYVREJYC.js} +1 -1
- package/build/dist/chunks/{KA7BPBCV.js → ROFPXEQ5.js} +1 -1
- package/build/dist/chunks/{5MQ5KSSV.js → RTAHNWHN.js} +1 -1
- package/build/dist/chunks/{MDDHG34Y.js → RTGS7RIO.js} +1 -1
- package/build/dist/chunks/{3WXK2FUA.js → RUC7KH7A.js} +1 -1
- package/build/dist/chunks/{MBTARLZQ.js → RUX3RY7Y.js} +1 -1
- package/build/dist/chunks/{3VAJW6TQ.js → RVDUSNWW.js} +1 -1
- package/build/dist/chunks/{ET23SES4.js → S5CBVFHY.js} +1 -1
- package/build/dist/chunks/{WMNRP3YH.js → SIYUNOLI.js} +1 -1
- package/build/dist/chunks/{TNKVRVTH.js → SJJR4ZBZ.js} +1 -1
- package/build/dist/chunks/{UFVPMWPJ.js → SMYWWIE6.js} +1 -1
- package/build/dist/chunks/{Z4SRGAVL.js → SPJCSEKP.js} +1 -1
- package/build/dist/chunks/{YEXUSRIZ.js → T7TFUH5K.js} +1 -1
- package/build/dist/chunks/{SKMPKAZI.js → TAEZTP4L.js} +1 -1
- package/build/dist/chunks/{E3UBHTJO.js → TEJ7W534.js} +1 -1
- package/build/dist/chunks/{AWXJV2YH.js → TFDPEAVZ.js} +1 -1
- package/build/dist/chunks/{UOGHQLQX.js → TMVO2DAK.js} +1 -1
- package/build/dist/chunks/{QJFXLYZG.js → TPBAFS7K.js} +1 -1
- package/build/dist/chunks/{MXW2TP5P.js → TVWMTMEF.js} +1 -1
- package/build/dist/chunks/{GRIGSPD4.js → TX2EOIRS.js} +1 -1
- package/build/dist/chunks/{Y7PRJOIK.js → U2RMUVVY.js} +1 -1
- package/build/dist/chunks/{VV2HEIFI.js → U5PMVP56.js} +1 -1
- package/build/dist/chunks/{TBCSZDAF.js → UD2XMNIT.js} +1 -1
- package/build/dist/chunks/{F26FK47J.js → UNJJRQIU.js} +1 -1
- package/build/dist/chunks/V5JWGWXC.js +1 -0
- package/build/dist/chunks/V74F6IDY.js +1 -0
- package/build/dist/chunks/VCOTCVKN.js +1 -0
- package/build/dist/chunks/{MYFAKCQI.js → VEQBHI6O.js} +1 -1
- package/build/dist/chunks/VHV6WQ5F.js +1 -0
- package/build/dist/chunks/{7WQEPZJY.js → VNV6ZISN.js} +1 -1
- package/build/dist/chunks/{W2OJ57ZO.js → VYAJXLND.js} +1 -1
- package/build/dist/chunks/{MDV7GECM.js → VYYSL557.js} +1 -1
- package/build/dist/chunks/WCNHZYQQ.js +1 -0
- package/build/dist/chunks/{K22EXPWN.js → WIRBCS4W.js} +1 -1
- package/build/dist/chunks/{YRXT3HTW.js → WLMWWEP7.js} +1 -1
- package/build/dist/chunks/{NDW5DAFL.js → WP6RHXGN.js} +1 -1
- package/build/dist/chunks/{PLZKXQ76.js → WTXC3XKW.js} +1 -1
- package/build/dist/chunks/{WGL46F3S.js → WU7XIAXB.js} +1 -1
- package/build/dist/chunks/{5OKJEGBH.js → WV3A3OUU.js} +1 -1
- package/build/dist/chunks/{MGPHD4VV.js → X2P55AC3.js} +1 -1
- package/build/dist/chunks/{RNC463IM.js → XBE3B6Y2.js} +1 -1
- package/build/dist/chunks/XD6X3KTC.js +1 -0
- package/build/dist/chunks/{BIRMUW7Z.js → XKSVTN5X.js} +1 -1
- package/build/dist/chunks/XL3LLGIR.js +1 -0
- package/build/dist/chunks/XQA5LCL6.js +1 -0
- package/build/dist/chunks/{SDHPFXRM.js → XSKFKBDR.js} +1 -1
- package/build/dist/chunks/{TJWVY4VO.js → YCZPSMZ5.js} +1 -1
- package/build/dist/chunks/{JZXYLHI7.js → YDNTY67T.js} +1 -1
- package/build/dist/chunks/{2DUCTO5C.js → YN56C7PN.js} +1 -1
- package/build/dist/chunks/{E6RRXNV2.js → YRNXGQJC.js} +1 -1
- package/build/dist/chunks/YWRLY5EA.js +1 -0
- package/build/dist/chunks/YWSX6IE6.js +1 -0
- package/build/dist/chunks/{DP2NIYBP.js → YXTSWRV5.js} +1 -1
- package/build/dist/chunks/{MQYOG66Q.js → Z6LZGCVW.js} +1 -1
- package/build/dist/chunks/{OFI3Y55L.js → ZQAFFWDK.js} +1 -1
- package/build/dist/chunks/{NZXQWDGF.js → ZQWZGH7V.js} +1 -1
- package/build/dist/chunks/{TBIVTEP5.js → ZSN4IRI5.js} +1 -1
- package/build/dist/chunks/{ZET37EIG.js → ZV5HIQXC.js} +1 -1
- package/build/dist/chunks/{VHLINDDS.js → ZXJ24B4L.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/24CQ2SPB.js +0 -1
- package/build/dist/chunks/2OJAOVMG.js +0 -1
- package/build/dist/chunks/65EQECL3.js +0 -1
- package/build/dist/chunks/6YYCGUCU.js +0 -1
- package/build/dist/chunks/EU3OAJU2.js +0 -1
- package/build/dist/chunks/H4NYYJ3Z.js +0 -1
- package/build/dist/chunks/HTXKERNS.js +0 -1
- package/build/dist/chunks/JG27HM4P.js +0 -1
- package/build/dist/chunks/L6D26AMO.js +0 -1
- package/build/dist/chunks/O6L4BJP4.js +0 -1
- package/build/dist/chunks/SUFA2GKR.js +0 -1
- package/build/dist/chunks/UP7FBDMJ.js +0 -1
- package/build/dist/chunks/YHRUAQQK.js +0 -1
- package/build/dist/chunks/ZCOFMGPS.js +0 -1
- package/build/dist/chunks/ZCUXM52B.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./PBQSJSZO.js";import{a as j}from"./5ZLOCQA4.js";import{d as ne,f as te,g as v,i as oe}from"./5KUWLUPM.js";import{a as p,i as ee}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as U}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as ue,erc20Abi as V,getAddress as y,hashMessage as fe,keccak256 as pe,parseAbi as D,recoverMessageAddress as me,toHex as we,zeroAddress as _}from"viem";var g=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),A=y("0xf08c65564eb07d880021105489552080b08e4319"),re=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),ae=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),le=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),C={address:y(ee[p].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:p},N=D(["function acceptOffer((uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address nftCollateralContract,uint32 loanDuration,uint16 loanAdminFeeInBasisPoints,address loanERC20Denomination,address referrer) offer,(uint256 nonce,uint256 expiry,address signer,bytes signature) signature,(address revenueSharePartner,uint16 referralFeeInBasisPoints) borrowerSettings) returns (uint32)","function payBackLoan(uint32 loanId)","function getPayoffAmount(uint32 loanId) view returns (uint256)","function loanIdToLoan(uint32 loanId) view returns (uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address loanERC20Denomination,uint32 loanDuration,uint16 loanInterestRateForDurationInBasisPoints,uint16 loanAdminFeeInBasisPoints,address nftCollateralWrapper,uint64 loanStartTime,address nftCollateralContract,address borrower)","function loanRepaidOrLiquidated(uint32 loanId) view returns (bool)","function getWhetherNonceHasBeenUsedForUser(address user,uint256 nonce) view returns (bool)","function hub() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)"]),J=D(["function ownerOf(uint256 tokenId) view returns (address)","function approve(address spender,uint256 tokenId)","function supportsInterface(bytes4) view returns (bool)"]),ge=D(["function getContract(bytes32) view returns (address)"]),be=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],$=n=>te(n,"Provide the documented Longbow NFT object.");function F(n,d){if(Object.keys(n).some(i=>!d.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,d=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(d))throw new o(`NFT amounts and IDs must be uint${d} decimal strings.`);return BigInt(n)}function f(n){return oe(n,"Provide an NFT contract address.",ne)}var K=n=>{if(n>8640000000000n)throw new o("NFT deadline exceeds the supported timestamp range.");return new Date(Number(n)*1e3).toISOString()};function ie(n,d,i=!0){let s=$(n),e=$(d);F(s,M),F(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:f(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:f(s.loanERC20Denomination),referrer:f(s.referrer)};if(i&&(!v(t.nftCollateralContract,A)||!v(t.loanERC20Denomination,C.address)))throw new o("NFT borrowing supports only Robinhood Punks collateral and canonical USDG.");if(i&&(t.loanPrincipalAmount===0n||t.maximumRepaymentAmount<t.loanPrincipalAmount||t.loanDuration===0||t.referrer!==_))throw new o("NFT offer principal, payoff, duration or referrer is unsupported.");if(typeof e.signature!="string"||!/^0x(?:[0-9a-f]{2}){0,4096}$/i.test(e.signature))throw new o("Provide the existing lender\u2019s bounded hexadecimal offer signature; Oak does not sign lender offers.");let r={nonce:h(e.nonce),expiry:h(e.expiry),signer:f(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function he(n){let{offer:d,signature:i}=n;return pe(ue(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[d.loanERC20Denomination,d.loanPrincipalAmount,d.maximumRepaymentAmount,d.nftCollateralContract,d.nftCollateralId,d.referrer,d.loanDuration,d.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,g,BigInt(p)]))}function se(n,d){if(n.filter(s=>s.token.chainId===p&&v(s.token.address,C.address)).reduce((s,e)=>{if(e.token.decimals!==C.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==d)throw new o("NFT preview does not match the exact principal or payoff.")}async function de(n){let d=n.clientFor(p);if(await d.getChainId()!==p)throw new o("Longbow NFT loans require chain 4663.");let i=await d.getBlock(),s=(a,w,m,u=[])=>d.readContract({address:a,abi:w,functionName:m,args:u,blockNumber:i.number}),[e,t,r,l]=await Promise.all([s(g,N,"hub"),s(re,ge,"getContract",[we("PERMITTED_NFTS",{size:32})]),s(ae,be,"getNFTWrapper",[A]),s(A,J,"supportsInterface",["0x80ac58cd"])]);if(f(e)!==re||f(t)!==ae||f(r)!==le||l!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:d,block:i,read:s}}async function G(n,d){let i=Number(h(d,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(p);if(await s.getChainId()!==p)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,E,b=[])=>s.readContract({address:T,abi:I,functionName:E,args:b,blockNumber:e.number}),[r,l,a]=await Promise.all([t(g,N,"loanIdToLoan",[i]),t(g,N,"loanRepaidOrLiquidated",[i]),t(g,N,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof l!="boolean")throw new o("Invalid NFT loan state.");let[w,m,u,c,z,,,R,S,B,O]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let L=f(c)===C.address&&f(B)===A&&f(R)===le&&f(O)!==_,x=C;if(f(c)!==C.address){let[T,I]=await Promise.all([t(f(c),V,"symbol"),t(f(c),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");x={address:f(c),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:p}}if(typeof a!="bigint"||a!==BigInt(m)||a<BigInt(w))throw new o("NFT payoff does not match the fixed loan terms.");let P=BigInt(S)+BigInt(z);return{loanId:d,loanContract:g,chainId:p,blockNumber:e.number.toString(),collection:f(B),wrapper:f(R),tokenId:String(u),borrower:f(O),currency:x,supportedForActions:L,principalAmount:String(w),payoffAmount:a.toString(),startedAt:String(S),deadline:P.toString(),deadlineUtc:K(P),status:l?"repaid_or_liquidated":e.timestamp>P?"overdue":"active",repayable:!l&&e.timestamp<=P,warning:"After the on-chain deadline repayment is rejected; the lender can permanently take this NFT. Settled state alone does not distinguish repayment from liquidation."}}async function H(n,d){let i=await n.http(`https://longbow.credit/api/nft${d}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(1e4),redirect:"error"});if(!i.ok)throw new o("Longbow NFT discovery is unavailable. Retry the read; no loan was originated.");let s=await i.json();if(!Array.isArray(s)||s.length>1e3)throw new o("Longbow NFT discovery returned an invalid or oversized list.");return s.map($)}var ve=n=>{async function d(e,t,r){if(q(t),r){if(F(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await G(n,e.loanId);if(!b.supportedForActions)throw new o("This NFT loan is read-only in Oak; its collection, currency, wrapper or obligation-receipt borrower is not qualified for repayment.");let ce=h(e.maxPayoff);if(await de(n),b.borrower!==y(t))throw new o("Only this NFT loan\u2019s borrower may repay through Oak.");if(!b.repayable)throw new o("NFT loan is settled or overdue; repayment is unavailable.");let k=BigInt(b.payoffAmount);if(k>ce)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(p).readContract({address:C.address,abi:V,functionName:"balanceOf",args:[t]})<k)throw new o(`NFT repayment needs ${k} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${k} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(C.address,g,k.toString(),p),n.unsignedTx({to:g,data:W({abi:N,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:p,description:Y})],X=await n.preview(Q,t);return se(X.changes,-k),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}F(e,["offer","lenderSignature"]);let l=ie(e.offer,e.lenderSignature),{offer:a,signature:w}=l,{client:m,block:u,read:c}=await de(n),[z,R,S,B,O]=await Promise.all([c(A,J,"ownerOf",[a.nftCollateralId]),c(g,N,"getWhetherNonceHasBeenUsedForUser",[w.signer,w.nonce]),c(g,N,"paused"),c(g,N,"maximumLoanDuration"),c(g,N,"adminFeeInBasisPoints")]);if(f(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if(R!==!1||S!==!1||w.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==O)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let L=he(l),x=!1;try{x=v(await me({message:{raw:L},signature:w.signature}),w.signer)}catch{}if(!x){let b=await m.getCode({address:w.signer,blockNumber:u.number});b&&b!=="0x"&&(x=await c(w.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[fe({raw:L}),w.signature])==="0x1626ba7e")}if(!x)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let P=u.timestamp+BigInt(a.loanDuration),T=`Borrow ${a.loanPrincipalAmount} USDG base units; total payoff ${a.maximumRepaymentAmount} USDG base units. Escrow Robinhood Punks collection ${a.nftCollateralContract}, token ID ${a.nftCollateralId}. Estimated absolute repayment deadline ${K(P)} at snapshot ${u.number}; actual deadline is the mined start plus ${a.loanDuration} seconds. Read longbow_nft_loan after mining. Late repayment is rejected and you can permanently lose this NFT. Approve only this token ID to ${g}.`,I=[n.unsignedTx({to:A,data:W({abi:J,functionName:"approve",args:[g,a.nftCollateralId]}),value:"0",chainId:p,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:g,data:W({abi:N,functionName:"acceptOffer",args:[a,w,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:p,description:T})],E=await n.preview(I,t);return se(E.changes,a.loanPrincipalAmount),{txs:I,preview:E,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(P),deadlineIsEstimate:!0}}let i=(e,t,r,l)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,w)=>{try{return await l(a,w)}catch(m){throw new o(n.plainError(m))}}});async function s(e){q(e);let t=(r,l)=>({module:"longbow",id:`4663:${g.toLowerCase()}:${r}`,chainId:p,incomplete:!0,assets:[],description:`Longbow borrower NFT loans unreadable: ${n.plainError(l)} Use longbow_nft_loans or longbow_nft_loan for a known loanId.`});try{let r=await H(n,`/loans/borrower/${y(e)}`);if(r.length>100)throw new o("NFT loan discovery exceeds 100 rows; read specific loan IDs with longbow_nft_loan.");let l=new Set,a=[];for(let[w,m]of r.entries()){let u=`unreadable-${w}`;try{if(m.loanContract!==void 0&&f(m.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(m.loanId??m.id),32).toString(),l.has(u))continue;l.add(u);let c=await G(n,u);if(c.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(c.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${g.toLowerCase()}:${u}`,chainId:p,assets:[],description:`Longbow borrower NFT loan ${u}: ${c.status}, payoff debt ${c.payoffAmount} ${c.currency.symbol} base units (token ${c.currency.address}, decimals ${c.currency.decimals}); collateral ${c.collection} token ID ${c.tokenId} is escrowed. Deadline ${c.deadlineUtc}. ${c.repayable?"Use longbow_nft_repay before the deadline.":"Repayment is unavailable; the lender can permanently take the collateral."} Indexer discovery may be incomplete; lender interests are not included.`})}catch(c){a.push(t(u,c))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{F(e,[]);let t=await H(n,"/listings");return{chainId:p,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==p)throw new o("Longbow returned a listing on another chain.");return{id:U(String(r.id)),collection:f(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:f(r.borrower??r.owner),status:U(String(r.status)),note:r.note==null?null:U(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128}},["listingId"],async e=>{if(F(e,["listingId"]),typeof e.listingId!="string"||!/^[a-zA-Z0-9_-]{1,128}$/.test(e.listingId))throw new o("Provide the listingId returned by longbow_nft_listings.");let t=await H(n,`/listings/${encodeURIComponent(e.listingId)}/offers`);return{listingId:e.listingId,offers:t.map(r=>{let l=r.raw?$(r.raw):r,a={...$(l.offer??Object.fromEntries(M.map(m=>[m,l[m]])))};for(let m of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[m];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[m]=String(u))}let w=ie(a,typeof l.signature=="object"?l.signature:{nonce:l.nonce,expiry:l.expiry,signer:l.signer??l.lender,signature:l.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...w},(m,u)=>typeof u=="bigint"||m==="loanDuration"||m==="loanAdminFeeInBasisPoints"?String(u):u))}),caveat:"These are lender-signed terms from an untrusted indexer. Accept rechecks ownership, wrapper, nonce, expiry and signature on chain. Empty offers do not imply a discovery failure."}}),i("longbow_nft_loan",{loanId:j()},["loanId"],async e=>{if(F(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return G(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"]}},[],async(e,t)=>{F(e,["role"]),q(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let l=await H(n,`/loans/${r}/${y(t)}`);if(l.length>100)throw new o("NFT loan discovery exceeds 100 rows; read a specific loanId.");return{source:"Longbow indexer IDs, freshly checked on chain. Indexer completeness is not guaranteed.",loans:await Promise.all(l.map(a=>{if(a.loanContract!==void 0&&f(a.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");return G(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",properties:Object.fromEntries(M.map(e=>[e,{type:"string"}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",properties:Object.fromEntries(Z.map(e=>[e,{type:"string"}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>d(e,t,!1)),i("longbow_nft_repay",{loanId:j(),maxPayoff:j()},["loanId","maxPayoff"],(e,t)=>d(e,t,!0))]}};async function ke(n,d,i){if(await n.getChainId()!==p||i<0n||i>=1n<<256n)throw new o("NFT cleanup requires chain 4663 and the original token ID.");let s=D(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function approve(address,uint256)"]),e=await n.readContract({address:A,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,d))return;let t=await n.readContract({address:A,abi:s,functionName:"getApproved",args:[i]});if(v(t,g))return{to:A,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:p,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{g as a,A as b,re as c,ae as d,le as e,N as f,h as g,ie as h,he as i,G as j,ve as k,ke as l};
|
|
1
|
+
import{a as q}from"./43LI5NKJ.js";import{a as j}from"./66F5ZH34.js";import{d as ne,f as te,g as v,i as oe}from"./NWNYJ26T.js";import{a as p,i as ee}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as U}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as ue,erc20Abi as V,getAddress as y,hashMessage as fe,keccak256 as pe,parseAbi as D,recoverMessageAddress as me,toHex as we,zeroAddress as _}from"viem";var g=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),A=y("0xf08c65564eb07d880021105489552080b08e4319"),re=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),ae=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),le=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),C={address:y(ee[p].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:p},N=D(["function acceptOffer((uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address nftCollateralContract,uint32 loanDuration,uint16 loanAdminFeeInBasisPoints,address loanERC20Denomination,address referrer) offer,(uint256 nonce,uint256 expiry,address signer,bytes signature) signature,(address revenueSharePartner,uint16 referralFeeInBasisPoints) borrowerSettings) returns (uint32)","function payBackLoan(uint32 loanId)","function getPayoffAmount(uint32 loanId) view returns (uint256)","function loanIdToLoan(uint32 loanId) view returns (uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address loanERC20Denomination,uint32 loanDuration,uint16 loanInterestRateForDurationInBasisPoints,uint16 loanAdminFeeInBasisPoints,address nftCollateralWrapper,uint64 loanStartTime,address nftCollateralContract,address borrower)","function loanRepaidOrLiquidated(uint32 loanId) view returns (bool)","function getWhetherNonceHasBeenUsedForUser(address user,uint256 nonce) view returns (bool)","function hub() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)"]),J=D(["function ownerOf(uint256 tokenId) view returns (address)","function approve(address spender,uint256 tokenId)","function supportsInterface(bytes4) view returns (bool)"]),ge=D(["function getContract(bytes32) view returns (address)"]),be=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],$=n=>te(n,"Provide the documented Longbow NFT object.");function F(n,d){if(Object.keys(n).some(i=>!d.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,d=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(d))throw new o(`NFT amounts and IDs must be uint${d} decimal strings.`);return BigInt(n)}function f(n){return oe(n,"Provide an NFT contract address.",ne)}var K=n=>{if(n>8640000000000n)throw new o("NFT deadline exceeds the supported timestamp range.");return new Date(Number(n)*1e3).toISOString()};function ie(n,d,i=!0){let s=$(n),e=$(d);F(s,M),F(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:f(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:f(s.loanERC20Denomination),referrer:f(s.referrer)};if(i&&(!v(t.nftCollateralContract,A)||!v(t.loanERC20Denomination,C.address)))throw new o("NFT borrowing supports only Robinhood Punks collateral and canonical USDG.");if(i&&(t.loanPrincipalAmount===0n||t.maximumRepaymentAmount<t.loanPrincipalAmount||t.loanDuration===0||t.referrer!==_))throw new o("NFT offer principal, payoff, duration or referrer is unsupported.");if(typeof e.signature!="string"||!/^0x(?:[0-9a-f]{2}){0,4096}$/i.test(e.signature))throw new o("Provide the existing lender\u2019s bounded hexadecimal offer signature; Oak does not sign lender offers.");let r={nonce:h(e.nonce),expiry:h(e.expiry),signer:f(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function he(n){let{offer:d,signature:i}=n;return pe(ue(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[d.loanERC20Denomination,d.loanPrincipalAmount,d.maximumRepaymentAmount,d.nftCollateralContract,d.nftCollateralId,d.referrer,d.loanDuration,d.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,g,BigInt(p)]))}function se(n,d){if(n.filter(s=>s.token.chainId===p&&v(s.token.address,C.address)).reduce((s,e)=>{if(e.token.decimals!==C.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==d)throw new o("NFT preview does not match the exact principal or payoff.")}async function de(n){let d=n.clientFor(p);if(await d.getChainId()!==p)throw new o("Longbow NFT loans require chain 4663.");let i=await d.getBlock(),s=(a,w,m,u=[])=>d.readContract({address:a,abi:w,functionName:m,args:u,blockNumber:i.number}),[e,t,r,l]=await Promise.all([s(g,N,"hub"),s(re,ge,"getContract",[we("PERMITTED_NFTS",{size:32})]),s(ae,be,"getNFTWrapper",[A]),s(A,J,"supportsInterface",["0x80ac58cd"])]);if(f(e)!==re||f(t)!==ae||f(r)!==le||l!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:d,block:i,read:s}}async function G(n,d){let i=Number(h(d,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(p);if(await s.getChainId()!==p)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,E,b=[])=>s.readContract({address:T,abi:I,functionName:E,args:b,blockNumber:e.number}),[r,l,a]=await Promise.all([t(g,N,"loanIdToLoan",[i]),t(g,N,"loanRepaidOrLiquidated",[i]),t(g,N,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof l!="boolean")throw new o("Invalid NFT loan state.");let[w,m,u,c,z,,,R,S,B,O]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let L=f(c)===C.address&&f(B)===A&&f(R)===le&&f(O)!==_,x=C;if(f(c)!==C.address){let[T,I]=await Promise.all([t(f(c),V,"symbol"),t(f(c),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");x={address:f(c),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:p}}if(typeof a!="bigint"||a!==BigInt(m)||a<BigInt(w))throw new o("NFT payoff does not match the fixed loan terms.");let P=BigInt(S)+BigInt(z);return{loanId:d,loanContract:g,chainId:p,blockNumber:e.number.toString(),collection:f(B),wrapper:f(R),tokenId:String(u),borrower:f(O),currency:x,supportedForActions:L,principalAmount:String(w),payoffAmount:a.toString(),startedAt:String(S),deadline:P.toString(),deadlineUtc:K(P),status:l?"repaid_or_liquidated":e.timestamp>P?"overdue":"active",repayable:!l&&e.timestamp<=P,warning:"After the on-chain deadline repayment is rejected; the lender can permanently take this NFT. Settled state alone does not distinguish repayment from liquidation."}}async function H(n,d){let i=await n.http(`https://longbow.credit/api/nft${d}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(1e4),redirect:"error"});if(!i.ok)throw new o("Longbow NFT discovery is unavailable. Retry the read; no loan was originated.");let s=await i.json();if(!Array.isArray(s)||s.length>1e3)throw new o("Longbow NFT discovery returned an invalid or oversized list.");return s.map($)}var ve=n=>{async function d(e,t,r){if(q(t),r){if(F(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await G(n,e.loanId);if(!b.supportedForActions)throw new o("This NFT loan is read-only in Oak; its collection, currency, wrapper or obligation-receipt borrower is not qualified for repayment.");let ce=h(e.maxPayoff);if(await de(n),b.borrower!==y(t))throw new o("Only this NFT loan\u2019s borrower may repay through Oak.");if(!b.repayable)throw new o("NFT loan is settled or overdue; repayment is unavailable.");let k=BigInt(b.payoffAmount);if(k>ce)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(p).readContract({address:C.address,abi:V,functionName:"balanceOf",args:[t]})<k)throw new o(`NFT repayment needs ${k} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${k} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(C.address,g,k.toString(),p),n.unsignedTx({to:g,data:W({abi:N,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:p,description:Y})],X=await n.preview(Q,t);return se(X.changes,-k),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}F(e,["offer","lenderSignature"]);let l=ie(e.offer,e.lenderSignature),{offer:a,signature:w}=l,{client:m,block:u,read:c}=await de(n),[z,R,S,B,O]=await Promise.all([c(A,J,"ownerOf",[a.nftCollateralId]),c(g,N,"getWhetherNonceHasBeenUsedForUser",[w.signer,w.nonce]),c(g,N,"paused"),c(g,N,"maximumLoanDuration"),c(g,N,"adminFeeInBasisPoints")]);if(f(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if(R!==!1||S!==!1||w.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==O)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let L=he(l),x=!1;try{x=v(await me({message:{raw:L},signature:w.signature}),w.signer)}catch{}if(!x){let b=await m.getCode({address:w.signer,blockNumber:u.number});b&&b!=="0x"&&(x=await c(w.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[fe({raw:L}),w.signature])==="0x1626ba7e")}if(!x)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let P=u.timestamp+BigInt(a.loanDuration),T=`Borrow ${a.loanPrincipalAmount} USDG base units; total payoff ${a.maximumRepaymentAmount} USDG base units. Escrow Robinhood Punks collection ${a.nftCollateralContract}, token ID ${a.nftCollateralId}. Estimated absolute repayment deadline ${K(P)} at snapshot ${u.number}; actual deadline is the mined start plus ${a.loanDuration} seconds. Read longbow_nft_loan after mining. Late repayment is rejected and you can permanently lose this NFT. Approve only this token ID to ${g}.`,I=[n.unsignedTx({to:A,data:W({abi:J,functionName:"approve",args:[g,a.nftCollateralId]}),value:"0",chainId:p,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:g,data:W({abi:N,functionName:"acceptOffer",args:[a,w,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:p,description:T})],E=await n.preview(I,t);return se(E.changes,a.loanPrincipalAmount),{txs:I,preview:E,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(P),deadlineIsEstimate:!0}}let i=(e,t,r,l)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,w)=>{try{return await l(a,w)}catch(m){throw new o(n.plainError(m))}}});async function s(e){q(e);let t=(r,l)=>({module:"longbow",id:`4663:${g.toLowerCase()}:${r}`,chainId:p,incomplete:!0,assets:[],description:`Longbow borrower NFT loans unreadable: ${n.plainError(l)} Use longbow_nft_loans or longbow_nft_loan for a known loanId.`});try{let r=await H(n,`/loans/borrower/${y(e)}`);if(r.length>100)throw new o("NFT loan discovery exceeds 100 rows; read specific loan IDs with longbow_nft_loan.");let l=new Set,a=[];for(let[w,m]of r.entries()){let u=`unreadable-${w}`;try{if(m.loanContract!==void 0&&f(m.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(m.loanId??m.id),32).toString(),l.has(u))continue;l.add(u);let c=await G(n,u);if(c.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(c.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${g.toLowerCase()}:${u}`,chainId:p,assets:[],description:`Longbow borrower NFT loan ${u}: ${c.status}, payoff debt ${c.payoffAmount} ${c.currency.symbol} base units (token ${c.currency.address}, decimals ${c.currency.decimals}); collateral ${c.collection} token ID ${c.tokenId} is escrowed. Deadline ${c.deadlineUtc}. ${c.repayable?"Use longbow_nft_repay before the deadline.":"Repayment is unavailable; the lender can permanently take the collateral."} Indexer discovery may be incomplete; lender interests are not included.`})}catch(c){a.push(t(u,c))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{F(e,[]);let t=await H(n,"/listings");return{chainId:p,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==p)throw new o("Longbow returned a listing on another chain.");return{id:U(String(r.id)),collection:f(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:f(r.borrower??r.owner),status:U(String(r.status)),note:r.note==null?null:U(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128}},["listingId"],async e=>{if(F(e,["listingId"]),typeof e.listingId!="string"||!/^[a-zA-Z0-9_-]{1,128}$/.test(e.listingId))throw new o("Provide the listingId returned by longbow_nft_listings.");let t=await H(n,`/listings/${encodeURIComponent(e.listingId)}/offers`);return{listingId:e.listingId,offers:t.map(r=>{let l=r.raw?$(r.raw):r,a={...$(l.offer??Object.fromEntries(M.map(m=>[m,l[m]])))};for(let m of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[m];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[m]=String(u))}let w=ie(a,typeof l.signature=="object"?l.signature:{nonce:l.nonce,expiry:l.expiry,signer:l.signer??l.lender,signature:l.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...w},(m,u)=>typeof u=="bigint"||m==="loanDuration"||m==="loanAdminFeeInBasisPoints"?String(u):u))}),caveat:"These are lender-signed terms from an untrusted indexer. Accept rechecks ownership, wrapper, nonce, expiry and signature on chain. Empty offers do not imply a discovery failure."}}),i("longbow_nft_loan",{loanId:j()},["loanId"],async e=>{if(F(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return G(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"]}},[],async(e,t)=>{F(e,["role"]),q(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let l=await H(n,`/loans/${r}/${y(t)}`);if(l.length>100)throw new o("NFT loan discovery exceeds 100 rows; read a specific loanId.");return{source:"Longbow indexer IDs, freshly checked on chain. Indexer completeness is not guaranteed.",loans:await Promise.all(l.map(a=>{if(a.loanContract!==void 0&&f(a.loanContract)!==g)throw new o("The NFT indexer returned a loan from another contract.");return G(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",properties:Object.fromEntries(M.map(e=>[e,{type:"string"}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",properties:Object.fromEntries(Z.map(e=>[e,{type:"string"}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>d(e,t,!1)),i("longbow_nft_repay",{loanId:j(),maxPayoff:j()},["loanId","maxPayoff"],(e,t)=>d(e,t,!0))]}};async function ke(n,d,i){if(await n.getChainId()!==p||i<0n||i>=1n<<256n)throw new o("NFT cleanup requires chain 4663 and the original token ID.");let s=D(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function approve(address,uint256)"]),e=await n.readContract({address:A,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,d))return;let t=await n.readContract({address:A,abi:s,functionName:"getApproved",args:[i]});if(v(t,g))return{to:A,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:p,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{g as a,A as b,re as c,ae as d,le as e,N as f,h as g,ie as h,he as i,G as j,ve as k,ke as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as y,g as a,i as l,l as h,m as A,n as g}from"./
|
|
1
|
+
import{e as y,g as a,i as l,l as h,m as A,n as g}from"./NWNYJ26T.js";import{a as f,i as k}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,keccak256 as I,parseAbi as _,parseAbiParameters as P}from"viem";var u=k[f].clanker,O={type:"string",pattern:"^\\d+$"},$={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R=_(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))","function tokenRewards(address) view returns ((address token,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,uint256 positionId,uint256 numPositions,uint16[] rewardBps,address[] rewardAdmins,address[] rewardRecipients))","function feePreferences(address,uint256) view returns (uint8)","function updateRewardRecipient(address,uint256,address)","function updateRewardAdmin(address,uint256,address)","function updateFeePreference(address,uint256,uint8)"]),x="Provide a valid nonzero address.";function c(e,o=!1){let r=l(e,x);return o?r:h(r,x)}function F(e){return g(e,"Amount exceeds uint256.")}function w(e,o,r){if(typeof e!="number"||!Number.isSafeInteger(e)||e<o||e>r)throw new s(`Choose an integer from ${o} to ${r}.`);return e}function H(e,o){let r=Object.keys(e).find(n=>!o.includes(n));if(r)throw new s(`Unsupported Clanker input: ${r}.`)}function T(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new s("Provide bytes32 hexadecimal data.");return e}function b(e){return A(e,"Clanker returned an invalid amount.").toString()}async function v(e,o){let r=await e.clientFor(f).readContract({address:u.factory.address,abi:R,functionName:"tokenDeploymentInfo",args:[o]});if(!Array.isArray(r)||r.length!==4||typeof r[0]!="string"||!a(r[0],o)||!Array.isArray(r[3]))throw new s("The pinned factory did not identify this Clanker token.");let n=c(r[1]),d=c(r[2]);if(![u.locker.address,u.legacy_locker_v1.address].some(t=>a(t,d))||![u.fee_static_hook_v2.address,u.fee_dynamic_hook_v2.address].some(t=>a(t,n)))throw new s("This Clanker locker or hook has not been verified by Oak.");return{hook:n,locker:d,extensions:r[3].map(t=>c(t))}}async function K(e,o){let r=await v(e,o),n=await e.clientFor(f).readContract({address:r.locker,abi:R,functionName:"tokenRewards",args:[o]});if(!y(n)||typeof n.token!="string"||!a(n.token,o)||!y(n.poolKey)||!Array.isArray(n.rewardBps)||!Array.isArray(n.rewardAdmins)||!Array.isArray(n.rewardRecipients))throw new s("Clanker returned invalid reward configuration.");let d=n.poolKey,t={currency0:c(d.currency0),currency1:c(d.currency1),fee:w(d.fee,0,16777215),tickSpacing:w(d.tickSpacing,1,32767),hooks:c(d.hooks)};if(BigInt(t.currency0)>=BigInt(t.currency1)||!a(t.hooks,r.hook)||![t.currency0,t.currency1].some(i=>a(i,o)))throw new s("Clanker returned a mismatched pool key.");let p=n.rewardBps.length;if(!p||p>7||p!==n.rewardAdmins.length||p!==n.rewardRecipients.length)throw new s("Clanker returned mismatched rewards.");let m=n.rewardBps.map(i=>w(i,1,1e4));if(m.reduce((i,C)=>i+C,0)!==1e4)throw new s("Clanker returned invalid reward splits.");return{...r,poolKey:t,poolId:I(S(P("address,address,uint24,int24,address"),[t.currency0,t.currency1,t.fee,t.tickSpacing,t.hooks])),positionId:b(n.positionId),numPositions:b(n.numPositions),rewardBps:m,rewardAdmins:n.rewardAdmins.map(i=>c(i)),rewardRecipients:n.rewardRecipients.map(i=>c(i)),pairedToken:a(t.currency0,o)?t.currency1:t.currency0}}export{u as a,O as b,$ as c,R as d,x as e,c as f,F as g,w as h,H as i,T as j,b as k,v as l,K as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./WWHCEMNB.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./PBQSJSZO.js";import{a as U}from"./5ZLOCQA4.js";import{c as _,e as K,g as p,h as G}from"./5KUWLUPM.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};
|
|
1
|
+
import{d as R,e as z,g as V,h as S,k as I,l as k,m as W,n as X,t as E,u as Z,v as J,w as C,x as Q,y as ee,z as $}from"./N4Q6GN65.js";import{a as h,d as Y}from"./X5V2Z2NM.js";import{a as M}from"./43LI5NKJ.js";import{a as U}from"./66F5ZH34.js";import{c as _,e as K,g as p,h as G}from"./NWNYJ26T.js";import{a as l}from"./XSD5NL7J.js";import{a as B}from"./JXOEJPJ4.js";import{encodeFunctionData as P,hashTypedData as se,parseAbiItem as le,recoverTypedDataAddress as de,decodeFunctionData as ce}from"viem";import{isDeepStrictEqual as pe}from"node:util";var he={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},we=300n,q=240n,ge="0x1626ba7e";function L(t,c,s,g,v){let{chainId:b,registry:O}=S(t);return{domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:b,verifyingContract:O},types:he,primaryType:"AgentWalletSet",message:{agentId:c.toString(),newWallet:s,owner:g,deadline:v.toString()}}}async function j(t){let c=await t.clientFor(S(t).chainId).getBlock();if(typeof c?.timestamp!="bigint")throw new l("The chain time is unavailable; nothing was built.");return c.timestamp}async function ue(t,c,s,g){try{let H=await de({...c,signature:g});if(p(H,s))return!0}catch{}let v=t.clientFor(S(t).chainId),b=await v.getCode({address:s});if(!b||b==="0x")return!1;let O=se(c);try{return await v.readContract({address:s,abi:Y,functionName:"isValidSignature",args:[O,g]})===ge}catch{return!1}}var te={transactionHash:{...z,description:"After local submission, repeat the same arguments with the mined hash: Oak verifies the exact calldata, the emitted event and the resulting registry state."}},N=(t,c)=>({type:"object",additionalProperties:!1,required:c,properties:{...t,...te}});async function D(t,c){let{chainId:s,registry:g}=S(t),v=await t.clientFor(s).readContract({address:g,abi:h,functionName:"ownerOf",args:[c]});return M(v),v}async function x(t,c,s){let{chainId:g,registry:v}=S(t),b=await t.clientFor(g).readContract({address:v,abi:h,functionName:s,args:[c]});return M(b),b}var Re=t=>{let{chainId:c,registry:s}=S(t),g=(a,r,e)=>({name:a,inputSchema:r,execute:async(n,o)=>{try{return M(o),X(t,n.chainId),await e(n,o)}catch(d){throw new l(t.plainError(d))}}}),v=g("erc8004_wallet_proof",{type:"object",additionalProperties:!1,required:["agentId","newWallet"],description:"Read-only: the exact EIP-712 AgentWalletSet message that newWallet must sign to become the agent's verified payment wallet. Nothing is signed or sent.",properties:{agentId:R,newWallet:{..._,description:"The wallet that will receive payments; it must sign."}}},async a=>{let r=k(a.agentId),e=W(a.newWallet,"newWallet");if(I(e))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let[n,o]=await Promise.all([D(t,r),j(t)]),d=o+q;return{agentId:r.toString(),owner:n,newWallet:e,deadline:d.toString(),validForSeconds:Number(q),chainId:c,registry:s,typedData:L(t,r,e,n,d),next:"Have newWallet sign typedData (EIP-712, eth_signTypedData_v4; an ERC-1271 contract wallet returns its own signature). Never share a key. Then, from the agent owner or an approved operator, call erc8004_set_wallet with the same agentId, newWallet, deadline and the signature as walletSignature before the deadline. If newWallet is the Oak wallet, call erc8004_set_wallet without walletSignature and Oak signs locally.",note:"The owner field is the owner at this moment; a transfer before submission invalidates the signature. The registry rejects a deadline more than 5 minutes ahead."}}),b=g("erc8004_set_wallet",{type:"object",additionalProperties:!1,required:["agentId"],description:"Verify a payment wallet for the agent (setAgentWallet). The new wallet proves control with an EIP-712 signature. Omit walletSignature to sign locally with the Oak wallet when it is the new wallet.",properties:{agentId:R,newWallet:{..._,description:"Defaults to the Oak wallet."},deadline:U("Unix seconds from erc8004_wallet_proof; required with walletSignature."),walletSignature:{...V,description:"newWallet's EIP-712 signature of the erc8004_wallet_proof message."},continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},...te}},async(a,r)=>{let e=k(a.agentId),n=a.newWallet===void 0?r:W(a.newWallet,"newWallet");if(I(n))throw new l("To clear the payment wallet use erc8004_unset_wallet.");let o=async w=>{let f=C(w,s,h,"MetadataSet"),T=await x(t,e,"getAgentWallet");if(f.metadataKey!=="agentWallet"||!G(f.metadataValue?.toString(),n)||!p(T,n))throw new l("The registry event or current payment wallet does not match the verified wallet.");return{agentId:e.toString(),agentWallet:T,verified:!0,summary:"The payment wallet is now the signed wallet."}},d=w=>{try{let f=ce({abi:h,data:w});return f.functionName==="setAgentWallet"&&f.args[0]===e&&p(f.args[1],n)}catch{return!1}};if(a.transactionHash!==void 0){let w=await J(t,a.transactionHash,r,d,s);return o(w)}let u=async(w,f,T)=>{let F=L(t,e,n,T,w);if(!await ue(t,F,n,f))throw new l("That signature is not a valid signature by newWallet for this exact agent, owner and deadline; nothing was built.");let A=await j(t);if(A>w)throw new l("The wallet proof has expired; request a fresh erc8004_wallet_proof.");if(w>A+we)throw new l("The deadline is more than 5 minutes ahead; the registry would revert. Request a fresh erc8004_wallet_proof.");let ie=P({abi:h,functionName:"setAgentWallet",args:[e,n,w,f]});return $(t,r,{},{to:s,data:ie,description:`Verify ${n} as the payment wallet of ERC-8004 agent ${e}.`,summary:`Sets the verified payment wallet of agent ${e} to ${n} (setAgentWallet; the wallet's own signature was checked locally). The wallet is cleared again by any NFT transfer. The signature expires at ${w}; confirm before then. Repeat the arguments with transactionHash to verify.`,authority:async()=>{},verify:o})};if(a.continuation===void 0){if(a.signature!==void 0)throw new l("A signature needs its continuation; start erc8004_set_wallet again.");let w=await E(t,e,r,"set the payment wallet");if(a.walletSignature!==void 0){if(typeof a.deadline!="string"||!/^[0-9]+$/.test(a.deadline))throw new l("Provide the deadline from erc8004_wallet_proof together with walletSignature.");return u(BigInt(a.deadline),a.walletSignature,w)}if(!p(n,r))throw new l(`The payment wallet must prove control. Call erc8004_wallet_proof for ${n}, have that wallet sign the returned typedData, then call erc8004_set_wallet again with deadline and walletSignature.`);let f=await j(t)+q,T=L(t,e,n,w,f);return{steps:[{kind:"typedData",request:T}],continuation:{stage:"wallet",wallet:r,chainId:c,agentId:e.toString(),newWallet:n,owner:w,deadline:f.toString(),request:T},summary:`Sign locally: the Oak wallet proves control of ${n} so it can become the verified payment wallet of ERC-8004 agent ${e}. It is an EIP-712 message to the agent registry; it moves no funds. Oak then builds the setAgentWallet transaction for confirmation. The proof expires in ${q} seconds.`}}let i=a.continuation;if(!K(i)||i.stage!=="wallet"||i.chainId!==c||typeof i.wallet!="string"||!p(i.wallet,r)||i.agentId!==e.toString()||typeof i.newWallet!="string"||!p(i.newWallet,r)||typeof i.owner!="string"||typeof i.deadline!="string"||!/^[0-9]+$/.test(i.deadline))throw new l("This payment-wallet continuation does not match the wallet, chain and agent; start erc8004_set_wallet again.");if(typeof a.signature!="string")throw new l("Provide this wallet's signature of the payment-wallet proof.");let m=await E(t,e,r,"set the payment wallet");if(!p(m,i.owner))throw new l("The agent changed owner while signing; start erc8004_set_wallet again.");let y=L(t,e,r,m,BigInt(i.deadline));if(!pe(y,i.request))throw new l("The signed request differs from the payment-wallet proof Oak built; nothing was sent.");return u(BigInt(i.deadline),a.signature,m)}),O=g("erc8004_unset_wallet",N({agentId:R},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=P({abi:h,functionName:"unsetAgentWallet",args:[e]});return $(t,r,a,{to:s,data:n,description:`Clear the verified payment wallet of ERC-8004 agent ${e}.`,summary:`Clears the verified payment wallet of agent ${e} (unsetAgentWallet). Payers then have no registry-verified wallet until erc8004_set_wallet proves one. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"clear the payment wallet"),verify:async o=>{let d=C(o,s,h,"MetadataSet"),u=await x(t,e,"getAgentWallet");if(d.metadataKey!=="agentWallet"||d.metadataValue!=="0x"||!I(u))throw new l("The registry event or current payment wallet does not show a cleared wallet.");return{agentId:e.toString(),agentWallet:u,cleared:!0}}})}),H=g("erc8004_transfer",N({agentId:R,to:{..._,description:"The new owner. The agent NFT, its profile and its on-chain history move with it."}},["agentId","to"]),async(a,r)=>{let e=k(a.agentId),n=W(a.to,"recipient");if(I(n)||p(n,s))throw new l("Choose a wallet that can own the agent, not the zero address or the registry.");let o=await D(t,e);if(p(o,n))throw new l("That wallet already owns this agent.");let d=P({abi:h,functionName:"safeTransferFrom",args:[o,n,e]});return $(t,r,a,{to:s,data:d,description:`Transfer ERC-8004 agent ${e} from ${o} to ${n}.`,summary:`Transfers ownership of agent ${e} to ${n} (ERC-721 safeTransferFrom). This clears its verified payment wallet and token approval, ends Oak access linked to the current owner, and the new owner must run oak setup link and re-verify a payment wallet. Operators approved for all agents keep that approval. Repeat the arguments with transactionHash to verify.`,authority:()=>E(t,e,r,"transfer this agent"),verify:async u=>{let i=C(u,s,h,"Transfer"),[m,y]=await Promise.all([D(t,e),x(t,e,"getAgentWallet")]);if(!p(String(i.from),o)||!p(String(i.to),n)||i.tokenId!==e||!p(m,n))throw new l("The registry event or current owner does not match the transfer.");return{agentId:e.toString(),owner:m,previousOwner:o,agentWallet:y,transferred:!0,next:"The new owner links Oak with oak setup link and verifies a payment wallet again."}}})}),ae=g("erc8004_approve",N({agentId:R,operator:{..._,description:"The single address allowed to manage and transfer this one agent."},clear:{type:"boolean",description:"Remove the approval for this agent instead."}},["agentId"]),async(a,r)=>{let e=k(a.agentId),n=a.clear===!0;if(n===(a.operator!==void 0))throw new l("Provide operator to approve, or clear:true to remove the approval, not both.");let o=n?"0x0000000000000000000000000000000000000000":W(a.operator,"operator");if(!n&&I(o))throw new l("Use clear:true to remove an approval.");let d=await D(t,e);if(!n&&p(o,d))throw new l("The owner does not need an approval.");let u=P({abi:h,functionName:"approve",args:[o,e]});return $(t,r,a,{to:s,data:u,description:n?`Remove the approved operator of ERC-8004 agent ${e}.`:`Approve ${o} to manage ERC-8004 agent ${e}.`,summary:n?`Removes the single-agent approval on agent ${e}. Repeat with transactionHash to verify.`:`Lets ${o} update agent ${e}'s profile and metadata, set its payment wallet, request validations for it and TRANSFER it (ERC-721 approve). A transfer or another approve clears it. Repeat with transactionHash to verify.`,authority:()=>Z(t,e,r),verify:async i=>{let m=C(i,s,h,"Approval"),y=await x(t,e,"getApproved");if(m.tokenId!==e||!p(String(m.approved),o)||!p(y,o))throw new l("The registry event or current approval does not match.");return{agentId:e.toString(),approved:I(y)?null:y,owner:m.owner}}})}),ne=g("erc8004_set_operator",N({operator:_,approved:{type:"boolean",description:"true grants, false revokes."}},["operator","approved"]),async(a,r)=>{let e=W(a.operator,"operator");if(typeof a.approved!="boolean")throw new l("approved must be true or false.");if(I(e)||p(e,r))throw new l("Choose another wallet as the operator.");let n=P({abi:h,functionName:"setApprovalForAll",args:[e,a.approved]});return $(t,r,a,{to:s,data:n,description:`${a.approved?"Approve":"Revoke"} ${e} as operator for all this wallet's ERC-8004 agents.`,summary:a.approved?`Gives ${e} control of EVERY ERC-8004 agent this wallet owns now or later: profile and metadata edits, payment wallet, validation requests and TRANSFER of the NFTs (ERC-721 setApprovalForAll). Revoke with approved:false. Repeat with transactionHash to verify.`:`Revokes ${e}'s control of all agents this wallet owns. Repeat with transactionHash to verify.`,authority:async()=>{},verify:async o=>{let d=C(o,s,h,"ApprovalForAll"),u=await t.clientFor(c).readContract({address:s,abi:h,functionName:"isApprovedForAll",args:[r,e]});if(!p(String(d.owner),r)||!p(String(d.operator),e)||d.approved!==a.approved||u!==a.approved)throw new l("The registry event or current operator approval does not match.");return{owner:r,operator:e,approved:u}}})}),re=g("erc8004_set_metadata",N({agentId:R,key:{type:"string",minLength:1,maxLength:128,description:"Onchain metadata key. agentWallet is reserved."},value:{...V,description:"0x hex bytes; provide this or text."},text:{type:"string",description:"UTF-8 text stored as bytes; provide this or value."}},["agentId","key"]),async(a,r)=>{let e=k(a.agentId),n=Q(a.key),o=ee(a),d=P({abi:h,functionName:"setMetadata",args:[e,n,o]});return $(t,r,a,{to:s,data:d,description:`Set onchain metadata ${n} on ERC-8004 agent ${e}.`,summary:`Publishes ${(o.length-2)/2} bytes under the key ${B(n)} on agent ${e}. Onchain metadata is public, mutable and self-asserted. Repeat with transactionHash to verify.`,authority:()=>E(t,e,r,"set metadata"),verify:async u=>{let i=C(u,s,h,"MetadataSet"),m=await t.clientFor(c).readContract({address:s,abi:h,functionName:"getMetadata",args:[e,n]});if(i.agentId!==e||i.metadataKey!==n||i.metadataValue!==o||m!==o)throw new l("The registry event or current metadata does not match.");return{agentId:e.toString(),key:B(n),value:o,confirmed:!0}}})}),oe=g("erc8004_owned",{type:"object",additionalProperties:!1,description:"Read-only: the agent IDs a wallet owns on the registry (it is not enumerable, so this scans incoming Transfer logs and confirms each with ownerOf).",properties:{owner:{..._,description:"Defaults to the Oak wallet."},limit:{type:"integer",minimum:1,maximum:50,default:25}}},async(a,r)=>{let e=a.owner===void 0?r:W(a.owner,"owner"),n=typeof a.limit=="number"?Math.min(Math.max(1,Math.trunc(a.limit)),50):25,o=t.clientFor(c),d=await o.readContract({address:s,abi:h,functionName:"balanceOf",args:[e]});if(typeof d!="bigint")throw new l("Registry balance is unavailable.");if(d===0n)return{owner:e,balance:"0",agents:[],complete:!0};let u=d<BigInt(n)?Number(d):n,i=[],m=new Set,y=await o.getBlockNumber({cacheTime:0});for(let w=0;w<40&&i.length<u;w++){let f=y>9999999n?y-9999999n:0n,T=await o.getLogs({address:s,event:le("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:e},fromBlock:f,toBlock:y,strict:!0});for(let F of[...T].reverse()){let A=F.args.tokenId.toString();if(!(F.removed||m.has(A))&&(m.add(A),p(await D(t,BigInt(A)),e)&&i.push(A),i.length>=u))break}if(f===0n)break;y=f-1n}return{owner:e,balance:d.toString(),agents:i,complete:i.length===Number(d),note:i.length<Number(d)?"More agents exist than were listed (limit or scan budget); raise limit or look up a known ID with erc8004_identity.":void 0}});return{tools:[v,b,O,H,ae,ne,re,oe]}};export{we as a,L as b,Re as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as R}from"./
|
|
1
|
+
import{d as R}from"./LKXO2BQS.js";import{a as L,f as N,g as b}from"./PIIHOXWF.js";import{H,J as j,K as O,b as p,d as l,y as D}from"./2THSW4QN.js";import{g as d}from"./NWNYJ26T.js";import{a as y}from"./FWD4L3CJ.js";import{a as e}from"./XSD5NL7J.js";import{decodeAbiParameters as J,decodeFunctionData as A,encodeAbiParameters as K,encodeFunctionData as Q,erc20Abi as W,getAddress as Y,parseAbi as Z,parseAbiParameters as ee}from"viem";var U=Z(["function modifyLiquidities(bytes unlockData,uint256 deadline) payable"]),V=ee("bytes actions,bytes[] params");function de(f,$){return{tools:[{name:"uniswap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["operations"],properties:{operations:{type:"array",minItems:1,maxItems:20,items:{type:"object",additionalProperties:!1,required:["name","arguments"],properties:{name:{type:"string",enum:["uniswap_add","uniswap_collect","uniswap_remove"]},arguments:{anyOf:[H,j,O]}}}}}},async execute(a,v){if(b(a,["operations"]),!Array.isArray(a.operations)||a.operations.length<1||a.operations.length>20)throw new e("Provide 1 to 20 v4 liquidity operations.");let s="0x",c,h=[],P=0n,g=new Map,_=new Set,E=new Set;for(let t of a.operations){if(!t||typeof t!="object"||Array.isArray(t))throw new e("Each operation needs name and arguments.");let o=t;if(b(o,["name","arguments"]),!["uniswap_add","uniswap_collect","uniswap_remove"].includes(String(o.name))||!o.arguments||typeof o.arguments!="object"||Array.isArray(o.arguments))throw new e("Batch supports v4 add, collect and remove operations only.");let r=o.arguments;if(r.version!=="v4")throw new e("Every batch operation must explicitly select version v4.");if(r.initialPrice!==void 0||r.sqrtPriceX96!==void 0)throw new e("Create a pool before batching its liquidity operations.");if(r.tokenId!==void 0){let n=L(r.tokenId,"tokenId").toString();if(E.has(n))throw new e("Batch tokenIds must be distinct decimal strings.");E.add(n)}else if(o.name!=="uniswap_add")throw new e("Existing-position operations require tokenId.");let I=await $.tools.find(n=>n.name===o.name).execute(r,v),u=I.txs.at(-1);if(!u||!d(u.to,p))throw new e("Batch operation returned an unexpected destination.");P+=BigInt(u.value);for(let n of I.txs.slice(0,-1)){if(BigInt(n.value)!==0n)throw new e("Batch prerequisite cannot send native currency.");if(d(n.to,l)){let i=A({abi:R,data:n.data}),[B,G,X,z]=i.args;if(!d(G,p))throw new e("Batch Permit2 spender must be PositionManager.");let T=B.toLowerCase(),m=g.get(T),q=BigInt(z),C=(m?.amount??0n)+X;if(C>=1n<<160n)throw new e("Batch approval exceeds uint160.");g.set(T,{token:B,amount:C,expiration:m&&m.expiration<q?m.expiration:q})}else{let i=A({abi:W,data:n.data});if(i.functionName!=="approve"||!d(i.args[0],l))throw new e("Unexpected batch prerequisite.")}}let S=A({abi:U,data:u.data}),[F,x]=J(V,S.args[0]),k=F.slice(2).match(/../g)??[];if(k.length!==x.length)throw new e("Batch action/parameter count differs.");k.forEach((n,i)=>{n==="14"?_.add(x[i]):(s=`${s}${n}`,h.push(x[i]))});let M=S.args[1];c=c===void 0||M<c?M:c}for(let t of _)s=`${s}14`,h.push(t);let w=[];for(let t of g.values())w.push(f.approval(Y(t.token),l,t.amount.toString(),y),D(t.token,p,t.amount.toString(),t.expiration.toString()));return w.push(f.unsignedTx({to:p,data:Q({abi:U,functionName:"modifyLiquidities",args:[K(V,[s,h]),c]}),value:P.toString(),chainId:y,description:`Atomically modify ${a.operations.length} v4 positions; recipients are the signing wallet.`})),N(f,w,v,"Atomic v4 batch: every operation must succeed. Each position retains its own minimums; preview covers the complete action stream.")}}]}}export{U as a,V as b,de as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./
|
|
1
|
+
import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./VEQBHI6O.js";import{a as M}from"./OTXSKFUD.js";import{e as c}from"./NWNYJ26T.js";import{a as m,i as x}from"./FWD4L3CJ.js";import{a as l}from"./XSD5NL7J.js";import{a as h}from"./JXOEJPJ4.js";import{getAddress as q,isAddress as F}from"viem";var E=`https://api-v2.pendle.finance/core/v1/${m}/markets?limit=100`,T=x[m].pendle.marketFactory.address;function f(e){if(e?.aborted)throw new l("The request was cancelled.")}var C=e=>typeof e=="number"&&Number.isFinite(e);function p(e){return typeof e=="string"&&F(e,{strict:!1})?q(e):void 0}function I(e){if(!c(e))return"a row was not an object";let t=p(e.address);if(!t)return"a row had no valid market address";let n=c(e.pt)?p(e.pt.address):void 0,r=c(e.yt)?p(e.yt.address):void 0,o=c(e.sy)?p(e.sy.address):void 0;if(!n||!r||!o)return`market ${t} had no valid PT, YT and SY addresses`;let i=typeof e.expiry=="string"?Date.parse(e.expiry):Number.NaN;if(!Number.isFinite(i)||i%1e3!==0||i<=0)return`market ${t} had no valid end date`;if(typeof e.isActive!="boolean")return`market ${t} had no active flag`;let a=c(e.pt)&&typeof e.pt.symbol=="string"?e.pt.symbol:typeof e.name=="string"?e.name:t,s=c(e.liquidity)&&C(e.liquidity.usd)&&e.liquidity.usd>=0?e.liquidity.usd:void 0;return{market:t,sy:o,pt:n,yt:r,expiry:i/1e3,active:e.isActive,label:h(a),source:"api",...C(e.impliedApy)?{impliedApy:e.impliedApy}:{},...s!==void 0?{liquidityUsd:s}:{}}}async function D(e,t={}){let n=await v(e,E,{method:"GET",headers:{"User-Agent":"oak-core/pendle",Accept:"application/json"},...t.signal?{signal:t.signal}:{}},i=>c(i)&&Array.isArray(i.results)),r=[],o=[];for(let i of n.results){let a=I(i);typeof a=="string"?o.push(a):r.push(a)}return{rows:r,dropped:o}}var L=10000000n,B=1000000n,W=52515580n,O=new WeakMap;async function U(e,t,n){f(n);let r=await e.getBlockNumber(),o=L;for(;t.next<=r;){f(n);let i=t.next,a=i+o-1n>r?r:i+o-1n;try{let s=await e.getLogs({address:T,event:S,fromBlock:i,toBlock:a});for(let u of s){let d=p(u.args.market);d&&t.found.add(d)}t.next=a+1n}catch{if(o<=B)throw new l("Oak can't list Pendle markets from the chain because the node refused the history request.");o/=2n}}return[...t.found]}function $(e,t={}){let n=O.get(e);n||(n={next:W,found:new Set,turn:Promise.resolve()},O.set(e,n));let r=n,o=r.turn.then(()=>U(e,r,t.signal));return r.turn=o.catch(()=>{}),o}async function _(e,t,n=Math.floor(Date.now()/1e3),r={}){f(r.signal);let o=await y(e,t.flatMap(s=>[{address:s,abi:b,functionName:"readTokens"},{address:s,abi:b,functionName:"expiry"}])),i=t.flatMap((s,u)=>{let d=o[u*2],k=o[u*2+1];if(!d.ok||!k.ok||!Array.isArray(d.value)||typeof k.value!="bigint")return[];let[w,g,A]=d.value.map(p),R=Number(k.value);return w&&g&&A&&Number.isSafeInteger(R)?[{market:s,sy:w,pt:g,yt:A,end:R}]:[]});f(r.signal);let a=await y(e,i.map(s=>({address:s.pt,abi:N,functionName:"symbol"})));return i.map((s,u)=>{let d=a[u];return{market:s.market,sy:s.sy,pt:s.pt,yt:s.yt,expiry:s.end,active:s.end>n,label:h(d.ok&&typeof d.value=="string"?d.value:s.market),source:"chain"}})}async function Y(e,t,n={}){return _(e,await $(e,n),t,n)}async function X(e,t,n){let[r]=await y(e,[{address:T,abi:P,functionName:"isValidMarket",args:[t]}]);if(!r.ok)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");if(r.value!==!0)throw new l("This isn't a market the Pendle factory created. Oak won't use this market.");let[o]=await _(e,[t],n);if(!o)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");return o}async function Z(e,t){f(t.signal);try{return{source:"api",...await D(e.http,t)}}catch(n){if(!t.allowChain||n instanceof M)throw n;return f(t.signal),{source:"chain",rows:await Y(e.clientFor(m),t.now,t),dropped:[]}}}export{E as a,f as b,D as c,W as d,$ as e,_ as f,Y as g,X as h,Z as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ne,b as re,d as ae,e as se,f as ce,g as de}from"./
|
|
1
|
+
import{a as ne,b as re,d as ae,e as se,f as ce,g as de}from"./A7I4IWUB.js";import{A as J}from"./2THSW4QN.js";import{c as te,d as ie}from"./CBLMQ5UU.js";import{a as m,e as T,f as q,h as _,i as E,j as n,k as oe,l as B,m as x,n as C,o as P,p as A,q as I,r as M,t as N}from"./T7TFUH5K.js";import{f as Y,g as Z,i as ee}from"./MQK6OP7S.js";import{a as W}from"./QHBS3PVU.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"],ye=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}),liquidity:m,amount0Max:m,amount1Max:m,deadline:m}),hookr_lp_remove:F({position:j,liquidity:m,amount0Min:m,amount1Min:m,deadline:m}),hookr_lp_collect:F({position:j,deadline:m})};function he(t,r){if(!ye(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,O,R]=await Promise.all([k("config",[e]),A(t,M,P("registry"),"admission",[I,a],i.number),k("configSchemaHash"),k("recaptureConfig",[e])]),y=x($),u=x(H),f=x(u.caps),g=x(o.caps);if(u.implementation!==a||u.codeHash!==Y(a).codeHash||u.schemaHash!==_(O)||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 h=n(g.maxLpFeePips,24),b=n(g.maxQuoteTakePips,24),c=n(g.maxSubjectTakeBps,16),w=n(y.burnBps,16),pe=n(y.lpBps,16),D=n(y.protocolShareBps,16);if(h>600000n||h>n(f.maxLpFeePips,24)||n(o.baseLpFeePips,24)>h||n(y.maxFeePips,24)>h||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 U=E(o.advisory),z={gated:!1};if(U!==S){if(U!==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,U);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),X=q(me.tierPips,24);if(X>50000n||n(o.baseLpFeePips,24)+X>h||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(B(R,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=B(await A(t,M,P("registry"),"activeLaneOf",[I],i.number),4);if(E(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:y,poolCaps:g,gateStatus:z,reportedRecaptureConfig:V,laneLiquidity:Q,lane:G})}async function ge(t,r,d,i){let e=he(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 O=e.adding?"Add":e.collecting?"Collect LP fees with zero principal removed from":"Remove",R=`${o.key.currency0} / ${o.key.currency1}`,y=`${O} 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 ${R} (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?W: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 h=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:y,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:y,state:o,request:e,actionIndex:h,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!==h),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,ye as b,ue as c,he as d,ge as e,be as f,$e as g,Te as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as l}from"./
|
|
1
|
+
import{h as l}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";async function m(a,e,t,r){let n=`OAK_RPC_URL_${e}`;try{let s=a(e);if(await s.getChainId()!==e)throw new Error("Wrong chain");let o=await s.request({method:"debug_traceCall",params:[{from:t,to:t,data:"0x",value:"0x0",gas:"0x5208"},"latest",{tracer:"callTracer"}]});if(o?.type!=="CALL"||!l(o.to,t)||o.error)throw new Error("Invalid trace")}catch{throw new i(`Relay return path is unavailable on the ${r} for chain ${e}. Set ${n} in both the Oak server and local add-on environments to an RPC for chain ${e} that supports debug_traceCall with callTracer, then restart both and retry bridge-out. Nothing was submitted.`)}return`Relay return path checked on the ${r}: chain ${e} RPC and debug_traceCall with callTracer are available. This checks setup now; it does not guarantee future RPC availability or Relay settlement. Keep destination ETH for return gas.`}var h=500;function d(a,e){let t=BigInt(a),r=BigInt(e),n=((t-r)*10000n+t-1n)/t;return new i(`Relay order minimum is below the allowed slippage minimum. This quote needs slippageBps at least ${n} (maximum 9999), or explicit minAmountOut "${e}". Review that minimum before retrying; a new quote alone may have the same floor.`)}export{m as a,h as b,d as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n,f as a,g as s,h as l,i as u}from"./
|
|
1
|
+
import{d as n,f as a,g as s,h as l,i as u}from"./7WSHW7KW.js";import{c as e}from"./AEL62KCG.js";var m="In-kind exits are a separate unsupported flow.";function b(t,i){return n(t,i,e)}function V(t,i,o,r,x,p){return a(t,i,o,r,x,p,e)}function A(t,i,o){return s(t,i,o,e,m)}function P(t){return l(t,e.symbol)}function S(t,i,o,r){u(t,i,o,r,e)}export{b as a,V as b,A as c,P as d,S as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ca as S}from"./ACW63WIL.js";import{a as d}from"./E3RACZUY.js";import{h as c,i as R,l as N,m as x}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as y,isHex as O,keccak256 as _,parseAbi as z}from"viem";var b=z(["function asset() view returns (address)","function decimals() view returns (uint8)","function symbol() view returns (string)","function owner() view returns (address)","function curator() view returns (address)","function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function parentVault() view returns (address)","function isVaultV2(address) view returns (bool)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function convertToAssets(uint256) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function getThreshold() view returns (uint256)","function getOwners() view returns (address[])"]),i=S("setup-mismatch",{}),m=e=>N(R(e,i),i),k=e=>x(e,i);function v(e){if(typeof e!="string"||!O(e,{strict:!0})||e.length<4||e.length%2!==0)throw new n(i);return _(e)}function V(e){if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255)throw new n(i);return e}function I(e,t){return typeof e=="string"&&/^[A-Za-z0-9.$_-]{1,32}$/.test(e)?e:t}async function P(e,t){if(await e.getChainId()!==d.chainId)throw new n("Borro requires chain 4663.");return k(t??await e.getBlockNumber({cacheTime:0}))}async function B(e,t,f){let a=(r,s,p=[])=>e.readContract({address:r,abi:b,functionName:s,args:p,blockNumber:f}),o={ok:!0,drift:[]};for(let r of["owner","curator"])try{o[r]=m(await a(t,r)),c(o[r],d[r])||o.drift.push(r)}catch{o.drift.push(`${r} unreadable`)}try{let r=k(await a(t,"adaptersLength"));if(r>64n)throw new n(i);let s=await Promise.all(Array.from({length:Number(r)},async(p,u)=>{let h=m(await a(t,"adapters",[BigInt(u)]));if(v(await e.getCode({address:h,blockNumber:f})),!c(await a(h,"parentVault"),t))throw new n(i);return h}));if(new Set(s).size!==s.length)throw new n(i);o.adapters=s}catch{o.drift.push("adapters unreadable or invalid")}return o}function $(e=[]){return async(t,f)=>{let a=c(f,d.assetRule.usdg.address)?{...d.assetRule.usdg,chainId:d.chainId}:e.find(o=>o.chainId===d.chainId&&c(o.address,f));return a?{...a,address:m(a.address)}:void 0}}function L(e={resolveAllowedAsset:$()}){return async(t,f,a,o={})=>{try{let r=m(f),s=await P(t,o.blockNumber),[p,u,h,A,T]=await Promise.all([t.getCode({address:d.factory.address,blockNumber:s}),t.readContract({address:d.factory.address,abi:b,functionName:"isVaultV2",args:[r],blockNumber:s}),t.getCode({address:r,blockNumber:s}),t.readContract({address:r,abi:b,functionName:"asset",blockNumber:s}),t.readContract({address:r,abi:b,functionName:"decimals",blockNumber:s})]);if(!c(v(p),d.factory.codeHash)||u!==!0||V(T)!==18)throw new n(i);let D=v(h),g=m(A),C=V(await t.readContract({address:g,abi:y,functionName:"decimals",blockNumber:s})),w;try{w=await e.resolveAllowedAsset(t,g,s)}catch{}if(w&&(!c(w.address,g)||w.chainId!==4663||w.decimals!==C||I(w.symbol,"")===""))throw new n(i);let l=await B(t,r,s);if(w||l.drift.push("asset identity is outside the available official catalogue"),l.drift.length){if(a!=="withdraw"||!o.wallet)throw new n(i);if(k(await t.readContract({address:r,abi:y,functionName:"balanceOf",args:[m(o.wallet)],blockNumber:s}))===0n)throw new n(i)}let H=I(await t.readContract({address:r,abi:y,functionName:"symbol",blockNumber:s}).catch(()=>{}),"shares");return{vault:r,symbol:w?.symbol??"token",vaultSymbol:H,asset:g,assetDecimals:C,codeHash:D,chainId:4663,shareDecimals:18,...l.owner&&{owner:l.owner},...l.curator&&{curator:l.curator},...l.adapters&&{adapters:l.adapters},setup:l,assetAllowed:!!w,mode:a,source:d.factory.source,measuredAtBlock:s.toString(),provenance:{kind:"factory",factory:d.factory.address,isVaultV2:!0}}}catch(r){throw r instanceof n?r:new n(i)}}}var G=L(),J=async(e,t,f)=>{try{let a=await P(e),[o,r,s,p]=await Promise.all([e.getCode({address:t.vault,blockNumber:a}),e.readContract({address:t.vault,abi:b,functionName:"asset",blockNumber:a}),e.readContract({address:t.vault,abi:y,functionName:"decimals",blockNumber:a}),e.readContract({address:t.asset,abi:y,functionName:"decimals",blockNumber:a})]);if(!c(v(o),t.codeHash)||!c(m(r),t.asset)||V(s)!==18||V(p)!==t.assetDecimals)throw new n(i);let u=await B(e,t.vault,a);if(t.adapters&&u.adapters&&(t.adapters.length!==u.adapters.length||t.adapters.some((h,A)=>!c(h,u.adapters[A])))&&u.drift.push("adapters changed"),f==="deposit"&&u.drift.length)throw new n(i);return u}catch(a){throw a instanceof n?a:new n(i)}};export{b as a,i as b,m as c,k as d,v as e,V as f,I as g,P as h,$ as i,L as j,G as k,J as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./U4JGEMKT.js";import{a as _,b as D}from"./43LI5NKJ.js";import{b as B,c as G,d as O}from"./IOYRL6AY.js";import{a as R,b as M,i as U,s as E}from"./FWD4L3CJ.js";import{a as m,b as H,c as I,e as S}from"./XSD5NL7J.js";import{decodeFunctionResult as ee,encodeFunctionData as te,erc20Abi as V,getAddress as L,isAddress as ne,toEventSelector as re,toHex as T,zeroAddress as se}from"viem";var C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function ae(e){let s=e.toLowerCase();return s===se||s===C?C:e}var oe=re("Transfer(address,address,uint256)"),W="Preview note: simulation transfer-based token changes exclude gas and do not prove external settlement.";function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function x(){throw new m("The endpoint returned an unexpected simulation response.")}function j(e,s,l){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s+l)&&x();let d=e[0].calls,a=d.slice(0,s).map(n=>{if(!p(n)||n.status!=="0x1"||n.error||!Array.isArray(n.logs)||n.logs.length!==0||typeof n.returnData!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n.returnData))throw new m("Preview auxiliary read failed or returned invalid data.");return n.returnData});return{result:[{calls:d.slice(s)}],readResults:a}}async function N(e,s,l,d){let a=await e.getChainId();if(a!==s)throw new m(`Preview is on chain ${s}, but the endpoint reports chain ${a}.`);let n=await z(e),t=await K(e,n);if(n.number===null||typeof n.baseFeePerGas!="bigint"||n.baseFeePerGas<0n||typeof t!="bigint"||t<0n)throw new m("Current block base fee and gas price are unavailable or inconsistent. Retry the preview.");let r=t<n.baseFeePerGas?n.baseFeePerGas:t,A=B(n.gasLimit),c=l.map(u=>({from:d,to:u.to,data:u.data,value:T(BigInt(u.value)),gasPrice:T(r),gas:T(A)})),y=()=>e.request({method:"eth_simulateV1",params:[{blockStateCalls:[{blockOverrides:{baseFeePerGas:T(n.baseFeePerGas)},calls:c}],validation:!1,traceTransfers:!0},T(n.number)]},{retryCount:0});try{return await y()}catch(u){if(!I(u))throw u;let g=await e.getBalance({address:d,blockNumber:n.number}),w=await Promise.all(l.map(o=>e.estimateGas({account:d,to:o.to,data:o.data,value:BigInt(o.value),gas:A,blockNumber:n.number}).catch(()=>{}))),k=g;for(let[o,i]of c.entries()){let f=BigInt(i.value),F=O(B(n.gasLimit,w[o]),k,f,r,d,s),h=w[o];if(h!==void 0&&h>F)throw new m(G(d,s,g-k+f+h*r,g));i.gas=T(F),k-=f}let v=await y();if(Array.isArray(v)&&p(v[0])&&Array.isArray(v[0].calls))for(let[o,i]of v[0].calls.entries()){let f=c[o];if(f&&p(i)&&i.status==="0x0"&&typeof i.gasUsed=="string"&&/^0x[0-9a-f]+$/i.test(i.gasUsed)&&BigInt(i.gasUsed)>=BigInt(f.gas))throw new m(G(d,s,BigInt(f.value)+(BigInt(f.gas)+1n)*r,g))}return v}}function J(e,s,l,d){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s)&&x();let a=new Map;for(let[n,t]of e[0].calls.entries()){if(p(t)||x(),t.status==="0x0")throw new m(`Preview call ${n+1} on chain ${d} reverted. ${S(t.error)}`);(t.status!=="0x1"||t.error||!Array.isArray(t.logs))&&x();for(let r of t.logs){if((!p(r)||!Array.isArray(r.topics))&&x(),typeof r.topics[0]!="string"||r.topics[0].toLowerCase()!==oe||r.topics.length===4)continue;(r.topics.length!==3||typeof r.address!="string"||!ne(r.address,{strict:!1})||typeof r.data!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r.data)||!r.topics.slice(1).every(w=>typeof w=="string"&&/^0x0{24}[0-9a-fA-F]{40}$/.test(w)))&&x();let A=r.topics[1].slice(-40).toLowerCase(),c=r.topics[2].slice(-40).toLowerCase(),y=l.slice(2).toLowerCase(),u=BigInt(r.data),g=(c===y?u:0n)-(A===y?u:0n);if(g!==0n){let w=ae(r.address.toLowerCase());a.set(w,(a.get(w)??0n)+g)}}}return a}async function Q(e,s,l,d){let a=s===R?E.mainnet:s===M?E.testnet:void 0,n=a&&[{address:a.usdg,symbol:"USDG",decimals:6},{address:a.weth,symbol:"WETH",decimals:18},...s===R?[{address:U[4663].meridian.CollateralToken_USDe.address,symbol:"USDe",decimals:18}]:[]].find(r=>r.address.toLowerCase()===e);if(n)return{...n,address:L(e),chainId:s};let t;if(e===C){let r=l.chain?.nativeCurrency??(s===4663?{symbol:"ETH",decimals:18}:void 0);if(!r)throw new m(`Native token metadata is unavailable for chain ${s}.`);t={address:e,chainId:s,symbol:r.symbol,decimals:r.decimals}}else if(d)t=await d(e,s,l);else{let r=await q(l,s,e,"decimals");t={address:e,chainId:s,symbol:e,decimals:r}}if(!t||typeof t.address!="string"||t.address.toLowerCase()!==e||t.chainId!==s||typeof t.symbol!="string"||!t.symbol.trim()||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new m(`Invalid token metadata for ${e} on chain ${s}.`);return{address:e===C?e:L(e),chainId:s,symbol:e===C?t.symbol:L(e),decimals:t.decimals}}function ge(e){return async(s,l,d)=>{_(l);let a=s.map(D),n=(d?.reads??[]).map(c=>D({...c,value:"0",description:"Read before simulated transactions."})),t=a[0]?.chainId;if(t===void 0&&n.length)throw new m("Preview auxiliary reads require a transaction bundle.");if(t===void 0)return{txs:a,changes:[],summary:W};let r=[...n,...a].find(c=>c.chainId!==t);if(r)throw new m(`Preview cannot combine chain ${t} with chain ${r.chainId}. Preview each chain separately.`);let A=n.length?[...n,...a]:a;try{let c=e.clientFor(t),y;try{y=await N(c,t,A,l)}catch(o){if(!H(o,-32601,-32004)||!e.anvilFor)throw o;c=await e.anvilFor(t),y=await N(c,t,A,l)}let u;n.length&&({result:y,readResults:u}=j(y,n.length,a.length));let g=J(y,a.length,l,t),w=new Map,k=[];for(let[o,i]of g)if(i!==0n)try{w.set(o,await Q(o,t,c,e.tokenFor))}catch(f){if(o===C||e.tokenFor||(await c.getCode({address:o})??"0x")!=="0x")throw f;k.push(o)}if(k.length){let o=k.flatMap(h=>["symbol","decimals"].map(b=>D({to:h,data:te({abi:V,functionName:b}),value:"0",chainId:t,description:`Read simulated token ${b}.`}))),i=await N(c,t,[...A,...o],l);if(u){let h=j(i,u.length,a.length+o.length);if(h.readResults.some((b,$)=>b!==u[$]))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");i=h.result}(!Array.isArray(i)||i.length!==1||!p(i[0])||!Array.isArray(i[0].calls)||i[0].calls.length!==a.length+o.length)&&x();let f=i[0].calls,F=J([{calls:f.slice(0,a.length)}],a.length,l,t);if(g.size!==F.size||[...g].some(([h,b])=>F.get(h)!==b))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");for(let[h,b]of k.entries()){let $=(Y,Z)=>{let P=f[a.length+h*2+Z];if(!p(P)||P.status!=="0x1"||P.error||typeof P.returnData!="string"||!/^0x[0-9a-fA-F]+$/.test(P.returnData))throw new m(`Invalid simulated token metadata for ${b} on chain ${t}.`);return ee({abi:V,functionName:Y,data:P.returnData})},X={address:b,chainId:t,symbol:$("symbol",0),decimals:$("decimals",1)};w.set(b,await Q(b,t,c,async()=>X))}}let v=[...g].filter(([,o])=>o!==0n).map(([o,i])=>({token:w.get(o),amount:i.toString()}));return{txs:a,changes:v,summary:W,...u?{readResults:u}:{}}}catch(c){throw new m(`Preview on chain ${t} failed: ${S(c)}`)}}}export{C as a,ae as b,ge as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as pe,c as me}from"./WV3A3OUU.js";import{a as ue}from"./SPJCSEKP.js";import{a as be}from"./43LI5NKJ.js";import{c as le}from"./VEQBHI6O.js";import{a as O}from"./66F5ZH34.js";import{c as Y,d as oe,g as I,i as fe,m as re,n as se}from"./NWNYJ26T.js";import{a as S,i as de,j as ie}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{decodeFunctionData as J,encodeFunctionData as T,erc20Abi as te,getAddress as Ce,keccak256 as he,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-11-04T21:56:26.556Z",block:"106231118",routeBlock:"106231118",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a","0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6":"0xd6f09e63327b36d3c498f8de8768bd3e4336894cd00ddb36aa9e0a1e4a4c911e"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"},qualificationHistory:[{observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",implementationHash:"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c"}],blockHash:"0xcb0e2862c6e22ca5854fb9264995749e497eb26f05a3370202db69909b891c47"};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],X=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ce=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),Fe=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),ge={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ye=P(["function deposit() payable"]),Z={vault:Y,chainId:{const:S},slippageBps:{type:"integer",minimum:0,maximum:500}},Be=10n**36n,z=Ce(de[S].uniswap.WETH.address),ve="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ke=Object.fromEntries(Object.entries(q.codeHashes).map(([d,s])=>[d.toLowerCase(),s])),Ae=Object.fromEntries(Object.entries(q.delegates).map(([d,s])=>[d.toLowerCase(),s]));function f(d){return fe(d,"Provide a token or vault address.",oe)}function F(d){return re(d,"Invalid Beefy CLM integer.")}function G(d,s=!1){return se(d,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!s})}function K(d){let s=d??50;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>500)throw new o("Use integer slippageBps from 0 to 500.");return BigInt(s)}function Q(d,s){let m=d*(10000n-s)/10000n;if(m<=0n)throw new o("This CLM amount is too small for a positive output minimum.");return m}function ne(d,s){if(!Array.isArray(d)||d.length!==s)throw new o("Invalid Beefy CLM quote.");return d.map(F)}function Se(d){let s=f(d),m=De.find(b=>I(b.vault,s));if(!m)throw new o("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return m}function Me(d,s,m,b,C){if(d<=0n||m<=0n||b<0n||C<0n)throw new o("The CLM price or budget is invalid.");let E=s?d*m/Be:d;if(E===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=C>e?C-e:e-C,a=E<t?E:t,r=(E-a)/2n,c=d*(C>e?a+r:r)/E;return[c,d-c]}var Ee=d=>{async function s(e){try{return await e()}catch(t){throw new o(d.plainError(t))}}function m(e,t){if(e.chainId!==void 0&&e.chainId!==S)throw new o("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new o(`Unsupported Beefy CLM input: ${a}.`);return Se(e.vault)}async function b(e,t){be(t);let a=d.clientFor(S);if(await a.getChainId()!==S)throw new o("The Beefy CLM endpoint must report chain 4663.");let r=F(await a.getBlockNumber()),c=await a.getBlock({blockNumber:r}),n=(B,p,A=[])=>a.readContract({address:f(B),abi:X,functionName:p,args:A,blockNumber:r}),i=new Set;async function l(B){let p=B.toLowerCase();if(i.has(p))return;let A=ke[p];if(!A)throw new o("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:r});if(!D||he(D)!==A)throw new o("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");i.add(p),Ae[p]&&await l(Ae[p])}await me(a,f(e.vault),r);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await l(B);let[g,u,y,x,h,k,w,M,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(g)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,p)=>f(B)!==e.wants[p])||f(y)!==e.strategy||f(x)!==e.implementation||f(h)!==e.pool||f(k)!==e.manager||f(w)!==e.wants[0]||f(M)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new o("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>F(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:r}));async function ae(B){let p=f(B),[A,D]=await Promise.all([a.readContract({address:p,abi:te,functionName:"symbol",blockNumber:r}),a.readContract({address:p,abi:te,functionName:"decimals",blockNumber:r})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new o("Invalid CLM token metadata.");return{address:p,symbol:A,decimals:D,chainId:S}}async function U(){let p=(await le(d.http,"https://api.beefy.finance/vaults",{},v=>Array.isArray(v)&&v.every($=>$!==null&&typeof $=="object"))).filter(v=>v.chain==="robinhood"&&typeof v.earnContractAddress=="string"&&I(v.earnContractAddress,e.vault)),A=p[0],D=pe(f(e.vault));if(p.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new o("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new o(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),_=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(_.some(v=>typeof v!="boolean"))throw new o("Invalid Beefy strategy pause flag.");if(_.some(Boolean))throw new o("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new o("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,p){let A=new Set([...e.wants,f(ie),z]);if(!A.has(B)||!A.has(p)||B===p)throw new o("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=q.routes.find(H=>H.from===B&&H.to===p&&(H.pools[0]===e.pool||H.kind==="v3"));if(!D)throw new o("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=q.markets[D.kind];for(let H of[L.router,L.quoter,L.factory,...D.pools])await l(H);let _=D.path;if(_.length!==88||f(_.slice(0,42))!==B||f(`0x${_.slice(-40)}`)!==p)throw new o("Invalid qualified CLM swap path.");let v=Number.parseInt(_.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:ge[D.kind],functionName:"getPool",args:[B,p,v],blockNumber:r});if(f($)!==D.pools[0])throw new o("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new o("The CLM quoter factory differs from its pin.");return D}async function j(B,p,A){let D=await N(B,p),L=q.markets[D.kind],_=await a.simulateContract({address:f(L.quoter),abi:Fe,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:r}),v=F(_.result[0]);if(v===0n)throw new o("No positive quote for this CLM swap.");return{selected:D,market:L,out:v}}return{client:a,blockNumber:r,deadline:c.timestamp+600n,read:n,balance:V,token:ae,code:l,entryAvailable:U,quote:j}}function C(e,t,a,r="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:r,chainId:S})}async function E(e,t,a){let r=await d.preview(e,t);return{txs:e,preview:r,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...Z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount","slippageBps"]),r=K(e.slippageBps),c=await b(a,t),[n,i,l,g,u,y,x,h]=await Promise.all([c.token(a.wants[0]),c.token(a.wants[1]),c.token(a.manager),c.balance(a.wants[0]),c.balance(a.wants[1]),c.balance(a.manager),c.read(a.manager,"balances"),c.read(a.strategy,"price")]),k;if(e.amount!==void 0){await c.entryAvailable();let w=G(e.amount),[M,R]=ne(x,2),ee=Me(w,a.bridge===n.address,F(h),M,R),V=[];for(let[ae,U]of[n,i].entries()){let N=ee[ae],j=N===0n||U.address===a.bridge?N:(await c.quote(f(a.bridge),U.address,N)).out;V.push({token:U,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":Q(j,r).toString(),swapRequired:N>0n&&U.address!==a.bridge})}k={bridge:await c.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:S,vault:a.vault,manager:a.manager,bridge:await c.token(a.bridge),constituents:[{token:n,balance:g.toString()},{token:i,balance:u.toString()}],shares:{token:l,amount:y.toString()},entryPlan:k,block:c.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...Z,from:Y,to:Y,amount:O()},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["from","to","amount","slippageBps"]),r=K(e.slippageBps),c=f(e.from),n=f(e.to),i=G(e.amount),l=c.toLowerCase()===ve,g=l?z:c,u=await b(a,t);if((l?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(c))<i)throw new o("Insufficient CLM swap balance; keep ETH for gas.");let y=[];l&&(await u.code(z),y.push(C(z,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",i.toString())));let x=i,h=i;if(g!==n){let w=await u.quote(g,n,i);x=w.out,h=Q(x,r),y.push(d.approval(g,f(w.market.router),i.toString(),S));let M={path:w.selected.path,recipient:t,amountIn:i,amountOutMinimum:h},R=w.selected.kind==="cl"?T({abi:ce,functionName:"exactInput",args:[{...M,deadline:u.deadline}]}):T({abi:W,functionName:"multicall",args:[u.deadline,[T({abi:W,functionName:"exactInput",args:[M]})]]});y.push(C(w.market.router,R,`Swap exact input with at least ${h} output base units to the calling wallet.`))}else if(!l)throw new o("The CLM swap requires different input and output tokens.");let k=await u.token(n);return{...await E(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:k,amount:x.toString()},minimumOutput:{token:k,amount:h.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...Z,amount0:O(),amount1:O()},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["amount0","amount1","slippageBps"]),r=K(e.slippageBps),c=G(e.amount0,!0),n=G(e.amount1,!0);if(c===0n&&n===0n)throw new o("At least one CLM deposit amount must be positive.");let i=await b(a,t);if(await i.entryAvailable(),await i.balance(a.wants[0])<c||await i.balance(a.wants[1])<n)throw new o("Acquire the CLM constituents first and retry with their mined balances.");let[l,g,u,y,x]=ne(await i.read(a.manager,"previewDeposit",[c,n]),5);if(g>c||u>n||g+u===0n||y>g||x>u)throw new o("The CLM returned invalid deposit amounts or fees.");let h=Q(l,r),k=[];for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),M.toString(),S));k.push(C(a.manager,T({abi:X,functionName:"deposit",args:[c,n,h]}),`Mint at least ${h} CLM share base units to the calling wallet.`));for(let[w,M]of[c,n].entries())M>0n&&k.push(d.approval(f(a.wants[w]),f(a.manager),"0",S));return{...await E(k,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await i.token(a.manager),amount:l.toString()},minimumShares:h.toString(),usedAmounts:[g.toString(),u.toString()],fees:[y.toString(),x.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...Z,shares:{anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=m(e,["shares","slippageBps"]),r=K(e.slippageBps),c=e.shares==="all"?void 0:G(e.shares),n=await b(a,t),i=await n.balance(a.manager),l=c??i;if(l===0n||l>i)throw new o("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[l]),2).map(x=>x===0n?0n:Q(x,r));if(u.every(x=>x===0n))throw new o("No positive CLM withdrawal output is available.");let y=[C(a.manager,T({abi:X,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await E(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(x,h)=>({token:await n.token(a.wants[h]),amount:x.toString()})))}})}]}};async function je(d,s,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let C=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},E=ue({clientFor:()=>b,http:fetch,quoteSwap:C,buildSwap:C,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await Ee(E).tools.find(t=>t.name===d).execute(s,m)).txs}function Ge(d,s,m){let b=()=>{throw new o("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function C(E,e,t){if(E===e)return;let a=J({abi:t,data:E}),r=J({abi:t,data:e});(a.functionName!==r.functionName||!a.args||!r.args)&&b();let c=[...a.args],n=[...r.args];if(I(T({abi:t,functionName:a.functionName,args:c}),E)||b(),a.functionName==="deposit"||a.functionName==="withdraw")for(let i of a.functionName==="deposit"?[2]:[1,2])F(c[i])<F(n[i])&&b(),c[i]=n[i];else if(a.functionName==="multicall"){let i=F(c[0]);(i<=m||i>F(n[0]))&&b(),(!Array.isArray(c[1])||!Array.isArray(n[1])||c[1].length!==1||n[1].length!==1)&&b(),C(c[1][0],n[1][0],W),c[0]=n[0],c[1]=n[1]}else if(a.functionName==="exactInput"){let i={...c[0]},l=n[0];F(i.amountOutMinimum)<F(l.amountOutMinimum)&&b(),i.amountOutMinimum=l.amountOutMinimum,"deadline"in i&&((F(i.deadline)<=m||F(i.deadline)>F(l.deadline))&&b(),i.deadline=l.deadline),c[0]=i}else b();I(T({abi:t,functionName:a.functionName,args:c}),e)||b()}(!s.length||d.length!==s.length)&&b();for(let[E,e]of d.entries()){let t=s[E];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&b();try{if(I(t.to,q.markets.cl.router))J({abi:ce,data:t.data}).args[0].deadline<=m&&b();else if(I(t.to,q.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=m)&&b()}}catch{b()}if(!I(e.data,t.data))try{let a=De.find(r=>I(r.manager,t.to));C(e.data,t.data,a?X:I(t.to,q.markets.cl.router)?ce:W)}catch{b()}}}var We=d=>({tools:Ee(d).tools.slice(1)});export{De as a,we as b,X as c,ce as d,W as e,Se as f,Me as g,Ee as h,je as i,Ge as j,We as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,c}from"./
|
|
1
|
+
import{a as x,c}from"./4HG6FRVH.js";import{a}from"./XSD5NL7J.js";import{parseAbi as M}from"viem";var b=M(["function readState(address router) view returns ((int256 totalPt,int256 totalSy,int256 totalLp,address treasury,int256 scalarRoot,uint256 expiry,uint256 lnFeeRateRoot,uint256 reserveFeePercent,uint256 lastLnImpliedRate) market)","function pyIndexCurrent() returns(uint256)","function exchangeRate() view returns(uint256)","function previewDeposit(address tokenIn,uint256 amount) view returns(uint256)","function previewRedeem(address tokenOut,uint256 amount) view returns(uint256)"]),R=10n**18n,E=31536e3,P="Pendle's price doesn't match what Oak checked on the chain. Try a smaller amount. Nothing was signed.";function n(e,t=!1){if(typeof e!="bigint"||e<(t?1n:0n)||e>=1n<<256n)throw new a("Oak could not read the Pendle price check from the chain. Nothing was signed.");return e}function d(e){return c(Number.isInteger(e)&&e>=0&&e<=77,"unreadable token decimals"),10n**BigInt(e)}function k(e){if(!Number.isFinite(e)||Math.abs(e)>40)throw new a(P);return BigInt(Math.floor(Math.exp(e)*1e18))}async function A(e,t,v,p,u,f){try{c(Number.isFinite(f)&&Math.abs(f)<=.03,"unreadable or excessive price impact"),n(p,!0),n(u,!0);let i=await e.getBlock(),s=i.number,[h,C]=await Promise.all([e.readContract({address:t.market,abi:b,functionName:"readState",args:[x],blockNumber:s}),e.simulateContract({address:t.yt,abi:b,functionName:"pyIndexCurrent",blockNumber:s}).then(o=>o.result)]),I=n(h.lastLnImpliedRate),D=n(h.lnFeeRateRoot),w=n(C,!0);c(Number.isSafeInteger(t.expiry)&&t.expiry>Number(i.timestamp),"this term has ended; use pendle_redeem");let y=(t.expiry-Number(i.timestamp))/E,g=Number(I)/1e18*y,r;if(v==="buy")r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewDeposit",args:[t.inputToken,p],blockNumber:s}),!0)*w*k(g)*d(t.ptDecimals)/(R*R*d(t.syDecimals));else{let o=p*k(-g)*d(t.syDecimals)/(w*d(t.ptDecimals));n(o,!0),r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewRedeem",args:[t.inputToken,o],blockNumber:s}),!0)}n(r,!0);let m=1-Math.exp(-Number(D)/1e18*y);c(Number.isFinite(m)&&m>=0&&m<=1,"unreadable market fee");let N=.01+m,F=u>r?u-r:r-u,l=Number(F)/Number(r);if(!Number.isFinite(l)||l>N)throw new a(P);return{estimateBase:r,relativeDifference:l,tolerance:N,blockNumber:s}}catch(i){throw i instanceof a?i:new a("Oak could not read the Pendle price check from the chain. Nothing was signed.")}}export{b as a,n as b,A as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function c(r,s){return r==="hoodlock_airdrop_claim"&&!Object.hasOwn(s,"id")}var h=new Map([]),_="find_tool",l="run_tool",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"],d={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"],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:[],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 w(r,s){let a=new Set(r),t=new Set;for(let[o,n]of Object.entries(d))for(let e of n){if(t.has(e))throw new Error(`Visible tool ${e} is listed twice.`);if(o!=="oak"&&!e.startsWith(`${o}_`))throw new Error(`Visible tool ${e} is filed under ${o}.`);if(i.includes(e)||a.has(e))t.add(e);else if(s==="mainnet")throw new Error(`Visible tool ${e} is not registered.`)}for(let o of[_,l,...i,"oak_playbook"])if(a.has(o))throw new Error(`Tool name ${o} is reserved for the add-on.`);return t}export{c as a,h as b,_ as c,l as d,i as e,d as f,w as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m}from"./DFM4T6ZE.js";import{a as p,e as b}from"./
|
|
1
|
+
import{a as m}from"./DFM4T6ZE.js";import{a as p,e as b}from"./DJN3JAWB.js";import{o as O}from"./AEL62KCG.js";import{a as y}from"./66F5ZH34.js";import{a as l}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as g,getAddress as a,parseAbi as I}from"viem";var x="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",A="(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)",h=I([`function swapExactIn(${x} key,bool zeroForOne,uint128 amountIn,uint256 minOut,uint160 sqrtPriceLimitX96,address to,uint256 deadline) returns (uint256 paid,uint256 out)`,`function exactInputSingle(${A} params) payable returns (uint256 amountOut)`,"function multicall(uint256 deadline,bytes[] data) payable returns (bytes[] results)"]),E=I(["function quoteExactInputSingle((address tokenIn,address tokenOut,uint256 amountIn,uint24 fee,uint160 sqrtPriceLimitX96) params) returns (uint256 amountOut,uint160 sqrtPriceX96After,uint32 initializedTicksCrossed,uint256 gasEstimate)"]),N=I([`function quoteExactInputSingle((${x} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)`]),_="0x0000000000000000000000000000000000000000",w={symbol:{type:"string",enum:m.tokens.map(e=>e.symbol)},side:{type:"string",enum:["buy","sell"]},amountIn:y()};async function S(e,o){let n=m.tokens.find(s=>s.symbol===e.symbol);if(!n||e.side!=="buy"&&e.side!=="sell")throw new u("Choose a published stock symbol and buy or sell.");let t=await O(String(e.symbol),{context:o});if(t.kind!=="official_stock"||t.address!==a(n.token))throw new u("Published Priors stock pool does not match the official stock contract address. Retry after the pool mapping is updated.");let r=b(e.amountIn,"amountIn",128);if(r===0n)throw new u("amountIn must be positive base units.");return{token:n,identity:t,amount:r,input:e.side==="buy"?p.usdg:a(n.token),output:e.side==="buy"?a(n.token):p.usdg}}function P(e,o,n){let[t,r]=BigInt(p.usdg)<BigInt(e)?[p.usdg,e]:[e,p.usdg];return{currency0:t,currency1:r,fee:o,tickSpacing:n,hooks:_}}function X(e){return{tools:[{name:"priors_stock_quote",inputSchema:{type:"object",properties:w,required:Object.keys(w),additionalProperties:!1},async execute(o,n){if(e.network==="testnet")throw new u("Priors stock swaps require mainnet chain 4663.");let t=await S(o,e),r=e.clientFor(l),s=await r.getBlockNumber({cacheTime:0}),k=await Promise.all(t.token.pools.map(async(i,d)=>{try{let c=P(a(t.token.token),i.fee,"tickSpacing"in i?i.tickSpacing:0),f=i.v===3?await r.simulateContract({address:a(m.v3.quoter),abi:E,functionName:"quoteExactInputSingle",args:[{tokenIn:t.input,tokenOut:t.output,amountIn:t.amount,fee:i.fee,sqrtPriceLimitX96:0n}],account:n,blockNumber:s}):await r.simulateContract({address:a(m.v4.quoter),abi:N,functionName:"quoteExactInputSingle",args:[{poolKey:c,zeroForOne:t.input===c.currency0,exactAmount:t.amount,hookData:"0x"}],account:n,blockNumber:s});return{poolIndex:d,version:i.v,amountOut:f.result[0].toString()}}catch(c){return{poolIndex:d,version:i.v,error:e.plainError(c)}}}));return{chainId:l,blockNumber:s.toString(),token:t.identity,quotes:k,warning:"Use explicit minimum output with priors_stock_swap and inspect its preview. Issuer restrictions can prevent sale. Quote is no promise of an exit; local regional eligibility remains required."}}},{name:"priors_stock_swap",inputSchema:{type:"object",properties:{...w,poolIndex:{type:"integer",minimum:0,maximum:2},minOut:y(),deadline:y(),eligible:{type:"boolean",description:"Operator/user affirms eligibility for this stock-token trade in their jurisdiction."}},required:[...Object.keys(w),"poolIndex","minOut","deadline","eligible"],additionalProperties:!1},async execute(o,n){if(e.network==="testnet")throw new u("Priors stock swaps require mainnet chain 4663.");if(n=a(n),o.eligible!==!0)throw new u("Confirm local eligibility for Robinhood stock tokens before trading.");let t=await S(o,e),r=b(o.minOut,"minOut"),s=b(o.deadline,"deadline"),k=BigInt(Math.floor(Date.now()/1e3));if(r===0n||s<=k||s>k+1800n||!Number.isSafeInteger(o.poolIndex))throw new u("Provide positive minOut, poolIndex and a deadline within 30 minutes.");let i=t.token.pools[o.poolIndex];if(!i)throw new u("No published pool at that index. Read priors_stock_quote.");let d=P(a(t.token.token),i.fee,"tickSpacing"in i?i.tickSpacing:0),c=t.input===d.currency0,f=a(i.v===3?m.v3.router:m.v4.swapper),q=i.v===3?g({abi:h,functionName:"multicall",args:[s,[g({abi:h,functionName:"exactInputSingle",args:[{tokenIn:t.input,tokenOut:t.output,fee:i.fee,recipient:n,amountIn:t.amount,amountOutMinimum:r,sqrtPriceLimitX96:0n}]})]]}):g({abi:h,functionName:"swapExactIn",args:[d,c,t.amount,r,c?4295128740n:1461446703485210103287273052203988822378723970341n,n,s]}),v=[e.approval(t.input,f,t.amount.toString(),l),e.unsignedTx({to:f,data:q,value:"0",chainId:l,description:`Priors stock ${o.side}: ${t.amount} input base units; minimum ${r}; pinned V${i.v} pool.`})],$=await e.preview(v,n);return{txs:v,expiresAt:s.toString(),summary:`Stock ${o.side} ${o.symbol}: input ${t.amount} base units (${t.input}), minimum output ${r} (${t.output}), receiver ${n}, deadline ${s}. Issuer transfer/sale restrictions apply. Price impact is not measured by this builder; inspect minOut and the preview. ${$.summary}`}}}]}}export{h as a,X as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as R}from"./
|
|
1
|
+
import{t as R}from"./DHUDSOGR.js";import{b as S}from"./CBG5HARQ.js";import{a as v}from"./P4UQGWCP.js";import{c as P}from"./VEQBHI6O.js";import{e as f}from"./NWNYJ26T.js";import{a as c,i as I}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";import{getAddress as x,isAddress as w}from"viem";function _(r){if(typeof r!="string"||!r.trim()||r.length>200)throw new a("Provide nonempty filter text of at most 200 characters.");return r}function O(r,u){if(typeof r!="number"||!Number.isSafeInteger(r)||r<0||r>u)throw new a(`Choose a pagination integer from 0 to ${u}.`);return r}var k={morpho:{assess:"morpho_status",enter:"morpho_supply_collateral",exit:"morpho_withdraw_collateral"},steakhouse:{assess:"steakhouse_list",enter:"steakhouse_deposit",exit:"steakhouse_withdraw"},spark:{assess:"spark_list",enter:"spark_deposit",exit:"spark_withdraw"},netnet:{assess:"netnet_list",enter:"netnet_deposit",exit:"netnet_withdraw"},longbow:{assess:"longbow_list",enter:"longbow_deposit",exit:"longbow_withdraw"},grove:{assess:"grove_list",enter:"grove_deposit",exit:"grove_withdraw"},beefy:{assess:"beefy_list",enter:"beefy_deposit",exit:"beefy_withdraw"},uniswap:{assess:"uniswap_list_positions",enter:"uniswap_add",exit:"uniswap_remove"}},h=I[c].vaults,C={steakhouse:[h.steakhouse.address],spark:[h.spark.address],netnet:[h.netnet.address],longbow:[h.longbowCore.address,h.longbowFrontier.address,h.longbowEth.address],grove:[h.groveAlm.address],beefy:v.vaults.map(r=>r.earnContractAddress)},M=new Set(R.map(r=>r.marketId.toLowerCase()));function N(r,u){return Object.hasOwn(C,r)&&typeof u=="string"&&w(u,{strict:!1})&&C[r].some(g=>g.toLowerCase()===u.toLowerCase())}var V=r=>{let u=(t,n,o)=>({name:`merkl_${t}`,inputSchema:{type:"object",properties:n,additionalProperties:!1},execute:async(d,e)=>{try{let s=Object.keys(d).find(p=>!Object.hasOwn(n,p));if(s)throw new a(`Unsupported Merkl input: ${s}.`);return await o(d,e)}catch(s){throw new a(r.plainError(s))}}}),g={page:{type:"integer",minimum:0,maximum:1e4},items:{type:"integer",minimum:1,maximum:100}},A=async(t,n)=>{let o=new URL(`https://api.merkl.xyz/v4/${t}`);for(let[d,e]of Object.entries(n))o.searchParams.set(d,e);return P(r.http,o.toString(),{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},d=>Array.isArray(d)||f(d))},b=t=>{let n=O(t.items??20,100);if(!n)throw new a("Choose at least one item per page.");return{page:String(O(t.page??0,1e4)),items:String(n)}};return{tools:[u("opportunities",{...g,protocol:{type:"string"},name:{type:"string"},explorerAddress:{type:"string"}},async t=>{let n={chainId:String(c),campaigns:"true",...b(t)};if(t.protocol!==void 0&&(n.mainProtocolId=_(t.protocol)),t.name!==void 0&&(n.name=_(t.name)),t.explorerAddress!==void 0){if(typeof t.explorerAddress!="string"||!w(t.explorerAddress,{strict:!1}))throw new a("Provide a pool or market explorer address.");n.explorerAddress=x(t.explorerAddress)}let o=await A("opportunities",n);if(!Array.isArray(o)||!o.every(e=>f(e)&&typeof e.id=="string"&&Number.isSafeInteger(e.chainId)))throw new a("Merkl returned unexpected opportunities.");return{opportunities:o.filter(e=>e.chainId===c).map(e=>{let s=(f(e.protocol)?e.protocol.id:void 0)??e.mainProtocolId??e.mainProtocol,p=typeof s=="string"?s.toLowerCase():"",i;p==="morpho"&&e.action==="LEND"?e.type==="MORPHOCOLLATERAL"?[e.marketId,e.identifier,e.explorerAddress].some(m=>typeof m=="string"&&M.has(m.toLowerCase()))&&(i=k.morpho):typeof e.type=="string"&&(e.type==="ERC20LOGPROCESSOR"||e.type.includes("MORPHOVAULT"))&&typeof e.explorerAddress=="string"&&w(e.explorerAddress,{strict:!1})&&x(e.explorerAddress)===I[c].vaults.steakhouse.address&&(i=k.steakhouse):p==="uniswap"?e.type==="UNISWAP_V4"&&e.action==="POOL"&&(i=k.uniswap):N(p,e.explorerAddress)&&(e.action==="LEND"||e.action==="STAKE")&&(i=k[p]);let l=e.action==="POOL"||i?.enter==="uniswap_add"?{lpWarning:`Illustration for $100; no deposit amount has been selected.
|
|
2
2
|
${S({apr:typeof e.apr=="number"?e.apr:void 0,endDate:typeof e.endTimestamp=="number"||typeof e.endTimestamp=="string"?e.endTimestamp:void 0,amountUsd:100})}`}:{};return{...e,oak:{...i?{candidateTools:i}:{},...l,destinationVerificationRequired:!0,eligibility:"Read campaign conditions; no wallet eligibility has been verified."}}}),...b(t),hasMore:o.length===Number(n.items),summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Public, untrusted campaign data includes conditions and destinations. Candidate Oak tools require a matching verified market/vault and a supported entry AND exit. APR is indicative; no rewards are promised."}}),u("campaigns",{...g,creator:{type:"string"},tokenSymbol:{type:"string"},opportunityId:{type:"string",pattern:"^\\d{1,30}$"}},async t=>{if(t.opportunityId!==void 0&&(t.creator!==void 0||t.tokenSymbol!==void 0))throw new a("Use creator and tokenSymbol without opportunityId; the opportunity endpoint does not support those filters.");if(t.opportunityId!==void 0&&(typeof t.opportunityId!="string"||!/^\d{1,30}$/.test(t.opportunityId)))throw new a("Provide an opportunityId as a decimal string of 1 to 30 digits.");let n={chainId:String(c),withOpportunity:"true",...b(t)};if(t.creator!==void 0){if(typeof t.creator!="string"||!w(t.creator,{strict:!1}))throw new a("Provide a creator address.");n.creatorAddress=x(t.creator)}t.tokenSymbol!==void 0&&(n.tokenSymbol=_(t.tokenSymbol));let o=t.opportunityId===void 0?"campaigns":`opportunities/${t.opportunityId}/campaigns`,d=await A(o,t.opportunityId===void 0?n:{}),e=t.opportunityId!==void 0&&f(d)?d:void 0;if(e&&e.chainId!==c)throw new a(`Merkl opportunity must be on chain ${c}.`);let s=t.opportunityId===void 0?d:e?.campaigns;if(!Array.isArray(s)||!s.every(y=>f(y)&&(typeof y.id=="string"||typeof y.id=="number")))throw new a("Merkl returned unexpected campaigns.");let p=e?s.filter(y=>y.distributionChainId===c):s,i=Number(n.page)*Number(n.items),l=t.opportunityId===void 0?p:p.slice(i,i+Number(n.items)),m=t.opportunityId===void 0?p.length===Number(n.items):i+Number(n.items)<p.length;return{campaigns:l,...e?{opportunity:{id:e.id,name:e.name,chainId:e.chainId,protocol:f(e.protocol)?{id:e.protocol.id,name:e.protocol.name}:void 0,explorerAddress:e.explorerAddress,identifier:e.identifier}}:{},chainId:c,...b(t),hasMore:m,summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Campaign rules, budgets, timing, exclusions and configuration are public API data; verify the reward distribution chain and destination before entering."}}),u("earning_status",{view:{enum:["active","breakdowns","stats","claims"]},...g},async(t,n)=>{if(!w(n,{strict:!1}))throw new a("Provide a valid connected wallet address.");let o=t.view??"active";if(!["active","breakdowns","stats","claims"].includes(String(o)))throw new a("Choose active, breakdowns, stats or claims.");let d=o==="claims"?"claims":o==="breakdowns"?`users/${n}/rewards/chains/${c}/breakdowns`:`users/${n}/rewards/${o==="active"?"active-opportunities":"stats"}`,{page:e,items:s}=b(t),p=o==="breakdowns"?{}:{chainId:String(c)};o==="claims"&&(p.recipient=n);let i=await A(d,p),l=Number(e)*Number(s),m=Array.isArray(i)?i:o==="breakdowns"&&f(i)&&Array.isArray(i.opportunities)?i.opportunities:void 0,y=m?Array.isArray(i)?m.slice(l,l+Number(s)):{...i,opportunities:m.slice(l,l+Number(s))}:i;return{view:o,chainId:c,wallet:n,data:y,...m?{page:e,items:s,hasMore:l+Number(s)<m.length}:{},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. API earning attribution and history can lag onchain state; pending earnings are not claimable. Private or restricted attribution may be omitted by Merkl. Recheck merkl_rewards before a claim."}})]}};export{V as a};
|