# 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 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 `getBalanceByMnemonic`request using the Volary 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: 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/gettotalbalanceinusdbyaddresarray/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.
