Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Conversation

clemente-xyz
Copy link
Contributor

@clemente-xyz clemente-xyz commented Nov 17, 2023

What was the problem?

This PR resolves #2135

How was it solved?

  • Fix application and token is correctly selected for deep link requesting tokens from a different application
  • Show insufficient fee error when users try to send token from account where they don't have any balance

How was it tested?

  • iOS simulator
  • iOS device
  • Android device

@clemente-xyz clemente-xyz changed the base branch from development to release/3.0.0 November 17, 2023 17:03
@Balanced02 Balanced02 marked this pull request as ready for review November 22, 2023 10:58
Comment on lines +53 to +76
if (!accountCanSendTokensData) {
modal.open(() => (
<TransactionError
actionButton={
<PrimaryButton
key="retry"
onClick={() => {
navigation.navigate('Request');
modal.close();
}}
title={`${i18next.t('Request')} ${tokenName.toUpperCase()}`}
style={[styles.tryAgainButton]}
/>
}
description={i18next.t('transactions.errors.insufficientFeeDescription', {
message: tokenName.toUpperCase(),
})}
title={i18next.t('transactions.errors.insufficientFee', {
message: tokenName.toUpperCase(),
})}
hideReport
hideIcon
/>
));
Copy link
Contributor

Choose a reason for hiding this comment

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

accountCanSendTokensData is missing the part of validating that the user has sufficient feeToken available.

Reason is because a user can have other fees apart from the native token(fee token) of that chain but because accountCanSendTokensData only checks that the user at least has a fee token the above conditional would not cover that case scenario.

To achieve this, useAccountCanSendTokens can also call the fees endpoint to get the feeTokenId of the chain then with the feeTokenId available, you can then check if the user has the token in their list of token balance meaning useAccountCanSendTokens can also return another value called hasFeeTokenBalance

Copy link
Contributor

Choose a reason for hiding this comment

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

We're making the call to the useFeesQuery, that's the token id we use to check if an account can send token.

Screenshot 2023-11-22 at 14 07 49

src/modules/SendToken/SendToken.js Outdated Show resolved Hide resolved
src/modules/SendToken/SendToken.js Outdated Show resolved Hide resolved
@Balanced02 Balanced02 removed their request for review November 22, 2023 15:53
Copy link
Contributor

@eniolam1000752 eniolam1000752 left a comment

Choose a reason for hiding this comment

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

LGTM

@Balanced02 Balanced02 self-requested a review November 22, 2023 16:15
@Balanced02 Balanced02 removed the request for review from ManuGowda November 22, 2023 16:16
@Balanced02 Balanced02 merged commit 6e9bae8 into release/3.0.0 Nov 22, 2023
3 checks passed
@Balanced02 Balanced02 deleted the 2135-send-token-screen-should-be-unaccessible-if-native-token-of-current-application-has-no-balance-on-account branch November 22, 2023 16:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send token screen should be unaccessible if native token of current application has no balance on account
5 participants