useDApp
useDApp copied to clipboard
decodeTransactionType
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'