# checkIfAddress

## Description

The `checkIfAddress` function is an asynchronous function that verifies whether an address or contract is valid on a specific blockchain

## Parameters

| Parameter    | Data Type | Description                                  |
| ------------ | --------- | -------------------------------------------- |
| `address`    | string    | The address or contract to be validated.     |
| `blockchain` | string    | The name or symbol of the target blockchain. |

## Response

| Field   | Data Type | Description                                                                              |
| ------- | --------- | ---------------------------------------------------------------------------------------- |
| `code`  | Number    | A numeric value indicating the execution status (1 for success, 0 for error).            |
| `valid` | boolean   | Indicates whether the provided address or contract is valid on the specified blockchain. |
| `error` | any       | The error object containing details about the encountered error, if applicable.          |

## 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:

```jsx
npm install @nest25/evm-chains-lib
OR
yarn add @nest25/evm-chains-lib
```

### Request

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

```jsx
import { Wallet } from '@nest25/evm-chains-lib';

const wallet = new Wallet();

async function main() {
    let { valid } = await wallet.checkIfAddress('SOL', 'HKCYfyqDgcMUZywmkHGduHin799i4sdsAG9TihgAb4Qn');
    console.log({ valid });
}

main();

```

### Response

```jsx
 { valid: true }
```

## Use Cases

* **Checking blockchain availability:** This function communicates with an external API to fetch available blockchains and verifies if the provided blockchain is supported.
* **Handling errors:** In case of any error during the execution of the function or if the blockchain is not found, the returned object will contain the error details.


---

# 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/evm-chains-sdk/wallet/checkifaddress.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.
