@oakagentkit/core 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/api/addresses.d.ts +9 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.d.ts +4 -0
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/identity-link.js +1 -1
- package/build/dist/api/metadata.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.js +1 -1
- package/build/dist/api/modules/beefy/guard.js +1 -1
- package/build/dist/api/modules/beefy/index.js +1 -1
- package/build/dist/api/modules/beefy/liquidity.js +1 -1
- package/build/dist/api/modules/beefy/management.js +1 -1
- package/build/dist/api/modules/beefy/vaults.js +1 -1
- package/build/dist/api/modules/borro/abi.d.ts +54 -0
- package/build/dist/api/modules/borro/abi.js +1 -1
- package/build/dist/api/modules/borro/actions.d.ts +14 -1
- package/build/dist/api/modules/borro/actions.js +1 -1
- package/build/dist/api/modules/borro/checks.js +1 -1
- package/build/dist/api/modules/borro/copy.d.ts +10 -2
- package/build/dist/api/modules/borro/copy.js +1 -1
- package/build/dist/api/modules/borro/index.js +1 -1
- package/build/dist/api/modules/borro/liquidity.js +1 -1
- package/build/dist/api/modules/borro/pins.d.ts +30 -14
- package/build/dist/api/modules/borro/pins.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/borro/types.d.ts +1 -0
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- 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.js +1 -1
- package/build/dist/api/modules/clanker/protocol.js +1 -1
- package/build/dist/api/modules/clanker/state.js +1 -1
- package/build/dist/api/modules/earn/copy.d.ts +6 -6
- package/build/dist/api/modules/earn/copy.js +1 -1
- package/build/dist/api/modules/earn/cost.d.ts +1 -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.js +1 -1
- package/build/dist/api/modules/earn/options.js +1 -1
- package/build/dist/api/modules/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
- package/build/dist/api/modules/erc8004/thesis.js +1 -0
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/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.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.d.ts +12 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/buyback.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.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.js +1 -1
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/read-utils.js +1 -1
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/abi.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/checks.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/merkl.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/layerbank/reserve.js +1 -1
- package/build/dist/api/modules/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/analytics.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/longbow/nft.js +1 -1
- package/build/dist/api/modules/longbow/rebates.js +1 -1
- package/build/dist/api/modules/longbow/staking.js +1 -1
- package/build/dist/api/modules/meridian/index.js +1 -1
- package/build/dist/api/modules/meridian/markets.js +1 -1
- package/build/dist/api/modules/meridian/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.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
- package/build/dist/api/modules/netnet/card-policy.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/desk-read.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/index.d.ts +6 -0
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/validate.js +1 -1
- package/build/dist/api/modules/pendle/verify.js +1 -1
- package/build/dist/api/modules/pons/claim.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/prices.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.js +1 -1
- package/build/dist/api/modules/pons/trade.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.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/raeto/index.js +1 -1
- package/build/dist/api/modules/relay/api.js +1 -1
- package/build/dist/api/modules/relay/bootstrap.js +1 -1
- package/build/dist/api/modules/relay/discovery.js +1 -1
- package/build/dist/api/modules/relay/inbound.js +1 -1
- package/build/dist/api/modules/relay/index.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.js +1 -1
- package/build/dist/api/modules/relay/reads.js +1 -1
- package/build/dist/api/modules/relay/vaults.js +1 -1
- package/build/dist/api/modules/spark/actions.js +1 -1
- package/build/dist/api/modules/spark/details.js +1 -1
- package/build/dist/api/modules/spark/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/discovery.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.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/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- 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.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.js +1 -1
- 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.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.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/upoch/copy.d.ts +5 -0
- package/build/dist/api/modules/upoch/copy.js +1 -0
- package/build/dist/api/modules/upoch/index.d.ts +8 -0
- package/build/dist/api/modules/upoch/index.js +1 -0
- package/build/dist/api/modules/upoch/pins.d.ts +8 -0
- package/build/dist/api/modules/upoch/pins.js +1 -0
- package/build/dist/api/modules/upoch/reads.d.ts +509 -0
- package/build/dist/api/modules/upoch/reads.js +1 -0
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
- package/build/dist/api/modules/wormhole/x402-client.js +1 -1
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/pricing.js +1 -1
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/secret-fields.d.ts +2 -0
- package/build/dist/api/secret-fields.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/signing.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.d.ts +1 -0
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/usd-estimate.js +1 -1
- package/build/dist/chunks/23HNDJ76.js +2 -0
- package/build/dist/chunks/{JS53DQVT.js → 24Q3FNGX.js} +1 -1
- package/build/dist/chunks/{N245WC5R.js → 25C4DTVA.js} +1 -1
- package/build/dist/chunks/{PV4AK32X.js → 2HN3U6OG.js} +1 -1
- package/build/dist/chunks/{GQYV4TFO.js → 2OVJ2BTJ.js} +1 -1
- package/build/dist/chunks/{DYYEA5HB.js → 2QGLPY2D.js} +1 -1
- package/build/dist/chunks/{ZFU65MB4.js → 2WRXH6BL.js} +1 -1
- package/build/dist/chunks/{EZZM2GQT.js → 2ZBSE2LD.js} +1 -1
- package/build/dist/chunks/{HIX5N25Z.js → 2ZQ7X223.js} +1 -1
- package/build/dist/chunks/{V37L4DU4.js → 3A2IKFTV.js} +1 -1
- package/build/dist/chunks/{FWIFTPSE.js → 3PU2SD3U.js} +1 -1
- package/build/dist/chunks/{SBY4RJ7I.js → 3ZH5SOC2.js} +1 -1
- package/build/dist/chunks/4NBXBKOX.js +2 -0
- package/build/dist/chunks/{FOKEFXGP.js → 4PLLS6CT.js} +1 -1
- package/build/dist/chunks/{KREBNL2D.js → 4R3G3H42.js} +1 -1
- package/build/dist/chunks/{XHYFISVV.js → 4Z3IGMU6.js} +1 -1
- package/build/dist/chunks/{CSDN4MYP.js → 5GQJVKVY.js} +1 -1
- package/build/dist/chunks/{JOKL5L6X.js → 5R576SDB.js} +1 -1
- package/build/dist/chunks/{UUID2E22.js → 5W74Z4WZ.js} +1 -1
- package/build/dist/chunks/{EH5G4O3U.js → 65356YKW.js} +1 -1
- package/build/dist/chunks/{QFSBDPLN.js → 65OITTDL.js} +1 -1
- package/build/dist/chunks/{DSTMEY5F.js → 6F527FLN.js} +1 -1
- package/build/dist/chunks/{CO4GCF4L.js → 6MDYKE2O.js} +1 -1
- package/build/dist/chunks/{IEG6GLFR.js → 6OCLWSMZ.js} +1 -1
- package/build/dist/chunks/75SULXNT.js +1 -0
- package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
- package/build/dist/chunks/{AMTRDPVO.js → 7U62MMUQ.js} +1 -1
- package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
- package/build/dist/chunks/{XVJ7ILKK.js → A2V4NFVA.js} +1 -1
- package/build/dist/chunks/A3BJSQ23.js +1 -0
- package/build/dist/chunks/{YSMWCKIX.js → ADIPEGNN.js} +1 -1
- package/build/dist/chunks/ANIF3JMV.js +4 -0
- package/build/dist/chunks/{RLI4JDOL.js → ATEVAJ5Y.js} +1 -1
- package/build/dist/chunks/{F3VDVTMS.js → B2HSLY5F.js} +1 -1
- package/build/dist/chunks/{N4XNNXOJ.js → B7BNDW35.js} +1 -1
- package/build/dist/chunks/{GLF7WEY2.js → C6VJAL5B.js} +1 -1
- package/build/dist/chunks/{5PI57UC2.js → C76D54YG.js} +1 -1
- package/build/dist/chunks/{GRSXWQWD.js → CD2JQ32C.js} +1 -1
- package/build/dist/chunks/{4GNUXN4K.js → CI5ENLYA.js} +1 -1
- package/build/dist/chunks/{F4UQEPJT.js → CZQ2CGYV.js} +1 -1
- package/build/dist/chunks/{APHNOGNS.js → D2IYA4LP.js} +1 -1
- package/build/dist/chunks/{4RQAOOO2.js → D7QXZM3S.js} +1 -1
- package/build/dist/chunks/{TDZTC5WR.js → DBOGRUPS.js} +1 -1
- package/build/dist/chunks/{Y77EVVT4.js → DGDMRATN.js} +1 -1
- package/build/dist/chunks/{3DNJTJ2X.js → DMB64UIN.js} +1 -1
- package/build/dist/chunks/{TM7Z5SA4.js → DMDOSHV7.js} +1 -1
- package/build/dist/chunks/{WHVZ372B.js → DRLBTB4E.js} +1 -1
- package/build/dist/chunks/{FZ6IJZZM.js → E76Z2TT4.js} +1 -1
- package/build/dist/chunks/{C75MT5SD.js → EHK7CDTU.js} +1 -1
- package/build/dist/chunks/{KKPMOAVI.js → ELHRXA5U.js} +1 -1
- package/build/dist/chunks/{XCKTE4ON.js → F7MGYRPU.js} +1 -1
- package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
- package/build/dist/chunks/{M7ZXDLKM.js → FGEGJOAA.js} +1 -1
- package/build/dist/chunks/{N6GIC7HJ.js → FN6GNTPR.js} +1 -1
- package/build/dist/chunks/{ZF2VPDRQ.js → FTMA24EC.js} +1 -1
- package/build/dist/chunks/FXOFR432.js +1 -0
- package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
- package/build/dist/chunks/{JWR5XVP2.js → GBIBRYOV.js} +1 -1
- package/build/dist/chunks/{FNGIJKMZ.js → GDOHHXNH.js} +1 -1
- package/build/dist/chunks/{LR4XTZ37.js → GP6YO24Z.js} +1 -1
- package/build/dist/chunks/{2OKYXT25.js → GQITAJVF.js} +1 -1
- package/build/dist/chunks/H3E7UD2X.js +1 -0
- package/build/dist/chunks/HFVXNKA5.js +1 -0
- package/build/dist/chunks/HHYE42JG.js +21 -0
- package/build/dist/chunks/{UOCRYXAB.js → HRAHGYNK.js} +1 -1
- package/build/dist/chunks/{U363GQTF.js → HS5HWBMU.js} +1 -1
- package/build/dist/chunks/{ARI72OYT.js → HVFMIURK.js} +1 -1
- package/build/dist/chunks/IBL6TL2Q.js +1 -0
- package/build/dist/chunks/{HCBX4NFM.js → IT2JLILU.js} +1 -1
- package/build/dist/chunks/{REWXG6X6.js → JDSSYT6R.js} +1 -1
- package/build/dist/chunks/{XRDXFHIK.js → JFWJBZ7M.js} +1 -1
- package/build/dist/chunks/{523ZIR3J.js → JI5DXDMY.js} +1 -1
- package/build/dist/chunks/{7QKYDNF6.js → JPPQDELB.js} +1 -1
- package/build/dist/chunks/{ZP36DSOD.js → K4P5VYDP.js} +1 -1
- package/build/dist/chunks/{32RXFUOH.js → KBU3PYP7.js} +1 -1
- package/build/dist/chunks/{BB765L75.js → KH4QFN72.js} +1 -1
- package/build/dist/chunks/{YTLH4M4Y.js → KMSAUFYV.js} +1 -1
- package/build/dist/chunks/{6UVGQYZ3.js → KOTGFD2V.js} +1 -1
- package/build/dist/chunks/{4JTTA3BX.js → KZA5GYZR.js} +1 -1
- package/build/dist/chunks/{WUT7TZYM.js → LCH6F5HT.js} +1 -1
- package/build/dist/chunks/{ARLGF5MU.js → LDJI2JAL.js} +1 -1
- package/build/dist/chunks/LEV5SNNC.js +3 -0
- package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
- package/build/dist/chunks/{J73ATSEQ.js → LJJYYUEG.js} +1 -1
- package/build/dist/chunks/{CAWTAR5V.js → LKX5WDOQ.js} +1 -1
- package/build/dist/chunks/M7BUKZW2.js +1 -0
- package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
- package/build/dist/chunks/{YWZQJJYY.js → MMCM3GSM.js} +1 -1
- package/build/dist/chunks/MQ5F2VOK.js +1 -0
- package/build/dist/chunks/{TE6D3OIX.js → MSMHS456.js} +1 -1
- package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
- package/build/dist/chunks/{YMV5TL5C.js → N64JJN37.js} +1 -1
- package/build/dist/chunks/{JKRBGAX2.js → NAO7VWZF.js} +1 -1
- package/build/dist/chunks/ND32LJWI.js +1 -0
- package/build/dist/chunks/{RT7IU6TI.js → NMJVQX5M.js} +1 -1
- package/build/dist/chunks/{67BWOVET.js → NMQBOBWJ.js} +1 -1
- package/build/dist/chunks/NQ4MTIU3.js +1 -0
- package/build/dist/chunks/{XWKK75TO.js → NWPAQER2.js} +1 -1
- package/build/dist/chunks/O2J5I4VA.js +1 -0
- package/build/dist/chunks/{2SUHQWND.js → O4S6XAYV.js} +1 -1
- package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
- package/build/dist/chunks/{NA424YAL.js → OB7BFDOV.js} +1 -1
- package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
- package/build/dist/chunks/{FL5SSHUL.js → OIQTZOBN.js} +1 -1
- package/build/dist/chunks/{XPEDQBLI.js → OODSXDIH.js} +1 -1
- package/build/dist/chunks/OOPMZIG7.js +1 -0
- package/build/dist/chunks/{GG24LO2R.js → OQFNUDMQ.js} +1 -1
- package/build/dist/chunks/{Q2ACLVWR.js → ORG6LVKJ.js} +1 -1
- package/build/dist/chunks/{XYPGLG6A.js → OSMOBKRQ.js} +1 -1
- package/build/dist/chunks/{EGZREEG2.js → OTLUQWLF.js} +1 -1
- package/build/dist/chunks/{OYJFXEDU.js → OTYB6BHK.js} +1 -1
- package/build/dist/chunks/{OZ5MDUD2.js → OVM4QIET.js} +1 -1
- package/build/dist/chunks/{OYPAVXGQ.js → OYDKAIS2.js} +1 -1
- package/build/dist/chunks/P6OB2AFW.js +1 -0
- package/build/dist/chunks/{UQEEF5W5.js → PDPTJMTJ.js} +1 -1
- package/build/dist/chunks/PEHXHQVA.js +1 -0
- package/build/dist/chunks/PMFR47H3.js +1 -0
- package/build/dist/chunks/{HHO5ISMM.js → PQXYTOV5.js} +1 -1
- package/build/dist/chunks/{HKVQ646Q.js → PSGRZWES.js} +1 -1
- package/build/dist/chunks/Q7L3BX6U.js +1 -0
- package/build/dist/chunks/{753HZZTY.js → QBYV7NXH.js} +1 -1
- package/build/dist/chunks/{2LWBN35N.js → QIB6OMQV.js} +1 -1
- package/build/dist/chunks/{TPEKCXVE.js → QLAOBULN.js} +1 -1
- package/build/dist/chunks/{DNNFKDZR.js → QLFPAN6S.js} +1 -1
- package/build/dist/chunks/QMEGAKLI.js +1 -0
- package/build/dist/chunks/{TK55VASJ.js → QMNUB2GM.js} +1 -1
- package/build/dist/chunks/{YUHNPUNK.js → R73R4KN3.js} +1 -1
- package/build/dist/chunks/{VR344DAZ.js → RN3WUJIO.js} +1 -1
- package/build/dist/chunks/{5HIHUYA4.js → RNCMXKKS.js} +1 -1
- package/build/dist/chunks/{ZOMFHTB2.js → ROQQ62LP.js} +1 -1
- package/build/dist/chunks/{D742AYEV.js → RUTSEGGD.js} +1 -1
- package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
- package/build/dist/chunks/{KDGSYNOP.js → S4UJDZGN.js} +1 -1
- package/build/dist/chunks/{AI3VAPA3.js → SMSXZ3FN.js} +1 -1
- package/build/dist/chunks/{JLRHM2DQ.js → SUNTJ6IU.js} +1 -1
- package/build/dist/chunks/{2FHELZ7Y.js → TGFQQCRY.js} +1 -1
- package/build/dist/chunks/{4JRXEN7C.js → THL4TMQW.js} +2 -2
- package/build/dist/chunks/TI727O2H.js +1 -0
- package/build/dist/chunks/{RLMVA575.js → TMRAF2L2.js} +1 -1
- package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
- package/build/dist/chunks/U243AWCH.js +1 -0
- package/build/dist/chunks/U762746N.js +1 -0
- package/build/dist/chunks/{GDRQ2ANN.js → U7UPLF4F.js} +1 -1
- package/build/dist/chunks/{4Q2ZBZXM.js → UPKVD7WG.js} +1 -1
- package/build/dist/chunks/{ZQAFFWDK.js → URBEK2VV.js} +1 -1
- package/build/dist/chunks/{VTPT5544.js → USEF3QKG.js} +1 -1
- package/build/dist/chunks/{U2YCQWZK.js → UVAR6BHU.js} +1 -1
- package/build/dist/chunks/{7VC53B5X.js → V5YSJKRH.js} +13 -13
- package/build/dist/chunks/{7D73A6KS.js → VB36EHIR.js} +1 -1
- package/build/dist/chunks/VMZYFO6I.js +1 -0
- package/build/dist/chunks/{UEDGYZOC.js → VVAM3EAK.js} +1 -1
- package/build/dist/chunks/VVJO6OYK.js +1 -0
- package/build/dist/chunks/{JESMX2UC.js → VXCGMALF.js} +1 -1
- package/build/dist/chunks/{ZKZUS3QU.js → VZVW5J7J.js} +1 -1
- package/build/dist/chunks/{NUFZUKYS.js → W32UECOL.js} +1 -1
- package/build/dist/chunks/{O3JWCJIF.js → W4RYRLL5.js} +1 -1
- package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
- package/build/dist/chunks/{BAIY32AV.js → WBNFRPAT.js} +1 -1
- package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
- package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
- package/build/dist/chunks/{L646YWDP.js → X24YTJST.js} +1 -1
- package/build/dist/chunks/{4FPV4CRC.js → X5AL3DUK.js} +1 -1
- package/build/dist/chunks/{SOTYQGPT.js → XBNZ7GTY.js} +1 -1
- package/build/dist/chunks/{BZ34ZR65.js → XEBMS5KU.js} +1 -1
- package/build/dist/chunks/{FOD34G2H.js → XL3W7DAQ.js} +1 -1
- package/build/dist/chunks/{GSFHM5L3.js → XPWGPZ2C.js} +1 -1
- package/build/dist/chunks/{2E4I7CJ7.js → XRDLMTBJ.js} +1 -1
- package/build/dist/chunks/{SKEKXEUU.js → XV3YJ4P6.js} +1 -1
- package/build/dist/chunks/XW3VGWXK.js +1 -0
- package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
- package/build/dist/chunks/Y64GFBTA.js +1 -0
- package/build/dist/chunks/{FJLJ7ZQ5.js → YARZE7SJ.js} +1 -1
- package/build/dist/chunks/{OARVU3RC.js → YBLJ75U5.js} +1 -1
- package/build/dist/chunks/YRSAZTTC.js +7 -0
- package/build/dist/chunks/{3VBIRLU3.js → YXXK6EPI.js} +1 -1
- package/build/dist/chunks/Z3IBPCY4.js +2 -0
- package/build/dist/chunks/{H5DY7CNB.js → Z7FGEWO2.js} +1 -1
- package/build/dist/chunks/{INOYMBWE.js → ZNPVBNC5.js} +1 -1
- package/build/dist/chunks/{EVBHQQQG.js → ZTKT3ZQK.js} +1 -1
- package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/3K2N5VFH.js +0 -1
- package/build/dist/chunks/3ZABD6ZF.js +0 -2
- package/build/dist/chunks/44MB6SA6.js +0 -1
- package/build/dist/chunks/4D4ZRZUW.js +0 -1
- package/build/dist/chunks/4OVIMYNH.js +0 -2
- package/build/dist/chunks/6NUNCD5J.js +0 -1
- package/build/dist/chunks/6PZGDVHV.js +0 -1
- package/build/dist/chunks/7MBVTNLU.js +0 -1
- package/build/dist/chunks/7VNO46LV.js +0 -1
- package/build/dist/chunks/DPE7SPW7.js +0 -1
- package/build/dist/chunks/E3RACZUY.js +0 -1
- package/build/dist/chunks/EI6GGPDS.js +0 -20
- package/build/dist/chunks/FV4WZOTD.js +0 -1
- package/build/dist/chunks/FWD4L3CJ.js +0 -1
- package/build/dist/chunks/JBTOZ6IH.js +0 -1
- package/build/dist/chunks/MVD3KWPP.js +0 -1
- package/build/dist/chunks/P6OMKZMR.js +0 -3
- package/build/dist/chunks/PXVREXCS.js +0 -1
- package/build/dist/chunks/QJNLLI6N.js +0 -1
- package/build/dist/chunks/RPB46QAC.js +0 -1
- package/build/dist/chunks/TID4C2KC.js +0 -1
- package/build/dist/chunks/UWBKAWX3.js +0 -7
- package/build/dist/chunks/WHTRPRRD.js +0 -1
- package/build/dist/chunks/WLMWWEP7.js +0 -2
- package/build/dist/chunks/XQ24RSEI.js +0 -1
- package/build/dist/chunks/YDNTY67T.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as y,g as a,i as l,l as h,m as A,n as g}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{e as y,g as a,i as l,l as h,m as A,n as g}from"./NWNYJ26T.js";import{b as f,j as k}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,keccak256 as I,parseAbi as _,parseAbiParameters as P}from"viem";var u=k[f].clanker,O={type:"string",pattern:"^\\d+$"},$={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R=_(["function tokenDeploymentInfo(address) view returns ((address,address,address,address[]))","function tokenRewards(address) view returns ((address token,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,uint256 positionId,uint256 numPositions,uint16[] rewardBps,address[] rewardAdmins,address[] rewardRecipients))","function feePreferences(address,uint256) view returns (uint8)","function updateRewardRecipient(address,uint256,address)","function updateRewardAdmin(address,uint256,address)","function updateFeePreference(address,uint256,uint8)"]),x="Provide a valid nonzero address.";function c(e,o=!1){let r=l(e,x);return o?r:h(r,x)}function F(e){return g(e,"Amount exceeds uint256.")}function w(e,o,r){if(typeof e!="number"||!Number.isSafeInteger(e)||e<o||e>r)throw new s(`Choose an integer from ${o} to ${r}.`);return e}function H(e,o){let r=Object.keys(e).find(n=>!o.includes(n));if(r)throw new s(`Unsupported Clanker input: ${r}.`)}function T(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new s("Provide bytes32 hexadecimal data.");return e}function b(e){return A(e,"Clanker returned an invalid amount.").toString()}async function v(e,o){let r=await e.clientFor(f).readContract({address:u.factory.address,abi:R,functionName:"tokenDeploymentInfo",args:[o]});if(!Array.isArray(r)||r.length!==4||typeof r[0]!="string"||!a(r[0],o)||!Array.isArray(r[3]))throw new s("The pinned factory did not identify this Clanker token.");let n=c(r[1]),d=c(r[2]);if(![u.locker.address,u.legacy_locker_v1.address].some(t=>a(t,d))||![u.fee_static_hook_v2.address,u.fee_dynamic_hook_v2.address].some(t=>a(t,n)))throw new s("This Clanker locker or hook has not been verified by Oak.");return{hook:n,locker:d,extensions:r[3].map(t=>c(t))}}async function K(e,o){let r=await v(e,o),n=await e.clientFor(f).readContract({address:r.locker,abi:R,functionName:"tokenRewards",args:[o]});if(!y(n)||typeof n.token!="string"||!a(n.token,o)||!y(n.poolKey)||!Array.isArray(n.rewardBps)||!Array.isArray(n.rewardAdmins)||!Array.isArray(n.rewardRecipients))throw new s("Clanker returned invalid reward configuration.");let d=n.poolKey,t={currency0:c(d.currency0),currency1:c(d.currency1),fee:w(d.fee,0,16777215),tickSpacing:w(d.tickSpacing,1,32767),hooks:c(d.hooks)};if(BigInt(t.currency0)>=BigInt(t.currency1)||!a(t.hooks,r.hook)||![t.currency0,t.currency1].some(i=>a(i,o)))throw new s("Clanker returned a mismatched pool key.");let p=n.rewardBps.length;if(!p||p>7||p!==n.rewardAdmins.length||p!==n.rewardRecipients.length)throw new s("Clanker returned mismatched rewards.");let m=n.rewardBps.map(i=>w(i,1,1e4));if(m.reduce((i,C)=>i+C,0)!==1e4)throw new s("Clanker returned invalid reward splits.");return{...r,poolKey:t,poolId:I(S(P("address,address,uint24,int24,address"),[t.currency0,t.currency1,t.fee,t.tickSpacing,t.hooks])),positionId:b(n.positionId),numPositions:b(n.numPositions),rewardBps:m,rewardAdmins:n.rewardAdmins.map(i=>c(i)),rewardRecipients:n.rewardRecipients.map(i=>c(i)),pairedToken:a(t.currency0,o)?t.currency1:t.currency0}}export{u as a,O as b,$ as c,R as d,x as e,c as f,F as g,w as h,H as i,T as j,b as k,v as l,K as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Be,b as he,g as Z,h as be,i as Oe,m as ee,n as D,y as ke,z as Ee}from"./LKX5WDOQ.js";import{b as y,c as qe}from"./URBEK2VV.js";import{a as fe,b as H}from"./Z7FGEWO2.js";import{a as Q}from"./43LI5NKJ.js";import{a as Ie}from"./IOYRL6AY.js";import{a as $e}from"./66F5ZH34.js";import{c as le,g as P}from"./NWNYJ26T.js";import{b as Se}from"./IX3GZMTM.js";import{b,j as me}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{a as pe}from"./JXOEJPJ4.js";import{randomUUID as ze}from"node:crypto";import{encodeAbiParameters as ne,encodeFunctionData as we,erc20Abi as ge,getAddress as F,parseAbi as X,parseAbiParameters as oe,zeroAddress as K}from"viem";var Re=me[b].pons,C=me[b].ponsTrade,_e=X(["function getLaunchedToken(address) view returns ((address token,address curve,address deployer,address creatorFeeRecipient,address pairToken,uint256 graduationThreshold,uint24 poolFee,int24 tickSpacing,uint16 creatorTaxBps,bool buybackEnabled,uint8 phase,uint256 sweptQuote,uint256 sweptTokens,uint256 sweptAt,bool exists))"]),te=X(["function getReserves() view returns (uint256 quoteReserve,uint256 tokenReserve)","function feeBps() view returns (uint256)","function creatorTaxBps() view returns (uint256)","function currentSnipeTaxBps(address) view returns (uint256)","function sellableTokens() view returns (uint256)","function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]),He=X(["function quoteExactInputSingle(((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)"]),Ke=X(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),Xe=X(["function approve(address token,address spender,uint160 amount,uint48 expiration)"]),je=oe("((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint256 minHopPriceX36,bytes hookData)"),Ge={address:fe,chainId:b,decimals:18,symbol:"ETH"},Qe="There is no on-chain expiry. The signed transaction is protected by its minimum output.",Ve="This trade must be sent within 5 minutes of its quote. If you approve later, Oak shows you fresh terms first.",We=`Quote expiry is enforced by Oak before signing only. ${Qe}`,$=10000n,Te=(1n<<256n)-1n,Ne=(1n<<128n)-1n,I=(n,t)=>({token:n,amount:t.toString()}),Ce=(n,t)=>(n+t-1n)/t,Me="Reuse existing exact allowance";async function Je(n,t,r,o,c){try{let e=await n.readContract({address:t,abi:ge,functionName:"allowance",args:[r,o],blockNumber:c});return typeof e=="bigint"?e:void 0}catch{return}}var Ye={type:"object",additionalProperties:!1,required:["token","amountIn"],properties:{token:{...le,description:"Pons launch token address on chain 4663."},amountIn:$e('Input in base units: pair token for buys (use its decimals), launch token for sells (18 decimals). Examples: "1000000" = 1 pair token at 6 decimals; "1000000000000000000" = 1 launch token.'),pairToken:{...le,description:"The launch pair from pons_status. Required to buy a custom-pair launch, so amountIn is never read in the wrong units; omit or use the zero address for native ETH."},slippageBps:{description:"Slippage tolerance in basis points (50 = 0.5%).",type:"integer",minimum:0,maximum:9999,default:he}}};function De(n,t,r,o){if(n===void 0){if(r&&y(t)!==K)throw new d(`This Pons launch is paired with ${o}; amountIn is in that token's base units. Repeat with pairToken "${t}" to confirm the input asset.`);return}if(typeof n!="string")throw new d("pairToken must be a token address.");if(Q(n),!P(y(n),y(t)))throw new Z(`This Pons launch trades only against ${o}.`)}async function Fe(n,t,r,o,{quoteOnly:c=!1,curveOnly:e=!1,blockNumber:p}={}){if(Q(r),Object.keys(t).some(f=>!["token","amountIn","slippageBps","pairToken"].includes(f)))throw new d("Provide only token, amountIn, optional pairToken and optional slippageBps.");if(typeof t.token!="string")throw new d("Provide a launch token address.");Q(t.token);let s=F(t.token),i=Se(t.amountIn);if(i===0n||i>Te)throw new d("Trade amount must be positive and within the uint256 range.");let m=t.slippageBps??he;if(typeof m!="number"||!Number.isInteger(m)||m<0||m>=1e4)throw new d("Slippage must be an integer from 0 to 9999 basis points.");let x=f=>f*($-BigInt(m))/$,a=n.clientFor(b),l=p===void 0?await a.getBlock():await a.getBlock({blockNumber:p});if(p!==void 0&&l.number!==p)throw new d("Pons quote snapshot is unavailable.");let u=await a.readContract({address:Re.factory.address,abi:_e,functionName:"getLaunchedToken",args:[s],blockNumber:l.number});if(!u.exists||!P(u.token,s))throw new d("This address is not a Pons launch token.");if(e&&u.phase!==0)throw new Z("Pons curve quotes are only available before graduation.");if(u.phase===1)throw new d("Pons graduation is pending; the curve is closed and the pool is not ready.");if(u.phase===3)throw new d("This Pons launch was rescued and has no active trade route.");if(u.phase!==0&&u.phase!==2)throw new d("This Pons launch has an unknown trade phase.");let g=y(u.pairToken)===K,M=F(u.pairToken);if(P(M,s))throw new d("This Pons launch has an invalid pair.");let j=f=>Promise.all([a.readContract({address:f,abi:ge,functionName:"symbol",blockNumber:l.number}),a.readContract({address:f,abi:ge,functionName:"decimals",blockNumber:l.number})]),[[B,U],L]=await Promise.all([j(s),g?void 0:j(M)]),w=L?{address:M,chainId:b,symbol:pe(L[0]),decimals:L[1]}:Ge,G=g?"native ETH":`${w.symbol} (${w.address})`;De(t.pairToken,M,o,`${G}, ${w.decimals} decimals`);let V={address:s,chainId:b,symbol:pe(B),decimals:U},se=o?w:V,ie=o?V:w,q=[],re=(f,h,S,A)=>n.unsignedTx({to:f,data:h,value:S.toString(),chainId:b,description:A}),T,k,W,O=i,ve=null,ae,ye="",ue;if(u.phase===0){let f=v=>a.readContract({address:u.curve,abi:te,functionName:v,blockNumber:l.number}),[[h,S],A,R,E,_]=await Promise.all([a.readContract({address:u.curve,abi:te,functionName:"getReserves",blockNumber:l.number}),f("feeBps"),f("creatorTaxBps"),o?a.readContract({address:u.curve,abi:te,functionName:"currentSnipeTaxBps",args:[r],blockNumber:l.number}):Promise.resolve(0n),o?f("sellableTokens"):Promise.resolve(0n)]);if(h<=0n||S<=0n||A+R>$-100n)throw new d("Pons curve reserves or fee settings are unavailable.");let J=$-A-R-100n,N=E<J?E:J,Ae=v=>({base:v*A/$,creator:v*R/$,snipe:v*N/$}),Pe=v=>{let z=Ae(v);return v-z.base-z.creator-z.snipe},Y;if(o){if(_<=0n||_>=S)throw new d("The curve has no available sellable tokens.");let v=Pe(i);if(T=v*S/(h+v),T>=_){T=_;let z=T*h/(S-T)+1n;O=Ce(z*$,$-A-R-N),O>i&&(O=i)}Y=O,k=x(T),W=Ce(k*i,O),g||q.push(n.approval(w.address,u.curve,i.toString(),b))}else Y=i*h/(S+i),T=Pe(Y),k=x(T),q.push(n.approval(s,u.curve,i.toString(),b));let ce=Ae(Y);ve={base:I(w,ce.base),creator:I(w,ce.creator),snipe:I(w,ce.snipe)},ae=`Curve fees included: ${A} base, ${R} creator and ${N} opening-tax basis points, each rounded separately.`,q.push(re(u.curve,we({abi:te,functionName:o?"buy":"sell",args:[i,W??k,r]}),o&&g?i:0n,o?`Buy Pons curve tokens with ${G}.`:`Sell Pons curve tokens for ${G}.`))}else{if(i>Ne)throw new d("Trade amount exceeds the router uint128 range.");let f=qe(u.pairToken,s,u.poolFee,u.tickSpacing),h=o?y(u.pairToken):s,S=o?s:y(u.pairToken),A=P(h,f.currency0);if(T=(await a.simulateContract({address:C.quoter.address,abi:He,functionName:"quoteExactInputSingle",args:[{poolKey:f,zeroForOne:A,exactAmount:i,hookData:"0x"}],account:r,gas:Ie,blockNumber:l.number})).result[0],k=x(T),k>Ne)throw new d("Minimum output exceeds the router uint128 range.");let E=l.timestamp+300n;if(ue=E.toString(),E>=1n<<48n)throw new d("Permit2 expiry exceeds its timestamp range.");if(h!==K){let N=!c&&await Je(a,h,r,C.permit2.address,l.number)===i;N||q.push(n.approval(h,C.permit2.address,i.toString(),b)),ye=N?`${Me}: ${i} input base units already approved to Permit2. `:"",q.push(re(C.permit2.address,we({abi:Xe,functionName:"approve",args:[h,C.universal_router.address,i,Number(E)]}),0n,`${N?`${Me}. `:""}Approve the exact token amount to the Pons router through Permit2 for five minutes.`))}let _=[ne(je,[{poolKey:f,zeroForOne:A,amountIn:i,amountOutMinimum:k,minHopPriceX36:0n,hookData:"0x"}]),ne(oe("address,uint256"),[h,i]),ne(oe("address,uint256"),[S,k])],J=ne(oe("bytes,bytes[]"),["0x060c0f",_]);q.push(re(C.universal_router.address,we({abi:Ke,functionName:"execute",args:["0x10",[J],E]}),h===K?i:0n,"Trade through Pons Universal Router v2.1.2.")),ae="Quoter output is net of Pons hook fees; no additional fee is subtracted."}if(T<=0n||k<=0n||k>Te||(W??k)>Te)throw new d("Trade output or minimum is outside the supported positive range.");let xe=c?{changes:[],summary:"Quote only; preview is required before sending."}:await n.preview(q,r),de=i-O;return{txs:q,changes:xe.changes,...ue===void 0?{}:{expiresAt:ue},summary:`${o?"Buy":"Sell"} ${V.symbol} (${V.address}) on chain ${b}${g?"":` ${o?"with":"for"} ${G}`}. ${ae} ${ye}${u.phase===0?`${Qe} `:`${Ve} `}${de>0n?`Expected ${g?"native refund":"refund"}: ${n.formatAmount(de.toString(),w.decimals)} ${w.symbol}; minimum output uses the expected spend after refund. `:""}${xe.summary}`,pairToken:w,quote:{phase:u.phase,amountIn:I(se,i),amountOut:I(ie,T),minAmountOut:I(ie,k),minimumKind:"absolute",calldataMinAmountOut:I(ie,W??k),expectedSpend:I(se,O),expectedRefund:I(se,de),fees:ve,blockNumber:l.number.toString(),blockTimestamp:l.timestamp.toString()}}}function hn(n){return Ue(n,!0)}function Ue(n,t=!1,r){let o=new Map,c=e=>{if(BigInt(ee())>=BigInt(e.expiresAt))throw new be};return{name:"pons",async quote(e,p){if(e={...e,from:H(e.from),to:H(e.to)},D(e.from)&&D(e.to))throw new Z("Pons quotes require a launch token and its pair token.");let s=D(e.from)||!D(e.to)&&await Ze(n,e.from,e.to,r),i=ee(),m=await Fe(n,{token:s?e.to:e.from,amountIn:e.amountIn,slippageBps:e.slippageBps,pairToken:y(s?e.from:e.to)},p,s,{quoteOnly:!0,curveOnly:t,blockNumber:r}),x=m.txs.at(-1),a=m.quote,l=String(BigInt(r===void 0?i:a.blockTimestamp)+BigInt(Be)),u=a.minAmountOut.amount,g=a.fees,M=D(m.pairToken.address)?"native ETH base units (18 decimals)":`${m.pairToken.symbol} (${m.pairToken.address}) base units (${m.pairToken.decimals} decimals)`,j=g?`Pons curve fees included in net output: ${g.base.amount} base, ${g.creator.amount} creator and ${g.snipe.amount} opening tax, in ${M}. Oak swap fee: 0 (venue fee is never Oak income). ${We}`:"Quoter output is net of Pons hook fees; no additional fee is subtracted. Oak swap fee: 0.",B=Ee({...e,quoteId:`pons:${ze()}`,provider:"pons",wallet:p,chainId:b,router:x.to,spender:a.phase===0?x.to:C.permit2.address,expiresAt:l,data:x.data,value:x.value,amountOut:a.amountOut.amount,minAmountOut:u,blockNumber:a.blockNumber,...a.phase===0?{ponsCurveToken:s?e.to:e.from,calldataMinAmountOut:a.calldataMinAmountOut.amount}:{ponsPoolToken:s?e.to:e.from},expectedSpend:a.expectedSpend.amount,expectedRefund:a.expectedRefund.amount,feeDisclosure:j,oakFee:"0"});ke(x,B),c(B);for(let[U,L]of o)BigInt(ee())>=BigInt(L.quote.expiresAt)&&o.delete(U);for(;o.size>=Oe;)o.delete(o.keys().next().value);return o.set(B.quoteId,{quote:{...B},txs:m.txs.map(U=>({...U})),summary:m.summary}),B},async build(e,p){let s=o.get(e);if(!s)throw new be;if(c(s.quote),Q(p),!P(p,s.quote.wallet))throw new d("Quote was issued for a different wallet.");let i=s.txs.map(a=>({...a}));ke(i.at(-1),s.quote);let m=await n.preview(i,p);if(c(s.quote),m.changes.filter(a=>P(H(a.token.address),H(s.quote.to))).reduce((a,l)=>a+BigInt(l.amount),0n)<BigInt(s.quote.minAmountOut))throw new d("Preview retained output is below the accepted minimum.");return{txs:i,summary:`${s.summary} ${m.summary} ${s.quote.feeDisclosure}`}}}}async function Le(n,t,r){return n.clientFor(b).readContract({address:Re.factory.address,abi:_e,functionName:"getLaunchedToken",args:[F(t)],...r===void 0?{}:{blockNumber:r}})}async function Ze(n,t,r,o){let c=await Le(n,r,o);return c.exists&&P(c.token,r)&&P(y(c.pairToken),y(t))}async function bn(n,t,r,o,c){if(typeof r.token!="string")throw new d("Provide a launch token address.");Q(r.token);let e=F(r.token),p=await Le(n,e,c);if(!p.exists||!P(p.token,e))throw new d("This address is not a Pons launch token.");let s=y(p.pairToken)===K?fe:F(p.pairToken);return De(r.pairToken,F(p.pairToken),t,s),{quote:await Ue(n,!1,c).quote({from:t?s:e,to:t?e:s,amountIn:String(r.amountIn),...r.slippageBps===void 0?{}:{slippageBps:r.slippageBps}},o),input:t?s:e}}var en=n=>({tools:[!0,!1].map(t=>({name:t?"pons_buy":"pons_sell",inputSchema:Ye,async execute(r,o){try{return await Fe(n,r,o,t)}catch(c){throw new d(n.plainError(c))}}}))}),kn=en;export{hn as a,Ue as b,bn as c,en as d,kn as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Te}from"./JFWJBZ7M.js";import{c as Se}from"./VMZYFO6I.js";import{a as qe,b as me,c as De}from"./Z3IBPCY4.js";import{h as Re,i as t,j as A,k as d,l as Ce,m as J,n as k,o as ue,p as F,r as O,s as c,t as ce,u as le,v as pe,w as Ae,x as $e}from"./Y64GFBTA.js";import{a as ve,o as de}from"./LKX5WDOQ.js";import{a as ke}from"./66F5ZH34.js";import{c as re,e as z,g as M}from"./NWNYJ26T.js";import{b as l,j as be}from"./TI727O2H.js";import{a as m}from"./XSD5NL7J.js";import{decodeFunctionData as Ue,erc20Abi as Me}from"viem";var K="0x0000000000000000000000000000000000000000",_=be[l].relay.depository.address.toLowerCase(),xe=30;function Fe(y){return/HTTP (400|401|403)\b|API key|\bhosted\b|authenticated wallet session/i.test(y)}var Ke=y=>{let L=$e(y);async function he(i){let e;try{e=await L(`/intents/status/v3?requestId=${encodeURIComponent(i)}`)}catch(D){if(y.plainError(D)!=="The request timed out. Please try again.")throw D;return{requestId:i,status:"unknown",timedOut:!0,fulfilled:!1,settled:!1,pollAgain:!0,needsAttention:!1,inTxHashes:[],txHashes:[],originChainId:void 0,destinationChainId:void 0,summary:"The status request timed out. Bridge settlement is unknown; poll again."}}if(typeof e.status!="string")throw new m("Relay returned an invalid bridge status.");let n=ce(e.inTxHashes),h=ce(e.txHashes),r=e.originChainId===void 0?void 0:J(e.originChainId),u=e.destinationChainId===void 0?void 0:J(e.destinationChainId),o=le(e.failReason),I=le(e.refundFailReason),s=e.status==="success"&&h.length>0&&u!==void 0,p=e.status==="refund"&&h.length>0&&r!==void 0,$=e.status==="failure"&&I!==void 0,f=["waiting","depositing","pending","submitted","failure","refund","success"].includes(e.status)?e.status==="failure"&&/TIMEOUT|EXPIRED/.test(typeof e.failReason=="string"?e.failReason:"")?"timeout":e.status:"unknown",q=s?"Relay reports destination fulfillment.":p?"Relay reports a refund on the origin chain; the destination was not fulfilled.":$?"The bridge failed and automatic refund is unavailable. Review the request with Relay.":"Bridge settlement is not confirmed. Poll Relay again; an origin receipt alone does not prove destination fulfillment.";return{requestId:i,status:f,relayStatus:e.status,fulfilled:s,settled:s||p,pollAgain:!s&&!p&&!$,needsAttention:$,timedOut:!1,inTxHashes:n,txHashes:h,originChainId:r,destinationChainId:u,failReason:o,refundFailReason:I,...e.updatedAt===void 0?{}:{updatedAt:k(String(e.updatedAt))},summary:q}}async function Ee(i,e){let n=o=>({destinationVerified:!1,destinationCheck:o}),h;try{if(h=y.clientFor(i),await h.getChainId()!==i)return n(`The configured RPC does not serve chain ${i}; destination receipts were not checked.`)}catch{return n(`No RPC is available for chain ${i}; destination receipts were not checked.`)}let r=[];for(let o of e)try{let I=await h.getTransactionReceipt({hash:o});r.push({hash:o,status:I.status,blockNumber:I.blockNumber.toString()})}catch{return{...n(`Receipt ${o} is not available on chain ${i} yet; poll again.`),destinationReceipts:r}}let u=r.length>0&&r.every(o=>o.status==="success");return{destinationVerified:u,destinationReceipts:r,destinationCheck:u?`Every Relay destination transaction has a successful receipt on chain ${i}. Amounts are not decoded here; compare the recipient balance for the exact delivered amount.`:`A Relay destination transaction did not succeed on chain ${i}; do not treat this bridge as delivered.`}}async function Pe(i){let e=await y.clientFor(l).readContract({address:i,abi:Me,functionName:"decimals"}),n=typeof e=="bigint"?Number(e):e;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>255)throw new m("Could not read valid ERC-20 decimals() on-chain.");return n}async function Oe(i,e){let n=d(e),h=d(i.recipient??n),r=J(i.destinationChainId);if(r===l)throw new m("Choose a destination chain other than 4663.");let u=Ce(i.originCurrency??K),o=u!==K,I=d(i.destinationCurrency??K),s=k(i.amount);if(s==="0")throw new m("Provide a positive bridge amount.");let p=i.minAmountOut===void 0?void 0:k(i.minAmountOut),$=i.slippageBps??me;if(typeof $!="number")throw new m("Slippage must be an integer from 0 to 9999 bps.");de("0",$);let v=A((await L("/chains")).chains).map(t),f=v.find(a=>a.id===l),q=v.find(a=>a.id===r);if(!f||!q||f.disabled!==!1||q.disabled!==!1||f.depositEnabled!==!0||f.vmType!=="evm"||q.vmType!=="evm")throw new m("Relay does not currently support this outbound chain route.");if(!Se(r))throw new m(`Relay has no supported Oak return path from chain ${r}. Choose a destination supported by relay_bridge_in before bridge-out.`);let D=await qe(y.clientFor,r,n,"server"),H=o?await Pe(u):18,b=Math.floor(Date.now()/1e3)+ve,R=await L("/quote/v2",{user:n,recipient:h,originChainId:l,destinationChainId:r,originCurrency:u,destinationCurrency:I,amount:s,tradeType:"EXACT_INPUT",...o?{explicitDeposit:!0}:{}}),C=F(R.requestId),x=t(R.details),N=O(x.currencyIn),g=O(x.currencyOut),S={token:g.token,amount:k(t(x.currencyOut).minimumAmount)};if(c(d(x.sender)===n&&d(x.recipient)===h&&N.token.chainId===l&&N.token.address===u&&N.token.decimals===H&&N.amount===s&&g.token.chainId===r&&g.token.address===I&&BigInt(S.amount)>0n&&BigInt(S.amount)<=BigInt(g.amount)),I===K&&c(g.token.decimals===t(q.currency).decimals),p!==void 0){if(S.amount!==p)throw new m("Relay order minimum must exactly match minAmountOut. Request a new quote.")}else if(BigInt(S.amount)<BigInt(de(g.amount,$)))throw De(g.amount,S.amount);let Z=t(t(R.protocol).v2),G=F(Z.orderId),j=t(Z.orderData),V=t(j.output),ee=ue(V.deadline),X=A(j.inputs).map(t);c(X.length>0);let te=X.flatMap(a=>{let w=A(a.refunds).map(t);return c(w.length>0),w.map(Ie=>{if(d(Ie.recipient)!==n)throw new m("Relay refund recipient does not match the agent wallet. Request a new quote.");return ue(Ie.deadline)})}),_e=te.reduce((a,w)=>Math.min(a,w),ee),ne=Math.min(b,_e-xe),fe=()=>{if(Date.now()/1e3>=ne)throw new m("The Relay quote expired or its order/refund deadline leaves too little time to sign and send. Request a fresh bridge quote.")};fe();let B=A(V.payments).map(t),ie=t(t(f.protocol).v2),He=t(t(q.protocol).v2),Y=t(Z.paymentDetails);c(V.chainId===He.chainId&&B.length===1&&A(V.calls).length===0&&d(B[0].recipient)===h&&d(B[0].currency)===I&&k(B[0].minimumAmount)===S.amount&&k(B[0].expectedAmount)===g.amount&&Y.chainId===ie.chainId&&d(Y.currency)===u&&k(Y.amount)===s),c(d(Y.depository)===_&&d(ie.depository)===_);let oe=t(X[0].payment);c(X.length===1&&oe.chainId===ie.chainId&&d(oe.currency)===u&&k(oe.amount)===s);let U=A(R.steps).map(t),P=o&&U.length===2?U[0]:void 0;c(U.length===(P?2:1));let Q=U[U.length-1];c(Q.kind==="transaction"&&Q.id==="deposit"&&Q.requestId===C);let W=A(Q.items).map(t);c(W.length===1&&W[0].status==="incomplete");let T=t(W[0].data),ye=t(W[0].check);if(c(ye.method==="GET"&&ye.endpoint===`/intents/status/v3?requestId=${C}`&&T.chainId===l&&d(T.from)===n&&d(T.to)===_&&k(T.value)===(o?"0":s)),typeof T.data!="string"||!(o?/^0x[0-9a-fA-F]{264}$/:/^0x[0-9a-fA-F]{136}$/).test(T.data))throw new m(`Relay returned unexpected ${o?"ERC-20":"native"} deposit calldata.`);let E=Ue({abi:Re,data:T.data});E.functionName==="depositErc20"?c(o&&d(E.args[0])===n&&d(E.args[1])===u&&E.args[2]===BigInt(s)&&M(E.args[3],G)):c(!o&&d(E.args[0])===n&&M(E.args[1],G));let Ne=v.filter(a=>a.vmType==="evm"&&z(a.protocol)&&z(a.protocol.v2)).map(a=>t(t(a.protocol).v2).chainId).filter(a=>typeof a=="string");if(!M(Te(j,Ne),G))throw new m("Relay order ID does not match the checked quote terms. Request a new quote.");let ae=o?y.approval(u,_,s,l):void 0;if(P&&ae){c(P.kind==="transaction"&&P.id==="approve"&&P.requestId===C);let a=A(P.items).map(t);c(a.length===1&&a[0].status==="incomplete");let w=t(a[0].data);c(w.chainId===l&&d(w.from)===n&&d(w.to)===u&&k(w.value)==="0"&&typeof w.data=="string"&&M(w.data,ae.data))}let ge=[...ae?await Ae(y,u,_,s,l,n):[],y.unsignedTx({to:_,data:T.data,value:o?"0":s,chainId:l,description:o?`Deposit ${s} base units of ${u} for Relay request ${C}.`:`Deposit native ETH for Relay request ${C}.`})],we=t(R.fees);for(let a of Object.values(we))O(a);let se=await y.preview(ge,n);fe();let Be=se.changes.map(a=>{let w=a.amount.startsWith("-");return`${w?"-":""}${y.formatAmount(w?a.amount.slice(1):a.amount,a.token.decimals)} ${a.token.symbol}`}).join(", ");return{txs:ge,requestId:C,orderId:G,orderData:structuredClone(j),recipient:h,originChainId:l,destinationChainId:r,expiresAt:String(ne),orderDeadline:String(ee),refundDeadlines:te.map(String),returnPath:D,amountIn:N,amountOut:g,minAmountOut:S,fees:we,expandedPriceImpact:x.expandedPriceImpact,timeEstimate:x.timeEstimate,preview:se,summary:`${D} Bridge to ${h} on chain ${r}; asset ${g.token.address} on chain ${g.token.chainId} (${pe(g.token.symbol)}); expected ${g.amount}, minimum ${S.amount} base units (${g.token.decimals} decimals). Order deadline ${ee} Unix seconds; refund deadlines ${te.join(", ")} Unix seconds; accept before ${ne} Unix seconds to reserve ${xe}s to sign and send. Origin preview: ${Be||se.summary}. Relay route fees are included in the quote; origin gas is separate. Poll relay_status with requestId ${C} after local submission; destination fulfillment is not yet confirmed.`}}return{tools:[{name:"relay_bridge_out",inputSchema:{type:"object",required:["destinationChainId","amount"],additionalProperties:!1,properties:{destinationChainId:{type:"integer",minimum:1,description:"Destination chain ID."},amount:{type:"string",pattern:"^[1-9][0-9]*$",description:'Origin token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'},recipient:{...re,description:"Destination recipient address; defaults to your wallet."},originCurrency:{...re,description:"Origin token address; defaults to native ETH."},slippageBps:{type:"integer",minimum:0,maximum:9999,default:me,description:"Slippage in basis points (50 = 0.5%)."},destinationCurrency:{type:"string",description:"Destination token address; defaults to the destination chain\u2019s native token."},minAmountOut:ke('Minimum destination token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).')}},execute:async(i,e)=>{try{return await Oe(i,e)}catch(n){throw new m(y.plainError(n))}}},{name:"relay_status",inputSchema:{type:"object",required:["requestId"],additionalProperties:!1,properties:{requestId:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$",description:"Relay request ID as a 0x-prefixed 32-byte hex string."},verifyDestination:{type:"boolean",description:"Check destination transactions on their chain when fulfilled."}}},execute:async i=>{let e=await he(F(i.requestId));return i.verifyDestination!==!0||!e.fulfilled||e.destinationChainId===void 0?e:{...e,...await Ee(e.destinationChainId,e.txHashes)}}}],positions:async i=>{let e=d(i),n=new Map,h={module:"relay",id:"relay-discovery-unavailable",chainId:l,assets:[],incomplete:!0,description:`Relay pending bridge discovery is unavailable: it needs the hosted Relay read (Oak's server-held Relay key), which is not available in this setup; no pending bridges were checked, which is not the same as none pending. Ask the operator to enable it, or check a known request with relay_status {"requestId":"<id>"}. Legacy vault shares on other chains can be checked with relay_vault_status {"chainId":1} or {"chainId":42161}.`};for(let r of["outbound","inbound"]){let u=new Set,o;do{let I=new URLSearchParams({user:e,[r==="outbound"?"originChainId":"destinationChainId"]:String(l),limit:"100",includePendingRequests:"true"});o&&I.set("continuation",o);let s;try{s=await L(`/requests/v3?${I}`)}catch(p){if(Fe(y.plainError(p)))return[...n.values(),h];throw p}for(let p of A(s.requests).map(t)){let $=z(p.depositAddress)?p.depositAddress.depositor:void 0;if(![p.user,p.sender,$].some(C=>typeof C=="string"&&C.toLowerCase()===e))throw new m("Relay returned a request for another wallet.");let v=F(p.id);if(n.has(v))continue;let f=await he(v);if(f.settled)continue;let q=t(p.data),D=t(t(q.route).quoted),H=O(t(D.origin).inputCurrency),b={...H,token:{...H.token,symbol:pe(H.token.symbol)??"unknown"}},R=O(t(D.destination).outputCurrency);c(r==="outbound"?b.token.chainId===l&&R.token.chainId!==l:b.token.chainId!==l&&R.token.chainId===l),f.originChainId!==void 0&&c(f.originChainId===b.token.chainId),f.destinationChainId!==void 0&&c(f.destinationChainId===R.token.chainId),n.set(v,{module:"relay",id:v,chainId:b.token.chainId,assets:[b],description:`Relay ${r} ${f.status}: ${b.amount} ${b.token.symbol} base units (${b.token.decimals} decimals) from chain ${b.token.chainId} toward ${d(p.recipient)} on chain ${R.token.chainId}. ${f.summary} Track with relay_status requestId ${v}.`})}if(s.continuation!==void 0&&s.continuation!==null&&typeof s.continuation!="string")throw new m("Relay returned invalid pagination.");if(o=typeof s.continuation=="string"&&s.continuation?s.continuation:void 0,o){if(u.has(o))throw new m("Relay repeated its pagination cursor. Pending positions are incomplete.");u.add(o)}}while(o)}return[...n.values()]}}};export{Ke as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A}from"./
|
|
1
|
+
import{a as A}from"./JI5DXDMY.js";import{a as i,b as w,c as b,e as C,f as x,g as h}from"./LJJYYUEG.js";import{a as o}from"./66F5ZH34.js";import{c as y}from"./NWNYJ26T.js";import{b as f}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeAbiParameters as S,encodeFunctionData as g,encodePacked as T,erc20Abi as I,getAddress as q,parseAbi as B,parseAbiParameters as D,zeroAddress as R}from"viem";var L=q("0x0000ffffbe8efe702c8703ae3477ff5de3d319c0"),N=D("(address currency,address tokensRecipient,address fundsRecipient,uint64 startBlock,uint64 endBlock,uint64 claimBlock,uint256 tickSpacing,address validationHook,uint256 floorPrice,uint128 requiredCurrencyRaised,bytes auctionStepsData)"),P=B(["function create(address token,uint256 amount,bytes configData,bytes32 salt) returns (address)","function getAddress(address token,uint256 amount,bytes configData,bytes32 salt,address sender) view returns (address)"]),O=B(["function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable"]),v={token:{...y,description:"Address of the ERC-20 sale token to distribute in this auction."},amount:o('Amount of sale token in base units; use sale token decimals. Example: "1000000" = 1 sale token at 6 decimals.'),currency:{...y,description:"Payment currency address; the zero address means native ETH."},startBlock:o("Future block number at which auction bidding starts, as a decimal string."),endBlock:o("Block number at which auction bidding ends, as a decimal string."),claimBlock:o("First block number at which auction tokens can be claimed, as a decimal string."),tickSpacing:o("Auction price tick spacing in Q96 payment-currency base units per sale-token base unit."),floorPrice:o("Auction floor price in Q96 payment-currency base units per sale-token base unit."),requiredCurrencyRaised:o('Minimum amount of payment currency in base units; use payment currency decimals. Example: "1000000" = 1 payment currency at 6 decimals.'),salt:{description:"Deployment salt as a 32-byte hex string; choose a fresh value for a new deployment.",type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},steps:{description:"Auction issuance steps; durations must cover endBlock minus startBlock and mps times duration must total 10000000.",type:"array",minItems:1,maxItems:100,items:{type:"object",additionalProperties:!1,required:["mps","duration"],properties:{mps:o("Issuance rate per block in MPS units; sum of mps times duration across steps must equal 10000000."),duration:o("Duration of this issuance step in blocks, as a decimal string.")}}}};function $(e,t){let r=i(e.startBlock,"startBlock",64),n=i(e.endBlock,"endBlock",64),c=i(e.claimBlock,"claimBlock",64);if(n<=r||c<n)throw new s("Auction needs startBlock < endBlock <= claimBlock.");if(!Array.isArray(e.steps)||e.steps.length<1||e.steps.length>100)throw new s("Provide 1 to 100 issuance steps.");let u="0x",p=0n,l=0n;for(let d of e.steps){if(!d||typeof d!="object"||Array.isArray(d))throw new s("Each step requires mps and duration decimal strings.");h(d,["mps","duration"]);let a=d,k=i(a.mps,"mps",24,!0),m=i(a.duration,"duration",40);u=`${u}${T(["uint24","uint40"],[Number(k),Number(m)]).slice(2)}`,l+=k*m,p+=m}if(l!==10000000n||p!==n-r)throw new s("Issuance must total exactly 10000000 MPS and its durations must equal endBlock - startBlock.");return S(N,[{currency:b(e.currency),tokensRecipient:t,fundsRecipient:t,startBlock:r,endBlock:n,claimBlock:c,tickSpacing:i(e.tickSpacing,"tickSpacing"),validationHook:R,floorPrice:i(e.floorPrice,"floorPrice"),requiredCurrencyRaised:i(e.requiredCurrencyRaised??"0","requiredCurrencyRaised",128,!0),auctionStepsData:u}])}function z(e){return{tools:[{name:"uniswap_create_auction",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","currency","startBlock","endBlock","claimBlock","tickSpacing","floorPrice","steps","salt"],properties:v},async execute(t,r){h(t,Object.keys(v));let n=w(t.token),c=i(t.amount,"amount",128);if(n===R||n===b(t.currency))throw new s("Auction sale token must be an ERC-20 distinct from its payment currency.");let u=$(t,r);if(typeof t.salt!="string"||!/^0x[0-9a-fA-F]{64}$/.test(t.salt))throw new s("Provide a 32-byte deployment salt.");let p=t.salt,l=e.clientFor(f),d=await l.getBlockNumber();if(BigInt(String(t.startBlock))<=d)throw new s("Choose a future auction startBlock with time for confirmation and approvals.");let a=await l.readContract({address:A,abi:P,functionName:"getAddress",args:[n,c,u,p,r]});if((await l.getCode({address:a})??"0x")!=="0x")throw new s("This auction already exists; choose a fresh salt or configuration.");let k=await C(e,n),m=[e.unsignedTx({to:A,data:g({abi:P,functionName:"create",args:[n,c,u,p]}),value:"0",chainId:f,description:`Create CCA ${a}; proceeds and unsold tokens go to ${r}.`}),e.unsignedTx({to:n,data:g({abi:I,functionName:"transfer",args:[a,c]}),value:"0",chainId:f,description:`Fund the factory-predicted auction ${a} with exactly ${c} base units of ${n}.`}),e.unsignedTx({to:a,data:g({abi:B(["function onTokensReceived()"]),functionName:"onTokensReceived"}),value:"0",chainId:f,description:`Activate CCA ${a} after its sale tokens arrive.`})];return{...await x(e,m,r,"Create/fund/activate a standalone CCA in three separately confirmed transactions, not an LBP-managed liquidity launch. If interrupted, inspect the predicted address and journal before recovery; do not transfer tokens twice. Raw prices are payment-base-units per sale-token-base-unit in Q96. No validation hook or off-chain signature; all proceeds and unsold tokens go to the signing wallet."),auction:a,sale:{token:k,amount:c.toString()}}}}]}}export{L as a,N as b,P as c,O as d,$ as e,z as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as V,k as T}from"./
|
|
1
|
+
import{g as V,k as T}from"./OODSXDIH.js";import{t as R,y as A}from"./WBNFRPAT.js";import{e as O,h as D,i as M,j as S,m as U,o as _,p as q}from"./XRDLMTBJ.js";import{a as I,b as k,g as F,h as H,i as N}from"./MQK6OP7S.js";import{a as t}from"./XSD5NL7J.js";import{randomUUID as J}from"node:crypto";import{getAddress as g,parseAbiItem as E}from"viem";var Q=E("event FamilyLaunched(bytes32 indexed familyId,address indexed owner,address indexed subject,address root)"),Y=E("event FamilyTransferred(bytes32 indexed familyId,address indexed owner)"),j=100000n,Z=64,z=512,K=300*1e3;function ce(P){let l=new Map,h=[g(k.launcherLegacy),g(k.launcherV1)],L=I.launcherDeployments,W=h.reduce((r,d)=>BigInt(L[d].blockNumber)<r?BigInt(L[d].blockNumber):r,BigInt(I.blockNumber));return{name:"hookr_lp_positions",inputSchema:{type:"object",additionalProperties:!1,properties:{cursor:{type:"string",minLength:1,maxLength:64,description:"Opaque, wallet-bound cursor from the preceding page; expires after five minutes. Restart without it if expired."},limit:{type:"integer",minimum:1,maximum:20,description:"Position summaries per page; defaults to 10. A page scans at most 100000 blocks and 32 family checks."}}},execute:async(r,d)=>{if(O(r,["cursor","limit"]),P.network==="testnet")throw new t("Hookr LP reads are configured only on mainnet, chain 4663.");let u=r.limit??10;if(typeof u!="number"||!Number.isInteger(u)||u<1||u>20)throw new t("Provide a Hookr position page limit from 1 to 20.");for(let[o,s]of l)s.expires<=Date.now()&&l.delete(o);let f=P.clientFor(4663),e;if(r.cursor!==void 0){if(typeof r.cursor!="string"||!l.has(r.cursor))throw new t("Hookr position cursor is unknown or expired. Restart without cursor; completeness has not been established.");let o=l.get(r.cursor);if(o.wallet!==d)throw new t("Hookr position cursor belongs to a different wallet. Restart without cursor.");if((await H(f,o.block.number)).hash!==o.block.hash)throw new t("Hookr position snapshot changed. Restart without cursor.");e={...o,candidates:[...o.candidates],seen:new Set(o.seen)}}else{let o=await H(f);e={wallet:d,block:o,nextBlock:o.number,firstBlock:W,candidates:[],member:0,seen:new Set,expires:Date.now()+K}}await F(f,e.block.number,[...h,k.rootV1]);let b=[],y=[],w=!1;if(e.candidates.length===0&&e.nextBlock>=e.firstBlock){let o=e.nextBlock,s=o-j+1n>e.firstBlock?o-j+1n:e.firstBlock;try{let i=(await Promise.all(h.flatMap(n=>[Q,Y].map(c=>f.getLogs({address:n,event:c,args:{owner:d},fromBlock:s,toBlock:o,strict:!0}))))).flat();if(i.length>z*2)throw new t("Hookr event page exceeds the bounded discovery limit. A dedicated position index is required.");let m=new Map;for(let n of i){let c=g(n.address),p=D(n.args.familyId);if(n.removed||!n.blockNumber||n.blockNumber<s||n.blockNumber>o||!h.includes(c)||n.args.owner!==d)throw new t("Hookr event page is incomplete or inconsistent with the requested wallet and block range.");let a=`${c}:${p}`;e.seen.has(a)||m.set(a,{launcher:c,familyId:p})}if(e.seen.size+m.size>z)throw new t("Hookr wallet history exceeds the bounded discovery limit. Completeness requires a dedicated position index.");e.candidates=[...m.values()];for(let n of m.keys())e.seen.add(n);e.nextBlock=s-1n}catch(i){w=!0,b.push(i instanceof t?i.message:"Hookr event history is unavailable for this block range. Retry this cursor; an empty page does not establish no positions.")}}let X=0;for(;!w&&e.candidates.length&&y.length<u&&X++<32;){let o=e.candidates[0],s=(i,m)=>q(f,o.launcher,_(o.launcher===g(k.launcherV1)?"launcherV1":"launcher"),i,m,e.block.number);try{let[i,m]=await Promise.all([s("familyOwner",[o.familyId]),s("memberCount",[o.familyId])]),n=M(i);if(BigInt(n)===0n)throw new t("Hookr family owner is unavailable for an indexed family.");if(n!==d){e.candidates.shift(),e.member=0;continue}let c=Number(S(m,8));if(c<1||c>8)throw new t("Hookr family member count is invalid.");for(;e.member<c&&y.length<u;){let p=e.member,a=U(await s("position",[o.familyId,p])),v=T(a.key);if(typeof a.tickLower!="number"||typeof a.tickUpper!="number")throw new t("Hookr family range is incomplete.");A(a.tickLower,a.tickUpper,v.tickSpacing);let $=S(a.liquidity,128),C=R(v);if(await s("poolFamily",[C])!==o.familyId)throw new t("Hookr position does not belong to this family.");let G=V({kind:"family",...o,member:String(p)});y.push({position:G,poolId:C,owner:d,liquidity:$.toString(),range:{tickLower:a.tickLower,tickUpper:a.tickUpper},poolKey:v}),e.member++}e.member===c&&(e.candidates.shift(),e.member=0)}catch(i){w=!0,b.push(i instanceof t?i.message:"Hookr family state is unavailable. Retry this cursor; no zero position is inferred.")}}await N(f,e.block);let x=!w&&e.nextBlock<e.firstBlock&&e.candidates.length===0;x||b.push("Discovery is incomplete. Continue nextCursor, including after an empty page. Current ownership is checked at the fixed snapshot; history gaps are not evidence of no positions.");let B=null;if(!x){for(;l.size>=Z;)l.delete(l.keys().next().value);B=J(),e.expires=Date.now()+K,l.set(B,e)}return typeof r.cursor=="string"&&l.delete(r.cursor),{chainId:4663,blockNumber:e.block.number.toString(),blockHash:e.block.hash,positions:y,nextCursor:B,complete:x,warnings:b,coverage:{custody:"reviewed Launcher families only",historyStartBlock:e.firstBlock.toString(),scannedFromBlock:e.nextBlock<e.block.number?(e.nextBlock+1n).toString():null,scannedThroughBlock:e.nextBlock<e.block.number?e.block.number.toString():null,snapshotBlock:e.block.number.toString()}}}}}export{ce as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{g as r}from"./NWNYJ26T.js";import{b as m,j as y}from"./TI727O2H.js";import{a}from"./XSD5NL7J.js";import{decodeAbiParameters as f,decodeFunctionData as K,encodeAbiParameters as w,encodeFunctionData as T,parseAbi as S,parseAbiParameters as k,zeroAddress as v}from"viem";var I=S(["function buy(uint256 quoteIn,uint256 minTokensOut,address recipient) payable returns (uint256)","function sell(uint256 tokensIn,uint256 minQuoteOut,address recipient) returns (uint256)"]),P=S(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"]),b=k("((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint256 minHopPriceX36,bytes hookData)"),g=k("bytes,bytes[]"),h=k("address,uint256"),O="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function A(c){return r(c,O)?v:c}function H(c,e,d,t){let i=A(c),p=A(e),[n,o]=BigInt(i)<BigInt(p)?[i,p]:[p,i];return{currency0:n,currency1:o,fee:d,tickSpacing:t,hooks:y[m].pons.memeHook.address}}function x(c){let e=K({abi:P,data:c}),[d,t,i]=e.args;if(d!=="0x10"||t.length!==1||!r(T({abi:P,...e}),c))throw new a("Pons router must contain one canonical v4 swap command.");let[p,n]=f(g,t[0]);if(p!=="0x060c0f"||n.length!==3||!r(w(g,[p,n]),t[0]))throw new a("Pons router actions must swap, settle the exact input and take all output to the sender.");let o=f(b,n[0])[0],u=f(h,n[1]),s=f(h,n[2]);if(!r(w(b,[o]),n[0])||!r(w(h,u),n[1])||!r(w(h,s),n[2])||o.hookData!=="0x"||o.minHopPriceX36!==0n||!r(u[0],o.zeroForOne?o.poolKey.currency0:o.poolKey.currency1)||u[1]!==o.amountIn||!r(s[0],o.zeroForOne?o.poolKey.currency1:o.poolKey.currency0)||s[1]!==o.amountOutMinimum)throw new a("Pons router settlement and receipt must match the single swap.");return{swap:o,deadline:i}}function B(c,e){let d=(o,u,s)=>{if(!r(o,u))throw new a(`Built swap ${s} does not match the accepted quote.`)},t=e.ponsPoolToken??e.ponsCurveToken;if(!t||e.ponsPoolToken&&e.ponsCurveToken)throw new a("Pons quote must name exactly one curve or pool token.");let i=r(e.to,t);if(!i&&!r(e.from,t))throw new a("Pons quote must trade its launch token.");let p=i?e.from:e.to;if(r(A(p),t))throw new a("Pons quote pair must differ from its launch token.");if(e.ponsPoolToken){if(d(e.router,y[m].ponsTrade.universal_router.address,"Pons router"),d(e.spender??e.router,y[m].ponsTrade.permit2.address,"Pons spender"),!e.data)throw new a("Pons pool quote must include locally reconstructed calldata.");let{swap:o,deadline:u}=x(c.data),s=x(e.data),l=H(p,t,s.swap.poolKey.fee,s.swap.poolKey.tickSpacing);if(d(o.poolKey.currency0,l.currency0,"pool currency0"),d(o.poolKey.currency1,l.currency1,"pool currency1"),d(o.poolKey.hooks,l.hooks,"pool hook"),o.zeroForOne!==r(A(e.from),l.currency0)||o.poolKey.fee!==s.swap.poolKey.fee||o.poolKey.tickSpacing!==s.swap.poolKey.tickSpacing||u!==s.deadline)throw new a("Pons pool direction, parameters or deadline differ from the accepted quote.");return{from:e.from,to:e.to,wallet:e.wallet,amount:o.amountIn}}let n=K({abi:I,data:c.data});if(n.functionName!==(i?"buy":"sell"))throw new a("Pons curve direction does not match the accepted quote.");return d(e.spender??e.router,e.router,"curve spender"),{from:e.from,to:e.to,wallet:n.args[2],amount:n.args[0]}}export{I as a,A as b,H as c,x as d,B as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as w,i as T,l as O,m as x,n as R}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{c as w,i as T,l as O,m as x,n as R}from"./NWNYJ26T.js";import{b as f,j as S}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{a as P}from"./JXOEJPJ4.js";import{encodeFunctionData as $,erc20Abi as E,parseAbi as z,zeroAddress as j}from"viem";var g=S[f].merkl.distributor.address,H=["function accessControlManager() view returns (address)","function isGovernor(address) view returns (bool)","function isGovernorOrGuardian(address) view returns (bool)","function canUpdateMerkleRoot(address) view returns (uint256)","function mainOperators(address,address) view returns (uint256)","function disputeToken() view returns (address)","function disputeAmount() view returns (uint256)","function disputer() view returns (address)","function endOfDisputePeriod() view returns (uint48)","function getMerkleRoot() view returns (bytes32)","function getEpochDuration() view returns (uint32)","function disputePeriod() view returns (uint48)","function upgradeabilityDeactivated() view returns (uint256)","function disputeTree(string)","function updateTree((bytes32 merkleRoot,bytes32 ipfsHash))","function toggleTrusted(address)","function toggleMainOperatorStatus(address,address)","function revokeUpgradeability()","function setEpochDuration(uint32)","function resolveDispute(bool)","function revokeTree()","function recoverERC20(address,address,uint256)","function setDisputePeriod(uint48)","function setDisputeToken(address)","function setDisputeAmount(uint256)"],y=z(H),F={type:"string",pattern:"^\\d+$"},C={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},G="Provide a valid address.";function m(o,l=!1){let n=T(o,G);return l?n:O(n,G)}function _(o,l=256){return R(o,`Value exceeds uint${l}.`,{bits:l})}function k(o){return x(o,"Merkl returned invalid protocol state.")}function I(o){return typeof o=="number"&&Number.isSafeInteger(o)&&o>=0?String(o):k(o).toString()}var D={updateTree:["merkleRoot","ipfsHash"],toggleTrusted:["target","enabled"],toggleMainOperatorStatus:["target","token","enabled"],revokeUpgradeability:[],setEpochDuration:["amount"],resolveDispute:["valid"],revokeTree:[],recoverERC20:["token","recipient","amount"],setDisputePeriod:["amount"],setDisputeToken:["token"],setDisputeAmount:["amount"]},W=o=>{let l=()=>o.clientFor(f),n=(r,i=[],e=g)=>l().readContract({address:e,abi:y,functionName:r,args:i}),b=(r,i,e,p)=>({name:`merkl_${r}`,inputSchema:{type:"object",properties:i,required:e,additionalProperties:!1},execute:async(u,s)=>{try{let a=Object.keys(u).find(d=>!Object.hasOwn(i,d));if(a)throw new c(`Unsupported Merkl input: ${a}.`);return await p(u,m(s))}catch(a){throw new c(o.plainError(a))}}}),U=async(r,i,e,p)=>{let u=[o.unsignedTx({to:g,data:$({abi:y,functionName:r,args:i}),value:"0",chainId:f,description:e})],s=await o.preview(u,p);return{txs:u,preview:s,summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${e} ${s.summary}`}};return{tools:[b("distributor_status",{},[],async(r,i)=>{let[e,p,u,s,a,d,t,h,N]=await Promise.all([n("getMerkleRoot"),n("disputeToken"),n("disputeAmount"),n("disputer"),n("endOfDisputePeriod"),n("getEpochDuration"),n("disputePeriod"),n("upgradeabilityDeactivated"),n("accessControlManager")]);if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e)||typeof d!="number"||!Number.isInteger(d)||d<0||d>4294967295)throw new c("Merkl returned invalid Distributor state.");let v=m(N),[M,A]=await Promise.all([n("isGovernor",[i],v),n("isGovernorOrGuardian",[i],v)]);if(typeof M!="boolean"||typeof A!="boolean")throw new c("Merkl returned invalid governance roles.");return{chainId:f,distributor:g,root:e,disputeToken:m(p,!0),disputeAmount:k(u).toString(),disputer:m(s,!0),endOfDisputePeriod:I(a),epochDuration:String(d),disputePeriod:I(t),upgradeabilityDeactivated:k(h).toString(),accessControlManager:v,governor:M,governorOrGuardian:A,summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Dispute amounts are token base units. Opening a dispute locks collateral until governor resolution; a rejected dispute forfeits it."}}),b("dispute",{reason:{type:"string",minLength:1,maxLength:2e3,description:"Public reason for disputing the Merkl tree, from 1 to 2000 characters."}},["reason"],async(r,i)=>{if(typeof r.reason!="string"||!r.reason.trim()||r.reason.length>2e3)throw new c("Provide a public dispute reason of 1 to 2000 characters.");let e=m(await n("disputeToken")),p=k(await n("disputeAmount")),[u,s]=await Promise.all([l().readContract({address:e,abi:E,functionName:"symbol"}),l().readContract({address:e,abi:E,functionName:"decimals"})]);if(typeof u!="string"||!u.trim()||typeof s!="number"||!Number.isInteger(s)||s<0||s>255)throw new c("Merkl dispute token metadata is invalid.");let a=`Dispute Merkl's tree: ${r.reason}. Lock ${p} ${P(u)} base units (token ${e}, decimals ${s}) until governor resolution; rejection forfeits the deposit. There is no unilateral withdrawal.`,d=[...p?[o.approval(e,g,p.toString(),f)]:[],o.unsignedTx({to:g,data:$({abi:y,functionName:"disputeTree",args:[r.reason]}),value:"0",chainId:f,description:a})],t=await o.preview(d,i);return{txs:d,preview:t,deposit:{token:{address:e,symbol:u,decimals:s,chainId:f},amount:p.toString()},summary:`Powered by Merkl \u2014 https://app.merkl.xyz. ${a} ${t.summary}`}}),b("distributor_admin",{operation:{enum:Object.keys(D),description:"Distributor admin operation: tree updates/revocation, trust/operator changes, epoch/dispute settings, resolution, token recovery or upgradeability revocation."},target:{...w,description:"Address whose trusted or operator status is changed."},token:{...w,description:"Reward or recovery token contract address."},recipient:{...w,description:"Address to receive recovered tokens."},amount:{...F,description:'Admin amount: Unix seconds for durations, otherwise token base units using recovery/dispute token decimals (USDG has 6: "1000000" = 1 USDG).'},enabled:{type:"boolean",description:"true enables the selected role; false disables it."},valid:{type:"boolean",description:"Whether the disputed tree is valid."},merkleRoot:{...C,description:"New reward tree root as a 0x-prefixed 32-byte hex string."},ipfsHash:{...C,description:"New tree IPFS content hash as a 0x-prefixed 32-byte hex string."}},["operation"],async(r,i)=>{let e=String(r.operation);if(!Object.hasOwn(D,e))throw new c("Choose a supported Distributor operation.");let p=D[e];for(let t of Object.keys(r))if(t!=="operation"&&!p.includes(t))throw new c(`Input ${t} does not match this Distributor operation.`);let u=m(await n("accessControlManager")),s=await n("isGovernor",[i],u);if(typeof s!="boolean")throw new c("Merkl returned invalid governor status.");if(!s&&!(e==="updateTree"?await n("canUpdateMerkleRoot",[i])===1n:e==="toggleMainOperatorStatus"&&r.token!==j?await n("isGovernorOrGuardian",[i],u)===!0:!1))throw new c("The connected wallet lacks the required Merkl governance role.");let a=p.map(t=>{if(t==="enabled"||t==="valid"){if(typeof r[t]!="boolean")throw new c(`Provide ${t} as boolean.`);return r[t]}if(t==="amount"){let h=_(r[t],e==="setEpochDuration"?32:e==="setDisputePeriod"?48:256);return e==="setEpochDuration"?Number(h):h}if(t==="merkleRoot"||t==="ipfsHash"){if(typeof r[t]!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r[t]))throw new c("Provide a bytes32 root and IPFS hash.");return r[t]}return m(r[t],t==="token"&&e==="toggleMainOperatorStatus")}),d=a;if(e==="updateTree"&&(d=[{merkleRoot:a[0],ipfsHash:a[1]}]),e==="toggleTrusted"||e==="toggleMainOperatorStatus"){let t=await n(e==="toggleTrusted"?"canUpdateMerkleRoot":"mainOperators",e==="toggleTrusted"?[a[0]]:a.slice(0,2));if(t!==0n&&t!==1n)throw new c("Merkl returned invalid authorization state.");if(t===1n===r.enabled)return{txs:[],summary:"Powered by Merkl \u2014 https://app.merkl.xyz. Authorization already has the requested state."};d=a.slice(0,-1)}return U(e,d,`Merkl Distributor ${e} ${JSON.stringify(r)}. Governance affects every claimant. Upgradeability revocation is permanent; dispute resolution returns or forfeits collateral. Authorization operations toggle the observed state; re-preview if state changes.`,i)})]}};export{W as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as v,n as F}from"./VYYSL557.js";import{b as A,i as U,n as X,o as V,q as j}from"./WU7XIAXB.js";import{a as $}from"./6WD4HHID.js";import{b as z,e as C,o as Y}from"./DNNFKDZR.js";import{a as w,b as S}from"./H5DY7CNB.js";import{a as k}from"./LIUXNOLP.js";import{a as P}from"./UEDGYZOC.js";import{a as B}from"./SPJCSEKP.js";import{b as q}from"./SCG5HWMN.js";import{b as T}from"./IX3GZMTM.js";import{p as y}from"./6NUNCD5J.js";import{a as m,b as f,c as H,d as N,i as g,j as W,k as R,p as K}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{a as D,b as L}from"./JXOEJPJ4.js";import{getAddress as b,isAddress as Q,parseAbi as oe}from"viem";var J=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];var M=300,de="1000000000000000000",te=b(g[m].tokens.USDG.address),ne=b(g[f].deployments.test_USDG.address),O=b(g[m].tokens.WETH.address),_=b(g[f].deployments.test_WETH.address);function re(n){let e=n.address.toLowerCase();return n.chainId===m?e===te.toLowerCase():n.chainId===f?e===ne.toLowerCase():!1}function ie(n){return n.chainId!==m&&n.chainId!==f?!1:S(n.address)===w}function ae(n){let e=n.address.toLowerCase();return n.chainId===m?e===O.toLowerCase():n.chainId===f?e===_.toLowerCase():!1}function ce(n){return ie(n)||ae(n)}var ue=-887272,me=887272,fe=(1n<<256n)-1n,le=oe(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]);function I(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new o(`Invalid ${e} timestamp.`)}function _e(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){try{return l(n,e,t),!0}catch{return!1}}function l(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){if(!Number.isInteger(t)||t<0)throw new o("Maximum price age must be a non-negative integer.");let s=I(n,"price"),a=I(e,"current");if(s<=0n)throw new o("Price timestamp must be positive.");if(s>a)throw new o("Price timestamp is in the future.");let i=a-s;if(i>BigInt(t))throw new o(`Price is stale: age ${i}s exceeds ${t}s.`);return s.toString()}function be(n){if(!Number.isInteger(n)||n<ue||n>me)throw new o(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=fe/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function Z(n,e,t,s){let a=async()=>{throw new o("Price identity resolution is read-only.")},i=B({network:e===f?"testnet":"mainnet",clientFor:r=>t.client??y(t.rpcUrl,r),http:t.http??q(),preview:a,quoteSwap:a,buildSwap:a}),c=await Y(n,{context:i,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:s,blockNumber:t.blockNumber,readMetadata:async r=>{let d=t.client??y(t.rpcUrl,e),[u,p]=await Promise.all([P(d,e,r,"symbol",t.blockNumber),P(d,e,r,"decimals",t.blockNumber)]);return{address:r,symbol:u,decimals:p,chainId:e}}});return{address:c.address,symbol:c.kind==="erc20"&&s?s.symbol:c.symbol,decimals:c.decimals,chainId:c.chainId}}async function pe(n,e,t){if(typeof n=="object"&&n!==null){let r=n.chainId??e,d=S(n.address)===w?w:b(n.address),u={address:d,symbol:n.symbol,decimals:n.decimals,chainId:r};return re(u)?{address:d,symbol:"USDG",decimals:N,chainId:r}:ie(u)?{address:w,symbol:"ETH",decimals:18,chainId:r}:ae(u)?{address:d,symbol:"WETH",decimals:18,chainId:r}:Z(u.address,r,t,u)}let s=n.trim(),a=s.toUpperCase(),i=s.toLowerCase();if(a==="ETH"||Q(s,{strict:!1})&&S(s)===w)return{...z,chainId:e};if(a==="WETH"||e===m&&i===O.toLowerCase()||e===f&&i===_.toLowerCase()){if(e!==m&&e!==f)throw new o(`No canonical WETH address configured for chain ${e}.`);return{address:e===f?_:O,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===m&&i===W.toLowerCase()||e===f&&i===R.toLowerCase()){if(e!==m&&e!==f)throw new o(`No canonical USDG address configured for chain ${e}.`);return{address:e===f?ne:te,symbol:"USDG",decimals:N,chainId:e}}if(e===m&&(a==="USDE"||i===C.address.toLowerCase()))return{...C,chainId:e};let c=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||c&&s.toLowerCase()===c.toLowerCase()){if(!c&&!Q(s,{strict:!1}))throw new o("OAK token address is required to price OAK.");return{address:b(c??s),symbol:"OAK",decimals:H,chainId:e}}return Z(n,e,t)}async function h(n,e,t){if(e)return(await n.readContract({address:e,abi:J,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:b(K),abi:le,functionName:"observe",args:[[A,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new o("ETH/USDG pool observation returned insufficient tick cumulatives.");let i=X(a[0],a[1],A),c=be(i);return V(c)}async function x(n,e,t,s){if(n.timestamp!==void 0)return l(n.timestamp,t(),s);if(e&&typeof e.getBlock=="function"){let i=await k(e,n.blockNumber);return l(i.timestamp,t(),s)}let a=t();return l(a,a,s)}function ee(n){if(n.startsWith("untrusted "))try{let e=JSON.parse(n.slice(10));if(typeof e=="string"&&D(e)===n)return n}catch{}return D(n)}async function Ie(n,e={}){let t=e.chainId??m,s=e.maxAgeSeconds??M,a=()=>e.now!==void 0?I(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),i=await pe(n,t,e);if((L(i.symbol)||i.symbol.length>256)&&(i.symbol=ee(i.symbol)),e.signedNote||e.priceNote){let r=e.signedNote?e.signedNote.note:e.priceNote,d=l(r.timestamp,a(),s);if(e.spotOakPerEthE18!==void 0&&!v(r.oakPerEthE18,e.spotOakPerEthE18))throw new o("Price note is outside the 50% spot guard band.");let u=e.signedNote?.signature??e.signature,p=e.signedNote?.consumer??e.consumer;if(u&&p){let G=await F({note:r,signature:u,consumer:p,signer:e.signer,now:a(),spotOakPerEthE18:e.spotOakPerEthE18,chainId:t});if(!G.valid)throw new o(G.error??"Price note verification failed.")}let E=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:U(E,r.oakPerEthE18),timestamp:d}}if(e.trades){let r=await x(e,e.client,a,s),d=j(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!v(d,e.spotOakPerEthE18))throw new o("30-minute average is outside the 50% spot guard band.");let u=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:U(u,d),timestamp:r}}if(e.usdE18!==void 0){let r=await x(e,e.client,a,s),d=T(e.usdE18.toString());if(d<=0n)throw new o("USD price must be positive.");return{token:i,usdE18:d.toString(),timestamp:r}}if(e.resolver){let r=await e.resolver(i),d=l(r.timestamp,a(),s),u=T(r.usdE18);if(u<=0n)throw new o("USD price must be positive.");return{token:i,usdE18:u.toString(),timestamp:d}}let c=e.client??y(e.rpcUrl,t);if(re(i)){let r=await x(e,c,a,s);return{token:i,usdE18:de,timestamp:r}}if(ce(i)){let r=await x(e,c,a,s),d=await h(c,e.oracleAddress,e.blockNumber);return{token:i,usdE18:d,timestamp:r}}if(i.chainId===m)try{let r=await k(c,e.blockNumber),d=l(r.timestamp,a(),s);if(r.number===null)throw new o("Pons reference requires a mined block.");let[u,p]=await Promise.all([$(i,c,r.number),h(c,e.oracleAddress,r.number)]),E=T(p)*u.numerator/u.denominator;if(E<=0n)throw new o("Pons USD reference price must be positive.");return{token:i,usdE18:E.toString(),timestamp:d}}catch{}throw new o(`Oak has no fresh on-chain trade price for ${ee(i.symbol)}, so it shows no price. balances and positions show a labeled estimate where one exists; an estimate is not a quote.`)}export{M as a,de as b,re as c,ie as d,ae as e,ce as f,_e as g,l as h,be as i,h as j,Ie as k};
|
|
1
|
+
import{b as A,i as U,n as X,o as V,q as j}from"./7EACRKFV.js";import{m as v,n as F}from"./WSILNJS2.js";import{a as $}from"./Y2QADJOB.js";import{b as z,e as C,o as Y}from"./QLFPAN6S.js";import{a as w,b as S}from"./Z7FGEWO2.js";import{a as k}from"./LIUXNOLP.js";import{a as P}from"./VVAM3EAK.js";import{a as B}from"./SPJCSEKP.js";import{b as q}from"./SCG5HWMN.js";import{b as T}from"./IX3GZMTM.js";import{t as y}from"./MQ5F2VOK.js";import{b as m,c as f,d as H,e as N,j as g,k as W,l as R,q as K}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{a as D,b as L}from"./JXOEJPJ4.js";import{getAddress as b,isAddress as Q,parseAbi as oe}from"viem";var J=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];var M=300,de="1000000000000000000",te=b(g[m].tokens.USDG.address),ne=b(g[f].deployments.test_USDG.address),O=b(g[m].tokens.WETH.address),_=b(g[f].deployments.test_WETH.address);function re(n){let e=n.address.toLowerCase();return n.chainId===m?e===te.toLowerCase():n.chainId===f?e===ne.toLowerCase():!1}function ie(n){return n.chainId!==m&&n.chainId!==f?!1:S(n.address)===w}function ae(n){let e=n.address.toLowerCase();return n.chainId===m?e===O.toLowerCase():n.chainId===f?e===_.toLowerCase():!1}function ce(n){return ie(n)||ae(n)}var ue=-887272,me=887272,fe=(1n<<256n)-1n,le=oe(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]);function I(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new o(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new o(`Invalid ${e} timestamp.`)}function _e(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){try{return l(n,e,t),!0}catch{return!1}}function l(n,e=BigInt(Math.floor(Date.now()/1e3)),t=M){if(!Number.isInteger(t)||t<0)throw new o("Maximum price age must be a non-negative integer.");let s=I(n,"price"),a=I(e,"current");if(s<=0n)throw new o("Price timestamp must be positive.");if(s>a)throw new o("Price timestamp is in the future.");let i=a-s;if(i>BigInt(t))throw new o(`Price is stale: age ${i}s exceeds ${t}s.`);return s.toString()}function be(n){if(!Number.isInteger(n)||n<ue||n>me)throw new o(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=fe/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function Z(n,e,t,s){let a=async()=>{throw new o("Price identity resolution is read-only.")},i=B({network:e===f?"testnet":"mainnet",clientFor:r=>t.client??y(t.rpcUrl,r),http:t.http??q(),preview:a,quoteSwap:a,buildSwap:a}),c=await Y(n,{context:i,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:s,blockNumber:t.blockNumber,readMetadata:async r=>{let d=t.client??y(t.rpcUrl,e),[u,p]=await Promise.all([P(d,e,r,"symbol",t.blockNumber),P(d,e,r,"decimals",t.blockNumber)]);return{address:r,symbol:u,decimals:p,chainId:e}}});return{address:c.address,symbol:c.kind==="erc20"&&s?s.symbol:c.symbol,decimals:c.decimals,chainId:c.chainId}}async function pe(n,e,t){if(typeof n=="object"&&n!==null){let r=n.chainId??e,d=S(n.address)===w?w:b(n.address),u={address:d,symbol:n.symbol,decimals:n.decimals,chainId:r};return re(u)?{address:d,symbol:"USDG",decimals:N,chainId:r}:ie(u)?{address:w,symbol:"ETH",decimals:18,chainId:r}:ae(u)?{address:d,symbol:"WETH",decimals:18,chainId:r}:Z(u.address,r,t,u)}let s=n.trim(),a=s.toUpperCase(),i=s.toLowerCase();if(a==="ETH"||Q(s,{strict:!1})&&S(s)===w)return{...z,chainId:e};if(a==="WETH"||e===m&&i===O.toLowerCase()||e===f&&i===_.toLowerCase()){if(e!==m&&e!==f)throw new o(`No canonical WETH address configured for chain ${e}.`);return{address:e===f?_:O,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===m&&i===W.toLowerCase()||e===f&&i===R.toLowerCase()){if(e!==m&&e!==f)throw new o(`No canonical USDG address configured for chain ${e}.`);return{address:e===f?ne:te,symbol:"USDG",decimals:N,chainId:e}}if(e===m&&(a==="USDE"||i===C.address.toLowerCase()))return{...C,chainId:e};let c=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||c&&s.toLowerCase()===c.toLowerCase()){if(!c&&!Q(s,{strict:!1}))throw new o("OAK token address is required to price OAK.");return{address:b(c??s),symbol:"OAK",decimals:H,chainId:e}}return Z(n,e,t)}async function h(n,e,t){if(e)return(await n.readContract({address:e,abi:J,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:b(K),abi:le,functionName:"observe",args:[[A,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new o("ETH/USDG pool observation returned insufficient tick cumulatives.");let i=X(a[0],a[1],A),c=be(i);return V(c)}async function x(n,e,t,s){if(n.timestamp!==void 0)return l(n.timestamp,t(),s);if(e&&typeof e.getBlock=="function"){let i=await k(e,n.blockNumber);return l(i.timestamp,t(),s)}let a=t();return l(a,a,s)}function ee(n){if(n.startsWith("untrusted "))try{let e=JSON.parse(n.slice(10));if(typeof e=="string"&&D(e)===n)return n}catch{}return D(n)}async function Ie(n,e={}){let t=e.chainId??m,s=e.maxAgeSeconds??M,a=()=>e.now!==void 0?I(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),i=await pe(n,t,e);if((L(i.symbol)||i.symbol.length>256)&&(i.symbol=ee(i.symbol)),e.signedNote||e.priceNote){let r=e.signedNote?e.signedNote.note:e.priceNote,d=l(r.timestamp,a(),s);if(e.spotOakPerEthE18!==void 0&&!v(r.oakPerEthE18,e.spotOakPerEthE18))throw new o("Price note is outside the 50% spot guard band.");let u=e.signedNote?.signature??e.signature,p=e.signedNote?.consumer??e.consumer;if(u&&p){let G=await F({note:r,signature:u,consumer:p,signer:e.signer,now:a(),spotOakPerEthE18:e.spotOakPerEthE18,chainId:t});if(!G.valid)throw new o(G.error??"Price note verification failed.")}let E=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:U(E,r.oakPerEthE18),timestamp:d}}if(e.trades){let r=await x(e,e.client,a,s),d=j(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!v(d,e.spotOakPerEthE18))throw new o("30-minute average is outside the 50% spot guard band.");let u=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await h(e.client??y(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:U(u,d),timestamp:r}}if(e.usdE18!==void 0){let r=await x(e,e.client,a,s),d=T(e.usdE18.toString());if(d<=0n)throw new o("USD price must be positive.");return{token:i,usdE18:d.toString(),timestamp:r}}if(e.resolver){let r=await e.resolver(i),d=l(r.timestamp,a(),s),u=T(r.usdE18);if(u<=0n)throw new o("USD price must be positive.");return{token:i,usdE18:u.toString(),timestamp:d}}let c=e.client??y(e.rpcUrl,t);if(re(i)){let r=await x(e,c,a,s);return{token:i,usdE18:de,timestamp:r}}if(ce(i)){let r=await x(e,c,a,s),d=await h(c,e.oracleAddress,e.blockNumber);return{token:i,usdE18:d,timestamp:r}}if(i.chainId===m)try{let r=await k(c,e.blockNumber),d=l(r.timestamp,a(),s);if(r.number===null)throw new o("Pons reference requires a mined block.");let[u,p]=await Promise.all([$(i,c,r.number),h(c,e.oracleAddress,r.number)]),E=T(p)*u.numerator/u.denominator;if(E<=0n)throw new o("Pons USD reference price must be positive.");return{token:i,usdE18:E.toString(),timestamp:d}}catch{}throw new o(`Oak has no fresh on-chain trade price for ${ee(i.symbol)}, so it shows no price. balances and positions show a labeled estimate where one exists; an estimate is not a quote.`)}export{M as a,de as b,re as c,ie as d,ae as e,ce as f,_e as g,l as h,be as i,h as j,Ie as k};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as ce}from"./63YRSLDK.js";var Se={};ce(Se,{ACCESS_FEE_LINE:()=>H,ACCESS_FREE_UNTIL_LINE:()=>K,ACCESS_NO_PLAN:()=>T,BANNED_COPY:()=>Ne,BONUS_CLAUSE:()=>h,CARD_FOOTER_ASK:()=>m,CARD_FOOTER_NO_ASK:()=>f,CARD_HEADER:()=>s,CARD_HEADER_AMOUNT:()=>r,CARD_HEADER_AMOUNT_NOT_HELD:()=>i,ETH_HINT:()=>k,FEES_ESTIMATED_HIGH:()=>W,LAYERBANK_RISK_SUMMARY:()=>u,LAYERBANK_SETUP_MISMATCH:()=>_e,LAYERBANK_SITE:()=>we,LB_BONUS_NOTE:()=>S,LB_CASH_NOTE:()=>L,LB_DEPOSIT_SCREEN:()=>x,LB_WITHDRAW_SCREEN:()=>N,LP_ADD_BUTTON:()=>be,LP_BLOCK:()=>X,LP_BLOCK_UNREADABLE:()=>ae,LP_DECLINE_BUTTON:()=>Te,LP_FEE_CLAUSE:()=>Z,LP_FUNDER_LINE:()=>te,LP_GAS_LINE:()=>Q,LP_NOT_A_PROMISE:()=>ee,LP_NOT_WORTH_CLAUSE:()=>oe,LP_RANGE_CLAUSE:()=>V,LP_RATE_LINE:()=>j,LP_SHARE_LINE:()=>J,MATURED_NOTICE:()=>F,MATURED_STOCK_NOTICE:()=>q,MATURED_STOCK_NOTICE_NO_AMOUNT:()=>z,MERKL_AFTER_DEPOSIT:()=>ne,MERKL_EARNING_EMPTY:()=>re,MERKL_LAST_UPDATE_CLAUSE:()=>se,NOTHING_TO_EARN:()=>b,NO_NEW_TERM:()=>$,OPTION_A:()=>l,OPTION_A_CANT_CHECK:()=>y,OPTION_A_CLOSED:()=>E,OPTION_A_NO_ROOM:()=>g,OPTION_B:()=>c,OPTION_B_CANT_CHECK:()=>w,OPTION_B_NONE:()=>p,PAYOUT_APPROX:()=>v,PAYOUT_EXACT:()=>U,PENDLE_BUY_STABLE_SCREEN:()=>A,PENDLE_BUY_STOCK_SCREEN:()=>O,PENDLE_CONTRACT_CHANGE:()=>me,PENDLE_EARLY_EXIT:()=>_,PENDLE_FIXED_RATE:()=>ge,PENDLE_REDEEM_SCREEN:()=>C,PENDLE_REDEEM_STOCK_SCREEN:()=>I,PENDLE_RISK_SUMMARY:()=>d,PENDLE_SELL_DEFAULT_BUTTON:()=>fe,PENDLE_SELL_GAP_LINE:()=>D,PENDLE_SELL_NO_GAP_LINE:()=>R,PENDLE_SELL_SCREEN:()=>P,PENDLE_SERVICE_DOWN:()=>le,PENDLE_SITE:()=>Ee,PRICE_MISMATCH_REFUSAL:()=>de,SLIPPAGE_CAP_REFUSAL:()=>ie,STOCK_PAID_IN:()=>Y,STOCK_SHORT_TERM:()=>B,STOCK_SHORT_TERM_DAYS:()=>ke,TEMPLATES:()=>xe,THIN_MARKET_REFUSAL:()=>ue,TOO_SMALL:()=>M,TOO_SMALL_NO_SIZE:()=>G,fill:()=>ye,placeholdersOf:()=>pe});function e(t){return{text:t}}function pe(t){return[...new Set([...t.text.matchAll(/\{([a-z][a-z0-9_]*)\}/g)].map(o=>o[1]))]}function ye(t,o){let he=o;return t.text.replace(/\{([a-z][a-z0-9_]*)\}/g,(Le,a)=>{let n=he[a];if(typeof n!="string")throw new Error(`Missing value for {${a}}`);return n})}var we="layerbank.finance",Ee="app.pendle.finance",s=e("You have {amount_usd} in USDG that isn't earning anything. Here are two ways to make it earn. Pick one, or neither."),r=e("Looking at {amount_usd} of your USDG. Here are two ways to make it earn. Pick one, or neither."),i=e("Looking at {amount_usd} of USDG. Here are two ways to make it earn. Pick one, or neither."),u="LayerBank is a lending app; if its code fails or almost everything is lent out, you could lose money or have to wait.",d="Pendle is a trading app; thin trading can make leaving early cost you, and its code can fail or be changed by its team.",_="If you leave early you sell at the market price that day, and that can be less than you put in.",ge="The rate is fixed only if you hold until the end date.",me="Pendle's router can be upgraded by Pendle's team, so its code can change.",l=e(`A. LayerBank: lending, take it out any time
|
|
2
2
|
Pays about {lb_base_rate}% a year from borrowers today{bonus_clause}. The rate changes, up or down.
|
|
3
3
|
You can take your money out any time while LayerBank has cash on hand (right now {lb_cash_usd}).
|
|
4
4
|
Risk: ${u}
|
|
5
|
-
Cost: network fees of about {lb_gas_in_usd} to put it in and {lb_gas_out_usd} to take it out.`),
|
|
5
|
+
Cost: network fees of about {lb_gas_in_usd} to put it in and {lb_gas_out_usd} to take it out.`),h=e(", plus a bonus of {lb_bonus_rate}% a year for the next {bonus_days}. After that I count only the {lb_base_rate}%, because Oak can't see whether the bonus will be renewed"),c=e(`B. Pendle: a fixed rate until {pendle_end_date}
|
|
6
6
|
Pays a fixed {pendle_rate}% a year if you keep it until {pendle_end_date}. You get {pendle_payout_usd} back for every {pendle_unit_usd} you put in.
|
|
7
7
|
${_}
|
|
8
8
|
Risk: ${d}
|
|
9
|
-
Cost: about {pendle_cost_in_usd} in fees to start and about {pendle_gas_out_usd} to cash out.`),p=
|
|
9
|
+
Cost: about {pendle_cost_in_usd} in fees to start and about {pendle_gas_out_usd} to cash out.`),p=e("B. Pendle has no fixed-rate USDG term open right now."),y=e("A. LayerBank can't be checked right now, so I won't offer it."),w=e("B. Pendle can't be checked right now, so I won't offer it."),E=e("A. LayerBank isn't taking new deposits right now, so I won't offer it."),g=e("A. LayerBank can only take {cap_room_usd} more right now, which is less than {amount_usd}, so I won't offer it."),m=e("Nobody guarantees either one. Which do you want: {choices}?"),f=e("Nobody guarantees either one."),k=e("You hold ETH but no USDG. I can swap some ETH to USDG first with Oak's swap tool and show you the price before anything happens."),b=e("This wallet holds no USDG and no ETH to put to work, so there is nothing to compare yet."),T=e("Oak is free."),x=e(`Put {amount_usd} into LayerBank?
|
|
10
10
|
|
|
11
11
|
What you get: about {lb_total_rate}% a year at today's rate. The rate changes.
|
|
12
12
|
What happens: {amount_usd} of USDG leaves your wallet and becomes {amount_usd} of "lRobUSDG", your receipt for money lent through LayerBank. Your receipt grows as interest arrives. Oak's preview checks the amount, but the contract doesn't enforce a minimum, so it can differ slightly.
|
|
@@ -14,57 +14,57 @@ The risk: LayerBank is a lending app. If its code fails, or almost everything is
|
|
|
14
14
|
Taking it out: any time LayerBank has cash on hand. Right now that is {lb_cash_usd}. You can also take it out on layerbank.finance with this wallet.
|
|
15
15
|
Cost: about {gas_usd} in network fees now and about {gas_out_usd} to take it out.
|
|
16
16
|
|
|
17
|
-
Put in {amount_usd}? [Yes] [No]`),N=
|
|
17
|
+
Put in {amount_usd}? [Yes] [No]`),N=e(`Take {amount_or_all} out of LayerBank?
|
|
18
18
|
|
|
19
19
|
You get back {usdg_out} USDG (your {amount_deposited_clause} plus interest so far{bonus_note}). Oak's preview checks the amount, but the contract doesn't enforce a minimum, so it can differ slightly.
|
|
20
20
|
{cash_note}
|
|
21
21
|
Cost: about {gas_usd} in network fees.
|
|
22
22
|
|
|
23
|
-
Take it out? [Yes] [No]`),S=
|
|
23
|
+
Take it out? [Yes] [No]`),S=e(". Your bonus is paid separately; ask me to claim it"),L=e("LayerBank only has {lb_cash_usd} on hand right now, so I can take out {max_now} today."),A=e(`Lock {amount_usd} in a fixed rate until {pendle_end_date}?
|
|
24
24
|
|
|
25
25
|
What you get: a fixed {pendle_rate}% a year, if you keep it until {pendle_end_date}. You put in {amount_usd} and get {pt_out} tokens. Each token pays out {payout_per_pt_phrase} on {pendle_end_date}. That is about {gain_usd} more than you put in.
|
|
26
26
|
What happens now: {amount_usd} of USDG leaves your wallet and you receive at least {pt_min} "PT-USDG" tokens (the price can move a little before this goes through; Oak refuses anything worse than {slippage_pct}%).
|
|
27
27
|
The risk: if you leave before {pendle_end_date}, you sell at the market price that day, and that can be less than you put in. Pendle is a trading app; its code can fail, and its team can change it.
|
|
28
28
|
Cost: about {fees_usd} in trading and network fees now, and about {gas_out_usd} to cash out at the end.
|
|
29
29
|
|
|
30
|
-
Lock {amount_usd} until {pendle_end_date}? [Yes] [No]`),O=
|
|
30
|
+
Lock {amount_usd} until {pendle_end_date}? [Yes] [No]`),O=e(`Lock {amount_units} {stock_symbol} in a fixed rate until {pendle_end_date}?
|
|
31
31
|
|
|
32
32
|
What you get: you put in {amount_units} {stock_symbol} and receive at least {pt_min} tokens. On {pendle_end_date} each token pays out {payout_per_pt_phrase}. That is {gain_units} {stock_symbol} more than you put in, a fixed {pendle_rate}% a year in {stock_symbol}, not in dollars.
|
|
33
33
|
The catch: the payout is in {stock_symbol}, not dollars. If the stock token is worth less on {pendle_end_date}, you get less in dollars, even though the {stock_symbol} count is fixed.
|
|
34
34
|
The risk: leaving early sells at the market price that day, which can be less than you put in. This term is short ({days_left} days), so the extra {stock_symbol} is small. Pendle is a trading app; its code can fail, and its team can change it.
|
|
35
35
|
Cost: about {fees_usd} in trading and network fees now and about {gas_out_usd} to cash out.
|
|
36
36
|
|
|
37
|
-
Lock it until {pendle_end_date}? [Yes] [No]`),P=
|
|
37
|
+
Lock it until {pendle_end_date}? [Yes] [No]`),P=e(`Leave early and sell {pt_amount} tokens now?
|
|
38
38
|
|
|
39
39
|
If you wait until {pendle_end_date}, these tokens pay {payout_at_end} {unit}.
|
|
40
40
|
If you sell now, the market pays about {sell_now} {unit}, and Oak accepts no less than {sell_min}. {gap_line}
|
|
41
41
|
Selling early can lose money. The price today may be lower than what you paid.
|
|
42
42
|
Cost: about {fees_usd} in trading and network fees.
|
|
43
43
|
|
|
44
|
-
Sell now? [Yes, sell now] [No, keep waiting]`),D=
|
|
44
|
+
Sell now? [Yes, sell now] [No, keep waiting]`),D=e("That is {gap} less than waiting."),R=e("The quoted output before fees is at least the payout at the end of the term. Fees, the minimum output and what you paid still affect whether you lose money."),fe="No, keep waiting",C=e(`Cash out {pt_amount} tokens for {usdg_out} USDG?
|
|
45
45
|
|
|
46
46
|
The term ended on {pendle_end_date}. Each token pays out {payout_per_pt_phrase} now, with no market price involved.
|
|
47
47
|
Cost: about {gas_usd} in network fees.
|
|
48
48
|
|
|
49
|
-
Cash out? [Yes] [No]`),I=
|
|
49
|
+
Cash out? [Yes] [No]`),I=e(`Cash out {pt_amount} tokens for about {unit_out} {stock_symbol}?
|
|
50
50
|
|
|
51
51
|
The term ended on {pendle_end_date}. You receive {stock_symbol}, not USDG: about {unit_out} {stock_symbol}, worth about {value_usd} at today's price, which can move. No market price is involved in the payout itself.
|
|
52
52
|
To end up in USDG, I can swap the {stock_symbol} afterwards with Oak's swap tool and show you that price first.
|
|
53
53
|
Cost: about {gas_usd} in network fees.
|
|
54
54
|
|
|
55
|
-
Cash out? [Yes] [No]`),U=
|
|
56
|
-
Want me to cash out to USDG, or start a new term? One "yes" is enough; say "cash out" or "new term".`),
|
|
55
|
+
Cash out? [Yes] [No]`),U=e("exactly 1 {unit}"),v=e("about {x} {unit} at today's exchange rate"),Y=e("Paid in {stock_symbol}, not dollars."),B=e("ends in {days_left} days, usually too short to be worth the fees"),ke=7,M=e("At {amount_usd}, this is too small to be worth it. You would earn about {gross_usd} over {horizon}, and fees would take about {costs_usd}, leaving about {net_usd}. Putting in {suggest_usd} or more would be worth it, and I can still do it if you want."),G=e("At {amount_usd}, this is too small to be worth it. You would earn about {gross_usd} over {horizon}, and fees would take about {costs_usd}, leaving about {net_usd}. At today's rate no amount would make up for the fees, and I can still do it if you want."),H=e("Oak is free."),K=e("Oak is free."),W=e("Fees estimated high because the live price was unavailable."),F=e(`Your fixed term on Pendle ended on {pendle_end_date}. Your {pt_amount} tokens are worth {usdg_out} USDG now.
|
|
56
|
+
Want me to cash out to USDG, or start a new term? One "yes" is enough; say "cash out" or "new term".`),q=e('Your fixed term on Pendle ended on {pendle_end_date}. Your {pt_amount} tokens pay out about {unit_out} {stock_symbol} now, worth about {value_usd}. Want me to cash out and swap that to USDG, or start a new term? One "yes" is enough.'),z=e('Your fixed term on Pendle in {stock_symbol} ended on {pendle_end_date}. Your tokens pay out in {stock_symbol}, not USDG; I will show the exact amount before anything is sent. Want me to cash out and swap that to USDG, or start a new term? One "yes" is enough.'),$=e("There is no new fixed-rate USDG term open right now. I cashed out to USDG; want me to show LayerBank instead?"),X=e(`Before you add liquidity: what it is worth, and what can go wrong
|
|
57
57
|
|
|
58
58
|
Worth: {worth_line}
|
|
59
59
|
{funder_line}What can go wrong:
|
|
60
60
|
- Price exposure: you put in two coins. If one moves a lot against the other, you can end up with less than you started with, even if you earn rewards.
|
|
61
61
|
- Going out of range: if the price leaves the range you chose, you stop earning until it comes back, and you hold mostly the weaker coin.
|
|
62
62
|
- The rewards can end: the campaign ends on {end_date}, or sooner, and the rate shown is today's rate, which changes.
|
|
63
|
-
Your call. [Add liquidity] [Don't]`),j=
|
|
63
|
+
Your call. [Add liquidity] [Don't]`),j=e("Merkl lists this pool's reward rate at about {apr}% a year until {end_date}. That rate is an average over everyone in the pool."),V=e("Rewards count only while the price stays inside your range."),Z=e("They are weighted {w}% by the trading fees your position earns, so your share can be lower."),J=e("For your {amount_usd}, at that average rate: about {per_day_usd} a day, about {gross_usd} until {end_date}."),Q=e("Network fees to join and leave are about {gas_usd}."),ee=e("Rates change; this is not a promise."),te=e("Uniswap pays the trading fees; Merkl runs the bonus, funded by {creator}. Oak can't identify who that is."),oe=e("That is not worth it at this size."),ae=e(`Before you add liquidity: what it is worth, and what can go wrong
|
|
64
64
|
|
|
65
65
|
Worth: the reward rate or end date couldn't be read, so I can't tell you what this is worth.
|
|
66
66
|
What can go wrong:
|
|
67
67
|
- Price exposure: you put in two coins. If one moves a lot against the other, you can end up with less than you started with, even if you earn rewards.
|
|
68
68
|
- Going out of range: if the price leaves the range you chose, you stop earning until it comes back, and you hold mostly the weaker coin.
|
|
69
69
|
- The rewards can end: a campaign can end at any time, and any rate shown is the rate of that day, which changes.
|
|
70
|
-
Your call. If you say nothing, the answer is Don't. [Don't] [Add liquidity]`),
|
|
70
|
+
Your call. If you say nothing, the answer is Don't. [Don't] [Add liquidity]`),be="Add liquidity",Te="Don't",ne=e("Your position is in the pool. Merkl adds new positions to its reward list after a delay, and rewards become claimable only after Merkl's next reward update{last_update_clause}. An empty list right after a deposit is normal; check again later."),se=e(": the last one was at {time} UTC"),re=e("Merkl lists no earning positions for this wallet right now. If you just added liquidity: {after_deposit}"),ie=e("Oak won't accept a price move that big. The most it allows is {cap_pct}%."),ue=e("This is a thin market and your size moves the price too much. Try a smaller amount."),de=e("Pendle's price doesn't match what Oak checked on the chain. Nothing was signed."),_e=e("LayerBank's setup no longer matches what Oak checked. Nothing was signed."),le=e("Pendle's price service isn't answering, so I can't quote or start a new term; I can still cash out ended terms."),xe={CARD_HEADER:s,CARD_HEADER_AMOUNT:r,CARD_HEADER_AMOUNT_NOT_HELD:i,OPTION_A:l,BONUS_CLAUSE:h,OPTION_B:c,OPTION_B_NONE:p,OPTION_A_CANT_CHECK:y,OPTION_B_CANT_CHECK:w,OPTION_A_CLOSED:E,OPTION_A_NO_ROOM:g,CARD_FOOTER_ASK:m,CARD_FOOTER_NO_ASK:f,ETH_HINT:k,NOTHING_TO_EARN:b,ACCESS_NO_PLAN:T,LB_DEPOSIT_SCREEN:x,LB_WITHDRAW_SCREEN:N,LB_BONUS_NOTE:S,LB_CASH_NOTE:L,PENDLE_BUY_STABLE_SCREEN:A,PENDLE_BUY_STOCK_SCREEN:O,PENDLE_SELL_SCREEN:P,PENDLE_SELL_GAP_LINE:D,PENDLE_SELL_NO_GAP_LINE:R,PENDLE_REDEEM_SCREEN:C,PENDLE_REDEEM_STOCK_SCREEN:I,PAYOUT_EXACT:U,PAYOUT_APPROX:v,STOCK_PAID_IN:Y,STOCK_SHORT_TERM:B,TOO_SMALL:M,TOO_SMALL_NO_SIZE:G,ACCESS_FEE_LINE:H,ACCESS_FREE_UNTIL_LINE:K,FEES_ESTIMATED_HIGH:W,MATURED_NOTICE:F,MATURED_STOCK_NOTICE:q,MATURED_STOCK_NOTICE_NO_AMOUNT:z,NO_NEW_TERM:$,LP_BLOCK:X,LP_RATE_LINE:j,LP_RANGE_CLAUSE:V,LP_FEE_CLAUSE:Z,LP_SHARE_LINE:J,LP_GAS_LINE:Q,LP_NOT_A_PROMISE:ee,LP_FUNDER_LINE:te,LP_NOT_WORTH_CLAUSE:oe,LP_BLOCK_UNREADABLE:ae,MERKL_AFTER_DEPOSIT:ne,MERKL_LAST_UPDATE_CLAUSE:se,MERKL_EARNING_EMPTY:re,SLIPPAGE_CAP_REFUSAL:ie,THIN_MARKET_REFUSAL:ue,PRICE_MISMATCH_REFUSAL:de,LAYERBANK_SETUP_MISMATCH:_e,PENDLE_SERVICE_DOWN:le},Ne=[/\bsafe(ly|ty)?\b/i,/\bguaranteed\b/i,/\brisk-free\b/i,/\bpassive\b/i,/\binvest/i,/\bAPY\b(?! a year)/];export{pe as a,ye as b,we as c,Ee as d,s as e,r as f,i as g,u as h,d as i,_ as j,ge as k,me as l,l as m,h as n,c as o,p,y as q,w as r,E as s,g as t,m as u,f as v,k as w,b as x,T as y,x as z,N as A,S as B,L as C,A as D,O as E,P as F,D as G,R as H,fe as I,C as J,I as K,U as L,v as M,Y as N,B as O,ke as P,M as Q,G as R,H as S,K as T,W as U,F as V,q as W,z as X,$ as Y,X as Z,j as _,V as $,Z as aa,J as ba,Q as ca,ee as da,te as ea,oe as fa,ae as ga,be as ha,Te as ia,ne as ja,se as ka,re as la,ie as ma,ue as na,de as oa,_e as pa,le as qa,xe as ra,Ne as sa,Se as ta};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./
|
|
1
|
+
import{a as v}from"./OVM4QIET.js";import{h as w}from"./2GXHYI23.js";import{a as y}from"./MSRCJ2BS.js";import{b as P,c as k,d as l}from"./WAKZWSHB.js";import{k as h}from"./UVAR6BHU.js";import{a as f}from"./43LI5NKJ.js";import{m as b,n as B}from"./NWNYJ26T.js";import{b as d}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as R}from"viem";var U=70515n,C=250202n,S=568341n;function N(a,r){return{token:{...a},amount:r.toString()}}function A(a){if(a.network!==void 0&&a.network!=="mainnet")throw new s("LayerBank requires chain 4663.")}async function g(a,r,n,e){try{return b(await a.readContract({address:r.address,abi:L,functionName:"balanceOf",args:[n],blockNumber:e}),"LayerBank returned a malformed wallet balance read.")}catch(t){throw t instanceof s?t:new s("LayerBank wallet balance could not be read. Please try again.")}}async function T(a,r,n){try{let[e,t]=await Promise.all([r.getGasPrice(),h("ETH",{client:r,http:a.http,chainId:d,blockNumber:n})]),i=B(t.usdE18,"LayerBank gas reference is unavailable.",{positive:!0}),c=b(e,"LayerBank gas reference is unavailable.");if(c===0n)throw new s("LayerBank gas reference is unavailable.");let u=m=>Number(R(m*c*i/10n**18n,18)),o=u(U+C),p=u(S);if(![o,p].every(m=>Number.isFinite(m)&&m>0))throw new s("LayerBank gas reference is unavailable.");return{gasInUsd:o,gasOutUsd:p}}catch{throw new s("LayerBank gas costs could not be checked against a fresh ETH/USD reference. Please try again.")}}async function x(a,r){A(a),f(r);let n=a.clientFor(d),e=await y(n),[t,i,c,u]=await Promise.all([g(n,k,r,e.blockNumber),g(n,l,r,e.blockNumber),v(a.http),T(a,n,e.blockNumber)]),o=[...c.checks,"Gas costs use measured USDG calls plus 20% headroom; entry includes approval and supply."];e.active||o.push("LayerBank reserve is inactive."),e.frozen&&o.push("LayerBank reserve is frozen for deposits."),e.paused&&o.push("LayerBank reserve is paused."),e.capRoomBase===0n&&o.push("LayerBank supply cap has no room left.");let p={rateBasePct:e.rateBasePct,...c.bonus==="unavailable"?{}:{bonus:c.bonus},cashUsdgBase:e.cashUsdgBase,capRoomBase:e.capRoomBase,open:e.active&&!e.frozen&&!e.paused&&e.capRoomBase>0n,walletUsdgBase:t,walletReceiptBase:i,...u,checks:o};return{reserve:e,reading:p}}function F(a){return async r=>{try{return(await x(a,r)).reading}catch(n){return{rateBasePct:0,cashUsdgBase:0n,capRoomBase:0n,open:!1,walletUsdgBase:0n,walletReceiptBase:0n,gasInUsd:0,gasOutUsd:0,checks:[n instanceof s?a.plainError(n):"LayerBank could not be checked right now. Please try again."]}}}}async function W(a,r){A(a),f(r);let n=a.clientFor(d),e=await y(n),t=await g(n,l,r,e.blockNumber);if(t===0n)return[];let i=a.formatAmount(t.toString(),6);return[{module:"layerbank",id:`${d}:${P}`,chainId:d,assets:[N(l,t)],economics:{principal:[w("redeemable",{token:{...k},amount:t.toString(),source:"layerbank.receiptBalance",heldAs:l.address,measuredAtBlock:e.blockNumber.toString()})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`${i} lRobUSDG = ${i} USDG; base supply rate ${e.rateBasePct}% a year, read now.`}]}export{U as a,C as b,S as c,N as d,A as e,g as f,x as g,F as h,W as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as me,c as Pe}from"./Z3IBPCY4.js";import{d as xe,e as Se,g as Ee,h as Oe,i as a,w as Ne}from"./Y64GFBTA.js";import{o as pe}from"./LKX5WDOQ.js";import{a as B}from"./Z7FGEWO2.js";import{a as Te}from"./43LI5NKJ.js";import{a as ee}from"./66F5ZH34.js";import{c as Y,j as ve}from"./NWNYJ26T.js";import{b as Ce}from"./IX3GZMTM.js";import{b as $,j as De}from"./TI727O2H.js";import{a as t}from"./XSD5NL7J.js";import{decodeFunctionData as _e,erc20Abi as Fe}from"viem";var Ge="https://api.relay.link",He="Relay requires an authorized API key for this endpoint. Ask the operator to configure a valid OAK_RELAY_API_KEY on the server with access to this resource; never pass keys in tool arguments.",oe=class extends Error{},k="0x0000000000000000000000000000000000000000",Ye=60,Be=30,n=De[$].relay.depository.address.toLowerCase(),te="0x59916da825d2d2ec1bf878d71c88826f6633ecca",ie=new Map([[1,{chainId:"ethereum",depository:n}],[10,{chainId:"optimism",depository:n}],[25,{chainId:"cronos",depository:te}],[56,{chainId:"bnb",depository:n}],[100,{chainId:"gnosis",depository:n}],[130,{chainId:"unichain",depository:n}],[137,{chainId:"polygon",depository:n}],[143,{chainId:"monad",depository:n}],[146,{chainId:"sonic",depository:n}],[169,{chainId:"manta",depository:n}],[196,{chainId:"xlayer",depository:n}],[288,{chainId:"boba",depository:n}],[324,{chainId:"zksync",depository:n}],[360,{chainId:"shape",depository:n}],[480,{chainId:"worldchain",depository:n}],[747,{chainId:"flow",depository:n}],[988,{chainId:"stable",depository:n}],[999,{chainId:"hyperevm",depository:n}],[1088,{chainId:"metis",depository:te}],[1135,{chainId:"lisk",depository:n}],[1868,{chainId:"soneium",depository:n}],[2020,{chainId:"ronin",depository:n}],[2741,{chainId:"abstract",depository:n}],[2818,{chainId:"morph",depository:n}],[4217,{chainId:"tempo",depository:n}],[4326,{chainId:"megaeth",depository:n}],[5e3,{chainId:"mantle",depository:te}],[5031,{chainId:"somnia",depository:n}],[5042,{chainId:"arc",depository:n}],[8453,{chainId:"base",depository:n}],[9745,{chainId:"plasma",depository:n}],[33139,{chainId:"apechain",depository:n}],[34443,{chainId:"mode",depository:n}],[42018,{chainId:"mythos",depository:n}],[42161,{chainId:"arbitrum",depository:n}],[42220,{chainId:"celo",depository:n}],[43114,{chainId:"avalanche",depository:n}],[48900,{chainId:"zircuit",depository:n}],[57073,{chainId:"ink",depository:n}],[59144,{chainId:"linea",depository:te}],[60808,{chainId:"bob",depository:n}],[80094,{chainId:"berachain",depository:n}],[97477,{chainId:"doma",depository:n}],[98866,{chainId:"plume",depository:n}],[534352,{chainId:"scroll",depository:n}],[685689,{chainId:"gensyn",depository:n}],[747474,{chainId:"katana",depository:n}],[5064014,{chainId:"ethereal",depository:n}],[7777777,{chainId:"zora",depository:n}]]),at=Object.freeze(["robinhood",...Array.from(ie.values(),e=>e.chainId)]);function dt(e){return e===$?"robinhood":ie.get(e)?.chainId}function ut(e){return ie.get(e)?.depository}function M(e){return ve(e,"Provide a token or wallet address.")}function g(e){let i=M(e);return i===B?k:i}function w(e,i){return M(e)===M(i)}function f(e){if(typeof e!="string")throw new t("Provide a decimal base-unit amount string.");return Ce(e),e}function ne(e){let i=f(e);if(BigInt(i)<=0n)throw new t("Provide a positive base-unit amount.");return i}function Ke(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Provide a positive integer origin chain ID.");return e}function Me(e,i){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t(`${i} is missing or invalid.`);return e}async function K(e,i,c,r,m){let s=a(c);if(s.chainId!==r||g(s.address)!==m||typeof s.symbol!="string"||!/^[A-Za-z0-9._-]{1,32}$/.test(s.symbol))throw new t("Relay quote token metadata does not match the requested chain and address.");if(m===k){if(s.decimals!==18)throw new t("Native token decimals must be 18.");return{address:B,chainId:r,symbol:s.symbol,decimals:18}}let b=`${r}:${m}`,h=i.get(b);if(h===void 0){let d=await e.clientFor(r).readContract({address:m,abi:Fe,functionName:"decimals"}),I=typeof d=="bigint"?Number(d):d;if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new t("Could not read valid ERC-20 decimals() on-chain.");h=I,i.set(b,h)}return{address:m,chainId:r,symbol:s.symbol,decimals:h}}async function Qe(e,i,c,r,m,s,b){if(c.swap===void 0)return[];let h=a(c.swap),d=a(h.from);if(d.chainId!==m)throw new t("The swap prerequisite token must be on the origin chain.");let I=await K(e,i,d,m,g(d.address)),F=s===k?B:s;if(w(I.address,F))throw new t("The swap prerequisite must use a different input token.");let he=ne(h.amountIn),y=h.slippageBps;if(y!==void 0&&(typeof y!="number"||!Number.isInteger(y)||y<0||y>1e4))throw new t("Provide swap slippage in basis points from 0 to 10000.");let S=await e.quoteSwap({from:I.address,to:F,amountIn:he,...y===void 0?{}:{slippageBps:y}},r);if(BigInt(f(S.expiresAt))<=BigInt(Math.floor(Date.now()/1e3)))throw new t("The swap prerequisite quote expired. Request a fresh quote.");if(BigInt(f(S.minAmountOut))<BigInt(b))throw new t("The swap prerequisite minimum cannot cover the bridge amount.");let q=await e.buildSwap(S.quoteId,r);if(!("txs"in q)||!q.txs.length)throw new t("The swap prerequisite must return unsigned transactions.");if(q.txs.some(p=>p.chainId!==m))throw new t("The injected swap coordinator does not support this origin chain.");return q.txs.map(p=>e.unsignedTx(p))}async function Ve(e,i,c){Te(c);let r=Ke(i.originChainId);if(r===$)throw new t("Inbound bridging requires an origin chain other than 4663.");let m=ie.get(r);if(!m)throw new t("Relay inbound does not support this origin chain.");if(i.destinationChainId!==void 0&&i.destinationChainId!==$)throw new t("Inbound bridge destination must be chain 4663.");let s=g(i.originCurrency??B),b=g(i.destinationCurrency??B),h=M(i.recipient??c),d=ne(i.amount),I=i.minAmountOut===void 0?void 0:f(i.minAmountOut),F=i.slippageBps===void 0?me:i.slippageBps;if(pe("0",F),await e.clientFor(r).getChainId()!==r)throw new t("The RPC chain does not match the inbound origin chain.");let y=new Map,S=await Qe(e,y,i,c,r,s,d),q;try{let o=await e.http(`${Ge}/quote/v2`,{method:"POST",headers:{"content-type":"application/json","user-agent":"oak-core/0.1.0"},body:JSON.stringify(xe({user:c,recipient:h,originChainId:r,destinationChainId:$,originCurrency:s,destinationCurrency:b,amount:d,tradeType:"EXACT_INPUT",includeProtocolData:!0,...s===k?{}:{explicitDeposit:!0}}))});if(o.status===401||o.status===403)throw new oe(He);if(!o.ok)throw new Error("Relay HTTP failure.");q=await o.json()}catch(o){throw o instanceof oe?new t(o.message):o instanceof t&&typeof o.reason=="string"&&o.reason.startsWith("keyed_")?new t(o.message):new t("Relay quote request failed. Please try again.")}let p=a(q);Se(p);let le=Ee(p.fees);if(typeof p.requestId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(p.requestId))throw new t("Relay returned an invalid request ID.");let E=p.requestId,ye=`/intents/status/v3?requestId=${E}`,U=a(p.details);if(!w(U.sender,c)||!w(U.recipient,h))throw new t("Relay quote sender or recipient does not match the request.");let fe=a(U.currencyIn),re=a(U.currencyOut),O=await K(e,y,fe.currency,r,s),N=await K(e,y,re.currency,$,b);if(f(fe.amount)!==d)throw new t("Relay quote input amount does not match the request.");let P=ne(re.amount),D=ne(re.minimumAmount);if(BigInt(D)>BigInt(P))throw new t("Relay quote minimum output exceeds the expected output.");if(I!==void 0){if(D!==I)throw new t("Relay order minimum must exactly match minAmountOut. Request a new quote.")}else{let o=pe(P,F);if(BigInt(D)<BigInt(o))throw Pe(P,D)}let we=a(a(p.fees).relayer),Ie=a(we.currency),Q=await K(e,y,Ie,r,g(Ie.address)),ge={token:Q,amount:f(we.amount)},be=a(U.refundCurrency),Ue=a(be.currency),L=await K(e,y,Ue,r,s),se=f(be.amount),j=a(a(p.protocol).v2);if(typeof j.orderId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(j.orderId))throw new t("Relay returned an invalid order ID.");let V=j.orderId.toLowerCase(),W=a(j.paymentDetails),R=M(W.depository);if(W.chainId!==m.chainId||R!==m.depository||g(W.currency)!==s||f(W.amount)!==d)throw new t("Relay payment details do not match the origin chain depository and input.");let z=a(j.orderData),C=a(z.output);if(C.chainId!=="robinhood"||!Array.isArray(C.calls)||C.calls.length!==0||!Array.isArray(C.payments)||C.payments.length!==1)throw new t("Relay order output does not match destination chain 4663.");let J=a(C.payments[0]);if(!w(J.recipient,h)||g(J.currency)!==b||f(J.minimumAmount)!==D||f(J.expectedAmount)!==P)throw new t("Relay order output payment does not match the quoted recipient and amounts.");let ae=Me(C.deadline,"Relay order output deadline");if(!Array.isArray(z.inputs)||!z.inputs.length)throw new t("Relay order has no inputs.");let X=[],de=[];for(let o of z.inputs){let u=a(o),T=a(u.payment);if(T.chainId!==m.chainId||g(T.currency)!==s||f(T.amount)!==d||!Array.isArray(u.refunds)||!u.refunds.length)throw new t("Relay order input does not match the quoted input.");for(let x of u.refunds){let l=a(x);if(!w(l.recipient,c))throw new t("Relay refund recipient does not match the agent wallet. Request a new quote.");if(X.push(Me(l.deadline,"Relay order refund deadline")),de.push(f(l.minimumAmount)),!(l.chainId===m.chainId?w(l.recipient,c)&&g(l.currency)===s:l.chainId==="robinhood"&&g(l.currency)===b))throw new t("Relay order refund terms do not match the sender or recipient.")}}let Ae=Math.min(ae,...X),G=0,$e=()=>{let o=Math.floor(Date.now()/1e3),u=G||o+Ye;if(Ae-o<=Be)throw new t("Relay order deadline is expired or too soon to sign safely. Request a new quote.");if(G=Math.min(u,Ae-Be),G<=o)throw new t("Relay quote expired before signing. Request a new quote.")};if($e(),!Array.isArray(p.steps)||!p.steps.length)throw new t("Relay returned no origin transactions.");let v=[];for(let o of p.steps){let u=a(o);if(u.kind!=="transaction"||u.requestId!==E||!Array.isArray(u.items)||!u.items.length)throw new t("Relay returned an unsupported origin step.");for(let T of u.items){let x=a(T),l=a(x.data),ce=a(x.check);if(x.status!=="incomplete"||l.chainId!==r||!w(l.from,c))throw new t("Relay transaction does not match the origin chain and sender.");if(ce.method!=="GET"||ce.endpoint!==ye)throw new t("Relay status endpoint does not match the request ID.");v.push(e.unsignedTx({to:M(l.to),data:l.data,value:f(l.value),chainId:r,description:`Relay inbound deposit for request ${E}; destination chain 4663.`}))}}if(!v.length)throw new t("Relay returned no origin transactions.");if(s===k&&v.length!==1)throw new t("Relay native deposit must be a single depositNative transaction.");if(s!==k&&v.length>2)throw new t("Relay ERC-20 deposit allows at most one exact-amount approval before depositErc20.");for(let o of v.slice(0,-1)){if(!o.data.toLowerCase().startsWith("0x095ea7b3"))throw new t("Relay returned an unsupported prerequisite transaction.");let u=_e({abi:Fe,data:o.data});if(u.functionName!=="approve")throw new t("Relay returned an invalid approval.");let[T,x]=u.args;if(s===k||!w(o.to,s)||!w(T,R)||x!==BigInt(d)||o.value!=="0")throw new t("Relay approval must authorize the exact input amount for the origin depository.");o.description=`Approve exactly ${e.formatAmount(d,O.decimals)} ${O.symbol} (${d} base units of ${s}) for ${R} on chain ${r}.`}let _=v[v.length-1],H=s===k,Z=H?"depositNative":"depositErc20",Re=H?"depositNative(address,bytes32)":"depositErc20(address,address,uint256,bytes32)";if(!w(_.to,R)||_.value!==(H?d:"0")||!(H?/^0x[0-9a-fA-F]{136}$/:/^0x[0-9a-fA-F]{264}$/).test(_.data))throw new t(`Relay deposit transaction does not target the origin depository with ${Z} calldata.`);let A;try{A=_e({abi:Oe,data:_.data})}catch{throw new t(`Relay deposit transaction must call ${Re}.`)}if(A.functionName!==Z)throw new t(`Relay deposit transaction must call ${Re}.`);let Le=A.args[0],je=A.functionName==="depositErc20"?A.args[3]:A.args[1];if(A.functionName==="depositErc20"&&(!w(A.args[1],s)||A.args[2]!==BigInt(d)))throw new t("Relay depositErc20 token or amount does not match the quoted input.");if(!w(Le,c)||je.toLowerCase()!==V)throw new t(`Relay ${Z} depositor or orderId does not match the wallet and quoted protocol.v2.orderId.`);_.description=`Relay inbound ${Z} for order ${V} (request ${E}); destination chain 4663.`;let ue=H?[]:await Ne(e,s,R,d,r,c);for(let[o,u]of ue.entries())u.description=ue.length===2&&o===0?`Reset the existing ${O.symbol} allowance for ${R} on chain ${r} to zero.`:`Approve exactly ${e.formatAmount(d,O.decimals)} ${O.symbol} (${d} base units of ${s}) for ${R} on chain ${r}.`;let ke=[...S,...ue,_],qe=await e.preview(ke,c);$e();let ze=qe.changes.map(o=>{let u=o.amount.startsWith("-");return`${u?"-":""}${e.formatAmount(u?o.amount.slice(1):o.amount,o.token.decimals)} ${o.token.symbol} (${o.token.address}, chain ${o.token.chainId})`});return{txs:ke,preview:qe,requestId:E,orderId:V,orderData:z,depository:R,originChainId:r,destinationChainId:$,recipient:h,amountIn:{token:O,amount:d},amountOut:{token:N,amount:P},minAmountOut:D,relayerFee:ge,fees:p.fees,...le,refundCurrency:{token:L,amount:se,minimumAmounts:de},orderDeadline:String(ae),refundDeadlines:X.map(String),expiresAt:String(G),status:"pending",statusEndpoint:ye,summary:`${le.feeDisclosure} ${S.length?"Swap prerequisite first, then ":""}Relay inbound from chain ${r} to chain 4663 for ${h}; expected ${e.formatAmount(P,N.decimals)} ${N.symbol}, minimum ${e.formatAmount(D,N.decimals)} ${N.symbol} (${N.address}). Quoted relay fee ${e.formatAmount(ge.amount,Q.decimals)} ${Q.symbol} (${Q.address}, chain ${r}); output is net of quoted fees. Order ${V} (request ${E}); output deadline ${ae}, refund deadlines ${X.join(", ")}, quote expires ${G}. Refund terms: details.refundCurrency quotes ${e.formatAmount(se,L.decimals)} ${L.symbol} (${se} base units) on chain ${L.chainId} (${L.address}), but protocol.v2 order refund floor is ${de.join(", ")} base units. ${ze.join("; ")}. Unsigned origin transactions only; destination fulfillment remains pending. Track with relay_status; timeout or refund is not fulfillment.`}}var ct=e=>({tools:[{name:"relay_bridge_in",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{const:$,description:"Destination chain ID; must be 4663."},originCurrency:{...Y,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{...Y,description:"Destination token address; defaults to native ETH."},amount:ee('Origin token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),minAmountOut:ee('Minimum destination token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),slippageBps:{type:"integer",minimum:0,maximum:9999,default:me,description:"Slippage in basis points (50 = 0.5%)."},recipient:{...Y,description:"Destination recipient address; defaults to your wallet."},swap:{type:"object",additionalProperties:!1,required:["from","amountIn"],properties:{from:{type:"object",additionalProperties:!1,required:["address","chainId","symbol","decimals"],properties:{address:{...Y,description:"Input token address."},chainId:{type:"integer",minimum:1,description:"Input token chain ID."},symbol:{type:"string",description:"Input token symbol."},decimals:{type:"integer",minimum:0,maximum:255,description:"Input token decimal places."}},description:"Token supplied to the origin swap."},amountIn:ee('Swap input token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),slippageBps:{type:"integer",minimum:0,maximum:1e4,description:"Slippage in basis points (50 = 0.5%)."}},description:"Optional origin swap before bridging."}}},async execute(i,c){try{return await Ve(e,i,c)}catch(r){throw new t(e.plainError(r))}}}]});export{at as a,dt as b,ut as c,ct as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A}from"./5HCXZWUH.js";import{
|
|
1
|
+
import{c as A}from"./5HCXZWUH.js";import{s as y}from"./MQ5F2VOK.js";import{a as b}from"./XSD5NL7J.js";import{erc20Abi as F,getAddress as $}from"viem";var P=new WeakMap,E=3e3,k=new WeakMap;async function q(C,h,u,m,c){u=$(u);let n=A(C),e=P.get(n);e||(e=new Map,P.set(n,e));let i=`${h}:${u.toLowerCase()}:${m}:${c??"latest"}`,t=e.get(i);if(t&&(e.delete(i),e.set(i,t)),!t){for(t=new Promise((s,T)=>{let a=k.get(n);a||(a=new Map,k.set(n,a));let f=`${h}:${c??"latest"}`,l=a.get(f);if(!l){l=[],a.set(f,l);let d=l;queueMicrotask(async()=>{a.delete(f);let w=d.map(r=>({address:r.address,abi:F,functionName:r.field}));try{if(d.length>1&&n.chain?.contracts?.multicall3&&typeof n.multicall=="function"){let r=await y(()=>n.multicall({contracts:w,blockNumber:c,allowFailure:!0}));d.forEach((o,p)=>{let g=r[p];g?.status==="success"?o.resolve(g.result):o.reject(g?.error??new b("Token metadata could not be read."))})}else await Promise.all(d.map(async(r,o)=>{try{r.resolve(await y(()=>n.readContract({...w[o],blockNumber:c})))}catch(p){r.reject(p)}}))}catch(r){d.forEach(o=>o.reject(r))}})}l.push({address:u,field:m,resolve:s,reject:T})}).then(s=>{if(m==="decimals"?!Number.isInteger(s)||Number(s)<0||Number(s)>255:typeof s!="string"||!s.trim())throw new b("The contract returned invalid token metadata.");return s});e.size>=E;)e.delete(e.keys().next().value);e.set(i,t);let M=t;t.catch(()=>{e.get(i)===M&&e.delete(i)})}try{return await t}finally{c!==void 0&&e.get(i)===t&&e.delete(i)}}export{q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d,b as D}from"./IBL6TL2Q.js";import{b as N}from"./G2AA73ZE.js";import{ja as T}from"./HHYE42JG.js";import{h as u,i as C,l as I,m as O}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as b,isHex as Z,keccak256 as j,parseAbi as G,zeroAddress as J}from"viem";var y=G(["function asset() view returns (address)","function decimals() view returns (uint8)","function symbol() view returns (string)","function owner() view returns (address)","function curator() view returns (address)","function adaptersLength() view returns (uint256)","function adapters(uint256) view returns (address)","function parentVault() view returns (address)","function isVaultV2(address) view returns (bool)","function totalAssets() view returns (uint256)","function totalSupply() view returns (uint256)","function convertToAssets(uint256) view returns (uint256)","function previewDeposit(uint256) view returns (uint256)","function performanceFee() view returns (uint256)","function getThreshold() view returns (uint256)","function getOwners() view returns (address[])"]),o=T("setup-mismatch",{}),p=e=>I(C(e,o),o),x=e=>O(e,o);function g(e){if(typeof e!="string"||!Z(e,{strict:!0})||e.length<4||e.length%2!==0)throw new n(o);return j(e)}function V(e){if(typeof e!="number"||!Number.isInteger(e)||e<0||e>255)throw new n(o);return e}function H(e,t){return typeof e=="string"&&/^[A-Za-z0-9.$_-]{1,32}$/.test(e)?e:t}async function _(e,t){if(await e.getChainId()!==d.chainId)throw new n("Borro requires chain 4663.");return x(t??await e.getBlockNumber({cacheTime:0}))}async function z(e,t,f){let a=(r,s,l=[])=>e.readContract({address:r,abi:y,functionName:s,args:l,blockNumber:f}),i={ok:!0,drift:[]};for(let r of["owner","curator"])try{i[r]=p(await a(t,r)),u(i[r],d[r])||i.drift.push(r)}catch{i.drift.push(`${r} unreadable`)}try{let r=x(await a(t,"adaptersLength"));if(r>64n)throw new n(o);let s=await Promise.all(Array.from({length:Number(r)},async(l,c)=>{let m=p(await a(t,"adapters",[BigInt(c)]));if(g(await e.getCode({address:m,blockNumber:f})),!u(await a(m,"parentVault"),t))throw new n(o);return m}));if(new Set(s).size!==s.length)throw new n(o);i.adapters=s}catch{i.drift.push("adapters unreadable or invalid")}return i}function M(e=[]){return async(t,f)=>{let a=u(f,d.assetRule.usdg.address)?{...d.assetRule.usdg,chainId:d.chainId}:e.find(i=>i.chainId===d.chainId&&u(i.address,f));return a?{...a,address:p(a.address)}:void 0}}function Q(e={resolveAllowedAsset:M()}){return async(t,f,a,i={})=>{try{let r=p(f),s=await _(t,i.blockNumber),l=a==="deposit"&&!!i.wallet,c=[{address:d.factory.address,abi:y,functionName:"isVaultV2",args:[r]},{address:r,abi:y,functionName:"asset"},{address:r,abi:y,functionName:"decimals"}],[m,k,R,E]=await Promise.all([t.getCode({address:d.factory.address,blockNumber:s}),t.getCode({address:r,blockNumber:s}),l?t.multicall({allowFailure:!1,batchSize:0,blockNumber:s,contracts:[...c,{address:d.builders.address,abi:N,functionName:"vaults",args:[r]},{address:d.builders.address,abi:N,functionName:"builders",args:[D]}]}):Promise.all(c.map(v=>t.readContract({...v,blockNumber:s}))),l?t.getCode({address:d.builders.address,blockNumber:s}):void 0]);if(!Array.isArray(R)||R.length!==(l?5:3))throw new n(o);let[$,F,L,S,q]=R,P=!1;if(l){if(!u(g(E),d.builders.codeHash)||typeof S!="boolean")throw new n(o);let v=C(q,o);P=S&&!u(v,J)}if(!u(g(m),d.factory.codeHash)||$!==!0||V(L)!==18)throw new n(o);let K=g(k),A=p(F),B=V(await t.readContract({address:A,abi:b,functionName:"decimals",blockNumber:s})),w;try{w=await e.resolveAllowedAsset(t,A,s)}catch{}if(w&&(!u(w.address,A)||w.chainId!==4663||w.decimals!==B||H(w.symbol,"")===""))throw new n(o);let h=await z(t,r,s);if(w||h.drift.push("asset identity is outside the available official catalogue"),h.drift.length){if(a!=="withdraw"||!i.wallet)throw new n(o);if(x(await t.readContract({address:r,abi:b,functionName:"balanceOf",args:[p(i.wallet)],blockNumber:s}))===0n)throw new n(o)}let U=H(await t.readContract({address:r,abi:b,functionName:"symbol",blockNumber:s}).catch(()=>{}),"shares");return{vault:r,symbol:w?.symbol??"token",vaultSymbol:U,asset:A,assetDecimals:B,codeHash:K,chainId:4663,shareDecimals:18,...h.owner&&{owner:h.owner},...h.curator&&{curator:h.curator},...h.adapters&&{adapters:h.adapters},setup:h,assetAllowed:!!w,mode:a,...l?{builderEligible:P}:{},source:d.factory.source,measuredAtBlock:s.toString(),provenance:{kind:"factory",factory:d.factory.address,isVaultV2:!0}}}catch(r){throw r instanceof n?r:new n(o)}}}var ae=Q(),se=async(e,t,f)=>{try{let a=await _(e),[i,r,s,l]=await Promise.all([e.getCode({address:t.vault,blockNumber:a}),e.readContract({address:t.vault,abi:y,functionName:"asset",blockNumber:a}),e.readContract({address:t.vault,abi:b,functionName:"decimals",blockNumber:a}),e.readContract({address:t.asset,abi:b,functionName:"decimals",blockNumber:a})]);if(!u(g(i),t.codeHash)||!u(p(r),t.asset)||V(s)!==18||V(l)!==t.assetDecimals)throw new n(o);let c=await z(e,t.vault,a);if(t.adapters&&c.adapters&&(t.adapters.length!==c.adapters.length||t.adapters.some((m,k)=>!u(m,c.adapters[k])))&&c.drift.push("adapters changed"),f==="deposit"&&c.drift.length)throw new n(o);return c}catch(a){throw a instanceof n?a:new n(o)}};export{y as a,o as b,p as c,x as d,g as e,V as f,H as g,_ as h,M as i,Q as j,ae as k,se as l};
|