Initialise the Bundler Instance and Account API Instance.
Make sure you have the ETH you want to schedule in your SC Wallet Address.
Transferring ETH if Proposal statusCode is equal to 2 in the example below.
import { BigNumber } from"ethers";import { encodeFunctionData, parseUnits } from"viem";constunsignedUserOp=awaitwalletAPI.createUnsignedUserOp({ target: recipientAddressForETH, data:"0x", maxFeePerGas:BigNumber.from("90000000000"),// average value for the token transfer maxPriorityFeePerGas:BigNumber.from("1500000000"),// average value for the token transfer gasLimit:BigNumber.from("2000320"),// average value for the token transfer value:1000000n,// Transfering ETH to recipient});constnewUserOp:any= { sender:awaitunsignedUserOp.sender, nonce:awaitunsignedUserOp.nonce, initCode:awaitunsignedUserOp.initCode, callData:awaitunsignedUserOp.callData, callGasLimit:awaitunsignedUserOp.callGasLimit, verificationGasLimit:awaitunsignedUserOp.verificationGasLimit, preVerificationGas:awaitunsignedUserOp.preVerificationGas, maxFeePerGas:awaitunsignedUserOp.maxFeePerGas, maxPriorityFeePerGas:awaitunsignedUserOp.maxPriorityFeePerGas, paymasterAndData:awaitunsignedUserOp.paymasterAndData, signature:awaitunsignedUserOp.signature,};constkey=awaitbundler.getValidNonceKey(newUserOp);constnonce=awaitwalletAPI.getNonce(key);newUserOp.nonce = nonce;constsignedUserOp=awaitwalletAPI.signUserOp(newUserOp);constadvancedOp= {...signedUserOp, advancedUserOperation: { triggerEvent: { contractAddress: propsalContractAddress, eventSignature:"event ProposalResult(address indexed recipient, uint statusCode);", evaluationStatement:":statusCode: == 2", }, },};constuserOpHash=awaitbundler.sendUserOpToBundler(advancedOp);