# near

## Description

The `getBalanceByMnemonic` function is used to retrieve the account balance associated with a specified mnemonic and account ID. It allows you to query the balance of a Near Protocol account by providing the mnemonic, the account ID, and the environment (e.g., testnet, mainnet) in which the account exists.

## Parameters

| Parameter    | Data Type | Description                                                              |
| ------------ | --------- | ------------------------------------------------------------------------ |
| `blockchain` | string    | The blockchain network associated with the mnemonic (in this case, near) |
| `mnemonic`   | string    | The mnemonic associated with the Near Protocol account.                  |
| `accountId`  | string    | The ID of the Near Protocol account.                                     |

## Response

| Field   | Data Type | Description                                               |
| ------- | --------- | --------------------------------------------------------- |
| `total` | numeric   | The total balance of the specified Near Protocol account. |

## 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 wallet from the nest SDK
const { Wallet } = require('@nest25/wallet-lib');
// create a new wallet instance
const wallet = new Wallet('');
// set the mnemonic to use for the wallet
const testMnemonic = 'exchange fun mixed elevator laundry length trap script boost purchase genuine arrest';

async function main() {
  // get the balance of the wallet
  const response = await wallet.getBalanceByMnemonic(
    'near',
    testMnemonic,
    'tomarc',
  );
  // log the response
  console.log(response);
}

```

{% endcode %}

### Response

{% code overflow="wrap" %}

```sh
  
```

{% endcode %}

## Use Cases

* **Online Wallets:** Online wallets can use this function to retrieve the status of transactions made on their platform. By querying the account balance using the `getBalanceByMnemonic` function, online wallets can provide users with real-time information about their account balances.
* **Trading Platforms:** Trading platforms can use this function to verify the status of transactions made by their users on different blockchain networks. By checking the account balance of a specific Near Protocol account using the `getBalanceByMnemonic` function, trading platforms can ensure that the necessary funds are available for executing transactions and updating the user's portfolio accordingly.

###


---

# 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.non-obvious.ai/sdks-guide/blockchain-sdks/wallet-sdk/getbalancebymnemonic/near.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.
