[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
This commit is contained in:
parent
4804d11b0f
commit
b7b7806ed1
|
@ -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)))
|
||||
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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?)))
|
||||
|
|
|
@ -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?)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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?)))
|
Loading…
Reference in New Issue