@oakagentkit/core 0.2.6 → 0.2.7
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/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/http.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/actions.js +1 -1
- package/build/dist/api/modules/borro/checks.js +1 -1
- package/build/dist/api/modules/borro/copy.d.ts +15 -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/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- 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/earn/copy.d.ts +32 -10
- 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/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.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.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.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/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/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.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-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.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/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/reads.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/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/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/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.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/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.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/prices.d.ts +3 -0
- package/build/dist/api/prices.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.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/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.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/{T7TFUH5K.js → 2E4I7CJ7.js} +1 -1
- package/build/dist/chunks/2FHELZ7Y.js +1 -0
- package/build/dist/chunks/2GXHYI23.js +1 -0
- package/build/dist/chunks/2LWBN35N.js +1 -0
- package/build/dist/chunks/{4HG6FRVH.js → 2OKYXT25.js} +1 -1
- package/build/dist/chunks/2SUHQWND.js +1 -0
- package/build/dist/chunks/2ZWKIBJT.js +1 -0
- package/build/dist/chunks/32RXFUOH.js +1 -0
- package/build/dist/chunks/3CH2IPQL.js +1 -0
- package/build/dist/chunks/3DNJTJ2X.js +1 -0
- package/build/dist/chunks/3K2N5VFH.js +1 -0
- package/build/dist/chunks/3VBIRLU3.js +1 -0
- package/build/dist/chunks/3ZABD6ZF.js +2 -0
- package/build/dist/chunks/44MB6SA6.js +1 -0
- package/build/dist/chunks/4D4ZRZUW.js +1 -0
- package/build/dist/chunks/{IPN6Z4JM.js → 4FPV4CRC.js} +1 -1
- package/build/dist/chunks/4GNUXN4K.js +1 -0
- package/build/dist/chunks/{K4DHHQBI.js → 4JRXEN7C.js} +2 -2
- package/build/dist/chunks/4JTTA3BX.js +1 -0
- package/build/dist/chunks/4OVIMYNH.js +2 -0
- package/build/dist/chunks/{7QIO77VE.js → 4Q2ZBZXM.js} +1 -1
- package/build/dist/chunks/4RQAOOO2.js +1 -0
- package/build/dist/chunks/4TTDAF4B.js +1 -0
- package/build/dist/chunks/523ZIR3J.js +1 -0
- package/build/dist/chunks/5DPJQCKJ.js +68 -0
- package/build/dist/chunks/5HIHUYA4.js +1 -0
- package/build/dist/chunks/5PI57UC2.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/5XAXJEWM.js +5 -0
- package/build/dist/chunks/67BWOVET.js +1 -0
- package/build/dist/chunks/6NUNCD5J.js +1 -0
- package/build/dist/chunks/{FJ4S4GHY.js → 6PZGDVHV.js} +1 -1
- package/build/dist/chunks/{RTAHNWHN.js → 6UVGQYZ3.js} +1 -1
- package/build/dist/chunks/753HZZTY.js +1 -0
- package/build/dist/chunks/7D73A6KS.js +1 -0
- package/build/dist/chunks/7MBVTNLU.js +1 -0
- package/build/dist/chunks/7QKYDNF6.js +18 -0
- package/build/dist/chunks/7VC53B5X.js +70 -0
- package/build/dist/chunks/7VNO46LV.js +1 -0
- package/build/dist/chunks/ACH4BSME.js +3 -0
- package/build/dist/chunks/AHUCYDBC.js +1 -0
- package/build/dist/chunks/AI3VAPA3.js +1 -0
- package/build/dist/chunks/AMTRDPVO.js +1 -0
- package/build/dist/chunks/APHNOGNS.js +1 -0
- package/build/dist/chunks/{BND2UFVW.js → ARI72OYT.js} +1 -1
- package/build/dist/chunks/ARLGF5MU.js +1 -0
- package/build/dist/chunks/BAIY32AV.js +1 -0
- package/build/dist/chunks/BB765L75.js +3 -0
- package/build/dist/chunks/BE3A7677.js +1 -0
- package/build/dist/chunks/{PAY5PD4H.js → BX46C5ZP.js} +1 -1
- package/build/dist/chunks/{XL3LLGIR.js → BZ34ZR65.js} +1 -1
- package/build/dist/chunks/C3WBHFLX.js +1 -0
- package/build/dist/chunks/C75MT5SD.js +1 -0
- package/build/dist/chunks/CAWTAR5V.js +1 -0
- package/build/dist/chunks/CNLL4NCR.js +1 -0
- package/build/dist/chunks/CO4GCF4L.js +1 -0
- package/build/dist/chunks/{P5PYFK7L.js → CQ5WRWV4.js} +1 -1
- package/build/dist/chunks/{SJJR4ZBZ.js → CSDN4MYP.js} +1 -1
- package/build/dist/chunks/CSOO4SW7.js +1 -0
- package/build/dist/chunks/CZL6T2ZQ.js +1 -0
- package/build/dist/chunks/D742AYEV.js +1 -0
- package/build/dist/chunks/DGCJZ3HO.js +1 -0
- package/build/dist/chunks/DNNFKDZR.js +1 -0
- package/build/dist/chunks/DPE7SPW7.js +1 -0
- package/build/dist/chunks/DSTMEY5F.js +1 -0
- package/build/dist/chunks/{FUDAXV5X.js → DYYEA5HB.js} +1 -1
- package/build/dist/chunks/EFESPGA2.js +1 -0
- package/build/dist/chunks/EGZREEG2.js +1 -0
- package/build/dist/chunks/EH5G4O3U.js +1 -0
- package/build/dist/chunks/EI6GGPDS.js +20 -0
- package/build/dist/chunks/EVBHQQQG.js +1 -0
- package/build/dist/chunks/EZZM2GQT.js +2 -0
- package/build/dist/chunks/F3VDVTMS.js +1 -0
- package/build/dist/chunks/F4UQEPJT.js +1 -0
- package/build/dist/chunks/FHTNMGFR.js +1 -0
- package/build/dist/chunks/FJLJ7ZQ5.js +1 -0
- package/build/dist/chunks/{WP6RHXGN.js → FL5SSHUL.js} +1 -1
- package/build/dist/chunks/FNGIJKMZ.js +1 -0
- package/build/dist/chunks/{KIFZ5ZSK.js → FOD34G2H.js} +1 -1
- package/build/dist/chunks/{WV3A3OUU.js → FOKEFXGP.js} +1 -1
- package/build/dist/chunks/FV4WZOTD.js +1 -0
- package/build/dist/chunks/FWIFTPSE.js +2 -0
- package/build/dist/chunks/FZ6IJZZM.js +1 -0
- package/build/dist/chunks/G2LAO23N.js +1 -0
- package/build/dist/chunks/GDRQ2ANN.js +1 -0
- package/build/dist/chunks/GG24LO2R.js +1 -0
- package/build/dist/chunks/GLF7WEY2.js +1 -0
- package/build/dist/chunks/GQ3XZFRL.js +1 -0
- package/build/dist/chunks/{QU5XKRGK.js → GQYV4TFO.js} +1 -1
- package/build/dist/chunks/GRSXWQWD.js +1 -0
- package/build/dist/chunks/{DL6AEWEM.js → GSFHM5L3.js} +1 -1
- package/build/dist/chunks/{QHBS3PVU.js → H5DY7CNB.js} +1 -1
- package/build/dist/chunks/HCBX4NFM.js +1 -0
- package/build/dist/chunks/HHO5ISMM.js +1 -0
- package/build/dist/chunks/HIX5N25Z.js +1 -0
- package/build/dist/chunks/HKVQ646Q.js +1 -0
- package/build/dist/chunks/IEG6GLFR.js +1 -0
- package/build/dist/chunks/INOYMBWE.js +1 -0
- package/build/dist/chunks/IV4K7FMD.js +1 -0
- package/build/dist/chunks/{PIIHOXWF.js → J73ATSEQ.js} +1 -1
- package/build/dist/chunks/JBTOZ6IH.js +1 -0
- package/build/dist/chunks/JESMX2UC.js +1 -0
- package/build/dist/chunks/JJGZ7W3V.js +1 -0
- package/build/dist/chunks/JKRBGAX2.js +1 -0
- package/build/dist/chunks/JLRHM2DQ.js +1 -0
- package/build/dist/chunks/JOKL5L6X.js +1 -0
- package/build/dist/chunks/JS53DQVT.js +1 -0
- package/build/dist/chunks/{WIRBCS4W.js → JWR5XVP2.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/{2VXLVXIB.js → KDGSYNOP.js} +1 -1
- package/build/dist/chunks/KKPMOAVI.js +1 -0
- package/build/dist/chunks/KREBNL2D.js +1 -0
- package/build/dist/chunks/L646YWDP.js +1 -0
- package/build/dist/chunks/{GSBIERZD.js → LR4XTZ37.js} +1 -1
- package/build/dist/chunks/LVFI74ST.js +1 -0
- package/build/dist/chunks/{QBIY6FQN.js → M7ZXDLKM.js} +1 -1
- package/build/dist/chunks/MVD3KWPP.js +1 -0
- package/build/dist/chunks/N245WC5R.js +1 -0
- package/build/dist/chunks/{WTXC3XKW.js → N4XNNXOJ.js} +1 -1
- package/build/dist/chunks/N6GIC7HJ.js +1 -0
- package/build/dist/chunks/{RUC7KH7A.js → NA424YAL.js} +1 -1
- package/build/dist/chunks/NUFZUKYS.js +1 -0
- package/build/dist/chunks/{XD6X3KTC.js → O3JWCJIF.js} +1 -1
- package/build/dist/chunks/OARVU3RC.js +1 -0
- package/build/dist/chunks/OEZ7FCLF.js +1 -0
- package/build/dist/chunks/{H43RNCX2.js → OUROA7XR.js} +1 -1
- package/build/dist/chunks/{2MT3G7YZ.js → OYJFXEDU.js} +1 -1
- package/build/dist/chunks/OYPAVXGQ.js +1 -0
- package/build/dist/chunks/{SMYWWIE6.js → OZ5MDUD2.js} +1 -1
- package/build/dist/chunks/P6OMKZMR.js +3 -0
- package/build/dist/chunks/PV4AK32X.js +1 -0
- package/build/dist/chunks/{HKEMQBFA.js → PXVREXCS.js} +1 -1
- package/build/dist/chunks/PZEF5LBL.js +2 -0
- package/build/dist/chunks/Q2ACLVWR.js +1 -0
- package/build/dist/chunks/QFSBDPLN.js +1 -0
- package/build/dist/chunks/QJNLLI6N.js +1 -0
- package/build/dist/chunks/QMZEGT5B.js +1 -0
- package/build/dist/chunks/{PNA6UIE5.js → REWXG6X6.js} +1 -1
- package/build/dist/chunks/{ALLLYOUG.js → RLI4JDOL.js} +1 -1
- package/build/dist/chunks/{UD2XMNIT.js → RLMVA575.js} +1 -1
- package/build/dist/chunks/RPB46QAC.js +1 -0
- package/build/dist/chunks/{Q42YI3EP.js → RT7IU6TI.js} +1 -1
- package/build/dist/chunks/{ER47KGRM.js → SBY4RJ7I.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/SKEKXEUU.js +1 -0
- package/build/dist/chunks/SOTYQGPT.js +1 -0
- package/build/dist/chunks/SZ466I5X.js +1 -0
- package/build/dist/chunks/{GNC6RXLT.js → TDZTC5WR.js} +1 -1
- package/build/dist/chunks/TE6D3OIX.js +1 -0
- package/build/dist/chunks/TID4C2KC.js +1 -0
- package/build/dist/chunks/TK55VASJ.js +2 -0
- package/build/dist/chunks/TM7Z5SA4.js +1 -0
- package/build/dist/chunks/TNJTET4G.js +1 -0
- package/build/dist/chunks/TPEKCXVE.js +1 -0
- package/build/dist/chunks/TVIMP5CK.js +1 -0
- package/build/dist/chunks/U2YCQWZK.js +1 -0
- package/build/dist/chunks/U363GQTF.js +1 -0
- package/build/dist/chunks/{U4JGEMKT.js → UEDGYZOC.js} +1 -1
- package/build/dist/chunks/UOCRYXAB.js +1 -0
- package/build/dist/chunks/UQEEF5W5.js +1 -0
- package/build/dist/chunks/{QQECG3WP.js → UUID2E22.js} +1 -1
- package/build/dist/chunks/UWBKAWX3.js +7 -0
- package/build/dist/chunks/V37L4DU4.js +1 -0
- package/build/dist/chunks/VR344DAZ.js +1 -0
- package/build/dist/chunks/{TX2EOIRS.js → VST6LFUB.js} +1 -1
- package/build/dist/chunks/VTPT5544.js +1 -0
- package/build/dist/chunks/VVWFB53Q.js +1 -0
- package/build/dist/chunks/WHTRPRRD.js +1 -0
- package/build/dist/chunks/WHVZ372B.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/WUT7TZYM.js +1 -0
- package/build/dist/chunks/XCKTE4ON.js +1 -0
- package/build/dist/chunks/XEPCDGN2.js +1 -0
- package/build/dist/chunks/XHYFISVV.js +1 -0
- package/build/dist/chunks/XPEDQBLI.js +1 -0
- package/build/dist/chunks/{QFNT73OF.js → XQ24RSEI.js} +1 -1
- package/build/dist/chunks/XRDXFHIK.js +1 -0
- package/build/dist/chunks/XTFRPI4G.js +1 -0
- package/build/dist/chunks/XVJ7ILKK.js +1 -0
- package/build/dist/chunks/XWKK75TO.js +1 -0
- package/build/dist/chunks/{CBLMQ5UU.js → XYPGLG6A.js} +1 -1
- package/build/dist/chunks/Y77EVVT4.js +1 -0
- package/build/dist/chunks/YEIM6BZQ.js +1 -0
- package/build/dist/chunks/{XSKFKBDR.js → YMV5TL5C.js} +1 -1
- package/build/dist/chunks/YSMWCKIX.js +1 -0
- package/build/dist/chunks/YTLH4M4Y.js +1 -0
- package/build/dist/chunks/YUHNPUNK.js +1 -0
- package/build/dist/chunks/YWZQJJYY.js +1 -0
- package/build/dist/chunks/{EGYVRQUR.js → ZF2VPDRQ.js} +1 -1
- package/build/dist/chunks/ZFU65MB4.js +1 -0
- package/build/dist/chunks/ZKZUS3QU.js +1 -0
- package/build/dist/chunks/ZOMFHTB2.js +1 -0
- package/build/dist/chunks/{OLSP46ZD.js → ZP36DSOD.js} +1 -1
- package/build/dist/chunks/ZQ6AF3VX.js +1 -0
- 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/FEYAY6OZ.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/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/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/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/YN56C7PN.js +0 -1
- package/build/dist/chunks/YRNXGQJC.js +0 -1
- package/build/dist/chunks/YWRLY5EA.js +0 -1
- package/build/dist/chunks/YWSX6IE6.js +0 -1
- package/build/dist/chunks/YXTSWRV5.js +0 -1
- package/build/dist/chunks/Z6LZGCVW.js +0 -1
- package/build/dist/chunks/ZQWZGH7V.js +0 -1
- package/build/dist/chunks/ZSN4IRI5.js +0 -1
- package/build/dist/chunks/ZV5HIQXC.js +0 -1
- package/build/dist/chunks/ZXJ24B4L.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m,h as t}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{e as m,h as t}from"./NWNYJ26T.js";import{c as E}from"./6NUNCD5J.js";import{i as C}from"./FWD4L3CJ.js";import{a as v,b as g}from"./XSD5NL7J.js";import{keccak256 as j,parseAbi as D}from"viem";var A=Object.freeze({robinswapV2:Object.freeze({factory:"0xa95DA9b9fCef09A07F99444fE9304457d6ECdccA",kind:"v2",kyberswap:"robinswap-v2",velora:void 0}),uniswapV2:Object.freeze({factory:"0x8BcEAA40b9aCDfAedf85ADf4fF01f5ad6517937F",kind:"v2",kyberswap:"uniswap",velora:"uniswapv2"}),uniswapV3:Object.freeze({factory:C[4663].uniswap.v3_factory.address,kind:"v3",kyberswap:"uniswapv3",velora:"uniswapv3"})}),L=Object.freeze(Object.fromEntries(Object.entries(A).map(([r,n])=>[r,n.factory])));function V(r){return Object.values(A).flatMap(n=>n[r]??[])}var P=D(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function fee() view returns (uint24)"]),S=D(["function getPair(address,address) view returns (address)","function getPool(address,address,uint24) view returns (address)"]),a=new Map;function M(r,n,i){let d=a.get(j(i));return!!d&&d.expires>Date.now()&&t(d.token,r)&&d.pools.some(u=>t(u,n))}async function B(r,n,i,d,u,z){let w=[...new Set(d.filter(o=>!t(o,u)).map(o=>o.toLowerCase()))];if(!w.length)return;let k=j(z);a.delete(k);let f=await r.getBlockNumber();for(let o of w){let s=e=>new v(`KyberSwap source receiver ${o} is not a verified input pool: ${e}.`),l=Array.isArray(n)?n.map(e=>Array.isArray(e)?e[0]:void 0).find(e=>m(e)&&t(e.pool,o)&&t(e.tokenIn,i)):void 0;if(!m(l)||typeof l.tokenOut!="string")throw s("not named as an input hop in the accepted route");let O=await r.getCode({address:o,blockNumber:f});if(!O||O==="0x")throw s("no deployed code");try{let[e,p,y]=await Promise.all(["token0","token1","factory"].map(c=>r.readContract({address:o,abi:P,functionName:c,blockNumber:f}))),h=t(e,i)?p:t(p,i)?e:void 0;if(!h||!t(h,l.tokenOut))throw s("tokens do not match the input route");let x=Object.values(A).find(c=>t(y,c.factory));if(!x)throw s("factory is not pinned");let b;if(x.kind==="v2")b=await r.readContract({address:y,abi:S,functionName:"getPair",args:[e,p],blockNumber:f});else{let c=await r.readContract({address:o,abi:P,functionName:"fee",blockNumber:f});b=await r.readContract({address:y,abi:S,functionName:"getPool",args:[e,p,c],blockNumber:f})}if(!t(b,o))throw s("not registered by the pinned factory")}catch(e){throw e instanceof v||E(e)?e:g(e,3)?s("pool token or factory read reverted; this pool interface is not supported by Oak"):s("on-chain verification unavailable")}}for(let[o,s]of a)s.expires<=Date.now()&&a.delete(o);a.size>=1e3&&a.delete(a.keys().next().value),a.set(k,{token:i,pools:w,expires:Date.now()+6e4})}export{A as a,L as b,V as c,M as d,B as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,d as y,e as m}from"./JESMX2UC.js";import{a as l}from"./66F5ZH34.js";import{a as c}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{concatHex as x,encodeAbiParameters as P,encodeFunctionData as w,getAddress as u,keccak256 as f,parseAbi as k,stringToHex as I}from"viem";var g=k(["function ownerOf(uint256) view returns (address)","function tokenURI(uint256) view returns (string)","function setMetadata(uint256,string,bytes)","function approve(address,uint256)"]),v=k(["function listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))","function recordHash(uint256) view returns (bytes32)"]),C=(t,r)=>f(x(BigInt(t)<BigInt(r)?[t,r]:[r,t]));function _(t){if(!Array.isArray(t)||t.length<1||t.length>1e4)throw new d("Provide 1 to 10000 identity IDs.");let r=[...new Set(t.map(e=>m(e,"agentIds").toString()))].sort((e,a)=>BigInt(e)<BigInt(a)?-1:1),i=[r.map(e=>f(f(P([{type:"uint256"}],[BigInt(e)]))))];for(;i.at(-1).length>1;){let e=i.at(-1),a=[];for(let s=0;s<e.length;s+=2)a.push(e[s+1]?C(e[s],e[s+1]):e[s]);i.push(a)}return{root:i.at(-1)[0],ids:r,proofs:r.map((e,a)=>{let s=[],p=a;for(let b of i.slice(0,-1)){let h=b[p^1];h&&s.push(h),p=Math.floor(p/2)}return{agentId:e,proof:s}})}}function S(t){return{tools:[{name:"priors_market_origin",inputSchema:{type:"object",properties:{agentIds:{type:"array",minItems:1,maxItems:1e4,items:l(),description:"Exact ERC-8004 agent ID list (decimal strings, 1 to 10000) to commit in a bid_any Merkle root."}},required:["agentIds"],additionalProperties:!1},async execute(r){return{chainId:c,..._(r.agentIds),caveat:"Locally commits exactly these IDs. This does not verify third-party origin, quality, current owner or a seller claim."}}},{name:"priors_market_pins",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID whose listing pins to read, as a decimal string. Example: "437".')},required:["agentId"],additionalProperties:!1},async execute(r){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let n=m(r.agentId,"agentId"),i=t.clientFor(c),e=await i.getBlockNumber({cacheTime:0}),[a,s,p]=await Promise.all([i.readContract({address:o.market,abi:v,functionName:"listingOf",args:[n],blockNumber:e}),i.readContract({address:o.market,abi:v,functionName:"recordHash",args:[n],blockNumber:e}),i.readContract({address:o.registry,abi:g,functionName:"tokenURI",args:[n],blockNumber:e})]);return{chainId:c,blockNumber:e.toString(),listing:y(a),recordHash:s,currentUriHash:f(I(p)),caveat:"Pins bind identity file and credit state, not included code, servers or keys. Listing and current URI hashes may differ; preview refuses an altered listing."}}},{name:"priors_market_clear_bid_budget",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(r,n){if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");let i=[t.approval(o.usdg,o.bidSpender,"0",c)],e=await t.preview(i,u(n));return{txs:i,summary:`Clear all this wallet future bid spending allowance to ${o.bidSpender}. Existing bids cannot fill from it until approved again. ${e.summary}`}}},{name:"priors_market_revoke_nft",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID whose single-NFT market approval to clear, as a decimal string. Example: "437".')},required:["agentId"],additionalProperties:!1},async execute(r,n){let i=m(r.agentId,"agentId");if(t.network==="testnet")throw new d("Priors market requires mainnet chain 4663.");if(u(await t.clientFor(c).readContract({address:o.registry,abi:g,functionName:"ownerOf",args:[i]}))!==u(n))throw new d("Only current NFT owner may revoke this per-token approval.");let e=[t.unsignedTx({to:o.registry,data:w({abi:g,functionName:"approve",args:["0x0000000000000000000000000000000000000000",i]}),value:"0",chainId:c,description:`Revoke exact ERC-8004 NFT ${i} market approval.`})],a=await t.preview(e,n);return{txs:e,summary:`Clear this identity per-token transfer approval. Also cancel its listing before granting any new market approval. ${a.summary}`}}},{name:"priors_x_link",inputSchema:{type:"object",properties:{agentId:l('ERC-8004 agent ID this wallet owns, as a decimal string. Example: "437".'),postUrl:{type:"string",maxLength:160,description:"Canonical https://x.com/<handle>/status/<id> owner proof post URL, or empty to unlink. Owner creates the public post themselves."}},required:["agentId","postUrl"],additionalProperties:!1},async execute(r,n){if(t.network==="testnet")throw new d("Priors X metadata is mainnet only.");let i=m(r.agentId,"agentId");if(u(await t.clientFor(c).readContract({address:o.registry,abi:g,functionName:"ownerOf",args:[i]}))!==u(n))throw new d("Only the identity owner can link or clear X metadata.");if(typeof r.postUrl!="string"||r.postUrl!==""&&!/^https:\/\/x\.com\/[A-Za-z0-9_]{1,15}\/status\/[0-9]{1,30}$/.test(r.postUrl))throw new d("Provide a canonical X status URL or empty string to unlink.");let e=[t.unsignedTx({to:o.registry,data:w({abi:g,functionName:"setMetadata",args:[i,"x",I(r.postUrl)]}),value:"0",chainId:c,description:"Set/clear the owner identity X proof-post metadata."})],a=await t.preview(e,n);return{txs:e,summary:`Publish ${r.postUrl?"the specified X post URL":"empty X metadata"} on public ERC-8004 identity ${i}. Priors independently verifies the post; metadata alone does not prove the X account or affect credit terms. ${a.summary}`}}}]}}export{_ as a,S as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as I,c as M}from"./
|
|
1
|
+
import{b as I,c as M}from"./GQYV4TFO.js";import{a as b,c as s,d as k,f as E}from"./2OKYXT25.js";import{g}from"./OUROA7XR.js";import{a as N}from"./43LI5NKJ.js";import{a as C,i as D,j as i}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{erc20Abi as U,parseAbi as P}from"viem";var o=P(["function isValidMarket(address market) view returns(bool)","function readTokens() view returns(address sy,address pt,address yt)","function expiry() view returns(uint256)","function isExpired() view returns(bool)","function getTokensIn() view returns(address[])","function getTokensOut() view returns(address[])"]);async function H(u,r,d){if(N(r),I(d,!0),u.network==="testnet")throw new y("Pendle is available on chain 4663 only.");let e=u.clientFor(C),w=await e.getBlock(),t=w.number;s(await e.readContract({address:D[4663].pendle.marketFactory.address,abi:o,functionName:"isValidMarket",args:[r],blockNumber:t})===!0,"market is not verified by Pendle\u2019s factory");let[[c,m,O],p,h]=await Promise.all([e.readContract({address:r,abi:o,functionName:"readTokens",blockNumber:t}),e.readContract({address:r,abi:o,functionName:"expiry",blockNumber:t}),e.readContract({address:r,abi:o,functionName:"isExpired",blockNumber:t})]),[v,T]=await Promise.all([e.readContract({address:c,abi:o,functionName:"getTokensIn",blockNumber:t}),e.readContract({address:c,abi:o,functionName:"getTokensOut",blockNumber:t})]);s(v.some(n=>k(n,i)),"the earn cost comparison requires a USDG term"),s(T.some(n=>k(n,i)),"this term cannot cash out to USDG"),s(!h&&p>w.timestamp&&p<=BigInt(Number.MAX_SAFE_INTEGER),"this term has ended or its end date is unreadable");let l=n=>e.readContract({address:n,abi:U,functionName:"decimals",blockNumber:t}),[S,x,R]=await Promise.all([l(i),l(m),l(c)]),A={market:r,sy:c,pt:m,yt:O,expiry:Number(p),expired:h,kind:"stable",inputToken:i,inputSymbol:"USDG",inputDecimals:S,ptDecimals:x,syDecimals:R,tokensIn:[...v],tokensOut:[...T]},f=await g(u.http,{inputToken:i,outputToken:m,amount:d,wallet:b,slippageBps:50}),a=E(f.body,{market:A,wallet:b,amount:d,slippageBps:50});if(Math.abs(a.priceImpact)>.03)throw new y("This is a thin market and your size moves the price too much. Try a smaller amount.");return await M(e,A,"buy",d,a.amountOut,a.priceImpact),s(Date.now()-f.receivedAt>=0&&Date.now()-f.receivedAt<=3e4,"display quote is too old; try again"),{feeUsd:a.feeUsd,impactPct:Math.abs(a.priceImpact)*100,ptOutBase:a.amountOut}}export{H as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as f}from"./
|
|
1
|
+
import{a as d,b as f}from"./UQEEF5W5.js";import{a}from"./P4UQGWCP.js";import{g as s}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{getAddress as m,keccak256 as u}from"viem";var l=a.vaults;function c(t,o=!0){let e=l.find(r=>s(r.earnContractAddress,t));if(!e&&o)throw new n("This Beefy vault is not in the pinned chain 4663 standard-vault inventory.");return e}async function v(t,o,e){c(o);let[r,i]=await Promise.all([t.getCode({address:m(o),blockNumber:e}),t.getCode({address:d,blockNumber:e})]),p=`0x363d3d373d3d3d363d73${d.slice(2).toLowerCase()}5af43d82803e903d91602b57fd5bf3`;if(r?.toLowerCase()!==p||!i||u(i)!==f)throw new n("The Beefy standard vault or implementation no longer matches its verified code.")}export{l as a,c as b,v as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t}from"./WUT7TZYM.js";import{c as o}from"./DNNFKDZR.js";function s(e,n,a){return t(e,n,a,o)}export{s as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as k,g as F,i as M,n as _,o as w,p as z}from"./RPB46QAC.js";import{$ as N,U as A,Z as T,_ as I,aa as O,b as s,ba as W,ca as y,da as D,ea as R,fa as S,ga as x,ha as U,ia as b,ja as B,ka as C}from"./7VC53B5X.js";import{getAddress as H,isAddress as G}from"viem";function K(e){if(e==null)return;let r=e instanceof Date?e.getTime()/1e3:typeof e=="string"?/^\d{1,12}$/.test(e)?Number(e):Date.parse(e)/1e3:e;return typeof r=="number"&&Number.isFinite(r)?Math.floor(r):void 0}var a=e=>typeof e=="number"&&Number.isFinite(e),$=e=>w(e).replace(/\.?0+$/,"");function j(e){let r=e.nowSec??Math.floor(Date.now()/1e3),f=K(e.endDate),i=a(e.apr)&&e.apr>=0?e.apr:void 0,o=a(e.amountUsd)&&e.amountUsd>0?e.amountUsd:void 0,g={addButton:U,declineButton:b};if(i===void 0||f===void 0||f<=r)return{text:s(x,{}),readable:!1,notWorth:!0,defaultButton:b,...g};let l=z(f),u=[s(I,{apr:$(i),end_date:l})];e.outOfRangeIncentivized===!1&&u.push(s(N,{})),a(e.feeWeightPct)&&e.feeWeightPct>0&&e.feeWeightPct<=100&&u.push(s(O,{w:$(e.feeWeightPct)}));let d=!1,c=[];if(o!==void 0){let n=(f-r)/86400,t=M({amountUsd:o,ratePct:i,days:n}),m=k(e.gasUsd);d=F({gross:t,costs:m.usd,amount:o}).tooSmall,u.push(s(W,{amount_usd:_(o),per_day_usd:_(o*i/100/365),gross_usd:_(t),end_date:l}),s(y,{gas_usd:_(m.usd)})),d&&c.push(s(S,{})),m.estimatedHigh&&c.push(s(A,{}))}u.push(s(D,{}),...c);let p=typeof e.creator=="string"&&G(e.creator,{strict:!1})?H(e.creator):void 0;return{text:s(T,{worth_line:u.join(" "),funder_line:p?`${s(R,{creator:p})}
|
|
2
|
+
`:"",end_date:l}),readable:!0,notWorth:d,...d?{defaultButton:b}:{},...g}}function X(e){return j(e).text}function Y(e){let r=a(e)&&e>0?s(C,{time:new Date(e*1e3).toISOString().slice(0,16).replace("T"," ")}):"";return s(B,{last_update_clause:r})}var h=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),E=e=>{if(a(e)&&Number.isSafeInteger(e)&&e>0)return e;if(typeof e=="string"&&/^\d{1,12}$/.test(e))return Number(e)};function P(e){if(!(e.length===0||e.some(r=>r===void 0)))return e.every(r=>r===e[0])?e[0]:void 0}function Z(e,r,f=4663){if(!Array.isArray(e))return{live:0};let i=e.filter(h).filter(n=>{if(n.distributionChainId!==void 0&&Number(n.distributionChainId)!==f)return!1;let t=E(n.startTimestamp),m=E(n.endTimestamp);return m!==void 0&&m>r&&(t===void 0||t<=r)});if(i.length===0)return{live:0};let o=i.map(n=>a(n.apr)&&n.apr>=0?n.apr:void 0),g=i.map(n=>h(n.params)?n.params:{}),l=g.map(n=>{let t=typeof n.weightFees=="string"&&/^\d{1,5}$/.test(n.weightFees)?Number(n.weightFees):n.weightFees;return a(t)&&Number.isInteger(t)&&t>=0&&t<=1e4?t/100:void 0}),u=i.map(n=>{let t=typeof n.creatorAddress=="string"?n.creatorAddress:h(n.creator)&&typeof n.creator.address=="string"?n.creator.address:void 0;return t!==void 0&&G(t,{strict:!1})?H(t):void 0}),d={live:i.length,endsAt:Math.min(...i.map(n=>E(n.endTimestamp)))};o.every(a)&&(d.aprPct=o.reduce((n,t)=>n+t,0));let c=P(g.map(n=>typeof n.isOutOfRangeIncentivized=="boolean"?n.isOutOfRangeIncentivized:void 0));c!==void 0&&(d.outOfRangeIncentivized=c);let p=P(l);p!==void 0&&(d.feeWeightPct=p);let L=P(u);return L!==void 0&&(d.creator=L),d}export{j as a,X as b,Y as c,Z as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as k,e as V,f,h as _,j as b,k as E,l as P,m as q,n as j,o as g,p as S,q as x,t as F,w as U,z as $}from"./V37L4DU4.js";import{c as m}from"./X5V2Z2NM.js";import{a as M}from"./43LI5NKJ.js";import{c as R,g as v}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{encodeFunctionData as N,keccak256 as G,toBytes as L}from"viem";var D=`0x${"00".repeat(32)}`,ae=d=>{let A=(e,t,s)=>({name:e,inputSchema:t,execute:async(r,a)=>{try{return M(a),j(d,r.chainId),await s(r,a)}catch(u){throw new n(d.plainError(u))}}}),C={transactionHash:{...V,description:"After local submission, repeat the same arguments with the mined hash to verify calldata, event and registry state."}},w=(e,t,s)=>d.clientFor(_(d).chainId).readContract({address:e,abi:m,functionName:t,args:s}),p=async(e,t)=>{try{return await w(e,"getValidationStatus",[t])}catch{return}},H=(e,t)=>({requestHash:e,validator:t[0],agentId:t[1].toString(),response:t[2],responseHash:t[3],tag:I(t[4]),lastUpdate:t[5].toString(),possiblyUnanswered:t[2]===0&&t[3]===D&&t[4]===""}),W=A("erc8004_validation_request",{type:"object",additionalProperties:!1,required:["agentId","validator","requestURI"],description:"Ask a validator (re-execution staker, zkML verifier, TEE oracle, judge) to check an agent's work (Validation Registry validationRequest). Owner or approved operator only.",properties:{agentId:k,validator:{...R,description:"The validator contract or wallet that will respond."},requestURI:{type:"string",description:"HTTPS/IPFS URI of the data the validator needs (inputs and outputs)."},requestHash:{...f,description:"keccak256 commitment to the request payload; provide this or requestContent."},requestContent:{type:"string",description:"The exact request payload text; Oak commits its keccak256 as requestHash."},...C}},async(e,t)=>{let{address:s}=b(d),r=P(e.agentId),a=q(e.validator,"validator");if(E(a))throw new n("Provide a real validator address.");let u=x(e.requestURI,"requestURI");if(e.requestHash===void 0==(e.requestContent===void 0))throw new n("Provide exactly one of requestHash or requestContent.");let l=e.requestHash!==void 0?g(e.requestHash,"requestHash"):G(L(S(e.requestContent,"requestContent",1e6,!1)));return $(d,t,e,{to:s,data:N({abi:m,functionName:"validationRequest",args:[a,r,u,l]}),description:`Request validation of ERC-8004 agent ${r} by ${a}.`,summary:`Asks ${a} to validate agent ${r}'s work: request ${l}, data at ${I(u)}. The request is public and permanent. Only the named validator can respond. Repeat with transactionHash to verify.`,authority:async()=>{if(await F(d,r,t,"request validation"),await p(s,l))throw new n("A validation request with that requestHash already exists; use a different payload commitment.")},verify:async h=>{let c=U(h,s,m,"ValidationRequest"),i=await p(s,l);if(!i||!v(String(c.validatorAddress),a)||c.agentId!==r||c.requestHash!==l||i[1]!==r||!v(i[0],a))throw new n("The registry event or stored request does not match.");return{...H(l,i),confirmed:!0}}})}),Z=A("erc8004_validation_response",{type:"object",additionalProperties:!1,required:["requestHash","response"],description:"As the named validator, record a validation result from 0 (failed) to 100 (passed) for a request. May be called again to update.",properties:{requestHash:f,response:{type:"integer",minimum:0,maximum:100,description:"Validation score from 0 (failed) to 100 (passed)."},responseURI:{type:"string",description:"Optional HTTPS/IPFS evidence or audit URI."},responseHash:{...f,description:"Optional commitment to the evidence content."},tag:{type:"string",description:"Optional category, e.g. soft-finality / hard-finality."},...C}},async(e,t)=>{let{address:s}=b(d),r=g(e.requestHash,"requestHash"),a=e.response;if(typeof a!="number"||!Number.isInteger(a)||a<0||a>100)throw new n("response must be an integer from 0 to 100.");let u=e.responseURI===void 0?"":x(e.responseURI,"responseURI"),l=e.responseHash===void 0?D:g(e.responseHash,"responseHash"),h=S(e.tag,"tag",128);return $(d,t,e,{to:s,data:N({abi:m,functionName:"validationResponse",args:[r,a,u,l,h]}),description:`Respond ${a}/100 to validation request ${r}.`,summary:`Records validation result ${a}/100${h?` (tag ${I(h)})`:""} for request ${r} as this wallet. It is public; a later response replaces the stored result but the event history stays. Repeat with transactionHash to verify.`,authority:async()=>{let c=await p(s,r);if(!c)throw new n("No validation request has that requestHash.");if(!v(c[0],t))throw new n("Only the validator named in the request can respond to it.")},verify:async c=>{let i=U(c,s,m,"ValidationResponse"),o=await p(s,r);if(!o||i.requestHash!==r||i.response!==a||!v(String(i.validatorAddress),t)||o[2]!==a)throw new n("The registry event or stored result does not match.");return{...H(r,o),confirmed:!0}}})}),z=A("erc8004_validation",{type:"object",additionalProperties:!1,description:"Read-only validation lookups. Provide exactly one of requestHash (one request), agentId (its requests and average) or validator (requests addressed to it).",properties:{requestHash:f,agentId:k,validator:{...R,description:"The validator contract or wallet that will respond."},validators:{type:"array",maxItems:50,items:R,description:"With agentId: average only these validators."},tag:{type:"string",description:"With agentId: average only this tag."},limit:{type:"integer",minimum:1,maximum:100,default:25,description:"Maximum validation requests to return, from 1 to 100."}}},async e=>{let{address:t}=b(d),s=["requestHash","agentId","validator"].filter(o=>e[o]!==void 0);if(s.length!==1)throw new n("Provide exactly one of requestHash, agentId or validator.");let r=typeof e.limit=="number"?Math.min(Math.max(1,Math.trunc(e.limit)),100):25,a=async o=>{let y=o.slice(-r).reverse(),B=await Promise.all(y.map(async T=>{let O=await p(t,T);return O?H(T,O):{requestHash:T,unavailable:!0}}));return{requestsTotal:o.length,requests:B,truncated:o.length>y.length,newestFirst:!0}};if(s[0]==="requestHash"){let o=g(e.requestHash,"requestHash"),y=await p(t,o);if(!y)throw new n("No validation request has that requestHash.");return{registry:t,...H(o,y)}}if(s[0]==="validator")return{registry:t,validator:q(e.validator,"validator"),...await a(await w(t,"getValidatorRequests",[q(e.validator,"validator")]))};let u=P(e.agentId),l=Array.isArray(e.validators)?e.validators.map(o=>q(o,"validator")):[],h=S(e.tag,"tag",128),[c,i]=await Promise.all([w(t,"getAgentValidations",[u]),w(t,"getSummary",[u,l,h])]);return{registry:t,agentId:u.toString(),answeredCount:i[0].toString(),averageResponse:i[0]===0n?null:i[1],...await a(c),note:"The average counts only answered requests and includes whatever validators were asked; judge a result by who the validator is."}});return{tools:[W,Z,z]}};export{ae as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as x}from"./66F5ZH34.js";var m=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),k=new Set(["amount","assets","shares","value","wei","deposit","withdraw","borrow","repay","supply","cash","tip"]),T=new Set(["id","ids","index","indices","count","counts","timestamp","timestamps","time","deadline","duration","nonce","block","blocks","bps","pips","decimals","liquidity","gas","point","points","divisor","numerator","denominator"]),C=new Set(["recipient","receiver","spender","owner","wallet","beneficiary","to","from"]),O=/0x[0-9a-fA-F]{40}\b/,F=/(?:^| )One of: (0x[0-9a-fA-F]{40}(?:, 0x[0-9a-fA-F]{40})*) \(any letter case\)\.(?![\s\S])/,G=new Set(["^[0-9]+$","^\\d+$","^(0|[1-9][0-9]*)$","^(?:0|[1-9][0-9]*)$","^[1-9][0-9]*$"]),P=["oneOf","anyOf","allOf"];function R(e){return(e.replace(/\.(?:oneOf|anyOf|allOf)\[\d+\]/g,"").replace(/\[[^\]]*\]/g,"").split(".").at(-1)??"").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z]+/).filter(Boolean)}function j(e){return R(e).some(t=>C.has(t))}function b(e){if(e.length>200)throw new RangeError("Parameter descriptions must be at most 200 characters.");return e}function E(e){if(O.test(e))throw new Error("Recipient roles must not contain an example address.");return b(`Address of the ${e}; use the intended address, never an example address.`)}var L={amount(e,t,c){if(t!==void 0&&(!Number.isInteger(t)||t<0||t>255))throw new RangeError("Token decimals must be an integer from 0 to 255.");let d=c??(t===void 0?"1":`1${"0".repeat(t)}`);if(!/^[0-9]+$/.test(d))throw new Error("Amount examples must be decimal base-unit strings.");let f=BigInt(d).toString(),p=t===void 0?"":f.padStart(t+1,"0"),y=t===void 0?`${f} / 10^decimals`:t===0?f:`${p.slice(0,-t)}.${p.slice(-t)}`.replace(/\.?0+$/,"");return b(`Amount of ${e} in base units (${t===void 0?`use ${e} decimals`:`${e} has ${t} decimals`}). Example: "${d}" = ${y} ${e}.`)},bps:()=>"Value in basis points (50 = 0.5%).",pips:()=>"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",address(e,t){if(j(e))return E(e);if(t!==void 0&&!/^0x[0-9a-fA-F]{40}$/.test(t))throw new Error("Address examples must be 0x followed by 40 hex digits.");return b(`Address of the ${e} (0x followed by 40 hex digits).${t===void 0?"":` Example: ${t}.`}`)},recipient:E,unixSeconds:()=>"Timestamp in Unix seconds. Example: 1800000000.",id:e=>b(`Identifier of the ${e}, as a decimal string. Example: "1".`),enumValues:e=>b(`Choose ${Object.entries(e).map(([t,c])=>`"${t}": ${c}`).join("; ")}.`)};function I(e,t=new Set){if(t.has(e))return!1;if(Array.isArray(e.type)&&e.type.length===2&&e.type.includes("string")&&e.type.includes("integer"))return!0;let c=typeof e.pattern=="string"&&(G.has(e.pattern)||/^\^(?:\[0-9\]|\\d)\{[1-9][0-9]*(?:,[1-9][0-9]*)?\}\$$/.test(e.pattern)||/^\^\[1-9\]\[0-9\]\{0,[1-9][0-9]*\}\$$/.test(e.pattern));if((e.type==="string"||e.type===void 0)&&c)return!0;t.add(e);let d=P.some(f=>Array.isArray(e[f])&&e[f].some(p=>m(p)&&I(p,t)));return t.delete(e),d}function D(e,t){let c=R(e);return c.some(d=>k.has(d))&&!c.some(d=>T.has(d))&&I(t)}function _(e){let t=[];for(let f of e){let h=function(r,a,$){let o=m(r)?r:{},n=typeof o.description=="string"?o.description:"",s=l=>t.push({tool:f.name,path:a,problem:l}),i=n.match(F),u=m($)?$.enum:void 0,w=Array.isArray(u)&&u.length>0&&u.every(l=>typeof l=="string"&&/^0x[0-9a-fA-F]{40}$/.test(l)),S=i&&w?n.slice(0,i.index):n;if(S.trim()||s("missing"),i){let l=i[1].toLowerCase().split(", ");(!w||u.length!==l.length||!u.every(A=>l.includes(A.toLowerCase()))||!l.every(A=>u.some(N=>N.toLowerCase()===A)))&&s("enum-values-mismatch")}D(a,o)&&!/\bbase units\b/i.test(n)&&s("amount-without-base-units"),j(a)&&O.test(n)&&s("example-address-on-recipient"),(S.length>200||n.length>446)&&s("too-long")},g=function(r,a,$){if(!m(r)||p.has(r))return;p.add(r);let o=m($)?$:{};for(let n of["properties","patternProperties"])if(m(r[n]))for(let[s,i]of Object.entries(r[n])){let u=y(a,s),w=m(o[n])?o[n][s]:void 0;h(i,u,w),g(i,u,w)}for(let n of["items","prefixItems"])Array.isArray(r[n])?r[n].forEach((s,i)=>g(s,`${a}[${i}]`,Array.isArray(o[n])?o[n][i]:void 0)):n==="items"&&g(r[n],`${a}[]`,o[n]);for(let n of P)Array.isArray(r[n])&&r[n].forEach((s,i)=>g(s,y(a,`${n}[${i}]`),Array.isArray(o[n])?o[n][i]:void 0));for(let n of["additionalProperties","additionalItems","contains","propertyNames","not","if","then","else"])g(r[n],y(a,n==="additionalProperties"?"*":n),o[n]);for(let n of["$defs","definitions","dependentSchemas","dependencies"])if(m(r[n]))for(let[s,i]of Object.entries(r[n]))g(i,y(y(a,n),s),m(o[n])?o[n][s]:void 0);p.delete(r)};var c=h,d=g;let p=new Set,y=(r,a)=>r?`${r}.${a}`:a;g(f.inputSchema,"",x(f.inputSchema))}return t}export{L as a,D as b,_ as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as A}from"./523ZIR3J.js";import{a as i,b as w,c as b,e as C,f as x,g as h}from"./J73ATSEQ.js";import{a as o}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{a as f}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as g,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as B,parseAbiParameters as D,zeroAddress as R}from"viem";var L=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),N=D("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=B(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),O=B(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:{...y,description:"Address of the ERC-20 sale token to distribute in this auction."},amount:o('Amount of sale token in base units; use sale token decimals. Example: "1000000" = 1 sale token at 6 decimals.'),currency:{...y,description:"Payment currency address; the zero address means native ETH."},startBlock:o("Future block number at which auction bidding starts, as a decimal string."),endBlock:o("Block number at which auction bidding ends, as a decimal string."),claimBlock:o("First block number at which auction tokens can be claimed, as a decimal string."),tickSpacing:o("Auction price tick spacing in Q96 payment-currency base units per sale-token base unit."),floorPrice:o("Auction floor price in Q96 payment-currency base units per sale-token base unit."),requiredCurrencyRaised:o('Minimum amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),salt:{description:"Deployment salt as a 32-byte hex string; choose a fresh value for a new deployment.",type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{description:"Auction issuance steps; durations must cover endBlock minus startBlock and mps times duration must total 10000000.",type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:o("Issuance rate per block in MPS units; sum of mps times duration across steps must equal 10000000."),duration:o("Duration of this issuance step in blocks, as a decimal string.")}}}};function $(e,t){let r=i(e.startBlock,"startBlock",64),n=i(e.endBlock,"endBlock",64),c=i(e.claimBlock,"claimBlock",64);if(n<=r||c<n)throw new s("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new s("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new s("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let a=d,k=i(a.mps,"mps",24,!0),m=i(a.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(m)]).slice(2)}`,l+=k*m,p+=m}if(l!==10000000n||p!==n-r)throw new s("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S(N,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:r,endBlock:n,claimBlock:c,tickSpacing:i(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:i(e.floorPrice,"floorPrice"),requiredCurrencyRaised:i(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function z(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,r){h(t,Object.keys(v));let n=w(t.token),c=i(t.amount,"amount",128);if(n===R||n===b(t.currency))throw new s("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=$(t,r);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new s("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(f),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new s("Choose a future auction startBlock with time for confirmation and approvals.");let a=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[n,c,u,p,r]});if((await l.getCode({address:a})??"0x")!=="0x")throw new s("This auction already exists; choose a fresh salt or configuration.");let k=await C(e,n),m=[e.unsignedTx({to:A,data:g({abi:P,functionName:"create",args:[n,c,u,p]}),value:"0",chainId:f,description:`Create CCA ${a}; proceeds and unsold tokens go to ${r}.`}),e.unsignedTx({to:n,data:g({abi:I,functionName:"transfer",args:[a,c]}),value:"0",chainId:f,description:`Fund the factory-predicted auction ${a} with exactly ${c} base units of ${n}.`}),e.unsignedTx({to:a,data:g({abi:B(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:f,description:`Activate CCA ${a} after its sale tokens arrive.`})];return{...await x(e,m,r,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:a,sale:{token:k,amount:c.toString()}}}}]}}export{L as a,N as b,P as c,O as d,$ as e,z as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as s}from"./Q2ACLVWR.js";import{a as o,c as t}from"./JESMX2UC.js";import{getAddress as i}from"viem";var f=new Set(["priors_status",...s,...t.filter(r=>r.read).map(r=>r.name),"priors_ethos_status","priors_request_borrow","priors_request_repay","priors_request_stock","priors_request_backing","priors_pt_quote","priors_pt_position","priors_stock_quote","priors_savings_liquidity","priors_market_origin","priors_market_pins","priors_capabilities"]),p=new Set(["priors_sign_consent",...t.filter(r=>r.consentRoot).map(r=>r.name)]),u=new Set([...p,"priors_starter_line"]),R=new Set([...t.filter(r=>!r.read).map(r=>r.name),"priors_root_offer","priors_autopay_on","priors_autopay_off","priors_pt_buy","priors_pt_sell","priors_pt_redeem","priors_savings_force_withdraw","priors_stock_swap","priors_market_clear_bid_budget","priors_market_revoke_nft","priors_x_link"]),S=["priors_lend","priors_withdraw","priors_borrow","priors_repay","priors_starter_line","priors_close_line","priors_release_bond"];function c(r){let _=t.find(e=>e.name===r);return _?[o[_.contract],..._.approval==="bid"?[o.bidSpender]:[]]:r==="priors_root_offer"?[o.pool]:r==="priors_autopay_on"||r==="priors_autopay_off"?[o.autopay]:r==="priors_savings_force_withdraw"?[o.savings]:r==="priors_stock_swap"?[i("0xCaf681a66D020601342297493863E78C959E5cb2"),i("0x7Cd4E04E433E69e588728c86A3832753B5F846d4")]:r==="priors_pt_buy"||r==="priors_pt_sell"||r==="priors_pt_redeem"?[i("0x888888888889758F76e7103c6CbF23ABbF58F946")]:r==="priors_market_clear_bid_budget"?[o.bidSpender]:r==="priors_market_revoke_nft"?[o.registry,"0x0000000000000000000000000000000000000000"]:r==="priors_x_link"?[o.registry]:[]}export{f as a,p as b,u as c,R as d,S as e,c as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as M}from"./AMTRDPVO.js";import{a as G}from"./WHVZ372B.js";import{b as I}from"./DW4V5PUY.js";import{h as C}from"./2GXHYI23.js";import{b as W}from"./SPJCSEKP.js";import{a as U}from"./43LI5NKJ.js";import{a as P}from"./66F5ZH34.js";import{g as $}from"./NWNYJ26T.js";import{b as R}from"./IX3GZMTM.js";import{a as h,d as y,i as T,j as b}from"./FWD4L3CJ.js";import{a as p}from"./XSD5NL7J.js";import{encodeFunctionData as A,erc20Abi as E,parseAbi as N}from"viem";var f=T[h].vaults.spark.address,i={address:b,chainId:h,symbol:"USDG",decimals:y},m={address:f,chainId:h,symbol:"spUSDG",decimals:6},_=(1n<<256n)-1n,k=N(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function maxDeposit(address receiver) view returns (uint256)","function maxWithdraw(address owner) view returns (uint256)","function maxRedeem(address owner) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewWithdraw(uint256 assets) view returns (uint256)","function previewRedeem(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),t=(s,l)=>({token:{...s},amount:l.toString()});function D(s,l,v=!1){if(!s||typeof s!="object"||Array.isArray(s)||Object.keys(s).some(g=>!l||g!=="amount"))throw new p(l?"Provide only the amount for this Spark action.":"Spark listing takes no arguments.");if(!l)return 0n;if(v&&s.amount==="max")return"max";if(typeof s.amount!="string")throw new p("Amount must be a positive integer string in base units.");let n=R(s.amount);if(n===0n||n>_)throw new p("Amount must be positive and within the uint256 range.");return n}var F=s=>{async function l(a){try{return await a()}catch(e){throw new p(s.plainError(e))}}async function v(a){U(a);let e=s.clientFor(h);if(await e.getChainId()!==h)throw new p("Spark requires an endpoint on chain 4663.");let[r,d,o]=await Promise.all([e.readContract({address:f,abi:k,functionName:"asset"}),e.readContract({address:f,abi:k,functionName:"decimals"}),e.readContract({address:b,abi:E,functionName:"decimals"})]);if(typeof r!="string"||!$(r,b))throw new p("Spark does not report the expected USDG asset on chain 4663.");if(d!==m.decimals||o!==i.decimals)throw new p("Spark shares and USDG must both have 6 decimals.");return async(u,x=[])=>{let c=await e.readContract({address:f,abi:k,functionName:u,args:x});if(typeof c!="bigint"||c<0n||c>_)throw new p(`Spark returned an invalid ${u} value.`);return c}}function n(a){let e=a.amount.startsWith("-"),r=e?a.amount.slice(1):a.amount;return`${e?"-":""}${s.formatAmount(r,a.token.decimals)} ${a.token.symbol}`}async function g(a,e,r,d){let o=await s.preview(a,e),u=o.changes.map(n).join(", ");return{txs:a,amounts:r,preview:o,summary:`${d} Preview values can change before execution. ${o.summary}${u?` Changes: ${u}.`:""}`}}return{positions:a=>l(async()=>{let e=await v(a),r=await e("balanceOf",[a]);if(r===0n)return[];let[d,o,u]=await Promise.all([e("previewRedeem",[r]),e("maxRedeem",[a]),e("maxWithdraw",[a])]);return[{module:"spark",id:`${h}:${f}`,chainId:h,assets:[t(m,r)],economics:{principal:d===0n?[]:[C("redeemable",{token:{...i},amount:d.toString(),source:"spark.previewRedeem",heldAs:m.address})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`${n(t(m,r))}; redeem preview ${n(t(i,d))} (rounded down). Current maximum redeem ${n(t(m,o))}; maximum withdrawal ${n(t(i,u))}.`}]}),tools:[I(s),...M(s),...G(s),{name:"spark_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(a,e)=>l(async()=>{D(a,!1);let r=await v(e),d=await r("totalAssets"),[o,u,x,c,w]=await Promise.all([r("balanceOf",[e]),r("maxDeposit",[e]),r("maxWithdraw",[e]),r("maxRedeem",[e]),r("previewDeposit",[1000000n])]),S=await r("previewRedeem",[o]);return[{chainId:h,address:f,name:"Spark Savings USDG",asset:{...i},shareToken:{...m},totalAssets:t(i,d),balance:t(m,o),maxDeposit:t(i,u),maxWithdraw:t(i,x),maxRedeem:t(m,c),previewDepositAssets:t(i,1000000n),previewDeposit:t(m,w),previewRedeemShares:t(m,o),previewRedeem:t(i,S),rounding:"Deposit shares and redeemed assets round down; exact-asset withdrawals round shares up. Previews can change before execution."}]})},{name:"spark_deposit",inputSchema:{type:"object",properties:{amount:P('Amount of USDG in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=D(a,!0),d=await v(e),[o,u]=await Promise.all([d("maxDeposit",[e]),d("previewDeposit",[r])]);if(r>o)throw new p("The deposit exceeds Spark\u2019s current maximum deposit.");if(u===0n)throw new p("This deposit would return zero Spark shares.");let x=[s.approval(b,f,r.toString(),h),s.unsignedTx({to:f,data:A({abi:k,functionName:"deposit",args:[r,e]}),value:"0",chainId:h,description:`Deposit ${n(t(i,r))} into Spark for this wallet.`})];return g(x,e,{assets:t(i,r),shares:t(m,u),maxDeposit:t(i,o)},`Approve exactly ${n(t(i,r))} for Spark ${f}, then deposit. Expected ${n(t(m,u))}, rounded down; current maximum deposit ${n(t(i,o))}.`)})},{name:"spark_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'Amount of USDG in base units (USDG has 6 decimals; "1000000" = 1 USDG), or "max" to redeem all held shares.'}},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=D(a,!0,!0),d=await v(e),[o,u,x]=await Promise.all([d("balanceOf",[e]),d("maxWithdraw",[e]),d("maxRedeem",[e])]);if(o===0n)throw new p("This wallet has no Spark shares to withdraw.");let c,w,S;if(r==="max"){if(w=o,w>x)throw new p("The full share balance exceeds Spark\u2019s current maximum redeem. Request an asset amount within the current maximum withdrawal.");c=await d("previewRedeem",[w]),S=A({abi:k,functionName:"redeem",args:[w,e,e]})}else{if(c=r,c>u)throw new p("The withdrawal exceeds Spark\u2019s current maximum withdrawal.");if(w=await d("previewWithdraw",[c]),w>o)throw new p("This wallet has insufficient Spark shares for the withdrawal.");S=A({abi:k,functionName:"withdraw",args:[c,e,e]})}if(c===0n||w===0n)throw new p("Spark returned a zero asset or share preview for this withdrawal.");let j=r==="max"?`Redeem all ${n(t(m,w))} from Spark to this wallet.`:`Withdraw ${n(t(i,c))} from Spark to this wallet.`,O=[s.unsignedTx({to:f,data:S,value:"0",chainId:h,description:j})];return g(O,e,{assets:t(i,c),shares:t(m,w),maxWithdraw:t(i,u),maxRedeem:t(m,x)},r==="max"?`Redeem all ${n(t(m,w))} for an expected ${n(t(i,c))}, rounded down. Current maximum redeem ${n(t(m,x))}.`:`Withdraw ${n(t(i,c))} using an expected ${n(t(m,w))}, rounded up. Current maximum withdrawal ${n(t(i,u))}.`)})}]}};function te(s){return W("spark",[F(s)])}export{F as a,te as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u,r=/\b(?:unsafe|safe|safety|risks?|risky|recommend\w*|buy\w*)\b/i,o=/(?:[a-z][a-z0-9+.-]*:\/\/|(?:https?|ftp|file|mailto|javascript|data):|www\.|\/\/|\b[a-z0-9-]+(?:\.[a-z0-9-]+)+\b)/i,i="HEY Research Lab context unavailable",E="Project names this contract",p="Builder evidence, not a trading signal.",a="Not on HEY Research Lab yet",c="Not every token is on HEY Research Lab. Stock tokens and stablecoins were not, when Oak checked on 2026-11-06.",b=Object.freeze([a,c]);function n(t,e){return typeof t=="string"&&!!t.trim()&&t.length<=e&&!s.test(t)&&!/[<>[\]`]/.test(t)&&!r.test(t)&&!o.test(t)}function N(t,e){return!n(t,80)||!n(e,300)?i:`Builder status by HEY Research Lab: ${t}. ${e}`}export{E as a,p as b,a as c,c as d,b as e,n as f,N as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,c}from"./
|
|
1
|
+
import{a as x,c}from"./2OKYXT25.js";import{a}from"./XSD5NL7J.js";import{parseAbi as M}from"viem";var b=M(["function readState(address router) view returns ((int256 totalPt,int256 totalSy,int256 totalLp,address treasury,int256 scalarRoot,uint256 expiry,uint256 lnFeeRateRoot,uint256 reserveFeePercent,uint256 lastLnImpliedRate) market)","function pyIndexCurrent() returns(uint256)","function exchangeRate() view returns(uint256)","function previewDeposit(address tokenIn,uint256 amount) view returns(uint256)","function previewRedeem(address tokenOut,uint256 amount) view returns(uint256)"]),R=10n**18n,E=31536e3,P="Pendle's price doesn't match what Oak checked on the chain. Try a smaller amount. Nothing was signed.";function n(e,t=!1){if(typeof e!="bigint"||e<(t?1n:0n)||e>=1n<<256n)throw new a("Oak could not read the Pendle price check from the chain. Nothing was signed.");return e}function d(e){return c(Number.isInteger(e)&&e>=0&&e<=77,"unreadable token decimals"),10n**BigInt(e)}function k(e){if(!Number.isFinite(e)||Math.abs(e)>40)throw new a(P);return BigInt(Math.floor(Math.exp(e)*1e18))}async function A(e,t,v,p,u,f){try{c(Number.isFinite(f)&&Math.abs(f)<=.03,"unreadable or excessive price impact"),n(p,!0),n(u,!0);let i=await e.getBlock(),s=i.number,[h,C]=await Promise.all([e.readContract({address:t.market,abi:b,functionName:"readState",args:[x],blockNumber:s}),e.simulateContract({address:t.yt,abi:b,functionName:"pyIndexCurrent",blockNumber:s}).then(o=>o.result)]),I=n(h.lastLnImpliedRate),D=n(h.lnFeeRateRoot),w=n(C,!0);c(Number.isSafeInteger(t.expiry)&&t.expiry>Number(i.timestamp),"this term has ended; use pendle_redeem");let y=(t.expiry-Number(i.timestamp))/E,g=Number(I)/1e18*y,r;if(v==="buy")r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewDeposit",args:[t.inputToken,p],blockNumber:s}),!0)*w*k(g)*d(t.ptDecimals)/(R*R*d(t.syDecimals));else{let o=p*k(-g)*d(t.syDecimals)/(w*d(t.ptDecimals));n(o,!0),r=n(await e.readContract({address:t.sy,abi:b,functionName:"previewRedeem",args:[t.inputToken,o],blockNumber:s}),!0)}n(r,!0);let m=1-Math.exp(-Number(D)/1e18*y);c(Number.isFinite(m)&&m>=0&&m<=1,"unreadable market fee");let N=.01+m,F=u>r?u-r:r-u,l=Number(F)/Number(r);if(!Number.isFinite(l)||l>N)throw new a(P);return{estimateBase:r,relativeDifference:l,tolerance:N,blockNumber:s}}catch(i){throw i instanceof a?i:new a("Oak could not read the Pendle price check from the chain. Nothing was signed.")}}export{b as a,n as b,A as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as R}from"./G2LAO23N.js";import{C as W,H as X,I as q,L as Y,a as w,z as C}from"./U363GQTF.js";import{a as V}from"./66F5ZH34.js";import{f as Q,g as D}from"./NWNYJ26T.js";import{b as K,d as J}from"./IX3GZMTM.js";import{a as k}from"./FWD4L3CJ.js";import{a as i}from"./XSD5NL7J.js";import{encodeFunctionData as oe,erc20Abi as ne,getAddress as I,parseAbi as ie}from"viem";var P="https://hookr.fun/api/mcp",Z=ie(["function fill(uint256 orderId) returns (uint256)","function fillGasFloor(uint256 orderId) view returns (uint256)"]),N={type:"string",pattern:"^[1-9][0-9]*$"},ee={type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Hookr v4 pool ID: 32 bytes, 0x followed by 64 hex digits."},te={type:"string",enum:["buy","sell"],description:R.enumValues({buy:"spend the pool quote token to receive the listed token",sell:"spend the listed token to receive the quote token"})},re={cursor:{...N,description:"Order ID to start from, scanning downward (newest first). Use nextCursor from the previous page; omit for the latest order."},limit:{type:"integer",minimum:1,maximum:32,description:"Maximum number of order IDs to scan in this page, 1 to 32. Default 16."}};function B(o,m){if(typeof o!="string"||!/^[1-9][0-9]*$/.test(o)||o.length>78||BigInt(o)>=1n<<256n)throw new i(`Provide ${m} as a positive decimal integer string.`);return BigInt(o)}function g(o){return Q(o,"Hookr returned an invalid read response. Retry later.")}function H(o,m,e,t){return{name:o,inputSchema:{type:"object",description:`Read ${o.replace("hookr_","Hookr ")}. No signature or transaction.`,properties:m,required:e,additionalProperties:!1},execute:async(n,s)=>{if(Object.keys(n).some(a=>!Object.hasOwn(m,a))||e.some(a=>n[a]===void 0))throw new i(`Provide the documented arguments for ${o}.`);return t(n,s)}}}function F(o){if(typeof o!="string"||!/^0x[0-9a-fA-F]{64}$/.test(o))throw new i("Provide a 32-byte Hookr poolId.");return o}function $(o,m){let e=g(o),t=g(e.key);if(typeof t.fee!="number"||!Number.isInteger(t.fee)||t.fee<0||t.fee>16777215||typeof t.tickSpacing!="number"||!Number.isInteger(t.tickSpacing)||t.tickSpacing<=0||t.tickSpacing>8388607)throw new i("Hookr pool key is invalid.");let n={currency0:I(String(t.currency0)),currency1:I(String(t.currency1)),fee:t.fee,tickSpacing:t.tickSpacing,hooks:I(String(t.hooks))},s=m??F(e.poolId);if(BigInt(n.currency0)>=BigInt(n.currency1)||!D(W(n),s))throw new i("Hookr pool key does not match its PoolId.");let a=g(e.token),u=g(e.quote),d=r=>{let b=I(String(r.address));if(typeof r.symbol!="string"||!r.symbol.trim()||typeof r.decimals!="number"||!Number.isInteger(r.decimals)||r.decimals<0||r.decimals>255||![n.currency0,n.currency1].includes(b))throw new i("Hookr listed token metadata is invalid.");return{...r,address:b,chainId:k}},c=d(a),l=d(u);if(c.address===l.address)throw new i("Hookr listed token pair is invalid.");return{...e,poolId:s,key:n,token:c,quote:l}}async function se(o,m,e){try{let t=await o.http(P,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:m,arguments:e}}),signal:AbortSignal.timeout(15e3),redirect:"error"});if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=g(await t.json());if(n.error||n.id!==1)throw new Error("RPC failure");let s=g(n.result);if(s.isError)throw new Error("Tool failure");let a=g(s.structuredContent);if(a.status==="unavailable"||a.error)throw new Error("Unavailable");return a}catch{throw new i(`Hookr ${m} read is unavailable. Retry later; unavailable data is not an empty result.`)}}var O=se;function ke(o){let m=e=>H(e?"hookr_orders":"hookr_open_orders",re,[],async(t,n)=>{let s=t.limit??16;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>32)throw new i("Hookr page limit must be an integer from 1 to 32.");let a=o.clientFor(k),u=await a.getBlock();if(typeof u.number!="bigint"||typeof u.timestamp!="bigint"||u.timestamp<=0n)throw new i("Hookr order reads need a valid chain block and timestamp.");let d=new Proxy(Y(a),{get(h,f,p){return f==="readContract"?y=>h.readContract({...y,blockNumber:u.number}):Reflect.get(h,f,p)}}),c={...o,clientFor:()=>d},l=await d.readContract({address:w,abi:C,functionName:"lastOrderId"});if(typeof l!="bigint"||l<0n)throw new i("Could not read the last Hookr order ID. Coverage is unknown.");let r=t.cursor===void 0?l:B(t.cursor,"cursor");if(r>l)throw new i("Hookr cursor exceeds the latest order ID. Restart pagination.");let b=[],A=new Map,x=r,S=r>BigInt(s)?r-BigInt(s):0n;for(;r>S;){let h=r--,f=X(await d.readContract({address:w,abi:C,functionName:"getOrder",args:[h]}));if(Number(f.status)===0||BigInt(f.owner)===0n)throw new i(`Hookr order #${h} is missing. Coverage is unknown.`);if(e?!D(f.owner,n):Number(f.status)!==1)continue;let p=await q(c,h,{order:f,tokens:A});if(e){b.push(p);continue}let y=null,M=null,G=null,j=null,z=BigInt(p.expiry)<u.timestamp,L=p.fillable&&!z;if(L)try{let _=await d.readContract({address:w,abi:Z,functionName:"fillGasFloor",args:[BigInt(p.orderId)]}),T=await a.estimateGas({account:n,to:w,data:oe({abi:Z,functionName:"fill",args:[BigInt(p.orderId)]}),blockNumber:u.number}),v=await a.getGasPrice();if(typeof _!="bigint"||_<0n||typeof T!="bigint"||T<=0n||typeof v!="bigint"||v<0n)throw new Error("Invalid gas data");let U=(_*6n+4n)/5n,E=T>U?T:U;y=E.toString(),M=v.toString(),G=(E*v).toString(),j=(BigInt(p.bounty)-E*v).toString()}catch{}b.push({...p,fillable:L,expired:z,economics:{gasLimit:y,gasPrice:M,estimatedGasCost:G,bountyLessEstimatedGas:j,note:"Estimate only; excludes bounty claim gas and competition. Recheck the fill preview."}})}return{chainId:k,book:w,blockNumber:u.number.toString(),chainTime:u.timestamp.toString(),orders:b,scanned:{from:x.toString(),through:(r+1n).toString()},nextCursor:r>0n?r.toString():null,complete:r===0n}});return[m(!1),m(!0),H("hookr_order",{orderId:{...N,description:R.id("Hookr limit order")}},["orderId"],async e=>q(o,B(e.orderId,"orderId"))),H("hookr_pools",{token:{type:"string",description:R.address("listed token whose pools to return")},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum number of pools to return, 1 to 50."},cursor:{type:"string",pattern:"^[0-9]{1,6}$",description:"Paging cursor: the nextCursor from the previous pools page; omit for the first page."}},[],async e=>{if(e.token!==void 0)try{I(String(e.token))}catch{throw new i("Provide a valid token address.")}if(e.limit!==void 0&&(typeof e.limit!="number"||!Number.isInteger(e.limit)||e.limit<1||e.limit>50))throw new i("Pool page limit must be from 1 to 50.");if(e.cursor!==void 0&&(typeof e.cursor!="string"||!/^[0-9]{1,6}$/.test(e.cursor)))throw new i("Provide the pool nextCursor from the previous page.");let t=await O(o,"hookr_pools",e);if(!Array.isArray(t.pools))throw new i("Hookr pool coverage is unknown. Retry later.");return{...t,pools:t.pools.map(n=>$(n)),chainId:k,source:P}}),H("hookr_pool",{poolId:ee,side:te,amountIn:{...N,description:'Order input amount in base units of the input token (quote token for buy, listed token for sell); read its decimals. Example: "1000000". Give with side and minAmountOut.'},minAmountOut:{...N,description:'Minimum output in base units of the output token (listed token for buy, quote token for sell); read its decimals. Example: "1000000". Give with side and amountIn.'}},["poolId"],async e=>{let t=F(e.poolId),n=[e.side,e.amountIn,e.minAmountOut].some(y=>y!==void 0);if(n&&(e.side!=="buy"&&e.side!=="sell"||e.amountIn===void 0||e.minAmountOut===void 0))throw new i("Provide side, amountIn and minAmountOut together for order-specific bounty bounds.");let s=n?B(e.amountIn,"amountIn"):void 0,a=n?B(e.minAmountOut,"minAmountOut"):void 0;if(s!==void 0&&(s>=1n<<128n||a>=1n<<128n))throw new i("Hookr order amounts must fit uint128 base units.");let u=await O(o,"hookr_pool",{poolId:t}),d=u.listing?$(u.listing,t):void 0,c={...u,...d?{listing:d}:{},chainId:k,source:P};if(!n)return{...c,bountyBounds:{status:"requires-order-terms",note:"The keeper bounty floor depends on the order. Supply side, amountIn and minAmountOut in base units. The batch-1 0.0005 ETH observation is not a permanent floor."}};if(!d)throw new i("Hookr pool key is unavailable; bounty floor is unknown.");let l=d.key,r=g(e.side==="buy"?d.quote:d.token),b=I(String(r.address))===l.currency0,A=o.clientFor(k),x=await A.getBlock(),S=await A.readContract({address:w,abi:C,functionName:"bountyBounds",args:[l,b,s,a],blockNumber:x.number});if(!Array.isArray(S)||S.length!==3||S.some(y=>typeof y!="bigint"||y<0n||y>=1n<<128n))throw new i("Hookr bounty bounds are unavailable; the floor is unknown.");let[h,f,p]=S;return{...c,bountyBounds:{status:"available",blockNumber:x.number.toString(),token:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",symbol:"ETH",decimals:18,chainId:k},minBounty:h.toString(),defaultBounty:f.toString(),maxBounty:p.toString(),effectiveFloor:(h>0n?h:f).toString(),note:"ETH wei for this order at this block. Oak create uses the positive minimum, or the default when minimum is zero; recheck at creation."}}}),H("hookr_quote",{poolId:ee,side:te,amountIn:{...V(),description:'Amount of the input token in base units (quote token for buy, listed token for sell); read its decimals. Example: "1000000" = 1 token with 6 decimals.'}},["poolId","side","amountIn"],async(e,t)=>{let n=F(e.poolId);if(e.side!=="buy"&&e.side!=="sell")throw new i("Hookr side must be buy or sell.");if(typeof e.amountIn!="string"||K(e.amountIn)<=0n)throw new i("Provide a positive amountIn in base units.");let s=await O(o,"hookr_pool",{poolId:n}),a=$(s.listing,n),u=g(e.side==="buy"?a.quote:a.token),d=I(String(u.address)),c=d==="0x0000000000000000000000000000000000000000"?18:await o.clientFor(k).readContract({address:d,abi:ne,functionName:"decimals"});if(typeof c!="number"||!Number.isInteger(c)||c<0||c>255||typeof u.symbol!="string")throw new i("Hookr input token metadata is unavailable.");let l=J(e.amountIn,c),r=await O(o,"hookr_quote",{poolId:n,side:e.side,amount:l,payer:t}),b=await O(o,"hookr_check_trade",{poolId:n,side:e.side,amount:l,wallet:t});return{chainId:k,source:P,input:{token:{address:d,symbol:u.symbol,decimals:c,chainId:k},amount:e.amountIn},quote:r,check:b,note:"Informational quote. Review pool rules; unknown trade checks do not authorize a trade."}})]}export{se as a,ke as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as ee}from"./ZQAFFWDK.js";import{a as B}from"./
|
|
1
|
+
import{c as ee}from"./ZQAFFWDK.js";import{a as B}from"./H5DY7CNB.js";import{a as q}from"./IOYRL6AY.js";import{c as J,d as X,j as Y,l as Z}from"./NWNYJ26T.js";import{a as w,i as G}from"./FWD4L3CJ.js";import{a as f}from"./XSD5NL7J.js";import{a as Q}from"./JXOEJPJ4.js";import{encodeAbiParameters as de,encodeFunctionData as N,erc20Abi as ne,keccak256 as ue,parseAbi as oe,zeroAddress as le}from"viem";var s=oe(["function launchFactory() view returns (address)","function curve() view returns (address)","function factory() view returns (address)","function feeEscrow() view returns (address)","function memeHook() view returns (address)","function buybackVault() view returns (address)","function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))","function balanceOf(address) view returns (uint256)","function balanceOfToken(address account,address token) view returns (uint256)","function quoteFeeBalance() view returns (uint256)","function creatorTaxBalance() view returns (uint256)","function pendingFees(bytes32,address) view returns (uint256)","function pendingCreatorTax(bytes32,address) view returns (uint256)","function releasable(address token) view returns (uint256)","function vestedAmount(address token) view returns (uint256)"]),h=oe(["function sweepFees(uint256 minBuybackTokensOut)","function sweepPoolFees(bytes32 poolId,uint256 minConversionQuoteOut,uint256 minBuybackTokensOut)","function claim()","function claimToken(address token)","function release(address token)","error InternalSwapRequiresOperator()"]),ae={address:B,chainId:w,symbol:"ETH",decimals:18},te=G[w].pons;function c(o){let d=Y(o,"Provide a valid Pons coin address.",X);return Z(d,"Provide a nonzero Pons coin or contract address.")}function pe(o){let d=new Set;for(;o&&typeof o=="object"&&!d.has(o)&&d.size<16;){d.add(o);let l=o;if(l.data==="0x31cdb504"||l.data&&typeof l.data=="object"&&l.data.errorName==="InternalSwapRequiresOperator")return!0;o=l.cause}return!1}async function fe(o,d,l,k=!1,t){let i=c(d),b=c(l),e=o.clientFor(w);if(t===void 0&&await e.getChainId()!==w)throw new f(`Pons claims require chain ${w}.`);let n=t??await e.getBlockNumber(),[R,se]=await Promise.all([e.readContract({address:i,abi:s,functionName:"launchFactory",blockNumber:n}),e.readContract({address:i,abi:s,functionName:"curve",blockNumber:n})]),P=c(te.factory.address);if(c(R)!==P)throw new f("The coin must belong to the pinned Pons factory.");let y=c(se),[r,re,ie]=await Promise.all([e.readContract({address:P,abi:s,functionName:"getLaunchedToken",args:[i],blockNumber:n}),e.readContract({address:y,abi:s,functionName:"factory",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"feeEscrow",blockNumber:n})]);if(!r.exists||c(r.token)!==i||c(r.curve)!==y||c(re)!==P)throw new f("The coin does not resolve to a consistent Pons launch.");if(r.phase<0||r.phase>3)throw new f("This Pons launch phase is unsupported.");let H=c(r.creatorFeeRecipient),A=H===b;if(k&&!A)throw new f("Only the current creator fee recipient can claim these fees. Use the recipient wallet or Safe.");let g=r.pairToken.toLowerCase(),S=g===le,m=c(ie),M=async a=>{let[u,p]=await Promise.all([e.readContract({address:a,abi:ne,functionName:"symbol",blockNumber:n}),e.readContract({address:a,abi:ne,functionName:"decimals",blockNumber:n})]);return{address:a,chainId:w,symbol:Q(u),decimals:p}},[v,T,_,j,$]=await Promise.all([M(i),S?ae:M(g),e.readContract({address:m,abi:s,functionName:"balanceOf",args:[b],blockNumber:n}),S?0n:e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,g],blockNumber:n}),e.readContract({address:m,abi:s,functionName:"balanceOfToken",args:[b,i],blockNumber:n})]),x=[],F=[],E,C=(a,u,p)=>o.unsignedTx({to:a,data:u,value:"0",chainId:w,description:p});if(r.phase===0){let[a,u]=await Promise.all([e.readContract({address:y,abi:s,functionName:"quoteFeeBalance",blockNumber:n}),e.readContract({address:y,abi:s,functionName:"creatorTaxBalance",blockNumber:n})]);a+u>0n&&(F.push({token:T,amount:(a+u).toString()}),r.buybackEnabled?E="buyback":A&&(await e.simulateContract({address:y,abi:h,functionName:"sweepFees",args:[0n],account:b,gas:q,blockNumber:n}),x.push(C(y,N({abi:h,functionName:"sweepFees",args:[0n]}),`Sweep ${T.symbol} curve fees into the recipient escrow.`))))}else if(r.phase===2){let a=c(await e.readContract({address:P,abi:s,functionName:"memeHook",blockNumber:n})),u=ee(g,i,r.poolFee,r.tickSpacing),p=ue(de([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[u.currency0,u.currency1,r.poolFee,r.tickSpacing,a])),[V,z,W,U]=await Promise.all([e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,g],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingFees",args:[p,i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"pendingCreatorTax",args:[p,i],blockNumber:n})]);if(V+z>0n&&F.push({token:T,amount:(V+z).toString()}),W+U>0n&&F.push({token:v,amount:(W+U).toString()}),F.length)if(r.buybackEnabled)E="buyback";else if(A)try{await e.simulateContract({address:a,abi:h,functionName:"sweepPoolFees",args:[p,0n,0n],account:b,gas:q,blockNumber:n}),x.push(C(a,N({abi:h,functionName:"sweepPoolFees",args:[p,0n,0n]}),`Sweep ${T.symbol} pool fees into the recipient escrow.`))}catch(K){if(!pe(K))throw K;E="conversion"}else W+U>0n&&(E="conversion")}let I=0n,L=0n,D;if(r.buybackEnabled||$>0n||A){let a=c(await e.readContract({address:P,abi:s,functionName:"buybackVault",blockNumber:n}));if(a===c(te.buybackVault.address)){let[u,p,V]=await Promise.all([e.readContract({address:a,abi:s,functionName:"feeEscrow",blockNumber:n}),e.readContract({address:a,abi:s,functionName:"releasable",args:[i],blockNumber:n}),e.readContract({address:a,abi:s,functionName:"vestedAmount",args:[i],blockNumber:n})]);if(c(u)!==m)throw new f("The Pons buyback vault credits a different escrow than this coin.");[D,I,L]=[a,p,V]}else if(k)throw new f("The Pons factory reports a buyback vault outside the pinned deployment.")}let O=[...x];if(k){I>0n&&O.push(C(D,N({abi:h,functionName:"release",args:[i]}),`Release the vested ${v.symbol} buyback into the recipient escrow.`));let a=S&&x.length>0,u=!S&&x.length>0;(_>0n||a)&&O.push(C(m,N({abi:h,functionName:"claim"}),"Claim the caller\u2019s full native ETH escrow balance across all coins.")),(j>0n||u)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[g]}),`Claim the caller\u2019s full ${T.symbol} escrow balance across all coins.`)),($>0n||I>0n)&&O.push(C(m,N({abi:h,functionName:"claimToken",args:[i]}),`Claim the caller\u2019s released ${v.symbol} escrow balance.`))}let ce=[{token:ae,amount:_.toString()},...S?[]:[{token:T,amount:j.toString()}],{token:v,amount:$.toString()}];return{coin:v,pair:T,phase:r.phase,recipient:H,holder:b,isRecipient:A,escrow:m,blockNumber:n.toString(),credited:ce,pendingBeforeSweep:F,operatorWait:E,txs:O,buybackVest:{enabled:r.buybackEnabled,vault:D??null,releasable:{token:v,amount:I.toString()},vested:{token:v,amount:L.toString()},note:"Releasable is the gross vested amount; the release splits it with the Pons protocol before crediting the recipient escrow, and the preview shows the net claim."}}}function be(o){return o==="buyback"?"Buyback-enabled fee sweeps are not built here; pending fees await Pons\u2019s operator.":o==="conversion"?"Pending token-side conversion is awaiting Pons\u2019s keeper; the hook sweep was skipped.":""}async function me(o,d,l){if(!d||Object.keys(d).some(R=>R!=="token"))throw new f("Unsupported input. Provide only the Pons coin token address.");let k=c(d.token),t=await fe(o,k,c(l),!0),{txs:i}=t,b=await o.preview(i,l),e=t.credited[t.pair.address===B?0:1],n=[i.length?`Unsigned Pons fee claim prepared for the current recipient. Claims withdraw every ${t.pair.address===B?"native ETH":`native ETH and ${t.pair.symbol}`} balance owed to this wallet on this escrow across its coins.`:"No claim is available from this escrow.",be(t.operatorWait),BigInt(t.buybackVest.releasable.amount)>0n?`The buyback vest has ${t.buybackVest.releasable.amount} ${t.coin.symbol} base units releasable (gross); the release credits the escrow and the claim withdraws it.`:"","Pending amounts are pre-sweep fee and tax totals, not a guaranteed creator payout. Preview excludes gas. No transaction was sent."].filter(Boolean).join(" ");return{txs:i,summary:n,preview:b,claimable:e,credited:t.credited,pendingBeforeSweep:t.pendingBeforeSweep,waitingForKeeper:t.operatorWait!==void 0,operatorWait:t.operatorWait??null,buybackVest:t.buybackVest,recipient:t.recipient,escrow:t.escrow,phase:t.phase,blockNumber:t.blockNumber}}var Ne=o=>({tools:[{name:"pons_claim",inputSchema:{type:"object",additionalProperties:!1,required:["token"],properties:{token:{...J,description:"Pons coin address on chain 4663."}}},execute:async(d,l)=>{try{return await me(o,d,l)}catch(k){throw new f(o.plainError(k))}}}]});export{fe as a,be as b,Ne 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"./UEDGYZOC.js";import{a as _,b as D}from"./43LI5NKJ.js";import{b as B,c as G,d as O}from"./IOYRL6AY.js";import{a as R,b as M,i as U,s as E}from"./FWD4L3CJ.js";import{a as m,b as H,c as I,e as S}from"./XSD5NL7J.js";import{decodeFunctionResult as ee,encodeFunctionData as te,erc20Abi as V,getAddress as L,isAddress as ne,toEventSelector as re,toHex as T,zeroAddress as se}from"viem";var C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function ae(e){let s=e.toLowerCase();return s===se||s===C?C:e}var oe=re("Transfer(address,address,uint256)"),W="Preview note: simulation transfer-based token changes exclude gas and do not prove external settlement.";function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function x(){throw new m("The endpoint returned an unexpected simulation response.")}function j(e,s,l){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s+l)&&x();let d=e[0].calls,a=d.slice(0,s).map(n=>{if(!p(n)||n.status!=="0x1"||n.error||!Array.isArray(n.logs)||n.logs.length!==0||typeof n.returnData!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n.returnData))throw new m("Preview auxiliary read failed or returned invalid data.");return n.returnData});return{result:[{calls:d.slice(s)}],readResults:a}}async function N(e,s,l,d){let a=await e.getChainId();if(a!==s)throw new m(`Preview is on chain ${s}, but the endpoint reports chain ${a}.`);let n=await z(e),t=await K(e,n);if(n.number===null||typeof n.baseFeePerGas!="bigint"||n.baseFeePerGas<0n||typeof t!="bigint"||t<0n)throw new m("Current block base fee and gas price are unavailable or inconsistent. Retry the preview.");let r=t<n.baseFeePerGas?n.baseFeePerGas:t,A=B(n.gasLimit),c=l.map(u=>({from:d,to:u.to,data:u.data,value:T(BigInt(u.value)),gasPrice:T(r),gas:T(A)})),y=()=>e.request({method:"eth_simulateV1",params:[{blockStateCalls:[{blockOverrides:{baseFeePerGas:T(n.baseFeePerGas)},calls:c}],validation:!1,traceTransfers:!0},T(n.number)]},{retryCount:0});try{return await y()}catch(u){if(!I(u))throw u;let g=await e.getBalance({address:d,blockNumber:n.number}),w=await Promise.all(l.map(o=>e.estimateGas({account:d,to:o.to,data:o.data,value:BigInt(o.value),gas:A,blockNumber:n.number}).catch(()=>{}))),k=g;for(let[o,i]of c.entries()){let f=BigInt(i.value),F=O(B(n.gasLimit,w[o]),k,f,r,d,s),h=w[o];if(h!==void 0&&h>F)throw new m(G(d,s,g-k+f+h*r,g));i.gas=T(F),k-=f}let v=await y();if(Array.isArray(v)&&p(v[0])&&Array.isArray(v[0].calls))for(let[o,i]of v[0].calls.entries()){let f=c[o];if(f&&p(i)&&i.status==="0x0"&&typeof i.gasUsed=="string"&&/^0x[0-9a-f]+$/i.test(i.gasUsed)&&BigInt(i.gasUsed)>=BigInt(f.gas))throw new m(G(d,s,BigInt(f.value)+(BigInt(f.gas)+1n)*r,g))}return v}}function J(e,s,l,d){(!Array.isArray(e)||e.length!==1||!p(e[0])||!Array.isArray(e[0].calls)||e[0].calls.length!==s)&&x();let a=new Map;for(let[n,t]of e[0].calls.entries()){if(p(t)||x(),t.status==="0x0")throw new m(`Preview call ${n+1} on chain ${d} reverted. ${S(t.error)}`);(t.status!=="0x1"||t.error||!Array.isArray(t.logs))&&x();for(let r of t.logs){if((!p(r)||!Array.isArray(r.topics))&&x(),typeof r.topics[0]!="string"||r.topics[0].toLowerCase()!==oe||r.topics.length===4)continue;(r.topics.length!==3||typeof r.address!="string"||!ne(r.address,{strict:!1})||typeof r.data!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r.data)||!r.topics.slice(1).every(w=>typeof w=="string"&&/^0x0{24}[0-9a-fA-F]{40}$/.test(w)))&&x();let A=r.topics[1].slice(-40).toLowerCase(),c=r.topics[2].slice(-40).toLowerCase(),y=l.slice(2).toLowerCase(),u=BigInt(r.data),g=(c===y?u:0n)-(A===y?u:0n);if(g!==0n){let w=ae(r.address.toLowerCase());a.set(w,(a.get(w)??0n)+g)}}}return a}async function Q(e,s,l,d){let a=s===R?E.mainnet:s===M?E.testnet:void 0,n=a&&[{address:a.usdg,symbol:"USDG",decimals:6},{address:a.weth,symbol:"WETH",decimals:18},...s===R?[{address:U[4663].meridian.CollateralToken_USDe.address,symbol:"USDe",decimals:18}]:[]].find(r=>r.address.toLowerCase()===e);if(n)return{...n,address:L(e),chainId:s};let t;if(e===C){let r=l.chain?.nativeCurrency??(s===4663?{symbol:"ETH",decimals:18}:void 0);if(!r)throw new m(`Native token metadata is unavailable for chain ${s}.`);t={address:e,chainId:s,symbol:r.symbol,decimals:r.decimals}}else if(d)t=await d(e,s,l);else{let r=await q(l,s,e,"decimals");t={address:e,chainId:s,symbol:e,decimals:r}}if(!t||typeof t.address!="string"||t.address.toLowerCase()!==e||t.chainId!==s||typeof t.symbol!="string"||!t.symbol.trim()||!Number.isInteger(t.decimals)||t.decimals<0||t.decimals>255)throw new m(`Invalid token metadata for ${e} on chain ${s}.`);return{address:e===C?e:L(e),chainId:s,symbol:e===C?t.symbol:L(e),decimals:t.decimals}}function ge(e){return async(s,l,d)=>{_(l);let a=s.map(D),n=(d?.reads??[]).map(c=>D({...c,value:"0",description:"Read before simulated transactions."})),t=a[0]?.chainId;if(t===void 0&&n.length)throw new m("Preview auxiliary reads require a transaction bundle.");if(t===void 0)return{txs:a,changes:[],summary:W};let r=[...n,...a].find(c=>c.chainId!==t);if(r)throw new m(`Preview cannot combine chain ${t} with chain ${r.chainId}. Preview each chain separately.`);let A=n.length?[...n,...a]:a;try{let c=e.clientFor(t),y;try{y=await N(c,t,A,l)}catch(o){if(!H(o,-32601,-32004)||!e.anvilFor)throw o;c=await e.anvilFor(t),y=await N(c,t,A,l)}let u;n.length&&({result:y,readResults:u}=j(y,n.length,a.length));let g=J(y,a.length,l,t),w=new Map,k=[];for(let[o,i]of g)if(i!==0n)try{w.set(o,await Q(o,t,c,e.tokenFor))}catch(f){if(o===C||e.tokenFor||(await c.getCode({address:o})??"0x")!=="0x")throw f;k.push(o)}if(k.length){let o=k.flatMap(h=>["symbol","decimals"].map(b=>D({to:h,data:te({abi:V,functionName:b}),value:"0",chainId:t,description:`Read simulated token ${b}.`}))),i=await N(c,t,[...A,...o],l);if(u){let h=j(i,u.length,a.length+o.length);if(h.readResults.some((b,$)=>b!==u[$]))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");i=h.result}(!Array.isArray(i)||i.length!==1||!p(i[0])||!Array.isArray(i[0].calls)||i[0].calls.length!==a.length+o.length)&&x();let f=i[0].calls,F=J([{calls:f.slice(0,a.length)}],a.length,l,t);if(g.size!==F.size||[...g].some(([h,b])=>F.get(h)!==b))throw new m("Simulation changed while reading new-token metadata. Refresh the preview.");for(let[h,b]of k.entries()){let $=(Y,Z)=>{let P=f[a.length+h*2+Z];if(!p(P)||P.status!=="0x1"||P.error||typeof P.returnData!="string"||!/^0x[0-9a-fA-F]+$/.test(P.returnData))throw new m(`Invalid simulated token metadata for ${b} on chain ${t}.`);return ee({abi:V,functionName:Y,data:P.returnData})},X={address:b,chainId:t,symbol:$("symbol",0),decimals:$("decimals",1)};w.set(b,await Q(b,t,c,async()=>X))}}let v=[...g].filter(([,o])=>o!==0n).map(([o,i])=>({token:w.get(o),amount:i.toString()}));return{txs:a,changes:v,summary:W,...u?{readResults:u}:{}}}catch(c){throw new m(`Preview on chain ${t} failed: ${S(c)}`)}}}export{C as a,ae as b,ge as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as E}from"./43LI5NKJ.js";import{c as O}from"./SCG5HWMN.js";import{c as C,e as u,g as I}from"./NWNYJ26T.js";import{a as m}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{getAddress as k}from"viem";var D="https://api.velora.xyz/v2/delta",A=["PENDING","AWAITING_SIGNATURE","ACTIVE","SUSPENDED","CANCELLING","BRIDGING","COMPLETED","FAILED","EXPIRED","REFUNDING","CANCELLED","REFUNDED"],w=["Order","FillableOrder","ProductiveOrder","ExternalOrder","TWAPOrder","TWAPBuyOrder"],x="^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";function i(e){if(!e)throw new y("Velora Delta returned an unexpected response.")}function l(e){if(typeof e!="string")throw new y("Provide an address.");return E(e),k(e)}function N(e,p,o){if(e===void 0)return o;if(typeof e!="number"||!Number.isSafeInteger(e)||e<1||e>p)throw new y(`Provide an integer between 1 and ${p}.`);return e}function b(e,p){if(typeof e!="string"||!p.includes(e))throw new y(`Choose one of: ${p.join(", ")}.`);return e}function T(e){i(u(e)&&Number.isSafeInteger(e.chainId)&&Number(e.chainId)>0);let p=l(e.token);for(let o of["amount","expectedAmount","executedAmount"])i(e[o]===void 0||e[o]===null||typeof e[o]=="string"&&/^(0|[1-9][0-9]*)$/.test(e[o])&&BigInt(e[o])<1n<<256n);return i(typeof e.amount=="string"||typeof e.expectedAmount=="string"),{chainId:e.chainId,token:p,...Object.fromEntries(["amount","expectedAmount","executedAmount"].filter(o=>e[o]!==void 0).map(o=>[o,e[o]]))}}function P(e,p,o){i(u(e)&&typeof e.id=="string"&&new RegExp(x).test(e.id)),i(o===void 0||I(e.id,o));let h=l(e.owner);i(I(h,p)),i(typeof e.status=="string"&&A.includes(e.status)),i(e.side==="SELL"||e.side==="BUY"),i(e.type==="MARKET"||e.type==="LIMIT"),i(typeof e.onChainOrderType=="string"&&w.includes(e.onChainOrderType));let t=T(e.input);i(t.chainId===m);let a=T(e.output);i(typeof e.orderHash=="string"&&/^0x[0-9a-fA-F]{64}$/.test(e.orderHash)),i(Array.isArray(e.transactions)&&Array.isArray(e.refunds));for(let r of e.transactions){i(u(r)&&typeof r.originTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.originTx)),i(r.destinationTx===void 0||r.destinationTx===null||typeof r.destinationTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.destinationTx)),i(typeof r.filledPercent=="number"&&Number.isFinite(r.filledPercent)&&r.filledPercent>=0&&r.filledPercent<=100);for(let d of["spentAmount","receivedAmount"])i(r[d]===void 0||r[d]===null||typeof r[d]=="string"&&/^(0|[1-9][0-9]*)$/.test(r[d]))}let n=e.refunds.map(r=>(i(u(r)&&typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)),{...T(r),tx:r.tx}));return{id:e.id,status:e.status,side:e.side,type:e.type,onChainOrderType:e.onChainOrderType,owner:h,beneficiary:l(e.beneficiary),orderHash:e.orderHash,input:t,output:a,transactions:structuredClone(e.transactions),refunds:n,...Object.fromEntries(["createdAt","updatedAt","expiresAt"].filter(r=>typeof e[r]=="string").map(r=>[r,e[r]]))}}function L(e){function p(t,a,n,r){return{name:t,inputSchema:{type:"object",additionalProperties:!1,properties:a,required:n},execute:async(d,s)=>{try{l(s);for(let c of Object.keys(d))if(!Object.hasOwn(a,c))throw new y(`Unsupported ${t} argument: ${c}.`);return await r(d,s)}catch(c){throw new y(e.plainError(c))}}}}let o=t=>O(e.http,`${D}/${t}`,{method:"GET"},u),h="Provider activity is not receipt proof. Token amounts are base units; resolve symbols and decimals with find_token. Delta signing and submission are not enabled in Oak.";return[p("velora_delta_token_support",{token:{...C,description:"Address of the token to inspect or use."}},["token"],async t=>{let a=l(t.token),n=await o(`prices/is-token-supported?${new URLSearchParams({chainId:String(m),token:a})}`);return i(typeof n.supported=="boolean"),{token:a,chainId:m,supported:n.supported}}),p("velora_delta_orders",{page:{description:"Result page number, starting at 1; defaults to 1.",type:"integer",minimum:1},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:1e3},type:{description:'Choose "MARKET" for a market order or "LIMIT" for a limit order.',type:"string",enum:["MARKET","LIMIT"]},status:{description:"Filter by the listed Delta lifecycle statuses; omit to include all statuses.",type:"array",minItems:1,maxItems:A.length,items:{type:"string",enum:A}},onChainOrderType:{description:"Filter by Delta contract family: Order, ProductiveOrder, ExternalOrder, TWAPOrder or TWAPBuyOrder.",type:"string",enum:w.filter(t=>t!=="FillableOrder")}},[],async(t,a)=>{let n=N(t.page,Number.MAX_SAFE_INTEGER,1),r=N(t.limit,1e3,100),d=new URLSearchParams({userAddress:a,chainId:String(m),page:String(n),limit:String(r)});if(t.type!==void 0&&d.set("type",b(t.type,["MARKET","LIMIT"])),t.onChainOrderType!==void 0&&d.set("onChainOrderType",b(t.onChainOrderType,w.filter(f=>f!=="FillableOrder"))),t.status!==void 0){if(!Array.isArray(t.status)||!t.status.length||t.status.length>A.length)throw new y("Provide a nonempty list of Delta statuses.");d.set("status",t.status.map(f=>b(f,A)).join(","))}let s=await o(`orders?${d}`);i(Array.isArray(s.data)&&s.data.length<=r),i(s.page===n&&s.limit===r&&Number.isSafeInteger(s.total)&&Number(s.total)>=0&&typeof s.hasMore=="boolean");let c=(n-1)*r+s.data.length;i(Number.isSafeInteger(c)&&c<=Math.max(Number(s.total),(n-1)*r)),i(s.hasMore===c<Number(s.total)&&(!s.hasMore||s.data.length>0));let g=s.data.map(f=>P(f,a));return i(new Set(g.map(f=>f.id.toLowerCase())).size===g.length),i(g.every(f=>(t.type===void 0||f.type===t.type)&&(t.onChainOrderType===void 0||f.onChainOrderType===t.onChainOrderType)&&(t.status===void 0||t.status.includes(f.status)))),{data:g,total:s.total,page:n,limit:r,hasMore:s.hasMore,notice:h}}),p("velora_delta_order",{orderId:{description:"Identifier of the Delta order, as a UUID.",type:"string",pattern:x}},["orderId"],async(t,a)=>{if(typeof t.orderId!="string"||!new RegExp(x).test(t.orderId))throw new y("Provide a Delta order UUID.");let n=await o(`orders/${t.orderId}`);return{order:P(n,a,t.orderId),notice:h}}),p("velora_delta_bridge_routes",{},[],async()=>{let t=await o("prices/bridge-routes");i(Array.isArray(t.routes));let a=t.routes.map(n=>(i(u(n)&&Number.isSafeInteger(n.srcChainId)&&Number(n.srcChainId)>0&&Number.isSafeInteger(n.destChainId)&&Number(n.destChainId)>0&&Array.isArray(n.tokens)),{srcChainId:n.srcChainId,destChainId:n.destChainId,tokens:n.tokens.map(l)})).filter(n=>n.srcChainId===m||n.destChainId===m);return{chainId:m,routes:a,executionAvailable:!1}}),p("velora_delta_bridge_protocols",{},[],async()=>{let t=await o("prices/bridge-protocols");return i(Array.isArray(t.bridgeProtocols)),{bridgeProtocols:t.bridgeProtocols.map(n=>(i(u(n)&&typeof n.protocol=="string"&&typeof n.displayName=="string"),{protocol:n.protocol,displayName:n.displayName})),executionAvailable:!1}}),p("velora_delta_strategies",{},[],async()=>{let t=await o(`prices/strategies/${m}`),a=Object.entries(t).map(([n,r])=>(i(u(r)&&Array.isArray(r.strategies)),{underlying:l(n),address:l(r.address),strategies:r.strategies.map(d=>{i(u(d)&&typeof d.name=="string");let s=d.apr;return i(s===null||u(s)&&["gross","net"].every(c=>typeof s[c]=="string"&&/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(s[c]))),{vault:l(d.vault),name:d.name,apr:structuredClone(d.apr)}})}));return{chainId:m,strategies:a,executionAvailable:!1,notice:"APRs are provider estimates refreshed every three hours, not promised returns. Verify each vault and its exit before depositing."}})]}export{L as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Ce,o as le}from"./CAWTAR5V.js";import{a as ue}from"./H5DY7CNB.js";import{b as Ne}from"./SPJCSEKP.js";import{a as Ae}from"./IOYRL6AY.js";import{a as ve}from"./66F5ZH34.js";import{e as X,g as p,i as xe,n as Ie}from"./NWNYJ26T.js";import{a as A,i as Te}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{a as de}from"./JXOEJPJ4.js";import{decodeErrorResult as Me,decodeEventLog as ce,encodeAbiParameters as U,encodeFunctionData as C,erc20Abi as J,parseAbi as $e,parseAbiParameters as q,toHex as Be,zeroAddress as F}from"viem";var g=Te[A].poolsTrade,Y=g.liquidityLauncher.address,B=g.uerc20BeneficiaryVault.address,fe=g.universalRouter.address,ie=10n**27n,j=(1n<<128n)-1n,Se=`0x${"00".repeat(32)}`,D=63127652n,pe=100000n,ae=10000000n,Ue=2000n,me={address:ue,symbol:"ETH",decimals:18,chainId:A},h=$e(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),K=$e(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),V=[g.instantLaunchStrategyFeesOn.address,g.instantLaunchStrategyFeesOff.address];function re(l){if(l.status!=="success")throw new r("The launch receipt did not succeed.");let c=[];for(let k of l.logs){let H=V.findIndex(L=>p(L,k.address));if(H===-1||k.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let G=ce({abi:K,eventName:"TokenLaunched",data:k.data,topics:[...k.topics]}),{token:x,poolId:ee,poolKey:M,feeSplitter:te}=G.args,_=H===0?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address;if(!p(te,_)||!p(M.currency0,F)||!p(M.currency1,x)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,F))throw new r("The launch does not match the current native ETH strategy.");let ne=l.logs.filter(L=>p(L.address,g.v4PositionManager.address)).flatMap(L=>{if(L.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let O=ce({abi:K,eventName:"Transfer",data:L.data,topics:[...L.topics]}).args;return p(O.from,F)&&p(O.to,V[H])?[O.tokenId]:[]});if(ne.length!==1)throw new r("The launch receipt must identify one matching position mint.");c.push({token:x,poolId:ee,positionId:ne[0].toString(),creatorFees:H===0})}return c}function S(l){return xe(l,"Provide a valid wallet or token address.")}function P(l,c,k=!1){return Ie(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!k})}function Z(l,c,k=!1){if(k&&l===void 0)return"";if(typeof l!="string"||!k&&!l.trim()||l.length>4096)throw new r(`Provide a valid ${c}.`);return l}function he(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new r("Provide a valid launch transaction hash.");return l}function ge(l,c,k="minAmountOut"){let H=c.slippageBps??Ce;if(typeof H!="number")throw new r("Slippage must be an integer in basis points.");let G=le(l.toString(),H),x=c[k]===void 0?BigInt(G):P(c[k],k,l===0n);if(x>l||l>0n&&x===0n||x>j)throw new r("The minimum output must be positive and no larger than the simulated output.");return x}var qe=l=>{let c=l.clientFor(A),k=(e,o,n,s)=>l.unsignedTx({to:e,data:o,value:n.toString(),chainId:A,description:s}),H=e=>{throw new r(l.plainError(e))};async function G(){if(await c.getChainId()!==A)throw new r("pools.trade requires Robinhood Chain 4663.")}async function x(e,o,n){let s=await l.preview(e,o),t=s.changes.map(({token:a,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,a.decimals)} ${de(a.symbol)} (${a.address}, chain ${a.chainId})`});return{txs:e,summary:[n,s.summary,...t].join(" ")}}async function ee(){return(await c.getBlock()).timestamp+600n}function M(e,o,n,s,t,a){let d=[F,e,2500,25,F],i=[U(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,o,n,s,0n,"0x"]]),U(q("address,uint256"),[o?F:e,n]),U(q("address,address,uint256"),[o?e:F,t,0n])],m=[U(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:m,encoded:U(q("bytes,bytes[],uint256"),["0x10",m,a])}}async function te(e,o){let n=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:o,gas:Be(Ae),to:i.to,data:i.data,value:Be(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(n)||n.length!==1||!X(n[0])||!Array.isArray(n[0].calls)||n[0].calls.length!==e.length)throw new r("The output simulation returned a malformed response.");let s=n[0].calls;if(!s.slice(0,-1).every(i=>X(i)&&i.status==="0x1"&&!i.error))throw new r("A prerequisite failed during the output simulation.");let t=s.at(-1);if(!X(t)||t.status!=="0x0")throw new r("The output simulation did not return the expected minimum-output control.");let a=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:X(t.error)?t.error.data:void 0;if(typeof a!="string"||!/^0x[0-9a-fA-F]+$/.test(a))throw new r("The output simulation did not report an expected amount.");let d=Me({abi:h,data:a});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==j||d.args[1]<=0n||d.args[1]>=j)throw new r("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ne=2e3;async function L(e,o,n,s=()=>!0){let t=await c.getBlockNumber(),a=t<D?0n:(t-D)/ae+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Ue)throw new r("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(a*BigInt(V.length+(e&&!n?1:0)));let m=new Map,b=new Set;for(let u=D;u<=t&&s();u+=ae){let f=u+ae-1n>t?t:u+ae-1n,y=(await Promise.all(V.map(T=>c.getLogs({address:T,event:K[0],...o?{args:{token:o}}:{},fromBlock:u,toBlock:f,strict:!0})))).flat(),$=[...new Set(y.map(T=>T.transactionHash))].filter(T=>!T||!m.has(T));for(let T=0;T<$.length&&s();T+=8)await Promise.all($.slice(T,T+8).map(async E=>{if(!E)throw new r("A launch log is missing its transaction hash.");let R=_.get(E);R||(i(),R=await c.getTransactionReceipt({hash:E}),_.size>=ne&&_.delete(_.keys().next().value),_.set(E,R)),m.set(E,R),s()&&await n?.(R)}));if(!s())break;if(e&&!n){let T=await c.getLogs({address:B,event:K[1],args:{to:e},fromBlock:u,toBlock:f,strict:!0});for(let E of T){let R=ce({abi:K,eventName:"Transfer",data:E.data,topics:E.topics}).args;b.add(R.tokenId.toString())}}}return{receipts:[...m.values()],feeIds:b}}async function O(e){let n=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:he(e.launchTx)})]:(await L(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(re).filter(s=>e.positionId!==void 0?s.positionId===P(e.positionId,"positionId").toString():p(s.token,S(e.token)));if(n.length!==1)throw new r("No unique current-strategy launch was found. Older strategy generations are unsupported.");return n[0]}async function Ee(e,o){if(typeof e.creatorFees!="boolean")throw new r("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),F)&&!p(S(e.pair),ue))throw new r("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new r("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&P(e.supply,"supply")!==ie)throw new r("Instant Launch requires a supply of one billion tokens.");let n=S(e.feeBeneficiary);if(p(n,F)||p(n,Y))throw new r("The fee beneficiary must be a wallet other than the launcher or zero address.");let s=Z(e.name,"name"),t=Z(e.symbol,"symbol"),a=e.initialBuy===void 0?0n:P(e.initialBuy,"initialBuy",!0);if(a>j)throw new r("The initial buy exceeds uint128.");if(a===0n&&e.minAmountOut!==void 0)throw new r("A minimum output requires an initial buy.");let d=await c.readContract({address:Y,abi:h,functionName:"getGraffiti",args:[o]}),i=S(await c.readContract({address:g.uerc20Factory.address,abi:h,functionName:"getUERC20Address",args:[s,t,18,Y,d]})),m=await c.getCode({address:i});if(m&&m!=="0x")throw new r("This wallet already launched that name and symbol.");let b=U(q("(string,string,string,bytes)"),[[Z(e.description,"description",!0),Z(e.website,"website",!0),Z(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?V[0]:V[1],f=[C({abi:h,functionName:"createToken",args:[g.uerc20Factory.address,s,t,18,ie,Y,b]}),C({abi:h,functionName:"distributeToken",args:[i,{strategy:u,amount:ie,configData:U(q("address"),[n])},Se]})],y=await ee(),v=T=>{let E=[...f];if(a>0n){let R=U(q("(address,address,bytes)"),[[fe,o,M(i,!0,a,T,o,y).encoded]]);E.push(C({abi:h,functionName:"distributeWithNative",args:[g.universalRouterStrategyApp.address,R,Se,a]}))}return k(Y,C({abi:h,functionName:"multicall",args:[E]}),a,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${n}.`)},$=a>0n?ge(await te([v(j)],o),e):0n;return x([v($)],o,`Launch ${s} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${n}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${$} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Fe(e,o,n){let s=P(e.amountIn,"amountIn");if(s>j)throw new r("The trade amount exceeds uint128.");let t=S(e.token);await O(e);let a=await ee(),d=[];n||(await c.readContract({address:t,abi:J,functionName:"allowance",args:[o,g.permit2.address]})<s&&d.push(l.approval(t,g.permit2.address,s.toString(),A)),d.push(k(g.permit2.address,C({abi:h,functionName:"approve",args:[t,fe,s,Number(a)]}),0n,`Permit the exact ${s} token base units until ${a}.`)));let i=u=>[...d,k(fe,C({abi:h,functionName:"execute",args:["0x10",M(t,n,s,u,o,a).inputs,a]}),n?s:0n,`${n?"Buy":"Sell"} ${t} with minimum output ${u}.`)],m=await te(i(j),o),b=ge(m,e);return x(i(b),o,`${n?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${s}, minimum output ${b} ${n?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function we(e,o,n){let s=await O(e),t=BigInt(s.positionId),a=s.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,d=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,a))throw new r("The position is not locked in its current-strategy splitter.");if(!n)return x([k(a,C({abi:h,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],o,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(i,o))throw new r("Only the current fee NFT holder is entitled to claim.");let m=await c.readContract({address:B,abi:h,functionName:"amounts",args:[t]}),b=ge(m[0],e,"minEth");if(m[1]!==0n)throw new r("The current buy-only creator fee configuration returned unexpected token fees.");return x([k(B,C({abi:h,functionName:"claim",args:[t,b,0n]}),0n,`Claim collected ETH fees for position ${t} to ${o}.`)],o,`Claim collected fees: ${m[0]} ETH base units (18 decimals), minimum ${b}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function Le(e,o){let n=await O(e),s=S(e.to);if(p(s,F))throw new r("The token recipient cannot be the zero address.");let t=P(e.amount,"amount"),a=await oe(n.token,await c.getBlockNumber());return x([k(a.address,C({abi:J,functionName:"transfer",args:[s,t]}),0n,`Transfer exactly ${t} ${de(a.symbol)} base units to ${s}.`)],o,`Transfer ${t} token base units (token ${a.address}, decimals ${a.decimals}, chain ${a.chainId}) to ${s}. No approval; no transaction sent.`)}async function Oe(e,o){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new r("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let n=e.positionIds.map(d=>P(d,"positionId").toString());if(new Set(n).size!==n.length)throw new r("Each position ID must appear once.");let s=e.launchTxs.map(he),t=new Map;for(let[d,i]of n.entries()){let b=(await O({positionId:i,launchTx:s[d]})).creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,u=BigInt(i),f=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[u]});if(!p(f,b))throw new r("The position is not locked in its current-strategy splitter.");t.set(b,[...t.get(b)??[],u])}let a=[...t].map(([d,i])=>k(d,C({abi:h,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return x(a,o,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let Q="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function oe(e,o){let[n,s]=await Promise.all([c.readContract({address:e,abi:J,functionName:"symbol",blockNumber:o}),c.readContract({address:e,abi:J,functionName:"decimals",blockNumber:o})]);if(typeof n!="string"||!n||n.length>256||s!==18)throw new r("The current launch token returned invalid metadata.");return{address:e,symbol:n,decimals:s,chainId:A}}async function be(e,o,n,s){let t=s??await oe(e.token,n),a=await c.readContract({address:t.address,abi:J,functionName:"balanceOf",args:[o],blockNumber:n});return{token:t,amount:a.toString(),humanAmount:l.formatAmount(a.toString(),t.decimals)}}async function Pe(e,o){let n=await O(e),s=await c.getBlockNumber();return{wallet:o,...await be(n,o,s),blockNumber:s.toString(),coverage:Q}}async function He(e,o){let n=he(e.launchTx),s=await c.getTransactionReceipt({hash:n}),t=re(s);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===P(e.positionId,"positionId").toString())),!t.length)throw new r("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let a=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let m=i.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,b=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a});if(!p(b,m))throw new r("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a}),approved:await c.readContract({address:B,abi:h,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:a}),collected:await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:a})}:void 0,f=await oe(i.token,a);return{...i,token:f,custodian:b,holding:await be(i,o,a,f),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:me,amount:u.collected[0].toString()},{token:f,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:n,wallet:o,creator:s.from,blockNumber:a.toString(),launches:d,coverage:Q}}async function Re(e){let o=await c.getBlockNumber(),n=e.limit??20;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>50)throw new r("limit must be an integer from 1 to 50.");let s=e.fromBlock===void 0?o>=D+pe?o-pe+1n:D:P(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?o:P(e.toBlock,"toBlock",!0),a=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new r("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),f=BigInt(u[0]),y=BigInt(u[1]);if(e.fromBlock!==void 0&&s!==f||e.toBlock!==void 0&&t!==y)throw new r("The cursor does not match this block range.");s=f,t=y,a=Number(u[2])}if(o<D&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:D.toString(),toBlock:o.toString(),coverage:Q,predeployment:!0};if(s<D||t<s||t>o||t-s>=pe)throw new r("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:V,event:K[0],fromBlock:s,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new r("The launch feed returned an incomplete log.");if(d.sort((u,f)=>u.blockNumber===f.blockNumber?f.logIndex-u.logIndex:u.blockNumber>f.blockNumber?-1:1),a>d.length)throw new r("The browse cursor is outside the launch feed.");let i=new Map,m=[];for(let u of d.slice(a,a+n)){let f=u.transactionHash,y=i.get(f);y||(y=await c.getTransactionReceipt({hash:f}),i.set(f,y));let v=ce({abi:K,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,$=re(y).filter(T=>p(T.token,v.token)&&p(T.poolId,v.poolId));if($.length!==1)throw new r("The launch feed log does not match one verified receipt launch.");m.push({...$[0],launchTx:f,blockNumber:u.blockNumber.toString(),token:await oe($[0].token,t),creator:y.from})}let b=a+n;return{launches:m,cursor:b<d.length?`${s}:${t}:${b}`:null,fromBlock:s.toString(),toBlock:t.toString(),coverage:Q,previousToBlock:s>D?(s-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ye(e,o,n){let s=await O(e);if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let t=BigInt(s.positionId),a=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(a,g.feeSplitterFeesOn.address))throw new r("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,o))throw new r("Only the current fee NFT holder can change this entitlement.");let i=S(n?e.to:e.spender);if(p(i,B)||n&&p(i,F))throw new r("The fee NFT recipient cannot be the vault or zero address.");let m=n?C({abi:h,functionName:"safeTransferFrom",args:[o,i,t]}):C({abi:h,functionName:"approve",args:[i,t]});return x([k(B,m,0n,n?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],o,n?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function De(){return{chainId:A,instant:{supported:!0,supply:ie.toString(),decimals:18,currency:me,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:Q}}let w=e=>({type:"string",description:e}),I=e=>ve(e),se="Launched token contract address (0x + 40 hex digits).",z="Transaction hash (0x + 64 hex digits) of the token launch; lets the tool find the launch without scanning. Optional where the token or position is given.",W='Liquidity position NFT id for the launch, as a decimal string. Example: "1".',ke={chainId:{type:"integer",const:A,description:"Chain id; only 4663 (Robinhood Chain mainnet) is accepted. Optional."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage tolerance in basis points (50 = 0.5%) used to derive minimum outputs when none is given. Optional."}};function N(e,o,n,s){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...ke,...o},required:n},execute:async(t,a)=>{try{let d=new Set([...Object.keys(ke),...Object.keys(o)]);if(Object.keys(t).some(i=>!d.has(i)))throw new r("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==A)throw new r("pools.trade requires chain 4663.");if(S(a),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new r("Slippage must be an integer in basis points.");le("10000",t.slippageBps)}return await G(),await s(t,a)}catch(d){H(d)}}}}return{tools:[N("launch",{name:w("Token name, shown in wallets and explorers."),symbol:w("Token ticker symbol."),creatorFees:{type:"boolean",description:"Permanent choice; must be explicit. true enables creator fees paid to feeBeneficiary from buys; false disables them forever."},feeBeneficiary:w("Address that receives creator fees; must not be the zero address or the launcher."),pair:w("Optional pair currency; only native ETH is supported (the zero address or the native ETH sentinel)."),decimals:{type:"integer",const:18,description:"Token decimals; must be 18 for an Instant Launch."},supply:I("Total token supply in base units (18 decimals); must be 1000000000000000000000000000 = one billion tokens."),initialBuy:I('ETH to spend on an initial buy in the same transaction, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.'),minAmountOut:I('Least new tokens to receive from the initial buy, in token base units (18 decimals). Requires initialBuy. Example: "1000000000000000000" = 1 token.'),description:w("Optional token description stored in token metadata."),website:w("Optional website URL stored in token metadata."),imageUri:w("Optional image URI stored in token metadata.")},["name","symbol","creatorFees","feeBeneficiary"],Ee),...["buy","sell"].map(e=>N(e,{token:w(se),amountIn:I(e==="buy"?'ETH to spend, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.':'Tokens to sell, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),minAmountOut:I(e==="buy"?'Least tokens to receive, in token base units (18 decimals). Example: "1000000000000000000" = 1 token. Defaults from slippageBps.':'Least ETH to receive, in wei base units (18 decimals). Example: "1000000000000000" = 0.001 ETH. Defaults from slippageBps.'),launchTx:w(z)},["token","amountIn"],(o,n)=>Fe(o,n,e==="buy"))),N("collect",{positionId:I(W),launchTx:w(z)},["positionId"],(e,o)=>we(e,o,!1)),N("claim",{positionId:I(W),launchTx:w(z),minEth:I('Least ETH you must receive from the claim, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.')},["positionId"],(e,o)=>we(e,o,!0)),N("browse",{fromBlock:I("First block number of the scan range, as a decimal string. Defaults to the most recent 100000 blocks."),toBlock:I("Last block number of the scan range, as a decimal string. Defaults to the latest block."),limit:{type:"integer",minimum:1,maximum:50,description:"Launches per page, 1 to 50 (default 20)."},cursor:w("Opaque pagination cursor exactly as returned by the previous browse call.")},[],Re),N("balance",{token:w(se),launchTx:w(z)},["token"],Pe),N("status",{launchTx:w("Transaction hash (0x + 64 hex digits) of the token launch to inspect."),token:w(se),positionId:I(W)},["launchTx"],He),N("launch_options",{},[],De),N("fee_transfer",{positionId:I(W),launchTx:w(z),to:w("Address that will become the new holder of the fee NFT and its future creator fees. Use the intended address.")},["positionId","to"],(e,o)=>ye(e,o,!0)),N("fee_approve",{positionId:I(W),launchTx:w(z),spender:w("Address approved to move the fee NFT. Use the intended address.")},["positionId","spender"],(e,o)=>ye(e,o,!1)),N("transfer",{token:w(se),amount:I('Tokens to send, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),to:w("Recipient address of the tokens; must not be the zero address. Use the intended address."),launchTx:w(z)},["token","amount","to"],Le),N("collect_many",{positionIds:{type:"array",items:I(W),minItems:1,maxItems:20,description:"Position NFT ids to collect fees for, decimal strings; same order as launchTxs."},launchTxs:{type:"array",items:w("Launch transaction hash (0x + 64 hex digits) matching the position id at the same index."),minItems:1,maxItems:20,description:"Launch transaction hashes, one per position id, in the same order."}},["positionIds","launchTxs"],Oe)],positions:async(e,o)=>{S(e);let n=[],s=0,t=!0,a=o?.deepScan?2e4:6e3,d=o?.signal,i,m,b=f=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:A,assets:[],incomplete:!0,description:`${f} Checked ${s} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),u=async()=>{await G(),t&&await L(e,void 0,async f=>{s++;for(let y of re(f)){if(!t)return;let v=y.creatorFees&&p(await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(y.positionId)]}),e);if(!t)return;if(!v&&!p(f.from,e))continue;let $=v?[{token:me,amount:(await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(y.positionId)]}))[0].toString()}]:[];t&&n.push({module:"poolstrade",id:y.positionId,chainId:A,assets:$,description:`Current Instant Launch ${y.token} (18 decimals, supply 1000000000), pool ${y.poolId}; creator fees ${y.creatorFees?"on":"off"} (permanent). ${v?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>t)};try{if(d?.aborted)return[b("Pools.trade discovery was cancelled; the historical scan is incomplete.")];let f=new Promise(v=>{i=()=>{t=!1,v("aborted")},d?.addEventListener("abort",i,{once:!0}),m=setTimeout(()=>{t=!1,v("budget")},a)}),y=await Promise.race([u().then(()=>"complete"),f]);return y==="complete"?n:[...n,b(y==="aborted"?"Pools.trade discovery was cancelled; the historical scan is incomplete.":`Pools.trade global launch discovery reached its ${a} ms read budget; the historical scan is incomplete.`)]}catch(f){return[...n,b(`Pools.trade discovery could not finish: ${l.plainError(f)}`)]}finally{t=!1,m!==void 0&&clearTimeout(m),i&&d?.removeEventListener("abort",i)}}}};function Ye(l){return Ne("poolstrade",[qe(l)])}export{re as a,qe as b,Ye as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as l,e as N,f as T}from"./7D73A6KS.js";import{a as D}from"./JKD2B6OX.js";import{a as w,c as o,d as u,e as y,g as b}from"./2MZXTOZU.js";import{a as U}from"./43LI5NKJ.js";import{b as A}from"./66F5ZH34.js";import{h as S,n as x}from"./NWNYJ26T.js";import{a as p}from"./FWD4L3CJ.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as G}from"viem";function $(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new n("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new n("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=$(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new n("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new n("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new n("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:o,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new n("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new n("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new n("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(o,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new n("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new n("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),L=t?G({abi:b,functionName:"withdraw",args:[o.address,m==="max"?y:a,d]}):G({abi:b,functionName:"supply",args:[o.address,a,d,0]}),B=[...t?[]:[e.approval(o.address,w,a.toString(),p)],e.unsignedTx({to:w,data:L,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,o)<a:k(h,o)!==-a||k(h,u)<a-1n)throw new n("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(o,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new n(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A('Positive USDG amount in base units (6 decimals): "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'USDG amount in base units (6 decimals): "1000000" = 1 USDG; max withdraws the full balance.'}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as R}from"./JS53DQVT.js";import{a as N,f as L,g as v}from"./J73ATSEQ.js";import{I as H,K as j,L as O,b as p,d as l,z as D}from"./BAIY32AV.js";import{g as d}from"./NWNYJ26T.js";import{a as x}from"./FWD4L3CJ.js";import{a as e}from"./XSD5NL7J.js";import{decodeAbiParameters as J,decodeFunctionData as b,encodeAbiParameters as K,encodeFunctionData as Q,erc20Abi as W,getAddress as Y,parseAbi as Z,parseAbiParameters as ee}from"viem";var U=Z(["function modifyLiquidities(bytes unlockData,uint256 deadline) payable"]),V=ee("bytes actions,bytes[] params");function de(f,$){return{tools:[{name:"uniswap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["operations"],properties:{operations:{description:"One to twenty v4 liquidity operations to execute atomically; each must use a distinct position NFT.",type:"array",minItems:1,maxItems:20,items:{type:"object",additionalProperties:!1,required:["name","arguments"],properties:{name:{description:'Choose "uniswap_add" to add liquidity, "uniswap_collect" to collect fees or "uniswap_remove" to remove liquidity.',type:"string",enum:["uniswap_add","uniswap_collect","uniswap_remove"]},arguments:{description:"Arguments for the selected v4 add, collect or remove operation; explicitly select version v4.",anyOf:[H,j,O]}}}}}},async execute(a,A){if(v(a,["operations"]),!Array.isArray(a.operations)||a.operations.length<1||a.operations.length>20)throw new e("Provide 1 to 20 v4 liquidity operations.");let s="0x",c,h=[],P=0n,w=new Map,_=new Set,E=new Set;for(let t of a.operations){if(!t||typeof t!="object"||Array.isArray(t))throw new e("Each operation needs name and arguments.");let n=t;if(v(n,["name","arguments"]),!["uniswap_add","uniswap_collect","uniswap_remove"].includes(String(n.name))||!n.arguments||typeof n.arguments!="object"||Array.isArray(n.arguments))throw new e("Batch supports v4 add, collect and remove operations only.");let r=n.arguments;if(r.version!=="v4")throw new e("Every batch operation must explicitly select version v4.");if(r.initialPrice!==void 0||r.sqrtPriceX96!==void 0)throw new e("Create a pool before batching its liquidity operations.");if(r.tokenId!==void 0){let o=N(r.tokenId,"tokenId").toString();if(E.has(o))throw new e("Batch tokenIds must be distinct decimal strings.");E.add(o)}else if(n.name!=="uniswap_add")throw new e("Existing-position operations require tokenId.");let I=await $.tools.find(o=>o.name===n.name).execute(r,A),u=I.txs.at(-1);if(!u||!d(u.to,p))throw new e("Batch operation returned an unexpected destination.");P+=BigInt(u.value);for(let o of I.txs.slice(0,-1)){if(BigInt(o.value)!==0n)throw new e("Batch prerequisite cannot send native currency.");if(d(o.to,l)){let i=b({abi:R,data:o.data}),[M,G,X,z]=i.args;if(!d(G,p))throw new e("Batch Permit2 spender must be PositionManager.");let T=M.toLowerCase(),m=w.get(T),B=BigInt(z),C=(m?.amount??0n)+X;if(C>=1n<<160n)throw new e("Batch approval exceeds uint160.");w.set(T,{token:M,amount:C,expiration:m&&m.expiration<B?m.expiration:B})}else{let i=b({abi:W,data:o.data});if(i.functionName!=="approve"||!d(i.args[0],l))throw new e("Unexpected batch prerequisite.")}}let S=b({abi:U,data:u.data}),[F,y]=J(V,S.args[0]),k=F.slice(2).match(/../g)??[];if(k.length!==y.length)throw new e("Batch action/parameter count differs.");k.forEach((o,i)=>{o==="14"?_.add(y[i]):(s=`${s}${o}`,h.push(y[i]))});let q=S.args[1];c=c===void 0||q<c?q:c}for(let t of _)s=`${s}14`,h.push(t);let g=[];for(let t of w.values())g.push(f.approval(Y(t.token),l,t.amount.toString(),x),D(t.token,p,t.amount.toString(),t.expiration.toString()));return g.push(f.unsignedTx({to:p,data:Q({abi:U,functionName:"modifyLiquidities",args:[K(V,[s,h]),c]}),value:P.toString(),chainId:x,description:`Atomically modify ${a.operations.length} v4 positions; recipients are the signing wallet.`})),L(f,g,A,"Atomic v4 batch: every operation must succeed. Each position retains its own minimums; preview covers the complete action stream.")}}]}}export{U as a,V as b,de as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as C,b as O}from"./ARI72OYT.js";import{a as y,c as w}from"./SPRVVJXI.js";import{a as f,b as k}from"./TM7Z5SA4.js";import{d as i}from"./XV6F3RET.js";import{a as d}from"./FWD4L3CJ.js";import{a}from"./XSD5NL7J.js";var x=r=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(i),description:"Card program to read: turbo (card collection), blackjack or feed."},method:{type:"string",description:"Exact read-only ABI signature from the catalog. Omit to list all available reads."},values:{type:"array",maxItems:16,description:"Ordered inputs for the chosen method: decimal strings for integers, 0x addresses or hex bytes, booleans, or arrays/tuples of them."}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(i,t.program))throw new a("Choose turbo, blackjack or feed.");let o=i[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new a("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let n=u.find(e=>f(e)===t.method),m=t.values??[];if(!n||!Array.isArray(m)||m.length!==n.inputs.length)throw new a("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let l=r.clientFor(d);if(await l.getChainId()!==d)throw new a("NetNet cards require chain 4663.");let p=await l.getBlock(),c=n.inputs.map((e,s)=>k(e,m[s])),E=await l.readContract({address:o.address,abi:[n],functionName:n.name,args:c,blockNumber:p.number}),g=t.program==="turbo"&&n.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(n.name)?[c[0]]:n.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(g.length){let e=await l.readContract({address:i.turbo.address,abi:i.turbo.abi,functionName:"seriesCount",blockNumber:p.number});b=[...new Set(g)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:i.turbo.address,contract:o.address,blockNumber:String(p.number),blockHash:p.hash,method:t.method,outputs:n.outputs,...b?{seriesStatus:b}:{},data:h(E)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new a("Card capabilities takes no arguments.");return{chainId:d,collection:i.turbo.address,blackjack:i.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...y],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(r,t=0){if(t>12)throw new a("Card read result exceeds the supported nesting.");if(typeof r=="bigint")return r.toString();if(typeof r=="string"){if(r.length>8194)throw new a("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(r)?r:`untrusted ${JSON.stringify(r)}`}if(Array.isArray(r)){if(r.length>4096)throw new a("Choose a bounded card read.");return r.map(o=>h(o,t+1))}return r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,u])=>[o,h(u,t+1)])):r}export{x as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as bt}from"./EGZREEG2.js";import{b as ft}from"./N4XNNXOJ.js";import{b as wt}from"./FNGIJKMZ.js";import{c as mt}from"./2SUHQWND.js";import{b as ht}from"./QFSBDPLN.js";import{b as gt}from"./TE6D3OIX.js";import{c as pt}from"./Q2ACLVWR.js";import{h as ut}from"./JESMX2UC.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"./WLMWWEP7.js";import{i as rt}from"./2GXHYI23.js";import{b as ot,o as it}from"./CAWTAR5V.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{a as $,d as N,i as ce}from"./FWD4L3CJ.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
|
+
var t=Object.freeze({recipient:"0x856bb126188bDB5e425D3ac9D59E9ffBD12e6ECf",bps:25});function i(n){return(BigInt(n)*BigInt(t.bps)/10000n).toString()}var s=BigInt(t.recipient)<<96n|1n<<92n|BigInt(t.bps);function r(n){if(!n)return"Oak fee 0.25% (USD estimate unavailable).";let e=(BigInt(n.amount)*BigInt(n.usdE18)*100n+10n**BigInt(n.decimals)*5n*10n**17n)/(10n**BigInt(n.decimals)*10n**18n);return`Oak fee 0.25% (\u2248 $${e/100n}.${(e%100n).toString().padStart(2,"0")}).`}export{t as a,i as b,s as c,r as d};
|