From b7b7806ed14707800db90f68b7fdffcc93647cf9 Mon Sep 17 00:00:00 2001 From: Eric Dvorsak Date: Fri, 26 Oct 2018 18:01:07 +0200 Subject: [PATCH] [refactor] remove allowed-keys macro The initial purpose of the allowed keys macro was to only accept maps with a defined set of keys so that the maps can be serialized into the db. The way maps are serialized has been changed so that only the existing keys in the db are cherry picked so passing maps with extra keys is no longer a problem --- src/status_im/accounts/db.cljs | 28 +- src/status_im/browser/db.cljs | 46 ++- src/status_im/contact/db.cljs | 5 +- .../ui/screens/bootnodes_settings/db.cljs | 9 +- src/status_im/ui/screens/db.cljs | 306 +++++++++--------- src/status_im/ui/screens/extensions/db.cljs | 11 +- src/status_im/ui/screens/group/db.cljs | 1 - .../ui/screens/network_settings/db.cljs | 1 - src/status_im/ui/screens/wallet/db.cljs | 27 +- .../ui/screens/wallet/request/db.cljs | 4 +- src/status_im/ui/screens/wallet/send/db.cljs | 12 +- src/status_im/utils/db.clj | 12 - 12 files changed, 215 insertions(+), 247 deletions(-) delete mode 100644 src/status_im/utils/db.clj diff --git a/src/status_im/accounts/db.cljs b/src/status_im/accounts/db.cljs index 13deffd7a6..169fe0cd40 100644 --- a/src/status_im/accounts/db.cljs +++ b/src/status_im/accounts/db.cljs @@ -6,8 +6,7 @@ [clojure.string :as string] [cljs.spec.alpha :as spec] [status-im.constants :as const] - [status-im.utils.security :as security]) - (:require-macros [status-im.utils.db :refer [allowed-keys]])) + [status-im.utils.security :as security])) (defn logged-in? [cofx] (boolean @@ -55,19 +54,18 @@ (spec/def :account/mainnet-warning-shown? (spec/nilable boolean?)) (spec/def :account/desktop-alpha-release-warning-shown? (spec/nilable boolean?)) -(spec/def :accounts/account (allowed-keys - :req-un [:account/name :account/address :account/public-key - :account/photo-path :account/signing-phrase - :account/installation-id] - :opt-un [:account/debug? :account/status :account/last-updated - :account/email :account/signed-up? :account/network - :account/networks :account/settings :account/mailserver - :account/last-sign-in :account/sharing-usage-data? :account/dev-mode? - :account/seed-backed-up? :account/mnemonic :account/desktop-notifications? - :account/wallet-set-up-passed? :account/last-request - :account/bootnodes :account/extensions - :account/mainnet-warning-shown? - :account/desktop-alpha-release-warning-shown?])) +(spec/def :accounts/account (spec/keys :req-un [:account/name :account/address :account/public-key + :account/photo-path :account/signing-phrase + :account/installation-id] + :opt-un [:account/debug? :account/status :account/last-updated + :account/email :account/signed-up? :account/network + :account/networks :account/settings :account/mailserver + :account/last-sign-in :account/sharing-usage-data? :account/dev-mode? + :account/seed-backed-up? :account/mnemonic :account/desktop-notifications? + :account/wallet-set-up-passed? :account/last-request + :account/bootnodes :account/extensions + :account/mainnet-warning-shown? + :account/desktop-alpha-release-warning-shown?])) (spec/def :accounts/accounts (spec/nilable (spec/map-of :account/address :accounts/account))) diff --git a/src/status_im/browser/db.cljs b/src/status_im/browser/db.cljs index 59d874f5b8..1d529cb10e 100644 --- a/src/status_im/browser/db.cljs +++ b/src/status_im/browser/db.cljs @@ -1,6 +1,5 @@ (ns status-im.browser.db - (:require [cljs.spec.alpha :as spec]) - (:require-macros [status-im.utils.db :refer [allowed-keys]])) + (:require [cljs.spec.alpha :as spec])) (spec/def :browser/browser-id (spec/nilable string?)) (spec/def :browser/timestamp (spec/nilable int?)) @@ -22,28 +21,26 @@ (spec/def :browser/options (spec/nilable - (allowed-keys - :opt-un [:browser/browser-id - :browser/url - :browser/loading? - :browser/resolving? - :browser/url-editing? - :browser/show-tooltip - :browser/show-permission - :browser/pending-permissions - :browser/yielding-control? - :browser/resolved-ens - :browser/error?]))) + (spec/keys :opt-un [:browser/browser-id + :browser/url + :browser/loading? + :browser/resolving? + :browser/url-editing? + :browser/show-tooltip + :browser/show-permission + :browser/pending-permissions + :browser/yielding-control? + :browser/resolved-ens + :browser/error?]))) (spec/def :browser/browser - (allowed-keys - :req-un [:browser/browser-id - :browser/timestamp] - :opt-un [:browser/name - :browser/dapp? - :browser/history - :browser/history-index - :browser/unsafe?])) + (spec/keys :req-un [:browser/browser-id + :browser/timestamp] + :opt-un [:browser/name + :browser/dapp? + :browser/history + :browser/history-index + :browser/unsafe?])) (spec/def :browser/browsers (spec/nilable (spec/map-of :global/not-empty-string :browser/browser))) @@ -51,8 +48,7 @@ (spec/def :dapp/permissions (spec/nilable vector?)) (spec/def :dapp/permission-map - (allowed-keys - :req-un [:dapp/dapp] - :opt-un [:dapp/permissions])) + (spec/keys :req-un [:dapp/dapp] + :opt-un [:dapp/permissions])) (spec/def :dapps/permissions (spec/nilable (spec/map-of :global/not-empty-string :dapp/permission-map))) diff --git a/src/status_im/contact/db.cljs b/src/status_im/contact/db.cljs index d5c09efdc8..4a38345173 100644 --- a/src/status_im/contact/db.cljs +++ b/src/status_im/contact/db.cljs @@ -1,5 +1,4 @@ (ns status-im.contact.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec] status-im.utils.db)) @@ -69,8 +68,8 @@ (spec/def :contacts/new-identity-error (spec/nilable string?)) ;;on showing this contact's profile (andrey: better to move into profile ns) (spec/def :contacts/identity (spec/nilable :global/not-empty-string)) -(spec/def :contacts/list-ui-props (spec/nilable (allowed-keys :opt-un [:contact-list-ui/edit?]))) -(spec/def :contacts/ui-props (spec/nilable (allowed-keys :opt-un [:contacts-ui/edit?]))) +(spec/def :contacts/list-ui-props (spec/nilable (spec/keys :opt-un [:contact-list-ui/edit?]))) +(spec/def :contacts/ui-props (spec/nilable (spec/keys :opt-un [:contacts-ui/edit?]))) ;;used in modal list (for example for wallet) (spec/def :contacts/click-handler (spec/nilable fn?)) ;;used in modal list (for example for wallet) diff --git a/src/status_im/ui/screens/bootnodes_settings/db.cljs b/src/status_im/ui/screens/bootnodes_settings/db.cljs index 42e723359d..d80687ffb4 100644 --- a/src/status_im/ui/screens/bootnodes_settings/db.cljs +++ b/src/status_im/ui/screens/bootnodes_settings/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.bootnodes-settings.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [clojure.string :as string] [cljs.spec.alpha :as spec])) @@ -10,9 +9,9 @@ (spec/def :bootnode/name ::not-blank-string) (spec/def :bootnode/id ::not-blank-string) (spec/def :bootnode/chain ::not-blank-string) -(spec/def :bootnode/bootnode (allowed-keys :req-un [:bootnode/chain - :bootnode/address - :bootnode/name - :bootnode/id])) +(spec/def :bootnode/bootnode (spec/keys :req-un [:bootnode/chain + :bootnode/address + :bootnode/name + :bootnode/id])) (spec/def :bootnodes/bootnodes (spec/nilable (spec/map-of :bootnode/id (spec/map-of :bootnode/id :bootnode/bootnode)))) diff --git a/src/status_im/ui/screens/db.cljs b/src/status_im/ui/screens/db.cljs index 3abcba46e7..087fc20747 100644 --- a/src/status_im/ui/screens/db.cljs +++ b/src/status_im/ui/screens/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec] [status-im.constants :as constants] [status-im.utils.platform :as platform] @@ -111,23 +110,23 @@ (spec/def :navigation/prev-tab-view-id (spec/nilable keyword?)) (spec/def :navigation/prev-view-id (spec/nilable keyword?)) ;; navigation screen params -(spec/def :navigation.screen-params/network-details (allowed-keys :req [:networks/selected-network])) +(spec/def :navigation.screen-params/network-details (spec/keys :req [:networks/selected-network])) (spec/def :navigation.screen-params/browser (spec/nilable map?)) (spec/def :navigation.screen-params.profile-qr-viewer/contact (spec/nilable map?)) (spec/def :navigation.screen-params.profile-qr-viewer/source (spec/nilable keyword?)) (spec/def :navigation.screen-params.profile-qr-viewer/value (spec/nilable string?)) -(spec/def :navigation.screen-params/profile-qr-viewer (allowed-keys :opt-un [:navigation.screen-params.profile-qr-viewer/contact - :navigation.screen-params.profile-qr-viewer/source - :navigation.screen-params.profile-qr-viewer/value])) +(spec/def :navigation.screen-params/profile-qr-viewer (spec/keys :opt-un [:navigation.screen-params.profile-qr-viewer/contact + :navigation.screen-params.profile-qr-viewer/source + :navigation.screen-params.profile-qr-viewer/value])) (spec/def :navigation.screen-params.qr-scanner/current-qr-context (spec/nilable any?)) -(spec/def :navigation.screen-params/qr-scanner (allowed-keys :opt-un [:navigation.screen-params.qr-scanner/current-qr-context])) +(spec/def :navigation.screen-params/qr-scanner (spec/keys :opt-un [:navigation.screen-params.qr-scanner/current-qr-context])) (spec/def :navigation.screen-params.group-contacts/show-search? (spec/nilable any?)) -(spec/def :navigation.screen-params/group-contacts (allowed-keys :opt [:group/contact-group-id] - :opt-un [:navigation.screen-params.group-contacts/show-search?])) +(spec/def :navigation.screen-params/group-contacts (spec/keys :opt [:group/contact-group-id] + :opt-un [:navigation.screen-params.group-contacts/show-search?])) (spec/def :navigation.screen-params.edit-contact-group/group (spec/nilable any?)) (spec/def :navigation.screen-params.edit-contact-group/group-type (spec/nilable any?)) -(spec/def :navigation.screen-params/edit-contact-group (allowed-keys :opt-un [:navigation.screen-params.edit-contact-group/group - :navigation.screen-params.edit-contact-group/group-type])) +(spec/def :navigation.screen-params/edit-contact-group (spec/keys :opt-un [:navigation.screen-params.edit-contact-group/group + :navigation.screen-params.edit-contact-group/group-type])) (spec/def :navigation.screen-params.dapp-description/dapp :new/open-dapp) (spec/def :navigation.screen-params/dapp-description map?) @@ -135,15 +134,15 @@ (spec/def :navigation.screen-params/show-extension map?) -(spec/def :navigation/screen-params (spec/nilable (allowed-keys :opt-un [:navigation.screen-params/network-details - :navigation.screen-params/browser - :navigation.screen-params/profile-qr-viewer - :navigation.screen-params/qr-scanner - :navigation.screen-params/group-contacts - :navigation.screen-params/edit-contact-group - :navigation.screen-params/dapp-description - :navigation.screen-params/collectibles-list - :navigation.screen-params/show-extension]))) +(spec/def :navigation/screen-params (spec/nilable (spec/keys :opt-un [:navigation.screen-params/network-details + :navigation.screen-params/browser + :navigation.screen-params/profile-qr-viewer + :navigation.screen-params/qr-scanner + :navigation.screen-params/group-contacts + :navigation.screen-params/edit-contact-group + :navigation.screen-params/dapp-description + :navigation.screen-params/collectibles-list + :navigation.screen-params/show-extension]))) (spec/def :desktop/desktop (spec/nilable any?)) (spec/def ::tooltips (spec/nilable any?)) @@ -184,139 +183,136 @@ (spec/def ::hardwallet map?) -(spec/def ::db (allowed-keys - :opt - [:contacts/contacts - :contacts/dapps - :contacts/new-identity - :contacts/new-identity-error - :contacts/identity - :contacts/ui-props - :contacts/list-ui-props - :contacts/click-handler - :contacts/click-action - :contacts/click-params - :pairing/installations - :commands/stored-command - :group/selected-contacts - :accounts/accounts - :accounts/create - :accounts/recover - :accounts/login - :account/account - :my-profile/profile - :my-profile/default-name - :my-profile/editing? - :my-profile/advanced? - :my-profile/seed - :group-chat-profile/profile - :group-chat-profile/editing? - :networks/selected-network - :networks/networks - :networks/manage - :bootnodes/manage - :extensions/manage - :node/status - :node/restart? - :node/address - :universal-links/url - :push-notifications/stored - :browser/browsers - :browser/options - :new/open-dapp - :navigation/screen-params - :chat/cooldowns - :chat/cooldown-enabled? - :chat/last-outgoing-message-sent-at - :chat/spam-messages-frequency - :transport/message-envelopes - :transport/chats - :transport/filters - :mailserver.edit/mailserver - :mailserver/mailservers - :mailserver/current-id - :mailserver/state - :mailserver/topics - :mailserver/pending-requests - :mailserver/current-request - :mailserver/connection-checks - :mailserver/request-to - :desktop/desktop - :dimensions/window - :dapps/permissions - :ui/contact - :ui/search - :ui/chat] - :opt-un - [::current-public-key - ::modal - ::was-modal? - ::rpc-url - ::tooltips - ::web3 - ::web3-node-version - ::webview-bridge - ::status-module-initialized? - ::keyboard-height - ::keyboard-max-height - ::tab-bar-visible? - ::network-status - ::peers-count - ::peers-summary - ::sync-state - ::sync-data - ::network - ::chain - ::app-state - ::semaphores - ::hardwallet - :navigation/view-id - :navigation/navigation-stack - :navigation/prev-tab-view-id - :navigation/prev-view-id - :qr/qr-codes - :qr/qr-modal - :qr/current-qr-context - :chat/chats - :chat/current-chat-id - :chat/chat-id - :chat/new-chat - :chat/new-chat-name - :chat/chat-animations - :chat/chat-ui-props - :chat/chat-list-ui-props - :chat/layout-height - :chat/message-data - :chat/message-status - :chat/selected-participants - :chat/public-group-topic - :chat/public-group-topic-error - :chat/messages - :chat/message-groups - :chat/message-statuses - :chat/not-loaded-message-ids - :chat/deduplication-ids - :chat/referenced-messages - :chat/last-clock-value - :chat/loaded-chats - :chat/bot-db - :chat/id->command - :chat/access-scope->command-id - :discoveries/discoveries - :discoveries/discover-search-tags - :discoveries/discover-current-dapp - :discoveries/tags - :discoveries/current-tag - :discoveries/request-discoveries-timer - :wallet/wallet - :wallet/wallet.transactions - :wallet/wallet-selected-asset - :prices/prices - :prices/prices-loading? - :notifications/notifications - ::device-UUID - ::collectible - ::collectibles - ::staged-extension - ::extensions-store - :registry/registry])) +(spec/def ::db (spec/keys :opt [:contacts/contacts + :contacts/dapps + :contacts/new-identity + :contacts/new-identity-error + :contacts/identity + :contacts/ui-props + :contacts/list-ui-props + :contacts/click-handler + :contacts/click-action + :contacts/click-params + :pairing/installations + :commands/stored-command + :group/selected-contacts + :accounts/accounts + :accounts/create + :accounts/recover + :accounts/login + :account/account + :my-profile/profile + :my-profile/default-name + :my-profile/editing? + :my-profile/advanced? + :my-profile/seed + :group-chat-profile/profile + :group-chat-profile/editing? + :networks/selected-network + :networks/networks + :networks/manage + :bootnodes/manage + :extensions/manage + :node/status + :node/restart? + :node/address + :universal-links/url + :push-notifications/stored + :browser/browsers + :browser/options + :new/open-dapp + :navigation/screen-params + :chat/cooldowns + :chat/cooldown-enabled? + :chat/last-outgoing-message-sent-at + :chat/spam-messages-frequency + :transport/message-envelopes + :transport/chats + :transport/filters + :mailserver.edit/mailserver + :mailserver/mailservers + :mailserver/current-id + :mailserver/state + :mailserver/topics + :mailserver/pending-requests + :mailserver/current-request + :mailserver/connection-checks + :mailserver/request-to + :desktop/desktop + :dimensions/window + :dapps/permissions + :ui/contact + :ui/search + :ui/chat] + :opt-un [::current-public-key + ::modal + ::was-modal? + ::rpc-url + ::tooltips + ::web3 + ::web3-node-version + ::webview-bridge + ::status-module-initialized? + ::keyboard-height + ::keyboard-max-height + ::tab-bar-visible? + ::network-status + ::peers-count + ::peers-summary + ::sync-state + ::sync-data + ::network + ::chain + ::app-state + ::semaphores + ::hardwallet + :navigation/view-id + :navigation/navigation-stack + :navigation/prev-tab-view-id + :navigation/prev-view-id + :qr/qr-codes + :qr/qr-modal + :qr/current-qr-context + :chat/chats + :chat/current-chat-id + :chat/chat-id + :chat/new-chat + :chat/new-chat-name + :chat/chat-animations + :chat/chat-ui-props + :chat/chat-list-ui-props + :chat/layout-height + :chat/message-data + :chat/message-status + :chat/selected-participants + :chat/public-group-topic + :chat/public-group-topic-error + :chat/messages + :chat/message-groups + :chat/message-statuses + :chat/not-loaded-message-ids + :chat/deduplication-ids + :chat/referenced-messages + :chat/last-clock-value + :chat/loaded-chats + :chat/bot-db + :chat/id->command + :chat/access-scope->command-id + :discoveries/discoveries + :discoveries/discover-search-tags + :discoveries/discover-current-dapp + :discoveries/tags + :discoveries/current-tag + :discoveries/request-discoveries-timer + :wallet/wallet + :wallet/wallet.transactions + :wallet/wallet-selected-asset + :prices/prices + :prices/prices-loading? + :notifications/notifications + ::device-UUID + ::collectible + ::collectibles + ::staged-extension + ::extensions-store + :registry/registry])) diff --git a/src/status_im/ui/screens/extensions/db.cljs b/src/status_im/ui/screens/extensions/db.cljs index c2004a36ba..1e8bceacdc 100644 --- a/src/status_im/ui/screens/extensions/db.cljs +++ b/src/status_im/ui/screens/extensions/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.extensions.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [clojure.string :as string] [cljs.spec.alpha :as spec])) @@ -11,10 +10,10 @@ (spec/def :extension/url ::not-blank-string) (spec/def :extension/active? boolean?) (spec/def :extension/data (spec/nilable string?)) -(spec/def :extension/extension (allowed-keys :req-un [:extension/id - :extension/name - :extension/url - :extension/active?] - :opt-un [:extension/data])) +(spec/def :extension/extension (spec/keys :req-un [:extension/id + :extension/name + :extension/url + :extension/active?] + :opt-un [:extension/data])) (spec/def :extensions/extensions (spec/nilable (spec/map-of :extension/id :extension/extension))) diff --git a/src/status_im/ui/screens/group/db.cljs b/src/status_im/ui/screens/group/db.cljs index bdf748e31a..2b242a5117 100644 --- a/src/status_im/ui/screens/group/db.cljs +++ b/src/status_im/ui/screens/group/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.group.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec])) (spec/def :group/selected-contacts (spec/nilable (spec/* string?))) diff --git a/src/status_im/ui/screens/network_settings/db.cljs b/src/status_im/ui/screens/network_settings/db.cljs index d29c6316df..bec805463c 100644 --- a/src/status_im/ui/screens/network_settings/db.cljs +++ b/src/status_im/ui/screens/network_settings/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.network-settings.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec])) (spec/def :networks/id string?) diff --git a/src/status_im/ui/screens/wallet/db.cljs b/src/status_im/ui/screens/wallet/db.cljs index dab2326506..9d8ecb0659 100644 --- a/src/status_im/ui/screens/wallet/db.cljs +++ b/src/status_im/ui/screens/wallet/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.wallet.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec] [status-im.i18n :as i18n] status-im.ui.screens.wallet.request.db @@ -8,7 +7,7 @@ (spec/def :wallet.send/recipient string?) -(spec/def :wallet/send (allowed-keys :req-un [:wallet.send/recipient])) +(spec/def :wallet/send (spec/keys :req-un [:wallet.send/recipient])) (spec/def :wallet/balance-loading? (spec/nilable boolean?)) (spec/def :wallet/transactions-loading? (spec/nilable boolean?)) @@ -26,18 +25,18 @@ (spec/def :wallet/currency (spec/nilable any?)) (spec/def :wallet/balance (spec/nilable any?)) -(spec/def :wallet/wallet (allowed-keys :opt-un [:wallet/send-transaction :wallet/request-transaction - :wallet/transactions-queue - :wallet/balance-loading? :wallet/errors :wallet/transactions-loading? - :wallet/transactions-last-updated-at :wallet/chat-transactions - :wallet/transactions-sync-started? :wallet/transactions - :wallet/edit - :wallet/current-tab - :wallet/current-transaction - :wallet/modal-history? - :wallet/visible-tokens - :wallet/currency - :wallet/balance])) +(spec/def :wallet/wallet (spec/keys :opt-un [:wallet/send-transaction :wallet/request-transaction + :wallet/transactions-queue + :wallet/balance-loading? :wallet/errors :wallet/transactions-loading? + :wallet/transactions-last-updated-at :wallet/chat-transactions + :wallet/transactions-sync-started? :wallet/transactions + :wallet/edit + :wallet/current-tab + :wallet/current-transaction + :wallet/modal-history? + :wallet/visible-tokens + :wallet/currency + :wallet/balance])) (defn- too-precise-amount? "Checks if number has any extra digit beyond the allowed number of decimals. diff --git a/src/status_im/ui/screens/wallet/request/db.cljs b/src/status_im/ui/screens/wallet/request/db.cljs index 0608c7b245..5b4a53eb43 100644 --- a/src/status_im/ui/screens/wallet/request/db.cljs +++ b/src/status_im/ui/screens/wallet/request/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.wallet.request.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec] [status-im.utils.money :as money])) @@ -8,5 +7,4 @@ (spec/def ::amount-text (spec/nilable string?)) (spec/def ::symbol (spec/nilable keyword?)) -(spec/def :wallet/request-transaction (allowed-keys - :opt-un [::amount ::amount-error ::amount-text ::symbol])) +(spec/def :wallet/request-transaction (spec/keys :opt-un [::amount ::amount-error ::amount-text ::symbol])) diff --git a/src/status_im/ui/screens/wallet/send/db.cljs b/src/status_im/ui/screens/wallet/send/db.cljs index f276291414..bb0d8edd63 100644 --- a/src/status_im/ui/screens/wallet/send/db.cljs +++ b/src/status_im/ui/screens/wallet/send/db.cljs @@ -1,5 +1,4 @@ (ns status-im.ui.screens.wallet.send.db - (:require-macros [status-im.utils.db :refer [allowed-keys]]) (:require [cljs.spec.alpha :as spec] [status-im.utils.money :as money] [status-im.utils.security :as security])) @@ -35,9 +34,8 @@ (spec/def ::on-result (spec/nilable any?)) (spec/def ::on-error (spec/nilable any?)) -(spec/def :wallet/send-transaction (allowed-keys - :opt-un [::amount ::to ::to-name ::amount-error ::asset-error ::amount-text - ::password ::show-password-input? ::id ::from ::data ::nonce - ::camera-flashlight ::in-progress? ::on-result ::on-error - ::wrong-password? ::from-chat? ::symbol ::advanced? - ::gas ::gas-price ::whisper-identity ::method ::tx-hash])) +(spec/def :wallet/send-transaction (spec/keys :opt-un [::amount ::to ::to-name ::amount-error ::asset-error ::amount-text + ::password ::show-password-input? ::id ::from ::data ::nonce + ::camera-flashlight ::in-progress? ::on-result ::on-error + ::wrong-password? ::from-chat? ::symbol ::advanced? + ::gas ::gas-price ::whisper-identity ::method ::tx-hash])) diff --git a/src/status_im/utils/db.clj b/src/status_im/utils/db.clj deleted file mode 100644 index 7ef66ccb12..0000000000 --- a/src/status_im/utils/db.clj +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.utils.db - (:require [cljs.spec.alpha :as s])) - -(defmacro allowed-keys - [& {:keys [req req-un opt opt-un] :as args}] - `(s/merge (s/keys ~@(apply concat (vec args))) - - (s/map-of ~(set (concat req - (map (comp keyword name) req-un) - opt - (map (comp keyword name) opt-un))) - any?))) \ No newline at end of file