-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#19410] wizard send collectibles #19515
Conversation
49ae5b5
to
1b71e41
Compare
Jenkins BuildsClick to see older builds (24)
|
(defn f-view-internal | ||
[{:keys [theme] :as _props}] | ||
(defn view-internal | ||
[_] | ||
(let [selected-tab (reagent/atom :overview) | ||
on-tab-change #(reset! selected-tab %)] | ||
(fn [] | ||
(fn [{:keys [theme] :as _props}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An additional fix, we were receiving the theme
in the wrong place, the component wouldn't re-render if it changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also use the hook directly, if you prefer 👍
(rf/reg-event-fx :wallet/send-collectibles-amount | ||
(fn [{:keys [db]} [{:keys [collectible stack-id amount]}]] | ||
{:db (-> db | ||
(update-in [:wallet :ui :send] dissoc :token) | ||
(assoc-in [:wallet :ui :send :collectible] collectible) | ||
(assoc-in [:wallet :ui :send :tx-type] :collectible) | ||
(assoc-in [:wallet :ui :send :amount] amount)) | ||
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]] | ||
[:navigate-to-within-stack [:screen/wallet.transaction-confirmation stack-id]]]})) | ||
(rf/reg-event-fx | ||
:wallet/set-collectible-to-send | ||
(fn [{db :db} [{:keys [collectible current-screen]}]] | ||
(let [one-collectible? (= (collectible.utils/collectible-balance collectible) 1) | ||
collectible-tx (-> db | ||
(update-in [:wallet :ui :send] dissoc :token) | ||
(assoc-in [:wallet :ui :send :collectible] collectible) | ||
(assoc-in [:wallet :ui :send :tx-type] :collectible))] | ||
{:db (cond-> collectible-tx | ||
one-collectible? (assoc-in [:wallet :ui :send :amount] 1)) | ||
:fx [(when one-collectible? | ||
[:dispatch [:wallet/get-suggested-routes {:amount 1}]]) | ||
[:dispatch | ||
[:wallet/wizard-navigate-forward | ||
{:current-screen current-screen | ||
:flow-id :wallet-flow}]]]}))) | ||
|
||
(rf/reg-event-fx :wallet/select-collectibles-amount | ||
(fn [{:keys [db]} [{:keys [collectible stack-id]}]] | ||
{:db (-> db | ||
(update-in [:wallet :ui :send] dissoc :token) | ||
(assoc-in [:wallet :ui :send :collectible] collectible) | ||
(assoc-in [:wallet :ui :send :tx-type] :collectible)) | ||
:fx [[:navigate-to-within-stack [:screen/wallet.select-collectible-amount stack-id]]]})) | ||
(rf/reg-event-fx | ||
:wallet/set-collectible-amount-to-send | ||
(fn [{db :db} [{:keys [stack-id amount]}]] | ||
{:db (assoc-in db [:wallet :ui :send :amount] amount) | ||
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]] | ||
[:dispatch | ||
[:wallet/wizard-navigate-forward | ||
{:current-screen stack-id | ||
:flow-id :wallet-flow}]]]})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redefined these events to handle the wizard flow, and changed their names.
send-collectibles-amount
-> set-collectible-to-send
select-collectibles-amount
-> set-collectible-amount-to-send
Given the functionality changed and the places where they are being used, the new names match better
(rf/reg-event-fx :wallet/send-select-amount | ||
(rf/reg-event-fx | ||
:wallet/set-token-amount-to-send |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the previous mentioned renaming, and given that this even is specific for tokens and not collectibles, I performed this rename
(defn- view-internal | ||
[] | ||
[:f> f-view-internal]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just removed this (now unnecessary) wrapper
(when (= transaction-type :collecible) :tx-type))}))) | ||
(when (= transaction-type :collectible) :tx-type))}))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix is not directly related, but noticed we had a typo here 👀
(rf/reg-event-fx | ||
:wallet/set-collectible-to-send | ||
(fn [{db :db} [{:keys [collectible current-screen]}]] | ||
(let [one-collectible? (= (collectible.utils/collectible-balance collectible) 1) | ||
collectible-tx (-> db | ||
(update-in [:wallet :ui :send] dissoc :token) | ||
(assoc-in [:wallet :ui :send :collectible] collectible) | ||
(assoc-in [:wallet :ui :send :tx-type] :collectible))] | ||
{:db (cond-> collectible-tx | ||
one-collectible? (assoc-in [:wallet :ui :send :amount] 1)) | ||
:fx [(when one-collectible? | ||
[:dispatch [:wallet/get-suggested-routes {:amount 1}]]) | ||
[:dispatch | ||
[:wallet/wizard-navigate-forward | ||
{:current-screen current-screen | ||
:flow-id :wallet-flow}]]]}))) | ||
|
||
(rf/reg-event-fx :wallet/select-collectibles-amount | ||
(fn [{:keys [db]} [{:keys [collectible stack-id]}]] | ||
{:db (-> db | ||
(update-in [:wallet :ui :send] dissoc :token) | ||
(assoc-in [:wallet :ui :send :collectible] collectible) | ||
(assoc-in [:wallet :ui :send :tx-type] :collectible)) | ||
:fx [[:navigate-to-within-stack [:screen/wallet.select-collectible-amount stack-id]]]})) | ||
(rf/reg-event-fx | ||
:wallet/set-collectible-amount-to-send |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can have tests for these events
@ulisesmac - I tested out this branch. |
Sure!, I'll add it :) |
1b71e41
to
be7c8c8
Compare
I already added it, it wasn't as straightforward as I thought but it's not too complex, I added two comments in the code to make this more clear. |
@OmarBasem @J-Son89 |
e313300
to
87ffb36
Compare
I tend to disagree, I think this will benefit from QA. Send is quite an important area and we're making quite a number of changes which can break it, no? |
I thought this was kind of just connecting existing features, but I agree, let's ask for QA then 👍 |
PR_ISSUE 5: The routes are not found when attempting to send a collectible using the 'send' button in the opened collectibleSteps:
Actual result:The routes are not found routes_collectible.mp4Expected result:The routes are found Logs: |
Hey @VolodLytvynenko Issue 1This is due to the relogin issue, so I'd say it's out of scope of this one Issue 2 and 3This PR is not focused on fixing UI things, so they need to be addressed but preferably in a separate one. Issue 4This issue is also related to the recovery and relogin one, so I think we should address it separately. Issue 5We don't know the exact reason for routes not being found, but it's out of scope of this PR. So, this PR is about connecting some flows, but they may still be buggy for various reasons, we'll address them separately. |
Hi @ulisesmac thank you for clarification. PR is ready to be merged |
@ulisesmac please let me know if any additional tests are needed after resolving the conflicts in this PR. I can quickly check everything |
3aa2593
to
3959259
Compare
3959259
to
531a240
Compare
531a240
to
4afe430
Compare
@VolodLytvynenko I solved the conflicts and merged the PR, I'll open issues for the points you pointed out and I'll be opening PRs to address them. Thank you! |
An update @VolodLytvynenko This is being addressed by @mmilad75 in: |
@VolodLytvynenko Another update on the issues, I've tested them on latest develop:
No longer reproducible.
No longer reproducible.
As said above @mmilad75 is solving it.
No longer reproducible.
No longer reproducible. Maybe it was happening because the collectible didn't support sending, you didn't have enough eth or it was a side issue and now it's solved. So there's nothing else pending from this PR, thank you for taking the time to test! |
Hi @ulisesmac thank you for the update. I confirm this. Issues you mentioned are fixed |
fixes #19410
fixes #16990
The bridge feature will be addressed in
Summary
This PR uses the wizard mechanism to unify the send token and send collectible flows, making able to skip some steps for the sending of collectibles.
Video containing the regular flow and the flow of first picking a collectible (skips select asset screen):
Screencast.from.2024-04-03.13-13-04.webm
Flow from home wallet screen (adds from step and skips sleect asset):
Screencast.from.2024-04-03.13-14-38.webm
Additionally, solves the following error when going back in the navigation:
Screencast.from.2024-04-03.13-02-27.webm
Testing notes
This PR focuses on the flow, there may be some other areas that still need to be polished/adjusted.
Platforms
Steps to test
status: ready