How to properly categorize and combine transactions?

Many LPs operate in the same way:
*Attach wallet to LP
*Deposit crypto into LP
*Balance earns interest
*Withdrawal crypto into LP

When you import the transactions from your wallet, you will see:
*Withdrawl to a wallet
*Deposit to a wallet with greater amount than before.

Is there a way to combine them or categorize them so that the interest is separated from the principal, and the transfer fees can be deducted from the cost basis?