Skip to content
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

feat(suite): added blockbook link to approval tx #16434

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

TomasBoda
Copy link
Contributor

Description

After approving a token to swap, while the blockchain is confirming the approval transaction, allow the user to copy the approval transaction ID as well as redirect to blockbook transaction detail page.

Related Issue

Resolve #14840

Screenshots:

On moving the mouse over the transaction ID, options to copy the transaction ID or go to the blockbook transaction detail page are displayed.

Screenshot 2025-01-17 at 10 48 17

Upon clicking the redirect button, the user is redirected to the blockbook transaction detail page.

Screenshot 2025-01-17 at 10 48 23

@TomasBoda TomasBoda self-assigned this Jan 17, 2025
@@ -139,9 +145,13 @@ export const CoinmarketOfferExchangeSendApproval = () => {
>
{dexTx.to}
</InfoItem>
{selectedQuote.approvalSendTxHash && (
{selectedQuote.approvalSendTxHash && blockchain && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅

Suggested change
{selectedQuote.approvalSendTxHash && blockchain && (
{selectedQuote.approvalSendTxHash && blockchain != null && (

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@adderpositive adderpositive Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think selectedQuote.approvalSendTxHash && blockchain && is more accurate. In this version, the property blockchain can be undefined because the symbol can be undefined. If the blockchain is undefined, the app will crash.

Additionally, instead of != please use strict type check equality !==.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the != null catches both null and undefined, but I have no problem changing it back to just blockchain

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok. Sorry then. But && blockchain is more readable IMHO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is also used in the majority of cases throughout the codebase, so I'll change it back to just blockchain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adderpositive We discussed using full conditionals instead of implicit boolean check because I think it is more readable and cleaner (we know right away that blockchain isn't just a boolean). I also prefer using != instead of !== because of the reasons that @TomasBoda wrote above. I found no code-style rules about these cases and if it is common in the codebase, I have no problem with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izmy Thank you for the explanation. In that case, it is fine by me as well. Anyway, both cases are correct, and if the full conditionals are required, I am ok with this!

My apologies for the confusion.

@@ -51,6 +52,8 @@ export const CoinmarketOfferExchangeSendApproval = () => {
selectedQuote?.status === 'CONFIRM' ? 'APPROVED' : 'MINIMAL',
);

const blockchainNetworks = useSelector(state => state.wallet.blockchain);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick:

const blockchain = useSelector(state => state.wallet.blockchain); or const { blockchain } = useSelector(state => state.wallet);.

and then use blockchainForSend or something like that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the codebase is used const blockchain = useSelector(state => state.wallet.blockchain);, that is the reason. 🤭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@adderpositive adderpositive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trading - check approval tx on explorer
3 participants