diff --git a/src/status_im/protocol/handlers.cljs b/src/status_im/protocol/handlers.cljs index 9cddffae68..f9bb450b86 100644 --- a/src/status_im/protocol/handlers.cljs +++ b/src/status_im/protocol/handlers.cljs @@ -226,7 +226,8 @@ (re-frame/reg-fx ::mark-trusted-peer (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-error %])))) diff --git a/src/status_im/protocol/web3/inbox.cljs b/src/status_im/protocol/web3/inbox.cljs index 01c9c00c5e..f430d68437 100644 --- a/src/status_im/protocol/web3/inbox.cljs +++ b/src/status_im/protocol/web3/inbox.cljs @@ -44,19 +44,14 @@ (swap! peers conj enode) (success-fn result)))))) -;; TODO(oskarth): Use web3 binding to do (.markTrustedPeer web3 enode cb) -(defn mark-trusted-peer [enode success-fn error-fn] +(defn mark-trusted-peer [web3 enode success-fn error-fn] (if (@trusted-peers enode) (success-fn true) - (let [args {:jsonrpc "2.0" - :id 1 - :method "shh_markTrustedPeer" - :params [enode]} - payload (.stringify js/JSON (clj->js args))] - (status/call-web3 payload - (response-handler error-fn (fn [result] - (swap! trusted-peers conj enode) - (success-fn result))))))) + (.markTrustedPeer (utils/shh web3) + enode + (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] (log/info "offline inbox: sym-key-id" sym-key-id)