const destinationEthBalance = await getBalance(wagmiConfig, {
address: address,
chainId: sepolia.id,
})
const quote = await relayClient.actions.getQuote({
chainId: sepolia.id,
toChainId: baseSepolia.id,
wallet,
amount: destinationEthBalance.value.toString()
})
const bufferedGasFee = BigInt(quote?.fees?.gas ?? 0) * (BigInt(100) + BigInt(5)) / BigInt(100) // add 5% buffer to handle flucation
const amountToBridgeBack =
destinationEthBalance.value -
bufferedGasFee -
BigInt(quote?.fees?.relayer ?? 0)
await relayClient.actions.execute({
quote,
wallet,
onProgress(steps) {
setStep(getCurrentStepDescription(steps))
},
})