Commit 7add2a91 authored by Moody Salem's avatar Moody Salem

remove a couple more state constants

parent 5f36437c
...@@ -5,9 +5,6 @@ import TxnPopup from '../components/TxnPopup' ...@@ -5,9 +5,6 @@ import TxnPopup from '../components/TxnPopup'
import { useWeb3React } from '../hooks' import { useWeb3React } from '../hooks'
import { useBlockNumber, usePopups } from './Application' import { useBlockNumber, usePopups } from './Application'
const BLOCK_NUMBER_CHECKED = 'BLOCK_NUMBER_CHECKED'
const SUMMARY = 'summary'
const ADD = 'ADD' const ADD = 'ADD'
const CHECK = 'CHECK' const CHECK = 'CHECK'
const FINALIZE = 'FINALIZE' const FINALIZE = 'FINALIZE'
...@@ -15,6 +12,7 @@ const FINALIZE = 'FINALIZE' ...@@ -15,6 +12,7 @@ const FINALIZE = 'FINALIZE'
interface TransactionState { interface TransactionState {
[chainId: number]: { [chainId: number]: {
[txHash: string]: { [txHash: string]: {
blockNumberChecked: any
response: { response: {
customData?: any customData?: any
summary: any summary: any
...@@ -62,7 +60,7 @@ function reducer(state: TransactionState, { type, payload }): TransactionState { ...@@ -62,7 +60,7 @@ function reducer(state: TransactionState, { type, payload }): TransactionState {
...state[networkId], ...state[networkId],
[hash]: { [hash]: {
...state[networkId]?.[hash], ...state[networkId]?.[hash],
[BLOCK_NUMBER_CHECKED]: blockNumber blockNumberChecked: blockNumber
} }
} }
} }
...@@ -129,7 +127,7 @@ export function Updater() { ...@@ -129,7 +127,7 @@ export function Updater() {
let stale = false let stale = false
Object.keys(allTransactions) Object.keys(allTransactions)
.filter( .filter(
hash => !allTransactions[hash].receipt && allTransactions[hash][BLOCK_NUMBER_CHECKED] !== globalBlockNumber hash => !allTransactions[hash].receipt && allTransactions[hash].blockNumberChecked !== globalBlockNumber
) )
.forEach(hash => { .forEach(hash => {
library library
...@@ -191,7 +189,7 @@ export function useTransactionAdder() { ...@@ -191,7 +189,7 @@ export function useTransactionAdder() {
if (!hash) { if (!hash) {
throw Error('No transaction hash found.') throw Error('No transaction hash found.')
} }
add(chainId, hash, { ...response, customData: customData, [SUMMARY]: summary }) add(chainId, hash, { ...response, customData: customData, summary })
}, },
[chainId, add] [chainId, add]
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment