//import Squid SDK and typesimport { Squid } from"@0xsquid/sdk";import { ChainType, EvmContractCall } from"@0xsquid/squid-types";// Import WETH ABIimport wethAbi from"../abi/wethAbi"; // Adjust the path if necessary// Function to get Squid SDK instanceconstgetSDK= ():Squid=> {constsquid=newSquid({ baseUrl:"https://apiplus.squidrouter.com", integratorId: integratorId, });return squid;};// Main function(async () => {// Initialize Squid SDKconstsquid=getSDK();awaitsquid.init();console.log("Initialized Squid SDK");// Creating Contract interfacesconstwethInterface=newethers.utils.Interface(wethAbi);constwrapEncodedData=wethInterface.encodeFunctionData("deposit");// Set up parameters for wrapping ETH to wETH and bridging to BUSD on Binance Smart Chainconstparams= { fromAddress:signer.address, fromChain: fromChainId, fromToken:WETH_ADDRESS,// WETH on Arbitrum fromAmount:amount.toString(), toChain: toChainId, toToken: toToken, toAddress:signer.address, slippageConfig: { autoMode:1, }, slippage:1, preHook: { chainType:ChainType.EVM, fundAmount:amount.toString(), fundToken:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",// Native ETH calls: [ { chainType:ChainType.EVM, callType:2,// 2 corresponds to CALL_DATA target:WETH_ADDRESS, value:amount.toString(),// Amount of ETH to wrap callData: wrapEncodedData, payload: { tokenAddress:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",// Native ETH inputPos:0, }, estimatedGas:"500000", } asEvmContractCall, ], provider: "Integration Test", //This should be the name of your product or application that is triggering the hook
description:"Wrap native ETH", logoURI:"https://pbs.twimg.com/profile_images/1548647667135291394/W2WOtKUq_400x400.jpg",//Add your logo here }, };console.log("Parameters:", params);// Get the swap route using Squid SDKconst { route,requestId } =awaitsquid.getRoute(params);console.log("Calculated route:",route.estimate.toAmount);