From 3c61403afe62998401e502e3a2bd70d842bb9e56 Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 26 Jul 2024 08:45:32 +0300 Subject: [PATCH] fix: withdrawal (#184) --- composables/zksync/useTransaction.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composables/zksync/useTransaction.ts b/composables/zksync/useTransaction.ts index d8662c93b..fdfe81d6d 100644 --- a/composables/zksync/useTransaction.ts +++ b/composables/zksync/useTransaction.ts @@ -36,6 +36,7 @@ export default (getSigner: () => Promise, getProvider: () => status.value = "processing"; const signer = await getSigner(); if (!signer) throw new Error("zkSync Signer is not available"); + const provider = getProvider(); const getRequiredBridgeAddress = async () => { if (transaction.tokenAddress === ETH_TOKEN.address) return undefined; @@ -48,7 +49,8 @@ export default (getSigner: () => Promise, getProvider: () => await validateAddress(transaction.to); status.value = "waiting-for-signature"; - const tx = await signer[transaction.type === "transfer" ? "transfer" : "withdraw"]({ + const txRequest = await provider[transaction.type === "transfer" ? "getTransferTx" : "getWithdrawTx"]({ + from: await signer.getAddress(), to: transaction.to, token: transaction.tokenAddress === ETH_TOKEN.address ? ETH_TOKEN.l1Address! : transaction.tokenAddress, amount: transaction.amount, @@ -59,6 +61,9 @@ export default (getSigner: () => Promise, getProvider: () => }, }); + const txResponse = await signer.sendTransaction(txRequest); + const tx = getProvider()._wrapTransaction(txResponse); + transactionHash.value = tx.hash; status.value = "done";