KomodoPlatform / komodo-wallet-mobile

KomodoWallet Mobile codebase
https://komodoplatform.com
MIT License
21 stars 33 forks source link

Persistence - Wallet Addresses Storage #41

Open naezith opened 1 year ago

naezith commented 1 year ago

The AccountAddressesApiHive class stores/retrieves a list of the user’s coin addresses. This will be used to populate the trading view (and possibly the home screen), where the user selects the trading pair.

Usage:

void main() async {
  AccountAddressesApiHive api = await AccountAddressesApiHive.initialize();
  // use API as needed
}

Currently Hive.registerAdapter(WalletAddressAdapter()); line is inside the initialize function. You might want to take it outside.

CharlVS commented 1 year ago

@naezith

Currently Hive.registerAdapter(WalletAddressAdapter()); line is inside the initialize function. You might want to take it outside.

If we need to do implementation-specific initialisation, we should limit it to our specific implementation. We want the concern of Hive to be separated from the rest of the app. This makes it cleaner in the future if we want to change to a different storage medium.

See the optional parameter in registerAdapter(...), which prevents an exception from being thrown if an adapter registration is repeated. Alternatively, create a boolean variable in the implementation which keeps track of if the API has been initialised. In this case, you'd check in the first line of the init() method and return if it was already initialised.

ca333 commented 8 months ago

status on this @naezith @CharlVS ? plz close if outdated / irrelevant.

naezith commented 8 months ago

status on this @naezith @CharlVS ? plz close if outdated / irrelevant.

We ended up not using this, can close I think.