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

View file

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