|
|
@ -17,14 +17,25 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const UNKNOWN_CHAIN_ID_KEY = 'UNKNOWN'; |
|
|
|
|
|
|
|
|
|
|
|
function transformState(state) { |
|
|
|
function transformState(state) { |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
state?.IncomingTransactionsController?.incomingTxLastFetchedBlocksByNetwork |
|
|
|
state?.IncomingTransactionsController?.incomingTxLastFetchedBlocksByNetwork |
|
|
|
) { |
|
|
|
) { |
|
|
|
state.IncomingTransactionsController.incomingTxLastFetchedBlockByChainId = mapKeys( |
|
|
|
state.IncomingTransactionsController.incomingTxLastFetchedBlockByChainId = mapKeys( |
|
|
|
state.IncomingTransactionsController.incomingTxLastFetchedBlocksByNetwork, |
|
|
|
state.IncomingTransactionsController.incomingTxLastFetchedBlocksByNetwork, |
|
|
|
(_, key) => NETWORK_TYPE_TO_ID_MAP[key].chainId, |
|
|
|
// using optional chaining in case user's state has fetched blocks for
|
|
|
|
|
|
|
|
// RPC network types (which don't map to a single chainId). This should
|
|
|
|
|
|
|
|
// not be possible, but it's safer
|
|
|
|
|
|
|
|
(_, key) => NETWORK_TYPE_TO_ID_MAP[key]?.chainId ?? UNKNOWN_CHAIN_ID_KEY, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
// Now that mainnet and test net last fetched blocks are keyed by their
|
|
|
|
|
|
|
|
// respective chainIds, we can safely delete anything we had for custom
|
|
|
|
|
|
|
|
// networks. Any custom network that shares a chainId with one of the
|
|
|
|
|
|
|
|
// aforementioned networks will use the value stored by chainId.
|
|
|
|
|
|
|
|
delete state.IncomingTransactionsController |
|
|
|
|
|
|
|
.incomingTxLastFetchedBlockByChainId[UNKNOWN_CHAIN_ID_KEY]; |
|
|
|
delete state.IncomingTransactionsController |
|
|
|
delete state.IncomingTransactionsController |
|
|
|
.incomingTxLastFetchedBlocksByNetwork; |
|
|
|
.incomingTxLastFetchedBlocksByNetwork; |
|
|
|
} |
|
|
|
} |
|
|
|