UNPKG

@reservoir0x/relay-kit-ui

Version:

Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.

23 lines 930 B
import getChainBlockExplorerUrl from './getChainBlockExplorerUrl.js'; const appendQueryParams = (url, params) => { if (params) { const queryParams = new URLSearchParams(params); return `${url}?${queryParams.toString()}`; } return url; }; export const getTxBlockExplorerUrl = (chainId, chains, txHash) => { const chain = chains?.find((chain) => chain.id === chainId); let blockExplorerUrl = getChainBlockExplorerUrl(chainId, chains); if (txHash) { if (chain?.explorerPaths?.transaction) { blockExplorerUrl = `${blockExplorerUrl}${chain.explorerPaths.transaction.replace('{TX_HASH}', txHash)}`; } else { blockExplorerUrl = `${blockExplorerUrl}/tx/${txHash}`; } } blockExplorerUrl = appendQueryParams(blockExplorerUrl, chain?.explorerQueryParams); return blockExplorerUrl; }; //# sourceMappingURL=getTxBlockExplorerUrl.js.map