(args)
| 858 | * currentCurrency, exchangeRate, contractExchangeRates, collectibleContracts, tokens |
| 859 | */ |
| 860 | export default async function decodeTransaction(args) { |
| 861 | const { tx, selectedAddress, ticker, chainId, swapsTransactions = {} } = args; |
| 862 | const { isTransfer } = tx || {}; |
| 863 | |
| 864 | const actionKey = await getActionKey(tx, selectedAddress, ticker, chainId); |
| 865 | let transactionElement, transactionDetails; |
| 866 | |
| 867 | if ( |
| 868 | tx.txParams.to?.toLowerCase() === getSwapsContractAddress(chainId) || |
| 869 | swapsTransactions[tx.id] |
| 870 | ) { |
| 871 | const [transactionElement, transactionDetails] = decodeSwapsTx({ |
| 872 | ...args, |
| 873 | actionKey, |
| 874 | }); |
| 875 | if (transactionElement && transactionDetails) |
| 876 | return [transactionElement, transactionDetails]; |
| 877 | } |
| 878 | if (isTransfer) { |
| 879 | [transactionElement, transactionDetails] = decodeIncomingTransfer({ |
| 880 | ...args, |
| 881 | actionKey, |
| 882 | }); |
| 883 | } else { |
| 884 | switch (actionKey) { |
| 885 | case strings('transactions.sent_tokens'): |
| 886 | [transactionElement, transactionDetails] = await decodeTransferTx({ |
| 887 | ...args, |
| 888 | actionKey, |
| 889 | }); |
| 890 | break; |
| 891 | case strings('transactions.sent_collectible'): |
| 892 | [transactionElement, transactionDetails] = decodeTransferFromTx({ |
| 893 | ...args, |
| 894 | actionKey, |
| 895 | }); |
| 896 | break; |
| 897 | case strings('transactions.contract_deploy'): |
| 898 | [transactionElement, transactionDetails] = decodeDeploymentTx({ |
| 899 | ...args, |
| 900 | actionKey, |
| 901 | }); |
| 902 | break; |
| 903 | default: |
| 904 | [transactionElement, transactionDetails] = decodeConfirmTx({ |
| 905 | ...args, |
| 906 | actionKey, |
| 907 | }); |
| 908 | } |
| 909 | } |
| 910 | return [transactionElement, transactionDetails]; |
| 911 | } |
no test coverage detected