# sol

## Description

The `txStatus` function is used to check the status of a transaction on the Solana blockchain. It takes a transaction hash and an environment as inputs and returns the status of the transaction. The function first validates the transaction hash and environment inputs, then uses the Solana RPC URL corresponding to the given environment to connect to the Solana blockchain. Finally, it retrieves the transaction status and returns it.

## Parameters

| Parameter Name | Data Type | Description                                              |
| -------------- | --------- | -------------------------------------------------------- |
| `txHash`       | string    | The hash of the transaction to check the status for      |
| `env`          | string    | The environment to connect to (e.g. 'devnet', 'mainnet') |

## Response

| Field Name | Data Type | Description                                                                 |
| ---------- | --------- | --------------------------------------------------------------------------- |
| `code`     | number    | A code indicating the result of the function (1 for success, 0 for failure) |
| `result`   | string    | The status of the transaction ('confirmed' if successful, 'failed' if not)  |
| `error`    | string    | An error message, returned if code is 0                                     |

## Example Request and Response

### Prerequisites

Before making requests with Volary SDK, you must have it installed.

You can install Volary SDK using either **`npm`** or **`yarn`**. Use the following commands to install Volary SDK:

```sh
npm install @nest25/wallet-lib
OR
yarn add @nest25/wallet-lib
```

### Request

Here is an example of how to make a `txStatus` request using the Volary SDK:

{% code overflow="wrap" %}

```javascript
// import Nest SDK
import { Wallet } from 'nest25/wallet-lib';

// Create a new instance of the Wallet class
const wallet = new Wallet();

const main = async () => {
  // Get the status of a transaction
  const response = await wallet.txStatus(
    'sol',
    '4iDWwQDUoasbZZS9ARdSydrLdFqMcNC1RDfqarAQgbRXpFXty624PQ3Z3AMnoiioKLJyCwtfpG5owHLAcWFr9ywa',
  );
  // Print the response
  console.log(response);
};

main();
```

{% endcode %}

### Response

{% code overflow="wrap" %}

```sh
   { code: 1, result: 'confirmed' }
```

{% endcode %}

## Use Cases

* **Wallet Applications:** Wallet applications can use this function to retrieve the status of transactions made by the user and update the transaction history accordingly.
* **Explorers:** Blockchain explorers can use this function to provide information on the status of transactions on the Solana blockchain.

###


---

# 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.volary.io/sdks-guide/blockchain-sdks/wallet-sdk/txstatus/sol.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.
