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

Fixes #15542
This commit is contained in:
dlipicar 2024-08-09 12:00:58 -03:00 committed by GitHub
parent e4ddfa4042
commit f21f66099c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 sTr("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

@ -1111,6 +1111,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 {
@ -1451,11 +1452,13 @@ QtObject {
readonly property string paraswapSwapContractAddress: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57"
readonly property string paraswapTermsAndConditionUrl: "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 f45dbb30677a478dc9578238c97900994fcd4147
Subproject commit 720c0c1058f52f551271d0c09dba17bfc3adbada