show symbol in txs table

This commit is contained in:
mmv 2019-06-20 18:54:30 +04:00
parent c64b4d3d6f
commit 4a81c69a1a
4 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,5 @@
// @flow
import { List } from 'immutable'
import { getWeb3 } from '~/logic/wallets/getWeb3'
import { type Token } from '~/logic/tokens/store/model/token'
import { sameAddress } from '~/logic/wallets/ethAddresses'
import { isAddressAToken } from '~/logic/tokens/utils/tokenHelpers'

View File

@ -32,7 +32,7 @@ export const getTxTableData = (transactions: List<Transaction>): List<BalanceRow
[TX_TABLE_NONCE_ID]: tx.nonce,
[TX_TABLE_TYPE_ID]: 'Outgoing transfer',
[TX_TABLE_DATE_ID]: formatDate(tx.isExecuted ? tx.executionDate : tx.submissionDate),
[TX_TABLE_AMOUNT_ID]: Number(tx.value) > 0 ? fromWei(toBN(tx.value), 'ether') : 'n/a',
[TX_TABLE_AMOUNT_ID]: Number(tx.value) > 0 ? `${fromWei(toBN(tx.value), 'ether')} ${tx.symbol}` : 'n/a',
[TX_TABLE_STATUS_ID]: tx.isExecuted ? 'success' : 'awaiting',
}))

View File

@ -11,7 +11,8 @@ import { buildTxServiceUrl, type TxServiceType } from '~/logic/safe/transactions
import { getOwners } from '~/logic/safe/utils'
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
import { addTransactions } from './addTransactions'
import { addressIsTokenContract } from '../../components/Balances/Tokens/screens/AddCustomToken/validators'
import { getHumanFriendlyToken } from '~/logic/tokens/store/actions/fetchTokens'
import { isAddressAToken } from '~/logic/tokens/utils/tokenHelpers'
type ConfirmationServiceModel = {
owner: string,
@ -46,10 +47,18 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
})
}),
)
const isToken = await addressIsTokenContract(tx.to)
console.log(isToken)
const isToken = await isAddressAToken(tx.to)
let symbol = 'ETH'
if (isToken) {
const tokenContract = await getHumanFriendlyToken()
const tokenInstance = await tokenContract.at(tx.to)
symbol = await tokenInstance.symbol()
}
return makeTransaction({
name,
symbol,
nonce: tx.nonce,
value: Number(tx.value),
confirmations,

View File

@ -13,6 +13,7 @@ export type TransactionProps = {
isExecuted: boolean,
submissionDate: Date,
executionDate: Date,
symbol: string,
}
export const makeTransaction: RecordFactory<TransactionProps> = Record({
@ -25,6 +26,7 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
isExecuted: false,
submissionDate: '',
executionDate: '',
symbol: '',
})
export type Transaction = RecordOf<TransactionProps>