diff --git a/src/logic/tokens/utils/tokenHelpers.js b/src/logic/tokens/utils/tokenHelpers.js index d99e5e7f..02883fb9 100644 --- a/src/logic/tokens/utils/tokenHelpers.js +++ b/src/logic/tokens/utils/tokenHelpers.js @@ -6,6 +6,9 @@ import { type Token, makeToken } from '~/logic/tokens/store/model/token' import { getWeb3 } from '~/logic/wallets/getWeb3' export const ETH_ADDRESS = '0x000' +export const SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH = '0x42842e0e' +export const DECIMALS_METHOD_HASH = '313ce567' + export const isEther = (symbol: string) => symbol === 'ETH' export const getEthAsToken = (balance: string) => { diff --git a/src/routes/safe/components/Balances/SendModal/screens/ReviewCollectible/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/ReviewCollectible/index.jsx index 2d3678bb..8dfbb89a 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewCollectible/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewCollectible/index.jsx @@ -32,6 +32,7 @@ import { } from '~/logic/tokens/store/actions/fetchTokens' import { type Token } from '~/logic/tokens/store/model/token' import { formatAmount } from '~/logic/tokens/utils/formatAmount' +import { SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH } from '~/logic/tokens/utils/tokenHelpers' import { getWeb3 } from '~/logic/wallets/getWeb3' import SafeInfo from '~/routes/safe/components/Balances/SendModal/SafeInfo' import { setImageToPlaceholder } from '~/routes/safe/components/Balances/utils' @@ -42,8 +43,6 @@ import { textShortener } from '~/utils/strings' const useStyles = makeStyles(styles) -const SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH = '0x42842e0e' - type Props = { onClose: () => void, onPrev: () => void, diff --git a/src/routes/safe/store/actions/fetchTransactions.js b/src/routes/safe/store/actions/fetchTransactions.js index 60df30ac..1772f2a0 100644 --- a/src/routes/safe/store/actions/fetchTransactions.js +++ b/src/routes/safe/store/actions/fetchTransactions.js @@ -13,7 +13,13 @@ import { type TxServiceType, buildTxServiceUrl } from '~/logic/safe/transactions import { getLocalSafe } from '~/logic/safe/utils' import { getHumanFriendlyToken } from '~/logic/tokens/store/actions/fetchTokens' import { ALTERNATIVE_TOKEN_ABI } from '~/logic/tokens/utils/alternativeAbi' -import { isMultisendTransaction, isTokenTransfer, isUpgradeTransaction } from '~/logic/tokens/utils/tokenHelpers' +import { + DECIMALS_METHOD_HASH, + SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH, + isMultisendTransaction, + isTokenTransfer, + isUpgradeTransaction, +} from '~/logic/tokens/utils/tokenHelpers' import { ZERO_ADDRESS, sameAddress } from '~/logic/wallets/ethAddresses' import { EMPTY_DATA } from '~/logic/wallets/ethTransactions' import { getWeb3 } from '~/logic/wallets/getWeb3' @@ -93,7 +99,8 @@ export const buildTransactionFrom = async (safeAddress: string, tx: TxServiceMod const cancellationTx = sameAddress(tx.to, safeAddress) && Number(tx.value) === 0 && !tx.data const code = tx.to ? await web3.eth.getCode(tx.to) : '' const isERC721Token = - code.includes('42842e0e') || (isTokenTransfer(tx.data, Number(tx.value)) && code.includes('06fdde03')) + code.includes(SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH) || + (isTokenTransfer(tx.data, Number(tx.value)) && !code.includes(DECIMALS_METHOD_HASH)) const isSendTokenTx = !isERC721Token && isTokenTransfer(tx.data, Number(tx.value)) const isMultiSendTx = isMultisendTransaction(tx.data, Number(tx.value)) const isUpgradeTx = isMultiSendTx && isUpgradeTransaction(tx.data)