show symbol in txs table
This commit is contained in:
parent
c64b4d3d6f
commit
4a81c69a1a
|
@ -1,6 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { List } from 'immutable'
|
import { List } from 'immutable'
|
||||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
|
||||||
import { type Token } from '~/logic/tokens/store/model/token'
|
import { type Token } from '~/logic/tokens/store/model/token'
|
||||||
import { sameAddress } from '~/logic/wallets/ethAddresses'
|
import { sameAddress } from '~/logic/wallets/ethAddresses'
|
||||||
import { isAddressAToken } from '~/logic/tokens/utils/tokenHelpers'
|
import { isAddressAToken } from '~/logic/tokens/utils/tokenHelpers'
|
||||||
|
|
|
@ -32,7 +32,7 @@ export const getTxTableData = (transactions: List<Transaction>): List<BalanceRow
|
||||||
[TX_TABLE_NONCE_ID]: tx.nonce,
|
[TX_TABLE_NONCE_ID]: tx.nonce,
|
||||||
[TX_TABLE_TYPE_ID]: 'Outgoing transfer',
|
[TX_TABLE_TYPE_ID]: 'Outgoing transfer',
|
||||||
[TX_TABLE_DATE_ID]: formatDate(tx.isExecuted ? tx.executionDate : tx.submissionDate),
|
[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',
|
[TX_TABLE_STATUS_ID]: tx.isExecuted ? 'success' : 'awaiting',
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ import { buildTxServiceUrl, type TxServiceType } from '~/logic/safe/transactions
|
||||||
import { getOwners } from '~/logic/safe/utils'
|
import { getOwners } from '~/logic/safe/utils'
|
||||||
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
||||||
import { addTransactions } from './addTransactions'
|
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 = {
|
type ConfirmationServiceModel = {
|
||||||
owner: string,
|
owner: string,
|
||||||
|
@ -46,10 +47,18 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const isToken = await addressIsTokenContract(tx.to)
|
const isToken = await isAddressAToken(tx.to)
|
||||||
console.log(isToken)
|
|
||||||
|
let symbol = 'ETH'
|
||||||
|
if (isToken) {
|
||||||
|
const tokenContract = await getHumanFriendlyToken()
|
||||||
|
const tokenInstance = await tokenContract.at(tx.to)
|
||||||
|
symbol = await tokenInstance.symbol()
|
||||||
|
}
|
||||||
|
|
||||||
return makeTransaction({
|
return makeTransaction({
|
||||||
name,
|
name,
|
||||||
|
symbol,
|
||||||
nonce: tx.nonce,
|
nonce: tx.nonce,
|
||||||
value: Number(tx.value),
|
value: Number(tx.value),
|
||||||
confirmations,
|
confirmations,
|
||||||
|
|
|
@ -13,6 +13,7 @@ export type TransactionProps = {
|
||||||
isExecuted: boolean,
|
isExecuted: boolean,
|
||||||
submissionDate: Date,
|
submissionDate: Date,
|
||||||
executionDate: Date,
|
executionDate: Date,
|
||||||
|
symbol: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
|
@ -25,6 +26,7 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
isExecuted: false,
|
isExecuted: false,
|
||||||
submissionDate: '',
|
submissionDate: '',
|
||||||
executionDate: '',
|
executionDate: '',
|
||||||
|
symbol: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
export type Transaction = RecordOf<TransactionProps>
|
export type Transaction = RecordOf<TransactionProps>
|
||||||
|
|
Loading…
Reference in New Issue