custom network symbol
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
f448f014f6
commit
c16b0860ec
1
.env
1
.env
|
@ -31,3 +31,4 @@ DATABASE_MANAGEMENT_ENABLED=1
|
||||||
METRICS_ENABLED=0
|
METRICS_ENABLED=0
|
||||||
DELETE_MESSAGE_ENABLED=1
|
DELETE_MESSAGE_ENABLED=1
|
||||||
COLLECTIBLES_ENABLED=1
|
COLLECTIBLES_ENABLED=1
|
||||||
|
COMMANDS_ENABLED=1
|
||||||
|
|
|
@ -122,13 +122,17 @@
|
||||||
network->chain-keyword
|
network->chain-keyword
|
||||||
name))
|
name))
|
||||||
|
|
||||||
(defn chain-keyword
|
(defn get-current-network
|
||||||
[{:networks/keys [current-network networks]}]
|
[{:networks/keys [current-network networks]}]
|
||||||
(network->chain-keyword (get networks current-network)))
|
(get networks current-network))
|
||||||
|
|
||||||
|
(defn chain-keyword
|
||||||
|
[db]
|
||||||
|
(network->chain-keyword (get-current-network db)))
|
||||||
|
|
||||||
(defn chain-id
|
(defn chain-id
|
||||||
[{:networks/keys [current-network networks]}]
|
[db]
|
||||||
(network->chain-id (get networks current-network)))
|
(network->chain-id (get-current-network db)))
|
||||||
|
|
||||||
(defn snt-symbol [db]
|
(defn snt-symbol [db]
|
||||||
(chain-keyword->snt-symbol (chain-keyword db)))
|
(chain-keyword->snt-symbol (chain-keyword db)))
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
(ns status-im.ethereum.tokens
|
(ns status-im.ethereum.tokens
|
||||||
(:require [clojure.string :as string])
|
(:require [clojure.string :as string]
|
||||||
|
[status-im.ethereum.core :as ethereum])
|
||||||
(:require-macros
|
(:require-macros
|
||||||
[status-im.ethereum.macros :as ethereum.macros :refer [resolve-icons]]))
|
[status-im.ethereum.macros :as ethereum.macros :refer [resolve-icons]]))
|
||||||
|
|
||||||
(def default-native-currency
|
(def default-native-currency
|
||||||
(memoize
|
(memoize
|
||||||
(fn []
|
(fn [symbol]
|
||||||
{:name "Native"
|
{:name "Native"
|
||||||
:symbol :ETH
|
:symbol :ETH
|
||||||
|
:symbol-display symbol
|
||||||
:decimals 18
|
:decimals 18
|
||||||
:icon {:source (js/require "../resources/images/tokens/default-token.png")}})))
|
:icon {:source (js/require "../resources/images/tokens/default-token.png")}})))
|
||||||
|
|
||||||
|
@ -43,8 +45,9 @@
|
||||||
(def native-currency-symbols
|
(def native-currency-symbols
|
||||||
(set (map #(-> % val :symbol) all-native-currencies)))
|
(set (map #(-> % val :symbol) all-native-currencies)))
|
||||||
|
|
||||||
(defn native-currency [chain]
|
(defn native-currency [{:keys [symbol] :as current-network}]
|
||||||
(-> (get all-native-currencies chain (default-native-currency))))
|
(let [chain (ethereum/network->chain-keyword current-network)]
|
||||||
|
(get all-native-currencies chain (default-native-currency symbol))))
|
||||||
|
|
||||||
(defn ethereum? [symbol]
|
(defn ethereum? [symbol]
|
||||||
(native-currency-symbols symbol))
|
(native-currency-symbols symbol))
|
||||||
|
@ -855,8 +858,8 @@
|
||||||
(defn address->token [all-tokens address]
|
(defn address->token [all-tokens address]
|
||||||
(get all-tokens (string/lower-case address)))
|
(get all-tokens (string/lower-case address)))
|
||||||
|
|
||||||
(defn asset-for [all-tokens chain symbol]
|
(defn asset-for [all-tokens current-network symbol]
|
||||||
(let [native-coin (native-currency chain)]
|
(let [native-coin (native-currency current-network)]
|
||||||
(if (or (= (:symbol-display native-coin) symbol)
|
(if (or (= (:symbol-display native-coin) symbol)
|
||||||
(= (:symbol native-coin) symbol))
|
(= (:symbol native-coin) symbol))
|
||||||
native-coin
|
native-coin
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
(def default-manage
|
(def default-manage
|
||||||
{:name {:value ""}
|
{:name {:value ""}
|
||||||
:url {:value ""}
|
:url {:value ""}
|
||||||
|
:symbol {:value ""}
|
||||||
:chain {:value :mainnet}})
|
:chain {:value :mainnet}})
|
||||||
|
|
||||||
(defn validate-string [{:keys [value]}]
|
(defn validate-string [{:keys [value]}]
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
(-> manage
|
(-> manage
|
||||||
(update :url validate-url)
|
(update :url validate-url)
|
||||||
(update :name validate-string)
|
(update :name validate-string)
|
||||||
|
(update :symbol validate-string)
|
||||||
(update :chain validate-string)
|
(update :chain validate-string)
|
||||||
(update :network-id validate-network-id)))
|
(update :network-id validate-network-id)))
|
||||||
|
|
||||||
|
@ -151,7 +153,7 @@
|
||||||
:on-success #(re-frame/dispatch [:navigate-back])}]}))
|
:on-success #(re-frame/dispatch [:navigate-back])}]}))
|
||||||
|
|
||||||
(defn new-network
|
(defn new-network
|
||||||
[random-id network-name upstream-url chain-type chain-id]
|
[random-id network-name symbol upstream-url chain-type chain-id]
|
||||||
(let [data-dir (str "/ethereum/" (name chain-type) "_rpc")
|
(let [data-dir (str "/ethereum/" (name chain-type) "_rpc")
|
||||||
config {:NetworkId (or (when chain-id (int chain-id))
|
config {:NetworkId (or (when chain-id (int chain-id))
|
||||||
(ethereum/chain-keyword->chain-id chain-type))
|
(ethereum/chain-keyword->chain-id chain-type))
|
||||||
|
@ -160,6 +162,7 @@
|
||||||
:URL upstream-url}}]
|
:URL upstream-url}}]
|
||||||
{:id random-id
|
{:id random-id
|
||||||
:name network-name
|
:name network-name
|
||||||
|
:symbol symbol
|
||||||
:config config}))
|
:config config}))
|
||||||
|
|
||||||
(fx/defn save
|
(fx/defn save
|
||||||
|
@ -169,10 +172,11 @@
|
||||||
random-id-generator :random-id-generator :as cofx}]
|
random-id-generator :random-id-generator :as cofx}]
|
||||||
(if (valid-manage? manage)
|
(if (valid-manage? manage)
|
||||||
;; rename network-id from UI to chain-id
|
;; rename network-id from UI to chain-id
|
||||||
(let [{:keys [name url chain network-id]} manage
|
(let [{:keys [name url chain network-id symbol]} manage
|
||||||
random-id (string/replace (random-id-generator) "-" "")
|
random-id (string/replace (random-id-generator) "-" "")
|
||||||
network (new-network random-id
|
network (new-network random-id
|
||||||
(:value name)
|
(:value name)
|
||||||
|
(:value symbol)
|
||||||
(:value url)
|
(:value url)
|
||||||
(:value chain)
|
(:value chain)
|
||||||
(:value network-id))
|
(:value network-id))
|
||||||
|
|
|
@ -34,11 +34,13 @@
|
||||||
(deftest new-network-test
|
(deftest new-network-test
|
||||||
(let [actual (network.core/new-network "randomid"
|
(let [actual (network.core/new-network "randomid"
|
||||||
"network-name"
|
"network-name"
|
||||||
|
"network-symbol"
|
||||||
"upstream-url"
|
"upstream-url"
|
||||||
:mainnet
|
:mainnet
|
||||||
nil)]
|
nil)]
|
||||||
(is (= {:id "randomid"
|
(is (= {:id "randomid"
|
||||||
:name "network-name"
|
:name "network-name"
|
||||||
|
:symbol "network-symbol"
|
||||||
:config {:NetworkId 1
|
:config {:NetworkId 1
|
||||||
:DataDir "/ethereum/mainnet_rpc"
|
:DataDir "/ethereum/mainnet_rpc"
|
||||||
:UpstreamConfig {:Enabled true
|
:UpstreamConfig {:Enabled true
|
||||||
|
@ -48,11 +50,13 @@
|
||||||
(deftest new-network-id-test
|
(deftest new-network-id-test
|
||||||
(let [actual (network.core/new-network "randomid"
|
(let [actual (network.core/new-network "randomid"
|
||||||
"network-name"
|
"network-name"
|
||||||
|
"network-symbol"
|
||||||
"upstream-url"
|
"upstream-url"
|
||||||
:mainnet
|
:mainnet
|
||||||
"5777")]
|
"5777")]
|
||||||
(is (= {:id "randomid"
|
(is (= {:id "randomid"
|
||||||
:name "network-name"
|
:name "network-name"
|
||||||
|
:symbol "network-symbol"
|
||||||
:config {:NetworkId 5777
|
:config {:NetworkId 5777
|
||||||
:DataDir "/ethereum/mainnet_rpc"
|
:DataDir "/ethereum/mainnet_rpc"
|
||||||
:UpstreamConfig {:Enabled true
|
:UpstreamConfig {:Enabled true
|
||||||
|
@ -63,21 +67,31 @@
|
||||||
(testing "a valid manage"
|
(testing "a valid manage"
|
||||||
(is (network.core/valid-manage? {:url {:value "http://valid.com"}
|
(is (network.core/valid-manage? {:url {:value "http://valid.com"}
|
||||||
:name {:value "valid"}
|
:name {:value "valid"}
|
||||||
|
:symbol {:value "valid"}
|
||||||
:chain {:value "valid"}})))
|
:chain {:value "valid"}})))
|
||||||
(testing "invalid url"
|
(testing "invalid url"
|
||||||
(is (not (network.core/valid-manage? {:url {:value "invalid"}
|
(is (not (network.core/valid-manage? {:url {:value "invalid"}
|
||||||
:name {:value "valid"}
|
:name {:value "valid"}
|
||||||
|
:symbol {:value "valid"}
|
||||||
:chain {:value "valid"}}))))
|
:chain {:value "valid"}}))))
|
||||||
|
|
||||||
(testing "invalid name"
|
(testing "invalid name"
|
||||||
(is (not (network.core/valid-manage? {:url {:value "http://valid.com"}
|
(is (not (network.core/valid-manage? {:url {:value "http://valid.com"}
|
||||||
:name {:value ""}
|
:name {:value ""}
|
||||||
|
:symbol {:value "valid"}
|
||||||
:chain {:value "valid"}}))))
|
:chain {:value "valid"}}))))
|
||||||
|
|
||||||
(testing "invalid chain"
|
(testing "invalid chain"
|
||||||
(is (not (network.core/valid-manage? {:url {:value "http://valid.com"}
|
(is (not (network.core/valid-manage? {:url {:value "http://valid.com"}
|
||||||
:name {:value "valid"}
|
:name {:value "valid"}
|
||||||
:chain {:value ""}})))))
|
:symbol {:value "valid"}
|
||||||
|
:chain {:value ""}}))))
|
||||||
|
|
||||||
|
(testing "invalid symbol"
|
||||||
|
(is (not (network.core/valid-manage? {:url {:value "http://valid.com"}
|
||||||
|
:name {:value "valid"}
|
||||||
|
:symbol {:value ""}
|
||||||
|
:chain {:value "valid"}})))))
|
||||||
|
|
||||||
(deftest set-input-test
|
(deftest set-input-test
|
||||||
(testing "it updates and validate a field"
|
(testing "it updates and validate a field"
|
||||||
|
@ -85,6 +99,8 @@
|
||||||
:error false}
|
:error false}
|
||||||
:name {:value ""
|
:name {:value ""
|
||||||
:error true}
|
:error true}
|
||||||
|
:symbol {:value "symbol"
|
||||||
|
:error false}
|
||||||
:chain {:value "mainnet"
|
:chain {:value "mainnet"
|
||||||
:error false}
|
:error false}
|
||||||
:network-id {:value nil
|
:network-id {:value nil
|
||||||
|
@ -93,6 +109,8 @@
|
||||||
:error true}
|
:error true}
|
||||||
:name {:value ""
|
:name {:value ""
|
||||||
:error false}
|
:error false}
|
||||||
|
:symbol {:value "symbol"
|
||||||
|
:error false}
|
||||||
:chain {:value "mainnet"
|
:chain {:value "mainnet"
|
||||||
:error false}}}}
|
:error false}}}}
|
||||||
:url "http://valid.com")))))
|
:url "http://valid.com")))))
|
||||||
|
@ -110,11 +128,13 @@
|
||||||
(let [fx (network.core/save {:random-id-generator (constantly "random-id")
|
(let [fx (network.core/save {:random-id-generator (constantly "random-id")
|
||||||
:db {:networks/manage {:url {:value "http://valid.com"}
|
:db {:networks/manage {:url {:value "http://valid.com"}
|
||||||
:chain {:value :mainnet}
|
:chain {:value :mainnet}
|
||||||
|
:symbol {:value "symbol"}
|
||||||
:name {:value "valid"}}
|
:name {:value "valid"}}
|
||||||
:multiaccount {}
|
:multiaccount {}
|
||||||
:networks/networks {"random2"
|
:networks/networks {"random2"
|
||||||
{:id "random2"
|
{:id "random2"
|
||||||
:name "network-name"
|
:name "network-name"
|
||||||
|
:symbol "symbol"
|
||||||
:config {:NetworkId 1
|
:config {:NetworkId 1
|
||||||
:DataDir "/ethereum/mainnet_rpc"
|
:DataDir "/ethereum/mainnet_rpc"
|
||||||
:UpstreamConfig {:Enabled true
|
:UpstreamConfig {:Enabled true
|
||||||
|
@ -147,11 +167,13 @@
|
||||||
:db {:networks/manage {:url {:value "http://valid.com"}
|
:db {:networks/manage {:url {:value "http://valid.com"}
|
||||||
:chain {:value :mainnet}
|
:chain {:value :mainnet}
|
||||||
:name {:value "valid"}
|
:name {:value "valid"}
|
||||||
|
:symbol {:value "symbol"}
|
||||||
:network-id {:value 5}}
|
:network-id {:value 5}}
|
||||||
:multiaccount {}
|
:multiaccount {}
|
||||||
:networks/networks {"randomid"
|
:networks/networks {"randomid"
|
||||||
{:id "randomid"
|
{:id "randomid"
|
||||||
:name "network-name"
|
:name "network-name"
|
||||||
|
:symbol "symbol"
|
||||||
:config {:NetworkId 3
|
:config {:NetworkId 3
|
||||||
:DataDir "/ethereum/mainnet_rpc"
|
:DataDir "/ethereum/mainnet_rpc"
|
||||||
:UpstreamConfig {:Enabled true
|
:UpstreamConfig {:Enabled true
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
(get-in tokens/all-tokens-normalized
|
(get-in tokens/all-tokens-normalized
|
||||||
[(keyword chain) (clojure.string/lower-case contract)]
|
[(keyword chain) (clojure.string/lower-case contract)]
|
||||||
default-erc20-token)
|
default-erc20-token)
|
||||||
(tokens/native-currency (keyword chain)))
|
(tokens/native-currency network))
|
||||||
amount (money/wei->ether (decode/uint value))
|
amount (money/wei->ether (decode/uint value))
|
||||||
to (or (:name toAccount) (utils/get-shortened-address to))
|
to (or (:name toAccount) (utils/get-shortened-address to))
|
||||||
from (or (:name fromAccount) (utils/get-shortened-address from))
|
from (or (:name fromAccount) (utils/get-shortened-address from))
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
:symbol :ETH
|
:symbol :ETH
|
||||||
:value value
|
:value value
|
||||||
:amount (str eth-amount)
|
:amount (str eth-amount)
|
||||||
:token (tokens/asset-for (:wallet/all-tokens db) (ethereum/chain-keyword db) :ETH)}
|
:token (tokens/asset-for (:wallet/all-tokens db) (ethereum/get-current-network db) :ETH)}
|
||||||
(not (nil? token))
|
(not (nil? token))
|
||||||
token
|
token
|
||||||
:else
|
:else
|
||||||
|
|
|
@ -509,6 +509,12 @@
|
||||||
(fn [chain-id]
|
(fn [chain-id]
|
||||||
(= 1 chain-id)))
|
(= 1 chain-id)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:ethereum-network?
|
||||||
|
:<- [:chain-id]
|
||||||
|
(fn [chain-id]
|
||||||
|
(< chain-id 6)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:network-name
|
:network-name
|
||||||
:<- [:current-network]
|
:<- [:current-network]
|
||||||
|
@ -654,9 +660,9 @@
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:ethereum/native-currency
|
:ethereum/native-currency
|
||||||
:<- [:ethereum/chain-keyword]
|
:<- [:current-network]
|
||||||
(fn [chain-keyword]
|
(fn [network]
|
||||||
(tokens/native-currency chain-keyword)))
|
(tokens/native-currency network)))
|
||||||
|
|
||||||
;;MULTIACCOUNT ==============================================================================================================
|
;;MULTIACCOUNT ==============================================================================================================
|
||||||
|
|
||||||
|
@ -1794,12 +1800,12 @@
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/visible-assets
|
:wallet/visible-assets
|
||||||
:<- [:ethereum/chain-keyword]
|
:<- [:current-network]
|
||||||
:<- [:wallet/visible-tokens-symbols]
|
:<- [:wallet/visible-tokens-symbols]
|
||||||
:<- [:wallet/sorted-tokens]
|
:<- [:wallet/sorted-tokens]
|
||||||
(fn [[chain visible-tokens-symbols all-tokens-sorted]]
|
(fn [[network visible-tokens-symbols all-tokens-sorted]]
|
||||||
(conj (filter #(contains? visible-tokens-symbols (:symbol %)) all-tokens-sorted)
|
(conj (filter #(contains? visible-tokens-symbols (:symbol %)) all-tokens-sorted)
|
||||||
(tokens/native-currency chain))))
|
(tokens/native-currency network))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/visible-assets-with-amount
|
:wallet/visible-assets-with-amount
|
||||||
|
@ -2796,11 +2802,11 @@
|
||||||
:<- [:wallet]
|
:<- [:wallet]
|
||||||
:<- [:offline?]
|
:<- [:offline?]
|
||||||
:<- [:wallet/all-tokens]
|
:<- [:wallet/all-tokens]
|
||||||
:<- [:ethereum/chain-keyword]
|
:<- [:current-network]
|
||||||
(fn [[{:keys [symbol from to amount-text] :as transaction}
|
(fn [[{:keys [symbol from to amount-text] :as transaction}
|
||||||
wallet offline? all-tokens chain]]
|
wallet offline? all-tokens current-network]]
|
||||||
(let [balance (get-in wallet [:accounts (:address from) :balance])
|
(let [balance (get-in wallet [:accounts (:address from) :balance])
|
||||||
{:keys [decimals] :as token} (tokens/asset-for all-tokens chain symbol)
|
{:keys [decimals] :as token} (tokens/asset-for all-tokens current-network symbol)
|
||||||
{:keys [value error]} (wallet.db/parse-amount amount-text decimals)
|
{:keys [value error]} (wallet.db/parse-amount amount-text decimals)
|
||||||
amount (money/formatted->internal value symbol decimals)
|
amount (money/formatted->internal value symbol decimals)
|
||||||
{:keys [amount-error] :as transaction-new}
|
{:keys [amount-error] :as transaction-new}
|
||||||
|
@ -2823,11 +2829,11 @@
|
||||||
:<- [:wallet]
|
:<- [:wallet]
|
||||||
:<- [:offline?]
|
:<- [:offline?]
|
||||||
:<- [:wallet/all-tokens]
|
:<- [:wallet/all-tokens]
|
||||||
:<- [:ethereum/chain-keyword]
|
:<- [:current-network]
|
||||||
(fn [[{:keys [symbol from to amount-text] :as transaction}
|
(fn [[{:keys [symbol from to amount-text] :as transaction}
|
||||||
wallet offline? all-tokens chain]]
|
wallet offline? all-tokens current-network]]
|
||||||
(let [balance (get-in wallet [:accounts (:address from) :balance])
|
(let [balance (get-in wallet [:accounts (:address from) :balance])
|
||||||
{:keys [decimals] :as token} (tokens/asset-for all-tokens chain symbol)
|
{:keys [decimals] :as token} (tokens/asset-for all-tokens current-network symbol)
|
||||||
{:keys [value error]} (wallet.db/parse-amount amount-text decimals)
|
{:keys [value error]} (wallet.db/parse-amount amount-text decimals)
|
||||||
amount (money/formatted->internal value symbol decimals)
|
amount (money/formatted->internal value symbol decimals)
|
||||||
{:keys [amount-error] :as transaction-new}
|
{:keys [amount-error] :as transaction-new}
|
||||||
|
|
|
@ -149,12 +149,13 @@
|
||||||
|
|
||||||
(defn- command-transaction-info
|
(defn- command-transaction-info
|
||||||
[contract value]
|
[contract value]
|
||||||
(let [{:keys [symbol icon decimals color] :as token}
|
(let [{:keys [symbol symbol-display icon decimals color] :as token}
|
||||||
(if (seq contract)
|
(if (seq contract)
|
||||||
(get @(re-frame/subscribe [:wallet/all-tokens])
|
(get @(re-frame/subscribe [:wallet/all-tokens])
|
||||||
contract
|
contract
|
||||||
transactions/default-erc20-token)
|
transactions/default-erc20-token)
|
||||||
@(re-frame/subscribe [:ethereum/native-currency]))
|
@(re-frame/subscribe [:ethereum/native-currency]))
|
||||||
|
symbol (or symbol-display symbol)
|
||||||
amount (money/internal->formatted value symbol decimals)
|
amount (money/internal->formatted value symbol decimals)
|
||||||
{:keys [code]}
|
{:keys [code]}
|
||||||
@(re-frame/subscribe [:wallet/currency])
|
@(re-frame/subscribe [:wallet/currency])
|
||||||
|
|
|
@ -34,6 +34,13 @@
|
||||||
:default-value (get-in manage-network [:name :value])
|
:default-value (get-in manage-network [:name :value])
|
||||||
:on-change-text #(re-frame/dispatch [::network/input-changed :name %])
|
:on-change-text #(re-frame/dispatch [::network/input-changed :name %])
|
||||||
:auto-focus true}]]
|
:auto-focus true}]]
|
||||||
|
[react/view {:padding-vertical 8}
|
||||||
|
[quo/text-input
|
||||||
|
{:label (i18n/label :t/symbol)
|
||||||
|
:placeholder (i18n/label :t/specify-symbol)
|
||||||
|
:default-value (get-in manage-network [:symbol :value])
|
||||||
|
:on-change-text #(re-frame/dispatch [::network/input-changed :symbol %])
|
||||||
|
:auto-focus true}]]
|
||||||
[react/view {:padding-vertical 8}
|
[react/view {:padding-vertical 8}
|
||||||
[quo/text-input
|
[quo/text-input
|
||||||
{:label (i18n/label :t/rpc-url)
|
{:label (i18n/label :t/rpc-url)
|
||||||
|
|
|
@ -410,7 +410,7 @@
|
||||||
[{:keys [from contact amount token cancel?] :as tx}]
|
[{:keys [from contact amount token cancel?] :as tx}]
|
||||||
(views/letsubs [fee [:signing/fee]
|
(views/letsubs [fee [:signing/fee]
|
||||||
sign [:signing/sign]
|
sign [:signing/sign]
|
||||||
chain [:ethereum/chain-keyword]
|
chain [:current-network]
|
||||||
{:keys [amount-error gas-error gas-error-state]}
|
{:keys [amount-error gas-error gas-error-state]}
|
||||||
[:signing/amount-errors (:address from)]
|
[:signing/amount-errors (:address from)]
|
||||||
keycard-multiaccount? [:keycard-multiaccount?]
|
keycard-multiaccount? [:keycard-multiaccount?]
|
||||||
|
|
|
@ -102,14 +102,15 @@
|
||||||
currency [:wallet/currency]
|
currency [:wallet/currency]
|
||||||
opensea-enabled? [:opensea-enabled?]
|
opensea-enabled? [:opensea-enabled?]
|
||||||
collectible-collection [:wallet/collectible-collection address]
|
collectible-collection [:wallet/collectible-collection address]
|
||||||
mainnet? [:mainnet?]]
|
mainnet? [:mainnet?]
|
||||||
|
ethereum-network? [:ethereum-network?]]
|
||||||
(let [{:keys [tab]} @state]
|
(let [{:keys [tab]} @state]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[react/view {:flex-direction :row :margin-bottom 8 :padding-horizontal 4}
|
[react/view {:flex-direction :row :margin-bottom 8 :padding-horizontal 4}
|
||||||
[tabs/tab-title state :assets (i18n/label :t/wallet-assets) (= tab :assets)]
|
[tabs/tab-title state :assets (i18n/label :t/wallet-assets) (= tab :assets)]
|
||||||
(when mainnet?
|
(when ethereum-network?
|
||||||
[tabs/tab-title state :nft (i18n/label :t/wallet-collectibles) (= tab :nft)])
|
[tabs/tab-title state :nft (i18n/label :t/wallet-collectibles) (= tab :nft)])
|
||||||
(when mainnet?
|
(when ethereum-network?
|
||||||
[tabs/tab-title state :history (i18n/label :t/history) (= tab :history)])]
|
[tabs/tab-title state :history (i18n/label :t/history) (= tab :history)])]
|
||||||
(cond
|
(cond
|
||||||
(= tab :assets)
|
(= tab :assets)
|
||||||
|
|
|
@ -503,14 +503,10 @@
|
||||||
[{:keys [db]} chat-id {:keys [value contract] :as request-parameters}]
|
[{:keys [db]} chat-id {:keys [value contract] :as request-parameters}]
|
||||||
(let [identity (:current-chat-id db)
|
(let [identity (:current-chat-id db)
|
||||||
all-tokens (:wallet/all-tokens db)
|
all-tokens (:wallet/all-tokens db)
|
||||||
current-network-string (:networks/current-network db)
|
|
||||||
all-networks (:networks/networks db)
|
|
||||||
current-network (get all-networks current-network-string)
|
|
||||||
chain (ethereum/network->chain-keyword current-network)
|
|
||||||
{:keys [symbol decimals]}
|
{:keys [symbol decimals]}
|
||||||
(if (seq contract)
|
(if (seq contract)
|
||||||
(get all-tokens contract)
|
(get all-tokens contract)
|
||||||
(tokens/native-currency chain))
|
(tokens/native-currency (ethereum/get-current-network db)))
|
||||||
amount-text (str (money/internal->formatted value symbol decimals))]
|
amount-text (str (money/internal->formatted value symbol decimals))]
|
||||||
{:db (assoc db :wallet/prepare-transaction
|
{:db (assoc db :wallet/prepare-transaction
|
||||||
{:from (ethereum/get-default-account (:multiaccount/accounts db))
|
{:from (ethereum/get-default-account (:multiaccount/accounts db))
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
{:wallet/get-prices
|
{:wallet/get-prices
|
||||||
{:from (if mainnet?
|
{:from (if mainnet?
|
||||||
(conj tokens "ETH")
|
(conj tokens "ETH")
|
||||||
[(-> (tokens/native-currency chain)
|
[(-> (tokens/native-currency (ethereum/get-current-network db))
|
||||||
(wallet.utils/exchange-symbol))])
|
(wallet.utils/exchange-symbol))])
|
||||||
:to [(:code currency)]
|
:to [(:code currency)]
|
||||||
:mainnet? mainnet?
|
:mainnet? mainnet?
|
||||||
|
|
|
@ -1157,6 +1157,7 @@
|
||||||
"soon": "Soon",
|
"soon": "Soon",
|
||||||
"specify-address": "Specify address",
|
"specify-address": "Specify address",
|
||||||
"specify-name": "Specify a name",
|
"specify-name": "Specify a name",
|
||||||
|
"specify-symbol": "Specify a symbol",
|
||||||
"specify-network-id": "Specify network id",
|
"specify-network-id": "Specify network id",
|
||||||
"specify-rpc-url": "Specify a RPC URL",
|
"specify-rpc-url": "Specify a RPC URL",
|
||||||
"start-chat": "Start chat",
|
"start-chat": "Start chat",
|
||||||
|
|
Loading…
Reference in New Issue