Skip to content

Commit

Permalink
fix: swap error message (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlec authored Oct 1, 2024
1 parent 0318567 commit 6fe3ec1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/swap/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export enum SwapMessage {
FETCHING_BALANCE = 'Fetching balance...',
INCOMPLETE_FIELD = 'Complete the fields to continue',
INSUFFICIENT_BALANCE = 'Insufficient balance',
LOW_LIQUIDITY = 'Liquidity too low for the token',
LOW_LIQUIDITY = 'Insufficient liquidity for this trade.',
SWAP_IN_PROGRESS = 'Swap in progress...',
TOO_MANY_REQUESTS = 'Too many requests. Please try again later.',
USER_REJECTED = 'User rejected the transaction',
Expand Down
10 changes: 5 additions & 5 deletions src/swap/utils/getSwapMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export function getSwapMessage({
lifecycleStatus,
to,
}: GetSwapMessageParams) {
// handle specific error codes
if (lifecycleStatus.statusName === 'error') {
return getErrorMessage(lifecycleStatus.statusData);
}

// handle balance error
if (from.error || to.error) {
return SwapMessage.BALANCE_ERROR;
Expand All @@ -32,10 +37,5 @@ export function getSwapMessage({
return SwapMessage.INCOMPLETE_FIELD;
}

// handle specific error codes
if (lifecycleStatus.statusName === 'error') {
return getErrorMessage(lifecycleStatus.statusData);
}

return '';
}

0 comments on commit 6fe3ec1

Please sign in to comment.