# checkNFT

## Description

The `checkNFT` function checks the ownership and metadata of a specific non-fungible token (NFT) on the Casper blockchain and returns the NFT's ownership and metadata

## Parameters

<table><thead><tr><th>Name</th><th width="158">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>RPC_API</code></td><td>string</td><td>The RPC API endpoint of the Casper blockchain</td></tr><tr><td><code>privateKey</code></td><td>string</td><td>The user's private key in string format</td></tr><tr><td><code>tokenId</code></td><td>string</td><td>The user's private key in string format</td></tr></tbody></table>

## Response

<table><thead><tr><th>Name</th><th width="111">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>status</code></td><td>number</td><td>Indicates if the function was successful (1) or not (0)</td></tr><tr><td><code>balanceOf</code></td><td>number</td><td>The balance of the user's account</td></tr><tr><td><code>ownerOfTokenOne</code></td><td>string</td><td>The public key of the NFT's owner</td></tr><tr><td><code>tokenOneMeta</code></td><td>object</td><td>The metadata of the NFT</td></tr></tbody></table>

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

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

### Request

Here is an example of how to make a `checkNFT` 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 privateKey = 'your-private-key';
const RPC_API = 'https://rpc.testnet.casperlabs.io/rpc';

async function main() {
  // check NFT data using tokenId
  const checkData = await casper.checkNFT(RPC_API, privateKey, '164298');
  console.log(checkData);
}
// call main function
main();
```

### Response

```sh
 {
        status: 1,
        balanceOf1: '6',
        ownerOfTokenOne: 'account-hash-b42ea6c352d692cff179749a5023189f92bec6ce81d2c19ad1a1ac2c2c009189',
        tokenOneMeta: Map(4) {
          'description' => 'Bored Ape Mango DESCRIPTION',
          'image' => 'img',
          'name' => 'Bored Ape Mango',
          'royalty' => '40'
        }
}
```

## Use cases

* **NFT marketplaces:** The function can be used by NFT marketplaces to verify the ownership and metadata of NFTs before displaying them for sale.
* **NFT collectors:** The function can be used by NFT collectors to check the ownership and metadata of NFTs they have acquired.
* **Smart contract developers:** The function can be used by smart contract developers to check the ownership and metadata of NFTs in their contracts.
