Skip to content

Commit

Permalink
Merge pull request #205 from zkLinkProtocol/feat/show_claimed_txhash
Browse files Browse the repository at this point in the history
show txhash for claimed failed deposit
  • Loading branch information
zkLeonardo authored Apr 29, 2024
2 parents f6bd41a + 011f5f1 commit b8fa883
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 24 deletions.
48 changes: 41 additions & 7 deletions components/transaction/FailedDepositLineItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<template>
<CommonButtonLine class="transaction-withdrawal-line-item" @click="isModalOpen = true">
<CommonButtonLine
class="transaction-withdrawal-line-item"
@click="
() => {
if (!clainedTxHash) {
isModalOpen = true;
}
}
"
>
<div class="line-button-with-img-image">
<DestinationIconContainer class="p-0">
<img src="/img/icon-cross.svg" class="w-3 h-3" />
Expand Down Expand Up @@ -30,12 +39,10 @@
</template>
<template #underline>
<div class="flex flex-col">
<span>Claim on source chain</span>
<CommonTimer format="human-readable" :future-date="expectedCompleteTimestamp" :only-days="true">
<template #default="{ timer, isTimerFinished }">
<span>{{ timer }} left</span>
</template>
</CommonTimer>
<span>Transaction hash of asset return</span>
<a :href="clainedTxHash?.explorerUrl" target="_blank" class="claimed-hash">{{
clainedTxHash?.txHash
}}</a>
</div>
</template>
</CommonButtonLineBodyInfo>
Expand Down Expand Up @@ -81,6 +88,7 @@ import { useOnboardStore } from "@/store/onboard";
import { useZkSyncProviderStore } from "@/store/zksync/provider";
import { shortenAddress } from "@/utils/formatters";
import { ETH_ADDRESS } from "~/zksync-web3-nova/src/utils";
import { failedDepositClaimedTxhashes } from "@/data/failedClaimedTxhashes";
const props = defineProps({
transfer: {
Expand Down Expand Up @@ -120,6 +128,7 @@ const chainsLabel = computed(() => {
});
const expectedCompleteTimestamp = computed(() => {
xw;
console.log("transer: ", props.transfer);
return new Date(1713088800000 + 15 * 24 * 3600 * 1000).toISOString(); // 15 days after withdrawal open
});
Expand All @@ -130,6 +139,21 @@ const token = computed(() => {
return props.transfer.token;
});
const clainedTxHash = computed(() => {
for (const [key, value] of Object.entries(failedDepositClaimedTxhashes)) {
const item = value[props.transfer.hash];
if (item) {
const network = zkSyncNetworks.find((item) => item.key === key);
return {
explorerUrl: `${network?.l1Network?.blockExplorers?.default.url}/tx/${item}`,
txHash: item.substring(0, 6) + "..." + item.substring(item.length - 4),
};
}
continue;
}
return null;
});
const timeAgo = useTimeAgo(props.transfer.receivedAt);
</script>

Expand Down Expand Up @@ -168,5 +192,15 @@ const timeAgo = useTimeAgo(props.transfer.receivedAt);
}
}
}
.claimed-hash {
color: #1755f4;
text-align: right;
font-family: Inter;
font-size: 16px;
font-style: normal;
font-weight: 400;
line-height: normal;
text-decoration-line: underline;
}
}
</style>
116 changes: 116 additions & 0 deletions data/failedClaimedTxhashes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
export const failedDepositClaimedTxhashes = {
primary: {
"0xea6b8bc9758af351354ad8043e218e3a83fe07bb7b33f931d7aa052201b19e69":
"0x3d3b3a2fc887a8b53e7e6f7d7271aa76b93324fd4555056476bdf0372ac52398",
"0xde259d9b980c4592ed00f6d85258f1cc5776dd56568cc90455f3035dd7e8b7c2":
"0x4b5f62cf86135f7d4b6ba878b05e062160f4e41d40da6db75d5576b3c6b38fb5",
"0xd7da438714cd2e0f2072b0d2c66c34129e0d6480ce484c9c9f0c2258848759db":
"0x9088a5de1208f5cff73ec83772e638bbae95eea85ef4213726671daf81b81815",
"0x47c67d9db9cf6c46e9f4b0b5b27397422e9d9206527cbd51d5779df96f9f794a":
"0xd90a0ddc22658e2f996b9a1129d146c16bcbbd3c1c341dda9627e36f8e9455e6",
"0xbc651aad5b049db85e9f163a17584bb451b6bf55d59ec0aebd3e0cb3a864113b":
"0x6f571e9d280f77ec499eb19caac26843a6c2e7d23569c9f41e1f60eaa80abda8",
"0x47907bf6f1c2fe1e54aa713b3a8d8bda720ebeadb0d89d18dd80e7e7fc890f9a":
"0xb9d8c66fd2902d9c3676ce54fc3ab796e47960f82fb00a3062c7d9bd4976d882",
"0x53232f19133946b47b9c01ad163812e49405a06310c8d21dbc79de4042025b69":
"0x0dcd1da9f465102c83beeabab2b76d9bdf76d2b1e64894ca3a67086e9100ffe3",
"0x7af08326dd8a78d9237c86c61bdaf35a75434fb11d6d4bd898c60fa4125b7d86":
"0x9ff27c64b96b55471086bb297bbbf0136615f6e2f02dcf04fee9ac1b87449b93",
"0xafd87fd35d348b671c8036da7534ef778e0abbe889367f4b70a210ec27d5efa7":
"0xae188a31f31c90e63d8f57a4a36ad80725c7d3162998714726a5d5e6dfc97b2a",
"0xff215e0146722fddf69d5740800c6e14785e69cc57d84f4d079b8451df2f4aab":
"0x2ce31590daa404c1045d29511462e686876b014198a04d8aaa3b8e5d9f8621e7",
"0x8e1531b932300b053d7b0f6892978ab94657a161d342f8fd4549231df04f8c91":
"0xf68952809bb1f675aea7d8e341d4a2d8e18fa6926ce018ccaaad4b62ebb9bb65",
"0xb26a28701fa346505a9e8fcbf5ce06fed0e80ca2a88b63bf9227eb526c47f52a":
"0xd999fa0638e6cead2fde40f2cef0c012e1d449ecba734df61cb1335196c89d8d",
},
ethereum: {
"0x1a75efdc959bc13cfab4b5ed2e827c341701f5308a0f966608d0054ec73ceae1":
"0xe60913c705c3e124410c61317d8a5f2485f2596275a0ccec93a4ad86c42b79f9",
"0x3497dd039c96730ecd48d4df0a1f05844e1d61bd197cba5bb0ede7545cd80596":
"0x4e4e4ced4615c7608138eae31d77b105532df82f8ab2bc75a1088477b0e4bb2f",
"0xb4799d4ab7742a85df0a7043c2539ba230c537cfb42e17e2f9b0eeda9d7575d8":
"0x514e2a85370b1fdab4040e73d372ac5f860493c242e14a10eede899a5f1b265f",
"0xcb75dc20052096b38ab3f39cbb6318f0776b7b1676eed362d73b4a8803155f33":
"0x3a0851531b6cb6d189d5e2c3d5e5efb35ae77b4ac52acbfe3f091544d5bca8dc",
"0x034211be2fe97e51d0a3ced7ad54e329809c233b6f693625e80ec0308593840c":
"0x22d47cfec3b0266143fefd76ebc0f01c8af23dc2729580fa342bb3dc328a73b2",
"0x764b1215e6387f9165da7d399ab4f2137dbbf5ef26ae4aeca4df24c95a55c2cc":
"0xdfb56eb9cde0adb52eaf7070d2aaea515b679073896cbe9dd7efc2c316ec14cc",
"0xbbf0d1e85dc2530b035a78086e1125c671a6a11494148b4f911c0a4336162c50":
"0x62196b9572cffa2b357cf0c57c5bd1e39f6c21882e3f6a0bdd3f32ddb20b3e10",
},

arbitrum: {
"0x90402d9418ebe6dc4b4454df383911de10f0b64208a256f7825c87deb3fa8407":
"0x3ae01a10ec1365bbe0526d68010c7962fcada42b29584de6bea3d143e4224d6d",
"0x5534a13b0f51e7fd3c99bfc0a4aea7296cb45da798cefe2caab371768184394a":
"0xae9dee80a034ff48ade8c8819b20b9efee1c9a38869bdd4a8e624e2d912e4c7a",
"0xe274a6bb073dcacea515057301952a24626cc90d8425db3f37f4939de50560a4":
"0x3ed6a2503751658955b7f7ec6427f5d5d3914d245bd9154aae99f81d0ba90159",
"0xed924dca4f4a93b1ae1cec62ea87168f3d1893214c55c5dcff41887f1bda6b6f":
"0x2d62c49bedbd53b95aab5ce1045080a5989b62b3c3d4ff358a6a5f007f40cace",
"0x414e94e8b943acf364c42af36c2ba9b8f98893b98c457851a0b80eee3dd950de":
"0xf30abaea208a0f631f18183e827d5abaa0256cbf4385a00e7472d34424e84991",
"0x83a96a548285f823754b803628d1663f5cce01ff54c815e8fef3592639cbfafa":
"0xe9acf8b081a8177ca761a89214e5e241a8b7f9a38199808ead5b024e2eb70062",
"0xb9efbaf63963d4978a5345a55c5f2a1f72f8b57d705157b21be437bcb7dbf68f":
"0xbfcf1fc87646629c2a003e116b32fea856ae5c58b37356bb9c602d115c914fcb",
"0x43cd7a1459fe0bfe47bcab9f0a26e3a5d4d328fd95c4c7556abf0547e92765c2":
"0x5da86dd2ad63ff9235841c0226cffb3394bafb95fbeee2524f5845b0ca349dads",
"0x292716ab15d44777e07c808e005ad61b8420a58dc80fafa454ed349bf31cf640":
"0x22743c4f1a013793c6a39503044f7ef0987551b9a5d8b88af19c7285992541d6",
"0x31a710b8da611be9f9e463d4a56539553b986e2a880d9e3afae5391e2e2f9abb":
"0x37217f784f5e5fb2954abffa6b097d7bcf88693ab6850c64ab000995595b4d42",
"0x501c8325d8b297efeae85d195d2a6af398a731eeca45e21a35a93dc6d2594694":
"0xf60ee218fcc9a4788620efab8146cf3660863be4ba46e549d286581298fb9813",
"0x96f9346f4739317ed86cb0df890ddc4a157ce68e1897071bc0ad150b3a2552e6":
"0x30f73a50b56ff7c6cac30aff83c038766a5c35d0642bd7ade3dfea4ee7c474bf",
"0xaff43da75014135153f6938f189c8a64799052364847ef0db5fa99db7f570f50":
"0x12085bde458a093710f1e220861e2bdfd95d79877bfc61cf1073c0931a605a61",
"0xc871860b97328816ff49527468d80a4e9c1b750032c16d9109b5728cc4620e9a":
"0xc7efbf10fc59e36b41c013aa4ae4e7fd6554883367ffb406394e796903e2c8db",
"0x8ccb5b8a82697dbaefb6a13e5c9f3f64c27e320699fa1f5553abf6fb3834f8d4":
"0x149e21268d8fc5394124caca4577e7134794497c571811cbf404c33d0c7d4e1c",
"0x77a9c29c72d9b5b442dbd09e17e0c454c54d8c9a96666a3739e12820077a40ec":
"0xc1b39c9d9e28c3d4ce082591fd96db7839de7c6a26b754adfb653b4a5b916e3b",
"0x8338a4ec9628cf432b84f4fe8306123bacf7ba947fd13efb0200670be1d0f94c":
"0x7271c2ccecf18fa9caedfa3717d04ecf351b88c2d48ff4af794c7c6d5de1a9e0",
"0x601fcc072ffa90c7e92e8126caa5deb925a04101055b3c1bf45e93868a2d3287":
"0xf48118ae72f6ffb7e26cb81e85597c7f36aaee88dc854816a4a4df02b6442b96",
"0xcb211712d0e71987d6bdd91eac6afc927e077a0f94daaa859455433cff8dc0b3":
"0x3aebdefd1ff1c12da099e931261e15b83e18ef6497f772bb1be3306ba7f70b22",
"0x171f01b26606d6be213dffce9a701403853b1fdd4cc3b2f3d4180e7d6aa83a16":
"0xa6f6c84e7f86e8b3defdb5d1b3bf0fd55bda0f3f2eb40a1cacca90479011db65",
"0x86ee8b02b3f88ded8263de5b33b3b39dcb98fe8840a2b3ec06199b11b6e55a27":
"0x5dc0c3b5c028b020735430067bfc030e80347f064716a948f7ea95528381ab9a",
"0xfc0f08d1d78d1ec7d688ec881e1b354883416d406d8b4841f6b01eded70b793b":
"0x31b1e90205d618eb06a4f239a4ca0145006a44e835ab311ffaa65d4229d9205c",
"0xaf882a01564108c11b31389b08f47c7e6056ece88a4475deb97e8f71ed43e5a3":
"0x2afef1c436a2d3c4d24c963f4e0a1bdfb923eb126682b3edb37211daf4108835",
},
manta: {
"0xba73560e6edd28aec7a75d620d8731c0e9431c060ea64742d5b031fd274f857b":
"0xbee40813a35f0260b8102420c599ce91f6effbc6cd3fd695fd92bec00c6ee418",
"0xe1ee3cbbc60a6a7b4bbf4cbeb75b0961a7e2f8ae7f5536095b198714bc13de1f":
"0xf9fd35db2dba9ae42c97d1da8a44319fc7e79c7ae82d876553c1f25eb05d5d85",
},

zksync: {
"0x5e49f4665992a9c38df5891f985577c1263b5dcc10bacf8219feefcd6cbd32e7":
"0x2ed7112c52ab33e4d0002f14febb55fc9effbec58e614a040af903285b905d4e",
},
optimism: {
"0x937740290f0ee86837bdb3e5d9de5918a9621ee925ea812c503efe3e45f032ed":
"0x691f31874152c094f1a58088ff94a1043b5906deebc73f0df21689442edb1f2b",
"0x3e93f75bd988f01385c1ab1aa09f30e48080bd1ca919a3bc037eb4725444057b":
"0x16975273085baf6f1cc86db90293e21aba15c05d7ce45953fd87529b7c7d44e5",
"0x9dda881e50c21f7c0b321a9a031feda55954ec63951bcbac1d4cebcf87d393b6":
"0xf054c7f2e136f510f31579502ed78ad58a111163510adf671eb32566fde259b4",
"0x83785d568f057fe612168769d88d58de43c390682a06a26eab76c013b8861190":
"0x0a50f0afc3253d8d9107abd5ee5ce7edcabb0781df9b70e97466787e2619220d",
"0x72d45323fd8c6256c252865b2ffbfb5363adcdf599cd5d6ecc0b370602dc77cf":
"0x3793acfc1188c4a206df053fd31ee48109b6ef02346cd22ed1f34cb4287ca2c2",
},
};
48 changes: 31 additions & 17 deletions store/zksync/failedDepositHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,39 @@ export const useFailedDepositHistoryStore = defineStore("failedDepositHistory",
const network = zkSyncNetworks.find((item) => item.key === networkKey);
if (!network) throw new Error("Invalid networ key: " + networkKey);
const publicClient = onboardStore.getPublicClient(network.l1Network?.id);
const [symbol, decimals] = await Promise.all([
publicClient?.readContract({
abi: erc20Abi,
address: token,
functionName: "symbol",
args: [],
}),
publicClient?.readContract({
abi: erc20Abi,
address: token,
functionName: "decimals",
args: [],
}),
]);
let _symbol = "",
_decimals = 18;
try {
const [symbol, decimals] = await Promise.all([
publicClient?.readContract({
abi: erc20Abi,
address: token,
functionName: "symbol",
args: [],
}),
publicClient?.readContract({
abi: erc20Abi,
address: token,
functionName: "decimals",
args: [],
}),
]);
_symbol = symbol ?? "";
_decimals = decimals ?? 18;
} catch (e) {
console.log(e);
if (token === "0xBBeB516fb02a01611cBBE0453Fe3c580D7281011") {
// special case for WBTC
_symbol = "WBTC";
_decimals = 8;
}
}

return {
address: token,
symbol: symbol!,
symbol: _symbol!,
amount,
decimals: decimals!,
decimals: _decimals!,
l2Address: "",
};
};
Expand Down Expand Up @@ -105,7 +119,7 @@ export const useFailedDepositHistoryStore = defineStore("failedDepositHistory",
hash: tx.hash,
amount,
token,
networkKey: tx.networkKey,
networkKey: tx.networkKey || "primary",
};
})
.filter((item) => !!item);
Expand Down

0 comments on commit b8fa883

Please sign in to comment.