Transactions API

Transactions are blockchain transactions that are already sent to the blockchain by the time you retrieve them, and are immutable. The transactions that you retrieve can be found on-chain via public block explorers.

Refer to the Transaction Workflow for more information on the transaction request statuses.

Retrieve

By Transaction Hash

You can retrieve a transaction by its hash using the following GraphQL query with the Transaction object. It requires the transactionHash as an input and returns details related to the specified transaction. This transaction hash is the hash of the transaction on, and is unique to, the blockchain.

QueryGraphQL
query TransactionByHash($walletId: ID!, $transactionHash: String!) {
  wallet(walletId: $walletId) {
    transaction(transactionHash: $transactionHash) {
      hash
      tokenTransferData {
        to # Token transferred to
        tokenAddress # Token contract address
        amount # Raw amount
        tokenDecimals # Token decimal places
      }
      amount # Amount used in native token
      timestamp
      gasUsed # Gas units used for this transaction
      gasPrice # Gas price at the time of this transaction
      status
    }
  }
}
VariablesJSON
{
  "variables": {
    "walletId": "22cf4347-405a-47df-8267-26bfecac7b11",
    "transactionHash": "0xae44592c4a3b4ff93c8dba0f5c9b837337f18e3079691ac3519c571cd161e9d6"
  }
}
ResponseJSON
{
  "data": {
    "wallet": {
      "transaction": {
        "hash": "0xae44592c4a3b4ff93c8dba0f5c9b837337f18e3079691ac3519c571cd161e9d6",
        "tokenTransferData": [
          {
            "to": "0x6886c0a002C3dE06481330ADB9e25E76d5bf2d2e",
            "tokenAddress": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
            "amount": "50000000000000000",
            "tokenDecimals": 18
          }
        ],
        "amount": "0",
        "timestamp": "1696656240",
        "gasUsed": "57182",
        "gasPrice": "1500000018",
        "status": "CONFIRMED"
      }
    }
  }
}

Delete

At Levain, we do not allow you to delete transactions because they are immutable, due to the nature of how blockchains work.