# transferOwnership

## Description

The `transferOwnership` function is an asynchronous function that facilitates the transfer of ownership for a given contract on a specified blockchain.

## Parameters

| Parameter         | Data Type | Description                                                                        |
| ----------------- | --------- | ---------------------------------------------------------------------------------- |
| `contract`        | string    | The type of contract ('ERC721', 'ERC1155', 'ERC20', 'SOULBOUND').                  |
| `blockchain`      | string    | The name or symbol of the blockchain.                                              |
| `contractAddress` | string    | The address of the contract on the blockchain.                                     |
| `privateKey`      | string    | The private key of the current owner.                                              |
| `newOwner`        | string    | The address of the new owner to whom the ownership will be transferred.            |
| `env`             | string    | The environment or network where the contract exists (e.g., 'mainnet', 'testnet'). |

## 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.                                                                                              |
| `result` | any       | The result object containing the outcome of the ownership transfer operation. The structure of the result object may vary depending on the contract type and implementation. |

## 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 `VLRYToCRYPTO` request using the Volary SDK:<br>

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

const nft = new Nft('testnet');
const privateKey = "your private key"

async function main() {
    const result = await nft.transferOwnership(
        'erc20',
        'ava',
        '0xc653bf7cdd8775f8d6fc2deb664d54b793914ca8',
        privateKey,
        '0x0EDdA2D7b045c0de5DF076bC367FB23af698df40',
    );
    console.log(result);
}

main();

```

### Response

```sh
```

### Use Cases

* The `transferOwnership` function can be used to transfer ownership of a contract on a specified blockchain. It is useful when there is a need to change the owner of a contract to another address.

&#x20;


---

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