> For the complete documentation index, see [llms.txt](https://docs.non-obvious.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.non-obvious.ai/sdks-guide/blockchain-sdks/wallet-sdk/gettotalbalanceinusdbyaddresarray/sol.md).

# sol

## Description

The `getTotalBalanceInUSDbyAddressArray` function is an asynchronous function used to retrieve the total balance in USD for a given array of Ethereum and Solana addresses.

## Parameters

| Parameter         | Data Type | Description                                                                         |
| ----------------- | --------- | ----------------------------------------------------------------------------------- |
| `addresses`       | string\[] | (Optional) An array of Ethereum addresses for which the total balance is requested. |
| `solanaAddresses` | string\[] | (Optional) An array of Solana addresses for which the total balance is requested.   |

## Response

| Field    | Data Type | Description                                                         |
| -------- | --------- | ------------------------------------------------------------------- |
| `code`   | number    | Indicates the status code. 1 for success, 0 for error.              |
| `result` | object    | Contains the total balance in USD for the provided addresses.       |
| `error`  | string    | Contains the error message if an error occurred during the process. |

## 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 `getBalanceByMnemonic`request using the NO.AI SDK:

```javascript
const { Wallet } = require('@nest25/wallet-lib');

const wallet = new Wallet('');

async function main() {
    const addresses = ['0x97Be6D5204A57b8384c15500c38295306243d154', '0x91e803036F3c0628406d8f032e883E21564a8C48'];

    const solanaAddresses = [
      'DqKvT89ndGomiUvPbUfJc8gLFmkKci8HdBJHekZt6kb7',
      '9jBxBwCHt6R5CgxhpjH43M6141JMCdjccjfWufnEB2r8',
    ];
  
    const response = await wallet.getTotalBalanceInUSDbyAddressArray(addresses, solanaAddresses);
    console.log("response --> ", response);
}

main();

```

{% code overflow="wrap" %}

```javascript
```

{% endcode %}

### Response

{% code overflow="wrap" %}

```sh
   response -->  {
        code: 1,
        result: [
          {
            address: '0x97Be6D5204A57b8384c15500c38295306243d154',
            solanaAddress: null,
            balances: [Array],
            totalBalance: 0
          },
          {
            address: '0x91e803036F3c0628406d8f032e883E21564a8C48',
            solanaAddress: null,
            balances: [Array],
            totalBalance: 98.93
          },
          {
            address: null,
            solanaAddress: 'DqKvT89ndGomiUvPbUfJc8gLFmkKci8HdBJHekZt6kb7',
            balances: [Array],
            totalBalance: 0
          },
          {
            address: null,
            solanaAddress: '9jBxBwCHt6R5CgxhpjH43M6141JMCdjccjfWufnEB2r8',
            balances: [Array],
            totalBalance: 0
          }
        ]
      }
```

{% endcode %}

## Use Cases

* **Retrieving total balance:** By invoking this function with an array of Ethereum and/or Solana addresses, you can retrieve the total balance in USD for those addresses.
* **Error handling:** If there is an error during the API request or if the response status code is not 1, the function will return an error object with the appropriate error message.

###


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.non-obvious.ai/sdks-guide/blockchain-sdks/wallet-sdk/gettotalbalanceinusdbyaddresarray/sol.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
