-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose monadic quote errors to the user (#5055)
- Loading branch information
1 parent
4c9787a
commit 1822ee1
Showing
7 changed files
with
107 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ts/MultiHopTrade/components/TradeInput/components/TradeQuotes/getQouteErrorTranslation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { InterpolationOptions } from 'node-polyglot' | ||
import type { SwapErrorRight } from 'lib/swapper/api' | ||
import { SwapErrorType } from 'lib/swapper/api' | ||
|
||
export const quoteStatusTranslation = ( | ||
swapError: SwapErrorRight | undefined, | ||
): string | [string, InterpolationOptions] => { | ||
const code = swapError?.code | ||
|
||
switch (code) { | ||
case SwapErrorType.TRADING_HALTED: | ||
return 'trade.errors.tradingNotActiveNoAssetSymbol' | ||
case SwapErrorType.UNSUPPORTED_PAIR: | ||
return 'trade.errors.unsupportedTradePair' | ||
default: | ||
return 'trade.errors.quoteError' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters