@@ -2,7 +2,7 @@ import type { TransactionDescription } from '@ethersproject/abi';
22import { Interface } from '@ethersproject/abi' ;
33import { query } from '@metamask/controller-utils' ;
44import type EthQuery from '@metamask/eth-query' ;
5- import { abiERC721 , abiERC20 , abiERC1155 } from '@metamask/metamask-eth-abis' ;
5+ import { abiERC721 , abiERC20 , abiERC1155 , USDC_ABI } from '@metamask/metamask-eth-abis' ;
66
77import type { InferTransactionTypeResult , TransactionParams } from '../types' ;
88import { TransactionType } from '../types' ;
@@ -12,6 +12,7 @@ export const ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';
1212const ERC20Interface = new Interface ( abiERC20 ) ;
1313const ERC721Interface = new Interface ( abiERC721 ) ;
1414const ERC1155Interface = new Interface ( abiERC1155 ) ;
15+ const USDCInterface = new Interface ( USDC_ABI ) ;
1516
1617/**
1718 * Determines the type of the transaction by analyzing the txParams.
@@ -62,7 +63,8 @@ export async function determineTransactionType(
6263 TransactionType . tokenMethodTransfer ,
6364 TransactionType . tokenMethodTransferFrom ,
6465 TransactionType . tokenMethodSafeTransferFrom ,
65- ] . find ( ( methodName ) => methodName . toLowerCase ( ) === name . toLowerCase ( ) ) ;
66+ TransactionType . tokenMethodIncreaseAllowance ,
67+ ] . find ( ( methodName ) => methodName . toLowerCase ( ) === ( name as string ) . toLowerCase ( ) ) ;
6668
6769 if ( tokenMethodName ) {
6870 return { type : tokenMethodName , getCodeResponse } ;
@@ -104,6 +106,12 @@ function parseStandardTokenTransactionData(
104106 // ignore and return undefined
105107 }
106108
109+ try {
110+ return USDCInterface . parseTransaction ( { data } ) ;
111+ } catch {
112+ // ignore and return undefined
113+ }
114+
107115 return undefined ;
108116}
109117
0 commit comments