# Getting the Transaction Status

## From the Kima Backend

Using the Kima Backend, you can get the transaction status by calling two `/tx` endpoints depending on the type of transaction.

For regular transactions: `GET /tx/:txId/status`

For liquidity pool transactions: `GET /tx/lp/:txId/status`

Parameters:

* txId `number`: the transaction id number. This is a sequential number assigned to each transaction, NOT the transaction hash (`tx_id` below).

Success Response:

Example note: this sample response uses testnet-style token symbols such as `USDK`. If you are integrating against mainnet, expect the same response shape with supported mainnet symbols such as `USDC`.

```json
{
  "data": {
    "transaction_data": [
      {
        "failreason": "",
        "pullfailcount": 0,
        "pullhash": "0x479c907fe8c92970e99fa102d440e805fa7d5d436469d4bbc003dec21349230f",
        "releasefailcount": 0,
        "releasehash": "4r58fVKEL6q6dZ7xdqTUXrL3adVLH23EYavwh7EjavPTu2mCwiqGJqtoWRHiSC17rsVJA2jdcAjF3ZoGbG5e1y86",
        "txstatus": "Completed",
        "amount": "6.00",
        "creator": "kima18lhurd62myjv0c73dfrzej9wamvs4rffugd948",
        "originaddress": "0x366Aa85aFd7e5Cb657748f2142009a04750AD081",
        "originchain": "ARB",
        "originsymbol": "USDK",
        "targetsymbol": "USDK",
        "targetaddress": "64tSEV9Rc5L7LaYDnSwaEgi4YGZMkBr4VnT9S7Va8fNE",
        "targetchain": "SOL",
        "tx_id": 15519,
        "kimahash": "4C9135132C88B05C78B89B208A9655428AF3E86A43D6E4D0680463364037F5DD"
      }
    ]
  }
}
```

## From the Kima Subgraph

Once the transaction has been submitted to the Kima Transaction Backend, you’ll want to display the transaction progress in the frontend. There are 2 GraphQL queries on the Kima subgraph for this purpose.

* Mainnet Kima Subgraph url: `https://graphql.kima.network/v1/graphql`
* Sardis Testnet url: `https://graphql.sardis.kima.network/v1/graphql`

Here is a code snippet for regular transactions using plain `fetch`. See the docs for your favorite graphql client for constructing queries.

Note: in the Kima subgraph, `tx_id` uses the GraphQL scalar `bigint`. In JSON variables, pass it as a numeric string such as `"15519"`.

```typescript
const result = await fetch("https://graphql.kima.network/v1/graphql", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `  
      query TransactionDetailsKima($txId: bigint) {  
        transaction_data(where: { tx_id: { _eq: $txId } }, limit: 1) {  
          failreason  
          pullfailcount  
          pullhash  
          releasefailcount  
          releasehash  
          txstatus  
          amount  
          creator  
          originaddress  
          originchain  
          originsymbol  
          targetsymbol  
          targetaddress  
          targetchain  
          tx_id  
          kimahash  
        }  
      }`,
    variables: {
      txId: `${txId}`,
    },
  }),
}).then((res) => res.json());
```

For liquidity pool transactions:

```typescript
const result = await fetch("https://graphql.kima.network/v1/graphql", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `  
      query TransactionDetailsKima($txId: bigint) {  
        liquidity_transaction_data(where: { tx_id: { _eq: $txId } }, limit: 1) {  
          failreason  
          pullfailcount  
          pullhash  
          releasefailcount  
          releasehash  
          txstatus  
          amount  
          creator  
          chain  
          providerchainaddress  
          symbol  
          tx_id  
          kimahash  
        }  
      }`,
    variables: {
      txId: `${txId}`,
    },
  }),
}).then((res) => res.json());
```

## Available transaction statuses

These are the current available transaction statuses returned from our blockchain and used throughout the SDK documentation today.

```typescript
export enum TransactionStatus {
  AVAILABLE='Available' // Transaction exists in mempool,
  CONFIRMED='Pull_Confirmed' // Funds have been pulled from source and confirmed after waiting n block confirmations,
  PULLED='Pulled' // Funds were pulled but are awaiting confirmation of txHash existence after waiting n block confirmations.
  PAID='Paid' // Funds were released in the target network but awaiting confirmation after waiting n block confirmations,,
  COMPLETED='Completed' // Transaction successfully completed,
  FAILEDTOPAY='FailedToPay' // Funds failed to be released on the target network,
  FAILEDTOPULL='FailedToPull' // Funds failed to be pulled from the source network,
  REFUNDSTART='RefundStart' // A refund has been initiated,
  REFUNDFAILED='RefundFailed' // The process of refunding failed,
  REFUNDCOMPLETED='RefundCompleted' // Refund has successfully completed,
  DECLINEDINVALID='DeclinedInvalid' // Transaction declined because it didn't comply with one or more security measures (feeId, signature, etc.)
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kima.network/kima-network/the-kima-sdk/use-kima-sdk-without-widget/getting-transaction-status.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
