Query NFT database tables
After using the update_nft method to initialise your local NFT database,
the following tables are available in DB/KOMODEFI.db
:
- AVAX_nft_list
- AVAX_nft_transfer_history
- BNB_nft_list
- BNB_nft_transfer_history
- ETH_nft_list
- ETH_nft_transfer_history
- FTM_nft_list
- FTM_nft_transfer_history
- MATIC_nft_list
- MATIC_nft_transfer_history
- scanned_nft_blocks
The COIN_nft_list tables contain the NFTs that you own It has the following columns, though not all columns are populated for all NFTs:
ID | Name | Type | Description |
---|---|---|---|
0 | token_address | VARCHAR(256) | The address of the token contract. |
1 | token_id | VARCHAR(256) | The id of the token. |
2 | chain | TEXT | The coin network which the NFT is on. |
3 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. |
4 | block_number | INTEGER | The block height of this transaction. |
5 | contract_type | TEXT | The contract type. Either ERC721 or ERC1155 . |
6 | possible_spam | INTEGER | 1 indicates the NFT has been identified as spam. 0 indicates it has not. |
7 | possible_phishing | INTEGER | 1 indicates the NFT has been identified as a scam. 0 indicates it has not. |
8 | collection_name | TEXT | The collection name which includes the token. |
9 | symbol | TEXT | An arbitrary symbol for the NFT |
10 | token_uri | TEXT | A link to the token's metadata. |
11 | token_domain | TEXT | The domain the token metadata is hosted on. |
12 | metadata | TEXT | The token's metadata in JSON format. |
13 | last_token_uri_sync | TEXT | Date and time when the token uri was last syncronised. |
14 | last_metadata_sync | TEXT | Date and time when the token metadata was last syncronised. |
15 | raw_image_url | TEXT | The raw URL for the token image. |
16 | image_url | TEXT | A link for the token's image (or other media). |
17 | image_domain | TEXT | The domain the token image (or other media) is hosted on. |
18 | token_name | TEXT | The name of the token. |
19 | description | TEXT | An arbitrary description of the NFT. |
20 | attributes | TEXT | Additional attribute data for the NFT in JSON format. |
21 | animation_url | TEXT | If NFT is animated, the URL of the animation. |
22 | animation_domain | TEXT | If NFT is animated, the domain of the animation. |
23 | external_url | TEXT | Additional URL related to the NFT |
24 | external_domain | TEXT | Domain of the additional URL related to the NFT |
25 | image_details | TEXT | Additional details about the NFT's image. |
26 | details_json | TEXT | Additional information about the transaction in JSON format. |
SELECT chain, token_name, token_address, token_id, possible_spam, possible_phishing FROM MATIC_nft_list LIMIT 5;
chain | token_name | token_address | token_id | possible_spam | possible_phishing |
---|---|---|---|---|---|
POLYGON | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 | 1 | 0 |
POLYGON | $1000 USDC Voucher🎁 | 0xb092b5eb5c653e915880dfc1f606be2ffe6fae8c | 1 | 1 | 0 |
POLYGON | 1000 BLUR Reward | 0xeaa3c52052b809c8d8072187efc134def2dd5b13 | 0 | 1 | 0 |
POLYGON | SHIB Voucher 66 of 100 | 0xc46e36339ebd8bed48b1bdb6bd815e4b72103949 | 0 | 1 | 0 |
POLYGON | $1000 Rewards | 0x6e0b84421388ad635f2a1167e39aff2dc742da2a | 0 | 1 | 0 |
The NFTs listed above are all spam, and will be ignored by the get_nft_list method.
The COIN_nft_transfer_history tables contain the history of transfers of your NFTs, and have the following columns:
ID | Name | Type | Description |
---|---|---|---|
0 | transaction_hash | VARCHAR(256) | Hex string, representing the transaction. |
1 | log_index | INTEGER | Simply a table index. |
2 | chain | TEXT | The coin network which the NFT is on. |
3 | block_number | INTEGER | The block height of this transaction. |
4 | block_timestamp | INTEGER | The block time of this transaction. |
5 | contract_type | TEXT | The contract type. Either ERC721 or ERC1155 . |
6 | token_address | VARCHAR(256) | The address of the token contract. |
7 | token_id | VARCHAR(256) | The id of the token. |
8 | status | TEXT | The transaction type: Recieve or Send |
9 | amount | VARCHAR(256) | The amount of NFTs transfered in this transaction. |
10 | possible_spam | INTEGER | 1 indicates the NFT has been identified as spam. 0 indicates it has not. |
11 | possible_phishing | INTEGER | 1 indicates the NFT has been identified as a scam. 0 indicates it has not. |
12 | token_uri | TEXT | A link to the token's metadata. |
13 | token_domain | TEXT | The domain the token metadata is hosted on. |
14 | collection_name | TEXT | The collection name which includes the token. |
15 | image_url | TEXT | A link for the token's image (or other media). |
16 | image_domain | TEXT | The domain the token image (or other media) is hosted on. |
17 | token_name | TEXT | The name of the token. |
18 | details_json | TEXT | Additional information about the transaction in JSON format. |
SELECT transaction_hash, token_name, token_address, token_id, FROM MATIC_nft_transfer_history WHERE block_timestamp > 1701519320;
transaction_hash | token_name | token_address | token_id |
---|---|---|---|
0x7b57303bcc2c68808b460490e984adcd18567a80660a18b7a151b62015247cda | $2000 USDT Airdrop🎁 | 0xe7ee9dcf5f4b7f9254b348ba596c9fb9121f77e7 | 1 |
The scanned_nft_blocks table contains the last block that was scanned for each chain. It has the following columns:
ID | Name | Type | Description |
---|---|---|---|
2 | chain | TEXT | The coin network which the NFT is on. |
1 | last_scanned_block | INTEGER | The block height when the last scan for NFTs was performed on a chain. |
SELECT * FROM scanned_nft_blocks;
chain | last_scanned_block |
---|---|
MATIC | 50651981 |
FTM | 66512090 |
ETH | 0 |
BNB | 0 |
AVAX | 0 |