# 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 NO.AI SDK, you must have it installed.

You can install NO.AI SDK using either **`npm`** or **`yarn`**. Use the following commands to install NO.AI 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 NO.AI 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.

###
