# deployContract

## Description

The `deployContract` function is an asynchronous function that deploys a contract on a specified blockchain.

It deploys different types of contracts based on the provided contract type, blockchain, and other parameters. The function utilizes other contract-specific deployment functions to handle the deployment process.

## Parameters

| Parameter    | Data Type | Description                                             |
| ------------ | --------- | ------------------------------------------------------- |
| `contract`   | string    | The type of contract to be deployed.                    |
| `blockchain` | string    | The target blockchain for contract deployment.          |
| `privateKey` | string    | The private key associated with the deploying account.  |
| `params`     | nftParams | Additional parameters required for contract deployment. |
| `env`        | string    | The environment for contract deployment.                |

## Response

| Field   | Data Type | Description                                                                     |
| ------- | --------- | ------------------------------------------------------------------------------- |
| `code`  | Number    | A numeric value indicating the execution status (1 for success, 0 for error).   |
| `error` | any       | The error object containing details about the encountered error, if applicable. |

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

<br>

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

### Request

Here is an example of how to make a `deployContract` request using the NO.AI SDK:

<br>

```sh
const { Nft } = require('@nest25/evm-chains-lib');

const nft = new Nft('testnet');
const privateKey = '0xYOUR_PRIVATE_KEY';

async function main() {
    const params = {
        name: 'TEST',
        symbol: 'TST',
    };
    const result = await nft.deployContract('erc721', 'klay', privateKey, params);
    console.log('result', result.hash);
}

main();
```

### Response

```sh
0xd56417a007ee79523c26ef47175104be43afd3f460a4c78938f2804ecd8fb069
```

### Use Cases

* **Deploying an ERC721 contract:** This function deploys an ERC721 contract on the specified blockchain, using the provided private key and deployment environment.
* **Deploying an ERC1155 contract:** If the contract type is ERC1155, this function deploys an ERC1155 contract on the target blockchain.
* **Deploying an ERC20 contract:** For the ERC20 contract type, this function deploys an ERC20 contract with the specified maximum cap, name, symbol, private key, and deployment environment.
* **Deploying a SoulBound contract:** If the contract type is SoulBound, this function deploys a SoulBound contract with the specified name, symbol, private key, and deployment environment.
* **Handling unsupported contract types:** If the provided contract type is not supported, the function returns an error indicating that the contract type is not supported.
