blink
blink copied to clipboard
fix: translate OnChainTxns retrieved from cache
Description
This is a first draft for the fix for issues: #1399, #1528, https://github.com/GaloyMoney/galoy-mobile/issues/548
The issue is that the full IncomingOnChainTransaction
type isn't persisted in redis, but our code assumes this full type comes back via get
. There needs to be a translation method somewhere to convert from redis persistence back to our domain type.
This is a first draft demonstrating the fix, but this fix may also be executed via a new repository that is specifically an IncomingOnChainTransactionsRepository
function.
TODO
- [ ] Add tests to capture issue and fix
- [ ] Potentially refactor to repository pattern
Details
Original object:
{
confirmations: 0,
rawTx: {
txHash: '688b2092df3c9f451b65d9b0b55515d8c8311559052542b50b4b953755539354',
outs: [Array]
},
fee: 0,
createdAt: 2022-08-12T05:11:59.000Z,
uniqueAddresses: [Function: uniqueAddresses]
}
Object from redis:
{
confirmations: 0,
rawTx: {
txHash: '688b2092df3c9f451b65d9b0b55515d8c8311559052542b50b4b953755539354',
outs: [Array]
},
fee: 0,
createdAt: '2022-08-12T05:11:59.000Z',
}