This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:message /confirmation-code , | |
:command {:command {:description Confirmation code, | |
:sequential-params true, | |
:color #7099e6, | |
:name confirmation-code, | |
:params [{:name code, :type number}], | |
:type :response, | |
:has-handler false, | |
:hidden? nil, | |
:owner-id console}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Subset of current db structure | |
{:chat-animations | |
{"console" | |
{:parameter-box | |
{:height 300 | |
:changes-counter 17}}} | |
:chat-loaded-callbacks | |
{"console" nil | |
"wallet" nil | |
"mailman" nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; While working on the status-react codebase, from time to time, some properties of persisted objects | |
;; can be added/removed, their semantics can change, or whole new kind of objects need to be persisted | |
;; (or deleted). | |
;; In such situation, realm database schema need to be changed and maybe, even migration/s need to be specified. | |
;; Lets suppose we need to add boolean property `:unremovable?` to all chat objects persisted in realm. | |
;; First, we need to add new schema to schemas defined in accounts: | |
(ns status.im.data-store.realm.schemas.account.core | |
(:require [status.im.data-store.realm.schemas.account.v1.core :as v1] | |
;; all the other versions between v1 and v(N) | |
;; require your v(N+1) schema file, in this case, v11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(when (get contacts from) | |
(some->> (:data payload) | |
(filter (comp discovery-exists? :message-id)) | |
(reduce (fn [fx discover] | |
...) | |
{}))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(handlers/register-handler-fx | |
:delete-chat | |
[re-frame/trim-v] | |
(fn [cofx [chat-id]] | |
(-> (chat.models/remove-chat cofx chat-id) | |
(update :db navigation/replace-view :home)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{:id "0f7c65277f916ff4379fe520b875082a56e587eb3ce1c1567d9ff94206bdb05ba167c52272f20f634cd1ebdec5d9dfeb393018bfde1595d8e64a717c8b46692f", :name "Geth/v1.7.3-stable/linux-amd64/go1.9.2", :caps ["eth/62" "eth/63" "les/1" "les/2" "shh/5"], :network {:localAddress "172.20.10.6:51863", :remoteAddress "51.15.54.150:30303"}, :protocols {:shh "unknown"}} {:id "12d52c3796700fb5acff2c7d96df7bbb6d7109b67f3442ee3d99ac1c197016cddb4c3568bbeba05d39145c59c990cd64f76bc9b00d4b13f10095c49507dd4cf9", :name "Geth/v1.7.3-stable/linux-amd64/go1.9.2", :caps ["eth/62" "eth/63" "les/1" "les/2" "shh/5"], :network {:localAddress "172.20.10.6:51860", :remoteAddress "51.15.63.110:30303"}, :protocols {:shh "unknown"}} {:id "482484b9198530ee2e00db89791823244ca41dcd372242e2e1297dd06f6d8dd357603960c5ad9cc8dc15fcdf0e4edd06b7ad7db590e67a0b54f798c26581ebd7", :name "Geth/v1.7.3-stable/linux-amd64/go1.9.2", :caps ["eth/62" "eth/63" "les/1" "les/2" "shh/5"], :network {:localAddress "172.20.10.6:51859", :remoteAddress "51.15.75.138:30303"}, :protoco |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; examples of public functions provided by us | |
(defn add-http-request [{:keys [url method payload]}] | |
(fn [_] | |
{:http {:method method | |
:url url | |
:payload payload}})) | |
(defn set-in [{:keys [path value]}] | |
(fn [_] | |
{:db (set-in db path value)})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; All our model functions adhere to simple interface, taking any number of arguments, | |
;; but always the `:cofx` map as an last argument and producing map of effects (or nothing) | |
;; as result: | |
(defn effects-fn [arg1 arg2 {:keys [db] :as cofx}] | |
{:db (update db :some-key arg1) | |
:http-call ...}) | |
;; We have both `merge-fx` macro and `merge-effect` functions at our disposal | |
;; Whenever we do static merging of effects, we use the former: | |
(defn final-effects-fn [cofx] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Rather then relying on macros, I propose to have `merge-fx` helper exposed as function | |
;; taking variable number of arguments (where the first one is always cofx, second one could | |
;; be initial effects map and then variable number of effects producing functions, with the | |
;; all of them with the same form as now: | |
(defn effects-fn [arg1 arg2 {:keys [db] :as cofx}] | |
{:db (update db :some-key arg1) | |
:http-call ...}) | |
(defn final-effects-fn [cofx] | |
(merge-fx cofx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{meta {:name "Collectibles" | |
:description "Demonstration of collectible command" | |
:documentation ""} | |
views/preview | |
(let [{{{symbol :symbol token :token tx-hash :tx-hash} :params} :content outgoing :outgoing timestamp-str :timestamp-str} @properties] | |
(let [collectible-token (query [:get-collectible-token symbol token])] | |
[view {:flex-direction :column | |
:align-items :flex-start} | |
[nft-token collectible-token] |