Allow importing db from script

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2021-05-27 10:47:38 +02:00
parent 65d76ba9c8
commit 8926a7ad4e
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
1 changed files with 9 additions and 2 deletions

View File

@ -1,11 +1,15 @@
(ns status-im.data-store.settings (ns status-im.data-store.settings
(:require [status-im.ethereum.eip55 :as eip55])) (:require
[status-im.utils.config :as config]
[status-im.ethereum.eip55 :as eip55]))
(defn rpc->networks [networks] (defn rpc->networks [networks]
(reduce (fn [acc {:keys [id] :as network}] (reduce (fn [acc {:keys [id] :as network}]
(assoc acc id network)) (assoc acc id network))
{} {}
networks)) (if (seq networks)
networks
config/default-networks)))
(defn rpc->visible-tokens [visible-tokens] (defn rpc->visible-tokens [visible-tokens]
(reduce-kv (fn [acc chain visible-tokens] (reduce-kv (fn [acc chain visible-tokens]
@ -36,6 +40,9 @@
(update :dapps-address eip55/address->checksum) (update :dapps-address eip55/address->checksum)
(update :address eip55/address->checksum) (update :address eip55/address->checksum)
(update :networks/networks rpc->networks) (update :networks/networks rpc->networks)
(update :networks/current-network #(if (seq %)
%
config/default-network))
(update :wallet/visible-tokens rpc->visible-tokens) (update :wallet/visible-tokens rpc->visible-tokens)
(update :pinned-mailservers rpc->pinned-mailservers) (update :pinned-mailservers rpc->pinned-mailservers)
(update :stickers/packs-installed rpc->stickers-packs) (update :stickers/packs-installed rpc->stickers-packs)