[#12365] Spin of death on adding custom NFT token contract

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2021-11-23 13:50:41 +01:00
parent 4000abfd0a
commit c9c8263c9e
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
2 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@
{:contract contract {:contract contract
:method "decimals()" :method "decimals()"
:outputs ["uint256"] :outputs ["uint256"]
:on-error #(re-frame/dispatch [:wallet.custom-token/not-supported])
:on-success :on-success
(fn [[contract-decimals]] (fn [[contract-decimals]]
(re-frame/dispatch [:wallet.custom-token/decimals-result (re-frame/dispatch [:wallet.custom-token/decimals-result
@ -31,6 +32,7 @@
{:contract contract {:contract contract
:method "symbol()" :method "symbol()"
:outputs ["string"] :outputs ["string"]
:on-error #(re-frame/dispatch [:wallet.custom-token/not-supported])
:on-success :on-success
(fn [[contract-symbol]] (fn [[contract-symbol]]
(re-frame/dispatch [:wallet.custom-token/symbol-result (re-frame/dispatch [:wallet.custom-token/symbol-result
@ -58,6 +60,7 @@
{:contract contract {:contract contract
:method "name()" :method "name()"
:outputs ["string"] :outputs ["string"]
:on-error #(re-frame/dispatch [:wallet.custom-token/not-supported])
:on-success :on-success
(fn [[contract-name]] (fn [[contract-name]]
(re-frame/dispatch [:wallet.custom-token/name-result (re-frame/dispatch [:wallet.custom-token/name-result
@ -149,6 +152,12 @@
(update db :wallet/custom-token-screen merge {:name token-name}) (update db :wallet/custom-token-screen merge {:name token-name})
:wallet.custom-token/get-symbol contract}) :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 (fx/defn balance-result
{:events [:wallet.custom-token/balance-result]} {:events [:wallet.custom-token/balance-result]}
[{:keys [db]} contract balance] [{:keys [db]} contract balance]

View File

@ -1359,6 +1359,7 @@
"wrong-card": "Wrong card", "wrong-card": "Wrong card",
"wrong-card-text": "Tapped card does not correspond to the keys you selected", "wrong-card-text": "Tapped card does not correspond to the keys you selected",
"wrong-contract": "Wrong contract", "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-text": "The Keycard you tapped is not associated with this phone",
"wrong-keycard-title": "Looks like youve tapped \na wrong keycard", "wrong-keycard-title": "Looks like youve tapped \na wrong keycard",
"wrong-password": "Wrong password", "wrong-password": "Wrong password",