UNPKG

@lifi/widget

Version:

LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.

11 lines 505 B
export const calculateValueLossPercentage = (fromAmountUSD, toAmountUSD, gasCostUSD, feeCostUSD) => { return Number.parseFloat(((toAmountUSD / (fromAmountUSD + gasCostUSD + feeCostUSD) - 1) * 100).toFixed(2)); }; export const getTokenValueLossThreshold = (fromAmountUSD, toAmountUSD, gasCostUSD, feeCostUSD) => { if (!fromAmountUSD || !toAmountUSD) { return false; } return toAmountUSD / (fromAmountUSD + gasCostUSD + feeCostUSD) < 0.9; }; //# sourceMappingURL=utils.js.map