From e1d502a189bdf9b478722ad35e85110c38efd6b5 Mon Sep 17 00:00:00 2001 From: rndquu Date: Wed, 16 Oct 2024 18:10:28 +0300 Subject: [PATCH] fix: show explorer URLs --- static/scripts/rewards/app-state.ts | 5 +++-- .../scripts/rewards/render-transaction/render-transaction.ts | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/static/scripts/rewards/app-state.ts b/static/scripts/rewards/app-state.ts index 54c0c354..d2be1db5 100644 --- a/static/scripts/rewards/app-state.ts +++ b/static/scripts/rewards/app-state.ts @@ -42,10 +42,11 @@ export class AppState { } get currentExplorerUrl(): string { - if (!this.reward) { + if (!this.reward || !networkExplorers[this.reward.networkId]) { return "https://blockscan.com"; } - return networkExplorers[this.reward.networkId] || "https://blockscan.com"; + + return networkExplorers[this.reward.networkId][0].url; } nextPermit(): Permit | null { diff --git a/static/scripts/rewards/render-transaction/render-transaction.ts b/static/scripts/rewards/render-transaction/render-transaction.ts index 73e42ba0..dfd373a4 100644 --- a/static/scripts/rewards/render-transaction/render-transaction.ts +++ b/static/scripts/rewards/render-transaction/render-transaction.ts @@ -1,5 +1,4 @@ import { ERC20Permit, Permit, TokenType } from "@ubiquibot/permit-generation/types"; -import { networkExplorers } from "@ubiquity-dao/rpc-handler"; import { app } from "../app-state"; import { buttonController, getMakeClaimButton, viewClaimButton } from "../button-controller"; import { claimErc20PermitHandlerWrapper, fetchTreasury } from "../web3/erc20-permit"; @@ -36,7 +35,7 @@ export async function renderTransaction(): Promise { tokenAddress: app.reward.tokenAddress, ownerAddress: app.reward.owner, amount: app.reward.amount, - explorerUrl: networkExplorers[app.reward.networkId], + explorerUrl: app.currentExplorerUrl, table, requestedAmountElement, }).catch(console.error); @@ -58,7 +57,7 @@ export async function renderTransaction(): Promise { table.setAttribute(`data-additional-data-size`, "large"); renderNftSymbol({ tokenAddress: app.reward.tokenAddress, - explorerUrl: networkExplorers[app.reward.networkId], + explorerUrl: app.currentExplorerUrl, table, requestedAmountElement, }).catch(console.error);