> For the complete documentation index, see [llms.txt](https://style-protocol.gitbook.io/sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://style-protocol.gitbook.io/sdk/referenence/for-developers/unity.md).

# Unity

{% hint style="info" %}
[Repository](https://github.com/STYLE-Protocol/STYLE-Protocol-SDK-Unity)
{% endhint %}

## Fetch NFTs

### Fetch requested NFTs

**How it looks like:**

```csharp
async public static Task<List<Dictionary<string, object>>> getRequestedNFTsAPI(
        List<string> metaverseFilter,
        List<string> typeFilter,
        List<string> subtypeFilter,
        int cursor = 0,
        int amount = 100,
        int chainId = 5
    )
```

* `metaverseFilter: List<string>`- Using for metaverse filter. Currently possible values are: `decentranland`, `sandbox`, `somnium_space`, `cryptovoxels, fabwelt`. Use empty array to get items from all metaverses.
* `typeFilter: List<string>`- Using for asset type filter. Currently possible values are: `AVATAR`, `WEARABLE`, `MISC`. Use empty array to get items of all types.
* `subtypeFilter: List<string>`- Using for asset subtype filter.  Use empty array to get items of all types.
* `cursor: int` - Start index of `getStakes` protocol\`s function (as it uses pagination).
* `amount: int` - Number of viewed indexes of `getStakes` protocol\`s function (as it uses pagination).
* `chainId: int` - Chain Id to be able to use it cross-chain.

**Return value:**

* If succeded:

```csharp
[
    {
      tokenAddress: "0xc36442b4a4522e871399cd717abdd847ab11fe88",
      tokenId: 36639,
      payment: {
        value: { type: "BigNumber", hex: "0x014d1120d7b1600000" },
        stringValue: "24",
      },
      paymentToken: {
        address: "0x48d373E2B7f0930DAEF4C51CA63711bdD9b5C5B0",
        name: "USD Circle",
        symbol: "USDC",
      },
      type: "AVATAR",
      subtype: "Other",
      tailorId: "632422280100cd8980997351",
      jobId: "633dd5ae8e81caae508afad9",
      uri: "https://stylexchange.mypinata.cloud/ipfs/QmVab2rT96LjdqTWEaQihj4CDVvq9bbm7bgTxUZ5b8YeVt",
      bidder: "0xb396aedb7e8eea5b29501f5dba173d82458c8e17",
      signature:
        "0x531fa0f96276037b14f61ebd2bf1702594e5ed9a67e6261e763e2163a63352d34e57d1e9d2ebee6255da18f313a873255842d4b8d391a2da63a5fe043fb5de2e1b",
      environment: "0x67701e71F9412Af1BcB2D77897F40139B6Ccc073",
      metaverseId: 0,
      adminSignature:
        "0x5a16fe5d80fa1c9a3a4400babfba2e298465eb04e429e9ea0e2e0d52cf33aea404143ffb77e03487adb56c6d048c6e6390a98da8333adb0dd1070b98fdba4a401c",
      asset: {
        name: "Derivative from Uniswap - 0.3% - USDC/SP - MIN<>100050",
        description:
          "StyleXchange derivative from Uniswap - 0.3% - USDC/SP - MIN<>100050 for DECENTRALAND",
        image:
          "https://stylexchange.mypinata.cloud/ipfs/QmdE18pYr2RE8toGZVC8PJ87ryfZ2u1pL73wX6y4Ansuz6",
        animation_url:
          "https://stylexchange.mypinata.cloud/ipfs/bafkreidqpr3ixz5wahwmpuoqwdhlwsraju3tz2wbf3nnopo4uexxnafgpu",
      },
      cid: "QmSTGGifjf669XWEFA7RxHkTGDNS23GLXjzyHKPFFuhBV8",
      numberOfDerivatives: 5,
    },
  ]
```

* If failed:

```csharp
null
```

### Fetch Owned Derivatives

**How it looks like:**

```csharp
async public static Task<List<Dictionary<string, object>>> getOwnedDerivatives(
        List<string> metaverseFilter,
        List<string> typeFilter,
        List<string> subtypeFilter,
        Dictionary<string, string> userProof,
        int chainId = 5
    )
```

* `metaverseFilter: List<string>`- Using for metaverse filter. Currently possible values are: `decentranland`, `sandbox`, `somnium_space`, `cryptovoxels, fabwelt`. Use empty array to get items from all metaverses.
* `typeFilter: List<string>`- Using for asset type filter. Currently possible values are: `AVATAR`, `WEARABLE`, `MISC`. Use empty array to get items of all types.
* `subtypeFilter: List<string>`- Using for asset subtype filter.  Use empty array to get items of all types.
* `userProof: Dictionary<string, string>`- User Proof with walletAddress and signature.
* `chainId: int` - Chain Id to be able to use it cross-chain.

**Return value:**

{% hint style="info" %}
NFT\["asset"]\["animation\_url"] contains an URI for its 3d model
{% endhint %}

* If succeded:

```csharp
[
  {
    contract: {
      address: "0x4d49b4c5dbd23f56811cb1b753bc58db63809b55",
      name: "Derivative of Derivative of Derivative of StyleProtocol Temps",
      symbol: "SPTSPSPSP",
      totalSupply: "2",
      tokenType: "ERC721",
      openSea: {
        lastIngestedAt: "2023-03-28T09:57:15.000Z",
      },
    },
    tokenId: "1",
    tokenType: "ERC721",
    title: "Derivative of Derivative of Derivative of Example3",
    description:
      "Style Protocol derivative from Derivative of Derivative of Example3 for SOMNIUM_SPACE\n\nhttps://www.protocol.style",
    timeLastUpdated: "2023-03-28T14:35:43.144Z",
    rawMetadata: {
      name: "Derivative of Derivative of Derivative of Example3",
      description:
        "Style Protocol derivative from Derivative of Derivative of Example3 for SOMNIUM_SPACE\n\nhttps://www.protocol.style",
      image:
        "https://ipfs.io/ipfs/bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
      animation_url:
        "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/0xb15175d683d88007e8121811122abd16895b7e2ad47aaa64d5883f38d0c57c434a695c6ef01526ca94a9dce6aa38221afd31d80a65468d00b62f672beab753c51b/0x67701e71f9412af1bcb2d77897f40139b6ccc073/yaku_test_anim.glb",
      model_url:
        "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/yaku_test_anim.glb",
      image_url:
        "https://ipfs.io/ipfs/bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
    },
    tokenUri: {
      gateway:
        "https://ipfs.io/ipfs/QmP6nxCCiqKcb6SszKgNz3MmqQUgQK6vJdL5cWywMEPH1S",
      raw: "ipfs://QmP6nxCCiqKcb6SszKgNz3MmqQUgQK6vJdL5cWywMEPH1S",
    },
    media: [
      {
        gateway:
          "https://nft-cdn.alchemy.com/eth-goerli/0c21dde76fca76c4824d0cd8b3f90f0f",
        thumbnail:
          "https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/0c21dde76fca76c4824d0cd8b3f90f0f",
        raw: "ipfs://bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
        format: "png",
        bytes: 31555,
      },
    ],
    balance: 1,
    metadata: {
      name: "Derivative of Derivative of Derivative of Example3",
      description:
        "Style Protocol derivative from Derivative of Derivative of Example3 for SOMNIUM_SPACE\n\nhttps://www.protocol.style",
      image:
        "https://ipfs.io/ipfs/bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
      animation_url:
        "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/0xb15175d683d88007e8121811122abd16895b7e2ad47aaa64d5883f38d0c57c434a695c6ef01526ca94a9dce6aa38221afd31d80a65468d00b62f672beab753c51b/0x67701e71f9412af1bcb2d77897f40139b6ccc073/yaku_test_anim.glb",
      model_url:
        "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/yaku_test_anim.glb",
      image_url:
        "https://ipfs.io/ipfs/bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
    },
    asset: {
      name: "Derivative of Derivative of Derivative of Example3",
      description:
        "Style Protocol derivative from Derivative of Derivative of Example3 for SOMNIUM_SPACE\n\nhttps://www.protocol.style",
      image:
        "https://ipfs.io/ipfs/bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
      animation_url:
        "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/0xb15175d683d88007e8121811122abd16895b7e2ad47aaa64d5883f38d0c57c434a695c6ef01526ca94a9dce6aa38221afd31d80a65468d00b62f672beab753c51b/0x67701e71f9412af1bcb2d77897f40139b6ccc073/yaku_test_anim.glb",
      model_url:
        "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/yaku_test_anim.glb",
      image_url:
        "https://ipfs.io/ipfs/bafybeigd7x5pfrpxtth7mthfbyvpepxhodsahvq46rfu2thtd2wpgpbaja/image.png",
    },
    threed_job_file_url:
      "https://style-protocol-api.vercel.app/api/data/0x4D49B4C5DbD23f56811CB1B753BC58DB63809b55/0xb15175d683d88007e8121811122abd16895b7e2ad47aaa64d5883f38d0c57c434a695c6ef01526ca94a9dce6aa38221afd31d80a65468d00b62f672beab753c51b/0x67701e71f9412af1bcb2d77897f40139b6ccc073/yaku_test_anim.glb",
    is_3djob: true,
    metaverse: "SOMNIUM_SPACE",
    type: "AVATAR",
    subType: "",
    source: {
      tokenAddress: "0x793DEdf81DbEf444602d80c81bE1960A6b0aE4Fb",
      tokenId: "0",
    },
  },
]
```

* If failed:

```csharp
null
```

## Buy NFTs

### Approve ERC20 tokens to protocol

**How it looks like:**

```csharp
async public static Task<string> approveERC20(
        Dictionary<string, object> NFT,
        int chainId = 5
    )
```

* `NFT: Dictionary<string, object>` - Object with NFT data (element of array taken from [fetch](#fetch-nfts) functions).
* `chainId: int` - Chain Id to be able to use it cross-chain.

**Return value:**

* If succeded:

```javascript
"true"
```

* If failed:

```javascript
"<Error message>"
```

### Buy requested NFTs

**How it looks like:**

```csharp
async public static Task<string> buyAndMintItem(
        Dictionary<string, object> NFT,
        int chainId = 5
    )
```

* `NFT: Dictionary<string, object>` - Object with NFT data (element of array taken from [fetch](#fetch-nfts) functions).
* `chainId: int` - Chain Id to be able to use it cross-chain.

**Return value:**

* If succeded:

```javascript
"true"
```

* If failed:

```javascript
"<Error message>"
```

## User Proof&#x20;

### Get User Proof

**How it looks like:**

```csharp
async public static Task<Dictionary<string, string>> getUserProof()
```

**Return value:**

* If succeded:

```javascript
{
    "signature": "<your signature>",
    "walletAddress": "0x67701e71f9412af1bcb2d77897f40139b6ccc073"
}
```

* If failed:

```javascript
null
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://style-protocol.gitbook.io/sdk/referenence/for-developers/unity.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.
