useDApp icon indicating copy to clipboard operation
useDApp copied to clipboard

decodeTransactionType

Open marekkirejczyk opened this issue 4 years ago • 0 comments

A function that allows to decode semantic transaction type from Transaction type.

function decodeTransactionType(transaction: Transaction) : TransactionType {
  ...
}

type TransactionType = {
  type: 'TokenApprove', 
  token: address
  from: address 
  to: address
  amount: BigNumber
} | {
  type: 'TokenTransfer',
  token: address
  from: address 
  to: address
  amount: BigNumber
} | ...

Considerations:

  • how do we make it extendable ('StakeETH', 'Created MakerDAO CDP`)
  • how do we extend it with token names (e.g. (TokenTransfer, DAI))
  • how do we combine it into readable messages (e.g. '10 DAI transfered from 0x1234...2345 to CDP contract'

marekkirejczyk avatar Apr 09 '21 09:04 marekkirejczyk