Merge branch 'fix/txTable-outgoingTx' of github.com:gnosis/safe-react into dont-fetch-ownername-in-fetchTransactions
This commit is contained in:
commit
46b30c77f6
|
@ -46,7 +46,7 @@ export const getTxAmount = (tx: Transaction) => {
|
||||||
|
|
||||||
if (tx.isTokenTransfer && tx.decodedParams) {
|
if (tx.isTokenTransfer && tx.decodedParams) {
|
||||||
const tokenDecimals = tx.decimals.toNumber ? tx.decimals.toNumber() : tx.decimals
|
const tokenDecimals = tx.decimals.toNumber ? tx.decimals.toNumber() : tx.decimals
|
||||||
txAmount = `${new BigNumber(tx.decodedParams.value).div(10 ** tokenDecimals).toString()} ${tx.symbol}`
|
txAmount = `${new BigNumber(tx.decodedParams.value).div(10 ** tokenDecimals).toFixed()} ${tx.symbol}`
|
||||||
} else if (Number(tx.value) > 0) {
|
} else if (Number(tx.value) > 0) {
|
||||||
txAmount = `${fromWei(toBN(tx.value), 'ether')} ${tx.symbol}`
|
txAmount = `${fromWei(toBN(tx.value), 'ether')} ${tx.symbol}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,24 +119,26 @@ export const buildTransactionFrom = async (
|
||||||
let symbol = txTokenSymbol || 'ETH'
|
let symbol = txTokenSymbol || 'ETH'
|
||||||
let decimals = txTokenDecimals || 18
|
let decimals = txTokenDecimals || 18
|
||||||
let decodedParams
|
let decodedParams
|
||||||
if (isSendTokenTx && (txTokenSymbol === null || txTokenDecimals === null)) {
|
if (isSendTokenTx) {
|
||||||
try {
|
if (txTokenSymbol === null || txTokenDecimals === null) {
|
||||||
const [tokenSymbol, tokenDecimals] = await Promise.all(
|
try {
|
||||||
generateBatchRequests({
|
const [tokenSymbol, tokenDecimals] = await Promise.all(
|
||||||
abi: ALTERNATIVE_TOKEN_ABI,
|
generateBatchRequests({
|
||||||
address: tx.to,
|
abi: ALTERNATIVE_TOKEN_ABI,
|
||||||
methods: ['symbol', 'decimals'],
|
address: tx.to,
|
||||||
}),
|
methods: ['symbol', 'decimals'],
|
||||||
)
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
symbol = tokenSymbol
|
symbol = tokenSymbol
|
||||||
decimals = tokenDecimals
|
decimals = tokenDecimals
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// some contracts may implement the same methods as in ERC20 standard
|
// some contracts may implement the same methods as in ERC20 standard
|
||||||
// we may falsely treat them as tokens, so in case we get any errors when getting token info
|
// we may falsely treat them as tokens, so in case we get any errors when getting token info
|
||||||
// we fallback to displaying custom transaction
|
// we fallback to displaying custom transaction
|
||||||
isSendTokenTx = false
|
isSendTokenTx = false
|
||||||
customTx = true
|
customTx = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const params = web3.eth.abi.decodeParameters(['address', 'uint256'], tx.data.slice(10))
|
const params = web3.eth.abi.decodeParameters(['address', 'uint256'], tx.data.slice(10))
|
||||||
|
@ -325,7 +327,7 @@ export const loadSafeTransactions = async (safeAddress: string, getState: GetSta
|
||||||
const txsWithData = await batchRequestTxsData(transactions)
|
const txsWithData = await batchRequestTxsData(transactions)
|
||||||
// In case that the etags don't match, we parse the new transactions and save them to the cache
|
// In case that the etags don't match, we parse the new transactions and save them to the cache
|
||||||
const txsRecord: Array<RecordInstance<TransactionProps>> = await Promise.all(
|
const txsRecord: Array<RecordInstance<TransactionProps>> = await Promise.all(
|
||||||
txsWithData.map(([tx: TxServiceModel, decimals, symbol, name, code]) =>
|
txsWithData.map(([tx: TxServiceModel, decimals, code, symbol, name]) =>
|
||||||
buildTransactionFrom(safeAddress, tx, knownTokens, decimals, symbol, name, code),
|
buildTransactionFrom(safeAddress, tx, knownTokens, decimals, symbol, name, code),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue