diff --git a/src/status_im/models/wallet.cljs b/src/status_im/models/wallet.cljs index cb2a31e6f2..e0af4bd870 100644 --- a/src/status_im/models/wallet.cljs +++ b/src/status_im/models/wallet.cljs @@ -16,7 +16,8 @@ (defmethod invalid-send-parameter? :gas-price [_ value] (cond (not value) :invalid-number - (< (money/->wei :gwei value) min-gas-price-wei) :not-enough-wei)) + (< (money/->wei :gwei value) min-gas-price-wei) :not-enough-wei + (-> (money/->wei :gwei value) .decimalPlaces pos?) :invalid-number)) (defmethod invalid-send-parameter? :default [_ value] (when (or (not value) diff --git a/test/cljs/status_im/test/models/wallet.cljs b/test/cljs/status_im/test/models/wallet.cljs index 3f150894dc..b9872d61df 100644 --- a/test/cljs/status_im/test/models/wallet.cljs +++ b/test/cljs/status_im/test/models/wallet.cljs @@ -36,6 +36,11 @@ (is (= "invalid" (get-in actual [:gas :value])))) (testing "it sets max-fee to 0" (is (= "0" (:max-fee actual)))))) + (testing "gas price in wei should be round" + (let [actual (-> {} + (model/build-edit :gas "21000") + (model/build-edit :gas-price "0.0000000023"))] + (is (get-in actual [:gas-price :invalid?])))) (testing "an valid edit" (let [actual (-> {} (model/build-edit :gas "21000")