mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 11:34:45 +00:00
[Fix #2810] Support markTrustedPeer in web3.js
Signed-off-by: Dmitry Novotochinov <trybeee@gmail.com>
This commit is contained in:
parent
fe697bfcc8
commit
e35edf1e90
@ -226,7 +226,8 @@
|
|||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::mark-trusted-peer
|
::mark-trusted-peer
|
||||||
(fn [{:keys [wnode web3]}]
|
(fn [{:keys [wnode web3]}]
|
||||||
(inbox/mark-trusted-peer wnode
|
(inbox/mark-trusted-peer web3
|
||||||
|
wnode
|
||||||
#(re-frame/dispatch [::mark-trusted-peer-success web3 %])
|
#(re-frame/dispatch [::mark-trusted-peer-success web3 %])
|
||||||
#(re-frame/dispatch [::mark-trusted-peer-error %]))))
|
#(re-frame/dispatch [::mark-trusted-peer-error %]))))
|
||||||
|
|
||||||
|
@ -44,19 +44,14 @@
|
|||||||
(swap! peers conj enode)
|
(swap! peers conj enode)
|
||||||
(success-fn result))))))
|
(success-fn result))))))
|
||||||
|
|
||||||
;; TODO(oskarth): Use web3 binding to do (.markTrustedPeer web3 enode cb)
|
(defn mark-trusted-peer [web3 enode success-fn error-fn]
|
||||||
(defn mark-trusted-peer [enode success-fn error-fn]
|
|
||||||
(if (@trusted-peers enode)
|
(if (@trusted-peers enode)
|
||||||
(success-fn true)
|
(success-fn true)
|
||||||
(let [args {:jsonrpc "2.0"
|
(.markTrustedPeer (utils/shh web3)
|
||||||
:id 1
|
enode
|
||||||
:method "shh_markTrustedPeer"
|
(response-handler error-fn (fn [result]
|
||||||
:params [enode]}
|
(swap! trusted-peers conj enode)
|
||||||
payload (.stringify js/JSON (clj->js args))]
|
(success-fn result))))))
|
||||||
(status/call-web3 payload
|
|
||||||
(response-handler error-fn (fn [result]
|
|
||||||
(swap! trusted-peers conj enode)
|
|
||||||
(success-fn result)))))))
|
|
||||||
|
|
||||||
(defn request-messages [web3 wnode topic sym-key-id success-fn error-fn]
|
(defn request-messages [web3 wnode topic sym-key-id success-fn error-fn]
|
||||||
(log/info "offline inbox: sym-key-id" sym-key-id)
|
(log/info "offline inbox: sym-key-id" sym-key-id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user