diff --git a/packages/bridge-ui/src/components/Transaction.svelte b/packages/bridge-ui/src/components/Transaction.svelte
index 0f6f8b1401a..2d022597b03 100644
--- a/packages/bridge-ui/src/components/Transaction.svelte
+++ b/packages/bridge-ui/src/components/Transaction.svelte
@@ -27,6 +27,7 @@
import { fetchSigner, switchNetwork } from "@wagmi/core";
import Bridge from "../constants/abi/Bridge";
import ButtonWithTooltip from "./ButtonWithTooltip.svelte";
+ import TokenVault from "../constants/abi/TokenVault";
export let transaction: BridgeTransaction;
@@ -151,6 +152,30 @@
);
transaction.status = await contract.getMessageStatus(transaction.msgHash);
+ if(transaction.status === MessageStatus.Failed) {
+ if(transaction.message.data !== "0x") {
+ const srcTokenVaultContract = new ethers.Contract(
+ $chainIdToTokenVaultAddress.get(transaction.fromChainId),
+ TokenVault,
+ $providers.get(chains[transaction.message.srcChainId.toNumber()].id)
+ )
+ const {token, amount} = await srcTokenVaultContract.messageDeposits(transaction.msgHash);
+ console.log(token, amount);
+ if(token === ethers.constants.AddressZero && amount.eq(0)) {
+ transaction.status = MessageStatus.FailedReleased;
+ }
+ } else {
+ const srcBridgeContract = new ethers.Contract(
+ chains[transaction.fromChainId].bridgeAddress,
+ Bridge,
+ $providers.get(chains[transaction.message.srcChainId.toNumber()].id)
+ )
+ const {token, amount} = await srcBridgeContract.isEtherReleased(transaction.msgHash);
+ if(token === ethers.constants.AddressZero && amount.eq(0)) {
+ transaction.status = MessageStatus.FailedReleased;
+ }
+ }
+ }
transaction = transaction;
if (transaction.status === MessageStatus.Done) clearInterval(interval);
}, 20 * 1000);
@@ -215,6 +240,8 @@
{:else if transaction.status === MessageStatus.Done}
Claimed
+ {:else if transaction.status === MessageStatus.FailedReleased}
+ Released
{/if}
diff --git a/packages/bridge-ui/src/constants/abi/Bridge.ts b/packages/bridge-ui/src/constants/abi/Bridge.ts
index 2e43ccef750..9c2612f484a 100644
--- a/packages/bridge-ui/src/constants/abi/Bridge.ts
+++ b/packages/bridge-ui/src/constants/abi/Bridge.ts
@@ -414,6 +414,25 @@ export default [
"stateMutability": "view",
"type": "function"
},
+ {
+ "inputs": [
+ {
+ "internalType": "bytes32",
+ "name": "msgHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "isEtherReleased",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
{
"inputs": [
{
diff --git a/packages/bridge-ui/src/domain/message.ts b/packages/bridge-ui/src/domain/message.ts
index 0abaa785c7e..1abf1c29bc8 100644
--- a/packages/bridge-ui/src/domain/message.ts
+++ b/packages/bridge-ui/src/domain/message.ts
@@ -5,6 +5,7 @@ enum MessageStatus {
Retriable,
Done,
Failed,
+ FailedReleased
}
type Message = {