feat(@desktop/wallet): handle Paraswap price impact error

Fixes #15542
This commit is contained in:
Dario Gabriel Lipicar 2024-07-29 18:10:40 -03:00 committed by dlipicar
parent 95d8db26d2
commit c0e5111fe5
5 changed files with 11 additions and 2 deletions

View File

@ -357,7 +357,8 @@ SplitView {
{name: "errNotEnoughTokenBalance", value: Constants.swap.errorCodes.errNotEnoughTokenBalance},
{name: "errNotEnoughNativeBalance", value: Constants.swap.errorCodes.errNotEnoughNativeBalance},
{name: "errPriceTimeout", value: Constants.swap.errorCodes.errPriceTimeout},
{name: "errNotEnoughLiquidity", value: Constants.swap.errorCodes.errNotEnoughLiquidity}
{name: "errNotEnoughLiquidity", value: Constants.swap.errorCodes.errNotEnoughLiquidity},
{name: "errPriceImpactTooHigh", value: Constants.swap.errorCodes.errPriceImpactTooHigh}
]
textRole: "name"
valueRole: "value"

View File

@ -167,6 +167,7 @@ QtObject {
case Constants.routerErrorCodes.processor.errContextDeadlineExceeded:
case Constants.routerErrorCodes.processor.errPriceTimeout:
case Constants.routerErrorCodes.processor.errNotEnoughLiquidity:
case Constants.routerErrorCodes.processor.errPriceImpactTooHigh:
return qsTr("processor internal error")
case Constants.routerErrorCodes.processor.errTransferCustomError:
case Constants.routerErrorCodes.processor.errERC721TransferCustomError:
@ -276,6 +277,8 @@ QtObject {
return qsTr("fetching price timeout")
case Constants.routerErrorCodes.processor.errNotEnoughLiquidity:
return qsTr("not enough liquidity")
case Constants.routerErrorCodes.processor.errPriceImpactTooHigh:
return qsTr("price impact too high")
case Constants.routerErrorCodes.processor.errTransferCustomError:
case Constants.routerErrorCodes.processor.errERC721TransferCustomError:

View File

@ -191,6 +191,8 @@ QObject {
return qsTr("Fetching the price took longer than expected. Please, try again later.")
case Constants.swap.errorCodes.errNotEnoughLiquidity:
return qsTr("Not enough liquidity. Lower token amount or try again later.")
case Constants.swap.errorCodes.errPriceImpactTooHigh:
return qsTr("Price impact too high. Lower token amount or try again later.")
}
return qsTr("Something went wrong. Change amount, token or try again later.")
}

View File

@ -1084,6 +1084,7 @@ QtObject {
readonly property string errContextDeadlineExceeded : "WPP-036"
readonly property string errPriceTimeout : "WPP-037"
readonly property string errNotEnoughLiquidity : "WPP-038"
readonly property string errPriceImpactTooHigh : "WPP-039"
}
readonly property QtObject router: QtObject {
@ -1416,11 +1417,13 @@ QtObject {
readonly property string paraswapSwapContractAddress: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57"
readonly property string termsAndConditionParaswapUrl: "https://files.paraswap.io/tos_v4.pdf"
// TOOD #15874: Unify with WalletUtils router error code handling
readonly property QtObject errorCodes: QtObject {
readonly property string errNotEnoughTokenBalance: "WR-016"
readonly property string errNotEnoughNativeBalance: "WR-017"
readonly property string errPriceTimeout: "WPP-037"
readonly property string errNotEnoughLiquidity: "WPP-038"
readonly property string errPriceImpactTooHigh: "WPP-039"
}
}

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit d5a78e784aa1b8852efc3a82de1cf9a0a1c10eda
Subproject commit d7fcbd3444aac73a36f1cfeb7a1f11fa4dcd9533