UNPKG

@openocean.finance/widget-sdk

Version:

OpenOcean Any-to-Any Cross-Chain-Swap SDK

30 lines 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTransactionFailedMessage = exports.getTransactionNotSentMessage = void 0; const viem_1 = require("viem"); const config_js_1 = require("../config.js"); const getTransactionNotSentMessage = async (step, process) => { let transactionNotSend = 'Transaction was not sent, your funds are still in your wallet'; if (step) { const chain = await config_js_1.config.getChainById(step.action.fromChainId); transactionNotSend += ` (${(0, viem_1.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."; transactionNotSend += process?.txLink ? `<br>You can check the failed transaction&nbsp;<a href="${process.txLink}" target="_blank" rel="nofollow noreferrer">here</a>.` : ''; return transactionNotSend; }; exports.getTransactionNotSentMessage = getTransactionNotSentMessage; const getTransactionFailedMessage = async (step, txLink) => { const chain = await config_js_1.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; }; exports.getTransactionFailedMessage = getTransactionFailedMessage; //# sourceMappingURL=getTransactionMessage.js.map