@oakagentkit/core 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/api/abort-scope.d.ts +2 -0
- package/build/dist/api/abort-scope.js +1 -0
- package/build/dist/api/addresses.d.ts +9 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.d.ts +4 -0
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/http.js +1 -1
- package/build/dist/api/identity-link.js +1 -1
- package/build/dist/api/metadata.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.js +1 -1
- package/build/dist/api/modules/beefy/guard.js +1 -1
- package/build/dist/api/modules/beefy/index.js +1 -1
- package/build/dist/api/modules/beefy/liquidity.js +1 -1
- package/build/dist/api/modules/beefy/management.js +1 -1
- package/build/dist/api/modules/beefy/vaults.js +1 -1
- package/build/dist/api/modules/borro/abi.d.ts +54 -0
- package/build/dist/api/modules/borro/abi.js +1 -1
- package/build/dist/api/modules/borro/actions.d.ts +14 -1
- package/build/dist/api/modules/borro/actions.js +1 -1
- package/build/dist/api/modules/borro/checks.js +1 -1
- package/build/dist/api/modules/borro/copy.d.ts +23 -10
- package/build/dist/api/modules/borro/copy.js +1 -1
- package/build/dist/api/modules/borro/index.js +1 -1
- package/build/dist/api/modules/borro/liquidity.js +1 -1
- package/build/dist/api/modules/borro/pins.d.ts +30 -14
- package/build/dist/api/modules/borro/pins.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/borro/types.d.ts +1 -0
- package/build/dist/api/modules/chop/abi.d.ts +31 -0
- package/build/dist/api/modules/chop/abi.js +1 -1
- package/build/dist/api/modules/chop/actions.js +1 -1
- package/build/dist/api/modules/chop/checks.d.ts +13 -5
- package/build/dist/api/modules/chop/checks.js +1 -1
- package/build/dist/api/modules/chop/copy.d.ts +11 -1
- package/build/dist/api/modules/chop/copy.js +1 -1
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- package/build/dist/api/modules/chop/positions.js +1 -1
- package/build/dist/api/modules/chop/reader.d.ts +132 -7
- package/build/dist/api/modules/chop/reader.js +1 -1
- package/build/dist/api/modules/chop/types.d.ts +12 -0
- package/build/dist/api/modules/clanker/extensions.d.ts +9 -0
- package/build/dist/api/modules/clanker/extensions.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/clanker/manage.js +1 -1
- package/build/dist/api/modules/clanker/pool-config.d.ts +15 -0
- package/build/dist/api/modules/clanker/pool-config.js +1 -1
- package/build/dist/api/modules/clanker/protocol.js +1 -1
- package/build/dist/api/modules/clanker/state.js +1 -1
- package/build/dist/api/modules/earn/copy.d.ts +36 -14
- package/build/dist/api/modules/earn/copy.js +1 -1
- package/build/dist/api/modules/earn/cost.d.ts +11 -1
- package/build/dist/api/modules/earn/cost.js +1 -1
- package/build/dist/api/modules/earn/index.js +1 -1
- package/build/dist/api/modules/earn/lp.d.ts +14 -1
- package/build/dist/api/modules/earn/lp.js +1 -1
- package/build/dist/api/modules/earn/options.d.ts +6 -4
- package/build/dist/api/modules/earn/options.js +1 -1
- package/build/dist/api/modules/erc8004/common.d.ts +1 -1
- package/build/dist/api/modules/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
- package/build/dist/api/modules/erc8004/thesis.js +1 -0
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/factor/abi.d.ts +642 -0
- package/build/dist/api/modules/factor/abi.js +1 -0
- package/build/dist/api/modules/factor/actions.d.ts +15 -0
- package/build/dist/api/modules/factor/actions.js +1 -0
- package/build/dist/api/modules/factor/api.d.ts +7 -0
- package/build/dist/api/modules/factor/api.js +1 -0
- package/build/dist/api/modules/factor/checks.d.ts +11 -0
- package/build/dist/api/modules/factor/checks.js +1 -0
- package/build/dist/api/modules/factor/copy.d.ts +33 -0
- package/build/dist/api/modules/factor/copy.js +1 -0
- package/build/dist/api/modules/factor/guard.d.ts +12 -0
- package/build/dist/api/modules/factor/guard.js +1 -0
- package/build/dist/api/modules/factor/index.d.ts +16 -0
- package/build/dist/api/modules/factor/index.js +8 -0
- package/build/dist/api/modules/factor/messages.d.ts +46 -0
- package/build/dist/api/modules/factor/messages.js +1 -0
- package/build/dist/api/modules/factor/pins.d.ts +64 -0
- package/build/dist/api/modules/factor/pins.js +1 -0
- package/build/dist/api/modules/factor/reader.d.ts +17 -0
- package/build/dist/api/modules/factor/reader.js +1 -0
- package/build/dist/api/modules/factor/types.d.ts +18 -0
- package/build/dist/api/modules/factor/types.js +0 -0
- package/build/dist/api/modules/gloam/copy.d.ts +4 -3
- package/build/dist/api/modules/gloam/copy.js +2 -2
- package/build/dist/api/modules/gloam/index.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.d.ts +29 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/scan.js +1 -1
- package/build/dist/api/modules/heyresearch/status-labels.d.ts +2 -0
- package/build/dist/api/modules/heyresearch/status-labels.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.d.ts +12 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/buyback.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.d.ts +2 -1
- package/build/dist/api/modules/hookr/contracts.js +1 -1
- package/build/dist/api/modules/hookr/create-cancel.js +1 -1
- package/build/dist/api/modules/hookr/discovery.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- package/build/dist/api/modules/hookr/launch.js +1 -1
- package/build/dist/api/modules/hookr/liquidity.js +1 -1
- package/build/dist/api/modules/hookr/lp-positions.js +1 -1
- package/build/dist/api/modules/hookr/lp-reads.d.ts +2 -0
- package/build/dist/api/modules/hookr/lp-reads.js +1 -1
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/read-utils.js +1 -1
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/abi.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/checks.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/merkl.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/layerbank/reserve.js +1 -1
- package/build/dist/api/modules/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/analytics.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/longbow/nft.js +1 -1
- package/build/dist/api/modules/longbow/rebates.js +1 -1
- package/build/dist/api/modules/longbow/staking.js +1 -1
- package/build/dist/api/modules/meridian/index.js +1 -1
- package/build/dist/api/modules/meridian/markets.js +1 -1
- package/build/dist/api/modules/meridian/perps-batch.js +1 -1
- package/build/dist/api/modules/meridian/perps-stream.js +1 -1
- package/build/dist/api/modules/meridian/perps.js +1 -1
- package/build/dist/api/modules/meridian/predict-read.js +1 -1
- package/build/dist/api/modules/meridian/rfq.js +1 -1
- package/build/dist/api/modules/merkl/discovery.js +1 -1
- package/build/dist/api/modules/merkl/index.js +1 -1
- package/build/dist/api/modules/merkl/manage.js +1 -1
- package/build/dist/api/modules/merkl/protocol.js +1 -1
- package/build/dist/api/modules/morpho/allocator.js +1 -1
- package/build/dist/api/modules/morpho/bundles.js +1 -1
- package/build/dist/api/modules/morpho/in-kind.js +1 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.js +1 -1
- package/build/dist/api/modules/morpho/midnight.js +1 -1
- package/build/dist/api/modules/morpho/protocol.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.d.ts +2 -0
- package/build/dist/api/modules/morpho/vault-v2.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
- package/build/dist/api/modules/netnet/card-policy.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/desk-read.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/gateway.js +1 -1
- package/build/dist/api/modules/orbio/index.d.ts +6 -0
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/convert.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/validate.js +1 -1
- package/build/dist/api/modules/pendle/verify.js +1 -1
- package/build/dist/api/modules/pons/claim.js +1 -1
- package/build/dist/api/modules/pons/holder-directory.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/prices.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.js +1 -1
- package/build/dist/api/modules/pons/trade.d.ts +3 -2
- package/build/dist/api/modules/pons/trade.js +1 -1
- package/build/dist/api/modules/poolstrade/index.js +1 -1
- package/build/dist/api/modules/priors/coverage.js +1 -1
- package/build/dist/api/modules/priors/discovery.js +1 -1
- package/build/dist/api/modules/priors/features.js +1 -1
- package/build/dist/api/modules/priors/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.d.ts +1 -0
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/raeto/authorization.d.ts +30 -0
- package/build/dist/api/modules/raeto/authorization.js +1 -0
- package/build/dist/api/modules/raeto/copy.d.ts +46 -0
- package/build/dist/api/modules/raeto/copy.js +1 -0
- package/build/dist/api/modules/raeto/errors.d.ts +4 -0
- package/build/dist/api/modules/raeto/errors.js +1 -0
- package/build/dist/api/modules/raeto/estimate.d.ts +2 -0
- package/build/dist/api/modules/raeto/estimate.js +1 -0
- package/build/dist/api/modules/raeto/index.d.ts +16 -0
- package/build/dist/api/modules/raeto/index.js +1 -0
- package/build/dist/api/modules/raeto/pairing.d.ts +40 -0
- package/build/dist/api/modules/raeto/pairing.js +1 -0
- package/build/dist/api/modules/raeto/pins.d.ts +24 -0
- package/build/dist/api/modules/raeto/pins.js +1 -0
- package/build/dist/api/modules/raeto/templates.d.ts +22 -0
- package/build/dist/api/modules/raeto/templates.js +1 -0
- package/build/dist/api/modules/raeto/terms.d.ts +8 -0
- package/build/dist/api/modules/raeto/terms.js +1 -0
- package/build/dist/api/modules/raeto/types.d.ts +64 -0
- package/build/dist/api/modules/raeto/types.js +0 -0
- package/build/dist/api/modules/relay/api.d.ts +16 -0
- package/build/dist/api/modules/relay/api.js +1 -1
- package/build/dist/api/modules/relay/bootstrap.js +1 -1
- package/build/dist/api/modules/relay/discovery.js +1 -1
- package/build/dist/api/modules/relay/inbound.js +1 -1
- package/build/dist/api/modules/relay/index.d.ts +1 -0
- package/build/dist/api/modules/relay/index.js +1 -1
- package/build/dist/api/modules/relay/order.js +1 -1
- package/build/dist/api/modules/relay/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/readiness.d.ts +1 -0
- package/build/dist/api/modules/relay/readiness.js +1 -1
- package/build/dist/api/modules/relay/reads.js +1 -1
- package/build/dist/api/modules/relay/vaults.js +1 -1
- package/build/dist/api/modules/spark/actions.js +1 -1
- package/build/dist/api/modules/spark/details.js +1 -1
- package/build/dist/api/modules/spark/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/discovery.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.d.ts +1 -0
- package/build/dist/api/modules/tickerspring/journeys.js +1 -1
- package/build/dist/api/modules/tickerspring/ladder.js +1 -1
- package/build/dist/api/modules/tickerspring/maker.js +1 -1
- package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
- package/build/dist/api/modules/tickerspring/research.js +1 -1
- package/build/dist/api/modules/tickerspring/strategies.js +1 -1
- package/build/dist/api/modules/uniswap/auction-create.js +1 -1
- package/build/dist/api/modules/uniswap/auction.js +1 -1
- package/build/dist/api/modules/uniswap/batch.js +1 -1
- package/build/dist/api/modules/uniswap/common.js +1 -1
- package/build/dist/api/modules/uniswap/fee-percent.d.ts +4 -0
- package/build/dist/api/modules/uniswap/fee-percent.js +1 -0
- package/build/dist/api/modules/uniswap/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- package/build/dist/api/modules/uniswap/local-guard.d.ts +2 -0
- package/build/dist/api/modules/uniswap/local-guard.js +1 -1
- package/build/dist/api/modules/uniswap/oracle.js +1 -1
- package/build/dist/api/modules/uniswap/pool-math.js +1 -1
- package/build/dist/api/modules/uniswap/pools.d.ts +2 -0
- package/build/dist/api/modules/uniswap/pools.js +1 -1
- package/build/dist/api/modules/uniswap/position.js +1 -1
- package/build/dist/api/modules/uniswap/protocol.js +1 -1
- package/build/dist/api/modules/uniswap/quote-guard.d.ts +38 -0
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -0
- package/build/dist/api/modules/uniswap/token-jar.js +1 -1
- package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
- package/build/dist/api/modules/uniswap/trade.d.ts +10 -3
- package/build/dist/api/modules/uniswap/trade.js +1 -1
- package/build/dist/api/modules/uniswap/v2.js +1 -1
- package/build/dist/api/modules/uniswap/v3.js +1 -1
- package/build/dist/api/modules/uniswap/v4.d.ts +6 -0
- package/build/dist/api/modules/uniswap/v4.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/upoch/copy.d.ts +5 -0
- package/build/dist/api/modules/upoch/copy.js +1 -0
- package/build/dist/api/modules/upoch/index.d.ts +8 -0
- package/build/dist/api/modules/upoch/index.js +1 -0
- package/build/dist/api/modules/upoch/pins.d.ts +8 -0
- package/build/dist/api/modules/upoch/pins.js +1 -0
- package/build/dist/api/modules/upoch/reads.d.ts +509 -0
- package/build/dist/api/modules/upoch/reads.js +1 -0
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/scan-text.js +1 -1
- package/build/dist/api/modules/wormhole/swap-token-verdict.js +1 -1
- package/build/dist/api/modules/wormhole/third-party-text.d.ts +14 -3
- package/build/dist/api/modules/wormhole/third-party-text.js +1 -1
- package/build/dist/api/modules/wormhole/token-check.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
- package/build/dist/api/modules/wormhole/x402-client.js +1 -1
- package/build/dist/api/oak-fee.d.ts +12 -0
- package/build/dist/api/oak-fee.js +1 -0
- package/build/dist/api/param-text.d.ts +22 -0
- package/build/dist/api/param-text.js +1 -0
- package/build/dist/api/position-economics.d.ts +70 -0
- package/build/dist/api/position-economics.js +1 -0
- package/build/dist/api/positions.d.ts +8 -5
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.d.ts +3 -0
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/pricing.js +1 -1
- package/build/dist/api/progress.d.ts +7 -0
- package/build/dist/api/progress.js +1 -0
- package/build/dist/api/read-budgets.d.ts +4 -0
- package/build/dist/api/read-budgets.js +1 -0
- package/build/dist/api/read-shape.d.ts +45 -0
- package/build/dist/api/read-shape.js +1 -0
- package/build/dist/api/revert.d.ts +23 -0
- package/build/dist/api/revert.js +1 -0
- package/build/dist/api/routes.js +1 -1
- package/build/dist/api/rpc.d.ts +1 -0
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/secret-fields.d.ts +2 -0
- package/build/dist/api/secret-fields.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.d.ts +8 -0
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/signing.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.d.ts +4 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.d.ts +1 -0
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.d.ts +1 -0
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/types.d.ts +3 -0
- package/build/dist/api/untrusted-unwrap.d.ts +1 -0
- package/build/dist/api/untrusted-unwrap.js +1 -0
- package/build/dist/api/usd-estimate.d.ts +23 -0
- package/build/dist/api/usd-estimate.js +1 -0
- package/build/dist/api/vendor-limits.js +1 -1
- package/build/dist/chunks/23HNDJ76.js +2 -0
- package/build/dist/chunks/24Q3FNGX.js +1 -0
- package/build/dist/chunks/25C4DTVA.js +1 -0
- package/build/dist/chunks/2GXHYI23.js +1 -0
- package/build/dist/chunks/2HN3U6OG.js +1 -0
- package/build/dist/chunks/{QU5XKRGK.js → 2OVJ2BTJ.js} +1 -1
- package/build/dist/chunks/{FUDAXV5X.js → 2QGLPY2D.js} +1 -1
- package/build/dist/chunks/2WRXH6BL.js +1 -0
- package/build/dist/chunks/2ZBSE2LD.js +2 -0
- package/build/dist/chunks/2ZQ7X223.js +1 -0
- package/build/dist/chunks/2ZWKIBJT.js +1 -0
- package/build/dist/chunks/3A2IKFTV.js +1 -0
- package/build/dist/chunks/3CH2IPQL.js +1 -0
- package/build/dist/chunks/3PU2SD3U.js +2 -0
- package/build/dist/chunks/{ER47KGRM.js → 3ZH5SOC2.js} +1 -1
- package/build/dist/chunks/4NBXBKOX.js +2 -0
- package/build/dist/chunks/{WV3A3OUU.js → 4PLLS6CT.js} +1 -1
- package/build/dist/chunks/4R3G3H42.js +1 -0
- package/build/dist/chunks/4TTDAF4B.js +1 -0
- package/build/dist/chunks/4Z3IGMU6.js +1 -0
- package/build/dist/chunks/5DPJQCKJ.js +68 -0
- package/build/dist/chunks/{SJJR4ZBZ.js → 5GQJVKVY.js} +1 -1
- package/build/dist/chunks/5R576SDB.js +1 -0
- package/build/dist/chunks/5RXALTDT.js +1 -0
- package/build/dist/chunks/5TUXSOMI.js +1 -0
- package/build/dist/chunks/5UAXLWJ2.js +1 -0
- package/build/dist/chunks/{QQECG3WP.js → 5W74Z4WZ.js} +1 -1
- package/build/dist/chunks/5XAXJEWM.js +5 -0
- package/build/dist/chunks/65356YKW.js +1 -0
- package/build/dist/chunks/65OITTDL.js +1 -0
- package/build/dist/chunks/6F527FLN.js +1 -0
- package/build/dist/chunks/6MDYKE2O.js +1 -0
- package/build/dist/chunks/6OCLWSMZ.js +1 -0
- package/build/dist/chunks/75SULXNT.js +1 -0
- package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
- package/build/dist/chunks/7U62MMUQ.js +1 -0
- package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
- package/build/dist/chunks/A2V4NFVA.js +1 -0
- package/build/dist/chunks/A3BJSQ23.js +1 -0
- package/build/dist/chunks/ACH4BSME.js +3 -0
- package/build/dist/chunks/ADIPEGNN.js +1 -0
- package/build/dist/chunks/AHUCYDBC.js +1 -0
- package/build/dist/chunks/ANIF3JMV.js +4 -0
- package/build/dist/chunks/{ALLLYOUG.js → ATEVAJ5Y.js} +1 -1
- package/build/dist/chunks/B2HSLY5F.js +1 -0
- package/build/dist/chunks/{WTXC3XKW.js → B7BNDW35.js} +1 -1
- package/build/dist/chunks/BE3A7677.js +1 -0
- package/build/dist/chunks/{PAY5PD4H.js → BX46C5ZP.js} +1 -1
- package/build/dist/chunks/C3WBHFLX.js +1 -0
- package/build/dist/chunks/C6VJAL5B.js +1 -0
- package/build/dist/chunks/C76D54YG.js +1 -0
- package/build/dist/chunks/CD2JQ32C.js +1 -0
- package/build/dist/chunks/CI5ENLYA.js +1 -0
- package/build/dist/chunks/CNLL4NCR.js +1 -0
- package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
- package/build/dist/chunks/CSOO4SW7.js +1 -0
- package/build/dist/chunks/CZL6T2ZQ.js +1 -0
- package/build/dist/chunks/CZQ2CGYV.js +1 -0
- package/build/dist/chunks/D2IYA4LP.js +1 -0
- package/build/dist/chunks/D7QXZM3S.js +1 -0
- package/build/dist/chunks/{GNC6RXLT.js → DBOGRUPS.js} +1 -1
- package/build/dist/chunks/DGCJZ3HO.js +1 -0
- package/build/dist/chunks/DGDMRATN.js +1 -0
- package/build/dist/chunks/DMB64UIN.js +1 -0
- package/build/dist/chunks/DMDOSHV7.js +1 -0
- package/build/dist/chunks/DRLBTB4E.js +1 -0
- package/build/dist/chunks/E76Z2TT4.js +1 -0
- package/build/dist/chunks/EFESPGA2.js +1 -0
- package/build/dist/chunks/EHK7CDTU.js +1 -0
- package/build/dist/chunks/ELHRXA5U.js +1 -0
- package/build/dist/chunks/F7MGYRPU.js +1 -0
- package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
- package/build/dist/chunks/{QBIY6FQN.js → FGEGJOAA.js} +1 -1
- package/build/dist/chunks/FHTNMGFR.js +1 -0
- package/build/dist/chunks/FN6GNTPR.js +1 -0
- package/build/dist/chunks/{EGYVRQUR.js → FTMA24EC.js} +1 -1
- package/build/dist/chunks/FXOFR432.js +1 -0
- package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
- package/build/dist/chunks/G2LAO23N.js +1 -0
- package/build/dist/chunks/{WIRBCS4W.js → GBIBRYOV.js} +1 -1
- package/build/dist/chunks/GDOHHXNH.js +1 -0
- package/build/dist/chunks/{GSBIERZD.js → GP6YO24Z.js} +1 -1
- package/build/dist/chunks/GQ3XZFRL.js +1 -0
- package/build/dist/chunks/{4HG6FRVH.js → GQITAJVF.js} +1 -1
- package/build/dist/chunks/H3E7UD2X.js +1 -0
- package/build/dist/chunks/HFVXNKA5.js +1 -0
- package/build/dist/chunks/HHYE42JG.js +21 -0
- package/build/dist/chunks/HRAHGYNK.js +1 -0
- package/build/dist/chunks/HS5HWBMU.js +1 -0
- package/build/dist/chunks/{BND2UFVW.js → HVFMIURK.js} +1 -1
- package/build/dist/chunks/IBL6TL2Q.js +1 -0
- package/build/dist/chunks/IT2JLILU.js +1 -0
- package/build/dist/chunks/IV4K7FMD.js +1 -0
- package/build/dist/chunks/{PNA6UIE5.js → JDSSYT6R.js} +1 -1
- package/build/dist/chunks/JFWJBZ7M.js +1 -0
- package/build/dist/chunks/JI5DXDMY.js +1 -0
- package/build/dist/chunks/JJGZ7W3V.js +1 -0
- package/build/dist/chunks/JPPQDELB.js +18 -0
- package/build/dist/chunks/{OLSP46ZD.js → K4P5VYDP.js} +1 -1
- package/build/dist/chunks/{JFYBH3DX.js → K6D6SDIG.js} +1 -1
- package/build/dist/chunks/K7HTDKAT.js +1 -0
- package/build/dist/chunks/KBU3PYP7.js +1 -0
- package/build/dist/chunks/KH4QFN72.js +3 -0
- package/build/dist/chunks/KMSAUFYV.js +1 -0
- package/build/dist/chunks/{RTAHNWHN.js → KOTGFD2V.js} +1 -1
- package/build/dist/chunks/KZA5GYZR.js +1 -0
- package/build/dist/chunks/LCH6F5HT.js +1 -0
- package/build/dist/chunks/LDJI2JAL.js +1 -0
- package/build/dist/chunks/LEV5SNNC.js +3 -0
- package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
- package/build/dist/chunks/{PIIHOXWF.js → LJJYYUEG.js} +1 -1
- package/build/dist/chunks/LKX5WDOQ.js +1 -0
- package/build/dist/chunks/LVFI74ST.js +1 -0
- package/build/dist/chunks/M7BUKZW2.js +1 -0
- package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
- package/build/dist/chunks/MMCM3GSM.js +1 -0
- package/build/dist/chunks/MQ5F2VOK.js +1 -0
- package/build/dist/chunks/MSMHS456.js +1 -0
- package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
- package/build/dist/chunks/{XSKFKBDR.js → N64JJN37.js} +1 -1
- package/build/dist/chunks/NAO7VWZF.js +1 -0
- package/build/dist/chunks/ND32LJWI.js +1 -0
- package/build/dist/chunks/{Q42YI3EP.js → NMJVQX5M.js} +1 -1
- package/build/dist/chunks/NMQBOBWJ.js +1 -0
- package/build/dist/chunks/NQ4MTIU3.js +1 -0
- package/build/dist/chunks/NWPAQER2.js +1 -0
- package/build/dist/chunks/O2J5I4VA.js +1 -0
- package/build/dist/chunks/O4S6XAYV.js +1 -0
- package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
- package/build/dist/chunks/{RUC7KH7A.js → OB7BFDOV.js} +1 -1
- package/build/dist/chunks/OEZ7FCLF.js +1 -0
- package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
- package/build/dist/chunks/{WP6RHXGN.js → OIQTZOBN.js} +1 -1
- package/build/dist/chunks/OODSXDIH.js +1 -0
- package/build/dist/chunks/OOPMZIG7.js +1 -0
- package/build/dist/chunks/OQFNUDMQ.js +1 -0
- package/build/dist/chunks/ORG6LVKJ.js +1 -0
- package/build/dist/chunks/{CBLMQ5UU.js → OSMOBKRQ.js} +1 -1
- package/build/dist/chunks/OTLUQWLF.js +1 -0
- package/build/dist/chunks/{2MT3G7YZ.js → OTYB6BHK.js} +1 -1
- package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
- package/build/dist/chunks/{SMYWWIE6.js → OVM4QIET.js} +1 -1
- package/build/dist/chunks/OYDKAIS2.js +1 -0
- package/build/dist/chunks/P6OB2AFW.js +1 -0
- package/build/dist/chunks/PDPTJMTJ.js +1 -0
- package/build/dist/chunks/PEHXHQVA.js +1 -0
- package/build/dist/chunks/PMFR47H3.js +1 -0
- package/build/dist/chunks/PQXYTOV5.js +1 -0
- package/build/dist/chunks/PSGRZWES.js +1 -0
- package/build/dist/chunks/PZEF5LBL.js +2 -0
- package/build/dist/chunks/Q7L3BX6U.js +1 -0
- package/build/dist/chunks/QBYV7NXH.js +1 -0
- package/build/dist/chunks/QIB6OMQV.js +1 -0
- package/build/dist/chunks/QLAOBULN.js +1 -0
- package/build/dist/chunks/QLFPAN6S.js +1 -0
- package/build/dist/chunks/QMEGAKLI.js +1 -0
- package/build/dist/chunks/QMNUB2GM.js +2 -0
- package/build/dist/chunks/QMZEGT5B.js +1 -0
- package/build/dist/chunks/R73R4KN3.js +1 -0
- package/build/dist/chunks/RN3WUJIO.js +1 -0
- package/build/dist/chunks/RNCMXKKS.js +1 -0
- package/build/dist/chunks/ROQQ62LP.js +1 -0
- package/build/dist/chunks/RUTSEGGD.js +1 -0
- package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
- package/build/dist/chunks/{2VXLVXIB.js → S4UJDZGN.js} +1 -1
- package/build/dist/chunks/SCG5HWMN.js +1 -0
- package/build/dist/chunks/{XQA5LCL6.js → SENOU5JR.js} +1 -1
- package/build/dist/chunks/SMSXZ3FN.js +1 -0
- package/build/dist/chunks/SUNTJ6IU.js +1 -0
- package/build/dist/chunks/SZ466I5X.js +1 -0
- package/build/dist/chunks/TGFQQCRY.js +1 -0
- package/build/dist/chunks/{K4DHHQBI.js → THL4TMQW.js} +2 -2
- package/build/dist/chunks/TI727O2H.js +1 -0
- package/build/dist/chunks/{UD2XMNIT.js → TMRAF2L2.js} +1 -1
- package/build/dist/chunks/TNJTET4G.js +1 -0
- package/build/dist/chunks/TVIMP5CK.js +1 -0
- package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
- package/build/dist/chunks/U243AWCH.js +1 -0
- package/build/dist/chunks/U762746N.js +1 -0
- package/build/dist/chunks/U7UPLF4F.js +1 -0
- package/build/dist/chunks/{7QIO77VE.js → UPKVD7WG.js} +1 -1
- package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
- package/build/dist/chunks/USEF3QKG.js +1 -0
- package/build/dist/chunks/UVAR6BHU.js +1 -0
- package/build/dist/chunks/V5YSJKRH.js +70 -0
- package/build/dist/chunks/VB36EHIR.js +1 -0
- package/build/dist/chunks/VMZYFO6I.js +1 -0
- package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
- package/build/dist/chunks/{U4JGEMKT.js → VVAM3EAK.js} +1 -1
- package/build/dist/chunks/VVJO6OYK.js +1 -0
- package/build/dist/chunks/VVWFB53Q.js +1 -0
- package/build/dist/chunks/VXCGMALF.js +1 -0
- package/build/dist/chunks/VZVW5J7J.js +1 -0
- package/build/dist/chunks/W32UECOL.js +1 -0
- package/build/dist/chunks/{XD6X3KTC.js → W4RYRLL5.js} +1 -1
- package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
- package/build/dist/chunks/WBNFRPAT.js +1 -0
- package/build/dist/chunks/{AFBEZXNV.js → WNWRF4HE.js} +1 -1
- package/build/dist/chunks/{4DP2VPXR.js → WOGWLFAL.js} +1 -1
- package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
- package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
- package/build/dist/chunks/X24YTJST.js +1 -0
- package/build/dist/chunks/{IPN6Z4JM.js → X5AL3DUK.js} +1 -1
- package/build/dist/chunks/XBNZ7GTY.js +1 -0
- package/build/dist/chunks/{XL3LLGIR.js → XEBMS5KU.js} +1 -1
- package/build/dist/chunks/XEPCDGN2.js +1 -0
- package/build/dist/chunks/{KIFZ5ZSK.js → XL3W7DAQ.js} +1 -1
- package/build/dist/chunks/{DL6AEWEM.js → XPWGPZ2C.js} +1 -1
- package/build/dist/chunks/{T7TFUH5K.js → XRDLMTBJ.js} +1 -1
- package/build/dist/chunks/XTFRPI4G.js +1 -0
- package/build/dist/chunks/XV3YJ4P6.js +1 -0
- package/build/dist/chunks/XW3VGWXK.js +1 -0
- package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
- package/build/dist/chunks/Y64GFBTA.js +1 -0
- package/build/dist/chunks/YARZE7SJ.js +1 -0
- package/build/dist/chunks/YBLJ75U5.js +1 -0
- package/build/dist/chunks/YEIM6BZQ.js +1 -0
- package/build/dist/chunks/YRSAZTTC.js +7 -0
- package/build/dist/chunks/YXXK6EPI.js +1 -0
- package/build/dist/chunks/Z3IBPCY4.js +2 -0
- package/build/dist/chunks/{QHBS3PVU.js → Z7FGEWO2.js} +1 -1
- package/build/dist/chunks/ZNPVBNC5.js +1 -0
- package/build/dist/chunks/ZQ6AF3VX.js +1 -0
- package/build/dist/chunks/ZTKT3ZQK.js +1 -0
- package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/2THSW4QN.js +0 -1
- package/build/dist/chunks/2TK3ETUO.js +0 -1
- package/build/dist/chunks/35KR3VSS.js +0 -1
- package/build/dist/chunks/3GQ7A3VB.js +0 -1
- package/build/dist/chunks/3XNZUIRU.js +0 -1
- package/build/dist/chunks/46547QT3.js +0 -1
- package/build/dist/chunks/4EN6MQEI.js +0 -1
- package/build/dist/chunks/4I3OU56B.js +0 -1
- package/build/dist/chunks/52ELWNXJ.js +0 -2
- package/build/dist/chunks/5AXWBSPG.js +0 -1
- package/build/dist/chunks/5N3O42X6.js +0 -1
- package/build/dist/chunks/5SMVQCAP.js +0 -1
- package/build/dist/chunks/5SZPNZG4.js +0 -1
- package/build/dist/chunks/64GOINYS.js +0 -1
- package/build/dist/chunks/6I4NTKB2.js +0 -1
- package/build/dist/chunks/6JAXZNZ3.js +0 -1
- package/build/dist/chunks/6O3Q5B6M.js +0 -1
- package/build/dist/chunks/6OGDTEGH.js +0 -1
- package/build/dist/chunks/6WZX7C4T.js +0 -2
- package/build/dist/chunks/6YB3VOUL.js +0 -1
- package/build/dist/chunks/7GJ6SLEV.js +0 -1
- package/build/dist/chunks/7KWZ5QJU.js +0 -1
- package/build/dist/chunks/7QZOTRSA.js +0 -2
- package/build/dist/chunks/7WSHW7KW.js +0 -1
- package/build/dist/chunks/A7I4IWUB.js +0 -1
- package/build/dist/chunks/ABPL3ZZI.js +0 -1
- package/build/dist/chunks/ACW63WIL.js +0 -20
- package/build/dist/chunks/AEL62KCG.js +0 -1
- package/build/dist/chunks/AKYF5264.js +0 -7
- package/build/dist/chunks/AW7AXQCZ.js +0 -1
- package/build/dist/chunks/AXRL3REN.js +0 -1
- package/build/dist/chunks/BBTPRZ6T.js +0 -1
- package/build/dist/chunks/BOVMED7R.js +0 -1
- package/build/dist/chunks/BTPXJAUX.js +0 -1
- package/build/dist/chunks/C7AXJHBT.js +0 -1
- package/build/dist/chunks/CBG5HARQ.js +0 -2
- package/build/dist/chunks/CDPSMI3Z.js +0 -1
- package/build/dist/chunks/CHXBOXOD.js +0 -1
- package/build/dist/chunks/CQEJSCFQ.js +0 -1
- package/build/dist/chunks/DBNTZEAJ.js +0 -1
- package/build/dist/chunks/DHUDSOGR.js +0 -18
- package/build/dist/chunks/DJN3JAWB.js +0 -1
- package/build/dist/chunks/E3RACZUY.js +0 -1
- package/build/dist/chunks/FEYAY6OZ.js +0 -1
- package/build/dist/chunks/FJ4S4GHY.js +0 -1
- package/build/dist/chunks/FWD4L3CJ.js +0 -1
- package/build/dist/chunks/GG6Y4OCJ.js +0 -1
- package/build/dist/chunks/GGHBFLRC.js +0 -1
- package/build/dist/chunks/GGSAKCND.js +0 -1
- package/build/dist/chunks/GRQYTVNT.js +0 -1
- package/build/dist/chunks/H6T5FXEX.js +0 -1
- package/build/dist/chunks/HHXBUYHO.js +0 -1
- package/build/dist/chunks/HKEMQBFA.js +0 -1
- package/build/dist/chunks/HQUVB7Z5.js +0 -3
- package/build/dist/chunks/HU7IMNBI.js +0 -1
- package/build/dist/chunks/HWX36XJI.js +0 -1
- package/build/dist/chunks/I26DMNJG.js +0 -1
- package/build/dist/chunks/I55MURSJ.js +0 -1
- package/build/dist/chunks/IMO3GDA5.js +0 -1
- package/build/dist/chunks/IPRVIKYC.js +0 -1
- package/build/dist/chunks/IVX4R5OL.js +0 -1
- package/build/dist/chunks/JQOQMFWD.js +0 -3
- package/build/dist/chunks/JUZ5JU6D.js +0 -70
- package/build/dist/chunks/JZS3E66E.js +0 -1
- package/build/dist/chunks/K3RDPI5J.js +0 -1
- package/build/dist/chunks/KBKK7UNY.js +0 -1
- package/build/dist/chunks/KVFZKPJT.js +0 -1
- package/build/dist/chunks/L5BLHY34.js +0 -1
- package/build/dist/chunks/LKXO2BQS.js +0 -1
- package/build/dist/chunks/LKZX4CAA.js +0 -1
- package/build/dist/chunks/LYMNHO5T.js +0 -1
- package/build/dist/chunks/M2UXYCKH.js +0 -1
- package/build/dist/chunks/M37654RL.js +0 -1
- package/build/dist/chunks/M6LC6DRE.js +0 -1
- package/build/dist/chunks/MOE3EVAL.js +0 -1
- package/build/dist/chunks/N4Q6GN65.js +0 -1
- package/build/dist/chunks/NAZPDRIF.js +0 -1
- package/build/dist/chunks/NKX3FE34.js +0 -1
- package/build/dist/chunks/NKZKKCK2.js +0 -1
- package/build/dist/chunks/NOFUKKP5.js +0 -1
- package/build/dist/chunks/O6ROOKY2.js +0 -1
- package/build/dist/chunks/OJ4WJUPP.js +0 -1
- package/build/dist/chunks/OOZSE2R7.js +0 -1
- package/build/dist/chunks/OTXSKFUD.js +0 -1
- package/build/dist/chunks/P5AJSLZ7.js +0 -1
- package/build/dist/chunks/PACN53TR.js +0 -1
- package/build/dist/chunks/PAHXBLCS.js +0 -1
- package/build/dist/chunks/PK66GCDT.js +0 -1
- package/build/dist/chunks/PSBQWDYI.js +0 -1
- package/build/dist/chunks/PXT5YTWU.js +0 -1
- package/build/dist/chunks/PZGGE5D3.js +0 -1
- package/build/dist/chunks/QA2RRIES.js +0 -1
- package/build/dist/chunks/QA3UHEO3.js +0 -1
- package/build/dist/chunks/QFNT73OF.js +0 -1
- package/build/dist/chunks/QW2OPEYJ.js +0 -1
- package/build/dist/chunks/QYVREJYC.js +0 -1
- package/build/dist/chunks/ROFPXEQ5.js +0 -2
- package/build/dist/chunks/RTGS7RIO.js +0 -1
- package/build/dist/chunks/RUX3RY7Y.js +0 -1
- package/build/dist/chunks/RVDUSNWW.js +0 -1
- package/build/dist/chunks/S5CBVFHY.js +0 -1
- package/build/dist/chunks/SIYUNOLI.js +0 -1
- package/build/dist/chunks/TEJ7W534.js +0 -1
- package/build/dist/chunks/TPBAFS7K.js +0 -1
- package/build/dist/chunks/TVWMTMEF.js +0 -1
- package/build/dist/chunks/U2RMUVVY.js +0 -1
- package/build/dist/chunks/U5PMVP56.js +0 -1
- package/build/dist/chunks/V5JWGWXC.js +0 -1
- package/build/dist/chunks/VCOTCVKN.js +0 -1
- package/build/dist/chunks/VEQBHI6O.js +0 -1
- package/build/dist/chunks/VNV6ZISN.js +0 -1
- package/build/dist/chunks/VYAJXLND.js +0 -1
- package/build/dist/chunks/WCNHZYQQ.js +0 -1
- package/build/dist/chunks/WLMWWEP7.js +0 -2
- package/build/dist/chunks/X2P55AC3.js +0 -1
- package/build/dist/chunks/XBE3B6Y2.js +0 -1
- package/build/dist/chunks/XKSVTN5X.js +0 -1
- package/build/dist/chunks/XSRIJUFU.js +0 -1
- package/build/dist/chunks/YCZPSMZ5.js +0 -1
- package/build/dist/chunks/YDNTY67T.js +0 -1
- package/build/dist/chunks/YN56C7PN.js +0 -1
- package/build/dist/chunks/YRNXGQJC.js +0 -1
- package/build/dist/chunks/YWRLY5EA.js +0 -1
- package/build/dist/chunks/YWSX6IE6.js +0 -1
- package/build/dist/chunks/YXTSWRV5.js +0 -1
- package/build/dist/chunks/Z6LZGCVW.js +0 -1
- package/build/dist/chunks/ZQWZGH7V.js +0 -1
- package/build/dist/chunks/ZSN4IRI5.js +0 -1
- package/build/dist/chunks/ZV5HIQXC.js +0 -1
- package/build/dist/chunks/ZXJ24B4L.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ie,b as le,c as de,d as Z}from"./VST6LFUB.js";import{a as D,b as Y}from"./KH4QFN72.js";import{c as ae}from"./SCG5HWMN.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as re,e as h,g,i as oe}from"./NWNYJ26T.js";import{b as v,j as ne,m as F,o as se}from"./TI727O2H.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as E,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,re)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(s=>O(s,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,d])=>[s,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function W(e,t,o){let s=e.clientFor(v),[d,a]=await Promise.all([s.readContract({address:t,abi:E,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:E,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),r=e.clientFor(v),m=await r.getBlockNumber({cacheTime:0}),k=await D(e,o,m),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(se),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([W(e,o,n),r.readContract({address:o,abi:E,functionName:"totalSupply",blockNumber:n})]),J=c=>1+R.filter(b=>BigInt(b.balance)>BigInt(c)).length,B=async(c,b)=>{let M=await r.readContract({address:o,abi:E,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:b,indexedRank:b===null||_.has(c)?null:J(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(M.toString(),q.toString()),balance:{token:G,amount:M.toString()},matchesIndex:b===null?null:M.toString()===b}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=s?i.rows.find(c=>g(c.wallet,s)):void 0,H=s?{...await B(s,V?.balance??null),excluded:_.get(s)??null,rankStatus:_.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(b=>g(b.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>g(b.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await D(e,u,r);let[w,_]=await Promise.all([W(e,u,r),a.readContract({address:u,abi:E,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),d=s.items.filter(r=>g(r.launch.factory,F)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:p(r.volumeUsd),trades:p(r.trades),traders:p(r.traders),change:p(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>g(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(s.generatedAt),latestDay:p(s.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:p(r.block),time:p(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&C.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:p(r.decimals),usd:p(r.usd),counterparty:typeof r.counterparty=="string"&&C.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=r.items.filter(i=>g(i.factory,F)&&g(i.deployer,s)).slice(0,d);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),r=await D(e,s,l),m=ne[v].pons.buybackVault.address,k=[],i=async(y,K)=>{try{return await K()}catch{return k.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),w=y=>i(y,()=>a.readContract({address:m,abi:ue,functionName:y,args:[s],blockNumber:l})),[_,R,G,q,J,B,A,V,H,c,b,M,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),W(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(J),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(b),vestingStart:S(M),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),s=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await D(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?r>=pe?r-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>r||r>a||r-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:be,fromBlock:m,toBlock:r,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await W(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,d){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await d(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{description:'Choose "overview" for totals, "burn" for burns or "buyback" for buybacks; defaults to overview.',type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:{...P,description:"Wallet address to inspect; defaults to the signing wallet."},cursor:{description:"Pagination cursor returned by the previous call to this tool.",type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."}},(o,s)=>_e(e,o,s)),t("pons_trades",{token:{...P,description:"Address of the token to inspect or use."},fromBlock:X("First block number of the scan, as a decimal string; inclusive."),toBlock:X("Last block number of the scan, as a decimal string; inclusive."),limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:{...P,description:"Wallet profile address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,xe as b,Le as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as O,h as Y}from"./X24YTJST.js";import{a as N}from"./A3PN3PK3.js";import{a as j}from"./43LI5NKJ.js";import{b as s,k as S}from"./TI727O2H.js";import{a as n}from"./XSD5NL7J.js";import{getAddress as c}from"viem";var R=["one_hour","six_hours","one_day","seven_days","thirty_days","ninety_days","one_year","inception"],A=["one_day","seven_days","thirty_days","ninety_days","one_year","inception"],P={apy:["v1","apy-averages"],allocations:["v0","allocations"],history:["v0","state/history"],pending_governance:["v0","pending-governance-actions"]};function f(o){if(!o||typeof o!="object"||Array.isArray(o))throw new n("Morpho analytics returned an invalid object.");return o}function _(o){if(typeof o!="string"||!/^\d+$/.test(o)||BigInt(o)>=1n<<256n)throw new n("Morpho analytics returned an invalid decimal base-unit amount.");return o}function H(o,d){let r=f(o);if(![s,String(s)].includes(r.chain_id)||typeof r.vault_address!="string"||c(r.vault_address)!==c(d))throw new n("Morpho analytics returned another chain or vault.")}function b(o,d=0){if(d>12)throw new n("Morpho analytics response is too deeply nested.");if(Array.isArray(o))return o.map(r=>b(r,d+1));if(o&&typeof o=="object")return Object.fromEntries(Object.entries(o).map(([r,e])=>{if(e!==null&&/(?:_assets|_shares|_supply|_cap|_wad|_ray)$/.test(r)&&typeof e!="object")return[r,_(e)];if(e!==null&&/_address$/.test(r)){if(typeof e!="string")throw new n("Morpho analytics returned an invalid address.");return[r,c(e)]}return[r,b(e,d+1)]}));if(typeof o=="number"&&!Number.isFinite(o))throw new n("Morpho analytics returned a non-finite value.");return o}function G(o,d,r){return{name:d,inputSchema:{type:"object",additionalProperties:!1,required:["view"],properties:{view:{type:"string",enum:Object.keys(P),description:'Which analytics to read (required): "apy" realized yield over a lookback; "allocations" where the vault funds sit; "history" past totals and share price; "pending_governance" queued curator changes.'},lookback:{type:"string",enum:R,description:"APY window: one_hour through inception. History: one_day, seven_days, thirty_days, ninety_days, one_year or inception. Defaults to six_hours for APY or seven_days for history."},cursor:{type:"string",maxLength:4096,description:"Opaque cursor from pending_governance only."},limit:{type:"integer",minimum:1,maximum:100,description:"Rows per page, 1 to 100 (defaults to 100). Only for view pending_governance; use cursor for the next page."}},allOf:[{if:{properties:{view:{const:"history",description:'When view is "history".'}},required:["view"]},then:{properties:{lookback:{enum:A,description:"History window: one_day, seven_days, thirty_days, ninety_days, one_year or inception (no sub-day history)."}}}}]},execute:async(e,$)=>{try{if(j($),Object.keys(e).some(t=>!["view","lookback","cursor","limit"].includes(t))||typeof e.view!="string"||!Object.hasOwn(P,e.view))throw new n("Choose a documented Morpho analytics view.");let a=e.view,y=a==="history",w=a==="apy",k=a==="pending_governance";if(e.lookback!==void 0&&(!y&&!w||typeof e.lookback!="string"||!R.includes(e.lookback)))throw new n("lookback is available only for APY/history with a documented window.");if(y&&e.lookback!==void 0&&!A.includes(e.lookback))throw new n(`Choose a history lookback from ${A.join(", ")}; sub-day history is unavailable.`);if(!k&&(e.cursor!==void 0||e.limit!==void 0))throw new n("Pagination applies only to pending_governance.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||e.cursor.length>4096))throw new n("Provide the opaque pending-governance cursor string.");let p=e.limit??100;if(typeof p!="number"||!Number.isInteger(p)||p<1||p>100)throw new n("Pagination limit must be an integer from 1 to 100.");let[q,D]=P[a],u=new URL(`https://api.morpho.org/${q}/vaults-v2/${s}:${c(r)}/${D}`);(y||w)&&u.searchParams.set("lookback",String(e.lookback??(y?"seven_days":"six_hours"))),k&&(u.searchParams.set("limit",String(p)),e.cursor!==void 0&&u.searchParams.set("cursor",e.cursor));let g=await o.http(u.toString(),{headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!g.ok)throw new n(`Morpho analytics HTTP ${g.status}. Retry when the service is reachable; no zero APY or empty book was inferred.`);let i=f(await g.json());H(w||a==="allocations"?i.data:i.params,r);let m,h=i.last_indexed_block,x=null,I=!1;if(w){let t=f(i.data);if(t.lookback!==(e.lookback??"six_hours")||t.apy!==null&&(typeof t.apy!="number"||!Number.isFinite(t.apy)||t.apy<-1))throw new n("Morpho analytics returned an invalid APY or lookback.");m={annualYieldFraction:t.apy===null?null:String(t.apy),...t.apy===null?{status:"unavailable",reason:"Not enough history for the requested APY window."}:{},lookback:t.lookback,basis:"Realized post-fee share-price APY, excluding rewards; historical observation, not a promised return."},h=t.last_indexed_block,I=t.apy===0}else if(a==="allocations"){let t=f(i.data);if(!Array.isArray(t.allocations))throw new n("Morpho analytics omitted adapter allocations.");m=b(t.allocations),h=t.last_indexed_block}else{if(!Array.isArray(i.data))throw new n("Morpho analytics omitted its record array.");if(y)for(let t of i.data){let l=f(t);if(typeof l.timestamp!="number"||!Number.isSafeInteger(l.timestamp)||l.timestamp<0)throw new n("Morpho history returned an invalid timestamp.");for(let C of["total_assets","total_supply","withdrawable_assets","allocated_assets","idle_assets"])_(l[C]);l.share_price_ray!==null&&_(l.share_price_ray)}if(k){if(i.cursor!==null&&typeof i.cursor!="string")throw new n("Morpho analytics returned an invalid pagination cursor.");x=i.cursor}m=b(i.data)}h!==void 0&&_(h);let v=o.clientFor(s);if(await v.getChainId()!==s)throw new n("Vault share metadata requires chain 4663.");let T=await N(v,c(r)),M=I&&await Y(v,c(r))===!0?O:void 0;return{vault:c(r),chainId:s,sourceUrl:u.toString(),view:a,lastIndexedBlock:h??null,cursor:x,data:m,...M?{note:M}:{},asset:{address:c(S),symbol:"USDG",decimals:6,chainId:s},shareToken:{address:c(r),symbol:T,decimals:18,chainId:s},scales:{sharePriceRay:"1000000000000000000000000000",capWad:"1000000000000000000"},caveat:"Indexer data may lag the chain. APY excludes rewards; empty records describe only this API window/page. Re-read onchain state and preview before any action. API book data is never executed as calldata automatically."}}catch(a){throw new n(o.plainError(a))}}}}export{G as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(e){let n=BigInt(e),t=(n%10000n).toString().padStart(4,"0").replace(/0+$/,"");return`${n/10000n}${t?`.${t}`:""}%`}function o(e,n){return(e.fee&8388608)!==0?`fee set by the pool's hook, currently ${r(n)}, can change on every trade`:`${r(e.fee)} pool fee`}export{r as a,o as b};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{b as E,f as P,g as w,j as ne,k as C,m as H,n as d,o as T,p as L,r as N,s as se}from"./H3E7UD2X.js";import{Q as X,R as v,U as I,V as ee,X as te,b as n,e as j,f as G,g as x,m as F,n as q,o as K,p as z,q as S,r as y,s as Y,t as Z,u as Q,v as V,w as J,x as W}from"./V5YSJKRH.js";import{a as D}from"./XSD5NL7J.js";var M=6,re=/^[A-Za-z0-9._-]{1,12}$/;function de(e){return re.test(e)?e:"the stock token"}function $(e){return e instanceof D?e.message:"unexpected error"}function k(e,t=M){return C({redeemOutBase:e,amountBase:0n,decimals:t})}function oe(e,t,a){let _={amount_usd:d(t),gross_usd:d(e.grossUsd),horizon:a,costs_usd:d(e.costsUsd),net_usd:d(e.netUsd)};return e.suggestUsd===void 0?n(v,_):n(X,{..._,suggest_usd:`$${e.suggestUsd}`})}function ie(e,t,a,_){let f={id:"A",project:"layerbank"},s=k(t);if(!Number.isFinite(e.rateBasePct)||e.rateBasePct<0)return _.push("LayerBank rate was malformed"),{option:{...f,offered:!1,reason:"cant_check"},block:n(S,{})};if(!e.open)return{option:{...f,offered:!1,reason:"closed"},block:n(Y,{})};if(e.capRoomBase<t)return{option:{...f,offered:!1,reason:"no_room"},block:n(Z,{cap_room_usd:d(k(e.capRoomBase)),amount_usd:d(s)})};let o=e.bonus,i=o!==void 0&&Number.isFinite(o.ratePct)&&o.ratePct>0&&o.endsAt>a,u=e.rateBasePct+(i?o.ratePct:0),O=i?H(a,o.endsAt):0,c=P(e.gasInUsd),l=P(e.gasOutUsd),p=c.usd+l.usd,h=c.estimatedHigh||l.estimatedHigh,m=ne({amountUsd:s,baseRatePct:e.rateBasePct,bonusRatePct:i?o.ratePct:0,bonusDays:O,days:30}),g=w({gross:m,costs:p,amount:s}),A=n(F,{lb_base_rate:T(e.rateBasePct),bonus_clause:i?n(q,{lb_bonus_rate:T(o.ratePct),bonus_days:N(O),lb_base_rate:T(e.rateBasePct)}):"",lb_cash_usd:d(k(e.cashUsdgBase)),lb_gas_in_usd:d(c.usd),lb_gas_out_usd:d(l.usd)});return h&&(A+=`
|
|
2
|
+
${n(I,{})}`),g.tooSmall&&(A+=`
|
|
3
|
+
${oe(g,s,N(30))}`),{option:{...f,offered:!0,amountUsd:s,ratePct:u,grossUsd:m,costsUsd:p,netUsd:g.netUsd,tooSmall:g.tooSmall,...g.suggestUsd===void 0?{}:{suggestUsd:g.suggestUsd},estimatedHigh:h},block:A,gross30d:m,horizonEndsAt:a+30*86400}}function ue(e,t,a){return e.filter(s=>s.kind==="stable"&&!s.matured&&s.endsAt>t).filter(s=>s.unitDecimals===M&&Number.isFinite(s.ratePct)?!0:(a.push(`Pendle term ${s.market} skipped: its USDG figures were not in the expected form`),!1)).sort((s,o)=>o.liquidityUsd-s.liquidityUsd||s.endsAt-o.endsAt)[0]}async function ce(e,t,a,_,f){let s={id:"B",project:"pendle"};if(!t)return{option:{...s,offered:!1,reason:"no_term"},block:n(z,{})};let o={option:{...s,offered:!1,reason:"cant_check"},block:n(y,{})},i=k(a),u;try{u=await e.pendleQuoteCosts(t.market,a)}catch(B){return f.push(`Pendle quote failed: ${$(B)}`),o}if(typeof u.ptOutBase!="bigint"||u.ptOutBase<=0n)return f.push("Pendle quote was malformed"),o;let O=u.ptOutBase,c=C({redeemOutBase:O,amountBase:a,decimals:M}),l=P(t.gasInUsd),p=P(t.gasOutUsd),h=Number.isFinite(u.feeUsd)&&u.feeUsd>0?u.feeUsd:0,m=l.usd+p.usd,g=l.estimatedHigh||p.estimatedHigh,A=H(_,t.endsAt),b=w({gross:c,costs:m,amount:i}),R=L(t.endsAt),U=n(K,{pendle_end_date:R,pendle_rate:T(t.ratePct),pendle_payout_usd:d(k(O)),pendle_unit_usd:d(i),pendle_cost_in_usd:d(h+l.usd),pendle_gas_out_usd:d(p.usd)});return g&&(U+=`
|
|
4
|
+
${n(I,{})}`),b.tooSmall&&(U+=`
|
|
5
|
+
${oe(b,i,`the ${N(A)} until ${R}`)}`),{option:{...s,offered:!0,amountUsd:i,ratePct:t.ratePct,market:t.market,endsAt:t.endsAt,grossUsd:c,costsUsd:m,netUsd:b.netUsd,tooSmall:b.tooSmall,...b.suggestUsd===void 0?{}:{suggestUsd:b.suggestUsd},estimatedHigh:g},block:U,gross30d:A>30?c*(30/A):c,horizonEndsAt:t.endsAt}}function le(e){return e.filter(t=>t.matured&&t.ptBalanceBase>0n).map(t=>{let a=L(t.endsAt);if(t.kind==="stock")return n(te,{stock_symbol:de(t.unitSymbol),pendle_end_date:a});let _=se(t.ptBalanceBase,t.unitDecimals);return n(ee,{pendle_end_date:a,pt_amount:_,usdg_out:_})})}function fe(e){if(e!==void 0){if(!/^[0-9]+$/.test(e))throw new D("The amount must be a whole number of USDG base units (6 decimals), for example 50000000 for 50 USDG.");return BigInt(e)}}async function ge(e,t,a,_={}){let f=fe(_.amount),s=t.nowSec(),o=[],[i,u]=await Promise.allSettled([e.layerbank(a),e.pendleTerms(a)]),O=i.status==="fulfilled"?i.value:void 0,c=u.status==="fulfilled"?u.value:void 0;i.status==="rejected"&&o.push(`LayerBank could not be read: ${$(i.reason)}`),u.status==="rejected"&&o.push(`Pendle could not be read: ${$(u.reason)}`),o.push(...O?.checks??[],...c?.flatMap(r=>r.checks)??[]);let l=O?.walletUsdgBase;if(l===void 0)try{l=await t.usdgBalance(a)}catch{o.push("wallet USDG balance could not be read")}let p=f??l,h=c?le(c):[],m=(r,ae)=>({card:[...h,...r].join(`
|
|
6
|
+
|
|
7
|
+
`),options:ae,notices:h,checks:[...new Set(o)]});if(p===void 0)return m([n(S,{}),n(y,{})],[{id:"A",project:"layerbank",offered:!1,reason:"cant_check"},{id:"B",project:"pendle",offered:!1,reason:"cant_check"}]);if(p===0n){let r=0n;try{r=await t.ethBalance(a)}catch{o.push("wallet ETH balance could not be read")}return r>0n?m([n(J,{})],[]):m([n(W,{})],[])}let g=O?ie(O,p,s,o):{option:{id:"A",project:"layerbank",offered:!1,reason:"cant_check"},block:n(S,{})},A=c?await ce(e,ue(c,s,o),p,s,o):{option:{id:"B",project:"pendle",offered:!1,reason:"cant_check"},block:n(y,{})},b=[g,A],U=[f===void 0||f===l?n(j,{amount_usd:d(k(p))}):n(l!==void 0&&f<l?G:x,{amount_usd:d(k(p))}),...b.map(r=>r.block)],B=b.filter(r=>r.option.offered&&!r.option.tooSmall).map(r=>r.option.id);if(B.length>0){let r=B.length===2?"A, B, or neither":`${B[0]}, or neither`;U.push(n(Q,{choices:r}))}else b.some(r=>r.option.offered)&&U.push(n(V,{}));return m(U,b.map(r=>r.option))}export{ge as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as re,i as ae}from"./2GXHYI23.js";import{a as j}from"./43LI5NKJ.js";import{a as G}from"./66F5ZH34.js";import{d as ne,f as te,g as v,i as oe}from"./NWNYJ26T.js";import{b as f,j as ee}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{a as E}from"./JXOEJPJ4.js";import{encodeFunctionData as W,encodePacked as me,erc20Abi as V,getAddress as y,hashMessage as pe,keccak256 as ge,parseAbi as D,recoverMessageAddress as we,toHex as be,zeroAddress as _}from"viem";var w=y("0xE3535330a82867cD7b81C0d7e518f465D12dDd99"),N=y("0xf08c65564eb07d880021105489552080b08e4319"),ie=y("0xc3e91d2d8a4145055c26c1174eb124ff3e3ed697"),se=y("0x7c4726c6fb8eeb7b329ac037bbc71cc3153234b5"),ue=y("0xa76c1d0bdcd94f16d5edd01c29483a2131d4c529"),F={address:y(ee[f].tokens.USDG.address),symbol:"USDG",decimals:6,chainId:f},A=D(["function acceptOffer((uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address nftCollateralContract,uint32 loanDuration,uint16 loanAdminFeeInBasisPoints,address loanERC20Denomination,address referrer) offer,(uint256 nonce,uint256 expiry,address signer,bytes signature) signature,(address revenueSharePartner,uint16 referralFeeInBasisPoints) borrowerSettings) returns (uint32)","function payBackLoan(uint32 loanId)","function getPayoffAmount(uint32 loanId) view returns (uint256)","function loanIdToLoan(uint32 loanId) view returns (uint256 loanPrincipalAmount,uint256 maximumRepaymentAmount,uint256 nftCollateralId,address loanERC20Denomination,uint32 loanDuration,uint16 loanInterestRateForDurationInBasisPoints,uint16 loanAdminFeeInBasisPoints,address nftCollateralWrapper,uint64 loanStartTime,address nftCollateralContract,address borrower)","function loanRepaidOrLiquidated(uint32 loanId) view returns (bool)","function getWhetherNonceHasBeenUsedForUser(address user,uint256 nonce) view returns (bool)","function hub() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)"]),J=D(["function ownerOf(uint256 tokenId) view returns (address)","function approve(address spender,uint256 tokenId)","function supportsInterface(bytes4) view returns (bool)"]),he=D(["function getContract(bytes32) view returns (address)"]),ye=D(["function getNFTWrapper(address) view returns (address)"]),M=["loanPrincipalAmount","maximumRepaymentAmount","nftCollateralId","nftCollateralContract","loanDuration","loanAdminFeeInBasisPoints","loanERC20Denomination","referrer"],Z=["nonce","expiry","signer","signature"],Ie={loanPrincipalAmount:'Amount of USDG the lender advances, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.',maximumRepaymentAmount:'Maximum USDG the borrower repays at maturity, in base units (USDG has 6 decimals). Example: "1100000" = 1.1 USDG.',nftCollateralId:"Token id of the Robinhood Punks NFT pledged as collateral, as a decimal string.",nftCollateralContract:"Address of the NFT collection contract pledged as collateral; must be the Robinhood Punks collection.",loanDuration:"Loan length in seconds, as a decimal string (86400 = 1 day).",loanAdminFeeInBasisPoints:"Protocol admin fee in basis points (50 = 0.5%), as a decimal string, copied from the lender offer.",loanERC20Denomination:"Address of the ERC-20 token the loan is denominated in; must be canonical USDG.",referrer:"Referrer address recorded in the offer; must be the zero address 0x0000000000000000000000000000000000000000."},Ae={nonce:"Lender signature nonce, as a decimal string; a used nonce cannot be reused.",expiry:"Unix seconds after which the lender signature is no longer valid, as a decimal string.",signer:"Address of the lender who signed the offer.",signature:"Lender signature over the offer terms, as 0x-prefixed hex bytes. Oak never signs lender offers."},R=n=>te(n,"Provide the documented Longbow NFT object.");function x(n,l){if(Object.keys(n).some(i=>!l.includes(i)))throw new o("Unsupported Longbow NFT argument.")}function h(n,l=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(l))throw new o(`NFT amounts and IDs must be uint${l} decimal strings.`);return BigInt(n)}function m(n){return oe(n,"Provide an NFT contract address.",ne)}var K=n=>{if(n>8640000000000n)throw new o("NFT deadline exceeds the supported timestamp range.");return new Date(Number(n)*1e3).toISOString()};function de(n,l,i=!0){let s=R(n),e=R(l);x(s,M),x(e,Z);let t={loanPrincipalAmount:h(s.loanPrincipalAmount),maximumRepaymentAmount:h(s.maximumRepaymentAmount),nftCollateralId:h(s.nftCollateralId),nftCollateralContract:m(s.nftCollateralContract),loanDuration:Number(h(s.loanDuration,32)),loanAdminFeeInBasisPoints:Number(h(s.loanAdminFeeInBasisPoints,16)),loanERC20Denomination:m(s.loanERC20Denomination),referrer:m(s.referrer)};if(i&&(!v(t.nftCollateralContract,N)||!v(t.loanERC20Denomination,F.address)))throw new o("NFT borrowing supports only Robinhood Punks collateral and canonical USDG.");if(i&&(t.loanPrincipalAmount===0n||t.maximumRepaymentAmount<t.loanPrincipalAmount||t.loanDuration===0||t.referrer!==_))throw new o("NFT offer principal, payoff, duration or referrer is unsupported.");if(typeof e.signature!="string"||!/^0x(?:[0-9a-f]{2}){0,4096}$/i.test(e.signature))throw new o("Provide the existing lender\u2019s bounded hexadecimal offer signature; Oak does not sign lender offers.");let r={nonce:h(e.nonce),expiry:h(e.expiry),signer:m(e.signer),signature:e.signature};if(r.signer===_)throw new o("NFT lender cannot be the zero address.");return{offer:t,signature:r}}function Ne(n){let{offer:l,signature:i}=n;return ge(me(["address","uint256","uint256","address","uint256","address","uint32","uint16","address","uint256","uint256","address","uint256"],[l.loanERC20Denomination,l.loanPrincipalAmount,l.maximumRepaymentAmount,l.nftCollateralContract,l.nftCollateralId,l.referrer,l.loanDuration,l.loanAdminFeeInBasisPoints,i.signer,i.nonce,i.expiry,w,BigInt(f)]))}function le(n,l){if(n.filter(s=>s.token.chainId===f&&v(s.token.address,F.address)).reduce((s,e)=>{if(e.token.decimals!==F.decimals||!/^-?\d+$/.test(e.amount))throw new o("Invalid NFT currency preview metadata.");return s+BigInt(e.amount)},0n)!==l)throw new o("NFT preview does not match the exact principal or payoff.")}async function ce(n){let l=n.clientFor(f);if(await l.getChainId()!==f)throw new o("Longbow NFT loans require chain 4663.");let i=await l.getBlock(),s=(a,g,p,u=[])=>l.readContract({address:a,abi:g,functionName:p,args:u,blockNumber:i.number}),[e,t,r,c]=await Promise.all([s(w,A,"hub"),s(ie,he,"getContract",[be("PERMITTED_NFTS",{size:32})]),s(se,ye,"getNFTWrapper",[N]),s(N,J,"supportsInterface",["0x80ac58cd"])]);if(m(e)!==ie||m(t)!==se||m(r)!==ue||c!==!0)throw new o("The NFT hub, collection interface or collateral wrapper changed. No action was built.");return{client:l,block:i,read:s}}async function q(n,l){let i=Number(h(l,32));if(i===0)throw new o("NFT loanId must be positive.");let s=n.clientFor(f);if(await s.getChainId()!==f)throw new o("Longbow NFT loan reads require chain 4663.");let e=await s.getBlock(),t=(T,I,U,b=[])=>s.readContract({address:T,abi:I,functionName:U,args:b,blockNumber:e.number}),[r,c,a]=await Promise.all([t(w,A,"loanIdToLoan",[i]),t(w,A,"loanRepaidOrLiquidated",[i]),t(w,A,"getPayoffAmount",[i])]);if(!Array.isArray(r)||r.length!==11||typeof c!="boolean")throw new o("Invalid NFT loan state.");let[g,p,u,d,z,,,$,S,B,L]=r;if(BigInt(S)===0n)throw new o("This NFT loan does not exist.");let O=m(d)===F.address&&m(B)===N&&m($)===ue&&m(L)!==_,k=F;if(m(d)!==F.address){let[T,I]=await Promise.all([t(m(d),V,"symbol"),t(m(d),V,"decimals")]);if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new o("NFT loan currency decimals are unavailable.");k={address:m(d),symbol:typeof T=="string"&&/^[A-Za-z0-9$._ -]{1,32}$/.test(T)?T:"TOKEN",decimals:I,chainId:f}}if(typeof a!="bigint"||a!==BigInt(p)||a<BigInt(g))throw new o("NFT payoff does not match the fixed loan terms.");let C=BigInt(S)+BigInt(z);return{loanId:l,loanContract:w,chainId:f,blockNumber:e.number.toString(),collection:m(B),wrapper:m($),tokenId:String(u),borrower:m(L),currency:k,supportedForActions:O,principalAmount:String(g),payoffAmount:a.toString(),startedAt:String(S),deadline:C.toString(),deadlineUtc:K(C),status:c?"repaid_or_liquidated":e.timestamp>C?"overdue":"active",repayable:!c&&e.timestamp<=C,warning:"After the on-chain deadline repayment is rejected; the lender can permanently take this NFT. Settled state alone does not distinguish repayment from liquidation."}}async function H(n,l){let i=await n.http(`https://longbow.credit/api/nft${l}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(1e4),redirect:"error"});if(!i.ok)throw new o("Longbow NFT discovery is unavailable. Retry the read; no loan was originated.");let s=await i.json();if(!Array.isArray(s)||s.length>1e3)throw new o("Longbow NFT discovery returned an invalid or oversized list.");return s.map(R)}var Re=n=>{async function l(e,t,r){if(j(t),r){if(x(e,["loanId","maxPayoff"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");let b=await q(n,e.loanId);if(!b.supportedForActions)throw new o("This NFT loan is read-only in Oak; its collection, currency, wrapper or obligation-receipt borrower is not qualified for repayment.");let fe=h(e.maxPayoff);if(await ce(n),b.borrower!==y(t))throw new o("Only this NFT loan\u2019s borrower may repay through Oak.");if(!b.repayable)throw new o("NFT loan is settled or overdue; repayment is unavailable.");let P=BigInt(b.payoffAmount);if(P>fe)throw new o("NFT payoff exceeds maxPayoff.");if(await n.clientFor(f).readContract({address:F.address,abi:V,functionName:"balanceOf",args:[t]})<P)throw new o(`NFT repayment needs ${P} USDG base units. Top up before the deadline ${b.deadlineUtc}.`);let Y=`Repay ${P} USDG base units to recover Robinhood Punks ${b.collection} token ID ${b.tokenId}; deadline ${b.deadlineUtc}.`,Q=[n.approval(F.address,w,P.toString(),f),n.unsignedTx({to:w,data:W({abi:A,functionName:"payBackLoan",args:[Number(b.loanId)]}),value:"0",chainId:f,description:Y})],X=await n.preview(Q,t);return le(X.changes,-P),{txs:Q,preview:X,summary:Y,requiresHumanConfirmation:!0}}x(e,["offer","lenderSignature"]);let c=de(e.offer,e.lenderSignature),{offer:a,signature:g}=c,{client:p,block:u,read:d}=await ce(n),[z,$,S,B,L]=await Promise.all([d(N,J,"ownerOf",[a.nftCollateralId]),d(w,A,"getWhetherNonceHasBeenUsedForUser",[g.signer,g.nonce]),d(w,A,"paused"),d(w,A,"maximumLoanDuration"),d(w,A,"adminFeeInBasisPoints")]);if(m(z)!==y(t))throw new o("This wallet does not own the offered NFT.");if($!==!1||S!==!1||g.expiry<u.timestamp||BigInt(a.loanDuration)>BigInt(String(B))||a.loanAdminFeeInBasisPoints!==L)throw new o("NFT offer is used, expired, paused or inconsistent with current loan settings.");let O=Ne(c),k=!1;try{k=v(await we({message:{raw:O},signature:g.signature}),g.signer)}catch{}if(!k){let b=await p.getCode({address:g.signer,blockNumber:u.number});b&&b!=="0x"&&(k=await d(g.signer,D(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),"isValidSignature",[pe({raw:O}),g.signature])==="0x1626ba7e")}if(!k)throw new o("NFT offer signature does not match these terms, chain and loan contract.");let C=u.timestamp+BigInt(a.loanDuration),T=`Borrow ${a.loanPrincipalAmount} USDG base units; total payoff ${a.maximumRepaymentAmount} USDG base units. Escrow Robinhood Punks collection ${a.nftCollateralContract}, token ID ${a.nftCollateralId}. Estimated absolute repayment deadline ${K(C)} at snapshot ${u.number}; actual deadline is the mined start plus ${a.loanDuration} seconds. Read longbow_nft_loan after mining. Late repayment is rejected and you can permanently lose this NFT. Approve only this token ID to ${w}.`,I=[n.unsignedTx({to:N,data:W({abi:J,functionName:"approve",args:[w,a.nftCollateralId]}),value:"0",chainId:f,description:`Approve only Robinhood Punks token ID ${a.nftCollateralId} to the pinned loan contract.`}),n.unsignedTx({to:w,data:W({abi:A,functionName:"acceptOffer",args:[a,g,{revenueSharePartner:_,referralFeeInBasisPoints:0}]}),value:"0",chainId:f,description:T})],U=await n.preview(I,t);return le(U.changes,a.loanPrincipalAmount),{txs:I,preview:U,summary:T,requiresHumanConfirmation:!0,estimatedDeadlineUtc:K(C),deadlineIsEstimate:!0}}let i=(e,t,r,c)=>({name:e,inputSchema:{type:"object",properties:t,required:r,additionalProperties:!1},execute:async(a,g)=>{try{return await c(a,g)}catch(p){throw new o(n.plainError(p))}}});async function s(e){j(e);let t=(r,c)=>{let a=`Longbow borrower NFT loans unreadable: ${n.plainError(c)}`;return{module:"longbow",id:`4663:${w.toLowerCase()}:${r}`,chainId:f,incomplete:!0,assets:[],economics:{principal:[],debt:[],rewards:[],backing:[],coverage:{complete:!1,reason:a}},description:`${a} Use longbow_nft_loans or longbow_nft_loan for a known loanId.`}};try{let r=await H(n,`/loans/borrower/${y(e)}`);if(r.length>100)throw new o("NFT loan discovery exceeds 100 rows; read specific loan IDs with longbow_nft_loan.");let c=new Set,a=[];for(let[g,p]of r.entries()){let u=`unreadable-${g}`;try{if(p.loanContract!==void 0&&m(p.loanContract)!==w)throw new o("The NFT indexer returned a loan from another contract.");if(u=h(String(p.loanId??p.id),32).toString(),c.has(u))continue;c.add(u);let d=await q(n,u);if(d.borrower!==y(e))throw new o("The NFT indexer returned another borrower\u2019s loan.");if(d.status==="repaid_or_liquidated")continue;a.push({module:"longbow",id:`4663:${w.toLowerCase()}:${u}`,chainId:f,assets:[],economics:{principal:[re("collateral",{token:{address:d.collection,symbol:"NFT",decimals:0,chainId:f},amount:"1",tokenId:d.tokenId,source:"longbow.nft.collateral",measuredAtBlock:d.blockNumber})],debt:[ae({token:d.currency,amount:d.payoffAmount,source:"longbow.nft.payoffAmount",dueAt:d.deadline,measuredAtBlock:d.blockNumber})],rewards:[],backing:[],coverage:{complete:!0}},description:`Longbow borrower NFT loan ${u}: ${d.status}, payoff debt ${d.payoffAmount} ${d.currency.symbol} base units (token ${d.currency.address}, decimals ${d.currency.decimals}); collateral ${d.collection} token ID ${d.tokenId} is escrowed. Deadline ${d.deadlineUtc}. ${d.repayable?"Use longbow_nft_repay before the deadline.":"Repayment is unavailable; the lender can permanently take the collateral."} Indexer discovery may be incomplete; lender interests are not included.`})}catch(d){a.push(t(u,d))}}return a}catch(r){return[t("unreadable",r)]}}return{positions:s,tools:[i("longbow_nft_listings",{},[],async e=>{x(e,[]);let t=await H(n,"/listings");return{chainId:f,source:"Longbow public order book; untrusted and potentially stale. No offer or execution is guaranteed.",listings:t.map(r=>{if(r.chainId!==f)throw new o("Longbow returned a listing on another chain.");return{id:E(String(r.id)),collection:m(r.nftContract??r.collection),tokenId:h(r.tokenId).toString(),borrower:m(r.borrower??r.owner),status:E(String(r.status)),note:r.note==null?null:E(String(r.note)).slice(0,512)}})}}),i("longbow_nft_offers",{listingId:{type:"string",maxLength:128,description:"Longbow NFT listing id, as returned by longbow_nft_listings (letters, digits, underscore or hyphen)."}},["listingId"],async e=>{if(x(e,["listingId"]),typeof e.listingId!="string"||!/^[a-zA-Z0-9_-]{1,128}$/.test(e.listingId))throw new o("Provide the listingId returned by longbow_nft_listings.");let t=await H(n,`/listings/${encodeURIComponent(e.listingId)}/offers`);return{listingId:e.listingId,offers:t.map(r=>{let c=r.raw?R(r.raw):r,a={...R(c.offer??Object.fromEntries(M.map(p=>[p,c[p]])))};for(let p of["loanDuration","loanAdminFeeInBasisPoints"]){let u=a[p];typeof u=="number"&&Number.isSafeInteger(u)&&u>=0&&(a[p]=String(u))}let g=de(a,typeof c.signature=="object"?c.signature:{nonce:c.nonce,expiry:c.expiry,signer:c.signer??c.lender,signature:c.signature},!1);return JSON.parse(JSON.stringify({id:String(r.id),...g},(p,u)=>typeof u=="bigint"||p==="loanDuration"||p==="loanAdminFeeInBasisPoints"?String(u):u))}),caveat:"These are lender-signed terms from an untrusted indexer. Accept rechecks ownership, wrapper, nonce, expiry and signature on chain. Empty offers do not imply a discovery failure."}}),i("longbow_nft_loan",{loanId:G('Longbow NFT loan id, as a decimal string. Example: "1".')},["loanId"],async e=>{if(x(e,["loanId"]),typeof e.loanId!="string")throw new o("NFT loanId must be a decimal string.");return q(n,e.loanId)}),i("longbow_nft_loans",{role:{enum:["borrower","lender"],description:'Which loans to list for this wallet: "borrower" (default) for loans it took out, "lender" for loans it funded.'}},[],async(e,t)=>{x(e,["role"]),j(t);let r=e.role??"borrower";if(r!=="borrower"&&r!=="lender")throw new o("Choose borrower or lender NFT loan discovery.");let c=await H(n,`/loans/${r}/${y(t)}`);if(c.length>100)throw new o("NFT loan discovery exceeds 100 rows; read a specific loanId.");return{source:"Longbow indexer IDs, freshly checked on chain. Indexer completeness is not guaranteed.",loans:await Promise.all(c.map(a=>{if(a.loanContract!==void 0&&m(a.loanContract)!==w)throw new o("The NFT indexer returned a loan from another contract.");return q(n,String(a.loanId??a.id))}))}}),i("longbow_nft_accept_offer",{offer:{type:"object",description:"Lender-signed NFT loan terms to accept, exactly as returned by longbow_nft_offers.",properties:Object.fromEntries(M.map(e=>[e,{type:"string",description:Ie[e]}])),required:M,additionalProperties:!1},lenderSignature:{type:"object",description:"The lender signature and its nonce, expiry and signer, as returned with the offer.",properties:Object.fromEntries(Z.map(e=>[e,{type:"string",description:Ae[e]}])),required:Z,additionalProperties:!1}},["offer","lenderSignature"],(e,t)=>l(e,t,!1)),i("longbow_nft_repay",{loanId:G('Longbow NFT loan id to repay, as a decimal string. Example: "1".'),maxPayoff:G('Highest USDG payoff you accept, in base units (USDG has 6 decimals). Example: "1100000" = 1.1 USDG.')},["loanId","maxPayoff"],(e,t)=>l(e,t,!0))]}};async function $e(n,l,i){if(await n.getChainId()!==f||i<0n||i>=1n<<256n)throw new o("NFT cleanup requires chain 4663 and the original token ID.");let s=D(["function ownerOf(uint256) view returns (address)","function getApproved(uint256) view returns (address)","function approve(address,uint256)"]),e=await n.readContract({address:N,abi:s,functionName:"ownerOf",args:[i]});if(!v(e,l))return;let t=await n.readContract({address:N,abi:s,functionName:"getApproved",args:[i]});if(v(t,w))return{to:N,data:W({abi:s,functionName:"approve",args:[_,i]}),value:"0",chainId:f,description:`Revoke only Robinhood Punks token ID ${i} approval to the Longbow loan contract.`}}export{w as a,N as b,ie as c,se as d,ue as e,A as f,h as g,de as h,Ne as i,q as j,Re as k,$e as l};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as o}from"./NWNYJ26T.js";import{a as s}from"./XSD5NL7J.js";var i={1:"Ethereum",10:"Optimism",8453:"Base",42161:"Arbitrum"},c=a=>i[a]??`chain ${a}`;async function u(a,t,n){let e;try{e=a(t)}catch{return"not-configured"}try{if(await e.getChainId()!==t)return"wrong-chain"}catch{return"unreadable"}let r;try{r=await e.request({method:"debug_traceCall",params:[{from:n,to:n,data:"0x",value:"0x0",gas:"0x5208"},"latest",{tracer:"callTracer"}]})}catch{return"no-tracer"}return r?.type!=="CALL"||!o(r.to,n)||r.error?"unreadable":void 0}function l(a,t,n){let e=c(t);if(a==="server")return`Bridging out to ${e} isn't available right now. Oak couldn't confirm it can check the return trip from ${e}, so nothing was sent and nothing was charged. This is a setup problem on Oak's side; there is nothing for you to change. Please try again later.`;if(n==="not-configured"){let r=t===4663||t===8453?`Oak uses hosted tracing by default for ${e} on mainnet; your own OAK_RPC_URL_${t} overrides it. Retry later, or set a tracing RPC and restart Oak.`:`Set OAK_RPC_URL_${t} to a tracing RPC, then restart Oak.`;return`Oak can only send money to ${e} when it can also act for this wallet on ${e} afterwards, and that needs a ${e} connection that can trace transactions. This computer has none set, so nothing was sent. ${r}`}return`The connection you set for ${e} didn't pass Oak's tracing check, so nothing was sent.`}async function h(a,t,n,e){let r=await u(a,t,n);if(r)throw e==="server"&&process.stderr.write(`${JSON.stringify({event:"relay_return_readiness",side:e,chainId:t,class:r})}
|
|
2
|
+
`),new s(l(e,t,r));return`Relay return path checked on the ${e}: chain ${t} RPC and debug_traceCall with callTracer are available. This checks setup now; it does not guarantee future RPC availability or Relay settlement. Keep destination ETH for return gas.`}var g=500;function f(a,t){let n=BigInt(a),e=BigInt(t),r=((n-e)*10000n+n-1n)/n;return new s(`Relay order minimum is below the allowed slippage minimum. This quote needs slippageBps at least ${r} (maximum 9999), or explicit minAmountOut "${t}". Review that minimum before retrying; a new quote alone may have the same floor.`)}export{h as a,g as b,f as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./
|
|
1
|
+
import{a as z,b as K}from"./LIUXNOLP.js";import{a as q}from"./VVAM3EAK.js";import{a as _,b as D}from"./43LI5NKJ.js";import{b as B,c as G,d as O}from"./IOYRL6AY.js";import{b as R,c as M,j as U,t as E}from"./TI727O2H.js";import{a as m,b as H,c as I,e as S}from"./XSD5NL7J.js";import{decodeFunctionResult as ee,encodeFunctionData as te,erc20Abi as V,getAddress as L,isAddress as ne,toEventSelector as re,toHex as T,zeroAddress as se}from"viem";var C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function ae(e){let s=e.toLowerCase();return s===se||s===C?C:e}var oe=re("Transfer(address,address,uint256)"),W="Preview note: simulation transfer-based token changes exclude gas and do not prove external settlement.";function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function x(){throw new m("The endpoint returned an unexpected simulation response.")}function j(e,s,l){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s+l)&&x();let d=e[0].calls,a=d.slice(0,s).map(n=>{if(!p(n)||n.status!=="0x1"||n.error||!Array.isArray(n.logs)||n.logs.length!==0||typeof n.returnData!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n.returnData))throw new m("Preview auxiliary read failed or returned invalid data.");return n.returnData});return{result:[{calls:d.slice(s)}],readResults:a}}async function N(e,s,l,d){let a=await e.getChainId();if(a!==s)throw new m(`Preview is on chain ${s}, but the endpoint reports chain ${a}.`);let n=await z(e),t=await K(e,n);if(n.number===null||typeof n.baseFeePerGas!="bigint"||n.baseFeePerGas<0n||typeof t!="bigint"||t<0n)throw new m("Current block base fee and gas price are unavailable or inconsistent. Retry the preview.");let r=t<n.baseFeePerGas?n.baseFeePerGas:t,A=B(n.gasLimit),c=l.map(u=>({from:d,to:u.to,data:u.data,value:T(BigInt(u.value)),gasPrice:T(r),gas:T(A)})),y=()=>e.request({method:"eth_simulateV1",params:[{blockStateCalls:[{blockOverrides:{baseFeePerGas:T(n.baseFeePerGas)},calls:c}],validation:!1,traceTransfers:!0},T(n.number)]},{retryCount:0});try{return await y()}catch(u){if(!I(u))throw u;let g=await e.getBalance({address:d,blockNumber:n.number}),w=await Promise.all(l.map(o=>e.estimateGas({account:d,to:o.to,data:o.data,value:BigInt(o.value),gas:A,blockNumber:n.number}).catch(()=>{}))),k=g;for(let[o,i]of c.entries()){let f=BigInt(i.value),F=O(B(n.gasLimit,w[o]),k,f,r,d,s),h=w[o];if(h!==void 0&&h>F)throw new m(G(d,s,g-k+f+h*r,g));i.gas=T(F),k-=f}let v=await y();if(Array.isArray(v)&&p(v[0])&&Array.isArray(v[0].calls))for(let[o,i]of v[0].calls.entries()){let f=c[o];if(f&&p(i)&&i.status==="0x0"&&typeof i.gasUsed=="string"&&/^0x[0-9a-f]+$/i.test(i.gasUsed)&&BigInt(i.gasUsed)>=BigInt(f.gas))throw new m(G(d,s,BigInt(f.value)+(BigInt(f.gas)+1n)*r,g))}return v}}function J(e,s,l,d){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s)&&x();let a=new Map;for(let[n,t]of e[0].calls.entries()){if(p(t)||x(),t.status==="0x0")throw new m(`Preview call ${n+1} on chain ${d} reverted. ${S(t.error)}`);(t.status!=="0x1"||t.error||!Array.isArray(t.logs))&&x();for(let r of t.logs){if((!p(r)||!Array.isArray(r.topics))&&x(),typeof r.topics[0]!="string"||r.topics[0].toLowerCase()!==oe||r.topics.length===4)continue;(r.topics.length!==3||typeof r.address!="string"||!ne(r.address,{strict:!1})||typeof r.data!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r.data)||!r.topics.slice(1).every(w=>typeof w=="string"&&/^0x0{24}[0-9a-fA-F]{40}$/.test(w)))&&x();let A=r.topics[1].slice(-40).toLowerCase(),c=r.topics[2].slice(-40).toLowerCase(),y=l.slice(2).toLowerCase(),u=BigInt(r.data),g=(c===y?u:0n)-(A===y?u:0n);if(g!==0n){let w=ae(r.address.toLowerCase());a.set(w,(a.get(w)??0n)+g)}}}return a}async function Q(e,s,l,d){let a=s===R?E.mainnet:s===M?E.testnet:void 0,n=a&&[{address:a.usdg,symbol:"USDG",decimals:6},{address:a.weth,symbol:"WETH",decimals:18},...s===R?[{address:U[4663].meridian.CollateralToken_USDe.address,symbol:"USDe",decimals:18}]:[]].find(r=>r.address.toLowerCase()===e);if(n)return{...n,address:L(e),chainId:s};let t;if(e===C){let r=l.chain?.nativeCurrency??(s===4663?{symbol:"ETH",decimals:18}:void 0);if(!r)throw new m(`Native token metadata is unavailable for chain ${s}.`);t={address:e,chainId:s,symbol:r.symbol,decimals:r.decimals}}else if(d)t=await d(e,s,l);else{let r=await q(l,s,e,"decimals");t={address:e,chainId:s,symbol:e,decimals:r}}if(!t||typeof t.address!="string"||t.address.toLowerCase()!==e||t.chainId!==s||typeof t.symbol!="string"||!t.symbol.trim()||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new m(`Invalid token metadata for ${e} on chain ${s}.`);return{address:e===C?e:L(e),chainId:s,symbol:e===C?t.symbol:L(e),decimals:t.decimals}}function ge(e){return async(s,l,d)=>{_(l);let a=s.map(D),n=(d?.reads??[]).map(c=>D({...c,value:"0",description:"Read before simulated transactions."})),t=a[0]?.chainId;if(t===void 0&&n.length)throw new m("Preview auxiliary reads require a transaction bundle.");if(t===void 0)return{txs:a,changes:[],summary:W};let r=[...n,...a].find(c=>c.chainId!==t);if(r)throw new m(`Preview cannot combine chain ${t} with chain ${r.chainId}. Preview each chain separately.`);let A=n.length?[...n,...a]:a;try{let c=e.clientFor(t),y;try{y=await N(c,t,A,l)}catch(o){if(!H(o,-32601,-32004)||!e.anvilFor)throw o;c=await e.anvilFor(t),y=await N(c,t,A,l)}let u;n.length&&({result:y,readResults:u}=j(y,n.length,a.length));let g=J(y,a.length,l,t),w=new Map,k=[];for(let[o,i]of g)if(i!==0n)try{w.set(o,await Q(o,t,c,e.tokenFor))}catch(f){if(o===C||e.tokenFor||(await c.getCode({address:o})??"0x")!=="0x")throw f;k.push(o)}if(k.length){let o=k.flatMap(h=>["symbol","decimals"].map(b=>D({to:h,data:te({abi:V,functionName:b}),value:"0",chainId:t,description:`Read simulated token ${b}.`}))),i=await N(c,t,[...A,...o],l);if(u){let h=j(i,u.length,a.length+o.length);if(h.readResults.some((b,$)=>b!==u[$]))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");i=h.result}(!Array.isArray(i)||i.length!==1||!p(i[0])||!Array.isArray(i[0].calls)||i[0].calls.length!==a.length+o.length)&&x();let f=i[0].calls,F=J([{calls:f.slice(0,a.length)}],a.length,l,t);if(g.size!==F.size||[...g].some(([h,b])=>F.get(h)!==b))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");for(let[h,b]of k.entries()){let $=(Y,Z)=>{let P=f[a.length+h*2+Z];if(!p(P)||P.status!=="0x1"||P.error||typeof P.returnData!="string"||!/^0x[0-9a-fA-F]+$/.test(P.returnData))throw new m(`Invalid simulated token metadata for ${b} on chain ${t}.`);return ee({abi:V,functionName:Y,data:P.returnData})},X={address:b,chainId:t,symbol:$("symbol",0),decimals:$("decimals",1)};w.set(b,await Q(b,t,c,async()=>X))}}let v=[...g].filter(([,o])=>o!==0n).map(([o,i])=>({token:w.get(o),amount:i.toString()}));return{txs:a,changes:v,summary:W,...u?{readResults:u}:{}}}catch(c){throw new m(`Preview on chain ${t} failed: ${S(c)}`)}}}export{C as a,ae as b,ge as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as ht}from"./65OITTDL.js";import{b as bt}from"./OTLUQWLF.js";import{b as gt}from"./MSMHS456.js";import{b as ft}from"./B7BNDW35.js";import{c as pt}from"./ORG6LVKJ.js";import{b as wt}from"./GDOHHXNH.js";import{c as mt}from"./O4S6XAYV.js";import{h as ut}from"./VXCGMALF.js";import{a as C,b as L,c as Ie,d as me,e as Ge,g as st,h as Ve,j as U,l as E,o as Fe,p as at,q as dt,r as Me,s as lt,t as qe,u as ct}from"./4NBXBKOX.js";import{i as rt}from"./2GXHYI23.js";import{b as ot,o as it}from"./LKX5WDOQ.js";import{b as et}from"./SPJCSEKP.js";import{a as z}from"./43LI5NKJ.js";import{a as tt,c as nt}from"./SCG5HWMN.js";import{a as Pe}from"./66F5ZH34.js";import{b as ee}from"./IX3GZMTM.js";import{b as $,e as N,j as ce}from"./TI727O2H.js";import{a}from"./XSD5NL7J.js";import{a as Ee}from"./JXOEJPJ4.js";import{BaseError as _t,ContractFunctionRevertedError as Ye,decodeEventLog as zt,decodeFunctionResult as Jt,encodeFunctionData as X,erc20Abi as Xt,getAddress as B,parseAbi as ke,parseAbiItem as Yt,recoverAddress as Zt,recoverMessageAddress as Kt,recoverTypedDataAddress as Qt}from"viem";var en="https://priors.trade/api/check",He=604800n,yt=50n,$t=10000n,We=5000000n,St=500000000n,je=86400n,At=2592000n,Ze=`Register one with oak_setup {"mode":"register"}, then open Priors' 5 USDG starter line with priors_starter_line (a refundable 5 USDG bond, an invite from Priors' invite bot, your pool consent; each transaction and signature is confirmed).`,tn="0x6982e39521a070a3c40782548bfbed6dc8f566ef",nn=["0xcbb95bbf36099d34da091dc6fa6f49efa257cee3","0x284358abc07f9359f19f4b5b4ac91901be2597ba"],c={pool:B(ce[4663].priors.pool.address),lens:B(ce[4663].priors.lens.address),usdg:B(ce[4663].priors.usdg.address),registry:B(ce[4663].priors.registry.address),stockVault:B(ce[4663].priors.stockVault.address)},te={address:c.usdg,symbol:"USDG",decimals:N,chainId:$},S=ke(["function deposit(uint256 assets, address receiver, uint256 minShares) returns (uint256 minted)","function withdraw(uint256 shares_, address receiver) returns (uint256 out)","function quoteFee(uint256 agentId, uint256 principal, uint64 term) view returns (uint256 fee, uint256 sponsorCut, uint256 reserveCut, uint256 premium)","function borrow(uint256 agentId, uint256 amount, uint64 term, address to, uint256 maxFee) returns (uint256 loanId)","function repay(uint256 loanId, uint256 expectedAgentId, uint256 maxDue)","function shares(address lender) view returns (uint256)","function convertToAssets(uint256 shares_) view returns (uint256)","function lastDepositAt(address lender) view returns (uint64)","function isController(uint256 id, address who) view returns (bool)","function delegateOf(uint256 id) view returns (address)","function getAgent(uint256 id) view returns (bool enrolled, bool isRoot, bool defaulted, bool frozen, bool importedFromV1, uint64 enrolledAt, uint64 lastBorrowAt, uint64 lastRepayAt, uint256 sponsor, uint256 delegatedIn, uint256 delegatedOut, uint256 principalOut, uint256 activeLoans, uint256 premiumBps, uint256 premiumCap, uint256 loansRepaid, uint256 volumeRepaid, uint256 feesPaid, uint256 recourseHonored, uint256 childrenDefaulted, uint256 qualifiedRepaid, uint256 dollarSecondsRepaid)","function nonces(uint256 id) view returns (uint256)","function consentDigest((uint256 agentId, uint256 sponsorId, address owner, uint256 maxPremiumBps, uint256 nonce, uint256 deadline) c) view returns (bytes32)","function leave(uint256 agentId)","function loansOf(uint256 id) view returns (uint256[])","function getLoan(uint256 loanId) view returns (uint256 agentId, uint256 sponsorId, uint256 principal, uint256 fee, uint256 sponsorCut, uint256 reserveCut, uint256 premium, address owner, uint64 issuedAt, uint64 dueAt, uint64 defaultableAt, uint64 minScoreTerm, uint64 closedAt, uint8 status)","event Borrowed(uint256 indexed loanId, uint256 indexed agentId, uint256 indexed sponsorId, uint256 principal, uint256 fee, uint64 dueAt, address to)"]),vt=ke(["function available(uint256 agentId) view returns (uint256)","function score(uint256 id) view returns (uint256)"]),kt=ke(["function ownerOf(uint256 agentId) view returns (address)","function balanceOf(address owner) view returns (uint256)","function getAgentWallet(uint256 agentId) view returns (address)"]),Pt=ke(["function borrowRoom(uint256 agentId) view returns (uint256)","function assetList() view returns (address[])","function assets(address token) view returns (address feed, uint32 heartbeat, uint8 tokenDecimals, uint8 feedDecimals, bool enabled, uint16 ltvBps, uint256 lineCap)"]);function Y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function on(e){return e.chainId===$&&e.address.toLowerCase()===c.usdg.toLowerCase()}function rn(e,i){let g=i.amount.trim(),u=g.startsWith("-"),f=u||g.startsWith("+")?g.slice(1):g,R=e.formatAmount(f,i.token.decimals),A=on(i.token)?"USDG":i.token.address;return`${u?"-":"+"}${R} ${A}`}function ne(e,i,g){if(!g.length)return i;let u=g.map(f=>rn(e,f)).join(", ");return`${i} Preview changes: ${u}.`}function It(e,i,g,u){let f=e[i]===void 0?void 0:ee(e[i]),R=e[g]===void 0?void 0:ee(e[g]);if(f!==void 0)return f;if(R!==void 0)return R;throw new a(`Provide ${u} as an integer string in base units ("${i}" or "${g}").`)}async function De(e,i,g){try{return B(await e.clientFor($).readContract({address:c.registry,abi:kt,functionName:"ownerOf",args:[i],blockNumber:g}))}catch(u){throw u instanceof _t&&u.walk(f=>f instanceof Ye)?new a(`ERC-8004 agent ${i} does not exist in registry ${c.registry}: it has no owner. Check the agent ID.`):new a(`Could not read the owner of ERC-8004 agent ${i} from registry ${c.registry}. Check the agent ID and retry when the registry is available.`)}}function pe(e,i){if(typeof e=="bigint"&&e>0n)return e;if(typeof e=="number"&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if(typeof e=="string"&&/^\d+$/.test(e.trim())){let g=BigInt(e.trim());if(g>0n)return g}throw new a(`Provide a positive integer ${i}.`)}function sn(e,i){let g=i!==void 0?pe(i,"agentId"):void 0,u=[];for(let f of e)if(!(!f||typeof f.address!="string")&&f.address.toLowerCase()===c.pool.toLowerCase()&&!(!Array.isArray(f.topics)||f.topics.length===0))try{let R=zt({abi:S,eventName:"Borrowed",data:f.data,topics:f.topics});if(g!==void 0&&R.args.agentId!==g)continue;u.push(R.args.loanId)}catch{continue}return u.length===0?null:u[u.length-1].toString()}function we(e){return{enrolled:!!e[0],isRoot:!!e[1],defaulted:!!e[2],frozen:!!e[3],importedFromV1:!!e[4],enrolledAt:BigInt(e[5]),lastBorrowAt:BigInt(e[6]),lastRepayAt:BigInt(e[7]),sponsor:BigInt(e[8]),delegatedIn:BigInt(e[9]),delegatedOut:BigInt(e[10]),principalOut:BigInt(e[11]),activeLoans:BigInt(e[12]),premiumBps:BigInt(e[13]),premiumCap:BigInt(e[14]),loansRepaid:BigInt(e[15]),volumeRepaid:BigInt(e[16]),feesPaid:BigInt(e[17]),recourseHonored:BigInt(e[18]),childrenDefaulted:BigInt(e[19]),qualifiedRepaid:BigInt(e[20]),dollarSecondsRepaid:BigInt(e[21])}}function Ce(e,i){return{loanId:e,agentId:BigInt(i[0]),sponsorId:BigInt(i[1]),principal:BigInt(i[2]),fee:BigInt(i[3]),sponsorCut:BigInt(i[4]),reserveCut:BigInt(i[5]),premium:BigInt(i[6]),owner:B(String(i[7])),issuedAt:BigInt(i[8]),dueAt:BigInt(i[9]),defaultableAt:BigInt(i[10]),minScoreTerm:BigInt(i[11]),closedAt:BigInt(i[12]),status:Number(i[13])}}async function _e(e,i){let g=e.clientFor($),u=await g.getBlockNumber({cacheTime:0}),f=await g.readContract({address:c.registry,abi:kt,functionName:"balanceOf",args:[i],blockNumber:u});if(f===0n)return[];if(typeof f!="bigint"||f<0n)throw new a("Registry balance is unavailable. Retry or provide an explicit agentId.");let R=[],A=new Set,x=u;for(;;){let H=x>9999999n?x-9999999n:0n,oe=await g.getLogs({address:c.registry,event:Yt("event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"),args:{to:i},fromBlock:H,toBlock:x,strict:!0});for(let O of oe){let J=O.args.tokenId;if(O.removed||A.has(J))continue;if(A.add(J),(await De(e,J,u)).toLowerCase()===i.toLowerCase()&&R.push(J),BigInt(R.length)===f)return R.sort((Z,se)=>Z<se?-1:Z>se?1:0)}if(H===0n)throw new a("Owned identities could not all be located. Retry or provide an explicit agentId.");x=H-1n}}async function Re(e,i,g){if(i.agentId!==void 0&&i.agentId!==null&&String(i.agentId).trim()!=="")return pe(i.agentId,"agentId");let u=await _e(e,g);if(u.length===0)throw new a(`Priors borrowing needs an ERC-8004 agent identity with a Priors credit line, and this wallet owns no identity. ${Ze}`);return u[0]}async function ze(e,i,g){let u=e.clientFor($),f=await De(e,i),[R,A]=await Promise.all([u.readContract({address:c.pool,abi:S,functionName:"delegateOf",args:[i]}),u.readContract({address:c.pool,abi:S,functionName:"isController",args:[i,g]})]),x=B(R);if(!A)throw new a(`Wallet ${g} is not an on-chain controller for ERC-8004 agent ${i} (ownerOf=${f}, delegateOf=${x}). An off-chain /api/check paymentWallet match alone does not grant CreditPoolV2 control.`);return{owner:f,delegate:x}}function an(e,i){if(!i.enrolled||i.isRoot||i.sponsor===0n)throw new a(`ERC-8004 agent ${e} has no sponsor-backed Priors credit line on CreditPoolV2 yet (enrolled=${i.enrolled}, sponsor=${i.sponsor}, isRoot=${i.isRoot}). For an agent with no Priors record, priors_starter_line opens Priors' 5 USDG treasury line (a refundable 5 USDG bond, an invite from Priors' invite bot, your pool consent), then borrow.`);if(i.defaulted||i.frozen)throw new a(`ERC-8004 agent ${e} is not eligible to borrow on CreditPoolV2 (defaulted=${i.defaulted}, frozen=${i.frozen}).`);let g=i.delegatedIn>i.principalOut?i.delegatedIn-i.principalOut:0n;if(g<=0n)throw new a(`ERC-8004 agent ${e} has 0 USDG remaining credit capacity (delegatedIn=${i.delegatedIn}, principalOut=${i.principalOut}).`);return g}function dn(e){let i=e.borrowReceiptLogs??(Y(e.borrowReceipt)?e.borrowReceipt.logs:void 0);if(!Array.isArray(i))return[];let g=[];for(let u of i)Y(u)&&(typeof u.address!="string"||!Array.isArray(u.topics)||typeof u.data!="string"||g.push({address:u.address,topics:u.topics,data:u.data}));return g}var Je="0x0000000000000000000000000000000000000000",ue=()=>Math.floor(Date.now()/1e3),G=e=>new Date(Number(e)*1e3).toISOString(),V=(e,i)=>e.toLowerCase()===i.toLowerCase();function ye(e){let i=(g,u)=>Array.isArray(e)?e[u]:e[g];return{depositor:B(String(i("depositor",0))),at:BigInt(i("at",1)),amount:BigInt(i("amount",2))}}async function he(e,i,g){let u=e.clientFor($),f=await u.getBlockNumber({cacheTime:0}),[R,A,x,H,oe,O,J,ge,Z,se,Te]=await Promise.all([De(e,i,f),u.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[i],blockNumber:f}),u.readContract({address:L,abi:E,functionName:"firstLined",args:[i],blockNumber:f}),u.readContract({address:L,abi:E,functionName:"agentId",blockNumber:f}),u.readContract({address:L,abi:E,functionName:"rules",blockNumber:f}),u.readContract({address:L,abi:E,functionName:"epochRoom",blockNumber:f}),u.readContract({address:C,abi:U,functionName:"bonds",args:[i],blockNumber:f}),u.readContract({address:C,abi:U,functionName:"amount",blockNumber:f}),u.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[i],blockNumber:f}),u.readContract({address:C,abi:U,functionName:"unusedAfter",blockNumber:f}),u.readContract({address:c.usdg,abi:Xt,functionName:"balanceOf",args:[g],blockNumber:f})]);return{owner:R,agent:we(A),firstLined:x===!0,root:BigInt(H),firstLineAmount:BigInt(oe[1]),epochRoom:BigInt(O),bond:ye(J),bondAmount:BigInt(ge),releaseAt:BigInt(Z),unusedAfter:BigInt(se),usdg:BigInt(Te)}}function Ct(e,i){return e.enrolled||e.enrolledAt>0n||e.isRoot||e.defaulted||e.importedFromV1||e.loansRepaid>0n||e.sponsor!==0n||i}function Rt(e,i,g,u){let f=R=>`${e.formatAmount(R.toString(),N)} USDG`;if(i.defaulted)return"it defaulted: the pool marks it, and Priors never lends to it again";if(i.isRoot)return"it is a root: it backs other agents' lines";if(i.delegatedIn>0n){let R=i.sponsor===g?`Priors' treasury (root #${g})`:`root #${i.sponsor}`;return`it has a ${f(i.delegatedIn)} line from ${R}${i.activeLoans>0n?` with ${i.activeLoans} loan(s) open`:""}`}return`it has no line now${i.enrolledAt>0n?` (it enrolled at ${G(i.enrolledAt)})`:""}${u?`; Priors' treasury opened a line for it once, and another needs a person at ${Ge}`:""}`}async function Xe(e,i){let g;try{g=await e.http(me,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(i)})}catch(f){if(!(f instanceof tt))throw new a(`Priors' invite bot (${me}) could not be reached: ${e.plainError(f)}`);g=f.response}let u;try{u=JSON.parse(await g.text())}catch{u=void 0}if(!Y(u))throw new a(`Priors' invite bot (${me}) answered HTTP ${g.status} without a readable JSON object.`);return u}var be=e=>Ee(typeof e=="string"&&e?e:"no reason given");function ln(e,i){let g=i instanceof _t?i.walk(x=>x instanceof Ye):void 0,u=g instanceof Ye?g.data:void 0,f=u?.args??[],R=x=>`${e.formatAmount(String(x),N)} USDG`,A=u?.errorName;switch(A){case"EpochCapReached":return`Priors' treasury has no room for a new line this week (wanted ${R(f[0])}, ${R(f[1])} left); the treasury caps new lines each week, so ask again next week.`;case"InsufficientBacking":return`Priors' treasury root lacks free backing for the line now (requested ${R(f[1])}, free ${R(f[2])}); try again later.`;case"InviteExpired":return"the invite expired; call priors_starter_line again for a new one.";case"InviteUsed":return"the invite was already used.";case"NotInvited":return`the invite's signer ${String(f[1])} is not an inviter TreasurySponsorV4 names.`;case"AlreadyLined":return"the agent is already on a treasury line.";case"OwnerDefaulted":return"a default on this wallet's Priors record stops new treasury lines.";case"BadConsent":return"the pool refused the consent (its owner, nonce or signature no longer matches); call priors_starter_line again.";case"ConsentExpired":return"the consent expired; call priors_starter_line again.";case"Paused":return"the Priors pool is paused for new risk; try again later.";case void 0:return e.plainError(i);default:return`${A}(${f.map(String).join(", ")}).`}}var cn=e=>{let i={name:"priors_lend",inputSchema:{type:"object",properties:{assets:{type:"string",pattern:"^[0-9]+$",description:'USDG deposit amount in 6-decimal base units (e.g. "1000000" for 1 USDG).'},amount:{type:"string",pattern:"^[0-9]+$",description:'Alias for assets: USDG amount in base units (6 decimals). Example: "1000000" = 1 USDG.'},receiver:{type:"string",description:"Optional share receiver address (must be the signing wallet)."},minShares:{type:"string",pattern:"^[0-9]+$",description:"Minimum pool shares in base units; defaults to simulated minted shares less slippage."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points for the simulated share minimum (defaults to 50)."}}},async execute(n,s){z(s);let o=B(s),t=o;if(n.receiver!==void 0&&(typeof n.receiver!="string"||n.receiver.trim().toLowerCase()!==o.toLowerCase()))throw new a("Priors receiver must be the signing wallet.");let r=It(n,"assets","amount","USDG deposit amount");if(r<=0n)throw new a("Deposit amount must be greater than zero.");let p=n.minShares===void 0?void 0:ee(n.minShares),d=e.approval(c.usdg,c.pool,r.toString(),$);if(p===void 0){let l;try{let v=await e.clientFor($).simulateCalls({account:o,calls:[{to:d.to,data:d.data},{to:c.pool,data:X({abi:S,functionName:"deposit",args:[r,t,0n]})}]}),[I,_]=v.results;if(I?.status!=="success"||_?.status!=="success")throw new a("Approval or deposit simulation failed.");l=Jt({abi:S,functionName:"deposit",data:_.data})}catch(v){throw new a(`Could not simulate Priors deposit shares: ${e.plainError(v)}`)}if(p=ee(it(l.toString(),n.slippageBps??ot)),p===0n)throw new a("The simulated deposit cannot provide a positive minimum share amount.")}let w=e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"deposit",args:[r,t,p]}),value:"0",chainId:$,description:`Deposit ${r} USDG base units into Priors CreditPoolV2 (${c.pool}) for ${t}.`}),b=[d,w],m=await e.preview(b,o),P=`Approve ${e.formatAmount(r.toString(),N)} USDG and deposit into Priors CreditPoolV2 (${c.pool}) for ${t} (minShares=${p}; 7-day MIN_HOLD applies a 0.5% early-exit fee on early withdrawals).`;return{txs:b,summary:ne(e,P,m.changes)}}},g={name:"priors_withdraw",inputSchema:{type:"object",properties:{shares:{type:"string",pattern:"^[0-9]+$",description:"Pool share count in base units to redeem (not USDG amount; omit to redeem full wallet share balance)."},receiver:{type:"string",description:"Optional USDG receiver address (must be the signing wallet)."}}},async execute(n,s){z(s);let o=B(s),t=o;if(n.receiver!==void 0&&(typeof n.receiver!="string"||n.receiver.trim().toLowerCase()!==o.toLowerCase()))throw new a("Priors receiver must be the signing wallet.");let r=e.clientFor($),p=n.shares!==void 0?ee(n.shares):await r.readContract({address:c.pool,abi:S,functionName:"shares",args:[o]});if(p<=0n)throw new a(`Wallet ${o} has no Priors CreditPoolV2 shares to withdraw.`);let[d,w,b]=await Promise.all([r.readContract({address:c.pool,abi:S,functionName:"convertToAssets",args:[p]}),r.readContract({address:c.pool,abi:S,functionName:"lastDepositAt",args:[o]}),r.getBlock()]),m=w>0n&&b.timestamp<w+He,h=m?d*yt/$t:0n,P=d-h,v=[e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"withdraw",args:[p,t]}),value:"0",chainId:$,description:`Withdraw ${p} shares from Priors CreditPoolV2 (${c.pool}) to ${t}.`})],I=await e.preview(v,o),_=e.formatAmount(P.toString(),N),F=e.formatAmount(d.toString(),N),k=e.formatAmount(h.toString(),N),D=m?`inside 7-day MIN_HOLD: ${k} USDG (0.5%) early-exit fee stays in pool, net payout ${_} USDG from ${F} USDG gross`:`outside 7-day MIN_HOLD: no early-exit fee, net payout ${_} USDG`,M=`Withdraw ${p} shares from Priors CreditPoolV2 (${c.pool}) to ${t} (${D}).`;return{txs:v,summary:ne(e,M,I.changes)}}},u={name:"priors_borrow",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"ERC-8004 agent token ID with an already-funded Priors credit line."},principal:{type:"string",pattern:"^[0-9]+$",description:'Borrow principal in 6-decimal USDG base units (min "5000000" = 5 USDG).'},amount:{type:"string",pattern:"^[0-9]+$",description:'Alias for principal: USDG amount in base units (6 decimals). Example: "5000000" = 5 USDG.'},term:{type:"string",description:'Loan term in seconds (between 86400 and 2592000; defaults to "86400"). The origination fee is pro-rated by term, so a longer term costs more.'},recipient:{type:"string",description:"Optional USDG recipient address (must be the signing wallet)."},maxFee:{type:"string",description:"Optional fee ceiling in USDG base units (6 decimals); must equal the pool quote for this principal and term. Omit to use it. The fee is pro-rated by term, not flat: 1666 for 5 USDG over 1 day."}}},async execute(n,s){z(s);let o=B(s),t=o;if(n.recipient!==void 0&&(typeof n.recipient!="string"||n.recipient.trim().toLowerCase()!==o.toLowerCase()))throw new a("Priors recipient must be the signing wallet.");let r=await Re(e,n,o);await ze(e,r,o);let p=e.clientFor($),d=await p.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[r]}),w=we(d),b=an(r,w),m=It(n,"principal","amount","USDG borrow principal");if(m<We||m>St)throw new a(`Borrow principal must be between ${We} (5 USDG) and ${St} (500 USDG) base units.`);if(m>b)throw new a(`Borrow principal ${m} exceeds available credit line capacity ${b} USDG base units for agent ${r}.`);let h=n.term!==void 0&&String(n.term).trim()!==""?pe(n.term,"term"):je;if(h<je||h>At)throw new a(`Loan term must be between ${je} (1 day) and ${At} (30 days) seconds.`);let P=await p.readContract({address:c.pool,abi:S,functionName:"quoteFee",args:[r,m,h]}),l=P[0],v=n.maxFee!==void 0?ee(n.maxFee):l;if(v<l)throw new a(`Provided maxFee ${v} is below the origination fee the pool quotes for this term, ${l} USDG base units.`);if(v>l)throw new a(`Provided maxFee ${v} is above the quoted origination fee ${l} USDG base units. Use the quoted fee or omit maxFee.`);let I=m+l,_=m+v,k=[e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"borrow",args:[r,m,h,t,v]}),value:"0",chainId:$,description:`Borrow ${m} USDG base units on Priors CreditPoolV2 for agent ${r} to ${t} (quoted fee ${l}, expected debt ${I}, maxFee ${v}, debt ceiling ${_}).`})],D=await e.preview(k,o),M=e.formatAmount(m.toString(),N),W=e.formatAmount(l.toString(),N),ae=e.formatAmount(I.toString(),N),j=e.formatAmount(v.toString(),N),$e=e.formatAmount(_.toString(),N),q=P[1]+P[3],K=P[2],de=l-q-K,ie=`Borrow ${M} USDG for ERC-8004 agent ${r} to recipient ${t} on Priors CreditPoolV2 (${c.pool}) for ${h}s: expected origination fee ${W} USDG (${l} base units; pro-rated by term, set when the loan opens, none refunded on early repayment), expected total repayment due ${ae} USDG (${I} base units); fee ceiling ${j} USDG (${v} base units), debt ceiling ${$e} USDG (${_} base units). Fee recipient on repayment: CreditPoolV2 (${c.pool}), allocating the quoted fee to sponsor ${w.sponsor} (${q} base units including premium), reserve (${K} base units), and lenders (${de} base units).`;return{txs:k,summary:ne(e,ie,D.changes)}}},f={name:"priors_repay",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"ERC-8004 agent token ID that owns the active loan."},loanId:{type:"string",description:"Optional explicit per-agent loan ID (otherwise recovered from Borrowed receipt logs or loansOf(agentId))."},borrowReceiptLogs:{type:"array",description:"Optional receipt logs array from the borrow transaction to decode the exact Borrowed(loanId, agentId, ...) event."},maxDue:{type:"string",description:"Optional maximum USDG base units to repay; must equal the exact fixed principal + fee. Omit to use that debt."}}},async execute(n,s){z(s);let o=B(s),t=await Re(e,n,o);await ze(e,t,o);let r=e.clientFor($),p;if(n.loanId!==void 0&&n.loanId!==null&&String(n.loanId).trim()!=="")p=pe(n.loanId,"loanId");else{let k=dn(n);if(k.length>0){let D=sn(k,t);D!==null&&(p=BigInt(D))}}let d;if(p!==void 0){let k=await r.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[p]}),D=Ce(p,k);if(D.agentId!==t)throw new a(`Loan ${p} belongs to agent ${D.agentId}, not agent ${t}. Recover loan IDs from the Borrowed receipt or loansOf(agentId), never global loanCount().`);if(D.status!==1)throw new a(`Loan ${p} for agent ${t} is not active (status=${D.status}).`);d=D}else{let k=await r.readContract({address:c.pool,abi:S,functionName:"loansOf",args:[t]});if(k.length===0)throw new a(`ERC-8004 agent ${t} has no recorded loans on Priors CreditPoolV2.`);let M=(await Promise.all(k.map(async W=>{let ae=await r.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[W]});return Ce(W,ae)}))).filter(W=>W.agentId===t&&W.status===1);if(M.length===0)throw new a(`ERC-8004 agent ${t} has no active loans to repay.`);d=M[M.length-1]}let w=d.principal+d.fee,b=n.maxDue!==void 0?ee(n.maxDue):w;if(b<w)throw new a(`Provided maxDue ${b} is below the exact fixed loan debt ${w} USDG base units (principal ${d.principal} + fixed fee ${d.fee}).`);if(b>w)throw new a(`Provided maxDue ${b} is above the exact fixed loan debt ${w} USDG base units. Use the fixed debt or omit maxDue.`);let m=e.approval(c.usdg,c.pool,w.toString(),$),h=e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"repay",args:[d.loanId,t,b]}),value:"0",chainId:$,description:`Repay fixed debt ${w} USDG base units (principal ${d.principal} + fee ${d.fee}) for loan ${d.loanId} (agent ${t}).`}),P=[m,h],l=await e.preview(P,o),v=e.formatAmount(w.toString(),N),I=e.formatAmount(d.principal.toString(),N),_=e.formatAmount(d.fee.toString(),N),F=`Approve and repay ${v} USDG (${w} base units: ${I} USDG principal + ${_} USDG fixed fee) for Priors loan ${d.loanId} (agent ${t}).`;return{txs:P,summary:ne(e,F,l.changes)}}},R={name:"priors_status",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"Optional ERC-8004 agent ID to inspect on CreditPoolV2, PriorsLens, and StockVault."},includeApiCheck:{type:"boolean",description:"Optional flag to query https://priors.trade/api/check for supplemental off-chain metadata."}}},async execute(n,s){z(s);let o=B(s),t=e.clientFor($),[r,p,d,w]=await Promise.all([t.readContract({address:c.pool,abi:S,functionName:"shares",args:[o]}),t.readContract({address:c.pool,abi:S,functionName:"lastDepositAt",args:[o]}),t.getBlock(),t.readContract({address:c.stockVault,abi:Pt,functionName:"assetList"})]),b=r>0n?await t.readContract({address:c.pool,abi:S,functionName:"convertToAssets",args:[r]}):0n,m=r>0n&&p>0n&&d.timestamp<p+He,h=m?b*yt/$t:0n,P=b-h,l=null;if(n.agentId!==void 0&&n.agentId!==null&&String(n.agentId).trim()!=="")l=pe(n.agentId,"agentId");else{let q=await _e(e,o);q.length>0&&(l=q[0])}let v=null,I=!1,_=[],F=null,k=null,D=null,M=null,W=null,ae=null,j=`This wallet owns no ERC-8004 agent identity. ${Ze}`;if(l!==null){let[q,K,de,ie,Ut,Et,Be,Ne,xe]=await Promise.all([t.readContract({address:c.lens,abi:vt,functionName:"score",args:[l]}),t.readContract({address:L,abi:E,functionName:"firstLined",args:[l]}),t.readContract({address:L,abi:E,functionName:"agentId"}),t.readContract({address:L,abi:E,functionName:"rules"}),t.readContract({address:L,abi:E,functionName:"epochRoom"}),t.readContract({address:C,abi:U,functionName:"bonds",args:[l]}),t.readContract({address:C,abi:U,functionName:"amount"}),t.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[l]}),t.readContract({address:C,abi:U,functionName:"releasable",args:[l]})]),[Gt,Vt,Ft,Mt,qt,Ht]=await Promise.all([t.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[l]}),t.readContract({address:c.pool,abi:S,functionName:"loansOf",args:[l]}),t.readContract({address:c.lens,abi:vt,functionName:"available",args:[l]}),t.readContract({address:c.stockVault,abi:Pt,functionName:"borrowRoom",args:[l]}),t.readContract({address:c.pool,abi:S,functionName:"delegateOf",args:[l]}),t.readContract({address:c.pool,abi:S,functionName:"isController",args:[l,o]})]),Le=await De(e,l),Wt=B(qt),Ke=Ht,y=we(Gt),Se=y.delegatedIn>y.principalOut?y.delegatedIn-y.principalOut:0n;I=y.enrolled&&!y.isRoot&&!y.defaulted&&!y.frozen&&y.sponsor>0n&&y.delegatedIn>0n,F=Ft.toString(),k=Mt.toString();let jt=await Promise.all(Vt.map(async T=>{let le=await t.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[T]});return Ce(T,le)}));for(let T of jt)if(T.agentId===l&&T.status===1){let le=T.principal+T.fee;_.push({loanId:T.loanId.toString(),agentId:T.agentId.toString(),sponsorId:T.sponsorId.toString(),principal:T.principal.toString(),fee:T.fee.toString(),due:le.toString(),dueAt:T.dueAt.toString(),issuedAt:T.issuedAt.toString(),owner:T.owner,token:te})}v={agentId:l.toString(),owner:Le,delegate:Wt,isAuthorizedController:Ke,enrolled:y.enrolled,isRoot:y.isRoot,defaulted:y.defaulted,frozen:y.frozen,sponsorId:y.sponsor.toString(),delegatedIn:y.delegatedIn.toString(),delegatedOut:y.delegatedOut.toString(),principalOut:y.principalOut.toString(),availableCapacity:Se.toString(),activeLoansCount:y.activeLoans.toString(),loansRepaid:y.loansRepaid.toString(),volumeRepaid:y.volumeRepaid.toString(),feesPaid:y.feesPaid.toString(),importedFromV1:y.importedFromV1,qualifiedRepaid:y.qualifiedRepaid.toString(),dollarSecondsRepaid:y.dollarSecondsRepaid.toString()};let Ae=BigInt(de),Oe=K===!0,Q=ye(Et),re=Q.depositor!==Je,ve=re&&V(Q.depositor,o),Qe=Ct(y,Oe),Ue=V(Le,o);D={onchain:BigInt(q).toString(),scale:"0-1000",source:`CreditLensV2.score(${l}) at ${c.lens}, the score the pool computes on chain`,scoreV2:null},M={open:y.sponsor!==0n&&y.delegatedIn>0n,amount:y.delegatedIn.toString(),drawn:y.principalOut.toString(),available:Se.toString(),sponsorId:y.sponsor.toString(),backer:y.sponsor===0n?null:y.sponsor===Ae?`Priors' treasury v4 (root #${Ae})`:`root #${y.sponsor}`,token:te},W={contract:C,posted:re,depositor:re?Q.depositor:null,postedByWallet:ve,postedAt:re?Q.at.toString():null,amount:(re?Q.amount:BigInt(Be)).toString(),releasable:re&&xe===!0,releaseAt:re?BigInt(Ne).toString():null,rule:"Back to its depositor once the agent holds no line and has no loan open, from 4 days after it was posted (close a line first with priors_close_line); a default forfeits it to Priors' Safe."},ae={eligible:Ue&&!Qe,firstLined:Oe,lineAmount:BigInt(ie[1]).toString(),bondAmount:BigInt(Be).toString(),treasuryRoot:Ae.toString(),treasuryRoomThisWeek:BigInt(Ut).toString(),note:"Not instant: Priors' invite bot decides each invite, and the treasury caps new lines each week."};let fe=_.map(T=>({id:String(T.loanId),dueAt:BigInt(String(T.dueAt))})).sort((T,le)=>T.dueAt<le.dueAt?-1:T.dueAt>le.dueAt?1:0);y.defaulted?j=`Agent #${l} defaulted; Priors never lends to it again${ve?" and its bond is forfeited":""}.`:!Ke&&!Ue?j=`This wallet does not control agent #${l} on CreditPoolV2 (owner ${Le}); act from its owner or delegate.`:fe.length?j=`Repay loan ${fe[0].id} with priors_repay before it is due at ${G(fe[0].dueAt)}${fe.length>1?` (${fe.length} loans open)`:""}.`:I&&Se>=We?j=`Borrow with priors_borrow (5 USDG minimum, up to ${A(Se)}; the fee is pro-rated by term); Priors counts loans held 7 days or more toward the score.`:!Qe&&Ue?j=ve?`Call priors_starter_line again: the ${A(Q.amount)} bond is posted, and it goes on with the invite bot's ownership proof and the invite's redemption${xe===!0?", or priors_release_bond returns the bond":""}.`:`Call priors_starter_line: a refundable ${A(BigInt(Be))} bond, an invite from Priors' invite bot and your pool consent open a ${A(BigInt(ie[1]))} line from Priors' treasury (each transaction and signature is confirmed).`:ve?j=xe===!0?`Release the ${A(Q.amount)} invite bond with priors_release_bond.`:y.delegatedIn>0n?`The line is open with nothing to draw; to take the bond back, close it with priors_close_line, then priors_release_bond from ${G(BigInt(Ne))}.`:`The ${A(Q.amount)} invite bond comes back with priors_release_bond from ${G(BigInt(Ne))}.`:j=`Agent #${l} has a Priors record but no line to draw now; ${Rt(e,y,Ae,Oe)}.`}let $e=null;if(n.includeApiCheck){let q=l!==null?`agent=${l.toString()}`:`address=${o}`,K=await nt(e.http,`${en}?${q}`,{method:"GET"},Y),de=Array.isArray(K.agents)?K.agents.find(ie=>Y(ie)&&String(ie.agentId)===String(l)):void 0;D&&Y(de)&&(D.scoreV2=de.scoreV2??null),$e={...K,grantsPoolControl:!1,controlRule:"Off-chain /api/check identity or paymentWallet match never grants CreditPoolV2 control; on-chain isController(agentId, wallet) must authorize the caller; stale delegates do not qualify."}}return{chainId:$,blockNumber:d.number?.toString()??null,blockTimestamp:d.timestamp.toString(),wallet:o,token:te,contracts:c,lender:{shares:r.toString(),grossAssets:b.toString(),earlyExitFeeAssets:h.toString(),netWithdrawAssets:P.toString(),lastDepositAt:p.toString(),withinMinHoldWindow:m,minHoldSeconds:He.toString()},hasFundedLine:I,agentId:l!==null?l.toString():null,nextStep:j,score:D,line:M,bond:W,starterLine:ae,agent:v,activeLoans:_,lens:{address:c.lens,available:F,caveat:"PriorsLens.available(agentId) is a status capacity hint for already-funded lines; backer hooks may still refuse borrows."},stockVault:{address:c.stockVault,borrowRoom:k,onchainAssetCount:w.length,hostedMcpStockCount:35,extraNonStockAsset:B(tn),zeroCapAssets:nn.map(q=>B(q)),caveat:"Use priors_stock_assets and priors_stock_asset_state for current collateral rules, then priors_stock_open. This summary is an observed asset-count snapshot, not a fixed allowlist; live caps, lending holds and prices control admission."},apiCheck:$e,limitations:["Borrowing and repayment require a sponsor-backed ERC-8004 credit line (enrolled && !isRoot && sponsor != 0) authorized on-chain by isController(agentId, wallet).","Priors line routes are exposed by priors_line_options and priors_capabilities: treasury starter, V5 move/raise, direct sponsor, stock and owner PRIORS backing. Ethos execution uses Priors own owner workflow because its worker supplies no unsigned final transaction.","score.onchain is the pool's on-chain score (CreditLensV2); score.scoreV2 is Priors Score v2 from /api/check, present only with includeApiCheck.","Loan debt is the principal plus the origination fee the pool quotes for the term. The fee is pro-rated by term, not flat (1666 base units for 5 USDG over 1 day, observed live 2026-10-31; priors_borrow shows the exact quote), and is fixed once the loan opens: variable interest is never invented, and early repayment refunds none of it.","Loan IDs are recovered from decoded Borrowed receipts or per-agent loansOf(agentId), never global loanCount().","Historical archive event queries and zero-position StockVault lines on public RPCs remain subject to archive retention and live backer state."]}}},A=n=>`${e.formatAmount(n.toString(),N)} USDG`;function x(n){let s=V(n.bond.depositor,n.owner)&&n.bond.amount>0n?n.bond.amount:n.bondAmount;return`Bond first: ${A(s)} is locked in Priors' InviteBond for at least ${n.unusedAfter} seconds (${Number(n.unusedAfter)/86400} days) after posting${n.releaseAt>0n?`; unusedReleaseAt is ${G(n.releaseAt)}`:"; the exact release time is read after posting"}. Release requires no line and no open loan; default can forfeit the bond. Invites are not guaranteed. The credit score can lag qualifying repayments. `}function H(n,s,o){if(!V(o.owner,s))throw new a(`This wallet (${s}) does not own ERC-8004 agent ${n} (its owner is ${o.owner}). The bond, the ownership proof and the pool consent are the owner's. Nothing was signed.`);if(o.root!==Ie)throw new a(`TreasurySponsorV4 (${L}) answers root #${o.root}, not the pinned #${Ie}. Nothing was signed; update Oak.`);if(Ct(o.agent,o.firstLined))throw new a(`Agent #${n} already has a Priors record, so priors_starter_line posts no bond and signs nothing: ${Rt(e,o.agent,o.root,o.firstLined)}; ${o.agent.loansRepaid} loan(s) repaid. The starter line is only for an identity with no record; priors_status shows this one.`)}let oe="stays posted in InviteBond";function O(n){let s=n.agent.delegatedIn>0n?`with a line open it comes back only after priors_close_line (no loan open), then priors_release_bond from ${G(n.releaseAt)} at the earliest`:`while the agent holds no line it comes back with priors_release_bond from ${G(n.releaseAt)} (${Number(n.unusedAfter)/86400} days after it was posted)`;return`The ${A(n.bond.amount>0n?n.bond.amount:n.bondAmount)} bond ${oe} (${C}), posted from this wallet; ${s}, and priors_starter_line never posts a second bond.`}async function J(n,s,o){try{return await o()}catch(t){let r=t instanceof a?t.message:e.plainError(t);if(r.includes(oe)||n===void 0||!/^[0-9]{1,78}$/.test(n))throw t;let p;try{let d=await he(e,BigInt(n),s);p=V(d.bond.depositor,s)?O(d):""}catch{p=`If the bond transactions mined, the invite bond ${oe} (${C}) remains locked until its on-chain release conditions are met; priors_status shows the exact amount and time (its state could not be read just now).`}throw p?new a(`${r} ${p}`):t}}async function ge(n,s,o){let t=lt(await Xe(e,{agentId:n}),{agentId:n,owner:s,now:ue()});if(!t.ok&&t.refused)throw new a(`Priors' invite bot gave no ownership proof to sign for agent #${n}: ${be(t.why)}. Nothing was signed. ${o}`.trim());if(!t.ok)throw new a(`Not signed: the invite bot's answer for agent #${n} is not one Oak signs: ${t.why}. Oak signs only the bot's own start-page text, rebuilt locally for this agent and this wallet. ${o}`.trim());if(t.exp-ue()<120)throw new a(`Not signed: the invite bot's proof for agent #${n} expires in under 2 minutes; call priors_starter_line again for a new one. ${o}`.trim());return t}function Z(n,s,o,t){return{steps:[{kind:"message",message:o.message}],continuation:{stage:"proof",wallet:s,chainId:$,agentId:n,n:o.n,exp:o.exp},summary:`${x(t)}Priors starter line for ERC-8004 agent ${n}, step 2 of 3: sign Priors' invite-bot ownership proof. It is a message signature (EIP-191) only: it sends no transaction and moves no funds. The text is the bot's own form, rebuilt locally for agent #${n} and this wallet, request ${o.n}, expiring ${G(o.exp)}. Oak then sends the signature to ${me}, and the bot decides the invite. ${O(t)}`}}function se(n,s,o){if(n.chainId!==$||typeof n.wallet!="string"||!V(n.wallet,s)||typeof n.agentId!="string"||!/^[1-9][0-9]{0,29}$/.test(n.agentId))throw new a("Priors starter-line continuation does not match this wallet or chain 4663; start priors_starter_line again.");if(o.agentId!==void 0&&String(o.agentId)!==n.agentId)throw new a("Priors starter-line continuation is for another agent; start priors_starter_line again.");return BigInt(n.agentId)}async function Te(n,s){let o;if(n.agentId!==void 0&&n.agentId!==null&&String(n.agentId).trim()!=="")o=pe(n.agentId,"agentId");else{let l=await _e(e,s);if(!l.length)throw new a(`Priors' starter line needs an ERC-8004 agent identity, and this wallet owns none. ${Ze}`);o=l[0]}let t=await he(e,o,s);H(o,s,t);let r=o.toString(),p=V(t.bond.depositor,s);if(!p){if(t.usdg<t.bondAmount)throw new a(`This wallet holds ${A(t.usdg)} on Robinhood Chain, and Priors' treasury invite asks a ${A(t.bondAmount)} bond first (InviteBond ${C}), posted from this wallet. Nothing was signed: add USDG, then call priors_starter_line again.`);if(t.epochRoom<t.firstLineAmount)return{summary:`${x(t)}Not submitted. Priors' treasury has ${A(t.epochRoom)} of room left this week and a first line is ${A(t.firstLineAmount)}, so priors_starter_line posted no bond and signed nothing. The treasury caps new lines each week: ask again next week.`,starterLine:{agentId:r,open:!1,reason:"room",epochRoom:t.epochRoom.toString()}};let l=await Xe(e,{check:!0,owner:s.toLowerCase()});if(l.check!==!0)throw new a("Priors' invite bot did not answer its check, so whether an invite is open cannot be told. Nothing was signed.");if(l.ok!==!0)throw new a(`Whether an automatic invite is open could not be told: Priors' invite bot says ${be(l.error)}. Nothing was signed; try again later.`);if(l.open!==!0){let v=typeof l.reason=="string"?l.reason.replace(/[^a-z-]/g,"").slice(0,24):"",I=typeof l.reopensAt=="number"&&Number.isSafeInteger(l.reopensAt)&&l.reopensAt>0?l.reopensAt:null;return{summary:`${x(t)}Not submitted. No automatic invite is open to this wallet right now, so priors_starter_line posted no bond and signed nothing. Priors' invite bot answers: closed, reason ${Ee(v||"none given")}${I?`, reopens ${G(I)}`:""}. ${ct({...l,reason:v})} Priors lists its other ways to a first line (the Ethos lane, a stock line, the owner's $PRIORS stake) at https://priors.trade/skill.md.`,starterLine:{agentId:r,open:!1,reason:v||null,reopensAt:I}}}}let d=await ge(r,s,p?O(t):"");if(p)return Z(r,s,d,t);let w=[e.approval(c.usdg,C,t.bondAmount.toString(),$),e.unsignedTx({to:C,data:X({abi:U,functionName:"deposit",args:[o]}),value:"0",chainId:$,description:`Post the ${t.bondAmount} USDG base-unit Priors invite bond for agent ${r} in InviteBond (${C}).`})],b=await e.preview(w,s),m=t.bond.depositor!==Je?` This deposit replaces the bond ${t.bond.depositor} posted for this agent; InviteBond returns that bond to it in the same transaction.`:"",h=`${x(t)}Priors starter line for ERC-8004 agent ${r}, step 1 of 3: approve exactly ${A(t.bondAmount)} to Priors' InviteBond (${C}) and post it as the agent's refundable invite bond (InviteBond.deposit).${m} Priors' invite bot says an automatic invite is open now and gave the ownership proof to sign next. Step 2 signs that proof (a message, no transaction); step 3 signs your pool consent and redeems the invite (TreasurySponsorV4.firstLine, ${L}) for a ${A(t.firstLineAmount)} line from Priors' treasury (root #${t.root}). The invite is the bot's decision, not a promise: if it refuses, or any later step fails, the bond stays posted and comes back with priors_release_bond after the on-chain lock and release conditions are met. With a line, the bond comes back only once the line is closed with no loan open (priors_close_line, then priors_release_bond); a default forfeits it to Priors' Safe.`;return{steps:w.map(l=>({kind:"tx",tx:l})),continuation:{stage:"bond",wallet:s,chainId:$,agentId:r,n:d.n,exp:d.exp},summary:ne(e,h,b.changes)}}async function Dt(n,s,o){let t=await he(e,n,s);H(n,s,t);let r=n.toString();if(!V(t.bond.depositor,s))throw new a(`The invite bond for agent #${r} is not on chain from this wallet, so nothing more was signed. Check the deposit transaction, then call priors_starter_line again.`);return typeof o.n=="string"&&Ve.test(o.n)&&typeof o.exp=="number"&&Number.isSafeInteger(o.exp)&&o.exp-ue()>=300?Z(r,s,{n:o.n,exp:o.exp,message:Me(r,o.n,o.exp)},t):Z(r,s,await ge(r,s,O(t)),t)}async function Tt(n,s,o,t){let r=n.toString();if(typeof o.n!="string"||!Ve.test(o.n)||typeof o.exp!="number"||!Number.isSafeInteger(o.exp))throw new a("Invalid Priors starter-line proof continuation; start priors_starter_line again.");if(typeof t!="string"||!/^0x[0-9a-fA-F]{130}$/.test(t))throw new a("Provide this wallet's signature of the invite bot's ownership proof.");if(o.exp<=ue())throw new a(`The invite bot's proof for agent #${r} expired before it reached the bot; nothing was sent to it. Call priors_starter_line again for a fresh proof (the bond is not posted again).`);let p=Me(r,o.n,o.exp);if(!V(await Kt({message:p,signature:t}),s))throw new a("The ownership-proof signature is not this wallet's; nothing was sent to the invite bot.");let d=await he(e,n,s);if(H(n,s,d),!V(d.bond.depositor,s))throw new a(`The invite bond for agent #${r} is not on chain from this wallet; nothing was sent to the invite bot. Call priors_starter_line again.`);let w=await Xe(e,{n:o.n,signature:t});if(w.ok!==!0)throw new a(`Priors' invite bot gave no invite for agent #${r}: ${be(w.error)}. ${O(d)}`);if(typeof w.code!="string")throw new a(`Priors' invite bot gave no invite for agent #${r}${w.reason?`: ${be(w.reason)}`:""}${typeof w.decided=="string"?` (its decision: ${be(w.decided)})`:""}. ${O(d)}`);let b=qe(w.code,r,ue()+60);if(!b.ok)throw new a(`Priors' invite bot's code for agent #${r} is not one Oak redeems: ${b.why}. Nothing more was signed. ${O(d)}`);let m=e.clientFor($),h=await m.readContract({address:L,abi:E,functionName:"inviteDigest",args:[n,b.expiry]});if(h.toLowerCase()!==dt(n,b.expiry).toLowerCase())throw new a("TreasurySponsorV4's invite digest differs from its pinned EIP-712 domain; nothing more was signed. Update Oak.");let P=await Zt({hash:h,signature:b.signature}),[l,v]=await Promise.all([m.readContract({address:L,abi:E,functionName:"inviters",args:[P]}),m.readContract({address:L,abi:E,functionName:"inviteUsed",args:[h]})]);if(l!==!0)throw new a(`Priors' invite for agent #${r} was signed by ${P}, which TreasurySponsorV4 does not name an inviter, so the treasury would refuse it. Nothing more was signed. ${O(d)}`);if(v===!0)throw new a(`Priors' invite for agent #${r} was already used. Nothing more was signed. ${O(d)}`);let[I,_]=await Promise.all([m.readContract({address:c.pool,abi:S,functionName:"nonces",args:[n]}),m.getBlock()]),F=_.timestamp+BigInt(st),k=Fe({agentId:r,owner:s,nonce:I.toString(),deadline:F.toString()}),D=await m.readContract({address:c.pool,abi:S,functionName:"consentDigest",args:[{agentId:n,sponsorId:d.root,owner:s,maxPremiumBps:0n,nonce:I,deadline:F}]});if(D.toLowerCase()!==at(k).toLowerCase())throw new a(`The pool's consentDigest (${D}) differs from the consent Oak builds for CreditPoolV2 (${c.pool}), so the pool would refuse it. Nothing more was signed. ${O(d)}`);return{steps:[{kind:"typedData",request:k}],continuation:{stage:"consent",wallet:s,chainId:$,agentId:r,invite:w.code,request:k},summary:`Priors starter line for ERC-8004 agent ${r}, step 3 of 3: Priors' invite bot gave an invite (signed by ${P}, an inviter TreasurySponsorV4 names; it expires ${G(b.expiry)}). Sign your pool consent (EIP-712 "Priors Credit" version 2 on CreditPoolV2 ${c.pool}): it lets Priors' treasury (root #${d.root}) back a line for agent #${r} with premium 0, nonce ${I}, valid until ${G(F)}. A transaction redeeming the invite (TreasurySponsorV4.firstLine) follows for your confirmation. ${O(d)}`}}async function Bt(n,s,o,t){let r=n.toString();if(typeof t!="string"||!/^0x[0-9a-fA-F]{130}$/.test(t))throw new a("Provide this wallet's signature of the Priors pool consent.");let p=qe(o.invite,r,ue()+60);if(!p.ok)throw new a(`The invite for agent #${r} is not one Oak redeems now: ${p.why}. Call priors_starter_line again for a new one.`);let d=Y(o.request)&&Y(o.request.message)?o.request.message:void 0;if(!d||typeof d.nonce!="string"||!/^[0-9]{1,78}$/.test(d.nonce)||typeof d.deadline!="string"||!/^[0-9]{1,20}$/.test(d.deadline))throw new a("Invalid Priors starter-line consent continuation; start priors_starter_line again.");let w=Fe({agentId:r,owner:s,nonce:d.nonce,deadline:d.deadline});if(!V(await Qt({...w,signature:t}),s))throw new a("The pool-consent signature is not this wallet's for the consent Oak built; nothing was offered.");let b=await he(e,n,s);H(n,s,b);let m=e.clientFor($),[h,P]=await Promise.all([m.readContract({address:c.pool,abi:S,functionName:"nonces",args:[n]}),m.getBlock()]);if(h.toString()!==d.nonce)throw new a(`Agent #${r}'s consent nonce moved on chain since it was signed; nothing was offered. Call priors_starter_line again.`);if(P.timestamp>=BigInt(d.deadline))throw new a(`The pool consent for agent #${r} expired at ${G(BigInt(d.deadline))}; nothing was offered. Call priors_starter_line again.`);let l={agentId:n,sponsorId:Ie,owner:s,maxPremiumBps:0n,nonce:h,deadline:BigInt(d.deadline)},v=[n,p.expiry,p.signature,l,t];try{await m.simulateContract({address:L,abi:E,functionName:"firstLine",args:v,account:s})}catch(k){throw new a(`TreasurySponsorV4.firstLine for agent #${r} would be refused: ${ln(e,k)} Nothing was offered. ${O(b)}`)}let I=e.unsignedTx({to:L,data:X({abi:E,functionName:"firstLine",args:v}),value:"0",chainId:$,description:`Redeem Priors' invite for agent ${r}: TreasurySponsorV4.firstLine opens a ${b.firstLineAmount} USDG base-unit line from root ${b.root} with the owner's consent.`}),_=await e.preview([I],s),F=`Redeem agent #${r}'s Priors invite: TreasurySponsorV4.firstLine (${L}) opens a ${A(b.firstLineAmount)} line from Priors' treasury (root #${b.root}) with your signed consent. No USDG moves in this transaction. Then priors_status shows the line and priors_borrow draws it (5 USDG minimum; the fee is pro-rated by term; Priors counts loans held 7 days or more toward the score). The ${A(b.bondAmount)} bond stays in InviteBond until the line is closed with no loan open (priors_close_line, then priors_release_bond, from ${G(b.releaseAt)} at the earliest); a default forfeits it.`;return{txs:[I],summary:ne(e,F,_.changes)}}let Nt={name:"priors_starter_line",inputSchema:{description:"Bond first: the launch bond is 5 USDG, locked at least 4 days. The first result reads amount(), unusedAfter() and unusedReleaseAt(agentId) for current terms before any approval. Invites are not guaranteed; the credit score can lag. Release needs no line or open loan; default can forfeit the bond.",type:"object",additionalProperties:!1,properties:{agentId:Pe("ERC-8004 agent ID this wallet owns, with no Priors record yet (default: the first identity this wallet owns)."),continuation:{type:"object",description:"Opaque state from the previous starter-line step; pass it back unchanged. Omit on the first call; never build it by hand."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Local signature for the confirmed starter-line step, as 0x hex; the bridge supplies it. Never a key."}}},async execute(n,s){z(s);let o=B(s);if(n.continuation===void 0){if(n.signature!==void 0)throw new a("A signature needs its Priors starter-line continuation; start priors_starter_line again.");return J(typeof n.agentId=="string"?n.agentId:void 0,o,()=>Te(n,o))}if(!Y(n.continuation))throw new a("Invalid Priors starter-line continuation; start priors_starter_line again.");let t=n.continuation,r=se(t,o,n),p=d=>J(r.toString(),o,d);if(t.stage==="bond"){if(n.signature!==void 0)throw new a("The bond stage takes no signature; start priors_starter_line again.");return p(()=>Dt(r,o,t))}if(t.stage==="proof")return p(()=>Tt(r,o,t,n.signature));if(t.stage==="consent")return p(()=>Bt(r,o,t,n.signature));throw new a("Unknown Priors starter-line stage; start priors_starter_line again.")}},xt={name:"priors_close_line",inputSchema:{type:"object",properties:{agentId:Pe("ERC-8004 agent ID whose Priors line to close (default: the first identity this wallet owns).")}},async execute(n,s){z(s);let o=B(s),t=await Re(e,n,o);await ze(e,t,o);let r=e.clientFor($),[p,d,w,b]=await Promise.all([r.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[t]}),r.readContract({address:C,abi:U,functionName:"bonds",args:[t]}),r.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[t]}),r.readContract({address:L,abi:E,functionName:"agentId"})]),m=we(p);if(m.sponsor===0n)throw new a(`Agent #${t} has no Priors line to close (no sponsor on CreditPoolV2).`);if(m.activeLoans>0n)throw new a(`Agent #${t} has ${m.activeLoans} loan(s) open; repay them with priors_repay first. The pool's leave refuses while a loan is open.`);let h=ye(d),P=m.sponsor===BigInt(b),l=e.unsignedTx({to:c.pool,data:X({abi:S,functionName:"leave",args:[t]}),value:"0",chainId:$,description:`Close agent ${t}'s Priors line on CreditPoolV2 (leave): the ${m.delegatedIn} USDG base-unit line returns to root ${m.sponsor}.`}),v=await e.preview([l],o),I=V(h.depositor,o)?` Its ${A(h.amount)} invite bond can then come back with priors_release_bond from ${G(w)} (4 days after it was posted).`:"",_=`Close agent #${t}'s Priors line (CreditPoolV2.leave, ${c.pool}): the whole ${A(m.delegatedIn)} line goes back to its backer (${P?`Priors' treasury, root #${b}`:`root #${m.sponsor}`}) and the agent can no longer borrow on it. This does not reopen: ${P?`priors_starter_line opens no second treasury line for an agent with a Priors record; another needs a person at ${Ge}.`:"a new line needs a backer's new consent."}${I} No USDG moves in this transaction.`;return{txs:[l],summary:ne(e,_,v.changes)}}},Lt={name:"priors_release_bond",inputSchema:{type:"object",properties:{agentId:Pe("ERC-8004 agent ID whose InviteBond bond this wallet posted (default: the first identity this wallet owns).")}},async execute(n,s){z(s);let o=B(s),t=await Re(e,n,o),r=e.clientFor($),[p,d,w,b,m]=await Promise.all([r.readContract({address:C,abi:U,functionName:"bonds",args:[t]}),r.readContract({address:C,abi:U,functionName:"releasable",args:[t]}),r.readContract({address:C,abi:U,functionName:"unusedReleaseAt",args:[t]}),r.readContract({address:c.pool,abi:S,functionName:"getAgent",args:[t]}),r.getBlock()]),h=ye(p);if(h.depositor===Je)throw new a(`Agent #${t} has no bond in Priors' InviteBond (${C}).`);if(!V(h.depositor,o))throw new a(`Agent #${t}'s InviteBond bond was posted by ${h.depositor}, not this wallet, and InviteBond.release pays the depositor. Oak releases only a bond this wallet posted.`);if(d!==!0){let I=we(b),_=I.defaulted?"the agent defaulted, so the bond is forfeited to Priors' Safe (InviteBond.slash)":I.activeLoans>0n?`the agent has ${I.activeLoans} loan(s) open: repay with priors_repay, close the line with priors_close_line, then release`:I.delegatedIn>0n?`the agent still holds a ${A(I.delegatedIn)} line: close it with priors_close_line (no loan may be open), then release`:m.timestamp<w?`it comes back 4 days after it was posted, from ${G(w)}`:"InviteBond does not release it yet";throw new a(`Agent #${t}'s ${A(h.amount)} invite bond cannot be released now: ${_}. Nothing was signed.`)}let P=e.unsignedTx({to:C,data:X({abi:U,functionName:"release",args:[t]}),value:"0",chainId:$,description:`Release agent ${t}'s ${h.amount} USDG base-unit Priors invite bond from InviteBond (${C}) to its depositor ${h.depositor}.`}),l=await e.preview([P],o),v=`Release agent #${t}'s ${A(h.amount)} invite bond from Priors' InviteBond (${C}): InviteBond.release returns it to its depositor, this wallet (${o}).`;return{txs:[P],summary:ne(e,v,l.changes)}}};async function Ot(n){z(n);let s=B(n),o=e.clientFor($),[t,r]=await Promise.all([o.readContract({address:c.pool,abi:S,functionName:"shares",args:[s]}),_e(e,s)]),p=[];if(t>0n){let d=await o.readContract({address:c.pool,abi:S,functionName:"convertToAssets",args:[t]});p.push({module:"priors",id:`priors:lender:${s.toLowerCase()}`,chainId:$,assets:[{token:te,amount:d.toString()}],description:`Priors CreditPoolV2 lender position (${t} shares = ${e.formatAmount(d.toString(),N)} USDG gross).`})}for(let d of r){let w=await o.readContract({address:c.pool,abi:S,functionName:"loansOf",args:[d]}),b=await Promise.all(w.map(async h=>{let P=await o.readContract({address:c.pool,abi:S,functionName:"getLoan",args:[h]});return Ce(h,P)}));for(let h of b)if(h.agentId===d&&h.status===1){let P=h.principal+h.fee;p.push({module:"priors",id:`priors:loan:${h.loanId.toString()}`,chainId:$,assets:[],liabilities:[{token:te,amount:P.toString()}],economics:{principal:[],debt:[rt({token:te,amount:P.toString(),source:"priors.loan.fixedDue",dueAt:h.dueAt.toString()})],rewards:[],backing:[],coverage:{complete:!0}},description:`Priors CreditPoolV2 active loan ${h.loanId} for agent ${d} (fixed due ${e.formatAmount(P.toString(),N)} USDG = ${h.principal} principal + ${h.fee} fee).`})}let m=ye(await o.readContract({address:C,abi:U,functionName:"bonds",args:[d]}));m.amount>0n&&V(m.depositor,s)&&p.push({module:"priors",id:`priors:bond:${d.toString()}`,chainId:$,assets:[{token:te,amount:m.amount.toString()}],description:`Priors invite bond for agent ${d} in InviteBond (${C}): ${A(m.amount)}, back with priors_release_bond once the agent holds no line and no loan, from 4 days after posting; a default forfeits it.`})}return p.push(...await ft(e,s,r,te)),p}return{tools:[i,g,u,f,R,Nt,xt,Lt],positions:Ot}},un=e=>{let i=cn(e),g=[i,ut(e),pt(e),mt(e),ht(e),bt(e),wt(e),gt()];return{...i,tools:g.flatMap(u=>u.tools)}},Bn=e=>et("priors",[un(e)]);export{en as a,He as b,yt as c,$t as d,We as e,St as f,je as g,At as h,c as i,te as j,sn as k,un as l,Bn as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseAbi as e}from"viem";var t=e(["function register()","function draw(uint256 id, uint256 amount, uint8 kind)","function deliver(uint256 id, bytes32 proof)","function decline(uint256 id)","function job(uint256 id) view returns ((address customer, uint40 dueAt, uint40 deliveredAt, uint8 state, bool allowEarly, bool late, address agent, uint256 price, uint256 early, uint256 fromPool, bytes32 proof))","function agent(address who) view returns ((bool registered, bool barred, uint40 firstSettledAt, uint32 settled, uint32 settledAtHalf, uint32 notDelivered, uint32 unanswered, uint32 customers, uint32 onTime, uint32 late, uint32 advancesRepaid, uint32 advancesNotRepaid, uint32 earlyKept, uint256 bond, uint256 feesPaid, uint256 advancedNow, uint256 volume))","function canDrawOn(uint256 id) view returns (uint256 early, uint256 fromPool)","function owed(address who) view returns (uint256)","function burnPot() view returns (address)","function gateway() view returns (address)","function BPS() view returns (uint256)","function ADVANCE_MAX_BPS() view returns (uint256)","function ADVANCE_FEE_BPS() view returns (uint256)","function JOB_FEE_BPS() view returns (uint256)","function REJECTED_BPS() view returns (uint256)","function POOL_OUT_MAX_BPS() view returns (uint256)","function MIN_JOB() view returns (uint256)","function MIN_DUE() view returns (uint256)","function MAX_DUE() view returns (uint256)","function GRACE() view returns (uint256)","function REVIEW() view returns (uint256)","function CUSTOMER_FEES_MIN() view returns (uint256)","event Advanced(uint256 indexed id, address indexed agent, uint8 kind, uint256 amount, uint256 fee)","event BondAdded(address indexed agent, uint256 amount, uint256 bond)","event BondTaken(address indexed agent, uint256 amount, uint256 bond)","event Collected(address indexed who, address indexed to, uint256 amount)","event Declined(uint256 indexed id, address indexed agent, uint256 toCustomer)","event Delivered(uint256 indexed id, address indexed agent, bytes32 proof, bool late)","event Locked(uint256 indexed id, address indexed customer, address indexed agent, uint256 price, uint256 dueAt, bool allowEarly)","event Owed(address indexed who, uint256 amount)","event PoolIn(address indexed from, uint256 amount)","event Refunded(uint256 indexed id, address indexed agent, uint256 toCustomer, uint256 notRepaid, uint256 fromBond, uint256 lost)","event Registered(address indexed agent)","event Settled(uint256 indexed id, address indexed agent, uint256 toAgent, uint256 poolRepaid, uint256 jobFee)","event SettledAtHalf(uint256 indexed id, address indexed agent, uint256 toCustomer, uint256 toAgent, uint256 poolRepaid, uint256 jobFee)","error AlreadyRegistered()","error BadDueTime()","error Barred()","error EarlyNotAllowed()","error GasShort()","error NotAgent()","error NotCustomer()","error NotRegistered()","error NothingOwed()","error OverBond(uint256 room)","error OverHalf(uint256 room)","error OverLimit(uint256 room)","error OwesThePool(uint256 amount)","error PoolShort(uint256 room)","error PushFailed()","error ReentrancyGuardReentrantCall()","error TooLate()","error TooSmall(uint256 minimum)","error TooSoon(uint256 at)","error WrongState(uint8 state)","error ZeroAddress()","error ZeroAmount()"]),r=e(["function keyOf(address account) view returns (address)","function desk() view returns (address)"]);export{t as a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as O}from"./X24YTJST.js";import{a as V}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{g as D}from"./NWNYJ26T.js";import{b as v,j as _}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as E,encodeAbiParameters as K,encodeFunctionData as h,getAddress as P,keccak256 as Y,parseAbi as H,parseAbiParameters as B}from"viem";var y=P("0xCe5c1aFa115fF8b1D6913509bfc79D9AE08CC857"),G=P("0x0FBad98595b0186dA120E41f77C102beb49f803c"),N=B("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),A="(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)",m=H(["function vaultV2Factory() view returns (address)","function vaultData(address) view returns (bool canPullFromIdle,uint64 penalty)","function absoluteCap(address,bytes32) view returns (uint256)","function canPullFromMarket(address,bytes32) view returns (bool)","function isActiveAdapter(address,address) view returns (bool)",`function reallocate(address vault,address deallocateAdapter,${A} deallocateMarketParams,address allocateAdapter,${A} allocateMarketParams,uint128 assets,uint64 penalty)`,`function allocateFromIdle(address vault,address adapter,${A} marketParams,uint128 assets,uint64 penalty)`,`function setAbsoluteCap(address vault,address adapter,${A} marketParams,uint256 newAbsoluteCap)`,`function setCanPullFromMarket(address vault,address adapter,${A} marketParams,bool newCanPullFromMarket)`,"function setCanPullFromIdle(address vault,bool newCanPullFromIdle)","function setIsActiveAdapter(address vault,address adapter,bool newIsActiveAdapter)","function setPenalty(address vault,uint64 newPenalty)"]),$=H(["function isAllocator(address) view returns (bool)","function allocation(bytes32) view returns (uint256)"]),z=H(["function isVaultV2(address) view returns (bool)"]),w=_[v],L=[{vault:w.vaults.netnet.address,underlying:w.tokens.USDG.address,symbol:"USDG",decimals:6},{vault:w.vaults.longbowCore.address,underlying:w.tokens.USDG.address,symbol:"USDG",decimals:6},{vault:w.vaults.longbowFrontier.address,underlying:w.tokens.USDG.address,symbol:"USDG",decimals:6},{vault:w.vaults.longbowEth.address,underlying:w.tokens.WETH.address,symbol:"WETH",decimals:18}];function x(n,c=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(c))throw new r("Provide uint decimal base-unit strings.");return BigInt(n)}function q(n){if(typeof n!="string"||!/^0x[0-9a-f]{64}$/i.test(n))throw new r("Provide the exact bytes32 marketId.");return n.toLowerCase()}var M=(n,c)=>n<c?n:c;async function Q(n,c){let l=L.find(u=>typeof c.vault=="string"&&D(u.vault,c.vault));if(!l)throw new r("Choose a pinned NetNet or Longbow V2 vault.");let a={address:P(l.underlying),chainId:v,symbol:l.symbol,decimals:l.decimals},o=n.clientFor(v),e=await O(o,l.vault,a),i=(u,T,j,J=[])=>o.readContract({address:u,abi:T,functionName:j,args:J,blockNumber:e.blockNumber}),t=q(c.marketId),s=e.markets.find(u=>u.id.toLowerCase()===t);if(!s)throw new r("Target market is not in this verified vault adapter inventory.");let[p,b,k,f,U]=await Promise.all([i(y,m,"vaultV2Factory"),i(G,z,"isVaultV2",[l.vault]),i(l.vault,$,"isAllocator",[y]),i(y,m,"vaultData",[l.vault]),i(y,m,"isActiveAdapter",[l.vault,s.adapter])]);if(typeof p!="string"||P(p)!==G||b!==!0||!Array.isArray(f)||f.length!==2||typeof f[0]!="boolean"||typeof f[1]!="bigint")throw new r("Invalid Public Allocator deployment or vault configuration.");let[d]=E(N,s.data);if(P(d.irm)!==P(w.morpho.adaptive_curve_irm.address))throw new r("Public allocation requires the pinned Adaptive Curve IRM.");let g=(u,T)=>Y(K(B(`string,address,${A}`),["this/marketParams",T,E(N,u)[0]])),C=g(s.data,s.adapter),[S,F]=await Promise.all([i(y,m,"absoluteCap",[l.vault,C]),i(l.vault,$,"allocation",[C])]);if(typeof S!="bigint"||typeof F!="bigint")throw new r("Invalid allocator cap read.");let R=S>F?S-F:0n,W=await Promise.all(e.markets.filter(u=>u.id.toLowerCase()!==t).map(async u=>({...u,canPull:await i(y,m,"canPullFromMarket",[l.vault,g(u.data,u.adapter)])===!0})));return{client:o,read:i,asset:a,definition:l,data:e,target:s,params:d,permission:k===!0&&U===!0,canIdle:f[0],penalty:f[1],headroom:R,sources:W}}var st=n=>{let c=a=>Q(n,a),l=(a,o,e,i)=>{let t={vault:{type:"string",enum:L.map(s=>s.vault),description:"Pinned NetNet or Longbow V2 vault address on chain 4663; use netnet_list or longbow_list for vault names."},marketId:{type:"string",description:"Target Morpho Blue market id (0x + 64 hex digits) that must be in this vault's adapter inventory."},...o};return{name:a,inputSchema:{type:"object",properties:t,required:["vault","marketId",...e],additionalProperties:!1},execute:async(s,p)=>{try{if(V(p),Object.keys(s).some(b=>!Object.hasOwn(t,b)))throw new r("Unsupported Public Allocator argument.");return await i(s,p)}catch(b){throw new r(n.plainError(b))}}}};return{tools:[l("morpho_allocator",{},[],async a=>{let o=await c(a);return{chainId:v,allocator:y,vault:o.definition.vault,targetMarketId:o.target.id,asset:o.asset,blockNumber:o.data.blockNumber.toString(),enabled:o.permission,penaltyWad:o.penalty.toString(),absoluteCapHeadroom:o.headroom.toString(),idleUpperBound:(o.permission&&o.canIdle?M(o.data.idle,o.headroom):0n).toString(),sources:o.sources.map(e=>({marketId:e.id,canPull:e.canPull,assetsUpperBound:(o.permission&&e.canPull?M(M(e.capacity,o.data.blueCash),o.headroom):0n).toString()})),caveat:"Upper bounds only; vault relative/absolute caps, accrual and liquidity still constrain execution. Preview an explicit source and amount with morpho_reallocate. This standalone allocation charges its disclosed penalty; a later borrow is a separate transaction and can fail or lose the added liquidity to another borrower."}}),l("morpho_reallocate",{sourceMarketId:{type:"string",description:"A returned source market ID, or omit to allocate idle assets."},assets:I(`Amount to move into the target market, in base units of the vault's asset (USDG 6 decimals, WETH 18). Example: "1000000" = 1 USDG.`),maxPenaltyAssets:I(`Highest penalty you accept, in base units of the vault's asset (USDG 6 decimals, WETH 18). Example: "10000" = 0.01 USDG.`)},["assets","maxPenaltyAssets"],async(a,o)=>{let e=x(a.assets,128),i=x(a.maxPenaltyAssets),t=await c(a);if(!t.permission||e===0n||e>t.headroom||t.penalty>10n**18n)throw new r("Public allocation is disabled or the requested amount exceeds target headroom.");let s=(e*t.penalty+10n**18n-1n)/10n**18n;if(s>i)throw new r("Allocator penalty exceeds maxPenaltyAssets.");let p;if(a.sourceMarketId===void 0){if(!t.canIdle||e>t.data.idle)throw new r("Public idle allocation is disabled or idle funds are insufficient.");p=h({abi:m,functionName:"allocateFromIdle",args:[t.definition.vault,t.target.adapter,t.params,e,t.penalty]})}else{let d=t.sources.find(C=>C.id.toLowerCase()===q(a.sourceMarketId));if(!d||!d.canPull||e>M(d.capacity,t.data.blueCash))throw new r("The source cannot publicly supply the requested liquidity.");let[g]=E(N,d.data);p=h({abi:m,functionName:"reallocate",args:[t.definition.vault,d.adapter,g,t.target.adapter,t.params,e,t.penalty]})}let b=`Move ${e} ${t.asset.symbol} base units inside ${t.definition.vault} to market ${t.target.id}; pay ${s} ${t.asset.symbol} base units as a donation penalty. This is a standalone reallocation; a subsequent borrow is separate and not guaranteed.`,k=[...s?[n.approval(t.asset.address,y,s.toString(),v)]:[],n.unsignedTx({to:y,data:p,value:"0",chainId:v,description:b})],f=await n.preview(k,o);if(f.changes.filter(d=>d.token.chainId===v&&D(d.token.address,t.asset.address)&&d.token.decimals===t.asset.decimals).reduce((d,g)=>d+BigInt(g.amount),0n)!==-s)throw new r("Allocator preview does not match the exact donation penalty.");return{txs:k,preview:f,penaltyAmount:s.toString(),summary:`${b} The calldata binds the current penalty rate. ${f.summary}`}}),l("morpho_manage_allocator",{operation:{enum:["setIsActiveAdapter","setCanPullFromMarket","setCanPullFromIdle","setAbsoluteCap","setPenalty"],description:"Allocator setting to change: adapter active flag, market pull permission, idle pull permission, absolute cap, or penalty rate."},enabled:{type:"boolean",description:"New true/false value for setIsActiveAdapter, setCanPullFromMarket or setCanPullFromIdle."},amount:I(`For setAbsoluteCap: cap in base units of the vault's asset ("1000000" = 1 USDG). For setPenalty: 18-decimal wad base units (1e18 = 100%).`)},["operation"],async(a,o)=>{let e=await c(a);if(await e.read(e.definition.vault,$,"isAllocator",[o])!==!0)throw new r("This wallet is not an allocator of this vault.");let i=a.enabled,t;if(a.operation==="setAbsoluteCap")t=h({abi:m,functionName:"setAbsoluteCap",args:[e.definition.vault,e.target.adapter,e.params,x(a.amount)]});else if(a.operation==="setPenalty"){let b=x(a.amount,64);if(b>10n**18n)throw new r("Public Allocator penalty must not exceed 1e18.");t=h({abi:m,functionName:"setPenalty",args:[e.definition.vault,b]})}else{if(typeof i!="boolean")throw new r("Provide enabled as a boolean.");if(a.operation==="setIsActiveAdapter")t=h({abi:m,functionName:"setIsActiveAdapter",args:[e.definition.vault,e.target.adapter,i]});else if(a.operation==="setCanPullFromMarket")t=h({abi:m,functionName:"setCanPullFromMarket",args:[e.definition.vault,e.target.adapter,e.params,i]});else if(a.operation==="setCanPullFromIdle")t=h({abi:m,functionName:"setCanPullFromIdle",args:[e.definition.vault,i]});else throw new r("Choose a supported allocator configuration operation.")}let s=`Configure Morpho Public Allocator ${String(a.operation)}: ${JSON.stringify(a)}.`,p=[n.unsignedTx({to:y,data:t,value:"0",chainId:v,description:s})];return{txs:p,preview:await n.preview(p,o),summary:s}})]}};export{y as a,G as b,m as c,Q as d,st as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as e,j as r}from"./TI727O2H.js";var t='Use query (token name, symbol or address) or category to narrow tickerspring_tokens. Unfiltered requests and sort:"volume" alone can return an incomplete or inconsistent provider response; retry with a query or category filter.';function i(){return{summary:"Minimums: limit orders 10 USDG; independent ladder levels 10 USDG each; grids 11 USDG; ladder planner 55 USDG. Vaults use current minDepositUnits from tickerspring_vaults (not a fixed 25 USDG). Basket creation first deposit 25 USDG; check current basket quote for trade minimums.",minimums:{denomination:{address:r[e].tokens.USDG.address,symbol:"USDG",decimals:6,chainId:e},limitOrderNotional:"10000000",independentLadderLevelNotional:"10000000",gridBudget:"11000000",ladderPlannerBudget:"55000000",vaultDeposit:{source:"tickerspring_vaults",field:"minDepositUnits",policy:"Per-vault current minimum; do not assume the 25 USDG example is a minimum."},basketCreationFirstDepositNotional:"25000000",basketTrade:{source:"tickerspring_baskets and current prepare quote",policy:"Check current provider minimum for the selected basket and payment token."}},tokenFilterGuidance:t}}export{t as a,i as b};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Re,d as je,e as qe,f as ye,i as Le,j as ze}from"./ALLLYOUG.js";import{i as ce}from"./7KWZ5QJU.js";import{b as Ie,o as Ce}from"./BOVMED7R.js";import{a as ae}from"./QHBS3PVU.js";import{a as T,b as Oe}from"./43LI5NKJ.js";import{a as L}from"./66F5ZH34.js";import{b as U}from"./IX3GZMTM.js";import{a as m,d as Xe,i as Q,j as Be}from"./FWD4L3CJ.js";import{a as o,b as He,e as ee}from"./XSD5NL7J.js";import{encodeAbiParameters as A,encodeFunctionData as ne,erc20Abi as We,getAddress as y,isAddress as In,keccak256 as Cn,pad as qn,parseAbi as Pe,parseAbiParameters as B,toEventSelector as Ln,toHex as Ge}from"viem";var Tn=y(Q[4663].uniswap.v4_pool_manager.address),$=y(Q[4663].uniswap.v4_position_manager.address),le=y(Q[4663].uniswap.v4_state_view.address),_e=y(Q[4663].uniswap.permit2.address),lt=y(Q[4663].ponsTrade.universal_router.address),te=y(Q[4663].uniswap.WETH.address),E=y(Be),k="0x0000000000000000000000000000000000000000",Ue=8388608,Ee=-887272,ke=887272,mn=(1n<<48n)-1n,J=(1n<<128n)-1n,$n=(1n<<160n)-1n,ue=1n<<96n,Ze=1800n,yn=50n,Ye=e=>e*(10000n-yn)/10000n,Qe=(e,n)=>{let i=(e*(10000n+yn)+9999n)/10000n;return i<n?i:n},Mn="0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",Ke=[{poolId:"0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551",key:{currency0:k,currency1:E,fee:8388608,tickSpacing:10,hooks:y("0x06a889870c8f83640d6816319f72e2aa579b6080")},liquidity:"5532026605872066941",sqrtPriceX96:"3839897026469220985301794",tick:-198703,protocolFee:0,lpFee:0},{poolId:"0x387bf619da4d3fb62bb276482693dba1b9b3520f573cabdfe033384a24125982",key:{currency0:k,currency1:E,fee:500,tickSpacing:10,hooks:k},liquidity:"225820987949255613",sqrtPriceX96:"3840577772610961024680304",tick:-198700,protocolFee:512125,lpFee:500},{poolId:"0x54f7883914619af9105355bf83ed678bcf9f63560218ac61c9963b9503d0ba32",key:{currency0:k,currency1:E,fee:460,tickSpacing:9,hooks:k},liquidity:"85654324417347171",sqrtPriceX96:"3840419018843648722761192",tick:-198701,protocolFee:479349,lpFee:460},{poolId:"0xc7b615a3721594f73664eb3f62d8290d0fcc8d9d1156aed1ddecbd7f32efd9f5",key:{currency0:k,currency1:E,fee:8388608,tickSpacing:10,hooks:y("0xcb787a5cdea8b3715d984d82f1203fd7bfebe0c4")},liquidity:"50517446454827887",sqrtPriceX96:"3840495145865430860317598",tick:-198700,protocolFee:0,lpFee:0},{poolId:"0x24107d152f14a76d292123265ae3f3c71f863fc2f4ef7ba49d64e78d28ea379e",key:{currency0:k,currency1:E,fee:100,tickSpacing:1,hooks:k},liquidity:"36478878201789434",sqrtPriceX96:"3840363370720475418748563",tick:-198701,protocolFee:102425,lpFee:100},{poolId:"0x84bd4e2d8be11aeb0afc1195b38f587b61e90068548f1063fdbe448fb8cad0b6",key:{currency0:te,currency1:E,fee:200,tickSpacing:4,hooks:k},liquidity:"5980655057479791",sqrtPriceX96:"3839891926195366283625355",tick:-198703,protocolFee:213044,lpFee:200},{poolId:"0x3b0cbf0603ecc67b5fc9bb4fbb6ac9e08d3b2f406b63d1662a36063a7fe5e866",key:{currency0:k,currency1:E,fee:87,tickSpacing:1,hooks:k},liquidity:"5486760264498148",sqrtPriceX96:"3840563617639470134132117",tick:-198700,protocolFee:90134,lpFee:87}],Ne=y("0x987e330f00b79864a07fe81dfac344d0078abcc0"),wn="0xa791e5169faf703c0b63fd9552c33ec1128a773a00f5dc33a640da62a022cd35",_n={currency0:k,currency1:E,fee:Ue,tickSpacing:1,hooks:Ne},En=new Set([...Ke.map(e=>e.key.hooks.toLowerCase()),Ne.toLowerCase()]),Dn=B("address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks"),Un=B("(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, int24 tickLower, int24 tickUpper, uint256 liquidity, uint128 amount0Max, uint128 amount1Max, address owner, bytes hookData"),Kn=B("address currency0, address currency1"),Nn=B("address currency, address recipient"),we=B("uint256 tokenId, uint256 liquidity, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Fn=B("uint256 tokenId, uint128 amount0Min, uint128 amount1Min, bytes hookData"),Te=B("address currency0, address currency1, address recipient"),de=B("bytes actions, bytes[] params"),F=Pe(["function modifyLiquidities(bytes unlockData, uint256 deadline) payable","function poolKeys(bytes25 poolId) view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)","function getPositionLiquidity(uint256 tokenId) view returns (uint128 liquidity)","function getPoolAndPositionInfo(uint256 tokenId) view returns ((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, uint256 info)","function positionInfo(uint256 tokenId) view returns (uint256 info)","function ownerOf(uint256 tokenId) view returns (address owner)","function nextTokenId() view returns (uint256 tokenId)"]),Vn=Pe(["function initialize((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint160 sqrtPriceX96) returns (int24 tick)"]),Je=B("address currency"),en=1e6,pe=Pe(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Hn=Pe(["function approve(address token, address spender, uint160 amount, uint48 expiration)"]),Xn=Ln("Transfer(address,address,uint256)");function he(e){if(typeof e!="string"||!In(e,{strict:!1}))throw new o("Provide a valid v4 currency address.");let n=e.toLowerCase();return n===k||n===ae.toLowerCase()?k:y(e)}function X(e){let n=e.toLowerCase();return n===k||n===ae.toLowerCase()}function fe(e){let n=he(e.currency0),i=he(e.currency1);T(e.hooks);let r=y(e.hooks);return Cn(A(Dn,[n,i,e.fee,e.tickSpacing,r]))}function bn(e){return((typeof e=="number"?e:e.fee)&Ue)!==0}function nn(e,n){return bn(e)?{dynamicFee:!0,storedLpFee:n,swapsAreFree:!1,feeNote:"Pool uses dynamic fee flag 0x800000; stored lpFee=0 does not mean swaps are free. The hook determines the swap fee; a past observation is not a current quote."}:{dynamicFee:!1,storedLpFee:n,swapsAreFree:n===0,feeNote:`Static LP fee ${n} pips.`}}function be(e,n){if(!e||typeof e!="object")throw new o("Provide a valid v4 PoolKey.");let i=he(e.currency0),r=he(e.currency1);if(BigInt(i)>=BigInt(r))throw new o("PoolKey currencies must be strictly sorted (currency0 < currency1).");if(!Number.isInteger(e.tickSpacing)||e.tickSpacing<=0||e.tickSpacing>32767)throw new o("PoolKey tickSpacing must be a positive integer.");if(!Number.isInteger(e.fee)||e.fee<0||e.fee>16777215)throw new o("PoolKey fee must be a valid uint24.");T(e.hooks);let c=y(e.hooks),s=bn(e.fee);if(!s&&e.fee>en)throw new o(`PoolKey static fee ${e.fee} exceeds the v4 maximum of ${en} pips (100%).`);if(s&&e.fee!==Ue)throw new o("Dynamic-fee PoolKey must use exact fee flag 0x800000 (8388608).");if(s&&c.toLowerCase()===k)throw new o("Dynamic-fee PoolKey requires a non-zero hook address.");if(!En.has(c.toLowerCase()))throw new o(`Unsupported v4 hook ${c}: Oak does not assure arbitrary v4 hooks outside measured PoolKeys.`);let t={currency0:i,currency1:r,fee:e.fee,tickSpacing:e.tickSpacing,hooks:c},d=fe(t);if(c===Ne&&d.toLowerCase()!==wn)throw new o("Only the documented VolatilePair ETH/USDG PoolKey is supported. Pool creation requires the Uniswap Labs role.");if(n!==void 0){if(typeof n!="string"||!/^0x[0-9a-fA-F]{64}$/.test(n))throw new o("Provide a 32-byte hex poolId.");if(d.toLowerCase()!==n.toLowerCase())throw new o(`PoolKey hash (${d}) does not match expected poolId (${n}).`)}return t}function Bn(e){if(!Number.isInteger(e)||e<=0||e>ke)throw new o("tickSpacing must be a positive integer.");let n=Math.trunc(Ee/e)*e,i=Math.trunc(ke/e)*e;return{tickLower:n===0?0:n,tickUpper:i===0?0:i}}function On(e,n,i){if(!Number.isInteger(i)||i<=0)throw new o("tickSpacing must be a positive integer.");if(!Number.isInteger(e)||!Number.isInteger(n))throw new o("tickLower and tickUpper must be integers.");if(e<Ee||n>ke)throw new o(`Ticks [${e}, ${n}] are outside Uniswap bounds [${Ee}, ${ke}].`);if(e>=n)throw new o("tickLower must be strictly less than tickUpper.");if(e%i!==0||n%i!==0)throw new o(`Ticks [${e}, ${n}] must be divisible by tickSpacing ${i}.`)}function tn(e,n,i,r,c=m){if(T(e),T(n),X(e))throw new o("Native ETH does not use Permit2 approval.");let s=U(i);if(s<=0n||s>$n)throw new o("Permit2 approval amount must be a positive integer within uint160.");let t=U(String(r));if(t<=0n||t>mn)throw new o("Permit2 expiration must be a positive timestamp within uint48.");let d=ne({abi:Hn,functionName:"approve",args:[e,n,s,Number(t)]});return Oe({to:_e,data:d,value:"0",chainId:c,description:`Approve Permit2 allowance of ${s} base units of ${e} for ${n} until ${t}.`})}function on(e){let n=Number(e&0xffffffn);return(n&8388608)!==0?n-16777216:n}function Rn(e){let n=(e&0xffn)!==0n,i=on(e>>8n&0xffffffn),r=on(e>>32n&0xffffffn);return{poolIdBytes25:`0x${(e>>56n&(1n<<200n)-1n).toString(16).padStart(50,"0")}`,tickLower:i,tickUpper:r,hasSubscriber:n}}function rn(e,n,i,r=!1){let[c,s]=e<=n?[e,n]:[n,e];if(c<=0n||s<=0n)return 0n;let t=(i<<96n)*(s-c),d=s*c;return r?(t+d-1n)/d:t/d}function sn(e,n,i,r=!1){let[c,s]=e<=n?[e,n]:[n,e],t=i*(s-c);return r?(t+ue-1n)/ue:t/ue}function gn(e){if(e.liquidity<=0n)return{amount0:0n,amount1:0n};let n=ce(e.tickLower),i=ce(e.tickUpper);return e.sqrtPriceX96<=n?{amount0:rn(n,i,e.liquidity,e.roundUp),amount1:0n}:e.sqrtPriceX96<i?{amount0:rn(e.sqrtPriceX96,i,e.liquidity,e.roundUp),amount1:sn(n,e.sqrtPriceX96,e.liquidity,e.roundUp)}:{amount0:0n,amount1:sn(n,i,e.liquidity,e.roundUp)}}function jn(e){let n=ce(e.tickLower),i=ce(e.tickUpper),r=(s,t,d)=>t<=s||d<=0n?0n:d*s*t/ue/(t-s),c=(s,t,d)=>t<=s||d<=0n?0n:d*ue/(t-s);if(e.sqrtPriceX96<=n)return r(n,i,e.amount0);if(e.sqrtPriceX96<i){let s=r(e.sqrtPriceX96,i,e.amount0),t=c(n,e.sqrtPriceX96,e.amount1);return s<t?s:t}return c(n,i,e.amount1)}function $e(e,n){return e.map(i=>{let r=i.amount.trim(),c=r.startsWith("-"),s=c||r.startsWith("+")?r.slice(1):r,t=n(s,i.token.decimals);return`${c?"-":""}${t} ${i.token.symbol}`})}function an(e,n=m){if(X(e))return{address:ae,symbol:"ETH",decimals:18,chainId:n};let i=y(e);return i.toLowerCase()===E.toLowerCase()?{address:E,symbol:"USDG",decimals:Xe,chainId:n}:i.toLowerCase()===te.toLowerCase()?{address:te,symbol:"WETH",decimals:18,chainId:n}:{address:i,symbol:i.slice(0,10),decimals:18,chainId:n}}async function N(e,n,i=m){if(X(n))return an(n,i);let r=y(n);if(r.toLowerCase()===E.toLowerCase()||r.toLowerCase()===te.toLowerCase())return an(r,i);let[c,s]=await Promise.all([e.readContract({address:r,abi:We,functionName:"symbol"}),e.readContract({address:r,abi:We,functionName:"decimals"})]);if(!Number.isInteger(Number(s))||Number(s)<0||Number(s)>77)throw new o(`Token ${r} reports invalid decimals.`);return{address:r,symbol:ze(c,r),decimals:Number(s),chainId:i}}function j(e,n){if(typeof e!="string"||!/^\d+$/.test(e))throw new o(`${n} must be a non-negative integer string in base units.`);return U(e)}function cn(e,n,i,r){let c=e===void 0?U(Ce(n.toString(),i)):j(e,r);if(c<=1n||c>J)throw new o(`${r} must exceed 1 base unit and fit in uint128; the simulated amount may be too small.`);return c}async function kn(e,n){if(typeof n=="number"&&Number.isFinite(n)&&n>0)return BigInt(Math.floor(n>1e11?n/1e3:n));if(typeof n=="string"&&/^\d+$/.test(n.trim()))return BigInt(n.trim());try{let i=await e.request({method:"eth_getBlockByNumber",params:["latest",!1]});if(i&&typeof i.timestamp=="string")return BigInt(i.timestamp)}catch{}return BigInt(Math.floor(Date.now()/1e3))}async function Me(e,n,i){let r=await kn(e,i);if(n==null)return r+1800n;let c=U(String(n));if(c<=r)throw new o(`Transaction deadline ${c} has expired (current timestamp ${r}).`);return c}async function De(e,n){let i=typeof n.poolId=="string"?n.poolId.trim():void 0,r=n.poolKey&&typeof n.poolKey=="object"&&!Array.isArray(n.poolKey)?n.poolKey:void 0,c=r?{currency0:String(r.currency0??k),currency1:String(r.currency1??E),fee:Number(r.fee),tickSpacing:Number(r.tickSpacing),hooks:String(r.hooks??k)}:n.currency0!==void 0&&n.currency1!==void 0&&n.fee!==void 0&&n.tickSpacing!==void 0?{currency0:String(n.currency0),currency1:String(n.currency1),fee:Number(n.fee),tickSpacing:Number(n.tickSpacing),hooks:String(n.hooks??k)}:void 0;if(c){if(X(c.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===te.toLowerCase())throw new o("Native ETH currency0 differs from WETH; do not supply WETH for a native-ETH v4 pool.");let b=be(c,i);return{poolId:fe(b),poolKey:b}}let s=(i??Mn).toLowerCase();if(s===wn)return{poolId:s,poolKey:be(_n,s)};let t=Ke.find(b=>b.poolId.toLowerCase()===s);if(t){if(X(t.key.currency0)&&typeof n.token0=="string"&&n.token0.toLowerCase()===te.toLowerCase())throw new o("Native ETH currency0 differs from WETH; do not supply WETH for a native-ETH v4 pool.");return{poolId:t.poolId,poolKey:t.key}}let d=s.slice(0,52),a=await e.readContract({address:$,abi:F,functionName:"poolKeys",args:[d]}),[p,l,f,u,h]=a;if(p.toLowerCase()===k&&l.toLowerCase()===k&&Number(u)===0)throw new o(`Unknown or uninitialized v4 poolId ${s}.`);let w=be({currency0:p,currency1:l,fee:Number(f),tickSpacing:Number(u),hooks:h},s);return{poolId:s,poolKey:w}}async function ge(e,n,i){try{let[r,c]=await e.readContract({address:$,abi:F,functionName:"getPoolAndPositionInfo",args:[n]}),s=be({currency0:r.currency0,currency1:r.currency1,fee:Number(r.fee),tickSpacing:Number(r.tickSpacing),hooks:r.hooks});if((i.poolKey||i.poolId)&&(await De(e,i)).poolId.toLowerCase()!==fe(s).toLowerCase())throw new o("The supplied PoolKey does not match this v4 position.");let t=Rn(BigInt(c));return{poolKey:s,poolId:fe(s),tickLower:t.tickLower,tickUpper:t.tickUpper}}catch(r){throw new o(`Could not read v4 position #${n}. ${ee(r)}`)}}function zn(e){if(typeof e!="string")throw new o("wallet must be a valid 20-byte hex address.");return T(e),y(e)}async function dn(e,n,i={}){T(n);let r=y(n),c=e.clientFor(m),s=new Set;if(i.tokenIds)for(let d of i.tokenIds)s.add(U(String(d)).toString());if(!i.tokenIds?.length)try{let d=await c.getBlockNumber(),a=10000000n;for(let p=0n;p<=d;p+=a){let l=p+a-1n<d?p+a-1n:d,f=await c.request({method:"eth_getLogs",params:[{address:$.toLowerCase(),topics:[Xn,null,qn(r)],fromBlock:Ge(p),toBlock:Ge(l)}]});if(!Array.isArray(f))throw new o("Invalid v4 position log response.");for(let u of f){if(!Array.isArray(u.topics)||u.topics.length!==4||!/^0x[0-9a-fA-F]{64}$/.test(u.topics[3]??""))throw new o("Invalid v4 position transfer log.");s.add(BigInt(u.topics[3]).toString())}}}catch(d){if(!i.tokenIds)throw new o(`Could not discover v4 positions. ${ee(d)}`)}let t=[];for(let d of s){let a=BigInt(d);try{let p;try{p=await c.readContract({address:$,abi:F,functionName:"ownerOf",args:[a]})}catch(P){if(He(P,3))continue;throw P}if(p.toLowerCase()!==r.toLowerCase())continue;let l=await c.readContract({address:$,abi:F,functionName:"getPositionLiquidity",args:[a]}),f=BigInt(l);if(f===0n&&!i.includeZero)continue;let{poolKey:u,poolId:h,tickLower:w,tickUpper:b}=await ge(c,a,{}),I=await c.readContract({address:le,abi:pe,functionName:"getSlot0",args:[h]}),x=BigInt(I[0]),{amount0:g,amount1:S}=gn({liquidity:f,tickLower:w,tickUpper:b,sqrtPriceX96:x}),[v,D]=await Promise.all([N(c,u.currency0,m),N(c,u.currency1,m)]);t.push({module:"uniswap",id:`uniswap:v4:${a.toString()}`,chainId:m,assets:[{token:v,amount:g.toString()},{token:D,amount:S.toString()}],description:`Uniswap v4 LP position #${a.toString()} (${v.symbol}/${D.symbol}, liquidity=${f.toString()}, ticks=[${w},${b}], poolId=${h})`})}catch(p){throw new o(`Could not read v4 position #${a}. ${ee(p)}`)}}return t}var Wn={type:"object",properties:{version:{type:"string",enum:["v4"]},poolId:{type:"string",description:"32-byte Uniswap v4 poolId hex string."},poolKey:{type:"object",properties:{currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"}}},currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"},tickLower:{type:"number"},tickUpper:{type:"number"},fullRange:{type:"boolean"},liquidity:L("Position liquidity in base units."),amount0Max:L("Maximum currency0 base units to spend."),amount1Max:L("Maximum currency1 base units to spend."),recipient:{type:"string"},deadline:L(),permit2Expiration:{type:"string"},hookData:{type:"string"},tokenId:L("Existing v4 position NFT to increase (keeps its tick range). Omit to mint a new position."),initialPrice:{type:"string",description:"Only when the pool does not exist: starting price as token1 per 1 token0 in human units (native ETH is 18 decimals). Needs the full poolKey. Creates the pool then mints the first position in separately confirmed transactions."},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},Gn={type:"object",description:"Create and initialize an empty Uniswap v4 pool (permissionless PoolManager.initialize). Add liquidity afterwards with uniswap_add.",properties:{version:{type:"string",enum:["v4"]},poolKey:{type:"object",properties:{currency0:{type:"string"},currency1:{type:"string"},fee:{type:"number"},tickSpacing:{type:"number"},hooks:{type:"string"}}},currency0:{type:"string",description:"Lower sorted currency; the zero address is native ETH."},currency1:{type:"string"},fee:{type:"number",description:"Static LP fee in pips (3000 = 0.30%), at most 1000000."},tickSpacing:{type:"number"},hooks:{type:"string",description:"Hook address; only hooks Oak has measured are accepted. Defaults to none."},initialPrice:{type:"string",description:'Starting price as token1 per 1 token0 in human units, e.g. "3000" for 1 ETH = 3000 USDG.'},sqrtPriceX96:{type:"string",description:"Alternative to initialPrice: exact starting sqrtPriceX96."},acceptPriceDeviation:{type:"boolean",description:"Allow a starting price more than 500 bps from other live pools of the pair."}}},Zn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenId:L(),poolId:{type:"string"},poolKey:{type:"object"},amount0Min:L(),amount1Min:L(),recipient:{type:"string"},deadline:L(),hookData:{type:"string"}},required:["tokenId"]},Yn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenId:L(),liquidity:{type:"string",pattern:"^(?:[0-9]+|all)$",description:"Positive base-unit liquidity amount, or all for a full burn."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:Ie},fullExit:{type:"boolean"},burn:{type:"boolean"},amount0Min:L(),amount1Min:L(),poolId:{type:"string"},poolKey:{type:"object"},recipient:{type:"string"},deadline:L(),hookData:{type:"string"}},required:["tokenId"]},Qn={type:"object",properties:{version:{type:"string",enum:["v4"]},tokenIds:{type:"array",items:L()},includeZero:{type:"boolean"}}};function un(e){let n=e.poolKey&&typeof e.poolKey=="object"&&!Array.isArray(e.poolKey)?e.poolKey:e;for(let i of["currency0","currency1","fee","tickSpacing"])if(n[i]===void 0)throw new o(`Creating a pool needs the full poolKey (currency0, currency1, fee, tickSpacing, hooks); ${i} is missing. A poolId alone cannot describe a pool that does not exist yet.`)}function ln(e,n,i){if(e.initialPrice!==void 0&&e.sqrtPriceX96!==void 0)throw new o("Provide initialPrice or sqrtPriceX96, not both.");if(e.sqrtPriceX96!==void 0){if(typeof e.sqrtPriceX96!="string"||!/^\d+$/.test(e.sqrtPriceX96))throw new o("sqrtPriceX96 must be a non-negative integer string.");return je(BigInt(e.sqrtPriceX96))}return Re(e.initialPrice,n,i)}async function Jn(e,n,i){let r;try{r=await e.readContract({address:$,abi:F,functionName:"ownerOf",args:[n]})}catch(c){throw new o(`Could not verify owner of Uniswap v4 position #${n}. ${ee(c)}`)}if(y(r)!==y(i))throw new o(`Wallet ${y(i)} is not the owner of Uniswap v4 position #${n} (owned by ${y(r)}).`)}async function pn(e,n){let i=fe(n).toLowerCase(),r=new Map;for(let s of Ke)s.key.currency0.toLowerCase()===n.currency0.toLowerCase()&&s.key.currency1.toLowerCase()===n.currency1.toLowerCase()&&r.set(s.poolId.toLowerCase(),s.key);let c=[];for(let[s,t]of r){if(s===i||BigInt(await e.readContract({address:le,abi:pe,functionName:"getLiquidity",args:[s]}))===0n)continue;let a=await e.readContract({address:le,abi:pe,functionName:"getSlot0",args:[s]});BigInt(a[0])>0n&&c.push({label:`v4 fee ${t.fee} spacing ${t.tickSpacing} pool ${s}`,sqrtPriceX96:BigInt(a[0])})}return c}function fn(e,n,i,r,c,s){return e.unsignedTx({to:Tn.toLowerCase(),data:ne({abi:Vn,functionName:"initialize",args:[{currency0:n.currency0.toLowerCase(),currency1:n.currency1.toLowerCase(),fee:n.fee,tickSpacing:n.tickSpacing,hooks:n.hooks.toLowerCase()},r]}),value:"0",chainId:m,description:`Create and initialize Uniswap v4 pool ${i} (${c.symbol}/${s.symbol}, fee ${n.fee}, tickSpacing ${n.tickSpacing}) at ${ye(r,c.decimals,s.decimals)} ${s.symbol} per ${c.symbol}.`})}var et=e=>({tools:[{name:"uniswap_add",inputSchema:Wn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=t.tokenId===void 0?void 0:U(String(t.tokenId));if(a!==void 0&&a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=t.initialPrice!==void 0||t.sqrtPriceX96!==void 0;if(a!==void 0&&p)throw new o("initialPrice cannot be combined with tokenId.");if(t.amount0Min!==void 0||t.amount1Min!==void 0||t.slippageBps!==void 0)throw new o("V4 mint encodes fixed liquidity and amount0Max/amount1Max; amount minima and slippageBps are not supported for minting.");let l=e.clientFor(m);p&&un(t);let f,u,h,w;if(a!==void 0){if(t.tickLower!==void 0||t.tickUpper!==void 0||t.fullRange!==void 0)throw new o("An existing v4 position keeps its tick range; omit tickLower, tickUpper and fullRange when increasing.");await Jn(l,a,d),{poolId:f,poolKey:u,tickLower:h,tickUpper:w}=await ge(l,a,t)}else{({poolId:f,poolKey:u}=await De(l,t));let q=Bn(u.tickSpacing);h=t.fullRange===!0&&t.tickLower===void 0?q.tickLower:Number(t.tickLower),w=t.fullRange===!0&&t.tickUpper===void 0?q.tickUpper:Number(t.tickUpper),On(h,w,u.tickSpacing)}let[b,I]=await Promise.all([N(l,u.currency0,m),N(l,u.currency1,m)]),x=j(t.amount0Max??t.amount0Desired,"amount0Max"),g=j(t.amount1Max??t.amount1Desired,"amount1Max");if(x<=0n&&g<=0n||x>J||g>J)throw new o("Provide positive amount0Max/amount1Max within uint128.");let S=await l.readContract({address:le,abi:pe,functionName:"getSlot0",args:[f]}),v=BigInt(S[0]),D=Number(S[3]),P;if(p){if(v>0n)throw new o(`Pool ${f} already exists; remove initialPrice/sqrtPriceX96 to add liquidity at its current price.`);let q=ln(t,b.decimals,I.decimals),K=Le(q,await pn(l,u),t.acceptPriceDeviation===!0,b.decimals,I.decimals);P={sqrtPriceX96:q,note:K},v=q}else if(v<=0n)throw new o(`Pool ${f} is not initialized on StateView. To create it and add the first liquidity in one tool call with separately confirmed transactions, pass the full poolKey plus initialPrice (token1 per 1 token0, human units); to create it without liquidity use uniswap_create_pool.`);let C=t.liquidity!==void 0?j(t.liquidity,"liquidity"):jn({amount0:Ye(x),amount1:Ye(g),tickLower:h,tickUpper:w,sqrtPriceX96:v});if(C<=0n||C>J)throw new o("Position liquidity must be a positive integer within uint128.");let{amount0:V,amount1:z}=gn({liquidity:C,tickLower:h,tickUpper:w,sqrtPriceX96:v,roundUp:!0});if(V>x||z>g)throw new o("Liquidity requires more tokens than amount0Max or amount1Max.");let ie=Qe(V,x),oe=Qe(z,g),W=t.recipient!==void 0?String(t.recipient):d;if(T(W),y(W)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let G=await kn(l),re=await Me(l,t.deadline,G.toString()),_=re<G+Ze?re:G+Ze,M=t.permit2Expiration===void 0?_:U(String(t.permit2Expiration));if(M<=G||M>_||M>mn)throw new o("Permit2 expiration must be in the next 30 minutes and no later than the transaction deadline.");let Z=typeof t.hookData=="string"?t.hookData:"0x",Y=((q,K)=>{let R=P?[fn(e,u,f,P.sqrtPriceX96,b,I)]:[];if(!X(u.currency0)&&q>0n){let se=u.currency0.toLowerCase();R.push(e.approval(se,_e.toLowerCase(),q.toString(),m)),R.push(tn(se,$.toLowerCase(),q.toString(),M.toString(),m))}if(!X(u.currency1)&&K>0n){let se=u.currency1.toLowerCase();R.push(e.approval(se,_e.toLowerCase(),K.toString(),m)),R.push(tn(se,$.toLowerCase(),K.toString(),M.toString(),m))}let H={currency0:u.currency0.toLowerCase(),currency1:u.currency1.toLowerCase(),fee:u.fee,tickSpacing:u.tickSpacing,hooks:u.hooks.toLowerCase()},Se=A(Un,[H,h,w,C,q,K,W.toLowerCase(),Z]),Pn=A(Kn,[H.currency0,H.currency1]),Ve=A(Nn,[k,W.toLowerCase()]),vn=A(we,[a??0n,C,q,K,Z]),An=a===void 0?A(de,["0x020d14",[Se,Pn,Ve]]):A(de,["0x00121214",[vn,A(Je,[H.currency0]),A(Je,[H.currency1]),Ve]]),xn=ne({abi:F,functionName:"modifyLiquidities",args:[An,re]}),Sn=X(u.currency0)?q.toString():"0";return R.push(e.unsignedTx({to:$.toLowerCase(),data:xn,value:Sn,chainId:m,description:a!==void 0?`Increase Uniswap v4 position #${a} on pool ${f} (liquidity +${C}).`:`Mint Uniswap v4 position on pool ${f} (ticks [${h}, ${w}], liquidity ${C}).`})),R})(ie,oe),O=await e.preview(Y,d),Fe=(q,K)=>{let R=X(K)?ae:K.toLowerCase();return-q.changes.filter(H=>H.token.address.toLowerCase()===R).reduce((H,Se)=>H+BigInt(Se.amount),0n)},ve=Fe(O,u.currency0),Ae=Fe(O,u.currency1);if(ve<0n||Ae<0n||ve>ie||Ae>oe||ve===0n&&Ae===0n&&a===void 0)throw new o("Invalid simulated v4 mint spend. Refresh the liquidity preview.");let hn=$e(O.changes,e.formatAmount),xe=nn(u,D);return{txs:Y,preview:O,poolId:f,poolKey:u,tickLower:h,tickUpper:w,liquidity:C.toString(),amount0Max:{token:b,amount:x.toString()},amount1Max:{token:I,amount:g.toString()},dynamicFee:xe.dynamicFee,swapsAreFree:xe.swapsAreFree,action:a!==void 0?"increase":P?"createAndMint":"mint",...a!==void 0?{tokenId:a.toString()}:{},...P?{poolCreated:!0,sqrtPriceX96:P.sqrtPriceX96.toString(),initialPrice:ye(P.sqrtPriceX96,b.decimals,I.decimals),initialTick:qe(P.sqrtPriceX96),priceCheck:P.note}:{},summary:`${a!==void 0?`Increase Uniswap v4 position #${a}`:P?"Create Uniswap v4 pool and add first liquidity":"Add Uniswap v4 liquidity"} (${C} L, ticks [${h}, ${w}]) on pool ${f}. Preview deltas: ${hn.join(", ")||"none"}. A partial spend can leave ERC-20 and Permit2 allowances equal to grant minus spent, bounded by your caps. Use oak_cleanup_allowances to revoke remaining allowances. ${xe.feeNote}${P?` ${P.note}`:""}`}}},{name:"uniswap_collect",inputSchema:Zn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=U(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(m),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),y(l)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let f=await Me(p,t.deadline,t.now),u=t.amount0Min!==void 0?j(t.amount0Min,"amount0Min"):0n,h=t.amount1Min!==void 0?j(t.amount1Min,"amount1Min"):0n;if(u>J||h>J)throw new o("amount0Min and amount1Min must fit in uint128.");let w=typeof t.hookData=="string"?t.hookData:"0x",{poolKey:b,poolId:I}=await ge(p,a,t),[x,g]=await Promise.all([N(p,b.currency0,m),N(p,b.currency1,m)]),S=A(we,[a,0n,u,h,w]),v=A(Te,[b.currency0.toLowerCase(),b.currency1.toLowerCase(),l.toLowerCase()]),D=A(de,["0x0111",[S,v]]),P=ne({abi:F,functionName:"modifyLiquidities",args:[D,f]}),C=[e.unsignedTx({to:$.toLowerCase(),data:P,value:"0",chainId:m,description:`Collect Uniswap v4 fees from position #${a} to ${l}.`})],V=await e.preview(C,d),z=$e(V.changes,e.formatAmount);return{txs:C,preview:V,tokenId:a.toString(),poolId:I,recipient:l,currencies:[x,g],summary:`Collect Uniswap v4 fees for position #${a} (actions 0x0111). Preview deltas: ${z.join(", ")||"0"}.`}}},{name:"uniswap_remove",inputSchema:Yn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=U(String(t.tokenId??""));if(a<=0n)throw new o("Provide a positive v4 position tokenId.");let p=e.clientFor(m),l=t.recipient!==void 0?String(t.recipient):d;if(T(l),y(l)!==y(d))throw new o("Uniswap recipient must be the signing wallet.");let f=await Me(p,t.deadline,t.now),{poolKey:u,poolId:h}=await ge(p,a,t),[w,b]=await Promise.all([N(p,u.currency0,m),N(p,u.currency1,m)]),I=t.slippageBps??Ie;if(typeof I!="number")throw new o("Slippage must be an integer from 0 to 9999 bps.");Ce("0",I);let x=typeof t.hookData=="string"?t.hookData:"0x",g=t.fullExit===!0||t.burn===!0||t.liquidity==="all";if(!g&&t.liquidity===void 0)throw new o('Provide a liquidity amount or explicitly choose liquidity "all" for a full exit.');let S=t.liquidity===void 0||t.liquidity==="all"?void 0:j(t.liquidity,"liquidity");if(S!==void 0&&(S<0n||S===0n&&!g||S>J))throw new o("Provide positive liquidity within uint128 for v4 removal.");let v;try{v=BigInt(await p.readContract({address:$,abi:F,functionName:"getPositionLiquidity",args:[a]}))}catch(_){throw new o(`Could not read v4 position liquidity. ${ee(_)}`)}if(v<0n||v===0n&&!g||S!==void 0&&S>v)throw new o("Removal requires a nonempty position and cannot exceed its liquidity.");if(g&&S!==void 0&&S!==v)throw new o("A full burn must match the position liquidity; omit the amount when explicitly choosing all.");let D=g?"0x0311":"0x0111",P=(_,M,Z)=>{let me=g?A(Fn,[a,_,M,x]):A(we,[a,S,_,M,x]),Y=A(Te,[u.currency0,u.currency1,Z]);return e.unsignedTx({to:$.toLowerCase(),data:ne({abi:F,functionName:"modifyLiquidities",args:[A(de,[D,[me,Y]]),f]}),value:"0",chainId:m,description:`${g?"Burn and exit":"Decrease"} Uniswap v4 position #${a} (${D}).`})},C=0n,V=0n;if(v>0n&&(t.amount0Min===void 0||t.amount1Min===void 0)){let _=e.unsignedTx({to:$.toLowerCase(),data:ne({abi:F,functionName:"modifyLiquidities",args:[A(de,["0x0111",[A(we,[a,0n,0n,0n,x]),A(Te,[u.currency0,u.currency1,$])]]),f]}),value:"0",chainId:m,description:"Simulation only: separate fees from removal principal."}),M=await e.preview([_,P(2n,2n,d)],d),Z=me=>M.changes.reduce((Y,O)=>O.token.chainId===m&&O.token.address.toLowerCase()===me.address.toLowerCase()?Y+BigInt(O.amount):Y,0n);if(C=Z(w),V=Z(b),C<0n||V<0n)throw new o("Removal simulation did not return the expected currencies.")}let z=(_,M)=>{if(_!==void 0&&j(_,M)!==0n)throw new o(`${M} must be zero for an empty position burn.`);return 0n},ie=v===0n?z(t.amount0Min,"amount0Min"):cn(t.amount0Min,C,I,"amount0Min"),oe=v===0n?z(t.amount1Min,"amount1Min"):cn(t.amount1Min,V,I,"amount1Min"),W=[P(ie,oe,l)],G=await e.preview(W,d),re=$e(G.changes,e.formatAmount);return{txs:W,preview:G,action:D,tokenId:a.toString(),poolId:h,amount0Min:{token:w,amount:ie.toString()},amount1Min:{token:b,amount:oe.toString()},summary:`${g?"Full exit":"Partial remove"} Uniswap v4 position #${a} (${D})${g?`; burns position #${a} at ${$}`:""}. Preview deltas: ${re.join(", ")||"none"}.`}}},{name:"uniswap_list_positions",inputSchema:Qn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');let a=Array.isArray(t.tokenIds)?t.tokenIds:void 0,p=t.includeZero===!0,l=t.wallet===void 0?y(d):zn(t.wallet),f=await dn(e,l,{tokenIds:a,includeZero:p});return{version:"v4",positions:f,summary:`Found ${f.length} active Uniswap v4 position(s) for ${l}.`}}},{name:"uniswap_create_pool",inputSchema:Gn,async execute(t,d){if(T(d),t.version!==void 0&&t.version!=="v4")throw new o('Uniswap v4 part only handles version "v4".');un(t);let a=e.clientFor(m),{poolId:p,poolKey:l}=await De(a,t),[f,u]=await Promise.all([N(a,l.currency0,m),N(a,l.currency1,m)]),h=await a.readContract({address:le,abi:pe,functionName:"getSlot0",args:[p]});if(BigInt(h[0])>0n)throw new o(`Uniswap v4 pool ${p} already exists. Use uniswap_add to provide liquidity.`);let w=ln(t,f.decimals,u.decimals),b=Le(w,await pn(a,l),t.acceptPriceDeviation===!0,f.decimals,u.decimals),I=ye(w,f.decimals,u.decimals),x=[fn(e,l,p,w,f,u)],g=await e.preview(x,d),S=nn(l,l.fee);return{txs:x,preview:g,poolId:p,poolKey:l,sqrtPriceX96:w.toString(),initialPrice:I,initialTick:qe(w),priceCheck:b,action:"createPool",summary:`${x[0].description} The pool starts empty: nothing trades until liquidity is added with uniswap_add. ${S.feeNote} ${b}`}}}],positions:t=>dn(e,t)}),pt=et;export{Tn as a,$ as b,le as c,_e as d,lt as e,te as f,E as g,k as h,Ue as i,Ee as j,ke as k,Mn as l,Ke as m,Ne as n,wn as o,_n as p,En as q,X as r,fe as s,bn as t,nn as u,be as v,Bn as w,On as x,tn as y,Rn as z,gn as A,jn as B,$e as C,an as D,N as E,ge as F,dn as G,Wn as H,Gn as I,Zn as J,Yn as K,Qn as L,pn as M,et as N,pt as O};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as P,n as O}from"./NWNYJ26T.js";import{a as l}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as F,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 x=_.boosts.map(c=>({...c,address:F(c.address.toLowerCase()),token:F(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],R=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 f(c){return D(c,"Provide an address.",S)}function I(c){return P(c,"Invalid Beefy reward-pool integer.")}function C(c){return O(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=x.find(n=>n.address===f(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=I(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:R,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>I(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(f(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 w=r[0].map(f);if(new Set(w).size!==w.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(w.map(async(h,g)=>({token:await a(h),amount:I(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 m(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:R,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}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=f(o);let n=await y(),t=[];for(let a of x)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,action:{enum:["stake","withdraw","claim","exit"]},amount:{anyOf:[v(),{const:"all"}]},chainId:{const:l}},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=f(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),w=e.amount==="all"?r:C(e.amount);if(w===0n||w>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:w.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,w.toString(),l)]:[],m(t.address,n,[w])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[m(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,action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"]},token:b,amount:v(),duration:v(),recipient:b,manager:b,enabled:{type:"boolean"},chainId:{const:l}},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=f(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:f(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=f(e.token),h=C(e.amount),g=C(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),m(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(m(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[f(e.token),f(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(m(a.address,"setWhitelist",[f(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(m(a.address,"transferOwnership",[f(e.recipient)])):i.push(m(a.address,"renounceOwnership"));let w=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}.${w} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=f(e);let o=await y(),n=[];for(let t of x){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{x as a,H as b,R as c,V as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as ie,b as le,c as de,d as Z}from"./TX2EOIRS.js";import{a as E,b as Y}from"./HQUVB7Z5.js";import{c as ae}from"./VEQBHI6O.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as se,e as h,g,i as oe}from"./NWNYJ26T.js";import{a as v,i as ne,l as D,n as re}from"./FWD4L3CJ.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as M,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),ye=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),be=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,se)}function j(e,t,o){let r=e??t;if(typeof r!="number"||!Number.isInteger(r)||r<1||r>o)throw new T(`Choose a limit from 1 to ${o}.`);return r}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(r=>O(r,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([r])=>/^[A-Za-z0-9_]{1,40}$/.test(r)).slice(0,40).map(([r,d])=>[r,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function J(e,t,o){let r=e.clientFor(v),[d,a]=await Promise.all([r.readContract({address:t,abi:M,functionName:"symbol",blockNumber:o}),r.readContract({address:t,abi:M,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),r=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),s=e.clientFor(v),m=await s.getBlockNumber({cacheTime:0}),k=await E(e,o,m),i=await le(e,o),n=await s.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(re),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([J(e,o,n),s.readContract({address:o,abi:M,functionName:"totalSupply",blockNumber:n})]),W=c=>1+R.filter(y=>BigInt(y.balance)>BigInt(c)).length,B=async(c,y)=>{let F=await s.readContract({address:o,abi:M,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:y,indexedRank:y===null||_.has(c)?null:W(y),indexedShareOfSupply:y===null?null:Z(y,u.supply),shareOfSupply:Z(F.toString(),q.toString()),balance:{token:G,amount:F.toString()},matchesIndex:y===null?null:F.toString()===y}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=r?i.rows.find(c=>g(c.wallet,r)):void 0,H=r?{...await B(r,V?.balance??null),excluded:_.get(r)??null,rankStatus:_.has(r)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(y=>g(y.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(y=>g(y.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let r=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${r.toLowerCase()}?view=positions`,ve),s=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await E(e,u,s);let[w,_]=await Promise.all([J(e,u,s),a.readContract({address:u,abi:M,functionName:"balanceOf",args:[r],blockNumber:s})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:r,statusBlock:s.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),r=await U(e,`${x}/launches/trending`,Ae),d=r.items.filter(s=>g(s.launch.factory,D)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async s=>({status:await Y(e,f(s.launch.address),a),index:{volumeUsd:p(s.volumeUsd),trades:p(s.trades),traders:p(s.traders),change:p(s.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:r.items.length-r.items.filter(s=>g(s.launch.factory,D)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let r=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(r.series)?r.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(r.generatedAt),latestDay:p(r.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(r.today),earnings:O(r.earnings),indexer:O(r.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(r,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let r=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${r.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:r,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(s=>({kind:$(s.kind,24),block:p(s.block),time:p(s.time),tx:typeof s.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(s.tx)?s.tx:null,token:typeof s.token=="string"&&C.test(s.token)?f(s.token):null,symbol:$(s.symbol,24),amount:typeof s.amount=="string"&&ke.test(s.amount)?s.amount:null,decimals:p(s.decimals),usd:p(s.usd),counterparty:typeof s.counterparty=="string"&&C.test(s.counterparty)?f(s.counterparty):null,counterpartyLabel:$(s.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let r=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${r.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},s=await U(e,`${x}/launches?deployer=${r.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=s.items.filter(i=>g(i.factory,D)&&g(i.deployer,r)).slice(0,d);return{address:r,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let r=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),s=await E(e,r,l),m=ne[v].pons.buybackVault.address,k=[],i=async(b,K)=>{try{return await K()}catch{return k.push(b),null}},n=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),u=b=>i(b,()=>a.readContract({address:s.curve,abi:Q,functionName:b,blockNumber:l})),w=b=>i(b,()=>a.readContract({address:m,abi:ue,functionName:b,args:[r],blockNumber:l})),[_,R,G,q,W,B,A,V,H,c,y,F,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:s.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:r,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:D,abi:be,functionName:"pendingCreatorFeeRecipient",args:[r],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),J(e,r,l)]),S=b=>b===null?null:b.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:s.phase,statusBlock:l.toString(),curve:s.curve,creatorFeeRecipient:s.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(W),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((b,K)=>[b,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:s.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(y),vestingStart:S(F),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),r=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await E(e,o,a),s=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?s>=pe?s-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>s||s>a||s-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:ye,fromBlock:m,toBlock:s,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await J(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:s.toString(),statusBlock:a.toString(),truncated:i.length>r,total:i.length,trades:i.slice(0,r).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,r,d){return{name:o,inputSchema:{type:"object",properties:r,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let s of Object.keys(a))if(!(s in r))throw new T(`Unknown ${o} input: ${s}.`);return await d(a,l)}catch(s){throw new T(e.plainError(s))}}}}return{tools:[t("pons_holders",{token:P,holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:P,limit:{type:"integer",minimum:1,maximum:40}},(o,r)=>xe(e,o,r)),t("pons_trending",{limit:{type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:P,cursor:{type:"string",maxLength:32}},(o,r)=>Pe(e,o,r)),t("pons_launch_info",{token:P,holder:P},(o,r)=>_e(e,o,r)),t("pons_trades",{token:P,fromBlock:X(),toBlock:X(),limit:{type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:P,limit:{type:"integer",minimum:1,maximum:20}},(o,r)=>Ne(e,o,r))]}};export{O as a,xe as b,Le as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as w,e as R,f as N,g as S}from"./PIIHOXWF.js";import{a as h}from"./66F5ZH34.js";import{c as g,g as E}from"./NWNYJ26T.js";import{a as d}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{encodeFunctionData as v,erc20Abi as I,getAddress as _,parseAbi as O,zeroAddress as C}from"viem";var k=_("0x2ac03e14cfe755426daaee0a4994184ce81482f8"),a=_("0x7a8f74c2585f84c781f951b7f2ff21337d5b630b"),o=O(["function RESOURCE() view returns (address)","function TOKEN_JAR() view returns (address)","function threshold() view returns (uint256)","function nonce() view returns (uint256)","function release(uint256 nonce,address[] assets,address recipient)"]),B={assets:{type:"array",minItems:1,maxItems:20,items:g},nonce:h(),maxResourceAmount:h()};function F(n){return{tools:[!1,!0].map(i=>({name:i?"uniswap_token_jar_release":"uniswap_token_jar",inputSchema:{type:"object",additionalProperties:!1,required:i?["assets","nonce","maxResourceAmount"]:["assets"],properties:B},async execute(t,m){if(S(t,i?["assets","nonce","maxResourceAmount"]:["assets"]),!Array.isArray(t.assets)||t.assets.length<1||t.assets.length>20)throw new r("Provide 1 to 20 unique assets to release.");let c=t.assets.map(w);if(new Set(c).size!==c.length)throw new r("Token Jar assets must be unique.");let s=n.clientFor(d),e=await s.getBlockNumber(),[x,P,u,f]=await Promise.all([s.readContract({address:a,abi:o,functionName:"RESOURCE",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"TOKEN_JAR",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"threshold",blockNumber:e}),s.readContract({address:a,abi:o,functionName:"nonce",blockNumber:e})]);if(!E(String(P),k)||x===C)throw new r("Releaser deployment does not match the pinned Token Jar and ERC-20 resource.");let p=await R(n,w(x),e),T=await Promise.all(c.map(async l=>({token:await R(n,l,e),amount:(l===C?await s.getBalance({address:k,blockNumber:e}):await s.readContract({address:l,abi:I,functionName:"balanceOf",args:[k],blockNumber:e})).toString()}))),y={payment:{token:p,amount:String(u)},nonce:String(f),assets:T,blockNumber:e.toString()};if(!i)return{...y,summary:"Resource payment buys the listed jar contents; no profit is promised. Release uses a nonce to refuse competing releases."};let J=b(t.maxResourceAmount,"maxResourceAmount"),A=b(t.nonce,"nonce",256,!0);if(A!==BigInt(f)||BigInt(u)>J)throw new r("Token Jar nonce or resource cost changed. Read uniswap_token_jar and confirm fresh terms.");let j=[n.approval(p.address,a,String(u),d),n.unsignedTx({to:a,data:v({abi:o,functionName:"release",args:[A,c,m]}),value:"0",chainId:d,description:`Pay ${u} base units of ${p.address} to release Token Jar assets to ${m}, nonce ${f}.`})];return{...await N(n,j,m,"Exchange resource tokens for Token Jar assets. Check the full payment, assets and recipient in the preview; gas is additional."),...y}}}))}}export{k as a,a as b,o as c,F as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as P,e as _,f as m}from"./O7HCEPQY.js";import{c as p,f as r,g as f,h as N,i as S,k as D,p as x,q}from"./46KWRAYK.js";import{b as I}from"./66F5ZH34.js";import{h as A}from"./NWNYJ26T.js";import{randomInt as U,randomUUID as H}from"node:crypto";import{isDeepStrictEqual as b}from"node:util";import{recoverTypedDataAddress as z}from"viem";function j(t){Object.keys(t).some(u=>!["subaccount","subaccountId","instructions","failureBehavior","continuation","signature"].includes(u))&&r("Use the Meridian batch schema."),D(t.subaccountId),(!Array.isArray(t.instructions)||t.instructions.length<1||t.instructions.length>20)&&r("A Meridian batch needs 1\u201320 instructions."),["ContinueOnFailure","StopOnFailure"].includes(String(t.failureBehavior))||r("Choose ContinueOnFailure or StopOnFailure explicitly; a batch does not roll back earlier results.");let c=new Set;return t.instructions.map(u=>{let e=f(u),a=e.kind;a!=="NEW"&&a!=="CANCEL"&&r("Each Meridian batch instruction needs kind NEW or CANCEL.");let o=a==="NEW"?P.order:["orderId","clientOrderId"];Object.keys(e).some(i=>i!=="kind"&&!o.includes(i))&&r("Unsupported Meridian batch instruction fields."),a==="CANCEL"&&e.orderId===void 0==(e.clientOrderId===void 0)&&r("Each batch cancellation needs exactly one orderId or clientOrderId.");for(let i of a==="NEW"?["clientOrderId"]:["orderId","clientOrderId"])if(e[i]!==void 0){let g=`${a}:${i}:${e[i]}`;c.has(g)&&r("Duplicate Meridian batch order identifiers."),c.add(g)}let d={subaccountId:t.subaccountId,...t.subaccount===void 0?{}:{subaccount:t.subaccount}};return a==="CANCEL"?{action:"cancel",kind:a,args:{...d,...e.orderId===void 0?{clientOrderIds:[e.clientOrderId]}:{orderIds:[e.orderId]}}}:{action:"order",kind:a,args:{...d,...Object.fromEntries(Object.entries(e).filter(([i])=>i!=="kind"))}}})}function M(t,c,u,e,a){let o=j(t);(!Number.isInteger(c)||c<0||c>=o.length)&&r("Invalid Meridian batch signing index.");let d=o[c],i=_(d.action,d.args,u,e,a);return d.kind==="CANCEL"&&(i.data={sender:u,subaccount:i.data.subaccount,nonce:e,...i.data.orderIds?{orderId:i.data.orderIds[0]}:{clientOrderId:i.data.clientOrderIds[0]}}),i}function ee(t,c,u,e,a,o){(e.stage!=="perps_batch_sign"||e.chainId!==p||!A(e.wallet,c)||typeof e.requestId!="string"||!e.requestId||typeof e.index!="number"||typeof e.signedAt!="number"||typeof e.expiresAt!="number"||e.expiresAt<=o||e.expiresAt>o+120||e.signedAt<o-120||e.signedAt>o+10)&&r("Meridian batch signing round is invalid or expired."),(a?a.requestId!==e.requestId||Number(a.index)+1!==e.index||a.expiresAt!==e.expiresAt:e.index!==0)&&r("Unexpected Meridian batch signing order.");let d=M(t,e.index,c,N(e.nonce,"the nonce",!1,64),e.signedAt),i=m(d,f(e.signatureTypes));(!b(e.request,i)||!b(e.data,d.data)||!b(u,[{kind:"typedData",request:i}]))&&r("Meridian batch signing fields differ from the local instruction.")}function te(t,c){let u=new Map;return{name:"meridian_perps_batch",inputSchema:{type:"object",additionalProperties:!1,required:["subaccountId","instructions","failureBehavior"],description:"Sign 1\u201320 NEW/CANCEL instructions locally and submit one batch. failureBehavior is explicit. Cancel/replace is not atomic. Reconcile each result and check fills after submission.",properties:{subaccountId:{type:"string",format:"uuid"},subaccount:{type:"string"},failureBehavior:{type:"string",enum:["ContinueOnFailure","StopOnFailure"]},instructions:{type:"array",minItems:1,maxItems:20,items:{type:"object",properties:{kind:{type:"string",enum:["NEW","CANCEL"]},quantity:I("D9 quantity base units."),price:I("D9 price base units."),stopPrice:I("D9 stop price base units."),expiresAt:I("Unix seconds.")},additionalProperties:!0}},continuation:{type:"object"},signature:{type:"string"}}},execute:async(e,a)=>{let o=S(a),d=j(e);d.forEach((s,n)=>M(e,n,o,"0",Math.floor(Date.now()/1e3)));let i=s=>({steps:[{kind:"typedData",request:structuredClone(s.round.request)}],continuation:structuredClone(s.round),summary:`Review and confirm Meridian batch instruction ${Number(s.round.index)+1}/${d.length}. D9 signed quantities and prices have 9 decimals. Every instruction is separately signed; no API submission occurs until all signatures are collected. ${e.failureBehavior}; earlier successful results are never rolled back.`});if(e.continuation!==void 0){let s=f(e.continuation),n=u.get(String(s.requestId));(!n||!A(s.wallet,o)||!b(n.round,s)||!b(n.args,Object.fromEntries(Object.entries(e).filter(([l])=>!["continuation","signature"].includes(l)))))&&r("Meridian batch continuation is lost, expired or changed. Check orders before restarting."),u.delete(String(s.requestId));let F=s.request;(typeof s.expiresAt!="number"||s.expiresAt<=Math.floor(Date.now()/1e3))&&(clearTimeout(n.timer),r("Meridian batch expired. Check orders before restarting."));try{(typeof e.signature!="string"||!/^0x[0-9a-fA-F]{130}$/.test(e.signature)||!A(await z({...F,signature:e.signature}),o))&&r("The local Meridian batch signature does not match this wallet.");let l=Number(s.index),L=n.values[l];if(n.signed.push({type:d[l].kind,data:L.data,signature:e.signature}),l+1<d.length){let h=n.values[l+1],$=f(s.signatureTypes);return n.round={...s,index:l+1,nonce:h.message.nonce,data:h.data,request:m(h,$),review:n.reviews[l+1]},u.set(String(s.requestId),n),i(n)}clearTimeout(n.timer),(t.network==="testnet"||await t.clientFor(p).getChainId()!==p)&&r("Meridian batch requires chain 4663.");let W=await q(t);return n.values.some(h=>!b(m(h,W).types,m(h,f(s.signatureTypes)).types))&&r("Meridian batch signing types changed; check orders before restarting."),{result:await x(t,"/v1/order/batch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({failureBehavior:e.failureBehavior,instructions:n.signed})}),chainId:p,summary:"Meridian batch API responded. Inspect every instruction result and subsequent order/fill state. HTTP success is not atomic success or proof of execution."}}catch(l){throw clearTimeout(n.timer),l}}e.signature!==void 0&&r("Meridian batch signatures require an active local signing round."),u.size>=1e3&&r("Too many pending Meridian batches. Try again shortly."),(t.network==="testnet"||await t.clientFor(p).getChainId()!==p)&&r("Meridian batch requires chain 4663.");let g=await q(t),y=f(await x(t,"/v1/time")).time;(typeof y!="number"||!Number.isSafeInteger(y)||Math.abs(y-Date.now())>3e4)&&r("Synchronize the clock before signing a Meridian batch.");let C=Math.floor(y/1e3),B=BigInt(y)*1000000n+BigInt(U(999980)),w=d.map((s,n)=>M(e,n,o,(B+BigInt(n)).toString(),C)),T=[];for(let[s,n]of d.entries())T.push(await c(n.action,n.args,o,w[s].data));let k=H(),v=w[0],R={stage:"perps_batch_sign",chainId:p,wallet:o,requestId:k,index:0,signedAt:C,expiresAt:C+90,nonce:v.message.nonce,data:v.data,request:m(v,g),signatureTypes:{TradeOrder:g.TradeOrder,CancelOrder:g.CancelOrder},review:T[0]},O=setTimeout(()=>u.delete(k),9e4);O.unref?.();let E={args:structuredClone(e),round:R,values:w,reviews:T,signed:[],timer:O};return u.set(k,E),i(E)}}}export{ee as a,te as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u,r=/\b(?:unsafe|safe|safety|risks?|risky|recommend\w*|buy\w*)\b/i,i=/(?:[a-z][a-z0-9+.-]*:\/\/|(?:https?|ftp|file|mailto|javascript|data):|www\.|\/\/|\b[a-z0-9-]+(?:\.[a-z0-9-]+)+\b)/i,o="HEY Research Lab context unavailable",a="Project names this contract",c="Builder evidence, not a trading signal.",E="Not on HEY Research Lab yet";function e(t,s){return typeof t=="string"&&!!t.trim()&&t.length<=s&&!n.test(t)&&!/[<>[\]`]/.test(t)&&!r.test(t)&&!i.test(t)}function p(t,s){return!e(t,80)||!e(s,300)?o:`Builder status by HEY Research Lab: ${t}. ${s}`}export{a,c as b,E as c,e as d,p as e};
|