fix reload crash with safe extension

This commit is contained in:
Mikhail Mikheev 2019-07-26 12:09:28 +04:00
parent 8d474c618a
commit 3bbe9f32fb
2 changed files with 6 additions and 6 deletions

View File

@ -2,9 +2,6 @@
import { type Transaction } from '~/routes/safe/store/models/transaction' import { type Transaction } from '~/routes/safe/store/models/transaction'
import { getWeb3 } from '~/logic/wallets/getWeb3' import { getWeb3 } from '~/logic/wallets/getWeb3'
const web3 = getWeb3()
const { toBN, fromWei } = web3.utils
type DecodedTxData = { type DecodedTxData = {
recipient: string, recipient: string,
value?: string, value?: string,
@ -16,6 +13,9 @@ type DecodedTxData = {
} }
export const getTxData = (tx: Transaction): DecodedTxData => { export const getTxData = (tx: Transaction): DecodedTxData => {
const web3 = getWeb3()
const { toBN, fromWei } = web3.utils
const txData = {} const txData = {}
if (tx.isTokenTransfer && tx.decodedParams) { if (tx.isTokenTransfer && tx.decodedParams) {

View File

@ -14,9 +14,6 @@ export const TX_TABLE_STATUS_ID = 'status'
export const TX_TABLE_RAW_TX_ID = 'tx' export const TX_TABLE_RAW_TX_ID = 'tx'
export const TX_TABLE_EXPAND_ICON = 'expand' export const TX_TABLE_EXPAND_ICON = 'expand'
const web3 = getWeb3()
const { toBN, fromWei } = web3.utils
type TxData = { type TxData = {
nonce: number, nonce: number,
type: string, type: string,
@ -29,6 +26,9 @@ type TxData = {
export const formatDate = (date: Date): string => format(date, 'MMM D, YYYY - HH:mm:ss') export const formatDate = (date: Date): string => format(date, 'MMM D, YYYY - HH:mm:ss')
export const getTxAmount = (tx: Transaction) => { export const getTxAmount = (tx: Transaction) => {
const web3 = getWeb3()
const { toBN, fromWei } = web3.utils
let txAmount = 'n/a' let txAmount = 'n/a'
if (tx.isTokenTransfer && tx.decodedParams) { if (tx.isTokenTransfer && tx.decodedParams) {