fix eth token balance not updating

This commit is contained in:
julian 2024-01-14 16:38:59 -06:00
parent 15a43899c4
commit 7bb8948d73
2 changed files with 12 additions and 7 deletions

View file

@ -75,9 +75,8 @@ class TokenWalletInfo implements IsarId {
);
} else {
await isar.writeTxn(() async {
await isar.tokenWalletInfo.deleteByWalletIdTokenAddress(
walletId,
tokenAddress,
await isar.tokenWalletInfo.delete(
thisEntry.id,
);
await isar.tokenWalletInfo.put(
TokenWalletInfo(
@ -85,7 +84,7 @@ class TokenWalletInfo implements IsarId {
tokenAddress: tokenAddress,
tokenFractionDigits: tokenFractionDigits,
cachedBalanceJsonString: balance.toJsonIgnoreCoin(),
),
)..id = thisEntry.id,
);
});
}

View file

@ -116,8 +116,14 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface {
FilterGroup.and(standardReceivingAddressFilters);
@override
Future<void> init({bool? isRestore}) {
// TODO: implement init
Future<void> init({bool? isRestore}) async {
final address = await getCurrentReceivingAddress();
if (address == null) {
await _generateAndSaveAddress(
await getMnemonic(),
await getMnemonicPassphrase(),
);
}
return super.init();
}
@ -205,7 +211,7 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface {
@override
Future<void> updateTransactions({bool isRescan = false}) async {
String thisAddress = (await getCurrentReceivingAddress())!.value;
final thisAddress = (await getCurrentReceivingAddress())!.value;
int firstBlock = 0;