From b1d5b7f6eadb65617faeb4b4bd72fb0b63b91959 Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 23 Mar 2023 09:39:06 -0600 Subject: [PATCH] store user added token contracts in wallet hive box for now --- lib/db/hive/db.dart | 1 + lib/services/mixins/wallet_cache.dart | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/db/hive/db.dart b/lib/db/hive/db.dart index 5c4f252e6..9f73a4962 100644 --- a/lib/db/hive/db.dart +++ b/lib/db/hive/db.dart @@ -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"; } diff --git a/lib/services/mixins/wallet_cache.dart b/lib/services/mixins/wallet_cache.dart index 7d859e74c..b5c4e2e75 100644 --- a/lib/services/mixins/wallet_cache.dart +++ b/lib/services/mixins/wallet_cache.dart @@ -112,4 +112,22 @@ mixin WalletCache { value: balance.toJsonIgnoreCoin(), ); } + + // Ethereum specific + List getWalletTokenContractAddresses() { + return DB.instance.get( + boxName: _walletId, + key: DBKeys.ethTokenContracts, + ) as List? ?? + []; + } + + Future updateWalletTokenContractAddresses( + List contractAddresses) async { + await DB.instance.put( + boxName: _walletId, + key: DBKeys.ethTokenContracts, + value: contractAddresses, + ); + } }