Created
October 3, 2016 16:23
-
-
Save madvas/fd1a5758fe4bcf68d6ff543eed61cec5 to your computer and use it in GitHub Desktop.
:initialize
This file contains 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
(reg-event-fx | |
:initialize | |
(fn [_ _] | |
(merge | |
{:db db/default-db | |
:dispatch [:contract/fetch-compiled-code [:contract/compiled-code-loaded]]} | |
(when (:provides-web3? db/default-db) | |
{:web3-fx.blockchain/fns | |
{:web3 (:web3 db/default-db) | |
:fns [[web3-eth/accounts :blockchain/my-addresses-loaded :log-error]]}})))) | |
(reg-event-fx | |
:blockchain/my-addresses-loaded | |
interceptors | |
(fn [{:keys [db]} [addresses]] | |
{:db (-> db | |
(assoc :my-addresses addresses) | |
(assoc-in [:new-tweet :address] (first addresses))) | |
:web3-fx.blockchain/balances | |
{:web3 (:web3 db/default-db) | |
:addresses addresses | |
:watch? true | |
:blockchain-filter-opts "latest" | |
:dispatches [:blockchain/balance-loaded :log-error]}})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment