Skip to content

Commit

Permalink
[#10868] ENS name is pending when tx has failed
Browse files Browse the repository at this point in the history
Signed-off-by: andrey <motor4ik@gmail.com>
  • Loading branch information
flexsurfer committed Jul 1, 2020
1 parent ac74cf0 commit 49744d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
15 changes: 15 additions & 0 deletions src/status_im/ens/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,18 @@
(fx/merge cofx
(set-username-candidate (get-in db [:ens/registration :username] ""))
(navigation/navigate-to-cofx :ens-search {})))

(fx/defn remove-username
{:events [::remove-username]}
[{:keys [db] :as cofx} name]
(let [names (get-in db [:multiaccount :usernames] [])
preferred-name (get-in db [:multiaccount :preferred-name])
new-names (remove #(= name %) names)]
(fx/merge cofx
(multiaccounts.update/multiaccount-update
:usernames new-names
{})
(when (= name preferred-name)
(multiaccounts.update/multiaccount-update
:preferred-name (first new-names) {}))
(navigation/navigate-back))))
17 changes: 10 additions & 7 deletions src/status_im/ui/screens/ens/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,18 @@
[section {:title (i18n/label :t/key)
:content public-key}]])
[react/view {:style {:margin-top 16 :margin-bottom 32}}
;;TODO: re-enable once feature is developped
#_[list/big-list-item {:text (i18n/label :t/ens-remove-username)
:subtext (i18n/label :t/ens-remove-hints)
:text-color colors/gray
;;TODO this is temporary fix for accounts with failed txs
;;we still need this for regular ens names (not pending) but we need to detach public key in the contract
(when pending?
[list/big-list-item {:text (i18n/label :t/ens-remove-username)
;:subtext (i18n/label :t/ens-remove-hints)
:text-color colors/red
:text-style {:font-weight "500"}
:icon :main-icons/close
:icon-color colors/gray
:hide-chevron? true}]
(when-not custom-domain?
:icon-color colors/red
:hide-chevron? true
:action-fn #(re-frame/dispatch [::ens/remove-username name])}])
(when (and (not custom-domain?) (not pending?))
[react/view {:style {:margin-top 18}}
[list/big-list-item {:text (i18n/label :t/ens-release-username)
:text-color (if releasable?
Expand Down

0 comments on commit 49744d8

Please sign in to comment.