Skip to content

Commit

Permalink
feat: add tx linkback in success
Browse files Browse the repository at this point in the history
  • Loading branch information
zugdev committed Dec 26, 2024
1 parent 1bd7ca8 commit 8105aab
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions static/display-popup-modal.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { appState, explorersUrl } from "./main";

export function renderErrorInModal(error: Error) {
const modal = document.getElementById("error-modal");
const closeButton = document.getElementsByClassName("error-close-modal");
Expand Down Expand Up @@ -32,6 +34,20 @@ export function renderSuccessModal(transactionHash: string) {

if (successMessageElement) {
successMessageElement.innerHTML = `You've successfully signed the transaction. Your allowance balance should be updated in a few blocks.<br><br>transaction hash: <span class="tx-hash">${transactionHash}</span>`;
const chainId = appState.getChainId();
const explorerUrl = chainId !== undefined ? explorersUrl[chainId] : "";
const txLink = document.createElement("a");
txLink.href = `${explorerUrl}/tx/${transactionHash}`;
txLink.target = "_blank";
txLink.rel = "noopener noreferrer";
txLink.style.color = "white";
txLink.textContent = transactionHash;

const txHashElement = successMessageElement.querySelector(".tx-hash");
if (txHashElement) {
txHashElement.innerHTML = "";
txHashElement.appendChild(txLink);
}
}

if (modal) {
Expand Down

0 comments on commit 8105aab

Please sign in to comment.