@biconomy/abstractjs
Version:
SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.
62 lines • 1.91 kB
JavaScript
import { getChain } from "./getChain.js";
/**
* Gets the block explorer transaction link for a given chain
*
* @param hash - {@link Hex} The transaction hash to view
* @param chain_ - {@link Chain} The chain object, chain ID, or chain name
* @returns {@link Url} The complete URL to view the transaction
*
* @throws Error if the chain has no block explorer configured
*
* @example
* // Using chain object
* const url = getExplorerTxLink(
* "0x123...",
* optimism
* );
*
* @example
* // Using chain ID
* const url = getExplorerTxLink(
* "0x123...",
* 10 // Optimism chain ID
* );
*/
export const getExplorerTxLink = (hash, chain_) => {
try {
const chain = typeof chain_ === "number" || typeof chain_ === "string"
? getChain(Number(chain_))
: chain_;
return `${chain.blockExplorers?.default.url}/tx/${hash}`;
}
catch (error) {
return `https://v2.jiffyscan.xyz/tx/${hash}`;
}
};
/**
* Gets the JiffyScan transaction link for a user operation
*
* @param userOpHash - {@link Hex} The user operation hash to view
* @returns {@link Url} The complete URL to view the user operation on JiffyScan
*
* @example
* const url = getJiffyScanLink("0x123...");
* console.log(url); // https://v2.jiffyscan.xyz/tx/0x123...
*/
export const getJiffyScanLink = (userOpHash) => {
return `https://v2.jiffyscan.xyz/tx/${userOpHash}`;
};
/**
* Gets the MeeScan transaction link for a user operation
*
* @param hash - {@link Hex} The transaction or user operation hash to view
* @returns {@link Url} The complete URL to view the transaction on MeeScan
*
* @example
* const url = getMeeScanLink("0x123...");
* console.log(url); // https://meescan.biconomy.io/details/0x123...
*/
export const getMeeScanLink = (hash) => {
return `https://meescan.biconomy.io/details/${hash}`;
};
//# sourceMappingURL=explorer.js.map