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

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


---

# 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/nft/deploycontract.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.
