diff --git a/package.json b/package.json index 4d1a1526..99ed7b33 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ } }, "dependencies": { + "@ledgerhq/errors": "^4.35.1", "@ledgerhq/hw-app-btc": "^4.34.0", "@ledgerhq/hw-app-eth": "^4.32.0", "@ledgerhq/hw-app-xrp": "^4.32.0", diff --git a/src/bridge/RippleJSBridge.js b/src/bridge/RippleJSBridge.js index 2b975444..0ec547cb 100644 --- a/src/bridge/RippleJSBridge.js +++ b/src/bridge/RippleJSBridge.js @@ -34,6 +34,7 @@ import { NotEnoughBalance, FeeNotLoaded, NotEnoughBalanceBecauseDestinationNotCreated, + InvalidAddressBecauseDestinationIsAlsoSource, } from '@ledgerhq/errors' import type { WalletBridge, EditProps } from './types' @@ -151,7 +152,7 @@ function isRecipientValid(recipient, source) { function getRecipientWarning(recipient, source) { if (source === recipient) { - return new Error('InvalidAddressBecauseDestinationIsAlsoSource') + return new InvalidAddressBecauseDestinationIsAlsoSource() } return null } diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 5a77c007..d1b58fa1 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -900,6 +900,9 @@ "InvalidAddress": { "title": "This is not a valid {{currencyName}} address" }, + "InvalidAddressBecauseDestinationIsAlsoSource": { + "title": "Destination and source accounts can't be the same" + }, "CantOpenDevice": { "title": "Oops, couldn’t connect to device", "description": "Device detected but connection failed. Please try again or contact us if the problem persists." diff --git a/yarn.lock b/yarn.lock index 9a55d7e3..f93b69d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1677,10 +1677,10 @@ camelcase "^5.0.0" prettier "^1.13.7" -"@ledgerhq/errors@^4.32.0": - version "4.33.7" - resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-4.33.7.tgz#b78becd20e8a68f7115ad0986fa357a8adddf6b7" - integrity sha512-1vKWcttI5NHpT6rMKKuxWPAjfwDgfgUTf/AyNAT5KXHlhiLvqnA3NDCdNUVadajVNKSa/s1u1ZWKismtbfePzg== +"@ledgerhq/errors@^4.32.0", "@ledgerhq/errors@^4.35.1": + version "4.35.1" + resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-4.35.1.tgz#3f162dc05480e444083b6381bd098df187751633" + integrity sha512-2Bo3/NRKyz3ddR07TvZ87VpDJc8fz4+ONLJnhzC0mwIwu+Pxal6SgCBiGtv503oGxkgDuG5PtODZBaehWkGRnQ== "@ledgerhq/hw-app-btc@^4.32.0": version "4.32.0"