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

Validate to & from addresses not the same #751

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/providers/wallets_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class WalletsNotifier extends StateNotifier<List<Wallet>> {
if (!_loading) {
final chainUrl = Globals().chainUrl;
await _mutex.protect(() async {
final List<Wallet> currentState = state.where((w) => true).toList();
final List<Wallet> currentState = state.where((w) => true).toList();
for (final wallet in currentState) {
final balance =
await TFChainService.getBalance(chainUrl, wallet.tfchainAddress);
Expand Down
6 changes: 6 additions & 0 deletions app/lib/screens/wallets/send.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,18 @@ class _WalletSendScreenState extends State<WalletSendScreen> {

bool _validateToAddress() {
final toAddress = toController.text.trim();
final fromAddress = fromController.text.trim();
toAddressError = null;
if (toAddress.isEmpty) {
toAddressError = "Address can't be empty";
return false;
}

if (toAddress == fromAddress) {
toAddressError = '"To" and "From" addresses must be different';
return false;
}

if (chainType == ChainType.TFChain) {
if (toAddress.length != 48) {
toAddressError = 'Address length should be 48 characters';
Expand Down
Loading