Skip to content

Commit

Permalink
fix qa issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilad75 authored and VolodLytvynenko committed May 8, 2024
1 parent 09a1cdb commit 6119423
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/status_im/contexts/wallet/common/scan_account/view.cljs
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
(ns status-im.contexts.wallet.common.scan-account.view
(:require [status-im.common.scan-qr-code.view :as scan-qr-code]
(:require [clojure.string :as string]
[status-im.common.scan-qr-code.view :as scan-qr-code]
[status-im.constants :as constants]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn- contains-address?
(def ^:private supported-networks #{:eth :arb1 :opt})

(defn- contains-supported-address?
[s]
(boolean (re-find constants/regx-address-contains s)))
(let [address? (boolean (re-find constants/regx-address-contains s))
networks (when address?
(as-> s $
(string/split $ ":")
(butlast $)))
supported? (every? supported-networks (map keyword networks))]
(and address? supported?)))

(defn- extract-address
[scanned-text]
Expand All @@ -20,7 +29,7 @@
{:title (i18n/label :t/scan-qr)
:subtitle (i18n/label :t/scan-an-account-qr-code)
:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
:validate-fn #(contains-address? %)
:validate-fn #(contains-supported-address? %)
:on-success-scan (fn [result]
(let [address (extract-address result)]
(when on-result (on-result address))
Expand Down

0 comments on commit 6119423

Please sign in to comment.