@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{a as l,c as w}from"./
|
|
1
|
+
import{a as l,c as w}from"./SCG5HWMN.js";import{e as d}from"./NWNYJ26T.js";import{a as h}from"./5HCXZWUH.js";import{a as p}from"./XSD5NL7J.js";var m=new WeakMap;async function x(o,r,s){let n=new URL(r);if(!(n.origin==="https://aggregator-api.kyberswap.com"&&n.pathname==="/robinhood/api/v1/routes")&&!(n.origin==="https://api.velora.xyz"&&n.pathname==="/prices"))throw new Error("Only supported public price routes may be shared.");let e=m.get(o);e||(e=new h(3e3),m.set(o,e));let i=await e.read(r,()=>w(o,r,{method:"GET"},s));return{value:i.value,expiresAt:Math.floor(i.started/1e3)+60}}var y="No route through verified sources.",g=new WeakMap;function E(o){let r=g.get(o);return r||(r=async(s,n)=>{let e=new URL(s instanceof Request?s.url:String(s)),i=["aggregator-api.kyberswap.com","api.kyberswap.com"].includes(e.hostname)&&e.pathname.endsWith("/robinhood/api/v1/routes"),u=e.origin==="https://api.velora.xyz"&&e.pathname==="/prices",f=async a=>{if(!(i||u)||![200,400,404].includes(a.status))return!1;let t=await a.clone().json().catch(()=>{});return d(t)?i&&(t.code===4008&&t.message==="route not found"||t.code===40011&&t.message==="filtered liquidity sources")||u&&typeof t.error=="string"&&/^(No routes found|No liquidity|No price route found)/i.test(t.error):!1},c;try{c=await o(s,n)}catch(a){throw a instanceof l&&await f(a.response)?new p(y):a}if(await f(c))throw new p(y);return c},g.set(o,r)),r}export{x as a,y as b,E as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C}from"./
|
|
1
|
+
import{b as C}from"./WNWRF4HE.js";import{a as O,c as P,g as B}from"./GQ3XZFRL.js";import{b as h,e as r,g as F}from"./NWNYJ26T.js";import{a as g}from"./FWD4L3CJ.js";import{a as y}from"./XSD5NL7J.js";import{a as E,b as x}from"./JXOEJPJ4.js";import{getAddress as T}from"viem";var q=["pons_status","pons_holders","pons_launch_info"],v=["getPartnerScanCard","getProjectSnapshot"],V=/^[a-z0-9][a-z0-9-]{0,79}$/,$=/^[0-9]{1,78}$/,K=/\b(?:unsafe|safe|safety|risks?|risky|recommend\w*|buy\w*|sell\w*)\b/i,z="https://heyresearch.xyz",D=["curve","pending pool creation","graduated","rescued"],G="This describes the project, not this token. HEY Research Lab does not tie this token to that activity.",X="Buyback-vault vesting only. It is not proof of vesting for any other address and not a liquidity lock. Unread figures say not read.",Z="An empty or missing source proves nothing; unread figures say not read, never zero. Address counts are Pons index figures, not on-chain counts; addresses are not people.",M=/rank|scor|trend|market|lock|sell|rating|price|signal|verdict|safe/i,c=(n,e)=>typeof n=="string"&&n.length>0&&n.length<=e&&!x(n)?n:null,k=n=>typeof n=="string"&&$.test(n)?n:null,Q=n=>typeof n=="number"&&Number.isSafeInteger(n)&&n>=0?n:null,L=n=>typeof n=="number"&&Number.isSafeInteger(n)?n:null,m=n=>typeof n=="string"&&h.test(n)?T(n):null,w=n=>(r(n)?k(n.amount):null)??"not read",d=n=>k(n)??"not read",R=n=>Q(n)??"not read",J=n=>L(n)??"not read";function W(n){if(typeof n!="string"||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/.test(n))return null;let e=Date.parse(n);return Number.isFinite(e)&&new Date(e).toISOString().slice(0,19)===n.slice(0,19)&&e<=Date.now()+3e5?n:null}function nn(n,e){if(typeof n!="string"||n.length>2048||/[\s<>\\]/.test(n)||x(n))return null;try{let t=new URL(n);return t.origin===z&&!t.username&&!t.password&&t.pathname===`/project/${e}`?n:null}catch{return null}}function tn(n){return typeof n!="string"?null:/^untrusted "(?:[^"\\]|\\.)*"$/.test(n)?n:E(n)}function en(n){return n instanceof Error&&/supported Pons factory/i.test(n.message)}function N(n,e){if(!r(n)||n.chainId!==g||typeof n.address!="string"||!h.test(n.address)||!F(n.address,e))return null;let t=n.decimals,s=tn(n.symbol);return typeof t!="number"||!Number.isInteger(t)||t<0||t>255||!s?null:{address:T(e),chainId:g,symbol:s,decimals:t}}function _(n){if(!r(n)||!r(n.token))return null;let e=m(n.token.address);return e?N(n.token,e):null}function sn(n,e){if(!r(n))return;let t=N(n.token,e),s=k(n.blockNumber),o=L(n.phase);if(!t||!s||o===null||o<0||o>3||n.phaseName!==D[o])return;let a=n.pool,l=r(a)&&typeof a.id=="string"&&/^0x[0-9a-fA-F]{1,64}$/.test(a.id)?a.id:null,i=r(a)?k(a.liquidity):null,p=r(a)&&l&&i?{id:l,liquidity:i,sqrtPriceX96:d(a.sqrtPriceX96),tick:J(a.tick),lpFee:R(a.lpFee),protocolFee:R(a.protocolFee)}:null;return{token:t,block:s,launch:{phase:o,phaseName:D[o],curve:m(n.curve),creatorFeeRecipient:m(n.creatorFeeRecipient),progressPpm:d(n.progressPpm),graduationThreshold:w(n.graduationThreshold),raised:w(n.raised),totalSupply:w(n.totalSupply),amountUnits:{graduationThreshold:_(n.graduationThreshold),raised:_(n.raised),totalSupply:_(n.totalSupply)},pool:p}}}function on(n,e){if(!r(n))return;let t=N(n.token,e),s=k(n.statusBlock);if(!t||!s)return;let o=r(n.sources)?n.sources:{},a=(Array.isArray(n.exclusions)?n.exclusions.slice(0,10):[]).flatMap(i=>{let p=r(i)?c(i.reason,120):null;return r(i)&&p?[{reason:p,indexedBalance:d(i.indexedBalance),countedInIndex:typeof i.countedInIndex=="boolean"?i.countedInIndex:null}]:[]}),l=r(n.indexAsOf)?n.indexAsOf:null;return{token:t,addresses:{statusBlock:s,addressCountKind:"indexed",addressCount:R(n.holderCount),indexAddressCount:R(n.indexHolderCount),totalSupply:d(n.totalSupply),indexSupply:d(n.indexSupply),burned:d(n.burned),circulating:d(n.circulating),amountUnits:{totalSupply:t,indexSupply:t,burned:t,circulating:t,indexedBalance:t},exclusions:a,indexAsOf:l?{rollupBucket:c(l.rollupBucket,40),tailFromBlock:d(l.tailFromBlock)}:null,sources:{addressCount:c(o.holderCount,300)??"Pons balances index (an indexed figure, not an on-chain count)",totalSupply:c(o.totalSupply,300),burned:c(o.burned,300),circulating:c(o.circulating,300)}}}}function rn(n,e){if(!r(n)||!r(n.buybackVest))return;let t=N(n.token,e),s=k(n.statusBlock);if(!t||!s)return;let o=n.buybackVest,a={locked:d(o.locked),released:d(o.released),vested:d(o.vested),releasable:d(o.releasable),vestingStart:d(o.vestingStart),vestingDurationSeconds:d(o.vestingDurationSeconds)};return{token:t,vest:{statusBlock:s,vault:m(o.vault),enabled:typeof o.enabled=="boolean"?o.enabled:null,...a,amountUnits:{locked:t,released:t,vested:t,releasable:t},unknownFields:Object.entries(a).filter(([,l])=>l==="not read").map(([l])=>l),scope:X,source:`On-chain reads of the Pons buyback vault at block ${s}.`}}}async function I(n,e,t,s){if(!q.includes(e))throw new y("Unsupported Pons read.");try{let o=s(await n(e,{token:t}),t);return o===void 0?{state:"unavailable",value:null}:{state:"available",value:o}}catch(o){return{state:en(o)?"unsupported-origin":"unavailable",value:null}}}async function H(n,e,t){if(!v.includes(e))throw new y("Unsupported HEY read.");try{let s=await n("heyresearch_read",{operation:e,parameters:t,detail:"full"});return r(s)&&s.operation===e&&r(s.data)?s.data:null}catch{return null}}function an(n){let e={};if(!r(n))return e;for(let[t,s]of Object.entries(n).slice(0,40))!/^[A-Za-z][A-Za-z0-9_]{0,39}$/.test(t)||M.test(t)||(s===null?e[t]="not read":(typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)||c(s,300)!==null&&!K.test(s))&&(e[t]=s));return e}function ln(n,e){let t=n?W(n.asOf):null;if(!n||!t)return null;let s=r(n.links)?n.links:{};return{asOf:t,page:nn(s.page,e),disclaimer:c(n.disclaimer,1e3),build:an(n.build),textIsData:!0}}async function bn(n,e){if(typeof n!="string"||!h.test(n)||/^0x(?:0{40}|e{40})$/i.test(n))throw new y("Provide a full token contract address on Robinhood Chain 4663.");let t=T(n),[s,o,a,l]=await Promise.all([H(e,"getPartnerScanCard",{chain:g,token:t}),I(e,"pons_status",t,sn),I(e,"pons_holders",t,on),I(e,"pons_launch_info",t,rn)]),i=s?C(s.found===!1&&s.contractAddress===void 0?{...s,contractAddress:t}:s,g,t):void 0,p=i?i.found?"available":"not-indexed":"unavailable",f=i?.found&&r(s?.project)?s.project:null,b=f&&typeof f.slug=="string"&&V.test(f.slug)?f.slug:null,U="not-read",S=null;b&&(S=ln(await H(e,"getProjectSnapshot",{slug:b}),b),U=S?"available":"unavailable");let u=i?.found?i:null,A=u?u.activity_applies_to_token&&u.token_verification==="VERIFIED"?"token":"project-only":null,j=u?.activity.last_ship&&u.activity.last_ship_url?{date:u.activity.last_ship,url:u.activity.last_ship_url,sourceHost:new URL(u.activity.last_ship_url).hostname}:null,Y=o.value?.token??a.value?.token??l.value?.token??null;return{chainId:g,token:t,checkedAt:new Date().toISOString(),hey:{provider:"HEY Research Lab",statusNote:"show exactly",status:u?B(u.status_label,u.status_help):i?.found===!1?P:"HEY Research Lab context unavailable",tie:A,qualification:A==="project-only"?G:null,tieLabel:A==="token"?O:null,verifiedBuilder:u?.verified_builder??null,projectSlug:b,projectLink:u?.project_link??null,asOf:u?.as_of??null,lastShip:j,snapshot:S},oak:{token:Y,statusBlock:o.value?.block??"not read",launch:o.value?.launch??null,addresses:a.value?.addresses??null,buybackVest:l.value?.vest??null},coverage:{hey:{scan:p,snapshot:U},oak:{status:o.state,addresses:a.state,launchInfo:l.state},note:Z}}}export{on as a,bn as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./I6PQW2JI.js";import{a as M}from"./K6D6SDIG.js";import{g as h,i as z,l as N,m as _,n as D}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{isHex as ce,keccak256 as pe}from"viem";var l=e=>N(z(e,"Provide a valid Chop address."),"Provide a nonzero Chop address."),P=e=>_(e,"Chop returned an invalid integer."),ye=e=>D(e,"Provide a positive Chop base-unit integer string within uint256.",{positive:!0});function he(e){if(typeof e!="string"||!ce(e,{strict:!0})||e.length<4||e.length%2)throw new i("Chop contract code is unavailable.");return pe(e)}function u(e){if(e?.aborted)throw new i("Chop read was cancelled.")}var B=(e,t,r,o,n,a,s)=>(u(s),e.readContract({address:t,abi:M,functionName:r,args:o,blockNumber:n,...a?{account:a}:{}}));async function L(e,t,r,o){u(o);let n=await e.multicall({allowFailure:!1,batchSize:0,blockNumber:r,contracts:t.map(a=>({address:a.target,abi:M,functionName:a.fn,args:a.args??[]}))});if(!Array.isArray(n)||n.length!==t.length)throw new i("Chop returned incomplete reads.");return n}async function le(e,t){if(u(t),await e.getChainId()!==d.chainId)throw new i("Chop requires chain 4663.");return u(t),P(await e.getBlockNumber({cacheTime:0}))}function b(e){if(!e||typeof e!="object"||Array.isArray(e))throw new i("Chop returned invalid log metadata.");return e}function R(e){if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255)throw new i("Chop token decimals are invalid.");return e}function O(e){return typeof e=="string"&&/^[A-Za-z0-9.$_-]{1,32}$/.test(e)?e:"token"}var be=()=>new WeakMap;function j(e,t){if(!t)return;let r=t.get(e);return r||(r={code:new Map,implementations:new Map},t.set(e,r)),r}var q=(e,t)=>`${e.toLowerCase()}:${t}`;function F(e,t,r){let o=e?.get(t);if(o)return o;let n=r();return e?.set(t,n),n}async function W(e,t,r,o,n){u(o);let a=await F(j(e,n)?.code,q(t,r),async()=>he(await e.getCode({address:t,blockNumber:r})));return u(o),a}async function E(e,t,r,o,n){if(!h(await W(e,t.address,r,o,n),t.codeHash))throw new i("Chop trust-anchor code changed.")}async function V(e,t,r,o,n,a,s,c){await Promise.all([E(e,o,a,s,c),E(e,{address:t,codeHash:r},a,s,c)]),u(s);let A=await F(j(e,c)?.implementations,q(o.address,a),async()=>l(await B(e,o.address,"implementation",[],a,void 0,s))),x=await W(e,A,a,s,c);return{address:A,codeHash:x,changed:!h(x,n)}}function ge(e,t){let r=b(e);if(!h(l(r.index),t)||r.verified!==!0)throw new i("This is not a verified Chop registry log.")}async function Ae(e,t,r,o,n,a){u(n);let s=l(t),c=o??await le(e,n);await E(e,d.registry,c,n,a);let A=await B(e,d.registry.address,"getIndex",[s],c,void 0,n);if(ge(A,s),r==="enter"){if(b(A).makePublic!==!0)throw new i("This verified Chop log is not public for new deposits.");await B(e,d.registry.address,"validateIndex",[s],c,void 0,n)}let[x,T]=await Promise.all([L(e,["getAllAssets","PAIRED_LP_TOKEN","lpStakingPool","lpRewardsToken","v2Pool","fees","decimals","symbol","totalSupply","config"].map(p=>({target:s,fn:p})),c,n),V(e,s,d.proxy.codeHash,d.beacon,d.implementation.codeHash,c,n,a)]),[v,X,Z,G,J,Q,Y,ee,ne,te]=x;if(!Array.isArray(v)||v.length!==1||P(b(v[0]).weighting)!==10n**18n)throw new i("Only verified single-token Chop logs are supported.");let g=l(b(v[0]).token),w=l(X),m=l(Z),C=l(J);if(!h(l(G),d.chop)||[s,g,w,m,C].some(p=>h(p,d.dormantOak))||new Set([s,g,w,m,C].map(p=>p.toLowerCase())).size!==5)throw new i("Chop log token identities do not match the supported setup.");let oe=b(Q),re=Object.fromEntries(["burn","bond","debond","buy","sell","partner"].map(p=>{let f=oe[p];if(typeof f!="number"||!Number.isInteger(f)||f<0||f>1e4)throw new i("Chop returned invalid fees.");return[p,f]})),K=b(te);if(K.hasTransferTax!==!1||K.blacklistTKNpTKNPoolV2!==!1)throw new i("Chop transfer-tax or blocked-pool logs are unsupported.");let k=await L(e,[{target:g,fn:"decimals"},{target:g,fn:"symbol"},{target:w,fn:"decimals"},{target:w,fn:"symbol"},{target:m,fn:"POOL_REWARDS"},{target:s,fn:"totalAssets",args:[g]}],c,n),y=l(k[4]);if([s,g,w,m,C].some(p=>h(p,y)))throw new i("Chop rewards identity is invalid.");let[ae,se,ie]=await Promise.all([L(e,[{target:m,fn:"INDEX_FUND"},{target:m,fn:"stakingToken"},{target:y,fn:"indexFund"},{target:y,fn:"trackingToken"},{target:y,fn:"rewardsToken"}],c,n),V(e,m,d.staking.codeHash,d.stakingBeacon,d.stakingImplementation.codeHash,c,n,a),V(e,y,d.rewards.codeHash,d.rewardsBeacon,d.rewardsImplementation.codeHash,c,n,a)]);if(ae.some((p,f)=>!h(l(p),[s,C,s,m,d.chop][f])))throw new i("Chop staking or rewards links do not match this log.");let H={address:g,decimals:R(k[0]),symbol:h(g,d.oak)?"OAK":O(k[1]),chainId:4663};if(H.symbol.replace(/^\$/,"").toUpperCase()==="OAK"&&!h(g,d.oak))throw new i("Chop underlying OAK is not the canonical Oak token.");let de={address:w,decimals:R(k[2]),symbol:O(k[3]),chainId:4663},U={address:s,decimals:R(Y),symbol:O(ee),chainId:4663},I=[T.changed?"log implementation":"",se.changed?"staking implementation":"",ie.changed?"rewards implementation":""].filter(Boolean);if(r==="enter"&&I.length)throw new i(`Chop implementation changed (${I.join(", ")}); wraps and farms are refused.`);let S=P(ne),$=P(k[5]);if(S===0n)throw new i("This Chop log has no issued supply.");return{log:U,underlying:H,paired:de,staking:{address:m,symbol:"Chop staked LP",decimals:18,chainId:4663},rewards:y,pool:C,fees:re,totalSupply:S.toString(),managedUnderlying:$.toString(),backingPerLog:{token:H,amount:($*10n**BigInt(U.decimals)/S).toString()},implementation:T.address,implementationHash:T.codeHash,drift:I,measuredAtBlock:c.toString()}}function Ce(e,t,r=!1){if(e.length!==t.length||e.some((o,n)=>!h(o.to,t[n].to)||o.data!==t[n].data||o.value!=="0"||o.chainId!==4663||o.gasLimit!==t[n].gasLimit&&!(r&&o.gasLimit===void 0)))throw new i("Chop transaction or exact approval does not match the requested action.")}function Pe(e,t){let r=new Map;for(let o of e.changes){let n=t.find(c=>h(c.token.address,o.token.address));if(!n||o.token.chainId!==4663||o.token.decimals!==n.token.decimals||typeof o.amount!="string"||!/^-?\d+$/.test(o.amount))throw new i("Chop preview showed an unexpected token movement.");let a=BigInt(o.amount);if(P(a<0n?-a:a),n.min>=0n&&a<0n||n.max!==void 0&&n.max<=0n&&a>0n)throw new i("Chop preview showed a reversed token movement.");let s=n.token.address.toLowerCase();r.set(s,(r.get(s)??0n)+a)}for(let o of t){let n=r.get(o.token.address.toLowerCase())??0n;if(n<o.min||o.max!==void 0&&n>o.max)throw new i("Chop preview receipt does not meet the quoted amount.")}return r}export{l as a,P as b,ye as c,he as d,u as e,B as f,L as g,le as h,be as i,E as j,ge as k,Ae as l,Ce as m,Pe as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getAddress as e}from"viem";var c={chainId:4663,blockNumber:107272178n,blockHash:"0x1a641b0acfca30a12686f032664231ed6c0b21b6eefd2c080585c5f797335e11",packCommit:"7faf3ad594ddd19ae8700b02f3efc9d9006eface",sourceCommit:"713df4eca1f41ef27434a7eb8edf484a4c7cdc83"},d={desk:{address:e("0x487Eb282E9Aa56aE871c15A16C5B061b9d2faA6F"),codeHash:"0x62f56fb1f0e0ebf6371132f36d3b8b134f6ac1913a27697cd064ee51ae90eafc"},burnPot:{address:e("0xff54EbC9c6871Fb1c5C9e03ac45250488d923F79"),codeHash:"0xb186b2d260e86cd1b200eaf2843bc61a00c42a650458ec7325278fd35ba3ab60"},gateway:{address:e("0xe4314Ba4DAe5f31582ec23812d5f40287f1eFdE0"),codeHash:"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"},line:{address:e("0xc9405ca62ed1e9a4a058f404e5c1c893f7ae67c4"),codeHash:"0x83926b11b8c0522bb06955b943bb2f9272edf6636495024cc21e6b396114b231"},lineAccountImplementation:{address:e("0x8f63D64ACafC6a3c956a9f3B0eFFbc438DB9a869"),codeHash:"0x7086ac2f1b2af935c98c6140d9fb3eebd24d5e5dd698cd9a9dba3328e6a7ace3"},accounts:{address:e("0x3417A303DcB62A84965a641f894ff5803502F8FA"),codeHash:"0x560df7e0b37e4551c4d3047a5c2284a22e6fb9eccd0fced5c5918fd111a265b2"},accountImplementation:{address:e("0x34a6b7A9885E57E28ec868d73652660d5e176358"),codeHash:"0xb957ce9c0530ebfe458eafb7b2cd4a00bb9572c4c922ecbd9466cdea924da133"}},b={BPS:10000n,ADVANCE_MAX_BPS:5000n,ADVANCE_FEE_BPS:100n,JOB_FEE_BPS:200n,REJECTED_BPS:5000n,POOL_OUT_MAX_BPS:8000n,MIN_JOB:1000000000000000n,MIN_DUE:3600n,MAX_DUE:2592000n,GRACE:43200n,REVIEW:86400n,CUSTOMER_FEES_MIN:1000000000000000n},f={"register()":"0x1aa3a008","draw(uint256,uint256,uint8)":"0xe895a7a7","deliver(uint256,bytes32)":"0xd9b42a7f","decline(uint256)":"0xa0355f4e","job(uint256)":"0x2329e48c","agent(address)":"0x92e423b5","canDrawOn(uint256)":"0xdf9343f0","owed(address)":"0xdf18e047","keyOf(address)":"0xfa073d76","burnPot()":"0xdd428d4d","gateway()":"0x116191b6"};export{c as a,d as b,b as c,f as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./43LI5NKJ.js";import{a as F}from"./66F5ZH34.js";import{g as D}from"./NWNYJ26T.js";import{b as U}from"./IX3GZMTM.js";import{a as c}from"./FWD4L3CJ.js";import{a as w}from"./XSD5NL7J.js";import{encodeFunctionData as A,getAddress as S,parseAbi as _}from"viem";var N={address:S("0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"),symbol:"NET",decimals:9,chainId:c},r={address:S("0xb773ec2C326B7f98a5a83fc098825492F020a4c7"),symbol:"sNET",decimals:9,chainId:c},u={address:S("0x63C12667638f2Ae6fC6ae09B43D98Ec84a8586eA"),symbol:"wsNET",decimals:18,chainId:c},i=S("0xB078cc304A0B264C5F3680DC0488954ACcd02E87"),k=S("0xA1ee052EC32532304a7522bd9A4b594eC28fF1b1"),tt=[i,u.address,k],p=_(["function net() view returns (address)","function sNet() view returns (address)","function warmupEpochs() view returns (uint256)","function epoch() view returns (uint64 length,uint64 number,uint64 end,uint256 distribute)","function warmup(address) view returns (uint256 gons,uint64 releaseEpoch)","function totalStaked() view returns (uint256)","function enabled() view returns (bool)","function claim(address to) returns (uint256)","function rebase()","function stake(address to, uint256 amount) returns (uint256)","function unstake(address to, uint256 amount) returns (uint256)"]),E=_(["function sNet() view returns (address)","function wrap(uint256 sNetAmount) returns (uint256)","function unwrap(uint256 wsAmount) returns (uint256)","function sNetToWs(uint256 sNetAmount) view returns (uint256)","function wsToSNet(uint256 wsAmount) view returns (uint256)"]),$=_(["function net() view returns (address)","function sNet() view returns (address)","function staking() view returns (address)","function wsNet() view returns (address)","function zap(uint256 netAmount) returns (uint256)"]),W=_(["function balanceOf(address owner) view returns (uint256)","function balanceForGons(uint256) view returns (uint256)"]),z="The expected output is a chain-read estimate; these calls encode no minimum output. No transaction was sent.",O=o=>({description:`${o.symbol} amount in base units (${o.symbol} has ${o.decimals} decimals; "${"1".padEnd(o.decimals+1,"0")}" = 1 ${o.symbol}), or "max" for the whole wallet balance.`,anyOf:[F(`Positive ${o.symbol} amount in integer base units (${o.decimals} decimals).`),{const:"max",description:`The fresh full ${o.symbol} wallet balance.`}]}),et=o=>{async function v(e){try{return await e()}catch(t){throw new w(o.plainError(t))}}function y(e,t){if(Object.keys(e).some(n=>!t.includes(n)))throw new w("Unsupported NetNet staking argument. Use the fields in the tool schema.")}async function f(e=!1){let t=o.clientFor(c);if(await t.getChainId()!==c)throw new w("NetNet staking requires chain 4663.");let n=[t.readContract({address:i,abi:p,functionName:"net"}),t.readContract({address:i,abi:p,functionName:"sNet"}),t.readContract({address:u.address,abi:E,functionName:"sNet"}),...e?[t.readContract({address:k,abi:$,functionName:"net"}),t.readContract({address:k,abi:$,functionName:"sNet"}),t.readContract({address:k,abi:$,functionName:"staking"}),t.readContract({address:k,abi:$,functionName:"wsNet"})]:[]],[s,a,d,...m]=await Promise.all(n),b=[N.address,r.address,r.address,...e?[N.address,r.address,i,u.address]:[]];if(![s,a,d,...m].every((T,q)=>typeof T=="string"&&D(T,b[q])))throw new w("NetNet staking contracts do not report the pinned NET, sNET and wsNET links.");return t}async function x(e,t){return o.clientFor(c).readContract({address:e.address,abi:W,functionName:"balanceOf",args:[t]})}async function C(e,t,n){let s=await x(t,n),a;if(e==="max")a=s;else{if(typeof e!="string")throw new w(`Provide an integer ${t.symbol} amount in base units, or "max".`);a=U(e)}if(a<=0n||a>=1n<<256n)throw new w(`This wallet has no ${t.symbol} to use; the amount must be positive.`);if(a>s)throw new w(`Insufficient ${t.symbol}: wallet holds ${s.toString()} base units, requested ${a.toString()}.`);return a}async function g(e,t,n,s){let a=await o.preview(e,t),d=a.changes.map(({token:m,amount:b})=>{let T=b.startsWith("-");return`${T?"-":"+"}${o.formatAmount(T?b.slice(1):b,m.decimals)} ${m.symbol}`}).join(", ");return{txs:e,preview:a,expectedOutput:n,summary:`${s} ${a.summary} ${d?`Estimated changes: ${d}. `:""}${z}`}}let h=(e,t,n)=>o.unsignedTx({to:e,data:t,value:"0",chainId:c,description:n});async function j(e,t){if(y(e,["amount","wrap"]),l(t),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new w("wrap must be a boolean.");let n=await f(e.wrap===!0);if(e.amount==="max")throw new w("Provide an exact NET amount in base units to stake.");let s=await n.readContract({address:i,abi:p,functionName:"warmupEpochs"});if(s!==0n&&e.wrap===!0)throw new w("NetNet warmup prevents immediate Zap wrapping; stake directly, then claim matured sNET before wrapping.");let a=await C(e.amount,N,t),d=o.formatAmount(a.toString(),N.decimals);if(e.wrap===!0){let m=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[a]});return g([o.approval(N.address,k,a.toString(),c),h(k,A({abi:$,functionName:"zap",args:[a]}),`Stake ${d} NET and wrap it into wsNET with NetNet's Zap.`)],t,{token:u,amount:m.toString()},`Approve exactly ${d} NET, then stake and wrap it into wsNET in one call.`)}return g([o.approval(N.address,i,a.toString(),c),h(i,A({abi:p,functionName:"stake",args:[S(t),a]}),`Stake ${d} NET into sNET.`)],t,{token:r,amount:s===0n?a.toString():"0"},s===0n?`Approve exactly ${d} NET, then stake it 1:1 into rebasing sNET.`:`Approve exactly ${d} NET and stake it into a ${s}-epoch warmup. No immediate sNET receipt; netnet_claim_stake releases matured sNET. Another stake resets your release epoch.`)}async function B(e,t){y(e,["amount"]),l(t),await f();let n=await C(e.amount,r,t),s=o.formatAmount(n.toString(),r.decimals);return g([o.approval(r.address,i,n.toString(),c),h(i,A({abi:p,functionName:"unstake",args:[S(t),n]}),`Unstake ${s} sNET into NET.`)],t,{token:N,amount:n.toString()},`Approve exactly ${s} sNET, then unstake it 1:1 into NET.`)}async function L(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,r,t),a=o.formatAmount(s.toString(),r.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"sNetToWs",args:[s]});return g([o.approval(r.address,u.address,s.toString(),c),h(u.address,A({abi:E,functionName:"wrap",args:[s]}),`Wrap ${a} sNET into wsNET.`)],t,{token:u,amount:d.toString()},`Approve exactly ${a} sNET, then wrap it into non-rebasing wsNET, the Loopback collateral.`)}async function G(e,t){y(e,["amount"]),l(t);let n=await f(),s=await C(e.amount,u,t),a=o.formatAmount(s.toString(),u.decimals),d=await n.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});return g([h(u.address,A({abi:E,functionName:"unwrap",args:[s]}),`Unwrap ${a} wsNET into sNET.`)],t,{token:r,amount:d.toString()},`Unwrap ${a} wsNET into sNET; no approval is needed.`)}async function M(e){return v(async()=>{l(e);let t=await f(),[n,s]=await Promise.all([x(r,e),x(u,e)]),a=[];if(n>0n&&a.push({module:"netnet",id:`${c}:${r.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:n.toString()}],description:`${o.formatAmount(n.toString(),r.decimals)} sNET staked NET (rebasing; unstakes 1:1 into NET with netnet_unstake).`}),s>0n){let m=await t.readContract({address:u.address,abi:E,functionName:"wsToSNet",args:[s]});a.push({module:"netnet",id:`${c}:${u.address.toLowerCase()}`,chainId:c,assets:[{token:{...N},amount:m.toString()}],description:`${o.formatAmount(s.toString(),u.decimals)} wsNET in the wallet, worth ${o.formatAmount(m.toString(),r.decimals)} sNET (NET 1:1) at the current index. wsNET posted as Morpho collateral appears under Morpho instead.`})}if(await t.readContract({address:i,abi:p,functionName:"warmupEpochs"})>0n){let m=await I({},e);BigInt(m.warmup.pendingSNet)>0n&&a.push({module:"netnet",id:`${c}:${i.toLowerCase()}:warmup`,chainId:c,assets:[{token:N,amount:m.warmup.pendingSNet}],description:`Pending NetNet warmup stake; releases sNET at epoch ${m.warmup.releaseEpoch}. Claim with netnet_claim_stake, then wrap or unstake.`})}return a})}async function I(e,t){y(e,[]),l(t);let n=await f(),[s,a,d,m,b]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.readContract({address:i,abi:p,functionName:"warmup",args:[t]}),n.readContract({address:i,abi:p,functionName:"warmupEpochs"}),n.readContract({address:i,abi:p,functionName:"totalStaked"}),n.readContract({address:i,abi:p,functionName:"enabled"})]),T=await n.readContract({address:r.address,abi:W,functionName:"balanceForGons",args:[a[0]]});return{chainId:c,staking:i,tokens:{net:N,sNet:r,wsNet:u},enabled:b,epoch:{length:s[0].toString(),number:s[1].toString(),end:s[2].toString(),distribute:s[3].toString()},warmupEpochs:d.toString(),totalStaked:m.toString(),warmup:{gons:a[0].toString(),releaseEpoch:a[1].toString(),pendingSNet:T.toString(),matured:a[0]>0n&&s[1]>=a[1]},caveat:"Warmup uses epoch numbers, not wall-clock time. Each rebase advances at most one due epoch; a claim also rebases once if due. A new stake resets the warmup release epoch."}}async function R(e,t){let n=await I(e,t);if(!n.enabled||!n.warmup.matured)throw new w("No matured NetNet warmup stake. Read netnet_staking_status and advance a due epoch before claiming.");return g([h(i,A({abi:p,functionName:"claim",args:[t]}),`Claim matured sNET to this wallet ${t}.`)],t,{token:r,amount:n.warmup.pendingSNet},"Claim matured NetNet staking warmup; rebase may change the sNET receipt.")}async function Z(e,t){y(e,[]),l(t);let n=await f(),[s,a,d]=await Promise.all([n.readContract({address:i,abi:p,functionName:"epoch"}),n.getBlock(),n.readContract({address:i,abi:p,functionName:"enabled"})]);if(!d||a.timestamp<s[2])throw new w("No enabled NetNet epoch is due to rebase.");return g([h(i,A({abi:p,functionName:"rebase"}),"Advance one due NetNet staking epoch and checkpoint its oracle.")],t,{token:r,amount:"0"},"Advance one due epoch. Distribution depends on live protocol state; this does not guarantee a reward.")}let P=(e,t,n)=>({name:e,inputSchema:{type:"object",properties:t,required:["amount"],additionalProperties:!1},execute:(s,a)=>v(()=>n(s,a))});return{positions:M,tools:[{name:"netnet_staking_status",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>I(e,t))},{name:"netnet_claim_stake",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>R(e,t))},{name:"netnet_rebase",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(e,t)=>v(()=>Z(e,t))},P("netnet_stake",{amount:F("Positive NET amount in integer base units (9 decimals)."),wrap:{type:"boolean",default:!1,description:"Stake and wrap into wsNET in one call through NetNet's Zap."}},j),P("netnet_wrap",{amount:O(r)},L),P("netnet_unwrap",{amount:O(u)},G),P("netnet_unstake",{amount:O(r)},B)]}};export{N as a,r as b,u as c,i as d,k as e,tt as f,et as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a={partner:"Factor is an official Oak partner. Factor's own team runs its product and contracts; Oak didn't build them and doesn't run them.",trust:"Factor's desk contract has no owner, and its rules are fixed in its code. Factor's website and API are run by Factor and can lag the chain.",fees:"An advance costs a 1% fee taken from the advance, paid to Factor's burn pot contract. A settled job pays Factor's 2% job fee from the agent's payout.",half:"At most half of a job's price can be advanced before delivery.",poolBar:"If a job you drew on isn't delivered within 12 hours after its due time, anyone can refund it, and this wallet can never draw from Factor's pool again.",decline:"You can decline a job only before drawing on it. A rejected job settles at half, with no appeal.",payLink:"A signed pay link can't be revoked; anyone holding it can pay it until it expires.",names:"Names are first come, and a fixed-price application can't be withdrawn.",privateWork:"Your work text stays on this computer; only its fingerprint (a hash) goes on chain.",publicWork:"Your work text will be public on Factor's job page and can't be edited.",walletCode:"This wallet has contract code, so Factor would hold its payouts until they are collected, which Oak can't do yet. Nothing was sent.",compute:"Oak doesn't send compute advances: that ETH goes to Factor's gateway as off-chain credit Oak can't check. Nothing was sent.",lineAccount:"This wallet uses a Factor credit line, which Oak doesn't support yet. Nothing was sent.",offers:"This Factor job takes offers, which Oak can't send yet. Nothing was signed.",deskOnly:"Desk figures only; jobs and limits held through a Factor credit line are not shown.",stateMismatch:"Factor's site names a different desk than the one Oak checked on chain. Nothing was signed or sent.",stateUnavailable:"Factor's site isn't answering, so Oak can't date this message. Nothing was signed.",apiLabel:"Factor API (can lag the chain)"},e={factor_sign_up:`Register this wallet as a Factor agent on Robinhood Chain, then sign its public profile with a name and description. Gas for registration; identity, active plan and human confirmation required. ${a.partner} ${a.trust} ${a.names}`,factor_create_pay_link:`Sign a pay link for a fixed-price ETH job on Robinhood Chain. Price is a wei string; expiry is 1-30 days. No payment now; a customer pays later. Identity, active plan and human confirmation required. ${a.payLink} ${a.half} ${a.fees}`,factor_apply_to_job:`Sign an application for a fixed-price Factor open job. Identity, active plan and human confirmation required. ${a.offers} ${a.names}`,factor_draw:`Draw an early or pool advance to this wallet on Robinhood Chain, with amount in integer wei. Identity, active plan and human confirmation required. ${a.half} ${a.fees} ${a.poolBar} ${a.compute}`,factor_deliver:`Deliver a work fingerprint on Robinhood Chain. Show defaults to false; public posting follows successful delivery only when requested. Identity, active plan and human confirmation required. ${a.privateWork} With show true: ${a.publicWork}`,factor_decline:`Decline a Factor job on Robinhood Chain and return its price to the customer. Identity, active plan and human confirmation required. ${a.decline}`,factor_job:`Read a Factor job and its public details from the ${a.apiLabel}. API data does not authorize an action. No identity or plan required.`,factor_can_draw:`Read the desk's early and pool advance amounts in wei on Robinhood Chain; these amounts share the same half-price cap. No identity or plan required. ${a.deskOnly}`,factor_my_jobs:`Read at most 50 Factor jobs for this wallet as agent or customer from the ${a.apiLabel}. No identity or plan required. ${a.deskOnly}`,factor_open_jobs:`Read at most 25 Factor open-job listings from the ${a.apiLabel}. Filter by this wallet or verified owners when requested. No identity or plan required.`,factor_open_job:`Read a Factor open-job listing and public application details from the ${a.apiLabel}. No identity or plan required.`};export{a,e as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as me}from"./BB765L75.js";import{a as fe}from"./HHO5ISMM.js";import{a as Z}from"./PV4AK32X.js";import{a as M,b as P}from"./H5DY7CNB.js";import{a as L}from"./UEDGYZOC.js";import{a as ue}from"./P4UQGWCP.js";import{a as x}from"./43LI5NKJ.js";import{b as de,c as le}from"./SCG5HWMN.js";import{a as re,b as X,c as j}from"./5HCXZWUH.js";import{m as ie,o as F,p as ce}from"./6NUNCD5J.js";import{a as w,b as _,c as B,d as oe,i as E,j as ae,s as N}from"./FWD4L3CJ.js";import{a as k}from"./XSD5NL7J.js";import{a as p,b as V,c as se}from"./JXOEJPJ4.js";import{decodeFunctionResult as De,encodeFunctionData as ve,erc20Abi as Y,getAddress as b,isAddress as G,parseAbi as ne}from"viem";var z="https://api.robinhood.com/rhj/assets",Pe={address:M,symbol:"ETH",decimals:18,chainId:w},Q={address:b(ae),symbol:"USDG",decimals:oe,chainId:w},J={address:b(E[4663].tokens.WETH.address),symbol:"WETH",decimals:18,chainId:w},we={address:b(E[4663].meridian.CollateralToken_USDe.address),symbol:"USDe",decimals:18,chainId:w};function K(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function $(e,n=w,s={}){let t=Array.isArray(e)?e:K(e)&&Array.isArray(e.assets)?e.assets:void 0;if(!t)throw new k("Official stock asset list response is malformed.");let a=new Map,d=new Map;if(t.length>1e4)throw new k("Official stock asset list exceeds the lookup limit.");for(let o of t){if(!K(o))continue;let r=o;if(typeof r.tokenSymbol!="string"||!r.tokenSymbol.trim()||!Array.isArray(r.deployments))continue;if(r.deployments.length>100)throw new k("Official stock deployment list exceeds the lookup limit.");let l=r.tokenSymbol;if(!/^[A-Za-z0-9.$_-]{1,32}$/.test(l))throw new k(`Invalid official stock ticker ${p(l)}.`);if(r.tokenDecimals!==void 0&&(typeof r.tokenDecimals!="number"||!Number.isInteger(r.tokenDecimals)||r.tokenDecimals<0||r.tokenDecimals>255))throw new k("Official stock asset has invalid token decimals.");let u=typeof r.tokenDecimals=="number"&&Number.isInteger(r.tokenDecimals)&&r.tokenDecimals>=0&&r.tokenDecimals<=255?r.tokenDecimals:18;for(let m of r.deployments){if(!K(m))continue;let h=m;if(h.chainId!==n)continue;if(typeof h.contractAddress!="string"||!G(h.contractAddress,{strict:!1}))throw new k("Official stock deployment has an invalid contract address.");let y=b(h.contractAddress),f=y.toLowerCase(),g=l.toUpperCase(),i=d.get(g);if(!s.allowAmbiguousSymbols&&i&&i!==f)throw new k(`Ambiguous official stock ticker ${p(l)} across multiple addresses.`);let c=a.get(f);if(c&&(c.symbol!==l||c.decimals!==u))throw new k(`Conflicting official stock identity at ${y}.`);d.set(g,f),a.set(f,{address:y,symbol:l,decimals:u,chainId:n,...s.includeNames&&typeof r.tokenName=="string"&&r.tokenName.trim()?{name:r.tokenName.trim()}:{}})}}return[...a.values()]}function Ee(e,n){if(typeof e.address!="string"||!G(e.address,{strict:!1}))return!1;let s=e.chainId??w,t=e.address.toLowerCase();return n.some(a=>a.chainId===s&&a.address.toLowerCase()===t&&a.symbol===e.symbol)}function W(e,n){x(e.address);let s=e.chainId??w,t=b(e.address),a=t.toLowerCase(),d=O(e.symbol),o=n.find(l=>l.chainId===s&&l.address.toLowerCase()===a),r=n.find(l=>l.chainId===s&&O(l.symbol)===d);if(o){if(e.symbol!==o.symbol)throw new k(`Token at ${t} does not match official stock ticker ${p(o.symbol)} (received ${p(e.symbol)}).`);if(e.decimals!==void 0&&e.decimals!==o.decimals)throw new k(`Token ${p(o.symbol)} at ${t} does not match official decimals ${o.decimals}.`);return o}if(r)throw new k(`Token symbol ${p(e.symbol)} at ${t} does not match the official stock contract address ${r.address}.`);return{address:t,symbol:e.symbol.trim(),decimals:e.decimals??18,chainId:s}}var xe=["AAOI","AAPL","ABCL","ADBE","AEHR","AEIS","ALAB","AMAT","AMBA","AMC","AMD","AMKR","AMZN","ANET","APLD","APP","ASML","ASTS","AUR","AVAV","AVGO","AXON","AXTI","BA","BABA","BB","BE","BMNR","BND","BULL","CBRS","CCL","CEG","CELH","CIEN","CLOV","CLS","CLSK","COHR","COIN","COST","CRCL","CRDO","CRM","CRWD","CRWV","CSCO","CTSH","CVNA","DDOG","DELL","DIS","DJT","DOCN","ELF","EWT","EWY","F","FICO","FIG","FISV","FIX","FLNC","FLY","FTNT","FUTU","GDX","GE","GEV","GLD","GLW","GLXY","GME","GOOGL","HII","HIMS","HPE","HWM","IBM","IBRX","INDA","INFQ","INOD","INTC","INTU","IONQ","IREN","JBL","JNJ","JOBY","JPM","KLAC","KSS","KTOS","LHX","LITE","LLY","LMT","LRCX","LULU","LUNR","MCD","MDB","META","MOD","MPWR","MRNA","MRVL","MSFT","MSTR","MTSI","MU","MXL","NAVN","NBIS","NET","NFLX","NNE","NOW","NU","NVDA","NVTS","OKLO","ON","ONTO","ORCL","OUST","P","PANW","PATH","PENG","PFE","PL","PLTR","POET","POWL","PR","PWR","PYPL","QBTS","QCOM","QQQ","QUBT","RBLX","RCAT","RDDT","RDW","RGTI","RIVN","RKLB","RUN","SATS","SCHD","SGOV","SHOP","SHY","SIMO","SKHY","SLS","SLV","SMCI","SMH","SMR","SNAP","SNDK","SNOW","SOFI","SOUN","SOXX","SPCX","SPMO","SPY","TE","TEAM","TEM","TER","TSEM","TSLA","TSM","TTD","TTWO","UBER","UMC","UNH","UPS","USAR","USO","V","VICR","VRT","VSAT","VST","VTI","WDAY","WDC","WULF","WYFI","XLK","XNDU","XOM","ZETA","ZM","ZS"],q=new WeakMap,ke=new WeakMap,ge=3e4,he=Object.freeze([]),D;function tt(){if(!D)return he;let e=Date.now()-D.started;return e>=0&&e<ge?D.tokens:he}var ee=new WeakMap;function H(e,n){return(ee.get(e)??F)(n)}async function Ae(e){let n=e?.http??de(),s=e?.url??z,t=e?.chainId??w,a=j(n),d=ke.get(a);d||(d=new re(ge),ke.set(a,d));let{value:o,started:r}=await H(n,()=>d.read(`${t}:${s}`,async()=>{let u=await F(h=>le(a,s,{method:"GET",signal:h},y=>K(y)||Array.isArray(y))),m=$(u,t,{allowAmbiguousSymbols:!0});if(t===w&&m.length===0)throw new k("Official stock asset list has no mainnet deployments; retry when the list is available.");return u})),l=$(o,t,e);if(t===w&&s===z&&(!D||r>=D.started||Date.now()<D.started)&&(D={started:r,tokens:Object.freeze($(o,t,{allowAmbiguousSymbols:!0}).map(u=>Object.freeze(u)))}),t===w){let u=q.get(a);u||(u=new Set,q.set(a,u));for(let m of l)u.add(O(m.symbol))}return l}var Me=ne(["function aggregate3((address target, bool allowFailure, bytes callData)[] calls) payable returns ((bool success, bytes returnData)[] returnData)"]);function ye(e){let n=e,s=new Set;for(;n&&typeof n=="object"&&!s.has(n)&&s.size<10;){s.add(n);let t=n;if(t.name==="ContractFunctionZeroDataError"||t.name==="AbiDecodingZeroDataError")return!0;let a=`${typeof t.shortMessage=="string"?t.shortMessage:""} ${typeof t.message=="string"?t.message:""}`;if(/returned no data \("0x"\)|Cannot decode zero data/i.test(a))return!0;n=t.cause}return!1}function Re(e){return e instanceof k?/RPC endpoint|too many requests|malformed JSON/i.test(e.message):e instanceof Error?/fetch failed|network|ECONNREFUSED|ETIMEDOUT|HTTP \d{3}|rate limit|too many requests/i.test(e.message):!1}async function Ue(e,n,s){if(typeof e.getCode=="function")try{let t=await e.getCode({address:n});return!t||t==="0x"}catch{return ye(s)}return ye(s)}async function Te(e,n,s){if(n.length===0)return[];let t=await Promise.allSettled(n.map(a=>e.readContract({address:a.address,abi:Y,functionName:"balanceOf",args:[s]})));if(t.every(a=>a.status==="rejected")&&t[0]?.status==="rejected"&&Re(t[0].reason))throw t[0].reason;return t.map(a=>{if(a.status!=="fulfilled"||a.value===void 0||a.value===null)return{ok:!1};try{let d=typeof a.value=="bigint"?a.value:BigInt(a.value);return d>=0n?{ok:!0,amount:d}:{ok:!1}}catch{return{ok:!1}}})}async function Se(e,n,s,t){if(s.length===0)return[];let a=ie(n,e);if(!a)return Te(e,s,t);let d=s.map(r=>({target:r.address,allowFailure:!0,callData:ve({abi:Y,functionName:"balanceOf",args:[t]})})),o;try{o=await e.readContract({address:a,abi:Me,functionName:"aggregate3",args:[d]})}catch(r){if(await Ue(e,a,r))return Te(e,s,t);throw r}if(!Array.isArray(o)||o.length!==s.length)throw new k("Multicall3 aggregate3 returned an invalid result list.");return o.map(r=>{let l=r,u=Array.isArray(l)?l[0]:l?.success,m=Array.isArray(l)?l[1]:l?.returnData;if(!u||typeof m!="string"||m==="0x")return{ok:!1};try{let h=De({abi:Y,functionName:"balanceOf",data:m}),y=typeof h=="bigint"?h:BigInt(h);return y>=0n?{ok:!0,amount:y}:{ok:!1}}catch{return{ok:!1}}})}async function nt(e,n={}){x(e);let s=b(e),t=n.chainId??w,a=n.client??ce(n.rpcUrl,t),d=[];if(n.stockTokens?d=[...n.stockTokens]:n.stockAssetsPayload!==void 0?d=$(n.stockAssetsPayload,t):n.includeStockTokens!==!1&&t!==_&&(d=await Ae({http:n.http,url:n.stockAssetsUrl,chainId:t})),n.tokens)for(let i of n.tokens)W(i,d);let o=t===w?[Q,J,we,...n.oakTokenAddress||process.env.OAK_TOKEN_ADDRESS?[{address:b(n.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS),symbol:"OAK",decimals:B,chainId:t}]:[]]:t===_?[{...Q,address:b(N.testnet.usdg),chainId:t},{...J,address:b(N.testnet.weth),chainId:t},...n.oakTokenAddress?[{address:b(n.oakTokenAddress),symbol:"OAK",decimals:B,chainId:t}]:[]]:[],r=t===w&&n.includePoolTokens!==!1?ue.vaults.flatMap(i=>[{address:b(i.tokenAddress),symbol:b(i.tokenAddress),decimals:i.tokenDecimals,chainId:t},{address:b(i.earnContractAddress),symbol:b(i.earnContractAddress),decimals:18,chainId:t}]):[],l=new Set(r.map(i=>i.address.toLowerCase())),u=[],m=new Set;for(let i of[...o,...d,...n.tokens??[],...r]){if(i.chainId!==t||P(i.address)===M)continue;let c=W(i,d),T=c.address.toLowerCase();m.has(T)||(m.add(T),u.push(c))}let[h,y]=await Promise.all([a.getBalance({address:s}),Se(a,t,u,s)]),f=[],g={address:M,symbol:"ETH",decimals:18,chainId:t};(h>0n||n.includeZero)&&f.push({token:g,amount:h.toString()});for(let i=0;i<u.length;i++){let c=u[i],T=o.some(S=>C(S.address,c.address))||d.some(S=>C(S.address,c.address))?c.symbol:p(c.symbol),I=y[i]??{ok:!1};if(!I.ok){f.push({token:{address:c.address,symbol:T,decimals:c.decimals,chainId:c.chainId},amount:"unavailable"});continue}let A=I.amount;if(A>0n&&l.has(c.address.toLowerCase()))try{let[S,R]=await Promise.all([L(a,t,c.address,"symbol"),L(a,t,c.address,"decimals")]);T=p(S),c.decimals=R}catch{}(A>0n||n.includeZero)&&f.push({token:{address:c.address,symbol:T,decimals:c.decimals,chainId:c.chainId},amount:A.toString()})}return f}async function st(e,n,s){if(x(e),n.length>1e4)throw new k("Journal token discovery exceeds the balance lookup limit.");let t=[...new Set(n.map(o=>(x(o),b(o))))].filter(o=>P(o)!==M).map(o=>({address:o,symbol:o,decimals:0,chainId:s.chainId})),a=await Se(s.client,s.chainId,t,b(e)),d=t.flatMap((o,r)=>{let l=a[r];return l.ok&&l.amount===0n?[]:[{token:o,amount:l.ok?l.amount.toString():"unavailable"}]});return Promise.all(d.map(async({token:o,amount:r})=>{let[l,u]=await Promise.all([L(s.client,s.chainId,o.address,"symbol").catch(()=>o.address),L(s.client,s.chainId,o.address,"decimals").catch(()=>{throw new k(`Token decimals are unavailable for journal-received token ${o.address}; retry balances when RPC metadata is available.`)})]);return{token:{...o,symbol:p(l),decimals:u},amount:r}}))}var C=(e,n)=>e.toLowerCase()===n.toLowerCase(),O=e=>se(e.normalize("NFKC")).toLowerCase().replace(/[^\p{L}\p{N}]/gu,"");function Oe(e){let n=e.context.network??"mainnet",{chainId:s,usdg:t,weth:a}=N[n],d=(o,r,l)=>({...o,address:P(b(o.address)),name:r,kind:l,verified:!0,source:"Oak fixed addresses",warnings:[]});return[d({...Pe,chainId:s},"Ether","native"),d({...Q,address:t,chainId:s},"Global Dollar","stablecoin"),d({...J,address:a,chainId:s},"Wrapped Ether","wrapped"),...n==="mainnet"?[d(we,"USDe","stablecoin")]:[],...e.oakTokenAddress?[d({address:e.oakTokenAddress,symbol:"OAK",decimals:B,chainId:s},"Oak","oak")]:[]]}async function Ce(e){if(e.context.network==="testnet")return[];let n=e.officialStockTokens??await Ae({http:e.context.http,includeNames:!0,allowAmbiguousSymbols:!0});return n.filter(s=>Ee(s,n)).map(s=>({...s,name:s.name??s.symbol,kind:"official_stock",verified:!0,source:z,warnings:[],identityNote:"Official Robinhood stock token: this address matches Robinhood's published list. The quoted name is text from that list."}))}async function te(e,n,s=!0){let{chainId:t}=N[n.context.network??"mainnet"],a=n.context.clientFor(t);if(await a.getChainId()!==t)throw new k(`Token lookup requires Robinhood Chain ${t}.`);let[d,o,r]=await Promise.all([H(a,()=>L(a,t,e,"name",n.blockNumber)).catch(l=>{if(s)throw l;return""}),H(a,()=>L(a,t,e,"symbol",n.blockNumber)),H(a,()=>L(a,t,e,"decimals",n.blockNumber))]);if(typeof d!="string"||s&&!d.trim()||typeof o!="string"||!o.trim()||!Number.isInteger(r)||r<0||r>255)throw new k("The contract returned invalid token metadata.");return{address:b(e),name:d||o,symbol:o,decimals:r,chainId:t}}async function be(e,n){let s=await n.context.clientFor(w).readContract({address:E[w].clanker.factory.address,abi:ne(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))"]),functionName:"tokenDeploymentInfo",args:[e]});return Array.isArray(s)&&s.length===4&&typeof s[0]=="string"&&C(s[0],e)}async function _e(e,n){let s=n.context.clientFor(w),t=E[w].poolsTrade,a=[t.instantLaunchStrategyFeesOn.address,t.instantLaunchStrategyFeesOff.address],d=ne(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)"])[0],o=await s.getBlockNumber(),r=new Set,l=0,u=0;for(let m=63127652n;m<=o;m+=10000000n){if(++l>Ie)throw new k("Token origin scan limit reached.");let h=m+9999999n>o?o:m+9999999n,y=await s.getLogs({address:a,event:d,args:{token:e},fromBlock:m,toBlock:h,strict:!0});for(let f of y){if(f.removed||!a.some(i=>C(i,f.address))||!f.args.token||!C(f.args.token,e)||!f.transactionHash||r.has(f.transactionHash))continue;if(r.add(f.transactionHash),++u>20)throw new k("Token origin receipt limit reached.");let g=await s.getTransactionReceipt({hash:f.transactionHash});if(fe(g).some(i=>C(i.token,e)))return b(g.from)}}}var Ie=5,Be=100,Fe=500,Ke=3e4;function Le(e){let n=Date.now()+Ke,s=0,t=new Map,a=o=>{let r=n-Date.now();if(r<=0)throw new k("Token lookup time budget reached; results are partial.");return F(o,Math.min(1e4,r))},d=X((o,r)=>a(async l=>{let u=await e.context.http(o,{...r,signal:l});return new Proxy(u,{get(m,h){if(h==="json")return()=>a(()=>m.json());let y=Reflect.get(m,h,m);return typeof y=="function"?y.bind(m):y}})}),e.context.http);return ee.set(d,a),{...e,context:{...e.context,http:d,clientFor:o=>{if(!t.has(o)){let r=e.context.clientFor(o),l=u=>{if(++s>Fe)throw new k("Token lookup RPC budget reached; results are partial.");return a(u)};t.set(o,X(new Proxy(r,{get(u,m){let h=Reflect.get(u,m);return typeof h!="function"?h:(...y)=>l(()=>h.apply(u,y))}}),r)),ee.set(t.get(o),l)}return t.get(o)}}}}function pe(e){return e.source==="Oak fixed addresses"?e:{...e,symbol:p(e.symbol),name:p(e.name)}}async function ot(e,n){if(n=Le(n),typeof e!="string"||e.length>256||!O(e))throw new k("Provide a token name, symbol or address to find_token.");let s=O(e),t=G(e.trim(),{strict:!1})?P(b(e.trim())):void 0,{chainId:a}=N[n.context.network??"mainnet"],d=[],o=Oe(n),r=!1;try{o.push(...await Ce(n))}catch{r=!0,d.push("The official stock list is unavailable; results are partial and stock identities and lookalikes could not be checked.")}let l=i=>t?C(i.address,t):O(i.symbol).includes(s)||O(i.name).includes(s),u=o.filter(l),m=[],h=(i,c)=>[i.symbol,i.name??""].some(T=>[c.symbol,c.name].some(I=>{let A=O(T),S=O(I);return!!A&&!!S&&(A.includes(S)||S.includes(A))})),y=(i,c={})=>{if(m.some(A=>C(A.address,i.address)))return;let T=[`Token ${p(i.symbol)} at ${i.address} is an unverified ${c.launchpad?"launchpad token":"token"}. Use its address, not its name or symbol.`];(V(i.symbol)||V(i.name)||o.some(A=>!C(A.address,i.address)&&h(i,A)))&&T.push(`Lookalike warning: ${p(i.symbol)} at ${i.address} resembles a verified token's name or symbol.`);let I={...i,...c,kind:c.launchpad?"launchpad":"erc20",verified:!1,source:c.launchpad?`${c.launchpad} origin and on-chain metadata; not a verified token`:"On-chain metadata only",warnings:T};m.push(I),d.push(...T)};if(t&&!u.length){let i=await te(t,n),c={};if(a===w){try{await be(t,n)&&(c.launchpad="clanker")}catch{d.push("Clanker origin lookup was unavailable for this address.")}if(c.launchpad==="clanker")try{let I=(await Z(n.context,{q:t,limit:20})).tokens.find(A=>C(A.contract_address,t));I&&(c.creator=b(I.msg_sender),c.creatorSource="Clanker indexer msg_sender")}catch{d.push("Clanker creator lookup is unavailable.")}else try{let T=await me(n.context,t);c.launchpad="pons",c.creator=b(T.creator),c.creatorSource="Pons factory deployer"}catch{d.push("Pons launch origin could not be confirmed for this address.")}if(!c.launchpad)try{let T=await _e(t,n);T&&(c.launchpad="pools.trade",c.creator=T,c.creatorSource="Launch transaction sender; may be a relayer")}catch{r=!0,d.push("pools.trade launch receipt lookup is unavailable; origin results are partial.")}}y(i,c)}else if(!t&&a===w){let i=new Set,c=new Set,T,I=0,A=0;try{do{if(++I>Ie)throw new k("Token search page limit reached.");let S=await Z(n.context,{q:e.trim(),limit:20,...T?{cursor:T}:{}});for(let R of S.tokens){if(++A>Be)throw new k("Token candidate limit reached.");let v=b(R.contract_address);if(!(c.has(v)||o.some(U=>C(U.address,v)))){c.add(v);try{let U=await te(v,n);if(!l(U))continue;let Ne=await be(v,n)?{launchpad:"clanker",creator:b(R.msg_sender),creatorSource:"Clanker indexer msg_sender"}:{};y(U,Ne)}catch{r=!0,d.push(`Could not read Clanker candidate ${v}; it was omitted from these partial results.`)}}}if(S.cursor&&i.has(S.cursor))throw new k("The Clanker indexer repeated a pagination cursor.");S.cursor&&i.add(S.cursor),T=S.cursor??void 0}while(T)}catch{r=!0,d.push("Clanker name search is unavailable, incomplete or reached its scan limit; results are partial.")}d.push("Pons and pools.trade require a token address; name search does not cover those launchpads.")}a===_&&d.push("Testnet lookup covers pinned tokens and explicit token addresses; stock and launchpad discovery are unavailable.");let f=i=>[...new Map(i.map(c=>[c.address.toLowerCase(),c])).values()],g=f([...u,...m]);for(let i of g)if(g.some(c=>!C(c.address,i.address)&&(O(i.symbol)===O(c.symbol)||O(i.name)===O(c.name)))){let c=`Duplicate warning: several tokens share the symbol or name of ${i.address}. Choose the intended address; do not guess from the name.`;i.warnings.push(c),d.push(c)}return u.length>1&&d.push("Several verified tokens match this search, including possible substring matches. Choose an exact address; the search does not select a quote token."),{query:p(e.trim()),chainId:a,partial:r,matches:f(u).map(pe),unverified:f(m).map(pe),warnings:d}}async function at(e,n){if(typeof e!="string"||!e.trim())throw new k("Provide a token address or verified symbol; use find_token to look it up.");if(!/^[A-Za-z0-9.$_-]{1,42}$/.test(e))throw new k("Use an exact ASCII verified symbol or token address; use find_token to look it up.");let s=e,t=G(s,{strict:!1})?P(b(s)):void 0,a=Oe(n),d=t&&a.find(y=>C(y.address,t));if(d)return d;let o=s.toUpperCase()==="$OAK"?"OAK":s.toUpperCase(),r=!t&&a.find(y=>y.symbol.toUpperCase()===o),l=[],u=!1;try{l=await Ce(n)}catch{if(r)return r;if(!t)throw new k("The official stock list is unavailable; stock symbols cannot be checked. Use find_token and try again when the list is reachable.");u=!0}if(t){let y=l.find(i=>C(i.address,t));if(y)return n.tokenMetadata&&W(n.tokenMetadata,l),{...y,name:p(y.name)};let f=n.tokenMetadata??await n.readMetadata?.(t);if(f&&(!C(f.address,t)||f.chainId!==N[n.context.network??"mainnet"].chainId))throw new k("Token metadata does not match the requested address and chain.");if(f&&(typeof f.symbol!="string"||!f.symbol.trim()||!Number.isInteger(f.decimals)||f.decimals<0||f.decimals>255))throw new k("The contract returned invalid token metadata.");let g=f?{...f,name:f.symbol}:await te(t,Le(n),!1);if(u){let i=O(g.symbol),c=q.get(j(n.context.http));if(xe.some(T=>O(T)===i)||c?.has(i))throw new k("The official stock list is unavailable; this address claims a stock ticker that cannot be checked. Try again when the list is reachable.")}return W(g,l),{...g,symbol:p(g.symbol),name:p(g.name),kind:"erc20",verified:!1,source:"On-chain metadata only",warnings:["This token address is unverified. On-chain names and symbols do not prove identity.",...u?["The official stock list is unavailable; stock identity could not be verified."]:[]]}}let m=[...a,...l].filter(y=>y.symbol.toUpperCase()===o);if(m.length!==1)throw new k(`Token symbol ${p(s)} is ${m.length?"ambiguous":"unverified"}; use find_token and choose an explicit address.`);let h=m[0];if(h.kind==="official_stock"&&s!==h.symbol)throw new k(`Use the exact official stock ticker ${p(h.symbol)}; case variants are refused.`);return h.source==="Oak fixed addresses"?h:{...h,name:p(h.name)}}export{z as a,Pe as b,Q as c,J as d,we as e,$ as f,Ee as g,W as h,tt as i,Ae as j,Me as k,nt as l,st as m,ot as n,at as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as J,h as K}from"./UUID2E22.js";import{a as H}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{c as D,d as Y,g as N,i as V,m as Q,n as z}from"./NWNYJ26T.js";import{a as p,i as R,j}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{decodeFunctionData as X,encodeFunctionData as x,erc20Abi as F,getAddress as L,parseAbi as Z}from"viem";var e={router:L("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:L("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:L("0x8697bb63743678640710b1270e98772a29642b3c"),weth:L("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:L("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},E=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),O={vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,h){let f=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==h.length&&f();for(let q=0;q<s.length;q++){let P=s[q],v=h[q];if((P.chainId!==v.chainId||!N(P.to,v.to)||P.value!==v.value)&&f(),!N(P.data,v.data))try{let B=X({abi:E,data:P.data}),n=X({abi:E,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&f();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:f(),i=x({abi:E,functionName:B.functionName,args:t});N(i,P.data)||f();let u=t.length-1;(l(t[u])<=l(a[u])-600n||l(t[u])>l(a[u]))&&f(),t[u]=a[u];for(let o of r)l(t[o])<l(a[o])&&f(),t[o]=a[o];N(x({abi:E,functionName:B.functionName,args:t}),v.data)||f()}catch{f()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function G(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function l(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let h=s??50;if(typeof h!="number"||!Number.isInteger(h)||h<0||h>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(h)}function W(s,h){let f=s*(10000n-h)/10000n;if(f===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return f}var ce=s=>{async function h(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function f(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==L(R[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function q(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=l(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=l(a.timestamp)+600n,i=(S,g,A=[])=>n.readContract({address:S,abi:E,functionName:g,args:A,blockNumber:t}),[u,o,m,c,w,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:R[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||w!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(S,g)=>l(await n.readContract({address:S,abi:F,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(S){let[g,A]=await Promise.all([n.readContract({address:S,abi:F,functionName:"symbol",blockNumber:t}),n.readContract({address:S,abi:F,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:S,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function P(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},amount:{...I(),description:'Optional CLM entry budget in base units of the bridge token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals.'},slippageBps:O.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>h(async()=>{if(J.some(b=>N(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);f(n,[]),H(t);let a=await q(),[r,i,u,o,m,c,w]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:l(o[0]).toString()},{token:i,balance:c.toString(),reserve:l(o[1]).toString()}],lp:{token:u,balance:w.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...O,from:{...D,description:"Address of the token to sell: native ETH placeholder, WETH, UP or USDG."},to:{...D,description:"Address of the token to receive: WETH, UP or USDG, different from the input token."},amount:I('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["from","to","amount","slippageBps"]),H(t);let a=y(n.from),r=y(n.to),i=G(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,L(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await q();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let w=[];m&&w.push(v(e.weth,x({abi:E,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let U=0;U<g.length-1;U++){let C={from:g[U],to:g[U+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let _=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(_)||_.length!==g.length||l(_[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let U of _)if(l(U)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=l(_.at(-1)),T=W(k,u),w.push(s.approval(b,e.router,i.toString(),p)),w.push(v(e.router,x({abi:E,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let S=await c.token(r);return{...await P(w,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:S,amount:k.toString()},minimumOutput:{token:S,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...O,amount0:I('Amount of WETH to add in base units (WETH has 18 decimals). Example: "1000000000000000000" = 1 WETH.'),amount1:I('Amount of UP to add in base units of the UP token (read its decimals). Example: "1000000000000000000" = 1 UP at 18 decimals.')},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount0","amount1","slippageBps"]),H(t);let a=G(n.amount0),r=G(n.amount1),i=M(n.slippageBps),u=await q();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=l(o[0]),c=l(o[1]),w=l(o[2]);if(m>a||c>r||w===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=W(m,i),k=W(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,x({abi:E,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await P(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:w.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...O,amount:{description:'Amount of UP-WETH LP tokens to remove, in base units of the LP token (18 decimals). Example: "1000000000000000000" = 1 LP token. "all" removes your full LP balance.',anyOf:[I(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount","slippageBps"]),H(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:G(n.amount),i=await q(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,w]=await Promise.all([i.client.readContract({address:e.pair,abi:F,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(l(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=W(c*o/m,a),k=W(w*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,x({abi:E,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await P(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,E as b,ue as c,de as d,ce as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as I}from"./43LI5NKJ.js";import{b as G}from"./IX3GZMTM.js";import{a as r,j as p}from"./FWD4L3CJ.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as T,erc20Abi as k,getAddress as h,parseAbi as F}from"viem";var f=F(["function asset() view returns (address)","function decimals() view returns (uint8)","function previewMint(uint256) view returns (uint256)","function previewRedeem(uint256) view returns (uint256)","function previewWithdraw(uint256) view returns (uint256)","function mint(uint256 shares,address receiver) returns (uint256)","function redeem(uint256 shares,address receiver,address owner) returns (uint256)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256)"]);function N(e){if(typeof e!="string")throw new n("Amount must be a positive base-unit integer string.");let a=G(e);if(a<=0n||a>=1n<<256n)throw new n("Amount must be positive and fit uint256.");return a}function E(e){if(typeof e!="bigint"||e<0n||e>=1n<<256n)throw new n("Invalid vault amount read.");return e}function J(e,a,o){return["mint",a==="steakhouse"?"redeem":"withdraw_assets"].map(v=>{let t=v==="mint",w=v==="redeem",d=t||w?"shares":"amount",q=l=>({type:"string",pattern:"^[0-9]+$",description:l}),M=t?'Exact vault shares to mint, in base units (shares have 18 decimals). Example: "1000000000000000000" = 1 share.':'Vault shares to redeem for USDG, in base units (shares have 18 decimals). Example: "1000000000000000000" = 1 share.',O='Amount of USDG to receive, in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.';return{name:`${a}_${v}`,inputSchema:{type:"object",additionalProperties:!1,required:t?["shares","maxAssets"]:[d],properties:{[d]:q(d==="shares"?M:O),...t?{maxAssets:q('Most USDG you will pay for these shares, in base units (USDG has 6 decimals). The call fails if the quote is higher. Example: "1000000" = 1 USDG.')}:{}}},execute:async(l,i)=>{try{if(I(i),Object.keys(l).some(x=>![d,...t?["maxAssets"]:[]].includes(x)))throw new n("Unexpected vault amount argument.");let s=N(l[d]),P=t?N(l.maxAssets):void 0,c=e.clientFor(r);if(await c.getChainId()!==r)throw new n("Vault amount actions require chain 4663.");let[S,R,V]=await Promise.all([c.readContract({address:o,abi:f,functionName:"asset"}),c.readContract({address:o,abi:f,functionName:"decimals"}),c.readContract({address:h(p),abi:k,functionName:"decimals"})]);if(typeof S!="string"||h(S)!==h(p)||R!==18||V!==6)throw new n("Vault amount actions require canonical USDG and the evidenced 18-decimal shares.");let m=E(await c.readContract({address:o,abi:f,functionName:t?"previewMint":w?"previewRedeem":"previewWithdraw",args:[s]}));if(m===0n)throw new n("The vault returned a zero amount quote.");if(t&&m>P)throw new n("The mint quote exceeds maxAssets.");let U=t?void 0:E(await c.readContract({address:o,abi:k,functionName:"balanceOf",args:[i]}));if(!t&&(w?s:m)>U)throw new n("The wallet share balance cannot cover this exit.");let _=t?T({abi:f,functionName:"mint",args:[s,i]}):w?T({abi:f,functionName:"redeem",args:[s,i,i]}):T({abi:f,functionName:"withdraw",args:[s,i,i]}),$=`${v} ${s} ${d==="shares"?"18-decimal share":"6-decimal USDG"} base units from ${a}; beneficiary ${i}.`,C=[...t?[e.approval(h(p),o,m.toString(),r)]:[],e.unsignedTx({to:o,data:_,value:"0",chainId:r,description:$})],y=await e.preview(C,i),D={address:h(p),chainId:r,symbol:"USDG",decimals:6},b={address:h(o),chainId:r,symbol:`${a} shares`,decimals:18},u=x=>y.changes.filter(g=>g.token.chainId===r&&g.token.address.toLowerCase()===x.address.toLowerCase()).reduce((g,A)=>{if(A.token.decimals!==x.decimals||!/^-?\d+$/.test(A.amount))throw new n("Invalid vault preview metadata.");return g+BigInt(A.amount)},0n);if(t?u(D)!==-m||u(b)!==s:w?u(b)!==-s||u(D)<=0n:u(D)!==s||-u(b)<=0n||-u(b)>U)throw new n("The preview does not match the requested vault amount and share balance.");return{txs:C,preview:y,summary:`${$} Quoted counterpart ${m} base units. ${y.summary} Standard ERC-4626 encodes no receipt minimum. Mint approvals use the exact current quote; accrual can require a new quote. Plain exits depend on available liquidity; use a separately previewed full force exit if required.`}}catch(s){throw new n(e.plainError(s))}}}})}export{J as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as k,c as P,d as R}from"./AEL62KCG.js";import{a as Z}from"./QHBS3PVU.js";import{a as H}from"./43LI5NKJ.js";import{g as G,i as Q}from"./NWNYJ26T.js";import{b as W,c as V}from"./IX3GZMTM.js";import{a as c,d as X,i as O}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as T}from"./JXOEJPJ4.js";import{encodeFunctionData as nt,erc20Abi as J,getAddress as a,parseAbi as gt}from"viem";var At="hookr",y=a(O[4663].hookr.HookrLimitOrders.address),wt=a(O[4663].hookr.HookrRoot.address),Ot=a(O[4663].hookr.HookrRouter.address),Bt=a(O[4663].hookr.HookrForwarder.address),ht=a(O[4663].hookr.PoolManager.address),It=a(O[4663].hookr.HOOKR_Token.address),N="0x0000000000000000000000000000000000000000",St="0x000000000000000000000000000000000000dEaD",Y=(1n<<128n)-1n,Tt=new Set([N.toLowerCase(),St.toLowerCase(),y.toLowerCase(),Ot.toLowerCase(),Bt.toLowerCase(),ht.toLowerCase(),wt.toLowerCase()]),B=gt(["function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function fill(uint256 orderId) returns (uint256 amountOut)","function claimBounty(address to) returns (uint256 amount)","function bountyOf(address keeper) view returns (uint256)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)"]);function Ht(t){let n=t.toLowerCase();return n===N.toLowerCase()||n===Z.toLowerCase()}function $t(t,n,i){let o=n.trim();if(o.startsWith("-")){let s=o.slice(1),r=t(s,i);return r==="0"?"0":`-${r}`}return t(o,i)}function Wt(t,n,i){return V(t,n,i)}function et(t,n){return!t.changes||t.changes.length===0?"no net ERC-20/native transfer delta on caller":t.changes.map(i=>`${$t(n,i.amount,i.token.decimals)} ${T(i.token.symbol)} (${i.token.address})`).join(", ")}function xt(t){if(typeof t=="bigint"){if(t<=0n)throw new u("Hookr orderId must be a positive integer.");return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<=0)throw new u("Hookr orderId must be a positive integer.");return BigInt(t)}if(typeof t=="string"&&/^\d+$/.test(t.trim())){let n=BigInt(t.trim());if(n<=0n)throw new u("Hookr orderId must be a positive integer.");return n}throw new u("Provide a positive integer Hookr orderId.")}function ot(t){if(t==null)return c;if(typeof t!="number"||!Number.isSafeInteger(t)||t!==c)throw new u(`Hookr limit orders are only supported on chain ${c}.`);return c}function Rt(t){switch(t){case 0:return"None";case 1:return"Open";case 2:return"Filled";case 3:return"Cancelled";default:return"Unknown"}}function Ct(t){if(Array.isArray(t)){let[n,i,o,s,r,d,g,m,b,e,l]=t;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:i,createdAt:o,expiry:s,zeroForOne:!!r,status:d,recipient:g,amountIn:BigInt(m),minAmountOut:BigInt(b),bounty:BigInt(e),sqrtPriceLimitX96:BigInt(l)}}if(t&&typeof t=="object"){let n=t;if(n.key&&typeof n.key=="object")return{key:{currency0:n.key.currency0,currency1:n.key.currency1,fee:Number(n.key.fee),tickSpacing:Number(n.key.tickSpacing),hooks:n.key.hooks},owner:n.owner,createdAt:n.createdAt,expiry:n.expiry,zeroForOne:!!n.zeroForOne,status:n.status,recipient:n.recipient,amountIn:BigInt(n.amountIn),minAmountOut:BigInt(n.minAmountOut),bounty:BigInt(n.bounty),sqrtPriceLimitX96:BigInt(n.sqrtPriceLimitX96)}}throw new u("HookrLimitOrders returned a malformed order tuple.")}function Dt(t){if(Array.isArray(t)&&t.length>=2)return{fillable:!!t[0],amountOut:BigInt(t[1])};if(t&&typeof t=="object"&&"fillable"in t&&"amountOut"in t){let n=t;return{fillable:!!n.fillable,amountOut:BigInt(n.amountOut)}}throw new u("HookrLimitOrders returned a malformed quoteFill response.")}function Pt(t){if(Array.isArray(t)&&t.length>=3)return{minBounty:BigInt(t[0]),defaultBounty:BigInt(t[1]),maxBounty:BigInt(t[2])};if(t&&typeof t=="object"&&"minBounty"in t&&"defaultBounty"in t&&"maxBounty"in t){let n=t;return{minBounty:BigInt(n.minBounty),defaultBounty:BigInt(n.defaultBounty),maxBounty:BigInt(n.maxBounty)}}throw new u("HookrLimitOrders returned a malformed bountyBounds response.")}async function tt(t,n,i=c){if(i!==c)throw new u(`Unsupported token chain ${i}; Hookr requires chain ${c}.`);if(Ht(n))return{...k,chainId:i};H(n);let o=a(n),s=o.toLowerCase();if(s===P.address.toLowerCase())return{address:o,symbol:P.symbol,decimals:X,chainId:i};if(s===R.address.toLowerCase())return{address:o,symbol:R.symbol,decimals:R.decimals,chainId:i};if(s===It.toLowerCase())return{address:o,symbol:"HOOKR",decimals:18,chainId:i};let[r,d]=await Promise.all([t.readContract({address:o,abi:J,functionName:"symbol"}),t.readContract({address:o,abi:J,functionName:"decimals"})]),g=typeof r=="string"&&r.trim()?r.trim():o,m=Number(d);if(!Number.isInteger(m)||m<0||m>255)throw new u(`Invalid token decimals for ${o} on chain ${i}.`);return{address:o,symbol:g,decimals:m,chainId:i}}async function Et(t){if(typeof t.getBlock!="function")throw new u("Cannot read the latest block timestamp for Hookr order expiry.");let n=await t.getBlock().catch(()=>{throw new u("Cannot read the latest block timestamp for Hookr order expiry.")});if(!n||typeof n.timestamp!="bigint"||n.timestamp<=0n)throw new u("Hookr requires a usable latest block timestamp to check order expiry.");return n.timestamp}function E(t,n=[]){let i=Q(t,"Provide a valid recipient wallet address."),o=i.toLowerCase();if(Tt.has(o)||n.some(s=>s.toLowerCase()===o))throw new u(`Recipient ${i} is a reserved protocol or zero address (invalid recipient).`);return i}function rt(t){if(t.minBountyEth!==void 0||t.minAmountOutDecimal!==void 0||t.rounding!==void 0)throw new u("Use minBounty and minAmountOut as base-unit integer strings.")}function L(t,n){if(t!==void 0){if(typeof t!="string"||!/^\d+$/.test(t))throw new u(`Provide ${n} as a base-unit integer string.`);return W(t)}}function Lt(t){return{name:"hookr_fill",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"HookrLimitOrders orderId as a positive integer string."},minBounty:{type:"string",description:"Optional minimum keeper bounty in wei (decimal base-unit string)."},minAmountOut:{type:"string",description:"Optional quote pre-check only, in token base-unit integer strings. Not enforced on chain: fill(uint256) enforces only the order minAmountOut."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},required:["orderId"],additionalProperties:!1},async execute(n,i){try{rt(n),H(i);let o=a(i),s=ot(n.chainId),r=xt(n.orderId),d=t.clientFor(s),[g,m,b]=await Promise.all([d.readContract({address:y,abi:B,functionName:"getOrder",args:[r]}),d.readContract({address:y,abi:B,functionName:"quoteFill",args:[r]}),Et(d)]),e=Ct(g),l=Number(e.status),h=Rt(l);if(l===0||G(e.owner,N))throw new u(`Hookr order #${r} does not exist.`);if(l!==1)throw new u(`Hookr order #${r} is not open (current status: ${h}).`);let A=BigInt(e.expiry);if(A<b)throw new u(`Hookr order #${r} is expired (expiry ${A} < current timestamp ${b}).`);let f=Number(e.key.tickSpacing),$=Number(e.key.fee);if(!Number.isInteger(f)||f<=0)throw new u(`Hookr order #${r} has an invalid pool tickSpacing (${f}).`);if(e.amountIn<=0n||e.amountIn>Y)throw new u(`Hookr order #${r} has an invalid amountIn (${e.amountIn}).`);if(e.minAmountOut<=0n||e.minAmountOut>Y)throw new u(`Hookr order #${r} has an invalid minAmountOut (${e.minAmountOut}).`);let C=a(e.key.hooks);E(e.recipient,[C]);let it=await d.readContract({address:y,abi:B,functionName:"bountyBounds",args:[{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:$,tickSpacing:f,hooks:C},e.zeroForOne,e.amountIn,e.minAmountOut]}),w=Pt(it),D=L(n.minBounty,"minBounty"),F=D!==void 0&&D>w.minBounty?D:w.minBounty;if(e.bounty<F)throw new u(`Hookr order #${r} is underbounty: order bounty (${e.bounty} wei) is below the required keeper bounty (${F} wei).`);if(e.bounty>w.maxBounty)throw new u(`Hookr order #${r} bounty (${e.bounty} wei) exceeds maximum bounty bound (${w.maxBounty} wei).`);let I=Dt(m),ut=e.zeroForOne?e.key.currency0:e.key.currency1,st=e.zeroForOne?e.key.currency1:e.key.currency0,[x,p]=await Promise.all([tt(d,ut,s),tt(d,st,s)]),S=L(n.minAmountOut,"minAmountOut"),v=S!==void 0&&S>e.minAmountOut?S:e.minAmountOut;if(!I.fillable||I.amountOut<=0n||I.amountOut<v)throw new u(`Hookr order #${r} is not executable: quoted output (${I.amountOut} base units of ${p.address}) does not meet minimum output (${v} base units).`);let at=nt({abi:B,functionName:"fill",args:[r]}),mt=t.formatAmount(e.amountIn.toString(),x.decimals),dt=t.formatAmount(I.amountOut.toString(),p.decimals),ct=t.formatAmount(e.minAmountOut.toString(),p.decimals),lt=t.formatAmount(e.bounty.toString(),18),yt=S===void 0?"":` Caller minAmountOut ${S} base units is a quote pre-check only, not enforced on chain; fill(uint256) enforces the order minimum of ${e.minAmountOut} base units.`,q=`Fill Hookr order #${r}: maker's escrow pays ${mt} ${T(x.symbol)} (${e.amountIn} base units of ${x.address}); net output goes to ${a(e.recipient)} (quoted ${dt} ${T(p.symbol)}, order minimum ${ct} ${T(p.symbol)}, ${e.minAmountOut} base units of ${p.address}). The filler sends no tokens or ETH (value 0), pays gas, and accrues ${lt} ETH (${e.bounty} wei) bounty to ${o}, payable only via claimBounty. Pool tickSpacing ${f}; expiry ${A} inclusive.${yt}`,M=t.unsignedTx({to:y,data:at,value:"0",chainId:s,description:q}),z=await t.preview([M],o),bt=et(z,t.formatAmount),K={token:x,amount:e.amountIn.toString()},U={token:p,amount:e.minAmountOut.toString()},ft={token:p,amount:I.amountOut.toString()},j={token:{...k,chainId:s},amount:e.bounty.toString()},pt={orderId:r.toString(),key:{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:$,tickSpacing:f,hooks:C},owner:a(e.owner),recipient:a(e.recipient),createdAt:BigInt(e.createdAt).toString(),expiry:A.toString(),zeroForOne:e.zeroForOne,status:l,statusLabel:h,amountIn:K,minAmountOut:U,bounty:j,sqrtPriceLimitX96:e.sqrtPriceLimitX96.toString()},kt={minBounty:{token:{...k,chainId:s},amount:w.minBounty.toString()},defaultBounty:{token:{...k,chainId:s},amount:w.defaultBounty.toString()},maxBounty:{token:{...k,chainId:s},amount:w.maxBounty.toString()}};return{txs:[M],summary:`${q} Preview deltas: ${bt}.`,preview:z,orderId:r.toString(),fillable:!0,amountIn:K,minAmountOut:U,quotedAmountOut:ft,bounty:j,bountyBounds:kt,order:pt}}catch(o){throw new u(t.plainError(o))}}}}function Nt(t){return{name:"hookr_claim_bounty",inputSchema:{type:"object",properties:{to:{type:"string",description:"Optional recipient address for the claimed native ETH bounty (must be the signing wallet)."},minBounty:{type:"string",description:"Optional minimum claimable bounty in wei (decimal base-unit string)."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},additionalProperties:!1},async execute(n,i){try{rt(n),H(i);let o=a(i),s=ot(n.chainId),r=n.to!==void 0&&n.to!==null?E(String(n.to)):E(o);if(r!==o)throw new u("Hookr bounty recipient must be the signing wallet.");let g=await t.clientFor(s).readContract({address:y,abi:B,functionName:"bountyOf",args:[o]}),m=BigInt(g);if(m<=0n)throw new u(`No claimable Hookr keeper bounty for ${o}.`);let b=L(n.minBounty,"minBounty");if(b!==void 0&&m<b)throw new u(`Claimable Hookr bounty (${m} wei) is below the requested minimum (${b} wei).`);let e=nt({abi:B,functionName:"claimBounty",args:[r]}),l=t.formatAmount(m.toString(),18),h=t.unsignedTx({to:y,data:e,value:"0",chainId:s,description:`Claim ${l} ETH (${m} wei) of accrued Hookr keeper bounty from ${y} to ${r}.`}),A=await t.preview([h],o),f=et(A,t.formatAmount),$={token:{...k,chainId:s},amount:m.toString()};return{txs:[h],summary:`Claim ${l} ETH (${m} wei) Hookr keeper bounty to ${r}. Preview deltas: ${f}.`,preview:A,recipient:r,claimableBounty:$}}catch(o){throw new u(t.plainError(o))}}}}async function _t(t,n){H(n);let i=a(n),o=t.clientFor(c);try{let s=await o.readContract({address:y,abi:B,functionName:"bountyOf",args:[i]}),r=BigInt(s);if(r<=0n)return[];let d=t.formatAmount(r.toString(),18);return[{module:At,id:`hookr:bounty:${i.toLowerCase()}`,chainId:c,assets:[{token:{...k,chainId:c},amount:r.toString()}],description:`Hookr claimable keeper bounty (${d} ETH)`}]}catch(s){throw new u(t.plainError(s))}}var _=t=>({tools:[Lt(t),Nt(t)],positions:n=>_t(t,n)}),Vt=_,Gt=_,Qt=_;export{At as a,y as b,wt as c,Ot as d,Bt as e,ht as f,It as g,B as h,$t as i,Wt as j,Lt as k,Nt as l,_t as m,_ as n,Vt as o,Gt as p,Qt as q};
|
|
1
|
+
import{b as k,c as P,d as R}from"./DNNFKDZR.js";import{a as Z}from"./H5DY7CNB.js";import{a as H}from"./43LI5NKJ.js";import{g as G,i as Q}from"./NWNYJ26T.js";import{b as W,c as V}from"./IX3GZMTM.js";import{a as c,d as X,i as O}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as T}from"./JXOEJPJ4.js";import{encodeFunctionData as nt,erc20Abi as J,getAddress as a,parseAbi as gt}from"viem";var At="hookr",y=a(O[4663].hookr.HookrLimitOrders.address),wt=a(O[4663].hookr.HookrRoot.address),Ot=a(O[4663].hookr.HookrRouter.address),Bt=a(O[4663].hookr.HookrForwarder.address),ht=a(O[4663].hookr.PoolManager.address),It=a(O[4663].hookr.HOOKR_Token.address),N="0x0000000000000000000000000000000000000000",St="0x000000000000000000000000000000000000dEaD",Y=(1n<<128n)-1n,Tt=new Set([N.toLowerCase(),St.toLowerCase(),y.toLowerCase(),Ot.toLowerCase(),Bt.toLowerCase(),ht.toLowerCase(),wt.toLowerCase()]),B=gt(["function getOrder(uint256 orderId) view returns (((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, address owner, uint40 createdAt, uint40 expiry, bool zeroForOne, uint8 status, address recipient, uint128 amountIn, uint128 minAmountOut, uint128 bounty, uint160 sqrtPriceLimitX96))","function quoteFill(uint256 orderId) view returns (bool fillable, uint256 amountOut)","function bountyBounds((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, bool zeroForOne, uint128 amountIn, uint128 minAmountOut) view returns (uint128 minBounty, uint128 defaultBounty, uint128 maxBounty)","function fill(uint256 orderId) returns (uint256 amountOut)","function claimBounty(address to) returns (uint256 amount)","function bountyOf(address keeper) view returns (uint256)","function lastOrderId() view returns (uint256)","function liabilities(address currency) view returns (uint256)"]);function Ht(t){let n=t.toLowerCase();return n===N.toLowerCase()||n===Z.toLowerCase()}function $t(t,n,i){let o=n.trim();if(o.startsWith("-")){let s=o.slice(1),r=t(s,i);return r==="0"?"0":`-${r}`}return t(o,i)}function Wt(t,n,i){return V(t,n,i)}function et(t,n){return!t.changes||t.changes.length===0?"no net ERC-20/native transfer delta on caller":t.changes.map(i=>`${$t(n,i.amount,i.token.decimals)} ${T(i.token.symbol)} (${i.token.address})`).join(", ")}function xt(t){if(typeof t=="bigint"){if(t<=0n)throw new u("Hookr orderId must be a positive integer.");return t}if(typeof t=="number"){if(!Number.isSafeInteger(t)||t<=0)throw new u("Hookr orderId must be a positive integer.");return BigInt(t)}if(typeof t=="string"&&/^\d+$/.test(t.trim())){let n=BigInt(t.trim());if(n<=0n)throw new u("Hookr orderId must be a positive integer.");return n}throw new u("Provide a positive integer Hookr orderId.")}function ot(t){if(t==null)return c;if(typeof t!="number"||!Number.isSafeInteger(t)||t!==c)throw new u(`Hookr limit orders are only supported on chain ${c}.`);return c}function Rt(t){switch(t){case 0:return"None";case 1:return"Open";case 2:return"Filled";case 3:return"Cancelled";default:return"Unknown"}}function Ct(t){if(Array.isArray(t)){let[n,i,o,s,r,d,g,m,b,e,l]=t;return{key:Array.isArray(n)?{currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}:n,owner:i,createdAt:o,expiry:s,zeroForOne:!!r,status:d,recipient:g,amountIn:BigInt(m),minAmountOut:BigInt(b),bounty:BigInt(e),sqrtPriceLimitX96:BigInt(l)}}if(t&&typeof t=="object"){let n=t;if(n.key&&typeof n.key=="object")return{key:{currency0:n.key.currency0,currency1:n.key.currency1,fee:Number(n.key.fee),tickSpacing:Number(n.key.tickSpacing),hooks:n.key.hooks},owner:n.owner,createdAt:n.createdAt,expiry:n.expiry,zeroForOne:!!n.zeroForOne,status:n.status,recipient:n.recipient,amountIn:BigInt(n.amountIn),minAmountOut:BigInt(n.minAmountOut),bounty:BigInt(n.bounty),sqrtPriceLimitX96:BigInt(n.sqrtPriceLimitX96)}}throw new u("HookrLimitOrders returned a malformed order tuple.")}function Dt(t){if(Array.isArray(t)&&t.length>=2)return{fillable:!!t[0],amountOut:BigInt(t[1])};if(t&&typeof t=="object"&&"fillable"in t&&"amountOut"in t){let n=t;return{fillable:!!n.fillable,amountOut:BigInt(n.amountOut)}}throw new u("HookrLimitOrders returned a malformed quoteFill response.")}function Pt(t){if(Array.isArray(t)&&t.length>=3)return{minBounty:BigInt(t[0]),defaultBounty:BigInt(t[1]),maxBounty:BigInt(t[2])};if(t&&typeof t=="object"&&"minBounty"in t&&"defaultBounty"in t&&"maxBounty"in t){let n=t;return{minBounty:BigInt(n.minBounty),defaultBounty:BigInt(n.defaultBounty),maxBounty:BigInt(n.maxBounty)}}throw new u("HookrLimitOrders returned a malformed bountyBounds response.")}async function tt(t,n,i=c){if(i!==c)throw new u(`Unsupported token chain ${i}; Hookr requires chain ${c}.`);if(Ht(n))return{...k,chainId:i};H(n);let o=a(n),s=o.toLowerCase();if(s===P.address.toLowerCase())return{address:o,symbol:P.symbol,decimals:X,chainId:i};if(s===R.address.toLowerCase())return{address:o,symbol:R.symbol,decimals:R.decimals,chainId:i};if(s===It.toLowerCase())return{address:o,symbol:"HOOKR",decimals:18,chainId:i};let[r,d]=await Promise.all([t.readContract({address:o,abi:J,functionName:"symbol"}),t.readContract({address:o,abi:J,functionName:"decimals"})]),g=typeof r=="string"&&r.trim()?r.trim():o,m=Number(d);if(!Number.isInteger(m)||m<0||m>255)throw new u(`Invalid token decimals for ${o} on chain ${i}.`);return{address:o,symbol:g,decimals:m,chainId:i}}async function Et(t){if(typeof t.getBlock!="function")throw new u("Cannot read the latest block timestamp for Hookr order expiry.");let n=await t.getBlock().catch(()=>{throw new u("Cannot read the latest block timestamp for Hookr order expiry.")});if(!n||typeof n.timestamp!="bigint"||n.timestamp<=0n)throw new u("Hookr requires a usable latest block timestamp to check order expiry.");return n.timestamp}function E(t,n=[]){let i=Q(t,"Provide a valid recipient wallet address."),o=i.toLowerCase();if(Tt.has(o)||n.some(s=>s.toLowerCase()===o))throw new u(`Recipient ${i} is a reserved protocol or zero address (invalid recipient).`);return i}function rt(t){if(t.minBountyEth!==void 0||t.minAmountOutDecimal!==void 0||t.rounding!==void 0)throw new u("Use minBounty and minAmountOut as base-unit integer strings.")}function L(t,n){if(t!==void 0){if(typeof t!="string"||!/^\d+$/.test(t))throw new u(`Provide ${n} as a base-unit integer string.`);return W(t)}}function Lt(t){return{name:"hookr_fill",inputSchema:{type:"object",properties:{orderId:{type:"string",description:"HookrLimitOrders orderId as a positive integer string."},minBounty:{type:"string",description:"Optional minimum keeper bounty in wei (decimal base-unit string)."},minAmountOut:{type:"string",description:"Optional quote pre-check only, in token base-unit integer strings. Not enforced on chain: fill(uint256) enforces only the order minAmountOut."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},required:["orderId"],additionalProperties:!1},async execute(n,i){try{rt(n),H(i);let o=a(i),s=ot(n.chainId),r=xt(n.orderId),d=t.clientFor(s),[g,m,b]=await Promise.all([d.readContract({address:y,abi:B,functionName:"getOrder",args:[r]}),d.readContract({address:y,abi:B,functionName:"quoteFill",args:[r]}),Et(d)]),e=Ct(g),l=Number(e.status),h=Rt(l);if(l===0||G(e.owner,N))throw new u(`Hookr order #${r} does not exist.`);if(l!==1)throw new u(`Hookr order #${r} is not open (current status: ${h}).`);let A=BigInt(e.expiry);if(A<b)throw new u(`Hookr order #${r} is expired (expiry ${A} < current timestamp ${b}).`);let f=Number(e.key.tickSpacing),$=Number(e.key.fee);if(!Number.isInteger(f)||f<=0)throw new u(`Hookr order #${r} has an invalid pool tickSpacing (${f}).`);if(e.amountIn<=0n||e.amountIn>Y)throw new u(`Hookr order #${r} has an invalid amountIn (${e.amountIn}).`);if(e.minAmountOut<=0n||e.minAmountOut>Y)throw new u(`Hookr order #${r} has an invalid minAmountOut (${e.minAmountOut}).`);let C=a(e.key.hooks);E(e.recipient,[C]);let it=await d.readContract({address:y,abi:B,functionName:"bountyBounds",args:[{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:$,tickSpacing:f,hooks:C},e.zeroForOne,e.amountIn,e.minAmountOut]}),w=Pt(it),D=L(n.minBounty,"minBounty"),F=D!==void 0&&D>w.minBounty?D:w.minBounty;if(e.bounty<F)throw new u(`Hookr order #${r} is underbounty: order bounty (${e.bounty} wei) is below the required keeper bounty (${F} wei).`);if(e.bounty>w.maxBounty)throw new u(`Hookr order #${r} bounty (${e.bounty} wei) exceeds maximum bounty bound (${w.maxBounty} wei).`);let I=Dt(m),ut=e.zeroForOne?e.key.currency0:e.key.currency1,st=e.zeroForOne?e.key.currency1:e.key.currency0,[x,p]=await Promise.all([tt(d,ut,s),tt(d,st,s)]),S=L(n.minAmountOut,"minAmountOut"),v=S!==void 0&&S>e.minAmountOut?S:e.minAmountOut;if(!I.fillable||I.amountOut<=0n||I.amountOut<v)throw new u(`Hookr order #${r} is not executable: quoted output (${I.amountOut} base units of ${p.address}) does not meet minimum output (${v} base units).`);let at=nt({abi:B,functionName:"fill",args:[r]}),mt=t.formatAmount(e.amountIn.toString(),x.decimals),dt=t.formatAmount(I.amountOut.toString(),p.decimals),ct=t.formatAmount(e.minAmountOut.toString(),p.decimals),lt=t.formatAmount(e.bounty.toString(),18),yt=S===void 0?"":` Caller minAmountOut ${S} base units is a quote pre-check only, not enforced on chain; fill(uint256) enforces the order minimum of ${e.minAmountOut} base units.`,q=`Fill Hookr order #${r}: maker's escrow pays ${mt} ${T(x.symbol)} (${e.amountIn} base units of ${x.address}); net output goes to ${a(e.recipient)} (quoted ${dt} ${T(p.symbol)}, order minimum ${ct} ${T(p.symbol)}, ${e.minAmountOut} base units of ${p.address}). The filler sends no tokens or ETH (value 0), pays gas, and accrues ${lt} ETH (${e.bounty} wei) bounty to ${o}, payable only via claimBounty. Pool tickSpacing ${f}; expiry ${A} inclusive.${yt}`,M=t.unsignedTx({to:y,data:at,value:"0",chainId:s,description:q}),z=await t.preview([M],o),bt=et(z,t.formatAmount),K={token:x,amount:e.amountIn.toString()},U={token:p,amount:e.minAmountOut.toString()},ft={token:p,amount:I.amountOut.toString()},j={token:{...k,chainId:s},amount:e.bounty.toString()},pt={orderId:r.toString(),key:{currency0:a(e.key.currency0),currency1:a(e.key.currency1),fee:$,tickSpacing:f,hooks:C},owner:a(e.owner),recipient:a(e.recipient),createdAt:BigInt(e.createdAt).toString(),expiry:A.toString(),zeroForOne:e.zeroForOne,status:l,statusLabel:h,amountIn:K,minAmountOut:U,bounty:j,sqrtPriceLimitX96:e.sqrtPriceLimitX96.toString()},kt={minBounty:{token:{...k,chainId:s},amount:w.minBounty.toString()},defaultBounty:{token:{...k,chainId:s},amount:w.defaultBounty.toString()},maxBounty:{token:{...k,chainId:s},amount:w.maxBounty.toString()}};return{txs:[M],summary:`${q} Preview deltas: ${bt}.`,preview:z,orderId:r.toString(),fillable:!0,amountIn:K,minAmountOut:U,quotedAmountOut:ft,bounty:j,bountyBounds:kt,order:pt}}catch(o){throw new u(t.plainError(o))}}}}function Nt(t){return{name:"hookr_claim_bounty",inputSchema:{type:"object",properties:{to:{type:"string",description:"Optional recipient address for the claimed native ETH bounty (must be the signing wallet)."},minBounty:{type:"string",description:"Optional minimum claimable bounty in wei (decimal base-unit string)."},chainId:{type:"number",description:"Target chain ID (must be 4663)."}},additionalProperties:!1},async execute(n,i){try{rt(n),H(i);let o=a(i),s=ot(n.chainId),r=n.to!==void 0&&n.to!==null?E(String(n.to)):E(o);if(r!==o)throw new u("Hookr bounty recipient must be the signing wallet.");let g=await t.clientFor(s).readContract({address:y,abi:B,functionName:"bountyOf",args:[o]}),m=BigInt(g);if(m<=0n)throw new u(`No claimable Hookr keeper bounty for ${o}.`);let b=L(n.minBounty,"minBounty");if(b!==void 0&&m<b)throw new u(`Claimable Hookr bounty (${m} wei) is below the requested minimum (${b} wei).`);let e=nt({abi:B,functionName:"claimBounty",args:[r]}),l=t.formatAmount(m.toString(),18),h=t.unsignedTx({to:y,data:e,value:"0",chainId:s,description:`Claim ${l} ETH (${m} wei) of accrued Hookr keeper bounty from ${y} to ${r}.`}),A=await t.preview([h],o),f=et(A,t.formatAmount),$={token:{...k,chainId:s},amount:m.toString()};return{txs:[h],summary:`Claim ${l} ETH (${m} wei) Hookr keeper bounty to ${r}. Preview deltas: ${f}.`,preview:A,recipient:r,claimableBounty:$}}catch(o){throw new u(t.plainError(o))}}}}async function _t(t,n){H(n);let i=a(n),o=t.clientFor(c);try{let s=await o.readContract({address:y,abi:B,functionName:"bountyOf",args:[i]}),r=BigInt(s);if(r<=0n)return[];let d=t.formatAmount(r.toString(),18);return[{module:At,id:`hookr:bounty:${i.toLowerCase()}`,chainId:c,assets:[{token:{...k,chainId:c},amount:r.toString()}],description:`Hookr claimable keeper bounty (${d} ETH)`}]}catch(s){throw new u(t.plainError(s))}}var _=t=>({tools:[Lt(t),Nt(t)],positions:n=>_t(t,n)}),Vt=_,Gt=_,Qt=_;export{At as a,y as b,wt as c,Ot as d,Bt as e,ht as f,It as g,B as h,$t as i,Wt as j,Lt as k,Nt as l,_t as m,_ as n,Vt as o,Gt as p,Qt as q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,g as i}from"./LVFI74ST.js";import{a as n}from"./SPJCSEKP.js";import{a as t}from"./XSD5NL7J.js";async function m(r,c,o){if(!Object.hasOwn(a,r.name))throw new t("Local Factor guard cannot rebuild this action; nothing was signed.");if(r.chainId!==void 0&&r.chainId!==4663)throw new t("Local Factor guard requires chain 4663; nothing was signed.");let e=async()=>{throw new t("Local Factor reconstruction uses no swap or preview service.")},s=n({clientFor:d=>{if(d!==4663)throw new t("Local Factor guard requires chain 4663.");return o.client},http:o.http??fetch,preview:e,quoteSwap:e,buildSwap:e});return i(s,r.name,r.args,c)}export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./DFM4T6ZE.js";import{a as p,e as y}from"./JESMX2UC.js";import{o as v}from"./DNNFKDZR.js";import{a as f}from"./66F5ZH34.js";import{a as l}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as w,getAddress as a,parseAbi as I}from"viem";var P="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",$="(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)",g=I([`function swapExactIn(${P} key,bool zeroForOne,uint128 amountIn,uint256 minOut,uint160 sqrtPriceLimitX96,address to,uint256 deadline) returns (uint256 paid,uint256 out)`,`function exactInputSingle(${$} params) payable returns (uint256 amountOut)`,"function multicall(uint256 deadline,bytes[] data) payable returns (bytes[] results)"]),E=I(["function quoteExactInputSingle((address tokenIn,address tokenOut,uint256 amountIn,uint24 fee,uint160 sqrtPriceLimitX96) params) returns (uint256 amountOut,uint160 sqrtPriceX96After,uint32 initializedTicksCrossed,uint256 gasEstimate)"]),_=I([`function quoteExactInputSingle((${P} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)`]),C="0x0000000000000000000000000000000000000000",h={symbol:{type:"string",enum:m.tokens.map(e=>e.symbol),description:'Official stock ticker with a published Priors pool. Example: "TSLA".'},side:{type:"string",enum:["buy","sell"],description:'Choose "buy": pay USDG for the stock token; "sell": pay the stock token for USDG.'},amountIn:f('Input amount in base units: USDG (6 decimals) to buy, or the stock token (its decimals) to sell. Example: "1000000" = 1 USDG.')};async function O(e,o){let n=m.tokens.find(s=>s.symbol===e.symbol);if(!n||e.side!=="buy"&&e.side!=="sell")throw new u("Choose a published stock symbol and buy or sell.");let t=await v(String(e.symbol),{context:o});if(t.kind!=="official_stock"||t.address!==a(n.token))throw new u("Published Priors stock pool does not match the official stock contract address. Retry after the pool mapping is updated.");let r=y(e.amountIn,"amountIn",128);if(r===0n)throw new u("amountIn must be positive base units.");return{token:n,identity:t,amount:r,input:e.side==="buy"?p.usdg:a(n.token),output:e.side==="buy"?a(n.token):p.usdg}}function x(e,o,n){let[t,r]=BigInt(p.usdg)<BigInt(e)?[p.usdg,e]:[e,p.usdg];return{currency0:t,currency1:r,fee:o,tickSpacing:n,hooks:C}}function R(e){return{tools:[{name:"priors_stock_quote",inputSchema:{type:"object",properties:h,required:Object.keys(h),additionalProperties:!1},async execute(o,n){if(e.network==="testnet")throw new u("Priors stock swaps require mainnet chain 4663.");let t=await O(o,e),r=e.clientFor(l),s=await r.getBlockNumber({cacheTime:0}),k=await Promise.all(t.token.pools.map(async(i,d)=>{try{let c=x(a(t.token.token),i.fee,"tickSpacing"in i?i.tickSpacing:0),b=i.v===3?await r.simulateContract({address:a(m.v3.quoter),abi:E,functionName:"quoteExactInputSingle",args:[{tokenIn:t.input,tokenOut:t.output,amountIn:t.amount,fee:i.fee,sqrtPriceLimitX96:0n}],account:n,blockNumber:s}):await r.simulateContract({address:a(m.v4.quoter),abi:_,functionName:"quoteExactInputSingle",args:[{poolKey:c,zeroForOne:t.input===c.currency0,exactAmount:t.amount,hookData:"0x"}],account:n,blockNumber:s});return{poolIndex:d,version:i.v,amountOut:b.result[0].toString()}}catch(c){return{poolIndex:d,version:i.v,error:e.plainError(c)}}}));return{chainId:l,blockNumber:s.toString(),token:t.identity,quotes:k,warning:"Use explicit minimum output with priors_stock_swap and inspect its preview. Issuer restrictions can prevent sale. Quote is no promise of an exit; local regional eligibility remains required."}}},{name:"priors_stock_swap",inputSchema:{type:"object",properties:{...h,poolIndex:{type:"integer",minimum:0,maximum:2,description:"Index of the published pool to use, from priors_stock_quote (0 to 2)."},minOut:f("Minimum output in base units: the stock token when buying, USDG (6 decimals) when selling. Must be positive."),deadline:f("Deadline in Unix seconds, within the next 30 minutes. Example: 1800000000."),eligible:{type:"boolean",description:"Operator/user affirms eligibility for this stock-token trade in their jurisdiction."}},required:[...Object.keys(h),"poolIndex","minOut","deadline","eligible"],additionalProperties:!1},async execute(o,n){if(e.network==="testnet")throw new u("Priors stock swaps require mainnet chain 4663.");if(n=a(n),o.eligible!==!0)throw new u("Confirm local eligibility for Robinhood stock tokens before trading.");let t=await O(o,e),r=y(o.minOut,"minOut"),s=y(o.deadline,"deadline"),k=BigInt(Math.floor(Date.now()/1e3));if(r===0n||s<=k||s>k+1800n||!Number.isSafeInteger(o.poolIndex))throw new u("Provide positive minOut, poolIndex and a deadline within 30 minutes.");let i=t.token.pools[o.poolIndex];if(!i)throw new u("No published pool at that index. Read priors_stock_quote.");let d=x(a(t.token.token),i.fee,"tickSpacing"in i?i.tickSpacing:0),c=t.input===d.currency0,b=a(i.v===3?m.v3.router:m.v4.swapper),q=i.v===3?w({abi:g,functionName:"multicall",args:[s,[w({abi:g,functionName:"exactInputSingle",args:[{tokenIn:t.input,tokenOut:t.output,fee:i.fee,recipient:n,amountIn:t.amount,amountOutMinimum:r,sqrtPriceLimitX96:0n}]})]]}):w({abi:g,functionName:"swapExactIn",args:[d,c,t.amount,r,c?4295128740n:1461446703485210103287273052203988822378723970341n,n,s]}),S=[e.approval(t.input,b,t.amount.toString(),l),e.unsignedTx({to:b,data:q,value:"0",chainId:l,description:`Priors stock ${o.side}: ${t.amount} input base units; minimum ${r}; pinned V${i.v} pool.`})],A=await e.preview(S,n);return{txs:S,expiresAt:s.toString(),summary:`Stock ${o.side} ${o.symbol}: input ${t.amount} base units (${t.input}), minimum output ${r} (${t.output}), receiver ${n}, deadline ${s}. Issuer transfer/sale restrictions apply. Price impact is not measured by this builder; inspect minOut and the preview. ${A.summary}`}}}]}}export{g as a,R as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as j}from"./VTPT5544.js";import{a as O}from"./EZZM2GQT.js";import{j as E}from"./2GXHYI23.js";import{b as D}from"./SPJCSEKP.js";import{a as R}from"./43LI5NKJ.js";import{c as H}from"./SCG5HWMN.js";import{c as b,e as h,g as v,i as _,l as B}from"./NWNYJ26T.js";import{b as L}from"./IX3GZMTM.js";import{a as u,i as M}from"./FWD4L3CJ.js";import{a as p}from"./XSD5NL7J.js";import{a as z}from"./JXOEJPJ4.js";import{encodeFunctionData as S,parseAbi as ne,zeroAddress as P}from"viem";import{encodeAbiParameters as F,encodeFunctionData as X,keccak256 as U,parseAbi as Y}from"viem";var I=M[u].merkl.distributor.address,A="Claim rewards on Merkl (Powered by Merkl \u2014 https://app.merkl.xyz)",W=`${A}. No claimable rewards on Robinhood Chain. Pending rewards must settle into a Merkle root before they can be claimed.`,C=Y(["function claimed(address user,address token) view returns (uint208 amount,uint48 timestamp,bytes32 merkleRoot)","function getMerkleRoot() view returns (bytes32)","function claim(address[] users,address[] tokens,uint256[] amounts,bytes32[][] proofs)"]);function J(s){return typeof s=="string"&&/^0x[0-9a-fA-F]{64}$/.test(s)}function k(){throw new p("Merkl returned an unexpected response. Please refetch rewards.")}function T(s){typeof s!="string"&&k();let d=L(s);if(d>=1n<<256n)throw new p("The Merkl reward amount exceeds the uint256 range.");return d.toString()}function ee(s){let d=[],m=new Set;for(let c of s)if((!h(c)||!h(c.chain)||!Number.isSafeInteger(c.chain.id))&&k(),c.chain.id===u){Array.isArray(c.rewards)||k();for(let r of c.rewards){if((!h(r)||typeof r.distributionLayer!="string"||!h(r.token))&&k(),r.distributionLayer!=="TREE"||(Number.isSafeInteger(r.token.chainId)||k(),r.token.chainId!==u)||(Array.isArray(r.proofs)||k(),!r.proofs.length))continue;(!r.proofs.every(J)||typeof r.token.address!="string"||typeof r.token.symbol!="string"||!r.token.symbol.trim()||typeof r.token.decimals!="number"||!Number.isInteger(r.token.decimals)||r.token.decimals<0||r.token.decimals>255)&&k(),R(r.token.address);let t=T(r.amount),n=T(r.pending);if(BigInt(t)===0n)continue;let e=r.token.address.toLowerCase();if(m.has(e))throw new p("Merkl returned duplicate token leaves. Please refetch rewards.");m.add(e),d.push({token:{address:r.token.address,chainId:u,decimals:r.token.decimals,symbol:r.token.symbol},amount:t,pending:n,proofs:r.proofs})}}return d}function re(s,d,m){let c=U(F([{type:"address"},{type:"address"},{type:"uint256"}],[s,d.token.address,BigInt(d.amount)]));for(let r of d.proofs){let t=BigInt(c)<BigInt(r)?[c,r]:[r,c];c=U(F([{type:"bytes32"},{type:"bytes32"}],t))}if(!v(c,m))throw new p("The Merkl proof does not match the active root. Please refetch rewards.")}function Z(s){if(!h(s)||Object.keys(s).length)throw new p("This Merkl tool takes no arguments and uses the connected wallet.")}async function q(s,d){let m=await K(s,d),c=new Map,r=[],t=new Set;for(let n of m)if((!h(n)||!h(n.chain)||!Number.isSafeInteger(n.chain.id))&&k(),n.chain.id===u){Array.isArray(n.rewards)||k();for(let e of n.rewards){if((!h(e)||typeof e.distributionLayer!="string"||!h(e.token)||!Number.isSafeInteger(e.token.chainId))&&k(),e.token.chainId!==u)continue;(typeof e.token.address!="string"||typeof e.token.symbol!="string"||!e.token.symbol.trim()||typeof e.token.decimals!="number"||!Number.isInteger(e.token.decimals)||e.token.decimals<0||e.token.decimals>255)&&k(),R(e.token.address);let a=T(e.amount),i=T(e.pending),o=`${e.distributionLayer}:${e.token.address.toLowerCase()}`;if(t.has(o))throw new p("Merkl returned duplicate earning rows. Please refetch rewards.");t.add(o);let l={address:e.token.address,symbol:e.token.symbol,decimals:e.token.decimals,chainId:u},f="0";if(e.distributionLayer==="TREE"){let g=await s.clientFor(u).readContract({address:I,abi:C,functionName:"claimed",args:[d,l.address]});(!Array.isArray(g)||typeof g[0]!="bigint"||g[0]<0n||g[0]>=1n<<208n)&&k(),f=g[0].toString(),c.set(l.address.toLowerCase(),f)}r.push({token:l,amount:a,pending:i,claimed:f,claimable:"0",distributionLayer:e.distributionLayer,status:e.distributionLayer!=="TREE"?"unsupported_distribution_layer":BigInt(a)>BigInt(f)?"awaiting_verified_proof":BigInt(i)>0n?"pending_settlement":"settled"})}}return{body:m,earnings:r,claimedSnapshot:c}}async function K(s,d){return R(d),H(s.http,`https://api.merkl.xyz/v4/users/${d}/rewards/summary?chainId=${u}`,{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},m=>Array.isArray(m))}async function x(s,d,m){return N(s,d,m)}async function N(s,d,m,c){R(d);let r=ee(m??await K(s,d)),t=s.clientFor(u),n=[];for(let a of r){let i=c?.get(a.token.address.toLowerCase());if(i===void 0){let o=await t.readContract({address:I,abi:C,functionName:"claimed",args:[d,a.token.address]});if(!Array.isArray(o)||typeof o[0]!="bigint"||o[0]<0n||o[0]>=1n<<208n)throw new p("The Merkl claimed balance could not be read. Please try again.");i=o[0].toString()}BigInt(a.amount)<=BigInt(i)||n.push({...a,claimed:i,claimable:(BigInt(a.amount)-BigInt(i)).toString()})}if(!n.length)return[];let e=await t.readContract({address:I,abi:C,functionName:"getMerkleRoot"});if(!J(e))throw new p("The active Merkl root could not be read. Please try again.");for(let a of n)re(d,a,e);return n}var te=s=>{async function d(t){try{return await t()}catch(n){throw new p(s.plainError(n))}}function m(t){let n=t.amount.startsWith("-"),e=n?t.amount.slice(1):t.amount;return`${n?"-":""}${s.formatAmount(e,t.token.decimals)} ${z(t.token.symbol)} (${t.token.address}, chain ${t.token.chainId}, ${t.token.decimals} decimals)`}let c=t=>x(s,t);return{tools:[{name:"merkl_rewards",description:"Read claimable rewards (Powered by Merkl \u2014 https://app.merkl.xyz).",inputSchema:{type:"object",properties:{},additionalProperties:!1,description:"Read rewards (Powered by Merkl \u2014 https://app.merkl.xyz)."},execute:(t,n)=>d(async()=>{Z(t);let{body:e,earnings:a,claimedSnapshot:i}=await q(s,n),o=await N(s,n,e,i);for(let l of a){let f=o.find(g=>v(g.token.address,l.token.address)&&l.distributionLayer==="TREE");f&&(l.claimed=f.claimed,l.claimable=f.claimable,l.status="claimable")}return{earnings:a,rewards:o.map(({proofs:l,...f})=>f),summary:o.length?`${A}. Claimable reward leaves: ${o.map(l=>m({token:l.token,amount:l.claimable})).join("; ")}. Wrapped leaves may transfer underlying tokens; claim preview shows the received assets. Pending rewards appear separately in earnings and are excluded from claimable amounts.`:`${W} Earnings include pending-only and unsupported distribution layers; an unverified amount is never presented as claimable.`}})},{name:"merkl_claim",description:A,inputSchema:{type:"object",properties:{},additionalProperties:!1,description:A},execute:(t,n)=>d(async()=>{Z(t);let e=await c(n);if(!e.length)return{txs:[],summary:W};let a=[s.unsignedTx({to:I,chainId:u,value:"0",description:A,data:X({abi:C,functionName:"claim",args:[e.map(()=>n),e.map(o=>o.token.address),e.map(o=>BigInt(o.amount)),e.map(o=>o.proofs)]})})],i=await s.preview(a,n);return{txs:a,summary:`${A}. Prepared unsigned claim. Expected wallet changes: ${i.changes.length?i.changes.map(m).join("; "):"no token transfers in simulation"}. ${i.summary}`}})}],positions:t=>d(async()=>{let{body:n,earnings:e,claimedSnapshot:a}=await q(s,t),i=await N(s,t,n,a);return e.flatMap(o=>{let l=o.distributionLayer==="TREE"?i.find(V=>v(V.token.address,o.token.address)):void 0,f=BigInt(o.pending)>0n;if(!l&&!f)return[];let g="Merkl pending rewards are not yet claimable and are excluded from valuation.";return[{module:"merkl",id:`${u}:${o.token.address.toLowerCase()}${o.distributionLayer==="TREE"?"":`:${o.distributionLayer}`}`,chainId:u,assets:l?[{token:l.token,amount:l.claimable}]:[],economics:{principal:[],debt:[],backing:[],coverage:f?{complete:!1,reason:g}:{complete:!0},rewards:[...l?[E("claimable",{token:l.token,amount:l.claimable,source:"merkl.claimable",claim:{tool:"merkl_claim",args:{}}})]:[],...f?[E("unpaid",{token:o.token,amount:null,source:"merkl.pending",unknownReason:g})]:[]]},description:`${A}. Unclaimed reward leaf; wrapped rewards may transfer underlying assets. Pending rewards are excluded from valuation.`}]})})}},ge=s=>D("merkl",[te(s),O(s),G(s),j(s)]);var $=M[u].merkl.distributor.address,w=ne(["function operators(address,address) view returns (uint256)","function claimRecipient(address,address) view returns (address)","function toggleOperator(address,address)","function setClaimRecipient(address,address)","function claim(address[],address[],uint256[],bytes32[][])","function claimWithRecipient(address[],address[],uint256[],bytes32[][],address[],bytes[])"]),Q="Provide a valid address.";function y(s,d=!1){let m=_(s,Q);return d?m:B(m,Q)}var G=s=>{let d=()=>s.clientFor(u),m=async(r,t,n)=>{let e=[s.unsignedTx({to:$,chainId:u,value:"0",data:r,description:t})],a=await s.preview(e,n);return{txs:e,preview:a,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${t} ${a.summary}`}},c=(r,t,n,e)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:t,required:n,additionalProperties:!1},execute:async(a,i)=>{try{let o=Object.keys(a).find(l=>!Object.hasOwn(t,l));if(o)throw new p(`Unsupported Merkl input: ${o}.`);return await e(a,y(i))}catch(o){throw new p(s.plainError(o))}}});return{tools:[c("claim_config",{token:{...b,description:"Reward token address; zero address selects the global setting where supported."},operator:{...b,description:"Address of the operator whose claim permission is read or changed."}},[],async(r,t)=>{let n=y(r.token??P,!0),e=y(await d().readContract({address:$,abi:w,functionName:"claimRecipient",args:[t,P]}),!0),a=y(await d().readContract({address:$,abi:w,functionName:"claimRecipient",args:[t,n]}),!0),i;if(r.operator!==void 0){let o=await d().readContract({address:$,abi:w,functionName:"operators",args:[t,y(r.operator,!0)]});if(o!==0n&&o!==1n)throw new p("Merkl returned invalid operator authorization.");i=o===1n}return{chainId:u,wallet:t,token:n,defaultRecipient:e,tokenRecipient:a,effectiveRecipient:a!==P?a:e!==P?e:t,...i===void 0?{}:{operatorEnabled:i},summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Zero recipient restores self-claims. Token overrides take precedence over the global recipient."}}),c("set_operator",{operator:{...b,description:"Address of the operator whose claim permission is read or changed."},enabled:{type:"boolean",description:"true grants claim permission; false revokes it."}},["operator","enabled"],async(r,t)=>{let n=y(r.operator,!0);if(typeof r.enabled!="boolean")throw new p("Provide enabled as boolean.");let e=await d().readContract({address:$,abi:w,functionName:"operators",args:[t,n]});if(e!==0n&&e!==1n)throw new p("Merkl returned invalid operator authorization.");return e===1n===r.enabled?{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Operator already has the requested state; no transaction needed."}:m(S({abi:w,functionName:"toggleOperator",args:[t,n]}),`${r.enabled?"Authorize":"Revoke"} Merkl claims by ${n} for ${t}. Zero operator grants permissionless claiming; configured recipients still apply. The contract toggles the observed state; preview and confirmation must remain current.`,t)}),c("set_recipient",{recipient:{...b,description:"Address to receive rewards; zero restores the default where supported."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."}},["recipient"],async(r,t)=>{let n=y(r.recipient,!0),e=y(r.token??P,!0);return m(S({abi:w,functionName:"setClaimRecipient",args:[n,e]}),`Set Merkl reward recipient for ${e===P?"all tokens":e} to ${n===P?`self (${t})`:n}. This redirects future claims; token-specific overrides remain authoritative.`,t)}),c("claim_to",{recipient:{...b,description:"Address to receive rewards; zero restores the default where supported."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."},data:{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:16386,description:"Optional recipient callback data as 0x-prefixed hex bytes."}},["recipient"],async(r,t)=>{let n=y(r.recipient),e=r.token===void 0?void 0:y(r.token),a=r.data??"0x";if(typeof a!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(a)||a.length>16386)throw new p("Provide callback data as at most 8192 hexadecimal bytes.");let i=(await x(s,t)).filter(o=>!e||v(o.token.address,e));return i.length?m(S({abi:w,functionName:"claimWithRecipient",args:[i.map(()=>t),i.map(o=>o.token.address),i.map(o=>BigInt(o.amount)),i.map(o=>o.proofs),i.map(()=>n),i.map(()=>a)]}),`Claim ${i.map(o=>`${o.claimable} ${o.token.symbol} base units (token ${o.token.address}, decimals ${o.token.decimals})`).join("; ")} to ${n}, overriding saved claim recipients for this claim only. Callback data for each leaf: ${a}. Inspect all callback effects in preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for the selected token."}}),c("claim_for",{user:{...b,description:"Address of the user whose rewards are claimed."},token:{...b,description:"Reward token address; zero address selects the global setting where supported."}},["user"],async(r,t)=>{let n=y(r.user),e=r.token===void 0?void 0:y(r.token),a=(await x(s,n)).filter(i=>!e||v(i.token.address,e));return a.length?m(S({abi:w,functionName:"claim",args:[a.map(()=>n),a.map(i=>i.token.address),a.map(i=>BigInt(i.amount)),a.map(i=>i.proofs)]}),`Claim Merkl rewards for ${n}; caller ${t} pays gas. The user's saved recipients control payment. Claim authorization and actual receipts must pass preview.`,t):{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. No verified claimable rewards for this user."}})]}};export{G as a,x as b,te as c,ge as d};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as w,b as r}from"./7VC53B5X.js";function n(e){return{text:e}}var h="borro.markets",k=n("Borro: lend your {symbol} to borrowers through Borro's vault."),R=n("Borro is an official Oak partner. Borro's own team runs its product and contracts; Oak didn't build them and doesn't run them."),E=n("Borro keeps {fee_pct}% of the interest as its fee."),A=n("Borro keeps part of the interest as its fee, and I couldn't read how much."),x=n("Reward: about {borro_rate}% a year today, which changes. {fee_clause} {comparison_clause}"),O=n("Reward: lending {symbol} pays about {borro_rate}% a year today, which changes. {fee_clause}"),S=n("Reward: lending {symbol} pays about {borro_rate}% a year today, which is close to nothing and changes. {fee_clause}"),g=n("I couldn't confirm Borro's rate in the last few minutes, so I can't tell you what this pays today. borro_list shows it when Borro's page is current."),T=n(`Reward: ${g.text} {fee_clause}`),_=n("The catch: you are lending {symbol}, a stock token, not dollars. If its price falls, what you get back is worth less in dollars, even though the {symbol} count is what you lent. The company that issues the token can also pause or restrict it."),N=n("LayerBank on Robinhood Chain pays about {lb_rate}% a year on USDG today, so LayerBank pays more."),C=n("LayerBank on Robinhood Chain pays about {lb_rate}% a year on USDG today, so Borro pays more."),I=n("LayerBank on Robinhood Chain pays about {lb_rate}% a year on USDG today, so they pay about the same."),B=n("I couldn't read {the_other} rate, so I can't compare them right now."),v=n("Borro is {age_phrase} old and has had no outside security check"),D=n("Borro's age couldn't be read, and it has had no outside security check"),L=n("A {threshold}-of-{owners} group wallet"),U=n("A wallet Oak could not inspect"),P=n("{age_clause}; its own page says only internal reviews were done. {controller_clause} controls the vault and can change where the money is lent. If Borro's code fails, or the people who control it make a harmful change, you could lose money."),F=n("Risk: {risk_clause}"),$=n(`Taking it out: you can take your money out when the vault has cash on hand. Right now about {ready} {symbol} of the {total} {symbol} lent in is ready; the rest is out with borrowers and can take time to come back. You can also take it out on ${h} with this wallet.`),K=n("Taking it out: you can take your money out when the vault has cash on hand. Right now all {total} {symbol} lent in is ready."),M=n(`Taking it out: you can take your money out when the vault has cash on hand. I couldn't read how much is ready to take out right now; money that is out with borrowers can take time to come back. You can also take it out on ${h} with this wallet.`),W=n("Cost: about {gas_in_usd} in network fees to put it in and about {gas_out_usd} to take it out."),Y=n("Cost: I couldn't read the network fees right now."),G=n("Cost: I couldn't price the network fees in dollars right now. The most you can pay, in ETH, is on the line below."),q=n("Rates shown leave out any $BORRO incentive."),H=n(`Lend {amount} {symbol} to Borro?
|
|
2
|
+
|
|
3
|
+
Borro is an official Oak partner. Borro's own team runs its product and contracts; Oak didn't build them and doesn't run them.
|
|
4
|
+
What you get: {reward_clause} {stock_catch_clause}
|
|
5
|
+
What happens: {amount} {symbol} leaves your wallet and becomes about {shares} "{vault_symbol}" tokens, your receipt for money lent through Borro. Oak's preview checks that you would get at least {shares_min}, but Borro's contract doesn't enforce a minimum, so the final amount can differ slightly.
|
|
6
|
+
The risk: {risk_clause}
|
|
7
|
+
Taking it out: {taking_out_clause}
|
|
8
|
+
{cost_line}
|
|
9
|
+
|
|
10
|
+
Lend {amount} {symbol}? [Yes] [No]`),V=n("about {borro_rate}% a year at today's rate, which changes."),j=n(`when the vault has cash on hand. Right now about {ready} {symbol} is ready of the {total} {symbol} lent in. Also possible on ${h} with this wallet.`),z=n(`when the vault has cash on hand. I couldn't read how much is ready right now. Also possible on ${h} with this wallet.`),Z=n("Cost: about {gas_in_usd} in network fees now and about {gas_out_usd} to take it out."),Q=n(`Take {amount_or_all} {symbol} out of Borro?
|
|
11
|
+
|
|
12
|
+
You get back about {out} {symbol} for {shares} "{vault_symbol}" tokens (what you lent plus interest so far). Oak's preview checks the amount, but the contract doesn't enforce a minimum, so it can differ slightly.
|
|
13
|
+
{liquidity_note}
|
|
14
|
+
{drift_notice}
|
|
15
|
+
{cost_line}
|
|
16
|
+
|
|
17
|
+
Take it out? [Yes] [No]`),J=n("Borro's vault only has about {ready} {symbol} ready right now, so I can take out {max_now} {symbol} today. Say so if you want that smaller amount."),X=n("Cost: about {gas_out_usd} in network fees."),tt=n("Borro's setup has changed since Oak checked it; the exit below was checked against the live contract."),et=n("I could not verify {vault_label} on chain, so Oak won't offer it. Nothing was signed."),ot=n("Borro's setup no longer matches what Oak checked. Nothing was signed."),nt=n("Borro only has {ready} {symbol} ready to take out right now, and you asked for {requested} {symbol}. I can take out {max_now} {symbol} now, or you can wait for more to come back."),rt=n("Borro only has {ready} {symbol} ready to take out right now, and you asked for {requested} {symbol}. None can be taken out today, so you can wait for more to come back."),st=n("This wallet has nothing lent on Borro for {symbol}."),at=n("Borro's vault wouldn't take this deposit right now (it may be full or paused). Nothing was signed."),it=n("New on Borro: the {symbol} vault. Oak checked it on the chain just now and it passes Oak's checks."),lt=n(`If you also borrowed, shorted or used credit on ${h}, Oak's view doesn't include that.`),At={CARD_INTRO:k,INDEPENDENCE:R,FEE_CLAUSE:E,FEE_CLAUSE_UNREADABLE:A,REWARD_USDG:x,REWARD_STOCK:O,REWARD_STOCK_LOW:S,RATE_UNREADABLE:g,REWARD_UNREADABLE:T,STOCK_CATCH:_,COMPARE_LAYERBANK_HIGHER:N,COMPARE_BORRO_HIGHER:C,COMPARE_SAME:I,COMPARE_UNREADABLE:B,AGE_CLAUSE:v,AGE_CLAUSE_UNKNOWN:D,CONTROLLER_SAFE:L,CONTROLLER_UNKNOWN:U,RISK_CLAUSE:P,RISK_LINE:F,TAKING_OUT:$,TAKING_OUT_ALL_READY:K,TAKING_OUT_UNREADABLE:M,CARD_COST:W,CARD_COST_UNREADABLE:Y,COST_UNREADABLE:G,NOTES_INCENTIVE:q,DEPOSIT_SCREEN:H,SCREEN_REWARD:V,SCREEN_TAKING_OUT:j,SCREEN_TAKING_OUT_UNREADABLE:z,DEPOSIT_COST:Z,WITHDRAW_SCREEN:Q,LIQUIDITY_NOTE:J,WITHDRAW_COST:X,DRIFT_NOTICE:tt,UNVERIFIED_REFUSAL:et,SETUP_MISMATCH:ot,TOO_LITTLE_READY:nt,NOTHING_READY:rt,NO_SHARES:st,DEPOSIT_WOULD_REVERT:at,NEW_VAULT_NOTICE:it,POSITIONS_NOTE:lt},xt=[/\bours?\b/i,/\bOak (?:owns?|runs?|operates?|built) Borro\b/i,/\bbuilt by\b/i,/\bOak's Borro\b/i,/\bour (?:vault|project)/i,/\bSafe\b/,/\bRobinhood\b(?! Chain)/,/\bfork\b/i,/\bpractice copy\b/i,/\banvil\b/i,/evm_increaseTime/i,/\bunlisted\b/i,/\bpinned\b/i];function y(e){return e.toFixed(2).replace(/\.?0+$/,"")}function l(e){return typeof e=="number"&&Number.isFinite(e)}var p=/^[A-Za-z0-9.$_-]{1,16}$/,yt=/^0x[0-9a-fA-F]{40}$/;function u(e){if(!p.test(e))throw new Error("Borro copy refused an asset symbol that is not a plain token symbol.");return e}function ut(e){return p.test(e)?e:"Borro vault shares"}function c(e,t){let o=t,s=[];for(let a of e.text.split(`
|
|
18
|
+
`)){let i=/^\{([a-z][a-z0-9_]*)\}$/.exec(a);i&&o[i[1]]===""||s.push(r(n(a),o).trimEnd())}return s.join(`
|
|
19
|
+
`)}var ht=86400,b=/^(\d+)(?:\.(\d+))?$/,mt=4;function d(e){let t=b.exec(e);if(!t)return e;let o=(t[2]??"").slice(0,mt).replace(/0+$/,"");return o?`${t[1]}.${o}`:t[1]}function bt(e,t){let o=b.exec(e),s=b.exec(t);if(!o||!s)return!1;let a=Math.max(o[2]?.length??0,s[2]?.length??0),i=m=>BigInt(m[1]+(m[2]??"").padEnd(a,"0"));return i(o)>=i(s)}function gt(e,t){if(!l(e)||!Number.isFinite(t)||e<=0)return;let o=(t-e)/ht;if(!(o<0)){if(o<1)return"under a day";if(o<14){let s=Math.floor(o);return s===1?"1 day":`${s} days`}return o<45?"about a month":`about ${Math.max(2,Math.round(o/30))} months`}}var _t=.05;function pt(e,t){let o=l(e),s=l(t);if(!o||!s)return r(B,{the_other:!o&&!s?"either":o?"LayerBank's":"Borro's"});let a=y(t),i=e-t;return Math.abs(i)<_t?r(I,{lb_rate:a}):r(i>0?C:N,{lb_rate:a})}function ct(e){let t=gt(e.deployedAtSeconds,e.nowSeconds),o=t===void 0?r(D,{}):r(v,{age_phrase:t}),a=Number.isInteger(e.threshold)&&Number.isInteger(e.owners)&&e.threshold>0&&e.owners>0&&e.threshold<=e.owners?r(L,{threshold:String(e.threshold),owners:String(e.owners)}):r(U,{});return r(P,{age_clause:o,controller_clause:a})}function ft(e){return l(e)?r(E,{fee_pct:y(e)}):r(A,{})}function f(e,t,o=G){let s={gas_in_usd:t.in,gas_out_usd:t.out};return w(e).some(i=>!s[i])?r(o,{}):r(e,s)}function wt(e){let t={...e,symbol:u(e.symbol)},o=l(t.borroRatePct),s=ft(t.feePct),a;o?t.kind==="usdg"?a=c(x,{borro_rate:y(t.borroRatePct),fee_clause:s,comparison_clause:pt(t.borroRatePct,t.layerbankRatePct)}):a=c(t.borroRatePct<1?S:O,{symbol:t.symbol,borro_rate:y(t.borroRatePct),fee_clause:s}):a=c(T,{fee_clause:s});let i;return t.readyAmount===void 0||t.totalAmount===void 0?i=r(M,{}):bt(t.readyAmount,t.totalAmount)?i=r(K,{total:d(t.totalAmount),symbol:t.symbol}):i=r($,{ready:d(t.readyAmount),total:d(t.totalAmount),symbol:t.symbol}),{intro:r(k,{symbol:t.symbol}),independence:r(R,{}),reward:a,...t.kind==="stock"?{catch:r(_,{symbol:t.symbol})}:{},risk:r(F,{risk_clause:ct(t)}),takingOut:i,cost:f(W,{in:t.gasInUsd,out:t.gasOutUsd},Y),notes:r(q,{})}}function Ot(e){let t=wt(e),{intro:o,independence:s,reward:a,risk:i,takingOut:m,cost:dt}=t;return[o,"",s,a,...t.catch?[t.catch]:[],i,m,dt].join(`
|
|
20
|
+
`)}function St(e){let t={...e,symbol:u(e.symbol),vaultSymbol:ut(e.vaultSymbol)},o=l(t.borroRatePct),s=t.readyAmount!==void 0&&t.totalAmount!==void 0;return c(H,{amount:t.amount,symbol:t.symbol,reward_clause:o?r(V,{borro_rate:y(t.borroRatePct)}):r(g,{}),stock_catch_clause:t.kind==="stock"?r(_,{symbol:t.symbol}):"",shares:t.shares,vault_symbol:t.vaultSymbol,shares_min:t.sharesMin,risk_clause:ct(t),taking_out_clause:s?r(j,{ready:d(t.readyAmount),total:d(t.totalAmount),symbol:t.symbol}):r(z,{}),cost_line:f(Z,{in:t.gasInUsd,out:t.gasOutUsd})})}function Tt(e){let t={...e,symbol:u(e.symbol),vaultSymbol:ut(e.vaultSymbol)};return c(Q,{amount_or_all:t.isAll?`all ${t.amount}`:t.amount,symbol:t.symbol,out:t.out,shares:t.shares,vault_symbol:t.vaultSymbol,liquidity_note:t.liquidity?r(J,{ready:t.liquidity.ready,symbol:t.symbol,max_now:t.liquidity.maxNow}):"",drift_notice:t.drift?r(tt,{}):"",cost_line:f(X,{out:t.gasOutUsd})})}function Nt(e){return r(it,{symbol:u(e)})}function Ct(){return r(lt,{})}function kt(e){return e===void 0||/^[0.,\s]*$/.test(e)}function It(e,t){switch(e){case"unverified":{let o=t.vaultLabel,s=o&&yt.test(o)?`the vault at ${o}`:o&&p.test(o)?`the ${o} vault`:"this vault";return r(et,{vault_label:s})}case"setup-mismatch":return r(ot,{});case"too-little-ready":{let o=t,s=u(o.symbol);return kt(o.maxNow)?r(rt,{ready:o.ready,requested:o.requested,symbol:s}):r(nt,{ready:o.ready,requested:o.requested,max_now:o.maxNow,symbol:s})}case"no-shares":return r(st,{symbol:u(t.symbol)});case"deposit-would-revert":return r(at,{});default:throw new Error(`Unknown Borro refusal kind: ${String(e)}`)}}export{h as a,k as b,R as c,E as d,A as e,x as f,O as g,S as h,g as i,T as j,_ as k,N as l,C as m,I as n,B as o,v as p,D as q,L as r,U as s,P as t,F as u,$ as v,K as w,M as x,W as y,Y as z,G as A,q as B,H as C,V as D,j as E,z as F,Z as G,Q as H,J as I,X as J,tt as K,et as L,ot as M,nt as N,rt as O,st as P,at as Q,it as R,lt as S,At as T,xt as U,y as V,d as W,gt as X,_t as Y,pt as Z,ct as _,wt as $,Ot as aa,St as ba,Tt as ca,Nt as da,Ct as ea,It as fa};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as O}from"./L646YWDP.js";import{a as V}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{g as D}from"./NWNYJ26T.js";import{a as v,i as _}from"./FWD4L3CJ.js";import{a as r}from"./XSD5NL7J.js";import{decodeAbiParameters as E,encodeAbiParameters as K,encodeFunctionData as h,getAddress as P,keccak256 as Y,parseAbi as H,parseAbiParameters as B}from"viem";var y=P("0xCe5c1aFa115fF8b1D6913509bfc79D9AE08CC857"),G=P("0x0FBad98595b0186dA120E41f77C102beb49f803c"),N=B("(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)"),A="(address loanToken,address collateralToken,address oracle,address irm,uint256 lltv)",m=H(["function vaultV2Factory() view returns (address)","function vaultData(address) view returns (bool canPullFromIdle,uint64 penalty)","function absoluteCap(address,bytes32) view returns (uint256)","function canPullFromMarket(address,bytes32) view returns (bool)","function isActiveAdapter(address,address) view returns (bool)",`function reallocate(address vault,address deallocateAdapter,${A} deallocateMarketParams,address allocateAdapter,${A} allocateMarketParams,uint128 assets,uint64 penalty)`,`function allocateFromIdle(address vault,address adapter,${A} marketParams,uint128 assets,uint64 penalty)`,`function setAbsoluteCap(address vault,address adapter,${A} marketParams,uint256 newAbsoluteCap)`,`function setCanPullFromMarket(address vault,address adapter,${A} marketParams,bool newCanPullFromMarket)`,"function setCanPullFromIdle(address vault,bool newCanPullFromIdle)","function setIsActiveAdapter(address vault,address adapter,bool newIsActiveAdapter)","function setPenalty(address vault,uint64 newPenalty)"]),$=H(["function isAllocator(address) view returns (bool)","function allocation(bytes32) view returns (uint256)"]),z=H(["function isVaultV2(address) view returns (bool)"]),w=_[v],L=[{vault:w.vaults.netnet.address,underlying:w.tokens.USDG.address,symbol:"USDG",decimals:6},{vault:w.vaults.longbowCore.address,underlying:w.tokens.USDG.address,symbol:"USDG",decimals:6},{vault:w.vaults.longbowFrontier.address,underlying:w.tokens.USDG.address,symbol:"USDG",decimals:6},{vault:w.vaults.longbowEth.address,underlying:w.tokens.WETH.address,symbol:"WETH",decimals:18}];function x(n,c=256){if(typeof n!="string"||!/^\d+$/.test(n)||n.length>78||BigInt(n)>=1n<<BigInt(c))throw new r("Provide uint decimal base-unit strings.");return BigInt(n)}function q(n){if(typeof n!="string"||!/^0x[0-9a-f]{64}$/i.test(n))throw new r("Provide the exact bytes32 marketId.");return n.toLowerCase()}var M=(n,c)=>n<c?n:c;async function Q(n,c){let l=L.find(u=>typeof c.vault=="string"&&D(u.vault,c.vault));if(!l)throw new r("Choose a pinned NetNet or Longbow V2 vault.");let a={address:P(l.underlying),chainId:v,symbol:l.symbol,decimals:l.decimals},o=n.clientFor(v),e=await O(o,l.vault,a),i=(u,T,j,J=[])=>o.readContract({address:u,abi:T,functionName:j,args:J,blockNumber:e.blockNumber}),t=q(c.marketId),s=e.markets.find(u=>u.id.toLowerCase()===t);if(!s)throw new r("Target market is not in this verified vault adapter inventory.");let[p,b,k,f,U]=await Promise.all([i(y,m,"vaultV2Factory"),i(G,z,"isVaultV2",[l.vault]),i(l.vault,$,"isAllocator",[y]),i(y,m,"vaultData",[l.vault]),i(y,m,"isActiveAdapter",[l.vault,s.adapter])]);if(typeof p!="string"||P(p)!==G||b!==!0||!Array.isArray(f)||f.length!==2||typeof f[0]!="boolean"||typeof f[1]!="bigint")throw new r("Invalid Public Allocator deployment or vault configuration.");let[d]=E(N,s.data);if(P(d.irm)!==P(w.morpho.adaptive_curve_irm.address))throw new r("Public allocation requires the pinned Adaptive Curve IRM.");let g=(u,T)=>Y(K(B(`string,address,${A}`),["this/marketParams",T,E(N,u)[0]])),C=g(s.data,s.adapter),[S,F]=await Promise.all([i(y,m,"absoluteCap",[l.vault,C]),i(l.vault,$,"allocation",[C])]);if(typeof S!="bigint"||typeof F!="bigint")throw new r("Invalid allocator cap read.");let R=S>F?S-F:0n,W=await Promise.all(e.markets.filter(u=>u.id.toLowerCase()!==t).map(async u=>({...u,canPull:await i(y,m,"canPullFromMarket",[l.vault,g(u.data,u.adapter)])===!0})));return{client:o,read:i,asset:a,definition:l,data:e,target:s,params:d,permission:k===!0&&U===!0,canIdle:f[0],penalty:f[1],headroom:R,sources:W}}var st=n=>{let c=a=>Q(n,a),l=(a,o,e,i)=>{let t={vault:{type:"string",enum:L.map(s=>s.vault),description:"Pinned NetNet or Longbow V2 vault address on chain 4663; use netnet_list or longbow_list for vault names."},marketId:{type:"string",description:"Target Morpho Blue market id (0x + 64 hex digits) that must be in this vault's adapter inventory."},...o};return{name:a,inputSchema:{type:"object",properties:t,required:["vault","marketId",...e],additionalProperties:!1},execute:async(s,p)=>{try{if(V(p),Object.keys(s).some(b=>!Object.hasOwn(t,b)))throw new r("Unsupported Public Allocator argument.");return await i(s,p)}catch(b){throw new r(n.plainError(b))}}}};return{tools:[l("morpho_allocator",{},[],async a=>{let o=await c(a);return{chainId:v,allocator:y,vault:o.definition.vault,targetMarketId:o.target.id,asset:o.asset,blockNumber:o.data.blockNumber.toString(),enabled:o.permission,penaltyWad:o.penalty.toString(),absoluteCapHeadroom:o.headroom.toString(),idleUpperBound:(o.permission&&o.canIdle?M(o.data.idle,o.headroom):0n).toString(),sources:o.sources.map(e=>({marketId:e.id,canPull:e.canPull,assetsUpperBound:(o.permission&&e.canPull?M(M(e.capacity,o.data.blueCash),o.headroom):0n).toString()})),caveat:"Upper bounds only; vault relative/absolute caps, accrual and liquidity still constrain execution. Preview an explicit source and amount with morpho_reallocate. This standalone allocation charges its disclosed penalty; a later borrow is a separate transaction and can fail or lose the added liquidity to another borrower."}}),l("morpho_reallocate",{sourceMarketId:{type:"string",description:"A returned source market ID, or omit to allocate idle assets."},assets:I(`Amount to move into the target market, in base units of the vault's asset (USDG 6 decimals, WETH 18). Example: "1000000" = 1 USDG.`),maxPenaltyAssets:I(`Highest penalty you accept, in base units of the vault's asset (USDG 6 decimals, WETH 18). Example: "10000" = 0.01 USDG.`)},["assets","maxPenaltyAssets"],async(a,o)=>{let e=x(a.assets,128),i=x(a.maxPenaltyAssets),t=await c(a);if(!t.permission||e===0n||e>t.headroom||t.penalty>10n**18n)throw new r("Public allocation is disabled or the requested amount exceeds target headroom.");let s=(e*t.penalty+10n**18n-1n)/10n**18n;if(s>i)throw new r("Allocator penalty exceeds maxPenaltyAssets.");let p;if(a.sourceMarketId===void 0){if(!t.canIdle||e>t.data.idle)throw new r("Public idle allocation is disabled or idle funds are insufficient.");p=h({abi:m,functionName:"allocateFromIdle",args:[t.definition.vault,t.target.adapter,t.params,e,t.penalty]})}else{let d=t.sources.find(C=>C.id.toLowerCase()===q(a.sourceMarketId));if(!d||!d.canPull||e>M(d.capacity,t.data.blueCash))throw new r("The source cannot publicly supply the requested liquidity.");let[g]=E(N,d.data);p=h({abi:m,functionName:"reallocate",args:[t.definition.vault,d.adapter,g,t.target.adapter,t.params,e,t.penalty]})}let b=`Move ${e} ${t.asset.symbol} base units inside ${t.definition.vault} to market ${t.target.id}; pay ${s} ${t.asset.symbol} base units as a donation penalty. This is a standalone reallocation; a subsequent borrow is separate and not guaranteed.`,k=[...s?[n.approval(t.asset.address,y,s.toString(),v)]:[],n.unsignedTx({to:y,data:p,value:"0",chainId:v,description:b})],f=await n.preview(k,o);if(f.changes.filter(d=>d.token.chainId===v&&D(d.token.address,t.asset.address)&&d.token.decimals===t.asset.decimals).reduce((d,g)=>d+BigInt(g.amount),0n)!==-s)throw new r("Allocator preview does not match the exact donation penalty.");return{txs:k,preview:f,penaltyAmount:s.toString(),summary:`${b} The calldata binds the current penalty rate. ${f.summary}`}}),l("morpho_manage_allocator",{operation:{enum:["setIsActiveAdapter","setCanPullFromMarket","setCanPullFromIdle","setAbsoluteCap","setPenalty"],description:"Allocator setting to change: adapter active flag, market pull permission, idle pull permission, absolute cap, or penalty rate."},enabled:{type:"boolean",description:"New true/false value for setIsActiveAdapter, setCanPullFromMarket or setCanPullFromIdle."},amount:I(`For setAbsoluteCap: cap in base units of the vault's asset ("1000000" = 1 USDG). For setPenalty: 18-decimal wad base units (1e18 = 100%).`)},["operation"],async(a,o)=>{let e=await c(a);if(await e.read(e.definition.vault,$,"isAllocator",[o])!==!0)throw new r("This wallet is not an allocator of this vault.");let i=a.enabled,t;if(a.operation==="setAbsoluteCap")t=h({abi:m,functionName:"setAbsoluteCap",args:[e.definition.vault,e.target.adapter,e.params,x(a.amount)]});else if(a.operation==="setPenalty"){let b=x(a.amount,64);if(b>10n**18n)throw new r("Public Allocator penalty must not exceed 1e18.");t=h({abi:m,functionName:"setPenalty",args:[e.definition.vault,b]})}else{if(typeof i!="boolean")throw new r("Provide enabled as a boolean.");if(a.operation==="setIsActiveAdapter")t=h({abi:m,functionName:"setIsActiveAdapter",args:[e.definition.vault,e.target.adapter,i]});else if(a.operation==="setCanPullFromMarket")t=h({abi:m,functionName:"setCanPullFromMarket",args:[e.definition.vault,e.target.adapter,e.params,i]});else if(a.operation==="setCanPullFromIdle")t=h({abi:m,functionName:"setCanPullFromIdle",args:[e.definition.vault,i]});else throw new r("Choose a supported allocator configuration operation.")}let s=`Configure Morpho Public Allocator ${String(a.operation)}: ${JSON.stringify(a)}.`,p=[n.unsignedTx({to:y,data:t,value:"0",chainId:v,description:s})];return{txs:p,preview:await n.preview(p,o),summary:s}})]}};export{y as a,G as b,m as c,Q as d,st as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as T}from"./7QKYDNF6.js";import{b as C,c as N,d as E}from"./FWIFTPSE.js";import{b as M}from"./2MZXTOZU.js";import{b as O,la as S}from"./7VC53B5X.js";import{a as R}from"./P4UQGWCP.js";import{c as v}from"./SCG5HWMN.js";import{e as y}from"./NWNYJ26T.js";import{a as m,i as _}from"./FWD4L3CJ.js";import{a as p}from"./XSD5NL7J.js";import{getAddress as x,isAddress as k}from"viem";function P(i){if(typeof i!="string"||!i.trim()||i.length>200)throw new p("Provide nonempty filter text of at most 200 characters.");return i}function $(i,u){if(typeof i!="number"||!Number.isSafeInteger(i)||i<0||i>u)throw new p(`Choose a pagination integer from 0 to ${u}.`);return i}var w={morpho:{assess:"morpho_status",enter:"morpho_supply_collateral",exit:"morpho_withdraw_collateral"},steakhouse:{assess:"steakhouse_list",enter:"steakhouse_deposit",exit:"steakhouse_withdraw"},spark:{assess:"spark_list",enter:"spark_deposit",exit:"spark_withdraw"},netnet:{assess:"netnet_list",enter:"netnet_deposit",exit:"netnet_withdraw"},longbow:{assess:"longbow_list",enter:"longbow_deposit",exit:"longbow_withdraw"},grove:{assess:"grove_list",enter:"grove_deposit",exit:"grove_withdraw"},beefy:{assess:"beefy_list",enter:"beefy_deposit",exit:"beefy_withdraw"},uniswap:{assess:"uniswap_list_positions",enter:"uniswap_add",exit:"uniswap_remove"},layerbank:{assess:"layerbank_list",enter:"layerbank_deposit",exit:"layerbank_withdraw"}},h=_[m].vaults,L={steakhouse:[h.steakhouse.address],spark:[h.spark.address],netnet:[h.netnet.address],longbow:[h.longbowCore.address,h.longbowFrontier.address,h.longbowEth.address],grove:[h.groveAlm.address],beefy:R.vaults.map(i=>i.earnContractAddress),layerbank:[M]},U=new Set(T.map(i=>i.marketId.toLowerCase()));function q(i,u){return Object.hasOwn(L,i)&&typeof u=="string"&&k(u,{strict:!1})&&L[i].some(g=>g.toLowerCase()===u.toLowerCase())}var Z=i=>{let u=(t,n,r)=>({name:`merkl_${t}`,inputSchema:{type:"object",properties:n,additionalProperties:!1},execute:async(c,e)=>{try{let s=Object.keys(c).find(d=>!Object.hasOwn(n,d));if(s)throw new p(`Unsupported Merkl input: ${s}.`);return await r(c,e)}catch(s){throw new p(i.plainError(s))}}}),g={page:{type:"integer",minimum:0,maximum:1e4,description:"Zero-based page number."},items:{type:"integer",minimum:1,maximum:100,description:"Maximum entries per page, from 1 to 100."}},A=async(t,n)=>{let r=new URL(`https://api.merkl.xyz/v4/${t}`);for(let[c,e]of Object.entries(n))r.searchParams.set(c,e);return v(i.http,r.toString(),{method:"GET",headers:{"User-Agent":"oak-core/merkl"}},c=>Array.isArray(c)||y(c))},b=t=>{let n=$(t.items??20,100);if(!n)throw new p("Choose at least one item per page.");return{page:String($(t.page??0,1e4)),items:String(n)}};return{tools:[u("opportunities",{...g,protocol:{type:"string",description:"Protocol identifier to filter opportunities."},name:{type:"string",description:"Opportunity name search text."},explorerAddress:{type:"string",description:"Pool or market contract address to filter opportunities."}},async t=>{let n={chainId:String(m),campaigns:"true",...b(t)};if(t.protocol!==void 0&&(n.mainProtocolId=P(t.protocol)),t.name!==void 0&&(n.name=P(t.name)),t.explorerAddress!==void 0){if(typeof t.explorerAddress!="string"||!k(t.explorerAddress,{strict:!1}))throw new p("Provide a pool or market explorer address.");n.explorerAddress=x(t.explorerAddress)}let r=await A("opportunities",n);if(!Array.isArray(r)||!r.every(e=>y(e)&&typeof e.id=="string"&&Number.isSafeInteger(e.chainId)))throw new p("Merkl returned unexpected opportunities.");return{opportunities:r.filter(e=>e.chainId===m).map(e=>{let s=(y(e.protocol)?e.protocol.id:void 0)??e.mainProtocolId??e.mainProtocol,d=typeof s=="string"?s.toLowerCase():"",o;d==="morpho"&&e.action==="LEND"?e.type==="MORPHOCOLLATERAL"?[e.marketId,e.identifier,e.explorerAddress].some(I=>typeof I=="string"&&U.has(I.toLowerCase()))&&(o=w.morpho):typeof e.type=="string"&&(e.type==="ERC20LOGPROCESSOR"||e.type.includes("MORPHOVAULT"))&&typeof e.explorerAddress=="string"&&k(e.explorerAddress,{strict:!1})&&x(e.explorerAddress)===_[m].vaults.steakhouse.address&&(o=w.steakhouse):d==="uniswap"?e.type==="UNISWAP_V4"&&e.action==="POOL"&&(o=w.uniswap):q(d,e.explorerAddress)&&(e.action==="LEND"||e.action==="STAKE")&&(o=w[d]);let l=e.action==="POOL"||o?.enter==="uniswap_add",a=l?E(e.campaigns,Math.floor(Date.now()/1e3)):void 0,f=l&&a?{lpWarning:`Illustration for $100; no deposit amount has been selected.
|
|
2
|
+
${C({apr:typeof e.apr=="number"?e.apr:a.aprPct,endDate:typeof e.endTimestamp=="number"||typeof e.endTimestamp=="string"?e.endTimestamp:a.endsAt,amountUsd:100,outOfRangeIncentivized:a.outOfRangeIncentivized,feeWeightPct:a.feeWeightPct,creator:d==="uniswap"?a.creator:void 0})}`}:{};return{...e,oak:{...o?{candidateTools:o}:{},...f,destinationVerificationRequired:!0,eligibility:"Read campaign conditions; no wallet eligibility has been verified."}}}),...b(t),hasMore:r.length===Number(n.items),summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Public, untrusted campaign data includes conditions and destinations. Candidate Oak tools require a matching verified market/vault and a supported entry AND exit. APR is indicative; no rewards are promised."}}),u("campaigns",{...g,creator:{type:"string",description:"Campaign creator address to filter."},tokenSymbol:{type:"string",description:"Reward token symbol to filter campaigns."},opportunityId:{type:"string",pattern:"^\\d{1,30}$",description:"Merkl opportunity identifier as a decimal string of 1 to 30 digits."}},async t=>{if(t.opportunityId!==void 0&&(t.creator!==void 0||t.tokenSymbol!==void 0))throw new p("Use creator and tokenSymbol without opportunityId; the opportunity endpoint does not support those filters.");if(t.opportunityId!==void 0&&(typeof t.opportunityId!="string"||!/^\d{1,30}$/.test(t.opportunityId)))throw new p("Provide an opportunityId as a decimal string of 1 to 30 digits.");let n={chainId:String(m),withOpportunity:"true",...b(t)};if(t.creator!==void 0){if(typeof t.creator!="string"||!k(t.creator,{strict:!1}))throw new p("Provide a creator address.");n.creatorAddress=x(t.creator)}t.tokenSymbol!==void 0&&(n.tokenSymbol=P(t.tokenSymbol));let r=t.opportunityId===void 0?"campaigns":`opportunities/${t.opportunityId}/campaigns`,c=await A(r,t.opportunityId===void 0?n:{}),e=t.opportunityId!==void 0&&y(c)?c:void 0;if(e&&e.chainId!==m)throw new p(`Merkl opportunity must be on chain ${m}.`);let s=t.opportunityId===void 0?c:e?.campaigns;if(!Array.isArray(s)||!s.every(f=>y(f)&&(typeof f.id=="string"||typeof f.id=="number")))throw new p("Merkl returned unexpected campaigns.");let d=e?s.filter(f=>f.distributionChainId===m):s,o=Number(n.page)*Number(n.items),l=t.opportunityId===void 0?d:d.slice(o,o+Number(n.items)),a=t.opportunityId===void 0?d.length===Number(n.items):o+Number(n.items)<d.length;return{campaigns:l,...e?{opportunity:{id:e.id,name:e.name,chainId:e.chainId,protocol:y(e.protocol)?{id:e.protocol.id,name:e.protocol.name}:void 0,explorerAddress:e.explorerAddress,identifier:e.identifier}}:{},chainId:m,...b(t),hasMore:a,summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Campaign rules, budgets, timing, exclusions and configuration are public API data; verify the reward distribution chain and destination before entering."}}),u("earning_status",{view:{enum:["active","breakdowns","stats","claims"],description:"active lists earning opportunities; breakdowns shows reward details; stats shows totals; claims lists claims."},...g},async(t,n)=>{if(!k(n,{strict:!1}))throw new p("Provide a valid connected wallet address.");let r=t.view??"active";if(!["active","breakdowns","stats","claims"].includes(String(r)))throw new p("Choose active, breakdowns, stats or claims.");let c=r==="claims"?"claims":r==="breakdowns"?`users/${n}/rewards/chains/${m}/breakdowns`:`users/${n}/rewards/${r==="active"?"active-opportunities":"stats"}`,{page:e,items:s}=b(t),d=r==="breakdowns"?{}:{chainId:String(m)};r==="claims"&&(d.recipient=n);let o=await A(c,d),l=Number(e)*Number(s),a=Array.isArray(o)?o:r==="breakdowns"&&y(o)&&Array.isArray(o.opportunities)?o.opportunities:void 0,f=a?Array.isArray(o)?a.slice(l,l+Number(s)):{...o,opportunities:a.slice(l,l+Number(s))}:o,D=r==="active"&&Array.isArray(a)&&a.length===0?`${O(S,{after_deposit:N()})} `:"";return{view:r,chainId:m,wallet:n,data:f,...a?{page:e,items:s,hasMore:l+Number(s)<a.length}:{},summary:`${D}Powered by Merkl \u2014 https://app.merkl.xyz. API earning attribution and history can lag onchain state; pending earnings are not claimable. Private or restricted attribution may be omitted by Merkl. Recheck merkl_rewards before a claim.`}})]}};export{Z as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as j}from"./OYJFXEDU.js";import{h as me,k as ke}from"./2GXHYI23.js";import{b as S}from"./DNNFKDZR.js";import{b as le}from"./SPJCSEKP.js";import{a as _}from"./43LI5NKJ.js";import{g as B,i as ue}from"./NWNYJ26T.js";import{b as H}from"./IX3GZMTM.js";import{a as d,i as N}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{a as de}from"./JXOEJPJ4.js";import{encodeFunctionData as K,erc20Abi as pe,getAddress as m,isAddress as ye,parseAbi as U,zeroAddress as fe}from"viem";var T=m(N[d].hoodlock.locker.address),F=m(N[d].hoodlock.burner.address),v=m(N[d].hoodlock.liquidityLocker.address),O=m(N[d].uniswap.v3_position_manager.address),V=m(N[d].uniswap.v4_position_manager.address),We="0x000000000000000000000000000000000000dEaD",$e=3153600000n,Le=1000000000000n,we=65535,D=U(["function fee() view returns (uint256)","function lock(address token, uint256 amount, uint256 unlockTime) payable returns (uint256 lockId)","function getLock(uint256 lockId) view returns (address owner, address token, uint256 amount, uint256 unlockTime, bool withdrawn)","function locksByOwner(address owner) view returns (uint256[])","function locksByToken(address token) view returns (uint256[])"]),te=U(["function fee() view returns (uint256)","function burn(address token, uint256 amount) payable returns (uint256 burnId)","function DEAD() view returns (address)","function getBurn(uint256 burnId) view returns (address burner, address token, uint256 amount, uint256 timestamp)","function totalBurnedOf(address token) view returns (uint256)"]),q=U(["function fixedFee() view returns (uint256)","function collectFeeBps() view returns (uint16)","function paused() view returns (bool)","function lock(address manager, uint256 tokenId, uint256 unlockTime, address feeRecipient, bool acceptUnverifiedHook, uint16 maxCollectFeeBps) payable returns (uint256 lockId)","function lockIdOf(address manager, uint256 tokenId) view returns (uint256)","function getLock(uint256 lockId) view returns (address owner, uint40 unlockTime, uint16 collectFeeBps, bool isV4, bool hookVerified, bool withdrawn, address feeRecipient, address token0, address token1, uint256 tokenId)","function locksOf(address owner) view returns (uint256[])"]),Se=U(["function approve(address to, uint256 tokenId)"]);function xe(e,o,t){let a=o.trim();if(a.startsWith("-")){let k=a.slice(1),i=e(k,t);return i==="0"?"0":`-${i}`}return e(a,t)}function ge(e,o){return o.length===0?"no ERC-20 transfer deltas":o.map(t=>`${xe(e.formatAmount,t.amount,t.token.decimals)} ${t.token.symbol}`).join(", ")}function E(e,o="token"){if(typeof e!="string"||!e.trim())throw new u(`Provide a valid ${o} contract address.`);if(!ye(e,{strict:!1}))throw new u(`Identify ${o} by chain and contract address, not by symbol.`);return m(e)}async function W(e,o){try{return await o()}catch(t){throw new u(e.plainError(t))}}function ve(e){let o=H(e);if(o<=0n)throw new u("Amount must be greater than zero.");return o}async function be(e){let o=await e.getBlock();if(!o||typeof o.timestamp!="bigint")throw new u("Could not read the current chain timestamp. Please try again.");return o.timestamp}function he(e,o){if(typeof e!="string"||!/^\d+$/.test(e.trim()))throw new u("unlockTime must be a non-negative integer string in Unix seconds.");let t=BigInt(e.trim());if(t>=Le)throw new u("unlockTime appears to be in milliseconds; provide Unix seconds at most 100 years (3153600000 seconds) in the future.");if(t<=o)throw new u(`unlockTime (${t}) must be in the future (greater than current timestamp ${o}).`);let a=o+$e;if(t>a)throw new u(`unlockTime (${t}) exceeds the 100-year maximum lock duration (3153600000 seconds; max ${a}).`);return t}async function ie(e,o,t=d){let a=m(o),[k,i]=await Promise.all([e.readContract({address:a,abi:pe,functionName:"symbol"}),e.readContract({address:a,abi:pe,functionName:"decimals"})]);return{address:a,symbol:de(String(k)),decimals:Number(i),chainId:t}}function Ie(e,o){if(e==null)return o;let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/.test(e.trim())?Number(e.trim()):NaN;if(!Number.isInteger(t)||t<0||t>we)throw new u("maxCollectFeeBps must be an integer between 0 and 65535.");if(t<o)throw new u(`Live collectFeeBps (${o}) exceeds maxCollectFeeBps (${t}): collect fee changed.`);return Math.min(t,o)}function Pe(e){return e.tokenId!==void 0||e.manager!==void 0||e.feeRecipient!==void 0||e.maxCollectFeeBps!==void 0||e.acceptUnverifiedHook!==void 0||e.kind==="v3"||e.kind==="lp"||e.kind==="v4"||e.version==="v3"||e.version==="v4"}async function Ce(e,o,t){_(t);let a=m(t),k=o.kind==="v4"||o.version==="v4",i=o.manager!==void 0?E(o.manager,"manager"):k?V:O,g=i===V;if(i!==O&&!g)throw new u(`Unsupported position manager ${i}; use the configured Uniswap v3 or v4 manager.`);if(k&&!g||g&&(o.kind==="v3"||o.version==="v3"))throw new u("The requested version disagrees with the position manager.");if(o.acceptUnverifiedHook!==void 0&&typeof o.acceptUnverifiedHook!="boolean")throw new u("acceptUnverifiedHook must be a boolean.");let b=o.acceptUnverifiedHook===!0;if(!g&&b)throw new u("Uniswap v3 has no hooks; omit acceptUnverifiedHook.");let s=g?"v4":"v3";if(typeof o.tokenId!="string")throw new u("Provide an NFT tokenId as a decimal string.");let p=String(o.tokenId).trim(),c=H(p),l=ue(o.feeRecipient,"Provide an explicit feeRecipient address for LP position locks."),w=e.clientFor(d),[x,I,h]=await Promise.all([be(w),w.readContract({address:v,abi:q,functionName:"fixedFee"}),w.readContract({address:v,abi:q,functionName:"collectFeeBps"})]),y,$=!0;if(g){let C=U(["function getPoolAndPositionInfo(uint256 tokenId) view returns ((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey, uint256 info)","function getPositionLiquidity(uint256 tokenId) view returns (uint128)","function ownerOf(uint256 tokenId) view returns (address)"]),[Y,J,M]=await Promise.all([w.readContract({address:i,abi:C,functionName:"getPoolAndPositionInfo",args:[c]}),w.readContract({address:i,abi:C,functionName:"getPositionLiquidity",args:[c]}),w.readContract({address:i,abi:C,functionName:"ownerOf",args:[c]})]);if(m(M)!==a)throw new u("This wallet does not own that v4 position NFT.");if(J<=0n)throw new u("The v4 position has no liquidity to lock.");if(y=m(Y[0].hooks),$=y===fe||await w.readContract({address:v,abi:U(["function hookAllowed(address) view returns (bool)"]),functionName:"hookAllowed",args:[y]}),!$&&!b)throw new u(`Unverified v4 hook ${y}; review its risks and explicitly set acceptUnverifiedHook: true to proceed.`)}let A=he(o.unlockTime,x),n=BigInt(I),r=Number(h);if(!Number.isInteger(r)||r<0||r>we)throw new u(`Invalid on-chain collectFeeBps (${String(h)}).`);if(o.maxFee!==void 0){let C=H(String(o.maxFee));if(n>C)throw new u(`Live fixedFee (${n}) exceeds maxFee (${C}).`)}let f=Ie(o.maxCollectFeeBps,r),L=(r/100).toString(),R=e.unsignedTx({to:i,data:K({abi:Se,functionName:"approve",args:[v,c]}),value:"0",chainId:d,description:`Approve Uniswap ${s} position NFT #${c} on ${i} for HoodLock LiquidityLocker ${v}.`}),P=e.unsignedTx({to:v,data:K({abi:q,functionName:"lock",args:[i,c,A,l,b,f]}),value:n.toString(),chainId:d,description:`Lock Uniswap ${s} NFT #${c} in HoodLock LiquidityLocker (${v}) until ${A} with feeRecipient ${l}, upfront fixedFee ${e.formatAmount(n.toString(),S.decimals)} ETH (${n} wei), and ongoing collect fee ${r} bps (${L}% of collected LP fees, frozen per lock).`}),X=[R,P],z=await e.preview(X,a),Q=`Approve and lock Uniswap ${s} NFT #${c} (manager ${i}) in HoodLock LiquidityLocker ${v} until Unix ${A}. Upfront fixedFee: ${e.formatAmount(n.toString(),S.decimals)} ETH (${n} wei). Ongoing LP fee share: ${r} bps (${L}% of collected LP fees, frozen per lock; maxCollectFeeBps=${f}) with feeRecipient ${l}. V4 hook: ${y??"none"}, reviewed: ${$}; acceptUnverifiedHook=${b}.`;return j(e,{txs:z.txs,summary:Q,preview:z,kind:s,contract:v,manager:i,tokenId:c.toString(),unlockTime:A.toString(),feeRecipient:l,acceptUnverifiedHook:b,collectFeeBps:r,maxCollectFeeBps:f,fixedFee:{token:S,amount:n.toString()}},v,n)}async function Fe(e,o,t){_(t);let a=m(t),k=E(o.token,"token"),i=e.clientFor(d),[g,b,s]=await Promise.all([be(i),i.readContract({address:T,abi:D,functionName:"fee"}),ie(i,k,d)]),p=ve(o.amount),c=he(o.unlockTime,g),l=BigInt(b);if(o.maxFee!==void 0){let A=H(String(o.maxFee));if(l>A)throw new u(`Live lock fee (${l}) exceeds maxFee (${A}).`)}let w=e.approval(s.address,T,p.toString(),d),x=e.unsignedTx({to:T,data:K({abi:D,functionName:"lock",args:[s.address,p,c]}),value:l.toString(),chainId:d,description:`Lock ${e.formatAmount(p.toString(),s.decimals)} ${s.symbol} (${p} base units of ${s.address}) in HoodLock Locker ${T} until ${c} with exact fee ${e.formatAmount(l.toString(),S.decimals)} ETH (${l} wei).`}),I=[w,x],h=await e.preview(I,a),y=ge(e,h.changes),$=`Approve and lock ${e.formatAmount(p.toString(),s.decimals)} ${s.symbol} (${p} base units of ${s.address}) in HoodLock Locker ${T} until Unix ${c}. Exact fee: ${e.formatAmount(l.toString(),S.decimals)} ETH (${l} wei). Preview changes: ${y}.`;return j(e,{txs:h.txs,summary:$,preview:h,kind:"token",contract:T,token:s,amount:p.toString(),unlockTime:c.toString(),fee:{token:S,amount:l.toString()}},T,l)}function Re(e){return{name:"hoodlock_lock",inputSchema:{type:"object",properties:{kind:{type:"string",enum:["token","v2","v3","v4"],description:"Lock mode: token/v2 LP via Locker, or Uniswap v3/v4 NFT via LiquidityLocker."},token:{type:"string",description:"ERC-20 token or v2 LP token contract address on chain 4663 (for token/v2 locks)."},amount:{type:"string",description:"Token amount as an integer string in base units (for token/v2 locks)."},manager:{type:"string",description:"Configured Uniswap v3 or v4 position manager; inferred from kind when omitted."},tokenId:{type:"string",description:"Uniswap NFT position tokenId as a decimal string."},feeRecipient:{type:"string",description:"Explicit recipient address for collected LP fees during a position lock."},acceptUnverifiedHook:{type:"boolean",description:"Explicit v4 unreviewed-hook consent; default false. A reviewed hook is not a safety guarantee."},maxFee:{type:"string",description:"Maximum upfront ETH fee in wei; the exact live fee is sent."},maxCollectFeeBps:{type:"number",description:"Maximum acceptable ongoing LP collect fee in bps (uint16, must be >= live collectFeeBps)."},unlockTime:{type:"string",description:"Unlock timestamp in Unix seconds (must be > now and <= now + 100 years)."}},required:["unlockTime"],additionalProperties:!1},async execute(o,t){return W(e,async()=>Pe(o)?Ce(e,o,t):Fe(e,o,t))}}}function Ne(e){return{name:"hoodlock_burn",inputSchema:{type:"object",properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663 to send to the dead address via HoodLock Burner."},amount:{type:"string",description:"Amount to burn as an integer string in base units."}},required:["token","amount"],additionalProperties:!1},async execute(o,t){return W(e,async()=>{_(t);let a=m(t),k=E(o.token,"token"),i=e.clientFor(d),[g,b,s]=await Promise.all([i.readContract({address:F,abi:te,functionName:"fee"}),i.readContract({address:F,abi:te,functionName:"DEAD"}),ie(i,k,d)]),p=ve(o.amount),c=BigInt(g),l=m(b);if(o.maxFee!==void 0){let A=H(String(o.maxFee));if(c>A)throw new u(`Live burn fee (${c}) exceeds maxFee (${A}).`)}let w=e.approval(s.address,F,p.toString(),d),x=e.unsignedTx({to:F,data:K({abi:te,functionName:"burn",args:[s.address,p]}),value:c.toString(),chainId:d,description:`Send ${e.formatAmount(p.toString(),s.decimals)} ${s.symbol} (${p} base units of ${s.address}) to the dead address (${l}) via HoodLock Burner ${F} (totalSupply is unchanged) with exact fee ${e.formatAmount(c.toString(),S.decimals)} ETH (${c} wei).`}),I=[w,x],h=await e.preview(I,a),y=ge(e,h.changes),$=`Approve and send ${e.formatAmount(p.toString(),s.decimals)} ${s.symbol} (${p} base units of ${s.address}) to the dead address (${l}) via HoodLock Burner ${F}. Note: tokens are transferred to ${l} and totalSupply is unchanged. Exact fee: ${e.formatAmount(c.toString(),S.decimals)} ETH (${c} wei). Preview changes: ${y}.`;return j(e,{txs:h.txs,summary:$,preview:h,contract:F,deadAddress:l,token:s,amount:p.toString(),fee:{token:S,amount:c.toString()},totalSupplyReduced:!1},F,c)})}}}async function Ae(e,o,t){_(o);let a=m(o),k=t?E(t,"token"):void 0,i=e.clientFor(d),g=[],b=new Set,s=n=>{for(let r of n){let f=r.toString();b.has(f)||(b.add(f),g.push(r))}};if(k){let[n,r]=await Promise.all([i.readContract({address:T,abi:D,functionName:"locksByToken",args:[k]}),i.readContract({address:T,abi:D,functionName:"locksByOwner",args:[a]})]);s(n),s(r)}else{let n=await i.readContract({address:T,abi:D,functionName:"locksByOwner",args:[a]});s(n)}let c=(await Promise.all(g.map(async n=>{let r=await i.readContract({address:T,abi:D,functionName:"getLock",args:[n]});return{id:n,owner:m(r[0]),token:m(r[1]),amount:BigInt(r[2]),unlockTime:BigInt(r[3]),withdrawn:!!r[4]}}))).filter(n=>!n.withdrawn&&n.amount>0n&&B(n.owner,a)&&(!k||B(n.token,k))),l=new Map,w=async n=>{let r=n.toLowerCase(),f=l.get(r);if(f)return f;let L=n===fe?S:await ie(i,n,d);return l.set(r,L),L},x=[],I=[];for(let n of c){let r=await w(n.token),f=n.amount.toString(),L=n.unlockTime.toString(),R={token:r,amount:f};x.push({lockId:n.id.toString(),kind:"token",contract:T,chainId:d,owner:n.owner,token:r,amount:f,asset:R,unlockTime:L,withdrawn:!1}),I.push({module:"hoodlock",id:`lock:${n.id.toString()}`,chainId:d,assets:[R],economics:{principal:[me("locked",{token:r,amount:f,source:"hoodlock.lock.amount",dueAt:L})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`HoodLock token lock #${n.id} of ${e.formatAmount(f,r.decimals)} ${r.symbol} (${r.address}) until Unix ${L}.`})}let h=await i.readContract({address:v,abi:q,functionName:"locksOf",args:[a]}),y=[...new Set(h.map(n=>n.toString()))].map(n=>BigInt(n)),$=[];for(let n of y){let r=await i.readContract({address:v,abi:q,functionName:"getLock",args:[n]}),[f,L,R,P,X,z,Q,C,Y,J]=r,M=m(f);if(z||!B(M,a))continue;let re=m(C),se=m(Y);if(k&&!B(re,k)&&!B(se,k))continue;let[Z,ee]=await Promise.all([w(re),w(se)]),ae=m(Q),ce=Number(R),oe=BigInt(L).toString(),ne=BigInt(J).toString();$.push({lockId:n.toString(),kind:P?"v4":"v3",contract:v,manager:P?V:O,chainId:d,owner:M,tokenId:ne,unlockTime:oe,collectFeeBps:ce,feeRecipient:ae,hookVerified:!!X,token0:Z,token1:ee,withdrawn:!1}),I.push({module:"hoodlock",id:`lp-lock:${n.toString()}`,chainId:d,assets:[{token:{address:P?V:O,symbol:`UNI-${P?"V4":"V3"} #${ne}`,decimals:0,chainId:d},amount:"1"}],economics:{principal:[],debt:[],rewards:[],backing:[Z,ee].map(Te=>ke({token:Te,amount:null,source:"hoodlock.lpLock.underlying",unknownReason:"HoodLock does not read the locked LP's underlying amounts.",heldAs:P?V:O,dueAt:oe})),coverage:{complete:!0}},description:`HoodLock Uniswap ${P?"v4":"v3"} LP lock #${n} (NFT #${ne}, ${Z.symbol}/${ee.symbol}, feeRecipient ${ae}, collectFeeBps ${ce}) until Unix ${oe}. One NFT held in LiquidityLocker custody for ${M}. Underlying token amounts are not valued.`})}let A=`Found ${x.length} active token lock(s) and ${$.length} active Uniswap v3/v4 LP lock(s) for ${a}.`;return{locks:x,lpLocks:$,positions:I,summary:A}}function He(e){return{name:"hoodlock_list_locks",inputSchema:{type:"object",properties:{owner:{type:"string",description:"Optional owner wallet address to query (defaults to the authenticated wallet)."},token:{type:"string",description:"Optional ERC-20 or LP token address to filter active locks owned by the wallet."}},additionalProperties:!1},async execute(o,t){let a=o.owner!==void 0?E(o.owner,"owner"):m(t),k=o.token!==void 0?E(o.token,"token"):void 0;return W(e,()=>Ae(e,a,k))}}}function Be(e){return async o=>(await W(e,()=>Ae(e,o))).positions}var G=e=>({tools:[Re(e),Ne(e),He(e)],positions:Be(e)}),Ge=G,Xe=G,Qe=e=>le("hoodlock",[G(e)]),Ye=G;export{T as a,F as b,v as c,O as d,V as e,We as f,$e as g,xe as h,Re as i,Ne as j,He as k,Be as l,G as m,Ge as n,Xe as o,Qe as p,Ye as q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as q,c as M,d as Y}from"./ZOMFHTB2.js";import{e as Q,g as j,i as z,j as F}from"./4FPV4CRC.js";import{F as E,c as W,f as H,n as k,t as R,u as K}from"./BAIY32AV.js";import{a as L}from"./YEIM6BZQ.js";import{a as O}from"./XSD5NL7J.js";import{getAddress as te,parseAbi as oe,zeroAddress as ne}from"viem";var se=oe(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)"]),G=1n<<192n,m={feeRefusal:t=>`Blocked: this pool charges a ${t} fee on every trade. Oak will not quote or prepare a swap through it. Pick a pool with a normal fee. Only if the person has been told the fee and still wants it, repeat with allowHighFeePools: true.`,lossRefusal:(t,e)=>`Blocked: this route returns about ${t} less than ${e}. Oak will not prepare this swap. Only if the person has been told the loss and still wants it, repeat with acceptValueLoss: true.`,warning:(t,e,i)=>`This route returns about ${t} less than ${e} (pool fee ${i} plus price impact).`,own:"this pool's own current price",noIndependent:"No independent market price was available for this pair, so Oak compared the quote with this pool's own current price only.",feeOverride:t=>`You chose to trade through a pool with a ${t} fee.`,lossOverride:(t,e)=>`This trade returns about ${t} less than ${e}.`},l=t=>t.toLowerCase()===ne?H.toLowerCase():t.toLowerCase(),X=(t,e,i,c)=>l(t)===l(i)&&l(e)===l(c)||l(t)===l(c)&&l(e)===l(i),B=(t,e)=>e?[t*t,G]:[G,t*t];async function de(t,e){let{blockNumber:i}=e,c=[],g=[],T=new Map,V=o=>{let n=R(o),s=T.get(n);return s||(s=t.readContract({address:W,abi:se,functionName:"getSlot0",args:[n],blockNumber:i}),T.set(n,s)),s},C=e.poolKeys??[],x=o=>k.some(n=>n.poolId.toLowerCase()===R(o).toLowerCase()),d=e.version==="v4"?await Promise.all(C.map(async o=>K(o)?Number((await V(o))[3]):o.fee)):e.version==="v3"?e.fees:Array.from({length:e.path.length-1},()=>3e3);for(let o=0;o<d.length;o++){let n=L(d[o]);if(d[o]>=5e4&&!(e.version==="v4"&&x(C[o]))&&!e.allowHighFeePools)throw new O(m.feeRefusal(n));(e.allowHighFeePools||e.acceptValueLoss)&&g.push(m.feeOverride(n))}let I=1n,_=1n,a=e.input,y=[],U=!1;for(let o=0;o<d.length;o++){let n=C[o],s=n?n.currency0===a?n.currency1:n.currency0:e.path[o+1],A=e.references?.[o],p,f;if(A)p=A.numerator,f=A.denominator,y.push(A.label);else{let h=(n&&x(n)?k.find(r=>r.poolId.toLowerCase()===R(n).toLowerCase()):void 0)??k.find(r=>X(a,s,r.key.currency0,r.key.currency1)),v=j.find(r=>X(a,s,r.token0,r.token1));if(h||v){let r=h?h.key.currency0:v.token0,u=h?h.key.currency1:v.token1,J=h?(await V(h.key))[0]:(await t.readContract({address:v.address,abi:F,functionName:"slot0",blockNumber:i}))[0];[p,f]=B(J,l(a)===l(r));let[Z,ee]=await Promise.all([E(t,r),E(t,u)]);y.push(`Oak's measured ${Z.symbol}/${ee.symbol} pool`)}else if(U=!0,y.push(m.own),n)[p,f]=B((await V(n))[0],a===n.currency0);else if(e.version==="v3"){let r=await t.readContract({address:Q.factory,abi:z,functionName:"getPool",args:[a,s,d[o]],blockNumber:i}),u=await t.readContract({address:r,abi:F,functionName:"slot0",blockNumber:i});[p,f]=B(u[0],BigInt(a)<BigInt(s))}else{let r=await t.readContract({address:q,abi:M,functionName:"getPair",args:[a,s],blockNumber:i}),u=await t.readContract({address:r,abi:Y,functionName:"getReserves",blockNumber:i});[p,f]=BigInt(a)<BigInt(s)?[u[1],u[0]]:[u[0],u[1]]}}if(p<=0n||f<=0n)throw new O("No positive Uniswap quote is available.");I*=p,_*=f,a=te(s)}let P=[...new Set(y)].join(" \xD7 "),w=U?m.noIndependent:void 0,b=e.exactOutput?e.quoted*I:e.amount*I,D=e.exactOutput?e.amount*_:e.quoted*_,N=b>D?b-D:0n,S=(N*1000n+b/2n)/b,$=`${S/10n}${S%10n?`.${S%10n}`:""}%`;if(N*10n>=b&&!e.acceptValueLoss)throw new O(`${m.lossRefusal($,P)}${w?` ${w}`:""}`);if((e.allowHighFeePools||e.acceptValueLoss)&&g.push(m.lossOverride($,P)),N*100n>=b*2n){let o=d.reduce((n,s)=>n*BigInt(1e6-s),1000000n)/1000000n**BigInt(d.length);c.push(m.warning($,P,L(Number(1000000n-o))))}return c.unshift(...g),c.length&&w&&c.push(w),{reference:P,...w?{referenceNote:w}:{},...c.length?{warnings:c}:{},confirmationWarnings:g}}export{m as a,de as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as u}from"./XEPCDGN2.js";import{a as i}from"./3CH2IPQL.js";import{decodeEventLog as l,isAddress as f,parseAbi as m}from"viem";var y={TransferWithAuthorization:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"validAfter",type:"uint256"},{name:"validBefore",type:"uint256"},{name:"nonce",type:"bytes32"}]},p=m(["event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce)","event AuthorizationCanceled(address indexed authorizer, bytes32 indexed nonce)","event Transfer(address indexed from, address indexed to, uint256 value)"]);function h(s,e,r,a){if(!/^[1-9][0-9]*$/.test(e.amount))throw new Error("Invalid top-up amount.");let n=BigInt(e.amount);if(n%1000000n!==0n||n>50000000n)throw new Error("Use whole dollars from 1 to 50.");if(u(e,Number(n/1000000n)),!f(s,{strict:!1})||!/^0x[0-9a-fA-F]{64}$/.test(a)||typeof r!="bigint"||r<0n)throw new Error("Invalid top-up wallet, nonce or chain time.");let t=r+BigInt(Math.min(e.maxTimeoutSeconds,300));if(t>=2n**256n)throw new Error("Invalid top-up chain time.");return{from:s,to:i.payTo,value:e.amount,validAfter:"0",validBefore:t.toString(),nonce:a}}function g(s,e){let r=new Set,a=new Set,n=!1;if(!f(e.wallet,{strict:!1})||e.payTo.toLowerCase()!==i.payTo.toLowerCase()||!/^0x[0-9a-fA-F]{64}$/.test(e.nonce)||!/^[1-9][0-9]*$/.test(e.value))return"unproven";for(let t of s)if(!(t.removed||typeof t.address!="string"||t.address.toLowerCase()!==i.usdg.toLowerCase()||typeof t.transactionHash!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.transactionHash)))try{let o=l({abi:p,topics:t.topics,data:t.data,strict:!0}),d=t.transactionHash.toLowerCase();o.eventName==="Transfer"?o.args.from.toLowerCase()===e.wallet.toLowerCase()&&o.args.to.toLowerCase()===e.payTo.toLowerCase()&&o.args.value===BigInt(e.value)&&a.add(d):o.args.authorizer.toLowerCase()===e.wallet.toLowerCase()&&o.args.nonce.toLowerCase()===e.nonce.toLowerCase()&&(o.eventName==="AuthorizationCanceled"?n=!0:r.add(d))}catch{}return n?"cancelled":[...r].some(t=>a.has(t))?"paid":"unproven"}export{y as a,h as b,g as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ie,b as le,c as de,d as Z}from"./VST6LFUB.js";import{a as D,b as Y}from"./BB765L75.js";import{c as ae}from"./SCG5HWMN.js";import{a as X}from"./66F5ZH34.js";import{b as C,c as P,d as re,e as h,g,i as oe}from"./NWNYJ26T.js";import{a as v,i as ne,l as F,n as se}from"./FWD4L3CJ.js";import{a as T}from"./XSD5NL7J.js";import{a as I}from"./JXOEJPJ4.js";import{erc20Abi as E,getAddress as f,parseAbi as L,zeroAddress as ee}from"viem";var x="https://ponsfamily.com/api",ce="https://balancesapi.ponsfamily.com/v1",Q=L(["function sellableTokens() view returns (uint256)","function reservedTokens() view returns (uint256)","function readyToGraduate() view returns (bool)","function graduated() view returns (bool)","function currentSnipeTaxBps(address) view returns (uint256)"]),be=L(["event CurveBuy(address indexed buyer, address indexed recipient, uint256 quoteIn, uint256 tokensOut, uint256 fee, uint256 tax)","event CurveSell(address indexed seller, address indexed recipient, uint256 tokensIn, uint256 quoteOut, uint256 fee, uint256 tax)"]),ye=L(["function pendingCreatorFeeRecipient(address) view returns (address,uint256,uint256)"]),he=L(["function getTokenInfo() view returns (address,string,string,(string,string,string,string,string))"]),ue=L(["function totalLocked(address) view returns (uint256)","function totalReleased(address) view returns (uint256)","function vestedAmount(address) view returns (uint256)","function releasable(address) view returns (uint256)","function vestingStart(address) view returns (uint256)","function VESTING_DURATION() view returns (uint256)"]),ge=10000n,pe=2000n,ke=/^[0-9]{1,78}$/,p=e=>typeof e=="number"&&Number.isFinite(e)?e:null,$=(e,t=80)=>typeof e=="string"?I(e.slice(0,t)):null;function N(e,t="address"){return oe(e,`Provide a ${t}.`,re)}function j(e,t,o){let s=e??t;if(typeof s!="number"||!Number.isInteger(s)||s<1||s>o)throw new T(`Choose a limit from 1 to ${o}.`);return s}function O(e,t=0,o=3){return e===null||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:typeof e=="string"?I(e.slice(0,80)):t>=o?null:Array.isArray(e)?{total:e.length,items:e.slice(0,10).map(s=>O(s,t+1,o))}:h(e)?Object.fromEntries(Object.entries(e).filter(([s])=>/^[A-Za-z0-9_]{1,40}$/.test(s)).slice(0,40).map(([s,d])=>[s,O(d,t+1,o)])):null}async function U(e,t,o){return ae(e.http,t,{method:"GET",redirect:"error",headers:{accept:"application/json"}},o)}async function W(e,t,o){let s=e.clientFor(v),[d,a]=await Promise.all([s.readContract({address:t,abi:E,functionName:"symbol",blockNumber:o}),s.readContract({address:t,abi:E,functionName:"decimals",blockNumber:o})]);return{address:t,chainId:v,symbol:I(d),decimals:a}}async function we(e,t){let o=N(t.token,"Pons launch token address"),s=t.holder===void 0?void 0:N(t.holder,"holder address"),d=j(t.limit,20,50),{offset:a,fingerprint:l}=de(t.cursor),r=e.clientFor(v),m=await r.getBlockNumber({cacheTime:0}),k=await D(e,o,m),i=await le(e,o),n=await r.getBlockNumber({cacheTime:0});if(l&&l!==i.fingerprint)throw new T("The Pons holder index changed. Retry pons_holders without a cursor.");let u=i.body,w=[{wallet:ee,reason:"burn (zero address)"},{wallet:f("0x000000000000000000000000000000000000dead"),reason:"burn (dead address)"},{wallet:f(k.curve),reason:"Pons bonding curve"},{wallet:f(se),reason:"Uniswap v4 pool manager (shared pool custody)"}],_=new Map(w.map(c=>[c.wallet,c.reason])),R=i.rows.filter(c=>!_.has(f(c.wallet))),[G,q]=await Promise.all([W(e,o,n),r.readContract({address:o,abi:E,functionName:"totalSupply",blockNumber:n})]),J=c=>1+R.filter(b=>BigInt(b.balance)>BigInt(c)).length,B=async(c,b)=>{let M=await r.readContract({address:o,abi:E,functionName:"balanceOf",args:[c],blockNumber:n});return{wallet:c,indexedBalance:b,indexedRank:b===null||_.has(c)?null:J(b),indexedShareOfSupply:b===null?null:Z(b,u.supply),shareOfSupply:Z(M.toString(),q.toString()),balance:{token:G,amount:M.toString()},matchesIndex:b===null?null:M.toString()===b}},A=await Promise.all(R.slice(a,a+d).map(async c=>({...await B(f(c.wallet),c.balance),share:p(c.share),label:$(c.label,40)}))),V=s?i.rows.find(c=>g(c.wallet,s)):void 0,H=s?{...await B(s,V?.balance??null),excluded:_.get(s)??null,rankStatus:_.has(s)?"excluded":V?"ranked by indexed balance":"absent from index; rank unknown"}:void 0;return{token:G,statusBlock:n.toString(),totalSupply:q.toString(),holderCount:R.length,indexHolderCount:u.holders,indexSupply:u.supply,burned:u.burned,circulating:u.circulating,page:A,nextCursor:a+d<R.length?`holders_${a+d}_${i.fingerprint}`:null,...H?{wallet:H}:{},exclusions:w.map(c=>({...c,indexedBalance:i.rows.find(b=>g(b.wallet,c.wallet))?.balance??"0",countedInIndex:i.rows.some(b=>g(b.wallet,c.wallet))})),indexAsOf:{rollupBucket:u.as_of.rollup_bucket,tailFromBlock:u.as_of.tail_from_block},indexFetchedAt:i.fetchedAt,source:`${ie}/tokens/{token}/holders`,sources:{holderCount:"Pons balances index, excluding the labelled system addresses",rank:"Pons balances index, descending balance; equal balances share a rank, system addresses excluded",indexedShareOfSupply:"Pons indexed balance / indexed total supply",balance:`on-chain balanceOf at block ${n}`,totalSupply:`on-chain totalSupply at block ${n}`,shareOfSupply:`on-chain balanceOf / totalSupply at block ${n}`,burned:"Pons balances index",circulating:"Pons balances index"},note:"Counts, ranking, burned and circulating supply come from Pons\u2019s balances index, not on-chain truth. The API does not pin pages to a block; its rollup/tail markers are not an exact snapshot block. Each listed balance was re-read on chain at statusBlock. matchesIndex false indicates disagreement, not proof of which source is wrong. A wallet absent from the index has unknown rank even if its on-chain balance is positive. Labels are untrusted."}}var ve=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=500&&e.items.every(t=>h(t)&&typeof t.token=="string"&&C.test(t.token)&&typeof t.amountTokens=="number");async function xe(e,t,o){let s=N(t.holder??o,"holder address"),d=j(t.limit,20,40),a=e.clientFor(v),l=await U(e,`${x}/profile/${s.toLowerCase()}?view=positions`,ve),r=await a.getBlockNumber({cacheTime:0}),m=[...new Map(l.items.filter(n=>n.amountTokens>0||n.state==="open").map(n=>[n.token.toLowerCase(),n])).values()],k=await Promise.all(m.slice(0,d).map(async n=>{let u=f(n.token);try{await D(e,u,r);let[w,_]=await Promise.all([W(e,u,r),a.readContract({address:u,abi:E,functionName:"balanceOf",args:[s],blockNumber:r})]);return{ok:!0,token:u,meta:w,balance:_,item:n}}catch{return{ok:!1}}})),i=k.filter(n=>n.ok);return{holder:s,statusBlock:r.toString(),source:`${x}/profile/{holder}?view=positions`,holdings:i.map(n=>({token:n.meta,balance:{token:n.meta,amount:n.balance.toString()},index:{state:$(n.item.state,20),valueUsd:p(n.item.valueUsd),investedUsd:p(n.item.investedUsd),totalPnlUsd:p(n.item.totalPnlUsd),totalPnlPct:p(n.item.totalPnlPct),buys:p(n.item.buys),sells:p(n.item.sells),lastTradeAt:p(n.item.lastTradeAt)}})),excludedUnverified:k.length-i.length,truncated:m.length>d,note:"Discovery through Pons\u2019s positions index; every launch was re-read from the pinned factory and every balance is an on-chain read. USD value and profit and loss are index estimates, not execution quotes. Sell the on-chain balance with pons_sell."}}var Ae=e=>h(e)&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&h(t.launch)&&typeof t.launch.address=="string"&&C.test(t.launch.address)&&typeof t.launch.factory=="string"&&C.test(t.launch.factory));async function Se(e,t){let o=j(t.limit,10,20),s=await U(e,`${x}/launches/trending`,Ae),d=s.items.filter(r=>g(r.launch.factory,F)).slice(0,o),a=await e.clientFor(v).getBlockNumber({cacheTime:0});return{items:await Promise.all(d.map(async r=>({status:await Y(e,f(r.launch.address),a),index:{volumeUsd:p(r.volumeUsd),trades:p(r.trades),traders:p(r.traders),change:p(r.change)}}))),statusBlock:a.toString(),source:`${x}/launches/trending`,excludedOtherFactories:s.items.length-s.items.filter(r=>g(r.launch.factory,F)).length,note:"Ranking is Pons\u2019s own trending list (discovery only); each launch was re-read on chain from the pinned factory."}}var z={overview:"analytics",burn:"analytics/burn",buyback:"analytics/buyback"};async function Te(e,t){let o=t.view??"overview";if(typeof o!="string"||!Object.hasOwn(z,o))throw new T("Choose view overview, burn or buyback.");let s=await U(e,`${x}/${z[o]}`,h);if(o==="overview"){let d=Array.isArray(s.series)?s.series:[];return{view:o,source:`${x}/analytics`,generatedAt:p(s.generatedAt),latestDay:p(s.latestDay),latest:O(d.at(-1)),seriesDays:d.length,today:O(s.today),earnings:O(s.earnings),indexer:O(s.indexer),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}return{view:o,source:`${x}/${z[o]}`,data:O(s,0,o==="buyback"?4:3),note:"Protocol-wide figures from Pons\u2019s analytics index; unaudited aggregates, not a quote."}}var Ce=e=>h(e)&&typeof e.wallet=="string"&&Array.isArray(e.items)&&e.items.length<=100&&e.items.every(t=>h(t)&&typeof t.kind=="string")&&(e.next===null||e.next===void 0||typeof e.next=="string");async function Pe(e,t,o){let s=N(t.wallet??o,"wallet address"),d=`${ce}/wallets/${s.toLowerCase()}/activity`;if(t.cursor!==void 0){if(typeof t.cursor!="string"||!/^[0-9]{1,12}-[0-9]{1,6}$/.test(t.cursor))throw new T("Use the nextCursor returned by the previous pons_activity page.");d+=`/before/${t.cursor}`}let a=await U(e,d,Ce),l=typeof a.next=="string"?/\/before\/([0-9]{1,12}-[0-9]{1,6})$/.exec(a.next):null;return{wallet:s,source:`${ce}/wallets/{wallet}/activity`,nextCursor:l?.[1]??null,items:a.items.map(r=>({kind:$(r.kind,24),block:p(r.block),time:p(r.time),tx:typeof r.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(r.tx)?r.tx:null,token:typeof r.token=="string"&&C.test(r.token)?f(r.token):null,symbol:$(r.symbol,24),amount:typeof r.amount=="string"&&ke.test(r.amount)?r.amount:null,decimals:p(r.decimals),usd:p(r.usd),counterparty:typeof r.counterparty=="string"&&C.test(r.counterparty)?f(r.counterparty):null,counterpartyLabel:$(r.counterparty_label,40)})),note:"Wallet history from Pons\u2019s balances index (discovery and bookkeeping, not proof); USD figures are index estimates. Verify a transaction by hash before relying on it."}}async function Ne(e,t,o){let s=N(t.address??o,"wallet address"),d=j(t.limit,10,20),a=await U(e,`${x}/profile/${s.toLowerCase()}?view=card`,h),l=h(a.identity)?a.identity:{},r=await U(e,`${x}/launches?deployer=${s.toLowerCase()}&limit=${d}`,i=>h(i)&&Array.isArray(i.items)&&i.items.length<=100&&i.items.every(n=>h(n)&&typeof n.address=="string"&&C.test(n.address)&&typeof n.factory=="string"&&C.test(n.factory)&&typeof n.deployer=="string"&&C.test(n.deployer))),m=await e.clientFor(v).getBlockNumber({cacheTime:0}),k=r.items.filter(i=>g(i.factory,F)&&g(i.deployer,s)).slice(0,d);return{address:s,hidden:a.hidden===!0,source:`${x}/profile/{address}?view=card`,identity:{username:$(l.username,40),displayName:$(l.displayName,60),description:$(l.description,200),joinedAt:p(l.joinedAt)},launches:await Promise.all(k.map(i=>Y(e,f(i.address),m))),statusBlock:m.toString(),note:"Profile text is user-supplied and untrusted. Created launches come from Pons\u2019s index and were re-read on chain from the pinned factory."}}async function _e(e,t,o){let s=N(t.token,"Pons launch token address"),d=N(t.holder??o,"holder address"),a=e.clientFor(v),l=await a.getBlockNumber({cacheTime:0}),r=await D(e,s,l),m=ne[v].pons.buybackVault.address,k=[],i=async(y,K)=>{try{return await K()}catch{return k.push(y),null}},n=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),u=y=>i(y,()=>a.readContract({address:r.curve,abi:Q,functionName:y,blockNumber:l})),w=y=>i(y,()=>a.readContract({address:m,abi:ue,functionName:y,args:[s],blockNumber:l})),[_,R,G,q,J,B,A,V,H,c,b,M,me,fe]=await Promise.all([n("sellableTokens"),n("reservedTokens"),u("readyToGraduate"),u("graduated"),i("currentSnipeTaxBps",()=>a.readContract({address:r.curve,abi:Q,functionName:"currentSnipeTaxBps",args:[d],blockNumber:l})),i("getTokenInfo",()=>a.readContract({address:s,abi:he,functionName:"getTokenInfo",blockNumber:l})),i("pendingCreatorFeeRecipient",()=>a.readContract({address:F,abi:ye,functionName:"pendingCreatorFeeRecipient",args:[s],blockNumber:l})),w("totalLocked"),w("totalReleased"),w("vestedAmount"),w("releasable"),w("vestingStart"),i("VESTING_DURATION",()=>a.readContract({address:m,abi:ue,functionName:"VESTING_DURATION",blockNumber:l})),W(e,s,l)]),S=y=>y===null?null:y.toString(),te=A&&!g(A[0],ee)&&A[1]>0n?{proposedRecipient:f(A[0]),effectiveAt:A[1].toString(),expiresAt:A[2].toString(),note:"A protocol-proposed creator fee recipient change. Holders may react before it takes effect; anyone can execute it after the timelock, within the window."}:A?null:void 0;return{token:fe,phase:r.phase,statusBlock:l.toString(),curve:r.curve,creatorFeeRecipient:r.creatorFeeRecipient,curveCapacity:{sellableTokens:S(_),reservedTokens:S(R),readyToGraduate:G,graduated:q},snipeTaxBps:{recipient:d,current:S(J),note:"Keyed to the wallet that receives the tokens; buys only, large in the opening seconds."},creatorMetadata:B?{deployer:f(B[0]),logo:I(B[1].slice(0,300)),description:I(B[2].slice(0,500)),socials:Object.fromEntries(["twitter","telegram","discord","website","farcaster"].map((y,K)=>[y,I(B[3][K].slice(0,300))]))}:null,pendingTakeover:te===void 0?"unavailable":te,buybackVest:{vault:m,enabled:r.buybackEnabled,locked:S(V),released:S(H),vested:S(c),releasable:S(b),vestingStart:S(M),vestingDurationSeconds:S(me),note:"Amounts are launch-token base units; releasing is for the vest beneficiaries only (see pons_claim)."},unavailable:k}}async function Be(e,t){let o=N(t.token,"Pons launch token address"),s=j(t.limit,25,100),d=e.clientFor(v),a=await d.getBlockNumber({cacheTime:0}),l=await D(e,o,a),r=t.toBlock===void 0?a:BigInt(String(t.toBlock)),m=t.fromBlock===void 0?r>=pe?r-pe+1n:0n:BigInt(String(t.fromBlock));if(m<0n||m>r||r>a||r-m+1n>ge)throw new T("Choose an ordered range of at most 10000 mined blocks.");let i=(await d.getLogs({address:l.curve,events:be,fromBlock:m,toBlock:r,strict:!0})).filter(n=>g(n.address,l.curve)&&!n.removed&&n.blockNumber!==null).sort((n,u)=>n.blockNumber===u.blockNumber?(u.logIndex??0)-(n.logIndex??0):n.blockNumber>u.blockNumber?-1:1);return{token:await W(e,o,a),curve:l.curve,fromBlock:m.toString(),toBlock:r.toString(),statusBlock:a.toString(),truncated:i.length>s,total:i.length,trades:i.slice(0,s).map(n=>n.eventName==="CurveBuy"?{side:"buy",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.buyer),recipient:f(n.args.recipient),pairIn:n.args.quoteIn.toString(),tokensOut:n.args.tokensOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}:{side:"sell",block:n.blockNumber.toString(),tx:n.transactionHash,trader:f(n.args.seller),recipient:f(n.args.recipient),tokensIn:n.args.tokensIn.toString(),pairOut:n.args.quoteOut.toString(),fee:n.args.fee.toString(),creatorTax:n.args.tax.toString()}),coverage:"Curve-phase trades in the requested block window only. Graduated-pool swaps are Uniswap v4 events and are not listed here; pons_activity and pons_status cover a wallet and the pool price."}}var Le=e=>{function t(o,s,d){return{name:o,inputSchema:{type:"object",properties:s,required:["pons_holders","pons_launch_info","pons_trades"].includes(o)?["token"]:[],additionalProperties:!1},execute:async(a,l)=>{try{if(!N(l)||g(l,ee))throw new T("Provide a wallet address.");for(let r of Object.keys(a))if(!(r in s))throw new T(`Unknown ${o} input: ${r}.`);return await d(a,l)}catch(r){throw new T(e.plainError(r))}}}}return{tools:[t("pons_holders",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Optional wallet for an on-chain balance and indexed rank after system exclusions."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:50},cursor:{type:"string",maxLength:128,description:"Filtered-directory nextCursor from pons_holders; restart if the index changes."}},o=>we(e,o)),t("pons_holdings",{holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:40}},(o,s)=>xe(e,o,s)),t("pons_trending",{limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},o=>Se(e,o)),t("pons_analytics",{view:{description:'Choose "overview" for totals, "burn" for burns or "buyback" for buybacks; defaults to overview.',type:"string",enum:Object.keys(z)}},o=>Te(e,o)),t("pons_activity",{wallet:{...P,description:"Wallet address to inspect; defaults to the signing wallet."},cursor:{description:"Pagination cursor returned by the previous call to this tool.",type:"string",maxLength:32}},(o,s)=>Pe(e,o,s)),t("pons_launch_info",{token:{...P,description:"Address of the token to inspect or use."},holder:{...P,description:"Holder address to inspect; defaults to the signing wallet."}},(o,s)=>_e(e,o,s)),t("pons_trades",{token:{...P,description:"Address of the token to inspect or use."},fromBlock:X("First block number of the scan, as a decimal string; inclusive."),toBlock:X("Last block number of the scan, as a decimal string; inclusive."),limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:100}},o=>Be(e,o)),t("pons_profile",{address:{...P,description:"Wallet profile address to inspect; defaults to the signing wallet."},limit:{description:"Maximum number of results to return, within the stated bounds.",type:"integer",minimum:1,maximum:20}},(o,s)=>Ne(e,o,s))]}};export{O as a,xe as b,Le as c};
|