Skip to content

Commit

Permalink
feat: add slippage too large error
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jul 4, 2022
1 parent e9de59c commit 17b0780
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/widget/src/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@
"transactionUnderpriced": "Transaction is underpriced.",
"transactionUnprepared": "Unable to prepare transaction.",
"unknown": "Something went wrong.",
"userRejectedSignatureRequest": "Signature required."
"userRejectedSignatureRequest": "Signature required.",
"slippageTooLarge": "Slippage too large."
},
"message": {
"signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
"transactionFailed": "Please check the block explorer for more information.",
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}})."
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}}).",
"slippageTooLarge": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."
}
},
"process": {
Expand Down
4 changes: 4 additions & 0 deletions packages/widget/src/pages/SwapPage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export function getProcessMessage(
title = t(`swap.error.title.transactionUnprepared`);
message = getTransactionNotSentMessage();
break;
case LifiErrorCode.SlippageError:
title = t(`swap.error.title.slippageTooLarge`);
message = t(`swap.error.message.slippageTooLarge`);
break;
case MetaMaskProviderErrorCode.userRejectedRequest:
title = t(`swap.error.title.userRejectedSignatureRequest`);
message = t(`swap.error.message.signatureRequired`, {
Expand Down

0 comments on commit 17b0780

Please sign in to comment.