TRAIT DataGate API
  1. State
TRAIT DataGate API
  • Intro
  • History
    • Blocks
      POST
    • Transactions
      POST
    • Events
      POST
  • State
    • Info of on-chain entities
      POST
    • Raw single values of blockchain storage
      POST
    • Raw collections of blockchain storage
      POST
  • Tokens
    • Balances of tokens
      POST
    • Transfers of tokens
      POST
  • Submit new transaction
    • Validate transfer of token TRAIT
      POST
    • Validate transfer of fungible tokens
      POST
    • Validate transfer of nft tokens
      POST
    • Validate clearing transaction of an AppAgent
      POST
    • Build info for new transaction
      POST
    • Submit transaction
      POST
    • Get transaction status
      POST
  1. State

Info of on-chain entities

POST
https://api.trait.tech/state/entity_info
State
The endpoint provides key info about on-chain entities: AppAgents and tokens.
Provided info contains URI to entity metadata (if set by owner) with the info of supported traits.

Request

Body Params application/json
Request params for the endpoint `/state/entity_info`.
block
Block
optional
ID of the block for which the blockchain state will be provided.
Any of
Block hash.
>= 66 characters<= 66 characters
Default:
blockchain_head
Match pattern:
^0x[0-9abcdefABCDEF]{64}$
entities
object (FilterBlockchainEntityId) 
required
Provide the IDs of the blockchain entities.
app_agents
App Agents
optional
Request info about AppAgents.
fungible_tokens
Fungible Tokens
optional
Request info about fungible tokens.
nft_collections
Nft Collections
optional
Request info about NFT collections.
nft_items
Nft Items
optional
Request info about NFT item.
native_token
boolean 
Native Token
optional
true to receive info about token TRAIT
Default:
false
Example
{
    "block": "blockchain_head",
    "entities": {
        "app_agents": [
            1017
        ],
        "fungible_tokens": [
            32
        ],
        "nft_collections": [
            17
        ],
        "nft_items": [
            {
                "nft_collection_id": 17,
                "nft_item_id": 754266
            }
        ],
        "native_token": true
    }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.trait.tech/state/entity_info' \
--header 'Content-Type: application/json' \
--data-raw '{
    "block": "blockchain_head",
    "entities": {
        "app_agents": [
            1017
        ],
        "fungible_tokens": [
            32
        ],
        "nft_collections": [
            17
        ],
        "nft_items": [
            {
                "nft_collection_id": 17,
                "nft_item_id": 754266
            }
        ],
        "native_token": true
    }
}'

Responses

🟢200OK
application/json
Successful Response
Body
Response schema for the endpoint `/state/entity_info`.
metadata
object (ResponseMetadata) 
required
Metadata for the generated response.
request_context
object (ResponseBlockId) 
required
For the endpoints with historical data: the last block, the data from which is included in the response. For the endpoints with blockchain state data: the block whose state is provided in the response. Request context remains the same for all data pages in the series for the initial request.
blockchain_head
object (ResponseBlockId) 
required
The latest blockchain block currently available.
data
object (BlockchainEntitiesInfo) 
required
Information about requested blockchain entities.
app_agents
array[object (AppAgentInfo) {4}] 
App Agents
required
Information about AppAgents.
fungible_tokens
array[object (FungibleTokenInfo) {7}] 
Fungible Tokens
required
Information about fungible tokens.
nft_collections
array[object (NftCollectionInfo) {5}] 
Nft Collections
required
Information about NFT collections.
nft_items
array[object (NftItemInfo) {3}] 
Nft Items
required
Information about NFT items.
native_token
Native Token
required
Information about token TRAIT.
Example
{
    "metadata": {
        "request_context": {
            "block_hash": "0xab8006019066f080402ab43da043127b930ef0ffb3349a333222d67c0f542338",
            "block_index": 29702,
            "block_timestamp": 1727581488000
        },
        "blockchain_head": {
            "block_hash": "0xab8006019066f080402ab43da043127b930ef0ffb3349a333222d67c0f542338",
            "block_index": 29702,
            "block_timestamp": 1727581488000
        }
    },
    "data": {
        "app_agents": [
            {
                "app_agent_id": 1017,
                "app_agent_address": {
                    "address": "ttrnYjkipbBQVVvpcx349CsAvbQvF35JrXHosmbAULSZa7Uyv",
                    "account_id": "0xf903000001d19712b1c73aa01de7b7764c220ed3d23403f9ef8052e5d2fcc16e",
                    "address_type": "app_agent",
                    "app_agent_id": 1017,
                    "ta_id": null,
                    "address_name": null
                },
                "app_agent_owner": {
                    "address": "ttmcLgs3b7tegED6wRMFAA6WLYWhYeCL1TgHv6u4VDWptiz8L",
                    "account_id": "0x140cd0b779f4418ec25a5d97572e29ead9afcc4112974c923ee796702338830b",
                    "address_type": "regular",
                    "app_agent_id": null,
                    "ta_id": null,
                    "address_name": null
                },
                "metadata": "https://trait-wallet-demo-account.trait.tech/game-c/app-agent-c/app-agent-c.json"
            },
            {
                "app_agent_id": 1033,
                "app_agent_address": {
                    "address": "ttmMsYRqsnrKY5DNTZY3rBCUHq7s191wKvWQXnrfb7xeADJGC",
                    "account_id": "0x0904000001d5006fd044601bad51baedee11be3f4247c688310084e17d778170",
                    "address_type": "app_agent",
                    "app_agent_id": 1033,
                    "ta_id": null,
                    "address_name": null
                },
                "app_agent_owner": {
                    "address": "ttqUHa4SJ5JE5mCcx9PkWNo4AkDAgyqeBLoaHxdCeY5rsq8E5",
                    "account_id": "0xbed94ac6f0fdf9a8b24c3a16ae861eb4f776d819f6c6316a0ae866c9238d2078",
                    "address_type": "regular",
                    "app_agent_id": null,
                    "ta_id": null,
                    "address_name": null
                },
                "metadata": "http://trait-wallet-demo-account-staging.trait.tech/game-a/app-agent-a/app-agent-a.json"
            }
        ],
        "fungible_tokens": [
            {
                "fungible_token_id": 32,
                "fungible_token_manager": {
                    "address": "ttmMsYRqsnrKY5DNTZY3rBCUHq7s191wKvWQXnrfb7xeADJGC",
                    "account_id": "0x0904000001d5006fd044601bad51baedee11be3f4247c688310084e17d778170",
                    "address_type": "app_agent",
                    "app_agent_id": 1033,
                    "ta_id": null,
                    "address_name": null
                },
                "supply": 1000000000000000,
                "min_amount": 1,
                "accounts": 3,
                "status": "Live",
                "metadata": "http://trait-wallet-demo-account-staging.trait.tech/game-a/fungible-a-a/fungible-a-a.json"
            }
        ],
        "nft_collections": [
            {
                "nft_collection_id": 17,
                "nft_collection_manager": {
                    "address": "ttrnYjkipbBQVVvpcx349CsAvbQvF35JrXHosmbAULSZa7Uyv",
                    "account_id": "0xf903000001d19712b1c73aa01de7b7764c220ed3d23403f9ef8052e5d2fcc16e",
                    "address_type": "app_agent",
                    "app_agent_id": 1017,
                    "ta_id": null,
                    "address_name": null
                },
                "manager_deposit": 1011130100000000,
                "items": 10,
                "metadata": "https://trait-wallet-demo-account.trait.tech/game-c/nft-collection-c-d/nft-collection-c-d/nft-collection-c-d.json"
            }
        ],
        "nft_items": [
            {
                "nft_collection_id": 17,
                "nft_item_id": 754266,
                "metadata": "https://trait-wallet-demo-account.trait.tech/game-c/nft-collection-c-d/nft-token-c-d-j/nft-token-c-d-j.json"
            }
        ],
        "native_token": {
            "name": "TRAIT",
            "symbol": "TRAIT",
            "decimals": 12,
            "min_amount": 1000000000000
        }
    }
}
🟠422Parameter Error
Modified at 2024-11-21 18:59:09
Previous
Events
Next
Raw single values of blockchain storage
Built with