@oakagentkit/core 0.2.1 → 0.2.3
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 +93 -0
- package/build/dist/api/addresses.js +1 -1
- 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/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/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/backoff.d.ts +6 -0
- package/build/dist/api/modules/heyresearch/backoff.js +1 -0
- package/build/dist/api/modules/heyresearch/builder-feed.d.ts +62 -0
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -0
- package/build/dist/api/modules/heyresearch/index.d.ts +3 -0
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/proof-reads.d.ts +7 -0
- package/build/dist/api/modules/heyresearch/proof-reads.js +1 -0
- package/build/dist/api/modules/heyresearch/public-reads.d.ts +1 -0
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/scan.d.ts +31 -0
- package/build/dist/api/modules/heyresearch/scan.js +1 -0
- package/build/dist/api/modules/heyresearch/status-labels.d.ts +5 -0
- package/build/dist/api/modules/heyresearch/status-labels.js +1 -0
- package/build/dist/api/modules/heyresearch/token-facts.d.ts +123 -0
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -0
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/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.d.ts +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.d.ts +63 -0
- package/build/dist/api/modules/hookr/agent-gate.js +1 -0
- 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.d.ts +1 -0
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/launch-options.d.ts +119 -0
- package/build/dist/api/modules/hookr/launch-options.js +1 -0
- package/build/dist/api/modules/hookr/launch-profile.d.ts +5 -0
- package/build/dist/api/modules/hookr/launch-profile.js +1 -0
- package/build/dist/api/modules/hookr/launch-receipt.d.ts +144 -0
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -0
- package/build/dist/api/modules/hookr/launch.d.ts +58 -0
- package/build/dist/api/modules/hookr/launch.js +1 -0
- package/build/dist/api/modules/hookr/liquidity.d.ts +48 -0
- package/build/dist/api/modules/hookr/liquidity.js +1 -0
- package/build/dist/api/modules/hookr/lp-positions.d.ts +2 -0
- package/build/dist/api/modules/hookr/lp-positions.js +1 -0
- package/build/dist/api/modules/hookr/lp-reads.d.ts +52 -0
- package/build/dist/api/modules/hookr/lp-reads.js +1 -0
- package/build/dist/api/modules/hookr/lp-receipt.d.ts +136 -0
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -0
- package/build/dist/api/modules/hookr/lp-state.d.ts +33 -0
- package/build/dist/api/modules/hookr/lp-state.js +1 -0
- package/build/dist/api/modules/hookr/pins.d.ts +43 -0
- package/build/dist/api/modules/hookr/pins.js +1 -0
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/read-utils.d.ts +59 -0
- package/build/dist/api/modules/hookr/read-utils.js +1 -0
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/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/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-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.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/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/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/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/reads.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/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/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.d.ts +5 -0
- package/build/dist/api/modules/wormhole/index.js +1 -0
- package/build/dist/api/modules/wormhole/license.d.ts +2 -0
- package/build/dist/api/modules/wormhole/license.js +1 -0
- package/build/dist/api/modules/wormhole/quotetext.d.ts +36 -0
- package/build/dist/api/modules/wormhole/quotetext.js +1 -0
- package/build/dist/api/modules/wormhole/scan-text.d.ts +40 -0
- package/build/dist/api/modules/wormhole/scan-text.js +1 -0
- package/build/dist/api/modules/wormhole/token-check.d.ts +54 -0
- package/build/dist/api/modules/wormhole/token-check.js +1 -0
- 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/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.js +1 -1
- package/build/dist/api/types.d.ts +7 -0
- package/build/dist/chunks/{QHHZDXRG.js → 2FSX7MMR.js} +1 -1
- package/build/dist/chunks/{RTBOMWCB.js → 2LM7U4S7.js} +1 -1
- package/build/dist/chunks/{BBVKWG65.js → 2MSQ6JII.js} +1 -1
- package/build/dist/chunks/{T6MTTMLQ.js → 2UU5TBBB.js} +1 -1
- package/build/dist/chunks/{OW7GOYKA.js → 2W46IRX6.js} +1 -1
- package/build/dist/chunks/{6LLOTPH2.js → 3EFV4FQF.js} +1 -1
- package/build/dist/chunks/{IAXKPME3.js → 3NDVXEBR.js} +1 -1
- package/build/dist/chunks/3SC5UI35.js +1 -0
- package/build/dist/chunks/{TCS3ICNE.js → 3WBDHUV2.js} +1 -1
- package/build/dist/chunks/{UPPYXY74.js → 4AKIXLXH.js} +1 -1
- package/build/dist/chunks/{ZGXNTWYG.js → 4GHVIBL5.js} +1 -1
- package/build/dist/chunks/{NHCRJC5X.js → 4KQZTPMS.js} +1 -1
- package/build/dist/chunks/{N77ANGBT.js → 4X2JOQ2L.js} +1 -1
- package/build/dist/chunks/{ZPM2MFXZ.js → 52DHGSG4.js} +1 -1
- package/build/dist/chunks/{2CS3M32D.js → 57HAXNQV.js} +1 -1
- package/build/dist/chunks/5IIR3GIN.js +1 -0
- package/build/dist/chunks/{CAU44UWP.js → 5O5ZE3ZV.js} +1 -1
- package/build/dist/chunks/5OEHZJ6X.js +1 -0
- package/build/dist/chunks/{CBA776XQ.js → 5VHH5PW3.js} +1 -1
- package/build/dist/chunks/{6HV5BR7P.js → 6AWTAE4Q.js} +1 -1
- package/build/dist/chunks/{JRVTSGAT.js → 6UPPUHCL.js} +1 -1
- package/build/dist/chunks/{MEMVFR7Z.js → 6ZYLNB2B.js} +1 -1
- package/build/dist/chunks/7XLEYOZH.js +1 -0
- package/build/dist/chunks/{Q4RZQCDS.js → AAGDMH54.js} +1 -1
- package/build/dist/chunks/ACN2BFMA.js +1 -0
- package/build/dist/chunks/{L24EOVLT.js → AJP5LDM2.js} +1 -1
- package/build/dist/chunks/{F2YH72GF.js → ALK6NKFP.js} +1 -1
- package/build/dist/chunks/{EC5W3UZD.js → AMICUXS6.js} +1 -1
- package/build/dist/chunks/{BEPSWFJX.js → ASDKY5NX.js} +1 -1
- package/build/dist/chunks/{5LQBHXFA.js → BX7XQANB.js} +1 -1
- package/build/dist/chunks/{NUTHT4FE.js → CE7D6MUS.js} +1 -1
- package/build/dist/chunks/{QNPEKNWM.js → CEIPDEXZ.js} +1 -1
- package/build/dist/chunks/{HFQS5344.js → CQCVFRQ5.js} +1 -1
- package/build/dist/chunks/{OJLMF5AR.js → CUNQ5RG5.js} +1 -1
- package/build/dist/chunks/{IWALIX7Q.js → CXLEQCP3.js} +1 -1
- package/build/dist/chunks/{VJ3W2V3B.js → CY75R4FK.js} +1 -1
- package/build/dist/chunks/{65QFM4JU.js → DCTUYDWF.js} +1 -1
- package/build/dist/chunks/{N37ZLNCT.js → DRWWPBOQ.js} +1 -1
- package/build/dist/chunks/{7B5UH2VS.js → DZGEQBO7.js} +1 -1
- package/build/dist/chunks/{RFJCG4NA.js → E7R3J4H7.js} +1 -1
- package/build/dist/chunks/{7T4BYFD4.js → EGUMOD3A.js} +1 -1
- package/build/dist/chunks/ELZNT5Q3.js +1 -0
- package/build/dist/chunks/{IUETZH6I.js → EXRKBBX2.js} +1 -1
- package/build/dist/chunks/{K7HIKXNT.js → FBSUTF3B.js} +1 -1
- package/build/dist/chunks/{LFN3OODW.js → FUXT7GRK.js} +1 -1
- package/build/dist/chunks/{7US6PD56.js → G3MHDTGT.js} +1 -1
- package/build/dist/chunks/G6HCV67X.js +1 -0
- package/build/dist/chunks/GCWA4Z3W.js +1 -0
- package/build/dist/chunks/{HNMOB76J.js → GGUEKSR4.js} +1 -1
- package/build/dist/chunks/{GZ5TW3WB.js → GIV5JMTE.js} +1 -1
- package/build/dist/chunks/{OMTCWXQR.js → GJY3P6OG.js} +1 -1
- package/build/dist/chunks/HOEQVPY7.js +1 -0
- package/build/dist/chunks/{3R3C3CU5.js → IBXYIN7Q.js} +1 -1
- package/build/dist/chunks/{SXX52Y27.js → IUE6RASI.js} +1 -1
- package/build/dist/chunks/{AYM5L6L7.js → J3GFCBZZ.js} +1 -1
- package/build/dist/chunks/{T3MGNKA6.js → JPOYTTTW.js} +1 -1
- package/build/dist/chunks/{AZGMF26W.js → JST5JGAP.js} +1 -1
- package/build/dist/chunks/{FBQWTWPT.js → JWCOXLYA.js} +1 -1
- package/build/dist/chunks/{G7UKNO2I.js → KHJFXJBU.js} +1 -1
- package/build/dist/chunks/{HQVC6X3T.js → KSZMMNXK.js} +1 -1
- package/build/dist/chunks/{O7PQDUVT.js → L3ZM77SJ.js} +1 -1
- package/build/dist/chunks/{QRUC7EFE.js → L62M7LOB.js} +1 -1
- package/build/dist/chunks/{22S4SFD5.js → L7YBCMZU.js} +1 -1
- package/build/dist/chunks/LKJBMHCE.js +1 -0
- package/build/dist/chunks/{FKAA7VUR.js → LLM5WDM3.js} +1 -1
- package/build/dist/chunks/{H6ED3RHF.js → LMVB3B6T.js} +1 -1
- package/build/dist/chunks/{UIIJWIR6.js → LQGPMOD2.js} +1 -1
- package/build/dist/chunks/{WLACEU2Y.js → LQUDJCAR.js} +1 -1
- package/build/dist/chunks/LT5P6PZW.js +1 -0
- package/build/dist/chunks/M7U3A4EH.js +3 -0
- package/build/dist/chunks/MKQVS3IO.js +1 -0
- package/build/dist/chunks/{5XFXH2JT.js → NATG6YA6.js} +1 -1
- package/build/dist/chunks/{O47JXRXN.js → NAYRD43N.js} +1 -1
- package/build/dist/chunks/{6L6DSMCU.js → NMYGNJIJ.js} +1 -1
- package/build/dist/chunks/NRBIXV7V.js +1 -0
- package/build/dist/chunks/{D6VP3N27.js → NSOEDRBU.js} +1 -1
- package/build/dist/chunks/{HL2MLC3O.js → NU4K3TEZ.js} +1 -1
- package/build/dist/chunks/NWSPC3NH.js +1 -0
- package/build/dist/chunks/O5IVZHHP.js +1 -0
- package/build/dist/chunks/{I7NUTSSX.js → OE3CLZHR.js} +1 -1
- package/build/dist/chunks/{2NA6JLEC.js → OQVZVR2S.js} +1 -1
- package/build/dist/chunks/{D3OWLDVB.js → OVK4EEOD.js} +1 -1
- package/build/dist/chunks/{Q2VMH2LB.js → PARWLWXW.js} +1 -1
- package/build/dist/chunks/{NCEJZWGX.js → PEA32CWB.js} +1 -1
- package/build/dist/chunks/{DHXVYHT4.js → PTAWEHKB.js} +1 -1
- package/build/dist/chunks/{DVKDWXEJ.js → PWBL4WKB.js} +1 -1
- package/build/dist/chunks/{PR2QED25.js → PZHR4ITH.js} +1 -1
- package/build/dist/chunks/{OG5HRQU4.js → QRDDKA4I.js} +1 -1
- package/build/dist/chunks/{YR3QJVJQ.js → QXNPPCOU.js} +1 -1
- package/build/dist/chunks/{6NR7SVRO.js → QYYFRAWY.js} +1 -1
- package/build/dist/chunks/{QR7ALOR4.js → R53P2K3C.js} +1 -1
- package/build/dist/chunks/{5RKWSFD2.js → R7FXNZRM.js} +1 -1
- package/build/dist/chunks/{CCEWSOBT.js → R7QPJQP6.js} +1 -1
- package/build/dist/chunks/{SLSPWXR6.js → R7SXC74O.js} +1 -1
- package/build/dist/chunks/{IHGVCPVA.js → RAKUK5VR.js} +1 -1
- package/build/dist/chunks/{7LDAJ6BM.js → S3HNPTXA.js} +1 -1
- package/build/dist/chunks/{WIDTTGSH.js → SJPM5ST4.js} +1 -1
- package/build/dist/chunks/{QYHJWU5T.js → SJPYXNOK.js} +1 -1
- package/build/dist/chunks/{VY3P34PY.js → SKQGLGES.js} +1 -1
- package/build/dist/chunks/{ZT67OMLW.js → SOYQOE5P.js} +1 -1
- package/build/dist/chunks/{GUBB5P6V.js → SQZRVIVF.js} +1 -1
- package/build/dist/chunks/{E24S22BZ.js → SSTROLQM.js} +1 -1
- package/build/dist/chunks/{DGGOO4RN.js → SXAIXD56.js} +1 -1
- package/build/dist/chunks/{D4WURN33.js → SXX3VTBP.js} +1 -1
- package/build/dist/chunks/{UXG67LH3.js → TCPPYBGQ.js} +1 -1
- package/build/dist/chunks/{67TJOOBI.js → TLJPVYRJ.js} +1 -1
- package/build/dist/chunks/{ULJ6E4HP.js → TMGWXDCZ.js} +1 -1
- package/build/dist/chunks/TNLHMDWL.js +1 -0
- package/build/dist/chunks/{NMFVXBTL.js → TNSKEHPC.js} +1 -1
- package/build/dist/chunks/TPDOUL4N.js +1 -0
- package/build/dist/chunks/{C2FEXLMA.js → TQL7UDFL.js} +1 -1
- package/build/dist/chunks/{QXFJZGVB.js → TWCSCRFS.js} +1 -1
- package/build/dist/chunks/{2EDXKJ3B.js → TWSTOFN3.js} +1 -1
- package/build/dist/chunks/{X6G4BD35.js → U3F6DDML.js} +1 -1
- package/build/dist/chunks/{XGUKLFBU.js → UFS2RVEZ.js} +1 -1
- package/build/dist/chunks/{RM5W63LO.js → UNZRE3YU.js} +1 -1
- package/build/dist/chunks/{GECX5U3F.js → USSOVTD5.js} +1 -1
- package/build/dist/chunks/V2OOOV6B.js +1 -0
- package/build/dist/chunks/{IRWEY7TQ.js → V5LTA42G.js} +1 -1
- package/build/dist/chunks/{TAI63P6E.js → VC2RCYQE.js} +1 -1
- package/build/dist/chunks/VCLPOU7T.js +1 -0
- package/build/dist/chunks/{BG4S6MSN.js → VFKNXQXI.js} +1 -1
- package/build/dist/chunks/{3ZVGHC6S.js → VFSRRDLY.js} +1 -1
- package/build/dist/chunks/{XW7RH7YY.js → VVEUJ36E.js} +1 -1
- package/build/dist/chunks/{5EHQM6DM.js → WQ6H62DM.js} +1 -1
- package/build/dist/chunks/{TDN3C4IG.js → WQQJ7UPJ.js} +1 -1
- package/build/dist/chunks/{F3TJCOVV.js → WTSMPDT5.js} +1 -1
- package/build/dist/chunks/{BYXBS45D.js → WVXW6VL3.js} +1 -1
- package/build/dist/chunks/WWFOYZT2.js +1 -0
- package/build/dist/chunks/WWNAGOCD.js +1 -0
- package/build/dist/chunks/X2NJSQUY.js +203 -0
- package/build/dist/chunks/{C3ZZSGSP.js → XQUPZ3GU.js} +1 -1
- package/build/dist/chunks/XQXLFF7Y.js +1 -0
- package/build/dist/chunks/XUYHMOHS.js +1 -0
- package/build/dist/chunks/XV2HQKND.js +1 -0
- package/build/dist/chunks/{QZM7CWZW.js → XVFLT275.js} +1 -1
- package/build/dist/chunks/{BV3AHLH5.js → XWEFKXKA.js} +1 -1
- package/build/dist/chunks/{NKY3DT34.js → YA5WWDEW.js} +1 -1
- package/build/dist/chunks/YHB55C5T.js +1 -0
- package/build/dist/chunks/YOENHHKI.js +1 -0
- package/build/dist/chunks/YQUKU2LS.js +1 -0
- package/build/dist/chunks/{72AWP4BM.js → YZSTP2E6.js} +1 -1
- package/build/dist/chunks/{T3NPRRTY.js → Z7RL4NGX.js} +1 -1
- package/build/dist/chunks/{YMB553OJ.js → ZT47KN7A.js} +1 -1
- package/build/dist/chunks/ZXQMF56D.js +1 -0
- package/package.json +1 -1
- package/build/dist/chunks/6SCCW74G.js +0 -1
- package/build/dist/chunks/DD7755AW.js +0 -1
- package/build/dist/chunks/EYYUWFUR.js +0 -1
- package/build/dist/chunks/JG24LNUI.js +0 -1
- package/build/dist/chunks/JRO6WTK4.js +0 -1
- package/build/dist/chunks/MNFU7PO3.js +0 -1
- package/build/dist/chunks/N3GWFLG6.js +0 -1
- package/build/dist/chunks/RRSODRGT.js +0 -1
- package/build/dist/chunks/UMK564HS.js +0 -1
- package/build/dist/chunks/XPFVT2EA.js +0 -1
- package/build/dist/chunks/XUJSQV52.js +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ToolArgs } from '../../types.js';
|
|
2
|
+
export declare const TOKEN_TIMEOUT_MS = 5000;
|
|
3
|
+
export declare function checkToken(http: typeof fetch, args: ToolArgs): Promise<{
|
|
4
|
+
status: string;
|
|
5
|
+
verdict: null;
|
|
6
|
+
signatureValid: boolean;
|
|
7
|
+
codes: never[];
|
|
8
|
+
reason: string;
|
|
9
|
+
token: {
|
|
10
|
+
address: `0x${string}`;
|
|
11
|
+
chainId: number;
|
|
12
|
+
};
|
|
13
|
+
contentBound: boolean;
|
|
14
|
+
mutationCountAuthenticated: boolean;
|
|
15
|
+
attribution: {
|
|
16
|
+
provider: string;
|
|
17
|
+
source: string;
|
|
18
|
+
page: string;
|
|
19
|
+
};
|
|
20
|
+
keyId: string;
|
|
21
|
+
unknowns: string[];
|
|
22
|
+
} | {
|
|
23
|
+
status: string;
|
|
24
|
+
verdict: unknown;
|
|
25
|
+
signatureValid: boolean;
|
|
26
|
+
codes: unknown;
|
|
27
|
+
evidence: {
|
|
28
|
+
attestation: Record<string, unknown>;
|
|
29
|
+
signature: string;
|
|
30
|
+
scope: string;
|
|
31
|
+
metadataHash: unknown;
|
|
32
|
+
bundleHash: string;
|
|
33
|
+
ruleset: unknown;
|
|
34
|
+
issuedAt: unknown;
|
|
35
|
+
expiresAt: unknown;
|
|
36
|
+
bundleIdentityValid: boolean;
|
|
37
|
+
};
|
|
38
|
+
staleReasons: string[];
|
|
39
|
+
mutationCount: unknown;
|
|
40
|
+
notice: string;
|
|
41
|
+
token: {
|
|
42
|
+
address: `0x${string}`;
|
|
43
|
+
chainId: number;
|
|
44
|
+
};
|
|
45
|
+
contentBound: boolean;
|
|
46
|
+
mutationCountAuthenticated: boolean;
|
|
47
|
+
attribution: {
|
|
48
|
+
provider: string;
|
|
49
|
+
source: string;
|
|
50
|
+
page: string;
|
|
51
|
+
};
|
|
52
|
+
keyId: string;
|
|
53
|
+
unknowns: string[];
|
|
54
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../../chunks/NWSPC3NH.js";import"../../../chunks/MYBDO5SA.js";import"../../../chunks/HIMVOTIU.js";import"../../../chunks/73N3TOJL.js";import"../../../chunks/RETS2ZEK.js";import"../../../chunks/5YS5V2LK.js";import"../../../chunks/JXOEJPJ4.js";export{a as TOKEN_TIMEOUT_MS,b as checkToken};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P}from"../chunks/6IM6A5VA.js";import{a as f}from"../chunks/RETS2ZEK.js";import{a as p}from"../chunks/
|
|
1
|
+
import{a as P}from"../chunks/6IM6A5VA.js";import{a as f}from"../chunks/RETS2ZEK.js";import{a as p}from"../chunks/G6HCV67X.js";import{a as m,d as u}from"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";import{getAddress as h}from"viem";function y(i){let t=Array.isArray(i)?i.map((o,e)=>[void 0,o,e]):Object.entries(i).map(([o,e],s)=>[o,e,s]),n=[];for(let[o,e,s]of t){if(typeof e=="function"){let a=o||e.name||`module_${s}`;n.push({name:a,read:e});continue}if(e&&typeof e=="object"){let a=o||e.name||("module"in e?e.module:void 0)||`module_${s}`;typeof e.positions=="function"?n.push({name:a,read:e.positions.bind(e)}):"read"in e&&typeof e.read=="function"&&n.push({name:a,read:e.read.bind(e)})}}return n}function w(i,t){if(!i||typeof i!="object")throw new m(`Module ${t} returned an invalid position.`);if(typeof i.id!="string"||!i.id.trim())throw new m(`Module ${t} returned a position without an id.`);if(!Number.isSafeInteger(i.chainId)||i.chainId<=0)throw new m(`Module ${t} returned a position with an invalid chainId.`);if(!Array.isArray(i.assets))throw new m(`Module ${t} returned a position with invalid assets.`);let n=i.assets.map(o=>({token:{address:o.token.address,symbol:o.token.symbol,decimals:o.token.decimals,chainId:o.token.chainId},amount:f(o.amount).toString()}));return{module:i.module||t,id:i.id,chainId:i.chainId,assets:n,description:i.description,...i.incomplete?{incomplete:!0}:{}}}async function $(i,t=[],n={}){P(i);let o=h(i),e=n.chainId??p,s=y(t),a=await Promise.allSettled(s.map(async r=>{let d=await r.read(o);if(!Array.isArray(d))throw new m(`Module ${r.name} did not return a position list.`);return d.map(c=>w(c,r.name))})),l=[];for(let r=0;r<a.length;r++){let d=a[r],c=s[r];d.status==="fulfilled"?l.push(...d.value):l.push({module:c.name,id:"error",chainId:e,assets:[],description:`${c.name}: ${u(d.reason)}`})}return l}export{$ as getPositions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunks/OVK4EEOD.js";import"../chunks/RETS2ZEK.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{d as BURNER_NOTE_WALLET,c as NOTE_TTL,a as PRICE_NOTE_NAME,e as PRICE_NOTE_TYPEHASH,b as PRICE_NOTE_VERSION,f as eip712DomainSeparator,m as isWithinNoteGuard,j as noteDigest,g as priceNoteDomain,h as priceNoteDomainSeparator,i as priceNoteStructHash,l as recoverNoteSigner,k as signNote,n as verifyNoteOffchain};
|
package/build/dist/api/prices.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"../chunks/FUXT7GRK.js";import"../chunks/OVK4EEOD.js";import"../chunks/R7QPJQP6.js";import"../chunks/E7R3J4H7.js";import"../chunks/JPOYTTTW.js";import"../chunks/LQGPMOD2.js";import"../chunks/NSOEDRBU.js";import"../chunks/3EFV4FQF.js";import"../chunks/XVFLT275.js";import"../chunks/5O5ZE3ZV.js";import"../chunks/EA6IYKIB.js";import"../chunks/KSZMMNXK.js";import"../chunks/TNSKEHPC.js";import"../chunks/CY75R4FK.js";import"../chunks/LIUXNOLP.js";import"../chunks/CQCVFRQ5.js";import"../chunks/KHJFXJBU.js";import"../chunks/WVXW6VL3.js";import"../chunks/GIV5JMTE.js";import"../chunks/WQ6H62DM.js";import"../chunks/QRDDKA4I.js";import"../chunks/P4UQGWCP.js";import"../chunks/AXYOJBX6.js";import"../chunks/Z25UKUJF.js";import"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/MYBDO5SA.js";import"../chunks/HIMVOTIU.js";import"../chunks/UWOFA6GV.js";import"../chunks/73N3TOJL.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/CXLEQCP3.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{a as MAX_PRICE_AGE_SECONDS,b as USD_PARITY_E18,h as assertFreshPrice,j as getPrice,f as isCanonicalEthOrWeth,d as isCanonicalNativeEth,c as isCanonicalUsdg,e as isCanonicalWeth,g as isPriceFresh,i as sqrtRatioAtTick};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../chunks/R7QPJQP6.js";import"../chunks/RETS2ZEK.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{e as BURNER_IMPACT_ALLOWANCE_BPS,d as MAX_BURNER_FLOOR_BPS,c as MIN_BURNER_FLOOR_BPS,a as NOHOLD_FLOOR,b as ORACLE_WINDOW_SECONDS,q as averageOakEth30m,l as burnerFloorBps,m as burnerMinOut,f as entryUsdE18,o as ethUsdFromSqrtRatioX96,k as marketCapUsdE18,n as meanTickFromCumulatives,g as noHoldPriceBase,i as oakUsdE18,j as requiredCount,h as signupBurn,p as spotOakPerEthFromSqrtPriceX96};
|
package/build/dist/api/rpc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e,f,g}from"../chunks/CXLEQCP3.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{a as RpcFailure,g as createRpcTransport,c as retryRpc,b as rpcFailure,d as rpcFallbackUrls,f as withBackgroundRpc,e as withInteractiveRpc};
|
package/build/dist/api/send.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m}from"../chunks/
|
|
1
|
+
import{a as m}from"../chunks/CY75R4FK.js";import"../chunks/LIUXNOLP.js";import"../chunks/QRDDKA4I.js";import{b as h}from"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/CXLEQCP3.js";import{i as u,s as l}from"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";import{encodeFunctionData as T,erc20Abi as f,formatUnits as y,getAddress as c,isAddress as g,zeroAddress as C}from"viem";var O={name:"send",description:"Send ETH or a pinned token from the local wallet. Requires human confirmation, verified identity and subscription. Full recipient and fee shown before signing. ETH all is refused.",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount","to"],properties:{token:{type:"string",description:"ETH, USDG, WETH, USDe, configured OAK, or their pinned token address."},amount:{type:"string",description:"Positive decimal base-unit integer; all is allowed only for ERC-20 tokens."},to:{type:"string",description:"Full EIP-55 checksummed recipient address."},confirmContract:{type:"boolean",description:"Set true only when the user explicitly intends a contract recipient; the human must still approve the full transfer."}}}};function E(e,t=4663,s){let r=t===4663?l.mainnet:t===46630?l.testnet:void 0;if(!r)throw new Error("Send requires an Oak network.");let o=[{address:c(m),symbol:"ETH",decimals:18,chainId:t},{address:c(r.usdg),symbol:"USDG",decimals:6,chainId:t},{address:c(r.weth),symbol:"WETH",decimals:18,chainId:t},...t===4663?[{address:c(u[4663].meridian.CollateralToken_USDe.address),symbol:"USDe",decimals:18,chainId:t}]:[]];if(s&&o.some(d=>d.address.toLowerCase()===s.toLowerCase()))throw new Error("The configured OAK token address is the address of another pinned token. Fix OAK_TOKEN_ADDRESS in your own terminal; nothing was sent.");let n=[...o,...s?[{address:c(s),symbol:"OAK",decimals:18,chainId:t}]:[]],i=typeof e=="string"&&n.find(d=>d.address.toLowerCase()===e.toLowerCase()||d.symbol.toUpperCase()===e.replace(/^\$/,"").toUpperCase());if(!i)throw new Error("Send supports only ETH and pinned USDG, WETH, USDe or configured OAK tokens. Unknown tokens are refused.");return i}function b(e,t,s=4663,r){if(Object.keys(e).some(i=>!["token","amount","to","confirmContract"].includes(i))||e.confirmContract!==void 0&&typeof e.confirmContract!="boolean")throw new Error("Provide only token, amount, to and optional confirmContract.");if(typeof e.to!="string"||!g(e.to,{strict:!1})||c(e.to)!==e.to)throw new Error("Provide the full EIP-55 checksummed recipient address.");let o=c(e.to);if(o===C)throw new Error("Cannot send to the zero address.");if(o.toLowerCase()===t.toLowerCase())throw new Error("Cannot send to this wallet itself.");let n=E(e.token,s,r);if(e.amount==="all"&&n.symbol==="ETH")throw new Error("ETH all is refused. Specify base units and leave ETH for network fees.");if(typeof e.amount!="string"||e.amount.length>78||!/^[0-9]+$/.test(e.amount)||BigInt(e.amount)<=0n||BigInt(e.amount)>=2n**256n)throw new Error("Provide a positive decimal base-unit amount string.");return{token:n,amount:BigInt(e.amount).toString(),to:o,contractRecipient:e.confirmContract===!0}}function k(e){return`Send ${y(BigInt(e.amount),e.token.decimals)} ${e.token.symbol} to ${e.to}. Token: ${e.token.address} (${e.token.symbol}, decimals ${e.token.decimals}); amount: ${e.amount} base units; chain ${e.token.chainId}.${e.contractRecipient?" Contract recipient intended: approve this transfer to the full address shown.":""}`}function S(e){let t=e.token.symbol==="ETH";return h({to:t?e.to:e.token.address,data:t?"0x":T({abi:f,functionName:"transfer",args:[e.to,BigInt(e.amount)]}),value:t?e.amount:"0",chainId:e.token.chainId,description:k(e)})}function x(e,t,s){let r=[],o=n=>{typeof n=="string"&&g(n,{strict:!1})?r.push(n.toLowerCase()):n&&typeof n=="object"&&Object.values(n).forEach(o)};return o(t===4663?u[4663]:u[46630]),o(t===4663?l.mainnet:l.testnet),s&&r.push(s.toLowerCase()),r.push(m.toLowerCase()),r.includes(e.toLowerCase())||BigInt(e)<=0x100n}async function R(e,t,s,r=4663,o){let n=structuredClone(e),i=E(n.token,r,o);if(n.amount==="all"&&i.symbol==="ETH")throw new Error("ETH all is refused. Specify base units and leave ETH for network fees.");if(b({...n,amount:n.amount==="all"?"1":n.amount},t,r,o),await s.getChainId()!==r)throw new Error("RPC chain does not match the send network.");if(o&&i.address.toLowerCase()===o.toLowerCase()){let w=await s.readContract({address:i.address,abi:f,functionName:"decimals",blockTag:"pending"});if(w!==i.decimals)throw new Error(`The configured OAK token reports ${String(w)} decimals, not ${i.decimals}. Refusing to show an amount at the wrong scale; nothing was sent.`)}let d=i.symbol==="ETH"?await s.getBalance({address:t,blockTag:"pending"}):await s.readContract({address:i.address,abi:f,functionName:"balanceOf",args:[t],blockTag:"pending"});n.amount==="all"&&(n.amount=d.toString());let a=b(n,t,r,o);if(BigInt(a.amount)>d)throw new Error(`Send amount exceeds the ${i.symbol} balance.`);let p=await s.getCode({address:a.to,blockTag:"pending"})??"0x";if(!/^0x(?:[0-9a-fA-F]{2})*$/.test(p))throw new Error("Recipient code is unavailable; retry with a code-capable RPC.");if((p!=="0x"||x(a.to,r,o))&&!a.contractRecipient)throw new Error(`Recipient ${a.to} is a contract or known protocol address. Ask the user to confirm this is intended, then set confirmContract true.`);return{terms:a,args:{...n,token:i.address,amount:a.amount},txs:[S(a)]}}export{O as SEND_TOOL,R as prepareSend,k as sendDescription,b as sendTerms,E as sendToken,S as sendTransaction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,g as P,i as D,j as m}from"../chunks/67TJOOBI.js";import"../chunks/D4WURN33.js";import"../chunks/OW7GOYKA.js";import"../chunks/H6ED3RHF.js";import"../chunks/FBQWTWPT.js";import"../chunks/QXFJZGVB.js";import{b as O}from"../chunks/IRWEY7TQ.js";import"../chunks/6L6DSMCU.js";import"../chunks/NHCRJC5X.js";import"../chunks/HNMOB76J.js";import{f as A,g as _,o as R}from"../chunks/TCS3ICNE.js";import{a as T,b as E}from"../chunks/VY3P34PY.js";import{e as I}from"../chunks/LBEMCOND.js";import{e as f}from"../chunks/C3TJLARP.js";import{a as h}from"../chunks/O47JXRXN.js";import{e as w}from"../chunks/ULJ6E4HP.js";import"../chunks/LFN3OODW.js";import"../chunks/D3OWLDVB.js";import"../chunks/CCEWSOBT.js";import"../chunks/RFJCG4NA.js";import"../chunks/T3MGNKA6.js";import"../chunks/UIIJWIR6.js";import"../chunks/D6VP3N27.js";import"../chunks/6LLOTPH2.js";import"../chunks/QZM7CWZW.js";import"../chunks/CAU44UWP.js";import"../chunks/EA6IYKIB.js";import"../chunks/HQVC6X3T.js";import"../chunks/NMFVXBTL.js";import"../chunks/VJ3W2V3B.js";import"../chunks/LIUXNOLP.js";import"../chunks/HFQS5344.js";import"../chunks/G7UKNO2I.js";import"../chunks/BYXBS45D.js";import"../chunks/GZ5TW3WB.js";import"../chunks/5EHQM6DM.js";import"../chunks/OG5HRQU4.js";import"../chunks/P4UQGWCP.js";import"../chunks/AXYOJBX6.js";import"../chunks/Z25UKUJF.js";import"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/MYBDO5SA.js";import"../chunks/HIMVOTIU.js";import"../chunks/UWOFA6GV.js";import"../chunks/73N3TOJL.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/IWALIX7Q.js";import{a as s,i as y,s as c}from"../chunks/XPFVT2EA.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";import{zeroAddress as G}from"viem";var e=(r,n)=>({...n,meaning:r}),v=y[s].meridian,Y=v.CollateralToken_USDe.address,N={by:"server-continuation",reason:"Meridian Predict settles RFQ approvals over a WebSocket auction session that the Oak server holds."},q={none:"Single-use auction approval: it cannot be cancelled and lapses at its deadline.",staysExecutableUntilExpiry:!0},Q={id:"meridian.rfq.mint-approval",program:"Meridian",purpose:"prediction buy approval",tools:["meridian_buy"],class:"order",encoding:"eip712",domain:{name:"PredictionMarketEscrow",version:"1",chainId:s,verifyingContract:v.PredictionMarketEscrow.address},primaryType:"MintApproval",types:{MintApproval:T},fields:{predictionHash:e("Hash of your picks, stake, the counterparty and its collateral, rebuilt locally from your request and the winning bid",{role:"derived",rebuild:"meridian.rfq.prediction-hash",yields:["counterparty"]}),signer:e("This wallet, the approving trader",{role:"signer"}),collateral:e("Your stake: the most USDe the escrow can take",{role:"amount",side:"out",token:Y,arg:"stake"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},V={id:"meridian.rfq.trade-approval",program:"Meridian",purpose:"prediction sale approval",tools:["meridian_sell"],class:"order",encoding:"eip712",domain:{name:"SecondaryMarketEscrow",version:"1",chainId:s,verifyingContract:v.SecondaryMarketEscrow.address},primaryType:"TradeApproval",types:{TradeApproval:E},fields:{tradeHash:e("Hash of the position token and amount you sell, the buyer and the USDe price, rebuilt locally",{role:"derived",rebuild:"meridian.rfq.trade-hash",yields:["token-out","amount-out","token-in","amount-in","counterparty"]}),signer:e("This wallet, the seller",{role:"signer"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},S=R({agentId:"1",owner:G,nonce:"0",deadline:"0"}),z={id:"priors.consent",program:"Priors",purpose:"pool consent",tools:["priors_starter_line",...O],class:"consent",encoding:"eip712",domain:{...S.domain},primaryType:S.primaryType,types:S.types,fields:{agentId:e("Your agent ID the consent is for",{role:"observed",check:"equals the agentId argument"}),sponsorId:e("Sponsor root that may use this consent",{role:"observed",check:"treasury v4 root, or the feature root or sponsorId argument"}),owner:e("This wallet, the agent owner",{role:"account"}),maxPremiumBps:e("Largest premium the sponsor may charge, in basis points",{role:"observed",check:"equals the maxPremiumBps argument (starter line: 0)"}),nonce:e("Priors pool nonce for this agent",{role:"nonce",kind:"program-counter"}),deadline:e("Consent deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:_+300,submit:{by:"transaction"},requireHuman:!0},j={id:"priors.seat-proof",program:"Priors",purpose:"agent ownership proof",tools:["priors_starter_line"],class:"auth",encoding:"eip191-template",primaryType:"priors.seat-request",types:{},fields:{agentId:e("Your agent ID",{role:"observed",check:"equals the agentId argument"}),n:e("Invite bot nonce",{role:"nonce",kind:"server-observed"}),exp:e("Proof expiry (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:A+300,submit:{by:"server-continuation",reason:"The Priors invite bot receives the ownership proof through the Oak server session."},requireHuman:!1},$={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},J={agentId:e("Agent whose payment wallet becomes this wallet",{role:"observed",check:"equals the agentId argument and the continuation"}),newWallet:e("This wallet, the new payment wallet",{role:"signer"}),owner:e("Current agent owner named by the registry",{role:"observed",check:"the registry checks it on chain"}),deadline:e("Proof deadline (Unix seconds)",{role:"expiry"})},F=r=>({id:r==="mainnet"?"erc8004.agent-wallet-set":"erc8004.agent-wallet-set.testnet",program:"ERC-8004",purpose:"payment-wallet proof",tools:["erc8004_set_wallet"],class:"auth",encoding:"eip712",...r==="testnet"?{network:r}:{},domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:c[r].chainId,verifyingContract:c[r].identityRegistry},primaryType:"AgentWalletSet",types:$,fields:J,maxLifetimeSeconds:420,submit:{by:"server-continuation",reason:"The proof is an argument of the setAgentWallet transaction the Oak server builds next."},requireHuman:!1}),X=F("mainnet"),Z=F("testnet"),ee={id:"hookr.relay.swap-intent",program:"Hookr",purpose:"relayed trader swap intent",tools:["hookr_relay"],class:"relayed",encoding:"eip712",domain:{name:"Permit2",chainId:s,verifyingContract:y[s].ponsTrade.permit2.address},primaryType:"HookrSwapIntent",types:{},fields:{owner:e("The trader who signed; never this wallet",{role:"counterparty"}),intent:e("The trader-signed swap terms; every calldata byte is rebuilt from them",{role:"derived",rebuild:"hookr.relay.calldata"}),signature:e("The trader Permit2 witness signature; the forwarder verifies it in a simulation from this relayer",{role:"observed",check:"forwarder execute simulation at a pinned block"})},maxLifetimeSeconds:2592e3,contractHash:{fn:"hashIntent"},nonceRead:"isNonceUsed",submit:{by:"transaction"},relayedPaths:["signature"],requireHuman:!1},re=w,ne="Meridian perps activation requires protocol-verified signing and submission vectors. TradeOrder has unsigned expiry and execution flags; delegate authority is unbounded. These candidates remain disabled.",te={by:"server-continuation",reason:"Today the Oak server holds the perps_sign round and posts to the Meridian API; local submission is adopted with the pending patch."},M={subaccount:"primary",subaccountId:"00000000-0000-4000-8000-000000000000"},ie="0x0000000000000000000000000000000000000001";function o(r,n,t,i,H,U,W={}){let g=I(i,{...M,...H},ie,"1",1);return{id:r,program:"Meridian",purpose:n,tools:[`meridian_perps_${i}`],class:t,encoding:"eip712",domain:{...f},primaryType:g.primaryType,types:{[g.primaryType]:Object.entries(g.fields).map(([B,K])=>({name:B,type:K}))},fields:U,maxLifetimeSeconds:3600,submit:te,requireHuman:t!=="auth"&&t!=="cancel",enabled:!1,disabledReason:ne,...W}}var a=e("This wallet, the account owner",{role:"signer"}),l=e("Subaccount name (bytes32) from your request",{role:"derived",rebuild:"meridian.perps.subaccount"}),d=e("Nanosecond nonce from the add-on clock; Meridian accepts it within 25 minutes",{role:"nonce",kind:"local-time"}),p=e("Signing time; Meridian accepts the signature for at most one hour after it",{role:"derived",rebuild:"meridian.perps.signed-at",yields:["expiry"]}),L={revoke:{none:"One-shot request: it cannot be cancelled and lapses within one hour.",staysExecutableUntilExpiry:!0}},oe=[o("meridian.perps.trade-order","perps order","order","order",{type:"LIMIT",quantity:"1",price:"1",side:0,onchainId:1,timeInForce:"GTD"},{sender:a,subaccount:l,quantity:e("Order size in D9 contract units: the most this order can trade",{role:"amount",side:"out",token:"productId",arg:"quantity"}),price:e("Limit price (D9) from your request; 0 for market orders",{role:"derived",rebuild:"meridian.perps.intent"}),reduceOnly:e("Only reduces an open position",{role:"derived",rebuild:"meridian.perps.intent"}),side:e("0 buy, 1 sell",{role:"derived",rebuild:"meridian.perps.intent"}),engineType:e("Order engine",{role:"pinned",value:0}),productId:e("Meridian product traded",{role:"token",side:"out",arg:"onchainId"}),nonce:d,signedAt:e("Signing time (the resting-order expiry is the API option expiresAt)",{role:"observed",check:"within the Meridian acceptance window"})},{maxLifetimeSeconds:2592e3,expiry:{enforcedBy:"api",path:"data.expiresAt"},revoke:{offchainSpec:"meridian.perps.cancel-order",staysExecutableUntilExpiry:!0}}),o("meridian.perps.cancel-order","perps order cancel","cancel","cancel",{all:!0},{sender:a,subaccount:l,nonce:d},{expiryBinding:"cancel-only"}),o("meridian.perps.initiate-withdraw","perps withdrawal","order","withdraw",{token:"0x0000000000000000000000000000000000000002",tokenId:M.subaccountId,amount:"1"},{account:a,subaccount:l,token:e("Token withdrawn",{role:"token",side:"out",arg:"token"}),amount:e("Amount withdrawn (D9)",{role:"amount",side:"out",token:"token",arg:"amount"}),nonce:d,signedAt:p,destinationAddress:e("This wallet, padded to 32 bytes",{role:"recipient"}),destinationEndpointId:e("Same-chain withdrawal",{role:"pinned",value:0})},L),o("meridian.perps.convert-token","perps conversion","order","convert",{fromToken:"0x0000000000000000000000000000000000000002",toToken:"0x0000000000000000000000000000000000000003",amount:"1"},{sender:a,subaccount:l,fromToken:e("Quote token converted from",{role:"token",side:"out",arg:"fromToken"}),toToken:e("Quote token converted to",{role:"token",side:"in",arg:"toToken"}),amount:e("Amount converted (D9)",{role:"amount",side:"out",token:"fromToken",arg:"amount"}),nonce:d,signedAt:p},L),o("meridian.perps.revoke-linked-signer","linked-signer revocation","cancel","signer",{mode:"revoke",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer revoked",{role:"delegate"}),subaccount:l,nonce:d,signedAt:p}),o("meridian.perps.refresh-linked-signer","linked-signer refresh","link","signer",{mode:"refresh",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer refreshed",{role:"delegate"}),nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.extend-linked-signer","linked-signer extension","link","signer",{mode:"extend"},{sender:a,nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.referral-auth","referral API authentication","auth","referral",{mode:"activate"},{sender:a,intent:e("Referral action: 0 activate, 1 claim, 2 read",{role:"derived",rebuild:"meridian.perps.intent"}),signedAt:e("Signed time; the local round accepts now minus 120 through now plus 10 seconds",{role:"derived",rebuild:"meridian.perps.auth-time",yields:["expiry"]})},{expiryBinding:"auth-window",authWindow:{field:"signedAt",maxAgeSeconds:120,maxFutureSeconds:10}})],ae={id:"longbow.nft.lender-offer",program:"Longbow",purpose:"existing NFT lender offer",tools:["longbow_nft_accept_offer"],class:"relayed",encoding:"eip191-packed-hash",primaryType:"longbow.nft.fixed-offer",types:{},fields:{chainId:e("Robinhood Chain, included in the packed offer hash",{role:"pinned",value:s}),contract:e("DirectLoanFixedOffer, included in the packed offer hash",{role:"pinned",value:h}),offer:e("Exact loan, payoff, NFT, currency and fee terms rebuilt by nftOfferDigest",{role:"derived",rebuild:"longbow.nft.offer-digest"}),"lenderSignature.signer":e("Existing lender who signed the offer",{role:"counterparty"}),"lenderSignature.expiry":e("Existing lender offer expiry",{role:"expiry"}),"lenderSignature.nonce":e("Lender nonce checked against the pinned loan contract",{role:"nonce",kind:"program-counter"}),"lenderSignature.signature":e("Existing lender signature, verified by recovery or pinned-block ERC-1271 before preview",{role:"observed",check:"nftOfferDigest and lender verification in the local loan builder"})},maxLifetimeSeconds:2592e3,submit:{by:"transaction"},relayedPaths:["lenderSignature.signature"],requireHuman:!1},k=[Q,V,z,j,X,Z,ee,ae,...oe],se=[f.verifyingContract,re,h],de=D(k,P(se));if(de.length)throw u("invalid signature registry");var b=new Map;for(let r of k)for(let n of r.tools)b.set(n,[...b.get(n)??[],r]);var C=new Map(k.map(r=>[m(r),r]));function x(r){return b.get(r)??[]}function Se(r,n=x(r)){return n.some(t=>t.tools.includes(r)&&t.submit.by==="addon")}function be(r){return x(r).flatMap(n=>n.class==="relayed"&&n.enabled!==!1?n.relayedPaths??[]:[])}function ve(r,n){let t=n?.domain?.chainId===c.testnet.chainId?"testnet":"mainnet",i=C.get(m({network:t==="testnet"?"testnet":void 0,encoding:"eip712",domain:n?.domain,primaryType:n?.primaryType}));if(!i||i.enabled===!1||!i.tools.includes(r)||i.class==="relayed")throw u("Oak has no signing contract for this request");return i}function ke(r){if(!r?.domain||typeof r.primaryType!="string")return;let n=r.domain.chainId===c.testnet.chainId?"testnet":void 0,t=C.get(m({network:n,encoding:"eip712",domain:r.domain,primaryType:r.primaryType}));return t?.class==="relayed"?void 0:t}function xe(r){let n=x(r).find(t=>t.encoding==="eip191-template"&&t.enabled!==!1);if(!n)throw u("Oak has no signing contract for this request");return n}export{X as ERC8004_WALLET_SET,Z as ERC8004_WALLET_SET_TESTNET,ee as HOOKR_RELAYED_INTENT,ae as LONGBOW_RELAYED_OFFER,Q as MERIDIAN_MINT_APPROVAL,oe as MERIDIAN_PERPS_SPECS,V as MERIDIAN_TRADE_APPROVAL,se as MODULE_PINS,z as PRIORS_CONSENT,j as PRIORS_SEAT_PROOF,k as SIGNATURE_SPECS,be as relayedSignaturePaths,xe as specForMessage,ke as specForStruct,ve as specForTypedData,x as specsForTool,Se as submitsFromAddon};
|
|
1
|
+
import{d as u,g as P,i as D,j as m}from"../chunks/TLJPVYRJ.js";import"../chunks/SXX3VTBP.js";import"../chunks/4KQZTPMS.js";import"../chunks/2W46IRX6.js";import"../chunks/LMVB3B6T.js";import"../chunks/JWCOXLYA.js";import"../chunks/TWCSCRFS.js";import{b as O}from"../chunks/V5LTA42G.js";import"../chunks/NMYGNJIJ.js";import"../chunks/GGUEKSR4.js";import{f as A,g as _,o as R}from"../chunks/3WBDHUV2.js";import{a as h}from"../chunks/NAYRD43N.js";import{a as T,b as E}from"../chunks/SKQGLGES.js";import{e as I}from"../chunks/LBEMCOND.js";import{e as f}from"../chunks/C3TJLARP.js";import{e as w}from"../chunks/TMGWXDCZ.js";import"../chunks/FUXT7GRK.js";import"../chunks/OVK4EEOD.js";import"../chunks/R7QPJQP6.js";import"../chunks/E7R3J4H7.js";import"../chunks/JPOYTTTW.js";import"../chunks/LQGPMOD2.js";import"../chunks/NSOEDRBU.js";import"../chunks/3EFV4FQF.js";import"../chunks/XVFLT275.js";import"../chunks/5O5ZE3ZV.js";import"../chunks/EA6IYKIB.js";import"../chunks/KSZMMNXK.js";import"../chunks/TNSKEHPC.js";import"../chunks/CY75R4FK.js";import"../chunks/LIUXNOLP.js";import"../chunks/CQCVFRQ5.js";import"../chunks/KHJFXJBU.js";import"../chunks/WVXW6VL3.js";import"../chunks/GIV5JMTE.js";import"../chunks/WQ6H62DM.js";import"../chunks/QRDDKA4I.js";import"../chunks/P4UQGWCP.js";import"../chunks/AXYOJBX6.js";import"../chunks/Z25UKUJF.js";import"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/MYBDO5SA.js";import"../chunks/HIMVOTIU.js";import"../chunks/UWOFA6GV.js";import"../chunks/73N3TOJL.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/CXLEQCP3.js";import{a as s,i as y,s as c}from"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";import{zeroAddress as G}from"viem";var e=(r,n)=>({...n,meaning:r}),v=y[s].meridian,Y=v.CollateralToken_USDe.address,N={by:"server-continuation",reason:"Meridian Predict settles RFQ approvals over a WebSocket auction session that the Oak server holds."},q={none:"Single-use auction approval: it cannot be cancelled and lapses at its deadline.",staysExecutableUntilExpiry:!0},Q={id:"meridian.rfq.mint-approval",program:"Meridian",purpose:"prediction buy approval",tools:["meridian_buy"],class:"order",encoding:"eip712",domain:{name:"PredictionMarketEscrow",version:"1",chainId:s,verifyingContract:v.PredictionMarketEscrow.address},primaryType:"MintApproval",types:{MintApproval:T},fields:{predictionHash:e("Hash of your picks, stake, the counterparty and its collateral, rebuilt locally from your request and the winning bid",{role:"derived",rebuild:"meridian.rfq.prediction-hash",yields:["counterparty"]}),signer:e("This wallet, the approving trader",{role:"signer"}),collateral:e("Your stake: the most USDe the escrow can take",{role:"amount",side:"out",token:Y,arg:"stake"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},V={id:"meridian.rfq.trade-approval",program:"Meridian",purpose:"prediction sale approval",tools:["meridian_sell"],class:"order",encoding:"eip712",domain:{name:"SecondaryMarketEscrow",version:"1",chainId:s,verifyingContract:v.SecondaryMarketEscrow.address},primaryType:"TradeApproval",types:{TradeApproval:E},fields:{tradeHash:e("Hash of the position token and amount you sell, the buyer and the USDe price, rebuilt locally",{role:"derived",rebuild:"meridian.rfq.trade-hash",yields:["token-out","amount-out","token-in","amount-in","counterparty"]}),signer:e("This wallet, the seller",{role:"signer"}),nonce:e("Escrow nonce chosen by the auction",{role:"nonce",kind:"server-observed"}),deadline:e("Approval deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:3600,revoke:q,submit:N,requireHuman:!0},S=R({agentId:"1",owner:G,nonce:"0",deadline:"0"}),z={id:"priors.consent",program:"Priors",purpose:"pool consent",tools:["priors_starter_line",...O],class:"consent",encoding:"eip712",domain:{...S.domain},primaryType:S.primaryType,types:S.types,fields:{agentId:e("Your agent ID the consent is for",{role:"observed",check:"equals the agentId argument"}),sponsorId:e("Sponsor root that may use this consent",{role:"observed",check:"treasury v4 root, or the feature root or sponsorId argument"}),owner:e("This wallet, the agent owner",{role:"account"}),maxPremiumBps:e("Largest premium the sponsor may charge, in basis points",{role:"observed",check:"equals the maxPremiumBps argument (starter line: 0)"}),nonce:e("Priors pool nonce for this agent",{role:"nonce",kind:"program-counter"}),deadline:e("Consent deadline (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:_+300,submit:{by:"transaction"},requireHuman:!0},j={id:"priors.seat-proof",program:"Priors",purpose:"agent ownership proof",tools:["priors_starter_line"],class:"auth",encoding:"eip191-template",primaryType:"priors.seat-request",types:{},fields:{agentId:e("Your agent ID",{role:"observed",check:"equals the agentId argument"}),n:e("Invite bot nonce",{role:"nonce",kind:"server-observed"}),exp:e("Proof expiry (Unix seconds)",{role:"expiry"})},maxLifetimeSeconds:A+300,submit:{by:"server-continuation",reason:"The Priors invite bot receives the ownership proof through the Oak server session."},requireHuman:!1},$={AgentWalletSet:[{name:"agentId",type:"uint256"},{name:"newWallet",type:"address"},{name:"owner",type:"address"},{name:"deadline",type:"uint256"}]},J={agentId:e("Agent whose payment wallet becomes this wallet",{role:"observed",check:"equals the agentId argument and the continuation"}),newWallet:e("This wallet, the new payment wallet",{role:"signer"}),owner:e("Current agent owner named by the registry",{role:"observed",check:"the registry checks it on chain"}),deadline:e("Proof deadline (Unix seconds)",{role:"expiry"})},F=r=>({id:r==="mainnet"?"erc8004.agent-wallet-set":"erc8004.agent-wallet-set.testnet",program:"ERC-8004",purpose:"payment-wallet proof",tools:["erc8004_set_wallet"],class:"auth",encoding:"eip712",...r==="testnet"?{network:r}:{},domain:{name:"ERC8004IdentityRegistry",version:"1",chainId:c[r].chainId,verifyingContract:c[r].identityRegistry},primaryType:"AgentWalletSet",types:$,fields:J,maxLifetimeSeconds:420,submit:{by:"server-continuation",reason:"The proof is an argument of the setAgentWallet transaction the Oak server builds next."},requireHuman:!1}),X=F("mainnet"),Z=F("testnet"),ee={id:"hookr.relay.swap-intent",program:"Hookr",purpose:"relayed trader swap intent",tools:["hookr_relay"],class:"relayed",encoding:"eip712",domain:{name:"Permit2",chainId:s,verifyingContract:y[s].ponsTrade.permit2.address},primaryType:"HookrSwapIntent",types:{},fields:{owner:e("The trader who signed; never this wallet",{role:"counterparty"}),intent:e("The trader-signed swap terms; every calldata byte is rebuilt from them",{role:"derived",rebuild:"hookr.relay.calldata"}),signature:e("The trader Permit2 witness signature; the forwarder verifies it in a simulation from this relayer",{role:"observed",check:"forwarder execute simulation at a pinned block"})},maxLifetimeSeconds:2592e3,contractHash:{fn:"hashIntent"},nonceRead:"isNonceUsed",submit:{by:"transaction"},relayedPaths:["signature"],requireHuman:!1},re=w,ne="Meridian perps activation requires protocol-verified signing and submission vectors. TradeOrder has unsigned expiry and execution flags; delegate authority is unbounded. These candidates remain disabled.",te={by:"server-continuation",reason:"Today the Oak server holds the perps_sign round and posts to the Meridian API; local submission is adopted with the pending patch."},M={subaccount:"primary",subaccountId:"00000000-0000-4000-8000-000000000000"},ie="0x0000000000000000000000000000000000000001";function o(r,n,t,i,H,U,W={}){let g=I(i,{...M,...H},ie,"1",1);return{id:r,program:"Meridian",purpose:n,tools:[`meridian_perps_${i}`],class:t,encoding:"eip712",domain:{...f},primaryType:g.primaryType,types:{[g.primaryType]:Object.entries(g.fields).map(([B,K])=>({name:B,type:K}))},fields:U,maxLifetimeSeconds:3600,submit:te,requireHuman:t!=="auth"&&t!=="cancel",enabled:!1,disabledReason:ne,...W}}var a=e("This wallet, the account owner",{role:"signer"}),l=e("Subaccount name (bytes32) from your request",{role:"derived",rebuild:"meridian.perps.subaccount"}),d=e("Nanosecond nonce from the add-on clock; Meridian accepts it within 25 minutes",{role:"nonce",kind:"local-time"}),p=e("Signing time; Meridian accepts the signature for at most one hour after it",{role:"derived",rebuild:"meridian.perps.signed-at",yields:["expiry"]}),L={revoke:{none:"One-shot request: it cannot be cancelled and lapses within one hour.",staysExecutableUntilExpiry:!0}},oe=[o("meridian.perps.trade-order","perps order","order","order",{type:"LIMIT",quantity:"1",price:"1",side:0,onchainId:1,timeInForce:"GTD"},{sender:a,subaccount:l,quantity:e("Order size in D9 contract units: the most this order can trade",{role:"amount",side:"out",token:"productId",arg:"quantity"}),price:e("Limit price (D9) from your request; 0 for market orders",{role:"derived",rebuild:"meridian.perps.intent"}),reduceOnly:e("Only reduces an open position",{role:"derived",rebuild:"meridian.perps.intent"}),side:e("0 buy, 1 sell",{role:"derived",rebuild:"meridian.perps.intent"}),engineType:e("Order engine",{role:"pinned",value:0}),productId:e("Meridian product traded",{role:"token",side:"out",arg:"onchainId"}),nonce:d,signedAt:e("Signing time (the resting-order expiry is the API option expiresAt)",{role:"observed",check:"within the Meridian acceptance window"})},{maxLifetimeSeconds:2592e3,expiry:{enforcedBy:"api",path:"data.expiresAt"},revoke:{offchainSpec:"meridian.perps.cancel-order",staysExecutableUntilExpiry:!0}}),o("meridian.perps.cancel-order","perps order cancel","cancel","cancel",{all:!0},{sender:a,subaccount:l,nonce:d},{expiryBinding:"cancel-only"}),o("meridian.perps.initiate-withdraw","perps withdrawal","order","withdraw",{token:"0x0000000000000000000000000000000000000002",tokenId:M.subaccountId,amount:"1"},{account:a,subaccount:l,token:e("Token withdrawn",{role:"token",side:"out",arg:"token"}),amount:e("Amount withdrawn (D9)",{role:"amount",side:"out",token:"token",arg:"amount"}),nonce:d,signedAt:p,destinationAddress:e("This wallet, padded to 32 bytes",{role:"recipient"}),destinationEndpointId:e("Same-chain withdrawal",{role:"pinned",value:0})},L),o("meridian.perps.convert-token","perps conversion","order","convert",{fromToken:"0x0000000000000000000000000000000000000002",toToken:"0x0000000000000000000000000000000000000003",amount:"1"},{sender:a,subaccount:l,fromToken:e("Quote token converted from",{role:"token",side:"out",arg:"fromToken"}),toToken:e("Quote token converted to",{role:"token",side:"in",arg:"toToken"}),amount:e("Amount converted (D9)",{role:"amount",side:"out",token:"fromToken",arg:"amount"}),nonce:d,signedAt:p},L),o("meridian.perps.revoke-linked-signer","linked-signer revocation","cancel","signer",{mode:"revoke",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer revoked",{role:"delegate"}),subaccount:l,nonce:d,signedAt:p}),o("meridian.perps.refresh-linked-signer","linked-signer refresh","link","signer",{mode:"refresh",signer:"0x0000000000000000000000000000000000000003"},{sender:a,signer:e("Linked signer refreshed",{role:"delegate"}),nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.extend-linked-signer","linked-signer extension","link","signer",{mode:"extend"},{sender:a,nonce:d,signedAt:p},{revoke:{offchainSpec:"meridian.perps.revoke-linked-signer",staysExecutableUntilExpiry:!1}}),o("meridian.perps.referral-auth","referral API authentication","auth","referral",{mode:"activate"},{sender:a,intent:e("Referral action: 0 activate, 1 claim, 2 read",{role:"derived",rebuild:"meridian.perps.intent"}),signedAt:e("Signed time; the local round accepts now minus 120 through now plus 10 seconds",{role:"derived",rebuild:"meridian.perps.auth-time",yields:["expiry"]})},{expiryBinding:"auth-window",authWindow:{field:"signedAt",maxAgeSeconds:120,maxFutureSeconds:10}})],ae={id:"longbow.nft.lender-offer",program:"Longbow",purpose:"existing NFT lender offer",tools:["longbow_nft_accept_offer"],class:"relayed",encoding:"eip191-packed-hash",primaryType:"longbow.nft.fixed-offer",types:{},fields:{chainId:e("Robinhood Chain, included in the packed offer hash",{role:"pinned",value:s}),contract:e("DirectLoanFixedOffer, included in the packed offer hash",{role:"pinned",value:h}),offer:e("Exact loan, payoff, NFT, currency and fee terms rebuilt by nftOfferDigest",{role:"derived",rebuild:"longbow.nft.offer-digest"}),"lenderSignature.signer":e("Existing lender who signed the offer",{role:"counterparty"}),"lenderSignature.expiry":e("Existing lender offer expiry",{role:"expiry"}),"lenderSignature.nonce":e("Lender nonce checked against the pinned loan contract",{role:"nonce",kind:"program-counter"}),"lenderSignature.signature":e("Existing lender signature, verified by recovery or pinned-block ERC-1271 before preview",{role:"observed",check:"nftOfferDigest and lender verification in the local loan builder"})},maxLifetimeSeconds:2592e3,submit:{by:"transaction"},relayedPaths:["lenderSignature.signature"],requireHuman:!1},k=[Q,V,z,j,X,Z,ee,ae,...oe],se=[f.verifyingContract,re,h],de=D(k,P(se));if(de.length)throw u("invalid signature registry");var b=new Map;for(let r of k)for(let n of r.tools)b.set(n,[...b.get(n)??[],r]);var C=new Map(k.map(r=>[m(r),r]));function x(r){return b.get(r)??[]}function Se(r,n=x(r)){return n.some(t=>t.tools.includes(r)&&t.submit.by==="addon")}function be(r){return x(r).flatMap(n=>n.class==="relayed"&&n.enabled!==!1?n.relayedPaths??[]:[])}function ve(r,n){let t=n?.domain?.chainId===c.testnet.chainId?"testnet":"mainnet",i=C.get(m({network:t==="testnet"?"testnet":void 0,encoding:"eip712",domain:n?.domain,primaryType:n?.primaryType}));if(!i||i.enabled===!1||!i.tools.includes(r)||i.class==="relayed")throw u("Oak has no signing contract for this request");return i}function ke(r){if(!r?.domain||typeof r.primaryType!="string")return;let n=r.domain.chainId===c.testnet.chainId?"testnet":void 0,t=C.get(m({network:n,encoding:"eip712",domain:r.domain,primaryType:r.primaryType}));return t?.class==="relayed"?void 0:t}function xe(r){let n=x(r).find(t=>t.encoding==="eip191-template"&&t.enabled!==!1);if(!n)throw u("Oak has no signing contract for this request");return n}export{X as ERC8004_WALLET_SET,Z as ERC8004_WALLET_SET_TESTNET,ee as HOOKR_RELAYED_INTENT,ae as LONGBOW_RELAYED_OFFER,Q as MERIDIAN_MINT_APPROVAL,oe as MERIDIAN_PERPS_SPECS,V as MERIDIAN_TRADE_APPROVAL,se as MODULE_PINS,z as PRIORS_CONSENT,j as PRIORS_SEAT_PROOF,k as SIGNATURE_SPECS,be as relayedSignaturePaths,xe as specForMessage,ke as specForStruct,ve as specForTypedData,x as specsForTool,Se as submitsFromAddon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"../chunks/TLJPVYRJ.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{a as MAX_SIGNATURE_LIFETIME,b as MAX_SIGNED_AMOUNT,c as VALUE_CLASSES,p as assertAmount,n as assertExpiry,k as assertRequestMatchesSpec,o as assertSignatureTime,q as fieldRows,l as fieldValue,e as isValueClass,g as pinnedAddresses,i as registryViolations,m as roleTerms,d as signingRefusal,j as specKey,h as specViolations,f as typePaths};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../chunks/
|
|
1
|
+
import{a,b,c}from"../chunks/CY75R4FK.js";import"../chunks/LIUXNOLP.js";import"../chunks/QRDDKA4I.js";import"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/CXLEQCP3.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{a as NATIVE_TOKEN_ADDRESS,c as createPreview,b as normalizeNativeTokenAddress};
|
package/build/dist/api/swap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as B,B as C,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"../chunks/
|
|
1
|
+
import{A as B,B as C,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"../chunks/5O5ZE3ZV.js";import"../chunks/EA6IYKIB.js";import{a}from"../chunks/KSZMMNXK.js";import"../chunks/TNSKEHPC.js";import"../chunks/CY75R4FK.js";import"../chunks/LIUXNOLP.js";import"../chunks/QRDDKA4I.js";import"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/MYBDO5SA.js";import"../chunks/HIMVOTIU.js";import"../chunks/73N3TOJL.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/CXLEQCP3.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{c as DEFAULT_SLIPPAGE_BPS,i as ExpiredQuoteError,j as MAX_RECENT_QUOTES,q as MAX_VELORA_FEE_BPS,e as NATIVE_ETH_ADDRESS,h as NoRouteError,d as PRICE_IMPACT_WARNING_BPS,b as QUOTE_TTL_SECONDS,f as ZERO_ADDRESS,y as assertCalldataMinAmountOut,m as assertQuoteBinding,z as assertSwapTransaction,t as assertVeloraPartnerAndFee,C as buildSwapFromQuote,p as computeMinAmountOut,k as copyQuote,x as decodeSwapMinAmountOut,v as encodeKyberSwapData,w as encodeVeloraSwapData,u as formatVenueFeeDisclosure,B as getQuote,o as isNativeToken,g as kyberSwapAbi,A as normalizeQuote,a as ponsCurveSwapAbi,n as resolveNowSeconds,l as snapshotQuote,s as veloraCalldataMinimum,r as veloraVenueFeeBps};
|
package/build/dist/api/tokens.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunks/JPOYTTTW.js";import"../chunks/LQGPMOD2.js";import"../chunks/NSOEDRBU.js";import"../chunks/3EFV4FQF.js";import"../chunks/XVFLT275.js";import"../chunks/5O5ZE3ZV.js";import"../chunks/EA6IYKIB.js";import"../chunks/KSZMMNXK.js";import"../chunks/TNSKEHPC.js";import"../chunks/CY75R4FK.js";import"../chunks/LIUXNOLP.js";import"../chunks/CQCVFRQ5.js";import"../chunks/KHJFXJBU.js";import"../chunks/WVXW6VL3.js";import"../chunks/GIV5JMTE.js";import"../chunks/WQ6H62DM.js";import"../chunks/QRDDKA4I.js";import"../chunks/P4UQGWCP.js";import"../chunks/AXYOJBX6.js";import"../chunks/Z25UKUJF.js";import"../chunks/6IM6A5VA.js";import"../chunks/EG6M6SSO.js";import"../chunks/MYBDO5SA.js";import"../chunks/HIMVOTIU.js";import"../chunks/UWOFA6GV.js";import"../chunks/73N3TOJL.js";import"../chunks/RETS2ZEK.js";import"../chunks/5HCXZWUH.js";import"../chunks/CXLEQCP3.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{j as MULTICALL3_ABI,b as NATIVE_ETH_TOKEN,a as STOCK_ASSETS_URL,e as USDE_TOKEN,c as USDG_TOKEN,d as WETH_TOKEN,h as assertOfficialStockIdentity,i as fetchOfficialStockTokens,m as findToken,k as getBalances,l as getReceivedTokenBalances,f as parseOfficialStockAssets,n as resolveQuoteToken,g as verifyOfficialStockToken};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h}from"../chunks/
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h}from"../chunks/3SC5UI35.js";import{a}from"../chunks/WTSMPDT5.js";import"../chunks/73N3TOJL.js";import"../chunks/RETS2ZEK.js";import"../chunks/G6HCV67X.js";import"../chunks/5YS5V2LK.js";import"../chunks/JXOEJPJ4.js";export{c as COMING_SOON,d as FIND_TOOL,f as LOCAL_TOOLS,e as RUN_TOOL,g as VISIBLE_TOOLS,a as isFundingBootstrap,b as isReadDiscovery,h as visibleTools};
|
|
@@ -160,6 +160,11 @@ export interface ProjectModulePart {
|
|
|
160
160
|
positions?(wallet: Address): Promise<Position[]>;
|
|
161
161
|
}
|
|
162
162
|
export type CreateModulePart = (context: ModuleContext) => ProjectModulePart;
|
|
163
|
+
export interface BuilderGrant {
|
|
164
|
+
project: string;
|
|
165
|
+
startsAt: DecimalString;
|
|
166
|
+
endsAt: DecimalString;
|
|
167
|
+
}
|
|
163
168
|
export interface Account {
|
|
164
169
|
plan: 'none' | 'holder' | 'nohold';
|
|
165
170
|
contract: Address;
|
|
@@ -170,6 +175,8 @@ export interface Account {
|
|
|
170
175
|
holderOpen: boolean;
|
|
171
176
|
noHoldPrice: DecimalString | 'unavailable';
|
|
172
177
|
priceError?: string;
|
|
178
|
+
grant?: BuilderGrant;
|
|
179
|
+
nextPaymentAt?: DecimalString;
|
|
173
180
|
}
|
|
174
181
|
export interface PriceNote {
|
|
175
182
|
wallet: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./6IM6A5VA.js";import{c as N}from"./MYBDO5SA.js";import{c as C,e as u,g as I}from"./73N3TOJL.js";import{a as m}from"./
|
|
1
|
+
import{a as E}from"./6IM6A5VA.js";import{c as N}from"./MYBDO5SA.js";import{c as C,e as u,g as I}from"./73N3TOJL.js";import{a as m}from"./G6HCV67X.js";import{a as y}from"./5YS5V2LK.js";import{getAddress as k}from"viem";var D="https://api.velora.xyz/v2/delta",A=["PENDING","AWAITING_SIGNATURE","ACTIVE","SUSPENDED","CANCELLING","BRIDGING","COMPLETED","FAILED","EXPIRED","REFUNDING","CANCELLED","REFUNDED"],T=["Order","FillableOrder","ProductiveOrder","ExternalOrder","TWAPOrder","TWAPBuyOrder"],x="^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";function i(e){if(!e)throw new y("Velora Delta returned an unexpected response.")}function h(e){if(typeof e!="string")throw new y("Provide an address.");return E(e),k(e)}function O(e,p,o){if(e===void 0)return o;if(typeof e!="number"||!Number.isSafeInteger(e)||e<1||e>p)throw new y(`Provide an integer between 1 and ${p}.`);return e}function b(e,p){if(typeof e!="string"||!p.includes(e))throw new y(`Choose one of: ${p.join(", ")}.`);return e}function w(e){i(u(e)&&Number.isSafeInteger(e.chainId)&&Number(e.chainId)>0);let p=h(e.token);for(let o of["amount","expectedAmount","executedAmount"])i(e[o]===void 0||e[o]===null||typeof e[o]=="string"&&/^(0|[1-9][0-9]*)$/.test(e[o])&&BigInt(e[o])<1n<<256n);return i(typeof e.amount=="string"||typeof e.expectedAmount=="string"),{chainId:e.chainId,token:p,...Object.fromEntries(["amount","expectedAmount","executedAmount"].filter(o=>e[o]!==void 0).map(o=>[o,e[o]]))}}function P(e,p,o){i(u(e)&&typeof e.id=="string"&&new RegExp(x).test(e.id)),i(o===void 0||I(e.id,o));let l=h(e.owner);i(I(l,p)),i(typeof e.status=="string"&&A.includes(e.status)),i(e.side==="SELL"||e.side==="BUY"),i(e.type==="MARKET"||e.type==="LIMIT"),i(typeof e.onChainOrderType=="string"&&T.includes(e.onChainOrderType));let t=w(e.input);i(t.chainId===m);let a=w(e.output);i(typeof e.orderHash=="string"&&/^0x[0-9a-fA-F]{64}$/.test(e.orderHash)),i(Array.isArray(e.transactions)&&Array.isArray(e.refunds));for(let n of e.transactions){i(u(n)&&typeof n.originTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.originTx)),i(n.destinationTx===void 0||n.destinationTx===null||typeof n.destinationTx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.destinationTx)),i(typeof n.filledPercent=="number"&&Number.isFinite(n.filledPercent)&&n.filledPercent>=0&&n.filledPercent<=100);for(let d of["spentAmount","receivedAmount"])i(n[d]===void 0||n[d]===null||typeof n[d]=="string"&&/^(0|[1-9][0-9]*)$/.test(n[d]))}let r=e.refunds.map(n=>(i(u(n)&&typeof n.tx=="string"&&/^0x[0-9a-fA-F]{64}$/.test(n.tx)),{...w(n),tx:n.tx}));return{id:e.id,status:e.status,side:e.side,type:e.type,onChainOrderType:e.onChainOrderType,owner:l,beneficiary:h(e.beneficiary),orderHash:e.orderHash,input:t,output:a,transactions:structuredClone(e.transactions),refunds:r,...Object.fromEntries(["createdAt","updatedAt","expiresAt"].filter(n=>typeof e[n]=="string").map(n=>[n,e[n]]))}}function L(e){function p(t,a,r,n){return{name:t,inputSchema:{type:"object",additionalProperties:!1,properties:a,required:r},execute:async(d,s)=>{try{h(s);for(let c of Object.keys(d))if(!Object.hasOwn(a,c))throw new y(`Unsupported ${t} argument: ${c}.`);return await n(d,s)}catch(c){throw new y(e.plainError(c))}}}}let o=t=>N(e.http,`${D}/${t}`,{method:"GET"},u),l="Provider activity is not receipt proof. Token amounts are base units; resolve symbols and decimals with find_token. Delta signing and submission are not enabled in Oak.";return[p("velora_delta_token_support",{token:C},["token"],async t=>{let a=h(t.token),r=await o(`prices/is-token-supported?${new URLSearchParams({chainId:String(m),token:a})}`);return i(typeof r.supported=="boolean"),{token:a,chainId:m,supported:r.supported}}),p("velora_delta_orders",{page:{type:"integer",minimum:1},limit:{type:"integer",minimum:1,maximum:1e3},type:{type:"string",enum:["MARKET","LIMIT"]},status:{type:"array",minItems:1,maxItems:A.length,items:{type:"string",enum:A}},onChainOrderType:{type:"string",enum:T.filter(t=>t!=="FillableOrder")}},[],async(t,a)=>{let r=O(t.page,Number.MAX_SAFE_INTEGER,1),n=O(t.limit,1e3,100),d=new URLSearchParams({userAddress:a,chainId:String(m),page:String(r),limit:String(n)});if(t.type!==void 0&&d.set("type",b(t.type,["MARKET","LIMIT"])),t.onChainOrderType!==void 0&&d.set("onChainOrderType",b(t.onChainOrderType,T.filter(f=>f!=="FillableOrder"))),t.status!==void 0){if(!Array.isArray(t.status)||!t.status.length||t.status.length>A.length)throw new y("Provide a nonempty list of Delta statuses.");d.set("status",t.status.map(f=>b(f,A)).join(","))}let s=await o(`orders?${d}`);i(Array.isArray(s.data)&&s.data.length<=n),i(s.page===r&&s.limit===n&&Number.isSafeInteger(s.total)&&Number(s.total)>=0&&typeof s.hasMore=="boolean");let c=(r-1)*n+s.data.length;i(Number.isSafeInteger(c)&&c<=Math.max(Number(s.total),(r-1)*n)),i(s.hasMore===c<Number(s.total)&&(!s.hasMore||s.data.length>0));let g=s.data.map(f=>P(f,a));return i(new Set(g.map(f=>f.id.toLowerCase())).size===g.length),i(g.every(f=>(t.type===void 0||f.type===t.type)&&(t.onChainOrderType===void 0||f.onChainOrderType===t.onChainOrderType)&&(t.status===void 0||t.status.includes(f.status)))),{data:g,total:s.total,page:r,limit:n,hasMore:s.hasMore,notice:l}}),p("velora_delta_order",{orderId:{type:"string",pattern:x}},["orderId"],async(t,a)=>{if(typeof t.orderId!="string"||!new RegExp(x).test(t.orderId))throw new y("Provide a Delta order UUID.");let r=await o(`orders/${t.orderId}`);return{order:P(r,a,t.orderId),notice:l}}),p("velora_delta_bridge_routes",{},[],async()=>{let t=await o("prices/bridge-routes");i(Array.isArray(t.routes));let a=t.routes.map(r=>(i(u(r)&&Number.isSafeInteger(r.srcChainId)&&Number(r.srcChainId)>0&&Number.isSafeInteger(r.destChainId)&&Number(r.destChainId)>0&&Array.isArray(r.tokens)),{srcChainId:r.srcChainId,destChainId:r.destChainId,tokens:r.tokens.map(h)})).filter(r=>r.srcChainId===m||r.destChainId===m);return{chainId:m,routes:a,executionAvailable:!1}}),p("velora_delta_bridge_protocols",{},[],async()=>{let t=await o("prices/bridge-protocols");return i(Array.isArray(t.bridgeProtocols)),{bridgeProtocols:t.bridgeProtocols.map(r=>(i(u(r)&&typeof r.protocol=="string"&&typeof r.displayName=="string"),{protocol:r.protocol,displayName:r.displayName})),executionAvailable:!1}}),p("velora_delta_strategies",{},[],async()=>{let t=await o(`prices/strategies/${m}`),a=Object.entries(t).map(([r,n])=>(i(u(n)&&Array.isArray(n.strategies)),{underlying:h(r),address:h(n.address),strategies:n.strategies.map(d=>{i(u(d)&&typeof d.name=="string");let s=d.apr;return i(s===null||u(s)&&["gross","net"].every(c=>typeof s[c]=="string"&&/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(s[c]))),{vault:h(d.vault),name:d.name,apr:structuredClone(d.apr)}})}));return{chainId:m,strategies:a,executionAvailable:!1,notice:"APRs are provider estimates refreshed every three hours, not promised returns. Verify each vault and its exit before depositing."}})]}export{L as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ee}from"./H4S2ZCWK.js";import{a as xe}from"./T3NPRRTY.js";import{a as $e,b as me,c as Te}from"./SQ5BNSXR.js";import{c as Re,d as t,e as R,f as d,g as Ae,h as W,i as v,j as de,k as L,m as O,n as c,o as ue,p as ce,q as le,r as Ce,s as qe}from"./53N7PNJH.js";import{a as ke,o as re}from"./CAU44UWP.js";import{a as ve}from"./UWOFA6GV.js";import{c as be,e as Q,g as M}from"./73N3TOJL.js";import{a as l,i as we}from"./XPFVT2EA.js";import{a as h}from"./5YS5V2LK.js";import{decodeFunctionData as Fe,erc20Abi as Me}from"viem";var z="0x0000000000000000000000000000000000000000",N=we[l].relay.depository.address.toLowerCase(),Se=30,ze=w=>{let U=qe(w);async function pe(n){let e;try{e=await U(`/intents/status/v3?requestId=${encodeURIComponent(n)}`)}catch(C){if(w.plainError(C)!=="The request timed out. Please try again.")throw C;return{requestId:n,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 h("Relay returned an invalid bridge status.");let i=ue(e.inTxHashes),p=ue(e.txHashes),u=e.originChainId===void 0?void 0:W(e.originChainId),a=e.destinationChainId===void 0?void 0:W(e.destinationChainId),s=ce(e.failReason),m=ce(e.refundFailReason),r=e.status==="success"&&p.length>0&&a!==void 0,q=e.status==="refund"&&p.length>0&&u!==void 0,g=e.status==="failure"&&m!==void 0,A=["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",k=r?"Relay reports destination fulfillment.":q?"Relay reports a refund on the origin chain; the destination was not fulfilled.":g?"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:n,status:A,relayStatus:e.status,fulfilled:r,settled:r||q,pollAgain:!r&&!q&&!g,needsAttention:g,timedOut:!1,inTxHashes:i,txHashes:p,originChainId:u,destinationChainId:a,failReason:s,refundFailReason:m,...e.updatedAt===void 0?{}:{updatedAt:v(String(e.updatedAt))},summary:k}}async function De(n,e){let i=s=>({destinationVerified:!1,destinationCheck:s}),p;try{if(p=w.clientFor(n),await p.getChainId()!==n)return i(`The configured RPC does not serve chain ${n}; destination receipts were not checked.`)}catch{return i(`No RPC is available for chain ${n}; destination receipts were not checked.`)}let u=[];for(let s of e)try{let m=await p.getTransactionReceipt({hash:s});u.push({hash:s,status:m.status,blockNumber:m.blockNumber.toString()})}catch{return{...i(`Receipt ${s} is not available on chain ${n} yet; poll again.`),destinationReceipts:u}}let a=u.length>0&&u.every(s=>s.status==="success");return{destinationVerified:a,destinationReceipts:u,destinationCheck:a?`Every Relay destination transaction has a successful receipt on chain ${n}. Amounts are not decoded here; compare the recipient balance for the exact delivered amount.`:`A Relay destination transaction did not succeed on chain ${n}; do not treat this bridge as delivered.`}}async function Pe(n){let e=await w.clientFor(l).readContract({address:n,abi:Me,functionName:"decimals"}),i=typeof e=="bigint"?Number(e):e;if(typeof i!="number"||!Number.isInteger(i)||i<0||i>255)throw new h("Could not read valid ERC-20 decimals() on-chain.");return i}async function _e(n,e){let i=d(e),p=d(n.recipient??i),u=W(n.destinationChainId);if(u===l)throw new h("Choose a destination chain other than 4663.");let a=Ae(n.originCurrency??z),s=a!==z,m=d(n.destinationCurrency??z),r=v(n.amount);if(r==="0")throw new h("Provide a positive bridge amount.");let q=n.minAmountOut===void 0?void 0:v(n.minAmountOut),g=n.slippageBps??me;if(typeof g!="number")throw new h("Slippage must be an integer from 0 to 9999 bps.");re("0",g);let I=R((await U("/chains")).chains).map(t),A=I.find(o=>o.id===l),k=I.find(o=>o.id===u);if(!A||!k||A.disabled!==!1||k.disabled!==!1||A.depositEnabled!==!0||A.vmType!=="evm"||k.vmType!=="evm")throw new h("Relay does not currently support this outbound chain route.");if(!xe(u))throw new h(`Relay has no supported Oak return path from chain ${u}. Choose a destination supported by relay_bridge_in before bridge-out.`);let C=await $e(w.clientFor,u,i,"server"),b=s?await Pe(a):18,P=Math.floor(Date.now()/1e3)+ke,$=await U("/quote/v2",{user:i,recipient:p,originChainId:l,destinationChainId:u,originCurrency:a,destinationCurrency:m,amount:r,tradeType:"EXACT_INPUT",...s?{explicitDeposit:!0}:{}}),E=L($.requestId),S=t($.details),B=O(S.currencyIn),f=O(S.currencyOut),T={token:f.token,amount:v(t(S.currencyOut).minimumAmount)};if(c(d(S.sender)===i&&d(S.recipient)===p&&B.token.chainId===l&&B.token.address===a&&B.token.decimals===b&&B.amount===r&&f.token.chainId===u&&f.token.address===m&&BigInt(T.amount)>0n&&BigInt(T.amount)<=BigInt(f.amount)),m===z&&c(f.token.decimals===t(k.currency).decimals),q!==void 0){if(T.amount!==q)throw new h("Relay order minimum must exactly match minAmountOut. Request a new quote.")}else if(BigInt(T.amount)<BigInt(re(f.amount,g)))throw Te(f.amount,T.amount);let J=t(t($.protocol).v2),j=L(J.orderId),Z=t(J.orderData),Y=t(Z.output),ee=de(Y.deadline),K=R(Z.inputs).map(t);c(K.length>0);let te=K.flatMap(o=>{let y=R(o.refunds).map(t);return c(y.length>0),y.map(Ie=>{if(d(Ie.recipient)!==i)throw new h("Relay refund recipient does not match the agent wallet. Request a new quote.");return de(Ie.deadline)})}),Oe=te.reduce((o,y)=>Math.min(o,y),ee),ne=Math.min(P,Oe-Se),he=()=>{if(Date.now()/1e3>=ne)throw new h("The Relay quote expired or its order/refund deadline leaves too little time to sign and send. Request a fresh bridge quote.")};he();let H=R(Y.payments).map(t),ie=t(t(A.protocol).v2),Ne=t(t(k.protocol).v2),V=t(J.paymentDetails);c(Y.chainId===Ne.chainId&&H.length===1&&R(Y.calls).length===0&&d(H[0].recipient)===p&&d(H[0].currency)===m&&v(H[0].minimumAmount)===T.amount&&v(H[0].expectedAmount)===f.amount&&V.chainId===ie.chainId&&d(V.currency)===a&&v(V.amount)===r),c(d(V.depository)===N&&d(ie.depository)===N);let oe=t(K[0].payment);c(K.length===1&&oe.chainId===ie.chainId&&d(oe.currency)===a&&v(oe.amount)===r);let F=R($.steps).map(t),_=s&&F.length===2?F[0]:void 0;c(F.length===(_?2:1));let G=F[F.length-1];c(G.kind==="transaction"&&G.id==="deposit"&&G.requestId===E);let X=R(G.items).map(t);c(X.length===1&&X[0].status==="incomplete");let x=t(X[0].data),fe=t(X[0].check);if(c(fe.method==="GET"&&fe.endpoint===`/intents/status/v3?requestId=${E}`&&x.chainId===l&&d(x.from)===i&&d(x.to)===N&&v(x.value)===(s?"0":r)),typeof x.data!="string"||!(s?/^0x[0-9a-fA-F]{264}$/:/^0x[0-9a-fA-F]{136}$/).test(x.data))throw new h(`Relay returned unexpected ${s?"ERC-20":"native"} deposit calldata.`);let D=Fe({abi:Re,data:x.data});D.functionName==="depositErc20"?c(s&&d(D.args[0])===i&&d(D.args[1])===a&&D.args[2]===BigInt(r)&&M(D.args[3],j)):c(!s&&d(D.args[0])===i&&M(D.args[1],j));let Be=I.filter(o=>o.vmType==="evm"&&Q(o.protocol)&&Q(o.protocol.v2)).map(o=>t(t(o.protocol).v2).chainId).filter(o=>typeof o=="string");if(!M(Ee(Z,Be),j))throw new h("Relay order ID does not match the checked quote terms. Request a new quote.");let ae=s?w.approval(a,N,r,l):void 0;if(_&&ae){c(_.kind==="transaction"&&_.id==="approve"&&_.requestId===E);let o=R(_.items).map(t);c(o.length===1&&o[0].status==="incomplete");let y=t(o[0].data);c(y.chainId===l&&d(y.from)===i&&d(y.to)===a&&v(y.value)==="0"&&typeof y.data=="string"&&M(y.data,ae.data))}let ye=[...ae?await Ce(w,a,N,r,l,i):[],w.unsignedTx({to:N,data:x.data,value:s?"0":r,chainId:l,description:s?`Deposit ${r} base units of ${a} for Relay request ${E}.`:`Deposit native ETH for Relay request ${E}.`})],ge=t($.fees);for(let o of Object.values(ge))O(o);let se=await w.preview(ye,i);he();let He=se.changes.map(o=>{let y=o.amount.startsWith("-");return`${y?"-":""}${w.formatAmount(y?o.amount.slice(1):o.amount,o.token.decimals)} ${o.token.symbol}`}).join(", ");return{txs:ye,requestId:E,orderId:j,recipient:p,originChainId:l,destinationChainId:u,expiresAt:String(ne),orderDeadline:String(ee),refundDeadlines:te.map(String),returnPath:C,amountIn:B,amountOut:f,minAmountOut:T,fees:ge,expandedPriceImpact:S.expandedPriceImpact,timeEstimate:S.timeEstimate,preview:se,summary:`${C} Bridge to ${p} on chain ${u}; asset ${f.token.address} on chain ${f.token.chainId} (${le(f.token.symbol)}); expected ${f.amount}, minimum ${T.amount} base units (${f.token.decimals} decimals). Order deadline ${ee} Unix seconds; refund deadlines ${te.join(", ")} Unix seconds; accept before ${ne} Unix seconds to reserve ${Se}s to sign and send. Origin preview: ${He||se.summary}. Relay route fees are included in the quote; origin gas is separate. Poll relay_status with requestId ${E} 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},amount:{type:"string",pattern:"^[1-9][0-9]*$"},recipient:{type:"string"},originCurrency:be,slippageBps:{type:"integer",minimum:0,maximum:9999,default:me},destinationCurrency:{type:"string"},minAmountOut:ve()}},execute:async(n,e)=>{try{return await _e(n,e)}catch(i){throw new h(w.plainError(i))}}},{name:"relay_status",inputSchema:{type:"object",required:["requestId"],additionalProperties:!1,properties:{requestId:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},verifyDestination:{type:"boolean"}}},execute:async n=>{let e=await pe(L(n.requestId));return n.verifyDestination!==!0||!e.fulfilled||e.destinationChainId===void 0?e:{...e,...await De(e.destinationChainId,e.txHashes)}}}],positions:async n=>{let e=d(n);if(!process.env.OAK_RELAY_API_KEY?.trim())return[{module:"relay",id:"relay-discovery-unavailable",chainId:l,assets:[],incomplete:!0,description:'Relay pending bridge discovery requires OAK_RELAY_API_KEY on the server. The request-history API requires this key; no pending bridges were checked. Ask the operator to configure 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}.'}];let i=new Map;for(let p of["outbound","inbound"]){let u=new Set,a;do{let s=new URLSearchParams({user:e,[p==="outbound"?"originChainId":"destinationChainId"]:String(l),limit:"100",includePendingRequests:"true"});a&&s.set("continuation",a);let m=await U(`/requests/v3?${s}`);for(let r of R(m.requests).map(t)){let q=Q(r.depositAddress)?r.depositAddress.depositor:void 0;if(![r.user,r.sender,q].some($=>typeof $=="string"&&$.toLowerCase()===e))throw new h("Relay returned a request for another wallet.");let g=L(r.id);if(i.has(g))continue;let I=await pe(g);if(I.settled)continue;let A=t(r.data),k=t(t(A.route).quoted),C=O(t(k.origin).inputCurrency),b={...C,token:{...C.token,symbol:le(C.token.symbol)??"unknown"}},P=O(t(k.destination).outputCurrency);c(p==="outbound"?b.token.chainId===l&&P.token.chainId!==l:b.token.chainId!==l&&P.token.chainId===l),I.originChainId!==void 0&&c(I.originChainId===b.token.chainId),I.destinationChainId!==void 0&&c(I.destinationChainId===P.token.chainId),i.set(g,{module:"relay",id:g,chainId:b.token.chainId,assets:[b],description:`Relay ${p} ${I.status}: ${b.amount} ${b.token.symbol} base units (${b.token.decimals} decimals) from chain ${b.token.chainId} toward ${d(r.recipient)} on chain ${P.token.chainId}. ${I.summary} Track with relay_status requestId ${g}.`})}if(m.continuation!==void 0&&m.continuation!==null&&typeof m.continuation!="string")throw new h("Relay returned invalid pagination.");if(a=typeof m.continuation=="string"&&m.continuation?m.continuation:void 0,a){if(u.has(a))throw new h("Relay repeated its pagination cursor. Pending positions are incomplete.");u.add(a)}}while(a)}return[...i.values()]}}};export{ze as a};
|
|
1
|
+
import{a as xe}from"./Z7RL4NGX.js";import{a as Ee}from"./H4S2ZCWK.js";import{a as $e,b as me,c as Te}from"./SQ5BNSXR.js";import{c as Re,d as t,e as R,f as d,g as Ae,h as W,i as v,j as de,k as L,m as O,n as c,o as ue,p as ce,q as le,r as Ce,s as qe}from"./53N7PNJH.js";import{a as ke,o as re}from"./5O5ZE3ZV.js";import{a as ve}from"./UWOFA6GV.js";import{c as be,e as Q,g as M}from"./73N3TOJL.js";import{a as l,i as we}from"./G6HCV67X.js";import{a as h}from"./5YS5V2LK.js";import{decodeFunctionData as Fe,erc20Abi as Me}from"viem";var z="0x0000000000000000000000000000000000000000",N=we[l].relay.depository.address.toLowerCase(),Se=30,ze=w=>{let U=qe(w);async function pe(n){let e;try{e=await U(`/intents/status/v3?requestId=${encodeURIComponent(n)}`)}catch(C){if(w.plainError(C)!=="The request timed out. Please try again.")throw C;return{requestId:n,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 h("Relay returned an invalid bridge status.");let i=ue(e.inTxHashes),p=ue(e.txHashes),u=e.originChainId===void 0?void 0:W(e.originChainId),a=e.destinationChainId===void 0?void 0:W(e.destinationChainId),s=ce(e.failReason),m=ce(e.refundFailReason),r=e.status==="success"&&p.length>0&&a!==void 0,q=e.status==="refund"&&p.length>0&&u!==void 0,g=e.status==="failure"&&m!==void 0,A=["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",k=r?"Relay reports destination fulfillment.":q?"Relay reports a refund on the origin chain; the destination was not fulfilled.":g?"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:n,status:A,relayStatus:e.status,fulfilled:r,settled:r||q,pollAgain:!r&&!q&&!g,needsAttention:g,timedOut:!1,inTxHashes:i,txHashes:p,originChainId:u,destinationChainId:a,failReason:s,refundFailReason:m,...e.updatedAt===void 0?{}:{updatedAt:v(String(e.updatedAt))},summary:k}}async function De(n,e){let i=s=>({destinationVerified:!1,destinationCheck:s}),p;try{if(p=w.clientFor(n),await p.getChainId()!==n)return i(`The configured RPC does not serve chain ${n}; destination receipts were not checked.`)}catch{return i(`No RPC is available for chain ${n}; destination receipts were not checked.`)}let u=[];for(let s of e)try{let m=await p.getTransactionReceipt({hash:s});u.push({hash:s,status:m.status,blockNumber:m.blockNumber.toString()})}catch{return{...i(`Receipt ${s} is not available on chain ${n} yet; poll again.`),destinationReceipts:u}}let a=u.length>0&&u.every(s=>s.status==="success");return{destinationVerified:a,destinationReceipts:u,destinationCheck:a?`Every Relay destination transaction has a successful receipt on chain ${n}. Amounts are not decoded here; compare the recipient balance for the exact delivered amount.`:`A Relay destination transaction did not succeed on chain ${n}; do not treat this bridge as delivered.`}}async function Pe(n){let e=await w.clientFor(l).readContract({address:n,abi:Me,functionName:"decimals"}),i=typeof e=="bigint"?Number(e):e;if(typeof i!="number"||!Number.isInteger(i)||i<0||i>255)throw new h("Could not read valid ERC-20 decimals() on-chain.");return i}async function _e(n,e){let i=d(e),p=d(n.recipient??i),u=W(n.destinationChainId);if(u===l)throw new h("Choose a destination chain other than 4663.");let a=Ae(n.originCurrency??z),s=a!==z,m=d(n.destinationCurrency??z),r=v(n.amount);if(r==="0")throw new h("Provide a positive bridge amount.");let q=n.minAmountOut===void 0?void 0:v(n.minAmountOut),g=n.slippageBps??me;if(typeof g!="number")throw new h("Slippage must be an integer from 0 to 9999 bps.");re("0",g);let I=R((await U("/chains")).chains).map(t),A=I.find(o=>o.id===l),k=I.find(o=>o.id===u);if(!A||!k||A.disabled!==!1||k.disabled!==!1||A.depositEnabled!==!0||A.vmType!=="evm"||k.vmType!=="evm")throw new h("Relay does not currently support this outbound chain route.");if(!xe(u))throw new h(`Relay has no supported Oak return path from chain ${u}. Choose a destination supported by relay_bridge_in before bridge-out.`);let C=await $e(w.clientFor,u,i,"server"),b=s?await Pe(a):18,P=Math.floor(Date.now()/1e3)+ke,$=await U("/quote/v2",{user:i,recipient:p,originChainId:l,destinationChainId:u,originCurrency:a,destinationCurrency:m,amount:r,tradeType:"EXACT_INPUT",...s?{explicitDeposit:!0}:{}}),E=L($.requestId),S=t($.details),B=O(S.currencyIn),f=O(S.currencyOut),T={token:f.token,amount:v(t(S.currencyOut).minimumAmount)};if(c(d(S.sender)===i&&d(S.recipient)===p&&B.token.chainId===l&&B.token.address===a&&B.token.decimals===b&&B.amount===r&&f.token.chainId===u&&f.token.address===m&&BigInt(T.amount)>0n&&BigInt(T.amount)<=BigInt(f.amount)),m===z&&c(f.token.decimals===t(k.currency).decimals),q!==void 0){if(T.amount!==q)throw new h("Relay order minimum must exactly match minAmountOut. Request a new quote.")}else if(BigInt(T.amount)<BigInt(re(f.amount,g)))throw Te(f.amount,T.amount);let J=t(t($.protocol).v2),j=L(J.orderId),Z=t(J.orderData),Y=t(Z.output),ee=de(Y.deadline),K=R(Z.inputs).map(t);c(K.length>0);let te=K.flatMap(o=>{let y=R(o.refunds).map(t);return c(y.length>0),y.map(Ie=>{if(d(Ie.recipient)!==i)throw new h("Relay refund recipient does not match the agent wallet. Request a new quote.");return de(Ie.deadline)})}),Oe=te.reduce((o,y)=>Math.min(o,y),ee),ne=Math.min(P,Oe-Se),he=()=>{if(Date.now()/1e3>=ne)throw new h("The Relay quote expired or its order/refund deadline leaves too little time to sign and send. Request a fresh bridge quote.")};he();let H=R(Y.payments).map(t),ie=t(t(A.protocol).v2),Ne=t(t(k.protocol).v2),V=t(J.paymentDetails);c(Y.chainId===Ne.chainId&&H.length===1&&R(Y.calls).length===0&&d(H[0].recipient)===p&&d(H[0].currency)===m&&v(H[0].minimumAmount)===T.amount&&v(H[0].expectedAmount)===f.amount&&V.chainId===ie.chainId&&d(V.currency)===a&&v(V.amount)===r),c(d(V.depository)===N&&d(ie.depository)===N);let oe=t(K[0].payment);c(K.length===1&&oe.chainId===ie.chainId&&d(oe.currency)===a&&v(oe.amount)===r);let F=R($.steps).map(t),_=s&&F.length===2?F[0]:void 0;c(F.length===(_?2:1));let G=F[F.length-1];c(G.kind==="transaction"&&G.id==="deposit"&&G.requestId===E);let X=R(G.items).map(t);c(X.length===1&&X[0].status==="incomplete");let x=t(X[0].data),fe=t(X[0].check);if(c(fe.method==="GET"&&fe.endpoint===`/intents/status/v3?requestId=${E}`&&x.chainId===l&&d(x.from)===i&&d(x.to)===N&&v(x.value)===(s?"0":r)),typeof x.data!="string"||!(s?/^0x[0-9a-fA-F]{264}$/:/^0x[0-9a-fA-F]{136}$/).test(x.data))throw new h(`Relay returned unexpected ${s?"ERC-20":"native"} deposit calldata.`);let D=Fe({abi:Re,data:x.data});D.functionName==="depositErc20"?c(s&&d(D.args[0])===i&&d(D.args[1])===a&&D.args[2]===BigInt(r)&&M(D.args[3],j)):c(!s&&d(D.args[0])===i&&M(D.args[1],j));let Be=I.filter(o=>o.vmType==="evm"&&Q(o.protocol)&&Q(o.protocol.v2)).map(o=>t(t(o.protocol).v2).chainId).filter(o=>typeof o=="string");if(!M(Ee(Z,Be),j))throw new h("Relay order ID does not match the checked quote terms. Request a new quote.");let ae=s?w.approval(a,N,r,l):void 0;if(_&&ae){c(_.kind==="transaction"&&_.id==="approve"&&_.requestId===E);let o=R(_.items).map(t);c(o.length===1&&o[0].status==="incomplete");let y=t(o[0].data);c(y.chainId===l&&d(y.from)===i&&d(y.to)===a&&v(y.value)==="0"&&typeof y.data=="string"&&M(y.data,ae.data))}let ye=[...ae?await Ce(w,a,N,r,l,i):[],w.unsignedTx({to:N,data:x.data,value:s?"0":r,chainId:l,description:s?`Deposit ${r} base units of ${a} for Relay request ${E}.`:`Deposit native ETH for Relay request ${E}.`})],ge=t($.fees);for(let o of Object.values(ge))O(o);let se=await w.preview(ye,i);he();let He=se.changes.map(o=>{let y=o.amount.startsWith("-");return`${y?"-":""}${w.formatAmount(y?o.amount.slice(1):o.amount,o.token.decimals)} ${o.token.symbol}`}).join(", ");return{txs:ye,requestId:E,orderId:j,recipient:p,originChainId:l,destinationChainId:u,expiresAt:String(ne),orderDeadline:String(ee),refundDeadlines:te.map(String),returnPath:C,amountIn:B,amountOut:f,minAmountOut:T,fees:ge,expandedPriceImpact:S.expandedPriceImpact,timeEstimate:S.timeEstimate,preview:se,summary:`${C} Bridge to ${p} on chain ${u}; asset ${f.token.address} on chain ${f.token.chainId} (${le(f.token.symbol)}); expected ${f.amount}, minimum ${T.amount} base units (${f.token.decimals} decimals). Order deadline ${ee} Unix seconds; refund deadlines ${te.join(", ")} Unix seconds; accept before ${ne} Unix seconds to reserve ${Se}s to sign and send. Origin preview: ${He||se.summary}. Relay route fees are included in the quote; origin gas is separate. Poll relay_status with requestId ${E} 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},amount:{type:"string",pattern:"^[1-9][0-9]*$"},recipient:{type:"string"},originCurrency:be,slippageBps:{type:"integer",minimum:0,maximum:9999,default:me},destinationCurrency:{type:"string"},minAmountOut:ve()}},execute:async(n,e)=>{try{return await _e(n,e)}catch(i){throw new h(w.plainError(i))}}},{name:"relay_status",inputSchema:{type:"object",required:["requestId"],additionalProperties:!1,properties:{requestId:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},verifyDestination:{type:"boolean"}}},execute:async n=>{let e=await pe(L(n.requestId));return n.verifyDestination!==!0||!e.fulfilled||e.destinationChainId===void 0?e:{...e,...await De(e.destinationChainId,e.txHashes)}}}],positions:async n=>{let e=d(n);if(!process.env.OAK_RELAY_API_KEY?.trim())return[{module:"relay",id:"relay-discovery-unavailable",chainId:l,assets:[],incomplete:!0,description:'Relay pending bridge discovery requires OAK_RELAY_API_KEY on the server. The request-history API requires this key; no pending bridges were checked. Ask the operator to configure 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}.'}];let i=new Map;for(let p of["outbound","inbound"]){let u=new Set,a;do{let s=new URLSearchParams({user:e,[p==="outbound"?"originChainId":"destinationChainId"]:String(l),limit:"100",includePendingRequests:"true"});a&&s.set("continuation",a);let m=await U(`/requests/v3?${s}`);for(let r of R(m.requests).map(t)){let q=Q(r.depositAddress)?r.depositAddress.depositor:void 0;if(![r.user,r.sender,q].some($=>typeof $=="string"&&$.toLowerCase()===e))throw new h("Relay returned a request for another wallet.");let g=L(r.id);if(i.has(g))continue;let I=await pe(g);if(I.settled)continue;let A=t(r.data),k=t(t(A.route).quoted),C=O(t(k.origin).inputCurrency),b={...C,token:{...C.token,symbol:le(C.token.symbol)??"unknown"}},P=O(t(k.destination).outputCurrency);c(p==="outbound"?b.token.chainId===l&&P.token.chainId!==l:b.token.chainId!==l&&P.token.chainId===l),I.originChainId!==void 0&&c(I.originChainId===b.token.chainId),I.destinationChainId!==void 0&&c(I.destinationChainId===P.token.chainId),i.set(g,{module:"relay",id:g,chainId:b.token.chainId,assets:[b],description:`Relay ${p} ${I.status}: ${b.amount} ${b.token.symbol} base units (${b.token.decimals} decimals) from chain ${b.token.chainId} toward ${d(r.recipient)} on chain ${P.token.chainId}. ${I.summary} Track with relay_status requestId ${g}.`})}if(m.continuation!==void 0&&m.continuation!==null&&typeof m.continuation!="string")throw new h("Relay returned invalid pagination.");if(a=typeof m.continuation=="string"&&m.continuation?m.continuation:void 0,a){if(u.has(a))throw new h("Relay repeated its pagination cursor. Pending positions are incomplete.");u.add(a)}}while(a)}return[...i.values()]}}};export{ze as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as j}from"./T3MGNKA6.js";import{c as z}from"./MYBDO5SA.js";import{d as O}from"./VXLJRRKV.js";import{g as $}from"./73N3TOJL.js";import{a as D,b as M}from"./RETS2ZEK.js";import{a as F,i as q}from"./XPFVT2EA.js";import{a as i}from"./5YS5V2LK.js";import{encodeAbiParameters as le,encodeFunctionData as Y,erc20Abi as K,getAddress as G,isAddress as se,keccak256 as W,parseAbi as ce,parseAbiParameters as me,zeroAddress as J}from"viem";var x=F,S=G(q[x].hoodlock.airdrop.address),Z="https://hoodlock.tech",P=25e4,ue=256,ye=604800n,ge=30n,V=250000000000000000n,X=0xffffffffn,fe=(1n<<64n)-1n,ee=(1n<<128n)-1n,oe="0x0000000000000000000000000000000000000000000000000000000000000000",pe="0x1111111111111111111111111111111111111111",be=me("uint256, address, uint256"),H=ce(["function quote(uint32 maxClaims) view returns (uint256)","function create(address token, bytes32 merkleRoot, uint256 total, uint32 maxClaims, uint64 endTime, string uri) payable returns (uint256 id)","function claim(uint256 id, uint256 index, address account, uint256 amount, bytes32[] proof)","function getAirdrop(uint256 id) view returns (address creator, uint64 endTime, uint32 maxClaims, address token, uint32 claims, bool swept, bytes32 merkleRoot, uint128 total, uint128 remaining)","function isClaimed(uint256 id, uint256 index) view returns (bool)"]);function xe(o,e,t){let n=e.trim();if(n.startsWith("-")){let r=n.slice(1);return`-${o.formatAmount(r,t)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,t)}function ne(o,e){if(!e.changes.length)return e.summary;let t=e.changes.map(n=>`${xe(o,n.amount,n.token.decimals)} ${n.token.symbol}`).join(", ");return`${e.summary} (${t})`}async function Ae(o,e){try{let[t,n]=await Promise.all([o.readContract({address:e,abi:K,functionName:"symbol"}),o.readContract({address:e,abi:K,functionName:"decimals"})]),d=typeof t=="string"&&t.trim()?t.trim():"TOKEN",r=Number(n);return{symbol:d,decimals:Number.isInteger(r)&&r>=0&&r<=255?r:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,t){if(typeof e=="string"&&e.includes(".")){if(t?.decimals===void 0)throw new i(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=t.rounding!==void 0?M(e,t.decimals,t.rounding):o?o.parseAmount(e,t.decimals):M(e,t.decimals),r=D(d);if(r<=0n)throw new i("Airdrop entry amount must be positive.");return r}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=D(e.trim());else throw new i("Amount must be a non-negative integer string in base units.")}catch(d){throw d instanceof i?d:new i(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new i("Airdrop entry amount must be strictly positive (> 0).");return n}function I(o,e){try{let t=typeof o=="bigint"?o:BigInt(String(o).trim());if(t<0n)throw new i(`${e} must be non-negative.`);return t}catch(t){throw t instanceof i?t:new i(`Invalid ${e}: ${String(o)}`,{cause:t})}}function A(o,e){if(typeof o!="string"||!se(o,{strict:!1}))throw new i(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return G(o)}function N(o,e,t){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>X)throw new i(`Airdrop leaf index must be in 0..${X.toString()}.`);let d=A(e,"account"),r=w(void 0,t),s=le(be,[n,d,r]);return W(W(s))}function te(o,e){let t=o;for(let n of e)t=O(t,n);return t}function De(o){try{let e=N(o.index,o.account,o.amount),t=te(e,o.proof);return $(t,o.root)}catch{return!1}}function L(o,e){if(!Array.isArray(o)||o.length===0)throw new i("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new i(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let t=[],n=0n;for(let a=0;a<o.length;a+=1){let l=o[a];if(!l)throw new i(`Missing airdrop entry at position ${a}.`);let c=l.index??a;if(!Number.isInteger(c)||c!==a)throw new i(`Airdrop entry index at position ${a} must be contiguous ${a} (got ${String(c)}).`);let u=A(l.account,`entries[${a}].account`),g=w(e?.context,l.amount,e);n+=g,t.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ee)throw new i("Airdrop total amount must be > 0 and fit in uint128.");let d=t.map(a=>N(a.index,a.account,a.amount)),r=[d];for(;r[r.length-1].length>1;){let a=r[r.length-1],l=[];for(let c=0;c<a.length;c+=2){let u=a[c],g=a[c+1];g===void 0?l.push(u):l.push(O(u,g))}r.push(l)}let s=r[r.length-1][0];if(s.toLowerCase()===oe)throw new i("Computed Merkle root cannot be zero.");let f=r.length>1?r[1]:r[0],m=t.map((a,l)=>{let c=[],u=l;for(let g=0;g<r.length-1;g+=1){let y=r[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:a.index,account:a.account,amount:a.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:t.length,values:t.map(a=>[a.index,a.account,a.amount]),entries:t};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:t.length,entries:t,proofs:m,list:p}}function he(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new i("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,r])=>({index:n,account:d,amount:r})),t=L(e);if(o.root&&!$(t.root,o.root))throw new i(`Rebuilt tree root ${t.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&t.maxClaims!==o.maxClaims)throw new i(`Rebuilt maxClaims (${t.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&t.totalAmount!==o.totalAmount)throw new i(`Rebuilt totalAmount (${t.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return t}async function re(o,e){return z(o.http,e,{method:"GET"},t=>t!==null&&typeof t=="object")}async function we(o,e,t){let n=A(e.token,"token");if(n===J)throw new i("Airdrop token cannot be the zero address.");let d=L(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),r=e.maxClaims??d.maxClaims;if(!Number.isInteger(r)||r<1||r>P||r!==d.maxClaims)throw new i(`maxClaims (${String(r)}) must equal entries.length (${d.maxClaims}) and be in 1..${P}.`);let s=BigInt(d.totalAmount),f=e.total!==void 0?w(o,e.total,{decimals:e.decimals,rounding:e.rounding}):s;if(f<s)throw new i(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ee)throw new i("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ue)throw new i(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let a=e.endTime!==void 0?I(e.endTime,"endTime"):0n;if(a>fe)throw new i("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new i(`Token ${n} has no contract code on chain ${x}.`);let u;if(a!==0n){let R=(await l.getBlock()).timestamp,U=e.inclusionMargin!==void 0?I(e.inclusionMargin,"inclusionMargin"):ge;if(U<=0n)throw new i("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let _=R+U,v=e.inclusionTime!==void 0?I(e.inclusionTime,"inclusionTime"):_;if(v<_)throw new i(`inclusionTime (${v.toString()}) must be after the already-mined block (${R.toString()}) with room for signing and inclusion (>= ${_.toString()}).`);u=v;let B=v+ye;if(a<B)throw new i(`endTime (${a.toString()}) is too short (window too short): must be 0 or at least inclusion time (${v.toString()}) + 604800 (7 days >= ${B.toString()}, after already-mined block.timestamp ${R.toString()}).`)}let g=await l.readContract({address:S,abi:H,functionName:"quote",args:[r]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>V)throw new i(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${V.toString()}).`);let b=o.formatAmount(y.toString(),j.decimals),h=o.approval(n,S,f.toString(),x),k=o.unsignedTx({chainId:x,to:S,data:Y({abi:H,functionName:"create",args:[n,d.root,f,r,a,m]}),value:y.toString(),description:`Create HoodLock airdrop (${r} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),C=[h,k],T=A(e.account??t??pe,"wallet"),E=await o.preview(C,T),ae=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",de=`${ne(o,E)}${ae}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:r,endTime:a,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:C,preview:E,summary:de}}async function Q(o,e,t,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==t)throw new i(`savedProof account (${m}) does not match claim account (${t}).`);return{index:n.savedProof.index,amount:w(o,n.savedProof.amount),proof:n.savedProof.proof}}if(n.proof!==void 0&&n.index!==void 0&&n.amount!==void 0){let m=Number(n.index);if(!Number.isInteger(m)||m<0)throw new i(`Invalid claim index: ${String(n.index)}`);return{index:m,amount:w(o,n.amount),proof:n.proof}}if(n.list||n.entries){let p=(n.list?he(n.list):L(n.entries,{context:o})).proofs.find(a=>!(!$(a.account,t)||n.index!==void 0&&a.index!==Number(n.index)));if(!p)throw new i(`Account ${t} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${Z}/api/airdrop/${e.toString()}/proof?address=${t}`,r=await re(o,d),s=r?.data??r;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new i(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${t}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new i(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function ie(o,e){let t=o.clientFor(x),n=await t.readContract({address:S,abi:H,functionName:"getAirdrop",args:[e.id]}),[d,r,s,f,m,p,a,,l]=n,c=BigInt(r),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===J||a.toLowerCase()===oe)throw new i(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new i(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await t.getBlock()).timestamp>=c)throw new i(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new i(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([t.readContract({address:S,abi:H,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),Ae(t,b)]);if(h)throw new i(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new i(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let C=N(e.index,e.account,e.amount),T=te(C,e.proof);if(!$(T,a))throw new i(`Computed Merkle root ${T} does not match on-chain airdrop root ${a} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:a,leaf:C}}async function ke(o,e){let{tokenAddress:t,tokenMeta:n,merkleRoot:d,leaf:r}=await ie(o,e),s=e.caller??e.account,f=!$(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:S,data:Y({abi:H,functionName:"claim",args:[e.id,BigInt(e.index),e.account,e.amount,[...e.proof]]}),value:"0",description:f?`Claim ${m} ${n.symbol} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for recipient ${e.account} (caller ${s} pays gas only, token delta 0)`:`Claim ${m} ${n.symbol} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for ${e.account}`}),a=[p],l=await o.preview(a,s),c,u,g=e.amount.toString(),y;if(f){let b=l.changes.filter(h=>h.amount.trim().startsWith("-"));c={...l,changes:b,summary:`${l.summary} Recipient ${e.account} receives ${m} ${n.symbol} (${e.amount.toString()} base units); caller ${s} change is 0 (gas only).`},u=`Third-party claim from HoodLock airdrop #${e.id.toString()} (index ${e.index}): recipient ${e.account} receives ${m} ${n.symbol} (${e.amount.toString()} base units of ${t}); caller ${s} own token change is 0 (gas only). ${l.summary}`,y="0"}else c=l,u=`Claim ${m} ${n.symbol} (${e.amount.toString()} base units of ${t}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${ne(o,c)}`,y=e.amount.toString();return{kind:"hoodlock_airdrop_claim",chainId:x,id:e.id,index:e.index,account:e.account,recipient:e.account,caller:e.caller,token:t,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:r,merkleRoot:d,proof:[...e.proof],tx:p,txs:a,preview:c,summary:u}}async function $e(o,e,t){let n=A(e.account??t??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):t!==void 0?A(t,"wallet"):void 0;if(e.id!==void 0){let l=I(e.id,"id"),c=await Q(o,l,n,e);return ke(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let r=`${Z}/api/airdrop/eligible?address=${n}`,s=await re(o,r),f=Array.isArray(s)?s:s?.claimable??s?.eligible??s?.airdrops??s?.claims??[],m=[];for(let l of f){let c=l.id??l.airdropId;if(c!==void 0)try{let u=I(c,"eligible.id"),g,y,b;if(l.index!==void 0&&l.amount!==void 0&&Array.isArray(l.proof))g=Number(l.index),y=w(o,l.amount),b=l.proof;else{let k=await Q(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await ie(o,{id:u,index:g,account:n,amount:y,proof:b});m.push({id:u.toString(),index:g,account:n,token:h.tokenAddress,amount:y.toString(),proof:[...b],merkleRoot:h.merkleRoot})}catch{continue}}let p=m.length===0?`No verified eligible HoodLock airdrops were returned by the index for ${n}. Discovery can lag after creation; this does not prove there are no claims. If you know the airdrop id, call hoodlock_airdrop_claim with id and account to resolve its list/proof and verify it on-chain.`:`Found ${m.length} eligible HoodLock airdrop(s) for ${n}: ${m.map(l=>`#${l.id}`).join(", ")}. Discovery can lag after creation. Choose an id, or pass a known new id, to hoodlock_airdrop_claim to verify and build a claim transaction.`;return{kind:"hoodlock_airdrop_eligible",chainId:x,account:n,recipient:n,caller:d,recipientDelta:"0",senderDelta:"0",eligible:m,claims:[],tx:void 0,txs:[],preview:{txs:[],changes:[],summary:p},summary:p}}var Se=o=>({tools:[{name:"hoodlock_airdrop_create",inputSchema:{type:"object",required:["token","entries"],additionalProperties:!1,properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663"},entries:{type:"array",description:"Ordered airdrop entries [{ index?, account, amount }] with base-unit integer string amounts"},total:{type:"string",description:"Optional total funded token amount as a base-unit integer string (>= sum of entries)"},maxClaims:{type:"number",description:"Optional claim count (must equal entries.length in 1..250000)"},endTime:{type:"number",description:"Unix timestamp in seconds (0 for non-sweepable or >= inclusion time + 604800)"},inclusionTime:{type:"number",description:"Optional expected transaction inclusion Unix timestamp in seconds (> already-mined block.timestamp)"},inclusionMargin:{type:"number",description:"Optional signing and inclusion margin in seconds above the already-mined block.timestamp (>= 1, default 30)"},uri:{type:"string",description:"Metadata URI (<= 256 UTF-8 bytes)"},decimals:{type:"number",description:"Optional token decimals when converting human decimal entry amounts via parseAmount"},rounding:{type:"string",enum:["floor","ceil"],description:"Optional rounding mode (floor or ceil) when converting decimal amounts"},account:{type:"string",description:"Optional creator wallet address for preview simulation"}}},execute:async(e,t)=>we(o,e,t)},{name:"hoodlock_airdrop_claim",inputSchema:{type:"object",required:["account"],additionalProperties:!1,properties:{id:{type:"string",description:"Optional airdrop ID (omit to query eligible airdrops)"},account:{type:"string",description:"Leaf recipient address that receives the tokens"},caller:{type:"string",description:"Optional caller/relayer address submitting the tx (pays gas only, receives 0 tokens)"},index:{type:"number",description:"Optional leaf index when supplying proof directly or selecting from list/entries"},amount:{type:"string",description:"Optional leaf amount as a base-unit integer string"},proof:{type:"array",items:{type:"string"},description:"Optional Merkle sibling proof array of 32-byte hex strings"},savedProof:{type:"object",description:"Optional saved proof item ({ index, account, amount, leaf?, proof }) from hoodlock_airdrop_create"},list:{type:"object",description:"Optional saved airdrop list ({ format, leafEncoding, root, totalAmount, maxClaims, values, entries }) to rebuild proof locally"},entries:{type:"array",description:"Optional airdrop entries array ([{ index?, account, amount }]) to rebuild proof locally"}}},execute:async(e,t)=>$e(o,e,t)}]}),Me=Se;export{K as a,x as b,S as c,Z as d,P as e,ue as f,ye as g,ge as h,V as i,H as j,xe as k,N as l,te as m,De as n,L as o,he as p,Se as q,Me as r};
|
|
1
|
+
import{b as j}from"./JPOYTTTW.js";import{c as z}from"./MYBDO5SA.js";import{d as O}from"./VXLJRRKV.js";import{g as $}from"./73N3TOJL.js";import{a as D,b as M}from"./RETS2ZEK.js";import{a as F,i as q}from"./G6HCV67X.js";import{a as i}from"./5YS5V2LK.js";import{encodeAbiParameters as le,encodeFunctionData as Y,erc20Abi as K,getAddress as G,isAddress as se,keccak256 as W,parseAbi as ce,parseAbiParameters as me,zeroAddress as J}from"viem";var x=F,S=G(q[x].hoodlock.airdrop.address),Z="https://hoodlock.tech",P=25e4,ue=256,ye=604800n,ge=30n,V=250000000000000000n,X=0xffffffffn,fe=(1n<<64n)-1n,ee=(1n<<128n)-1n,oe="0x0000000000000000000000000000000000000000000000000000000000000000",pe="0x1111111111111111111111111111111111111111",be=me("uint256, address, uint256"),H=ce(["function quote(uint32 maxClaims) view returns (uint256)","function create(address token, bytes32 merkleRoot, uint256 total, uint32 maxClaims, uint64 endTime, string uri) payable returns (uint256 id)","function claim(uint256 id, uint256 index, address account, uint256 amount, bytes32[] proof)","function getAirdrop(uint256 id) view returns (address creator, uint64 endTime, uint32 maxClaims, address token, uint32 claims, bool swept, bytes32 merkleRoot, uint128 total, uint128 remaining)","function isClaimed(uint256 id, uint256 index) view returns (bool)"]);function xe(o,e,t){let n=e.trim();if(n.startsWith("-")){let r=n.slice(1);return`-${o.formatAmount(r,t)}`}let d=n.startsWith("+")?n.slice(1):n;return o.formatAmount(d,t)}function ne(o,e){if(!e.changes.length)return e.summary;let t=e.changes.map(n=>`${xe(o,n.amount,n.token.decimals)} ${n.token.symbol}`).join(", ");return`${e.summary} (${t})`}async function Ae(o,e){try{let[t,n]=await Promise.all([o.readContract({address:e,abi:K,functionName:"symbol"}),o.readContract({address:e,abi:K,functionName:"decimals"})]),d=typeof t=="string"&&t.trim()?t.trim():"TOKEN",r=Number(n);return{symbol:d,decimals:Number.isInteger(r)&&r>=0&&r<=255?r:18}}catch{return{symbol:"TOKEN",decimals:18}}}function w(o,e,t){if(typeof e=="string"&&e.includes(".")){if(t?.decimals===void 0)throw new i(`Decimal string amount "${e}" requires explicit token decimals; amount inputs are base-unit integer strings by default.`);let d=t.rounding!==void 0?M(e,t.decimals,t.rounding):o?o.parseAmount(e,t.decimals):M(e,t.decimals),r=D(d);if(r<=0n)throw new i("Airdrop entry amount must be positive.");return r}let n;try{if(typeof e=="bigint")n=e;else if(typeof e=="string")n=D(e.trim());else throw new i("Amount must be a non-negative integer string in base units.")}catch(d){throw d instanceof i?d:new i(`Invalid airdrop amount "${String(e)}".`,{cause:d})}if(n<=0n)throw new i("Airdrop entry amount must be strictly positive (> 0).");return n}function I(o,e){try{let t=typeof o=="bigint"?o:BigInt(String(o).trim());if(t<0n)throw new i(`${e} must be non-negative.`);return t}catch(t){throw t instanceof i?t:new i(`Invalid ${e}: ${String(o)}`,{cause:t})}}function A(o,e){if(typeof o!="string"||!se(o,{strict:!1}))throw new i(`Invalid ${e} address "${String(o)}": token/account must be a valid EVM address, never a symbol.`);return G(o)}function N(o,e,t){let n=typeof o=="bigint"?o:BigInt(o);if(n<0n||n>X)throw new i(`Airdrop leaf index must be in 0..${X.toString()}.`);let d=A(e,"account"),r=w(void 0,t),s=le(be,[n,d,r]);return W(W(s))}function te(o,e){let t=o;for(let n of e)t=O(t,n);return t}function De(o){try{let e=N(o.index,o.account,o.amount),t=te(e,o.proof);return $(t,o.root)}catch{return!1}}function L(o,e){if(!Array.isArray(o)||o.length===0)throw new i("Airdrop entries list cannot be empty; maxClaims must be in 1..250000.");if(o.length>P)throw new i(`Airdrop entries length (${o.length}) exceeds maxClaims limit of ${P}.`);let t=[],n=0n;for(let a=0;a<o.length;a+=1){let l=o[a];if(!l)throw new i(`Missing airdrop entry at position ${a}.`);let c=l.index??a;if(!Number.isInteger(c)||c!==a)throw new i(`Airdrop entry index at position ${a} must be contiguous ${a} (got ${String(c)}).`);let u=A(l.account,`entries[${a}].account`),g=w(e?.context,l.amount,e);n+=g,t.push({index:c,account:u,amount:g.toString()})}if(n<=0n||n>ee)throw new i("Airdrop total amount must be > 0 and fit in uint128.");let d=t.map(a=>N(a.index,a.account,a.amount)),r=[d];for(;r[r.length-1].length>1;){let a=r[r.length-1],l=[];for(let c=0;c<a.length;c+=2){let u=a[c],g=a[c+1];g===void 0?l.push(u):l.push(O(u,g))}r.push(l)}let s=r[r.length-1][0];if(s.toLowerCase()===oe)throw new i("Computed Merkle root cannot be zero.");let f=r.length>1?r[1]:r[0],m=t.map((a,l)=>{let c=[],u=l;for(let g=0;g<r.length-1;g+=1){let y=r[g],b=u^1;b<y.length&&c.push(y[b]),u=Math.floor(u/2)}return{index:a.index,account:a.account,amount:a.amount,leaf:d[l],proof:c}}),p={format:"openzeppelin-standard-merkle-tree-v1",leafEncoding:["uint256","address","uint256"],root:s,totalAmount:n.toString(),maxClaims:t.length,values:t.map(a=>[a.index,a.account,a.amount]),entries:t};return{root:s,leaves:d,level1:f,totalAmount:n.toString(),maxClaims:t.length,entries:t,proofs:m,list:p}}function he(o){if(!o||!Array.isArray(o.entries)&&!Array.isArray(o.values))throw new i("Saved airdrop list is missing entries/values.");let e=Array.isArray(o.entries)&&o.entries.length>0?o.entries:o.values.map(([n,d,r])=>({index:n,account:d,amount:r})),t=L(e);if(o.root&&!$(t.root,o.root))throw new i(`Rebuilt tree root ${t.root} does not match saved list root ${o.root}.`);if(o.maxClaims!==void 0&&t.maxClaims!==o.maxClaims)throw new i(`Rebuilt maxClaims (${t.maxClaims}) does not match saved list maxClaims (${o.maxClaims}).`);if(o.totalAmount!==void 0&&t.totalAmount!==o.totalAmount)throw new i(`Rebuilt totalAmount (${t.totalAmount}) does not match saved list totalAmount (${o.totalAmount}).`);return t}async function re(o,e){return z(o.http,e,{method:"GET"},t=>t!==null&&typeof t=="object")}async function we(o,e,t){let n=A(e.token,"token");if(n===J)throw new i("Airdrop token cannot be the zero address.");let d=L(e.entries,{decimals:e.decimals,rounding:e.rounding,context:o}),r=e.maxClaims??d.maxClaims;if(!Number.isInteger(r)||r<1||r>P||r!==d.maxClaims)throw new i(`maxClaims (${String(r)}) must equal entries.length (${d.maxClaims}) and be in 1..${P}.`);let s=BigInt(d.totalAmount),f=e.total!==void 0?w(o,e.total,{decimals:e.decimals,rounding:e.rounding}):s;if(f<s)throw new i(`Airdrop total (${f.toString()}) is less than the sum of entry amounts (${s.toString()}).`);if(f<=0n||f>ee)throw new i("Airdrop total must be positive and fit in uint128.");let m=e.uri??"",p=new TextEncoder().encode(m).byteLength;if(p>ue)throw new i(`Airdrop URI length (${p} bytes) exceeds 256-byte limit.`);let a=e.endTime!==void 0?I(e.endTime,"endTime"):0n;if(a>fe)throw new i("endTime exceeds uint64 maximum.");let l=o.clientFor(x),c=await l.getCode({address:n});if(!c||c==="0x")throw new i(`Token ${n} has no contract code on chain ${x}.`);let u;if(a!==0n){let R=(await l.getBlock()).timestamp,U=e.inclusionMargin!==void 0?I(e.inclusionMargin,"inclusionMargin"):ge;if(U<=0n)throw new i("inclusionMargin must be at least 1 second to leave room for signing and inclusion after the already-mined block.");let _=R+U,v=e.inclusionTime!==void 0?I(e.inclusionTime,"inclusionTime"):_;if(v<_)throw new i(`inclusionTime (${v.toString()}) must be after the already-mined block (${R.toString()}) with room for signing and inclusion (>= ${_.toString()}).`);u=v;let B=v+ye;if(a<B)throw new i(`endTime (${a.toString()}) is too short (window too short): must be 0 or at least inclusion time (${v.toString()}) + 604800 (7 days >= ${B.toString()}, after already-mined block.timestamp ${R.toString()}).`)}let g=await l.readContract({address:S,abi:H,functionName:"quote",args:[r]}),y=typeof g=="bigint"?g:BigInt(String(g));if(y<0n||y>V)throw new i(`HoodLock quote(uint32) fee (${y.toString()}) exceeds max fee cap (${V.toString()}).`);let b=o.formatAmount(y.toString(),j.decimals),h=o.approval(n,S,f.toString(),x),k=o.unsignedTx({chainId:x,to:S,data:Y({abi:H,functionName:"create",args:[n,d.root,f,r,a,m]}),value:y.toString(),description:`Create HoodLock airdrop (${r} claims, total ${f.toString()}, quote fee ${b} ETH (${y.toString()} wei))`}),C=[h,k],T=A(e.account??t??pe,"wallet"),E=await o.preview(C,T),ae=y>0n?` Quote fee: -${b} ETH (${b} ETH / ${y.toString()} wei).`:" Quote fee: 0 ETH (0 wei).",de=`${ne(o,E)}${ae}`;return{kind:"hoodlock_airdrop_create",chainId:x,token:n,merkleRoot:d.root,totalAmount:d.totalAmount,total:f.toString(),maxClaims:r,endTime:a,...u!==void 0?{inclusionTime:u}:{},uri:m,quoteFee:y,list:d.list,proofs:d.proofs,txs:C,preview:E,summary:de}}async function Q(o,e,t,n){if(n.savedProof){let m=A(n.savedProof.account,"savedProof.account");if(m!==t)throw new i(`savedProof account (${m}) does not match claim account (${t}).`);return{index:n.savedProof.index,amount:w(o,n.savedProof.amount),proof:n.savedProof.proof}}if(n.proof!==void 0&&n.index!==void 0&&n.amount!==void 0){let m=Number(n.index);if(!Number.isInteger(m)||m<0)throw new i(`Invalid claim index: ${String(n.index)}`);return{index:m,amount:w(o,n.amount),proof:n.proof}}if(n.list||n.entries){let p=(n.list?he(n.list):L(n.entries,{context:o})).proofs.find(a=>!(!$(a.account,t)||n.index!==void 0&&a.index!==Number(n.index)));if(!p)throw new i(`Account ${t} was not found in the saved airdrop list.`);return{index:p.index,amount:w(o,p.amount),proof:p.proof}}let d=`${Z}/api/airdrop/${e.toString()}/proof?address=${t}`,r=await re(o,d),s=r?.data??r;if(!s||s.index===void 0||s.amount===void 0||!Array.isArray(s.proof))throw new i(`No valid proof returned from HoodLock API for airdrop ${e.toString()} and account ${t}.`);let f=Number(s.index);if(!Number.isInteger(f)||f<0)throw new i(`Invalid index in API proof: ${String(s.index)}`);return{index:f,amount:w(o,s.amount),proof:s.proof}}async function ie(o,e){let t=o.clientFor(x),n=await t.readContract({address:S,abi:H,functionName:"getAirdrop",args:[e.id]}),[d,r,s,f,m,p,a,,l]=n,c=BigInt(r),u=Number(s),g=Number(m),y=BigInt(l),b=A(f,"airdrop.token");if(d===J||a.toLowerCase()===oe)throw new i(`Airdrop ${e.id.toString()} does not exist.`);if(p)throw new i(`Airdrop ${e.id.toString()} has already been swept.`);if(c>0n&&(await t.getBlock()).timestamp>=c)throw new i(`Airdrop ${e.id.toString()} expired at timestamp ${c.toString()}.`);if(g>=u)throw new i(`Airdrop ${e.id.toString()} has reached maxClaims (${u}).`);let[h,k]=await Promise.all([t.readContract({address:S,abi:H,functionName:"isClaimed",args:[e.id,BigInt(e.index)]}),Ae(t,b)]);if(h)throw new i(`Airdrop ${e.id.toString()} index ${e.index} has already been claimed.`);if(y<e.amount)throw new i(`Airdrop ${e.id.toString()} remaining balance (${y.toString()}) is less than claim amount (${e.amount.toString()}).`);let C=N(e.index,e.account,e.amount),T=te(C,e.proof);if(!$(T,a))throw new i(`Computed Merkle root ${T} does not match on-chain airdrop root ${a} (bad proof).`);return{tokenAddress:b,tokenMeta:k,merkleRoot:a,leaf:C}}async function ke(o,e){let{tokenAddress:t,tokenMeta:n,merkleRoot:d,leaf:r}=await ie(o,e),s=e.caller??e.account,f=!$(s,e.account),m=o.formatAmount(e.amount.toString(),n.decimals),p=o.unsignedTx({chainId:x,to:S,data:Y({abi:H,functionName:"claim",args:[e.id,BigInt(e.index),e.account,e.amount,[...e.proof]]}),value:"0",description:f?`Claim ${m} ${n.symbol} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for recipient ${e.account} (caller ${s} pays gas only, token delta 0)`:`Claim ${m} ${n.symbol} (${e.amount.toString()} base units) from HoodLock airdrop #${e.id.toString()} for ${e.account}`}),a=[p],l=await o.preview(a,s),c,u,g=e.amount.toString(),y;if(f){let b=l.changes.filter(h=>h.amount.trim().startsWith("-"));c={...l,changes:b,summary:`${l.summary} Recipient ${e.account} receives ${m} ${n.symbol} (${e.amount.toString()} base units); caller ${s} change is 0 (gas only).`},u=`Third-party claim from HoodLock airdrop #${e.id.toString()} (index ${e.index}): recipient ${e.account} receives ${m} ${n.symbol} (${e.amount.toString()} base units of ${t}); caller ${s} own token change is 0 (gas only). ${l.summary}`,y="0"}else c=l,u=`Claim ${m} ${n.symbol} (${e.amount.toString()} base units of ${t}) from HoodLock airdrop #${e.id.toString()} (index ${e.index}) for recipient ${e.account}. ${ne(o,c)}`,y=e.amount.toString();return{kind:"hoodlock_airdrop_claim",chainId:x,id:e.id,index:e.index,account:e.account,recipient:e.account,caller:e.caller,token:t,amount:e.amount.toString(),recipientDelta:g,senderDelta:y,leaf:r,merkleRoot:d,proof:[...e.proof],tx:p,txs:a,preview:c,summary:u}}async function $e(o,e,t){let n=A(e.account??t??"","account"),d=e.caller!==void 0?A(e.caller,"caller"):t!==void 0?A(t,"wallet"):void 0;if(e.id!==void 0){let l=I(e.id,"id"),c=await Q(o,l,n,e);return ke(o,{id:l,index:c.index,account:n,caller:d,amount:c.amount,proof:c.proof})}let r=`${Z}/api/airdrop/eligible?address=${n}`,s=await re(o,r),f=Array.isArray(s)?s:s?.claimable??s?.eligible??s?.airdrops??s?.claims??[],m=[];for(let l of f){let c=l.id??l.airdropId;if(c!==void 0)try{let u=I(c,"eligible.id"),g,y,b;if(l.index!==void 0&&l.amount!==void 0&&Array.isArray(l.proof))g=Number(l.index),y=w(o,l.amount),b=l.proof;else{let k=await Q(o,u,n,{id:u,account:n});g=k.index,y=k.amount,b=k.proof}let h=await ie(o,{id:u,index:g,account:n,amount:y,proof:b});m.push({id:u.toString(),index:g,account:n,token:h.tokenAddress,amount:y.toString(),proof:[...b],merkleRoot:h.merkleRoot})}catch{continue}}let p=m.length===0?`No verified eligible HoodLock airdrops were returned by the index for ${n}. Discovery can lag after creation; this does not prove there are no claims. If you know the airdrop id, call hoodlock_airdrop_claim with id and account to resolve its list/proof and verify it on-chain.`:`Found ${m.length} eligible HoodLock airdrop(s) for ${n}: ${m.map(l=>`#${l.id}`).join(", ")}. Discovery can lag after creation. Choose an id, or pass a known new id, to hoodlock_airdrop_claim to verify and build a claim transaction.`;return{kind:"hoodlock_airdrop_eligible",chainId:x,account:n,recipient:n,caller:d,recipientDelta:"0",senderDelta:"0",eligible:m,claims:[],tx:void 0,txs:[],preview:{txs:[],changes:[],summary:p},summary:p}}var Se=o=>({tools:[{name:"hoodlock_airdrop_create",inputSchema:{type:"object",required:["token","entries"],additionalProperties:!1,properties:{token:{type:"string",description:"ERC-20 token contract address on chain 4663"},entries:{type:"array",description:"Ordered airdrop entries [{ index?, account, amount }] with base-unit integer string amounts"},total:{type:"string",description:"Optional total funded token amount as a base-unit integer string (>= sum of entries)"},maxClaims:{type:"number",description:"Optional claim count (must equal entries.length in 1..250000)"},endTime:{type:"number",description:"Unix timestamp in seconds (0 for non-sweepable or >= inclusion time + 604800)"},inclusionTime:{type:"number",description:"Optional expected transaction inclusion Unix timestamp in seconds (> already-mined block.timestamp)"},inclusionMargin:{type:"number",description:"Optional signing and inclusion margin in seconds above the already-mined block.timestamp (>= 1, default 30)"},uri:{type:"string",description:"Metadata URI (<= 256 UTF-8 bytes)"},decimals:{type:"number",description:"Optional token decimals when converting human decimal entry amounts via parseAmount"},rounding:{type:"string",enum:["floor","ceil"],description:"Optional rounding mode (floor or ceil) when converting decimal amounts"},account:{type:"string",description:"Optional creator wallet address for preview simulation"}}},execute:async(e,t)=>we(o,e,t)},{name:"hoodlock_airdrop_claim",inputSchema:{type:"object",required:["account"],additionalProperties:!1,properties:{id:{type:"string",description:"Optional airdrop ID (omit to query eligible airdrops)"},account:{type:"string",description:"Leaf recipient address that receives the tokens"},caller:{type:"string",description:"Optional caller/relayer address submitting the tx (pays gas only, receives 0 tokens)"},index:{type:"number",description:"Optional leaf index when supplying proof directly or selecting from list/entries"},amount:{type:"string",description:"Optional leaf amount as a base-unit integer string"},proof:{type:"array",items:{type:"string"},description:"Optional Merkle sibling proof array of 32-byte hex strings"},savedProof:{type:"object",description:"Optional saved proof item ({ index, account, amount, leaf?, proof }) from hoodlock_airdrop_create"},list:{type:"object",description:"Optional saved airdrop list ({ format, leafEncoding, root, totalAmount, maxClaims, values, entries }) to rebuild proof locally"},entries:{type:"array",description:"Optional airdrop entries array ([{ index?, account, amount }]) to rebuild proof locally"}}},execute:async(e,t)=>$e(o,e,t)}]}),Me=Se;export{K as a,x as b,S as c,Z as d,P as e,ue as f,ye as g,ge as h,V as i,H as j,xe as k,N as l,te as m,De as n,L as o,he as p,Se as q,Me as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as G}from"./
|
|
1
|
+
import{b as G}from"./TCPPYBGQ.js";import{a as p}from"./6IM6A5VA.js";import{a as W}from"./UWOFA6GV.js";import{g as P}from"./73N3TOJL.js";import{a as T}from"./RETS2ZEK.js";import{a as w,d as R,i as B}from"./G6HCV67X.js";import{a as o}from"./5YS5V2LK.js";import{encodeFunctionData as h,getAddress as L,parseAbi as x}from"viem";var y={address:L("0x451b42a15100c340ca12f7c66de06fac5ea2d751"),symbol:"BOW",decimals:18,chainId:w},u=L("0xeba502e1177f5fad9432c2deb273569d8381e01a"),b={address:B[w].tokens.USDG.address,symbol:"USDG",decimals:R,chainId:w},i=x(["function stakingToken() view returns (address)","function rewardsToken() view returns (address)","function balanceOf(address account) view returns (uint256)","function earned(address account) view returns (uint256)","function stake(uint256 amount)","function withdraw(uint256 amount)","function getReward()","function exit()","function cooldown() view returns (uint256)","function stakedAt(address) view returns (uint256)","function stakePaused() view returns (bool)","function totalSupply() view returns (uint256)","function rewardRate() view returns (uint256)","function rewardsDuration() view returns (uint256)","function periodFinish() view returns (uint256)","function owner() view returns (address)","function rewardsDistribution() view returns (address)","function notifyRewardAmount(uint256 reward)","function setRewardsDistribution(address distribution)","function setRewardsDuration(uint256 duration)","function setCooldown(uint256 cooldown)","function setStakePaused(bool paused)","function recoverERC20(address token,uint256 amount)","function transferOwnership(address newOwner)","function renounceOwnership()"]),X=m=>{async function D(n){try{return await n()}catch(t){throw new o(m.plainError(t))}}function A(n,t){if(Object.keys(n).some(e=>!t.includes(e)))throw new o("Unsupported Longbow staking input. Use the fields in the tool schema.")}async function U(){let n=m.clientFor(w);if(await n.getChainId()!==w)throw new o("Longbow requires a client on chain 4663.");let[t,e]=await Promise.all([n.readContract({address:u,abi:i,functionName:"stakingToken"}),n.readContract({address:u,abi:i,functionName:"rewardsToken"})]);if(typeof t!="string"||typeof e!="string"||!P(t,y.address)||!P(e,b.address))throw new o("Longbow staking does not report the pinned BOW stake and USDG reward tokens.");return n}async function S(n){let t=await U(),[e,a,s]=await Promise.all([t.readContract({address:u,abi:i,functionName:"balanceOf",args:[n]}),t.readContract({address:u,abi:i,functionName:"earned",args:[n]}),t.readContract({address:y.address,abi:i,functionName:"balanceOf",args:[n]})]);return{staked:e,earned:a,held:s,rpc:t}}async function v(n,t,e){let a=await m.preview(n,t),s=a.changes.map(({token:r,amount:d})=>{let c=d.startsWith("-");return`${c?"-":"+"}${m.formatAmount(c?d.slice(1):d,r.decimals)} ${r.symbol}`}).join(", ");return{txs:n,preview:a,summary:`${e} ${a.summary} ${s?`Estimated changes: ${s}. `:""}No transaction was sent.`}}let O=(n,t)=>m.unsignedTx({to:u,data:n,value:"0",chainId:w,description:t}),l=n=>m.formatAmount(n.toString(),y.decimals);async function _(n,t){if(A(n,["amount"]),p(t),typeof n.amount!="string")throw new o("Provide an integer BOW amount in base units (18 decimals).");let e=T(n.amount),{held:a,rpc:s}=await S(t),[r,d]=await Promise.all([s.readContract({address:u,abi:i,functionName:"cooldown"}),s.readContract({address:u,abi:i,functionName:"stakePaused"})]);if(d)throw new o("Longbow new stakes are paused; withdrawals and claims remain available.");if(e<=0n)throw new o("Stake amount must be positive.");if(e>a)throw new o(`Insufficient BOW: wallet holds ${a.toString()} base units, requested ${e.toString()}.`);return v([m.approval(y.address,u,e.toString(),w),O(h({abi:i,functionName:"stake",args:[e]}),`Stake ${l(e)} BOW in Longbow StakingRewards.`)],t,`Approve exactly ${l(e)} BOW, then stake it for USDG rewards. Current withdrawal cooldown: ${r} seconds; staking restarts that clock.`)}async function I(n,t){A(n,["amount"]),p(t);let{staked:e,earned:a,rpc:s}=await S(t),r=await s.readContract({address:u,abi:i,functionName:"cooldown"});if(r>0n){let[c,g]=await Promise.all([s.readContract({address:u,abi:i,functionName:"stakedAt",args:[t]}),s.getBlock()]);if(g.timestamp<c+r)throw new o(`Longbow unstaking cooldown ends at Unix second ${c+r}. Rewards can still be claimed.`)}if(e===0n)throw new o("This wallet has no BOW staked with Longbow.");if(n.amount==="all")return v([O(h({abi:i,functionName:"exit"}),`Unstake all ${l(e)} BOW and claim USDG rewards.`)],t,`Exit Longbow staking: return all ${l(e)} staked BOW and claim ${m.formatAmount(a.toString(),b.decimals)} USDG of earned rewards in one call.`);if(typeof n.amount!="string")throw new o('Provide an integer BOW amount in base units, or "all".');let d=T(n.amount);if(d<=0n||d>e)throw new o(`Unstake amount must be positive and at most the ${e.toString()} base units staked.`);return v([O(h({abi:i,functionName:"withdraw",args:[d]}),`Unstake ${l(d)} BOW.`)],t,`Unstake ${l(d)} BOW. Earned USDG rewards stay claimable with longbow_claim_rewards.`)}async function E(n,t){A(n,[]),p(t);let{earned:e}=await S(t);if(e===0n)throw new o("No Longbow staking rewards to claim for this wallet.");let a=m.formatAmount(e.toString(),b.decimals);return v([O(h({abi:i,functionName:"getReward"}),`Claim ${a} USDG of Longbow staking rewards.`)],t,`Claim ${a} USDG of earned Longbow staking rewards; staked BOW stays staked.`)}async function F(n){return D(async()=>{p(n);let{staked:t,earned:e}=await S(n);return t===0n&&e===0n?[]:[{module:"longbow",id:`${w}:${u.toLowerCase()}`,chainId:w,assets:[...t>0n?[{token:{...y},amount:t.toString()}]:[],...e>0n?[{token:{...b},amount:e.toString()}]:[]],description:`Longbow BOW staking: ${l(t)} BOW staked, ${m.formatAmount(e.toString(),b.decimals)} USDG rewards earned and claimable.`}]})}let $=(n,t,e,a)=>({name:n,inputSchema:{type:"object",properties:t,required:e,additionalProperties:!1},execute:(s,r)=>D(()=>a(s,r))});async function j(n,t){A(n,[]),p(t);let{staked:e,earned:a,held:s,rpc:r}=await S(t),d=["cooldown","stakePaused","totalSupply","rewardRate","rewardsDuration","periodFinish","owner","rewardsDistribution"],c=await Promise.all(d.map(f=>r.readContract({address:u,abi:i,functionName:f}))),g=await r.readContract({address:u,abi:i,functionName:"stakedAt",args:[t]});return{chainId:w,staking:u,stakeToken:y,rewardToken:b,staked:e.toString(),earned:a.toString(),walletBalance:s.toString(),stakedAt:g.toString(),...Object.fromEntries(d.map((f,k)=>[f,typeof c[k]=="bigint"?c[k].toString():c[k]])),rewardRateScale:"1000000000000000000",caveat:"rewardRate is USDG base units multiplied by 1e18 per second, not APY. Cooldown and pause state are owner-configurable."}}let C=[["notifyRewardAmount",["uint256"]],["setRewardsDistribution",["address"]],["setRewardsDuration",["uint256"]],["setCooldown",["uint256"]],["setStakePaused",["bool"]],["recoverERC20",["address","uint256"]],["transferOwnership",["address"]],["renounceOwnership",[]]];async function q(n,t){A(n,["operation","values","fund"]),p(t);let e=C.find(([f])=>f===n.operation);if(!e||!Array.isArray(n.values)||n.values.length!==e[1].length)throw new o("Choose a staking operation and its exact ordered values.");let a=e[1].map((f,k)=>G(f,n.values[k])),s=await U(),r=e[0]==="notifyRewardAmount",d=await s.readContract({address:u,abi:i,functionName:r?"rewardsDistribution":"owner"});if(!P(d,t))throw new o("This wallet lacks the Longbow staking owner/distribution role.");if(n.fund!==void 0&&(typeof n.fund!="boolean"||!r))throw new o("fund is a boolean available only for notifyRewardAmount.");let c=`Longbow staking ${e[0]}, values ${JSON.stringify(n.values)}.${e[0]==="renounceOwnership"?" Owner administration is permanently relinquished.":""}`,g=[];if(r&&n.fund===!0){let f=a[0];if(f===0n)throw new o("Reward funding must be positive.");let k=x(["function transfer(address,uint256) returns (bool)"]);g.push(m.unsignedTx({to:b.address,data:h({abi:k,functionName:"transfer",args:[u,f]}),value:"0",chainId:w,description:`Fund exactly ${f} USDG base units before notifying rewards.`}))}return g.push(O(h({abi:i,functionName:e[0],args:a}),c)),v(g,t,`${c} ${n.fund===!0?"Funding and notification are separate transactions. A failed notification leaves funded USDG in the staking contract.":""}`)}let N=W("Positive BOW amount in integer base units (18 decimals).");return{positions:F,tools:[$("longbow_staking_status",{},[],j),$("longbow_manage_staking",{operation:{enum:C.map(([n])=>n)},values:{type:"array",maxItems:2,items:{oneOf:[{type:"string"},{type:"boolean"}]}},fund:{type:"boolean"}},["operation","values"],q),$("longbow_stake",{amount:N},["amount"],_),$("longbow_unstake",{amount:{anyOf:[N,{const:"all",description:"Unstake everything and claim rewards in one exit() call."}]}},["amount"],I),$("longbow_claim_rewards",{},[],E)]}};export{y as a,u as b,X as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,d as T,e as p}from"./
|
|
1
|
+
import{a as d,d as T,e as p}from"./GGUEKSR4.js";import{a as S}from"./UWOFA6GV.js";import{a as r}from"./G6HCV67X.js";import{a as u}from"./5YS5V2LK.js";import{encodeFunctionData as k,erc20Abi as E,getAddress as m,parseAbi as I}from"viem";var e={router:m("0x888888888889758F76e7103c6CbF23ABbF58F946"),oracle:m("0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2"),market:m("0xc2b89e6eca583e2c232201ac557e9be58af55f4c"),pt:m("0x6982e39521A070a3C40782548bfBED6Dc8F566ef"),yt:m("0xF35Ee6bd9A93fE42BC7e628BFC4DDbdc6DE1f615"),expiry:1805932800n},$="(uint8 swapType,address extRouter,bytes extCalldata,bool needScale)",C="(uint256 salt,uint256 expiry,uint256 nonce,uint8 orderType,address token,address YT,address maker,address receiver,uint256 makingAmount,uint256 lnImpliedRate,uint256 failSafeRate,bytes permit)",w=`(${C} order,bytes signature,uint256 makingAmount)`,O=`(address limitRouter,uint256 epsSkipMarket,${w}[] normalFills,${w}[] flashFills,bytes optData)`,M=`(address tokenIn,uint256 netTokenIn,address tokenMintSy,address pendleSwap,${$} swapData)`,F=`(address tokenOut,uint256 minTokenOut,address tokenRedeemSy,address pendleSwap,${$} swapData)`,_="(uint256 guessMin,uint256 guessMax,uint256 guessOffchain,uint256 maxIteration,uint256 eps)",b=I([`function swapExactTokenForPt(address receiver,address market,uint256 minPtOut,${_} guessPtOut,${M} input,${O} limit) payable returns (uint256 netPtOut,uint256 netSyFee,uint256 netSyInterm)`,`function swapExactPtForToken(address receiver,address market,uint256 exactPtIn,${F} output,${O} limit) returns (uint256 netTokenOut,uint256 netSyFee,uint256 netSyInterm)`,`function redeemPyToToken(address receiver,address YT,uint256 netPyIn,${F} output) returns (uint256 netTokenOut,uint256 netSyInterm)`]),N=I(["function getPtToAssetRate(address market,uint32 duration) view returns (uint256)"]),h={address:e.pt,symbol:"PT-USDG",decimals:6,chainId:r},l="0x0000000000000000000000000000000000000000",D={swapType:0,extRouter:l,extCalldata:"0x",needScale:!1},A={limitRouter:l,epsSkipMarket:0n,normalFills:[],flashFills:[],optData:"0x"},B={guessMin:0n,guessMax:(1n<<256n)-1n,guessOffchain:0n,maxIteration:256n,eps:10n**14n},f=S("Exact USDG or PT base units (both 6 decimals).");function Y(i){let y=async()=>{if(i.network==="testnet")throw new u("Priors PT is configured only on chain 4663.");return i.clientFor(r).getBlock()};return{tools:[{name:"priors_pt_quote",inputSchema:{type:"object",properties:{side:{type:"string",enum:["buy","sell"]},amount:f},required:["side","amount"],additionalProperties:!1},async execute(n){let s=await y();if(s.timestamp>=e.expiry)throw new u("This PT market matured; use redemption.");let t=p(n.amount,"amount");if(t===0n||!["buy","sell"].includes(String(n.side)))throw new u("Provide buy or sell and a positive base-unit amount.");let a=await i.clientFor(r).readContract({address:e.oracle,abi:N,functionName:"getPtToAssetRate",args:[e.market,0]});if(a===0n)throw new u("PT oracle returned a zero rate.");return{chainId:r,token:h,market:e.market,blockNumber:s.number?.toString(),amountIn:t.toString(),estimatedOutput:(n.side==="buy"?t*10n**18n/a:t*a/10n**18n).toString(),rateE18:a.toString(),caveat:"Oracle spot estimate excludes own price impact and execution fees. Specify minOut explicitly and inspect the actual swap preview."}}},{name:"priors_pt_position",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(n,s){let t=await y(),a=await i.clientFor(r).readContract({address:e.pt,abi:E,functionName:"balanceOf",args:[m(s)]});return{token:h,balance:a.toString(),market:e.market,expiry:e.expiry.toString(),matured:t.timestamp>=e.expiry}}},...["buy","sell","redeem"].map(n=>({name:`priors_pt_${n}`,inputSchema:{type:"object",properties:{amount:f,minOut:f},required:["amount","minOut"],additionalProperties:!1},async execute(s,t){t=m(t);let a=await y(),x=a.timestamp>=e.expiry;if(n==="redeem"!==x)throw new u(x?"Market matured; redeem PT instead.":"PT redemption opens at maturity.");let o=p(s.amount,"amount"),c=p(s.minOut,"minOut");if(o===0n||c===0n)throw new u("amount and minOut must be positive base units.");let P={tokenOut:d.usdg,minTokenOut:c,tokenRedeemSy:d.usdg,pendleSwap:l,swapData:D},R=n==="buy"?k({abi:b,functionName:"swapExactTokenForPt",args:[t,e.market,c,B,{tokenIn:d.usdg,netTokenIn:o,tokenMintSy:d.usdg,pendleSwap:l,swapData:D},A]}):n==="sell"?k({abi:b,functionName:"swapExactPtForToken",args:[t,e.market,o,P,A]}):k({abi:b,functionName:"redeemPyToToken",args:[t,e.yt,o,P]}),g=[i.approval(n==="buy"?d.usdg:e.pt,e.router,o.toString(),r),i.unsignedTx({to:e.router,data:R,value:"0",chainId:r,description:`${n} PT-USDG, exact input ${o}, minimum output ${c} (6 decimals).`})],v=await i.preview(g,t);return{txs:g,summary:`Pendle PT ${n}: ${o} base units, minimum ${c}, receiver ${t}. No external aggregator. ${v.summary}`,terms:T({expiry:e.expiry,market:e.market})}}}))]}}export{e as a,b,Y as c};
|