Skip to content
Merged
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
13 changes: 10 additions & 3 deletions packages/stellar_client/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,17 @@ class Client {
}
throw Exception('Balance with asset code ${currency} not found.');
});
// check that receiver account exists
final receiver = await _sdk.accounts.account(accountId);
List<BalanceInfo> receiverBalance = [];
try {
// check that receiver account exists
receiverBalance = await getBalanceByAccountID(
network: _network, accountId: destinationAddress);
} catch (e) {
throw Exception('Receiver account does not exist.');
}

// check that asset exists
var specificBalance = receiver.balances.firstWhere(
var specificBalance = receiverBalance.firstWhere(
(balance) => balance.assetCode == currency,
orElse: () {
throw Exception('Balance with asset code ${currency} not found.');
Expand Down