[fix 6047] fix bridge functions cofx position

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2018-09-28 10:06:20 +02:00
parent 8638c562f9
commit 9fc2105cb8
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
1 changed files with 11 additions and 11 deletions

View File

@ -225,8 +225,8 @@
(update-browser browser)
(navigation/navigate-to-cofx :browser nil))))
(defn web3-send-async
[{:keys [method] :as payload} message-id {:keys [db]}]
(fx/defn web3-send-async
[{:keys [db]} {:keys [method] :as payload} message-id]
(if (or (= method constants/web3-send-transaction)
(= method constants/web3-personal-sign))
{:db (update-in db [:wallet :transactions-queue] conj {:message-id message-id :payload payload})
@ -244,17 +244,17 @@
{:browser/send-to-bridge {:message message
:webview (get-in cofx [:db :webview-bridge])}})
(defn web3-send-async-read-only
[dapp-name {:keys [method] :as payload} message-id {:keys [db] :as cofx}]
(fx/defn web3-send-async-read-only
[{:keys [db] :as cofx} dapp-name {:keys [method] :as payload} message-id]
(let [{:dapps/keys [permissions]} db]
(if (and (#{"eth_accounts" "eth_coinbase" "eth_sendTransaction" "eth_sign"
"eth_signTypedData" "personal_sign" "personal_ecRecover"} method)
(not (some #{"WEB3"} (get-in permissions [dapp-name :permissions]))))
(send-to-bridge {:type constants/web3-send-async-callback
(send-to-bridge cofx
{:type constants/web3-send-async-callback
:messageId message-id
:error "Denied"}
cofx)
(web3-send-async payload message-id cofx))))
:error "Denied"})
(web3-send-async cofx payload message-id))))
(fx/defn handle-scanned-qr-code
[cofx data message]
@ -275,13 +275,13 @@
(and (= type constants/history-state-changed)
platform/ios?
(not= "about:blank" url))
(update-browser-history browser url false cofx)
(update-browser-history cofx browser url false)
(= type constants/web3-send-async)
(web3-send-async payload messageId cofx)
(web3-send-async cofx payload messageId)
(= type constants/web3-send-async-read-only)
(web3-send-async-read-only dapp-name payload messageId cofx)
(web3-send-async-read-only cofx dapp-name payload messageId)
(= type constants/scan-qr-code)
(qr-scanner/scan-qr-code cofx