@oakagentkit/core 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/api/abort-scope.d.ts +2 -0
- package/build/dist/api/abort-scope.js +1 -0
- package/build/dist/api/addresses.d.ts +9 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.d.ts +4 -0
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/http.js +1 -1
- package/build/dist/api/identity-link.js +1 -1
- package/build/dist/api/metadata.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.js +1 -1
- package/build/dist/api/modules/beefy/guard.js +1 -1
- package/build/dist/api/modules/beefy/index.js +1 -1
- package/build/dist/api/modules/beefy/liquidity.js +1 -1
- package/build/dist/api/modules/beefy/management.js +1 -1
- package/build/dist/api/modules/beefy/vaults.js +1 -1
- package/build/dist/api/modules/borro/abi.d.ts +54 -0
- package/build/dist/api/modules/borro/abi.js +1 -1
- package/build/dist/api/modules/borro/actions.d.ts +14 -1
- package/build/dist/api/modules/borro/actions.js +1 -1
- package/build/dist/api/modules/borro/checks.js +1 -1
- package/build/dist/api/modules/borro/copy.d.ts +23 -10
- package/build/dist/api/modules/borro/copy.js +1 -1
- package/build/dist/api/modules/borro/index.js +1 -1
- package/build/dist/api/modules/borro/liquidity.js +1 -1
- package/build/dist/api/modules/borro/pins.d.ts +30 -14
- package/build/dist/api/modules/borro/pins.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/borro/types.d.ts +1 -0
- package/build/dist/api/modules/chop/abi.d.ts +31 -0
- package/build/dist/api/modules/chop/abi.js +1 -1
- package/build/dist/api/modules/chop/actions.js +1 -1
- package/build/dist/api/modules/chop/checks.d.ts +13 -5
- package/build/dist/api/modules/chop/checks.js +1 -1
- package/build/dist/api/modules/chop/copy.d.ts +11 -1
- package/build/dist/api/modules/chop/copy.js +1 -1
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- package/build/dist/api/modules/chop/positions.js +1 -1
- package/build/dist/api/modules/chop/reader.d.ts +132 -7
- package/build/dist/api/modules/chop/reader.js +1 -1
- package/build/dist/api/modules/chop/types.d.ts +12 -0
- package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
- package/build/dist/api/modules/clanker/extensions.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/clanker/manage.js +1 -1
- package/build/dist/api/modules/clanker/pool-config.d.ts +15 -0
- package/build/dist/api/modules/clanker/pool-config.js +1 -1
- package/build/dist/api/modules/clanker/protocol.js +1 -1
- package/build/dist/api/modules/clanker/state.js +1 -1
- package/build/dist/api/modules/earn/copy.d.ts +36 -14
- package/build/dist/api/modules/earn/copy.js +1 -1
- package/build/dist/api/modules/earn/cost.d.ts +11 -1
- package/build/dist/api/modules/earn/cost.js +1 -1
- package/build/dist/api/modules/earn/index.js +1 -1
- package/build/dist/api/modules/earn/lp.d.ts +14 -1
- package/build/dist/api/modules/earn/lp.js +1 -1
- package/build/dist/api/modules/earn/options.d.ts +6 -4
- package/build/dist/api/modules/earn/options.js +1 -1
- package/build/dist/api/modules/erc8004/common.d.ts +1 -1
- package/build/dist/api/modules/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
- package/build/dist/api/modules/erc8004/thesis.js +1 -0
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/factor/abi.d.ts +642 -0
- package/build/dist/api/modules/factor/abi.js +1 -0
- package/build/dist/api/modules/factor/actions.d.ts +15 -0
- package/build/dist/api/modules/factor/actions.js +1 -0
- package/build/dist/api/modules/factor/api.d.ts +7 -0
- package/build/dist/api/modules/factor/api.js +1 -0
- package/build/dist/api/modules/factor/checks.d.ts +11 -0
- package/build/dist/api/modules/factor/checks.js +1 -0
- package/build/dist/api/modules/factor/copy.d.ts +33 -0
- package/build/dist/api/modules/factor/copy.js +1 -0
- package/build/dist/api/modules/factor/guard.d.ts +12 -0
- package/build/dist/api/modules/factor/guard.js +1 -0
- package/build/dist/api/modules/factor/index.d.ts +16 -0
- package/build/dist/api/modules/factor/index.js +8 -0
- package/build/dist/api/modules/factor/messages.d.ts +46 -0
- package/build/dist/api/modules/factor/messages.js +1 -0
- package/build/dist/api/modules/factor/pins.d.ts +64 -0
- package/build/dist/api/modules/factor/pins.js +1 -0
- package/build/dist/api/modules/factor/reader.d.ts +17 -0
- package/build/dist/api/modules/factor/reader.js +1 -0
- package/build/dist/api/modules/factor/types.d.ts +18 -0
- package/build/dist/api/modules/factor/types.js +0 -0
- package/build/dist/api/modules/gloam/copy.d.ts +4 -3
- package/build/dist/api/modules/gloam/copy.js +2 -2
- package/build/dist/api/modules/gloam/index.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.d.ts +29 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/scan.js +1 -1
- package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
- package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.d.ts +12 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/buyback.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.d.ts +2 -1
- package/build/dist/api/modules/hookr/contracts.js +1 -1
- package/build/dist/api/modules/hookr/create-cancel.js +1 -1
- package/build/dist/api/modules/hookr/discovery.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- package/build/dist/api/modules/hookr/launch.js +1 -1
- package/build/dist/api/modules/hookr/liquidity.js +1 -1
- package/build/dist/api/modules/hookr/lp-positions.js +1 -1
- package/build/dist/api/modules/hookr/lp-reads.d.ts +2 -0
- package/build/dist/api/modules/hookr/lp-reads.js +1 -1
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/read-utils.js +1 -1
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/abi.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/checks.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/merkl.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/layerbank/reserve.js +1 -1
- package/build/dist/api/modules/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/analytics.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/longbow/nft.js +1 -1
- package/build/dist/api/modules/longbow/rebates.js +1 -1
- package/build/dist/api/modules/longbow/staking.js +1 -1
- package/build/dist/api/modules/meridian/index.js +1 -1
- package/build/dist/api/modules/meridian/markets.js +1 -1
- package/build/dist/api/modules/meridian/perps-batch.js +1 -1
- package/build/dist/api/modules/meridian/perps-stream.js +1 -1
- package/build/dist/api/modules/meridian/perps.js +1 -1
- package/build/dist/api/modules/meridian/predict-read.js +1 -1
- package/build/dist/api/modules/meridian/rfq.js +1 -1
- package/build/dist/api/modules/merkl/discovery.js +1 -1
- package/build/dist/api/modules/merkl/index.js +1 -1
- package/build/dist/api/modules/merkl/manage.js +1 -1
- package/build/dist/api/modules/merkl/protocol.js +1 -1
- package/build/dist/api/modules/morpho/allocator.js +1 -1
- package/build/dist/api/modules/morpho/bundles.js +1 -1
- package/build/dist/api/modules/morpho/in-kind.js +1 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.js +1 -1
- package/build/dist/api/modules/morpho/midnight.js +1 -1
- package/build/dist/api/modules/morpho/protocol.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
- package/build/dist/api/modules/morpho/vault-v2.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
- package/build/dist/api/modules/netnet/card-policy.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/desk-read.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/gateway.js +1 -1
- package/build/dist/api/modules/orbio/index.d.ts +6 -0
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/convert.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/validate.js +1 -1
- package/build/dist/api/modules/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.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.d.ts +3 -2
- package/build/dist/api/modules/pons/trade.js +1 -1
- package/build/dist/api/modules/poolstrade/index.js +1 -1
- package/build/dist/api/modules/priors/coverage.js +1 -1
- package/build/dist/api/modules/priors/discovery.js +1 -1
- package/build/dist/api/modules/priors/features.js +1 -1
- package/build/dist/api/modules/priors/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.d.ts +1 -0
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
- package/build/dist/api/modules/raeto/authorization.js +1 -0
- package/build/dist/api/modules/raeto/copy.d.ts +46 -0
- package/build/dist/api/modules/raeto/copy.js +1 -0
- package/build/dist/api/modules/raeto/errors.d.ts +4 -0
- package/build/dist/api/modules/raeto/errors.js +1 -0
- package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
- package/build/dist/api/modules/raeto/estimate.js +1 -0
- package/build/dist/api/modules/raeto/index.d.ts +16 -0
- package/build/dist/api/modules/raeto/index.js +1 -0
- package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
- package/build/dist/api/modules/raeto/pairing.js +1 -0
- package/build/dist/api/modules/raeto/pins.d.ts +24 -0
- package/build/dist/api/modules/raeto/pins.js +1 -0
- package/build/dist/api/modules/raeto/templates.d.ts +22 -0
- package/build/dist/api/modules/raeto/templates.js +1 -0
- package/build/dist/api/modules/raeto/terms.d.ts +8 -0
- package/build/dist/api/modules/raeto/terms.js +1 -0
- package/build/dist/api/modules/raeto/types.d.ts +64 -0
- package/build/dist/api/modules/raeto/types.js +0 -0
- package/build/dist/api/modules/relay/api.d.ts +16 -0
- package/build/dist/api/modules/relay/api.js +1 -1
- package/build/dist/api/modules/relay/bootstrap.js +1 -1
- package/build/dist/api/modules/relay/discovery.js +1 -1
- package/build/dist/api/modules/relay/inbound.js +1 -1
- package/build/dist/api/modules/relay/index.d.ts +1 -0
- package/build/dist/api/modules/relay/index.js +1 -1
- package/build/dist/api/modules/relay/order.js +1 -1
- package/build/dist/api/modules/relay/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/readiness.d.ts +1 -0
- package/build/dist/api/modules/relay/readiness.js +1 -1
- package/build/dist/api/modules/relay/reads.js +1 -1
- package/build/dist/api/modules/relay/vaults.js +1 -1
- package/build/dist/api/modules/spark/actions.js +1 -1
- package/build/dist/api/modules/spark/details.js +1 -1
- package/build/dist/api/modules/spark/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/discovery.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.d.ts +1 -0
- package/build/dist/api/modules/tickerspring/journeys.js +1 -1
- package/build/dist/api/modules/tickerspring/ladder.js +1 -1
- package/build/dist/api/modules/tickerspring/maker.js +1 -1
- package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
- package/build/dist/api/modules/tickerspring/research.js +1 -1
- package/build/dist/api/modules/tickerspring/strategies.js +1 -1
- package/build/dist/api/modules/uniswap/auction-create.js +1 -1
- package/build/dist/api/modules/uniswap/auction.js +1 -1
- package/build/dist/api/modules/uniswap/batch.js +1 -1
- package/build/dist/api/modules/uniswap/common.js +1 -1
- package/build/dist/api/modules/uniswap/fee-percent.d.ts +4 -0
- package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
- package/build/dist/api/modules/uniswap/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- package/build/dist/api/modules/uniswap/local-guard.d.ts +2 -0
- package/build/dist/api/modules/uniswap/local-guard.js +1 -1
- package/build/dist/api/modules/uniswap/oracle.js +1 -1
- package/build/dist/api/modules/uniswap/pool-math.js +1 -1
- package/build/dist/api/modules/uniswap/pools.d.ts +2 -0
- package/build/dist/api/modules/uniswap/pools.js +1 -1
- package/build/dist/api/modules/uniswap/position.js +1 -1
- package/build/dist/api/modules/uniswap/protocol.js +1 -1
- package/build/dist/api/modules/uniswap/quote-guard.d.ts +38 -0
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
- package/build/dist/api/modules/uniswap/token-jar.js +1 -1
- package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
- package/build/dist/api/modules/uniswap/trade.d.ts +10 -3
- package/build/dist/api/modules/uniswap/trade.js +1 -1
- package/build/dist/api/modules/uniswap/v2.js +1 -1
- package/build/dist/api/modules/uniswap/v3.js +1 -1
- package/build/dist/api/modules/uniswap/v4.d.ts +6 -0
- package/build/dist/api/modules/uniswap/v4.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/upoch/copy.d.ts +5 -0
- package/build/dist/api/modules/upoch/copy.js +1 -0
- package/build/dist/api/modules/upoch/index.d.ts +8 -0
- package/build/dist/api/modules/upoch/index.js +1 -0
- package/build/dist/api/modules/upoch/pins.d.ts +8 -0
- package/build/dist/api/modules/upoch/pins.js +1 -0
- package/build/dist/api/modules/upoch/reads.d.ts +509 -0
- package/build/dist/api/modules/upoch/reads.js +1 -0
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/scan-text.js +1 -1
- package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -1
- package/build/dist/api/modules/wormhole/third-party-text.d.ts +14 -3
- package/build/dist/api/modules/wormhole/third-party-text.js +1 -1
- package/build/dist/api/modules/wormhole/token-check.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
- package/build/dist/api/modules/wormhole/x402-client.js +1 -1
- package/build/dist/api/oak-fee.d.ts +12 -0
- package/build/dist/api/oak-fee.js +1 -0
- package/build/dist/api/param-text.d.ts +22 -0
- package/build/dist/api/param-text.js +1 -0
- package/build/dist/api/position-economics.d.ts +70 -0
- package/build/dist/api/position-economics.js +1 -0
- package/build/dist/api/positions.d.ts +8 -5
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.d.ts +3 -0
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/pricing.js +1 -1
- package/build/dist/api/progress.d.ts +7 -0
- package/build/dist/api/progress.js +1 -0
- package/build/dist/api/read-budgets.d.ts +4 -0
- package/build/dist/api/read-budgets.js +1 -0
- package/build/dist/api/read-shape.d.ts +45 -0
- package/build/dist/api/read-shape.js +1 -0
- package/build/dist/api/revert.d.ts +23 -0
- package/build/dist/api/revert.js +1 -0
- package/build/dist/api/routes.js +1 -1
- package/build/dist/api/rpc.d.ts +1 -0
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/secret-fields.d.ts +2 -0
- package/build/dist/api/secret-fields.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.d.ts +8 -0
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/signing.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.d.ts +4 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.d.ts +1 -0
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.d.ts +1 -0
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/types.d.ts +3 -0
- package/build/dist/api/untrusted-unwrap.d.ts +1 -0
- package/build/dist/api/untrusted-unwrap.js +1 -0
- package/build/dist/api/usd-estimate.d.ts +23 -0
- package/build/dist/api/usd-estimate.js +1 -0
- package/build/dist/api/vendor-limits.js +1 -1
- package/build/dist/chunks/23HNDJ76.js +2 -0
- package/build/dist/chunks/24Q3FNGX.js +1 -0
- package/build/dist/chunks/25C4DTVA.js +1 -0
- package/build/dist/chunks/2GXHYI23.js +1 -0
- package/build/dist/chunks/2HN3U6OG.js +1 -0
- package/build/dist/chunks/{QU5XKRGK.js → 2OVJ2BTJ.js} +1 -1
- package/build/dist/chunks/{FUDAXV5X.js → 2QGLPY2D.js} +1 -1
- package/build/dist/chunks/2WRXH6BL.js +1 -0
- package/build/dist/chunks/2ZBSE2LD.js +2 -0
- package/build/dist/chunks/2ZQ7X223.js +1 -0
- package/build/dist/chunks/2ZWKIBJT.js +1 -0
- package/build/dist/chunks/3A2IKFTV.js +1 -0
- package/build/dist/chunks/3CH2IPQL.js +1 -0
- package/build/dist/chunks/3PU2SD3U.js +2 -0
- package/build/dist/chunks/{ER47KGRM.js → 3ZH5SOC2.js} +1 -1
- package/build/dist/chunks/4NBXBKOX.js +2 -0
- package/build/dist/chunks/{WV3A3OUU.js → 4PLLS6CT.js} +1 -1
- package/build/dist/chunks/4R3G3H42.js +1 -0
- package/build/dist/chunks/4TTDAF4B.js +1 -0
- package/build/dist/chunks/4Z3IGMU6.js +1 -0
- package/build/dist/chunks/5DPJQCKJ.js +68 -0
- package/build/dist/chunks/{SJJR4ZBZ.js → 5GQJVKVY.js} +1 -1
- package/build/dist/chunks/5R576SDB.js +1 -0
- package/build/dist/chunks/5RXALTDT.js +1 -0
- package/build/dist/chunks/5TUXSOMI.js +1 -0
- package/build/dist/chunks/5UAXLWJ2.js +1 -0
- package/build/dist/chunks/{QQECG3WP.js → 5W74Z4WZ.js} +1 -1
- package/build/dist/chunks/5XAXJEWM.js +5 -0
- package/build/dist/chunks/65356YKW.js +1 -0
- package/build/dist/chunks/65OITTDL.js +1 -0
- package/build/dist/chunks/6F527FLN.js +1 -0
- package/build/dist/chunks/6MDYKE2O.js +1 -0
- package/build/dist/chunks/6OCLWSMZ.js +1 -0
- package/build/dist/chunks/75SULXNT.js +1 -0
- package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
- package/build/dist/chunks/7U62MMUQ.js +1 -0
- package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
- package/build/dist/chunks/A2V4NFVA.js +1 -0
- package/build/dist/chunks/A3BJSQ23.js +1 -0
- package/build/dist/chunks/ACH4BSME.js +3 -0
- package/build/dist/chunks/ADIPEGNN.js +1 -0
- package/build/dist/chunks/AHUCYDBC.js +1 -0
- package/build/dist/chunks/ANIF3JMV.js +4 -0
- package/build/dist/chunks/{ALLLYOUG.js → ATEVAJ5Y.js} +1 -1
- package/build/dist/chunks/B2HSLY5F.js +1 -0
- package/build/dist/chunks/{WTXC3XKW.js → B7BNDW35.js} +1 -1
- package/build/dist/chunks/BE3A7677.js +1 -0
- package/build/dist/chunks/{PAY5PD4H.js → BX46C5ZP.js} +1 -1
- package/build/dist/chunks/C3WBHFLX.js +1 -0
- package/build/dist/chunks/C6VJAL5B.js +1 -0
- package/build/dist/chunks/C76D54YG.js +1 -0
- package/build/dist/chunks/CD2JQ32C.js +1 -0
- package/build/dist/chunks/CI5ENLYA.js +1 -0
- package/build/dist/chunks/CNLL4NCR.js +1 -0
- package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
- package/build/dist/chunks/CSOO4SW7.js +1 -0
- package/build/dist/chunks/CZL6T2ZQ.js +1 -0
- package/build/dist/chunks/CZQ2CGYV.js +1 -0
- package/build/dist/chunks/D2IYA4LP.js +1 -0
- package/build/dist/chunks/D7QXZM3S.js +1 -0
- package/build/dist/chunks/{GNC6RXLT.js → DBOGRUPS.js} +1 -1
- package/build/dist/chunks/DGCJZ3HO.js +1 -0
- package/build/dist/chunks/DGDMRATN.js +1 -0
- package/build/dist/chunks/DMB64UIN.js +1 -0
- package/build/dist/chunks/DMDOSHV7.js +1 -0
- package/build/dist/chunks/DRLBTB4E.js +1 -0
- package/build/dist/chunks/E76Z2TT4.js +1 -0
- package/build/dist/chunks/EFESPGA2.js +1 -0
- package/build/dist/chunks/EHK7CDTU.js +1 -0
- package/build/dist/chunks/ELHRXA5U.js +1 -0
- package/build/dist/chunks/F7MGYRPU.js +1 -0
- package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
- package/build/dist/chunks/{QBIY6FQN.js → FGEGJOAA.js} +1 -1
- package/build/dist/chunks/FHTNMGFR.js +1 -0
- package/build/dist/chunks/FN6GNTPR.js +1 -0
- package/build/dist/chunks/{EGYVRQUR.js → FTMA24EC.js} +1 -1
- package/build/dist/chunks/FXOFR432.js +1 -0
- package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
- package/build/dist/chunks/G2LAO23N.js +1 -0
- package/build/dist/chunks/{WIRBCS4W.js → GBIBRYOV.js} +1 -1
- package/build/dist/chunks/GDOHHXNH.js +1 -0
- package/build/dist/chunks/{GSBIERZD.js → GP6YO24Z.js} +1 -1
- package/build/dist/chunks/GQ3XZFRL.js +1 -0
- package/build/dist/chunks/{4HG6FRVH.js → GQITAJVF.js} +1 -1
- package/build/dist/chunks/H3E7UD2X.js +1 -0
- package/build/dist/chunks/HFVXNKA5.js +1 -0
- package/build/dist/chunks/HHYE42JG.js +21 -0
- package/build/dist/chunks/HRAHGYNK.js +1 -0
- package/build/dist/chunks/HS5HWBMU.js +1 -0
- package/build/dist/chunks/{BND2UFVW.js → HVFMIURK.js} +1 -1
- package/build/dist/chunks/IBL6TL2Q.js +1 -0
- package/build/dist/chunks/IT2JLILU.js +1 -0
- package/build/dist/chunks/IV4K7FMD.js +1 -0
- package/build/dist/chunks/{PNA6UIE5.js → JDSSYT6R.js} +1 -1
- package/build/dist/chunks/JFWJBZ7M.js +1 -0
- package/build/dist/chunks/JI5DXDMY.js +1 -0
- package/build/dist/chunks/JJGZ7W3V.js +1 -0
- package/build/dist/chunks/JPPQDELB.js +18 -0
- package/build/dist/chunks/{OLSP46ZD.js → K4P5VYDP.js} +1 -1
- package/build/dist/chunks/{JFYBH3DX.js → K6D6SDIG.js} +1 -1
- package/build/dist/chunks/K7HTDKAT.js +1 -0
- package/build/dist/chunks/KBU3PYP7.js +1 -0
- package/build/dist/chunks/KH4QFN72.js +3 -0
- package/build/dist/chunks/KMSAUFYV.js +1 -0
- package/build/dist/chunks/{RTAHNWHN.js → KOTGFD2V.js} +1 -1
- package/build/dist/chunks/KZA5GYZR.js +1 -0
- package/build/dist/chunks/LCH6F5HT.js +1 -0
- package/build/dist/chunks/LDJI2JAL.js +1 -0
- package/build/dist/chunks/LEV5SNNC.js +3 -0
- package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
- package/build/dist/chunks/{PIIHOXWF.js → LJJYYUEG.js} +1 -1
- package/build/dist/chunks/LKX5WDOQ.js +1 -0
- package/build/dist/chunks/LVFI74ST.js +1 -0
- package/build/dist/chunks/M7BUKZW2.js +1 -0
- package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
- package/build/dist/chunks/MMCM3GSM.js +1 -0
- package/build/dist/chunks/MQ5F2VOK.js +1 -0
- package/build/dist/chunks/MSMHS456.js +1 -0
- package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
- package/build/dist/chunks/{XSKFKBDR.js → N64JJN37.js} +1 -1
- package/build/dist/chunks/NAO7VWZF.js +1 -0
- package/build/dist/chunks/ND32LJWI.js +1 -0
- package/build/dist/chunks/{Q42YI3EP.js → NMJVQX5M.js} +1 -1
- package/build/dist/chunks/NMQBOBWJ.js +1 -0
- package/build/dist/chunks/NQ4MTIU3.js +1 -0
- package/build/dist/chunks/NWPAQER2.js +1 -0
- package/build/dist/chunks/O2J5I4VA.js +1 -0
- package/build/dist/chunks/O4S6XAYV.js +1 -0
- package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
- package/build/dist/chunks/{RUC7KH7A.js → OB7BFDOV.js} +1 -1
- package/build/dist/chunks/OEZ7FCLF.js +1 -0
- package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
- package/build/dist/chunks/{WP6RHXGN.js → OIQTZOBN.js} +1 -1
- package/build/dist/chunks/OODSXDIH.js +1 -0
- package/build/dist/chunks/OOPMZIG7.js +1 -0
- package/build/dist/chunks/OQFNUDMQ.js +1 -0
- package/build/dist/chunks/ORG6LVKJ.js +1 -0
- package/build/dist/chunks/{CBLMQ5UU.js → OSMOBKRQ.js} +1 -1
- package/build/dist/chunks/OTLUQWLF.js +1 -0
- package/build/dist/chunks/{2MT3G7YZ.js → OTYB6BHK.js} +1 -1
- package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
- package/build/dist/chunks/{SMYWWIE6.js → OVM4QIET.js} +1 -1
- package/build/dist/chunks/OYDKAIS2.js +1 -0
- package/build/dist/chunks/P6OB2AFW.js +1 -0
- package/build/dist/chunks/PDPTJMTJ.js +1 -0
- package/build/dist/chunks/PEHXHQVA.js +1 -0
- package/build/dist/chunks/PMFR47H3.js +1 -0
- package/build/dist/chunks/PQXYTOV5.js +1 -0
- package/build/dist/chunks/PSGRZWES.js +1 -0
- package/build/dist/chunks/PZEF5LBL.js +2 -0
- package/build/dist/chunks/Q7L3BX6U.js +1 -0
- package/build/dist/chunks/QBYV7NXH.js +1 -0
- package/build/dist/chunks/QIB6OMQV.js +1 -0
- package/build/dist/chunks/QLAOBULN.js +1 -0
- package/build/dist/chunks/QLFPAN6S.js +1 -0
- package/build/dist/chunks/QMEGAKLI.js +1 -0
- package/build/dist/chunks/QMNUB2GM.js +2 -0
- package/build/dist/chunks/QMZEGT5B.js +1 -0
- package/build/dist/chunks/R73R4KN3.js +1 -0
- package/build/dist/chunks/RN3WUJIO.js +1 -0
- package/build/dist/chunks/RNCMXKKS.js +1 -0
- package/build/dist/chunks/ROQQ62LP.js +1 -0
- package/build/dist/chunks/RUTSEGGD.js +1 -0
- package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
- package/build/dist/chunks/{2VXLVXIB.js → S4UJDZGN.js} +1 -1
- package/build/dist/chunks/SCG5HWMN.js +1 -0
- package/build/dist/chunks/{XQA5LCL6.js → SENOU5JR.js} +1 -1
- package/build/dist/chunks/SMSXZ3FN.js +1 -0
- package/build/dist/chunks/SUNTJ6IU.js +1 -0
- package/build/dist/chunks/SZ466I5X.js +1 -0
- package/build/dist/chunks/TGFQQCRY.js +1 -0
- package/build/dist/chunks/{K4DHHQBI.js → THL4TMQW.js} +2 -2
- package/build/dist/chunks/TI727O2H.js +1 -0
- package/build/dist/chunks/{UD2XMNIT.js → TMRAF2L2.js} +1 -1
- package/build/dist/chunks/TNJTET4G.js +1 -0
- package/build/dist/chunks/TVIMP5CK.js +1 -0
- package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
- package/build/dist/chunks/U243AWCH.js +1 -0
- package/build/dist/chunks/U762746N.js +1 -0
- package/build/dist/chunks/U7UPLF4F.js +1 -0
- package/build/dist/chunks/{7QIO77VE.js → UPKVD7WG.js} +1 -1
- package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
- package/build/dist/chunks/USEF3QKG.js +1 -0
- package/build/dist/chunks/UVAR6BHU.js +1 -0
- package/build/dist/chunks/V5YSJKRH.js +70 -0
- package/build/dist/chunks/VB36EHIR.js +1 -0
- package/build/dist/chunks/VMZYFO6I.js +1 -0
- package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
- package/build/dist/chunks/{U4JGEMKT.js → VVAM3EAK.js} +1 -1
- package/build/dist/chunks/VVJO6OYK.js +1 -0
- package/build/dist/chunks/VVWFB53Q.js +1 -0
- package/build/dist/chunks/VXCGMALF.js +1 -0
- package/build/dist/chunks/VZVW5J7J.js +1 -0
- package/build/dist/chunks/W32UECOL.js +1 -0
- package/build/dist/chunks/{XD6X3KTC.js → W4RYRLL5.js} +1 -1
- package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
- package/build/dist/chunks/WBNFRPAT.js +1 -0
- package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
- package/build/dist/chunks/{4DP2VPXR.js → WOGWLFAL.js} +1 -1
- package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
- package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
- package/build/dist/chunks/X24YTJST.js +1 -0
- package/build/dist/chunks/{IPN6Z4JM.js → X5AL3DUK.js} +1 -1
- package/build/dist/chunks/XBNZ7GTY.js +1 -0
- package/build/dist/chunks/{XL3LLGIR.js → XEBMS5KU.js} +1 -1
- package/build/dist/chunks/XEPCDGN2.js +1 -0
- package/build/dist/chunks/{KIFZ5ZSK.js → XL3W7DAQ.js} +1 -1
- package/build/dist/chunks/{DL6AEWEM.js → XPWGPZ2C.js} +1 -1
- package/build/dist/chunks/{T7TFUH5K.js → XRDLMTBJ.js} +1 -1
- package/build/dist/chunks/XTFRPI4G.js +1 -0
- package/build/dist/chunks/XV3YJ4P6.js +1 -0
- package/build/dist/chunks/XW3VGWXK.js +1 -0
- package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
- package/build/dist/chunks/Y64GFBTA.js +1 -0
- package/build/dist/chunks/YARZE7SJ.js +1 -0
- package/build/dist/chunks/YBLJ75U5.js +1 -0
- package/build/dist/chunks/YEIM6BZQ.js +1 -0
- package/build/dist/chunks/YRSAZTTC.js +7 -0
- package/build/dist/chunks/YXXK6EPI.js +1 -0
- package/build/dist/chunks/Z3IBPCY4.js +2 -0
- package/build/dist/chunks/{QHBS3PVU.js → Z7FGEWO2.js} +1 -1
- package/build/dist/chunks/ZNPVBNC5.js +1 -0
- package/build/dist/chunks/ZQ6AF3VX.js +1 -0
- package/build/dist/chunks/ZTKT3ZQK.js +1 -0
- package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/2THSW4QN.js +0 -1
- package/build/dist/chunks/2TK3ETUO.js +0 -1
- package/build/dist/chunks/35KR3VSS.js +0 -1
- package/build/dist/chunks/3GQ7A3VB.js +0 -1
- package/build/dist/chunks/3XNZUIRU.js +0 -1
- package/build/dist/chunks/46547QT3.js +0 -1
- package/build/dist/chunks/4EN6MQEI.js +0 -1
- package/build/dist/chunks/4I3OU56B.js +0 -1
- package/build/dist/chunks/52ELWNXJ.js +0 -2
- package/build/dist/chunks/5AXWBSPG.js +0 -1
- package/build/dist/chunks/5N3O42X6.js +0 -1
- package/build/dist/chunks/5SMVQCAP.js +0 -1
- package/build/dist/chunks/5SZPNZG4.js +0 -1
- package/build/dist/chunks/64GOINYS.js +0 -1
- package/build/dist/chunks/6I4NTKB2.js +0 -1
- package/build/dist/chunks/6JAXZNZ3.js +0 -1
- package/build/dist/chunks/6O3Q5B6M.js +0 -1
- package/build/dist/chunks/6OGDTEGH.js +0 -1
- package/build/dist/chunks/6WZX7C4T.js +0 -2
- package/build/dist/chunks/6YB3VOUL.js +0 -1
- package/build/dist/chunks/7GJ6SLEV.js +0 -1
- package/build/dist/chunks/7KWZ5QJU.js +0 -1
- package/build/dist/chunks/7QZOTRSA.js +0 -2
- package/build/dist/chunks/7WSHW7KW.js +0 -1
- package/build/dist/chunks/A7I4IWUB.js +0 -1
- package/build/dist/chunks/ABPL3ZZI.js +0 -1
- package/build/dist/chunks/ACW63WIL.js +0 -20
- package/build/dist/chunks/AEL62KCG.js +0 -1
- package/build/dist/chunks/AKYF5264.js +0 -7
- package/build/dist/chunks/AW7AXQCZ.js +0 -1
- package/build/dist/chunks/AXRL3REN.js +0 -1
- package/build/dist/chunks/BBTPRZ6T.js +0 -1
- package/build/dist/chunks/BOVMED7R.js +0 -1
- package/build/dist/chunks/BTPXJAUX.js +0 -1
- package/build/dist/chunks/C7AXJHBT.js +0 -1
- package/build/dist/chunks/CBG5HARQ.js +0 -2
- package/build/dist/chunks/CDPSMI3Z.js +0 -1
- package/build/dist/chunks/CHXBOXOD.js +0 -1
- package/build/dist/chunks/CQEJSCFQ.js +0 -1
- package/build/dist/chunks/DBNTZEAJ.js +0 -1
- package/build/dist/chunks/DHUDSOGR.js +0 -18
- package/build/dist/chunks/DJN3JAWB.js +0 -1
- package/build/dist/chunks/E3RACZUY.js +0 -1
- package/build/dist/chunks/FEYAY6OZ.js +0 -1
- package/build/dist/chunks/FJ4S4GHY.js +0 -1
- package/build/dist/chunks/FWD4L3CJ.js +0 -1
- package/build/dist/chunks/GG6Y4OCJ.js +0 -1
- package/build/dist/chunks/GGHBFLRC.js +0 -1
- package/build/dist/chunks/GGSAKCND.js +0 -1
- package/build/dist/chunks/GRQYTVNT.js +0 -1
- package/build/dist/chunks/H6T5FXEX.js +0 -1
- package/build/dist/chunks/HHXBUYHO.js +0 -1
- package/build/dist/chunks/HKEMQBFA.js +0 -1
- package/build/dist/chunks/HQUVB7Z5.js +0 -3
- package/build/dist/chunks/HU7IMNBI.js +0 -1
- package/build/dist/chunks/HWX36XJI.js +0 -1
- package/build/dist/chunks/I26DMNJG.js +0 -1
- package/build/dist/chunks/I55MURSJ.js +0 -1
- package/build/dist/chunks/IMO3GDA5.js +0 -1
- package/build/dist/chunks/IPRVIKYC.js +0 -1
- package/build/dist/chunks/IVX4R5OL.js +0 -1
- package/build/dist/chunks/JQOQMFWD.js +0 -3
- package/build/dist/chunks/JUZ5JU6D.js +0 -70
- package/build/dist/chunks/JZS3E66E.js +0 -1
- package/build/dist/chunks/K3RDPI5J.js +0 -1
- package/build/dist/chunks/KBKK7UNY.js +0 -1
- package/build/dist/chunks/KVFZKPJT.js +0 -1
- package/build/dist/chunks/L5BLHY34.js +0 -1
- package/build/dist/chunks/LKXO2BQS.js +0 -1
- package/build/dist/chunks/LKZX4CAA.js +0 -1
- package/build/dist/chunks/LYMNHO5T.js +0 -1
- package/build/dist/chunks/M2UXYCKH.js +0 -1
- package/build/dist/chunks/M37654RL.js +0 -1
- package/build/dist/chunks/M6LC6DRE.js +0 -1
- package/build/dist/chunks/MOE3EVAL.js +0 -1
- package/build/dist/chunks/N4Q6GN65.js +0 -1
- package/build/dist/chunks/NAZPDRIF.js +0 -1
- package/build/dist/chunks/NKX3FE34.js +0 -1
- package/build/dist/chunks/NKZKKCK2.js +0 -1
- package/build/dist/chunks/NOFUKKP5.js +0 -1
- package/build/dist/chunks/O6ROOKY2.js +0 -1
- package/build/dist/chunks/OJ4WJUPP.js +0 -1
- package/build/dist/chunks/OOZSE2R7.js +0 -1
- package/build/dist/chunks/OTXSKFUD.js +0 -1
- package/build/dist/chunks/P5AJSLZ7.js +0 -1
- package/build/dist/chunks/PACN53TR.js +0 -1
- package/build/dist/chunks/PAHXBLCS.js +0 -1
- package/build/dist/chunks/PK66GCDT.js +0 -1
- package/build/dist/chunks/PSBQWDYI.js +0 -1
- package/build/dist/chunks/PXT5YTWU.js +0 -1
- package/build/dist/chunks/PZGGE5D3.js +0 -1
- package/build/dist/chunks/QA2RRIES.js +0 -1
- package/build/dist/chunks/QA3UHEO3.js +0 -1
- package/build/dist/chunks/QFNT73OF.js +0 -1
- package/build/dist/chunks/QW2OPEYJ.js +0 -1
- package/build/dist/chunks/QYVREJYC.js +0 -1
- package/build/dist/chunks/ROFPXEQ5.js +0 -2
- package/build/dist/chunks/RTGS7RIO.js +0 -1
- package/build/dist/chunks/RUX3RY7Y.js +0 -1
- package/build/dist/chunks/RVDUSNWW.js +0 -1
- package/build/dist/chunks/S5CBVFHY.js +0 -1
- package/build/dist/chunks/SIYUNOLI.js +0 -1
- package/build/dist/chunks/TEJ7W534.js +0 -1
- package/build/dist/chunks/TPBAFS7K.js +0 -1
- package/build/dist/chunks/TVWMTMEF.js +0 -1
- package/build/dist/chunks/U2RMUVVY.js +0 -1
- package/build/dist/chunks/U5PMVP56.js +0 -1
- package/build/dist/chunks/V5JWGWXC.js +0 -1
- package/build/dist/chunks/VCOTCVKN.js +0 -1
- package/build/dist/chunks/VEQBHI6O.js +0 -1
- package/build/dist/chunks/VNV6ZISN.js +0 -1
- package/build/dist/chunks/VYAJXLND.js +0 -1
- package/build/dist/chunks/WCNHZYQQ.js +0 -1
- package/build/dist/chunks/WLMWWEP7.js +0 -2
- package/build/dist/chunks/X2P55AC3.js +0 -1
- package/build/dist/chunks/XBE3B6Y2.js +0 -1
- package/build/dist/chunks/XKSVTN5X.js +0 -1
- package/build/dist/chunks/XSRIJUFU.js +0 -1
- package/build/dist/chunks/YCZPSMZ5.js +0 -1
- package/build/dist/chunks/YDNTY67T.js +0 -1
- package/build/dist/chunks/YN56C7PN.js +0 -1
- package/build/dist/chunks/YRNXGQJC.js +0 -1
- package/build/dist/chunks/YWRLY5EA.js +0 -1
- package/build/dist/chunks/YWSX6IE6.js +0 -1
- package/build/dist/chunks/YXTSWRV5.js +0 -1
- package/build/dist/chunks/Z6LZGCVW.js +0 -1
- package/build/dist/chunks/ZQWZGH7V.js +0 -1
- package/build/dist/chunks/ZSN4IRI5.js +0 -1
- package/build/dist/chunks/ZV5HIQXC.js +0 -1
- package/build/dist/chunks/ZXJ24B4L.js +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{a as ae}from"./3CCBUYUM.js";import{a as xt,d as It,e as Tt}from"./ZTKT3ZQK.js";import{a as Re}from"./7MR37STI.js";import{a as Ze,b as Ge,d as At}from"./X24YTJST.js";import{h as Je,i as St}from"./2GXHYI23.js";import{b as kt,c as yt,d as gt}from"./QLFPAN6S.js";import{d as wt,e as te}from"./LKX5WDOQ.js";import{a as ht}from"./Z7FGEWO2.js";import{b as bt}from"./SPJCSEKP.js";import{a as q}from"./43LI5NKJ.js";import{a as A,d as W}from"./66F5ZH34.js";import{d as Oe,g as R,i as Ee}from"./NWNYJ26T.js";import{b as Le}from"./IX3GZMTM.js";import{o as ft}from"./MQ5F2VOK.js";import{b as f,j as z}from"./TI727O2H.js";import{a as i,e as ie}from"./XSD5NL7J.js";import{a as Ye}from"./JXOEJPJ4.js";import{encodeFunctionData as be,erc20Abi as Qa,getAddress as aa,parseAbi as pt,zeroAddress as Xa}from"viem";import{decodeAbiParameters as ca,encodeFunctionData as ua,getAddress as le,parseAbiParameters as ma,zeroAddress as he,zeroHash as Dt}from"viem";import{decodeAbiParameters as ra,encodeFunctionData as na,erc20Abi as sa,getAddress as Ct,parseAbi as ia,parseAbiParameters as la,zeroHash as Mt}from"viem";var et=Ct("0xCE29862924756584BBD0D75CA1249d22007E2813"),Lt="(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)",da="(uint256 value,uint256 nonce,uint256 deadline,uint8 v,bytes32 r,bytes32 s)",vt=ia(["function BLUE() view returns (address)",`function vaultExitBundlesV1InKindRedemptionVaultV2(address vault,address adapter,${Lt}[] marketParamsList,uint256 exitAssets,${da} sharesPermit,uint256 deadline)`]);function N(e,t=!1){if(typeof e!="string"||!/^\d{1,78}$/.test(e)||BigInt(e)>=1n<<256n||!t&&BigInt(e)===0n)throw new i("Provide a positive uint256 decimal base-unit string.");return BigInt(e)}var Pt=(e,t)=>e<t?e:t;async function io(e,t,s,r,n){q(n);let l=N(r.amount),a=N(r.maxShares),o=N(r.maxPenaltyAssets,!0),u=N(r.deadline),c=e.clientFor(f),m=await At(c,t,s),d=(S,B,Ce,ee=[])=>c.readContract({address:S,abi:B,functionName:Ce,args:ee,blockNumber:m.blockNumber}),[p,b,h,w]=await Promise.all([c.getBlock({blockNumber:m.blockNumber}),d(et,vt,"BLUE"),d(t,sa,"balanceOf",[n]),d(t,Ze,"previewRedeem",[a])]);if(typeof b!="string"||Ct(b)!==$)throw new i("VaultExitBundlesV1 does not report the pinned Morpho Blue.");if(u<p.timestamp||u>p.timestamp+300n)throw new i("Use an absolute Unix deadline within the next five minutes.");if(a>Ge(h))throw new i("maxShares exceeds the wallet share balance.");let y=Pt(m.idle,l),k=m.markets.filter(S=>S.supplied>0n&&j(S.id)),g=l-y,T=k[0]?.penalty??0n,x=g*10n**18n/(10n**18n+T);if(g>0n&&x===0n)throw new i("The penalty-adjusted in-kind amount rounds to zero.");let M=[];for(let S of k){if(x===0n)break;let B=Pt(S.supplied,x);M.push({marketId:S.id,assets:B,penalty:(B*S.penalty+10n**18n-1n)/10n**18n}),x-=B}if(x>0n)throw new i("The supported adapter positions cannot cover the requested in-kind exit. Reduce the amount; unverified market positions are not transferred.");if(l+BigInt(M.length)>Ge(w))throw new i("maxShares cannot cover the exit and per-market rounding buffer.");if(M.some(S=>S.assets>m.blueCash))throw new i("Morpho Blue cannot fund the largest in-kind callback. Reduce the amount.");let C=M.reduce((S,B)=>S+B.penalty,0n);if(C>o)throw new i("In-kind penalty exceeds maxPenaltyAssets.");let P=[...y?[y]:[],...M.flatMap(S=>[S.assets,S.penalty].filter(B=>B>0n))],E=(await Promise.all(P.map(S=>d(t,Ze,"previewWithdraw",[S])))).reduce((S,B)=>S+Ge(B),0n);if(E===0n||E>a)throw new i("Separately rounded burns exceed maxShares.");let Z=M.map(S=>ra(la(Lt),m.markets.find(B=>B.id===S.marketId).data)[0]),H=m.markets[0]?.adapter;if(!H)throw new i("In-kind exit requires a verified market adapter.");let F=`In-kind exit from ${t}: spend at most ${E} share base units; receive ${y} ${s.symbol} base units and Morpho Blue supply positions ${M.map(S=>`${S.marketId}: ${S.assets} ${s.symbol} base units`).join(", ")||"none"}. Penalty ${C} ${s.symbol} base units. Deadline ${u} (Unix seconds). Supply positions remain exposed to borrower default and can only be withdrawn when market liquidity returns. This is not a cash exit. The exact share allowance bounds drift; accrual can require a fresh preview.`,v=na({abi:vt,functionName:"vaultExitBundlesV1InKindRedemptionVaultV2",args:[t,H,Z,l,{value:0n,nonce:0n,deadline:0n,v:0,r:Mt,s:Mt},u]}),U=[e.approval(t,et,E.toString(),f),e.unsignedTx({to:et,data:v,value:"0",chainId:f,description:F})],D=await e.preview(U,n),V=-D.changes.filter(S=>S.token.chainId===f&&R(S.token.address,t)).reduce((S,B)=>{if(B.token.decimals!==18||!/^-?\d+$/.test(B.amount))throw new i("Invalid in-kind share preview.");return S+BigInt(B.amount)},0n);if(V<=0n||V>E)throw new i("In-kind preview exceeds the exact share authorization or burns no shares.");return{txs:U,preview:D,summary:F,receipt:{idleAssets:y.toString(),positions:M.map(S=>({marketId:S.marketId,asset:s,assets:S.assets.toString()})),penaltyAssets:C.toString()}}}var we=le("0x53A1eB6589861F686af7c531211E35Aefe30210f"),Ut=["supply","withdraw","supplyCollateralAndBorrow","repayAndWithdrawCollateral","migrateBorrowPosition"],tt={kind:0,data:"0x"},_e={nonce:0n,deadline:0n,signature:{v:0,r:Dt,s:Dt}},pa=ma("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),$t=e=>({tools:[{name:"morpho_bundle",inputSchema:{type:"object",additionalProperties:!1,required:["operation","marketId","deadline"],properties:{operation:{type:"string",enum:Ut,description:"Bundle: supply, withdraw, supplyCollateralAndBorrow, repayAndWithdrawCollateral, or migrateBorrowPosition (move debt to destinationMarketId)."},marketId:{type:"string",description:"Verified Morpho Blue market id (0x + 64 hex digits); the source market for migrateBorrowPosition."},destinationMarketId:{type:"string",description:"Only for migrateBorrowPosition: verified market id (0x + 64 hex) to move the borrow into; must share the same tokens."},assets:A(`Amount of the market's loan token in base units (read its decimals). Example: "1000000" = 1 USDG for a 6-decimal token.`),collateralAssets:A(`Collateral amount in base units of the market's collateral token (read its decimals). Example: "1000000" = 1 USDG for a 6-decimal token.`),shares:A("Market share amount in base units (supply or borrow shares, read the position), instead of assets. Give assets or shares, not both."),maxRepayAssets:A('Most loan token you accept paying to repay, in base units of the loan token (read its decimals). Example: "1000000" = 1 USDG.'),maxLtv:A("Highest loan-to-value allowed after the bundle, as an 18-decimal wad in base units (0.8e18 = 80 percent); cannot exceed the market LLTV."),deadline:A("Absolute Unix seconds deadline, no more than five minutes ahead. Example: 1800000000."),allocations:{type:"array",maxItems:4,description:"Up to four Public Allocator moves that add liquidity to the market before borrowing or withdrawing; one per vault.",items:{type:"object",additionalProperties:!1,required:["vault","assets","maxPenaltyAssets"],properties:{vault:{type:"string",description:"Pinned NetNet or Longbow V2 vault address (0x + 40 hex) to pull liquidity from; one entry per vault."},sourceMarketId:{type:"string",description:"Source market id (0x + 64 hex) to pull from; omit to allocate idle vault assets."},assets:A(`Amount to reallocate, in base units of the vault's asset (USDG 6 decimals, WETH 18). Example: "1000000" = 1 USDG.`),maxPenaltyAssets:A(`Highest allocator penalty you accept, in base units of the vault's asset. Example: "10000" = 0.01 USDG for a 6-decimal asset.`)}}}}},execute:async(t,s)=>{try{q(s);let r=t.operation,n=e.clientFor(f);if(await n.getChainId()!==f||typeof r!="string"||!Ut.includes(r))throw new i("Choose a supported Blue bundle on chain 4663.");let l=["operation","marketId","deadline",...r==="supply"?["assets"]:r==="withdraw"?["assets","shares","allocations"]:r==="supplyCollateralAndBorrow"?["collateralAssets","assets","maxLtv","allocations"]:r==="repayAndWithdrawCollateral"?["assets","shares","maxRepayAssets","collateralAssets","maxLtv"]:["destinationMarketId","maxLtv","allocations"]];if(Object.keys(t).some(v=>!l.includes(v)))throw new i("Unexpected argument for this Blue bundle.");let a=await n.getBlock(),o=N(t.deadline);if(o<a.timestamp||o>a.timestamp+300n)throw new i("Use an absolute Unix deadline within the next five minutes.");let[u,c]=await Promise.all([n.readContract({address:we,abi:Re,functionName:"BLUE",blockNumber:a.number}),n.readContract({address:we,abi:Re,functionName:"PUBLIC_ALLOCATOR",blockNumber:a.number})]);if(le(u)!==$||le(c)!==xt)throw new i("BlueBundlesV1 deployment does not match Oak\u2019s pinned Blue and Public Allocator.");let m=async v=>{if(typeof v!="string"||!j(v))throw new i("Choose a verified Morpho market with a supported exit.");let U=await n.readContract({address:$,abi:O,functionName:"idToMarketParams",args:[v],blockNumber:a.number}),D={loanToken:le(U[0]),collateralToken:le(U[1]),oracle:le(U[2]),irm:le(U[3]),lltv:U[4]};if(!R(ke({...D,lltv:String(D.lltv)}),v))throw new i("Blue bundle market identity mismatch.");return D},d=await m(t.marketId),p=r==="migrateBorrowPosition"?await m(t.destinationMarketId):d;if(d.loanToken!==p.loanToken||d.collateralToken!==p.collateralToken)throw new i("Migration requires the same loan and collateral tokens.");if(r==="migrateBorrowPosition"&&t.marketId===t.destinationMarketId)throw new i("Choose a different destination market.");if(r!=="supply"&&!await n.readContract({address:$,abi:O,functionName:"isAuthorized",args:[s,we],blockNumber:a.number}))throw new i(`Authorize the pinned Blue bundle explicitly with morpho_manage setAuthorization account ${we}, enabled true, then retry. That authority covers all Blue positions. Revoke it with enabled false after the bundle.`);let b=t.assets===void 0?0n:N(t.assets,!0),h=t.shares===void 0?0n:N(t.shares,!0),w=t.collateralAssets===void 0?0n:N(t.collateralAssets,!0),y=r==="supply"||r==="withdraw"?0n:N(t.maxLtv,!0);if(y>p.lltv)throw new i("maxLtv cannot exceed the verified destination market LLTV.");if(r==="supply"&&b===0n||r==="withdraw"&&b===0n==(h===0n)||r==="supplyCollateralAndBorrow"&&w===0n&&b===0n||r==="repayAndWithdrawCollateral"&&(b>0n&&h>0n||b===0n&&h===0n&&w===0n))throw new i("Choose a nonzero amount; assets and shares are mutually exclusive for repayment/withdrawal.");let k=t.allocations??[];if(!Array.isArray(k)||k.length>4||k.length&&r==="supplyCollateralAndBorrow"&&b===0n)throw new i("Provide at most four explicit allocations, only with a borrow or withdrawal.");let g=new Set,T=[],x=0n;for(let v of k){if(!v||typeof v!="object"||Array.isArray(v)||Object.keys(v).some(Xe=>!["vault","sourceMarketId","assets","maxPenaltyAssets"].includes(Xe)))throw new i("Unsupported bundled allocation input.");let U=v,D=await It(e,{vault:U.vault,marketId:r==="migrateBorrowPosition"?t.destinationMarketId:t.marketId});if(g.has(D.definition.vault.toLowerCase()))throw new i("Use each source vault at most once per bundle.");g.add(D.definition.vault.toLowerCase());let V=N(U.assets),S=N(U.maxPenaltyAssets,!0);if(!D.permission||V>=1n<<128n||V>D.headroom||D.penalty>10n**18n||D.asset.address!==p.loanToken)throw new i("Bundled allocation is disabled, unqualified or exceeds target capacity.");let B=(V*D.penalty+10n**18n-1n)/10n**18n;if(B>S)throw new i("Bundled allocation exceeds maxPenaltyAssets.");x+=B;let Ce=U.sourceMarketId===void 0,ee=Ce?void 0:D.sources.find(Xe=>R(Xe.id,String(U.sourceMarketId)));if(Ce?!D.canIdle||V>D.data.idle:!ee||!ee.canPull||V>ee.capacity||V>D.data.blueCash)throw new i("Bundled allocation source cannot cover the requested amount.");T.push({vault:D.definition.vault,adapter:D.target.adapter,marketParams:D.params,sourceAdapter:ee?.adapter??he,sourceMarketParams:ee?ca(pa,ee.data)[0]:D.params,assets:V,penalty:D.penalty,fromIdle:Ce})}let M,C,P,I=0n;if(r==="supply")M="blueBundlesV1Supply",P=d.loanToken,I=b,C=[d,b,tt,0n,he,o];else if(r==="withdraw")M="blueBundlesV1Withdraw",C=[d,b,h,_e,T,0n,he,o];else if(r==="supplyCollateralAndBorrow"){if(M="blueBundlesV1SupplyCollateralAndBorrow",P=d.collateralToken,I=w,x>=b&&x>0n)throw new i("Allocation penalties would consume the borrow proceeds.");C=[d,w,b,y,tt,_e,T,0n,he,o]}else if(r==="repayAndWithdrawCollateral"){if(M="blueBundlesV1RepayAndWithdrawCollateral",P=d.loanToken,I=N(t.maxRepayAssets,!0),b>I||h>0n&&I===0n)throw new i("Repayment requires a sufficient maxRepayAssets budget.");C=[d,b,h,I,w,y,tt,_e,0n,he,o]}else M="blueBundlesV1MigrateBorrowPosition",C=[d,p,y,_e,T,0n,he,o];let E=`Morpho Blue atomic ${r}: ${JSON.stringify(t)}. Allocation penalties ${x} loan-token base units; zero referral fee. Max LTV ${y}; absolute deadline ${o}. Migration adds allocation penalties to destination debt; borrowing deducts them from proceeds. Exact input approval ${I}. Existing Blue bundle authorization remains until explicitly revoked with morpho_manage. No opaque callback, permit or signature is accepted.`,Z=[...P&&I?[e.approval(P,we,I.toString(),f)]:[],e.unsignedTx({to:we,data:ua({abi:Re,functionName:M,args:C}),value:"0",chainId:f,description:E})],H=await e.preview(Z,s),F=new Map;for(let v of H.changes)if(BigInt(v.amount)<0n){let U=v.token.address.toLowerCase();F.set(U,(F.get(U)??0n)-BigInt(v.amount))}if([...F].some(([v,U])=>!P||v!==P.toLowerCase()||U>I))throw new i("Bundle preview spends outside the exact input budget.");return{txs:Z,preview:H,summary:E}}catch(r){throw new i(e.plainError(r))}}}]});import{concatHex as Bt,decodeAbiParameters as fa,encodeAbiParameters as Rt,encodeFunctionData as at,erc20Abi as Nt,getAddress as K,keccak256 as rt,zeroAddress as ye,zeroHash as ba}from"viem";var Y=K("0x6120765Ba5336150BbdDdD0Cd9108B5bFD369632"),ha=["0x90B800999e4ACd1bD20283BD450bBd2e06D91F7C","0x708d6Bf6F847202a0755bb5636bE663B174242ea"].map(e=>K(e)),nt=ae.find(e=>e.name==="take"),Ot=[nt.inputs[0]],wa=[nt.inputs[0].components[0]];function Et(e){let t=rt(Bt(["0x600b380380600b5f395ff3",Rt(wa,[e])]));return rt(Bt(["0xff",e.midnight,ba,t]))}var de=10n**18n,Gt=(e,t)=>(e+(t-1n)/2n)/t;function _t(e){if(e<0n)return 10n**36n/_t(-e);let t=693147180559945309n,s=(e+322611214989459870n)/t,r=e-s*t,n=r*r/(2n*de),l=n*r/(3n*de);return de+r+n+l<<s}function ka(e){if(e<0n||e>6744n)throw new i("Midnight tick is outside 0..6744.");return Gt(Gt(10n**36n,de+_t(4987541511039073n*(3372n-e))),10n**11n)*10n**11n}function He(e,t){if(typeof e!="string"||!/^0x([0-9a-f]{2})*$/i.test(e)||e.length>32770||t!==void 0&&e.length!==2+t*2)throw new i("Provide bounded canonical hex data.");return e}function ot(e,t){if(!Array.isArray(e)||e.length!==t)throw new i("Invalid Midnight state tuple.");return e.map(s=>{if(typeof s=="number"&&Number.isSafeInteger(s)&&s>=0)return BigInt(s);if(typeof s=="bigint"&&s>=0n)return s;throw new i("Invalid Midnight integer state.")})}var ya=e=>JSON.parse(JSON.stringify(e,(t,s)=>typeof s=="bigint"?s.toString():s)),Ht=e=>{async function t(n,l){let a=He(n,32),o=e.clientFor(f);if(await o.getChainId()!==f)throw new i("Midnight requires chain 4663.");let u=await o.getBlock(),c=(k,g=[])=>o.readContract({address:Y,abi:ae,functionName:k,args:g,blockNumber:u.number}),m=await c("toMarket",[a]);if(m.chainId!==BigInt(f)||K(m.midnight)!==Y||!R(Et(m),a))throw new i("Midnight market identity does not match the pinned chain and contract.");if(![z[f].tokens.USDG.address,z[f].tokens.WETH.address].some(k=>R(k,m.loanToken)))throw new i("This Midnight loan token needs a qualified transfer and exit fixture.");if(!m.collateralParams.length||m.collateralParams.length>128)throw new i("Invalid Midnight collateral inventory.");let[p,b,h,w]=await Promise.all([c("position",[a,l]),c("updatePositionView",[m,a,l]),c("marketState",[a]),c("isHealthy",[m,a,l])]),y=async k=>{let[g,T]=await Promise.all([o.readContract({address:k,abi:Nt,functionName:"decimals",blockNumber:u.number}),o.readContract({address:k,abi:Nt,functionName:"symbol",blockNumber:u.number})]);if(!Number.isInteger(g)||g>36||typeof T!="string")throw new i("Invalid Midnight token metadata.");return{address:K(k),decimals:g,symbol:T.replace(/[^a-zA-Z0-9.$_-]/g,"").slice(0,32),chainId:f}};return{id:a,rpc:o,block:u,market:m,read:c,token:y,loan:await y(m.loanToken),position:ot(p,6),updated:ot(b,3),state:ot(h,13),healthy:w}}let s=(n,l,a,o)=>({name:n,inputSchema:{type:"object",properties:l,required:a,additionalProperties:!1},execute:async(u,c)=>{try{if(q(c),Object.keys(u).some(m=>!Object.hasOwn(l,m)))throw new i("Unsupported Midnight argument.");return await o(u,c)}catch(m){throw new i(e.plainError(m))}}});async function r(n,l,a){return{txs:n,preview:await e.preview(n,l),summary:a}}return{tools:[s("morpho_midnight_status",{marketId:{type:"string",description:"Midnight market id: 0x + 64 hex digits (bytes32)."}},["marketId"],async(n,l)=>{let a=await t(n.marketId,l),o=await Promise.all(a.market.collateralParams.map(async(m,d)=>({token:await a.token(m.token),lltvWad:m.lltv.toString(),oracle:m.oracle,assets:String(await a.read("collateral",[a.id,l,BigInt(d)]))}))),u=["configurator","feeSetter","feeClaimer","tickSpacingSetter"],c=await Promise.all(u.map(m=>a.read(m)));return{protocol:Object.fromEntries(u.map((m,d)=>[m,K(String(c[d]))])),continuousFeePerSecondWad:String(a.state[11]),tickSpacing:String(a.state[12]),settlementFeeCbps:a.state.slice(4,11).map(String),settlementFeeCbpWadScale:"1000000000000",chainId:f,midnight:Y,marketId:a.id,blockNumber:String(a.block.number),market:ya(a.market),loanToken:a.loan,collaterals:o,debtUnits:String(a.position[4]),creditUnits:String(a.updated[0]),pendingFeeUnits:String(a.updated[1]),withdrawableUnits:String(a.state[2]),healthy:a.healthy,maturity:String(a.market.maturity),matured:a.block.timestamp>a.market.maturity,warning:"Maturity does not guarantee lender liquidity. Borrowers become liquidatable after maturity even when collateralized. Lender credit may absorb borrower default losses."}}),s("morpho_midnight_take",{offer:{type:"string",description:"ABI-encoded Offer struct, never transaction calldata."},ratifierData:{type:"string",description:"Hex proof data (0x...) that the offer's pinned ratifier uses to confirm the maker approved this offer."},units:A("Fixed debt units to trade, as a decimal string below 2^128. The asset cost or proceeds follow from the offer price; maxAssets and minAssets bound them."),maxAssets:A('Most loan token you will spend when buying credit, in base units of the market loan token (read its decimals). Example: "1000000" = 1 USDG.'),minAssets:A('Least loan token you must receive when selling credit or borrowing, in base units of the market loan token. Example: "1000000" = 1 USDG.')},["offer","ratifierData","units","maxAssets","minAssets"],async(n,l)=>{let a=He(n.offer),[o]=fa(Ot,a);if(!R(Rt(Ot,[o]),a))throw new i("Offer encoding is not canonical.");let u=await t(Et(o.market),l),c=N(n.units),m=N(n.maxAssets,!0),d=N(n.minAssets,!0),p=He(n.ratifierData);if(c>=1n<<128n||R(o.maker,l)||o.callback!==ye||o.callbackData!=="0x"||!ha.includes(K(o.ratifier)))throw new i("Use a non-self offer with a pinned ratifier and no maker callbacks. Callback routes need a separate qualified builder.");if(u.block.timestamp<o.start||u.block.timestamp>o.expiry||o.expiry<o.start)throw new i("The Midnight offer is not currently live.");if(o.buy&&o.receiverIfMakerIsSeller!==ye||!o.buy&&o.receiverIfMakerIsSeller===ye)throw new i("Invalid offer seller receiver.");if(o.buy&&u.block.timestamp>u.market.maturity&&c>u.updated[0])throw new i("Post-maturity sales cannot increase this wallet\u2019s debt.");let b=await u.read("settlementFee",[u.id,u.market.maturity>u.block.timestamp?u.market.maturity-u.block.timestamp:0n]),h=ka(o.tick);if(b>h&&o.buy)throw new i("Settlement fee exceeds the offer price.");let w=o.buy?h-b:h,y=w+b,k=v=>o.buy?v/de:(v+de-1n)/de,g=k(c*y),T=k(c*w);if(o.buy?T<d||T===0n:g>m||g===0n)throw new i("Midnight proceeds/spend do not fit the requested bounds.");let x=await u.read("consumed",[o.maker,o.group]);if(o.maxAssets===0n==(o.maxUnits===0n)||x+(o.maxAssets?o.buy?g:T:c)>(o.maxAssets||o.maxUnits))throw new i("Midnight offer capacity is exhausted or invalid.");if(u.state[11]>o.continuousFeeCap||o.tick%u.state[12]!==0n)throw new i("Offer fee cap or market tick spacing no longer permits execution.");let M=await u.read("isAuthorized",[o.maker,o.ratifier]),C=[{type:"function",name:"isRatified",stateMutability:"view",inputs:[nt.inputs[0],{type:"bytes"},{type:"address"}],outputs:[{type:"bytes32"}]}],P=await u.rpc.readContract({address:o.ratifier,abi:C,functionName:"isRatified",args:[o,p,l],blockNumber:u.block.number});if(M!==!0||P!==rt(new TextEncoder().encode("morpho.midnight.callbackSuccess")))throw new i("The maker has not authorized and ratified this exact offer.");let I=at({abi:ae,functionName:"take",args:[o,p,c,l,o.buy?l:ye,ye,"0x"]}),E=`Midnight ${o.buy?"sell credit or borrow":"buy credit or reduce debt"}: ${c} fixed debt units; ${o.buy?`receive ${T}`:`spend ${g}`} ${u.loan.symbol} base units (token ${u.loan.address}, decimals ${u.loan.decimals}). Maturity ${u.market.maturity} Unix seconds; offer expiry ${o.expiry}. A borrower can lose collateral after maturity; lender withdrawal depends on repayments and bears default losses. No lender signature or callback is created. Bounds are rechecked locally; the take calldata fixes the offer and units. Exact buyer approval caps wallet spending.`,Z=[...o.buy?[]:[e.approval(u.loan.address,Y,g.toString(),f)],e.unsignedTx({to:Y,data:I,value:"0",chainId:f,description:E})],H=await r(Z,l,E),F=H.preview.changes.filter(v=>v.token.chainId===f&&R(v.token.address,u.loan.address)).reduce((v,U)=>v+BigInt(U.amount),0n);if(o.buy?F<T:F!==-g)throw new i("Midnight preview does not match the exact quoted cash flow.");return H}),s("morpho_midnight_action",{marketId:{type:"string",description:"Midnight market id: 0x + 64 hex digits (bytes32)."},operation:{enum:["supplyCollateral","withdrawCollateral","repay","withdraw","updatePosition","claimContinuousFee"],description:"Action: add or remove collateral, repay debt, withdraw matured credit, refresh the position, or claim continuous fees (fee claimer only)."},amount:A('Amount in base units of the relevant token: the collateral token for collateral operations, else the loan token (read decimals). Example: "1000000" = 1 USDG.'),collateralIndex:{type:"integer",minimum:0,maximum:127,description:"Zero-based position of the collateral in the market collateral list; required for supplyCollateral and withdrawCollateral only."}},["marketId","operation"],async(n,l)=>{let a=await t(n.marketId,l),o=n.operation;if(!["supplyCollateral","withdrawCollateral","repay","withdraw","updatePosition","claimContinuousFee"].includes(String(o)))throw new i("Choose a finite Midnight position operation.");let u,c,m=a.loan,d=0n;if(o==="updatePosition"){if(n.amount!==void 0||n.collateralIndex!==void 0)throw new i("Position update takes no amount or collateral index.");u=[a.market,l]}else if(o==="claimContinuousFee"){if(d=N(n.amount),n.collateralIndex!==void 0||K(String(await a.read("feeClaimer")))!==K(l))throw new i("This wallet lacks the Midnight fee claimer role or supplied an unused collateral index.");u=[a.market,d,l]}else{if(d=N(n.amount),d>=1n<<128n)throw new i("Midnight position amount exceeds uint128.");if(o==="supplyCollateral"||o==="withdrawCollateral"){if(!Number.isInteger(n.collateralIndex)||Number(n.collateralIndex)<0||Number(n.collateralIndex)>=a.market.collateralParams.length)throw new i("Choose a current collateral index.");let h=BigInt(String(n.collateralIndex)),w=await a.token(a.market.collateralParams[Number(h)].token);if(m=w,o==="withdrawCollateral"&&d>await a.read("collateral",[a.id,l,h]))throw new i("Insufficient Midnight collateral.");u=o==="supplyCollateral"?[a.market,h,d,l]:[a.market,h,d,l,l],o==="supplyCollateral"&&(c=w)}else{if(n.collateralIndex!==void 0)throw new i("This operation takes no collateral index.");if(o==="repay"&&d>a.position[4]||o==="withdraw"&&(d>a.updated[0]||d>a.state[2]))throw new i("Amount exceeds current debt, credit or available repayment liquidity.");u=o==="repay"?[a.market,d,l,ye,"0x"]:[a.market,d,l,l],o==="repay"&&(c=a.loan)}}let p=`Midnight ${o}: ${d} ${m.symbol} base units (token ${m.address}, decimals ${m.decimals}) on ${a.id}; beneficiary ${l}; maturity ${a.market.maturity} Unix seconds. No callbacks or delegation. Withdrawal can fail if collateral health or lender liquidity changes.`,b=[...c?[e.approval(c.address,Y,d.toString(),f)]:[],e.unsignedTx({to:Y,data:at({abi:ae,functionName:String(o),args:u}),value:"0",chainId:f,description:p})];return r(b,l,p)}),s("morpho_midnight_manage",{operation:{type:"string",enum:["setConsumed","setIsAuthorized","setConfigurator","setFeeSetter","setFeeClaimer","setTickSpacingSetter","enableLltv","enableLiquidationCursor","setMarketTickSpacing","setMarketSettlementFee","setMarketContinuousFee","setDefaultSettlementFee","setDefaultContinuousFee","claimSettlementFee"],description:"Midnight management function name; role-gated except setConsumed and setIsAuthorized, which act on this wallet."},values:{type:"array",maxItems:3,description:"Ordered arguments for the chosen operation, as in the Midnight ABI: decimal strings for integers (base units), 0x addresses or bytes32, or booleans.",items:{oneOf:[{type:"string"},{type:"boolean"}]}}},["operation","values"],async(n,l)=>{let a={setConfigurator:"configurator",setFeeSetter:"configurator",setFeeClaimer:"configurator",setTickSpacingSetter:"configurator",enableLltv:"configurator",enableLiquidationCursor:"configurator",setMarketTickSpacing:"tickSpacingSetter",setMarketSettlementFee:"feeSetter",setMarketContinuousFee:"feeSetter",setDefaultSettlementFee:"feeSetter",setDefaultContinuousFee:"feeSetter",claimSettlementFee:"feeClaimer"};if(typeof n.operation!="string"||!["setConsumed","setIsAuthorized",...Object.keys(a)].includes(n.operation)||!Array.isArray(n.values))throw new i("Choose a finite Midnight management operation and ordered values.");let o=n.operation,u=ae.find(p=>p.name===o);if(n.values.length!==u.inputs.length)throw new i("Provide the exact ordered operation values.");let c=e.clientFor(f);if(await c.getChainId()!==f)throw new i("Midnight requires chain 4663.");let m=u.inputs.map((p,b)=>{let h=n.values[b];if(p.type==="bool"){if(typeof h!="boolean")throw new i("Use boolean management values.");return h}if(p.type==="address")return Ee(h,"Use explicit management addresses.",Oe);if(p.type==="bytes32")return He(h,32);if(/^uint/.test(p.type)){let w=N(h,!0);if(w>=1n<<BigInt(p.type.slice(4)))throw new i("Management integer exceeds its ABI width.");return w}throw new i("Unsupported management argument type.")});if(o==="setConsumed"||o==="setIsAuthorized"){if(!R(String(m[2]),l))throw new i("Midnight management is bound to this wallet.")}else{let p=await c.readContract({address:Y,abi:ae,functionName:a[o]});if(typeof p!="string"||K(p)!==K(l))throw new i("This wallet lacks the Midnight configuration, fee or tick role.")}let d=`Midnight ${o}, ordered values ${JSON.stringify(n.values)}. ${o==="setIsAuthorized"&&m[1]?"This grants authority over all Midnight positions, cancellations and further delegation, without an amount cap. Revoke with false when done.":""}${o==="setConsumed"?"Consumption only increases; setting uint128 maximum permanently cancels this offer group.":""}`;return r([e.unsignedTx({to:Y,data:at({abi:ae,functionName:o,args:m}),value:"0",chainId:f,description:d})],l,d)})]}};import{decodeAbiParameters as re,encodeAbiParameters as ga,encodeFunctionData as G,erc20Abi as it,getAddress as L,isAddress as Fe,keccak256 as Sa,parseAbi as Ve,parseAbiParameters as J}from"viem";var De="morpho",Aa="https://api.morpho.org/graphql",$=L(z[f].morpho.morpho_blue.address),xa=L(z[f].morpho.adaptive_curve_irm.address),Ia=L(z[f].morpho.USDG.address),me=L(z[f].morpho.WETH.address),Ta=["0x7c820d6a09502d63be80bb8025ec479d29d7c06e70f8df65a92aaeed23a366e2","0x1fa5293f9f60059a7f6a4923022156fcdcc038bd3749be55897000c03afe92d8"],Ma={"oak-recorded":"Oak recorded chain observations (block 100362239).","morpho-listed":"Morpho API (POST https://api.morpho.org/graphql, markets where chainId_in [4663]) returned listed: true, fetched 2026-10-31 UTC.",longbow:"Longbow market list: Longbow MCP list_markets/get_market (https://mcp.longbow.credit/mcp, named on https://longbow.cash/mcp) and the live market list on https://longbow.cash/earn, fetched 2026-10-31 UTC; each ID re-read on chain.",netnet:"NetNet Credit: six stock-token market IDs printed at https://docs.netnet.capital/credit, plus the Loopback wsNET/USDG market returned by NetNet's Turbo router marketId() and Credit adapter marketIds(6); fetched 2026-10-31 UTC."},lt=[{marketId:"0x7c820d6a09502d63be80bb8025ec479d29d7c06e70f8df65a92aaeed23a366e2",label:"WETH/USDG 77%",source:"oak-recorded"},{marketId:"0x1fa5293f9f60059a7f6a4923022156fcdcc038bd3749be55897000c03afe92d8",label:"USDG/WETH",source:"oak-recorded"},{marketId:"0x0309c02dabf0be02682af1a2bde9a457f4df0f0b6bc889cde3f948e5315e4114",label:"spUSDG/USDG 91.5%",source:"morpho-listed"},{marketId:"0x10151e2ac82a820153520d9d77d56de1c84775e23b79bdc11e2e34282d9afa10",label:"SPCX/USDG 62.5%",source:"morpho-listed"},{marketId:"0x127353ba63e08f74d8e9ce8a1c2b41b5f89c7167135b1c09fbed34a71b4cb06b",label:"WETH/USDG 86%",source:"morpho-listed"},{marketId:"0x1a31d1c8c05a98b94777663912e4166bf50f3fcdc9c3c3d29deb55634ac58239",label:"PONS/USDG 62.5%",source:"morpho-listed"},{marketId:"0x1efd13a2d1dc66a2466e7c25820537028e604791f00454d9c686fdfbf70f404d",label:"mGLO/USDG 91.5%",source:"morpho-listed"},{marketId:"0x21ea2a012b888120e328775c2a7bf6fb4619cf4c4c631ad1c9b6db51f8882d5a",label:"SPCX/USDG 62.5%",source:"morpho-listed"},{marketId:"0x22e4598e5cc16cff0056e72d61c5f1f2f8bf5bbffc22da5277ab196939c8a59e",label:"TSLA/USDG 62.5%",source:"morpho-listed"},{marketId:"0x66306c087add8907752320b309934abcc354d21626de8115c79df49d9c214edc",label:"NVDA/USDG 62.5%",source:"morpho-listed"},{marketId:"0x69400cfe81f2ae381b9a9f27076a4d637338379d999e9ffdfbde52f0876312ee",label:"META/USDG 62.5%",source:"morpho-listed"},{marketId:"0x7408b08b03e05ffd2d21c797489a0e77a28e4bb36acb4e827c69e805d06272b4",label:"GOOGL/USDG 77%",source:"morpho-listed"},{marketId:"0x7c1e38bf461da47df9805ae9b7e97a12ec023625a1f92d2a403b3b9a92260894",label:"CASHCAT/USDG 62.5%",source:"morpho-listed"},{marketId:"0x919a9b6b94dae7c86620eaf7a08e597aae8a4c3a9e9c7671771fbaf62b6b61c7",label:"syrupUSDG/USDG 91.5%",source:"morpho-listed"},{marketId:"0x93ed7865910b09f5a2e0dbfd4670c2d3bc1da9647f7c68e7975f37f497898cdb",label:"mGLO/USDG 91.5%",source:"morpho-listed"},{marketId:"0x947ae981cc823024ea00b602f6ea72d049cac05d66ef096198ceeb998651c175",label:"AAPL/USDG 62.5%",source:"morpho-listed"},{marketId:"0x95312f02c1dae8407b2c80468a5657a9bd19c45ac277f1a61aa52c11444c5314",label:"NVDA/USDG 62.5%",source:"morpho-listed"},{marketId:"0xba01f6625137b692c5dd86afb8e654b4016d7b64e36dfca4124e84bef98bc4d2",label:"GOOGL/USDG 62.5%",source:"morpho-listed"},{marketId:"0xc845da65a020ddca5f132efa8fea79676d8edfdea504226a4c01e7a9e34cddd6",label:"USDe/USDG 91.5%",source:"morpho-listed"},{marketId:"0xcaa167af7ba0422c76424fae56167b7db25bf19f4f435215e6dd7d06a943bdac",label:"AAPL/USDG 62.5%",source:"morpho-listed"},{marketId:"0xe29c7d3790037800101ecbad9c45de2067698d206cbcab7c25069a9f43c9eb98",label:"TSLA/USDG 62.5%",source:"morpho-listed"},{marketId:"0xe5a6d99c3721ef2ab00fb16f0ad226bc7c87a90394f82e27dc6bbca4b1d95c5d",label:"AI/USDG 62.5%",source:"morpho-listed"},{marketId:"0xeb1739b2a69dd22a4285d366a06698a01018b37c24d2994fefe19cc72f313613",label:"SPY/USDG 77%",source:"morpho-listed"},{marketId:"0xf5ff7d546af5e72f3912d2aa723088fd0bf66fddc158714995637714d9db6e4c",label:"NVDA/USDG 62.5%",source:"morpho-listed"},{marketId:"0xaa586d26a6fe62d9c0f0948fede6e2130500ac7a655587447e2d4a37e6330589",label:"wsNET/USDG 62.5% (NetNet Loopback)",source:"netnet"},{marketId:"0x8b16891f032a93b771347c9cb470a780e6699dd701553d3402aa3cdba6189c3e",label:"NVDA/USDG 62.5% (NetNet Credit)",source:"netnet"},{marketId:"0x9b4b47cdf7e295341c6c6cdfd3efb9805c4a5b3d580dba0c0c39d3a4232b297b",label:"SPCX/USDG 62.5% (NetNet Credit)",source:"netnet"},{marketId:"0xdeb4782d012d5fd3b24962538c2f6559049d70bda4dabd2e4212dacb96c28d45",label:"AAPL/USDG 62.5% (NetNet Credit)",source:"netnet"},{marketId:"0x7fa81b10e5d21b2e4c571f862442bc11aff2ed14f02335868d0ff933fd40d0ba",label:"GOOGL/USDG 62.5% (NetNet Credit)",source:"netnet"},{marketId:"0x2e1859aa8f143b7220088f80562c6dfe0bf8e52b87d9cedf8da8805f231994ce",label:"MSFT/USDG 62.5% (NetNet Credit)",source:"netnet"},{marketId:"0x3ebd43d91c3960a9fac32bedd5c60428e0e414de5bdd67fda770207afb0eb615",label:"COIN/USDG 38.5% (NetNet Credit)",source:"netnet"},{marketId:"0x26f3bd5919ba0e6ea6f4bca1b8bd95ce29cbe3aad4ef824fb007570eac35103b",label:"cbBTC/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xb095654f06f4d17d4fc010c2d89a107649e3c5b58e53a3812d1736c95e63e3f8",label:"NVDAon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x947c05e7c0fa3ba187d57db710d04ba8be4fef53baba0cfbe71ce61b34a1367d",label:"SPCXon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xf8f0b5badf06192908bc47af32b93742d9b4fb6072d388cb183ff7849ee6534c",label:"SPYon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x26c80a00f8facc6b081989965d89cedc274b90b81be660e69245a74e5384f5de",label:"METAon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xeefec6c3e5cb7df1f2366ea7cf96a583081205b9720e807d2868d9866a702229",label:"GOOGLon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xf511a080dcb4d0a3b9d6aebb06e24afa011cda87f9f71ada70c60f8220e94f35",label:"AAPLon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xa87da1cc931faa945a41861cc9c90076772ceeae9a663836df6b265c4f30106d",label:"MSTRon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x0279ea145eff84ed2ffd3b1ed1f2aca333060d9cef6fdd48bd21073c13ec86bf",label:"CRCLon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xff2063ef18bc5f71867c56d6d3290b61f3da1d010c8a0552bdb7995cfad8cacc",label:"TSLAon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x83d542605940b5495ef38d4b62a39293766a486a24e5c67930f41acd919cf1d1",label:"QQQon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x9b01d5ad5ce8e477510854132cc47853f6e82a708c9c4723887550412f4ee522",label:"GMEon/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x8b2af4d69ad861a4099b995b6279aeaf6a905225a0ee889bce424c7faf19b7d9",label:"AMZN/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x4edbd2f2f3b33bc5f80ab588def67fab8c10945fc99f855d80ff4bef2c4aa1f0",label:"SLV/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x7e6ebfdc58a893a5cddba0fba0483baf4fac2efece627ad50821dbe27d6f9738",label:"GOOGL/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x30a2a5f1a098b23ed91eadc4529a8d1c967f2cdc2e40a709f3a5992004b01ac0",label:"AAPL/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x14973a168cf6c6b1148309f5d567c255b292863ffe9cca59f4284e1426636f00",label:"RKLB/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xf049167e6bf18a1b41b8e2acefcf7bc9b13ea013d8d65c7fbc7cbaeb3fe9b4e2",label:"NBIS/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x8114b65dfc5e64222103e5588de261eca9defd25f47ea4ae2f91d49fe4fa2993",label:"CLSK/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x96d3d5f9bc842e4c8a935c5628abd02fb0e10115560c35a9add768781434f471",label:"CRWV/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x1b3555f7c1273688f01ae82da7dc8e508e6a7841ec0038dbb15767154a277b86",label:"EWY/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x039503b6308d6d818d181e626d3fbc667d6e68393c3d74332a6124cd2dd6e755",label:"CASHCAT_LEGACY/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x597227ca652ea5e8afb6e4801ecd766a4d6eb9b3b9fafa9127ba88a8b1f19629",label:"SPCX/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x50bc39b5722fb5634c436d74c6787f3c125b879e7b73cf9e9ecc01bbb57b8e55",label:"SPY/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x315b99abb698487891243a84afd28a5ff56fe02143f203c03edd3f103936bf60",label:"QQQ/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x4979137c23c8fb519cd507adc290944c3c2120e8a3191547531fced28360e9c2",label:"GME/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x6b8a1f62d88d1cd1e8de609aef07cafc8226172ba703e57c52c3730350e61df1",label:"USO/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xafc86936af4f7edf083eb2550b8c42311b83c685982742b9271b309a58268855",label:"MSFT/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xf6f3dbe0a19e948147e79e66502c6b05709d8dfde977fec7db1528fc8f0ebdfa",label:"SGOV/USDG 86% (Longbow)",source:"longbow"},{marketId:"0x2ab6a14c9f68d4216dcb3b4e6ed607cf82f2e6badfa2bd5618d7f69d012d7fab",label:"USAR/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0xb41b34c5989420ad080e79363a9cfe3e23bec7459fcd2d88029250da370288df",label:"TSLA/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x4d2075836fd32183b10e5be1b383f6430de859df6d2bd5ec5b859970c4dd14e8",label:"AMD/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x9df4f54a2e46b35bd326cec97dbabc4203fa6c64a8e4182128f277adba8fefaf",label:"MU/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xb5ba72c0d55c353fa37c0bea104eb117afb2f4934473bcb736d2218ae5686746",label:"PLTR/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xda5584635e8b14ea18f674dbe4243365505910fefd8e3aa1ac9bfaac0eba74e8",label:"INTC/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x74fece475178af9e06d31fb64f405046a305f8f0abc588782f596d6f261c1fbb",label:"SNDK/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xee04847a312224d551d2267bb5c2c2695777af5fd1f05347bdcca397e8f54336",label:"ORCL/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x508b47fb12dbb8747644d4436aae65489b5f2819936adefc8a591323f64a5b01",label:"COIN/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x243ac165f79a75a0590d2e994ffa9e260b70292fd1ca134ace95f3640895b19f",label:"TSM/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x01baec96478004fc7b74c8dfe38abef8d716fea59ffd481b6ec74db915d3bc80",label:"MSTR/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xf0959f62e748938cf260ca6fe7cb21a412e0a6643913460f4a6770c3f4b90af6",label:"CRCL/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xbe881499e682850931951c998e76cfbf38c7979b1beeae7cbbb97a39b3336a07",label:"ASML/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xdd578ca54b4ef6a7827c6e9fc06905699a577f6e2f00712853d8aab13383bc38",label:"BABA/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xd8b502d5c43f6e5cfff7f938c7ef18e684f114fb5b362611981144397e5d5aef",label:"DELL/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0x003390b057d753bd839981a0d45f9a567aa0b0ed6373fd42e951eac8ee86c2ba",label:"RGTI/USDG 62.5% (Longbow)",source:"longbow"},{marketId:"0xc6e16cff2bcf185639562ab937b7a1c381522768ff16aefc85a25ff6ab1c45ea",label:"AI/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0xaba3ac501ce4c6b80c08ed0dba19e1ac0de495f17af3ed692a38e92d176a6c9e",label:"PONS/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x8097c1d1000eb657e75265384137041ac92856c8dc0b72c99569c3681320a430",label:"DELTA/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x6e6762ae397a2b3f2500ea2f48f8adce0eadfbf54cbc37f6108602e907e844ad",label:"INDEX/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x378713071c58206c6a826287d0051bcae113d83d6e3d3b6370b7e73128d06162",label:"STONKBROKER/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x2695be2638c98241c887e4cad4eeba0f01137205f46b9e302edab04b5fee0570",label:"AVGO/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x6c12c02536aa27831f713d658b59f74e149cc62b48528cb74455e79fab32f772",label:"GLD/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x298e8ff9b31f22be90507bc61b55e66ab93e78b55a60593035e309ed93137cb8",label:"RDDT/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0xb33399a677e1a21152fa9969f02c57a7a342e692ec45608a3fa0d3d92519c343",label:"COST/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x3be7fe1b6b439cfeb737d9921e9b83c92095a23a4f50aeee0d6d04f44446170f",label:"DJT/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x0066bc47b87597993af0bca6f526175c0abae011b764d4bf12a3def45e1f4e78",label:"NFLX/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x8c170f5c5df593791640ac9fbac297d59d08c2e92e86f38fe52d38e929e60fa3",label:"AMC/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x0f18d4fd8d86bd4d100b867b67e1fd38c80981fcd43e442313c2d5408da9352d",label:"LLY/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x7d4313cf1b0ede39395a2c7495dc1b1b47370caf51f70571d927f22e715e5f58",label:"LULU/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0xa85928d77bd25cc348e13ea6587b8b3ca3793f4af5e5db8ca07d0f20fd5cfa99",label:"IBM/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x9d61e320efb766ce5c375032b399f08afe644b095a9cb0b2d6d1f6ab68399a6f",label:"F/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x43c51f6ff44ab406ab9c97cb5512c881f4a7498209f94bbcfd874d8f97fad79d",label:"HIMS/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0xe6284cf12d0603aee18ff5ab412e262cf99f120e967579111d7a51f37f276f54",label:"TTWO/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0xe8d9b45cdbedc4401a3145be7726c9f72b715e03c5399c961439f11636ee9fb6",label:"MRNA/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x46eea143d473cdb8587505f8886dad452037f285f7729a7763e8c233c63b2e8e",label:"RIVN/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x8338aed363a309039b2f271a83558831e7e445f2d13c6e72c576ec0b8a969415",label:"RBLX/USDG 38.5% (Longbow)",source:"longbow"},{marketId:"0x4e92b336ecad6c842be20ae2ae27b28b3cf5ced6c5388a808167c03a8d75fdf8",label:"SPY/WETH 38.5% (Longbow)",source:"longbow"},{marketId:"0x141c2b1d2bbecf7f8a76563307d7e5bf586457e873c3d97c4bb1502e57b77952",label:"NVDA/WETH 38.5% (Longbow)",source:"longbow"}],va=new Map(lt.map(e=>[e.marketId.toLowerCase(),e]));function j(e){return va.get(e.toLowerCase())}function ct(e){let t=j(e);return t?{actions:"enabled",label:t.label,source:Ma[t.source]}:{actions:"read-only",reason:"Not in Oak's verified Morpho market registry; Oak builds no transactions for it."}}var qt=20,Ue=120n,ze=1000000n,We=1n,Se=10n**18n,Pa=10n**36n,jt=(1n<<128n)-1n,Ca=(1n<<256n)-1n,X=Ve(["function idToMarketParams(bytes32 id) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)","function market(bytes32 id) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)","function position(bytes32 id, address user) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)","function supplyCollateral((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint256 assets, address onBehalf, bytes data)","function withdrawCollateral((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint256 assets, address onBehalf, address receiver)","function borrow((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint256 assets, uint256 shares, address onBehalf, address receiver) returns (uint256 assetsBorrowed, uint256 sharesBorrowed)","function repay((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint256 assets, uint256 shares, address onBehalf, bytes data) returns (uint256 assetsRepaid, uint256 sharesRepaid)","function supply((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint256 assets, uint256 shares, address onBehalf, bytes data) returns (uint256 assetsSupplied, uint256 sharesSupplied)","function withdraw((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint256 assets, uint256 shares, address onBehalf, address receiver) returns (uint256 assetsWithdrawn, uint256 sharesWithdrawn)"]),La=Ve(["function price() view returns (uint256)"]),Da=Ve(["function borrowRateView((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee) market) view returns (uint256)"]),Kt=Ve(["function deposit() payable"]);function pe(e){return{loanToken:e.loanToken,collateralToken:e.collateralToken,oracle:e.oracle,irm:e.irm,lltv:e.lltv.toString()}}function $e(e,t){return e===0n?0n:(e+t-1n)/t}function Ua(e,t,s){return e*(s+ze)/(t+We)}function $a(e,t,s){return $e(e*(s+ze),t+We)}function ut(e,t,s){return e*(t+We)/(s+ze)}function se(e,t,s){return $e(e*(t+We),s+ze)}function Ae(e,t,s){return e*t/Pa*s/Se}function Ba(e,t,s){return t.startsWith("-")?`-${e.formatAmount(t.slice(1),s)}`:e.formatAmount(t,s)}function xe(e,t){let s=[],r={};for(let n of t.changes){let l=Ba(e,n.amount,n.token.decimals);s.push({token:n.token,amount:n.amount,formattedAmount:l}),r[n.token.address.toLowerCase()]=l}return{formattedChanges:s,formattedNetOutflows:r}}function Qt(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new i("Morpho marketId must be a 32-byte hex string.");return e.toLowerCase()}function je(e){if(!e||typeof e!="object")throw new i("Morpho marketParams must be an object.");for(let a of[e.loanToken,e.collateralToken,e.oracle,e.irm])if(typeof a!="string"||!Fe(a,{strict:!1}))throw new i("Morpho marketParams contains an invalid address.");let t=L(e.loanToken),s=L(e.collateralToken),r=L(e.oracle),n=L(e.irm),l=typeof e.lltv=="bigint"?e.lltv:Le(String(e.lltv));if(t===te||s===te||r===te)throw new i("Morpho marketParams loan, collateral, and oracle addresses must be non-zero.");if(l<=0n||l>=Se)throw new i("Morpho marketParams LLTV must be between 0 and 1e18.");return{loanToken:t,collateralToken:s,oracle:r,irm:n,lltv:l}}function ke(e){let t=je(e),s=ga(J("address, address, address, address, uint256"),[t.loanToken,t.collateralToken,t.oracle,t.irm,t.lltv]);return Sa(s)}function dt(e){let t=e.toLowerCase();return t===ht.toLowerCase()||t===wt.toLowerCase()||t===te.toLowerCase()}function Ie(e,t){let s=t??e.wallet;if(!s)throw new i("Provide a valid wallet address.");return q(s),L(s)}async function ne(e,t,s){if(typeof e.call=="function"){let r=await e.call({to:t,data:s});if(r&&typeof r.data=="string")return r.data}if(typeof e.request=="function"){let r=await e.request({method:"eth_call",params:[{to:t,data:s},"latest"]});if(typeof r=="string")return r}throw new i(`Unable to execute eth_call on contract ${t}.`)}function Xt(e){return typeof e=="string"&&/^[A-Za-z0-9$._+-]{1,32}$/.test(e)?e:"UNKNOWN"}async function Q(e,t,s=f){if(q(t),dt(t))return{...kt,chainId:s};let r=L(t),n=r.toLowerCase();if(s===f){if(n===Ia.toLowerCase())return yt;if(n===me.toLowerCase())return gt}let[l,a]=await Promise.all([ne(e,r,G({abi:it,functionName:"symbol"})),ne(e,r,G({abi:it,functionName:"decimals"}))]),[o]=re(J("string"),l),[u]=re(J("uint8"),a);return{address:r,symbol:Xt(o),decimals:Number(u),chainId:s}}async function Yt(e,t){let s=await ne(e,$,G({abi:X,functionName:"idToMarketParams",args:[t]})),[r,n,l,a,o]=re(J("address, address, address, address, uint256"),s);return{loanToken:L(r),collateralToken:L(n),oracle:L(l),irm:L(a),lltv:o}}async function Jt(e,t){let s=await ne(e,$,G({abi:X,functionName:"market",args:[t]})),[r,n,l,a,o,u]=re(J("uint128, uint128, uint128, uint128, uint128, uint128"),s);return{totalSupplyAssets:r,totalSupplyShares:n,totalBorrowAssets:l,totalBorrowShares:a,lastUpdate:o,fee:u}}async function Te(e,t,s){let r=await ne(e,$,G({abi:X,functionName:"position",args:[t,L(s)]})),[n,l,a]=re(J("uint256, uint128, uint128"),r);return{supplyShares:n,borrowShares:l,collateral:a}}async function Ke(e,t){let s=await ne(e,L(t),G({abi:La,functionName:"price"})),[r]=re(J("uint256"),s);return r}async function Na(e,t,s){if(t.irm===te)return 0n;let r=await ne(e,L(t.irm),G({abi:Da,functionName:"borrowRateView",args:[t,s]})),[n]=re(J("uint256"),r);return n}function Qe(e,t,s){let r=s>e.lastUpdate?s-e.lastUpdate:0n,n=t*r,l=$e(n*n,2n*Se),a=$e(l*n,3n*Se);return e.totalBorrowAssets+$e(e.totalBorrowAssets*(n+l+a),Se)}async function Be(e,t,s,r=0n){let[n,l]=await Promise.all([e.getBlock({blockTag:"latest"}),Na(e,t,s)]),a=BigInt(Math.ceil(Date.now()/1e3)),o=(n.timestamp>a?n.timestamp:a)+r;return{totalBorrowAssets:Qe(s,l,o),accruedThrough:o,rate:l}}async function Zt(e,t,s){let r=await ne(e,L(t),G({abi:it,functionName:"balanceOf",args:[L(s)]})),[n]=re(J("uint256"),r);return n}async function fe(e,t,s=!1){let r=t.marketId,n=t.marketParams;if(!r&&!n)throw new i("Provide either marketId or marketParams for the Morpho Blue market.");let l=n?je(n):void 0,a=l?ke(l):void 0,o=r!==void 0?Qt(r):void 0;if(o&&a&&o!==a.toLowerCase())throw new i(`MarketParams tuple hash (${a}) does not match marketId (${o}).`);let u=(o??a).toLowerCase();if(s&&!j(u))throw new i(`Morpho actions require a known market from Oak's verified registry, which pins its oracle. Find one with morpho_status {"discover":true}; other markets are read-only.`);let[c,m]=await Promise.all([Yt(e,u),Jt(e,u)]);if(c.loanToken===te||c.collateralToken===te||c.lltv===0n||m.lastUpdate===0n)throw new i(`Morpho market ${u} is not initialized on chain ${f}.`);let d=ke(c);if(d.toLowerCase()!==u.toLowerCase())throw new i(`On-chain idToMarketParams tuple hash (${d}) does not match marketId (${u}).`);if(l&&!(l.loanToken.toLowerCase()===c.loanToken.toLowerCase()&&l.collateralToken.toLowerCase()===c.collateralToken.toLowerCase()&&l.oracle.toLowerCase()===c.oracle.toLowerCase()&&l.irm.toLowerCase()===c.irm.toLowerCase()&&l.lltv===c.lltv))throw new i(`Provided marketParams tuple does not match on-chain idToMarketParams for ${u}.`);return{marketId:u,marketParams:c,marketState:m}}function Me(e){if(e.assets!==void 0&&e.amount!==void 0)throw new i("Specify either assets or amount, not both.");let t=e.assets??e.amount;if(typeof t!="string")throw new i("Provide an amount as a base-unit integer string.");let s=Le(t);if(s<=0n||s>jt)throw new i("Asset amount must be greater than zero and fit in uint128.");return s}function ve(e,t){for(let s of["onBehalf","receiver"])if(e[s]!==void 0&&(typeof e[s]!="string"||e[s].toLowerCase()!==t.toLowerCase()))throw new i(`Morpho ${s} must be the wallet; overrides are not supported.`);if(e.data!==void 0&&e.data!=="0x")throw new i("Morpho callback data must be empty (0x).")}async function Oa(e,t,s){let r=Ie(t,s);ve(t,r);let n=r,l=e.clientFor(f),{marketId:a,marketParams:o}=await fe(l,t,!0),u=await Q(l,o.collateralToken,f),c=o.collateralToken.toLowerCase()===me.toLowerCase(),m=typeof t.collateralToken=="string"?(q(t.collateralToken),L(t.collateralToken)):void 0,d=W("wrapNative",t.wrapNative)===!0||m!==void 0&&dt(m);if(m&&!dt(m)&&m.toLowerCase()!==o.collateralToken.toLowerCase())throw new i(`Collateral token ${m} does not match market collateral ${o.collateralToken}.`);if(d&&!c)throw new i("Native ETH wrapping is only supported when market collateralToken is WETH.");let p=Me(t),b=p.toString(),h=e.formatAmount(b,u.decimals),w=[];d&&w.push(e.unsignedTx({chainId:f,to:me,data:G({abi:Kt,functionName:"deposit"}),value:b,description:`Wrap ${h} ETH into WETH at ${me}.`})),w.push(e.approval(o.collateralToken,$,b,f)),w.push(e.unsignedTx({chainId:f,to:$,data:G({abi:X,functionName:"supplyCollateral",args:[o,p,n,"0x"]}),value:"0",description:`Supply ${h} ${u.symbol} (${b} base units) collateral to Morpho market ${a}.`}));let y=await e.preview(w,r),{formattedChanges:k,formattedNetOutflows:g}=xe(e,y);return{action:"morpho_supply_collateral",chainId:f,marketId:a,marketParams:pe(o),collateralToken:u,assets:b,formattedAssets:h,onBehalf:n,txs:w,summary:`${d?`Send ${h} ETH to wrap into WETH. `:""}Supply ${h} ${u.symbol} collateral to Morpho Blue market ${a}.`,preview:y,formattedChanges:k,formattedNetOutflows:g}}async function Ea(e,t,s){let r=Ie(t,s);ve(t,r);let n=r,l=r,a=e.clientFor(f),{marketId:o,marketParams:u,marketState:c}=await fe(a,t,!0),[m,d,p,b]=await Promise.all([Q(a,u.loanToken,f),Te(a,o,n),Ke(a,u.oracle),Be(a,u,c,Ue)]),h=Me(t),w=h.toString(),y=e.formatAmount(w,m.decimals),k=c.totalSupplyAssets>c.totalBorrowAssets?c.totalSupplyAssets-c.totalBorrowAssets:0n;if(h>k)throw new i(`Insufficient market liquidity: requested ${w} base units, available ${k.toString()} base units.`);let g=Ae(d.collateral,p,u.lltv),T=se(d.borrowShares,b.totalBorrowAssets,c.totalBorrowShares);if(d.collateral===0n||T+h>g)throw new i(`Insufficient collateral or unhealthy borrow: total debt ${(T+h).toString()} exceeds max borrow ${g.toString()} base units.`);let x=$a(h,b.totalBorrowAssets,c.totalBorrowShares),C=[e.unsignedTx({chainId:f,to:$,data:G({abi:X,functionName:"borrow",args:[u,h,0n,n,l]}),value:"0",description:`Borrow ${y} ${m.symbol} (${w} base units) from Morpho market ${o}.`})],P=await e.preview(C,r),{formattedChanges:I,formattedNetOutflows:E}=xe(e,P);return{action:"morpho_borrow",chainId:f,marketId:o,marketParams:pe(u),loanToken:m,assets:w,formattedAssets:y,borrowShares:x.toString(),onBehalf:n,receiver:l,txs:C,summary:`Borrow ${y} ${m.symbol} from Morpho Blue market ${o}.`,preview:P,formattedChanges:I,formattedNetOutflows:E}}async function Ga(e,t,s){let r=Ie(t,s);ve(t,r);let n=r,l=e.clientFor(f);if(t.shares!==void 0){let I=Le(t.shares);if(I<=0n||I===Ca||I>jt)throw new i("Morpho Blue core does not accept maxUint256 or out-of-range share sentinels; pass exact position.borrowShares.")}if(W("repayAll",t.repayAll)===!0&&(t.shares!==void 0||t.assets!==void 0||t.amount!==void 0))throw new i("Specify repayAll alone, without shares or assets/amount.");if(t.shares!==void 0&&(t.assets!==void 0||t.amount!==void 0))throw new i("Specify either assets/amount or shares for Morpho repay, not both.");let{marketId:a,marketParams:o,marketState:u}=await fe(l,t,!0),[c,m,d]=await Promise.all([Q(l,o.loanToken,f),Te(l,a,n),Zt(l,o.loanToken,r)]);if(m.borrowShares===0n)throw new i(`Position has no active borrow debt on Morpho market ${a}.`);let p=0n,b=0n;if(W("repayAll",t.repayAll)===!0)b=m.borrowShares;else if(t.shares!==void 0){let I=Le(t.shares);if(I>m.borrowShares)throw new i(`Repay shares (${I.toString()}) exceed current position borrowShares (${m.borrowShares.toString()}).`);b=I}else p=Me(t);let h=b>0n?await Be(l,o,u,Ue):void 0,w=b>0n?se(b,h.totalBorrowAssets,u.totalBorrowShares):p;if(d<w)throw new i(`Insufficient loan token balance for repayment: wallet holds ${d.toString()} base units, but ${w.toString()} base units are required (including accrued interest).`);let y=w.toString(),k=e.formatAmount(y,c.decimals),g=e.approval(o.loanToken,$,y,f),T=e.unsignedTx({chainId:f,to:$,data:G({abi:X,functionName:"repay",args:[o,p,b,n,"0x"]}),value:"0",description:b>0n?`Repay ${b.toString()} borrow shares (${k} ${c.symbol}) on Morpho market ${a}.`:`Repay ${k} ${c.symbol} (${p.toString()} base units) on Morpho market ${a}.`}),x=[g,T],M=await e.preview(x,r),{formattedChanges:C,formattedNetOutflows:P}=xe(e,M);return{action:"morpho_repay",chainId:f,marketId:a,marketParams:pe(o),loanToken:c,repayAssets:p.toString(),repayShares:b.toString(),requiredAssets:y,...h?{accruedThrough:h.accruedThrough.toString(),borrowRatePerSecond:h.rate.toString(),inclusionSeconds:Ue.toString()}:{},formattedRequiredAssets:k,onBehalf:n,txs:x,summary:b>0n?`Repay ${b.toString()} borrow shares (approval up to ${k} ${c.symbol}) on Morpho Blue market ${a}. Refresh if signing/inclusion takes more than ${Ue} seconds.`:`Repay ${k} ${c.symbol} on Morpho Blue market ${a}.`,preview:M,formattedChanges:C,formattedNetOutflows:P}}async function Ra(e,t,s){let r=Ie(t,s);ve(t,r);let n=r,l=r,a=e.clientFor(f),{marketId:o,marketParams:u,marketState:c}=await fe(a,t,!0),[m,d,p,b]=await Promise.all([Q(a,u.collateralToken,f),Te(a,o,n),Ke(a,u.oracle),Be(a,u,c,Ue)]),h=W("withdrawAll",t.withdrawAll)===!0?d.collateral:Me(t);if(h<=0n||h>d.collateral)throw new i(`Insufficient collateral to withdraw: requested ${h.toString()} base units, position holds ${d.collateral.toString()} base units.`);if(d.borrowShares>0n){let C=d.collateral-h,P=Ae(C,p,u.lltv),I=se(d.borrowShares,b.totalBorrowAssets,c.totalBorrowShares);if(I>P)throw new i(`Unhealthy collateral withdrawal: remaining max borrow ${P.toString()} would fall below current debt ${I.toString()} base units.`)}let w=h.toString(),y=e.formatAmount(w,m.decimals),g=[e.unsignedTx({chainId:f,to:$,data:G({abi:X,functionName:"withdrawCollateral",args:[u,h,n,l]}),value:"0",description:`Withdraw ${y} ${m.symbol} (${w} base units) collateral from Morpho market ${o}.`})],T=await e.preview(g,r),{formattedChanges:x,formattedNetOutflows:M}=xe(e,T);return{action:"morpho_withdraw_collateral",chainId:f,marketId:o,marketParams:pe(u),collateralToken:m,assets:w,formattedAssets:y,onBehalf:n,receiver:l,txs:g,summary:`Withdraw ${y} ${m.symbol} collateral from Morpho Blue market ${o}.`,preview:T,formattedChanges:x,formattedNetOutflows:M}}async function _a(e,t,s){let r=Ie(t,s);ve(t,r);let n=e.clientFor(f),{marketId:l,marketParams:a,marketState:o}=await fe(n,t,!0),u=W("wrapNative",t.wrapNative)===!0;if(u&&a.loanToken.toLowerCase()!==me.toLowerCase())throw new i("Native ETH wrapping is only supported when the market loanToken is WETH.");let c=Me(t),m=c.toString(),[d,p]=await Promise.all([Q(n,a.loanToken,f),u?Promise.resolve(c):Zt(n,a.loanToken,r)]);if(p<c)throw new i(`Insufficient ${d.symbol} balance to lend: wallet holds ${p.toString()} base units, requested ${m}.`);let b=e.formatAmount(m,d.decimals),h=[];u&&h.push(e.unsignedTx({chainId:f,to:me,data:G({abi:Kt,functionName:"deposit"}),value:m,description:`Wrap ${b} ETH into WETH at ${me}.`})),h.push(e.approval(a.loanToken,$,m,f)),h.push(e.unsignedTx({chainId:f,to:$,data:G({abi:X,functionName:"supply",args:[a,c,0n,r,"0x"]}),value:"0",description:`Lend ${b} ${d.symbol} (${m} base units) to Morpho market ${l}.`}));let w=Ua(c,o.totalSupplyAssets,o.totalSupplyShares),y=await e.preview(h,r),{formattedChanges:k,formattedNetOutflows:g}=xe(e,y);return{action:"morpho_supply",chainId:f,marketId:l,marketParams:pe(a),loanToken:d,assets:m,formattedAssets:b,supplySharesEstimated:w.toString(),onBehalf:r,oak:ct(l),txs:h,summary:`${u?`Send ${b} ETH to wrap into WETH. `:""}Lend ${b} ${d.symbol} to Morpho Blue market ${l}. It earns the market supply rate and is exposed to the market's collateral, oracle and liquidity risk.`,preview:y,formattedChanges:k,formattedNetOutflows:g}}async function Ha(e,t,s){let r=Ie(t,s);ve(t,r);let n=e.clientFor(f),l=W("withdrawAll",t.withdrawAll)===!0;if(l&&(t.assets!==void 0||t.amount!==void 0))throw new i("Specify withdrawAll alone, without assets/amount.");let{marketId:a,marketParams:o,marketState:u}=await fe(n,t,!0),[c,m]=await Promise.all([Q(n,o.loanToken,f),Te(n,a,r)]);if(m.supplyShares===0n)throw new i(`This wallet has no lent ${c.symbol} on Morpho market ${a}.`);let d=ut(m.supplyShares,u.totalSupplyAssets,u.totalSupplyShares),p=l?0n:Me(t),b=l?m.supplyShares:0n;if(!l&&p>d)throw new i(`Withdrawal exceeds the lent balance: requested ${p.toString()} base units, position holds about ${d.toString()}. Use withdrawAll for a full exit.`);let h=u.totalSupplyAssets>u.totalBorrowAssets?u.totalSupplyAssets-u.totalBorrowAssets:0n,w=l?d:p;if(w>h)throw new i(`Insufficient market liquidity: withdrawing ${w.toString()} base units needs idle assets, but only ${h.toString()} are available until borrowers repay. Withdraw at most that amount, or retry later.`);let y=e.formatAmount(w.toString(),c.decimals),g=[e.unsignedTx({chainId:f,to:$,data:G({abi:X,functionName:"withdraw",args:[o,p,b,r,r]}),value:"0",description:l?`Withdraw all ${m.supplyShares.toString()} supply shares (about ${y} ${c.symbol}) from Morpho market ${a}.`:`Withdraw ${y} ${c.symbol} (${p.toString()} base units) of lent assets from Morpho market ${a}.`})],T=await e.preview(g,r),{formattedChanges:x,formattedNetOutflows:M}=xe(e,T);return{action:"morpho_withdraw",chainId:f,marketId:a,marketParams:pe(o),loanToken:c,withdrawAssets:p.toString(),withdrawShares:b.toString(),estimatedAssets:w.toString(),formattedAssets:y,receiver:r,txs:g,summary:l?`Withdraw all lent ${c.symbol} (about ${y}, including interest) from Morpho Blue market ${a}.`:`Withdraw ${y} lent ${c.symbol} from Morpho Blue market ${a}.`,preview:T,formattedChanges:x,formattedNetOutflows:M}}async function ea(e,t,s){let r=await e.http(Aa,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:t,variables:s})});if(!r.ok)throw new i(`Morpho GraphQL request failed (HTTP ${r.status}).`);let n=await r.json();if(n.errors?.length)throw new i("Morpho GraphQL returned query errors.");return n.data??{}}async function ta(e){let t=`query Markets($chainId: Int!) {
|
|
2
|
+
markets(first: 1000, where: { chainId_in: [$chainId] }) {
|
|
3
|
+
items {
|
|
4
|
+
marketId chain { id } lltv listed
|
|
5
|
+
loanAsset { address symbol decimals }
|
|
6
|
+
collateralAsset { address symbol decimals }
|
|
7
|
+
oracle { address } morphoBlue { address } irmAddress
|
|
8
|
+
state { supplyAssets borrowAssets liquidityAssets fee supplyApy borrowApy }
|
|
9
|
+
warnings { type level }
|
|
10
|
+
}
|
|
11
|
+
pageInfo { count countTotal }
|
|
12
|
+
}
|
|
13
|
+
}`;try{let r=(await ea(e,t,{chainId:f})).markets;if(!Array.isArray(r?.items)||typeof r.pageInfo?.countTotal!="number"||r.pageInfo.countTotal!==r.items.length||r.items.some(n=>!n||typeof n.marketId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n.marketId)))throw new i("Morpho GraphQL returned an incomplete or invalid market inventory.");return r.items}catch(s){throw new i(`Morpho GraphQL read failed: ${ie(s)}`)}}async function qa(e,t){return(await ta(e)).find(r=>r.marketId.toLowerCase()===t)??null}async function Fa(e,t){let r=await ea(e,`query Positions($chainId: Int!, $wallet: String!) {
|
|
14
|
+
marketPositions(first: 1000, where: { chainId_in: [$chainId], userAddress_in: [$wallet] }) {
|
|
15
|
+
items { market { marketId } }
|
|
16
|
+
pageInfo { countTotal }
|
|
17
|
+
}
|
|
18
|
+
}`,{chainId:f,wallet:t}),n=r.marketPositions?.items;if(!Array.isArray(n)||r.marketPositions?.pageInfo?.countTotal!==n.length)throw new i("Morpho GraphQL returned an incomplete wallet position list.");return n.map(l=>Qt(l.market?.marketId))}function Ft(e){let t=e;return!t||typeof t.address!="string"||!Fe(t.address,{strict:!1})?null:{address:L(t.address),symbol:Xt(t.symbol),decimals:typeof t.decimals=="number"?t.decimals:null}}function Vt(e){return typeof e=="string"&&Fe(e,{strict:!1})?L(e):null}function zt(e,t){if(e===void 0)return;if(typeof e!="string"||!e.trim())throw new i(`Morpho ${t} filter must be a token address or symbol.`);let s=e.trim().toLowerCase();return r=>!!r&&(String(r.address).toLowerCase()===s||typeof r.symbol=="string"&&r.symbol.toLowerCase()===s.replace(/^\$/,""))}async function Va(e,t){if(t.marketId!==void 0||t.marketParams!==void 0||t.includeGraphql!==void 0)throw new i("Use discover without marketId, marketParams or includeGraphql.");let s=t.limit===void 0?20:Number(t.limit);if(!Number.isSafeInteger(s)||s<1||s>100)throw new i("Morpho discover limit must be an integer from 1 to 100.");let r=zt(t.loanToken,"loanToken"),n=zt(t.collateralToken,"collateralToken"),l=W("verifiedOnly",t.verifiedOnly)===!0,a=await ta(e),o=a.map(c=>{let m=c.marketId.toLowerCase(),d=c.state??{},p=Ft(c.loanAsset),b=Ft(c.collateralAsset),h=Array.isArray(c.warnings)?c.warnings.map(w=>({type:String(w?.type??"").slice(0,64),level:String(w?.level??"").slice(0,16)})):[];return{marketId:m,listed:c.listed===!0,warnings:h,loanToken:p,collateralToken:b,lltv:typeof c.lltv=="string"||typeof c.lltv=="number"?String(c.lltv):null,oracle:Vt(c.oracle?.address),irm:Vt(c.irmAddress),state:{supplyAssets:d.supplyAssets===void 0?null:String(d.supplyAssets),borrowAssets:d.borrowAssets===void 0?null:String(d.borrowAssets),liquidityAssets:d.liquidityAssets===void 0?null:String(d.liquidityAssets),supplyApy:typeof d.supplyApy=="number"?d.supplyApy:null,borrowApy:typeof d.borrowApy=="number"?d.borrowApy:null},oak:ct(m)}}).filter(c=>(!l||c.oak.actions==="enabled")&&(!r||r(c.loanToken))&&(!n||n(c.collateralToken))),u=c=>{try{return BigInt(c.state.liquidityAssets??"0")}catch{return 0n}};return o.sort((c,m)=>{let d=+(m.oak.actions==="enabled")-+(c.oak.actions==="enabled");if(d)return d;let p=u(m)-u(c);return p>0n?1:p<0n?-1:0}),{chainId:f,morphoBlue:$,source:"Morpho API market inventory; token symbols, rates and liquidity are indexer data, not chain reads.",totalMatching:o.length,inventoryTotal:a.length,markets:o.slice(0,s),next:'Re-read a market with morpho_status {"marketId":"<id>"} before acting. Only oak.actions "enabled" markets accept Oak transactions.'}}async function za(e,t,s){let r=e.clientFor(f),n=s??t.wallet,l=n&&Fe(n,{strict:!1})?L(n):void 0;if(W("discover",t.discover)===!0)return Va(e,t);for(let c of["loanToken","collateralToken","verifiedOnly","limit"])if(t[c]!==void 0)throw new i(`Morpho ${c} is a discover filter; pass discover:true with it.`);let a=W("includeGraphql",t.includeGraphql)===!0,o=t.marketId||t.marketParams?[t]:Ta.map(c=>({marketId:c})),u=await Promise.all(o.map(async c=>{let{marketId:m,marketParams:d,marketState:p}=await fe(r,c),[b,h,w,y,k,g]=await Promise.all([Q(r,d.loanToken,f),Q(r,d.collateralToken,f),Ke(r,d.oracle),Be(r,d,p),l?Te(r,m,l):Promise.resolve(void 0),a?qa(e,m):Promise.resolve(void 0)]),T=p.totalSupplyAssets>p.totalBorrowAssets?p.totalSupplyAssets-p.totalBorrowAssets:0n,x;if(k){let M=k.borrowShares>0n?se(k.borrowShares,y.totalBorrowAssets,p.totalBorrowShares):0n,C=k.supplyShares>0n?ut(k.supplyShares,p.totalSupplyAssets,p.totalSupplyShares):0n,P=Ae(k.collateral,w,d.lltv),I=M>0n?e.formatAmount((P*Se/M).toString(),18):null;x={supplyShares:k.supplyShares.toString(),supplyAssets:C.toString(),borrowShares:k.borrowShares.toString(),borrowAssets:M.toString(),collateralAssets:k.collateral.toString(),maxBorrowAssets:P.toString(),healthFactor:I}}return{marketId:m,marketParams:pe(d),loanToken:b,collateralToken:h,state:{totalSupplyAssets:p.totalSupplyAssets.toString(),totalSupplyShares:p.totalSupplyShares.toString(),totalBorrowAssets:p.totalBorrowAssets.toString(),totalBorrowShares:p.totalBorrowShares.toString(),availableLiquidity:T.toString(),lastUpdate:p.lastUpdate.toString(),fee:p.fee.toString()},oraclePrice:w.toString(),borrowRatePerSecond:y.rate.toString(),oak:ct(m),...x?{position:x}:{},...a?{graphql:g??null}:{}}}));return{chainId:f,morphoBlue:$,adaptiveCurveIrm:xa,markets:u}}async function Wa(e,t,s,r){let[n,l]=await Promise.all([Yt(t,s),Jt(t,s)]),[a,o,u,c]=await Promise.all([Q(t,n.loanToken,f),Q(t,n.collateralToken,f),Ke(t,n.oracle),Be(t,n,l)]),m=[];r.collateral>0n&&m.push({token:o,amount:r.collateral.toString()});let d=r.supplyShares>0n?ut(r.supplyShares,l.totalSupplyAssets,l.totalSupplyShares):0n;d>0n&&m.push({token:a,amount:d.toString()});let p=r.borrowShares>0n?se(r.borrowShares,c.totalBorrowAssets,l.totalBorrowShares):0n,b=Ae(r.collateral,u,n.lltv),h=e.formatAmount(r.collateral.toString(),o.decimals),w=e.formatAmount(p.toString(),a.decimals);return{module:De,id:s,chainId:f,assets:m,economics:{principal:[...r.collateral>0n?[Je("collateral",{token:o,amount:r.collateral.toString(),source:"morpho.collateral"})]:[],...d>0n?[Je("redeemable",{token:a,amount:d.toString(),source:"morpho.supplyAssets"})]:[]],debt:p>0n?[St({token:a,amount:p.toString(),source:"morpho.borrowAssets"})]:[],rewards:[],backing:[],coverage:{complete:!0}},description:`Morpho Blue market ${s}: collateral=${h} ${o.symbol} (${r.collateral.toString()}), debt=${w} ${a.symbol} (${p.toString()}, shares=${r.borrowShares.toString()}), maxBorrow=${b.toString()}${r.supplyShares>0n?`, lent=${e.formatAmount(d.toString(),a.decimals)} ${a.symbol} (supplyShares=${r.supplyShares.toString()})`:""}.${j(s)?"":" Read-only: not in Oak's verified market registry, so Oak cannot build exits here."}`}}async function ja(e,t){q(t);let s=L(t),r=e.clientFor(f),n=[],l=new Set(lt.map(d=>d.marketId)),a;try{for(let d of await Fa(e,s))l.add(d)}catch(d){a=ie(d)}let o=[...l],u=[],c=[];if(typeof r.multicall=="function")try{let d=await r.multicall({multicallAddress:ft,batchSize:0,allowFailure:!0,contracts:o.map(p=>({address:$,abi:X,functionName:"position",args:[p,s]}))});if(d.length!==o.length)throw new i("Morpho multicall returned an incomplete position list.");d.forEach((p,b)=>{let h=o[b];if(p.status!=="success"){c.push({marketId:h,reason:ie(p.error)});return}let[w,y,k]=p.result;u.push({marketId:h,position:{supplyShares:w,borrowShares:y,collateral:k}})})}catch(d){c.push(...o.map(p=>({marketId:p,reason:ie(d)})))}else for(let d=0;d<o.length;d+=qt)u.push(...await Promise.all(o.slice(d,d+qt).map(async p=>({marketId:p,position:await Te(r,p,s).catch(b=>{c.push({marketId:p,reason:ie(b)})})}))));c.length&&n.push({module:De,id:"morpho-market-reads-incomplete",chainId:f,assets:[],incomplete:!0,description:`Morpho could not read ${c.length} of ${o.length} markets. ${[...new Set(c.map(d=>d.reason))].slice(0,3).join(" ")} Example market IDs: ${c.slice(0,3).map(d=>d.marketId).join(", ")}. Retry positions or check a known market with morpho_status {"marketId":"<id>"}; other readable markets are retained.`});let m=u.filter(d=>d.position!==void 0&&(d.position.supplyShares>0n||d.position.borrowShares>0n||d.position.collateral>0n));for(let{marketId:d,position:p}of m)try{n.push(await Wa(e,r,d,p))}catch(b){let h=j(d)!==void 0;n.push({module:De,id:d,chainId:f,assets:[],incomplete:!0,description:`Unreadable ${h?"verified":"unverified"} Morpho market ${d}: the wallet holds supplyShares=${p.supplyShares.toString()}, borrowShares=${p.borrowShares.toString()}, collateral=${p.collateral.toString()} base units, but its token or oracle reads failed (${ie(b)}). Retry morpho_status {"marketId":"${d}"}.${h?"":" Read-only in Oak."}`})}return a!==void 0&&n.push({module:De,id:"morpho-discovery-unavailable",incomplete:!0,chainId:f,assets:[],description:`Incomplete: Morpho API position discovery failed (${a}). Only Oak's ${lt.length} verified markets were checked on chain; check any other market with morpho_status {"marketId":"<id>"}.`}),n}var ce="Morpho Blue market id: 0x followed by 64 hex digits (bytes32). Provide this or marketParams.",ue="Market parameters object with loanToken, collateralToken, oracle, irm (addresses) and lltv (decimal string, 18 decimals). Provide this or marketId.",ge="Position owner address. Must be the Oak wallet; any other address is refused. Omit to use the wallet.",st="Address receiving the tokens. Must be the Oak wallet; any other address is refused. Omit to use the wallet.",oe=()=>`Amount of the market's loan token in base units (read its decimals). Example: "1000000" = 1 USDG for a 6-decimal token.`,qe=`Amount of the market's collateral token in base units (read its decimals). Example: "1000000" = 1 USDG for a 6-decimal token.`,Ka=e=>({tools:[{name:"morpho_supply_collateral",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},assets:A(qe),amount:A(qe),collateralToken:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Optional collateral token address (0x + 40 hex); must match the market collateral token, or be the native ETH sentinel to wrap."},wrapNative:{type:"boolean",description:"true wraps native ETH into WETH first; only valid when the token supplied is WETH."},onBehalf:{type:"string",description:ge}}},execute:(s,r)=>Oa(e,s,r)},{name:"morpho_withdraw_collateral",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},assets:A(qe),amount:A(qe),withdrawAll:{type:"boolean",description:"true withdraws the full collateral balance; do not combine with assets or amount."},onBehalf:{type:"string",description:ge},receiver:{type:"string",description:st}}},execute:(s,r)=>Ra(e,s,r)},{name:"morpho_borrow",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},assets:A(oe()),amount:A(oe()),onBehalf:{type:"string",description:ge},receiver:{type:"string",description:st}}},execute:(s,r)=>Ea(e,s,r)},{name:"morpho_repay",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},assets:A(oe()),amount:A(oe()),shares:A("Borrow shares to repay, in share base units exactly as your position reports them (not loan-token units). Use instead of assets or amount."),repayAll:{type:"boolean",description:"true repays the entire debt; do not combine with assets, amount or shares."},onBehalf:{type:"string",description:ge}}},execute:(s,r)=>Ga(e,s,r)},{name:"morpho_supply",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},assets:A(oe()),amount:A(oe()),wrapNative:{type:"boolean",description:"true wraps native ETH into WETH first; only valid when the market loan token is WETH."},onBehalf:{type:"string",description:ge}}},execute:(s,r)=>_a(e,s,r)},{name:"morpho_withdraw",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},assets:A(oe()),amount:A(oe()),withdrawAll:{type:"boolean",description:"true withdraws the full supplied balance; do not combine with assets or amount."},onBehalf:{type:"string",description:ge},receiver:{type:"string",description:st}}},execute:(s,r)=>Ha(e,s,r)},{name:"morpho_status",inputSchema:{type:"object",properties:{marketId:{type:"string",description:ce},marketParams:{type:"object",description:ue},includeGraphql:{type:"boolean",description:"true also fetches Morpho API (GraphQL) market data alongside on-chain reads."},discover:{type:"boolean",description:"List the Morpho API market inventory with Oak action eligibility instead of reading markets on chain."},loanToken:{type:"string",description:"discover filter: loan token address or symbol."},collateralToken:{type:"string",description:"discover filter: collateral token address or symbol."},verifiedOnly:{type:"boolean",description:"discover filter: only markets Oak can act on."},limit:{type:"integer",minimum:1,maximum:100,description:"discover page size, default 20."}}},execute:(s,r)=>za(e,s,r)}].map(s=>{let r=new Set(Object.keys(s.inputSchema.properties));if(r.add("wallet"),s.name!=="morpho_status")for(let l of["onBehalf","receiver","data"])r.add(l);let n=new Set(["loanToken","collateralToken","oracle","irm","lltv"]);return{...s,execute:async(l,a)=>{for(let o of Object.keys(l))if(!r.has(o))throw new i(`Unknown argument ${Ye(o)} for ${s.name}; remove it and retry.`);if(l.marketParams&&typeof l.marketParams=="object"){for(let o of Object.keys(l.marketParams))if(!n.has(o))throw new i(`Unknown Morpho marketParams field ${Ye(o)}; remove it and retry.`)}return s.execute(l,a)}}}),positions:s=>ja(e,s)}),Ko=e=>bt(De,[Ka(e),Tt(e),Wt(e),Ht(e),$t(e)]);var _=z[f].morpho.morpho_blue.address,Pe="(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)",O=pt(["function owner() view returns (address)","function feeRecipient() view returns (address)","function isIrmEnabled(address) view returns (bool)","function isLltvEnabled(uint256) view returns (bool)","function isAuthorized(address,address) view returns (bool)","function nonce(address) view returns (uint256)",`function idToMarketParams(bytes32) view returns ${Pe}`,"function market(bytes32) view returns (uint128,uint128,uint128,uint128,uint128,uint128)","function position(bytes32,address) view returns (uint256 supplyShares,uint128 borrowShares,uint128 collateral)",`function createMarket(${Pe} marketParams)`,`function accrueInterest(${Pe} marketParams)`,`function setFee(${Pe} marketParams,uint256 newFee)`,"function setAuthorization(address authorized,bool newIsAuthorized)","function setOwner(address newOwner)","function setFeeRecipient(address newFeeRecipient)","function enableIrm(address irm)","function enableLltv(uint256 lltv)",`function liquidate(${Pe} marketParams,address borrower,uint256 seizedAssets,uint256 repaidShares,bytes data) returns (uint256,uint256)`]),Ya=pt(["function price() view returns (uint256)"]),Ja=pt([`function borrowRateView(${Pe} marketParams,(uint128 totalSupplyAssets,uint128 totalSupplyShares,uint128 totalBorrowAssets,uint128 totalBorrowShares,uint128 lastUpdate,uint128 fee) market) view returns (uint256)`]),oa=["createMarket","accrueInterest","setAuthorization","setOwner","setFeeRecipient","enableIrm","enableLltv","setFee"],Za=new Set(["setOwner","setFeeRecipient","enableIrm","enableLltv","setFee"]);function Ne(e){if(typeof e!="string"||!/^\d+$/.test(e)||e.length>78||BigInt(e)>=1n<<256n)throw new i("Provide a uint256 decimal base-unit string.");return BigInt(e)}function mt(e){return Ee(e,"Provide an explicit account address.",Oe)}var Wt=e=>{async function t(){let n=e.clientFor(f);if(await n.getChainId()!==f)throw new i("Morpho protocol tools require chain 4663.");return n}async function s(n){if(typeof n!="string"||!j(n))throw new i("Choose a market in Oak\u2019s verified registry.");let l=await t(),a=await l.readContract({address:_,abi:O,functionName:"idToMarketParams",args:[n]}),o={loanToken:a[0],collateralToken:a[1],oracle:a[2],irm:a[3],lltv:a[4]};if(!R(ke({...o,lltv:o.lltv.toString()}),n))throw new i("On-chain Morpho parameters do not match the selected market.");return{rpc:l,params:o,marketId:n}}let r=(n,l,a,o)=>({name:n,inputSchema:{type:"object",properties:l,required:a,additionalProperties:!1},execute:async(u,c)=>{try{if(q(c),Object.keys(u).some(m=>!Object.hasOwn(l,m)))throw new i("Unsupported Morpho protocol argument.");return await o(u,c)}catch(m){throw new i(e.plainError(m))}}});return{tools:[r("morpho_protocol",{authorized:{type:"string",description:"Optional address to check whether it is authorized to manage the Oak wallet's Morpho positions."}},[],async(n,l)=>{let a=await t(),[o,u,c]=await Promise.all([a.readContract({address:_,abi:O,functionName:"owner"}),a.readContract({address:_,abi:O,functionName:"feeRecipient"}),a.readContract({address:_,abi:O,functionName:"nonce",args:[l]})]),m=n.authorized===void 0?void 0:mt(n.authorized);return{chainId:f,morpho:_,owner:o,feeRecipient:u,nonce:c.toString(),...m?{authorized:m,isAuthorized:await a.readContract({address:_,abi:O,functionName:"isAuthorized",args:[l,m]})}:{}}}),r("morpho_manage",{operation:{enum:oa,description:"Protocol action: createMarket, accrueInterest, setAuthorization, setOwner, setFeeRecipient, enableIrm, enableLltv or setFee. Owner-only except accrueInterest, setAuthorization and createMarket."},marketId:{type:"string",description:"Verified market id (0x + 64 hex digits). Used by accrueInterest and setFee."},marketParams:{type:"object",description:"For createMarket only: loanToken, collateralToken, oracle, irm addresses and lltv as a decimal string (18 decimals)."},account:{type:"string",description:"Address argument: authorized account for setAuthorization, new owner, new fee recipient, or IRM to enable."},enabled:{type:"boolean",description:"For setAuthorization: true grants the account control of all your Morpho positions, false revokes it."},value:A("18-decimal wad in base units: for setFee the fee (max 0.25e18 = 25 percent), for enableLltv the LLTV (below 1e18; 0.8e18 = 80 percent).")},["operation"],async(n,l)=>{if(typeof n.operation!="string"||!oa.includes(n.operation))throw new i("Choose a documented Morpho protocol operation.");let a=n.operation,o=await t(),u=a==="createMarket"?["operation","marketParams"]:a==="accrueInterest"?["operation","marketId"]:a==="setFee"?["operation","marketId","value"]:a==="enableLltv"?["operation","value"]:a==="setAuthorization"?["operation","account","enabled"]:["operation","account"];if(Object.keys(n).some(p=>!u.includes(p)))throw new i("Unexpected fields for this Morpho operation.");if(Za.has(a)){let p=await o.readContract({address:_,abi:O,functionName:"owner"});if(aa(p)!==aa(l))throw new i("This wallet does not hold the Morpho owner role.")}let c;if(a==="createMarket"){if(!n.marketParams||typeof n.marketParams!="object"||Array.isArray(n.marketParams)||Object.keys(n.marketParams).some(w=>!["loanToken","collateralToken","oracle","irm","lltv"].includes(w)))throw new i("Provide only the five documented market parameter fields.");let p=je(n.marketParams),[b,h]=await Promise.all([o.readContract({address:_,abi:O,functionName:"isIrmEnabled",args:[p.irm]}),o.readContract({address:_,abi:O,functionName:"isLltvEnabled",args:[p.lltv]})]);if(!b||!h)throw new i("The new market\u2019s IRM and LLTV must first be enabled by the Morpho owner.");c=be({abi:O,functionName:"createMarket",args:[p]})}else if(a==="accrueInterest"||a==="setFee"){let{params:p}=await s(n.marketId);if(a==="setFee"){let b=Ne(n.value);if(b>250000000000000000n)throw new i("Morpho market fee cannot exceed 25% (0.25e18).");c=be({abi:O,functionName:"setFee",args:[p,b]})}else c=be({abi:O,functionName:"accrueInterest",args:[p]})}else if(a==="enableLltv"){let p=Ne(n.value);if(p>=10n**18n)throw new i("Morpho LLTV must be below 1e18.");c=be({abi:O,functionName:"enableLltv",args:[p]})}else{let p=mt(n.account);if(a==="setAuthorization"){if(typeof n.enabled!="boolean")throw new i("Provide enabled as a boolean.");c=be({abi:O,functionName:"setAuthorization",args:[p,n.enabled]})}else if(a==="setOwner"||a==="enableIrm"||a==="setFeeRecipient")c=be({abi:O,functionName:a,args:[p]});else throw new i("Unsupported Morpho operation.")}let m=`Morpho ${a}: ${JSON.stringify(n)}. ${a==="setAuthorization"&&n.enabled?"This account can manage all your Morpho positions, including borrowing and withdrawals. There is no amount cap.":""}${a==="setOwner"&&n.account===Xa?"Setting the owner to zero permanently relinquishes protocol administration.":""}${a==="createMarket"?"New market creation does not add it to Oak\u2019s verified action registry.":""}`,d=[e.unsignedTx({to:_,data:c,value:"0",chainId:f,description:m})];return{txs:d,preview:await e.preview(d,l),summary:m}}),r("morpho_liquidate",{marketId:{type:"string",description:"Verified Morpho Blue market id (0x + 64 hex digits) holding the unhealthy position."},borrower:{type:"string",description:"Address of the unhealthy borrower to liquidate."},repaidShares:A("Borrow shares to repay, in share base units (read the borrower position); cannot exceed their debt shares."),maxAssets:A('Most loan token you will pay, in base units of the market loan token (read its decimals). Example: "1000000" = 1 USDG.'),minCollateral:A("Least collateral you must receive, in collateral token units (base units, read its decimals); checked in simulation only.")},["marketId","borrower","repaidShares","maxAssets","minCollateral"],async(n,l)=>{let{rpc:a,params:o,marketId:u}=await s(n.marketId),c=mt(n.borrower),m=Ne(n.repaidShares),d=Ne(n.maxAssets),p=Ne(n.minCollateral),[b,h,w,y]=await Promise.all([a.readContract({address:_,abi:O,functionName:"market",args:[u]}),a.readContract({address:_,abi:O,functionName:"position",args:[u,c]}),a.readContract({address:o.oracle,abi:Ya,functionName:"price"}),a.getBlock()]);if(m===0n||m>h[1]||w===0n)throw new i("Liquidation shares must fit the current debt and the oracle must be valid.");let k={totalSupplyAssets:b[0],totalSupplyShares:b[1],totalBorrowAssets:b[2],totalBorrowShares:b[3],lastUpdate:b[4],fee:b[5]},g=await a.readContract({address:o.irm,abi:Ja,functionName:"borrowRateView",args:[o,k]}),T=Qe(k,g,y.timestamp);if(se(h[1],T,b[3])<=Ae(h[2],w,o.lltv))throw new i("This borrower is healthy; liquidation is unavailable.");let x=se(m,Qe(k,g,y.timestamp+120n),b[3]);if(x>d)throw new i("Liquidation funding exceeds maxAssets.");if(await a.readContract({address:o.loanToken,abi:Qa,functionName:"balanceOf",args:[l]})<x)throw new i("Top up the loan token before liquidating.");let C=`Liquidate ${m} debt shares of ${c} on ${u}; exact approval ${x} loan-token base units; preview minimum ${p} collateral units. No callbacks; the wallet funds repayment. Approval can leave interest-buffer dust; revoke it afterward.`,P=[e.approval(o.loanToken,_,x.toString(),f),e.unsignedTx({to:_,data:be({abi:O,functionName:"liquidate",args:[o,c,0n,m,"0x"]}),value:"0",chainId:f,description:C})],I=await e.preview(P,l),E=Z=>I.changes.filter(H=>H.token.chainId===f&&R(H.token.address,Z)).reduce((H,F)=>H+BigInt(F.amount),0n);if(-E(o.loanToken)<=0n||-E(o.loanToken)>x||E(o.collateralToken)<p||E(o.collateralToken)<=0n)throw new i("Liquidation preview does not match the funding limit and collateral minimum.");return{txs:P,preview:I,requiredAssets:x.toString(),summary:`${C} MinCollateral is a local simulation check, not an on-chain floor.`}})]}};export{O as a,Wt as b,we as c,$t as d,Y as e,ha as f,Ot as g,wa as h,Et as i,ka as j,Ht as k,De as l,Aa as m,$ as n,xa as o,Ia as p,me as q,Ta as r,Ma as s,lt as t,j as u,Ue as v,Ua as w,$a as x,ut as y,se as z,Ae as A,Ba as B,je as C,ke as D,Xt as E,Qe as F,Ka as G,Ko as H,et as I,vt as J,N as K,io as L};
|