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