Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
? Web3Wrapper.toUnitAmount(error.amountAvailableToFill, asset.metaData.decimals)
: error.amountAvailableToFill;
const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.decimalPlaces(
2,
BigNumber.ROUND_DOWN,
);
if (roundedUnitAmountAvailableToFill.isGreaterThan(BIG_NUMBER_ZERO)) {
return `There are only ${roundedUnitAmountAvailableToFill} ${assetName} available to buy`;
}
}
return `Not enough ${assetName} available`;
} else if (
error.message === SwapQuoterError.StandardRelayerApiError ||
error.message.startsWith(SwapQuoterError.AssetUnavailable)
) {
const assetName = assetUtils.bestNameForAsset(asset, 'This asset');
return `${assetName} is currently unavailable`;
}
return undefined;
},
};