Skip to content

Latest commit

 

History

History
234 lines (203 loc) · 21.9 KB

File metadata and controls

234 lines (203 loc) · 21.9 KB

export const title = "Komodo DeFi SDK Common Structures: Non-Fungible Tokens"; export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0.";

Non-Fungible Token Structures

The following structures are used in the Komodo DeFi SDK for non-fungible tokens (NFTs).

NftInfoBasic

The NftInfoBasic object includes the following items for a given token:

Parameter Type Description
amount string The amount of this NFT the user owns (used by ERC1155).
chain string Chain name. One of AVALANCHE, BSC, ETH, FANTOM, or POLYGON.
contract_type string The type of NFT contract standard. One of ERC721 or ERC1155.
token_address string The address of the NFT contract.
token_id string The token ID of the NFT.

NftInfo

The NftInfo object includes the following items for a given token:

Parameter Type Description
amount string The amount of this NFT the user owns (used by ERC1155).
block_number_minted integer The block height when the NFT was minted. May be null.
block_number integer The block height when the amount or owner changed.
chain string Chain name. One of AVALANCHE, BSC, ETH, FANTOM, or POLYGON.
name string May be null. An NFT collection name.
contract_type string The type of NFT contract standard. One of ERC721 or ERC1155.
last_token_uri_sync string When the token_uri was last updated.
last_metadata_sync string When the metadata was last updated.
metadata string The metadata of the token. May be null.
minter_address string Minter address. May be null.
owner_of string The wallet address of the owner of the NFT.
possible_spam boolean If true, the contract address has been identified as associated with spam or suspicious activities.
possible_phishing boolean If true, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains.
symbol string May be null. The symbol of the NFT contract.
token_address string The address of the NFT contract.
token_id string The token ID of the NFT.
token_hash string The token hash. May be null.
token_uri string The URI to the metadata of the token. May be null.
token_domain string Token domain. May be null.
uri_meta object A standard NftMetadata object.

NftFilter

The NftFilter object includes the following items for a given coin or token:

Parameter Type Description
exclude_spam boolean Optional, defaults to false. If true, only tokens which have param possible_spam:false are included in the response.
exclude_phishing boolean Optional, defaults to false. If true, only tokens which have param possible_phishing:false are included in the response.

NftTransfer

The NftTransfer object includes the following items for each token transaction:

Parameter Type Description
amount string Amount of tokens transferred.
block_hash string May be null. Hash of block in which transfer occurred.
block_number integer Height of block in which transfer occurred.
block_timestamp integer Block time in unix epoch format.
chain string Chain name. One of AVALANCHE, BSC, ETH, FANTOM, or POLYGON.
token_uri string May be null. The URI to the metadata of the token.
token_domain string May be null. Extracted domain from the token_uri, if valid.
collection_name string May be null. Name of collection which token belongs to.
image_url string May be null. The URI to the token image.
image_domain string May be null. Extracted domain from the image_url, if valid.
token_name string May be null. Name of the token.
contract_type string Contract type. ERC721 or ERC1155.
token_address string Address of token transferred.
token_id string Token ID.
possible_spam boolean If true, the contract address has been identified as associated with spam or suspicious activities.
possible_phishing boolean If true, the token has been identified as associated with phishing, as at least one of domain fields is found in database with phishing domains.
transaction_hash string Transaction ID of the transfer.
transaction_index string May be null. Transaction index of the transfer.
log_index string Log index of the transfer.
value string May be null. Tranfer value.
transaction_type string May be null. Transaction type. Possible values are Single.
from_address string Address of previous owner which sent the token(s).
to_address string Address of new owner which received the token(s).
status string Transfer status. Will be either Send or Receive. When the from_address and to_address are the same (i.e. sending to yourself), this value will be Receive.
verified integer May be null. A deprecated field which will be removed in future.
operator string May be null.
fee_details object Optional. A standard FeeInfo object.
confirmations integer The count of blocks produced since this transaction was confirmed.
`verified` has no description. Related to [https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth](https://cointelegraph.com/news/nft-whale-pranksy-pranked-by-fake-banksy-for-97-7-eth)? Who verifies it? I can see there are ways to verify on opensea etc, I assume Moralis incormoprates this. What are the other possible values for `transaction_type`? What is `operator`? What does `verified` mean?

NftTransferFilter

The NftTransferFilter object includes the following items for a transfer of given coin or token:

Parameter Type Description
receive boolean Optional, defaults to false. If true, only transfers where user received NFTs are included in the response.
send boolean Optional, defaults to false. If true, only transfers where user sent NFTs are included in the response.
from_date integer Optional. A timestamp in unix epoch format. If true, filter includes transfers from this date onwards (inclusive).
to_date integer Optional. A timestamp in unix epoch format. If true, filter includes transfers up to this date (inclusive).
exclude_spam boolean Optional, defaults to false. If true, only transfers which have param possible_spam:false are included in the response.
exclude_phishing boolean Optional, defaults to false. If true, only transfers which have param possible_phishing:false are included in the response.
```json { "ticker": "MINDS-ERC20", "required_confirmations": 4 } ```

NftMetadata

The NftMetadata object includes the following items for a given coin or token:

Parameter Type Description
image string Optional. Direct URL to the NFT's image.
image_url string Optional. Optional. Url to the NFT's image. Derived from the image or image_url fields to prioritize the non-null value. Can be null if neither is provided.
image_domain string Optional. Extracted domain from the 'image_url', if valid.
name string Optional. Name of the token.
description string Optional. Description of the token.
attributes object or array of objects Optional. The values within this parameter will vary, and are set by the creator. Often used to store traits.
animation_url string Optional. Url to an animation to be displayed instead of a static image.
animation_domain string Optional. Extracted domain from the animation_url, if valid.
external_url string Optional. URL to the external source related to the token.
external_domain string Optional. Extracted domain from the external_url, if valid.
image_details object Optional. JSON containing additional details or attributes of the image.
```json [ { "trait_type": "Specialization", "value": "Thief" }, { "trait_type": "Skin Tone", "value": "#0013b0" }, { "trait_type": "Weapon", "value": "Crossbow" }, { "trait_type": "Species", "value": "Dark Elf" }, { "trait_type": "Gender", "value": "Female" }, { "trait_type": "Strength", "value": "8" }, { "trait_type": "Dexterity", "value": "12" }, { "trait_type": "Intelligence", "value": "10" }, { "trait_type": "Perks", "value": ["Steath", "Eagle Eye", "Lockpicking", "Pickpocketing", "Fire resistance"] }, { "trait_type": "Weakness", "value": ["Slow healing", "Elfbark Addict", "Lockpicking", "Fear of cats", "Unconvincing liar"] }, { "trait_type": "Personality", "value": "Aggressive" } ] ```

WithdrawNftData

The WithdrawNftData object is used for withdrawals of NFTs on ERC721 and ERC1155 contracts. It includes the following items for a given coin or token:

Parameter Type Description
chain string The token chain. Chain must be activated first.
to string Destination address to withdraw the token to.
token_address string Token address.
token_id string Token ID.
fee object A standard WithdrawFee object. May be missing for older transfers.
amount string Optional, ERC1155 only. Defaults to 1. Amount of NFTs to withdraw. Ignored if max is true.
max boolean Optional, ERC1155 only. Defaults to false. If true, amount parameter will be ignored and all NFTs with this token_id will be sent.
When the `type` parameter in a [withdraw\_nft](/komodo-defi-framework/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc721`, it means the NFT is absolutely unique, and it has only 1 owner and the owner can own only 1 NFT with this `token_id` in its `token_address` (also referred to as contract address). When the `type` parameter in a [withdraw\_nft](/komodo-defi-framework/api/v20-dev/non_fungible_tokens/withdraw_nft/) request is `withdraw_erc1155`, it means that it is possible for more than 1 user to own one or more of the same NFT (with an identical `token_id`). Due to this difference, the `amount` and `max` fields are only used the when the `type` value is `withdraw_erc1155`.

NftProvider

The NftProvider object is used in the 'enable_nft' RPC method. It defines the NFT providers that are avaialable and their configuration.

Parameter Type Description
type string Specifies the type of the provider.
info object Additional information about the provider
info.url string URL of the provider's endpoint
info.komodo_proxy boolean Optional. Indicates whether proxy authentication is enabled for the endpoint
```json { "type": "Moralis", "info": { "url": "https://moralis-proxy.komodo.earth", "komodo_proxy": true } } ```