Open obiyankenobi opened 4 years ago
I completely agree with the suggested refactor, but I couldn't find if (key === 'wallet:data')
. As far as I remember, it was used for debugging an issue, but it has never been merged.
Desktop wallet: https://github.com/HathorNetwork/hathor-wallet/blob/master/src/storage.js#L62
Mobile wallet (about to merge): https://github.com/HathorNetwork/hathor-wallet-mobile/pull/53/files#diff-3bf35cd41da51153dcca3003656f7c67R32
The lib needs to save some that on the storage, but some of it just needs to be in memory. Right now, we save
wallet:data
in memory, using a specificif
in the storesetItem
implementations (on desktop and mobile) to check that:Wallet implementations shouldn't need to know these details. We should change the store interface to have two save methods:
setItemPersistent
andsetItemTemporary
. The lib will know which one it should call.