UNPKG

@lifi/sdk

Version:

LI.FI Any-to-Any Cross-Chain-Swap SDK

27 lines 1.55 kB
import { formatUnits } from 'viem'; import { config } from '../config.js'; export const getTransactionNotSentMessage = async (step, process) => { let transactionNotSend = 'Transaction was not sent, your funds are still in your wallet'; // add information about funds if available if (step) { const chain = await config.getChainById(step.action.fromChainId); transactionNotSend += ` (${formatUnits(BigInt(step.action.fromAmount), step.action.fromToken.decimals)} ${step.action.fromToken.symbol} on ${chain.name})`; } transactionNotSend += ", please retry.<br/>If it still doesn't work, it is safe to delete this transfer and start a new one."; // add transaction explorer link if available transactionNotSend += process?.txLink ? `<br>You can check the failed transaction&nbsp;<a href="${process.txLink}" target="_blank" rel="nofollow noreferrer">here</a>.` : ''; return transactionNotSend; }; export const getTransactionFailedMessage = async (step, txLink) => { const chain = await config.getChainById(step.action.toChainId); const baseString = `It appears that your transaction may not have been successful. However, to confirm this, please check your ${chain.name} wallet for ${step.action.toToken.symbol}.`; return txLink ? `${baseString} You can also check the&nbsp;<a href="${txLink}" target="_blank" rel="nofollow noreferrer">block explorer</a> for more information.` : baseString; }; //# sourceMappingURL=getTransactionMessage.js.map