From c9c8263c9e35142693e2ebd2f640f340708296ee Mon Sep 17 00:00:00 2001 From: andrey Date: Tue, 23 Nov 2021 13:50:41 +0100 Subject: [PATCH] [#12365] Spin of death on adding custom NFT token contract Signed-off-by: andrey --- src/status_im/wallet/custom_tokens/core.cljs | 9 +++++++++ translations/en.json | 1 + 2 files changed, 10 insertions(+) diff --git a/src/status_im/wallet/custom_tokens/core.cljs b/src/status_im/wallet/custom_tokens/core.cljs index 953ab7049b..3db6996cb1 100644 --- a/src/status_im/wallet/custom_tokens/core.cljs +++ b/src/status_im/wallet/custom_tokens/core.cljs @@ -19,6 +19,7 @@ {:contract contract :method "decimals()" :outputs ["uint256"] + :on-error #(re-frame/dispatch [:wallet.custom-token/not-supported]) :on-success (fn [[contract-decimals]] (re-frame/dispatch [:wallet.custom-token/decimals-result @@ -31,6 +32,7 @@ {:contract contract :method "symbol()" :outputs ["string"] + :on-error #(re-frame/dispatch [:wallet.custom-token/not-supported]) :on-success (fn [[contract-symbol]] (re-frame/dispatch [:wallet.custom-token/symbol-result @@ -58,6 +60,7 @@ {:contract contract :method "name()" :outputs ["string"] + :on-error #(re-frame/dispatch [:wallet.custom-token/not-supported]) :on-success (fn [[contract-name]] (re-frame/dispatch [:wallet.custom-token/name-result @@ -149,6 +152,12 @@ (update db :wallet/custom-token-screen merge {:name token-name}) :wallet.custom-token/get-symbol contract}) +(fx/defn not-supported + {:events [:wallet.custom-token/not-supported]} + [{:keys [db]}] + {:db (assoc-in db [:wallet/custom-token-screen :in-progress?] nil) + :utils/show-popup {:content (i18n/label :t/contract-isnt-supported)}}) + (fx/defn balance-result {:events [:wallet.custom-token/balance-result]} [{:keys [db]} contract balance] diff --git a/translations/en.json b/translations/en.json index 29772d8c23..06a3e82778 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1359,6 +1359,7 @@ "wrong-card": "Wrong card", "wrong-card-text": "Tapped card does not correspond to the keys you selected", "wrong-contract": "Wrong contract", + "contract-isnt-supported": "Contract is not supported", "wrong-keycard-text": "The Keycard you tapped is not associated with this phone", "wrong-keycard-title": "Looks like you’ve tapped \na wrong keycard", "wrong-password": "Wrong password",