Add High network fees error message
This commit is contained in:
@@ -53,8 +53,8 @@ namespace Managing.Application.Trading.Handlers
|
|||||||
if (currentGasFees > Constants.GMX.Config.MaximumGasFeeUsd)
|
if (currentGasFees > Constants.GMX.Config.MaximumGasFeeUsd)
|
||||||
{
|
{
|
||||||
throw new InsufficientFundsException(
|
throw new InsufficientFundsException(
|
||||||
$"Gas fee too high for position opening: {currentGasFees:F2} USD (threshold: {Constants.GMX.Config.MaximumGasFeeUsd} USD). Position opening cancelled.",
|
$"Gas fee too high for position opening: {currentGasFees:F2} USD (threshold: {Constants.GMX.Config.MaximumGasFeeUsd} USD). Position opening rejected.",
|
||||||
InsufficientFundsType.InsufficientEth);
|
InsufficientFundsType.HighNetworkFee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,21 +105,26 @@ public class InsufficientFundsException : Exception
|
|||||||
return errorType switch
|
return errorType switch
|
||||||
{
|
{
|
||||||
InsufficientFundsType.InsufficientEth =>
|
InsufficientFundsType.InsufficientEth =>
|
||||||
"❌ **Insufficient ETH for Gas Fees**\n" +
|
"❌ Insufficient ETH for Gas Fees\n" +
|
||||||
"Your wallet doesn't have enough ETH to pay for transaction gas fees.\n" +
|
"Your wallet doesn't have enough ETH to pay for transaction gas fees.\n" +
|
||||||
"Please add ETH to your wallet and try again.",
|
"Please add ETH to your wallet and try again.",
|
||||||
|
|
||||||
InsufficientFundsType.InsufficientAllowance =>
|
InsufficientFundsType.InsufficientAllowance =>
|
||||||
"❌ **Insufficient Token Allowance**\n" +
|
"❌ Insufficient Token Allowance\n" +
|
||||||
"The trading contract doesn't have permission to spend your tokens.\n" +
|
"The trading contract doesn't have permission to spend your tokens.\n" +
|
||||||
"Please approve token spending in your wallet and try again.",
|
"Please approve token spending in your wallet and try again.",
|
||||||
|
|
||||||
InsufficientFundsType.InsufficientBalance =>
|
InsufficientFundsType.InsufficientBalance =>
|
||||||
"❌ **Insufficient Token Balance**\n" +
|
"❌ Insufficient Token Balance\n" +
|
||||||
"Your wallet doesn't have enough tokens for this trade.\n" +
|
"Your wallet doesn't have enough tokens for this trade.\n" +
|
||||||
"Please add more tokens to your wallet and try again.",
|
"Please add more tokens to your wallet and try again.",
|
||||||
|
|
||||||
_ => "❌ **Transaction Failed**\n" +
|
InsufficientFundsType.HighNetworkFee =>
|
||||||
|
"❌ High Network Fee\n" +
|
||||||
|
"The gas fee for this position is too high.\n" +
|
||||||
|
"Position opening rejected.",
|
||||||
|
|
||||||
|
_ => "❌ Transaction Failed\n" +
|
||||||
"The transaction failed due to insufficient funds.\n" +
|
"The transaction failed due to insufficient funds.\n" +
|
||||||
"Please check your wallet balance and try again."
|
"Please check your wallet balance and try again."
|
||||||
};
|
};
|
||||||
@@ -149,5 +154,6 @@ public enum InsufficientFundsType
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// General insufficient funds error
|
/// General insufficient funds error
|
||||||
/// </summary>
|
/// </summary>
|
||||||
General
|
General,
|
||||||
|
HighNetworkFee
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user