Enhance bot command handlers with GMX wallet initialization
- Updated RestartBotCommandHandler, StartBotCommandHandler, and StartCopyTradingCommandHandler to include ITradingService for GMX wallet initialization. - Added checks for GMX account initialization status and implemented wallet initialization logic where necessary. - Improved error handling for wallet initialization failures.
This commit is contained in:
@@ -93,7 +93,7 @@ public class InsufficientFundsException : Exception
|
||||
/// </summary>
|
||||
public string UserMessage { get; }
|
||||
|
||||
public InsufficientFundsException(string errorMessage, InsufficientFundsType errorType)
|
||||
public InsufficientFundsException(string errorMessage, InsufficientFundsType errorType)
|
||||
: base(errorMessage)
|
||||
{
|
||||
ErrorType = errorType;
|
||||
@@ -104,31 +104,31 @@ public class InsufficientFundsException : Exception
|
||||
{
|
||||
return errorType switch
|
||||
{
|
||||
InsufficientFundsType.InsufficientEth =>
|
||||
InsufficientFundsType.InsufficientEth =>
|
||||
"❌ Insufficient ETH for 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.",
|
||||
|
||||
// InsufficientFundsType.InsufficientAllowance =>
|
||||
// "❌ Insufficient Token Allowance\n" +
|
||||
// "The trading contract doesn't have permission to spend your tokens.\n" +
|
||||
// "Please approve token spending in your wallet and try again.",
|
||||
|
||||
InsufficientFundsType.InsufficientAllowance =>
|
||||
"❌ High Network Fee\n" +
|
||||
"The gas fee for this position is too high.\n" +
|
||||
"Position opening rejected.",
|
||||
|
||||
InsufficientFundsType.InsufficientBalance =>
|
||||
InsufficientFundsType.InsufficientAllowance =>
|
||||
"❌ Insufficient Token Allowance\n" +
|
||||
"The trading contract doesn't have permission to spend your tokens, or you don't have enough ETH in your wallet to cover the required amount when using GMX SDK.\n" +
|
||||
"Please approve token spending in your wallet and ensure you have sufficient ETH for the transaction, then try again.",
|
||||
|
||||
// InsufficientFundsType.InsufficientAllowance =>
|
||||
// "❌ High Network Fee\n" +
|
||||
// "The gas fee for this position is too high.\n" +
|
||||
// "Position opening rejected.",
|
||||
|
||||
InsufficientFundsType.InsufficientBalance =>
|
||||
"❌ Insufficient Token Balance\n" +
|
||||
"Your wallet doesn't have enough tokens for this trade.\n" +
|
||||
"Please add more tokens to your wallet and try again.",
|
||||
|
||||
InsufficientFundsType.HighNetworkFee =>
|
||||
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" +
|
||||
"Please check your wallet balance and try again."
|
||||
@@ -145,17 +145,17 @@ public enum InsufficientFundsType
|
||||
/// Not enough ETH for gas fees
|
||||
/// </summary>
|
||||
InsufficientEth,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Token allowance is insufficient (ERC20: transfer amount exceeds allowance)
|
||||
/// </summary>
|
||||
InsufficientAllowance,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Token balance is insufficient
|
||||
/// </summary>
|
||||
InsufficientBalance,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// General insufficient funds error
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user