store user added token contracts in wallet hive box for now

This commit is contained in:
julian 2023-03-23 09:39:06 -06:00
parent e99ef7497c
commit b1d5b7f6ea
2 changed files with 19 additions and 0 deletions

View file

@ -253,4 +253,5 @@ abstract class DBKeys {
static const String isFavorite = "isFavorite";
static const String id = "id";
static const String storedChainHeight = "storedChainHeight";
static const String ethTokenContracts = "ethTokenContracts";
}

View file

@ -112,4 +112,22 @@ mixin WalletCache {
value: balance.toJsonIgnoreCoin(),
);
}
// Ethereum specific
List<String> getWalletTokenContractAddresses() {
return DB.instance.get<dynamic>(
boxName: _walletId,
key: DBKeys.ethTokenContracts,
) as List<String>? ??
[];
}
Future<void> updateWalletTokenContractAddresses(
List<String> contractAddresses) async {
await DB.instance.put<dynamic>(
boxName: _walletId,
key: DBKeys.ethTokenContracts,
value: contractAddresses,
);
}
}