Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/frontend/src/hooks/ramp/useRampValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const useRampValidation = () => {
});

const getCurrentErrorMessage = useCallback(() => {
if (quoteError) return quoteError;
if (quoteError) return t(quoteError);

if (isDisconnected) return;

Expand Down
10 changes: 4 additions & 6 deletions apps/frontend/src/stores/ramp/useQuoteStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface QuotePayload {
interface QuoteState {
quote: QuoteResponse | undefined;
loading: boolean;
error: string | null;
error: string | null; // This is either the error message or the key of the translation
outputAmount: Big | undefined;
exchangeRate: number;
fetchQuote: (params: QuoteParams) => Promise<void>;
Expand Down Expand Up @@ -96,12 +96,11 @@ const processQuoteResponse = (quoteResponse: QuoteResponse) => {
export const useQuoteStore = create<QuoteState>(set => ({
error: null,
exchangeRate: 0,

fetchQuote: async (params: QuoteParams) => {
const { inputAmount, partnerId } = params;

if (!inputAmount) {
set({ error: "Invalid input parameters", loading: false });
if (!inputAmount || inputAmount.eq(0)) {
set({ error: "pages.swap.error.invalidInputAmount", loading: false, outputAmount: Big(0), quote: undefined });
return;
}

Expand Down Expand Up @@ -130,7 +129,7 @@ export const useQuoteStore = create<QuoteState>(set => ({
});
} catch (error) {
console.error("Error fetching quote:", error);
const errorMessage = error instanceof Error ? error.message : "Failed to get quote";
const errorMessage = error instanceof Error ? error.message : "pages.swap.error.fetchingQuote";
set({
error: errorMessage,
loading: false,
Expand All @@ -142,7 +141,6 @@ export const useQuoteStore = create<QuoteState>(set => ({
loading: false,
outputAmount: undefined,
quote: undefined,

reset: () => {
set({
error: null,
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"ARS_tokenUnavailable": "Improving your ARS exit - back shortly! ",
"BRL_tokenUnavailable": "Improving your BRL exit - back shortly! ",
"EURC_tokenUnavailable": "Improving your EUR exit - back shortly! ",
"fetchingQuote": "Failed to get quote",
"gasWarning": "Please choose a smaller amount to ensure you can pay the gas cost of the transaction.",
"initializeFailed": {
"default": "We're experiencing a digital traffic jam. Please hold tight while we clear the road and get things moving again!",
Expand All @@ -383,6 +384,7 @@
},
"insufficientFunds": "Exceeds balance. Your balance is {{userInputTokenBalance}} {{assetSymbol}}",
"insufficientLiquidity": "The amount is temporarily not available. Please, try with a smaller amount.",
"invalidInputAmount": "Invalid input amount",
"lessThanMinimumWithdrawal": {
"buy": "Minimum buy amount is {{minAmountUnits}} {{assetSymbol}}.",
"sell": "Minimum sell amount is {{minAmountUnits}} {{assetSymbol}}."
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/src/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
"ARS_tokenUnavailable": "Ajustando sua saída ARS - em breve!",
"BRL_tokenUnavailable": "Ajustando sua saída BRL - em breve!",
"EURC_tokenUnavailable": "Ajustando sua saída EUR - em breve!",
"fetchingQuote": "Falha ao obter cotação",
"gasWarning": "Escolha um valor menor para garantir que você consiga pagar o custo do gás da transação.",
"initializeFailed": {
"default": "Estamos enfrentando um congestionamento digital. Por favor, aguarde enquanto liberamos o caminho e fazemos as coisas funcionarem novamente!",
Expand All @@ -382,6 +383,7 @@
},
"insufficientFunds": "Saldo insuficiente. Seu saldo é {{userInputTokenBalance}} {{assetSymbol}}",
"insufficientLiquidity": "O valor está temporariamente indisponível. Por favor, tente com um valor menor.",
"invalidInputAmount": "Valor de entrada inválido",
"lessThanMinimumWithdrawal": {
"buy": "O valor mínimo de compra é {{minAmountUnits}} {{assetSymbol}}.",
"sell": "O valor mínimo de venda é {{minAmountUnits}} {{assetSymbol}}."
Expand Down