Example Query

A breakdown of an example GraphQL query in inabit

GraphQL Query: Retrieve Transaction Details

In GraphQL, queries are used to fetch data from the server. This example demonstrates how to retrieve detailed information about a transaction.

Let's walk through a more complex query and put this information in context.

Operation Name:

The operation is named Transaction.

Query:

query Transaction($where: TransactionWhereUniqueInput!) {
  transaction: transaction(where: $where) {
    id
    transactionType
    createdAt
    createdBy {
      fullName
      firstName
      lastName
      id
      profileFile {
        id
      }
    }
    txId
    contactCryptoAccount {
      address
      name
      contact {
        name
      }
    }
    kyt
    wallet {
      id
      name
      externalId
      organization {
        id
      }
      organizationExchange {
        exchange {
          code
          id
        }
        id
      }
    }
    financialAsset {
      id
      code
      name
      precision
    }
    blockchain {
      id
      name
      code
      contractType
      networkScannerUrl
    }
    amount
    rateEUR
    rateUSD
    status {
      category
      status
      exchangeStatuses {
        status
      }
      transactionSubStatuses {
        subStatus
      }
    }
    fee
    note
    swapAssetTo {
      code
      precision
    }
    swapToAmount
    metaData {
      value
      transactionMetaDataField {
        id
        name
      }
    }
  }
}

Variables:

{
  "where": {
    "id": "clk10q8he002kk660o1ed8ud4"
  }
}

Explanation:

This query retrieves detailed information about a transaction identified by its unique ID ($where). Here's a breakdown of the fields being requested:

  • id: The unique identifier of the transaction.

  • transactionType: The type of the transaction.

  • createdAt: The timestamp indicating when the transaction was created.

  • createdBy: Information about the user who created the transaction, including their full name, first name, last name, user ID, and profile file ID.

  • txId: The transaction ID.

  • contactCryptoAccount: Details about the contact's crypto account, including the address, name, and contact's name.

  • kyt: KYT (Know Your Transaction) status.

  • wallet: Information about the wallet associated with the transaction, including its ID, name, external ID, associated organization ID, and exchange details.

  • financialAsset: Details about the financial asset involved in the transaction, such as its ID, code, name, and precision.

  • blockchain: Information about the blockchain associated with the transaction, including its ID, name, code, contract type, and network scanner URL.

  • amount: The amount involved in the transaction.

  • rateEUR and rateUSD: Exchange rates for EUR and USD.

  • status: The status of the transaction, including its category, status, exchange statuses, and transaction sub-statuses.

  • fee: The fee associated with the transaction.

  • note: Any additional notes or comments about the transaction.

  • swapAssetTo: Details about the asset swapped to, including its code and precision.

  • swapToAmount: The amount swapped to.

  • metaData: Additional metadata associated with the transaction, including its value and metadata field details.

Response:

Upon successful execution, the response contains detailed information about the requested transaction.