Skip to content

check wallet activated when sending to stellar#782

Merged
AlaaElattar merged 3 commits into
developmentfrom
development_check_wallet_activated
Dec 4, 2024
Merged

check wallet activated when sending to stellar#782
AlaaElattar merged 3 commits into
developmentfrom
development_check_wallet_activated

Conversation

@AlaaElattar
Copy link
Copy Markdown
Contributor

Tested Scenarios:

  • Tried to send to wallet with no stellar but the error appeared.

Comment on lines +123 to +125
toAddressError = 'Wallet not activated on stellar';
return false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
toAddressError = 'Wallet not activated on stellar';
return false;
}
final wallet = widget.allWallets
.where((wallet) => wallet.stellarAddress == toAddress).toList().first;
if (wallet.stellarBalance == '-1') {
toAddressError = 'Wallet not activated on stellar';
return false;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the provided code if there's no matching wallet, flutter will throw an exception.
That's why i handled it that way to check first there's a matching wallet.

@AlaaElattar AlaaElattar marked this pull request as draft December 2, 2024 10:21
Comment on lines +118 to +125
final matchingWallets = widget.allWallets
.where((wallet) => wallet.stellarAddress == toAddress);
final Wallet? wallet =
matchingWallets.isNotEmpty ? matchingWallets.first : null;
if (wallet != null && wallet.stellarBalance == '-1') {
toAddressError = 'Wallet not activated on stellar';
return false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not enough, what if the user copies and pastes an address that does not match the current wallets?

we should get the balance of the wallet and make sure it's activated and has TFT trustline

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should be fixed

@AlaaElattar AlaaElattar marked this pull request as ready for review December 4, 2024 10:55
@AlaaElattar AlaaElattar merged commit 1ff0f36 into development Dec 4, 2024
@AlaaElattar AlaaElattar deleted the development_check_wallet_activated branch December 4, 2024 13:05
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.

3 participants