MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / decodeTransaction

Function decodeTransaction

app/components/UI/TransactionElement/utils.js:860–911  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

858 * currentCurrency, exchangeRate, contractExchangeRates, collectibleContracts, tokens
859 */
860export 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}

Callers 3

index.jsFile · 0.85
index.jsFile · 0.85
getTransactionInfoFunction · 0.85

Calls 8

getActionKeyFunction · 0.90
stringsFunction · 0.90
decodeSwapsTxFunction · 0.85
decodeIncomingTransferFunction · 0.85
decodeTransferTxFunction · 0.85
decodeTransferFromTxFunction · 0.85
decodeDeploymentTxFunction · 0.85
decodeConfirmTxFunction · 0.85

Tested by

no test coverage detected