synapsecns/sanguine

View on GitHub
packages/synapse-interface/components/_Transaction/helpers/getExplorerAddressLink.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Chain } from '@/utils/types'
import { CHAINS_BY_ID } from '@/constants/chains'

export const getExplorerAddressLink = (chainId: number, address: string) => {
  if (!chainId || !address) {
    return [null, null]
  }

  const chain: Chain = CHAINS_BY_ID[chainId]

  const addressExplorerUrl = `${chain.explorerUrl}/address/${address}`
  const explorerName = chain.explorerName

  return [addressExplorerUrl, explorerName]
}