Currently, we have the following data stored in the wallet state
- balances
- hydratedUtxoDetails
- parsedTxHistory
- slpBalancesAndUtxos
- tokens
- utxos
To maintain a single source of truth, we should drop “utxos”, “hydratedUtxoDetails”,
“tokens”, and maybe even “balances” from the wallet state.
Those data is already in or can be derived from “slpBalancesAndUtxos”.
This would make to code clearer and easier to understand.
We should consider converting each property (nonSlpUtxos, slpUtxos, tokens)
of slpBalancesAndUtxos from Array to Object (with the key being tx_hash + tx_pos).
This would give us quick direct access to each tx if we need to.
While looping through them still cost the same in term of performance.
Checking to see if an utxo is new would simply involve accessing
slpBalancesAndUtxos.nonSlpUtxos[utxo.tx_hash + utxo.tx_pos] and
slpBalancesAndUtxos.slpUtxos[utxo.tx_hash + utxo.tx_pos]