# ERC721 Token

## Endpoint

> **Real Server :** [**https://api.lmtls.io/v1/chain/erc721**](https://api.lmtls.io/v1/chain/erc721)
>
> **Test Server :** [**https://test-api.lmtls.io/v1/chain/erc721**](https://test-api.lmtls.io/v1/chain/erc721)

### getBalance

Return an address Token balance.

#### Parameters

| Name            | Type   | Description                |
| --------------- | ------ | -------------------------- |
| contractAddress | String | Contract address of token. |
| address         | String | Address                    |

#### Return Value

| Name    | Type       | Description               |
| ------- | ---------- | ------------------------- |
| balance | BigInteger | Token balance of address. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "10"
        }
    }
}
```

### getMintedTokenId

Return a minted tokenId.

#### Parameters

| Name          | Type   | Description                    |
| ------------- | ------ | ------------------------------ |
| transactionId | String | TransactionId of erc721\_mint. |

#### Return Value

| Name    | Type       | Description                                       |
| ------- | ---------- | ------------------------------------------------- |
| tokenId | BigInteger | minted tokenId. If it is an error, this is null . |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "tokenId": "1"
        }
    }
}
```

### mint

Create new token with uri data. Only the token owner can do this..

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Address                                                                                                                                                                                                           |
| uri             | String     | <p>The uri data to store in the token.<br>Max length : 100</p>                                                                                                                                                    |
| tempKey         | String     | tempKey for "mint"                                                                                                                                                                                                |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                                                                                        |
| signature       | String     | sign( hash ( contractAddress \| sender \| uri \| tempKey \| hashKey ) ) by owner's privateKey using signData API                                                                                                  |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

{% hint style="info" %}
The generated tokenId can be checked using erc721\_getMintedTokenId API.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab...",
            "nonce": 32
        }
    }
}
```

### getURI

Returns an owner and uri data of tokenId.

#### Parameters

| Name            | Type       | Description               |
| --------------- | ---------- | ------------------------- |
| contractAddress | String     | Contract address of token |
| address         | String     | Address                   |
| tokenId         | BigInteger | Token Id                  |

#### Return Value

| Name  | Type   | Description            |
| ----- | ------ | ---------------------- |
| owner | String | Owner's address        |
| uri   | String | The uri data of token. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "owner":"0x666cf9aed17a9dfb4ae91b8078...",
            "uri":"0xaff42527a42d60ca3fb548fd799b01e6f57e..."
        }
    }
}
```

### transfer

Transfer NFT owner from from-address to to-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| tokenId         | BigInteger | Token Id                                                                                                                                                                                                          |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash ( contractAddress \| sender \| toAddress \| tokenId \| tempKey \| hashKey ) ) by formAddress's privateKey using signData API                                                                           |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| none          | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e972...",
            "noce": 32
        }
    }
}
```

### transferFrom

Transfer NFT owner from from-address to to-address by spender address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| fromAddress     | String     | From address                                                                                                                                                                                                      |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| tokenId         | BigInteger | Token Id                                                                                                                                                                                                          |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash ( contractAddress \| sender \| fromAddress \| toAddress \| tokenId \| tempKey \| hashKey ) ) by address's privateKey using signData API                                                                |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17...",
            "nonce": 32
        }
    }
}
```

### approve

Approve token from owner-address to spender-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| spender         | String     | Spender address                                                                                                                                                                                                   |
| tokenId         | BigInteger | Token Id                                                                                                                                                                                                          |
| tempKey         | String     | tempKey for "approve"                                                                                                                                                                                             |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash ( contractAddress \| sender \| spender \| tokenId \| tempKey \| hashKey ) ) by formAddress's privateKey using signData API                                                                             |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type   | Description    |
| ------------- | ------ | -------------- |
| transactionId | String | Transaction Id |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e1...",
            "nonce": 32
        }
    }
}
```

### getApproved

Returns an allowed token spender from owner address.

#### Parameters

| Name            | Type       | Description                |
| --------------- | ---------- | -------------------------- |
| contractAddress | String     | Contract address of token. |
| address         | String     | Owner address              |
| tokenId         | BigInteger | Token Id                   |

#### Return Value

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| address | String | Spender's address |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "address": "0x666cf9aed17a9dfb4ae91b..."
        }
    }
}
```


---

# 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://docs.lmtls.io/lmtls-tech-summary/chain-api/api-references/erc721-token.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.
