diff --git a/src/status_im/ens/core.cljs b/src/status_im/ens/core.cljs index eeedad5777..5e27c074a0 100644 --- a/src/status_im/ens/core.cljs +++ b/src/status_im/ens/core.cljs @@ -64,14 +64,14 @@ (fx/defn register-name {:events [:ens/register]} - [{:keys [db] :as cofx} {:keys [contract custom-domain? username address public-key]}] + [{:keys [db] :as cofx} {:keys [amount contract custom-domain? username address public-key]}] (let [{:keys [x y]} (ethereum/coordinates public-key)] (signing/eth-transaction-call cofx {:contract (contracts/get-address db :status/snt) :method "approveAndCall(address,uint256,bytes)" :params [contract - (money/unit->token 10 18) + (money/unit->token amount 18) (abi-spec/encode "register(bytes32,address,bytes32,bytes32)" [(ethereum/sha3 username) address x y])] :on-result [:ens/save-username custom-domain? username] @@ -150,9 +150,11 @@ {}))) (fx/defn on-registration-failure + "TODO not sure there is actually anything to do here + it should only be called if the user cancels the signing + Actual registration failure has not been implemented properly" {:events [:ens/on-registration-failure]} - [{:keys [db]} username] - {:db (assoc-state-for db username :registration-failed)}) + [{:keys [db]} username]) (fx/defn store-name-detail {:events [:ens/store-name-detail]} diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index cbb391aa54..dbe33f9055 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -1770,14 +1770,26 @@ :<- [:ens/registration] :<- [:ens.stateofus/registrar] :<- [:multiaccount] - (fn [[{:keys [custom-domain? username-candidate registering?] :as ens} registrar {:keys [accounts public-key]}]] - {:state (get-in ens [:states username-candidate]) - :registering? registering? - :username username-candidate - :custom-domain? (or custom-domain? false) - :contract registrar - :address (:address (ethereum/get-default-account accounts)) - :public-key public-key})) + :<- [:chain-id] + (fn [[{:keys [custom-domain? username-candidate registering?] :as ens} + registrar {:keys [accounts public-key]} chain-id]] + (let [amount (case chain-id + 3 50 + 1 10 + 0) + amount-label (str amount (case chain-id + 3 " STT" + 1 " SNT" + ""))] + {:state (get-in ens [:states username-candidate]) + :registering? registering? + :username username-candidate + :custom-domain? (or custom-domain? false) + :contract registrar + :address (:address (ethereum/get-default-account accounts)) + :public-key public-key + :amount amount + :amount-label amount-label}))) (re-frame/reg-sub :ens.name/screen diff --git a/src/status_im/ui/screens/ens/views.cljs b/src/status_im/ui/screens/ens/views.cljs index 67fa9fbb67..c3a909c678 100644 --- a/src/status_im/ui/screens/ens/views.cljs +++ b/src/status_im/ui/screens/ens/views.cljs @@ -290,7 +290,7 @@ [react/text (i18n/label :t/ens-understand)]]]) -(defn- registration-bottom-bar [{:keys [checked] :as props}] +(defn- registration-bottom-bar [{:keys [checked amount-label] :as props}] [react/view {:style {:height 60 :background-color colors/white :border-top-width 1 @@ -305,7 +305,7 @@ :icon-size 16}]] [react/view {:flex-direction :column :margin-vertical 8} [react/text {:style {:font-size 15}} - (i18n/label :t/ens-10-SNT)] + amount-label] [react/text {:style {:color colors/gray :font-size 15}} (i18n/label :t/ens-deposit)]]] [button {:disabled? (not @checked)