This commit is contained in:
julian 2024-11-26 13:48:33 -06:00
parent 3fb18bf2db
commit d6abd7d658

View file

@ -132,11 +132,14 @@ class SolanaWallet extends Bip39Wallet<Solana> {
// Rent exemption of Solana // Rent exemption of Solana
final accInfo = await _rpcClient?.getAccountInfo(address!.value); final accInfo = await _rpcClient?.getAccountInfo(address!.value);
if (accInfo!.value == null) {
throw Exception("Account does not appear to exist");
}
final int minimumRent = final int minimumRent =
await _rpcClient?.getMinimumBalanceForRentExemption( await _rpcClient!.getMinimumBalanceForRentExemption(
accInfo!.value!.data.toString().length, accInfo.value!.data.toString().length,
) ?? );
0; // TODO revisit null condition.
if (minimumRent > if (minimumRent >
((await _getCurrentBalanceInLamports()) - ((await _getCurrentBalanceInLamports()) -
txData.amount!.raw.toInt() - txData.amount!.raw.toInt() -
@ -300,13 +303,14 @@ class SolanaWallet extends Bip39Wallet<Solana> {
// Rent exemption of Solana // Rent exemption of Solana
final accInfo = await _rpcClient?.getAccountInfo(address!.value); final accInfo = await _rpcClient?.getAccountInfo(address!.value);
// TODO [prio=low]: handle null account info. if (accInfo!.value == null) {
throw Exception("Account does not appear to exist");
}
final int minimumRent = final int minimumRent =
await _rpcClient?.getMinimumBalanceForRentExemption( await _rpcClient!.getMinimumBalanceForRentExemption(
accInfo!.value!.data.toString().length, accInfo.value!.data.toString().length,
) ?? );
0;
// TODO [prio=low]: revisit null condition.
final spendableBalance = balance!.value - minimumRent; final spendableBalance = balance!.value - minimumRent;
final newBalance = Balance( final newBalance = Balance(