File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed
Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,20 @@ export const initialRpcUrls: Record<number, string[]> = {
122122} ;
123123
124124export function setChain ( chain : Chain , url ?: string ) {
125+ const explorers : Record < number , { name : string ; url : string } > = {
126+ [ gnosis . id ] : {
127+ name : 'Gnosis chain explorer' ,
128+ url : 'https://gnosisscan.io' ,
129+ } ,
130+ [ avalanche . id ] : { name : 'Snowscan' , url : 'https://snowscan.xyz' } ,
131+ [ avalancheFuji . id ] : {
132+ name : 'Snowscan Fuji' ,
133+ url : 'https://testnet.snowscan.xyz' ,
134+ } ,
135+ } ;
136+
137+ const defaultExplorer = explorers [ chain . id ] || chain . blockExplorers ?. default ;
138+
125139 return {
126140 ...chain ,
127141 rpcUrls : {
@@ -133,10 +147,7 @@ export function setChain(chain: Chain, url?: string) {
133147 } ,
134148 blockExplorers : {
135149 ...chain . blockExplorers ,
136- default :
137- chain . id === gnosis . id
138- ? { name : 'Gnosis chain explorer' , url : 'https://gnosisscan.io' }
139- : chain . blockExplorers ?. default || mainnet . blockExplorers . default ,
150+ default : defaultExplorer ,
140151 } ,
141152 } ;
142153}
Original file line number Diff line number Diff line change 1- import { Address } from 'viem' ;
2-
31import { appConfig } from './appConfig' ;
4- import { chainInfoHelper } from './configs ' ;
2+ import { CHAINS } from './chains ' ;
53
64export function getScanLink ( {
75 chainId = appConfig . govCoreChainId ,
86 address,
97 type = 'address' ,
108} : {
119 chainId ?: number ;
12- address : Address | string ;
10+ address : string ;
1311 type ?: 'address' | 'tx' ;
1412} ) {
15- return ` ${
16- chainInfoHelper . getChainParameters ( chainId ) . blockExplorers ?. default . url
17- } / ${ type } /${ address } `;
13+ const baseUrl = CHAINS [ chainId ] ?. blockExplorers ?. default . url || '' ;
14+ const url = baseUrl . endsWith ( '/' ) ? baseUrl : ` ${ baseUrl } /` ;
15+ return ` ${ url } ${ type } /${ address } `;
1816}
You can’t perform that action at this time.
0 commit comments