Create event

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Zach Zundel 2018-12-15 18:42:07 -07:00 committed by Julien Eluard
parent 941526a7fc
commit 4dca2e9caa
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
3 changed files with 18 additions and 0 deletions

View File

@ -209,6 +209,8 @@
(def ^:const web3-uninstall-filter "eth_uninstallFilter")
(def ^:const web3-get-filter-changes "eth_getFilterChanges")
(def ^:const status-create-address "status_createaddress")
(def ^:const event-transfer-hash
(ethereum/sha3 "Transfer(address,address,uint256)"))

View File

@ -535,6 +535,10 @@
:data? :string
:on-success :event
:on-failure? :event}}
'ethereum/create-address
{:permissions [:read]
:value :extensions/ethereum-create-address
:arguments {:on-result :event}}
'ethereum/send-transaction
{:permissions [:read]
:value :extensions/ethereum-send-transaction

View File

@ -344,6 +344,18 @@
:method constants/web3-personal-sign})}
(navigation/navigate-to-cofx :wallet-sign-message-modal nil)))))
(handlers/register-handler-fx
:extensions/ethereum-create-address
(fn [_ [_ _ {:keys [on-result]}]]
(let [args {:jsonrpc "2.0"
:method constants/status-create-address}
payload (types/clj->json args)]
(status/call-private-rpc payload #(let [{:keys [error result]} (types/json->clj %1)
response (if error {:result result :error error}
{:result result})]
(re-frame/dispatch (on-result response)))))))
;; poll logs implementation
(handlers/register-handler-fx
:extensions/ethereum-logs-changes
(fn [_ [_ _ {:keys [id] :as m}]]