11import { isHexString } from 'ethereumjs-util' ;
22import { Interface } from '@ethersproject/abi' ;
3- import { abiERC721 , abiERC20 , abiERC1155 } from '@metamask/metamask-eth-abis' ;
3+ import {
4+ abiERC721 ,
5+ abiERC20 ,
6+ abiERC1155 ,
7+ abiFiatTokenV2 ,
8+ } from '@metamask/metamask-eth-abis' ;
49import type EthQuery from '@metamask/eth-query' ;
510import log from 'loglevel' ;
611import {
@@ -18,6 +23,7 @@ const INFERRABLE_TRANSACTION_TYPES: TransactionType[] = [
1823 TransactionType . tokenMethodSetApprovalForAll ,
1924 TransactionType . tokenMethodTransfer ,
2025 TransactionType . tokenMethodTransferFrom ,
26+ TransactionType . tokenMethodIncreaseAllowance ,
2127 TransactionType . contractInteraction ,
2228 TransactionType . simpleSend ,
2329] ;
@@ -32,6 +38,7 @@ type InferTransactionTypeResult = {
3238const erc20Interface = new Interface ( abiERC20 ) ;
3339const erc721Interface = new Interface ( abiERC721 ) ;
3440const erc1155Interface = new Interface ( abiERC1155 ) ;
41+ const USDCInterface = new Interface ( abiFiatTokenV2 ) ;
3542
3643/**
3744 * Determines if the maxFeePerGas and maxPriorityFeePerGas fields are supplied
@@ -116,6 +123,12 @@ export function parseStandardTokenTransactionData(data: string) {
116123 // ignore and return undefined
117124 }
118125
126+ try {
127+ return USDCInterface . parseTransaction ( { data } ) ;
128+ } catch {
129+ // ignore and return undefined
130+ }
131+
119132 return undefined ;
120133}
121134
@@ -169,6 +182,7 @@ export async function determineTransactionType(
169182 TransactionType . tokenMethodSetApprovalForAll ,
170183 TransactionType . tokenMethodTransfer ,
171184 TransactionType . tokenMethodTransferFrom ,
185+ TransactionType . tokenMethodIncreaseAllowance ,
172186 TransactionType . tokenMethodSafeTransferFrom ,
173187 ] . find ( ( methodName ) => isEqualCaseInsensitive ( methodName , name ) ) ;
174188 return {
@@ -227,6 +241,7 @@ export async function determineTransactionAssetType(
227241 TransactionType . tokenMethodSetApprovalForAll ,
228242 TransactionType . tokenMethodTransfer ,
229243 TransactionType . tokenMethodTransferFrom ,
244+ TransactionType . tokenMethodIncreaseAllowance ,
230245 ] . find ( ( methodName ) => methodName === inferrableType ) ;
231246
232247 if (
0 commit comments