# NFT を発行する

## 手順

### 1. NFT コントラクトを実装・デプロイする

unWallet Enterprise を介して NFT を発行するためには、該当 NFT に相当するコントラクトが以下の条件を満たす必要があります。

* `IAirdroppableNFT` を実装していること
  * `IAirdroppableNFT` の内容については [こちら](https://github.com/SIVIRA/sample-contracts/blob/main/contracts/IAirdroppableNFT.sol) を参照してください
  * `IAirdroppableNFT` に含まれる各関数は、[POST /mintNFT](/01_spec/01_http-endpoint/01_interface/01_blockchain.md#mintnft) を介してコールされます
    * `airdrop`：`nftMetadataType` と `nftMetadataURI` が指定されなかった場合にコールされます
    * `airdropByType`：`nftMetadataType` が指定された場合にコールされます
    * `airdropWithTokenURI`：`nftMetadataURI` が指定された場合にコールされます
* unWallet Enterprise 管理下にある特定のコントラクト（`0xb607656eBB77b4f0e273fFe5Bc613ff46A77E0CC`）から `IAirdroppableNFT` に含まれる各関数をコールできること

簡単のため、ここでは `airdrop` のみを実装したシンプルな NFT コントラクトを利用することとします。実装例は [こちら](https://github.com/SIVIRA/sample-contracts/blob/main/contracts/SampleSingleTypeNFT.sol) を参照してください。

{% hint style="info" %}
本ユースケースでは扱いませんが、`nftMetadataType` を指定して [POST /mintNFT](/01_spec/01_http-endpoint/01_interface/01_blockchain.md#mintnft) をコールしたい場合、対象となる NFT コントラクトが `airdropByType` を実装している必要があります。実装例は [こちら](https://github.com/SIVIRA/sample-contracts/blob/main/contracts/SampleMultipleTypeNFT.sol) を参照してください。
{% endhint %}

{% hint style="info" %}
本ユースケースでは扱いませんが、`nftMetadataURI` を指定して [POST /mintNFT](/01_spec/01_http-endpoint/01_interface/01_blockchain.md#mintnft) をコールしたい場合、対象となる NFT コントラクトが `airdropWithTokenURI` を実装している必要があります。実装例は [こちら](https://github.com/SIVIRA/sample-contracts/blob/main/contracts/SampleNoTypeNFT.sol) を参照してください。
{% endhint %}

### 2. NFT の発行先となるアドレスを決定する

NFT の発行先となるアドレスを決定してください。

unWallet ユーザーに対して NFT を発行したい場合は、[unWallet 認証](/02_usecase/01_connect-to-unwallet.md) を行い、該当ユーザーのウォレットアドレスを取得してください。

### 3. NFT 発行をリクエストする

[POST /mintNFT](/01_spec/01_http-endpoint/01_interface/01_blockchain.md#mintnft) を利用して、NFT 発行をリクエストしてください。

前述した通り、ここでは `airdrop` のみを実装した NFT コントラクトに対して NFT 発行をリクエストしますので、以下のリクエストパラメータを指定することとなります。

* `chainID`：該当 NFT コントラクトがデプロイされているブロックチェーンのチェーン ID
* `nftAddress`：該当 NFT コントラクトのアドレス
* `ownerAddress`：NFT の発行先となるアドレス

なお、[POST /mintNFT](/01_spec/01_http-endpoint/01_interface/01_blockchain.md#mintnft) のレスポンスには NFT 発行トランザクションに関する情報が含まれます。後続の処理で利用しますので、適宜保存しておいてください。

### 4. NFT 発行トランザクションのステータスを確認する

[GET /getTransaction](/01_spec/01_http-endpoint/01_interface/01_blockchain.md#gettransaction) を利用して、NFT 発行トランザクションのステータスを確認することができます。

リクエスト直後のステータスは `pending` ですが、該当トランザクションがブロックチェーンに取り込まれると `success` または `failure` に変わります。このことを考慮して後続の処理を行なってください。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.ent.unwallet.world/02_usecase/02_mint-nft.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
