From 27bfbea6bd7f7d6b720bfc6612e1b7c9a4f41737 Mon Sep 17 00:00:00 2001 From: Volodymyr Kozieiev Date: Thu, 5 Dec 2024 10:19:26 +0000 Subject: [PATCH] Fix sending collectible by building transaction before signing (#21744) * Fix sending collectible by building transaction before signing --- src/status_im/contexts/wallet/send/events.cljs | 7 +++++++ .../wallet/send/transaction_confirmation/view.cljs | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/status_im/contexts/wallet/send/events.cljs b/src/status_im/contexts/wallet/send/events.cljs index 94a9762123..0b6f1aa901 100644 --- a/src/status_im/contexts/wallet/send/events.cljs +++ b/src/status_im/contexts/wallet/send/events.cljs @@ -336,6 +336,13 @@ :start-flow? start-flow? :flow-id :wallet-send-flow}]]]}))) +(rf/reg-event-fx + :wallet/build-transaction-for-collectible-route + (fn [{:keys [db]}] + (let [last-request-uuid (get-in db [:wallet :ui :send :last-request-uuid])] + {:db (update-in db [:wallet :ui :send] dissoc :transaction-for-signing) + :fx [[:dispatch [:wallet/build-transactions-from-route {:request-uuid last-request-uuid}]]]}))) + (rf/reg-event-fx :wallet/set-token-amount-to-bridge (fn [{:keys [db]} [{:keys [amount stack-id start-flow?]}]] diff --git a/src/status_im/contexts/wallet/send/transaction_confirmation/view.cljs b/src/status_im/contexts/wallet/send/transaction_confirmation/view.cljs index b4af20266d..efd93650f3 100644 --- a/src/status_im/contexts/wallet/send/transaction_confirmation/view.cljs +++ b/src/status_im/contexts/wallet/send/transaction_confirmation/view.cljs @@ -249,6 +249,17 @@ user-props {:full-name to-address :address (utils/get-shortened-address to-address)}] + ;; In token send flow we already have transaction built when + ;; we reach confirmation screen. But in send collectible flow + ;; routes request happens at the same time with navigation to + ;; confirmation screen. So we need to build the transaction as soon + ;; as route is available. + (rn/use-effect + (fn [] + (when (and (send-utils/tx-type-collectible? transaction-type) + first-route) + (rf/dispatch [:wallet/build-transaction-for-collectible-route]))) + [first-route]) [rn/view {:style {:flex 1}} [floating-button-page/view {:footer-container-padding 0