@oakagentkit/core 0.3.0 → 0.3.1
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/history.js +1 -1
- package/build/dist/api/modules/beefy/clm.d.ts +9 -0
- 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/borro/index.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/chop/actions.js +1 -1
- package/build/dist/api/modules/chop/checks.js +1 -1
- package/build/dist/api/modules/chop/copy.js +1 -1
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- package/build/dist/api/modules/chop/pins.d.ts +13 -0
- package/build/dist/api/modules/chop/pins.js +1 -1
- package/build/dist/api/modules/chop/positions.js +1 -1
- package/build/dist/api/modules/chop/reader.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/earn/index.js +1 -1
- package/build/dist/api/modules/fobo/client.d.ts +9 -0
- package/build/dist/api/modules/fobo/client.js +1 -0
- package/build/dist/api/modules/fobo/index.d.ts +16 -0
- package/build/dist/api/modules/fobo/index.js +1 -0
- package/build/dist/api/modules/fobo/intent.d.ts +243 -0
- package/build/dist/api/modules/fobo/intent.js +1 -0
- package/build/dist/api/modules/fobo/pins.d.ts +178 -0
- package/build/dist/api/modules/fobo/pins.js +1 -0
- package/build/dist/api/modules/fobo/steps.d.ts +25 -0
- package/build/dist/api/modules/fobo/steps.js +1 -0
- package/build/dist/api/modules/fobo/verify.d.ts +89 -0
- package/build/dist/api/modules/fobo/verify.js +1 -0
- package/build/dist/api/modules/gloam/copy.d.ts +1 -1
- package/build/dist/api/modules/gloam/copy.js +1 -1
- package/build/dist/api/modules/gloam/index.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/create-cancel.js +1 -1
- package/build/dist/api/modules/hookr/discovery.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- package/build/dist/api/modules/hookr/launch.js +1 -1
- package/build/dist/api/modules/hookr/liquidity.js +1 -1
- package/build/dist/api/modules/hookr/lp-positions.js +1 -1
- package/build/dist/api/modules/hookr/lp-reads.js +1 -1
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/meridian/index.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/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.d.ts +2 -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/surface.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.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/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/reader.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/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.d.ts +2 -8
- 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/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/raeto/index.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/spark/index.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.js +1 -1
- package/build/dist/api/modules/tickerspring/ladder.js +1 -1
- package/build/dist/api/modules/tickerspring/maker.js +1 -1
- package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
- package/build/dist/api/modules/tickerspring/research.js +1 -1
- package/build/dist/api/modules/tickerspring/strategies.js +1 -1
- package/build/dist/api/modules/uniswap/auction-create.js +1 -1
- package/build/dist/api/modules/uniswap/auction.js +1 -1
- package/build/dist/api/modules/uniswap/batch.js +1 -1
- package/build/dist/api/modules/uniswap/common.js +1 -1
- package/build/dist/api/modules/uniswap/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- package/build/dist/api/modules/uniswap/local-guard.js +1 -1
- package/build/dist/api/modules/uniswap/oracle.js +1 -1
- package/build/dist/api/modules/uniswap/pool-math.js +1 -1
- package/build/dist/api/modules/uniswap/pools.js +1 -1
- package/build/dist/api/modules/uniswap/position.js +1 -1
- package/build/dist/api/modules/uniswap/protocol.js +1 -1
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
- package/build/dist/api/modules/uniswap/token-jar.js +1 -1
- package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
- package/build/dist/api/modules/uniswap/trade.js +1 -1
- package/build/dist/api/modules/uniswap/v2.js +1 -1
- package/build/dist/api/modules/uniswap/v3.js +1 -1
- package/build/dist/api/modules/uniswap/v4.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/prices.d.ts +5 -0
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/swap.d.ts +1 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/universal-router.d.ts +45 -0
- package/build/dist/api/universal-router.js +1 -0
- package/build/dist/api/usd-estimate.js +1 -1
- package/build/dist/chunks/{ROQQ62LP.js → 22TU5PFT.js} +1 -1
- package/build/dist/chunks/{2WRXH6BL.js → 257N7343.js} +1 -1
- package/build/dist/chunks/{B2HSLY5F.js → 27PVS6BU.js} +1 -1
- package/build/dist/chunks/{25C4DTVA.js → 2JWAFLJU.js} +1 -1
- package/build/dist/chunks/{24Q3FNGX.js → 35LXCSHY.js} +1 -1
- package/build/dist/chunks/{OYDKAIS2.js → 3BMM3V4P.js} +1 -1
- package/build/dist/chunks/{VZVW5J7J.js → 3FU6XP6S.js} +1 -1
- package/build/dist/chunks/{KH4QFN72.js → 3PHJUFU2.js} +1 -1
- package/build/dist/chunks/43BG2JRB.js +1 -0
- package/build/dist/chunks/{KMSAUFYV.js → 47HSRR7G.js} +1 -1
- package/build/dist/chunks/{2ZBSE2LD.js → 4NDIYRH5.js} +1 -1
- package/build/dist/chunks/{M7BUKZW2.js → 4RCYYN6O.js} +1 -1
- package/build/dist/chunks/4ZD5D2UP.js +1 -0
- package/build/dist/chunks/{X5AL3DUK.js → 6D3XNCOX.js} +1 -1
- package/build/dist/chunks/{W4RYRLL5.js → 6GWXPQZ6.js} +1 -1
- package/build/dist/chunks/{KBU3PYP7.js → 73BZPPRS.js} +1 -1
- package/build/dist/chunks/{XV3YJ4P6.js → 7FIEBJOZ.js} +1 -1
- package/build/dist/chunks/{CI5ENLYA.js → 7FZXSYFD.js} +1 -1
- package/build/dist/chunks/{K4P5VYDP.js → 7TSIF3F4.js} +1 -1
- package/build/dist/chunks/AG2G7BHH.js +6 -0
- package/build/dist/chunks/{QMEGAKLI.js → AIYNFIG6.js} +1 -1
- package/build/dist/chunks/{KZA5GYZR.js → AWV24X7F.js} +1 -1
- package/build/dist/chunks/{JPPQDELB.js → AXHFNE6L.js} +1 -1
- package/build/dist/chunks/{WOGWLFAL.js → BGVC5NI6.js} +1 -1
- package/build/dist/chunks/BJK75C7G.js +1 -0
- package/build/dist/chunks/BSX4LFYI.js +1 -0
- package/build/dist/chunks/{OTYB6BHK.js → BZPFPQ2I.js} +1 -1
- package/build/dist/chunks/{PQXYTOV5.js → DCGNVMKG.js} +1 -1
- package/build/dist/chunks/{OTLUQWLF.js → DLNA5272.js} +1 -1
- package/build/dist/chunks/{VMZYFO6I.js → DXAPKN7H.js} +1 -1
- package/build/dist/chunks/{NMQBOBWJ.js → EHGH646D.js} +1 -1
- package/build/dist/chunks/{PZEF5LBL.js → ETMD747Y.js} +1 -1
- package/build/dist/chunks/{XEBMS5KU.js → GGMVT5A6.js} +1 -1
- package/build/dist/chunks/GK3D7OKG.js +1 -0
- package/build/dist/chunks/GYPMUYB5.js +1 -0
- package/build/dist/chunks/{U7UPLF4F.js → H64QC4QR.js} +1 -1
- package/build/dist/chunks/{HS5HWBMU.js → HIG7JY3J.js} +1 -1
- package/build/dist/chunks/{NWPAQER2.js → HOBIXKGO.js} +1 -1
- package/build/dist/chunks/HQIS3QI7.js +3 -0
- package/build/dist/chunks/{C6VJAL5B.js → HUKDISRE.js} +1 -1
- package/build/dist/chunks/{XPWGPZ2C.js → HZSYMGJ2.js} +1 -1
- package/build/dist/chunks/{YARZE7SJ.js → I4473OC6.js} +1 -1
- package/build/dist/chunks/{DMB64UIN.js → IJ4HZIDG.js} +1 -1
- package/build/dist/chunks/{YBLJ75U5.js → IPU656WB.js} +1 -1
- package/build/dist/chunks/{QLAOBULN.js → JTPHZCO3.js} +1 -1
- package/build/dist/chunks/{CSOO4SW7.js → K4GUZ5QS.js} +1 -1
- package/build/dist/chunks/{WBNFRPAT.js → KLEJ3W4T.js} +1 -1
- package/build/dist/chunks/{ACH4BSME.js → KOKLM63Q.js} +1 -1
- package/build/dist/chunks/{VB36EHIR.js → KVVBT43U.js} +1 -1
- package/build/dist/chunks/{6MDYKE2O.js → KXX7ZBFY.js} +1 -1
- package/build/dist/chunks/{I6PQW2JI.js → L2AE32SL.js} +1 -1
- package/build/dist/chunks/{KOTGFD2V.js → LGLWEGPY.js} +1 -1
- package/build/dist/chunks/{2HN3U6OG.js → LQSPWRHN.js} +1 -1
- package/build/dist/chunks/{C3WBHFLX.js → LTDF2LNP.js} +1 -1
- package/build/dist/chunks/{RNCMXKKS.js → M4AGEGWW.js} +1 -1
- package/build/dist/chunks/{HVFMIURK.js → M6SQPOOL.js} +1 -1
- package/build/dist/chunks/{XBNZ7GTY.js → M7CQPTRK.js} +1 -1
- package/build/dist/chunks/{OODSXDIH.js → MGVX5EUH.js} +1 -1
- package/build/dist/chunks/{D2IYA4LP.js → MQ37QX6U.js} +1 -1
- package/build/dist/chunks/{TMRAF2L2.js → NDSNE6PS.js} +1 -1
- package/build/dist/chunks/{6OCLWSMZ.js → NTUXDIY6.js} +1 -1
- package/build/dist/chunks/{CZQ2CGYV.js → NUERUFH7.js} +1 -1
- package/build/dist/chunks/NV6FDIYT.js +1 -0
- package/build/dist/chunks/{A2V4NFVA.js → O3CC5SRM.js} +1 -1
- package/build/dist/chunks/{JI5DXDMY.js → ODV3XT5U.js} +1 -1
- package/build/dist/chunks/OLDQV43V.js +1 -0
- package/build/dist/chunks/{B7BNDW35.js → OY5W7ZSL.js} +1 -1
- package/build/dist/chunks/{CD2JQ32C.js → PDGYM2WG.js} +1 -1
- package/build/dist/chunks/{5R576SDB.js → PKYQ3XVA.js} +1 -1
- package/build/dist/chunks/{FN6GNTPR.js → PWJVC2FV.js} +1 -1
- package/build/dist/chunks/{Q7L3BX6U.js → QHV5GORV.js} +1 -1
- package/build/dist/chunks/{PSGRZWES.js → QN45T4N3.js} +1 -1
- package/build/dist/chunks/{LJJYYUEG.js → QPY6UTLU.js} +1 -1
- package/build/dist/chunks/{ATEVAJ5Y.js → RA7DOR7F.js} +1 -1
- package/build/dist/chunks/{U762746N.js → RUSXMQSJ.js} +1 -1
- package/build/dist/chunks/{UPKVD7WG.js → RXP7ZUPY.js} +1 -1
- package/build/dist/chunks/{2QGLPY2D.js → SMKO7GKX.js} +1 -1
- package/build/dist/chunks/{EHK7CDTU.js → SNCV6HV7.js} +1 -1
- package/build/dist/chunks/{2ZQ7X223.js → SOJHYMD7.js} +1 -1
- package/build/dist/chunks/{ORG6LVKJ.js → UBI3HBXD.js} +1 -1
- package/build/dist/chunks/{N64JJN37.js → UEHN2IDF.js} +1 -1
- package/build/dist/chunks/{FTMA24EC.js → UHIJMDD2.js} +1 -1
- package/build/dist/chunks/UJQYOTO5.js +1 -0
- package/build/dist/chunks/{GP6YO24Z.js → UYULQHZJ.js} +1 -1
- package/build/dist/chunks/{MMCM3GSM.js → V4UJMUIB.js} +1 -1
- package/build/dist/chunks/{ZNPVBNC5.js → VC5ZCQYZ.js} +1 -1
- package/build/dist/chunks/{FGEGJOAA.js → VDJPDIBV.js} +1 -1
- package/build/dist/chunks/{TGFQQCRY.js → VFM2BICB.js} +1 -1
- package/build/dist/chunks/{MSMHS456.js → VOJULRNU.js} +1 -1
- package/build/dist/chunks/{5W74Z4WZ.js → W3DGFMQE.js} +1 -1
- package/build/dist/chunks/W7OCS4AM.js +6 -0
- package/build/dist/chunks/{QLFPAN6S.js → W7QNSNOH.js} +1 -1
- package/build/dist/chunks/{OQFNUDMQ.js → XVOW6UCI.js} +1 -1
- package/build/dist/chunks/{P6OB2AFW.js → Y7HBFQYG.js} +1 -1
- package/build/dist/chunks/{LDJI2JAL.js → YGW4ODAP.js} +1 -1
- package/build/dist/chunks/{U243AWCH.js → YW4W3LPQ.js} +1 -1
- package/build/dist/chunks/{65356YKW.js → Z2QV6EZY.js} +1 -1
- package/build/dist/chunks/{S4UJDZGN.js → ZDCCFEVL.js} +1 -1
- package/build/dist/chunks/{D7QXZM3S.js → ZOLHVZDK.js} +1 -1
- package/build/dist/chunks/{SMSXZ3FN.js → ZSVAGOF2.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/4R3G3H42.js +0 -1
- package/build/dist/chunks/LKX5WDOQ.js +0 -1
- package/build/dist/chunks/ND32LJWI.js +0 -1
- package/build/dist/chunks/URBEK2VV.js +0 -1
- package/build/dist/chunks/UVAR6BHU.js +0 -1
- package/build/dist/chunks/V6SDKPZS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as me,c as Pe}from"./Z3IBPCY4.js";import{d as xe,e as Se,g as Ee,h as Oe,i as a,w as Ne}from"./Y64GFBTA.js";import{o as pe}from"./LKX5WDOQ.js";import{a as B}from"./Z7FGEWO2.js";import{a as Te}from"./43LI5NKJ.js";import{a as ee}from"./66F5ZH34.js";import{c as Y,j as ve}from"./NWNYJ26T.js";import{b as Ce}from"./IX3GZMTM.js";import{b as $,j as De}from"./TI727O2H.js";import{a as t}from"./XSD5NL7J.js";import{decodeFunctionData as _e,erc20Abi as Fe}from"viem";var Ge="https://api.relay.link",He="Relay requires an authorized API key for this endpoint. Ask the operator to configure a valid OAK_RELAY_API_KEY on the server with access to this resource; never pass keys in tool arguments.",oe=class extends Error{},k="0x0000000000000000000000000000000000000000",Ye=60,Be=30,n=De[$].relay.depository.address.toLowerCase(),te="0x59916da825d2d2ec1bf878d71c88826f6633ecca",ie=new Map([[1,{chainId:"ethereum",depository:n}],[10,{chainId:"optimism",depository:n}],[25,{chainId:"cronos",depository:te}],[56,{chainId:"bnb",depository:n}],[100,{chainId:"gnosis",depository:n}],[130,{chainId:"unichain",depository:n}],[137,{chainId:"polygon",depository:n}],[143,{chainId:"monad",depository:n}],[146,{chainId:"sonic",depository:n}],[169,{chainId:"manta",depository:n}],[196,{chainId:"xlayer",depository:n}],[288,{chainId:"boba",depository:n}],[324,{chainId:"zksync",depository:n}],[360,{chainId:"shape",depository:n}],[480,{chainId:"worldchain",depository:n}],[747,{chainId:"flow",depository:n}],[988,{chainId:"stable",depository:n}],[999,{chainId:"hyperevm",depository:n}],[1088,{chainId:"metis",depository:te}],[1135,{chainId:"lisk",depository:n}],[1868,{chainId:"soneium",depository:n}],[2020,{chainId:"ronin",depository:n}],[2741,{chainId:"abstract",depository:n}],[2818,{chainId:"morph",depository:n}],[4217,{chainId:"tempo",depository:n}],[4326,{chainId:"megaeth",depository:n}],[5e3,{chainId:"mantle",depository:te}],[5031,{chainId:"somnia",depository:n}],[5042,{chainId:"arc",depository:n}],[8453,{chainId:"base",depository:n}],[9745,{chainId:"plasma",depository:n}],[33139,{chainId:"apechain",depository:n}],[34443,{chainId:"mode",depository:n}],[42018,{chainId:"mythos",depository:n}],[42161,{chainId:"arbitrum",depository:n}],[42220,{chainId:"celo",depository:n}],[43114,{chainId:"avalanche",depository:n}],[48900,{chainId:"zircuit",depository:n}],[57073,{chainId:"ink",depository:n}],[59144,{chainId:"linea",depository:te}],[60808,{chainId:"bob",depository:n}],[80094,{chainId:"berachain",depository:n}],[97477,{chainId:"doma",depository:n}],[98866,{chainId:"plume",depository:n}],[534352,{chainId:"scroll",depository:n}],[685689,{chainId:"gensyn",depository:n}],[747474,{chainId:"katana",depository:n}],[5064014,{chainId:"ethereal",depository:n}],[7777777,{chainId:"zora",depository:n}]]),at=Object.freeze(["robinhood",...Array.from(ie.values(),e=>e.chainId)]);function dt(e){return e===$?"robinhood":ie.get(e)?.chainId}function ut(e){return ie.get(e)?.depository}function M(e){return ve(e,"Provide a token or wallet address.")}function g(e){let i=M(e);return i===B?k:i}function w(e,i){return M(e)===M(i)}function f(e){if(typeof e!="string")throw new t("Provide a decimal base-unit amount string.");return Ce(e),e}function ne(e){let i=f(e);if(BigInt(i)<=0n)throw new t("Provide a positive base-unit amount.");return i}function Ke(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Provide a positive integer origin chain ID.");return e}function Me(e,i){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t(`${i} is missing or invalid.`);return e}async function K(e,i,c,r,m){let s=a(c);if(s.chainId!==r||g(s.address)!==m||typeof s.symbol!="string"||!/^[A-Za-z0-9._-]{1,32}$/.test(s.symbol))throw new t("Relay quote token metadata does not match the requested chain and address.");if(m===k){if(s.decimals!==18)throw new t("Native token decimals must be 18.");return{address:B,chainId:r,symbol:s.symbol,decimals:18}}let b=`${r}:${m}`,h=i.get(b);if(h===void 0){let d=await e.clientFor(r).readContract({address:m,abi:Fe,functionName:"decimals"}),I=typeof d=="bigint"?Number(d):d;if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new t("Could not read valid ERC-20 decimals() on-chain.");h=I,i.set(b,h)}return{address:m,chainId:r,symbol:s.symbol,decimals:h}}async function Qe(e,i,c,r,m,s,b){if(c.swap===void 0)return[];let h=a(c.swap),d=a(h.from);if(d.chainId!==m)throw new t("The swap prerequisite token must be on the origin chain.");let I=await K(e,i,d,m,g(d.address)),F=s===k?B:s;if(w(I.address,F))throw new t("The swap prerequisite must use a different input token.");let he=ne(h.amountIn),y=h.slippageBps;if(y!==void 0&&(typeof y!="number"||!Number.isInteger(y)||y<0||y>1e4))throw new t("Provide swap slippage in basis points from 0 to 10000.");let S=await e.quoteSwap({from:I.address,to:F,amountIn:he,...y===void 0?{}:{slippageBps:y}},r);if(BigInt(f(S.expiresAt))<=BigInt(Math.floor(Date.now()/1e3)))throw new t("The swap prerequisite quote expired. Request a fresh quote.");if(BigInt(f(S.minAmountOut))<BigInt(b))throw new t("The swap prerequisite minimum cannot cover the bridge amount.");let q=await e.buildSwap(S.quoteId,r);if(!("txs"in q)||!q.txs.length)throw new t("The swap prerequisite must return unsigned transactions.");if(q.txs.some(p=>p.chainId!==m))throw new t("The injected swap coordinator does not support this origin chain.");return q.txs.map(p=>e.unsignedTx(p))}async function Ve(e,i,c){Te(c);let r=Ke(i.originChainId);if(r===$)throw new t("Inbound bridging requires an origin chain other than 4663.");let m=ie.get(r);if(!m)throw new t("Relay inbound does not support this origin chain.");if(i.destinationChainId!==void 0&&i.destinationChainId!==$)throw new t("Inbound bridge destination must be chain 4663.");let s=g(i.originCurrency??B),b=g(i.destinationCurrency??B),h=M(i.recipient??c),d=ne(i.amount),I=i.minAmountOut===void 0?void 0:f(i.minAmountOut),F=i.slippageBps===void 0?me:i.slippageBps;if(pe("0",F),await e.clientFor(r).getChainId()!==r)throw new t("The RPC chain does not match the inbound origin chain.");let y=new Map,S=await Qe(e,y,i,c,r,s,d),q;try{let o=await e.http(`${Ge}/quote/v2`,{method:"POST",headers:{"content-type":"application/json","user-agent":"oak-core/0.1.0"},body:JSON.stringify(xe({user:c,recipient:h,originChainId:r,destinationChainId:$,originCurrency:s,destinationCurrency:b,amount:d,tradeType:"EXACT_INPUT",includeProtocolData:!0,...s===k?{}:{explicitDeposit:!0}}))});if(o.status===401||o.status===403)throw new oe(He);if(!o.ok)throw new Error("Relay HTTP failure.");q=await o.json()}catch(o){throw o instanceof oe?new t(o.message):o instanceof t&&typeof o.reason=="string"&&o.reason.startsWith("keyed_")?new t(o.message):new t("Relay quote request failed. Please try again.")}let p=a(q);Se(p);let le=Ee(p.fees);if(typeof p.requestId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(p.requestId))throw new t("Relay returned an invalid request ID.");let E=p.requestId,ye=`/intents/status/v3?requestId=${E}`,U=a(p.details);if(!w(U.sender,c)||!w(U.recipient,h))throw new t("Relay quote sender or recipient does not match the request.");let fe=a(U.currencyIn),re=a(U.currencyOut),O=await K(e,y,fe.currency,r,s),N=await K(e,y,re.currency,$,b);if(f(fe.amount)!==d)throw new t("Relay quote input amount does not match the request.");let P=ne(re.amount),D=ne(re.minimumAmount);if(BigInt(D)>BigInt(P))throw new t("Relay quote minimum output exceeds the expected output.");if(I!==void 0){if(D!==I)throw new t("Relay order minimum must exactly match minAmountOut. Request a new quote.")}else{let o=pe(P,F);if(BigInt(D)<BigInt(o))throw Pe(P,D)}let we=a(a(p.fees).relayer),Ie=a(we.currency),Q=await K(e,y,Ie,r,g(Ie.address)),ge={token:Q,amount:f(we.amount)},be=a(U.refundCurrency),Ue=a(be.currency),L=await K(e,y,Ue,r,s),se=f(be.amount),j=a(a(p.protocol).v2);if(typeof j.orderId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(j.orderId))throw new t("Relay returned an invalid order ID.");let V=j.orderId.toLowerCase(),W=a(j.paymentDetails),R=M(W.depository);if(W.chainId!==m.chainId||R!==m.depository||g(W.currency)!==s||f(W.amount)!==d)throw new t("Relay payment details do not match the origin chain depository and input.");let z=a(j.orderData),C=a(z.output);if(C.chainId!=="robinhood"||!Array.isArray(C.calls)||C.calls.length!==0||!Array.isArray(C.payments)||C.payments.length!==1)throw new t("Relay order output does not match destination chain 4663.");let J=a(C.payments[0]);if(!w(J.recipient,h)||g(J.currency)!==b||f(J.minimumAmount)!==D||f(J.expectedAmount)!==P)throw new t("Relay order output payment does not match the quoted recipient and amounts.");let ae=Me(C.deadline,"Relay order output deadline");if(!Array.isArray(z.inputs)||!z.inputs.length)throw new t("Relay order has no inputs.");let X=[],de=[];for(let o of z.inputs){let u=a(o),T=a(u.payment);if(T.chainId!==m.chainId||g(T.currency)!==s||f(T.amount)!==d||!Array.isArray(u.refunds)||!u.refunds.length)throw new t("Relay order input does not match the quoted input.");for(let x of u.refunds){let l=a(x);if(!w(l.recipient,c))throw new t("Relay refund recipient does not match the agent wallet. Request a new quote.");if(X.push(Me(l.deadline,"Relay order refund deadline")),de.push(f(l.minimumAmount)),!(l.chainId===m.chainId?w(l.recipient,c)&&g(l.currency)===s:l.chainId==="robinhood"&&g(l.currency)===b))throw new t("Relay order refund terms do not match the sender or recipient.")}}let Ae=Math.min(ae,...X),G=0,$e=()=>{let o=Math.floor(Date.now()/1e3),u=G||o+Ye;if(Ae-o<=Be)throw new t("Relay order deadline is expired or too soon to sign safely. Request a new quote.");if(G=Math.min(u,Ae-Be),G<=o)throw new t("Relay quote expired before signing. Request a new quote.")};if($e(),!Array.isArray(p.steps)||!p.steps.length)throw new t("Relay returned no origin transactions.");let v=[];for(let o of p.steps){let u=a(o);if(u.kind!=="transaction"||u.requestId!==E||!Array.isArray(u.items)||!u.items.length)throw new t("Relay returned an unsupported origin step.");for(let T of u.items){let x=a(T),l=a(x.data),ce=a(x.check);if(x.status!=="incomplete"||l.chainId!==r||!w(l.from,c))throw new t("Relay transaction does not match the origin chain and sender.");if(ce.method!=="GET"||ce.endpoint!==ye)throw new t("Relay status endpoint does not match the request ID.");v.push(e.unsignedTx({to:M(l.to),data:l.data,value:f(l.value),chainId:r,description:`Relay inbound deposit for request ${E}; destination chain 4663.`}))}}if(!v.length)throw new t("Relay returned no origin transactions.");if(s===k&&v.length!==1)throw new t("Relay native deposit must be a single depositNative transaction.");if(s!==k&&v.length>2)throw new t("Relay ERC-20 deposit allows at most one exact-amount approval before depositErc20.");for(let o of v.slice(0,-1)){if(!o.data.toLowerCase().startsWith("0x095ea7b3"))throw new t("Relay returned an unsupported prerequisite transaction.");let u=_e({abi:Fe,data:o.data});if(u.functionName!=="approve")throw new t("Relay returned an invalid approval.");let[T,x]=u.args;if(s===k||!w(o.to,s)||!w(T,R)||x!==BigInt(d)||o.value!=="0")throw new t("Relay approval must authorize the exact input amount for the origin depository.");o.description=`Approve exactly ${e.formatAmount(d,O.decimals)} ${O.symbol} (${d} base units of ${s}) for ${R} on chain ${r}.`}let _=v[v.length-1],H=s===k,Z=H?"depositNative":"depositErc20",Re=H?"depositNative(address,bytes32)":"depositErc20(address,address,uint256,bytes32)";if(!w(_.to,R)||_.value!==(H?d:"0")||!(H?/^0x[0-9a-fA-F]{136}$/:/^0x[0-9a-fA-F]{264}$/).test(_.data))throw new t(`Relay deposit transaction does not target the origin depository with ${Z} calldata.`);let A;try{A=_e({abi:Oe,data:_.data})}catch{throw new t(`Relay deposit transaction must call ${Re}.`)}if(A.functionName!==Z)throw new t(`Relay deposit transaction must call ${Re}.`);let Le=A.args[0],je=A.functionName==="depositErc20"?A.args[3]:A.args[1];if(A.functionName==="depositErc20"&&(!w(A.args[1],s)||A.args[2]!==BigInt(d)))throw new t("Relay depositErc20 token or amount does not match the quoted input.");if(!w(Le,c)||je.toLowerCase()!==V)throw new t(`Relay ${Z} depositor or orderId does not match the wallet and quoted protocol.v2.orderId.`);_.description=`Relay inbound ${Z} for order ${V} (request ${E}); destination chain 4663.`;let ue=H?[]:await Ne(e,s,R,d,r,c);for(let[o,u]of ue.entries())u.description=ue.length===2&&o===0?`Reset the existing ${O.symbol} allowance for ${R} on chain ${r} to zero.`:`Approve exactly ${e.formatAmount(d,O.decimals)} ${O.symbol} (${d} base units of ${s}) for ${R} on chain ${r}.`;let ke=[...S,...ue,_],qe=await e.preview(ke,c);$e();let ze=qe.changes.map(o=>{let u=o.amount.startsWith("-");return`${u?"-":""}${e.formatAmount(u?o.amount.slice(1):o.amount,o.token.decimals)} ${o.token.symbol} (${o.token.address}, chain ${o.token.chainId})`});return{txs:ke,preview:qe,requestId:E,orderId:V,orderData:z,depository:R,originChainId:r,destinationChainId:$,recipient:h,amountIn:{token:O,amount:d},amountOut:{token:N,amount:P},minAmountOut:D,relayerFee:ge,fees:p.fees,...le,refundCurrency:{token:L,amount:se,minimumAmounts:de},orderDeadline:String(ae),refundDeadlines:X.map(String),expiresAt:String(G),status:"pending",statusEndpoint:ye,summary:`${le.feeDisclosure} ${S.length?"Swap prerequisite first, then ":""}Relay inbound from chain ${r} to chain 4663 for ${h}; expected ${e.formatAmount(P,N.decimals)} ${N.symbol}, minimum ${e.formatAmount(D,N.decimals)} ${N.symbol} (${N.address}). Quoted relay fee ${e.formatAmount(ge.amount,Q.decimals)} ${Q.symbol} (${Q.address}, chain ${r}); output is net of quoted fees. Order ${V} (request ${E}); output deadline ${ae}, refund deadlines ${X.join(", ")}, quote expires ${G}. Refund terms: details.refundCurrency quotes ${e.formatAmount(se,L.decimals)} ${L.symbol} (${se} base units) on chain ${L.chainId} (${L.address}), but protocol.v2 order refund floor is ${de.join(", ")} base units. ${ze.join("; ")}. Unsigned origin transactions only; destination fulfillment remains pending. Track with relay_status; timeout or refund is not fulfillment.`}}var ct=e=>({tools:[{name:"relay_bridge_in",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{const:$,description:"Destination chain ID; must be 4663."},originCurrency:{...Y,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{...Y,description:"Destination token address; defaults to native ETH."},amount:ee('Origin token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),minAmountOut:ee('Minimum destination token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),slippageBps:{type:"integer",minimum:0,maximum:9999,default:me,description:"Slippage in basis points (50 = 0.5%)."},recipient:{...Y,description:"Destination recipient address; defaults to your wallet."},swap:{type:"object",additionalProperties:!1,required:["from","amountIn"],properties:{from:{type:"object",additionalProperties:!1,required:["address","chainId","symbol","decimals"],properties:{address:{...Y,description:"Input token address."},chainId:{type:"integer",minimum:1,description:"Input token chain ID."},symbol:{type:"string",description:"Input token symbol."},decimals:{type:"integer",minimum:0,maximum:255,description:"Input token decimal places."}},description:"Token supplied to the origin swap."},amountIn:ee('Swap input token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),slippageBps:{type:"integer",minimum:0,maximum:1e4,description:"Slippage in basis points (50 = 0.5%)."}},description:"Optional origin swap before bridging."}}},async execute(i,c){try{return await Ve(e,i,c)}catch(r){throw new t(e.plainError(r))}}}]});export{at as a,dt as b,ut as c,ct as d};
|
|
1
|
+
import{b as me,c as Pe}from"./Z3IBPCY4.js";import{d as xe,e as Se,g as Ee,h as Oe,i as a,w as Ne}from"./Y64GFBTA.js";import{o as pe}from"./GYPMUYB5.js";import{a as B}from"./Z7FGEWO2.js";import{a as Te}from"./43LI5NKJ.js";import{a as ee}from"./66F5ZH34.js";import{c as Y,j as ve}from"./NWNYJ26T.js";import{b as Ce}from"./IX3GZMTM.js";import{b as $,j as De}from"./TI727O2H.js";import{a as t}from"./XSD5NL7J.js";import{decodeFunctionData as _e,erc20Abi as Fe}from"viem";var Ge="https://api.relay.link",He="Relay requires an authorized API key for this endpoint. Ask the operator to configure a valid OAK_RELAY_API_KEY on the server with access to this resource; never pass keys in tool arguments.",oe=class extends Error{},k="0x0000000000000000000000000000000000000000",Ye=60,Be=30,n=De[$].relay.depository.address.toLowerCase(),te="0x59916da825d2d2ec1bf878d71c88826f6633ecca",ie=new Map([[1,{chainId:"ethereum",depository:n}],[10,{chainId:"optimism",depository:n}],[25,{chainId:"cronos",depository:te}],[56,{chainId:"bnb",depository:n}],[100,{chainId:"gnosis",depository:n}],[130,{chainId:"unichain",depository:n}],[137,{chainId:"polygon",depository:n}],[143,{chainId:"monad",depository:n}],[146,{chainId:"sonic",depository:n}],[169,{chainId:"manta",depository:n}],[196,{chainId:"xlayer",depository:n}],[288,{chainId:"boba",depository:n}],[324,{chainId:"zksync",depository:n}],[360,{chainId:"shape",depository:n}],[480,{chainId:"worldchain",depository:n}],[747,{chainId:"flow",depository:n}],[988,{chainId:"stable",depository:n}],[999,{chainId:"hyperevm",depository:n}],[1088,{chainId:"metis",depository:te}],[1135,{chainId:"lisk",depository:n}],[1868,{chainId:"soneium",depository:n}],[2020,{chainId:"ronin",depository:n}],[2741,{chainId:"abstract",depository:n}],[2818,{chainId:"morph",depository:n}],[4217,{chainId:"tempo",depository:n}],[4326,{chainId:"megaeth",depository:n}],[5e3,{chainId:"mantle",depository:te}],[5031,{chainId:"somnia",depository:n}],[5042,{chainId:"arc",depository:n}],[8453,{chainId:"base",depository:n}],[9745,{chainId:"plasma",depository:n}],[33139,{chainId:"apechain",depository:n}],[34443,{chainId:"mode",depository:n}],[42018,{chainId:"mythos",depository:n}],[42161,{chainId:"arbitrum",depository:n}],[42220,{chainId:"celo",depository:n}],[43114,{chainId:"avalanche",depository:n}],[48900,{chainId:"zircuit",depository:n}],[57073,{chainId:"ink",depository:n}],[59144,{chainId:"linea",depository:te}],[60808,{chainId:"bob",depository:n}],[80094,{chainId:"berachain",depository:n}],[97477,{chainId:"doma",depository:n}],[98866,{chainId:"plume",depository:n}],[534352,{chainId:"scroll",depository:n}],[685689,{chainId:"gensyn",depository:n}],[747474,{chainId:"katana",depository:n}],[5064014,{chainId:"ethereal",depository:n}],[7777777,{chainId:"zora",depository:n}]]),at=Object.freeze(["robinhood",...Array.from(ie.values(),e=>e.chainId)]);function dt(e){return e===$?"robinhood":ie.get(e)?.chainId}function ut(e){return ie.get(e)?.depository}function M(e){return ve(e,"Provide a token or wallet address.")}function g(e){let i=M(e);return i===B?k:i}function w(e,i){return M(e)===M(i)}function f(e){if(typeof e!="string")throw new t("Provide a decimal base-unit amount string.");return Ce(e),e}function ne(e){let i=f(e);if(BigInt(i)<=0n)throw new t("Provide a positive base-unit amount.");return i}function Ke(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t("Provide a positive integer origin chain ID.");return e}function Me(e,i){if(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)throw new t(`${i} is missing or invalid.`);return e}async function K(e,i,c,r,m){let s=a(c);if(s.chainId!==r||g(s.address)!==m||typeof s.symbol!="string"||!/^[A-Za-z0-9._-]{1,32}$/.test(s.symbol))throw new t("Relay quote token metadata does not match the requested chain and address.");if(m===k){if(s.decimals!==18)throw new t("Native token decimals must be 18.");return{address:B,chainId:r,symbol:s.symbol,decimals:18}}let b=`${r}:${m}`,h=i.get(b);if(h===void 0){let d=await e.clientFor(r).readContract({address:m,abi:Fe,functionName:"decimals"}),I=typeof d=="bigint"?Number(d):d;if(typeof I!="number"||!Number.isInteger(I)||I<0||I>255)throw new t("Could not read valid ERC-20 decimals() on-chain.");h=I,i.set(b,h)}return{address:m,chainId:r,symbol:s.symbol,decimals:h}}async function Qe(e,i,c,r,m,s,b){if(c.swap===void 0)return[];let h=a(c.swap),d=a(h.from);if(d.chainId!==m)throw new t("The swap prerequisite token must be on the origin chain.");let I=await K(e,i,d,m,g(d.address)),F=s===k?B:s;if(w(I.address,F))throw new t("The swap prerequisite must use a different input token.");let he=ne(h.amountIn),y=h.slippageBps;if(y!==void 0&&(typeof y!="number"||!Number.isInteger(y)||y<0||y>1e4))throw new t("Provide swap slippage in basis points from 0 to 10000.");let S=await e.quoteSwap({from:I.address,to:F,amountIn:he,...y===void 0?{}:{slippageBps:y}},r);if(BigInt(f(S.expiresAt))<=BigInt(Math.floor(Date.now()/1e3)))throw new t("The swap prerequisite quote expired. Request a fresh quote.");if(BigInt(f(S.minAmountOut))<BigInt(b))throw new t("The swap prerequisite minimum cannot cover the bridge amount.");let q=await e.buildSwap(S.quoteId,r);if(!("txs"in q)||!q.txs.length)throw new t("The swap prerequisite must return unsigned transactions.");if(q.txs.some(p=>p.chainId!==m))throw new t("The injected swap coordinator does not support this origin chain.");return q.txs.map(p=>e.unsignedTx(p))}async function Ve(e,i,c){Te(c);let r=Ke(i.originChainId);if(r===$)throw new t("Inbound bridging requires an origin chain other than 4663.");let m=ie.get(r);if(!m)throw new t("Relay inbound does not support this origin chain.");if(i.destinationChainId!==void 0&&i.destinationChainId!==$)throw new t("Inbound bridge destination must be chain 4663.");let s=g(i.originCurrency??B),b=g(i.destinationCurrency??B),h=M(i.recipient??c),d=ne(i.amount),I=i.minAmountOut===void 0?void 0:f(i.minAmountOut),F=i.slippageBps===void 0?me:i.slippageBps;if(pe("0",F),await e.clientFor(r).getChainId()!==r)throw new t("The RPC chain does not match the inbound origin chain.");let y=new Map,S=await Qe(e,y,i,c,r,s,d),q;try{let o=await e.http(`${Ge}/quote/v2`,{method:"POST",headers:{"content-type":"application/json","user-agent":"oak-core/0.1.0"},body:JSON.stringify(xe({user:c,recipient:h,originChainId:r,destinationChainId:$,originCurrency:s,destinationCurrency:b,amount:d,tradeType:"EXACT_INPUT",includeProtocolData:!0,...s===k?{}:{explicitDeposit:!0}}))});if(o.status===401||o.status===403)throw new oe(He);if(!o.ok)throw new Error("Relay HTTP failure.");q=await o.json()}catch(o){throw o instanceof oe?new t(o.message):o instanceof t&&typeof o.reason=="string"&&o.reason.startsWith("keyed_")?new t(o.message):new t("Relay quote request failed. Please try again.")}let p=a(q);Se(p);let le=Ee(p.fees);if(typeof p.requestId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(p.requestId))throw new t("Relay returned an invalid request ID.");let E=p.requestId,ye=`/intents/status/v3?requestId=${E}`,U=a(p.details);if(!w(U.sender,c)||!w(U.recipient,h))throw new t("Relay quote sender or recipient does not match the request.");let fe=a(U.currencyIn),re=a(U.currencyOut),O=await K(e,y,fe.currency,r,s),N=await K(e,y,re.currency,$,b);if(f(fe.amount)!==d)throw new t("Relay quote input amount does not match the request.");let P=ne(re.amount),D=ne(re.minimumAmount);if(BigInt(D)>BigInt(P))throw new t("Relay quote minimum output exceeds the expected output.");if(I!==void 0){if(D!==I)throw new t("Relay order minimum must exactly match minAmountOut. Request a new quote.")}else{let o=pe(P,F);if(BigInt(D)<BigInt(o))throw Pe(P,D)}let we=a(a(p.fees).relayer),Ie=a(we.currency),Q=await K(e,y,Ie,r,g(Ie.address)),ge={token:Q,amount:f(we.amount)},be=a(U.refundCurrency),Ue=a(be.currency),L=await K(e,y,Ue,r,s),se=f(be.amount),j=a(a(p.protocol).v2);if(typeof j.orderId!="string"||!/^0x[0-9a-fA-F]{64}$/.test(j.orderId))throw new t("Relay returned an invalid order ID.");let V=j.orderId.toLowerCase(),W=a(j.paymentDetails),R=M(W.depository);if(W.chainId!==m.chainId||R!==m.depository||g(W.currency)!==s||f(W.amount)!==d)throw new t("Relay payment details do not match the origin chain depository and input.");let z=a(j.orderData),C=a(z.output);if(C.chainId!=="robinhood"||!Array.isArray(C.calls)||C.calls.length!==0||!Array.isArray(C.payments)||C.payments.length!==1)throw new t("Relay order output does not match destination chain 4663.");let J=a(C.payments[0]);if(!w(J.recipient,h)||g(J.currency)!==b||f(J.minimumAmount)!==D||f(J.expectedAmount)!==P)throw new t("Relay order output payment does not match the quoted recipient and amounts.");let ae=Me(C.deadline,"Relay order output deadline");if(!Array.isArray(z.inputs)||!z.inputs.length)throw new t("Relay order has no inputs.");let X=[],de=[];for(let o of z.inputs){let u=a(o),T=a(u.payment);if(T.chainId!==m.chainId||g(T.currency)!==s||f(T.amount)!==d||!Array.isArray(u.refunds)||!u.refunds.length)throw new t("Relay order input does not match the quoted input.");for(let x of u.refunds){let l=a(x);if(!w(l.recipient,c))throw new t("Relay refund recipient does not match the agent wallet. Request a new quote.");if(X.push(Me(l.deadline,"Relay order refund deadline")),de.push(f(l.minimumAmount)),!(l.chainId===m.chainId?w(l.recipient,c)&&g(l.currency)===s:l.chainId==="robinhood"&&g(l.currency)===b))throw new t("Relay order refund terms do not match the sender or recipient.")}}let Ae=Math.min(ae,...X),G=0,$e=()=>{let o=Math.floor(Date.now()/1e3),u=G||o+Ye;if(Ae-o<=Be)throw new t("Relay order deadline is expired or too soon to sign safely. Request a new quote.");if(G=Math.min(u,Ae-Be),G<=o)throw new t("Relay quote expired before signing. Request a new quote.")};if($e(),!Array.isArray(p.steps)||!p.steps.length)throw new t("Relay returned no origin transactions.");let v=[];for(let o of p.steps){let u=a(o);if(u.kind!=="transaction"||u.requestId!==E||!Array.isArray(u.items)||!u.items.length)throw new t("Relay returned an unsupported origin step.");for(let T of u.items){let x=a(T),l=a(x.data),ce=a(x.check);if(x.status!=="incomplete"||l.chainId!==r||!w(l.from,c))throw new t("Relay transaction does not match the origin chain and sender.");if(ce.method!=="GET"||ce.endpoint!==ye)throw new t("Relay status endpoint does not match the request ID.");v.push(e.unsignedTx({to:M(l.to),data:l.data,value:f(l.value),chainId:r,description:`Relay inbound deposit for request ${E}; destination chain 4663.`}))}}if(!v.length)throw new t("Relay returned no origin transactions.");if(s===k&&v.length!==1)throw new t("Relay native deposit must be a single depositNative transaction.");if(s!==k&&v.length>2)throw new t("Relay ERC-20 deposit allows at most one exact-amount approval before depositErc20.");for(let o of v.slice(0,-1)){if(!o.data.toLowerCase().startsWith("0x095ea7b3"))throw new t("Relay returned an unsupported prerequisite transaction.");let u=_e({abi:Fe,data:o.data});if(u.functionName!=="approve")throw new t("Relay returned an invalid approval.");let[T,x]=u.args;if(s===k||!w(o.to,s)||!w(T,R)||x!==BigInt(d)||o.value!=="0")throw new t("Relay approval must authorize the exact input amount for the origin depository.");o.description=`Approve exactly ${e.formatAmount(d,O.decimals)} ${O.symbol} (${d} base units of ${s}) for ${R} on chain ${r}.`}let _=v[v.length-1],H=s===k,Z=H?"depositNative":"depositErc20",Re=H?"depositNative(address,bytes32)":"depositErc20(address,address,uint256,bytes32)";if(!w(_.to,R)||_.value!==(H?d:"0")||!(H?/^0x[0-9a-fA-F]{136}$/:/^0x[0-9a-fA-F]{264}$/).test(_.data))throw new t(`Relay deposit transaction does not target the origin depository with ${Z} calldata.`);let A;try{A=_e({abi:Oe,data:_.data})}catch{throw new t(`Relay deposit transaction must call ${Re}.`)}if(A.functionName!==Z)throw new t(`Relay deposit transaction must call ${Re}.`);let Le=A.args[0],je=A.functionName==="depositErc20"?A.args[3]:A.args[1];if(A.functionName==="depositErc20"&&(!w(A.args[1],s)||A.args[2]!==BigInt(d)))throw new t("Relay depositErc20 token or amount does not match the quoted input.");if(!w(Le,c)||je.toLowerCase()!==V)throw new t(`Relay ${Z} depositor or orderId does not match the wallet and quoted protocol.v2.orderId.`);_.description=`Relay inbound ${Z} for order ${V} (request ${E}); destination chain 4663.`;let ue=H?[]:await Ne(e,s,R,d,r,c);for(let[o,u]of ue.entries())u.description=ue.length===2&&o===0?`Reset the existing ${O.symbol} allowance for ${R} on chain ${r} to zero.`:`Approve exactly ${e.formatAmount(d,O.decimals)} ${O.symbol} (${d} base units of ${s}) for ${R} on chain ${r}.`;let ke=[...S,...ue,_],qe=await e.preview(ke,c);$e();let ze=qe.changes.map(o=>{let u=o.amount.startsWith("-");return`${u?"-":""}${e.formatAmount(u?o.amount.slice(1):o.amount,o.token.decimals)} ${o.token.symbol} (${o.token.address}, chain ${o.token.chainId})`});return{txs:ke,preview:qe,requestId:E,orderId:V,orderData:z,depository:R,originChainId:r,destinationChainId:$,recipient:h,amountIn:{token:O,amount:d},amountOut:{token:N,amount:P},minAmountOut:D,relayerFee:ge,fees:p.fees,...le,refundCurrency:{token:L,amount:se,minimumAmounts:de},orderDeadline:String(ae),refundDeadlines:X.map(String),expiresAt:String(G),status:"pending",statusEndpoint:ye,summary:`${le.feeDisclosure} ${S.length?"Swap prerequisite first, then ":""}Relay inbound from chain ${r} to chain 4663 for ${h}; expected ${e.formatAmount(P,N.decimals)} ${N.symbol}, minimum ${e.formatAmount(D,N.decimals)} ${N.symbol} (${N.address}). Quoted relay fee ${e.formatAmount(ge.amount,Q.decimals)} ${Q.symbol} (${Q.address}, chain ${r}); output is net of quoted fees. Order ${V} (request ${E}); output deadline ${ae}, refund deadlines ${X.join(", ")}, quote expires ${G}. Refund terms: details.refundCurrency quotes ${e.formatAmount(se,L.decimals)} ${L.symbol} (${se} base units) on chain ${L.chainId} (${L.address}), but protocol.v2 order refund floor is ${de.join(", ")} base units. ${ze.join("; ")}. Unsigned origin transactions only; destination fulfillment remains pending. Track with relay_status; timeout or refund is not fulfillment.`}}var ct=e=>({tools:[{name:"relay_bridge_in",inputSchema:{type:"object",additionalProperties:!1,required:["originChainId","amount"],properties:{originChainId:{type:"integer",minimum:1,description:"Origin chain ID."},destinationChainId:{const:$,description:"Destination chain ID; must be 4663."},originCurrency:{...Y,description:"Origin token address; defaults to the origin chain\u2019s native token."},destinationCurrency:{...Y,description:"Destination token address; defaults to native ETH."},amount:ee('Origin token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),minAmountOut:ee('Minimum destination token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),slippageBps:{type:"integer",minimum:0,maximum:9999,default:me,description:"Slippage in basis points (50 = 0.5%)."},recipient:{...Y,description:"Destination recipient address; defaults to your wallet."},swap:{type:"object",additionalProperties:!1,required:["from","amountIn"],properties:{from:{type:"object",additionalProperties:!1,required:["address","chainId","symbol","decimals"],properties:{address:{...Y,description:"Input token address."},chainId:{type:"integer",minimum:1,description:"Input token chain ID."},symbol:{type:"string",description:"Input token symbol."},decimals:{type:"integer",minimum:0,maximum:255,description:"Input token decimal places."}},description:"Token supplied to the origin swap."},amountIn:ee('Swap input token amount in base units using its decimals (USDG has 6: "1000000" = 1 USDG).'),slippageBps:{type:"integer",minimum:0,maximum:1e4,description:"Slippage in basis points (50 = 0.5%)."}},description:"Optional origin swap before bridging."}}},async execute(i,c){try{return await Ve(e,i,c)}catch(r){throw new t(e.plainError(r))}}}]});export{at as a,dt as b,ut as c,ct as d};
|