# transferNFT

## Description

The `transferNFT` function allows for the transfer of a non-fungible token (NFT) between two addresses on the Casper blockchain network.&#x20;

The function uses the CEP47Client library and makes use of the CasperServiceByJsonRPC to retrieve the state root hash and account information.

## Parameters

| Name         | Type   | Description                             |
| ------------ | ------ | --------------------------------------- |
| `RPC_API`    | string | The RPC API for the Casper network      |
| `privateKey` | string | The private key of the owner of the NFT |
| `receiver`   | string | The receiver address for the NFT        |
| `tokenId`    | string | The ID of the NFT being transferred     |
| `owner`      | string | The current owner of the NFT            |

## Response

| Name      | Type   | Description                          |
| --------- | ------ | ------------------------------------ |
| `tokenId` | string | The ID of the transferred NFT        |
| `txHash`  | string | The transaction hash of the transfer |

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

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

### Request

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

```javascript
// import Nest25 Casper library
const { Casper } = require('@nest25/casper-lib');
// create a new Casper instance
const casper = new Casper();

// set testnet variables
const testPrivateKey = 'your-private-key';
const publicKey = '013a156a50fc6284ba436aedeaf96b55ac1a0c57ee9f8a46bf1c6518afe9b2f56c';
const RPC_API = 'https://rpc.testnet.casperlabs.io/rpc';

async function main() {
  // transfer NFT
  const result = await casper.transferNFT(
    RPC_API,
    testPrivateKey,
    872222,
    '017224493871278b24d2e9588b0ccc2f80e226aaff9b676ca00d031221bc73b61e',
    publicKey,
  );
  // print result
  console.log(result);
}
// call main function
main();
```

### Response

```sh
 {
        tokenId: 872222,
        txHash: '97d7b930bfb83474202ec4f5351be8c6666de3e212398b6cb814b163ca3192f3'
}
```

## Use Cases

* **NFT Marketplaces:** The `transferNFT` function can be used by NFT marketplaces to facilitate the transfer of NFTs between buyers and sellers.
* **Gaming Platforms:** The function can be used by gaming platforms to transfer NFT assets between players.
* **Decentralized Applications:** The `transferNFT` function can be used by developers building decentralized applications that require the transfer of NFTs on the Casper network.
