fix: execute decodeParams for all sendTokenTxs
This commit is contained in:
parent
c887c71b05
commit
cdcdd07b23
|
@ -133,24 +133,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))
|
||||||
|
|
Loading…
Reference in New Issue