@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
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as le,o as K}from"./BOVMED7R.js";import{b as x}from"./66F5ZH34.js";import{c as W,f as de,h as y,i as ce,l as ue}from"./NWNYJ26T.js";import{a as k,i as oe,j as G}from"./FWD4L3CJ.js";import{a as N}from"./XSD5NL7J.js";import{a as O}from"./JXOEJPJ4.js";import{randomBytes as ge,randomUUID as he}from"node:crypto";import{isDeepStrictEqual as pe}from"node:util";import{decodeFunctionData as me,encodeAbiParameters as ne,erc20Abi as J,keccak256 as ie,parseAbi as re,parseAbiParameters as ae,toEventSelector as be,zeroAddress as L}from"viem";var se=oe[k].meridian,Q=se.PredictionMarketEscrow.address,V=se.SecondaryMarketEscrow.address,$={address:se.CollateralToken_USDe.address,chainId:k,symbol:"USDe",decimals:18},we="wss://relayer.predict.meridian.xyz/auction",ke=ae("(address conditionResolver,bytes conditionId,uint8 predictedOutcome)[]"),Ie=ae("bytes32,uint256,uint256,address,address,address,bytes"),Se=ae("address,address,address,address,uint256,uint256"),X=re(["function isNonceUsed(address,uint256) view returns (bool)"]),Be=re(["function mint(((address conditionResolver,bytes conditionId,uint8 predictedOutcome)[] picks,uint256 predictorCollateral,uint256 counterpartyCollateral,address predictor,address counterparty,uint256 predictorNonce,uint256 counterpartyNonce,uint256 predictorDeadline,uint256 counterpartyDeadline,bytes predictorSignature,bytes counterpartySignature,bytes32 refCode,bytes predictorSessionKeyData,bytes counterpartySessionKeyData,address predictorSponsor,bytes predictorSponsorData) request)"]),Me=re(["function executeTrade((address token,address collateral,address seller,address buyer,uint256 tokenAmount,uint256 price,uint256 sellerNonce,uint256 buyerNonce,uint256 sellerDeadline,uint256 buyerDeadline,bytes sellerSignature,bytes buyerSignature,bytes32 refCode,bytes sellerSessionKeyData,bytes buyerSessionKeyData) request)"]),$e=be("Transfer(address,address,uint256)"),Ae=[{name:"predictionHash",type:"bytes32"},{name:"signer",type:"address"},{name:"collateral",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],Ce=[{name:"tradeHash",type:"bytes32"},{name:"signer",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}];function i(n){throw new N(n)}function _(n){return de(n,"Meridian returned an invalid exchange object.")}function M(n,t,d=!1){return d&&typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&(n=String(n)),(typeof n!="string"||!/^\d+$/.test(n)||BigInt(n)>=1n<<256n)&&i(`Provide ${t} as a decimal base-unit integer string.`),n}function F(n){let t=Number(n);return(!Number.isSafeInteger(t)||t<0||BigInt(t)!==BigInt(n))&&i("Meridian signing terms cannot be represented exactly as JSON numbers."),t}function R(n){let t="Provide a nonzero token, resolver or wallet address.";return ue(ce(n,t),t)}function Z(n,t){return(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n)||t!==void 0&&n.length!==2+t*2)&&i("Meridian returned invalid hexadecimal data."),n}function v(n){return(typeof n!="string"||n.length===0||n.length>256)&&i("Meridian returned an invalid exchange identifier."),n}function j(){return BigInt(Math.floor(Date.now()/1e3))}function ve(n,t){let d=n==="buy"?["picks","stake","minCounterpartyCollateral","usdgAmountIn","slippageBps","continuation","signature"]:["token","amount","minPrice","slippageBps","continuation","signature"];Object.keys(t).some(S=>!d.includes(S))&&i("Unsupported Meridian arguments; use the tool input schema."),t.slippageBps!==void 0&&(typeof t.slippageBps!="number"||!Number.isInteger(t.slippageBps)||t.slippageBps<0||t.slippageBps>=1e4)&&i("Slippage must be an integer from 0 to 9999 basis points.");let c=t.slippageBps;if(n==="sell"){let S=M(t.amount,"the position amount");BigInt(S)===0n&&i("The position amount must be positive.");let B=R(t.token);(y(B,$.address)||y(B,G))&&i("Choose a Meridian position token to sell.");let A;if(t.minPrice!==void 0){let e=M(t.minPrice,"the minimum sale price");BigInt(e)<=1n&&i("The minimum sale price must be greater than 1 base unit."),A=e}else{let e=BigInt(S)/100n>10n**18n?BigInt(S)/100n:10n**18n;A=c===void 0?e.toString():K(e.toString(),c)}return{side:n,token:B,amount:S,minPrice:A,priceFloorSource:t.minPrice===void 0?"default":"explicit",...c===void 0?{}:{slippageBps:c}}}(!Array.isArray(t.picks)||t.picks.length<1||t.picks.length>10)&&i("Provide between one and ten Meridian picks.");let m=t.picks.map(S=>{let B=_(S);return(Object.keys(B).some(A=>!["conditionResolver","conditionId","predictedOutcome"].includes(A))||B.predictedOutcome!==0&&B.predictedOutcome!==1)&&i("Each pick needs a resolver, condition ID and outcome 0 or 1."),{conditionResolver:R(B.conditionResolver),conditionId:Z(B.conditionId),predictedOutcome:B.predictedOutcome}}).sort((S,B)=>{let A=`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}:${S.predictedOutcome}`,e=`${B.conditionResolver.toLowerCase()}:${B.conditionId.toLowerCase()}:${B.predictedOutcome}`;return A<e?-1:A>e?1:0}),g=m.map(S=>`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}`);new Set(g).size!==m.length&&i("Do not repeat a condition in the same prediction.");let l=M(t.stake,"the USDe stake");BigInt(l)<10n**18n&&i("Meridian requires a stake of at least 1 USDe.");let I=t.usdgAmountIn===void 0?void 0:M(t.usdgAmountIn,"the USDG swap amount");I!==void 0&&BigInt(I)===0n&&i("The USDG swap amount must be positive.");let D=t.minCounterpartyCollateral!==void 0?M(t.minCounterpartyCollateral,"the minimum counterparty collateral"):K(l,c??le);return BigInt(D)<=1n&&i("The minimum counterparty collateral must be greater than 1 base unit."),{side:n,picks:m,stake:l,minCounterpartyCollateral:D,...I===void 0?{}:{usdgAmountIn:I},...c===void 0?{}:{slippageBps:c}}}var ee=class{constructor(t,d){this.id=t;this.prefix=d;this.socket=new globalThis.WebSocket(we),this.socket.addEventListener("open",()=>{this.opened=!0,this.notify?.()}),this.socket.addEventListener("close",()=>this.stop("Meridian exchange socket was lost. Start a fresh auction.")),this.socket.addEventListener("error",()=>this.stop("Meridian exchange socket failed. Start a fresh auction.")),this.socket.addEventListener("message",c=>{try{(typeof c.data!="string"||c.data.length>65536)&&i("Meridian returned a malformed exchange message.");let m=_(JSON.parse(c.data));if(m.type==="pong")return;let g=v(m.type),l=_(m.payload);if(g==="error"&&i("Meridian rejected or failed the exchange. Start a fresh auction."),g===`${d}.ack`){this.auctionId===void 0?((l.id!==t||this.accepting||l.accepted!==void 0)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected the exchange: ${O(v(l.error))}.`),this.auctionId=v(l.auctionId)):((!this.accepting||l.auctionId!==this.auctionId||l.id!==void 0&&l.id!==t)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected acceptance: ${O(v(l.error))}.`),l.accepted!==!0&&i("Meridian rejected acceptance of the exchange."));return}if((!g.startsWith(`${d}.`)||l.auctionId!==this.auctionId||!this.auctionId)&&i("Meridian returned a message for a different exchange."),["error","rejected","failed","expired"].some(I=>g===`${d}.${I}`)){let I=["reason","makerReason"].flatMap(D=>l[D]===void 0?[]:[`${D}=${O(v(l[D]))}`]);i(`Meridian exchange ${g.slice(d.length+1)}${I.length?`: ${I.join("; ")}`:""}. Start a fresh auction.`)}if((g===`${d}.pending`||g===`${d}.filled`)&&!this.accepting&&i("Meridian returned settlement before acceptance."),g===`${d}.pending`)return;this.queue.length>=16&&i("Meridian returned too many exchange messages."),this.queue.push({type:g,payload:l}),this.notify?.()}catch(m){this.stop(m instanceof N?m.message:"Meridian rejected or returned an invalid exchange message. Start a fresh auction.")}})}id;prefix;socket;queue=[];notify;error;auctionId;accepting=!1;opened=!1;check(){if(this.error)throw this.error;this.socket.readyState>1&&i("Meridian exchange socket was lost. Start a fresh auction.")}stop(t){this.error??=new N(t),this.notify?.(),this.socket.readyState<2&&this.socket.close()}async wait(t,d=3e4){return new Promise((c,m)=>{let g=setTimeout(()=>this.stop("Meridian exchange timed out. Start a fresh auction."),d),l=()=>{try{if(this.check(),t===void 0?!this.opened:!this.queue.length)return;let I=t===void 0?void 0:this.queue.shift();I&&I.type!==`${this.prefix}.${t}`&&i("Meridian returned an unexpected exchange stage."),clearTimeout(g),this.notify=void 0,c(I?.payload??{})}catch(I){clearTimeout(g),this.notify=void 0,m(I)}};this.notify=l,l()})}send(t,d){this.check(),this.socket.readyState!==1&&i("Meridian exchange socket is not open."),t==="accept"&&(this.accepting=!0),this.socket.send(JSON.stringify({...t==="start"?{id:this.id}:{},type:`${this.prefix}.${t}`,payload:d}))}};function te(n){return ie(ne(ke,[n]))}function De(n,t,d){return ie(ne(Ie,[te(n.picks),BigInt(n.stake),BigInt(d.counterpartyCollateral),t,d.counterparty,L,"0x"]))}function qe(n,t,d,c){return ie(ne(Se,[n.token,$.address,t,d,BigInt(n.amount),BigInt(c)]))}function Y(n,t){let{input:d,wallet:c,nonce:m,deadline:g}=n,l={name:d.side==="buy"?"PredictionMarketEscrow":"SecondaryMarketEscrow",version:"1",chainId:k,verifyingContract:n.continuation.escrowContract};return(!m||!g)&&i("Meridian exchange is missing its signing terms."),d.side==="buy"?(t||i("Meridian has not returned a winning bid."),{domain:l,primaryType:"MintApproval",types:{MintApproval:Ae},message:{predictionHash:De(d,c,t),signer:c,collateral:d.stake,nonce:m,deadline:g}}):{domain:l,primaryType:"TradeApproval",types:{TradeApproval:Ce},message:{tradeHash:qe(d,c,t?t.buyer:L,t?t.price:"0"),signer:c,nonce:m,deadline:g}}}function fe(n){let t=[BigInt(n.deadline)],d=n.continuation;if(d.stage==="primary_accept"||d.stage==="secondary_accept"){t.push(BigInt(d.acceptDeadline));let c=d.winningBid;d.stage==="primary_accept"&&t.push(BigInt(c.counterpartyDeadline)),c.buyerDeadline!==void 0&&t.push(BigInt(M(c.buyerDeadline,"the buyer deadline",!0)))}return t.reduce((c,m)=>c<m?c:m)}function H(n){n.channel?.check(),n.deadline&&j()>=fe(n)&&i("Meridian exchange expired. Start a fresh auction.")}var Oe=n=>{let t=new Map;function d(e){clearTimeout(e.timer),t.delete(e.continuation.requestId),e.channel?.stop("Meridian exchange is closed or expired. Start a fresh auction.")}function c(e,a){clearTimeout(e.timer),e.timer=setTimeout(()=>d(e),a),e.timer.unref?.()}function m(e){let{wallet:a,chainId:s,escrowContract:f,requestId:u}=e.continuation;return{wallet:a,chainId:s,escrowContract:f,requestId:u}}function g(e){return e.side!=="sell"?"":` Effective minimum sale proceeds: ${e.minPrice} USDe base units (${$.address}, 18 decimals). ${e.priceFloorSource==="explicit"?"Caller minPrice is unchanged; slippageBps does not reduce this floor.":`Default floor with ${e.slippageBps??0} bps slippage applied.`}`}async function l(e){let{input:a,wallet:s}=e,f=n.clientFor(k),u=a.side==="buy"?$.address:a.token,r=a.side==="buy"?a.stake:a.amount,[h,w]=await Promise.all([f.readContract({address:u,abi:J,functionName:"balanceOf",args:[s]}),f.readContract({address:u,abi:J,functionName:"allowance",args:[s,e.continuation.escrowContract]})]);if(a.side==="sell"&&await f.readContract({address:u,abi:J,functionName:"decimals"})!==18&&i("Meridian position tokens must have 18 decimals."),h>=BigInt(r)&&w>=BigInt(r))return;(e.continuation.stage==="primary_accept"||e.continuation.stage==="secondary_accept")&&i("Meridian prerequisites changed during the auction. Start a fresh auction after funding and approval.");let p,C;if(h<BigInt(r)){a.side==="sell"&&i("The wallet does not have enough position tokens to sell."),a.usdgAmountIn||i("Not enough USDe. Provide usdgAmountIn in USDG base units to quote a swap before the auction.");let b=await n.quoteSwap({from:G,to:$.address,amountIn:a.usdgAmountIn,...a.slippageBps===void 0?{}:{slippageBps:a.slippageBps}},s);(j()>=BigInt(M(b.expiresAt,"the swap expiry"))||BigInt(M(b.minAmountOut,"the swap minimum"))+h<BigInt(r))&&i("The USDG swap minimum does not cover the USDe stake, or the quote expired. Request a fresh quote with sufficient input.");let o=await n.buildSwap(b.quoteId,s);(!("txs"in o)||!o.txs.length)&&i("The swap coordinator did not return prerequisite transactions."),p=o.txs,C=`${o.summary} Minimum USDe output: ${b.minAmountOut} base units (18 decimals).`}else p=[n.approval(u,e.continuation.escrowContract,r,k)],C=`Approve exactly ${r} base units (18 decimals) of ${u} for ${e.continuation.escrowContract} on chain ${k}.`;p.some(b=>b.chainId!==k)&&i("Meridian prerequisite transactions must use chain 4663.");let q=await n.preview(p,s),T=q.changes.map(b=>{let o=b.amount.startsWith("-");return`${o?"-":"+"}${n.formatAmount(o?b.amount.slice(1):b.amount,b.token.decimals)} ${b.token.symbol} (${b.token.address}, chain ${b.token.chainId}, ${b.token.decimals} decimals)`}).join("; ");return e.channel?.stop("Meridian prerequisites must be mined before the auction."),e.channel=void 0,e.deadline=void 0,e.nonce=void 0,e.continuation={...m(e),stage:"prerequisites"},{steps:p.map(b=>({kind:"tx",tx:b})),continuation:structuredClone(e.continuation),summary:`${C}${g(a)} ${q.summary} ${T}. Mine these prerequisites before continuing; no RFQ has started.`}}function I(e){let a=e.continuation;a.stage==="prerequisites"&&i("Meridian prerequisites need to finish before signing."),H(e),c(e,Number(fe(e)-j())*1e3);let s=e.input,f=s.side==="buy"?`Stake ${s.stake} base units of USDe (${$.address}, 18 decimals)`:`Sell ${s.amount} base units of position ${s.token} (18 decimals)`,u=a.stage==="secondary_start"?"Initial buyer-zero, price-zero intent only.":a.stage==="primary_accept"?`Counterparty ${a.winningBid.counterparty}; counterparty collateral ${a.winningBid.counterpartyCollateral} USDe base units; counterparty deadline ${a.winningBid.counterpartyDeadline}.`:`Buyer ${a.winningBid.buyer}; receive ${a.winningBid.price} USDe base units (${$.address}, 18 decimals).`;return{steps:[{kind:"typedData",request:structuredClone(a.request)}],continuation:structuredClone(a),summary:`${f} on chain ${k}.${g(s)} Approval was checked on chain. ${u} Sign locally for domain ${a.request.domain.name}, version 1, escrow ${a.escrowContract}, signature deadline ${e.deadline}${"acceptDeadline"in a?`, acceptance deadline ${a.acceptDeadline}`:""}. External relayer settlement is pending; a signature is not a fill.`}}async function D(e){let a=await e.channel.wait("result"),s=_(a.winningBid),f=v(a.auctionId);s.auctionId!==f&&i("Meridian winning bid belongs to another auction.");let u=M(a.acceptDeadline,"the acceptance deadline",!0);if(e.input.side==="buy"){let r={auctionId:f,counterparty:v(s.counterparty),counterpartyCollateral:M(s.counterpartyCollateral,"the counterparty collateral"),counterpartyNonce:M(s.counterpartyNonce,"the counterparty nonce",!0),counterpartyDeadline:M(s.counterpartyDeadline,"the counterparty deadline",!0),receivedAt:v(s.receivedAt)};R(r.counterparty),(!Number.isFinite(Date.parse(r.receivedAt))||BigInt(r.counterpartyCollateral)<=1n||BigInt(r.counterpartyCollateral)<BigInt(e.input.minCounterpartyCollateral))&&i("Meridian winning bid counterparty collateral is below the caller minimum."),e.continuation={...m(e),stage:"primary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}else{let r={auctionId:f,buyer:v(s.buyer),price:M(s.price,"the sale price"),...s.buyerDeadline!==void 0?{buyerDeadline:M(s.buyerDeadline,"the buyer deadline",!0)}:{},...s.buyerNonce!==void 0?{buyerNonce:M(s.buyerNonce,"the buyer nonce",!0)}:{},...s.receivedAt!==void 0?{receivedAt:v(s.receivedAt)}:{}};R(r.buyer),(BigInt(r.price)<=1n||BigInt(r.price)<BigInt(e.input.minPrice))&&i("Meridian winning bid sale price is below the caller minimum."),e.continuation={...m(e),stage:"secondary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}return I(e)}async function S(e,a){let s=e.continuation;s.stage!=="primary_accept"&&s.stage!=="secondary_accept"&&i("Meridian exchange is not ready for acceptance."),H(e),e.channel.send("accept",{auctionId:s.auctionId,[e.input.side==="buy"?"predictorSignature":"sellerSignature"]:a}),c(e,15e4);let f=await e.channel.wait("filled",12e4),u=Z(f.transactionHash,32),r=n.clientFor(k),[h,w]=await Promise.all([r.waitForTransactionReceipt({hash:u,timeout:12e4}),r.getTransaction({hash:u})]);(h.status!=="success"||!y(h.transactionHash,u)||!y(w.hash,u)||!y(h.to,s.escrowContract)||!y(w.to,s.escrowContract)||w.chainId!==k)&&i("Meridian fill has no matching successful receipt on chain 4663.");let{input:p,wallet:C}=e;if(p.side==="buy"&&s.stage==="primary_accept"){let o=me({abi:Be,data:w.input}).args[0];(!y(te([...o.picks]),te(p.picks))||o.predictorCollateral!==BigInt(p.stake)||o.counterpartyCollateral!==BigInt(s.winningBid.counterpartyCollateral)||!y(o.predictor,C)||!y(o.counterparty,s.winningBid.counterparty)||o.predictorNonce!==BigInt(e.nonce)||o.predictorDeadline!==BigInt(e.deadline)||!y(o.predictorSponsor,L)||o.predictorSponsorData!=="0x"||!y(o.predictorSignature,a))&&i("Meridian mint receipt does not match the accepted prediction.")}else if(p.side==="sell"&&s.stage==="secondary_accept"){let o=me({abi:Me,data:w.input}).args[0];(!y(o.token,p.token)||!y(o.collateral,$.address)||!y(o.seller,C)||!y(o.buyer,s.winningBid.buyer)||o.tokenAmount!==BigInt(p.amount)||o.price!==BigInt(s.winningBid.price)||o.sellerNonce!==BigInt(e.nonce)||o.sellerDeadline!==BigInt(e.deadline)||!y(o.sellerSignature,a))&&i("Meridian sale receipt does not match the accepted trade.")}let q=new Map,T=new Map;for(let o of h.logs){if(o.topics[0]!==$e||o.topics.length!==3)continue;(!/^0x[0-9a-fA-F]{64}$/.test(o.data)||!o.topics.slice(1).every(ye=>/^0x0{24}[0-9a-fA-F]{40}$/.test(ye)))&&i("Meridian receipt has malformed transfer logs.");let E=`0x${o.topics[1].slice(-40)}`,U=`0x${o.topics[2].slice(-40)}`,P=o.address.toLowerCase(),z=BigInt(o.data);q.set(P,(q.get(P)??0n)+(y(U,C)?z:0n)-(y(E,C)?z:0n)),y(E,L)&&y(U,C)&&T.set(P,(T.get(P)??0n)+z)}let b;if(p.side==="buy"&&s.stage==="primary_accept"){let o=BigInt(p.stake)+BigInt(s.winningBid.counterpartyCollateral),E=[...T].filter(([U,P])=>!y(U,$.address)&&P===o&&q.get(U)===o);(E.length!==1||q.get($.address.toLowerCase())!==-BigInt(p.stake))&&i("Meridian mint receipt does not prove the expected collateral and position delta."),b=`${o} base units received in position ${E[0][0]}`}else p.side==="sell"&&s.stage==="secondary_accept"?((q.get(p.token.toLowerCase())!==-BigInt(p.amount)||q.get($.address.toLowerCase())!==BigInt(s.winningBid.price))&&i("Meridian sale receipt does not prove the expected collateral and position delta."),b=`${p.amount} base units sold from position ${p.token}; ${s.winningBid.price} USDe base units received`):i("Meridian fill has a different exchange stage.");return{txs:[],hashes:[u],status:"mined",summary:`Mined: ${u}. Status: mined. Meridian ${p.side} filled by the external relayer. Successful receipt and transfer deltas verified on chain ${k}: ${b} (18 decimals); collateral USDe ${$.address} (18 decimals).`}}async function B(e,a,s){let f=R(s),u=ve(e,a),r;if(a.continuation!==void 0){let h=_(a.continuation),w=t.get(v(h.requestId));w||i("Meridian exchange is lost or expired. Start a fresh auction."),(!y(w.wallet,f)||!pe(w.input,u)||!pe(w.continuation,h))&&i("Meridian continuation or arguments do not match the active wallet exchange."),w.busy&&i("Meridian exchange is already processing this continuation."),r=w}else{a.signature!==void 0&&i("A signature requires an active Meridian continuation."),t.size>=1e3&&i("Too many active Meridian exchanges. Please try again later.");let h=he(),w=setTimeout(()=>{let p=t.get(h);p&&d(p)},9e5);w.unref?.(),r={input:u,wallet:f,continuation:{stage:"prerequisites",wallet:f,chainId:k,escrowContract:e==="buy"?Q:V,requestId:h},busy:!1,timer:w},t.set(h,r)}r.busy=!0;try{H(r),await n.clientFor(k).getChainId()!==k&&i("Meridian requires an RPC on chain 4663.");let h=r.continuation.stage;h==="prerequisites"&&a.signature!==void 0&&i("Do not sign before Meridian prerequisites have mined.");let w=await l(r);if(w)return w;if(h==="prerequisites")return r.nonce=(ge(4).readUInt32BE()+1).toString(),r.deadline=(j()+300n).toString(),await n.clientFor(k).readContract({address:r.continuation.escrowContract,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i(`Meridian ${e==="buy"?"predictor":"seller"} nonce is already used. Start a fresh auction.`),r.channel=new ee(r.continuation.requestId,e==="buy"?"auction":"secondary.auction"),await r.channel.wait(),u.side==="buy"?(r.channel.send("start",{id:r.continuation.requestId,picks:u.picks,predictorCollateral:u.stake,predictor:f,predictorNonce:F(r.nonce),predictorDeadline:F(r.deadline),chainId:k,escrowContract:Q,mode:"blind"}),await D(r)):(r.continuation={...m(r),stage:"secondary_start",request:Y(r)},I(r));let p=Z(a.signature);if(e==="sell"&&await n.clientFor(k).readContract({address:V,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian seller nonce is already used. Start a fresh auction."),e==="buy"&&await n.clientFor(k).readContract({address:Q,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian predictor nonce is already used. Start a fresh auction."),H(r),h==="secondary_start"&&u.side==="sell")return r.channel.send("start",{id:r.continuation.requestId,token:u.token,collateral:$.address,tokenAmount:u.amount,seller:f,sellerNonce:F(r.nonce),sellerDeadline:F(r.deadline),chainId:k,escrowContract:V,mode:"blind",sellerSignature:p}),await D(r);let C=await S(r,p);return d(r),C}catch(h){throw d(r),new N(n.plainError(h))}finally{r.busy=!1}}let A={continuation:{type:"object"},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"}};return{tools:[{name:"meridian_buy",inputSchema:{type:"object",additionalProperties:!1,required:["picks","stake"],properties:{...A,stake:x("USDe stake in base units, 18 decimals, chain 4663."),minCounterpartyCollateral:x("Optional caller minimum counterparty collateral in USDe base units, 18 decimals."),usdgAmountIn:x("Optional exact USDG swap input in base units, 6 decimals, if USDe balance is insufficient."),slippageBps:{type:"integer",minimum:0,maximum:9999},picks:{type:"array",minItems:1,maxItems:10,items:{type:"object",additionalProperties:!1,required:["conditionResolver","conditionId","predictedOutcome"],properties:{conditionResolver:W,conditionId:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$"},predictedOutcome:{type:"integer",enum:[0,1]}}}}}},execute:(e,a)=>B("buy",e,a)},{name:"meridian_sell",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount"],properties:{...A,token:{...W,description:"Position token address on chain 4663."},amount:x("Position amount in base units, 18 decimals."),minPrice:x("Optional minimum total sale proceeds in USDe base units, 18 decimals. Explicit minPrice is never reduced by slippageBps."),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Applied only to the default sale floor when minPrice is omitted."}}},execute:(e,a)=>B("sell",e,a)}]}};export{Ae as a,Ce as b,Oe as c};
|
|
1
|
+
import{b as le,o as K}from"./LKX5WDOQ.js";import{b as x}from"./66F5ZH34.js";import{c as W,f as de,h as g,i as ce,l as ue}from"./NWNYJ26T.js";import{b as k,j as oe,k as G}from"./TI727O2H.js";import{a as N}from"./XSD5NL7J.js";import{a as F}from"./JXOEJPJ4.js";import{randomBytes as ye,randomUUID as he}from"node:crypto";import{isDeepStrictEqual as pe}from"node:util";import{decodeFunctionData as me,encodeAbiParameters as ne,erc20Abi as J,keccak256 as ie,parseAbi as re,parseAbiParameters as ae,toEventSelector as be,zeroAddress as L}from"viem";var se=oe[k].meridian,Q=se.PredictionMarketEscrow.address,V=se.SecondaryMarketEscrow.address,$={address:se.CollateralToken_USDe.address,chainId:k,symbol:"USDe",decimals:18},we="wss://relayer.predict.meridian.xyz/auction",ke=ae("(address conditionResolver,bytes conditionId,uint8 predictedOutcome)[]"),Ie=ae("bytes32,uint256,uint256,address,address,address,bytes"),Se=ae("address,address,address,address,uint256,uint256"),X=re(["function isNonceUsed(address,uint256) view returns (bool)"]),Be=re(["function mint(((address conditionResolver,bytes conditionId,uint8 predictedOutcome)[] picks,uint256 predictorCollateral,uint256 counterpartyCollateral,address predictor,address counterparty,uint256 predictorNonce,uint256 counterpartyNonce,uint256 predictorDeadline,uint256 counterpartyDeadline,bytes predictorSignature,bytes counterpartySignature,bytes32 refCode,bytes predictorSessionKeyData,bytes counterpartySessionKeyData,address predictorSponsor,bytes predictorSponsorData) request)"]),Me=re(["function executeTrade((address token,address collateral,address seller,address buyer,uint256 tokenAmount,uint256 price,uint256 sellerNonce,uint256 buyerNonce,uint256 sellerDeadline,uint256 buyerDeadline,bytes sellerSignature,bytes buyerSignature,bytes32 refCode,bytes sellerSessionKeyData,bytes buyerSessionKeyData) request)"]),$e=be("Transfer(address,address,uint256)"),Ce=[{name:"predictionHash",type:"bytes32"},{name:"signer",type:"address"},{name:"collateral",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],ve=[{name:"tradeHash",type:"bytes32"},{name:"signer",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}];function i(n){throw new N(n)}function _(n){return de(n,"Meridian returned an invalid exchange object.")}function M(n,t,d=!1){return d&&typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&(n=String(n)),(typeof n!="string"||!/^\d+$/.test(n)||BigInt(n)>=1n<<256n)&&i(`Provide ${t} as a decimal base-unit integer string.`),n}function O(n){let t=Number(n);return(!Number.isSafeInteger(t)||t<0||BigInt(t)!==BigInt(n))&&i("Meridian signing terms cannot be represented exactly as JSON numbers."),t}function R(n){let t="Provide a nonzero token, resolver or wallet address.";return ue(ce(n,t),t)}function Z(n,t){return(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n)||t!==void 0&&n.length!==2+t*2)&&i("Meridian returned invalid hexadecimal data."),n}function A(n){return(typeof n!="string"||n.length===0||n.length>256)&&i("Meridian returned an invalid exchange identifier."),n}function j(){return BigInt(Math.floor(Date.now()/1e3))}function Ae(n,t){let d=n==="buy"?["picks","stake","minCounterpartyCollateral","usdgAmountIn","slippageBps","continuation","signature"]:["token","amount","minPrice","slippageBps","continuation","signature"];Object.keys(t).some(S=>!d.includes(S))&&i("Unsupported Meridian arguments; use the tool input schema."),t.slippageBps!==void 0&&(typeof t.slippageBps!="number"||!Number.isInteger(t.slippageBps)||t.slippageBps<0||t.slippageBps>=1e4)&&i("Slippage must be an integer from 0 to 9999 basis points.");let c=t.slippageBps;if(n==="sell"){let S=M(t.amount,"the position amount");BigInt(S)===0n&&i("The position amount must be positive.");let B=R(t.token);(g(B,$.address)||g(B,G))&&i("Choose a Meridian position token to sell.");let C;if(t.minPrice!==void 0){let e=M(t.minPrice,"the minimum sale price");BigInt(e)<=1n&&i("The minimum sale price must be greater than 1 base unit."),C=e}else{let e=BigInt(S)/100n>10n**18n?BigInt(S)/100n:10n**18n;C=c===void 0?e.toString():K(e.toString(),c)}return{side:n,token:B,amount:S,minPrice:C,priceFloorSource:t.minPrice===void 0?"default":"explicit",...c===void 0?{}:{slippageBps:c}}}(!Array.isArray(t.picks)||t.picks.length<1||t.picks.length>10)&&i("Provide between one and ten Meridian picks.");let m=t.picks.map(S=>{let B=_(S);return(Object.keys(B).some(C=>!["conditionResolver","conditionId","predictedOutcome"].includes(C))||B.predictedOutcome!==0&&B.predictedOutcome!==1)&&i("Each pick needs a resolver, condition ID and outcome 0 or 1."),{conditionResolver:R(B.conditionResolver),conditionId:Z(B.conditionId),predictedOutcome:B.predictedOutcome}}).sort((S,B)=>{let C=`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}:${S.predictedOutcome}`,e=`${B.conditionResolver.toLowerCase()}:${B.conditionId.toLowerCase()}:${B.predictedOutcome}`;return C<e?-1:C>e?1:0}),y=m.map(S=>`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}`);new Set(y).size!==m.length&&i("Do not repeat a condition in the same prediction.");let l=M(t.stake,"the USDe stake");BigInt(l)<10n**18n&&i("Meridian requires a stake of at least 1 USDe.");let I=t.usdgAmountIn===void 0?void 0:M(t.usdgAmountIn,"the USDG swap amount");I!==void 0&&BigInt(I)===0n&&i("The USDG swap amount must be positive.");let D=t.minCounterpartyCollateral!==void 0?M(t.minCounterpartyCollateral,"the minimum counterparty collateral"):K(l,c??le);return BigInt(D)<=1n&&i("The minimum counterparty collateral must be greater than 1 base unit."),{side:n,picks:m,stake:l,minCounterpartyCollateral:D,...I===void 0?{}:{usdgAmountIn:I},...c===void 0?{}:{slippageBps:c}}}var ee=class{constructor(t,d){this.id=t;this.prefix=d;this.socket=new globalThis.WebSocket(we),this.socket.addEventListener("open",()=>{this.opened=!0,this.notify?.()}),this.socket.addEventListener("close",()=>this.stop("Meridian exchange socket was lost. Start a fresh auction.")),this.socket.addEventListener("error",()=>this.stop("Meridian exchange socket failed. Start a fresh auction.")),this.socket.addEventListener("message",c=>{try{(typeof c.data!="string"||c.data.length>65536)&&i("Meridian returned a malformed exchange message.");let m=_(JSON.parse(c.data));if(m.type==="pong")return;let y=A(m.type),l=_(m.payload);if(y==="error"&&i("Meridian rejected or failed the exchange. Start a fresh auction."),y===`${d}.ack`){this.auctionId===void 0?((l.id!==t||this.accepting||l.accepted!==void 0)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected the exchange: ${F(A(l.error))}.`),this.auctionId=A(l.auctionId)):((!this.accepting||l.auctionId!==this.auctionId||l.id!==void 0&&l.id!==t)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected acceptance: ${F(A(l.error))}.`),l.accepted!==!0&&i("Meridian rejected acceptance of the exchange."));return}if((!y.startsWith(`${d}.`)||l.auctionId!==this.auctionId||!this.auctionId)&&i("Meridian returned a message for a different exchange."),["error","rejected","failed","expired"].some(I=>y===`${d}.${I}`)){let I=["reason","makerReason"].flatMap(D=>l[D]===void 0?[]:[`${D}=${F(A(l[D]))}`]);i(`Meridian exchange ${y.slice(d.length+1)}${I.length?`: ${I.join("; ")}`:""}. Start a fresh auction.`)}if((y===`${d}.pending`||y===`${d}.filled`)&&!this.accepting&&i("Meridian returned settlement before acceptance."),y===`${d}.pending`)return;this.queue.length>=16&&i("Meridian returned too many exchange messages."),this.queue.push({type:y,payload:l}),this.notify?.()}catch(m){this.stop(m instanceof N?m.message:"Meridian rejected or returned an invalid exchange message. Start a fresh auction.")}})}id;prefix;socket;queue=[];notify;error;auctionId;accepting=!1;opened=!1;check(){if(this.error)throw this.error;this.socket.readyState>1&&i("Meridian exchange socket was lost. Start a fresh auction.")}stop(t){this.error??=new N(t),this.notify?.(),this.socket.readyState<2&&this.socket.close()}async wait(t,d=3e4){return new Promise((c,m)=>{let y=setTimeout(()=>this.stop("Meridian exchange timed out. Start a fresh auction."),d),l=()=>{try{if(this.check(),t===void 0?!this.opened:!this.queue.length)return;let I=t===void 0?void 0:this.queue.shift();I&&I.type!==`${this.prefix}.${t}`&&i("Meridian returned an unexpected exchange stage."),clearTimeout(y),this.notify=void 0,c(I?.payload??{})}catch(I){clearTimeout(y),this.notify=void 0,m(I)}};this.notify=l,l()})}send(t,d){this.check(),this.socket.readyState!==1&&i("Meridian exchange socket is not open."),t==="accept"&&(this.accepting=!0),this.socket.send(JSON.stringify({...t==="start"?{id:this.id}:{},type:`${this.prefix}.${t}`,payload:d}))}};function te(n){return ie(ne(ke,[n]))}function De(n,t,d){return ie(ne(Ie,[te(n.picks),BigInt(n.stake),BigInt(d.counterpartyCollateral),t,d.counterparty,L,"0x"]))}function Pe(n,t,d,c){return ie(ne(Se,[n.token,$.address,t,d,BigInt(n.amount),BigInt(c)]))}function Y(n,t){let{input:d,wallet:c,nonce:m,deadline:y}=n,l={name:d.side==="buy"?"PredictionMarketEscrow":"SecondaryMarketEscrow",version:"1",chainId:k,verifyingContract:n.continuation.escrowContract};return(!m||!y)&&i("Meridian exchange is missing its signing terms."),d.side==="buy"?(t||i("Meridian has not returned a winning bid."),{domain:l,primaryType:"MintApproval",types:{MintApproval:Ce},message:{predictionHash:De(d,c,t),signer:c,collateral:d.stake,nonce:m,deadline:y}}):{domain:l,primaryType:"TradeApproval",types:{TradeApproval:ve},message:{tradeHash:Pe(d,c,t?t.buyer:L,t?t.price:"0"),signer:c,nonce:m,deadline:y}}}function fe(n){let t=[BigInt(n.deadline)],d=n.continuation;if(d.stage==="primary_accept"||d.stage==="secondary_accept"){t.push(BigInt(d.acceptDeadline));let c=d.winningBid;d.stage==="primary_accept"&&t.push(BigInt(c.counterpartyDeadline)),c.buyerDeadline!==void 0&&t.push(BigInt(M(c.buyerDeadline,"the buyer deadline",!0)))}return t.reduce((c,m)=>c<m?c:m)}function H(n){n.channel?.check(),n.deadline&&j()>=fe(n)&&i("Meridian exchange expired. Start a fresh auction.")}var Fe=n=>{let t=new Map;function d(e){clearTimeout(e.timer),t.delete(e.continuation.requestId),e.channel?.stop("Meridian exchange is closed or expired. Start a fresh auction.")}function c(e,a){clearTimeout(e.timer),e.timer=setTimeout(()=>d(e),a),e.timer.unref?.()}function m(e){let{wallet:a,chainId:s,escrowContract:f,requestId:u}=e.continuation;return{wallet:a,chainId:s,escrowContract:f,requestId:u}}function y(e){return e.side!=="sell"?"":` Effective minimum sale proceeds: ${e.minPrice} USDe base units (${$.address}, 18 decimals). ${e.priceFloorSource==="explicit"?"Caller minPrice is unchanged; slippageBps does not reduce this floor.":`Default floor with ${e.slippageBps??0} bps slippage applied.`}`}async function l(e){let{input:a,wallet:s}=e,f=n.clientFor(k),u=a.side==="buy"?$.address:a.token,r=a.side==="buy"?a.stake:a.amount,[h,w]=await Promise.all([f.readContract({address:u,abi:J,functionName:"balanceOf",args:[s]}),f.readContract({address:u,abi:J,functionName:"allowance",args:[s,e.continuation.escrowContract]})]);if(a.side==="sell"&&await f.readContract({address:u,abi:J,functionName:"decimals"})!==18&&i("Meridian position tokens must have 18 decimals."),h>=BigInt(r)&&w>=BigInt(r))return;(e.continuation.stage==="primary_accept"||e.continuation.stage==="secondary_accept")&&i("Meridian prerequisites changed during the auction. Start a fresh auction after funding and approval.");let p,v;if(h<BigInt(r)){a.side==="sell"&&i("The wallet does not have enough position tokens to sell."),a.usdgAmountIn||i("Not enough USDe. Provide usdgAmountIn in USDG base units to quote a swap before the auction.");let b=await n.quoteSwap({from:G,to:$.address,amountIn:a.usdgAmountIn,...a.slippageBps===void 0?{}:{slippageBps:a.slippageBps}},s);(j()>=BigInt(M(b.expiresAt,"the swap expiry"))||BigInt(M(b.minAmountOut,"the swap minimum"))+h<BigInt(r))&&i("The USDG swap minimum does not cover the USDe stake, or the quote expired. Request a fresh quote with sufficient input.");let o=await n.buildSwap(b.quoteId,s);(!("txs"in o)||!o.txs.length)&&i("The swap coordinator did not return prerequisite transactions."),p=o.txs,v=`${o.summary} Minimum USDe output: ${b.minAmountOut} base units (18 decimals).`}else p=[n.approval(u,e.continuation.escrowContract,r,k)],v=`Approve exactly ${r} base units (18 decimals) of ${u} for ${e.continuation.escrowContract} on chain ${k}.`;p.some(b=>b.chainId!==k)&&i("Meridian prerequisite transactions must use chain 4663.");let P=await n.preview(p,s),T=P.changes.map(b=>{let o=b.amount.startsWith("-");return`${o?"-":"+"}${n.formatAmount(o?b.amount.slice(1):b.amount,b.token.decimals)} ${b.token.symbol} (${b.token.address}, chain ${b.token.chainId}, ${b.token.decimals} decimals)`}).join("; ");return e.channel?.stop("Meridian prerequisites must be mined before the auction."),e.channel=void 0,e.deadline=void 0,e.nonce=void 0,e.continuation={...m(e),stage:"prerequisites"},{steps:p.map(b=>({kind:"tx",tx:b})),continuation:structuredClone(e.continuation),summary:`${v}${y(a)} ${P.summary} ${T}. Mine these prerequisites before continuing; no RFQ has started.`}}function I(e){let a=e.continuation;a.stage==="prerequisites"&&i("Meridian prerequisites need to finish before signing."),H(e),c(e,Number(fe(e)-j())*1e3);let s=e.input,f=s.side==="buy"?`Stake ${s.stake} base units of USDe (${$.address}, 18 decimals)`:`Sell ${s.amount} base units of position ${s.token} (18 decimals)`,u=a.stage==="secondary_start"?"Initial buyer-zero, price-zero intent only.":a.stage==="primary_accept"?`Counterparty ${a.winningBid.counterparty}; counterparty collateral ${a.winningBid.counterpartyCollateral} USDe base units; counterparty deadline ${a.winningBid.counterpartyDeadline}.`:`Buyer ${a.winningBid.buyer}; receive ${a.winningBid.price} USDe base units (${$.address}, 18 decimals).`;return{steps:[{kind:"typedData",request:structuredClone(a.request)}],continuation:structuredClone(a),summary:`${f} on chain ${k}.${y(s)} Approval was checked on chain. ${u} Sign locally for domain ${a.request.domain.name}, version 1, escrow ${a.escrowContract}, signature deadline ${e.deadline}${"acceptDeadline"in a?`, acceptance deadline ${a.acceptDeadline}`:""}. External relayer settlement is pending; a signature is not a fill.`}}async function D(e){let a=await e.channel.wait("result"),s=_(a.winningBid),f=A(a.auctionId);s.auctionId!==f&&i("Meridian winning bid belongs to another auction.");let u=M(a.acceptDeadline,"the acceptance deadline",!0);if(e.input.side==="buy"){let r={auctionId:f,counterparty:A(s.counterparty),counterpartyCollateral:M(s.counterpartyCollateral,"the counterparty collateral"),counterpartyNonce:M(s.counterpartyNonce,"the counterparty nonce",!0),counterpartyDeadline:M(s.counterpartyDeadline,"the counterparty deadline",!0),receivedAt:A(s.receivedAt)};R(r.counterparty),(!Number.isFinite(Date.parse(r.receivedAt))||BigInt(r.counterpartyCollateral)<=1n||BigInt(r.counterpartyCollateral)<BigInt(e.input.minCounterpartyCollateral))&&i("Meridian winning bid counterparty collateral is below the caller minimum."),e.continuation={...m(e),stage:"primary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}else{let r={auctionId:f,buyer:A(s.buyer),price:M(s.price,"the sale price"),...s.buyerDeadline!==void 0?{buyerDeadline:M(s.buyerDeadline,"the buyer deadline",!0)}:{},...s.buyerNonce!==void 0?{buyerNonce:M(s.buyerNonce,"the buyer nonce",!0)}:{},...s.receivedAt!==void 0?{receivedAt:A(s.receivedAt)}:{}};R(r.buyer),(BigInt(r.price)<=1n||BigInt(r.price)<BigInt(e.input.minPrice))&&i("Meridian winning bid sale price is below the caller minimum."),e.continuation={...m(e),stage:"secondary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}return I(e)}async function S(e,a){let s=e.continuation;s.stage!=="primary_accept"&&s.stage!=="secondary_accept"&&i("Meridian exchange is not ready for acceptance."),H(e),e.channel.send("accept",{auctionId:s.auctionId,[e.input.side==="buy"?"predictorSignature":"sellerSignature"]:a}),c(e,15e4);let f=await e.channel.wait("filled",12e4),u=Z(f.transactionHash,32),r=n.clientFor(k),[h,w]=await Promise.all([r.waitForTransactionReceipt({hash:u,timeout:12e4}),r.getTransaction({hash:u})]);(h.status!=="success"||!g(h.transactionHash,u)||!g(w.hash,u)||!g(h.to,s.escrowContract)||!g(w.to,s.escrowContract)||w.chainId!==k)&&i("Meridian fill has no matching successful receipt on chain 4663.");let{input:p,wallet:v}=e;if(p.side==="buy"&&s.stage==="primary_accept"){let o=me({abi:Be,data:w.input}).args[0];(!g(te([...o.picks]),te(p.picks))||o.predictorCollateral!==BigInt(p.stake)||o.counterpartyCollateral!==BigInt(s.winningBid.counterpartyCollateral)||!g(o.predictor,v)||!g(o.counterparty,s.winningBid.counterparty)||o.predictorNonce!==BigInt(e.nonce)||o.predictorDeadline!==BigInt(e.deadline)||!g(o.predictorSponsor,L)||o.predictorSponsorData!=="0x"||!g(o.predictorSignature,a))&&i("Meridian mint receipt does not match the accepted prediction.")}else if(p.side==="sell"&&s.stage==="secondary_accept"){let o=me({abi:Me,data:w.input}).args[0];(!g(o.token,p.token)||!g(o.collateral,$.address)||!g(o.seller,v)||!g(o.buyer,s.winningBid.buyer)||o.tokenAmount!==BigInt(p.amount)||o.price!==BigInt(s.winningBid.price)||o.sellerNonce!==BigInt(e.nonce)||o.sellerDeadline!==BigInt(e.deadline)||!g(o.sellerSignature,a))&&i("Meridian sale receipt does not match the accepted trade.")}let P=new Map,T=new Map;for(let o of h.logs){if(o.topics[0]!==$e||o.topics.length!==3)continue;(!/^0x[0-9a-fA-F]{64}$/.test(o.data)||!o.topics.slice(1).every(ge=>/^0x0{24}[0-9a-fA-F]{40}$/.test(ge)))&&i("Meridian receipt has malformed transfer logs.");let U=`0x${o.topics[1].slice(-40)}`,E=`0x${o.topics[2].slice(-40)}`,q=o.address.toLowerCase(),z=BigInt(o.data);P.set(q,(P.get(q)??0n)+(g(E,v)?z:0n)-(g(U,v)?z:0n)),g(U,L)&&g(E,v)&&T.set(q,(T.get(q)??0n)+z)}let b;if(p.side==="buy"&&s.stage==="primary_accept"){let o=BigInt(p.stake)+BigInt(s.winningBid.counterpartyCollateral),U=[...T].filter(([E,q])=>!g(E,$.address)&&q===o&&P.get(E)===o);(U.length!==1||P.get($.address.toLowerCase())!==-BigInt(p.stake))&&i("Meridian mint receipt does not prove the expected collateral and position delta."),b=`${o} base units received in position ${U[0][0]}`}else p.side==="sell"&&s.stage==="secondary_accept"?((P.get(p.token.toLowerCase())!==-BigInt(p.amount)||P.get($.address.toLowerCase())!==BigInt(s.winningBid.price))&&i("Meridian sale receipt does not prove the expected collateral and position delta."),b=`${p.amount} base units sold from position ${p.token}; ${s.winningBid.price} USDe base units received`):i("Meridian fill has a different exchange stage.");return{txs:[],hashes:[u],status:"mined",summary:`Mined: ${u}. Status: mined. Meridian ${p.side} filled by the external relayer. Successful receipt and transfer deltas verified on chain ${k}: ${b} (18 decimals); collateral USDe ${$.address} (18 decimals).`}}async function B(e,a,s){let f=R(s),u=Ae(e,a),r;if(a.continuation!==void 0){let h=_(a.continuation),w=t.get(A(h.requestId));w||i("Meridian exchange is lost or expired. Start a fresh auction."),(!g(w.wallet,f)||!pe(w.input,u)||!pe(w.continuation,h))&&i("Meridian continuation or arguments do not match the active wallet exchange."),w.busy&&i("Meridian exchange is already processing this continuation."),r=w}else{a.signature!==void 0&&i("A signature requires an active Meridian continuation."),t.size>=1e3&&i("Too many active Meridian exchanges. Please try again later.");let h=he(),w=setTimeout(()=>{let p=t.get(h);p&&d(p)},9e5);w.unref?.(),r={input:u,wallet:f,continuation:{stage:"prerequisites",wallet:f,chainId:k,escrowContract:e==="buy"?Q:V,requestId:h},busy:!1,timer:w},t.set(h,r)}r.busy=!0;try{H(r),await n.clientFor(k).getChainId()!==k&&i("Meridian requires an RPC on chain 4663.");let h=r.continuation.stage;h==="prerequisites"&&a.signature!==void 0&&i("Do not sign before Meridian prerequisites have mined.");let w=await l(r);if(w)return w;if(h==="prerequisites")return r.nonce=(ye(4).readUInt32BE()+1).toString(),r.deadline=(j()+300n).toString(),await n.clientFor(k).readContract({address:r.continuation.escrowContract,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i(`Meridian ${e==="buy"?"predictor":"seller"} nonce is already used. Start a fresh auction.`),r.channel=new ee(r.continuation.requestId,e==="buy"?"auction":"secondary.auction"),await r.channel.wait(),u.side==="buy"?(r.channel.send("start",{id:r.continuation.requestId,picks:u.picks,predictorCollateral:u.stake,predictor:f,predictorNonce:O(r.nonce),predictorDeadline:O(r.deadline),chainId:k,escrowContract:Q,mode:"blind"}),await D(r)):(r.continuation={...m(r),stage:"secondary_start",request:Y(r)},I(r));let p=Z(a.signature);if(e==="sell"&&await n.clientFor(k).readContract({address:V,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian seller nonce is already used. Start a fresh auction."),e==="buy"&&await n.clientFor(k).readContract({address:Q,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian predictor nonce is already used. Start a fresh auction."),H(r),h==="secondary_start"&&u.side==="sell")return r.channel.send("start",{id:r.continuation.requestId,token:u.token,collateral:$.address,tokenAmount:u.amount,seller:f,sellerNonce:O(r.nonce),sellerDeadline:O(r.deadline),chainId:k,escrowContract:V,mode:"blind",sellerSignature:p}),await D(r);let v=await S(r,p);return d(r),v}catch(h){throw d(r),new N(n.plainError(h))}finally{r.busy=!1}}let C={continuation:{type:"object",description:"Internal continuation returned by the previous local signing round."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Internal hexadecimal signature supplied by local signing; never enter manually."}};return{tools:[{name:"meridian_buy",inputSchema:{type:"object",additionalProperties:!1,required:["picks","stake"],properties:{...C,stake:x('USDe stake in base units (18 decimals): "1000000000000000000" = 1 USDe.'),minCounterpartyCollateral:x('Minimum counterparty USDe collateral in base units (18 decimals): "1000000000000000000" = 1 USDe.'),usdgAmountIn:x('USDG swap input in base units if USDe is short (6 decimals): "1000000" = 1 USDG.'),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points (50 = 0.5%)."},picks:{type:"array",minItems:1,maxItems:10,items:{type:"object",additionalProperties:!1,required:["conditionResolver","conditionId","predictedOutcome"],properties:{conditionResolver:{...W,description:"Condition resolver contract address on chain 4663."},conditionId:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Condition identifier as a 0x-prefixed even-length hex string."},predictedOutcome:{type:"integer",enum:[0,1],description:"Predicted binary outcome, 0 or 1, as defined by the condition."}}},description:"Prediction picks for the auction."}}},execute:(e,a)=>B("buy",e,a)},{name:"meridian_sell",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount"],properties:{...C,token:{...W,description:"Position token address on chain 4663."},amount:x('Position token amount in base units (18 decimals): "1000000000000000000" = 1 position token.'),minPrice:x('Minimum total USDe proceeds in base units (18 decimals): "1000000000000000000" = 1 USDe. Explicit minimum is not reduced by slippage.'),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points (50 = 0.5%); applies only to the default floor when minPrice is omitted."}}},execute:(e,a)=>B("sell",e,a)}]}};export{Ce as a,ve as b,Fe as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Z,c as z,d as J,e as K}from"./FGEGJOAA.js";import{a as W}from"./6F527FLN.js";import{a as H}from"./ND32LJWI.js";import{a as V}from"./YBLJ75U5.js";import{c as j}from"./X24YTJST.js";import{a as L}from"./A3PN3PK3.js";import{b as T,o as q}from"./LKX5WDOQ.js";import{b as _}from"./SPJCSEKP.js";import{a as A,d as I,e as B}from"./43LI5NKJ.js";import{a as $}from"./66F5ZH34.js";import{g as x,m as E,n as R}from"./NWNYJ26T.js";import{b as h,e as F,j as N,k as S}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{getAddress as O,parseAbi as te}from"viem";var n=O(N[4663].vaults.groveAlm.address),ne="0x29626c2d8ca49a51e4deceec5499e52983c42bd5",m=te(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function balanceOf(address) view returns (uint256)","function maxDeposit(address) view returns (uint256)","function maxWithdraw(address) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function managementFee() view returns (uint256)"]),C=$("Positive integer in token base units."),U={type:"string",description:`Public Grove vault only: ${n}. Defaults to this vault.`},Q={type:"integer",minimum:0,maximum:9999,default:T,description:`Allowed slippage in basis points (50 = 0.5%), 0 to 9999. Sets the minimum output unless you pass it explicitly. Defaults to ${T}.`};function D(t){return R(t,"Amount must be positive and within the uint256 range.",{notString:"Amount must be a positive integer string in base units.",positive:!0})}function v(t){return E(t,"Grove returned an invalid integer read.")}function M(t,d,l){if(A(d),Object.keys(t).some(u=>!["vault",...l].includes(u)))throw new o("Unsupported Grove argument.");if(t.vault!==void 0){if(typeof t.vault!="string")throw new o("Provide the public Grove vault address.");if(t.vault.toLowerCase()===ne)throw new o("The Grove ALM proxy is allocator infrastructure, not the public ERC-4626 vault.");if(A(t.vault),!x(t.vault,n))throw new o("Only the public Grove ERC-4626 vault is supported.")}}function X(t,d,l){let u=l===void 0?T:l;if(typeof u!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");let e=BigInt(q(t.toString(),u)),a=d===void 0?e:D(d);if(a<=0n||a>t)throw new o("The minimum output must be positive and no greater than the quoted output.");return a}function Y(t,d){let l=0n;for(let u of t.changes)if(!(u.token.chainId!==d.chainId||!x(u.token.address,d.address))){if(u.token.decimals!==d.decimals||typeof u.amount!="string"||!/^-?\d+$/.test(u.amount))throw new o("Grove preview returned invalid token metadata or amounts.");l+=BigInt(u.amount)}return l}var ae=t=>{async function d(e){try{return await e()}catch(a){throw new o(t.plainError(a))}}async function l(){let e=t.clientFor(h);if(await e.getChainId()!==h)throw new o("Grove requires an RPC endpoint on chain 4663.");let a=await e.readContract({address:n,abi:m,functionName:"asset"});if(typeof a!="string"||!x(a,S))throw new o("The public Grove vault must use canonical USDG on chain 4663.");let[i,r,s]=await Promise.all([e.readContract({address:O(S),abi:m,functionName:"decimals"}),e.readContract({address:n,abi:m,functionName:"decimals"}),L(e,n)]);if(i!==F||r!==18)throw new o("Grove token decimals differ from the evidenced USDG/share interface.");let p={address:O(S),chainId:h,decimals:i,symbol:"USDG"};return{client:e,asset:p,shareToken:{address:n,chainId:h,decimals:r,symbol:s}}}async function u(e,a,i,r,s,p){let f=await t.preview(e,a);if(Y(f,i)!==-r)throw new o("Grove simulation did not show the exact requested token outflow.");if(Y(f,s)<p)throw new o("Grove simulated output is below the minimum.");let g=f.changes.map(({token:w,amount:b})=>{let y=b.startsWith("-");return`${y?"-":"+"}${t.formatAmount(y?b.slice(1):b,w.decimals)} ${w.symbol} (${w.address}, chain ${w.chainId})`}).join("; ");return{txs:e,summary:`${f.summary} ${g}. Minimum ${p} base units of ${s.address} is a preview check, not enforced on-chain by standard ERC-4626. Re-preview before signing; execution output can change.`}}return{tools:[z(t,"grove_details",n),V(t,"grove_analytics",n),H(t,"grove_manage",n),...W(t,"grove",n),{name:"grove_list",inputSchema:{type:"object",properties:{vault:U},additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,[]);let{client:i,asset:r,shareToken:s}=await l(),[p,f,c,g,w,b]=await Promise.all([i.readContract({address:n,abi:m,functionName:"totalAssets"}),i.readContract({address:n,abi:m,functionName:"totalSupply"}),i.readContract({address:n,abi:m,functionName:"maxDeposit",args:[a]}),i.readContract({address:n,abi:m,functionName:"maxWithdraw",args:[a]}),i.readContract({address:n,abi:m,functionName:"performanceFee"}),i.readContract({address:n,abi:m,functionName:"managementFee"})]);return[{vault:n,chainId:h,name:"Grove x Steakhouse USDG",asset:r,shareToken:s,totalAssets:{token:r,amount:v(p).toString()},totalSupply:{token:s,amount:v(f).toString()},maxDeposit:v(c)===0n?null:c.toString(),maxWithdraw:v(g)===0n?null:g.toString(),maxViewCaveat:"Zero Morpho V2 maximum views mean unknown capacity. Simulate the requested action; full exits use the fresh share balance.",fees:{performanceFeeRaw:v(w).toString(),managementFeeRaw:v(b).toString(),scale:"1000000000000000000",managementFeeTimeUnit:"second",performanceFeeBasis:"accrued interest"}}]})},{name:"grove_deposit",inputSchema:{type:"object",description:"Deposit USDG in base units (1 USDG = 1000000) for 18-decimal vault shares. Exit with grove_withdraw; check positions after confirmation.",properties:{vault:U,amount:C,minSharesOut:C,slippageBps:Q},required:["amount"],additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,["amount","minSharesOut","slippageBps"]);let i=D(e.amount),{client:r,asset:s,shareToken:p}=await l(),f=v(await r.readContract({address:n,abi:m,functionName:"previewDeposit",args:[i]})),c=X(f,e.minSharesOut,e.slippageBps),g=I(n,s.address,i.toString(),a,h),w=[t.approval(s.address,n,i.toString(),h),t.unsignedTx(g.txs[1])];return u(w,a,s,i,p,c)})},{name:"grove_withdraw",inputSchema:{type:"object",description:"Redeem shares in 18-decimal base units, or shares all for a full exit to USDG. Check positions after confirmation.",properties:{vault:U,shares:{oneOf:[C,{const:"all",description:"Redeem the fresh full share balance."}],description:'Vault shares to redeem, in base units (shares have 18 decimals; "1000000000000000000" = 1 share), or "all" for the full balance.'},minAmountOut:C,slippageBps:Q,force:{type:"boolean",description:'True plans a full Morpho V2 force exit with penalty disclosure. Needs shares "all", minAmountOut and maxPenaltyAssets.'},maxPenaltyAssets:$('Force exit only: most USDG, in base units (6 decimals), you accept losing to the exit penalty. Example: "1000000" = 1 USDG.')},required:["shares"],additionalProperties:!1},execute:(e,a)=>d(async()=>{M(e,a,["shares","minAmountOut","slippageBps","force","maxPenaltyAssets"]);let i=e.shares==="all"?void 0:D(e.shares),{client:r,asset:s,shareToken:p}=await l(),f=v(await r.readContract({address:n,abi:m,functionName:"balanceOf",args:[a]})),c=i??f;if(c===0n||c>f)throw new o("The Grove share balance is insufficient for this withdrawal.");if(e.force!==void 0&&typeof e.force!="boolean")throw new o("force must be a boolean.");if(e.force===!0){if(e.shares!=="all"||e.slippageBps!==void 0)throw new o("Force exit requires shares all and an explicit minAmountOut; omit slippageBps.");let G=j(e.maxPenaltyAssets),ee=D(e.minAmountOut),k=await Z(t,r,n,a,c,G),P=await t.preview([k.tx],a);return K(P.changes,n,c,ee),{txs:[k.tx],preview:P,summary:`${J(k.plan)} ${P.summary}`}}if(e.maxPenaltyAssets!==void 0)throw new o("maxPenaltyAssets requires force true.");let g=v(await r.readContract({address:n,abi:m,functionName:"previewRedeem",args:[c]})),w=X(g,e.minAmountOut,e.slippageBps),y=B(n,c.toString(),a,h).txs.map(G=>t.unsignedTx({...G,description:`Redeem ${c} Grove share base units to the wallet.`}));return u(y,a,p,c,s,w)})}],positions:e=>d(async()=>{A(e);let{client:a,asset:i,shareToken:r}=await l(),s=v(await a.readContract({address:n,abi:m,functionName:"balanceOf",args:[e]}));if(s===0n)return[];let p=v(await a.readContract({address:n,abi:m,functionName:"previewRedeem",args:[s]}));return[{module:"grove",id:`${h}:${n.toLowerCase()}`,chainId:h,assets:[{token:i,amount:p.toString()}],description:`${t.formatAmount(s.toString(),r.decimals)} Grove shares (${s} base units, ${r.decimals} decimals, ${n}); estimated USDG redemption, subject to simulation.`}]})}},we=t=>_("grove",[ae(t)]);export{ae as a,we as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as f}from"./X24YTJST.js";import{a as p}from"./43LI5NKJ.js";import{b as u}from"./TI727O2H.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as A,getAddress as w,parseAbi as T,parseAbiItem as F}from"viem";var R=[["setOwner(address newOwner)","owner"],["setCurator(address newCurator)","owner"],["setIsSentinel(address account,bool enabled)","owner"],["setName(string name)","owner"],["setSymbol(string symbol)","owner"],["setIsAllocator(address account,bool enabled)","timelock"],["setReceiveSharesGate(address gate)","timelock"],["setSendSharesGate(address gate)","timelock"],["setReceiveAssetsGate(address gate)","timelock"],["setSendAssetsGate(address gate)","timelock"],["setAdapterRegistry(address registry)","timelock"],["addAdapter(address adapter)","timelock"],["removeAdapter(address adapter)","timelock"],["increaseTimelock(bytes4 selector,uint256 duration)","timelock"],["decreaseTimelock(bytes4 selector,uint256 duration)","timelock"],["abdicate(bytes4 selector)","timelock"],["setPerformanceFee(uint256 fee)","timelock"],["setManagementFee(uint256 fee)","timelock"],["setPerformanceFeeRecipient(address recipient)","timelock"],["setManagementFeeRecipient(address recipient)","timelock"],["increaseAbsoluteCap(bytes idData,uint256 cap)","timelock"],["increaseRelativeCap(bytes idData,uint256 cap)","timelock"],["decreaseAbsoluteCap(bytes idData,uint256 cap)","curatorOrSentinel"],["decreaseRelativeCap(bytes idData,uint256 cap)","curatorOrSentinel"],["setForceDeallocatePenalty(address adapter,uint256 penalty)","timelock"],["allocate(address adapter,bytes data,uint256 assets)","allocator"],["deallocate(address adapter,bytes data,uint256 assets)","allocatorOrSentinel"],["setLiquidityAdapterAndData(address adapter,bytes data)","allocator"],["setMaxRate(uint256 rate)","allocator"],["accrueInterest()","any"]],S=R.map(([a,t])=>({abi:F(`function ${a}`),authority:t})),x=T(["function asset() view returns (address)","function owner() view returns (address)","function curator() view returns (address)","function isSentinel(address) view returns (bool)","function isAllocator(address) view returns (bool)","function executableAt(bytes) view returns (uint256)","function abdicated(bytes4) view returns (bool)","function submit(bytes data)","function revoke(bytes data)"]);function M(a,t){if(a==="bool"){if(typeof t!="boolean")throw new n("Boolean operation values must be booleans.");return t}if(typeof t!="string")throw new n("All address, byte, text and integer operation values must be strings.");if(a==="address")return p(t),w(t);if(a==="uint256"){if(!/^\d+$/.test(t)||BigInt(t)>=1n<<256n)throw new n("Integer operation values must be uint256 decimal base-unit strings.");return BigInt(t)}if((a==="bytes"||a==="bytes4")&&!(a==="bytes4"?/^0x[0-9a-f]{8}$/i:/^0x(?:[0-9a-f]{2})*$/i).test(t))throw new n("Invalid hexadecimal operation bytes.");return t}function V(a,t,m,O){return{name:t,inputSchema:{type:"object",additionalProperties:!1,required:["operation","values"],properties:{operation:{type:"string",enum:S.map(i=>i.abi.name),description:"Vault management function to call (role-gated curator, owner, allocator or sentinel actions); values supplies its arguments in order."},values:{type:"array",maxItems:3,items:{oneOf:[{type:"string"},{type:"boolean"}]},description:"Ordered ABI values. Integers are decimal base-unit strings; addresses and bytes are explicit strings."},mode:{enum:["call","submit","revoke"],default:"call",description:"Submit/revoke only for timelocked curator operations. Execution is a separate call after the delay."}}},execute:async(i,c)=>{try{if(p(c),Object.keys(i).some(e=>!["operation","values","mode"].includes(e)))throw new n("Unexpected vault management argument.");let r=S.find(e=>e.abi.name===i.operation);if(!r||!Array.isArray(i.values)||i.values.length!==r.abi.inputs.length)throw new n("Provide a supported operation and its exact ordered values.");let o=i.mode??"call";if(!["call","submit","revoke"].includes(String(o))||o!=="call"&&r.authority!=="timelock")throw new n("Submit/revoke is available only for timelocked curator operations.");let I=r.abi.inputs.map((e,d)=>M(e.type,i.values[d])),l=A({abi:[r.abi],functionName:r.abi.name,args:I}),b=a.clientFor(u);if(await b.getChainId()!==u)throw new n("Vault management requires chain 4663.");let s=(e,d=[])=>b.readContract({address:m,abi:x,functionName:e,args:d}),y=await s("asset");if(typeof y!="string"||w(y)!==w(O.address))throw new n("Vault management requires the pinned vault asset.");let g=e=>typeof e=="string"&&e.toLowerCase()===c.toLowerCase(),C=async e=>e==="any"?!0:e==="owner"?g(await s("owner")):e==="allocator"?await s("isAllocator",[c])===!0:e==="allocatorOrSentinel"?await s("isAllocator",[c])===!0||await s("isSentinel",[c])===!0:g(await s("curator"))||e==="curatorOrSentinel"&&await s("isSentinel",[c])===!0;if(r.authority==="timelock"&&o==="call"){let[e,d,D]=await Promise.all([s("executableAt",[l]),s("abdicated",[l.slice(0,10)]),b.getBlock()]);if(f(e)===0n||f(e)>D.timestamp||d!==!1)throw new n("This exact operation has not matured or its selector is abdicated. Submit it with the curator, then wait for its executable time.")}else if(!await C(o==="submit"?"timelock":o==="revoke"?"curatorOrSentinel":r.authority))throw new n("This wallet does not hold the required vault management role. No transaction was built.");let $=o==="call"?l:A({abi:x,functionName:o==="submit"?"submit":"revoke",args:[l]}),k=`${o} ${r.abi.name} on ${m}; ordered values ${JSON.stringify(i.values)}. ${r.abi.name==="abdicate"?"Abdication is irreversible.":""}`,h=[a.unsignedTx({to:m,data:$,value:"0",chainId:u,description:k})],v=await a.preview(h,c);return{txs:h,preview:v,summary:`${k} ${v.summary} ${o==="submit"?"Submission schedules this exact operation; it does not execute the configuration change.":"Role, cap and timing checks can change before execution."}`}}catch(r){throw new n(a.plainError(r))}}}}export{S as a,M as b,V as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as D}from"./VMZYFO6I.js";import{b as O,g as M,i as A,j as B,k as T,l as P,m as I,n as U,r as k,s as F,v as f,x as z}from"./Y64GFBTA.js";import{a as w,e as _}from"./NWNYJ26T.js";import{b as y}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";function $(u){return{...u,token:{...u.token,symbol:f(u.token.symbol)??"unknown"}}}var Q=u=>{let N=z(u);async function G(t,r){let g=T(r),i=I(t.originChainId),e=I(t.destinationChainId);if(i!==y&&e!==y)throw new d(`A Relay quote must start or end on chain ${y}.`);let h=P(t.originCurrency??O),b=P(t.destinationCurrency??O),c=T(t.recipient??g),a=U(t.amount);if(a==="0")throw new d("Provide a positive bridge amount.");let n=t.tradeType??"EXACT_INPUT";if(!["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"].includes(String(n)))throw new d("Choose EXACT_INPUT, EXACT_OUTPUT or EXPECTED_OUTPUT.");let m={};for(let E of["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"]){let p=t[E];if(p!==void 0){if(!Array.isArray(p)||p.length>100||p.some(j=>typeof j!="string"||!/^[A-Za-z0-9._ -]{1,128}$/.test(j)))throw new d("Provide valid Relay swap source names.");m[E]=p}}let S=await N("/quote/v2",{user:g,recipient:c,originChainId:i,destinationChainId:e,originCurrency:h,destinationCurrency:b,amount:a,tradeType:n,...m}),o=A(S.details),l=$(k(o.currencyIn)),s=$(k(o.currencyOut)),C=U(A(o.currencyOut).minimumAmount);F(T(o.sender)===g&&T(o.recipient)===c&&l.token.chainId===i&&l.token.address===h&&(n==="EXACT_INPUT"?l.amount===a:s.amount===a)&&s.token.chainId===e&&s.token.address===b&&BigInt(C)<=BigInt(s.amount));let H=Object.fromEntries(Object.entries(A(S.fees)).map(([E,p])=>[E,$(k(p))])),R=typeof o.timeEstimate=="number"&&Number.isFinite(o.timeEstimate)&&o.timeEstimate>=0?o.timeEstimate:void 0,v=M(S.fees),X=e===y,x=X?"relay_bridge_in":"relay_bridge_out",q=n==="EXACT_INPUT"&&Object.keys(m).length===0&&i!==e&&(!X||D(i)!==void 0);return{executable:!1,nextAction:q?x:void 0,originChainId:i,destinationChainId:e,recipient:c,tradeType:n,amountIn:l,amountOut:s,minAmountOut:{token:s.token,amount:C},fees:H,...v,slippage:{source:"provider",minimumAmount:C},...R===void 0?{}:{timeEstimateSeconds:R},summary:`${v.feeDisclosure} Read-only Relay estimate: ${l.amount} base units of ${l.token.symbol} (${l.token.decimals} decimals) on chain ${i} for about ${s.amount}, minimum ${C}, base units of ${s.token.symbol} (${s.token.decimals} decimals) on chain ${e} for ${c}. Slippage: selected by Relay; Oak sent no slippage setting. The returned minimum above is the quote floor. Relay fees are already deducted from the output; origin gas is separate. Nothing was built or signed, and this estimate cannot be executed. ${q?`To bridge, call ${x}; it fetches a fresh quote and shows its own preview for human confirmation.`:"This estimate shape has no matching Oak execution path. No action will preserve these trade type or routing options."}`}}async function Z(t){let r=t.chainId===void 0?void 0:I(t.chainId),i=B((await N("/chains")).chains).map(A).flatMap(e=>{if(typeof e.id!="number"||!Number.isSafeInteger(e.id)||e.id<=0)return[];if(r!==void 0&&e.id!==r)return[];let h=e.disabled===!1,b=_(e.currency)?e.currency:{},c={chainId:e.id,name:f(e.displayName,"name")??f(e.name,"name")??String(e.id),vmType:f(e.vmType),nativeCurrency:{symbol:f(b.symbol),decimals:typeof b.decimals=="number"?b.decimals:void 0},bridgeIn:e.id!==y&&h&&D(e.id)!==void 0,bridgeOut:e.id!==y&&h&&e.vmType==="evm"};if(r===void 0)return[c];let a=new Map;for(let n of[...Array.isArray(e.featuredTokens)?e.featuredTokens:[],...Array.isArray(e.erc20Currencies)?e.erc20Currencies:[]]){if(!_(n)||typeof n.address!="string"||!new RegExp(w).test(n.address)||typeof n.decimals!="number"||!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>255)continue;let m=T(n.address);a.has(m)||a.set(m,{address:m,symbol:f(n.symbol)??"unknown",decimals:n.decimals,bridgeable:n.supportsBridging===!0})}return[{...c,currencies:[...a.values()]}]});if(r!==void 0&&!i.length)throw new d(`Relay does not list chain ${r}.`);return{chains:i,summary:`${i.length} Relay chain${i.length===1?"":"s"}. bridgeIn marks origins relay_bridge_in can build from; bridgeOut marks destinations relay_bridge_out can reach. Currency lists are Relay-reported display data; bridgeable false means Relay does not bridge that token. Confirm token addresses before bridging.`}}return{tools:[{name:"relay_quote",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","destinationChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{type:"integer",minimum:1,description:"Destination chain ID."},originCurrency:{type:"string",pattern:w,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{type:"string",pattern:w,description:"Destination token address; defaults to the destination chain\u2019s native token."},amount:{type:"string",pattern:"^[1-9][0-9]*$",description:'Input token amount for EXACT_INPUT, otherwise output token amount, in base units using that token\u2019s decimals (USDG has 6: "1000000" = 1 USDG).'},recipient:{type:"string",pattern:w,description:"Destination recipient address; defaults to your wallet."},tradeType:{type:"string",enum:["EXACT_INPUT","EXACT_OUTPUT","EXPECTED_OUTPUT"],description:"EXACT_INPUT fixes input; EXACT_OUTPUT fixes output; EXPECTED_OUTPUT targets output."},...Object.fromEntries(["includedSwapSources","excludedSwapSources","includedOriginSwapSources","includedDestinationSwapSources"].map(t=>[t,{type:"array",description:t==="excludedSwapSources"?"Swap sources to exclude.":t==="includedOriginSwapSources"?"Origin swap sources to include.":t==="includedDestinationSwapSources"?"Destination swap sources to include.":"Swap sources to include.",maxItems:100,items:{type:"string",pattern:"^[A-Za-z0-9._ -]{1,128}$"}}]))}},execute:async(t,r)=>{try{return await G(t,r)}catch(g){throw new d(u.plainError(g))}}},{name:"relay_chains",inputSchema:{type:"object",additionalProperties:!1,properties:{chainId:{type:"integer",minimum:1,description:"Filter by chain ID."}}},execute:async t=>{try{return await Z(t)}catch(r){throw new d(u.plainError(r))}}}]}};export{Q as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{b as W}from"./JDSSYT6R.js";import{a as M,b as U}from"./IBL6TL2Q.js";import{a as b,b as P}from"./G2AA73ZE.js";import{fa as F,ga as G,ja as A}from"./HHYE42JG.js";import{g as $,i as T,m as I,n as O}from"./NWNYJ26T.js";import{d as V}from"./IX3GZMTM.js";import{b as v}from"./TI727O2H.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as R}from"viem";var j={asset:{type:"string",pattern:"^[A-Za-z0-9.$_-]{1,32}$",description:"Official asset symbol; use vault if discovery is unavailable or ambiguous."},vault:{type:"string",pattern:"^0x[0-9a-fA-F]{40}$",description:"Vault address verified on chain on every call; required for a rebuild without HTTP."}};function E(r){return{type:"object",additionalProperties:!1,properties:{...j,amount:{type:"string",pattern:r==="withdraw"?"^(?:[0-9]+|max)$":"^[0-9]+$",description:'Selected vault asset amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG); withdraw also accepts max to redeem all shares.'}},required:["amount"],anyOf:[{required:["asset"]},{required:["vault"]}]}}function H(r){return O(r,"Borro amount must be positive and fit uint256.",{positive:!0,notString:"Borro amount must be an integer string in asset base units."})}function B(r){return I(r,"Borro returned an invalid uint256 read.")}var L=r=>r*9950n/10000n,Z=new WeakMap;function oe(r,o){Z.set(r,{...o})}async function K(r,o,h,i=W){let k=await i(r,o).catch(()=>({kind:"unknown"})),f=k.kind!=="unknown"&&"readyBase"in k?k.readyBase:void 0,l=typeof f=="bigint"&&f>=0n&&f<1n<<256n?f:void 0,g=y=>V(y.toString(),o.assetDecimals);return{ready:l,...l!==void 0&&l<h?{refusal:A("too-little-ready",{ready:g(l),requested:g(h),maxNow:g(l),symbol:o.symbol})}:{}}}function z(r,o,h,i,k){let f=0n,l=0n;for(let g of r.changes){let y=g.token;if(typeof g.amount!="string"||!/^-?\d+$/.test(g.amount))throw new n("Borro preview returned invalid token changes. Nothing was signed.");let e=BigInt(g.amount);B(e<0n?-e:e);let d=$(y.address,o.address)?o:$(y.address,i.address)?i:void 0;if(!d||y.chainId!==v||y.decimals!==d.decimals)throw new n("Borro preview showed an unexpected token movement. Nothing was signed.");if(d===o){if(e>0n)throw new n("Borro preview showed a reversed input movement. Nothing was signed.");f-=e}else{if(e<0n)throw new n("Borro preview showed a reversed output movement. Nothing was signed.");l+=e}}if(B(f),B(l),f!==h||l<k||l===0n)throw new n("Borro preview did not match the requested receipt. Nothing was signed.")}var re=r=>{let{client:o,context:h,wallet:i}=r;async function k(e,d,s){if(T(s,"Provide a valid wallet address."),!$(s,i))throw new n("Borro action wallet differs from the signing wallet. Nothing was signed.");if(h.network==="testnet"||await o.getChainId()!==v)throw new n("Borro requires chain 4663. Nothing was signed.");if(Object.keys(e).some(m=>!["asset","vault","amount"].includes(m)))throw new n("Unsupported Borro argument.");if(e.asset!==void 0&&(typeof e.asset!="string"||!/^[A-Za-z0-9.$_-]{1,32}$/.test(e.asset)||/^0x/i.test(e.asset)))throw new n("Provide an asset symbol, or put the vault address in vault.");let w=e.vault===void 0?void 0:T(e.vault,"Provide a valid Borro vault address.");if(!w&&e.asset===void 0)throw new n("Provide an asset symbol or a vault address.");let t=w?await r.verifyVault(o,w,d,{wallet:i}):await r.resolveVault(o,{asset:e.asset},d,i);if(w&&!$(w,t.vault)||e.asset!==void 0&&e.asset.toUpperCase()!==t.symbol.toUpperCase())throw new n("Borro vault and asset selectors do not match. Nothing was signed.");if(T(t.vault,"Borro returned an invalid vault address."),T(t.asset,"Borro returned an invalid asset address."),t.chainId!==v||t.shareDecimals!==18||$(t.asset,t.vault)||!Number.isInteger(t.assetDecimals)||t.assetDecimals<0||t.assetDecimals>255||t.mode!==d)throw new n(A("setup-mismatch",{}));let a=await r.verifySetup(o,t,d);if(!a.ok||d==="deposit"&&(!t.assetAllowed||a.drift.length>0))throw new n(A("setup-mismatch",{}));return{...t,setup:a}}function f(e){let d=e.mode==="withdraw"&&!/^[A-Za-z0-9.$_-]{1,16}$/.test(e.symbol)?"token":e.symbol;return{asset:{address:T(e.asset,"Borro returned an invalid asset."),symbol:d,decimals:e.assetDecimals,chainId:v},share:{address:T(e.vault,"Borro returned an invalid vault."),symbol:e.vaultSymbol,decimals:18,chainId:v}}}let l=(e,d)=>h.formatAmount(e.toString(),d),g="The minimum is checked in the preview; standard ERC-4626 calldata does not enforce it on chain. Re-preview before signing; execution output can change.",y=[{name:"borro_deposit",inputSchema:E("deposit"),execute:async(e,d)=>{let s=H(e.amount),w=await k(e,"deposit",d),{asset:t,share:a}=f(w),m=B(await o.readContract({address:t.address,abi:b,functionName:"balanceOf",args:[i]}));if(s>m)throw new n("This wallet does not hold enough of that asset for the Borro deposit.");let p=B(await o.readContract({address:a.address,abi:b,functionName:"previewDeposit",args:[s]}));if(p===0n)throw new n(A("deposit-would-revert",{}));let c=w.builderEligible===!0,u=Z.get(e);if(u&&(!c||!$(u.token,a.address)||!$(u.recipient,i)||u.minimum<=0n||u.minimum>p))throw new n(A("deposit-would-revert",{}));let S=u?.minimum??L(p),C=c?M.builders.address:a.address,N=[h.approval(t.address,C,s.toString(),v),h.unsignedTx({to:C,data:c?R({abi:P,functionName:"deposit",args:[a.address,s,U,S]}):R({abi:b,functionName:"deposit",args:[s,i]}),value:"0",chainId:v,description:`Deposit ${s} asset base units into Borro vault ${a.address}.`})],x;try{x=await h.preview(N,i),z(x,t,s,a,S)}catch{throw new n(A("deposit-would-revert",{}))}let D=w.deployedAt===void 0?void 0:Date.parse(w.deployedAt)/1e3,_=F({viaBuilder:c,amount:l(s,t.decimals),symbol:t.symbol,kind:t.symbol==="USDG"?"usdg":"stock",shares:l(p,18),sharesMin:l(S,18),vaultSymbol:a.symbol,deployedAtSeconds:D,nowSeconds:Math.floor(Date.now()/1e3)});return{txs:N,preview:x,vault:a.address,asset:t,shareToken:a,amount:s.toString(),shares:p.toString(),shares_min:S.toString(),summary:`${_}
|
|
2
|
+
Base units: amount ${s} (${t.address}, decimals ${t.decimals}); shares ${p} (${a.address}, decimals 18); shares_min ${S}.`}}},{name:"borro_withdraw",inputSchema:E("withdraw"),execute:async(e,d)=>{let s=e.amount==="max",w=s?void 0:H(e.amount),t=await k(e,"withdraw",d),{asset:a,share:m}=f(t),p=B(await o.readContract({address:m.address,abi:b,functionName:"balanceOf",args:[i]}));if(p===0n)throw new n(A("no-shares",{symbol:a.symbol}));let c=s?p:B(await o.readContract({address:m.address,abi:b,functionName:"previewWithdraw",args:[w]}));if(c===0n||c>p)throw new n("This wallet does not hold enough Borro shares for that withdrawal.");let u=w??B(await o.readContract({address:m.address,abi:b,functionName:"previewRedeem",args:[c]}));if(u===0n)throw new n("Borro preview returned no assets for these shares. Nothing was signed.");let{ready:S,refusal:C}=await K(o,{...t,symbol:a.symbol},u,r.readLiquidity);if(C!==void 0)return{txs:[],vault:m.address,asset:a,shareToken:m,amount:u.toString(),shares:c.toString(),max_now:S.toString(),summary:C};let N=s?L(u):u,x=[h.unsignedTx({to:m.address,data:s?R({abi:b,functionName:"redeem",args:[c,i,i]}):R({abi:b,functionName:"withdraw",args:[u,i,i]}),value:"0",chainId:v,description:`Withdraw ${u} asset base units from Borro vault ${m.address}${s?` for ${c} share base units`:""}.`})],D=s?await h.preview(x,i):await h.preview(x,i,{reads:[{to:m.address,data:R({abi:b,functionName:"previewWithdraw",args:[u]}),chainId:v}]});if(!s){let q=D.readResults?.[0];if(D.readResults?.length!==1||typeof q!="string"||!/^0x[0-9a-fA-F]{64}$/.test(q))throw new n("Borro preview returned an invalid share quote. Nothing was signed.");if(c=B(BigInt(q)),c===0n||c>p)throw new n("This wallet does not hold enough Borro shares for that withdrawal.")}z(D,m,c,a,N);let _=G({amount:l(u,a.decimals),isAll:s,symbol:a.symbol,out:l(u,a.decimals),shares:l(c,18),vaultSymbol:m.symbol,drift:t.setup.drift.length>0});return{txs:x,preview:D,vault:m.address,asset:a,shareToken:m,amount:u.toString(),shares:c.toString(),assets_min:N.toString(),isMax:s,setup:t.setup,summary:`${_}
|
|
3
|
+
Base units: amount ${u} (${a.address}, decimals ${a.decimals}); shares ${c} (${m.address}, decimals 18); assets_min ${N}. ${g}`}}}];for(let e of y){let d=e.execute;e.execute=async(s,w)=>{try{return await d(s,w)}catch(t){throw new n(h.plainError(t))}}}return y};export{oe as a,K as b,re as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"];function i(e,n){if(!s.includes(e))return!1;let a=n[e==="netnet_blackjack_claim"?"seriesId":"sessionId"];return Object.keys(n).length===1&&typeof a=="string"&&/^[1-9]\d{0,77}$/.test(a)&&BigInt(a)<1n<<256n}var t={setApprovalForAll:"Collection-wide card approval is not supportable under current policy. Owner transfers and burns need no approval.",seat:"New blackjack seating is disabled: channel State has no protocol-enforced signature expiry, so Oak cannot safely activate its signing key.",play:"Blackjack channel state has no protocol-enforced signature expiry under Oak\u2019s signing contract; nothing was signed.",signatures:"Existing blackjack signature relay needs a separately qualified signing contract, hash, signer and nonce validation. Signature import is disabled.",conversion:"NetNet card conversion is disabled until the router route, calldata, value and asset exits have been qualified. Arbitrary swap bytes are refused."};function o(e,n){if(s.includes(e)&&!i(e,n))return"Recovery accepts exactly one positive decimal session or series ID; recipients, signatures and extra fields are refused.";if(e==="netnet_turbo_action")return n.operation==="setApprovalForAll"?t.setApprovalForAll:["convertPremiums","convertSleeveFees"].includes(String(n.operation))?t.conversion:"TURBO card actions are unavailable. Read card balances and existing blackjack sessions to inspect their status.";if(e==="netnet_blackjack_seat")return t.seat;if(e==="netnet_blackjack_play"||e==="netnet_blackjack_action")return t.play}var c=(e,n)=>e==="netnet_turbo_action"&&["safeTransferFrom","safeBatchTransferFrom"].includes(String(n.operation))&&Object.keys(n).every(r=>["operation","values"].includes(r));export{s as a,i as b,t as c,o as d,c as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as p}from"./
|
|
1
|
+
import{j as p}from"./ATEVAJ5Y.js";import{a as d}from"./Z7FGEWO2.js";import{a as f}from"./43LI5NKJ.js";import{d as a,i as c}from"./NWNYJ26T.js";import{b as m}from"./IX3GZMTM.js";import{b as i}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as u,zeroAddress as b}from"viem";function T(r,n,e=256,t=!1){if(typeof r!="string"||!/^[0-9]+$/.test(r))throw new s(`${n} must be a decimal base-unit string.`);let o=m(r);if(!t&&o===0n||o>=1n<<BigInt(e))throw new s(`${n} must be ${t?"a":"a positive"} uint${e}.`);return o}function g(r){return c(r,"Provide a token or contract address.",a)}function E(r){return typeof r=="string"&&["eth",d.toLowerCase()].includes(r.toLowerCase())?b:g(r)}function D(r){let n=r??50;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>=1e4)throw new s("Slippage must be an integer from 0 to 9999 bps.");return n}async function N(r,n,e){if(n===b)return{address:d,symbol:"ETH",decimals:18,chainId:i};let t=r.clientFor(i),[o,w]=await Promise.all([t.readContract({address:n,abi:u,functionName:"symbol",blockNumber:e}),t.readContract({address:n,abi:u,functionName:"decimals",blockNumber:e})]);return{address:n,symbol:p(o,n),decimals:w,chainId:i}}async function S(r,n,e,t){return f(e),{txs:n,preview:await r.preview(n,e),summary:t}}function $(r,n){if(Object.keys(r).some(e=>!n.includes(e)))throw new s(`Provide only ${n.join(", ")}.`)}export{T as a,g as b,E as c,D as d,N as e,S as f,$ as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as V}from"./CQ5WRWV4.js";import{a as S,b as C,c as W,d as re}from"./IV4K7FMD.js";import{a as ae,d as se,e as ie}from"./URBEK2VV.js";import{d as ue}from"./OIQTZOBN.js";import{b as F}from"./Z7FGEWO2.js";import{a as f,b as j,c as oe}from"./43LI5NKJ.js";import{c as G}from"./5TUXSOMI.js";import{b as o,e as ne}from"./IX3GZMTM.js";import{A as te,b as x,j as z,x as K,y as _}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{decodeFunctionData as R,encodeFunctionData as M,parseAbi as ce}from"viem";var ve=60,Z=50,Ne=200;var he="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",J="0x0000000000000000000000000000000000000000",T=z[4663].routes.kyberswap.address,y=z[4663].routes.velora.address,q=K[4663].kyberswap.toLowerCase(),le=K[4663].velora.toLowerCase(),Se="0x0000000000000000000000000000000000000000000000000000000000000000",N=ce(["function swap((address callTarget, address approveTarget, bytes targetData, (address srcToken, address dstToken, address[] srcReceivers, uint256[] srcAmounts, address[] feeReceivers, uint256[] feeAmounts, address dstReceiver, uint256 amount, uint256 minReturnAmount, uint256 flags, bytes permit) desc, bytes clientData) execution) payable returns (uint256 returnAmount, uint256 gasUsed)"]),$=ce(["function swapExactAmountIn(address executor, (address srcToken, address destToken, uint256 fromAmount, uint256 toAmount, uint256 quotedAmount, bytes32 metadata, address beneficiary) swapData, uint256 partnerAndFee, bytes permit, bytes executorData) payable returns (uint256 receivedAmount, uint256 submittedAmount, uint256 augustusFeeAmount)"]),E=class extends r{name="NoRouteError";constructor(t="No swap route is available for this token pair and amount."){super(t)}},L=class extends r{name="ExpiredQuoteError";constructor(t="Quote has expired. Request a fresh quote."){super(t)}},be=1e3,k=new Map;function me(e){for(let[t,n]of k)BigInt(e)>=o(n.expiresAt)&&k.delete(t)}function Y(e){return{...e,...e.sourcePoolRoute!==void 0?{sourcePoolRoute:structuredClone(e.sourcePoolRoute)}:{},...e.txs?{txs:e.txs.map(t=>({...t}))}:{}}}function de(e){let t=Y(e);return t.txs&&(t.txs.forEach(Object.freeze),Object.freeze(t.txs)),Object.freeze(t)}var Oe=["router","from","to","wallet","amountIn","amountOut","minAmountOut","expiresAt","chainId","spender","value","ponsCurveToken","ponsPoolToken","blockNumber","calldataMinAmountOut","expectedSpend","expectedRefund","oakFee","oakFeeBps","oakFeeToken","grossAmountOut","venueFee","venueFeeBps"];function U(e,t,n=!1){for(let u of Oe)if(!(u==="expiresAt"&&n&&o(e.expiresAt)<=o(t.expiresAt))&&e[u]!==void 0&&String(e[u]).toLowerCase()!==String(t[u]).toLowerCase())throw new r(`Quote ${u} does not match the accepted quote.`)}function H(e=Date.now){let t=e();if(!Number.isFinite(t)||t<0)throw new r("Clock must return a non-negative timestamp.");return t>1e11?Math.floor(t/1e3):Math.floor(t)}function P(e){let t=e.toLowerCase();return t===he.toLowerCase()||t===J.toLowerCase()}function ke(e,t=Z){if(!Number.isInteger(t)||t<0||t>=1e4)throw new r("Slippage must be an integer from 0 to 9999 bps.");return ne(e,String(1e4-t),"10000","floor")}var Ie=200;function $e(e){if(typeof e!="number"||!Number.isFinite(e)||!/^\d+(?:\.\d{1,2})?$/.test(String(e)))throw new r("Velora returned an unsupported venue fee. Request a fresh quote.");let[t,n=""]=String(e).split("."),u=Number(t)*100+Number(n.padEnd(2,"0"));return ee(u),u}function ee(e){if(!Number.isInteger(e)||e<0||e>Ie)throw new r("Velora returned an unsupported venue fee. Request a fresh quote.")}function pe(e,t=S.bps){return ee(t),o(e)*10000n/BigInt(1e4-t)+1n}function xe(e,t){if(ee(t),t!==S.bps||e!==W)throw new r("Velora partnerAndFee must match the pinned Oak fee, recipient and flags.")}function fe(e){if(e.oakFeeBps===S.bps)return`${re()} ${e.provider==="velora"?"Oak\u2019s share is paid to the Oak treasury.":"Paid to the Oak treasury."} Venue fee: ${e.venueFee} base units (${e.venueFeeBps} bps) retained by ${e.provider??"venue"}. Output and minimum are net.${e.provider==="velora"?" Velora retains 15% of the partner fee; Oak receives 85% (about 21.25 bps).":""}`;if(e.oakFee!==void 0&&o(e.oakFee)!==0n)throw new r("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");let t=e.provider??"venue";return`Venue fee: ${e.venueFee} base units (${e.venueFeeBps} bps) retained by ${t}; Oak swap fee: 0 (venue fee is never Oak income).`}function Fe(e){f(e.from),f(e.to),f(e.wallet);let t=e.callTarget??_[x].kyberswap.address,n=e.approveTarget??J;f(t),f(n);let u=o(e.amountIn),a=o(e.minAmountOut);return M({abi:N,functionName:"swap",args:[{callTarget:t,approveTarget:n,targetData:e.targetData??"0x",desc:{srcToken:e.from,dstToken:e.to,srcReceivers:P(e.from)?[]:[t],srcAmounts:P(e.from)?[]:[u-BigInt(C(e.amountIn))],feeReceivers:[S.recipient],feeAmounts:[BigInt(S.bps)],dstReceiver:e.wallet,amount:u,minReturnAmount:a,flags:640n,permit:"0x"},clientData:e.clientData??"0x"}]})}function Ee(e){f(e.from),f(e.to),f(e.wallet);let t=e.executor??_[x].velora.address;return f(t),M({abi:$,functionName:"swapExactAmountIn",args:[t,{srcToken:e.from,destToken:e.to,fromAmount:o(e.amountIn),toAmount:o(e.minAmountOut),quotedAmount:o(e.amountOut),metadata:e.metadata??Se,beneficiary:e.wallet},e.partnerAndFee??W,"0x",e.executorData??"0x"]})}function De(e){if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})+$/.test(e)||e.length<10)throw new r("Swap calldata must contain a 4-byte function selector.");let t=e.slice(0,10).toLowerCase();if(t===q)return R({abi:N,data:e}).args[0].desc.minReturnAmount;if(t===le)return R({abi:$,data:e}).args[1].toAmount;if(t==="0x3593564c")return se(e).swap.amountOutMinimum;let n=R({abi:ae,data:e});if(n.functionName==="buy"||n.functionName==="sell")return n.args[1];throw new r(`Unsupported swap router selector ${t}.`)}function we(e,t,n=!1){let u=o(t),a=De(e);if(a<=0n||u<=0n||a!==u&&!(n&&(a>u||e.slice(0,10).toLowerCase()===q&&a+1n===u)))throw new r(`Built swap calldata minimum output (${a}) does not match the accepted quote minimum (${u}).`);return a}function Ae(e,t){let{from:n,to:u,wallet:a,amountIn:d}=t;if(!n||!u||!a||d===void 0)throw new r("Accepted quote must include input, output, amount and wallet.");for(let i of[n,u,a,t.router,e.to])f(i);let p=(i,l,w)=>{if(i.toLowerCase()!==l.toLowerCase())throw new r(`Built swap ${w} does not match the accepted quote.`)};if(p(e.to,t.router,"router"),e.chainId!==(t.chainId??x))throw new r("Built swap chain does not match the accepted quote.");let g=P(n)?o(d):0n;if(o(e.value)!==g||t.value!==void 0&&o(t.value)!==g)throw new r("Built swap value does not match the accepted quote input.");let A=e.data.slice(0,10).toLowerCase(),s=t.router.toLowerCase();if(s===T.toLowerCase()||s===y.toLowerCase()){let i=s===T.toLowerCase(),l=i?d:t.grossAmountOut,w=i?n:u;if(t.oakFeeBps!==S.bps||l===void 0||t.oakFee!==C(l)||t.oakFeeToken?.toLowerCase()!==F(w).toLowerCase())throw new r("Oak fee must match the pinned rate, token and amount.")}let c;if(s===T.toLowerCase()&&A===q){p(t.spender??t.router,T,"spender");let i=R({abi:N,data:e.data});if(M({abi:N,...i}).toLowerCase()!==e.data.toLowerCase())throw new r("KyberSwap calldata must be canonically decodable.");let{callTarget:l,approveTarget:w,desc:m}=i.args[0];p(l,_[x].kyberswap.address,"executor"),p(w,J,"executor approval target");let I=P(n);if(m.srcReceivers.length!==m.srcAmounts.length||(I?m.srcReceivers.length!==0:m.srcReceivers.length===0||m.srcAmounts.some(v=>v<=0n)||m.srcAmounts.reduce((v,b)=>v+b,0n)!==o(d)-BigInt(C(d))))throw new r("KyberSwap source transfers must send the exact input less the pinned fee to the pinned executor or verified input pool.");for(let v of m.srcReceivers)if(v.toLowerCase()!==l.toLowerCase()&&!ue(n,v,e.data))throw new r(`KyberSwap source transfers: receiver ${v} is not a verified input pool or the pinned executor.`);if(m.feeReceivers.length!==1||m.feeAmounts.length!==1||m.feeReceivers[0].toLowerCase()!==S.recipient.toLowerCase()||m.feeAmounts[0]!==BigInt(S.bps)||m.flags!==640n||m.permit!=="0x")throw new r("KyberSwap fee recipients, fee amounts, flags and permit must match the pinned Oak input-fee policy.");c={from:m.srcToken,to:m.dstToken,wallet:m.dstReceiver,amount:m.amount}}else if(s===y.toLowerCase()&&A===le){p(t.spender??t.router,y,"spender");let i=R({abi:$,data:e.data});if(M({abi:$,...i}).toLowerCase()!==e.data.toLowerCase())throw new r("Velora calldata must be canonically decodable.");let[l,w,m,I]=i.args;if(!te.some(v=>v.toLowerCase()===l.toLowerCase()))throw new r("Built swap executor does not match the accepted quote.");if(I!=="0x")throw new r("Velora permit must match the pinned empty-permit policy.");if(xe(m,t.oakFeeBps??S.bps),t.calldataMinAmountOut!==void 0&&o(t.calldataMinAmountOut)!==pe(t.minAmountOut,S.bps))throw new r("Velora calldata minimum must cover the accepted net output, venue fee and router dust.");if(t.calldataMinAmountOut!==void 0&&(w.quotedAmount!==o(t.grossAmountOut??"0")||w.quotedAmount<o(t.calldataMinAmountOut)))throw new r("Velora quoted gross output must match the accepted quote and cover its calldata minimum.");if(m!==0n&&t.calldataMinAmountOut===void 0)throw new r("Velora venue fee requires a fee-adjusted calldata minimum.");c={from:w.srcToken,to:w.destToken,wallet:w.beneficiary,amount:w.fromAmount}}else if(t.provider==="pons"&&(t.ponsPoolToken||t.ponsCurveToken))c=ie(e,{...t,from:n,to:u,wallet:a});else throw new r("Built swap selector does not match the accepted router.");if(p(c.from,n,"input token"),p(c.to,u,"output token"),p(c.wallet,a,"recipient"),c.amount!==o(d))throw new r("Built swap input amount does not match the accepted quote.");we(e.data,t.calldataMinAmountOut??t.minAmountOut,s===T.toLowerCase())}function X(e,t={}){if(!e||typeof e.quoteId!="string"||!e.quoteId.trim())throw new r("Quote must include a non-empty quoteId.");if(f(e.router),e.oakFeeBps!==void 0){let h=t.provider??e.provider,O=h==="kyberswap"?t.amountIn??e.amountIn:e.grossAmountOut,Q=h==="kyberswap"?t.from??e.from:t.to??e.to;if(!["kyberswap","velora"].includes(h??"")||e.oakFeeBps!==S.bps||O===void 0||e.oakFee!==C(O)||!Q||e.oakFeeToken?.toLowerCase()!==F(Q).toLowerCase())throw new r("Oak fee must match the pinned rate, token and amount.")}else if(e.oakFee!==void 0&&o(e.oakFee)!==0n)throw new r("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");let n=o(e.amountOut),u=e.destAmountAfterFee??e.netAmountOut,a,d,p;if(u!==void 0){if(d=o(u),a=e.grossAmountOut!==void 0?o(e.grossAmountOut):n>=d?n:d,a<d)throw new r("Gross output cannot be less than net output.");p=e.venueFee!==void 0?o(e.venueFee):a-d}else if(e.grossAmountOut!==void 0){if(a=o(e.grossAmountOut),d=n,a<d)throw new r("Gross output cannot be less than net output.");p=e.venueFee!==void 0?o(e.venueFee):a-d}else e.venueFee!==void 0?(p=o(e.venueFee),d=n,a=d+p):(d=n,a=n,p=0n);if(d<=0n)throw new E("Quote output amount must be positive.");let g=t.slippageBps??e.slippageBps??Z,A=e.minAmountOut!==void 0?o(e.minAmountOut):o(ke(d.toString(),g));if(A<=0n||A>a)throw new r("Quote minAmountOut must be positive and not exceed gross output.");if((t.provider??e.provider)==="velora"&&e.calldataMinAmountOut!==void 0){if(o(e.calldataMinAmountOut)!==pe(A.toString(),S.bps)||o(e.calldataMinAmountOut)>a)throw new r("Velora calldata minimum must cover the accepted net output, venue fee and router dust.")}else if(e.calldataMinAmountOut!==void 0||e.ponsCurveToken!==void 0){if((t.provider??e.provider)!=="pons"||!e.ponsCurveToken)throw new r("Curve minimum requires a Pons curve quote.");f(e.ponsCurveToken);let h=o(t.amountIn??e.amountIn??"0"),O=o(e.expectedSpend??"0"),Q=o(e.expectedRefund??"0"),ge=o(e.calldataMinAmountOut??"0");if(h<=0n||O<=0n||O+Q!==h||ge*O/h!==A)throw new r("Pons actual minimum and refund do not match the encoded minimum.")}let s=H(t.now),c=BigInt(s+ve),i=e.expiresAt!==void 0?o(e.expiresAt):c,l=(i>c?c:i).toString(),w=p.toString(),m=e.venueFeeBps??(a>0n&&p>0n?Number((p*10000n+a/2n)/a):0),I=t.provider??e.provider??(e.router.toLowerCase()===y.toLowerCase()?"velora":"kyberswap"),v=I==="pons"&&e.feeDisclosure?e.feeDisclosure:fe({provider:I,venueFee:w,venueFeeBps:m,oakFee:e.oakFee??"0",oakFeeBps:e.oakFeeBps}),b={...e,quoteId:e.quoteId,amountOut:d.toString(),minAmountOut:A.toString(),router:e.router,expiresAt:l,provider:I,grossAmountOut:a.toString(),destAmountAfterFee:d.toString(),netAmountOut:d.toString(),venueFee:w,venueFeeBps:m,oakFee:e.oakFee??"0",feeDisclosure:v,...t.from??e.from?{from:F(t.from??e.from)}:{},...t.to??e.to?{to:F(t.to??e.to)}:{},...t.amountIn??e.amountIn?{amountIn:t.amountIn??e.amountIn}:{},...t.wallet??e.wallet?{wallet:t.wallet??e.wallet}:{},slippageBps:g,chainId:t.chainId??e.chainId??x,spender:e.spender??e.router,...t.allowance??e.allowance?{allowance:t.allowance??e.allowance}:{}};if(BigInt(s)>=o(l))throw new L;if(t.cache===!1)return b;if(me(s),BigInt(s)>=o(l))throw new L;let B=k.get(b.quoteId);if(B){U(b,B,!0);let h=de({...B,expiresAt:b.expiresAt});return k.set(h.quoteId,h),Y(h)}for(;k.size>=be;)k.delete(k.keys().next().value);let D=de(b);return k.set(D.quoteId,D),Y(D)}async function Ue(e,t,n={}){e={...e},f(e.from),f(e.to),f(e.wallet),e.from=F(e.from),e.to=F(e.to);let u=o(e.amountIn);if(u<=0n)throw new r("Swap amountIn must be greater than zero.");let a=e.slippageBps??Z;if(!Number.isInteger(a)||a<0||a>=1e4)throw new r("Slippage must be an integer from 0 to 9999 bps.");if(!Array.isArray(t)||t.length===0)throw new E;let d={from:e.from,to:e.to,amountIn:u.toString(),slippageBps:a},p=await Promise.allSettled(t.map(async s=>{let c=await(s.quotePrices??s.quote).call(s,{...d},e.wallet);return{quote:X(c,{provider:s.name,from:e.from,to:e.to,amountIn:u.toString(),wallet:e.wallet,slippageBps:a,chainId:e.chainId??x,allowance:e.allowance,now:e.now,cache:!1}),provider:s}})),g,A=[];for(let s of p)s.status==="rejected"&&(g??=G(s.reason)),s.status==="fulfilled"&&o(s.value.quote.expiresAt)>BigInt(H(e.now))&&A.push(s.value);if(A.length===0){let s=p.some(c=>c.status==="rejected"&&c.reason instanceof Error&&c.reason.message===V)&&p.every(c=>c.status==="rejected"&&(c.reason instanceof E||c.reason instanceof Error&&c.reason.message===V));throw g??new E(s?V:void 0)}A.sort((s,c)=>{let l=o(c.quote.amountOut)-o(s.quote.amountOut)||o(c.quote.minAmountOut)-o(s.quote.minAmountOut);return l>0n?1:l<0n?-1:0});for(let{quote:s,provider:c}of A)try{if(BigInt(H(e.now))>=o(s.expiresAt))continue;if(n.deferBuild||!c.prepareQuote)return X(s,{now:e.now});let i=await c.prepareQuote(s.quoteId,e.wallet);if(i.quoteId!==s.quoteId)throw new r("Prepared quote ID does not match the selected route.");if(U(i,s,!0),!i.data)throw new r("Selected route did not return swap calldata.");let l={...s,expiresAt:i.expiresAt,data:i.data,value:i.value,allowance:i.allowance??s.allowance};return Ae(j({to:l.router,data:i.data,value:i.value??"0",chainId:l.chainId??x,description:"Selected swap route"}),l),X(l,{now:e.now})}catch(i){g??=G(i);continue}throw g??new E}function He(e,t={}){if(!e||typeof e.quoteId!="string"||!e.quoteId.trim())throw new r("Provide a valid quote to build a swap.");f(e.router);let n=k.get(e.quoteId),u=H(t.now);if(me(u),!n||BigInt(u)>=o(n.expiresAt))throw k.delete(e.quoteId),new L;if(e.oakFeeBps===void 0&&e.oakFee!==void 0&&o(e.oakFee)!==0n)throw new r("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");U(e,n),U({...n,...t},n);let a=n.from,d=n.to,p=n.amountIn,g=n.wallet;if(!a||!d||!g||p===void 0)throw new r("Accepted quote must include input, output, amount and wallet.");let A=n.chainId??x,s=n.spender??n.router,c=t.allowance??e.allowance??n?.allowance??"0";f(a),f(d),f(g),f(s);let i=o(p);if(i<=0n)throw new r("Swap amountIn must be greater than zero.");let l=o(n.minAmountOut);if(l<=0n)throw new r("Swap minAmountOut must be greater than zero.");let w=e.router.toLowerCase()===y.toLowerCase(),m=t.data??e.data??n?.data??(w?Ee({from:a,to:d,amountIn:i.toString(),amountOut:n.grossAmountOut??n.amountOut,minAmountOut:n.calldataMinAmountOut??l.toString(),wallet:g}):Fe({from:a,to:d,amountIn:i.toString(),minAmountOut:l.toString(),wallet:g}));we(m,n.calldataMinAmountOut??l.toString(),n.router.toLowerCase()===T.toLowerCase());let I=n.venueFee??"0",v=n.venueFeeBps??0,b=n.provider??(w?"velora":"kyberswap"),B=n.feeDisclosure??fe({provider:b,venueFee:I,venueFeeBps:v,oakFee:n.oakFee??"0",oakFeeBps:n.oakFeeBps}),D=P(a),h=t.value??e.value??n?.value??(D?i.toString():"0"),O=j({to:e.router,data:m,value:h,chainId:A,description:`Swap ${i} base units of ${a} for at least ${l} base units of ${d} via ${b} (${e.router}). ${B}`});return Ae(O,n),D||o(c)>=i?[O]:[oe(a,s,i.toString(),A),O]}export{ve as a,Z as b,Ne as c,he as d,J as e,N as f,E as g,L as h,be as i,Y as j,de as k,U as l,H as m,P as n,ke as o,Ie as p,$e as q,pe as r,xe as s,fe as t,Fe as u,Ee as v,De as w,we as x,Ae as y,X as z,Ue as A,He as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as m}from"./5XAXJEWM.js";import{a as T,b as a,c as _,d as j,e as A,f as k,h as v}from"./AHUCYDBC.js";import{d as F}from"./JJGZ7W3V.js";import{b as y,c as w}from"./CZL6T2ZQ.js";import{a as c}from"./ZQ6AF3VX.js";import{a as x}from"./DGCJZ3HO.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as l,keccak256 as P,toHex as D}from"viem";var C={factor_sign_up:["name","does"],factor_draw:["job","amount","from"],factor_deliver:["job","work","proof","show"],factor_decline:["job"]};function u(t,o){return{to:y.desk.address,data:t,value:"0",chainId:4663,description:o}}function $(){return u(l({abi:c,functionName:"register"}),"Register this wallet as a Factor agent.")}function N(t,o,e){if(e==="compute")throw new r(x.compute);if(e!=="early"&&e!=="pool")throw new r("Choose early or pool for a Factor draw.");if(typeof o!="string")throw new r("Provide amount as a decimal wei string.");let i=a(t,"job"),f=a(o,"amount");return u(l({abi:c,functionName:"draw",args:[i,f,e==="early"?0:1]}),`Draw ${f} wei on Factor job ${i} from ${e}.`)}function O(t,o){if(!/^0x[0-9a-fA-F]{64}$/.test(o))throw new r("Provide the work proof as 32 hexadecimal bytes.");let e=a(t,"job");return u(l({abi:c,functionName:"deliver",args:[e,o]}),`Deliver the work fingerprint for Factor job ${e}.`)}function R(t){let o=a(t,"job");return u(l({abi:c,functionName:"decline",args:[o]}),`Decline Factor job ${o}.`)}function U(t){if(t.show!==void 0&&typeof t.show!="boolean")throw new r("show must be a boolean.");let o;if(t.work!==void 0){if(typeof t.work!="string"||!t.work.trim())throw new r("Provide non-empty work text.");if(t.show===!0&&t.work.length>2e5)throw new r("Public work must have at most 200000 characters.");o=P(D(t.work))}if(t.proof!==void 0){if(typeof t.proof!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.proof))throw new r("Provide the work proof as 32 hexadecimal bytes.");if(o!==void 0&&o!==t.proof.toLowerCase())throw new r("The proof does not match the work text.");o=t.proof.toLowerCase()}if(o===void 0)throw new r("Provide work text or its proof.");return o}async function H(t,o,e,i){if(!Object.hasOwn(C,o))throw new r("Unknown Factor action.");let f=o==="factor_sign_up"?["name","does"]:o==="factor_draw"?["job","amount","from"]:["job"];T(e,C[o],f),o==="factor_sign_up"&&(m("name",e.name),m("does",e.does));let p=o==="factor_sign_up"?$():o==="factor_draw"?N(e.job,e.amount,e.from):o==="factor_deliver"?O(e.job,U(e)):R(e.job);await j(t,i,!1);let s=t.clientFor(4663);if(o==="factor_sign_up"){if((await A(s,i)).registered)return[]}else{let n=await k(s,e.job,i);if(o==="factor_decline"){if(n.state!==1||n.early!==0n||n.fromPool!==0n)throw new r("The job is not in a state that permits declining before any advance.")}else{if(n.state!==1&&n.state!==2)throw new r("The job is not in a state that permits this action. Read the job again.");if((await s.getBlock()).timestamp>BigInt(n.dueAt)+w.GRACE)throw new r("It is too late for that on this job.");if(o==="factor_draw"){let h=a(e.amount,"amount"),b=n.price*w.ADVANCE_MAX_BPS/w.BPS-n.early-n.fromPool;if(h>b)throw new r(`Advances stop at half the job price; ${b} wei remains drawable.`);if(e.from==="early"&&!n.allowEarly)throw new r("The customer did not allow an early advance on this job.");let g=await F(s,e.job);if(h>BigInt(e.from==="early"?g.early:g.pool))throw new r("The desk\u2019s current advance or pool limit is below this draw amount.")}}}let d=t.unsignedTx(p);if(_(d),d.data.toLowerCase()!==p.data.toLowerCase())throw new r("Factor calldata changed during construction. Nothing was sent.");return await v(s,d,i),[d]}export{C as a,$ as b,N as c,O as d,R as e,U as f,H as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as J,h as K}from"./5W74Z4WZ.js";import{a as H}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{c as D,d as Y,g as N,i as V,m as Q,n as z}from"./NWNYJ26T.js";import{b as p,j as R,k as j}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{decodeFunctionData as X,encodeFunctionData as x,erc20Abi as F,getAddress as L,parseAbi as Z}from"viem";var e={router:L("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:L("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:L("0x8697bb63743678640710b1270e98772a29642b3c"),weth:L("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:L("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},E=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),O={vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,h){let f=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==h.length&&f();for(let q=0;q<s.length;q++){let P=s[q],v=h[q];if((P.chainId!==v.chainId||!N(P.to,v.to)||P.value!==v.value)&&f(),!N(P.data,v.data))try{let B=X({abi:E,data:P.data}),n=X({abi:E,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&f();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:f(),i=x({abi:E,functionName:B.functionName,args:t});N(i,P.data)||f();let u=t.length-1;(l(t[u])<=l(a[u])-600n||l(t[u])>l(a[u]))&&f(),t[u]=a[u];for(let o of r)l(t[o])<l(a[o])&&f(),t[o]=a[o];N(x({abi:E,functionName:B.functionName,args:t}),v.data)||f()}catch{f()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function G(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function l(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let h=s??50;if(typeof h!="number"||!Number.isInteger(h)||h<0||h>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(h)}function W(s,h){let f=s*(10000n-h)/10000n;if(f===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return f}var ce=s=>{async function h(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function f(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==L(R[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function q(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=l(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=l(a.timestamp)+600n,i=(S,g,A=[])=>n.readContract({address:S,abi:E,functionName:g,args:A,blockNumber:t}),[u,o,m,c,w,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:R[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||w!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(S,g)=>l(await n.readContract({address:S,abi:F,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(S){let[g,A]=await Promise.all([n.readContract({address:S,abi:F,functionName:"symbol",blockNumber:t}),n.readContract({address:S,abi:F,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:S,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function P(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},amount:{...I(),description:'Optional CLM entry budget in base units of the bridge token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals.'},slippageBps:O.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>h(async()=>{if(J.some(b=>N(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);f(n,[]),H(t);let a=await q(),[r,i,u,o,m,c,w]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:l(o[0]).toString()},{token:i,balance:c.toString(),reserve:l(o[1]).toString()}],lp:{token:u,balance:w.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...O,from:{...D,description:"Address of the token to sell: native ETH placeholder, WETH, UP or USDG."},to:{...D,description:"Address of the token to receive: WETH, UP or USDG, different from the input token."},amount:I('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["from","to","amount","slippageBps"]),H(t);let a=y(n.from),r=y(n.to),i=G(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,L(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await q();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let w=[];m&&w.push(v(e.weth,x({abi:E,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let U=0;U<g.length-1;U++){let C={from:g[U],to:g[U+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let _=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(_)||_.length!==g.length||l(_[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let U of _)if(l(U)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=l(_.at(-1)),T=W(k,u),w.push(s.approval(b,e.router,i.toString(),p)),w.push(v(e.router,x({abi:E,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let S=await c.token(r);return{...await P(w,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:S,amount:k.toString()},minimumOutput:{token:S,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...O,amount0:I('Amount of WETH to add in base units (WETH has 18 decimals). Example: "1000000000000000000" = 1 WETH.'),amount1:I('Amount of UP to add in base units of the UP token (read its decimals). Example: "1000000000000000000" = 1 UP at 18 decimals.')},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount0","amount1","slippageBps"]),H(t);let a=G(n.amount0),r=G(n.amount1),i=M(n.slippageBps),u=await q();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=l(o[0]),c=l(o[1]),w=l(o[2]);if(m>a||c>r||w===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=W(m,i),k=W(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,x({abi:E,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await P(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:w.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...O,amount:{description:'Amount of UP-WETH LP tokens to remove, in base units of the LP token (18 decimals). Example: "1000000000000000000" = 1 LP token. "all" removes your full LP balance.',anyOf:[I(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount","slippageBps"]),H(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:G(n.amount),i=await q(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,w]=await Promise.all([i.client.readContract({address:e.pair,abi:F,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(l(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=W(c*o/m,a),k=W(w*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,x({abi:E,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await P(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,E as b,ue as c,de as d,ce as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as u}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{decodeErrorResult as h,encodeFunctionData as k,formatEther as p,keccak256 as w,parseAbi as y}from"viem";var l="0x5aeB8269977Ce12f62D2cD9a1f04E9A7894512ee",m="0x5236857c06be1bf151306dcc5ac134b2a2353760f3d73817da769dee67d7ef24",O=["hoodlock_buyback"],b=y(["function execute() returns(uint256)","error NotReady(uint256 balance,uint256 need,uint64 readyAt)"]);function g(e){let s=new Set;for(let o=0;e&&typeof e=="object"&&o<16&&!s.has(e);o++){s.add(e);let t=e,a=t.raw??t.data;if(typeof a=="string"&&/^0x[0-9a-f]+$/i.test(a))try{let n=h({abi:b,data:a});if(n.errorName==="NotReady"){let[r,i,d]=n.args;return`HoodLock buyback is not ready: ${p(r)} ETH pending in the vault; threshold ${p(i)} ETH${r<i?" not reached":""}. Contract readiness time: ${d} Unix seconds. No wallet funds were spent; retry when the vault is ready.`}}catch{}e=t.cause}}var v=e=>({tools:[{name:"hoodlock_buyback",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(s,o){if(Object.keys(s).length)throw new c("HoodLock buyback accepts no amount, recipient or calldata.");let t=e.clientFor(u);if(await t.getChainId()!==u)throw new c("HoodLock buyback requires chain 4663.");let a=await t.getBlockNumber(),n=await t.getCode({address:l,blockNumber:a});if(!n||w(n)!==m)throw new c("The HoodLock buyback vault no longer matches its pinned runtime code.");let r=[e.unsignedTx({to:l,chainId:u,value:"0",data:k({abi:b,functionName:"execute"}),description:"Trigger the HoodLock vault to buy back and burn LOCK using its own ETH. No wallet funds or approvals."})];try{await t.simulateContract({address:l,abi:b,functionName:"execute",account:o,blockNumber:a})}catch(d){let f=g(d);throw new c(f??e.plainError(d))}let i=await e.preview(r,o);return{txs:r,preview:i,summary:"Permissionless HoodLock buyback and burn. The vault enforces its threshold, cooldown, oracle and slippage checks. The caller pays gas and receives no reward. Confirm the local preview before signing."}}}]});export{l as a,m as b,O as c,b as d,g as e,v as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as k}from"./LKX5WDOQ.js";import{a as A}from"./VVAM3EAK.js";import{b as T}from"./43LI5NKJ.js";import{b as D}from"./66F5ZH34.js";import{c as _,d as I,g as v,i as $,n as V}from"./NWNYJ26T.js";import{b as u}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as R,erc20Abi as O,getAddress as C,parseAbi as S}from"viem";var N=C("0x0000000000bbf5c5fd284e657f01bd000933c96d"),b=C("0x0a0d53b6684c7b32b4cbef5fe8483bfcc8406742"),U=C("0x00700052c0608F670705380a4900e0a8080010CC"),x=S(["function getCollectedFees(address partner,address token) view returns (uint256)","function withdrawAllFees(address token,address recipient) returns (uint256 amount)","function getBalance(address token,address partner) view returns (uint256)","function withdrawAllERC20(address token,address recipient) returns (bool)","function withdrawNative(uint256 amount,address owner,address receiver)"]),H=(1n<<256n)-1n,B={description:'Choose "market" for market-swap fees or "delta" for Delta fees.',type:"string",enum:["market","delta"]};function w(t){return $(t,"Provide a token or wallet address.",I)}function y(t){if(t!=="market"&&t!=="delta")throw new o("Choose market or delta fees.");return t}function P(t){return V(t,"Amount must be positive and within uint256.",{notString:"Amount must be a decimal base-unit string.",positive:!0}).toString()}function E(t,m,d){if(d=w(d),t==="velora_unwrap_deth"){for(let e of Object.keys(m))if(e!=="amount")throw new o(`Unsupported ${t} argument: ${e}.`);let a=P(m.amount);return{tx:T({to:b,chainId:u,value:"0",data:R({abi:x,functionName:"withdrawNative",args:[BigInt(a),d,d]}),description:`Unwrap ${a} dETH base units into the same amount of native ETH for ${d} on chain ${u}.`}),inputs:[{token:b,amount:a}]}}if(t!=="velora_claim_fees")throw new o("Unknown Velora claim action.");for(let a of Object.keys(m))if(!["token","kind"].includes(a))throw new o(`Unsupported ${t} argument: ${a}.`);let f=w(m.token);if(k(f))throw new o("Velora fee claims require an ERC-20 token address.");let c=y(m.kind);return{tx:T({to:c==="delta"?N:U,chainId:u,value:"0",data:R({abi:x,functionName:c==="delta"?"withdrawAllFees":"withdrawAllERC20",args:[f,d]}),description:`Claim the full accrued ${c} fee balance of ${f} to ${d} on chain ${u}. Receipt amount can change before mining; no minimum is encoded.`}),inputs:[]}}function Q(t,m,d,f){let{tx:c}=E(m,d,f),a=t[0];if(t.length!==1||!a||a.chainId!==c.chainId||!v(a.to,c.to)||!v(a.data,c.data)||a.value!==c.value)throw new o("Velora claim calldata, recipient, amount or destination differs from the request.")}function X(t){let m=async()=>{let e=t.clientFor(u);if(await e.getChainId()!==u)throw new o("Velora requires an RPC on chain 4663.");return e};async function d(e){if(e===b)return{address:e,symbol:"dETH",decimals:18,chainId:u};let n=await m(),[s,r]=await Promise.all([A(n,u,e,"symbol"),A(n,u,e,"decimals")]);if(typeof s!="string"||!s.trim()||!Number.isInteger(r)||r<0||r>255)throw new o("Velora fee token metadata is unavailable.");return{address:e,symbol:s,decimals:r,chainId:u}}async function f(e,n){let s=y(e.kind),r=w(e.token);if(k(r))throw new o("Velora fee claims require an ERC-20 token address.");let i=await(await m()).readContract({address:s==="delta"?N:U,abi:x,functionName:s==="delta"?"getCollectedFees":"getBalance",args:s==="delta"?[n,r]:[r,n]});if(typeof i!="bigint"||i<0n||i>H)throw new o("Velora fee balance is unavailable.");return i}function c(e,n,s,r){return{name:e,inputSchema:{type:"object",additionalProperties:!1,properties:n,required:s},execute:async(p,i)=>{try{i=w(i);for(let l of Object.keys(p))if(!Object.hasOwn(n,l))throw new o(`Unsupported ${e} argument: ${l}.`);return await r(p,i)}catch(l){throw new o(t.plainError(l))}}}}let a={token:{..._,description:"Address of the token to inspect or use."},kind:B};return[c("velora_fee_balance",a,["token","kind"],async(e,n)=>({kind:y(e.kind),token:await d(w(e.token)),amount:(await f(e,n)).toString()})),c("velora_claim_fees",a,["token","kind"],async(e,n)=>{let{tx:s}=E("velora_claim_fees",e,n),r=await f(e,n);if(r===0n)throw new o("No accrued Velora fees for this wallet and token.");let p=await d(w(e.token)),i=[s],l=await t.preview(i,n);return{txs:i,preview:l,estimatedReceipt:{token:p,amount:r.toString()},summary:`${s.description} ${l.summary}`}}),c("velora_unwrap_deth",{amount:D('Amount of wallet-held dETH in base units (18 decimals). Example: "1000000000000000000" = 1 dETH.')},["amount"],async(e,n)=>{let{tx:s,inputs:r}=E("velora_unwrap_deth",e,n),i=await(await m()).readContract({address:b,abi:O,functionName:"balanceOf",args:[n]});if(typeof i!="bigint"||i<0n||i>H)throw new o("Wallet dETH balance is unavailable.");if(i<BigInt(r[0].amount))throw new o("Insufficient wallet-held dETH. An active native Delta order must first settle, expire or cancel.");let l=[s],g=await t.preview(l,n);if(g.changes.filter(h=>h.token.chainId===u&&k(h.token.address)).reduce((h,F)=>h+BigInt(F.amount),0n)<BigInt(r[0].amount))throw new o("Velora dETH preview does not return the requested native ETH amount.");return{txs:l,preview:g,summary:`${s.description} ${g.summary}`}})]}export{N as a,b,U as c,x as d,E as e,Q as f,X as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as T}from"./5RXALTDT.js";import{b as p,c as C,j as S}from"./TI727O2H.js";import{a as l}from"./XSD5NL7J.js";import{AsyncLocalStorage as W}from"node:async_hooks";import{custom as X}from"viem";import{createPublicClient as U,custom as x,defineChain as q}from"viem";var A="https://rpc.mainnet.chain.robinhood.com",D="https://api.oakagentkit.org/v1/rpc",E=8453,ce=[p,E];function j(e){return e===p?A:e===E?D:void 0}var B="oak-core/0.1.0",z=S[4663].ponsClaims.multicall3.address,L=new Set(["eth_sendTransaction","eth_sendRawTransaction","eth_sign","personal_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","wallet_sendTransaction","wallet_sign"]);function O(e=p,t=A){if(!Number.isSafeInteger(e)||e<=0)throw new l("Provide a positive integer chain ID.");let n=e===p?"Robinhood Chain":e===C?"Robinhood Chain Testnet":`Chain ${e}`;return q({id:e,name:n,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:[t]}},...e===p?{contracts:{multicall3:{address:z}}}:{}})}function ue(e=p,t){if(t?.chain&&t.chain.id===e)return t.chain.contracts?.multicall3?.address;if(!(!Number.isSafeInteger(e)||e<=0))return O(e).contracts?.multicall3?.address}function G(e,t,n){let o=e?.trim()||n?.rpcUrl?.trim()||n?.rpcUrls?.[t]?.trim(),r=t===p?(process.env[`OAK_RPC_URL_${t}`]??process.env.OAK_RPC_URL)?.trim():t===C?(process.env.OAK_TESTNET_RPC_URL??process.env.OAK_RPC_URL)?.trim():process.env[`OAK_RPC_URL_${t}`]?.trim(),s=o||r||j(t);if(!s)throw new l(`No RPC URL configured for chain ${t}.`);if(s===D&&!n?.transport)throw new l(`Hosted RPC needs a local session transport; configure OAK_RPC_URL_${t} for a direct core/server client.`);if((n?.requireKeyedRpc??process.env.NODE_ENV==="production")&&t===p&&s===A)throw new l("Production requires a keyed OAK_RPC_URL.");return s}var J=1e4;async function v(e,t=J){if(!Number.isFinite(t)||t<=0||t>3e4)throw new l("RPC timeout must be greater than zero and at most 30000 ms.");let n=new AbortController,o;try{return await Promise.race([new Promise((r,s)=>{o=setTimeout(()=>{s(new l("The RPC request timed out. Please try again.")),n.abort()},t)}),e(n.signal)])}finally{clearTimeout(o)}}function V(e,t=p,n){let o=typeof e=="object"&&e!==null,r=o?e:n??{},s=typeof e=="string"?e:r.rpcUrl,i=o?r.chainId??t:t;if(!Number.isSafeInteger(i)||i<=0)throw new l("Provide a positive integer chain ID.");if(r.timeoutMs!==void 0&&(!Number.isFinite(r.timeoutMs)||r.timeoutMs<=0||r.timeoutMs>3e4))throw new l("RPC timeout must be greater than zero and at most 30000 ms.");let d=G(s,i,r),a=O(i,d);if(r.transport){let c=r.transport({chain:a,retryCount:0});return U({chain:a,transport:x({request:f=>{if(L.has(f.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(f.method))throw new l("Read-only RPC client does not allow this method.");return v(()=>c.request(f),r.timeoutMs)}},{retryCount:0})})}let u=M({url:d,chainId:i,fetch:r.fetch,userAgent:r.userAgent?.trim()||B,retries:r.retries,retryDelayMs:r.retryDelayMs,maxRetryDelayMs:r.maxRetryDelayMs,timeoutMs:r.timeoutMs,fallbackUrls:r.rpcFallbackUrls?.[i]??r.fallbackRpcUrls??P(process.env[`OAK_RPC_FALLBACK_URLS_${i}`]??(i===p?process.env.OAK_RPC_FALLBACK_URLS:void 0))})({chain:a,retryCount:0}),b=x({request:c=>{if(L.has(c.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(c.method))throw new l("Read-only RPC client does not allow this method.");return u.request(c)}},{retryCount:0});return U({chain:a,transport:b})}function le(e={}){let t=new Map;return n=>{let o=t.get(n);if(o)return o;let r=V(e.rpcUrls?.[n],n,e);return t.set(n,r),r}}var y=class extends l{},Q=16,k=new Map;async function Y(e,t,n){t.throwIfAborted();let o=new URL(e).origin,r=k.get(o);r||(r={active:0,waiters:new Set},k.set(o,r));let s=r;s.active<Q?s.active++:await new Promise((i,d)=>{let a=()=>{t.removeEventListener("abort",h),i()},h=()=>{s.waiters.delete(a),t.removeEventListener("abort",h),d(t.reason)};s.waiters.add(a),t.addEventListener("abort",h,{once:!0})});try{return t.throwIfAborted(),await n()}finally{let i=s.waiters.values().next().value;i?(s.waiters.delete(i),i()):--s.active===0&&k.delete(o)}}function I(e){let t=[];for(;e&&typeof e=="object"&&!t.includes(e);)t.push(e),e=e.cause;return t}function Z(e){return I(e).find(t=>t instanceof y)}function ee(e){if(!Z(e))for(let t of I(e)){let n=Number(t.status??t.code);if(n===429||n>=500&&n<=599)return{status:n,delay:typeof t.retryAfterMs=="number"?t.retryAfterMs:void 0};if(/rate.?limit|too many requests/i.test(String(t.message??"")))return{status:429}}}async function N(e,t,n={},o){let r=T();r&&r!==o&&(o=o?AbortSignal.any([r,o]):r);let s=n.retries??3,i=n.retryDelayMs??250,d=n.maxRetryDelayMs??2e3;if(!Number.isInteger(s)||s<0||s>5||!Number.isFinite(i)||i<0||!Number.isFinite(d)||d<0||d>3e4)throw new l("RPC retries must be 0 to 5; backoff must be non-negative and at most 30000 ms.");for(let a=0;;a++){o?.throwIfAborted();try{return await e()}catch(h){o?.throwIfAborted();let u=ee(h);if(!u)throw h;let b=Math.min(d,i*2**a),c=Math.max(Math.min(d,b+Math.floor(Math.random()*b/4)),u.delay??0);if(a>=s||c>d){let f=u.status===429?"public RPC rate-limited":`RPC returned HTTP ${u.status}`,m=u.delay?` Retry after ${Math.max(1,Math.ceil(u.delay/1e3))} seconds.`:"";throw new y(`${f}, retried ${a} times (${t}).${m} ${u.status===429?"The RPC rate limit remains active. ":""}Configure a keyed OAK_RPC_URL or comma-separated OAK_RPC_FALLBACK_URLS for this chain.`)}await new Promise((f,m)=>{let w=()=>{clearTimeout(R),m(o?.reason)},R=setTimeout(()=>{o?.removeEventListener("abort",w),f()},c);o?.addEventListener("abort",w,{once:!0}),o?.aborted&&w()})}}}function P(e){if(e===void 0||e.trim()==="")return[];let t=e.split(",").map(n=>n.trim());if(t.length>4)throw new l("Configure at most four ordered fallback RPC URLs.");for(let n of t){let o;try{o=new URL(n)}catch{throw new l("Fallback RPC URLs must use HTTP or HTTPS.")}if(!["http:","https:"].includes(o.protocol))throw new l("Fallback RPC URLs must use HTTP or HTTPS.")}return t}var g=new Map;async function te(e,t,n){let o=g.get(e)??Promise.resolve(),r,s=new Promise(d=>{r=d}),i=o.then(()=>s);g.set(e,i);try{return await o,n.throwIfAborted(),await t()}finally{r(),g.get(e)===i&&g.delete(e)}}var K=new W,F=new Map,H=e=>{let t=new URL(e).origin,n=F.get(t);return n||(n={interactive:0},F.set(t,n)),n};async function re(e,t){let n=K.getStore(),o=[...new Set(e.map(H))].filter(r=>!n?.has(r));o.forEach(r=>{r.interactive++});try{let r=o.flatMap(s=>s.background?[s.background.catch(()=>{})]:[]);return r.length&&await Promise.all(r),await t()}finally{o.forEach(r=>{r.interactive--})}}async function ye(e,t,n=o=>new Promise(r=>{setTimeout(r,o).unref()})){let o=H(e);for(;o.interactive||o.background;)await n(100);let r=Promise.resolve().then(()=>K.run(new Set([o]),t));o.background=r;try{return await r}finally{o.background===r&&(o.background=void 0)}}function M(e){let t=[...new Set([e.url,...e.fallbackUrls??[]])];P(t.slice(1).join(","));let n=new Set,o=0;return X({request:({method:r,params:s})=>re(t,()=>v(async i=>{let d=T(),a=d?AbortSignal.any([d,i]):i;a.throwIfAborted();let h;for(let u of t){a.throwIfAborted();let b=async(c,f=[])=>Y(u,a,async()=>{a.throwIfAborted();let m=await(e.fetch??globalThis.fetch)(u,{method:"POST",redirect:"error",signal:a,headers:{"content-type":"application/json","user-agent":e.userAgent??"oak-core/0.1.0"},body:JSON.stringify({jsonrpc:"2.0",id:++o,method:c,params:f})});if(!m.ok){let R=m.headers.get("retry-after"),_=R===null?void 0:/^\d+(\.\d+)?$/.test(R.trim())?Number(R)*1e3:Math.max(0,Date.parse(R)-Date.now()),$=typeof _=="number"&&Number.isFinite(_)?_:void 0;throw await m.body?.cancel(),m.status===429||m.status>=500?Object.assign(new Error("Transient RPC HTTP failure"),{status:m.status,retryAfterMs:$}):new y(`RPC returned HTTP ${m.status} (${c}).`)}let w;try{w=await m.json()}catch{throw new y("The RPC endpoint returned malformed JSON.")}if(w.error)throw Object.assign(new Error(w.error.message??"RPC error"),{code:w.error.code,data:w.error.data});return w.result});try{if(u!==t[0]&&r!=="eth_chainId"&&(!n.has(u)||r==="eth_sendRawTransaction")){let m=await N(()=>b("eth_chainId"),"eth_chainId",e,a);if(Number(m)!==e.chainId)throw new y("RPC chain does not match the requested chain.");n.add(u)}let c=()=>N(()=>b(r,s),r,e,a),f=await(r==="eth_simulateV1"?te(u,c,a):c());if(r==="eth_chainId")if(Number(f)!==e.chainId){if(u!==t[0])throw new y("RPC chain does not match the requested chain.")}else n.add(u);return f}catch(c){if(a.throwIfAborted(),h=c,!(c instanceof y)||!/rate-limited|HTTP 5\d\d|chain does not match/.test(c.message))throw c}}throw h},e.timeoutMs))},{retryCount:0})}export{y as a,Q as b,Z as c,N as d,P as e,re as f,ye as g,M as h,A as i,D as j,E as k,ce as l,j as m,B as n,z as o,O as p,ue as q,J as r,v as s,V as t,le as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as o,d as r,e as i}from"./OQFNUDMQ.js";import{c as s}from"./VXCGMALF.js";import{b as t}from"./TI727O2H.js";var n=[{feature:"Ethos claim",source:"https://go.priors.trade/start-ethos.js",missing:"Public claim endpoint signs/sends the sponsor transaction remotely. No unsigned final transaction with a local preview/confirmation handoff is published. Use the owner Go Start workflow; Oak offers status and route discovery."},{feature:"x402 pay_url, paid reports, hire payments and pay_gateway",source:"https://github.com/priors-agents/priors/tree/02230282d8888e00794207ed271ee01b4ce30309/packages/x402",missing:"These hand EIP-3009 payment authorization to an external merchant/facilitator. The recipient settles remotely; no Oak-local unsigned transaction handoff is exposed. Oak discovery is supported; external payment-signature validation, recipient/invoice binding and preview semantics require a shared add-on protocol, beyond this module write scope. Gateway source also says its live 402 surface was not measured."},{feature:"Go Google/Privy account, gas sponsorship, recovery and agent001 approvals",source:"https://go.priors.trade/account",missing:"Authenticated smart-account/session and sponsored-operation APIs are not publicly specified as an unsigned plain-wallet contract. Owner uses Priors UI. Underlying pool, stock, savings and backing contracts are supported here."},{feature:"Publish merchant listings, job offers/results, board requests and signed public offers",source:"https://priors.trade/agent",missing:"Hosted MCP supplies discovery and signed board reads. A versioned authenticated mutation/withdrawal contract is not pinned from the inspected public SDK. Existing owner consent plus direct sponsor offer is supported on chain; creating external listings/messages remains an owner workflow."},{feature:"Create the X proof post",source:"https://go.priors.trade/xlink-core.js",missing:"Requires the human account owner to publish on X. Oak can set or clear the canonical proof URL as public ERC-8004 metadata, but does not publish posts or claim metadata alone verifies X ownership."}];function l(){return{tools:[{name:"priors_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(){return{chainId:t,sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309",reads:[...a],actions:[...r],localOwnerSignatures:[...o],core:[...i],ownerOnly:s.filter(e=>e.owner).map(e=>e.name),blocked:n.map(e=>({...e,status:"BLOCKED"})),integration:"The shared bridge/server diffs must be integrated for open reads, local signing continuations, exact calldata reconstruction, action destinations and human confirmation. New core builders fail closed in older add-ons; a core-only install does not establish end-to-end feature availability.",safety:"Every local action previews its exact unsigned transaction bundle. Approvals equal inputs or explicit finite future budgets; never unlimited. Persistent autopay and bids authorize later third-party execution within the stated budget. Token backing is collateral and provides no promised returns."}}}]}}export{n as a,l as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as B}from"./
|
|
1
|
+
import{b as B}from"./S4JUFCT4.js";import{a as u,b,c,e as k,f as m,g as l,h as w}from"./WAKZWSHB.js";import{e as y,m as o}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as x}from"viem";var a="LayerBank returned a malformed reserve read. Please try again.";function N(r){let s=o(r,a);if(s>=1n<<128n)throw new n(a);return s}async function I(r,s){try{let e=s??await r.getBlockNumber({cacheTime:0}),p=await B(r,e),[f,h,R,v]=await Promise.all([r.readContract({address:u,abi:l,functionName:"getConfiguration",args:[c.address],blockNumber:e}),r.readContract({address:c.address,abi:L,functionName:"balanceOf",args:[b],blockNumber:e}),r.readContract({address:b,abi:w,functionName:"scaledTotalSupply",blockNumber:e}),r.readContract({address:u,abi:l,functionName:"getReserveNormalizedIncome",args:[c.address],blockNumber:e})]);if(!y(f))throw new n(a);let t=o(f.data,a);if((t>>48n&255n)!==6n)throw new n(a);let C=N(p.currentLiquidityRate),P=N(p.accruedToTreasury),T=o(R,a),g=o(v,a);if(g===0n)throw new n(a);let d=((T+P)*g+m/2n)/m,i=(t>>116n&(1n<<36n)-1n)*10n**6n;return{blockNumber:e,active:(t&1n<<56n)!==0n,frozen:(t&1n<<57n)!==0n,paused:(t&1n<<60n)!==0n,supplyCapBase:i,suppliedBase:d,capRoomBase:i===0n?k:d>=i?0n:i-d,cashUsdgBase:o(h,a),rateBasePct:Number(x(C,25))}}catch(e){throw e instanceof n?e:new n("LayerBank reserve could not be read. Please try again.")}}export{I as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as T}from"./
|
|
1
|
+
import{b as T}from"./QMNUB2GM.js";import{c as A}from"./FAH7FKUT.js";import{i as b}from"./NMJVQX5M.js";import{k as P}from"./UVAR6BHU.js";import{b as f,j as g}from"./TI727O2H.js";var U=.5,E=394930n,C=315200n,R=1000000000n,x=10000n*10n**18n,M="fees estimated high because the live price was unavailable";function I(s,r){if(s.impliedApy===void 0)return{reason:"Pendle's service gave no rate, so Oak won't show one."};let t=Math.expm1(Number(r)/1e18)*100,n=s.impliedApy*100;return!Number.isFinite(t)||!Number.isFinite(n)?{reason:"the rate could not be checked against the chain, so Oak won't show one."}:Math.abs(n-t)>U?{reason:`The rate Pendle's service lists (${n.toFixed(2)}% a year) differs from the chain's (${t.toFixed(2)}% a year) by more than ${U} points, so Oak won't show one.`}:{ratePct:n}}async function S(s,r){let t=s.clientFor(f),n=await t.getGasPrice().catch(()=>{}),i=r;i===void 0&&(i=await P(g[f].tokens.WETH.address,{client:t}).then(a=>BigInt(a.usdE18),()=>{}));let o=n!==void 0&&n>0n&&i!==void 0&&i>0n?{gasPrice:n,ethUsd:i}:void 0,{gasPrice:u,ethUsd:h}=o??{gasPrice:R,ethUsd:x},m=a=>Number(a*u*h)/1e36;return{inUsd:m(E),outUsd:m(C),checks:o?[]:[M]}}async function v(s,r,t={}){let n=s.clientFor(f),i=t.now??Math.floor(Date.now()/1e3),o=await b(s,{allowChain:!1}),u=await T(n,r,o.rows),h=e=>(u.get(e.pt.toLowerCase())??0n)>0n,m=o.rows.filter(e=>e.active&&e.expiry>i||h(e)),[{ok:a,dropped:_},p]=await Promise.all([A(n,m,{now:i}),S(s,t.ethUsdE18)]),y=[...o.dropped,..._],l=[];for(let{row:e,facts:d}of a){let c=d.verified,k={market:e.market,kind:c.kind,unitSymbol:c.inputSymbol,unitDecimals:c.inputDecimals,endsAt:c.expiry,liquidityUsd:e.liquidityUsd??0,ptBalanceBase:u.get(e.pt.toLowerCase())??0n,gasInUsd:p.inUsd,gasOutUsd:p.outUsd};if(c.expired){k.ptBalanceBase>0n&&l.push({...k,ratePct:0,matured:!0,checks:["this term has ended",...p.checks]});continue}if(!e.active)continue;let w=I(e,d.lnImpliedRate);if("reason"in w){y.push(`${e.market}: ${w.reason}`);continue}l.push({...k,ratePct:w.ratePct,matured:!1,checks:[...e.liquidityUsd===void 0?["liquidity was not reported"]:[],...p.checks]})}return l.sort((e,d)=>e.kind===d.kind?e.endsAt-d.endsAt:e.kind==="stable"?-1:1),{terms:l,dropped:y}}async function L(s,r,t={}){return(await v(s,r,t)).terms}export{I as a,v as b,L as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as O,n as F}from"./NWNYJ26T.js";import{b as l}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as R,parseAbi as U}from"viem";var _={source:"https://github.com/beefyfinance/beefy-v2/blob/main/src/config/promos/chain/robinhood.json",observedAt:"2026-10-31",version:2,boosts:[{id:"moo_alandale-cow-robinhood-weth-shop-vault",address:"0xdC955E855148bE11621a74A5B4588846558215d1",token:"0xEBe70034de92614ebe06Cde98C12257f9397dC0e",vaultId:"alandale-cow-robinhood-weth-shop-vault"},{id:"moo_alandale-cow-robinhood-usdg-net-vault",address:"0x3bB573076462ab4E3De4542cFDAa4f36F0Ce082d",token:"0x857b3971E8038a8f8E2C0Da797145447eFbf6b86",vaultId:"alandale-cow-robinhood-usdg-net-vault"},{id:"moo_alandale-cow-robinhood-weth-usdg-vault",address:"0x13ec60CcFFD2cf989912CCBC038D618d3F56a30E",token:"0x4ED469Ac0080bE3CD192530D482E4d321823e743",vaultId:"alandale-cow-robinhood-weth-usdg-vault"},{id:"moo_alandale-cow-robinhood-weth-lute-vault",address:"0xC5ff71a8754c9A9FC0c27EE297025Ea7eEbDD19d",token:"0xd4A452bB077618b931603DbcB60ea43c05eBEa45",vaultId:"alandale-cow-robinhood-weth-lute-vault"},{id:"moo_alandale-cow-robinhood-usdg-lute-vault",address:"0x83a074A41c06c07631e284463ea2bfc3d2f674c5",token:"0xe50D89C43D0D13eE1439Bb5E94876A1163a26434",vaultId:"alandale-cow-robinhood-usdg-lute-vault"},{id:"moo_alandale-cow-robinhood-weth-spy-vault",address:"0xcdDa7830A6F034d66a46919f3D132f53A56a356d",token:"0x87673A619Fc4F3Fc08068A0BB04f60aA2D04ca62",vaultId:"alandale-cow-robinhood-weth-spy-vault"}]};var C=_.boosts.map(c=>({...c,address:R(c.address.toLowerCase()),token:R(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],P=U(["function stakedToken() view returns(address)","function owner() view returns(address)","function whitelisted(address) view returns(bool)","function earned(address) view returns(address[],uint256[])","function stake(uint256)","function withdraw(uint256)","function getReward()","function exit()","function notifyRewardAmount(address,uint256,uint256)","function removeReward(address,address)","function rescueTokens(address,address)","function setWhitelist(address,bool)","function transferOwnership(address)","function renounceOwnership()"]);function w(c){return D(c,"Provide an address.",S)}function x(c){return O(c,"Invalid Beefy reward-pool integer.")}function I(c){return F(c,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}var V=c=>{async function k(e){try{return await e()}catch(o){throw new d(c.plainError(o))}}function A(e,o){if(e.chainId!==void 0&&e.chainId!==l)throw new d("Beefy requires chain 4663.");for(let n of Object.keys(e))if(!["chainId",...o].includes(n))throw new d(`Unsupported Beefy input: ${n}.`)}function T(e){let o=C.find(n=>n.address===w(e.boost));if(!o)throw new d("Choose a pinned Robinhood Beefy v2 boost from beefy_boosts.");return o}async function y(){let e=c.clientFor(l);if(await e.getChainId()!==l)throw new d("The Beefy endpoint must report chain 4663.");let o=x(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:P,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>x(await e.readContract({address:s,abi:B,functionName:"balanceOf",args:[i],blockNumber:o}));async function a(s){let[i,r]=await Promise.all([e.readContract({address:s,abi:B,functionName:"symbol",blockNumber:o}),e.readContract({address:s,abi:B,functionName:"decimals",blockNumber:o})]);if(typeof i!="string"||!i.trim()||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)throw new d("Invalid Beefy boost token metadata.");return{address:s,symbol:i,decimals:r,chainId:l}}async function u(s,i){if(w(await n(s.address,"stakedToken"))!==s.token)throw new d("The Beefy boost staked token no longer matches its pinned configuration.");let r=await n(s.address,"earned",[i]);if(!Array.isArray(r)||r.length!==2||!Array.isArray(r[0])||!Array.isArray(r[1])||r[0].length!==r[1].length||r[0].length>100)throw new d("Invalid Beefy boost rewards.");let m=r[0].map(w);if(new Set(m).size!==m.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(m.map(async(h,g)=>({token:await a(h),amount:x(r[1][g]).toString()})));return{id:s.id,boost:s.address,vaultId:s.vaultId,staked:{token:await a(s.token),amount:(await t(s.address,i)).toString()},rewards:p,block:o.toString(),chainId:l,source:_.source}}return{read:n,balance:t,token:a,pool:u,blockNumber:o}}function f(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:P,functionName:o,args:n}),value:"0",chainId:l,description:`Beefy reward pool: ${o}.`})}async function E(e,o,n,t){return{txs:e,inputs:t,preview:await c.preview(e,o),summary:n}}return{tools:[{name:"beefy_boosts",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=w(o);let n=await y(),t=[];for(let a of C)t.push(await n.pool(a,o));return{boosts:t,summary:"Pinned Robinhood v2 reward pools. Staked moo receipts keep their underlying vault exposure. Earned amounts are estimates; inspect claim preview. Boost receipt acquisition depends on the corresponding vault adapter."}})},{name:"beefy_boost",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["stake","withdraw","claim","exit"],description:"stake: deposit moo receipts into the pool; withdraw: take staked receipts out; claim: collect rewards; exit: withdraw everything and claim."},amount:{description:'For stake and withdraw: amount of moo receipt (stake token) in base units of that token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals. "all" uses the full balance.',anyOf:[v(),{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n=String(e.action);if(!["stake","withdraw","claim","exit"].includes(n))throw new d("Choose stake, withdraw, claim or exit.");A(e,["boost","action",...["stake","withdraw"].includes(n)?["amount"]:[]]),o=w(o);let t=T(e),a=await y();await a.pool(t,o);let u,s=[];if(n==="stake"||n==="withdraw"){let i=n==="stake"?t.token:t.address,r=await a.balance(i,o),m=e.amount==="all"?r:I(e.amount);if(m===0n||m>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:m.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,m.toString(),l)]:[],f(t.address,n,[m])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[f(t.address,n==="claim"?"getReward":"exit")];return E(u,o,`${n} Beefy boost ${t.id}. Withdraw returns moo receipts; exit also claims rewards. Redeem moo receipts with the matching supported vault adapter afterward. No output amount is guaranteed by these calls.`,s)})},{name:"beefy_boost_manage",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"],description:"Owner or manager call: add a reward (notify_reward), remove a reward, rescue stuck tokens, set a manager, transfer ownership, or renounce it permanently."},token:{...b,description:"Address of the reward token for notify_reward, remove_reward or rescue_tokens."},amount:v('For notify_reward: reward amount in base units of the reward token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals.'),duration:v("For notify_reward: reward period in seconds, at least 3600 (86400 = 1 day). Decimal string."),recipient:{...b,description:"Address that receives removed or rescued tokens, or the new owner for transfer_ownership."},manager:{...b,description:"Address of the manager (reward notifier) to enable or disable with set_manager."},enabled:{type:"boolean",description:"For set_manager: true allows the manager to add rewards, false removes them."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n={notify_reward:["token","amount","duration"],remove_reward:["token","recipient"],rescue_tokens:["token","recipient"],set_manager:["manager","enabled"],transfer_ownership:["recipient"],renounce_ownership:[]},t=String(e.action);if(!Object.hasOwn(n,t))throw new d("Choose a documented Beefy reward-pool management action.");A(e,["boost","action",...n[t]]),o=w(o);let a=T(e),u=await y();if(await u.pool(a,o),!(t==="notify_reward"?await u.read(a.address,"whitelisted",[o])===!0:w(await u.read(a.address,"owner"))===o))throw new d("This wallet does not hold the required Beefy reward-pool owner or manager role.");let i=[],r=[];if(t==="notify_reward"){let p=w(e.token),h=I(e.amount),g=I(e.duration);if(p===a.token||g<3600n)throw new d("Reward token must differ from the stake token and duration must be at least 3600 seconds.");if(await u.balance(p,o)<h)throw new d("Insufficient reward token balance.");r.push({token:p,amount:h.toString()}),i.push(c.approval(p,a.address,h.toString(),l),f(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(f(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[w(e.token),w(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(f(a.address,"setWhitelist",[w(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(f(a.address,"transferOwnership",[w(e.recipient)])):i.push(f(a.address,"renounceOwnership"));let m=t==="remove_reward"?" Removing this reward discards all unclaimed entitlements for that token.":t==="renounce_ownership"?" Renouncing ownership permanently gives up owner administration.":"";return E(i,o,`Beefy owner/manager action ${t} on ${a.address}.${m} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=w(e);let o=await y(),n=[];for(let t of C){let a=await o.pool(t,e);a.staked.amount==="0"&&a.rewards.every(u=>u.amount==="0")||n.push({module:"beefy",id:t.address,chainId:l,assets:[a.staked,...a.rewards.filter(u=>u.amount!=="0")],description:`${t.id}: moo receipt stake and estimated claimable rewards at block ${o.blockNumber}. Unstake/exit before redeeming moo receipts.`})}return n})}};export{C as a,H as b,P as c,V as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t}from"./LCH6F5HT.js";import{c as o}from"./QLFPAN6S.js";function s(e,n,a){return t(e,n,a,o)}export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./
|
|
1
|
+
import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./SCG5HWMN.js";import{a as M}from"./5TUXSOMI.js";import{e as c}from"./NWNYJ26T.js";import{b as m,j as x}from"./TI727O2H.js";import{a as l}from"./XSD5NL7J.js";import{a as h}from"./JXOEJPJ4.js";import{getAddress as q,isAddress as F}from"viem";var E=`https://api-v2.pendle.finance/core/v1/${m}/markets?limit=100`,T=x[m].pendle.marketFactory.address;function f(e){if(e?.aborted)throw new l("The request was cancelled.")}var C=e=>typeof e=="number"&&Number.isFinite(e);function p(e){return typeof e=="string"&&F(e,{strict:!1})?q(e):void 0}function I(e){if(!c(e))return"a row was not an object";let t=p(e.address);if(!t)return"a row had no valid market address";let n=c(e.pt)?p(e.pt.address):void 0,r=c(e.yt)?p(e.yt.address):void 0,o=c(e.sy)?p(e.sy.address):void 0;if(!n||!r||!o)return`market ${t} had no valid PT, YT and SY addresses`;let i=typeof e.expiry=="string"?Date.parse(e.expiry):Number.NaN;if(!Number.isFinite(i)||i%1e3!==0||i<=0)return`market ${t} had no valid end date`;if(typeof e.isActive!="boolean")return`market ${t} had no active flag`;let a=c(e.pt)&&typeof e.pt.symbol=="string"?e.pt.symbol:typeof e.name=="string"?e.name:t,s=c(e.liquidity)&&C(e.liquidity.usd)&&e.liquidity.usd>=0?e.liquidity.usd:void 0;return{market:t,sy:o,pt:n,yt:r,expiry:i/1e3,active:e.isActive,label:h(a),source:"api",...C(e.impliedApy)?{impliedApy:e.impliedApy}:{},...s!==void 0?{liquidityUsd:s}:{}}}async function D(e,t={}){let n=await v(e,E,{method:"GET",headers:{"User-Agent":"oak-core/pendle",Accept:"application/json"},...t.signal?{signal:t.signal}:{}},i=>c(i)&&Array.isArray(i.results)),r=[],o=[];for(let i of n.results){let a=I(i);typeof a=="string"?o.push(a):r.push(a)}return{rows:r,dropped:o}}var L=10000000n,B=1000000n,W=52515580n,O=new WeakMap;async function U(e,t,n){f(n);let r=await e.getBlockNumber(),o=L;for(;t.next<=r;){f(n);let i=t.next,a=i+o-1n>r?r:i+o-1n;try{let s=await e.getLogs({address:T,event:S,fromBlock:i,toBlock:a});for(let u of s){let d=p(u.args.market);d&&t.found.add(d)}t.next=a+1n}catch{if(o<=B)throw new l("Oak can't list Pendle markets from the chain because the node refused the history request.");o/=2n}}return[...t.found]}function $(e,t={}){let n=O.get(e);n||(n={next:W,found:new Set,turn:Promise.resolve()},O.set(e,n));let r=n,o=r.turn.then(()=>U(e,r,t.signal));return r.turn=o.catch(()=>{}),o}async function _(e,t,n=Math.floor(Date.now()/1e3),r={}){f(r.signal);let o=await y(e,t.flatMap(s=>[{address:s,abi:b,functionName:"readTokens"},{address:s,abi:b,functionName:"expiry"}])),i=t.flatMap((s,u)=>{let d=o[u*2],k=o[u*2+1];if(!d.ok||!k.ok||!Array.isArray(d.value)||typeof k.value!="bigint")return[];let[w,g,A]=d.value.map(p),R=Number(k.value);return w&&g&&A&&Number.isSafeInteger(R)?[{market:s,sy:w,pt:g,yt:A,end:R}]:[]});f(r.signal);let a=await y(e,i.map(s=>({address:s.pt,abi:N,functionName:"symbol"})));return i.map((s,u)=>{let d=a[u];return{market:s.market,sy:s.sy,pt:s.pt,yt:s.yt,expiry:s.end,active:s.end>n,label:h(d.ok&&typeof d.value=="string"?d.value:s.market),source:"chain"}})}async function Y(e,t,n={}){return _(e,await $(e,n),t,n)}async function X(e,t,n){let[r]=await y(e,[{address:T,abi:P,functionName:"isValidMarket",args:[t]}]);if(!r.ok)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");if(r.value!==!0)throw new l("This isn't a market the Pendle factory created. Oak won't use this market.");let[o]=await _(e,[t],n);if(!o)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");return o}async function Z(e,t){f(t.signal);try{return{source:"api",...await D(e.http,t)}}catch(n){if(!t.allowChain||n instanceof M)throw n;return f(t.signal),{source:"chain",rows:await Y(e.clientFor(m),t.now,t),dropped:[]}}}export{E as a,f as b,D as c,W as d,$ as e,_ as f,Y as g,X as h,Z as i};
|