# CW721

## Introduction

The **CW721** ADO is a smart contract to allow users to launch their own custom NFT projects. In addition to the standard CW721 messages, we have added some custom logic to further extend the utility and function of the contract.&#x20;

The CW721 ADO is one of the base ADOs meaning it can interact with a large number of other ADOs such as the marketplace, crowdfund, auction, CW721 timelock and many more.

The contract has implemented a custom `TransferAgreement` message to allow the buying/selling of tokens between two parties throught the CW721 ADO itself.

**Ado\_type**: cw721

**Version: 2.1.0**

## InstantiateMsg

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

```rust
pub struct InstantiateMsg {
    pub name: String,
    pub symbol: String,
    pub minter: AndrAddr,
    pub kernel_address: String,
    pub owner: Option<String>,
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
"name": "Example Token",
"symbol": "ET",
"minter":"andr1...",
"kernel_address":"andr1..."
}
        
```

{% endtab %}
{% endtabs %}

| Name             | Type                                                                                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`           | String                                                                                               | The name of the NFT collection.                                                                                                                                                                                                                                                                                                                                                                                                             |
| `symbol`         | String                                                                                               | The symbol of the NFT collection.                                                                                                                                                                                                                                                                                                                                                                                                           |
| `minter`         | [AndrAddr](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#andraddr) | The address allowed to mint NFTs.                                                                                                                                                                                                                                                                                                                                                                                                           |
| `kernel_address` | String                                                                                               | Contract address of the [kernel contract](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/andromeda-messaging-protocol/kernel) to be used for [AMP](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/andromeda-messaging-protocol) messaging. Kernel contract address can be found in our [deployed contracts](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/deployed-contracts). |
| `owner`          | Option\<String>                                                                                      | Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.                                                                                                                                                                                                                                                                                                                                 |

## ExecuteMsg

### Mint

Mints a new NFT.

{% hint style="warning" %}
Only available to the defined `minter` in the `InstantiateMsg.`
{% endhint %}

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

<pre class="language-rust"><code class="lang-rust">pub enum ExecuteMsg  {
<strong>   Mint {
</strong>    pub token_id: String,
    pub owner: String,
    pub token_uri: Option&#x3C;String>,
    pub extension: TokenExtension,
   }
}
</code></pre>

{% endtab %}

{% tab title="JSON" %}

```javascript
{
"mint": {                                                                                                                             
    "token_id": "1",
    "owner": "andr1...",
    "token_uri":"https://gateway.pinata.cloud/ipfs...",
    "extension": {
            "publisher": "Andromeda"
        }
    }
}
```

{% endtab %}
{% endtabs %}

| Name        | Type            | Description                                                                                                                                                 |
| ----------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token_id`  | String          | Unique Id of the NFT.                                                                                                                                       |
| `owner`     | String          | The address of the NFT owner.                                                                                                                               |
| `token_uri` | Option\<String> | URI pointing to the NFT metadata. You can read more about the NFT token URI and metadata standards [here](https://docs.opensea.io/docs/metadata-standards). |
| `extension` | TokenExtension  | Any custom extension used by this contract. Here we use [TokenExtension](#tokenextension).                                                                  |

### TokenExtension

Extension that can be added to an NFT when minting.

```rust
pub struct TokenExtension {
   pub publisher: String,
}
```

<table><thead><tr><th width="248.55224634023222">Name</th><th width="260.3333333333333">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>publisher</code></td><td>String</td><td>The entity to assign as the publisher of the NFT e.g. "Andromeda" or "Bob". (Immutable).</td></tr></tbody></table>

### BatchMint

Mint several NFTs at once.&#x20;

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

<pre class="language-rust"><code class="lang-rust"><strong>pub enum ExecuteMsg {
</strong>   BatchMint {
        tokens: Vec&#x3C;MintMsg>,
    }
}
</code></pre>

{% endtab %}

{% tab title="JSON" %}

```json
{
  "batch_mint": {
    "tokens": [
      {
        "token_id": "1",
        "owner": "andr1...",
        "token_uri":"https://gateway.pinata.cloud/ipfs...",
        "extension": {
          "publisher": "Andromeda"
        }
      },
      {
        "token_id": "2",
        "owner": "andr1...",
        "token_uri":"https://gateway.pinata.cloud/ipfs...",
        "extension": {
          "publisher": "Andromeda"
        }
      },
      {
        "token_id": "3",
        "owner": "andr1...",
        "token_uri":"https://gateway.pinata.cloud/ipfs...",
        "extension": {
          "publisher": "Andromeda"
        }
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th>Name</th><th width="294">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokens</code></td><td>Vec<a href="#mint">&#x3C;MintMsg</a>></td><td>Vector of MintMsg. Similar to minting one token, but allows minting of many tokens in one go. </td></tr></tbody></table>

### TransferAgreement

Assigns a `TransferAgreement` for a token. If the `agreement` field is not set, the message will remove any previously set agreements on the token (Instead of making a new RemoveAgreement message).

{% hint style="warning" %}
Only available to the token owner.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
       TransferAgreement {
           token_id: String,
           agreement: Option<TransferAgreement>,
        }
  }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"transfer_agreement":{
    "token_id":"1",
    "agreement":{
        "amount":{
            "raw":{
                "denom":"uandr",
                "amount":"1000000"
                }
            },
         "purchaser":"andr1..."
         }
   }
 }
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th>Name</th><th width="262.3333333333333">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>token_id</code></td><td>String</td><td>The token Id of the NFT we want to add an agreement for.</td></tr><tr><td><code>agreement</code></td><td>Option&#x3C;<a href="#transferagreement-1">TransferAgreement</a>></td><td>The agreement for the token containing the selling price and the address allowed to purchase the token. If not specified then any previously set agreement is removed from the token.</td></tr></tbody></table>

#### TransferAgreement

The `purchaser` may use the `TransferNft` message for this token as long as funds are provided equaling the `amount` defined in the agreement.

If the `purchaser` is set to `"*"` then anyone can complete the `TransferAgreement` (Anyone can buy the NFT).

```rust
pub struct TransferAgreement {
    pub amount: Coin,
    pub purchaser: String,
}
```

| Name        | Type                                                                                         | Description                                                               |
| ----------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `amount`    | [Coin](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#coin) | The amount required for the purchaser to transfer ownership of the token. |
| `purchaser` | String                                                                                       | The address of the purchaser that is allowed to purchase the token.       |

### TransferNft

A CW721 compliant transfer method. Transfers ownership of a minted token.

{% hint style="warning" %}
Archived tokens cannot be transferred.

Only available to the contract owner, an approved operator, or a purchaser in a [`TransferAgreement`](#transferagreement) for the given token.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    TransferNft {
        recipient: AndrAddr,
        token_id: String,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "transfer_nft": {
        "recipient": "andr1...",
        "token_id": "anewtoken"
    }
}
```

{% endtab %}
{% endtabs %}

| Name        | Type                                                                                                 | Description                                  |
| ----------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| `recipient` | [AndrAddr](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#andraddr) | The address to receive the NFT.              |
| `token_id`  | String                                                                                               | The token Id of the token to be transferred. |

### SendNft

A CW721 compliant send method. Sends ownership of a minted token to an external contract.

{% hint style="warning" %}
Only available to the token owner/operator/approved address.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    SendNft {
        contract: AndrAddr,
        token_id: String,
        msg: Binary,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "send_nft": {
        "contract": "andr1...",
        "token_id": "anewtoken",
        "msg":"eyJzdGFydF9hdWN0aW9uIjogeyJzdGFydF90aW1lIjogMTY2MzMzNDk3MDIxMSwiZHVyYXRpb24iOiA5MDAwMDAsImNvaW5fZGVub20iOiAidWFuZHIiLCJtaW5fYmlkIjoiMzAwIiwid2hpdGVsaXN0IjogWyJhbmRyMS4uLiIsICJhbmRyMS4uLiIsIC4uLl19fQ=="
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type                                                                                                 | Description                                     |
| ---------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `contract` | [AndrAddr](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#andraddr) | The address of the receiving contract.          |
| `token_id` | String                                                                                               | The Id of the token to be sent.                 |
| `msg`      | Binary                                                                                               | A message to be sent to the receiving contract. |

### Burn <a href="#mintmsg" id="mintmsg"></a>

Destroys any token data related to an token Id. The Id of the token is still reserved.

{% hint style="warning" %}
Cannot be undone.

Only available to the token owner.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    Burn {
        token_id: String,
    },
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "burn": {
        "token_id": "1"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description                  |
| ---------- | ------ | ---------------------------- |
| `token_id` | String | The Id of the token to burn. |

### Archive <a href="#mintmsg" id="mintmsg"></a>

Archives an token, making it immutable in any respect. Once an token is archived it cannot be edited, transferred or burnt.&#x20;

{% hint style="warning" %}
Cannot be undone.

Only available to the token owner.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    Archive {
        token_id: String,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "archive": {
        "token_id": "1"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description                     |
| ---------- | ------ | ------------------------------- |
| `token_id` | String | The Id of the token to archive. |

### Approve

A CW721 compliant approve method. Approves a given address as an operator for the token, allowing them to transfer, burn or archive the token.

{% hint style="warning" %}
Only available to the token owner/operator.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    Approve {
        spender: String,
        token_id: String,
        expires: Option<Expiration>,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "approve": {
        "spender": "andr1...",
        "token_id": "1"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type                                                                                                             | Description                                                           |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `spender`  | String                                                                                                           | The address to be authorised as an operator.                          |
| `token_id` | String                                                                                                           | The id of the token for which to assign the `spender` as an operator. |
| `expires`  | Option<[Expiration](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#expiration)> | An optional expiration for the approval. Defaults to never.           |

### Revoke

A CW721 compliant revoke method. Revokes operator privileges for a given address.&#x20;

{% hint style="warning" %}
Only available to the token owner/operator.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    Revoke {
        spender: String,
        token_id: String,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "revoke": {
        "spender": "andr1...",
        "token_id": "1"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description                                                  |
| ---------- | ------ | ------------------------------------------------------------ |
| `spender`  | String | The address of the operator for which to revoke privileges.  |
| `token_id` | String | The Id of the token for which to revoke operator privileges. |

### ApproveAll

A CW721 compliant approve all method. Approves a given address as an operator for all tokens owned by the sender.

{% hint style="warning" %}
Will overwrite any approval currently assigned to the operator's address.
{% endhint %}

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

```rust
pub enum ExecuteMsg {
    ApproveAll {
        operator: String,
        expires: Option<Expiration>,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "approve_all": {
        "operator": "andr1..."
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type                                                                                                             | Description                                                 |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| `operator` | String                                                                                                           | The address to be authorised as an operator.                |
| `expires`  | Option<[Expiration](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#expiration)> | An optional expiration for the approval. Defaults to never. |

### RevokeAll

A CW721 compliant revoke all method. Revokes an operator's privileges for any tokens owned by the sender.

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

```rust
pub enum ExecuteMsg {
    RevokeAll {
        operator: String,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "revoke_all": {
        "operator": "andr1..."
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description                                                 |
| ---------- | ------ | ----------------------------------------------------------- |
| `operator` | String | The address of the operator for which to revoke privileges. |

### Base Executes

The rest of the execute messages can be found in the[ ADO Base](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/ado-base) section.

## QueryMsg

### Minter

Queries the current minter of the contract.

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

```rust
pub enum QueryMsg{
    #[returns(MinterResponse)]
    Minter{},
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"minter":{}
}
```

{% endtab %}
{% endtabs %}

#### MinterResponse

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

```rust
pub struct MinterResponse{
        minter: Option<String>,
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"minter":"andr1..."
}
```

{% endtab %}
{% endtabs %}

### OwnerOf

A CW721 compliant "owner of" query. Queries the current owner of a given token Id.

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

```rust
pub enum QueryMsg {
    #[returns(OwnerOfResponse)]
    OwnerOf {
        token_id: String,
        include_expired:bool,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "owner_of": {
        "token_id": "1",
        "include_expired": false
    }
}
```

{% endtab %}
{% endtabs %}

| Name              | Type   | Description                            |
| ----------------- | ------ | -------------------------------------- |
| `token_id`        | String | The Id of the token to query.          |
| `include_expired` | bool   | Whether to include any expired owners. |

#### OwnerOfResponse

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

```rust
pub struct OwnerOfResponse {
    pub owner: String,
    pub approvals: Vec<Approval>,
}

```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "owner": "andr1...",
    "approvals": [
        {
            "spender": "andr1...",
            "expires": "never"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

| Name        | Type                         | Description                              |
| ----------- | ---------------------------- | ---------------------------------------- |
| `owner`     | String                       | The owner of the queried token.          |
| `approvals` | Vec<[Approval](#approval-1)> | An array of all approvals for the token. |

#### Approval

```rust
pub struct Approval {
    pub spender: String,
    pub expires: Expiration,
}
```

| Name      | Type                                                                                                     | Description                      |
| --------- | -------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `spender` | String                                                                                                   | The address that is approved.    |
| `expires` | [Expiration](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#expiration) | The expiration for the approval. |

### Operator

Returns the  approval of a given operator for all tokens of an owner. Errors if no approvals are set.

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

```rust
pub enum QueryMsg {
   #[returns(cw721::OperatorResponse)]
   Operator {
        owner: String,
        operator: String,
        include_expired: Option<bool>,
    }
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"operator":{
    "owner":"andr1...",
    "operator":"andr1...",
    "include_expired": false
    }
}
```

{% endtab %}
{% endtabs %}

| Name              | Type          | Description                                                                     |
| ----------------- | ------------- | ------------------------------------------------------------------------------- |
| `owner`           | String        | The address of the NFTs owner.                                                  |
| `operator`        | String        | The address of the operator that has approvals over the specified `owner` NFTs. |
| `include_expired` | Option\<bool> | Whether to include any expired approvals.                                       |

#### OperatorResponse

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

```rust
#[cw_serde]
pub struct OperatorResponse {
    pub approval: Approval,
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"approval":{
    "spender": "andr1...",
    "expires":{
            "at_time": "16705100749238434832"
        }
    }
 }
```

{% endtab %}
{% endtabs %}

Returns an [Approval](#approval) struct.

### AllOperators

List all operators that can access all of the owner's tokens.

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

```rust
pub enum QueryMsg {
    #[returns(OperatorsResponse)]
    AllOperators {
        owner: String,
        include_expired: Option<bool>,
        start_after: Option<String>,
        limit: Option<u32>,
    },
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "all_operators": {
        "owner": "andr1...",
        "include_expired": true,
        "start_after":"andr1...",
        "limit": 10
    }
}
```

{% endtab %}
{% endtabs %}

| Name              | Type            | Description                                                                                                         |
| ----------------- | --------------- | ------------------------------------------------------------------------------------------------------------------- |
| `owner`           | String          | The address of the owner for which to query operators.                                                              |
| `include_expired` | Option\<bool>   | Whether to include any expired approvals.                                                                           |
| `limit`           | Option\<u32>    | An optional limit on how many approvals are returned. The default limit is 10 and the maximum limit allowed is 100. |
| `start_after`     | Option\<String> | An optional address for which to start after, used for pagination.                                                  |

#### OperatorsResponse

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

```rust
pub struct OperatorsResponse {
    pub operators: Vec<Approval>,
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "operators": [
        {
            "spender": "andr1...",
            "expires":{
                "at_time": "16705100749238434832"
            }
        },
      ...
    ]
}
```

{% endtab %}
{% endtabs %}

| Name        | Type                         | Description                                            |
| ----------- | ---------------------------- | ------------------------------------------------------ |
| `approvals` | Vec<[Approval](#approval-1)> | An array of all approvals for the given owner address. |

### NumTokens

A CW721 compliant "num tokens" query. Queries the amount of tokens minted by the contract.

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

```rust
pub enum QueryMsg {
    #[returns(NumTokensResponse)]
    NumTokens {}
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
"num_tokens": {}
}
```

{% endtab %}
{% endtabs %}

#### NumTokensResponse

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

```rust
pub struct NumTokensResponse {
    pub count: u64,
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "count": 1
}
```

{% endtab %}
{% endtabs %}

| Name    | Type | Description                                  |
| ------- | ---- | -------------------------------------------- |
| `count` | u64  | The amount of tokens minted by the contract. |

### NftInfo

A CW721 compliant "nft info" query. Queries the stored info of a token.

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

```rust
pub enum QueryMsg {
    #[returns(NftInfoResponse<TokenExtension>)]
    NftInfo {
        token_id: String,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "nft_info": {
        "token_id": "1"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description          |
| ---------- | ------ | -------------------- |
| `token_id` | String | The id of the token. |

#### NftInfoResponse

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

```rust
pub struct NftInfoResponse<T> {
    pub token_uri: Option<String>,
    pub extension: T,
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
   "token_uri":"ipfs://QmT6NxhMpZEXePZ4PvK8gN92sZkA8cm43UAcJ3zAZ9ErCj",
   "extension":{
         "name":"mytoken",
         "publisher":"publisher",
         "description":"This token ....",
         "archived": false
        }
 }
```

{% endtab %}
{% endtabs %}

| Name        | Type             | Description                                                                                                                                           |
| ----------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token_uri` | String           | A URI pointing to metadata for the NFT. Typically an IPFS link that follows the [metadata standard](https://docs.opensea.io/docs/metadata-standards). |
| `extension` | T (Generic type) | Any extension being used by the contract to add custom metadata to the tokens.                                                                        |

### AllNftInfo

A CW721 compliant "all nft info" query. Queries all stored info of an token.

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

```rust
pub enum QueryMsg {
    #[returns(AllNftInfoResponse<TokenExtension>)]
    AllNftInfo {
        token_id: String,
        include_expired: Option<bool>
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "all_nft_info": {
        "token_id": "1",
        "include_expired": false
    }
}
```

{% endtab %}
{% endtabs %}

| Name              | Type          | Description                               |
| ----------------- | ------------- | ----------------------------------------- |
| `token_id`        | String        | The token id of the NFT.                  |
| `include_expired` | Option\<bool> | Whether to include any expired approvals. |

#### AllNftInfoResponse

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

```rust
pub struct AllNftInfoResponse<T> {
    pub access: OwnerOfResponse,
    pub info: NftInfoResponse<T>,
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "access": {
        "owner": "andr1...",
        "approvals": [
            {
                "spender": "andr1...",
                "expires": "never"
            }
        ]
    },
    "info": {
        "name": "A New Token",
        "description": "A newly minted token",
        "extension": {
            "archived": false,
            "metadata": "{ \"some_json_field\": \"some_json_value\" }",
            "agreement": {
                "purchaser": "andr1...",
                "amount": "100uandr"
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

| Name     | Type                                | Description                              |
| -------- | ----------------------------------- | ---------------------------------------- |
| `access` | [OwnerOfResponse](#ownerofresponse) | The address that can transfer the token. |
| `info`   | [NFtInfoResponse](#nftinforesponse) | Data on the token itself.                |

### IsArchived

Checks if the token with the specified `token_id` is archived.

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

```rust
pub enum QueryMsg {
   #[returns(bool)]
   IsArchived {
         token_id: String,
        }
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"is_archived":{
    "token_id":"3"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description                                 |
| ---------- | ------ | ------------------------------------------- |
| `token_id` | String | The `token_id` of the NFT we want to check. |

Returns a bool value.

### TransferAgreement

Checks if the token has a [TransferAgreement ](#transferagreement).

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

```rust
pub enum QueryMsg {
      #[returns(Option<TransferAgreement>)]
      TransferAgreement {
        token_id: String,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"transfer_agreement":{
    "token_id":"3"
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type   | Description                                |
| ---------- | ------ | ------------------------------------------ |
| `token_id` | String | The token\_id of the nft we want to check. |

Returns None if no TransferAgreement is found, and the [TransferAgreement](#transferagreement) struct otherwise.

### Tokens

Queries all the tokens of a particular owner.

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

```rust
pub enum QueryMsg {
    #[returns(TokensResponse)]
    Tokens {
        owner: String,
        start_after: Option<String>,
        limit: Option<u32>,
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"tokens": {
            "owner":"andr1...",
            "start_after":"3",
            "limit": 25
            }
    }

```

{% endtab %}
{% endtabs %}

| Name          | Type            | Description                                                                                         |
| ------------- | --------------- | --------------------------------------------------------------------------------------------------- |
| `owner`       | String          | The address that we want to check the tokens of                                                     |
| `start_after` | Option\<String> | An optional address for which to start after, used for pagination.                                  |
| `limit`       | Option\<u32>    | Optional limit to the number of tokens queried. It is set by default as 10 and can be set up to 30. |

#### TokensResponse

Contains all token\_ids in lexicographical ordering. If there are more than `limit`, use `start_from` in future queries to achieve pagination.

```rust
pub struct TokensResponse {
    pub tokens: Vec<String>,
}
```

### AllTokens

Queries the tokens minted by the contract.

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

```rust
 pub enum QueryMsg {
    #[returns(TokensResponse)]
    AllTokens {
        start_after: Option<String>,
        limit: Option<u32>,
        }
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "all_tokens": {
          "limit": 5
          }
  }
```

{% endtab %}
{% endtabs %}

| Name          | Type            | Description                                                                                         |
| ------------- | --------------- | --------------------------------------------------------------------------------------------------- |
| `start_after` | Option\<String> | An optional address for which to start after, used for pagination.                                  |
| `limit`       | Option\<u32>    | Optional limit to the number of tokens queried. It is set by default as 10 and can be set up to 30. |

#### TokensResponse

Contains all token\_ids in lexicographical ordering. If there are more than `limit`, use `start_from` in future queries to achieve pagination.

```rust
pub struct TokensResponse {
    pub tokens: Vec<String>,
}
```

### ContractInfo

Queries the  name and symbol of  the token collection.

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

```rust
pub enum QueryMsg {
    #[returns(ContractInfoResponse)]
    ContractInfo {}
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "contract_info": {}
}
```

{% endtab %}
{% endtabs %}

#### ContractInfoResponse

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

```rust
pub struct CotractInfoResponse {
    pub name: String,
    pub symbol: String,
}
```

{% endtab %}

{% tab title="JSON" %}

```javascript
{
    "name": "Example Token",
    "symbol": "ET"
}
```

{% endtab %}
{% endtabs %}

| Name     | Type   | Description                          |
| -------- | ------ | ------------------------------------ |
| `name`   | String | The name of the contract.            |
| `symbol` | String | The assigned symbol of the contract. |

### Approval

Queries the spender's approval to check for the expiration.

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

```rust
 pub enum QueryMsg {
 Approval {
        token_id: String,
        spender: String,
        include_expired: Option<bool>,
    }
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"approval":{
    "token_id":"my_token";
    "spender":"andr1...";
    "include_expired": true
    }
} 
```

{% endtab %}
{% endtabs %}

| Name              | Type          | Description                                                        |
| ----------------- | ------------- | ------------------------------------------------------------------ |
| `token_id`        | String        | The token Id of the NFT to check.                                  |
| `spender`         | String        | The address to check the approvals.                                |
| `include_expired` | Option\<bool> | Optional flag to include the expired approvals. Defaults to false. |

#### ApprovalResponse

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

```rust
pub struct ApprovalResponse {
    pub approval: Approval,
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"spender":"andr1...";
"expires":{
    "at_height": 500
    }
}
```

{% endtab %}
{% endtabs %}

| Name       | Type     | Description                                               |
| ---------- | -------- | --------------------------------------------------------- |
| `approval` | Approval | The approved spender and the expiration for the approval. |

```rust
pub struct Approval {
    pub spender: String,
    pub expires: Expiration,
}
```

| Name      | Type                                                                                                     | Description                                            |
| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| `spender` | String                                                                                                   | Account that can transfer/send the token               |
| `expires` | [Expiration](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/common-types#expiration) | When the Approval expires. Might be Expiration::never. |

### Approvals

Returns all the approvals a token has.

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

```rust
pub enum QueryMsg{
  Approvals {
        token_id: String,
        include_expired: Option<bool>,
    }
 }
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"approval":{
    "token_id":"my_token";
    "include_expired": true
    }
}
```

{% endtab %}
{% endtabs %}

| Name              | Type          | Description                                                        |
| ----------------- | ------------- | ------------------------------------------------------------------ |
| `token_id`        | String        | The token Id of the NFT to get approvals for.                      |
| `include_expired` | Option\<bool> | Optional flag to include the expired approvals. Defaults to false. |

#### ApprovalsResponse

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

```rust
pub struct ApprovalsResponse {
    pub approvals: Vec<Approval>,
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
"approvals":[    
                {
                    "spender":"andr1...";
                    "expires":{
                        "at_height": 500
                         }
                    },
                    {
                    "spender":"andr1...";
                    "expires":{
                        "at_height": 500
                        }
                    },
                    ...
            ]
}
```

{% endtab %}
{% endtabs %}

Return a vector of [Approval](#approval).

### &#x20;Base Queries

The rest of the query messages can be found in the[ ADO Base](https://docs.andromedaprotocol.io/andromeda/platform-and-framework/ado-base) section.
