@oakagentkit/core 0.3.0 → 0.3.2
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.d.ts +2 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.d.ts +3 -2
- 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/{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/{TMRAF2L2.js → 3UQXTZ5R.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/{M7BUKZW2.js → 4RCYYN6O.js} +1 -1
- package/build/dist/chunks/4ZD5D2UP.js +1 -0
- package/build/dist/chunks/{6OCLWSMZ.js → 5CPB33XA.js} +1 -1
- package/build/dist/chunks/{X5AL3DUK.js → 6D3XNCOX.js} +1 -1
- package/build/dist/chunks/{W4RYRLL5.js → 6GWXPQZ6.js} +1 -1
- package/build/dist/chunks/{D2IYA4LP.js → 72EV7TGI.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/{KZA5GYZR.js → AWV24X7F.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/{XBNZ7GTY.js → CXH46MHJ.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/{GP6YO24Z.js → FSYYD3OM.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/{65356YKW.js → HPY2ONAS.js} +1 -1
- package/build/dist/chunks/{C6VJAL5B.js → HUKDISRE.js} +1 -1
- package/build/dist/chunks/{XPWGPZ2C.js → HZSYMGJ2.js} +1 -1
- package/build/dist/chunks/{QMEGAKLI.js → I3ZBOSSH.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/{OODSXDIH.js → MGVX5EUH.js} +1 -1
- package/build/dist/chunks/NCAV7Q4C.js +6 -0
- 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/{HVFMIURK.js → OFWTO4N6.js} +1 -1
- package/build/dist/chunks/{B7BNDW35.js → OY5W7ZSL.js} +1 -1
- package/build/dist/chunks/{CD2JQ32C.js → PDGYM2WG.js} +1 -1
- package/build/dist/chunks/PHGHJ7SN.js +1 -0
- package/build/dist/chunks/{5R576SDB.js → PKYQ3XVA.js} +1 -1
- package/build/dist/chunks/{FN6GNTPR.js → PWJVC2FV.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/{Q7L3BX6U.js → SO6O7JK2.js} +1 -1
- package/build/dist/chunks/{2ZQ7X223.js → SOJHYMD7.js} +1 -1
- package/build/dist/chunks/SVKG4JOY.js +3 -0
- package/build/dist/chunks/{ORG6LVKJ.js → UBI3HBXD.js} +1 -1
- package/build/dist/chunks/{NWPAQER2.js → UCHJYWGU.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/{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/{QLFPAN6S.js → W7QNSNOH.js} +1 -1
- package/build/dist/chunks/{2ZBSE2LD.js → WCI3FHWT.js} +1 -1
- package/build/dist/chunks/X5I5EJ5T.js +6 -0
- package/build/dist/chunks/{JPPQDELB.js → XKLXVTSE.js} +3 -3
- package/build/dist/chunks/{OQFNUDMQ.js → XVOW6UCI.js} +1 -1
- package/build/dist/chunks/{P6OB2AFW.js → Y7HBFQYG.js} +1 -1
- package/build/dist/chunks/{25C4DTVA.js → YAVWSW3G.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/{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 Ce,o as le}from"./LKX5WDOQ.js";import{a as ue}from"./Z7FGEWO2.js";import{b as Ne}from"./SPJCSEKP.js";import{a as Ae}from"./IOYRL6AY.js";import{a as ve}from"./66F5ZH34.js";import{e as X,g as p,i as xe,n as Ie}from"./NWNYJ26T.js";import{b as A,j as Te}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as de}from"./JXOEJPJ4.js";import{decodeErrorResult as Me,decodeEventLog as ce,encodeAbiParameters as U,encodeFunctionData as C,erc20Abi as J,parseAbi as $e,parseAbiParameters as q,toHex as Be,zeroAddress as F}from"viem";var g=Te[A].poolsTrade,Y=g.liquidityLauncher.address,B=g.uerc20BeneficiaryVault.address,fe=g.universalRouter.address,ie=10n**27n,j=(1n<<128n)-1n,Se=`0x${"00".repeat(32)}`,D=63127652n,pe=100000n,ae=10000000n,Ue=2000n,me={address:ue,symbol:"ETH",decimals:18,chainId:A},h=$e(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),K=$e(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),V=[g.instantLaunchStrategyFeesOn.address,g.instantLaunchStrategyFeesOff.address];function re(l){if(l.status!=="success")throw new r("The launch receipt did not succeed.");let c=[];for(let k of l.logs){let H=V.findIndex(L=>p(L,k.address));if(H===-1||k.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let G=ce({abi:K,eventName:"TokenLaunched",data:k.data,topics:[...k.topics]}),{token:x,poolId:ee,poolKey:M,feeSplitter:te}=G.args,_=H===0?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address;if(!p(te,_)||!p(M.currency0,F)||!p(M.currency1,x)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,F))throw new r("The launch does not match the current native ETH strategy.");let ne=l.logs.filter(L=>p(L.address,g.v4PositionManager.address)).flatMap(L=>{if(L.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let O=ce({abi:K,eventName:"Transfer",data:L.data,topics:[...L.topics]}).args;return p(O.from,F)&&p(O.to,V[H])?[O.tokenId]:[]});if(ne.length!==1)throw new r("The launch receipt must identify one matching position mint.");c.push({token:x,poolId:ee,positionId:ne[0].toString(),creatorFees:H===0})}return c}function S(l){return xe(l,"Provide a valid wallet or token address.")}function P(l,c,k=!1){return Ie(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!k})}function Z(l,c,k=!1){if(k&&l===void 0)return"";if(typeof l!="string"||!k&&!l.trim()||l.length>4096)throw new r(`Provide a valid ${c}.`);return l}function he(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new r("Provide a valid launch transaction hash.");return l}function ge(l,c,k="minAmountOut"){let H=c.slippageBps??Ce;if(typeof H!="number")throw new r("Slippage must be an integer in basis points.");let G=le(l.toString(),H),x=c[k]===void 0?BigInt(G):P(c[k],k,l===0n);if(x>l||l>0n&&x===0n||x>j)throw new r("The minimum output must be positive and no larger than the simulated output.");return x}var qe=l=>{let c=l.clientFor(A),k=(e,o,n,s)=>l.unsignedTx({to:e,data:o,value:n.toString(),chainId:A,description:s}),H=e=>{throw new r(l.plainError(e))};async function G(){if(await c.getChainId()!==A)throw new r("pools.trade requires Robinhood Chain 4663.")}async function x(e,o,n){let s=await l.preview(e,o),t=s.changes.map(({token:a,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,a.decimals)} ${de(a.symbol)} (${a.address}, chain ${a.chainId})`});return{txs:e,summary:[n,s.summary,...t].join(" ")}}async function ee(){return(await c.getBlock()).timestamp+600n}function M(e,o,n,s,t,a){let d=[F,e,2500,25,F],i=[U(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,o,n,s,0n,"0x"]]),U(q("address,uint256"),[o?F:e,n]),U(q("address,address,uint256"),[o?e:F,t,0n])],m=[U(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:m,encoded:U(q("bytes,bytes[],uint256"),["0x10",m,a])}}async function te(e,o){let n=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:o,gas:Be(Ae),to:i.to,data:i.data,value:Be(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(n)||n.length!==1||!X(n[0])||!Array.isArray(n[0].calls)||n[0].calls.length!==e.length)throw new r("The output simulation returned a malformed response.");let s=n[0].calls;if(!s.slice(0,-1).every(i=>X(i)&&i.status==="0x1"&&!i.error))throw new r("A prerequisite failed during the output simulation.");let t=s.at(-1);if(!X(t)||t.status!=="0x0")throw new r("The output simulation did not return the expected minimum-output control.");let a=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:X(t.error)?t.error.data:void 0;if(typeof a!="string"||!/^0x[0-9a-fA-F]+$/.test(a))throw new r("The output simulation did not report an expected amount.");let d=Me({abi:h,data:a});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==j||d.args[1]<=0n||d.args[1]>=j)throw new r("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ne=2e3;async function L(e,o,n,s=()=>!0){let t=await c.getBlockNumber(),a=t<D?0n:(t-D)/ae+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Ue)throw new r("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(a*BigInt(V.length+(e&&!n?1:0)));let m=new Map,b=new Set;for(let u=D;u<=t&&s();u+=ae){let f=u+ae-1n>t?t:u+ae-1n,y=(await Promise.all(V.map(T=>c.getLogs({address:T,event:K[0],...o?{args:{token:o}}:{},fromBlock:u,toBlock:f,strict:!0})))).flat(),$=[...new Set(y.map(T=>T.transactionHash))].filter(T=>!T||!m.has(T));for(let T=0;T<$.length&&s();T+=8)await Promise.all($.slice(T,T+8).map(async E=>{if(!E)throw new r("A launch log is missing its transaction hash.");let R=_.get(E);R||(i(),R=await c.getTransactionReceipt({hash:E}),_.size>=ne&&_.delete(_.keys().next().value),_.set(E,R)),m.set(E,R),s()&&await n?.(R)}));if(!s())break;if(e&&!n){let T=await c.getLogs({address:B,event:K[1],args:{to:e},fromBlock:u,toBlock:f,strict:!0});for(let E of T){let R=ce({abi:K,eventName:"Transfer",data:E.data,topics:E.topics}).args;b.add(R.tokenId.toString())}}}return{receipts:[...m.values()],feeIds:b}}async function O(e){let n=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:he(e.launchTx)})]:(await L(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(re).filter(s=>e.positionId!==void 0?s.positionId===P(e.positionId,"positionId").toString():p(s.token,S(e.token)));if(n.length!==1)throw new r("No unique current-strategy launch was found. Older strategy generations are unsupported.");return n[0]}async function Ee(e,o){if(typeof e.creatorFees!="boolean")throw new r("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),F)&&!p(S(e.pair),ue))throw new r("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new r("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&P(e.supply,"supply")!==ie)throw new r("Instant Launch requires a supply of one billion tokens.");let n=S(e.feeBeneficiary);if(p(n,F)||p(n,Y))throw new r("The fee beneficiary must be a wallet other than the launcher or zero address.");let s=Z(e.name,"name"),t=Z(e.symbol,"symbol"),a=e.initialBuy===void 0?0n:P(e.initialBuy,"initialBuy",!0);if(a>j)throw new r("The initial buy exceeds uint128.");if(a===0n&&e.minAmountOut!==void 0)throw new r("A minimum output requires an initial buy.");let d=await c.readContract({address:Y,abi:h,functionName:"getGraffiti",args:[o]}),i=S(await c.readContract({address:g.uerc20Factory.address,abi:h,functionName:"getUERC20Address",args:[s,t,18,Y,d]})),m=await c.getCode({address:i});if(m&&m!=="0x")throw new r("This wallet already launched that name and symbol.");let b=U(q("(string,string,string,bytes)"),[[Z(e.description,"description",!0),Z(e.website,"website",!0),Z(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?V[0]:V[1],f=[C({abi:h,functionName:"createToken",args:[g.uerc20Factory.address,s,t,18,ie,Y,b]}),C({abi:h,functionName:"distributeToken",args:[i,{strategy:u,amount:ie,configData:U(q("address"),[n])},Se]})],y=await ee(),v=T=>{let E=[...f];if(a>0n){let R=U(q("(address,address,bytes)"),[[fe,o,M(i,!0,a,T,o,y).encoded]]);E.push(C({abi:h,functionName:"distributeWithNative",args:[g.universalRouterStrategyApp.address,R,Se,a]}))}return k(Y,C({abi:h,functionName:"multicall",args:[E]}),a,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${n}.`)},$=a>0n?ge(await te([v(j)],o),e):0n;return x([v($)],o,`Launch ${s} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${n}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${$} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Fe(e,o,n){let s=P(e.amountIn,"amountIn");if(s>j)throw new r("The trade amount exceeds uint128.");let t=S(e.token);await O(e);let a=await ee(),d=[];n||(await c.readContract({address:t,abi:J,functionName:"allowance",args:[o,g.permit2.address]})<s&&d.push(l.approval(t,g.permit2.address,s.toString(),A)),d.push(k(g.permit2.address,C({abi:h,functionName:"approve",args:[t,fe,s,Number(a)]}),0n,`Permit the exact ${s} token base units until ${a}.`)));let i=u=>[...d,k(fe,C({abi:h,functionName:"execute",args:["0x10",M(t,n,s,u,o,a).inputs,a]}),n?s:0n,`${n?"Buy":"Sell"} ${t} with minimum output ${u}.`)],m=await te(i(j),o),b=ge(m,e);return x(i(b),o,`${n?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${s}, minimum output ${b} ${n?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function we(e,o,n){let s=await O(e),t=BigInt(s.positionId),a=s.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,d=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,a))throw new r("The position is not locked in its current-strategy splitter.");if(!n)return x([k(a,C({abi:h,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],o,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(i,o))throw new r("Only the current fee NFT holder is entitled to claim.");let m=await c.readContract({address:B,abi:h,functionName:"amounts",args:[t]}),b=ge(m[0],e,"minEth");if(m[1]!==0n)throw new r("The current buy-only creator fee configuration returned unexpected token fees.");return x([k(B,C({abi:h,functionName:"claim",args:[t,b,0n]}),0n,`Claim collected ETH fees for position ${t} to ${o}.`)],o,`Claim collected fees: ${m[0]} ETH base units (18 decimals), minimum ${b}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function Le(e,o){let n=await O(e),s=S(e.to);if(p(s,F))throw new r("The token recipient cannot be the zero address.");let t=P(e.amount,"amount"),a=await oe(n.token,await c.getBlockNumber());return x([k(a.address,C({abi:J,functionName:"transfer",args:[s,t]}),0n,`Transfer exactly ${t} ${de(a.symbol)} base units to ${s}.`)],o,`Transfer ${t} token base units (token ${a.address}, decimals ${a.decimals}, chain ${a.chainId}) to ${s}. No approval; no transaction sent.`)}async function Oe(e,o){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new r("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let n=e.positionIds.map(d=>P(d,"positionId").toString());if(new Set(n).size!==n.length)throw new r("Each position ID must appear once.");let s=e.launchTxs.map(he),t=new Map;for(let[d,i]of n.entries()){let b=(await O({positionId:i,launchTx:s[d]})).creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,u=BigInt(i),f=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[u]});if(!p(f,b))throw new r("The position is not locked in its current-strategy splitter.");t.set(b,[...t.get(b)??[],u])}let a=[...t].map(([d,i])=>k(d,C({abi:h,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return x(a,o,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let Q="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function oe(e,o){let[n,s]=await Promise.all([c.readContract({address:e,abi:J,functionName:"symbol",blockNumber:o}),c.readContract({address:e,abi:J,functionName:"decimals",blockNumber:o})]);if(typeof n!="string"||!n||n.length>256||s!==18)throw new r("The current launch token returned invalid metadata.");return{address:e,symbol:n,decimals:s,chainId:A}}async function be(e,o,n,s){let t=s??await oe(e.token,n),a=await c.readContract({address:t.address,abi:J,functionName:"balanceOf",args:[o],blockNumber:n});return{token:t,amount:a.toString(),humanAmount:l.formatAmount(a.toString(),t.decimals)}}async function Pe(e,o){let n=await O(e),s=await c.getBlockNumber();return{wallet:o,...await be(n,o,s),blockNumber:s.toString(),coverage:Q}}async function He(e,o){let n=he(e.launchTx),s=await c.getTransactionReceipt({hash:n}),t=re(s);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===P(e.positionId,"positionId").toString())),!t.length)throw new r("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let a=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let m=i.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,b=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a});if(!p(b,m))throw new r("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a}),approved:await c.readContract({address:B,abi:h,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:a}),collected:await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:a})}:void 0,f=await oe(i.token,a);return{...i,token:f,custodian:b,holding:await be(i,o,a,f),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:me,amount:u.collected[0].toString()},{token:f,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:n,wallet:o,creator:s.from,blockNumber:a.toString(),launches:d,coverage:Q}}async function Re(e){let o=await c.getBlockNumber(),n=e.limit??20;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>50)throw new r("limit must be an integer from 1 to 50.");let s=e.fromBlock===void 0?o>=D+pe?o-pe+1n:D:P(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?o:P(e.toBlock,"toBlock",!0),a=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new r("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),f=BigInt(u[0]),y=BigInt(u[1]);if(e.fromBlock!==void 0&&s!==f||e.toBlock!==void 0&&t!==y)throw new r("The cursor does not match this block range.");s=f,t=y,a=Number(u[2])}if(o<D&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:D.toString(),toBlock:o.toString(),coverage:Q,predeployment:!0};if(s<D||t<s||t>o||t-s>=pe)throw new r("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:V,event:K[0],fromBlock:s,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new r("The launch feed returned an incomplete log.");if(d.sort((u,f)=>u.blockNumber===f.blockNumber?f.logIndex-u.logIndex:u.blockNumber>f.blockNumber?-1:1),a>d.length)throw new r("The browse cursor is outside the launch feed.");let i=new Map,m=[];for(let u of d.slice(a,a+n)){let f=u.transactionHash,y=i.get(f);y||(y=await c.getTransactionReceipt({hash:f}),i.set(f,y));let v=ce({abi:K,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,$=re(y).filter(T=>p(T.token,v.token)&&p(T.poolId,v.poolId));if($.length!==1)throw new r("The launch feed log does not match one verified receipt launch.");m.push({...$[0],launchTx:f,blockNumber:u.blockNumber.toString(),token:await oe($[0].token,t),creator:y.from})}let b=a+n;return{launches:m,cursor:b<d.length?`${s}:${t}:${b}`:null,fromBlock:s.toString(),toBlock:t.toString(),coverage:Q,previousToBlock:s>D?(s-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ye(e,o,n){let s=await O(e);if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let t=BigInt(s.positionId),a=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(a,g.feeSplitterFeesOn.address))throw new r("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,o))throw new r("Only the current fee NFT holder can change this entitlement.");let i=S(n?e.to:e.spender);if(p(i,B)||n&&p(i,F))throw new r("The fee NFT recipient cannot be the vault or zero address.");let m=n?C({abi:h,functionName:"safeTransferFrom",args:[o,i,t]}):C({abi:h,functionName:"approve",args:[i,t]});return x([k(B,m,0n,n?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],o,n?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function De(){return{chainId:A,instant:{supported:!0,supply:ie.toString(),decimals:18,currency:me,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:Q}}let w=e=>({type:"string",description:e}),I=e=>ve(e),se="Launched token contract address (0x + 40 hex digits).",z="Transaction hash (0x + 64 hex digits) of the token launch; lets the tool find the launch without scanning. Optional where the token or position is given.",W='Liquidity position NFT id for the launch, as a decimal string. Example: "1".',ke={chainId:{type:"integer",const:A,description:"Chain id; only 4663 (Robinhood Chain mainnet) is accepted. Optional."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage tolerance in basis points (50 = 0.5%) used to derive minimum outputs when none is given. Optional."}};function N(e,o,n,s){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...ke,...o},required:n},execute:async(t,a)=>{try{let d=new Set([...Object.keys(ke),...Object.keys(o)]);if(Object.keys(t).some(i=>!d.has(i)))throw new r("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==A)throw new r("pools.trade requires chain 4663.");if(S(a),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new r("Slippage must be an integer in basis points.");le("10000",t.slippageBps)}return await G(),await s(t,a)}catch(d){H(d)}}}}return{tools:[N("launch",{name:w("Token name, shown in wallets and explorers."),symbol:w("Token ticker symbol."),creatorFees:{type:"boolean",description:"Permanent choice; must be explicit. true enables creator fees paid to feeBeneficiary from buys; false disables them forever."},feeBeneficiary:w("Address that receives creator fees; must not be the zero address or the launcher."),pair:w("Optional pair currency; only native ETH is supported (the zero address or the native ETH sentinel)."),decimals:{type:"integer",const:18,description:"Token decimals; must be 18 for an Instant Launch."},supply:I("Total token supply in base units (18 decimals); must be 1000000000000000000000000000 = one billion tokens."),initialBuy:I('ETH to spend on an initial buy in the same transaction, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.'),minAmountOut:I('Least new tokens to receive from the initial buy, in token base units (18 decimals). Requires initialBuy. Example: "1000000000000000000" = 1 token.'),description:w("Optional token description stored in token metadata."),website:w("Optional website URL stored in token metadata."),imageUri:w("Optional image URI stored in token metadata.")},["name","symbol","creatorFees","feeBeneficiary"],Ee),...["buy","sell"].map(e=>N(e,{token:w(se),amountIn:I(e==="buy"?'ETH to spend, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.':'Tokens to sell, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),minAmountOut:I(e==="buy"?'Least tokens to receive, in token base units (18 decimals). Example: "1000000000000000000" = 1 token. Defaults from slippageBps.':'Least ETH to receive, in wei base units (18 decimals). Example: "1000000000000000" = 0.001 ETH. Defaults from slippageBps.'),launchTx:w(z)},["token","amountIn"],(o,n)=>Fe(o,n,e==="buy"))),N("collect",{positionId:I(W),launchTx:w(z)},["positionId"],(e,o)=>we(e,o,!1)),N("claim",{positionId:I(W),launchTx:w(z),minEth:I('Least ETH you must receive from the claim, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.')},["positionId"],(e,o)=>we(e,o,!0)),N("browse",{fromBlock:I("First block number of the scan range, as a decimal string. Defaults to the most recent 100000 blocks."),toBlock:I("Last block number of the scan range, as a decimal string. Defaults to the latest block."),limit:{type:"integer",minimum:1,maximum:50,description:"Launches per page, 1 to 50 (default 20)."},cursor:w("Opaque pagination cursor exactly as returned by the previous browse call.")},[],Re),N("balance",{token:w(se),launchTx:w(z)},["token"],Pe),N("status",{launchTx:w("Transaction hash (0x + 64 hex digits) of the token launch to inspect."),token:w(se),positionId:I(W)},["launchTx"],He),N("launch_options",{},[],De),N("fee_transfer",{positionId:I(W),launchTx:w(z),to:w("Address that will become the new holder of the fee NFT and its future creator fees. Use the intended address.")},["positionId","to"],(e,o)=>ye(e,o,!0)),N("fee_approve",{positionId:I(W),launchTx:w(z),spender:w("Address approved to move the fee NFT. Use the intended address.")},["positionId","spender"],(e,o)=>ye(e,o,!1)),N("transfer",{token:w(se),amount:I('Tokens to send, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),to:w("Recipient address of the tokens; must not be the zero address. Use the intended address."),launchTx:w(z)},["token","amount","to"],Le),N("collect_many",{positionIds:{type:"array",items:I(W),minItems:1,maxItems:20,description:"Position NFT ids to collect fees for, decimal strings; same order as launchTxs."},launchTxs:{type:"array",items:w("Launch transaction hash (0x + 64 hex digits) matching the position id at the same index."),minItems:1,maxItems:20,description:"Launch transaction hashes, one per position id, in the same order."}},["positionIds","launchTxs"],Oe)],positions:async(e,o)=>{S(e);let n=[],s=0,t=!0,a=o?.deepScan?2e4:6e3,d=o?.signal,i,m,b=f=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:A,assets:[],incomplete:!0,description:`${f} Checked ${s} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),u=async()=>{await G(),t&&await L(e,void 0,async f=>{s++;for(let y of re(f)){if(!t)return;let v=y.creatorFees&&p(await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(y.positionId)]}),e);if(!t)return;if(!v&&!p(f.from,e))continue;let $=v?[{token:me,amount:(await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(y.positionId)]}))[0].toString()}]:[];t&&n.push({module:"poolstrade",id:y.positionId,chainId:A,assets:$,description:`Current Instant Launch ${y.token} (18 decimals, supply 1000000000), pool ${y.poolId}; creator fees ${y.creatorFees?"on":"off"} (permanent). ${v?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>t)};try{if(d?.aborted)return[b("Pools.trade discovery was cancelled; the historical scan is incomplete.")];let f=new Promise(v=>{i=()=>{t=!1,v("aborted")},d?.addEventListener("abort",i,{once:!0}),m=setTimeout(()=>{t=!1,v("budget")},a)}),y=await Promise.race([u().then(()=>"complete"),f]);return y==="complete"?n:[...n,b(y==="aborted"?"Pools.trade discovery was cancelled; the historical scan is incomplete.":`Pools.trade global launch discovery reached its ${a} ms read budget; the historical scan is incomplete.`)]}catch(f){return[...n,b(`Pools.trade discovery could not finish: ${l.plainError(f)}`)]}finally{t=!1,m!==void 0&&clearTimeout(m),i&&d?.removeEventListener("abort",i)}}}};function Ye(l){return Ne("poolstrade",[qe(l)])}export{re as a,qe as b,Ye as c};
|
|
1
|
+
import{b as Ce,o as le}from"./GYPMUYB5.js";import{a as ue}from"./Z7FGEWO2.js";import{b as Ne}from"./SPJCSEKP.js";import{a as Ae}from"./IOYRL6AY.js";import{a as ve}from"./66F5ZH34.js";import{e as X,g as p,i as xe,n as Ie}from"./NWNYJ26T.js";import{b as A,j as Te}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as de}from"./JXOEJPJ4.js";import{decodeErrorResult as Me,decodeEventLog as ce,encodeAbiParameters as U,encodeFunctionData as C,erc20Abi as J,parseAbi as $e,parseAbiParameters as q,toHex as Be,zeroAddress as F}from"viem";var g=Te[A].poolsTrade,Y=g.liquidityLauncher.address,B=g.uerc20BeneficiaryVault.address,fe=g.universalRouter.address,ie=10n**27n,j=(1n<<128n)-1n,Se=`0x${"00".repeat(32)}`,D=63127652n,pe=100000n,ae=10000000n,Ue=2000n,me={address:ue,symbol:"ETH",decimals:18,chainId:A},h=$e(["function multicall(bytes[] data) payable returns (bytes[])","function createToken(address factory,string name,string symbol,uint8 decimals,uint128 initialSupply,address recipient,bytes tokenData) payable returns (address)","function distributeToken(address token,(address strategy,uint128 amount,bytes configData) distribution,bytes32 salt) payable","function distributeWithNative(address strategy,bytes configData,bytes32 salt,uint256 nativeAmount) payable","function getGraffiti(address sender) view returns (bytes32)","function getUERC20Address(string name,string symbol,uint8 decimals,address recipient,bytes32 graffiti) view returns (address)","function execute(bytes commands,bytes[] inputs,uint256 deadline) payable","function collectFees(uint256[] ids)","function claim(uint256 id,uint256 minCurrency0Amount,uint256 minCurrency1Amount)","function amounts(uint256 id) view returns (uint128 eth,uint128 token)","function ownerOf(uint256 id) view returns (address)","function getApproved(uint256 id) view returns (address)","function approve(address spender,uint256 id)","function safeTransferFrom(address from,address to,uint256 id)","function approve(address token,address spender,uint160 amount,uint48 expiration)","error V4TooLittleReceived(uint256 minAmountOut,uint256 amountOut)"]),K=$e(["event TokenLaunched(bytes32 indexed poolId,address indexed token,address indexed feeSplitter,(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey)","event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)"]),V=[g.instantLaunchStrategyFeesOn.address,g.instantLaunchStrategyFeesOff.address];function re(l){if(l.status!=="success")throw new r("The launch receipt did not succeed.");let c=[];for(let k of l.logs){let H=V.findIndex(L=>p(L,k.address));if(H===-1||k.topics[0]!=="0x3b3d2bafdcae274a232217e1f80ee4305d3af6aa25c8b14b1681bd68d18042a4")continue;let G=ce({abi:K,eventName:"TokenLaunched",data:k.data,topics:[...k.topics]}),{token:x,poolId:ee,poolKey:M,feeSplitter:te}=G.args,_=H===0?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address;if(!p(te,_)||!p(M.currency0,F)||!p(M.currency1,x)||M.fee!==2500||M.tickSpacing!==25||!p(M.hooks,F))throw new r("The launch does not match the current native ETH strategy.");let ne=l.logs.filter(L=>p(L.address,g.v4PositionManager.address)).flatMap(L=>{if(L.topics[0]!=="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")return[];let O=ce({abi:K,eventName:"Transfer",data:L.data,topics:[...L.topics]}).args;return p(O.from,F)&&p(O.to,V[H])?[O.tokenId]:[]});if(ne.length!==1)throw new r("The launch receipt must identify one matching position mint.");c.push({token:x,poolId:ee,positionId:ne[0].toString(),creatorFees:H===0})}return c}function S(l){return xe(l,"Provide a valid wallet or token address.")}function P(l,c,k=!1){return Ie(l,`${c} is outside its supported range.`,{notString:`${c} must be an integer string in base units.`,positive:!k})}function Z(l,c,k=!1){if(k&&l===void 0)return"";if(typeof l!="string"||!k&&!l.trim()||l.length>4096)throw new r(`Provide a valid ${c}.`);return l}function he(l){if(typeof l!="string"||!/^0x[0-9a-fA-F]{64}$/.test(l))throw new r("Provide a valid launch transaction hash.");return l}function ge(l,c,k="minAmountOut"){let H=c.slippageBps??Ce;if(typeof H!="number")throw new r("Slippage must be an integer in basis points.");let G=le(l.toString(),H),x=c[k]===void 0?BigInt(G):P(c[k],k,l===0n);if(x>l||l>0n&&x===0n||x>j)throw new r("The minimum output must be positive and no larger than the simulated output.");return x}var qe=l=>{let c=l.clientFor(A),k=(e,o,n,s)=>l.unsignedTx({to:e,data:o,value:n.toString(),chainId:A,description:s}),H=e=>{throw new r(l.plainError(e))};async function G(){if(await c.getChainId()!==A)throw new r("pools.trade requires Robinhood Chain 4663.")}async function x(e,o,n){let s=await l.preview(e,o),t=s.changes.map(({token:a,amount:d})=>{let i=d.startsWith("-");return`${i?"-":""}${l.formatAmount(i?d.slice(1):d,a.decimals)} ${de(a.symbol)} (${a.address}, chain ${a.chainId})`});return{txs:e,summary:[n,s.summary,...t].join(" ")}}async function ee(){return(await c.getBlock()).timestamp+600n}function M(e,o,n,s,t,a){let d=[F,e,2500,25,F],i=[U(q("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),[[d,o,n,s,0n,"0x"]]),U(q("address,uint256"),[o?F:e,n]),U(q("address,address,uint256"),[o?e:F,t,0n])],m=[U(q("bytes,bytes[]"),["0x060c0e",i])];return{inputs:m,encoded:U(q("bytes,bytes[],uint256"),["0x10",m,a])}}async function te(e,o){let n=await c.request({method:"eth_simulateV1",params:[{blockStateCalls:[{calls:e.map(i=>({from:o,gas:Be(Ae),to:i.to,data:i.data,value:Be(BigInt(i.value))}))}],validation:!1,traceTransfers:!1},"latest"]},{retryCount:0});if(!Array.isArray(n)||n.length!==1||!X(n[0])||!Array.isArray(n[0].calls)||n[0].calls.length!==e.length)throw new r("The output simulation returned a malformed response.");let s=n[0].calls;if(!s.slice(0,-1).every(i=>X(i)&&i.status==="0x1"&&!i.error))throw new r("A prerequisite failed during the output simulation.");let t=s.at(-1);if(!X(t)||t.status!=="0x0")throw new r("The output simulation did not return the expected minimum-output control.");let a=typeof t.returnData=="string"&&t.returnData!=="0x"?t.returnData:X(t.error)?t.error.data:void 0;if(typeof a!="string"||!/^0x[0-9a-fA-F]+$/.test(a))throw new r("The output simulation did not report an expected amount.");let d=Me({abi:h,data:a});if(d.errorName!=="V4TooLittleReceived"||d.args[0]!==j||d.args[1]<=0n||d.args[1]>=j)throw new r("The output simulation did not report a valid amount.");return d.args[1]}let _=new Map,ne=2e3;async function L(e,o,n,s=()=>!0){let t=await c.getBlockNumber(),a=t<D?0n:(t-D)/ae+1n,d=1n,i=(u=1n)=>{if(d+=u,d>Ue)throw new r("Pools.trade scan exceeds the 2000-request limit. Use launchTx for a specific launch; positions coverage is incomplete.")};i(a*BigInt(V.length+(e&&!n?1:0)));let m=new Map,b=new Set;for(let u=D;u<=t&&s();u+=ae){let f=u+ae-1n>t?t:u+ae-1n,y=(await Promise.all(V.map(T=>c.getLogs({address:T,event:K[0],...o?{args:{token:o}}:{},fromBlock:u,toBlock:f,strict:!0})))).flat(),$=[...new Set(y.map(T=>T.transactionHash))].filter(T=>!T||!m.has(T));for(let T=0;T<$.length&&s();T+=8)await Promise.all($.slice(T,T+8).map(async E=>{if(!E)throw new r("A launch log is missing its transaction hash.");let R=_.get(E);R||(i(),R=await c.getTransactionReceipt({hash:E}),_.size>=ne&&_.delete(_.keys().next().value),_.set(E,R)),m.set(E,R),s()&&await n?.(R)}));if(!s())break;if(e&&!n){let T=await c.getLogs({address:B,event:K[1],args:{to:e},fromBlock:u,toBlock:f,strict:!0});for(let E of T){let R=ce({abi:K,eventName:"Transfer",data:E.data,topics:E.topics}).args;b.add(R.tokenId.toString())}}}return{receipts:[...m.values()],feeIds:b}}async function O(e){let n=(e.launchTx!==void 0?[await c.getTransactionReceipt({hash:he(e.launchTx)})]:(await L(void 0,e.token===void 0?void 0:S(e.token))).receipts).flatMap(re).filter(s=>e.positionId!==void 0?s.positionId===P(e.positionId,"positionId").toString():p(s.token,S(e.token)));if(n.length!==1)throw new r("No unique current-strategy launch was found. Older strategy generations are unsupported.");return n[0]}async function Ee(e,o){if(typeof e.creatorFees!="boolean")throw new r("creatorFees must be an explicit boolean; the choice is permanent.");if(e.pair!==void 0&&!p(S(e.pair),F)&&!p(S(e.pair),ue))throw new r("Only the native ETH pair is supported.");if(e.decimals!==void 0&&e.decimals!==18)throw new r("Instant Launch requires 18 decimals.");if(e.supply!==void 0&&P(e.supply,"supply")!==ie)throw new r("Instant Launch requires a supply of one billion tokens.");let n=S(e.feeBeneficiary);if(p(n,F)||p(n,Y))throw new r("The fee beneficiary must be a wallet other than the launcher or zero address.");let s=Z(e.name,"name"),t=Z(e.symbol,"symbol"),a=e.initialBuy===void 0?0n:P(e.initialBuy,"initialBuy",!0);if(a>j)throw new r("The initial buy exceeds uint128.");if(a===0n&&e.minAmountOut!==void 0)throw new r("A minimum output requires an initial buy.");let d=await c.readContract({address:Y,abi:h,functionName:"getGraffiti",args:[o]}),i=S(await c.readContract({address:g.uerc20Factory.address,abi:h,functionName:"getUERC20Address",args:[s,t,18,Y,d]})),m=await c.getCode({address:i});if(m&&m!=="0x")throw new r("This wallet already launched that name and symbol.");let b=U(q("(string,string,string,bytes)"),[[Z(e.description,"description",!0),Z(e.website,"website",!0),Z(e.imageUri,"image URI",!0),"0x"]]),u=e.creatorFees?V[0]:V[1],f=[C({abi:h,functionName:"createToken",args:[g.uerc20Factory.address,s,t,18,ie,Y,b]}),C({abi:h,functionName:"distributeToken",args:[i,{strategy:u,amount:ie,configData:U(q("address"),[n])},Se]})],y=await ee(),v=T=>{let E=[...f];if(a>0n){let R=U(q("(address,address,bytes)"),[[fe,o,M(i,!0,a,T,o,y).encoded]]);E.push(C({abi:h,functionName:"distributeWithNative",args:[g.universalRouterStrategyApp.address,R,Se,a]}))}return k(Y,C({abi:h,functionName:"multicall",args:[E]}),a,`Atomic Instant Launch: creator fees ${e.creatorFees?"on":"off"} (permanent); beneficiary ${n}.`)},$=a>0n?ge(await te([v(j)],o),e):0n;return x([v($)],o,`Launch ${s} (${i}, chain 4663), supply 1000000000, decimals 18. Creator fees ${e.creatorFees?"on":"off"} are permanent; fee beneficiary ${n}. Creator ETH fees come from buys only (recorded 0.09996%); sells compound into locked liquidity. Initial-buy minimum ${$} token base units. Off-chain image/display unproven; no private metadata registration. No transaction sent.`)}async function Fe(e,o,n){let s=P(e.amountIn,"amountIn");if(s>j)throw new r("The trade amount exceeds uint128.");let t=S(e.token);await O(e);let a=await ee(),d=[];n||(await c.readContract({address:t,abi:J,functionName:"allowance",args:[o,g.permit2.address]})<s&&d.push(l.approval(t,g.permit2.address,s.toString(),A)),d.push(k(g.permit2.address,C({abi:h,functionName:"approve",args:[t,fe,s,Number(a)]}),0n,`Permit the exact ${s} token base units until ${a}.`)));let i=u=>[...d,k(fe,C({abi:h,functionName:"execute",args:["0x10",M(t,n,s,u,o,a).inputs,a]}),n?s:0n,`${n?"Buy":"Sell"} ${t} with minimum output ${u}.`)],m=await te(i(j),o),b=ge(m,e);return x(i(b),o,`${n?"Buy":"Sell"} token ${t} (chain 4663, 18 decimals), amountIn ${s}, minimum output ${b} ${n?"token":"ETH"} base units (18 decimals). Recorded swap fee 0.2899%; creator ETH fees from buys only, none from sells. No transaction sent.`)}async function we(e,o,n){let s=await O(e),t=BigInt(s.positionId),a=s.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,d=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,a))throw new r("The position is not locked in its current-strategy splitter.");if(!n)return x([k(a,C({abi:h,functionName:"collectFees",args:[[t]]}),0n,`Collect fees for position ${t}; permissionless.`)],o,"Collect fees for the entitled recipients; collection does not transfer creator fees to the collector. No transaction sent.");if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let i=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(i,o))throw new r("Only the current fee NFT holder is entitled to claim.");let m=await c.readContract({address:B,abi:h,functionName:"amounts",args:[t]}),b=ge(m[0],e,"minEth");if(m[1]!==0n)throw new r("The current buy-only creator fee configuration returned unexpected token fees.");return x([k(B,C({abi:h,functionName:"claim",args:[t,b,0n]}),0n,`Claim collected ETH fees for position ${t} to ${o}.`)],o,`Claim collected fees: ${m[0]} ETH base units (18 decimals), minimum ${b}. Uncollected fees require poolstrade_collect first. No transaction sent.`)}async function Le(e,o){let n=await O(e),s=S(e.to);if(p(s,F))throw new r("The token recipient cannot be the zero address.");let t=P(e.amount,"amount"),a=await oe(n.token,await c.getBlockNumber());return x([k(a.address,C({abi:J,functionName:"transfer",args:[s,t]}),0n,`Transfer exactly ${t} ${de(a.symbol)} base units to ${s}.`)],o,`Transfer ${t} token base units (token ${a.address}, decimals ${a.decimals}, chain ${a.chainId}) to ${s}. No approval; no transaction sent.`)}async function Oe(e,o){if(!Array.isArray(e.positionIds)||e.positionIds.length<1||e.positionIds.length>20||!Array.isArray(e.launchTxs)||e.launchTxs.length!==e.positionIds.length)throw new r("Provide 1 to 20 positionIds and one matching launchTxs entry for each.");let n=e.positionIds.map(d=>P(d,"positionId").toString());if(new Set(n).size!==n.length)throw new r("Each position ID must appear once.");let s=e.launchTxs.map(he),t=new Map;for(let[d,i]of n.entries()){let b=(await O({positionId:i,launchTx:s[d]})).creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,u=BigInt(i),f=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[u]});if(!p(f,b))throw new r("The position is not locked in its current-strategy splitter.");t.set(b,[...t.get(b)??[],u])}let a=[...t].map(([d,i])=>k(d,C({abi:h,functionName:"collectFees",args:[i]}),0n,`Collect fees for positions ${i.join(", ")}; permissionless.`));return x(a,o,"Collect fees in batches for the fixed entitled recipients. Collection does not pay the collector. No transaction sent.")}let Q="Current native ETH Instant Launch strategies only. Crowd Launch and older deployments are not covered.";async function oe(e,o){let[n,s]=await Promise.all([c.readContract({address:e,abi:J,functionName:"symbol",blockNumber:o}),c.readContract({address:e,abi:J,functionName:"decimals",blockNumber:o})]);if(typeof n!="string"||!n||n.length>256||s!==18)throw new r("The current launch token returned invalid metadata.");return{address:e,symbol:n,decimals:s,chainId:A}}async function be(e,o,n,s){let t=s??await oe(e.token,n),a=await c.readContract({address:t.address,abi:J,functionName:"balanceOf",args:[o],blockNumber:n});return{token:t,amount:a.toString(),humanAmount:l.formatAmount(a.toString(),t.decimals)}}async function Pe(e,o){let n=await O(e),s=await c.getBlockNumber();return{wallet:o,...await be(n,o,s),blockNumber:s.toString(),coverage:Q}}async function He(e,o){let n=he(e.launchTx),s=await c.getTransactionReceipt({hash:n}),t=re(s);if(e.token!==void 0&&(t=t.filter(i=>p(i.token,S(e.token)))),e.positionId!==void 0&&(t=t.filter(i=>i.positionId===P(e.positionId,"positionId").toString())),!t.length)throw new r("The receipt contains no matching current Instant Launch. Crowd Launch and older strategies are not covered.");let a=await c.getBlockNumber(),d=await Promise.all(t.map(async i=>{let m=i.creatorFees?g.feeSplitterFeesOn.address:g.feeSplitterFeesOff.address,b=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a});if(!p(b,m))throw new r("The position is not locked in its current-strategy splitter.");let u=i.creatorFees?{owner:await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(i.positionId)],blockNumber:a}),approved:await c.readContract({address:B,abi:h,functionName:"getApproved",args:[BigInt(i.positionId)],blockNumber:a}),collected:await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(i.positionId)],blockNumber:a})}:void 0,f=await oe(i.token,a);return{...i,token:f,custodian:b,holding:await be(i,o,a,f),...u?{feeEntitlement:{owner:u.owner,approved:u.approved,collected:[{token:me,amount:u.collected[0].toString()},{token:f,amount:u.collected[1].toString()}],uncollectedFeesIncluded:!1}}:{}}}));return{launchTx:n,wallet:o,creator:s.from,blockNumber:a.toString(),launches:d,coverage:Q}}async function Re(e){let o=await c.getBlockNumber(),n=e.limit??20;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>50)throw new r("limit must be an integer from 1 to 50.");let s=e.fromBlock===void 0?o>=D+pe?o-pe+1n:D:P(e.fromBlock,"fromBlock",!0),t=e.toBlock===void 0?o:P(e.toBlock,"toBlock",!0),a=0;if(e.cursor!==void 0){if(typeof e.cursor!="string"||!/^[0-9]{1,78}:[0-9]{1,78}:[0-9]{1,10}$/.test(e.cursor))throw new r("Provide the browse cursor exactly as returned.");let u=e.cursor.split(":"),f=BigInt(u[0]),y=BigInt(u[1]);if(e.fromBlock!==void 0&&s!==f||e.toBlock!==void 0&&t!==y)throw new r("The cursor does not match this block range.");s=f,t=y,a=Number(u[2])}if(o<D&&e.fromBlock===void 0&&e.toBlock===void 0&&e.cursor===void 0)return{launches:[],cursor:null,fromBlock:D.toString(),toBlock:o.toString(),coverage:Q,predeployment:!0};if(s<D||t<s||t>o||t-s>=pe)throw new r("Choose a deployed block range of at most 100000 blocks, ending no later than the current head.");let d=await c.getLogs({address:V,event:K[0],fromBlock:s,toBlock:t,strict:!0});if(d.some(u=>u.blockNumber===null||u.logIndex===null||!u.transactionHash))throw new r("The launch feed returned an incomplete log.");if(d.sort((u,f)=>u.blockNumber===f.blockNumber?f.logIndex-u.logIndex:u.blockNumber>f.blockNumber?-1:1),a>d.length)throw new r("The browse cursor is outside the launch feed.");let i=new Map,m=[];for(let u of d.slice(a,a+n)){let f=u.transactionHash,y=i.get(f);y||(y=await c.getTransactionReceipt({hash:f}),i.set(f,y));let v=ce({abi:K,eventName:"TokenLaunched",data:u.data,topics:u.topics}).args,$=re(y).filter(T=>p(T.token,v.token)&&p(T.poolId,v.poolId));if($.length!==1)throw new r("The launch feed log does not match one verified receipt launch.");m.push({...$[0],launchTx:f,blockNumber:u.blockNumber.toString(),token:await oe($[0].token,t),creator:y.from})}let b=a+n;return{launches:m,cursor:b<d.length?`${s}:${t}:${b}`:null,fromBlock:s.toString(),toBlock:t.toString(),coverage:Q,previousToBlock:s>D?(s-1n).toString():null,summary:"Newest launches first within this fixed block range. Empty does not establish absence outside the range or covered strategies."}}async function ye(e,o,n){let s=await O(e);if(!s.creatorFees)throw new r("Creator fees are permanently disabled for this position.");let t=BigInt(s.positionId),a=await c.readContract({address:g.v4PositionManager.address,abi:h,functionName:"ownerOf",args:[t]});if(!p(a,g.feeSplitterFeesOn.address))throw new r("The position is not locked in its current-strategy splitter.");let d=await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[t]});if(!p(d,o))throw new r("Only the current fee NFT holder can change this entitlement.");let i=S(n?e.to:e.spender);if(p(i,B)||n&&p(i,F))throw new r("The fee NFT recipient cannot be the vault or zero address.");let m=n?C({abi:h,functionName:"safeTransferFrom",args:[o,i,t]}):C({abi:h,functionName:"approve",args:[i,t]});return x([k(B,m,0n,n?`Transfer fee NFT ${t} to ${i}, including accrued and future fees.`:`Approve ${i} for fee NFT ${t} only; zero address revokes approval.`)],o,n?`Transfer the entire fee entitlement for position ${t} to ${i}. This includes collected and future fees; locked LP remains in its splitter. No transaction sent.`:`Set the exact single-NFT approval for position ${t} to ${i}. This permits transfer of that fee entitlement; zero address revokes. No transaction sent.`)}async function De(){return{chainId:A,instant:{supported:!0,supply:ie.toString(),decimals:18,currency:me,permanentCreatorFeeChoice:!0},crowd:{status:"BLOCKED",strategy:"0xbf1aB81f7d534b2CC0Da76fcf4d541322bB0e000",factory:"0x000000001F26a0044BaA66024e7b6599c61963F8",missing:"A verified Pools-specific auction configuration (BlockNumberish timing, reserve allocation, Q96 floor/tick, USD FDV conversion, issuance steps, locked LP plan) and a bytecode-matched factory-created auction ABI with success/refund fixtures. Generic CCA parameters are not a verified Pools Crowd Launch.",source:"https://github.com/Uniswap/sdks/blob/main/sdks/liquidity-launcher-sdk/src/addresses.ts"},coverage:Q}}let w=e=>({type:"string",description:e}),I=e=>ve(e),se="Launched token contract address (0x + 40 hex digits).",z="Transaction hash (0x + 64 hex digits) of the token launch; lets the tool find the launch without scanning. Optional where the token or position is given.",W='Liquidity position NFT id for the launch, as a decimal string. Example: "1".',ke={chainId:{type:"integer",const:A,description:"Chain id; only 4663 (Robinhood Chain mainnet) is accepted. Optional."},slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage tolerance in basis points (50 = 0.5%) used to derive minimum outputs when none is given. Optional."}};function N(e,o,n,s){return{name:`poolstrade_${e}`,inputSchema:{type:"object",additionalProperties:!1,properties:{...ke,...o},required:n},execute:async(t,a)=>{try{let d=new Set([...Object.keys(ke),...Object.keys(o)]);if(Object.keys(t).some(i=>!d.has(i)))throw new r("Unsupported input for this pools.trade tool.");if(t.chainId!==void 0&&t.chainId!==A)throw new r("pools.trade requires chain 4663.");if(S(a),t.slippageBps!==void 0){if(typeof t.slippageBps!="number")throw new r("Slippage must be an integer in basis points.");le("10000",t.slippageBps)}return await G(),await s(t,a)}catch(d){H(d)}}}}return{tools:[N("launch",{name:w("Token name, shown in wallets and explorers."),symbol:w("Token ticker symbol."),creatorFees:{type:"boolean",description:"Permanent choice; must be explicit. true enables creator fees paid to feeBeneficiary from buys; false disables them forever."},feeBeneficiary:w("Address that receives creator fees; must not be the zero address or the launcher."),pair:w("Optional pair currency; only native ETH is supported (the zero address or the native ETH sentinel)."),decimals:{type:"integer",const:18,description:"Token decimals; must be 18 for an Instant Launch."},supply:I("Total token supply in base units (18 decimals); must be 1000000000000000000000000000 = one billion tokens."),initialBuy:I('ETH to spend on an initial buy in the same transaction, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.'),minAmountOut:I('Least new tokens to receive from the initial buy, in token base units (18 decimals). Requires initialBuy. Example: "1000000000000000000" = 1 token.'),description:w("Optional token description stored in token metadata."),website:w("Optional website URL stored in token metadata."),imageUri:w("Optional image URI stored in token metadata.")},["name","symbol","creatorFees","feeBeneficiary"],Ee),...["buy","sell"].map(e=>N(e,{token:w(se),amountIn:I(e==="buy"?'ETH to spend, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.':'Tokens to sell, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),minAmountOut:I(e==="buy"?'Least tokens to receive, in token base units (18 decimals). Example: "1000000000000000000" = 1 token. Defaults from slippageBps.':'Least ETH to receive, in wei base units (18 decimals). Example: "1000000000000000" = 0.001 ETH. Defaults from slippageBps.'),launchTx:w(z)},["token","amountIn"],(o,n)=>Fe(o,n,e==="buy"))),N("collect",{positionId:I(W),launchTx:w(z)},["positionId"],(e,o)=>we(e,o,!1)),N("claim",{positionId:I(W),launchTx:w(z),minEth:I('Least ETH you must receive from the claim, in wei base units (ETH has 18 decimals). Example: "1000000000000000" = 0.001 ETH.')},["positionId"],(e,o)=>we(e,o,!0)),N("browse",{fromBlock:I("First block number of the scan range, as a decimal string. Defaults to the most recent 100000 blocks."),toBlock:I("Last block number of the scan range, as a decimal string. Defaults to the latest block."),limit:{type:"integer",minimum:1,maximum:50,description:"Launches per page, 1 to 50 (default 20)."},cursor:w("Opaque pagination cursor exactly as returned by the previous browse call.")},[],Re),N("balance",{token:w(se),launchTx:w(z)},["token"],Pe),N("status",{launchTx:w("Transaction hash (0x + 64 hex digits) of the token launch to inspect."),token:w(se),positionId:I(W)},["launchTx"],He),N("launch_options",{},[],De),N("fee_transfer",{positionId:I(W),launchTx:w(z),to:w("Address that will become the new holder of the fee NFT and its future creator fees. Use the intended address.")},["positionId","to"],(e,o)=>ye(e,o,!0)),N("fee_approve",{positionId:I(W),launchTx:w(z),spender:w("Address approved to move the fee NFT. Use the intended address.")},["positionId","spender"],(e,o)=>ye(e,o,!1)),N("transfer",{token:w(se),amount:I('Tokens to send, in token base units (launched tokens have 18 decimals). Example: "1000000000000000000" = 1 token.'),to:w("Recipient address of the tokens; must not be the zero address. Use the intended address."),launchTx:w(z)},["token","amount","to"],Le),N("collect_many",{positionIds:{type:"array",items:I(W),minItems:1,maxItems:20,description:"Position NFT ids to collect fees for, decimal strings; same order as launchTxs."},launchTxs:{type:"array",items:w("Launch transaction hash (0x + 64 hex digits) matching the position id at the same index."),minItems:1,maxItems:20,description:"Launch transaction hashes, one per position id, in the same order."}},["positionIds","launchTxs"],Oe)],positions:async(e,o)=>{S(e);let n=[],s=0,t=!0,a=o?.deepScan?2e4:6e3,d=o?.signal,i,m,b=f=>({module:"poolstrade",id:"poolstrade-discovery-incomplete",chainId:A,assets:[],incomplete:!0,description:`${f} Checked ${s} launch receipts. Readable holdings are retained. Check a known launch with poolstrade_status {"launchTx":"<hash>"} or its token holding with poolstrade_balance {"token":"<address>","launchTx":"<hash>"}. Crowd Launch and older deployments are outside this reader's coverage.`}),u=async()=>{await G(),t&&await L(e,void 0,async f=>{s++;for(let y of re(f)){if(!t)return;let v=y.creatorFees&&p(await c.readContract({address:B,abi:h,functionName:"ownerOf",args:[BigInt(y.positionId)]}),e);if(!t)return;if(!v&&!p(f.from,e))continue;let $=v?[{token:me,amount:(await c.readContract({address:B,abi:h,functionName:"amounts",args:[BigInt(y.positionId)]}))[0].toString()}]:[];t&&n.push({module:"poolstrade",id:y.positionId,chainId:A,assets:$,description:`Current Instant Launch ${y.token} (18 decimals, supply 1000000000), pool ${y.poolId}; creator fees ${y.creatorFees?"on":"off"} (permanent). ${v?"Collected ETH fees only; uncollected fees excluded.":"Launch record; no fee entitlement held."} Liquidity is permanently locked.`})}},()=>t)};try{if(d?.aborted)return[b("Pools.trade discovery was cancelled; the historical scan is incomplete.")];let f=new Promise(v=>{i=()=>{t=!1,v("aborted")},d?.addEventListener("abort",i,{once:!0}),m=setTimeout(()=>{t=!1,v("budget")},a)}),y=await Promise.race([u().then(()=>"complete"),f]);return y==="complete"?n:[...n,b(y==="aborted"?"Pools.trade discovery was cancelled; the historical scan is incomplete.":`Pools.trade global launch discovery reached its ${a} ms read budget; the historical scan is incomplete.`)]}catch(f){return[...n,b(`Pools.trade discovery could not finish: ${l.plainError(f)}`)]}finally{t=!1,m!==void 0&&clearTimeout(m),i&&d?.removeEventListener("abort",i)}}}};function Ye(l){return Ne("poolstrade",[qe(l)])}export{re as a,qe as b,Ye as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as p,e as y}from"./VXCGMALF.js";import{a as m}from"./DFM4T6ZE.js";import{o as v}from"./W7QNSNOH.js";import{a as f}from"./66F5ZH34.js";import{b as l}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as w,getAddress as a,parseAbi as I}from"viem";var P="(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)",$="(address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96)",g=I([`function swapExactIn(${P} key,bool zeroForOne,uint128 amountIn,uint256 minOut,uint160 sqrtPriceLimitX96,address to,uint256 deadline) returns (uint256 paid,uint256 out)`,`function exactInputSingle(${$} params) payable returns (uint256 amountOut)`,"function multicall(uint256 deadline,bytes[] data) payable returns (bytes[] results)"]),E=I(["function quoteExactInputSingle((address tokenIn,address tokenOut,uint256 amountIn,uint24 fee,uint160 sqrtPriceLimitX96) params) returns (uint256 amountOut,uint160 sqrtPriceX96After,uint32 initializedTicksCrossed,uint256 gasEstimate)"]),_=I([`function quoteExactInputSingle((${P} poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut,uint256 gasEstimate)`]),C="0x0000000000000000000000000000000000000000",h={symbol:{type:"string",enum:m.tokens.map(e=>e.symbol),description:'Official stock ticker with a published Priors pool. Example: "TSLA".'},side:{type:"string",enum:["buy","sell"],description:'Choose "buy": pay USDG for the stock token; "sell": pay the stock token for USDG.'},amountIn:f('Input amount in base units: USDG (6 decimals) to buy, or the stock token (its decimals) to sell. Example: "1000000" = 1 USDG.')};async function O(e,o){let n=m.tokens.find(s=>s.symbol===e.symbol);if(!n||e.side!=="buy"&&e.side!=="sell")throw new u("Choose a published stock symbol and buy or sell.");let t=await v(String(e.symbol),{context:o});if(t.kind!=="official_stock"||t.address!==a(n.token))throw new u("Published Priors stock pool does not match the official stock contract address. Retry after the pool mapping is updated.");let r=y(e.amountIn,"amountIn",128);if(r===0n)throw new u("amountIn must be positive base units.");return{token:n,identity:t,amount:r,input:e.side==="buy"?p.usdg:a(n.token),output:e.side==="buy"?a(n.token):p.usdg}}function x(e,o,n){let[t,r]=BigInt(p.usdg)<BigInt(e)?[p.usdg,e]:[e,p.usdg];return{currency0:t,currency1:r,fee:o,tickSpacing:n,hooks:C}}function R(e){return{tools:[{name:"priors_stock_quote",inputSchema:{type:"object",properties:h,required:Object.keys(h),additionalProperties:!1},async execute(o,n){if(e.network==="testnet")throw new u("Priors stock swaps require mainnet chain 4663.");let t=await O(o,e),r=e.clientFor(l),s=await r.getBlockNumber({cacheTime:0}),k=await Promise.all(t.token.pools.map(async(i,d)=>{try{let c=x(a(t.token.token),i.fee,"tickSpacing"in i?i.tickSpacing:0),b=i.v===3?await r.simulateContract({address:a(m.v3.quoter),abi:E,functionName:"quoteExactInputSingle",args:[{tokenIn:t.input,tokenOut:t.output,amountIn:t.amount,fee:i.fee,sqrtPriceLimitX96:0n}],account:n,blockNumber:s}):await r.simulateContract({address:a(m.v4.quoter),abi:_,functionName:"quoteExactInputSingle",args:[{poolKey:c,zeroForOne:t.input===c.currency0,exactAmount:t.amount,hookData:"0x"}],account:n,blockNumber:s});return{poolIndex:d,version:i.v,amountOut:b.result[0].toString()}}catch(c){return{poolIndex:d,version:i.v,error:e.plainError(c)}}}));return{chainId:l,blockNumber:s.toString(),token:t.identity,quotes:k,warning:"Use explicit minimum output with priors_stock_swap and inspect its preview. Issuer restrictions can prevent sale. Quote is no promise of an exit; local regional eligibility remains required."}}},{name:"priors_stock_swap",inputSchema:{type:"object",properties:{...h,poolIndex:{type:"integer",minimum:0,maximum:2,description:"Index of the published pool to use, from priors_stock_quote (0 to 2)."},minOut:f("Minimum output in base units: the stock token when buying, USDG (6 decimals) when selling. Must be positive."),deadline:f("Deadline in Unix seconds, within the next 30 minutes. Example: 1800000000."),eligible:{type:"boolean",description:"Operator/user affirms eligibility for this stock-token trade in their jurisdiction."}},required:[...Object.keys(h),"poolIndex","minOut","deadline","eligible"],additionalProperties:!1},async execute(o,n){if(e.network==="testnet")throw new u("Priors stock swaps require mainnet chain 4663.");if(n=a(n),o.eligible!==!0)throw new u("Confirm local eligibility for Robinhood stock tokens before trading.");let t=await O(o,e),r=y(o.minOut,"minOut"),s=y(o.deadline,"deadline"),k=BigInt(Math.floor(Date.now()/1e3));if(r===0n||s<=k||s>k+1800n||!Number.isSafeInteger(o.poolIndex))throw new u("Provide positive minOut, poolIndex and a deadline within 30 minutes.");let i=t.token.pools[o.poolIndex];if(!i)throw new u("No published pool at that index. Read priors_stock_quote.");let d=x(a(t.token.token),i.fee,"tickSpacing"in i?i.tickSpacing:0),c=t.input===d.currency0,b=a(i.v===3?m.v3.router:m.v4.swapper),q=i.v===3?w({abi:g,functionName:"multicall",args:[s,[w({abi:g,functionName:"exactInputSingle",args:[{tokenIn:t.input,tokenOut:t.output,fee:i.fee,recipient:n,amountIn:t.amount,amountOutMinimum:r,sqrtPriceLimitX96:0n}]})]]}):w({abi:g,functionName:"swapExactIn",args:[d,c,t.amount,r,c?4295128740n:1461446703485210103287273052203988822378723970341n,n,s]}),S=[e.approval(t.input,b,t.amount.toString(),l),e.unsignedTx({to:b,data:q,value:"0",chainId:l,description:`Priors stock ${o.side}: ${t.amount} input base units; minimum ${r}; pinned V${i.v} pool.`})],A=await e.preview(S,n);return{txs:S,expiresAt:s.toString(),summary:`Stock ${o.side} ${o.symbol}: input ${t.amount} base units (${t.input}), minimum output ${r} (${t.output}), receiver ${n}, deadline ${s}. Issuer transfer/sale restrictions apply. Price impact is not measured by this builder; inspect minOut and the preview. ${A.summary}`}}}]}}export{g as a,R as b};
|
|
@@ -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};
|