[#12760] Add Binance Smart chain as main network
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
345ae29ddb
commit
a573ae70e5
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -25,7 +25,8 @@
|
||||||
:rinkeby {:id 4 :name "Rinkeby"}
|
:rinkeby {:id 4 :name "Rinkeby"}
|
||||||
:xdai {:id 100 :name "xDai"}
|
:xdai {:id 100 :name "xDai"}
|
||||||
:poa {:id 99 :name "POA"}
|
:poa {:id 99 :name "POA"}
|
||||||
:goerli {:id 5 :name "Goerli"}})
|
:goerli {:id 5 :name "Goerli"}
|
||||||
|
:bsc {:id 56 :name "BSC"}})
|
||||||
|
|
||||||
(defn chain-id->chain-keyword [i]
|
(defn chain-id->chain-keyword [i]
|
||||||
(or (some #(when (= i (:id (val %))) (key %)) chains)
|
(or (some #(when (= i (:id (val %))) (key %)) chains)
|
||||||
|
@ -50,7 +51,8 @@
|
||||||
|
|
||||||
(defn sidechain? [id]
|
(defn sidechain? [id]
|
||||||
(contains? #{(chain-keyword->chain-id :xdai)
|
(contains? #{(chain-keyword->chain-id :xdai)
|
||||||
(chain-keyword->chain-id :poa)} id))
|
(chain-keyword->chain-id :poa)
|
||||||
|
(chain-keyword->chain-id :bsc)} id))
|
||||||
|
|
||||||
(defn network-with-upstream-rpc? [network]
|
(defn network-with-upstream-rpc? [network]
|
||||||
(get-in network [:config :UpstreamConfig :Enabled]))
|
(get-in network [:config :UpstreamConfig :Enabled]))
|
||||||
|
|
|
@ -34,19 +34,20 @@
|
||||||
tokens))
|
tokens))
|
||||||
|
|
||||||
(defn network->icon [network]
|
(defn network->icon [network]
|
||||||
(let [s (str "../resources/images/tokens/" (name network) "/0-native.png")
|
(let [s (str "./resources/images/tokens/" (name network) "/0-native.png")
|
||||||
|
s-js (str "." s)
|
||||||
image (gensym)]
|
image (gensym)]
|
||||||
(if (.exists (io/file s))
|
(if (.exists (io/file s))
|
||||||
`(let [~image (atom nil)]
|
`(let [~image (atom nil)]
|
||||||
(fn []
|
(fn []
|
||||||
(or @~image
|
(or @~image
|
||||||
(reset! ~image (js/require ~s)))))
|
(reset! ~image (js/require ~s-js)))))
|
||||||
`(let [~image (atom nil)]
|
`(let [~image (atom nil)]
|
||||||
(fn []
|
(fn []
|
||||||
(or
|
(or
|
||||||
@~image
|
@~image
|
||||||
(reset! ~image
|
(reset! ~image
|
||||||
(js/require "../resources/images/tokens/default-native.png"))))))))
|
(js/require "../resources/images/tokens/default-token.png"))))))))
|
||||||
|
|
||||||
(defmacro resolve-native-currency-icons
|
(defmacro resolve-native-currency-icons
|
||||||
"In react-native arguments to require must be static strings.
|
"In react-native arguments to require must be static strings.
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
(def default-native-currency
|
(def default-native-currency
|
||||||
(memoize
|
(memoize
|
||||||
(fn []
|
(fn []
|
||||||
{:name "Native"
|
{:name "Native"
|
||||||
:symbol :ETH
|
:symbol :ETH
|
||||||
:decimals 18
|
:decimals 18
|
||||||
:icon {:source (js/require "../resources/images/tokens/default-native.png")}})))
|
:icon {:source (js/require "../resources/images/tokens/default-token.png")}})))
|
||||||
|
|
||||||
(def snt-icon-source (js/require "../resources/images/tokens/mainnet/SNT.png"))
|
(def snt-icon-source (js/require "../resources/images/tokens/mainnet/SNT.png"))
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@
|
||||||
:symbol :ETH
|
:symbol :ETH
|
||||||
:symbol-display :xDAI
|
:symbol-display :xDAI
|
||||||
:symbol-exchange :DAI
|
:symbol-exchange :DAI
|
||||||
|
:decimals 18}
|
||||||
|
:bsc {:name "BSC"
|
||||||
|
:symbol :ETH
|
||||||
|
:symbol-display :BNB
|
||||||
:decimals 18}}))
|
:decimals 18}}))
|
||||||
|
|
||||||
(def native-currency-symbols
|
(def native-currency-symbols
|
||||||
|
|
|
@ -300,17 +300,20 @@
|
||||||
(let [{:networks/keys [current-network networks]
|
(let [{:networks/keys [current-network networks]
|
||||||
:as settings}
|
:as settings}
|
||||||
(data-store.settings/rpc->settings settings)
|
(data-store.settings/rpc->settings settings)
|
||||||
multiaccount (dissoc settings :networks/current-network :networks/networks)]
|
multiaccount (dissoc settings :networks/current-network :networks/networks)
|
||||||
|
;;for some reason we save default networks in db, in case when we want to modify default-networks for
|
||||||
|
;; existing accounts we have to merge them again into networks
|
||||||
|
merged-networks (merge networks config/default-networks-by-id)]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(dissoc :multiaccounts/login)
|
(dissoc :multiaccounts/login)
|
||||||
(assoc :networks/current-network current-network
|
(assoc :networks/current-network current-network
|
||||||
:networks/networks networks
|
:networks/networks merged-networks
|
||||||
:multiaccount multiaccount))}
|
:multiaccount multiaccount))}
|
||||||
(data-store.chats/fetch-chats-rpc
|
(data-store.chats/fetch-chats-rpc
|
||||||
{:on-success
|
{:on-success
|
||||||
#(do (re-frame/dispatch [:chats-list/load-success %])
|
#(do (re-frame/dispatch [:chats-list/load-success %])
|
||||||
(re-frame/dispatch [::get-chats-callback settings]))})
|
(re-frame/dispatch [::get-chats-callback]))})
|
||||||
(acquisition/login)
|
(acquisition/login)
|
||||||
(initialize-appearance)
|
(initialize-appearance)
|
||||||
(initialize-communities-enabled)
|
(initialize-communities-enabled)
|
||||||
|
@ -321,9 +324,9 @@
|
||||||
|
|
||||||
(fx/defn get-chats-callback
|
(fx/defn get-chats-callback
|
||||||
{:events [::get-chats-callback]}
|
{:events [::get-chats-callback]}
|
||||||
[{:keys [db] :as cofx} settings]
|
[{:keys [db] :as cofx}]
|
||||||
(let [{:keys [notifications-enabled?]
|
(let [{:networks/keys [current-network networks]} db
|
||||||
:networks/keys [current-network networks]} settings
|
notifications-enabled? (get-in db [:multiaccount :notifications-enabled?])
|
||||||
network-id (str (get-in networks [current-network :config :NetworkId]))]
|
network-id (str (get-in networks [current-network :config :NetworkId]))]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
(cond-> {::eip1559/check-eip1559-activation
|
(cond-> {::eip1559/check-eip1559-activation
|
||||||
|
|
|
@ -101,17 +101,21 @@
|
||||||
(views/letsubs [{:keys [tokens]} [:wallet/visible-assets-with-values address]
|
(views/letsubs [{:keys [tokens]} [:wallet/visible-assets-with-values address]
|
||||||
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?]]
|
||||||
(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)]
|
||||||
[tabs/tab-title state :nft (i18n/label :t/wallet-collectibles) (= tab :nft)]
|
(when mainnet?
|
||||||
[tabs/tab-title state :history (i18n/label :t/history) (= tab :history)]]
|
[tabs/tab-title state :nft (i18n/label :t/wallet-collectibles) (= tab :nft)])
|
||||||
|
(when mainnet?
|
||||||
|
[tabs/tab-title state :history (i18n/label :t/history) (= tab :history)])]
|
||||||
(cond
|
(cond
|
||||||
(= tab :assets)
|
(= tab :assets)
|
||||||
[:<>
|
[:<>
|
||||||
[buy-crypto/banner]
|
(when mainnet?
|
||||||
|
[buy-crypto/banner])
|
||||||
(for [item tokens]
|
(for [item tokens]
|
||||||
^{:key (:name item)}
|
^{:key (:name item)}
|
||||||
[accounts/render-asset item nil nil (:code currency)])]
|
[accounts/render-asset item nil nil (:code currency)])]
|
||||||
|
|
|
@ -216,7 +216,8 @@
|
||||||
:onRefresh refresh-action}]))
|
:onRefresh refresh-action}]))
|
||||||
|
|
||||||
(defn accounts-overview []
|
(defn accounts-overview []
|
||||||
(let [mnemonic @(re-frame/subscribe [:mnemonic])]
|
(let [mnemonic @(re-frame/subscribe [:mnemonic])
|
||||||
|
mainnet? @(re-frame/subscribe [:mainnet?])]
|
||||||
[react/view
|
[react/view
|
||||||
{:style {:flex 1}}
|
{:style {:flex 1}}
|
||||||
[quo/animated-header
|
[quo/animated-header
|
||||||
|
@ -235,7 +236,8 @@
|
||||||
:icon :main-icons/more
|
:icon :main-icons/more
|
||||||
:accessibility-label :accounts-more-options}]}
|
:accessibility-label :accounts-more-options}]}
|
||||||
[accounts]
|
[accounts]
|
||||||
[buy-crypto/banner]
|
(when mainnet?
|
||||||
|
[buy-crypto/banner])
|
||||||
[assets]
|
[assets]
|
||||||
[react/view {:height 68}]]
|
[react/view {:height 68}]]
|
||||||
[send-button]]))
|
[send-button]]))
|
||||||
|
|
|
@ -114,7 +114,13 @@
|
||||||
:config {:NetworkId (ethereum/chain-keyword->chain-id :poa)
|
:config {:NetworkId (ethereum/chain-keyword->chain-id :poa)
|
||||||
:DataDir "/ethereum/poa_rpc"
|
:DataDir "/ethereum/poa_rpc"
|
||||||
:UpstreamConfig {:Enabled true
|
:UpstreamConfig {:Enabled true
|
||||||
:URL "https://core.poa.network"}}}])
|
:URL "https://core.poa.network"}}}
|
||||||
|
{:id "bsc_rpc",
|
||||||
|
:name "BSC Network",
|
||||||
|
:config {:NetworkId (ethereum/chain-keyword->chain-id :bsc)
|
||||||
|
:DataDir "/ethereum/bsc_rpc"
|
||||||
|
:UpstreamConfig {:Enabled true
|
||||||
|
:URL "https://bsc-dataseed.binance.org"}}}])
|
||||||
|
|
||||||
(def testnet-networks
|
(def testnet-networks
|
||||||
[{:id "testnet_rpc",
|
[{:id "testnet_rpc",
|
||||||
|
|
Loading…
Reference in New Issue