Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

Transaction app types and mapping from json to UI layer

Jose Alvarez edited this page Jun 3, 2020 · 11 revisions
  1. Transaction DTO (backend)

  2. Data layer mapping:

    • Transfer

      • condition: transactionDto.transfers.size == 1
      • fields: recipient = transactionDto.transfers[0].to, sender = transactionDto.transfers[0].from , value = transactionDto.transfers[0].value, date = transactionDto.transfers[0].executionDate, Erc20TokenInfo, Erc721TokenInfo, ETH
    • SettingsChange

      • precondition: these are the solidity contracts method names to be supported for now. settingMethodNames = ["setFallbackHandler", "addOwnerWithThreshold", "removeOwner", "swapOwner", "changeThreshold", "changeMasterCopy"]
      • condition: transactionDto.to == transactionDto.safe && transactionDto.dataDecoded != null && settingMethodNames.contains(transactionDto.dataDecoded.method)
      • fields: dataDecoded, date = (transactionDto.executionDate ?: transactionDto.submissionDate ?: transactionDto.creationDate)
    • Custom (Multisend included)

      • condition: else
      • fields: transactionDto.to, transactionDto.value, sizeInBytes(transactionDto.data), date = (transactionDto.executionDate ?: transactionDto.submissionDate ?: transactionDto.creationDate)

    // Multisend: list<Transfer | SettingsChange | Custom | Multisend>

  3. UI layer mapping: (each type is grouped by queued/history)

    • Transfer

      • transfer direction: if(Transfer.recipient == currentSafe) Incoming else Outgoing
    • SettingsChange

      • methodName = SettingsChange.dataDecoded.method, define human readable assets for each method in settingMethodNames = ["setFallbackHandler", "addOwnerWithThreshold", "removeOwner", "swapOwner", "changeThreshold", "changeMasterCopy"]
    • ChangeMasterCopy (specification of SettingsChange)

      • SettingsChange.dataDecoded.method == "changeMasterCopy", get version name string from hardcoded asset (SettingsChange.dataDecoded.params[0].value)
    • Custom

      • n/a
  4. Status calculation (precondition: Safe info needs to be available):

    • queued = status is one of {pending, waitingForConfirmation, waitingFroExecution} sorted by nonce ascending, creation date descending NOTE: since these are outgoing transactions, they must have nonce.

      • Pending: Submitted from device, therefore not supported yet
      • WaitingForConfirmation
        • condition: transactionDto.isExecuted != true && transactionDto.nonce >= safe.nonce && transactionDto.confirmations.size < safe.threshold
      • WaitingForExecution
        • condition: transactionDto.isExecuted != true && transactionDto.nonce >= safe.nonce && transactionDto.confirmations.size >= safe.threshold
    • history = status is one of {success, failed, cancelled} sorted by execution date (if null, then created date), descending

      • Success
        • condition: transactionDto.isExecuted == true && transactionDto.isSuccessful == true
      • Failed
        • condition: transactionDto.isExecuted == true && transactionDto.isSuccessful != true
      • Cancelled
        • condition: transactionDto.isExecuted != true && transactionDto.nonce < safe.nonce
  5. Pagination No dodgy business

Backend Assumptions:

transfers - logical transfers inferred from the transaction - ETHER_TRANSFER : ETH is transferred (data = null) - ERC20_TRANSFER : some token - ERC721_TRANSFER : some other token - UNKNOWN : might be a sh*t token

Clone this wiki locally