Skip to content

Commit

Permalink
Merge pull request #267 from zkLinkProtocol/feat/add_error_log
Browse files Browse the repository at this point in the history
fix:catch error for withdraw estiamte fee
  • Loading branch information
leochw authored Jul 11, 2024
2 parents 8a05622 + 8db1b0d commit ff8f4e4
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions composables/zksync/useWithdrawalFinalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,32 @@ export default (transactionInfo: ComputedRef<TransactionInfo>) => {
const publicClient = onboardStore.getPublicClient(eraNetwork.l1Network?.id);
if (!publicClient) return;
const transactionParams = await getTransactionParams();
const [price, limit] = await Promise.all([
retry(async () => BigNumber.from((await publicClient.getGasPrice()).toString())),
retry(async () => {
return BigNumber.from(
(
await publicClient.estimateContractGas({
...transactionParams,
})
).toString()
);
}),
]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
gasPrice.value = price;
gasLimit.value = limit;

return {
transactionParams,
gasPrice: gasPrice.value,
gasLimit: gasLimit.value,
};
try {
const [price, limit] = await Promise.all([
retry(async () => BigNumber.from((await publicClient.getGasPrice()).toString())),
retry(async () => {
return BigNumber.from(
(
await publicClient.estimateContractGas({
...transactionParams,
})
).toString()
);
}),
]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
gasPrice.value = price;
gasLimit.value = limit;
return {
transactionParams,
gasPrice: gasPrice.value,
gasLimit: gasLimit.value,
};
} catch (e) {
console.error("transactionHash: ", transactionInfo.value.transactionHash);
console.error("transactionParams: ", transactionParams);
throw e;
}
},
{ cache: 1000 * 8 }
);
Expand Down

0 comments on commit ff8f4e4

Please sign in to comment.