From 2a745c59f62848e7a4c8dafe5813c8d570dc78d3 Mon Sep 17 00:00:00 2001 From: martonp Date: Mon, 15 Jul 2024 14:38:27 +0200 Subject: [PATCH] app: Fix polygon coin explorer Polygon coin explorer was not working properly. --- client/webserver/site/src/js/coinexplorers.ts | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/client/webserver/site/src/js/coinexplorers.ts b/client/webserver/site/src/js/coinexplorers.ts index e7e4c47178..9059814178 100644 --- a/client/webserver/site/src/js/coinexplorers.ts +++ b/client/webserver/site/src/js/coinexplorers.ts @@ -33,6 +33,21 @@ const ethExplorers: Record string> = { } } +const polygonExplorers: Record string> = { + [Mainnet]: (cid: string) => { + const [arg, isAddr] = ethBasedExplorerArg(cid) + return isAddr ? `https://polygonscan.com/address/${arg}` : `https://polygonscan.com/tx/${arg}` + }, + [Testnet]: (cid: string) => { + const [arg, isAddr] = ethBasedExplorerArg(cid) + return isAddr ? `https://amoy.polygonscan.com/address/${arg}` : `https://amoy.polygonscan.com/tx/${arg}` + }, + [Simnet]: (cid: string) => { + const [arg, isAddr] = ethBasedExplorerArg(cid) + return isAddr ? `https://polygonscan.com/address/${arg}` : `https://polygonscan.com/tx/${arg}` + } +} + export const CoinExplorers: Record string>> = { 42: { // dcr [Mainnet]: (cid: string) => { @@ -68,6 +83,7 @@ export const CoinExplorers: Record strin }, 60: ethExplorers, 60001: ethExplorers, + 60002: ethExplorers, 3: { // doge [Mainnet]: (cid: string) => `https://dogeblocks.com/tx/${cid.split(':')[0]}`, [Testnet]: (cid: string) => `https://blockexplorer.one/dogecoin/testnet/tx/${cid.split(':')[0]}`, @@ -97,20 +113,11 @@ export const CoinExplorers: Record strin [Testnet]: (cid: string) => `https://tbch4.loping.net/tx/${cid.split(':')[0]}`, [Simnet]: (cid: string) => `https://bch.loping.net/tx/${cid.split(':')[0]}` }, - 966: { // matic - [Mainnet]: (cid: string) => { - const [arg, isAddr] = ethBasedExplorerArg(cid) - return isAddr ? `https://polygonscan.com/address/${arg}` : `https://polygonscan.com/tx/${arg}` - }, - [Testnet]: (cid: string) => { - const [arg, isAddr] = ethBasedExplorerArg(cid) - return isAddr ? `https://amoy.polygonscan.com/address/${arg}` : `https://amoy.polygonscan.com/tx/${arg}` - }, - [Simnet]: (cid: string) => { - const [arg, isAddr] = ethBasedExplorerArg(cid) - return isAddr ? `https://polygonscan.com/address/${arg}` : `https://polygonscan.com/tx/${arg}` - } - } + 966: polygonExplorers, + 966001: polygonExplorers, + 966002: polygonExplorers, + 966003: polygonExplorers, + 966004: polygonExplorers } export function formatCoinID (cid: string) {