# NFTRainbow - NFT 彩虹桥 🌈🌉🦄

NFTRainbow -- NFT 彩虹桥。是一个 ”一站式，简单，开发者友好的 NFT 基础设施\&API服务“，可以帮助开发者将 NFT 应用推向市场的时间从几个月缩减至几个小时。我们负责搭建好 NFT 基础设施，开发者可以将精力专注于应用开发。由开发者打造，服务于开发者。

## NFT 应用开发通常是困难，缓慢和昂贵的 🤯

### 复杂的 Blockchain 技术栈 🤔

开发者需要学习区块链的基础概念比如区块链，账户，私钥，助记词等等；掌握新的开发技能如 Solidity，Web3.js，GraphQL，节点，IPFS等等。这往往需要花费大量的时间，甚至需要多人分工来完成。

### 搭建和维护区块链基础设施是一件有挑战的工作 👹

团队需要花费 25-50% 的工程师资源搭建区块链节点，NFT 索引服务，并进行持续的运维（节点升级）。如果想开发多链应用，这些工作不只是翻倍，因为通长开发一个健壮的一条链的 NFT 基础设施至少需要三个月。

### 运行独立的节点非常昂贵 💸

以`以太坊`为例，运行一个节点，一年最少需要 8.4w$，如果是云服务器每月需要 $2k-5k，以及 $5K 每月的人力费用。使用托管的节点服务更加昂贵，因为你需要查询所有的 NFT 历史数据。

### 使用非基础设施节点提供商有很大的业务风险 🎰

他们的 API 通常被严重的限流保护，因为他们不是一个基础设施为核心业务的公司，他们可能随时修改业务策略，限流策略，甚至关闭他们的服务，这将会导致你的应用非常尴尬。

### NFT 市场，推出速度非常关键 🚀

被竞争对手抢先发布产品是快速发展的 NFT 市场参与者最大的忌讳之一。开发周期长，部署落后会阻碍你进入市场，从而导致丢失用户，收益，被竞争对手所替代。

## NFTRainbow 核心产品和优势 🏳️‍🌈🍭

我们提供服务能够让开发者以最快的速度完成他们 NFT 应用的开发。这些产品可以让开发者把更多的精力放在为用户开发最好的产品服务上，而不是重新制造 NFT 基础设施轮子。

### NFT Easy Minting 🖼️

使用我们的 API 服务，开发者可以在`两分钟内`将任何资源铸造成 NFT。开发者无需具备区块链知识和经验，领维护成本。

* 提供多种资源托管方式：中心化存储，IPFS，云存储
* 支持 Conflux 树图链
* 支持多种数字藏品应用场景
* 支持批量铸造，超高上链性能

### 开发者控制台 🖥

在我们的开发者控制台，用户可以查看自己部署的所有合约，铸造的 NFT，以及 API 使用情况。

## 技术支持&开发者社区 👥

我们的目标是提升开发者的开发体验，帮助 NFT 应用快速完成产品，取得成功。我们有区块链专家手把手指导，随时解决问题。

用户可至开发者文档 [FAQs](/docs/faqs) 部分查看常见问题解决方案，也可以通过邮箱 `contact@nftrainbow.xyz` 联系我们。

加入我们的开发者社区，在那里可以得到 NFTRainbow 团队的帮助和支持，以及讨论 NFT 相关的话题。并和其他 NFT 爱好者建立联系，互相交流。 除此之外我们还提供：

* 官方核心开发者的直接支持
* 为您的 NFT 产品提供咨询服务
* 帮助您与 NFT 行业的其他大咖建立联系


# Mints


# 铸造NFT快速指南

欢迎来到 NFTRainbow，使用我们的NFTRainbow-API, 您将可以在2分钟之内免费将任意文件铸造成为NFT，而且可以在多种区块链上进行。

## 本文将包含如下内容

* [为什么使用 NFTRainbow-API](#为什么使用-nftrainbow-api)
* [NFTRainbow-API 能做什么](#nftrainbow-api-能做什么)
* [准备工作](#准备工作)
* [简单铸造 NFT](#简单铸造-nft)
* [定制化铸造 NFT](#定制化铸造-nft)
* [设置代付](#设置代付)

## 为什么使用 NFTRainbow-API

1. 区块链技术栈很复杂，通常实现铸造和查询NFT需要掌握区块链相关知识，包括 Solidity、Web3.js、GraphQL、节点、IPFS、数据密集型应用程序等，学习曲线陡峭且需要大量时间，通常需要一个团队来涵盖所有技能。
2. 基础设施的建立和维护成本昂贵且耗时，通常团队的50%的工作量会花费在这上面，如果支持多种区块链则会让难度成倍上升。
3. 运行自己的节点很昂贵，使用第三方节点服务则受限于服务的可靠性和安全性。
4. 时间是宝贵的，当有一个商业机会时是否能抢在对手前面将影响整个项目的成败。

使用 NFTRainbow-API 将可以避免以上问题，让web2开发者无门槛使用，不需要学习web3技术栈，极大降低成本，提高开发效率。

## NFTRainbow-API 能做什么

可以将任何文件（通常是图片或视频），通过Web API的方式铸造成为NFT，比如艺术品或者数字收藏品，或者您能想到的任何可视化的东西。

这意味着您可以：

* 快速铸造 NFT 将其发布到区块链网络
* 无需学习智能合约开发即可测试新的 NFT 产品创意
* 在您的应用程序中通过调用 NFTRainbow-API 自动铸造 NFT
* 向指定用户钱包地址铸造 NFT 来宣传您的 NFT项目，比如向 CryptoPunk 或者 Bored Ape Yacht Club 拥有者地址铸造 NFT

NFTRainbow-API 提供了两种方式来铸造NFT

* [简单铸造](#简单铸造-nft)
* [定制化铸造](#定制化铸造-nft)

## 准备工作

铸造NFT之前，您需要

1. [注册 NFTRainbow 账户，并进行实名认证](https://console.nftrainbow.cn/panels/)
2. [创建应用，应用通常对应一个产品](https://console.nftrainbow.cn/panels/apps)
3. 从[应用列表](https://console.nftrainbow.cn/panels/apps)进入刚创建的应用，点击“查看AppKey”，获取AppKey
4. [登录应用，获取JWT Token](https://docs.nftrainbow.xyz/api-reference/open-api/login#app-login)，下面的API将都需要使用该Token做身份验证

## 简单铸造 NFT

简单铸造NFT，就是用最简单的方式来铸造NFT，您只需要提供

* NFT 名称
* NFT 描述
* NFT 文件 或 NFT 文件 URL；NFT 文件可以是任意类型的文件，包括 图片、音频、视频、文本、PDF、二进制文件等。通常艺术品类NFT都是使用图片、音频或视频文件。
* NFT 铸造目标链
* NFT 铸造目标地址

然后使用 [easymint-file](https://docs.nftrainbow.xyz/api-reference/open-api/mints#mint-nft-with-file) 或 [easymint-url](https://docs.nftrainbow.xyz/api-reference/open-api/mints#mint-nft-with-metadata) 铸造NFT即可。

当简单铸造 NFT 时，背后做了如下工作

1. 上传文件到存储服务器生成文件URL
2. 创建 NFT Metadata 文件并生成 Metadata URI
3. 调用 Easy mint NFT 合约铸造NFT

恭喜！您的第一个NFT铸造成功！

## 定制化铸造 NFT

我们也提供了定制化方式铸造NFT，与简易铸造不同的是定制化铸造方式支持部署自己的NFT智能合约，在指定合约上铸币，并设置自定义的Metadata URI， 步骤如下：

1. 使用[部署API](https://docs.nftrainbow.xyz/api-reference/open-api/contract#deploy-contract)来部署一个单独的的合约
2. [创建自定义 Metadata 文件并上传](https://docs.nftrainbow.xyz/api-reference/open-api/metadata#create-nft-metadata)得到Metadata URI
3. 使用[定制化铸造NFT](https://docs.nftrainbow.xyz/api-reference/open-api/mints#mint-nft)铸造NFT，您需要提供
   * NFT 名称
   * NFT 描述
   * NFT Metadata URI
   * NFT 智能合约地址
   * NFT 铸造目标链
   * NFT 铸造目标地址

## 设置代付

其中有的区块链支持代付机制，代付指由代付方支付合约调用所花费的gas，合约调用方不需要付费。所以代付使您可以完全免费的去铸造NFT，铸造花费的gas将由代付方来支付。

当前支持代付的网络有conflux

* 使用 conflux test 网络时，可以通过[代付API](https://docs.nftrainbow.xyz/api-reference/open-api/contract#set-sponsor)或 [confluxscan](https://testnet.confluxscan.io/sponsor) 来申请代付
* 使用 conflux 网络时，您可以通过 [confluxscan](https://confluxscan.io/sponsor) 申请代付，当有大额需求时请联系 conflux 官方。


# Interactive Flowchart

## 项目方侧使用Rainbow服务的交互流程

项目方:

1. 注册账户
2. KYC
3. 创建APP
4. 登录APP
5. 上传文件，创建METADATA并上传
6. 部署合约
7. 为合约申请代付

用户:

1. 创建账户
2. Mint -> 项目方调用 NFT-Rainbow Mint

![流程图](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-5b006e1be56ef6203d1751e07ae13ce201429660%2Fcross_function.drawio.png?alt=media)


# By Community


# Account Solutions

NFTRainbow 的核心能力是 NFT 的创建和发行。目前并不提供区块链账户创建，托管等服务，主要是考虑到用户对区块链账户安全性的高要求，以及终端用户对钱包选择的多样性需求。 NFTRainbow 在服务设计时就考虑到了一点，并将服务设计的足够灵活和通用。项目方可以根据自身需求选择合适的账户解决方案。

根据账户私钥的存储方式不同，目前主要有两大类解决方案：

* 中心化账户托管
* 集成现有主流钱包

## 中心化托管

所谓中心化托管是指账户的创建，保存，使用均由项目方的中心化服务来负责实现。NFT 用户无需了解复杂的区块链新概念（私钥，助记词），直接使用手机号，邮箱等传统方式注册账户。项目方需要在用户注册账户时，帮用户同时创建区块链账户，并将两者关联起来。

此种方式的优点是用户使用简单，门槛低，体验好。缺点是项目方需要承担私钥的安全，且用户并不实际掌控资产的所有权，不够去中心化。

### 自行创建并托管

项目方可以自行创建账户，并将账户私钥保存在自己的数据库中。后续需要进行区块链交互时，只需获取账户私钥进行相应操作即可。

#### Conflux 账户创建示例

为方便项目快速集成，我们提供了主流开发语言的[账户创建示例代码](https://github.com/nft-rainbow/conflux-account-generate-example)，供项目方参考。包括：

* JavaScript
* Golang
* Java
* Python

项目方创建账户后，只需要将账户私钥，地址妥善保管起来，并同项目自身用户账户关联起来。后续需要进行区块链交互时，只需获取账户私钥进行相应操作即可。

### Rainbow 账户托管解决方案

Rainbow 也开发了账户托管解决方案，基于业界主流 TSS和 MPC 等技术保障私钥的安全。项目方可以直接使用 Rainbow 提供的账户接口创建或获取账户，无需关心私钥的安全问题。

目前支持通过手机号创建或获取账户，符合国内用户习惯，后续会支持邮箱等方式。

```shell
# 创建账户
curl --location 'https://api.nftrainbow.cn/v1/accounts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-JWT-KEY' \
--data '{
    "phone": "13011221111"
}'
```

关于接口调用详细文档，参看 [API 文档](https://docs.nftrainbow.xyz/api-reference/open-api)

## 集成主流钱包

另外一种方式是在 NFT 项目中集成现有主流钱包。用户在同项目交互时/前，需要先自行安装钱包并创建账户。然后再使用钱包账户同 NFT 应用交互（领取或转移NFT）。

此种方式的优缺点正好同托管方案相反。优点是用户实际掌控资产的所有权，去中心化。缺点是用户需要了解区块链新概念（私钥，助记词），使用门槛高，体验不好。

### Conflux

目前 Conflux 主流钱包有：

* [晒啦钱包(Cellar)](https://www.cellar.pub/)
* [AnyWeb](https://anyweb.cc/)
* [Fluent](https://fluentwallet.com/)

#### AnyWeb

AnyWeb 是一款强合规区块链资产钱包，统一认证及支付解决方案。它是一款 web2.5 钱包，由 AnyWeb 官方帮助用户创建账户，并使用TSS，MPC等技术保证用户私钥的安全。同时提供多种客户端包括微信小程序，H5，iOS，Android等。用户使用手机号即可注册，使用简单方便。

具体接入流程可[参考 AnyWeb 官方文档](https://wiki.anyweb.cc/)

#### Cellar

晒啦数字藏品管家, 基于主流区块公链藏品应用，聚合、收藏、展览等主流功能, 更好的管理自己的藏品和资源，安全、可靠、易用

#### Fluent

Fluent 是一款完全去中心化，浏览器插件钱包。用户通过 Fluent 创建的账户私钥，保存在用户本地，不会上传到任何服务器。同时支持 Chrome，Firefox，Edge等浏览器。用户需要通过助记词，私钥，Keystore等方式备份账户，并自行保证账户的安全。通过 Fluent 钱包创建的账户完全由用户自己掌控。

具体接入流程可[参考 Fluent 官方文档](https://docs.fluentwallet.com/)


# Guides


# 控制台合约代付设置

## 基本介绍

合约代付是Conflux独有的机制，项目方能够通过为合约设置代付与设置白名单，使得在白名单内用户能够在不使用自己的代币的同时完成与合约的交互。具体的代付概念可见[树图Contract Sponsor.](https://docs.nftrainbow.xyz/docs/shu-tu-contract-sponsor)

NFTRainbow提供了合约设置代付的接口，项目方在发布了自己的合约并为其设置代付后，其生态用户就可以铸造其自己的NFT，在这个角度上，能够推进项目的发展。

## 代付流程

项目方通过Rainbow发布NFT的费用将和接口调用数目挂钩。具体的价格，可见<https://docs.nftrainbow.xyz/docs/price>。为了支付这笔费用，项目方先要通过法币充值功能，为自己的账户充值，再设置代付。

### 充值

通过控制台右上角的`用户余额`进入充值页面。

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2FYqz1C6cNO9WifAUUK6rk%2Fimage.png?alt=media&amp;token=550ae64c-c377-44d4-b073-ff65d56f487f" alt=""><figcaption></figcaption></figure>

点击`充值`按钮，进入充值流程。目前Rainbow支持微信支付，后续还有开启其他法币充值渠道。

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2FWJoi14JXFu22bJrdf2Go%2Fimage.png?alt=media&amp;token=77858d2f-8a1d-47d6-aba2-295948894024" alt=""><figcaption></figcaption></figure>

输入充值的金额后，页面就会弹出支付二维码。通过微信扫码后并支付费用后，可用额度就会增加。

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2FUaVTKLRU3JozjF7jQ11o%2Fimage.png?alt=media&amp;token=a264b141-ed9b-4fd8-8ba8-c6f745df177f" alt=""><figcaption></figcaption></figure>

### 设置代付

项目方在充值完后，可以为合约设置代付。

点击`智能合约`页面的`设置树图代付`按钮，进入代付流程

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2FsoCBNmyB49O9PffwVtgd%2Fimage.png?alt=media&amp;token=0d05777f-776c-401a-9ce9-6c2f1c04f3f5" alt=""><figcaption></figcaption></figure>

可以看到，代付页面主要包含四个参数，分别为`合约地址`、`燃气数量`、`燃气上限`、`存储数量`。

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2F9O9IlNJZ9wHFRKwgAQYz%2Fimage.png?alt=media&amp;token=892f039c-c198-4960-a5d3-5b1059870406" alt=""><figcaption></figcaption></figure>

其中，`合约地址`是我们想要去赞助的合约，可以是项目方部署的合约，也可以是其他人的合约。若该合约是项目方通过Rainbow部署的，则在部署合约页面能够获取到合约地址

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2F4xveA5gGviNfLKeuoXKw%2Fimage.png?alt=media&amp;token=abfc9511-8e59-4048-9941-080fdc1ed1dd" alt=""><figcaption></figcaption></figure>

燃气是合约运行的燃料，合约的运行离不开燃气。设置代付需要对合约的`燃气数量`与`燃气上限`进行设置。燃气数量为项目方为该合约设置的燃气总数，用户调用该合约需要消耗对应的燃气数量，燃气上限为用户调用合约会消耗的燃气上限。

合约的代码与数据的存储需要消耗空间，这部分的数据将被上链。项目方需要为其付费。因此，`存储数量`也需要进行设置。

燃气数量与燃气上限及存储的详细介绍可以参考[树图Contract Sponsor.](https://docs.nftrainbow.xyz/docs/shu-tu-contract-sponsor)

`存储空间` 的单位为 KB。`燃气数量`、`燃气上限`的单位是 BL 与 GDrip。其中 BL 与 GDrip 的关系为 1BL=1000000000 GDrip (9个0)。另外, 燃气数量需大于 1000 \* 燃气上限值。

以721合约为例，一个NFT的铸造需要消耗0.6 KB空间，其中，燃气的消耗为20w GDrip。因此，在设置代付参数时，燃气上限建议值为 100w GDrip，燃气数量可以设为1-5 BL。对于存储数量，可以将其设为 NFT 的发行量 \* 0.6 KB。

在填入对应的数据后，点击`提交`，就能够实现对应的代付。代付的提交需要上链，因此中间需要几分钟的时间。

<figure><img src="https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2FraN3Ll9hnow671jykSrx%2Fimage.png?alt=media&amp;token=0e43f6d8-5db8-4518-9fad-8bfd1bc89e7d" alt=""><figcaption></figcaption></figure>

### 设置白名单

在为合约实现代付后，用户需要为白名单进行设置。若白名单内包括零地址，则意味着任何人都可以通过代付去调用该合约。具体的配置可以通过[Add Contract Sponsor Users接口](https://docs.nftrainbow.xyz/api-reference/open-api/contract)实现。

\[1] [Conflux存储介绍](https://forum.conflux.fun/t/conflux/11947)


# 元数据管理

Rainbow 控制台支持 NFT 元数据管理，包括 NFT 元数据上传、NFT 元数据查看等功能. 在这里可以查看 Rainbow 接口调用或 NFT 活动使用过程中产生的元数据信息. 也可以直接创建元数据以用于 NFT 铸造

通过点击 `MetadataId` 或 `下载` 按钮可以查看元数据的完整信息, 以及 url (浏览器地址框中的 url).

```txt
https://api.nftrainbow.cn/assets/metadata/1/nft/d2511cea559b14e324444a1a459d6b4a8497e1223b712a1dee6f32ea9e5281fc.json
```

该 url 可以在 NFT 铸造时使用, Rainbow 合约的藏品铸造页面多个地方可以直接使用该 url.

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-a2dae54d5d624d47378a6e2e7f50bfb5949d2748%2Frn-medata.jpg?alt=media)

点击 `添加` 按钮, 即可打开元数据创建弹窗, 输入必要信息及上传文件(或输入文件 url)后, 即可轻松创建一个 NFT 元数据. 必要信息包括:

1. 所属项目
2. 图片
3. 名字
4. 描述: NFT 介绍

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-d7aedff6457e45f8ff819f4fdc6ff20cc032b050%2Frn-metadata2.jpg?alt=media)

关于 NFT 元数据标准内容参看: [OpenSea 推荐](https://docs.opensea.io/docs/metadata-standards)


# Rainbow 铸造工具简介

Rainbow 在 Console 端提供了一些常用的 NFT 铸造工具, 包括:

* 单个铸造
* 批量铸造
* 按序铸造

可以满足大部分的非编程铸造需求.

铸造工具的入口在`智能合约`页面, 如果你还没有`部署合约` 需要先点击 `部署合约`按钮部署一个, 待合约部署交易上链执行成功之后, 刷新即可看到该合约. 在每个合约的右侧有一个 `铸造 NFT` 链接, 点击即可进入到铸造工具页面.

注意: 合约需要`设置好代付`或开启`代付自动设置功能`才能进行 NFT 铸造, 具体参看[代付操作说明](/tutorials/guides/kong-zhi-tai-he-yue-dai-fu-she-zhi)

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-93e61e5421c13ff8cf8402c34aa984e1d7f9dfd5%2Frn-contracts.jpg?alt=media)

## 单个铸造

单个铸造适用于直接上传图片并编辑 NFT 信息然后直接铸造 NFT 至指定 Web3 账户, 同时也支持直接使用`元数据 uri`进行铸造.

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-1e0bc4d313a3b0d61b1076f3b5cee87b61d2d8f4%2Frn-mint-1.jpg?alt=media)

铸造任务提交后, Rainbow 后台会自动做上链处理, 铸造状态可在 `铸造历史`页面查看

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-eea5c10ad4c7ee9b6256e1ea233626c85aa69003%2Frn-mint-3.jpg?alt=media)

## 按序铸造

按序铸造可实现一次铸造多个 NFT, 且保证 NFT 的 TokenId 按序递增. 铸造 NFT 的元数据 url 需要提前准备好(可以使用 Rainbow 的元数据管理工具). 铸造流程如下:

1. 下载铸造任务模板文件.
2. 编辑文件, 设置铸造任务
3. 提交
4. 在铸造历史查看

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-416afd41a79295115522a7832b7a680d9f1b30cd%2Frn-mint-2.jpg?alt=media)

### 任务模板

铸造任务文件, 一行即是一个铸造任务.

1. Address: NFT 的接受账户, 通常为 Web3 地址, 也可以填手机号(会发送至手机号对应的晒啦钱包)
2. MetadataUri: NFT metadata uri 链接, 该 url 也支持模版字符串如 <https://a.com/{id}.json>
3. TokenId(可选): 指定 NFT 的 ID, 不填的话, 自动递增.

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b4b74d3224cc656fc337e3cac46a50bf5af44b17%2Frn-mint-4.jpg?alt=media)

### FAQs

1. 按序铸造一次性可以铸造多少 NFT?

5000

2. 文件提交后如何查看铸造结果?

可在`铸造历史`页面查看铸造状态


# Rainbow Activity

Rainbow Activity 方便项目方发行活动纪念或奖章类 NFT（如 POAP），并提供统一的领取页面。控制台入口：[NFTRainbow Console](https://console.nftrainbow.cn)。

## 准备工作

创建活动前，请先完成以下步骤：

1. 注册并登录 [NFTRainbow 控制台](https://console.nftrainbow.cn)
2. 在右上角提交实名信息，等待审核通过
3. 创建项目并部署合约
4. 为合约设置代付：需先在右上角完成充值。单个 NFT 存储消耗约 `0.6–0.7 CFX`，建议按发行量预留（例如 100 个 NFT 可设置约 `70 CFX` 代付）。详见 [控制台合约代付设置](/tutorials/guides/kong-zhi-tai-he-yue-dai-fu-she-zhi)

## 项目方：创建活动并发放链接

1. 在 NFT 活动页面，点击 `创建活动/创建POAP`

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-a3155e6101939e9f930eca86e6d9feff447c661f%2Frn-activity-create.png?alt=media)

2. 填写活动详情（名称、说明、徽章图片等）

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-65da1a3d83cd2004a62f50a0a57db21287c5a944%2Frn-activity-details.png?alt=media)

3. 点击 `管理藏品`

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-bf0670d0af3b513507d1756eedd125ae69872c24%2Frn-activity-manage-items.png?alt=media)

4. 绑定已部署的合约（合约需已完成代付设置）

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-0d72146a30a96d4f0eedbd03c07602e166b0bc31%2Frn-activity-bind-contract.png?alt=media)

5. 保存后返回活动列表，点击活动链接即可打开领取页面，可将该链接发给用户

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-e4a487302f3ec115686be35244c9e760419a047b%2Frn-activity-link.png?alt=media)

## 用户：领取 NFT

1. 用户通过活动链接进入领取页面

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-f72cb63e51d62e6d391740702be7d61bdeff8f10%2Frn-activity-claim-page.png?alt=media)

2. 点击 `连接钱包`，输入手机号码登录

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-c225287c9c1dee43043c091de3efa2d78a98a116%2Frn-activity-phone-login.png?alt=media)

3. 授权账户

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-77396517ce541fd044dfd24463351bbf68cb58df%2Frn-activity-authorize.png?alt=media)

4. 右上角显示钱包已连接后，点击 `领取` 按钮领取 NFT

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-d05b287f294cb668a536c7d1b4247d6532859119%2Frn-activity-claim.png?alt=media)

5. 等待数十秒，领取完成后点击去钱包查看

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-9e3cc54fbb79a076f5874d252ced6cf9eb08230e%2Frn-activity-claim-success.png?alt=media)

6. 登录晒啦钱包，即可看到刚领取的 NFT

![](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-87c530c6ade8552ea6ee976daf43917df109ce27%2Frn-activity-wallet-nft.png?alt=media)


# FAQs

## 目前 NFTRainbow 支持哪些链?

* 树图链

将来计划会支持：

* 主流EVM 兼容链

## 如何获取访问 API 的 AppSecret ？

注册 [NFTRainbow 平台账号](https://console.nftrainbow.xyz/)，并填写用户实名信息，官方审核通过后，可创建自己的应用，从应用详情管理页面获取 AppId 和 AppSecret。

## AppId, AppSecret 调用登录接口失败？

返回错误 ”KYC required“, 是因为未填写实名信息，填写完成通过审核后才可能访问接口。

## 如何收费的？

收费规则[参看详情](/docs/price)

## 树图链如何给合约设置代付？

在 NFTRainbow 控制台，`智能合约页面` 有树图代付设置入口，该功能可用于给合约设置代付，测试网免费设置，主网需要按量收取费用

## 为什么 Mint 接口调用后，接口返回的数据中没有 tokenId，哈希等信息？

当前 NFTRainbow 所有的上链操作都是异步进行的，接口调用后无法立刻获取 tokenId，可使用 Mint 详情接口，查看藏品铸造状态。 成功上链后可以获取藏品铸造的 TokenId，哈希等信息。失败的会会返回失败的原因。

## 我是一个 Web2 平台或应用，藏品铸造时目标账号怎么获取？

目前藏品铸造地址为所选择区块链的账户地址，账户需要由应用自己创建托管，或使用托管类的钱包服务产品如 [Anyweb](https://anyweb.cc/)，当然也可以使用完全去中心化钱包账户地址。

未来 NFTRainbow 也会提供账号解决方案，届时将可直接使用手机号邮箱等作为接受账号。

## NFTRainbow 的产品资源是存放于什么地方？

我们提供多种存储方式选择比如：云对象存储服务，云服务器，IPFS 等，用户可根据自己的产品或应用选择。

## 自定义 Mint 功能，mint 的 token id 为什么不连续？

CustomMint 接口，支持参数指定 tokenId，若不指定则会随机生成；接口调用方可根据自身需求控制 tokenId 自增，从而实现连续。

## NFT 支持的文件格式有哪些？

目前支持 图片，视频，音频 三大类文件，具体支持的格式如下：

* 图片：.ico .svg .tif .tiff .jpg, .jpeg, .png, .gif, .bmp, .webp
* 视频：.mp4, .avi .mpeg .ogv .ts .webm .3gp .2gp
* 音频：.aac .mid .midi .mp3 .oga .opus .wav .weba .cda

## Easy Mint 跟自定义 Mint 的区别？

Easy mint 主要作用是方便 Rainbow 用户快速体验铸造功能，直接使用事先部署好的合约进行铸造。此种方式用户无需部署合约，因此操作比较简单。`但此种方式铸造的 NFT 无法通过转移接口转移`。

自定义 Mint 是用户自己部署合约，然后使用自定义 Mint 接口进行铸造。此种方式用户需要部署合约，因此操作比较复杂。但此种方式铸造的 NFT 可以通过转移接口转移。

## ERC721 和 ERC1155 的区别？

ERC721 是最初的 NFT 标准，每个 NFT 都是唯一，不可替代的。每个 NFT 都有唯一的 tokenId，且只有一个，不可分割。

ERC1155 是多代币标准，一个合约中可以有多种 NFT，每种 NFT 可以有多个。TokenId 相同的 NFT 之间是等价的。

## 文件上传的大小限制？

目前文件大小限制为 10M


# Changelog

## 2023.1.1

1. 接入微信支付
2. 正式开启服务商用
3. 控制台增加自助代付设置功能

## 2022.8.24

拓展 API 接口和合约能力：

### 合约功能扩展

1. 支持 ERC-2981
2. 合约支持可配置：burn，transfer
3. 支持 NFT metadata 可更新
4. 采用 Minimal proxy 模式，优化 NFT Factory 合约

### API

1. 增加 Contract，NFT 详情接口
2. 增加支持 NFT 转移接口
3. 增加 NFT 批量铸造，转移接口

### DiscorBot

基于 NFTRainbow 服务开发一款 [DiscordBot](https://github.com/nft-rainbow/discordBot)，可用于社区 NFT 空投，抽奖等活动，方便社区运营者，提高社区活跃度。

未来该机器人会不断扩展功能，支持活动规则自定义；优化使用体验；拓展适用平台，包括 Telegram，DoDo，Fanbook 等。

## 2022.8.1

完成核心功能开发上线，包括：

1. 实现 NFTRainbow 基础功能：EasyMint，合约部署，资源托管，自定义 Mint，数据查询等 API
2. 核心模块交易上链模块，支持树图链
3. 控制台管理端开发

## 2022.9.6

1. 修改了metadata, transfers, mints的response与parameters的字段
2. 将transfer改为了transfers


# RoadMap

## Stage 2

1. 接入法币支付 ✅
2. 支持树图链存储抵押购买 ✅
3. 支持藏品 Collection 发行
4. 开发 Discord NFT 领取机器人产品

## Stage 3

1. 支持 IPFS
2. 支持其他 EVM 兼容链
3. 提供 NFT 数据查询接口

## Stage 4

1. 提升服务的稳定性和性能
2. 提供 web2 + web3 账号解决方案


# Conflux Sponsor

在像以太坊与Conflux这样的公链中，用户与合约的交互当中，`gas`是避不开的一个问题。该机制为网络对抗DoS攻击等问题提供了保障。然而，该机制也提高了用户理解与合约交互的门槛，从而在一定程度上为项目方推进项目设置了障碍。若是存在项目方为用户与合约进行交互买单的行为，web2用户接触将更加容易接触web3项目，这将为项目方推进web3项目提供便利。

Conflux的gas机制与以太坊或绝大部分的公链基本一致，合约的部署与调用都是需要去消耗`gas`（燃气费），EVM中的每一次操作都是需要`gas`作为燃料来推动的，合约越复杂，所需要的gas也越高。用户可以对gasPrice进行配置，从而可以让自己的交易更快被打包。用户对gasLimit的配置也可以防止合约陷入死循环或是发生一些其他的异常情况。用户支付gas费所支付的费用，将被分配给矿工。

在Conflux中引入了[Collateral for storage（简称CFS）机制](https://segmentfault.com/a/1190000041282025), 作为使用存储的定价方式，相比Ethereum中的一次性存储费用，CFS机制会更加公平合理。这种机制需要锁定一笔资金，作为占用存储空间的抵押物。在相应的存储空间被释放或被他人覆盖前，抵押物都会被锁定，而被锁定的抵押物所产生的相应利息会直接分配给矿工，用于存储空间的维护。因此，Conflux的存储成本也取决于空间占用的时间长短。

Conflux中的`SponsorWhitelistControl`内置合约为合约的代付提供了可能。基于该内置合约，若项目方是合约的admin，他只需完成以下的步骤，则可以为自己的合约设置代付：

1. 项目方需要为合约的gas与collateral代付进行配置，该配置包括对应的代付的上限与用于代付的代币数量。
2. 项目方将允许代付的用户加入sponsor白名单。若是希望任何用户都可以调用该合约的话，则需要将零地址（0x0000000000000000000000000000000000000000）加入该白名单当中。
3. 若是项目方为合约代付寄存的代币不够了，需要及时补充。

{% hint style="info" %}
设置代付时，gas 代付的金额需要大于等于代付的上限 \* 1000
{% endhint %}

项目方只需通过为该合约进行设置代付，代付白名单中的用户在调用该合约时，可以不消耗自己的代币实现与合约的交互。

{% embed url="<https://developer.confluxnetwork.org/conflux-rust/internal_contract/internal_contract/#sponsorwhitelistcontrol-contract>" %}

## FAQs

### 哪一些角色可以去对合约的白名单或是赞助进行配置呢？

设置赞助不设要求，白名单需要合约的admin去进行配置

### 如何去换合约的赞助方呢？

更换合约的赞助方需要调用`setSponsorForGas(address contractAddr, uint upperBound)`

另外需要注意的是：

* 向`SponsorWhitelistControl` 合约转账的金额需要比当前的`sponsor_balance_for_gas` 高
* 新的gas上限需要大于等于旧的gas上限，除非旧的gas上限不够去调用合约
* 向`SponsorWhitelistControl` 合约，新转账的金额需要大于等于limit的1000倍


# Terminology

* **非同质化代币 (NFT):** 与比特币，以太坊这类同质化代币相对的，NFT是一类非同质化代币，每一个代币都是独一无二的存在。基于这样的特性，非同质化代币一般被用于数字藏品的发行。该NFT可作为数字藏品的唯一凭证，在保护其数字版权的基础上，实现真实可信的数字化发行、购买、收藏和使用。
* **智能合约：**&#x8FD0;行在区块链上的代码。需要用户进行部署后，才能运行在区块链上，用户可以按编码规则对其进行编码，从而实现对应的业务逻辑。
* **交易：**&#x5408;约的部署与NFT的发行都需要上链，对应的数据需要转为交易的格式，才能被区块链接受并上链。
* **燃气：**&#x8D26;户调用合约执行合约逻辑需要花费一定的燃气。燃气可以看作是合约执行的动力来源。账户需要为燃气的消耗支付燃气费。
* **存储：**&#x533A;块链上的合约存储需要对应的空间，这部分空间用户需要为其买单。在Conflux中，存储押金的费用是每 `1024` 字节 `1` CFX。由于每个条目占用 `64` 字节，因此，每个条目的押金费用就是 `1/16` CFX. 每笔交易执行期间，新产生的押金费用会在交易执行结束的时统一收取。
* **ERC-721：**&#x45;RC-721是NFT的标准接口，广泛应用在数字藏品领域。该协议能够轻易实现数字藏品溯源，数字藏品的转移等其他功能。部署ERC721合约需要代币的名称、符号和 tokenURI。
* **ERC-1155：**&#x45;RC-1155在一定程度上融合了ERC-20和ERC-721的功能。其主要用途包括了发行同质化代币和非同质化代币。同质化代币即能像ERC-20一样发布各样的代币类型；另外，ERC-1155标准更是能够发行NFT，且能基于一个合约同时发行多个NFT。
* **Sponsor：**&#x53;ponsor机制为Conflux特有的代付机制。项目方通过为合约设置代付与白名单，可以使得白名单内的用户在不花费自身代币的基础上实现与合约的交互。
* **元数据：**&#x5143;数据（Metadata）是所有 NFT 合约的重要组成部分，每个代币都有数据可供应用检索并用于显示 NFT 的内容。例如，视频 NFT 的元数据将是视频的长度和构成其各个帧的图像。个人资料图片 (PFP​​) 或数字艺术 NFT 的元数据将是特定的生成属性，它将定义 NFT 的稀有程度。元数据以json文件的形式存储在链下。
* **TokenURI：**&#x6BCF;一个NFT都会有自己独一无二的tokenurI，该URI是一个链接，指向了一个json。该json中包含了元数据。
* **账户地址：**&#x7528;户在区块链中都有一个自己的账户，该账户中保存着用户的token以及交易记录。该账户由一个独一无二的地址来进行表征，基于用户的助记词，通过密码学方法来进行生成。
* **POAP：**&#x50;OAP 是英文单词 Proof of Attendance Protocol（出勤证明协议）的首字母缩写，是一个以 ERC-721 为标准，由以太坊开发者社区构建的开源协议。POAP 旨在创造一种可靠的记录生活经历的新方式。只要活动方支持 POAP，POAP 收集者就可以在参加活动后，获得一个区块链上的独特徽章作为纪念。


# Prices

NFTRainbow 从 `2023.1.1` 开始正式商用，收费方式如下:

## 区块链上链费用

### Conflux 树图区块链

树图区块链支持为合约设置上链费用赞助，设置赞助后所有与合约的交互费用将由赞助商承担，通常情况下，赞助费用由 NFT 发行方承担，NFT 持有者可以免费转移 NFT。

Rainbow 对树图`每单位上链费用`定价为 `0.8 元`。

树图链 NFT 铸造消耗量:

| 接口/操作   | 消耗量(KB) |
| ------- | ------- |
| 721 铸造  | 0.6-0.7 |
| 1155 铸造 | 0.8-0.9 |

## Rainbow 服务费用

| 接口/操作 | 单价(元) | 每月免费次数 |
| ----- | ----- | ------ |
| 合约部署  | 5     | 2      |
| 铸造操作  | 0.1   | 50     |
| 其他接口  | 0.001 | 50000  |

## 实例说明

以 721 铸造为例，假设 NFT 发行方需要铸造 1000 个 NFT:

1. 合约部署费用 5 元
2. NFT 铸造费用 (0.6 \* 0.8 + 0.1) \* 1000 = 580 元
3. 其他接口调用费用根据实际情况计算：访问 1000 次，每次 0.001 元，总计 1 元

## FAQs

### 1. 测试网合约部署，NFT铸造收费么？

测试网不收费，免费使用


# Conflux RPC Bridge

## 简介

Conflux 是一个采用创新树图结构的高性能公链，但其原生空间（Core Space）的 RPC，与以太坊不兼容，由一组专有的 RPC 方法组成，并且账户地址格式也不同。由此导致以太坊生态的大部分开发工具，SDK，服务无法直接使用，大大增加的开发者学习成本，及项目迁移成本。为解决此问题 [Conflux RPC Bridge](https://github.com/conflux-fans/rpc-bridge) 服务应孕而生，该服务可将 Conflux 的大部分方法映射为以太坊的 RPC 方法，最终目标是使得开发者可以直接使用以太坊的开发工具，SDK，服务与 Conflux Core 空间交互。

## Rainbow RPC Bridge Service

NFTRainbow 使用开源代码，搭建了一套公共的 Conflux RPC Bridge 服务，供开发者使用：

| 网络(Chain ID) | 地址                                  |
| ------------ | ----------------------------------- |
| 主网(1029)     | <https://cfx2eth.nftrainbow.cn>     |
| 测试网(1)       | <https://cfx2ethtest.nftrainbow.cn> |

## 兼容性

目前该服务实现了以太坊核心 RPC 方法的适配，但并不完全兼容，具体兼容性查看 [RPC-bridge 服务兼容性介绍](https://github.com/conflux-fans/rpc-bridge#methods)

### 地址说明

Conflux 使用 base32 编码的地址，而以太坊使用 hex40 地址，两者可以互相转换，Conflux 各语言的 SDK 都提供了地址转换的方法，ConfluxScan 也提供了[地址转换工具](https://confluxscan.net/address-converter)。

> 另外需要注意的是 Conflux 地址转换为 hex40 格式后，前缀只有 `0x1`, `0x8` 两种，其他前缀的地址都不是合法的 Conflux 地址。使用 RPC Bridge 服务接收资产时，一定要注意地址的前缀，确定是合法有效地址。

> 通过私钥计算地址时，请使用 Conflux 的 SDK，以太坊生态 SDK 或工具生成的地址，可能不是 Conflux 的合法地址。

### eth\_sendRawTransaction

RPC Bridge 服务，直接将 `eth_sendRawTransaction` 方法适配为了 `cfx_sendRawTransaction`。但 [Conflux Core 交易的字段以及编码签名方式](https://developer.confluxnetwork.org/sending-tx/en/transaction_explain)与以太坊不同，因此以太坊原生 SDK，工具，钱包等构造的交易无法使用本服务发送。需要配合 Conflux 定制化的签名模块使用。

## 使用场景

### 使用 TheGraph 索引 Conflux Core 数据

TheGraph 是一个开源的以太坊链上数据索引服务和工具。目前 RPC-Bridge 支持使用 graph-node 索引 Conflux Core 合约数据：

1. 需要自建 graph-node 服务，并将 ethereum RPC 配置为 RPC Bridge 服务地址。
2. 将 Conflux Core 合约地址转换为 hex40 格式，修改子图 subgraph.yaml 文件中的合约地址。

### 使用 web3.py|brownie + conflux-web3py-signer 与 Core 交互

[conflux-web3py-signer](https://github.com/conflux-fans/conflux-web3py-signer) 是一个专门为 web3.py 开发的 Conflux 交易签名插件，与 web3.py 或 brownie 配合使用，可通过 RPC Bridge 服务与 Conflux Core 交互。

### web3.js

RPC Bridge 服务可支持 web3.js 读取 Conflux Core 数据，但不支持 web3.js 发送交易。交易的发送需要使用 Conflux 定制化的签名插件，目前开发中。

### ethers.js

RPC Bridge 服务可支持 ethers.js 读取 Conflux Core 数据，但不支持 web3.js 发送交易。交易的发送需要使用 Conflux 定制化的签名插件，目前开发中。

### Truffle

理论上 truffle 配合 Conflux 专门的交易签名模块，通过 RPC Bridge 服务也可进行 Conflux Core 的合约应用开发。当目前还在开发当中。

## FAQs

### 该服务地址能直接添加到 MetaMask 网络中么？

不行，因为 Conflux Core 的交易签名算法与以太坊不同，MetaMask 无法直接使用。

### 该服务收费么？

目前不收费，免费对外提供，但是后续可能会收费。


# ERC-6551

ERC-6551 是一个全新的以太坊标准，它可以为`任意的 721 NFT` 创建一个绑定的`合约账户(TBA)`，该账户只有 NFT 的所有者可以控制，该账户与普通账户无异，可以存放任何链上资产。

6551 标准可以极大扩展 NFT 的可组合性, 及功能性。从而极大的扩展 NFT 的应用场景。

## Rainbow 增加对 ERC-6551 的支持

Rainbow 增加了对 Conflux Core 上的 ERC-6551 的支持，部署了第一个 `ERC-6551 Registry 合约`及 `Account Impl 合约`。任何人可以直接与该合约交互为任意的 NFT 创建 TBA，从而为自身应用增加更多的功能。

同时 Rainbow 提供了 **RESTful Open API 供开发者来以接口调用的方式创建和获取 TBA**。对于非开发者账户，Rainbow 将会在 **Console 提供可视化的界面来创建和管理 TBA**。

我们也会持续开发更多的工具(SDK)来帮助开发者，应用，场景更好的使用 ERC-6551。从而打造一个完善的 ERC-6551 生态。

将来 Rainbow 会将 ERC-6551 的支持扩展到 eSpace 甚至其他 EVM 区块链上。

### 部署地址

#### 树图主网

* ERC6551AdminSafeRegistry: `cfx:ach1zpmjyv17arzdjx9fgbt4cw6uns0ntuwre8sdsy`
* ERC6551AccountUpgradeableImpl: `cfx:acd9jgz4d5as156ef08r5mdgux28y51yz639nr5s78`

[合约源码](https://github.com/conflux-fans/erc6551-conflux-reference)

#### 树图测试网

TODO

## 常见应用场景

### 投资组合

创建动态的 NFT 甚至包括 20 资产的投资组合， 该投资组合内的资产可以随时变化， 也可以整体打包转移。

### 高价值 NFT 资产扩张

高价值 NFT 可作为身份象征，不短增加其他标签 NFT 或用于领取空投。

## FAQs

## 资源

1. [Official Site](https://tokenbound.org/)
2. [ERC-6551 Twitter](https://twitter.com/erc6551)
3. [ERC-6551 Telegram](https://t.co/pa9JFwgd56)
4. [Github](https://github.com/tokenbound)
5. [An Overview on ERC 6551](https://www.lcx.com/an-overview-on-erc-6551/)
6. [ERC-6551 详解](https://github.com/nft-rainbow/rainbow-doc/blob/main/docs/ERC-6551.pdf)


# Web3 Services

## 简介

NFTRainbow 致力于推动 Web3 在各行各业应用, 简化 Web3 开发流程和体验. 为此我们不止提供 NFT 铸造相关服务, 还提供了一系列 Web3 服务, 来帮助开发者快速搭建 Web3 应用. 包括:

* 区块链 RPC 服务
* 区块链数据索引服务

以上服务都同时包含 Conflux Core 空间和 eSpace 空间, 并且同时支持主网和测试网.

## RPC 服务

NFTRainbow 自研了整套的 RPC 服务基础设施. 能够提供稳定可靠的 RPC 服务, 开发者无需自己搭建节点, 从而省去巨量的运维工作, 并专心开发应用. NFTRainbow RPC 服务具有以下优势:

* 节点自动扩容, 自动升级
* 完善的数据监控, 保证数据的实时性
* 基于 IP hash 路由, 保证数据一致性

### 定价

Rainbow RPC 服务提供灵活且有竞争力的定价方案, 不仅提供免费版服务, 还提供多档可选套餐. 除此之外还提供加油包模式, 能满足多种类型客户需求.

套餐定价如下:

| 套餐    | 请求量       | QPS     | 价格       |
| ----- | --------- | ------- | -------- |
| 免费套餐  | 10w 次/天   | 50 R/S  | free     |
| 基础套餐  | 20w 次/天   | 100 R/S | 100 元/月  |
| VIP套餐 | 110w 次/天  | 100 R/S | 1000 元/月 |
| 企业套餐  | 1000w 次/天 | 500 R/S | 5000 元/月 |

加油包定价如下:

| 加油包   | 请求量     | 价格    |
| ----- | ------- | ----- |
| 加油包 1 | 300w 次  | 200 元 |
| 加油包 2 | 1000w 次 | 500 元 |

加油包请求次数不限制使用时间.

* [Conflux Core RPC 文档](https://doc.confluxnetwork.org/docs/core/build/json-rpc/json_rpc)
* [Conflux eSpace RPC 文档](https://ethereum.org/en/developers/docs/apis/json-rpc/)

## 区块链数据索引服务

区块链数据索引服务可对区块链历史数据进行索引并提供查询服务, 例如 NFT 转移历史, 账户 NFT 资产列表等, 目前该服务接口同 Scan API 完全兼容, 方便用户迁移.

套餐定价如下:

| 套餐    | 请求量      | QPS     | 价格       |
| ----- | -------- | ------- | -------- |
| 免费套餐  | 10w 次/天  | 5 R/S   | free     |
| 基础套餐  | 20w 次/天  | 10 R/S  | 100 元/月  |
| VIP套餐 | 50w 次/天  | 20 R/S  | 1000 元/月 |
| 企业套餐  | 500w 次/天 | 100 R/S | 5000 元/月 |

加油包定价如下:

| 加油包   | 请求量    | 价格    |
| ----- | ------ | ----- |
| 加油包 1 | 200w 次 | 200 元 |
| 加油包 2 | 600w 次 | 500 元 |

加油包请求次数不限制使用时间.

接口详细文档 可参看 Scan 相关文档:

* [Conflux Core Scan API](https://api.confluxscan.net/doc)
* [Conflux eSpace Scan API](https://evmapi.confluxscan.net/doc)

## FAQs

### 如何获取服务访问 url 及 key?

可在 Rainbow Console 控制台的`Web3服务页面`查看或创建应用, 每个应用会分配一个访问 Web3 Service 的 key, 在应用详情可查看此 key, 及完整的服务 url

### 如何购买服务?

在 Console 控制台 `Web3服务 -> 我的服务` 页面, 有购买服务的入口, 点击后即可进入购买页面. 在购买页面可切用户当前的服务套餐, 也可购买加油包

### 套餐升级后, 还可以降级回来么?

可以的, 可以取消自动续订功能, 套餐到期后自动切换为免费版, 也可以直接进行套餐切换操作, 切换后立刻生效, 但不会返还费用.

### 套餐的额度是多个项目共用的么?

是的

### Web3服务中的`项目列表`跟我的项目中的`项目列表`是一样的么?

是的, 两者共用一套数据, 在不用的页面查看不同的项目信息

### 关于 burst


# Open-API

Open-APIs help users to create NFTs easily

Rainbow Open API 由多组 API 组成，可以帮助用户轻松创建 NFT。包括:

1. 登录
2. 合约部署
3. 元数据管理
4. NFT 创建, 转移, 销毁
5. 合约代付


# Login

Rainbow-APIs is based on JWT. In order to use the open APIs, login APIs provide us entries to get the JWT.

## Login actions

Login actions provide users the entries to call the open APIs including [Metadata](/api-reference/open-api/metadata), [Mints](/api-reference/open-api/mints), [Contract](/api-reference/open-api/contract), [Files](/api-reference/open-api/files).

### App Login

`APP login` API helps users to get the JWT according to `app_id` and `app_secret`. JWT can be used to access other open APIs.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/login" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>app_id</td><td>The id of the app</td><td>body</td><td>string</td><td>true</td></tr><tr><td>app_secret</td><td>The secret of the app</td><td>body</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "app_id": "qUUcdueA",
    "app_secret": "zGCaP8kAFEmwanqo"
}
```

{% endtab %}

{% tab title="Response" %}
The returned result can be used to access other OPEN-APIs

| Name         | Meaning          | Type   |
| ------------ | ---------------- | ------ |
| token        | JWT token        | String |
| expire       | The expired time | String |
| {% endtab %} |                  |        |

{% tab title="Response Example" %}

```
{
    "expire": "2022-08-31T15:54:04.2046805+08:00",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjE5MzI0NDQsImlkIjozLCJvcmlnX2lhdCI6MTY1OTM0MDQ0NH0.BLkzyiQzxlljYLj5Gjjqjnd4fFm1GdoEduaVrVlU_Tw"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/login \
  --header 'Content-Type: application/json' \
  --data-raw `{
    "app_id": "qUUcdueA",
    "app_secret": "zGCaP8kAFEmwanqo"
}`
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note:** Each JWT is valid to call open APIs for one hour. Once the JWT is expired, users have to call [Refresh JWT](#refresh_token) to get the new JWT.
{% endhint %}

### Refresh JWT

`Refresh JWT` API helps users to get a new JWT of the specified app.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/refresh\_token" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Response" %}

| Name         | Meaning          | Type   |
| ------------ | ---------------- | ------ |
| token        | JWT token        | String |
| expire       | The expired time | String |
| {% endtab %} |                  |        |

{% tab title="Response Example" %}

```
{
    "expire": "2022-08-31T15:54:04.2046805+08:00",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjE5MzI0NDQsImlkIjozLCJvcmlnX2lhdCI6MTY1OTM0MDQ0NH0.BLkzyiQzxlljYLj5Gjjqjnd4fFm1GdoEduaVrVlU_Tw"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/refresh_token \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Note: Each JWT is valid to call [Refresh JWT](#refresh_token) for five hours. Once the JWT is expired, users have to call [App Login](#login) to get JWT agian.
{% endhint %}


# Files

The files APIs provide users to make preparations for creating NFTs including uploading files and the corresponding query functions.

### Upload File

`Upload file` API helps users to upload a file to get the corresponding url for creating NFT metadata. The file can be a video, a figure and so on.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/files/" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>file</td><td>uploaded file</td><td>multipart/form-data</td><td></td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Responses" %}

| Name         | Meaning                      | Type    |
| ------------ | ---------------------------- | ------- |
| file\_name   | The name of the uploaed file | string  |
| file\_size   | The size of the uploaed file | integer |
| file\_type   | The type of the uploaed file | string  |
| file\_url    | The url of the uploaed file  | string  |
| {% endtab %} |                              |         |

{% tab title="Response Example" %}

```
{
  "file_url": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg",
  "file_size": 11295,
  "file_type": "jpeg",
  "file_name": "67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/files/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: multipart/form-data' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form file=
```

{% endtab %}
{% endtabs %}

### Upload File to OSS

OSS is a storage service provided by Alibaba. Users can choose to upload the files to OSS storage. `Upload file to OSS` API helps users to achieve the target. The file can be a video, a figure and so on.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/files/oss" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>file</td><td>uploaded file</td><td>multipart/form-data</td><td></td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Responses" %}

| Name         | Meaning                      | Type    |
| ------------ | ---------------------------- | ------- |
| file\_name   | The name of the uploaed file | string  |
| file\_size   | The size of the uploaed file | integer |
| file\_type   | The type of the uploaed file | string  |
| file\_url    | The url of the uploaed file  | string  |
| {% endtab %} |                              |         |

{% tab title="Response Example" %}

```
{
    "file_url": "https://nft-rainbow.oss-cn-hangzhou.aliyuncs.com/file/4/nft/377d21aaeddfff1f4f1fa73498df70a462945bb06f5a984358202cec0682c4d2.jpeg",
    "file_size": 11295,
    "file_type": "jpeg",
    "file_name": "377d21aaeddfff1f4f1fa73498df70a462945bb06f5a984358202cec0682c4d2"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/files/oss \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: multipart/form-data' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form file=
```

{% endtab %}
{% endtabs %}

### Upload File List

`Upload File List` API helps users to upload a folder to the server. The files can be a video, a figure and so on.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/files/folder" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>folder</td><td>uploaded files</td><td>multipart/form-data</td><td></td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Responses" %}

| Name         | Meaning                        | Type    |
| ------------ | ------------------------------ | ------- |
| file\_num    | The number of the uploaed file | integer |
| folder\_url  | The url of the uploaed folder  | string  |
| {% endtab %} |                                |         |

{% tab title="Response Example" %}

```
{
    "folder_url": "http://dev.nftrainbow/assets/file/1/nft/e7201e566e70819f09842fba3972c9f0de24d3e57ea667a7b4e3b881d1f4c6fd",
    "file_num": 5
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/files/folder \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: multipart/form-data' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form file=
```

{% endtab %}
{% endtabs %}

### Upload File List To OSS

`Upload File List To OSS` API helps users to upload a folder to oss. The files in this folder can be a video, a figure and so on.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/files/folder/oss" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>folder</td><td>uploaded files</td><td>multipart/form-data</td><td></td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Responses" %}

| Name         | Meaning                        | Type    |
| ------------ | ------------------------------ | ------- |
| file\_num    | The number of the uploaed file | integer |
| folder\_url  | The url of the uploaed folder  | string  |
| {% endtab %} |                                |         |

{% tab title="Response Example" %}

```
{
    "folder_url": "https://nft-rainbow.oss-cn-hangzhou.aliyuncs.com/file/4/nft/377d21aaeddfff1f4f1fa73498df70a462945bb06f5a984358202cec0682c4d2",
    "file_num": 5
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/files/folder/oss \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: multipart/form-data' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form file=
```

{% endtab %}
{% endtabs %}

### Obtain File List

`Obtain file list` API helps users to obtain the list including the inforamion of the files uploaded in the specified app. The information of each file contains `file_url`, `file_size`, `file_type` and `file_name`.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/files/" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>page</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>limit</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>10</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name  | Meaning                          | Type           |
| ----- | -------------------------------- | -------------- |
| count | The number of the uploaded files | integer        |
| items | The files information            | \[]ExposedFile |

The **`ExposedFile`** struct is lised as follow:

| Name         | Meaning                      | Type    |
| ------------ | ---------------------------- | ------- |
| file\_name   | The name of the uploaed file | string  |
| file\_size   | The size of the uploaed file | integer |
| file\_type   | The type of the uploaed file | string  |
| file\_url    | The url of the uploaed file  | string  |
| {% endtab %} |                              |         |

{% tab title="Response Example" %}

```
{
        "count": 3,
        "items": [
            {
                "file_url": "http://dev.nftrainbow/assets/file/2/nft/fa6f733c258e3a0f364aeb18198c9e2bae2e2c91bee4d38a1c88fb9cc8a71a1b.jpeg",
                "file_size": 11295,
                "file_type": "jpeg",
                "file_name": "fa6f733c258e3a0f364aeb18198c9e2bae2e2c91bee4d38a1c88fb9cc8a71a1b"
            },
            {
                "file_url": "http://dev.nftrainbow/assets/file/2/nft/06edf22f414234ea59c949104a054ca4af27cd71e87170d99401b50d15651cdc.jpeg",
                "file_size": 11295,
                "file_type": "jpeg",
                "file_name": "06edf22f414234ea59c949104a054ca4af27cd71e87170d99401b50d15651cdc"
            },
            {
                "file_url": "http://dev.nftrainbow/assets/file/2/nft/bf822838b7b3a7dadc96bd6f38defcbb21376852284ded6302aac69a71e58027.jpeg",
                "file_size": 11295,
                "file_type": "jpeg",
                "file_name": "bf822838b7b3a7dadc96bd6f38defcbb21376852284ded6302aac69a71e58027"
            }
        ]
    }
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/files/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

###


# Metadata

The metadata APIs provide users to make preparations for creating NFTs including creating NFT metadata and the corresponding query functions.

## Create NFT Metadata

`Create NFT metadata` API helps users to create their own metadata after calling[ Upload File](/api-reference/open-api/files#upload-file) to get the corresponding file url. To call `Create NFT metadata` , users have to provide the metadata information including `name`, `file`, `external_link` and so on.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/metadata/" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>name</td><td>The name of the metadata</td><td>body</td><td>string</td><td>true</td></tr><tr><td>image</td><td>The file url of the metadata</td><td>body</td><td>string</td><td>true</td></tr><tr><td>external_link</td><td>The externanl link of the metadata</td><td>body</td><td>string</td><td>false</td></tr><tr><td>description</td><td>The description of the metadata</td><td>body</td><td>string</td><td>true</td></tr><tr><td>animation_url</td><td>A URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA.</td><td>body</td><td>string</td><td>false</td></tr><tr><td>attributes</td><td>The attributes of the metadata</td><td>array</td><td>attribute</td><td>false</td></tr></tbody></table>

The struct of the MetadataAttribute is listed as bellow.

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>attribute_name</td><td>The name of the attribute</td><td>body</td><td>string</td><td>false</td></tr><tr><td>display_type</td><td>The display type of the attribute</td><td>body</td><td>string</td><td>false</td></tr><tr><td>trait_type</td><td>The trait type of the attribute</td><td>body</td><td>string</td><td>false</td></tr><tr><td>value</td><td>The value of the attribute</td><td>body</td><td>string</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
  "attributes": [
    {
      "attribute_name": "mouse",
      "display_type": "test hey hey",
      "trait_type": "big",
      "value": "big"
    }
  ],
  "description": "this is a test metadata",
  "image": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg",
  "name": "test",
  "external_link": "https://www.google.com/search",
  "animation_url": "https://www.google.com/search"
}
```

{% endtab %}

{% tab title="Responses" %}

| Name           | Meaning                                                                                                                                                                            | Type                        |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| uri            | The uri of the metadata                                                                                                                                                            | string                      |
| metadata\_id   | The id of the metadata                                                                                                                                                             | string                      |
| description    | The description of the metadata                                                                                                                                                    | string                      |
| external\_link | The external link of the metadata                                                                                                                                                  | string                      |
| image          | The file url of the metadata                                                                                                                                                       | string                      |
| metadata\_id   | The id of the metadata                                                                                                                                                             | string                      |
| name           | The name of the metadata                                                                                                                                                           | string                      |
| animation\_url | A URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA. | string                      |
| attributes     | The attribute of the metadata                                                                                                                                                      | \[]ExposedMetadataAttribute |

The **ExposedMetadataAttribute struct** is listed as follow:

| Name            | Meaning                          | Type   |
| --------------- | -------------------------------- | ------ |
| attribute\_name | The name of the attribute        | string |
| display\_type   | The display type of the attribut | string |
| trait\_type     | The trait type of the attribute  | string |
| value           | The value of the attribute       | string |
| {% endtab %}    |                                  |        |

{% tab title="Response Example" %}

```
{
  "attributes": [
    {
      "attribute_name": "mouse",
      "display_type": "test hey hey",
      "trait_type": "big",
      "value": "big"
    }
  ],
  "description": "this is a test metadata",
  "metadata_id": "f35c25ced3f537e8850a377c01d22aa7507069270054d12587ddbe5fc47ec490",
  "image": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg",
  "name": "test",
  "external_link": "https://www.google.com/search",
  "animation_url": "https://www.google.com/search",
  "uri": "https://dev.nftrainbow.cn/assets/metadata/2/nft/db2078aed6187e487a46a19624ba1559faddeb096849c4688347302023c40f6b.json"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST
--url https://api.nftrainbow.cn/v1/metadata/ \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "attributes": [
    {
      "attribute_name": "mouse",
      "display_type": "test hey hey",
      "trait_type": "big",
      "value": "big"
    }
  ],
  "description": "this is a test metadata",
  "image": "https://www.google.com/search",
  "external_link": "https://www.google.com/search",
   "animation_url": "https://www.google.com/search",
  "name": "test"
}
```

{% endtab %}
{% endtabs %}

## Query Metadata

`Query metadata` API helps users to query the detailed information of the specified metadata according to `metadata_id`. This api returns the `name`, `description`, `external link`, `file` and `attributes` of the queried metada.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/metadata/{metadata\_id}" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>metadata_id</td><td>The id of the metadata</td><td>Path</td><td>Integer</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                                                                                                                                            | Data Type                   |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| attributes     | The attribute of the metadata                                                                                                                                                      | \[]ExposedMetadataAttribute |
| description    | The description of the metadata                                                                                                                                                    | string                      |
| external\_link | The external link of the metadata                                                                                                                                                  | string                      |
| animation\_url | A URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA. | string                      |
| image          | The file url of the metadata                                                                                                                                                       | string                      |
| metadata\_id   | The id of the metadata                                                                                                                                                             | string                      |
| name           | The name of the metadata                                                                                                                                                           | string                      |

The **ExposedMetadataAttribute struct** is listed as follow:

| Name            | Meaning                          | Type   |
| --------------- | -------------------------------- | ------ |
| attribute\_name | The name of the attribute        | string |
| display\_type   | The display type of the attribut | string |
| trait\_type     | The trait type of the attribute  | string |
| value           | The value of the attribute       | string |
| {% endtab %}    |                                  |        |

{% tab title="Response Example" %}

```
{
  "attributes": [
    {
      "attribute_name": "mouse",
      "display_type": "test hey hey",
      "trait_type": "big",
      "value": "big"
    }
  ],
  "description": "this is a test metadata",
  "external_link": "https://www.google.com/search",
  "animation_url": "https://www.google.com/search",
  "metadata_id": "f35c25ced3f537e8850a377c01d22aa7507069270054d12587ddbe5fc47ec490",
  "image": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg",
  "name": "test",
  "uri": "https://dev.nftrainbow.cn/assets/metadata/2/nft/db2078aed6187e487a46a19624ba1559faddeb096849c4688347302023c40f6b.json"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://dev.nftrainbow/v1/metadata/:metadata_id \
  --header 'Authorization: 'Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

## Obtain Metadata List

`Query metadata list` API helps users to obain the metadata list including the information of the metadata created in the specified app. This API returns the array of the result from calling [Query matadata](#metadata-metadata_id).

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/metadata/" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameters" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>page</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>limit</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>10</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name  | Meaning                          | Type                    |
| ----- | -------------------------------- | ----------------------- |
| count | The number of the uploaded files | integer                 |
| items | The files information            | \[]QueryMetadataRsponse |

The **`QueryMetadataResponse struct`** is listed as follow:

| Name           | Meaning                                                                                                                                                                            | Data Type     |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| attributes     | The attribute of the                                                                                                                                                               | \[]attributes |
| description    | The description of the metadata                                                                                                                                                    | string        |
| external\_link | The external link of the metadata                                                                                                                                                  | string        |
| animation\_url | A URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA. | string        |
| image          | The file url of the metadata                                                                                                                                                       | string        |
| metadata\_id   | The id of the metadata                                                                                                                                                             | string        |
| name           | The name of the metadata                                                                                                                                                           | string        |

The **`attributes struct`** is listed as follow:

| Name            | Meaning                          | Type   |
| --------------- | -------------------------------- | ------ |
| attribute\_name | The name of the attribute        | string |
| display\_type   | The display type of the attribut | string |
| trait\_type     | The trait type of the attribute  | string |
| value           | The value of the attribute       | string |
| {% endtab %}    |                                  |        |

{% tab title="Response Example" %}

```
{
        "count": 1,
        "items": [
            {
                "metadata": {
                    "name": "test",
                    "description": "this is a test metadata",
                    "metadata_id": "f35c25ced3f537e8850a377c01d22aa7507069270054d12587ddbe5fc47ec490",
                    "image": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg",
                    "external_link": "https://www.google.com/search",
                    "animation_url": "https://www.google.com/search",
                    "attributes": [
                        {
                            "attribute_name": "eyes",
                            "trait_type": "test trait",
                            "display_type": "",
                            "value": "big"
                        },
                        {
                            "attribute_name": "mouse",
                            "trait_type": "test hey hey",
                            "display_type": "",
                            "value": "big"
                        }
                    ]
                },
                "uri": "http://dev.nftrainbow/assets/metadata/1/nft/46708cf66a806743cfc27b110a41a2ea2e1b7a47fbcfb2efc9cac8fd3bf29cd1.json"
            }
        ]
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/metadata/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}


# Contract

The contract API provide users the entries to interact with the ERC721 contracts, including deploying the contracts, setting the sponsors and so on.

## Contract Actions

### Deploy Contract

The `Deploy contract` API helps users to deploy a ERC721 or a ERC1155 contract.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>name</td><td>The name of the NFT</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>symbol</td><td>The symbol of the NFT</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>owner_address</td><td>The creater of the contract</td><td>body</td><td>string</td><td>false</td><td></td></tr><tr><td>type</td><td>The type of the contract, e.g., erc721, erc1155</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>base_uri</td><td>The uri of the NFT. For ERC721 contract, the token_uri is the base_uri. For ERC1155 contract, the token_uri is the base_uri/ token_id. During minting, if the metadata_uri is not null, the base_uri will be ignored.</td><td>body</td><td>string</td><td>false</td><td>null string</td></tr><tr><td>chain</td><td>The chain type, which can be <code>conflux</code> or <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>royalties_bps</td><td><p>The price</p><p>of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.</p></td><td>body</td><td>integer</td><td>false</td><td>0</td></tr><tr><td>royalties_address</td><td>The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.</td><td>body</td><td>string</td><td>false</td><td>The owner of the contract</td></tr><tr><td>tokens_burnable</td><td>Whether the function of burning tokens by the token owner is supported</td><td>body</td><td>bool</td><td>false</td><td>false</td></tr><tr><td>tokens_transferable_by_admin</td><td>Whether the function of transferring tokens by the contract admin is supported</td><td>body</td><td>bool</td><td>false</td><td>false</td></tr><tr><td>tokens_transferable_by_user</td><td>Whether the function of transferring tokens by contract user is supported</td><td>body</td><td>bool</td><td>false</td><td>false</td></tr><tr><td>transfer_cooldown_time</td><td>The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.</td><td>body</td><td>integer</td><td>false</td><td>false</td></tr><tr><td>is_sponsor_for_all_user</td><td>Whether the contract can be called by all users free. If the function opens, all uesrs can call the contract free.</td><td>body</td><td>bool</td><td>false</td><td></td></tr><tr><td>auto_sponsor</td><td>Whether auto set sponsor for new created contract</td><td>body</td><td>bool</td><td>false</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
 {
    "chain": "conflux_test",
    "name": "NFT-name",
    "symbol": "ENFT",
    "owner_address": "cfxtest:aatk708nbb7573bkwumsu00h0r1rtkcdz2chwhttzk",
    "type": "erc721",
    "base_uri": "",
    "royalties_bps": 0,
    "royalties_address": "",
    "tokens_burnable": false,
    "tokens_transferable_by_admin": false,
    "tokens_transferable_by_user": false,
    "transfer_cooldown_time": 0,
    "is_sponsor_for_all_user": false
}
```

{% endtab %}

{% tab title="Response" %}

| Name                            | Meaning                                                                                                                                                                                                                      | Type    |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at                     | The time of creating the item in the database                                                                                                                                                                                | string  |
| updated\_at                     | The time of updating the item in the database                                                                                                                                                                                | string  |
| deleted\_at                     | The time of deleting the item in the database                                                                                                                                                                                | string  |
| id                              | The id of the item in the database, which can be used to [query detail contract](#query-detail-contract)                                                                                                                     | integer |
| app\_id                         | The id of the app                                                                                                                                                                                                            | integer |
| chain\_id                       | The id of the chain. 1029-mainnet, 1-testnet                                                                                                                                                                                 | integer |
| chain\_type                     | The type of the chain. 1-CFX, 2-ETH                                                                                                                                                                                          | integer |
| name                            | The name of the NFT                                                                                                                                                                                                          | string  |
| symbol                          | The symbol of the NFT                                                                                                                                                                                                        | string  |
| owner\_address                  | The admin of the contract                                                                                                                                                                                                    | string  |
| type                            | The type of the contract, e.g., erc721, erc1155                                                                                                                                                                              | string  |
| base\_uri                       | The uri of the NFT. For ERC721 contract, the token\_uri is the base\_uri. For ERC1155 contract, the token\_uri is the base\_uri/ token\_id. During minting, if the metadata\_uri is not null, the base\_uri will be ignored. | string  |
| address                         | The address of the contract. The response will be null after calling this interface. After several seconds, it can call [query contract](#query-detail-contract) according to the id.                                        | string  |
| royalties\_bps                  | <p>The price</p><p>of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.</p>                                                                                   | integer |
| royalties\_address              | The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.                                                                                                                  | string  |
| tokens\_burnable                | Whether the function of burning tokens by the token owner is supported                                                                                                                                                       | bool    |
| tokens\_transferable\_by\_admin | Whether the function of transferring tokens by the contract admin is supported                                                                                                                                               | bool    |
| tokens\_transferable\_by\_user  | Whether the function of transferring tokens by contract user is supported                                                                                                                                                    | bool    |
| transfer\_cooldown\_time        | The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.                                                        | integer |
| status                          | The status of the transaction. 0-pending, 1-success, 2-failed. The response will be 0 after calling this interface. After several seconds, it can call [query contract](#query-detail-contract) according to the id.         | integer |
| tx\_id                          | The id of the transaction                                                                                                                                                                                                    | integer |
| hash                            | The hash of the transaction. The response will be null after calling this interface. After several seconds, it can call [query contract](#query-detail-contract) according to the id.                                        | string  |
| {% endtab %}                    |                                                                                                                                                                                                                              |         |

{% tab title="Response Example" %}

```
{
    "id": 20,
    "created_at": "2022-08-22T15:49:42.46+08:00",
    "updated_at": "2022-08-22T15:49:42.46+08:00",
    "deleted_at": null,
    "app_id": 4,
    "chain_type": 1,
    "chain_id": 1,
    "address": "",
    "owner_address": "cfxtest:aajb342mw5kzad6pjjkdz0wxx0tr54nfwpbu6yaj49",
    "type": 1,
    "base_uri": "",
    "name": "NFT-name",
    "symbol": "ENFT",
    "royalties_bps": 0,
    "royalties_address": "cfxtest:aajb342mw5kzad6pjjkdz0wxx0tr54nfwpbu6yaj49",
    "tokens_burnable": false,
    "tokens_transferable_by_admin": false,
    "tokens_transferable_by_user": false,
    "transfer_cooldown_time": 0,
    "hash": "",
    "tx_id": 64,
    "status": 0
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/contracts/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \
  --data-raw ' {
    "chain": "conflux_test",
    "name": "NFT-name",
    "symbol": "ENFT",
    "owner_address": "cfxtest:aatk708nbb7573bkwumsu00h0r1rtkcdz2chwhttzk",
    "type": "erc721",
    "base_uri": "",
    "royalties_bps": 0,
    "royalties_address": "",
    "tokens_burnable": false,
    "tokens_transferable_by_admin": false,
    "tokens_transferable_by_user": false,
    "transfer_cooldown_time": 0
}'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
When the API is called successfully, we need to use the id in response to call [Query contract detail ](#query-detail-contract)API to get the contract address. It takes several seconds that the contract address can be obtained from [Query contract detail ](#query-detail-contract)API.
{% endhint %}

### Update contract admin

The `Update contract admin` API provides users the entry to update the admin of the specific contract.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/admin" method="put" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>admin_address</td><td>The address of the admin</td><td>body</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name         | Meaning                   | Type    |
| ------------ | ------------------------- | ------- |
| tx\_id       | The id of the transaction | integer |
| {% endtab %} |                           |         |

{% tab title="Response Example" %}

```
{
  "tx_id": 421312
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request PUT \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/admin \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

### Set Sponsor

{% hint style="info" %}
**Good to know:** Conflux provides users the sponsor function. Once a contract is sponsored by an account, the accounts in the contract white list can call this contracts for free.
{% endhint %}

The `Set sponsor` API provides users to set a sponser for a specific contract according to the sponsor' address.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/sponsor" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>chain</td><td>The blockchain name: conflux, conflux_test(default)</td><td>query</td><td>string</td><td>false</td></tr><tr><td>auto_sponsor</td><td>Whether auto recharge sponsor balance when not enough</td><td>query</td><td>bool</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name                       | Meaning                                                                                   | Type    |
| -------------------------- | ----------------------------------------------------------------------------------------- | ------- |
| sponsor\_gas\_tx\_id       | The id of the sponsor gas setting transaction. `gas` is used for contract running.        | integer |
| sponsor\_collateral\_tx\_i | The id of the sponsor storage setting transaction. `collateral` is presented for storage. | integer |
| {% endtab %}               |                                                                                           |         |

{% tab title="Response Example" %}

```
{
    "sponsor_gas_tx_id": 8475,
    "sponsor_collateral_tx_id": 8476
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/sponsor \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note:** UP to now, `Set sponsor` API can only be called by users free in testnet. In mainnet, Users need to [recharge their own wallet.](/tutorials/guides/kong-zhi-tai-he-yue-dai-fu-she-zhi)
{% endhint %}

### Add Contract Sponsor Users

The `Add Contract Sponsor Users` API provides users to add the address in the whitelist.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/sponsor/whitelist" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>users</td><td>The addresses being added into the <a href="/docs/shu-tu-contract-sponsor">whitelist</a></td><td>body</td><td>[]string</td><td>true</td></tr><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name         | Meaning                   | Type    |
| ------------ | ------------------------- | ------- |
| tx\_id       | The id of the transaction | integer |
| {% endtab %} |                           |         |

{% tab title="Response Example" %}

```
{
  "tx_id": 421312
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/sponsor/whitelist/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \
  --data-raw `["cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8"]`
```

{% endtab %}
{% endtabs %}

### Remove Contract Sponsor Users

The `Remove Contract Sponsor Users` API provides users to remove the address from the whitelist.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/sponsor/whitelist" method="delete" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name         | Meaning                   | Type    |
| ------------ | ------------------------- | ------- |
| tx\_id       | The id of the transaction | integer |
| {% endtab %} |                           |         |

{% tab title="Response Example" %}

```
{
  "tx_id": 421312
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request DELETE \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/sponsor/whitelist/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \
  --data-raw `["cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8"]`
  
```

{% endtab %}
{% endtabs %}

## Query Informations

### Obtain Contract List

The `Obtain contarct list` API provides users the entry to get the inforamtion of the contracts deployed in a specified app. The parameter `page` and `size` are optional parameters.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>page</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>limit</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>10</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name  | Meaning                              | Type        |
| ----- | ------------------------------------ | ----------- |
| count | The number of the deployed contracts | integer     |
| items | The contract information             | \[]Contract |

The **`Contract Struct`** is listed as follow:

| Name                            | Meaning                                                                                                                                                                                                                      | Type    |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at                     | The time of creating the item in the database                                                                                                                                                                                | string  |
| updated\_at                     | The time of updating the item in the database                                                                                                                                                                                | string  |
| deleted\_at                     | The time of deleting the item in the database                                                                                                                                                                                | string  |
| id                              | The id of the item in the database                                                                                                                                                                                           | integer |
| app\_id                         | The id of the app                                                                                                                                                                                                            | integer |
| chain\_id                       | The id of the chain. 1029-mainnet, 1-testnet                                                                                                                                                                                 | integer |
| chain\_type                     | The type of the chain. 1-CFX, 2-ETH                                                                                                                                                                                          | integer |
| name                            | The name of the NFT                                                                                                                                                                                                          | string  |
| symbol                          | The symbol of the NFT                                                                                                                                                                                                        | string  |
| owner\_address                  | The admin of the contract                                                                                                                                                                                                    | string  |
| type                            | The type of the contract, e.g., erc721, erc1155                                                                                                                                                                              | string  |
| base\_uri                       | The uri of the NFT. For ERC721 contract, the token\_uri is the base\_uri. For ERC1155 contract, the token\_uri is the base\_uri/ token\_id. During minting, if the metadata\_uri is not null, the base\_uri will be ignored. | string  |
| address                         | The address of the contract                                                                                                                                                                                                  | string  |
| royalties\_bps                  | <p>The price</p><p>of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.</p>                                                                                   | integer |
| royalties\_address              | The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.                                                                                                                  | string  |
| tokens\_burnable                | Whether the function of burning tokens by the token owner is supported                                                                                                                                                       | bool    |
| tokens\_transferable\_by\_admin | Whether the function of transferring tokens by the contract admin is supported                                                                                                                                               | bool    |
| tokens\_transferable\_by\_user  | Whether the function of transferring tokens by contract user is supported                                                                                                                                                    | bool    |
| transfer\_cooldown\_time        | The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.                                                        | integer |
| status                          | The status of the transaction. 0-pending, 1-success, 2-failed                                                                                                                                                                | integer |
| tx\_id                          | The id of the transaction                                                                                                                                                                                                    | integer |
| hash                            | The hash of the transaction                                                                                                                                                                                                  | string  |
| {% endtab %}                    |                                                                                                                                                                                                                              |         |

{% tab title="Response Example" %}

```
{
        "count": 1,
        "items": [
            {
                "id": 1,
                "created_at": "2022-08-19T10:48:13.049+08:00",
                "updated_at": "2022-08-19T10:49:15.853+08:00",
                "deleted_at": null,
                "app_id": 4,
                "chain_type": 1,
                "chain_id": 1,
                "address": "cfxtest:acdzrjc92rds9tuta8rdkx3mn10yzf0jny1z3s0s8e",
                "owner_address": "cfxtest:aajb342mw5kzad6pjjkdz0wxx0tr54nfwpbu6yaj49",
                "type": 1,
                "base_uri": "",
                "name": "ttt",
                "symbol": "test",
                "royalties_bps": 0,
                "royalties_address": "",
                "tokens_burnable": false,
               "tokens_transferable_by_admin": false,
                "tokens_transferable_by_user": false,
                "transfer_cooldown_time": 0,
                "hash": "0xcbcedb27eb941a9a4fb6008d343055d98d9fe1ccdba65268680f46af6bf3fa0a",
                "tx_id": 49,
                "status": 1
            }
        ]
    }
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/contracts/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

### Query detail contract

The `Query detail contract` API provides users the entry to get the detail contract information of a specific contract according to the contract's id. The parameter `chain` is optional, which can be used to choose the test or main network of conflux.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/detail/{id}" method="get" expanded="false" fullWidth="false" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>id</td><td>The id of the contract</td><td>Path</td><td>integer</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name                            | Meaning                                                                                                                                                                                                                      | Type    |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at                     | The time of creating the item in the database                                                                                                                                                                                | string  |
| updated\_at                     | The time of updating the item in the database                                                                                                                                                                                | string  |
| deleted\_at                     | The time of deleting the item in the database                                                                                                                                                                                | string  |
| id                              | The id of the item in the database                                                                                                                                                                                           | integer |
| app\_id                         | The id of the app                                                                                                                                                                                                            | integer |
| chain\_id                       | The id of the chain. 1029-mainnet, 1-testnet                                                                                                                                                                                 | integer |
| chain\_type                     | The type of the chain. 1-CFX, 2-ETH                                                                                                                                                                                          | integer |
| name                            | The name of the NFT                                                                                                                                                                                                          | string  |
| symbol                          | The symbol of the NFT                                                                                                                                                                                                        | string  |
| owner\_address                  | The admin of the contract                                                                                                                                                                                                    | string  |
| type                            | The type of the contract, e.g., erc721, erc1155                                                                                                                                                                              | string  |
| base\_uri                       | The uri of the NFT. For ERC721 contract, the token\_uri is the base\_uri. For ERC1155 contract, the token\_uri is the base\_uri/ token\_id. During minting, if the metadata\_uri is not null, the base\_uri will be ignored. | string  |
| address                         | The address of the contract.                                                                                                                                                                                                 | string  |
| royalties\_bps                  | <p>The price</p><p>of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.</p>                                                                                   | integer |
| royalties\_address              | The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.                                                                                                                  | string  |
| tokens\_burnable                | Whether the function of burning tokens by the token owner is supported                                                                                                                                                       | bool    |
| tokens\_transferable\_by\_admin | Whether the function of transferring tokens by the contract admin is supported                                                                                                                                               | bool    |
| tokens\_transferable\_by\_user  | Whether the function of transferring tokens by contract user is supported                                                                                                                                                    | bool    |
| transfer\_cooldown\_time        | The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.                                                        | integer |
| status                          | The status of the transaction. 0-pending, 1-success, 2-failed                                                                                                                                                                | integer |
| tx\_id                          | The id of the transaction                                                                                                                                                                                                    | integer |
| hash                            | The hash of the transaction                                                                                                                                                                                                  | string  |
| {% endtab %}                    |                                                                                                                                                                                                                              |         |

{% tab title="Response Example" %}

```
{
    "id": 10,
    "created_at": "2022-08-19T10:48:13.049+08:00",
    "updated_at": "2022-08-19T10:49:15.853+08:00",
    "deleted_at": null,
    "app_id": 4,
    "chain_type": 1,
    "chain_id": 1,
    "address": "cfxtest:acdzrjc92rds9tuta8rdkx3mn10yzf0jny1z3s0s8e",
    "owner_address": "cfxtest:aajb342mw5kzad6pjjkdz0wxx0tr54nfwpbu6yaj49",
    "type": 1,
    "base_uri": "",
    "name": "ttt",
    "symbol": "test",
    "royalties_bps": 0,
    "royalties_address": "",
    "tokens_burnable": false,
    "tokens_transferable_by_admin": false,
    "tokens_transferable_by_user": false,
    "transfer_cooldown_time": 0,
    "hash": "0xcbcedb27eb941a9a4fb6008d343055d98d9fe1ccdba65268680f46af6bf3fa0a",
    "tx_id": 49,
    "status": 1
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/contracts/detail/{id} \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

### Query Sponsor

The `Query sponsor` API provides users the entry to get the sponsors of a specific contract according to the contract's address. The parameter `chain` is optional, which can be used to choose the test or main network of conflux.

{% hint style="info" %}
**Good to know:** Conflux Network can be divided into the main network and the test network. The later is used to test the developed functions for developers.
{% endhint %}

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/sponsor" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>address</td><td>The address of the sponsor</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>chain</td><td>The chain type, which can be <code>conflux</code> or <code>conflux_test</code></td><td>query</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name                         | Meaning                                  | Type    |
| ---------------------------- | ---------------------------------------- | ------- |
| collateral\_sponsor          | The address of the collateral sponsor    | string  |
| collateral\_sponsor\_balance | The balance of the collateral sponsor    | integer |
| gas\_sponsor                 | The address of the gas sponsor           | string  |
| gas\_sponsor\_balance        | The balance of the gas sponsor           | integer |
| gas\_upper\_bound            | The upper bound of using gas             | integer |
| is\_all\_white\_listed       | wheter the sponsor in the all white list | bool    |
| {% endtab %}                 |                                          |         |

{% tab title="Response Example" %}

```
{
        "gas_sponsor": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
        "gas_sponsor_balance": 10000000000000000000,
        "collateral_sponsor": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
        "collateral_sponsor_balance": 100000000000000000000,
        "is_all_white_listed": true,
        "gas_upper_bound": 5000000000000000
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/sponsor \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Good to know:** For more detailed information, please refer to the following link.
{% endhint %}

{% embed url="<https://developer.confluxnetwork.org/conflux-rust/internal_contract/internal_contract#sponsorwhitelistcontrol-contract>" %}
SponsorWhitelistControl Contract
{% endembed %}

### Query contract admin

The `Query contract admin` API provides users the entry to get the admin of the specific contract.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/admin" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response Example" %}

```
{
  "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0"
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/admin \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

### Query Contract Whitelist

The `Query Contract Whitelist` API provides users to get the whitelist of the specific contract. Only the addresses in the whitelist can call the contract free.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/contracts/{address}/sponsor/whitelist" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

```
Return the slices of the addresses in the whiltelist.
```

{% endtab %}

{% tab title="Response Example" %}

```
["cfxtest:acexyjf36ddwcct171wr1k5srd289zp9te70p67zc1"]
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/contracts/{address}/sponsor/whitelist/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}


# Mints

The Mints APIs provide users the entries to mint the NFTs by calling the method in the ERC721 or ERC1155 contract.

## Mint Actions

The Mints APIs provide three methods to help users mint NFTs, including the custom minting, minting with a file and minting with metadata.

### Mint NFT

The `Mint NFT` provides users with the entry to call the ERC721 or ERC1155 contract to mint the NFT. Users need to [deploy their own contract](/api-reference/open-api/contract#deploy-contract) firstly. If the network is `Conflux_test` , [`set sponsor api`](/api-reference/open-api/contract#set-sponsor) needs to be called beforing minting.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/mints/" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>token_id</td><td>The id of the NFT, which will be generated randomly if the field in the request is null.</td><td>body</td><td>string</td><td>false</td><td>random</td></tr><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>mint_to_address</td><td>The owner of the NFT</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>contract_address</td><td>The address of the contract</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>metadata_uri</td><td>The uri of the metadata. It can be created thorugh <a href="/api-reference/open-api/metadata">create metadata uri</a>.</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>amount</td><td>The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0.</td><td>body</td><td>integer</td><td>false</td><td>1</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "chain": "conflux_test",
    "token_id": "123",
    "mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
    "contract_address": "cfxtest:aca7psszv5pvak2hesk3e33m5yabkn3d5j2gzsmm5n",
    "metadata_uri": "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
    "amount": 123
}
```

{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                                                                                           | Type    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                                                                                     | string  |
| updated\_at    | The time of updating the item in the database                                                                                     | string  |
| deleted\_at    | The time of deleting the item in the database                                                                                     | string  |
| id             | The id of the item in the database                                                                                                | integer |
| amount         | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
| app\_id        | The id of the app                                                                                                                 | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                                                                                      | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                                                                                               | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                                                                                     | integer |
| contract       | The address of the contract                                                                                                       | string  |
| error          | The error during executing tx                                                                                                     | string  |
| hash           | The hash of the transaction                                                                                                       | string  |
| mint\_to       | The owner of the nft                                                                                                              | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed                                                                     | integer |
| token\_id      | The id of the token                                                                                                               | string  |
| token\_uri     | The uri of the token                                                                                                              | string  |
| tx\_id         | The id of the transaction                                                                                                         | integer |
| mint\_type     | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint                                                                 | integer |
| {% endtab %}   |                                                                                                                                   |         |

{% tab title="Response Example" %}

```
        {
            "id": 8109,
            "created_at": "2022-08-24T04:56:09.841Z",
            "updated_at": "2022-08-24T04:56:52.986Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
            "contract_type": 0,
            "tx_id": 8121,
            "hash": "0x5e8eafa9cf8fc52f3fb0d0810a86b5ac97ef23c3ba057bfa8a9f889907e65209",
            "status": 1,
            "error": "",
            "mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
            "token_id": "123",
            "amount": 1,
            "token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
            "mint_type": 0
        }
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/mints/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
  --data-raw '{
    "chain": "conflux_test",
    "token_id": "123",
    "mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
    "contract_address": "cfxtest:acgat1yux2rk0xmk2s8ceferyprgm0u1hetj0w72yf",
    "metadata_uri": "http://dev.nftrainbow/assets/metadata/0/nft/2dfd6b3add9d5154cf4ccef7a040f4c5c3c965ec5845bd11ca297e8550ac63ee.json",
    "amount": 1
}'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token\_id is the number like "123", whose type is string
{% endhint %}

### Batch Mint NFTs

The `Batch Mint NFTs` API provides users with the entry to call the ERC721 or ERC1155 contract to mint several NFTs once.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/mints/customizable/batch" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>contract_address</td><td>The address of the contract</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>mint_items</td><td>The mint tasks</td><td>body</td><td>The array of the MintItemDto</td><td>true</td><td></td></tr></tbody></table>

The MintItemDto construct is presented in the following.

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>token_id</td><td>The id of the NFT, which will be generated randomly if the field in the request is null.</td><td>body</td><td>string</td><td>false</td><td>The radom value between 1 and 10</td></tr><tr><td>mint_to_address</td><td>The owner of the NFT</td><td>body</td><td>string</td><td>true</td><td></td></tr><tr><td>amount</td><td>The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0.</td><td>body</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>metadata_uri</td><td>The uri of the metadata. This uri can be generated through <a href="/api-reference/open-api/metadata#create-nft-metadata">create metadata</a></td><td>body</td><td>string</td><td>false</td><td>The base_uri in the <a href="/api-reference/open-api/contract#deploy-contract">deploy contract</a></td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "chain": "conflux_test",
    "contract_address": "cfxtest:aceng286bm0xnu8s4wdf1xzdchgn0zxxapb1jj597t",
    "mint_items": [
        {
            "mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/10",
            "token_id":"10",
            "amount": 1
        },
        {
            "mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/11",
            "token_id":"11",
            "amount": 1
        },
        {
            "mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/12",
            "token_id":"12",
            "amount": 1
        }
    ]
}
```

{% endtab %}

{% tab title="Response" %}
The response is the array of MintTask construct.

The MintTask construct is showed in the following.

| Name           | Meaning                                                                                                                           | Type    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                                                                                     | string  |
| updated\_at    | The time of updating the item in the database                                                                                     | string  |
| deleted\_at    | The time of deleting the item in the database                                                                                     | string  |
| id             | The id of the item in the database                                                                                                | integer |
| app\_id        | The id of the app                                                                                                                 | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH.                                                                                              | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                                                                                      | integer |
| contract       | The address of the contract                                                                                                       | string  |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                                                                                     | integer |
| mint\_to       | The address of the owner                                                                                                          | string  |
| token\_uri     | The uri of the token                                                                                                              | string  |
| token\_id      | The id of the NFT, which will be generated randomly if the field in the request is null.                                          | string  |
| amount         | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed                                                                     | integer |
| hash           | The hash of the transaction                                                                                                       | string  |
| tx\_id         | The id of the transaction                                                                                                         | integer |
| error          | The error during executing the transaction                                                                                        | string  |
| mint\_type     | The type of minting. 1-easyMinting 2-customMinting 3-BatchcustomMinting                                                           | integer |
| {% endtab %}   |                                                                                                                                   |         |

{% tab title="Response Example" %}

```
[
    {
        "id": 8372,
        "created_at": "2022-09-28T07:54:53.602Z",
        "updated_at": "2022-09-28T07:54:53.602Z",
        "deleted_at": null,
        "app_id": 2,
        "chain_type": 1,
        "chain_id": 1,
        "contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
        "contract_type": 1,
        "tx_id": 8474,
        "hash": "",
        "status": 0,
        "error": "",
        "mint_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
        "token_id": "1",
        "amount": 1,
        "token_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/10",
        "mint_type": 3
    },
    {
        "id": 8373,
        "created_at": "2022-09-28T07:54:53.602Z",
        "updated_at": "2022-09-28T07:54:53.602Z",
        "deleted_at": null,
        "app_id": 2,
        "chain_type": 1,
        "chain_id": 1,
        "contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
        "contract_type": 1,
        "tx_id": 8474,
        "hash": "",
        "status": 0,
        "error": "",
        "mint_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
        "token_id": "22",
        "amount": 1,
        "token_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/11",
        "mint_type": 3
    },
    {
        "id": 8374,
        "created_at": "2022-09-28T07:54:53.602Z",
        "updated_at": "2022-09-28T07:54:53.602Z",
        "deleted_at": null,
        "app_id": 2,
        "chain_type": 1,
        "chain_id": 1,
        "contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
        "contract_type": 1,
        "tx_id": 8474,
        "hash": "",
        "status": 0,
        "error": "",
        "mint_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
        "token_id": "23",
        "amount": 1,
        "token_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/12",
        "mint_type": 3
    }
]
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/mints/customizable/batch \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
  --data-raw '{
    "chain": "conflux_test",
    "contract_address": "cfxtest:aceng286bm0xnu8s4wdf1xzdchgn0zxxapb1jj597t",
    "mint_items": [
        {
            "mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/10",
            "token_id":"10",
            "amount": 1
        },
        {
            "mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/11",
            "token_id":"11",
            "amount": 1
        },
        {
            "mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/12",
            "token_id":"12",
            "amount": 1
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

### Mint NFT with file

The `Mint NFT with file` API provides users with the entry to call the ERC721 or ERC1155 contract to mint the NFT with uploading files. The uploaded files can be images, video and so on.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/mints/easy/files" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>name</td><td>The name of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td></tr><tr><td>mint_to_address</td><td>The owner of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>description</td><td>The description of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>file</td><td>The uploaded file</td><td>formData</td><td></td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                                                                                           | Type    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                                                                                     | string  |
| updated\_at    | The time of updating the item in the database                                                                                     | string  |
| deleted\_at    | The time of deleting the item in the database                                                                                     | string  |
| id             | The id of the item in the database                                                                                                | integer |
| amount         | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
| app\_id        | The id of the app                                                                                                                 | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                                                                                      | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                                                                                               | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                                                                                     | integer |
| contract       | The address of the contract.                                                                                                      | string  |
| error          | The error during executing tx                                                                                                     | string  |
| hash           | The hash of the transaction                                                                                                       | string  |
| mint\_to       | The owner of the nft                                                                                                              | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed                                                                     | integer |
| token\_id      | The id of the NFT, which will be generated randomly if the field in the request is null.                                          | string  |
| token\_uri     | The uri of the token                                                                                                              | string  |
| tx\_id         | The id of the transaction                                                                                                         | integer |
| mint\_type     | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint                                                                 | integer |
| {% endtab %}   |                                                                                                                                   |         |

{% tab title="Response Example" %}

```
        {
            "id": 8109,
            "created_at": "2022-08-24T04:56:09.841Z",
            "updated_at": "2022-08-24T04:56:52.986Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
            "contract_type": 0,
            "tx_id": 8121,
            "hash": "0x5e8eafa9cf8fc52f3fb0d0810a86b5ac97ef23c3ba057bfa8a9f889907e65209",
            "status": 1,
            "error": "",
            "mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
            "token_id": "123",
            "amount": 1,
            "token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
            "mint_type": 0
        }
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/mints/easy/files \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: multipart/form-data' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form file= \
  --form chain= 'conflux_test' \
  --form description= 'throll description' \ 
  --form mint_to_address= 'cfxtest:aatk708nbb7573bkwumsu00h0r1rtkcdz2chwhttzk' \
  --form name= 'throll'
```

{% endtab %}
{% endtabs %}

### Mint NFT with metadata

The `Mint NFT with metadata` provides users with the entry to call the ERC721 or ERC1155 contract to mint the NFT with creating metadata by providing a file url.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/mints/easy/urls" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>name</td><td>The name of the nft</td><td>body</td><td>string</td><td>true</td></tr><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td></tr><tr><td>mint_to_address</td><td>The owner of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>description</td><td>The description of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>file_url</td><td>The url of the file, which can be generated through <a href="/api-reference/open-api/files#upload-file">upload file</a> or <a href="/api-reference/open-api/files#upload-file-to-oss">upload file to oss</a></td><td>body</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "chain": "conflux_test",
    "name": "123",
    "description": "123",
    "mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
    "file_url": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg"
}
```

{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                                                                                           | Type    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                                                                                     | string  |
| updated\_at    | The time of updating the item in the database                                                                                     | string  |
| deleted\_at    | The time of deleting the item in the database                                                                                     | string  |
| id             | The id of the item in the database                                                                                                | integer |
| amount         | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
| app\_id        | The id of the app                                                                                                                 | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                                                                                      | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                                                                                               | integer |
| contract\_type | The type of the contract                                                                                                          | integer |
| contract       | The address of the contract                                                                                                       | string  |
| error          | The error during executing tx                                                                                                     | string  |
| hash           | The hash of the transaction                                                                                                       | string  |
| mint\_to       | The owner of the nft                                                                                                              | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed                                                                     | integer |
| token\_id      | The id of the NFT, which will be generated randomly if the field in the request is null.                                          | string  |
| token\_uri     | The uri of the token                                                                                                              | string  |
| tx\_id         | The id of the transaction                                                                                                         | integer |
| mint\_type     | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint                                                                 | integer |
| {% endtab %}   |                                                                                                                                   |         |

{% tab title="Response Example" %}

```
        {
            "id": 8109,
            "created_at": "2022-08-24T04:56:09.841Z",
            "updated_at": "2022-08-24T04:56:52.986Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
            "contract_type": 0,
            "tx_id": 8121,
            "hash": "0x5e8eafa9cf8fc52f3fb0d0810a86b5ac97ef23c3ba057bfa8a9f889907e65209",
            "status": 1,
            "error": "",
            "mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
            "token_id": "123",
            "amount": 1,
            "token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
            "mint_type": 0
        }
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/mints/easy/urls \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "chain": "conflux_test",
    "name": "123",
    "description": "123",
    "mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
    "file_url": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg"
}'
```

{% endtab %}
{% endtabs %}

## Obtain Informations

### Obtain NFT list

The `Obtain NFT list` API provides users with the entry to query the NFTs information created on a spcific app.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/mints/" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>page</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>limit</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>10</td></tr><tr><td>contract</td><td>contract address</td><td>query</td><td>string</td><td>true</td><td></td></tr><tr><td>mint_to</td><td>owner of NFTs</td><td>query</td><td>string</td><td>true</td><td></td></tr><tr><td>status</td><td>The status of the transaction. 0-pending, 1-success, 2-failed</td><td>query</td><td>integer</td><td>false</td><td>-1</td></tr><tr><td>chain</td><td>The chain type including <code>conflux</code> and <code>conflux_test</code></td><td>query</td><td>string</td><td>true</td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name  | Meaning                       | Type        |
| ----- | ----------------------------- | ----------- |
| count | The number of the minted NFTs | integer     |
| items | The nfts information          | \[]MintTask |

The **`MintTask Struct`** is listed as follow:

| Name           | Meaning                                                                                                                           | Type    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                                                                                     | string  |
| updated\_at    | The time of updating the item in the database                                                                                     | string  |
| deleted\_at    | The time of deleting the item in the database                                                                                     | string  |
| id             | The id of the item in the database                                                                                                | integer |
| amount         | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
| app\_id        | The id of the app                                                                                                                 | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                                                                                      | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                                                                                               | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                                                                                     | integer |
| contract       | The address of the contract                                                                                                       | string  |
| error          | The error during executing tx                                                                                                     | string  |
| hash           | The hash of the transaction                                                                                                       | string  |
| mint\_to       | The owner of the nft                                                                                                              | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed                                                                     | integer |
| token\_id      | The id of the NFT, which will be generated randomly if the field in the request is null.                                          | string  |
| token\_uri     | The uri of the token                                                                                                              | string  |
| tx\_id         | The id of the transaction                                                                                                         | integer |
| mint\_type     | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint                                                                 | integer |
| {% endtab %}   |                                                                                                                                   |         |

{% tab title="Response Example" %}

```
 {
        "count": 1,
        "items": [
            {
            "id": 8109,
            "created_at": "2022-08-24T04:56:09.841Z",
            "updated_at": "2022-08-24T04:56:52.986Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
            "contract_type": 0,
            "tx_id": 8121,
            "status": 1,
            "error": "",
            "mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
            "token_id": "",
            "amount": 1,
            "token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
            "mint_type": 0
            }
]
 
    }
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/mints/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

### Query detailed NFT

The `Query detailed NFT` API provides users with the entry to query the detailed NFT information created on a specific app according to the NFT's id.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/mints/{id}" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>id</td><td>NFT id</td><td>path</td><td>integer</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                                                                                           | Type    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                                                                                     | string  |
| updated\_at    | The time of updating the item in the database                                                                                     | string  |
| deleted\_at    | The time of deleting the item in the database                                                                                     | string  |
| id             | The id of the item in the database                                                                                                | integer |
| amount         | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
| app\_id        | The id of the app                                                                                                                 | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                                                                                      | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                                                                                               | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                                                                                     | integer |
| contract       | The address of the contract                                                                                                       | string  |
| error          | The error during executing tx                                                                                                     | string  |
| hash           | The hash of the transaction                                                                                                       | string  |
| mint\_to       | The owner of the nft                                                                                                              | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed                                                                     | integer |
| token\_id      | The id of the NFT, which will be generated randomly if the field in the request is null.                                          | string  |
| token\_uri     | The uri of the token                                                                                                              | string  |
| tx\_id         | The id of the transaction                                                                                                         | integer |
| mint\_type     | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint                                                                 | integer |
| {% endtab %}   |                                                                                                                                   |         |

{% tab title="Response Example" %}

```
{
    "id": 22,
    "created_at": "2022-08-16T15:14:04.737+08:00",
    "updated_at": "2022-08-16T15:14:40.78+08:00",
    "deleted_at": null,
    "app_id": 4,
    "chain_type": 1,
    "chain_id": 1,
    "contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
    "contract_type": 0,
    "tx_id": 14,
    "hash": "0xb060076e19fc4c69fb5399faa2f8c63c0bb3179f54f069b164b84b7c312fef62",
    "status": 1,
    "error": "",
    "mint_to": "cfxtest:aajb342mw5kzad6pjjkdz0wxx0tr54nfwpbu6yaj49",
    "token_id": "14448",
    "amount": 1,
    "token_uri": "http://localhost:8080/assets/metadata/0/nft/2a4dc76844247c2ae927a1a67877e76b4f02f627a5b84667549fbad3d6f57250.json",
    "mint_type": 0
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/mints/{id} \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}


# Transfers

The Transfer APIs provide users the entries to tranfer the NFTs easily.

## Transfer Actions

The Transfer APIs provide two methods to help users transfer NFTs, including the tranfer or batch transfer NFTs.

### Transfer NFT

The `Transfer NFT` provides users with the entry to transfer the NFT.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/transfers/customizable" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>contract_type</td><td>The type of the contract, which includes erc721 and erc1155</td><td>body</td><td>string</td><td>false</td></tr><tr><td>token_id</td><td>The id of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td></tr><tr><td>transfer_from_address</td><td>The sender of the sending NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>contract_address</td><td>The address of the contract</td><td>body</td><td>string</td><td>true</td></tr><tr><td>transfer_to_address</td><td>The receiver of the sending NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>amount</td><td>The amount of the sending NFT</td><td>body</td><td>integer</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "chain": "conflux_test",
    "contract_address": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
    "contract_type":"erc1155",
    "transfer_from_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "transfer_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "token_id":"20",
    "amount":1
}
```

{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH.                          | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| contract       | The address of the contract                                   | string  |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| token\_id      | The id of the token                                           | string  |
| transfer\_from | The sender of the sending NFT                                 | string  |
| transfer\_to   | The receiver of the sending NFT                               | string  |
| amount         | The amount of the sending NFT                                 | integer |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| hash           | The hash of the transaction                                   | string  |
| tx\_id         | The id of the transaction                                     | integer |
| error          | The error during executing the transaction                    | string  |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
{
    "id": 1,
    "created_at": "2022-08-24T07:33:59.985Z",
    "updated_at": "2022-08-24T07:33:59.985Z",
    "deleted_at": null,
    "app_id": 2,
    "chain_type": 1,
    "chain_id": 1,
    "contract": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
    "contract_type": 2,
    "tx_id": 8127,
    "hash": "",
    "status": 0,
    "error": "",
    "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "transfer_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "token_id": "20",
    "amount": 1
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/transfers/customizable \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
  --data-raw '{
    "chain": "conflux_test",
    "contract_address": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
    "contract_type":"erc1155",
    "transfer_from_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "transfer_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "token_id":"20",
    "amount":1
}'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token\_id is the number like "123", which type is string
{% endhint %}

### Batch Transfer NFTs

The `Batch Transfer NFTs` API provides users with the entry to transfer several NFTs once.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/transfers/customizable/batch" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td></tr><tr><td>contract_type</td><td>The type of the contract, which includes <code>erc721</code> and <code>erc1155</code></td><td>body</td><td>string</td><td>true</td></tr><tr><td>contract_address</td><td>The address of the contract</td><td>body</td><td>string</td><td>true</td></tr><tr><td>items</td><td>The mint tasks</td><td>body</td><td>The array of the TransferItem</td><td>true</td></tr></tbody></table>

The TransferItem construct is presented in the following.

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>transfer_from_address</td><td>The sender of the sending NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>transfer_to_address</td><td>The receiver of the sending NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>amount</td><td>The amount of the NFTs</td><td>body</td><td>integer</td><td>true</td></tr><tr><td>token_id</td><td>The id of the token</td><td>body</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "chain": "conflux_test",
    "contract_address": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
    "contract_type": "erc1155",
    "items": [
        {
            "transfer_from_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to_address": "cfxtest:aanpu16mtgc7dke5xhuktyfyef8f00pz8a2z5mc14g",
            "token_id": "20",
            "amount": 2
        },
        {
            "transfer_from_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to_address": "cfxtest:aang4d91rejdbpgmgtmspdyefxkubj2bbywrwm9j3z",
            "token_id": "21",
            "amount": 1
        }
    ]
}
```

{% endtab %}

{% tab title="Response" %}
The response is the array of transferTask construct. The construct is showed in the following.

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH.                          | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| contract       | The address of the contract                                   | string  |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| hash           | The hash of the transaction                                   | string  |
| tx\_id         | The id of the transaction                                     | integer |
| error          | The error during executing the transaction                    | string  |
| transfer\_to   | The receiver of the sending NFT                               | string  |
| transfer\_from | The sender of the sending NFT                                 | string  |
| token\_id      | The id of the token                                           | integer |
| amount         | The amount of the sending NFT                                 | integer |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
[
    {
        "id": 1,
        "created_at": "2022-08-24T07:47:48.558Z",
        "updated_at": "2022-08-24T07:47:48.558Z",
        "deleted_at": null,
        "app_id": 2,
        "chain_type": 1,
        "chain_id": 1,
        "contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
        "contract_type": 1,
        "tx_id": 8474,
        "hash": "",
        "status": 0,
        "error": "",
        "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
        "transfer_to": "cfxtest:aanpu16mtgc7dke5xhuktyfyef8f00pz8a2z5mc14g",
        "token_id": "20",
        "amount": 2,
    },
    {
        "id": 2,
        "created_at": "2022-08-24T07:47:48.558Z",
        "updated_at": "2022-08-24T07:47:48.558Z",
        "deleted_at": null,
        "app_id": 2,
        "chain_type": 1,
        "chain_id": 1,
        "contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
        "contract_type": 1,
        "tx_id": 8474,
        "hash": "",
        "status": 0,
        "error": "",
        "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
        "transfer_to": "cfxtest:aang4d91rejdbpgmgtmspdyefxkubj2bbywrwm9j3z",
        "token_id": "21",
        "amount": 1,
    }
]
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/transfers/customizable/batch \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
  --data-raw '{
    "chain": "conflux_test",
    "contract_address": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
    "contract_type": "erc1155",
    "items": [
        {
            "transfer_from_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to_address": "cfxtest:aanpu16mtgc7dke5xhuktyfyef8f00pz8a2z5mc14g",
            "token_id": "20",
            "amount": 2
        },
        {
            "transfer_from_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to_address": "cfxtest:aang4d91rejdbpgmgtmspdyefxkubj2bbywrwm9j3z",
            "token_id": "21",
            "amount": 1
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

## Obtain Informations

### Obtain transferred NFT list

The `Obtain transferred NFT list` API provides users with the entry to query the transferred NFTs information.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/transfers/" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>page</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>limit</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>10</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name  | Meaning                           | Type            |
| ----- | --------------------------------- | --------------- |
| count | The number of the tranferred NFTs | integer         |
| items | The nfts information              | \[]TransferTask |

The **`TransferTask Struct`** is listed as follow:

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| amount         | The amount of the sending NFTs                                | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                           | integer |
| contract       | The address of the nft                                        | string  |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| error          | The error during executing tx                                 | string  |
| hash           | The hash of the transaction                                   | string  |
| transfer\_to   | The receiver of the sending NFT                               | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| token\_id      | The id of the token                                           | string  |
| transfer\_from | The sender of the sending NFT                                 | string  |
| tx\_id         | The id of the transaction                                     | integer |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
{
    "count": 3,
    "items": [
        {
            "id": 3,
            "created_at": "2022-08-24T07:47:48.56Z",
            "updated_at": "2022-08-24T07:47:51.882Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
            "contract_type": 2,
            "tx_id": 8129,
            "hash": "",
            "status": 2,
            "error": "",
            "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to": "cfxtest:aang4d91rejdbpgmgtmspdyefxkubj2bbywrwm9j3z",
            "token_id": "21",
            "amount": 1
        },
        {
            "id": 2,
            "created_at": "2022-08-24T07:47:48.56Z",
            "updated_at": "2022-08-24T07:47:51.877Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
            "contract_type": 2,
            "tx_id": 8129,
            "hash": "",
            "status": 2,
            "error": "",
            "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to": "cfxtest:aanpu16mtgc7dke5xhuktyfyef8f00pz8a2z5mc14g",
            "token_id": "20",
            "amount": 2
        },
        {
            "id": 1,
            "created_at": "2022-08-24T07:33:59.985Z",
            "updated_at": "2022-08-24T07:34:21.757Z",
            "deleted_at": null,
            "app_id": 2,
            "chain_type": 1,
            "chain_id": 1,
            "contract": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
            "contract_type": 2,
            "tx_id": 8127,
            "hash": "",
            "status": 2,
            "error": "",
            "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "transfer_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
            "token_id": "20",
            "amount": 1
        }
    ]
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/transfers/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

### Obtain Detialed NFT Transfer Information

The `Obtain Detialed NFT Transfer Information` API provides users with the entry to query the transferred NFT information according to its `id`.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/transfers/{id}" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>id</td><td>transfer id</td><td>path</td><td>integer</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| amount         | The amount of the sending NFTs                                | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                           | integer |
| contract       | The address of the nft                                        | string  |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| error          | The error during executing tx                                 | string  |
| hash           | The hash of the transaction                                   | string  |
| transfer\_to   | The receiver of the sending NFT                               | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| token\_id      | The id of the token                                           | string  |
| transfer\_from | The sender of the sending NFT                                 | string  |
| tx\_id         | The id of the transaction                                     | integer |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
{
    "id": 3,
    "created_at": "2022-08-24T07:47:48.56Z",
    "updated_at": "2022-08-24T07:47:51.882Z",
    "deleted_at": null,
    "app_id": 2,
    "chain_type": 1,
    "chain_id": 1,
    "contract": "cfxtest:accy6epch754uamc4x55mcv3pzgae8vfvaufj6v4uj",
    "contract_type": 2,
    "tx_id": 8129,
    "hash": "",
    "status": 2,
    "error": "",
    "transfer_from": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "transfer_to": "cfxtest:aang4d91rejdbpgmgtmspdyefxkubj2bbywrwm9j3z",
    "token_id": "21",
    "amount": 1
}
```

{% endtab %}

{% tab title="Request Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/transfers/{id} \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}


# Transaction

The transaction API provide users the entries to interact with the transactions.

## Query Transaction

### Query Transaction Information

The `Query Transaction Information` API provides users to get the transaction information according to id.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/tx/{id}" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>id</td><td>The id of the transaction</td><td>Path</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name          | Meaning                               | Type    |
| ------------- | ------------------------------------- | ------- |
| hash          | The hash of the transaction           | string  |
| state\_code   | The code of the transaction state     | integer |
| state\_msg    | The msg of the state                  | string  |
| is\_finalized | Whether the transaction is finalized  | boolean |
| is\_success   | Whether the transaction is successful | boolean |
| error\_msg    | The msg of the error during executing | string  |
| {% endtab %}  |                                       |         |

{% tab title="Response Example" %}

```
{
    "hash": "0xd7b1403ff021df36b98bece9eacdb3cab7cc10c5ff76dfb0f885bc08b362658f",
    "state_code": 3,
    "state_msg": "Excuted and success",
    "is_finalized": true,
    "is_success": true,
    "error_msg": ""
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/tx/{id} \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}


# NFT

The nft API provide users the entries to interact with the NFTs.

## Update NFT

### Update NFT token uri

The `Update NFT token uri` API provides users to update the nft token uri according to the contract address and the token\_id.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/nft/{address}/{token\_id}/tokenUri" method="put" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>token_id</td><td>The id of the nft</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>token_uri</td><td>The updated token uri</td><td>body</td><td>string</td><td>false</td></tr><tr><td>contract_type</td><td>The type of the contract, which includes erc721 and erc1155</td><td>body</td><td>string</td><td>false</td></tr><tr><td>chain</td><td>The type of the chain, which includes conflux and conflux_test</td><td>body</td><td>string</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name            | Meaning                                                                                                                                                                                                    | Type    |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| created\_at     | The time of creating the item in the database                                                                                                                                                              | string  |
| updated\_at     | The time of updating the item in the database                                                                                                                                                              | string  |
| deleted\_at     | The time of deleting the item in the database                                                                                                                                                              | string  |
| id              | The id of the item in the database                                                                                                                                                                         | integer |
| TaskType        | The type of the item in the transaction. 1-deploy, 2-mint, 3-batch mint, 4-transfer, 5-batch transfer, 6-burn, 7-batch burn, 8-update admin, 9-sponsor balance, 10-sponsor privilege, 11-update token\_uri | integer |
| ChainType       | The type of the chain, 1-cfx, 2-eth                                                                                                                                                                        | integer |
| ChainId         | The type of the chain, 1-testnet, 1029-mainnet                                                                                                                                                             | integer |
| From            | The sender of the transaction                                                                                                                                                                              | string  |
| To              | The receiver of the transaction                                                                                                                                                                            | string  |
| Nonce           | The nonce of the transaction                                                                                                                                                                               | string  |
| Value           | The value of the transaction                                                                                                                                                                               | string  |
| Data            | The data of the transaction                                                                                                                                                                                | string  |
| Hash            | The hash of the transaction                                                                                                                                                                                | string  |
| State           | The state of the transaction                                                                                                                                                                               | integer |
| epoch\_number   | The epoch number of the transaction                                                                                                                                                                        | integer |
| error           | The error of the transaction                                                                                                                                                                               | string  |
| GasPrice        | The gas price of the transaction                                                                                                                                                                           | string  |
| Gas             | The used gas of the transaction                                                                                                                                                                            | string  |
| StorageLimit    | The storage limit of the transaction                                                                                                                                                                       | string  |
| EpochHeight     | The epoch height of the transaction                                                                                                                                                                        | string  |
| pending\_reason | The pending reason of the transaction                                                                                                                                                                      | string  |
| {% endtab %}    |                                                                                                                                                                                                            |         |

{% tab title="Response Example" %}

```
{
    "id": 181295,
    "created_at": "2023-02-15T10:19:00.166+08:00",
    "updated_at": "2023-02-15T10:19:00.166+08:00",
    "deleted_at": null,
    "TaskType": 11,
    "ChainType": 1,
    "ChainId": 1,
    "From": "cfxtest:aanygt6awrrj1rv9jtctu763t3j6f9hh4p1xc4bkdd",
    "To": "cfxtest:acdggzx0r58uykdz19t42fyab92xmdk4g6vazyywns",
    "Nonce": 0,
    "Value": "0",
    "Data": "0x18e97fd100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000d7777772e62616964752e636f6d00000000000000000000000000000000000000",
    "Hash": "",
    "State": 0,
    "epoch_number": 0,
    "error": "",
    "GasPrice": "0",
    "Gas": "0",
    "StorageLimit": "0",
    "EpochHeight": "0",
    "pending_reason": ""
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request PUT \
  --url https://api.nftrainbow.cn/v1/nft/{address}/{token_id} \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
  --data-raw '
  {
    "token_uri": "www.baidu.com",
    "contract_type": "erc1155",
    "chain": "conflux_test"
}'
```

{% endtab %}
{% endtabs %}

## Query NFT

### Query specific NFT of specific account

The `Query specific NFT of specific account` API provides users to get the nft information according to the contract address and the token\_id.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/nft/{address}/{token\_id}" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>token_id</td><td>The id of the nft</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>address</td><td>The address of the contract</td><td>Path</td><td>string</td><td>true</td></tr><tr><td>type</td><td>The contract type: erc721, erc1155. Default is erc721</td><td>Query</td><td>string</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name              | Meaning                     | Type   |
| ----------------- | --------------------------- | ------ |
| owner             | The owner of the NFT        | string |
| contract\_address | The address of the contract | string |
| token\_id         | The id of the token         | string |
| {% endtab %}      |                             |        |

{% tab title="Response Example" %}

```
{
    "owner": "cfxtest:aakkfzezns4h8ymx1cgmcnd4x3aev6e2he38nnu8sv",
    "contract_address": "cfxtest:acd8eue6shtzvnc7mts66hh88nvw2gtnaez6c4s1a5",
    "token_id": "17",
    "token_uri": "https://nftrainbow.cn/assets/1.json"
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/nft/{address}/{token_id} \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token\_id is a number like "123", which type is string. If the type parameter pass erc1155, the response's owner field will be empty.
{% endhint %}

### Query NFT Hold count


# Burns

The burns API provide users the entries to burn the NFTs.

## Burn NFTs

### Burn NFT by Admin

The `Burn NFT by Admin` API helps users to burn the corresponding NFT.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/burns" method="post" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>token_id</td><td>The id of the NFT</td><td>body</td><td>string</td><td>true</td></tr><tr><td>chain</td><td>The chain type. The types include <code>conflux</code> and <code>conflux_test</code></td><td>body</td><td>string</td><td>true</td></tr><tr><td>contract_address</td><td>The address of the contract</td><td>body</td><td>string</td><td>true</td></tr><tr><td>contract_type</td><td>The type of the contract</td><td>body</td><td>string</td><td>true</td></tr><tr><td>amount</td><td>The amount of the burned NFTs</td><td>body</td><td>integer</td><td>false</td></tr><tr><td>user</td><td>The address of the user</td><td>body</td><td>string</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Example" %}

```
{
    "chain": "conflux_test",
    "contract_address": "cfxtest:acg1rr3cxaykwymwrajgat0vbk44wvzsrj0ftk7wb1",
    "contract_type":"erc721",
    "user": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "token_id":"23",
    "amount":1
}
```

{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| amount         | The amount of the nft                                         | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                           | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| contract       | The address of the nft                                        | string  |
| error          | The error during executing tx                                 | string  |
| hash           | The hash of the transaction                                   | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| token\_id      | The id of the token                                           | string  |
| user           | The address of the user                                       | string  |
| tx\_id         | The id of the transaction                                     | integer |
| mint\_type     | The type of the minting                                       | integer |
| error          | The error during executing the transaction                    | string  |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
{
    "id": 106,
    "created_at": "2022-10-11T17:18:29.494+08:00",
    "updated_at": "2022-10-11T17:18:29.494+08:00",
    "deleted_at": null,
    "app_id": 18,
    "chain_type": 1,
    "chain_id": 1,
    "contract": "cfxtest:acdyu08shg7mu816y0xkty81hev50g7gtu2effygtk",
    "contract_type": 1,
    "tx_id": 767,
    "hash": "",
    "status": 0,
    "error": "",
    "user": "cfxtest:aarep2p1rcadt0j1x0gkybggfkk97uxwty45grxxt7",
    "token_id": "23",
    "amount": 1
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request POST \
  --url https://api.nftrainbow.cn/v1/burns/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
  --data-raw '{
    "chain": "conflux_test",
    "contract_address": "cfxtest:acg1rr3cxaykwymwrajgat0vbk44wvzsrj0ftk7wb1",
    "contract_type":"erc721",
    "user": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
    "token_id":"23",
    "amount":1
}'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token\_id is the number like "123", which type is string
{% endhint %}

## Query Operations

### Query specific Burning NFT information

The `Query specific Burning NFT information` API helps users to query burning record according to `id`.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/burns/{id}" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>id</td><td>The id of the record</td><td>path</td><td>string</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| amount         | The amount of the nft                                         | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                           | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| contract       | The address of the nft                                        | string  |
| error          | The error during executing tx                                 | string  |
| hash           | The hash of the transaction                                   | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| token\_id      | The id of the token                                           | string  |
| user           | The address of the user                                       | string  |
| tx\_id         | The id of the transaction                                     | integer |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
{
    "id": 106,
    "created_at": "2022-10-11T17:18:29.494+08:00",
    "updated_at": "2022-10-11T17:18:44.02+08:00",
    "deleted_at": null,
    "app_id": 18,
    "chain_type": 1,
    "chain_id": 1,
    "contract": "cfxtest:acdyu08shg7mu816y0xkty81hev50g7gtu2effygtk",
    "contract_type": 1,
    "tx_id": 767,
    "hash": "0xc7bc8b1e33c30cd0e522d973b8ab63880549125ec12389701e7e54a6d6836bb0",
    "status": 1,
    "error": "",
    "user": "cfxtest:aarep2p1rcadt0j1x0gkybggfkk97uxwty45grxxt7",
    "token_id": "4646046442",
    "amount": 1
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request get \
  --url https://api.nftrainbow.cn/v1/burns/105 \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
```

{% endtab %}
{% endtabs %}

### Query Burning List

The `Query Burning List` API helps users to query burning list.

{% openapi src="/files/9Xn6Obl1bD1nl4G8Wv3D" path="/v1/burns" method="get" %}
[swagger.json](https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Auth" %}

| Name          | Meaning      | Param Type | Data Type |
| ------------- | ------------ | ---------- | --------- |
| Authorization | Bearer Token | Header     | string    |
| {% endtab %}  |              |            |           |

{% tab title="Parameter" %}

<table><thead><tr><th>Name</th><th>Meaning</th><th>Param Type</th><th>Data Type</th><th data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>page</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>1</td></tr><tr><td>limit</td><td>Page Query</td><td>query</td><td>integer</td><td>false</td><td>10</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

| Name  | Meaning                  | Type        |
| ----- | ------------------------ | ----------- |
| count | The count of the records | string      |
| Items | The array of items       | \[]BurnTask |

The BurnTask struct is showed in the following.

| Name           | Meaning                                                       | Type    |
| -------------- | ------------------------------------------------------------- | ------- |
| created\_at    | The time of creating the item in the database                 | string  |
| updated\_at    | The time of updating the item in the database                 | string  |
| deleted\_at    | The time of deleting the item in the database                 | string  |
| id             | The id of the item in the database                            | integer |
| amount         | The amount of the nft                                         | integer |
| app\_id        | The id of the app                                             | integer |
| chain\_id      | The id of the chain. 1029-mainnet, 1-testnet                  | integer |
| chain\_type    | The type of the chain. 1-CFX, 2-ETH                           | integer |
| contract\_type | The type of the contract. 1-ERC721, 2-ERC1155                 | integer |
| contract       | The address of the nft                                        | string  |
| error          | The error during executing tx                                 | string  |
| hash           | The hash of the transaction                                   | string  |
| status         | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
| token\_id      | The id of the token                                           | string  |
| user           | The address of the user                                       | string  |
| tx\_id         | The id of the transaction                                     | integer |
| {% endtab %}   |                                                               |         |

{% tab title="Response Example" %}

```
{
    "count": 1,
    "items": [
        {
            "id": 1,
            "created_at": "2022-10-10T23:07:17.747+08:00",
            "updated_at": "2022-10-10T23:07:36.485+08:00",
            "deleted_at": null,
            "app_id": 19,
            "chain_type": 1,
            "chain_id": 1029,
            "contract": "cfx:acd1pmsj9crnr79rmmd9ne5pb5dbk51p4ydf6msz5e",
            "contract_type": 2,
            "tx_id": 657,
            "hash": "0x26acea5c8f60aeb8964e6505e33b66cbb017185b93d7ea1fb9d4d80139a307a8",
            "status": 1,
            "error": "",
            "user": "cfx:aat5w71vgxyumvm2bzsxshed027rwjst6e8mt3sam0",
            "token_id": "9262474764",
            "amount": 1
        }
    ]
}
```

{% endtab %}

{% tab title="Requst Sample" %}

```
curl --request GET \
  --url https://api.nftrainbow.cn/v1/burns/ \
  --header 'Authorization: Bearer {JWT}' \
  --header 'Content-Type: application/json' \ 
```

{% endtab %}
{% endtabs %}


# SDKs


# Common Errors

## Mint 操作失败常见错误及原因

Rainbow 控制台铸造列表和 OpenAPI mints 列表接口均可以看到铸造的状态，如果失败的话，可以看到失败原因。以下是 NFT 铸造时可能遇到的一些错误，及原因，同时给出了可能的解决方法。

### NotEnoughCash

#### 错误详情

```
estimate error: Can not estimate: transaction execution failed, all gas will be charged (
execution error: NotEnoughCash { required: 625000000000000000, got: 0, actual_gas_cost: 0, max_storage_limit_cost: 625000000000000000 }), 
data: NotEnoughCash { required: 625000000000000000, got: 0, actual_gas_cost: 0, max_storage_limit_cost: 625000000000000000 }
```

#### 原因及解决方法

此错误产生，是因为交易上链时无法支付足够的上链费用而失败。此种情况大概率是因为`合约未设置代付`，或`合约代付已用完`。

为合约设置或补充代付重新发送交易即可解决此问题。

#### 为什么合约有足够的代付，仍然铸造失败，返回此错误?

此种情况请检查:

1. 合约代付白名单是否正常打开（使用 Rainbow 部署的合约会默认打开白名单）。单独部署合约可自行检查是否打开
2. 合约燃气代付上限设置是否足够。如果交易燃气消耗较大，超过燃气代付上限，则交易不会被代付。通常批量 mint 交易所消耗燃气较大

备注：Rainbow 默认推荐设置燃气上限为 100w Gdrip，普通单 NFT 铸造燃气消耗量为 10-20w Gdrip. 如果需要进行 batch 铸造操作，建议设置一个较大的燃气上限比如 1000w Gdrip.

### ERC721: token already minted

#### 错误详情

```
estimate error: Estimation isn't accurate: transaction is reverted: ERC721: token already minted.
 Innermost error is at CFX:TYPE.CONTRACT:ACA0P90602FKGS7CVRJ5AGS8830GT7P63PSMJ7G0NU: Vm reverted. 
 ERC721: token already minted., data: CFX:TYPE.CONTRACT:ACA0P90602FKGS7CVRJ5AGS8830GT7P63PSMJ7G0NU: Vm reverted. 
 ERC721: token already minted CFX:TYPE.CONTRACT:ACGVX1PDSWDZGKNTGRG0DV49XS2AC0B8RU06696HX1: Vm reverted. ERC721: token already minted
```

#### 原因及解决方法

在 721 类型合约中，一个 tokenId 只能进行一次铸造操作，如果某个 tokenId 重复进行铸造操作，则会失败，返回此错误。

在铸造 721 NFT 时，只需自行控制好 tokenId 不重复使用，即可避免此问题

### xxx discarded due to out of balance

#### 错误详情

```
Invalid parameters: tx, data: "Transaction 0xdaba3ea56331e16e45fa0574d43072a76d7da43c473aa7be7a12649214d74ba3 is 
discarded due to out of balance, needs 13760882000000000 but account balance is 0"
```

#### 原因及解决方法

此错误亦是因为交易上链时无法支付足够的上链费用，在发送到区块链节点交易池时失败了。确切一点的话此错误最有可能是`交易的燃气消耗超过了合约燃气上限`。通常在 batch 铸造操作中可能会遇到此错误。

可通过提高合约燃气代付上限来解决此问题

### xxx exceeds the maximum value 15000000, the half of pivot block gas limit

#### 错误详情

```
Invalid parameters: tx, data: "transaction gas 20436888 
exceeds the maximum value 15000000, the half of pivot block gas limit"
```

#### 原因及解决方法

在 Conflux 树图链，单笔交易允许的燃气用量为 1500w，如果超过则会报此错误。

降低交易燃气用量即可解决此错误，如果是在进行 batch 铸造操作，可降低 batch 铸造的 NFT 数量。如果合约燃气上限设置为 1000w，单次 batch 铸造量建议为 50

### AccessControl

#### 错误详情

```
error: estimate error: Estimation isn't accurate: transaction is reverted: AccessControl: 
account 0x1d6a8330ef25759f92a02d0bf.... Innermost error is at CFXTEST:TYPE.CONTRACT:ACB7UNP488HY4PWC7TAHGMPKXRGKW7XS465P8G9C3U: 
Vm reverted. AccessControl: account 0x1d6a8330ef25759f92a02d0bf...., data: CFXTEST:TYPE.CONTRACT:ACB7UNP488HY4PWC7TAHGMPKXRGKW7XS465P8G9C3U: 
Vm reverted. AccessControl: account 0x1d6a8330ef25759f92a02d0bf...
```

#### 原因及解决方法

此错误表示交易发送方，没有铸造 NFT 的权限。通常此错误是因为合约部署时`没有打开管理员转移权限`，或者调用铸造接口时，`使用了错误的项目 appId&appSecret` （项目跟合约不匹配）。

此时检查合约设置，或 appId 与合约的对应关系，调整即可.

### NFT: URI different with previous

#### 错误详情

```
error: estimate error: Estimation isn't accurate: transaction is reverted: 
NFT: URI different with previous. Innermost error is at CFX:TYPE.CONTRACT:ACA0E92WW1PPWJFWEYHVXBUEKRU16JNUKPE0EWSG0B: 
Vm reverted. NFT: URI different with previous., data: CFX:TYPE.CONTRACT:ACA0E92WW1PPWJFWEYHVXBUEKRU16JNUKPE0EWSG0B: 
Vm reverted. NFT: URI different with previous CFX:TYPE.CONTRACT:ACBHEEV04431G3HUPU18BW57K8E5K8TM26PGBV6S0Y: 
Vm reverted. NFT: URI different with previous
```

#### 原因及解决方法

此错误表示在铸造 NFT 时，NFT 的 Token `URI` 与之前的不一致，1155 NFT 单个 tokenId 可铸造多个（多次），但要求多次铸造时必须使用相同的 token\_uri，否则会报此错误。

### ERC1155: transfer to non ERC1155Receiver implement

#### 错误详情

```
error: estimate error: Estimation isn't accurate: transaction is reverted: ERC1155: transfer to non ERC1155Receiver implement.... 
Innermost error is at CFXTEST:TYPE.CONTRACT:ACDT6158XGRMEMPRMFFJN4DA5VRKH5M9CESGWBJK8Y: Vm reverted. ., 
data: CFXTEST:TYPE.CONTRACT:ACDT6158XGRMEMPRMFFJN4DA5VRKH5M9CESGWBJK8Y: Vm reverted.
CFXTEST:TYPE.CONTRACT:ACAKSW1DP0PK9R8N9ECRD0FR9ZAZKKTTB6TXJ1GKH1: Vm reverted.
CFXTEST:TYPE.CONTRACT:ACDT6158XGRMEMPRMFFJN4DA5VRKH5M9CESGWBJK8Y: Vm reverted. ERC1155: transfer to non ERC1155Receiver implement...
CFXTEST:TYPE.CONTRACT:ACAKSW1DP0PK9R8N9ECRD0FR9ZAZKKTTB6TXJ1GKH1: Vm reverted. ERC1155: transfer to non ERC1155Receiver implement...
```

#### 原因及解决方法

此错误表示在 NFT 铸造或转移时，`接收方`是一个合约地址，但没有实现 ERC1155Receiver 接口，即没有 `onERC1155Received` 函数。

此时更换接受地址即可。

### xxx discarded due to a too stale nonce

#### 错误详情

```
error: Invalid parameters: tx, data: "Transaction 0x484dfc2fc6716833cc13b5903a0b12b0521769821a420afc6cecfd738e261772 is 
discarded due to a too stale nonce"
```

#### 原因及解决方法

此错误表示由于某种原因，发送交易所使用的 nonce 已经过期，需要重新获取 nonce 后再次发送交易。

### block\_number is missing for best\_hash

#### 错误详情

```
error: failed to bulk fetch chain infos: Error processing request: block_number is missing for best_hash, data: <nil>
```

#### 原因及解决方法

此错误为偶发性错误，一般为网络问题导致，可稍后重试。


# Authentication

All the open APIs use a single authentication scheme: a Bearer JWT passed in the HTTP request header.

To obtain the access to [open APIs](/api-reference/open-api), users have to do the following:

1. Use `app_id` and `app_secret` to call [login](/api-reference/open-api/login#login) to get the JWT.
2. Add the `Authorization: Bearer {JWT}` in the request header to call the corresponding API. The corresponding example can refer to [sample](/api-reference/open-api/login#request-sample).

{% hint style="info" %}
**Note:** `app_id` and `app_secret` are obtained from Rainbow Console.
{% endhint %}

The Bearer JWT is valid for one hour to call [open APIs](/api-reference/open-api). Once the token is expired for one hour, users have to call [Refersh JWT](/api-reference/open-api/login#refresh_token) to obtain a new JWT. The corresponding example can refer to [sample](/api-reference/open-api/login#request-sample-1).

{% hint style="info" %}
**Note:** Bearer JWT is valid for five hours to call [Refersh JWT](/api-reference/open-api/login#refresh_token). Once the token is expired for five hours, users have to call [login](/api-reference/open-api/login#login) again.
{% endhint %}

To debug various error codes related to authentication, please see[ Error codes.](/about-the-apis/error-codes)


# Error codes

Most errors in Rainbow-API include an error code and a brief explanation.

The possible errors containing the `error codes`, `status code` and how to fix them are listed in the following. &#x20;

### Auth Errors

| ERROR CODE | ERROR MESSAGE                     | EXPLANATION                                                                                          |
| ---------- | --------------------------------- | ---------------------------------------------------------------------------------------------------- |
| 40100      | `Unauthorized`                    | The account does not have the access to kyc file. Please validate your information.                  |
| 40101      | `Unauthorized, invalid JWT token` | The JWT token is invalied. Please use the correct JWT                                                |
| 40102      | `Authorization header is empty`   | The Authorization header is empty. Please add it.                                                    |
| 40103      | `Authorization token is invalid`  | Your authorization token is invalid. Please use the correct JWT.                                     |
| 40104      | `Token is expired`                | Your JWT is expired. Please call refresh JWT to get a new JWT.                                       |
| 40105      | `KYC required`                    | Your personal information has not been validated. Please validate your information.                  |
| 40106      | `No permission to access`         | Your account does not have the permission to access the kyc files. Please validate your information. |
| 40107      | `Auth header is empty`            | Your auth header is empty. Please add the JWT.                                                       |
| 40108      | `Missing exp field`               | The expired time is missing. Please add it.                                                          |
| 40109      | `Exp must be float64 format`      | The expired time should be float64.                                                                  |
| 40110      | `Jwt payload content uncorrect`   | The payload content uncorrect. Please correct it.                                                    |

{% hint style="info" %}
**Note:** The character `*` means the error message is not stationary. It depends on the detailed error. Please refer the detailed error message.
{% endhint %}

### Validation Errors

<table><thead><tr><th width="244.68851346338153">ERROR CODE</th><th width="239.33333333333331">ERROR MESSAGE</th><th>EXPLANATION</th></tr></thead><tbody><tr><td>40000</td><td><code>Invalid request</code></td><td>Your request is invalid. Please check the parameters.</td></tr><tr><td>40001</td><td><code>Invalid app id</code></td><td>Your <code>appid</code> <em>is not valid. Please use the correct <code>app_id</code>.</em></td></tr><tr><td>40002</td><td><code>Invalid address</code></td><td>The input address is incorrect. Please check the address.</td></tr><tr><td>40003</td><td><code>Chain is not supported</code></td><td>The chain type is not supported. The chain type includes <code>conflux</code> and <code>conflux_test</code>.</td></tr><tr><td>40004</td><td><code>Contract type is not supported</code></td><td>The contract type does not be supported. The supported contract type includes <code>ERC721</code> and <code>ERC1155</code>.</td></tr><tr><td>40005</td><td><code>Invalid url</code></td><td>The url path is not true. Please check the url again.</td></tr><tr><td>40006</td><td><code>Invalid metadataId</code></td><td>The metadataID is not true. The length of the metadataid should be 64.</td></tr><tr><td>40007</td><td><code>Invalid mint amount, mint amount could not be 0</code></td><td>The mint amount is invalied. Please set the mint amount again.</td></tr><tr><td>40008</td><td><code>Invalid mint amount, mint amount could not more than 1 for erc 721 contract</code></td><td>The mint amount is invalied. Please set the mint amount again.</td></tr><tr><td>40009</td><td><code>Invalid token ID</code></td><td>The token id is invalied. Please check the token id again.</td></tr><tr><td>40010</td><td><code>Contract type and contract address not match</code></td><td>The contract type and contract address do not match. Please check the contract type again.</td></tr><tr><td>40011</td><td><code>Invalid page or limit</code></td><td>The page or limit are invalid. The parameters should be integer.</td></tr></tbody></table>

### Conflict Errors

<table><thead><tr><th>ERROR CODE</th><th width="293.3333333333333">ERROR MESSAGE</th><th>EXPLANATION</th></tr></thead><tbody><tr><td>40900</td><td><code>Conflict</code></td><td></td></tr><tr><td>40901</td><td><code>company already exists</code></td><td>The company has been validated by other accounts. Please use another one.</td></tr></tbody></table>

### Ratelimit Errors

<table><thead><tr><th>ERROR CODE</th><th width="293.3333333333333">ERROR MESSAGE</th><th>EXPLANATION</th></tr></thead><tbody><tr><td>42900</td><td><code>Too many requests</code></td><td>Too many requests are sent in the meantime. Please reduce the number of requests.</td></tr></tbody></table>

### Internal Server Errors

| ERROR CODE | ERROR MESSAGE              | EXPLANATION                                                        |
| ---------- | -------------------------- | ------------------------------------------------------------------ |
| 50000      | `Internal Server error`    | <p>There are errors in the </p><p>internal server.</p>             |
| 50001      | `database operation error` | The databse operation is not correct. Please check your operation. |
| 50002      | \*                         | The data does not been found in the database.                      |

### Business Errors

<table><thead><tr><th>ERROR CODE</th><th width="293.3333333333333">ERROR MESSAGE</th><th>EXPLANATION</th></tr></thead><tbody><tr><td>60000</td><td><code>Business error</code></td><td>The transactions have not been processed. Please wait.</td></tr><tr><td>60001</td><td><code>Mint limit exceeded</code></td><td>The number of minted NFTs exceed the limits. Please reduce the number of the minted NFTs.</td></tr><tr><td>60002</td><td><code>Deploy limit exceeded</code></td><td>The number of deployed contracts exceed the limits. Please reduce the number of the deployed contracts.</td></tr><tr><td>60003</td><td><code>Uploade file limit exceeded</code></td><td>The number of uploaded files exceed the limits. Please reduce the number of the uploaded files</td></tr><tr><td>60004</td><td><code>Contract has no sponsor</code></td><td>Your contract has no sponsor. Please set the sponsor first.</td></tr><tr><td>60005</td><td><code>Contract sponsor balance not enough</code></td><td>The sponsor balance is not enough. Please connect to the sponsor.</td></tr><tr><td>60006</td><td><code>Contract has no sponsor for application admin</code></td><td>The contract has not sponsors.</td></tr><tr><td>60007</td><td><code>Only admin can reset admin</code></td><td>Only the app admin can reset the contract admin.</td></tr><tr><td>60008</td><td><code>Contract is not belong to this application</code></td><td>Contract does not belong to the application.</td></tr><tr><td>60009</td><td><code>Contract not exist</code></td><td>The contract does not exist. Please use the correct one.</td></tr></tbody></table>


# Quotas and rate limits

## Quotas

| API             | LIMIT TIMEFRAME    | COMMON USER | COMPANY  |
| --------------- | ------------------ | ----------- | -------- |
| Deploy Contract | requests per month | 2           | NO LIMIT |
| Upload file     | requests per month | 10          | NO LIMIT |
| Mint NFTs       | requests per month | 100         | NO LIMIT |

## Rate Limits

| API | LIMIT TIMEFRAME     | FREE TIER LIMIT | GROWTH TIER LIMIT |
| --- | ------------------- | --------------- | ----------------- |
| All | requests per second | 5               | 10                |


