[#20909] fix: dapp wrong network refusal (#21123)

This commit is contained in:
Mohsen 2024-09-06 15:56:04 +03:00 committed by GitHub
parent 779eadd787
commit 3ae500ff68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View File

@ -50,7 +50,9 @@
(defn get-session-dapp-metadata
[proposal]
(get-in proposal [:params :proposer :metadata]))
(let [metadata (get-in proposal [:params :proposer :metadata])
origin (get-in proposal [:verifyContext :verified :origin])]
(or metadata {:url origin})))
(defn get-current-request-dapp
[request sessions]

View File

@ -109,8 +109,11 @@
(if (wallet-connect-core/event-should-be-handled? db event)
{:fx [[:dispatch [:wallet-connect/process-session-request event]]]}
{:fx [[:dispatch
[:wallet-connect/show-session-networks-unsupported-toast event]]
[:dispatch
[:wallet-connect/send-response
{:error (wallet-connect/get-sdk-error
{:request event
:error (wallet-connect/get-sdk-error
constants/wallet-connect-user-rejected-chains-error-key)}]]]})))
(rf/reg-event-fx

View File

@ -115,8 +115,9 @@
(rf/reg-event-fx
:wallet-connect/send-response
(fn [{:keys [db]} [{:keys [result error]}]]
(when-let [{:keys [id topic] :as event} (get-in db [:wallet-connect/current-request :event])]
(fn [{:keys [db]} [{:keys [request result error]}]]
(when-let [{:keys [id topic] :as event} (or request
(get-in db [:wallet-connect/current-request :event]))]
(let [method (wallet-connect-core/get-request-method event)
web3-wallet (get db :wallet-connect/web3-wallet)]
{:db (assoc-in db [:wallet-connect/current-request :response-sent?] true)