TON Center
Tonlib type identifiers Every object returned by API v2 includes a @type field that identifies the object's structure. These values originate from two sources:
Tonlib types such as raw.fullAccountState and tvm.cell come from the tonlib TL schema , the type definition language used by the C++ library powering this API.
Extended types, which are prefixed with ext., are added by TON Center to provide parsed representations with additional decoded fields that are not available in the base tonlib schema.
The @type field acts as a discriminator : when a response can return different object shapes, the @type value indicates which fields to expect. This pattern is useful for type-safe deserialization in statically typed languages.
{
"@type" : "raw.fullAccountState" ,
"balance" : "1000000000" ,
"code" : "te6cc..." ,
"data" : "te6cc..." ,
"last_transaction_id" : {
"@type" : "internal.transactionId" ,
"lt" : "12345678" ,
"hash" : "abc..."
}
}
The TL schema maps to JSON types as follows:
TL type JSON type Notes int32number 32-bit signed integer int53number 53-bit signed integer; safe for JavaScript Number int64string 64-bit signed integer as decimal string; exceeds JS safe range int256string 256-bit integer as decimal or hex string bytesstring Binary data, base64-encoded stringstring UTF-8 text Boolboolean true or falsevector<T>array Ordered list of elements of type T
When querying account information, the account_state field uses @type to indicate which kind of contract is deployed. The TL schema defines these as variants of AccountState:
raw.accountState code:bytes data:bytes frozen_hash:bytes = AccountState;
wallet.v3.accountState wallet_id:int64 seqno:int32 = AccountState;
wallet.v4.accountState wallet_id:int64 seqno:int32 = AccountState;
wallet.highload.v1.accountState wallet_id:int64 seqno:int32 = AccountState;
wallet.highload.v2.accountState wallet_id:int64 = AccountState;
dns.accountState wallet_id:int64 = AccountState;
rwallet.accountState wallet_id:int64 seqno:int32 unlocked_balance:int64 config:rwallet.config = AccountState;
pchan.accountState config:pchan.config state:pchan.State description:string = AccountState;
uninited.accountState frozen_hash:bytes = AccountState;
@type valueAPI schema TL fields raw.accountStateAccountStateRawcode, data, frozen_hashwallet.v3.accountStateAccountStateWalletV3wallet_id, seqnowallet.v4.accountStateAccountStateWalletV4wallet_id, seqnowallet.highload.v1.accountStateAccountStateWalletHighloadV1wallet_id, seqnowallet.highload.v2.accountStateAccountStateWalletHighloadV2wallet_iddns.accountStateAccountStateDnswallet_idrwallet.accountStateAccountStateRWalletwallet_id, seqno, unlocked_balance, configpchan.accountStateAccountStatePChanconfig, state, descriptionuninited.accountStateAccountStateUninitedfrozen_hash
Full account queries return one of these top-level types:
raw.fullAccountState balance:int64 extra_currencies:vector<extraCurrency> code:bytes data:bytes
last_transaction_id:internal.transactionId block_id:ton.blockIdExt frozen_hash:bytes sync_utime:int53
= raw.FullAccountState;
fullAccountState address:accountAddress balance:int64 extra_currencies:vector<extraCurrency>
last_transaction_id:internal.transactionId block_id:ton.blockIdExt sync_utime:int53
account_state:AccountState revision:int32
= FullAccountState;
@type valueAPI schema Description raw.fullAccountStateAddressInformationRaw state with balance, code, data, and frozen hash. fullAccountStateExtendedAddressInformationParsed state with identified contract type. ext.accounts.walletInformationWalletInformationWallet-specific: type, seqno, wallet_id; TON Center extension.
accountAddress account_address:string = AccountAddress;
@type valueAPI schema TL fields accountAddressAccountAddressaccount_addressaddr_stdSmcAddrworkchain, id
ton.blockIdExt workchain:int32 shard:int64 seqno:int32 root_hash:bytes file_hash:bytes = ton.BlockIdExt;
@type valueAPI schema TL fields ton.blockIdExtTonBlockIdExtworkchain, shard, seqno, root_hash, file_hash
These types are returned by block query endpoints. The TL definitions:
blocks.masterchainInfo last:ton.BlockIdExt state_root_hash:bytes init:ton.BlockIdExt = blocks.MasterchainInfo;
blocks.shards shards:vector<ton.BlockIdExt> = blocks.Shards;
blocks.header id:ton.blockIdExt global_id:int32 version:int32 flags:# after_merge:Bool after_split:Bool
before_split:Bool want_merge:Bool want_split:Bool validator_list_hash_short:int32 catchain_seqno:int32
min_ref_mc_seqno:int32 is_key_block:Bool prev_key_block_seqno:int32 start_lt:int64 end_lt:int64
gen_utime:int53 vert_seqno:# prev_blocks:vector<ton.blockIdExt> = blocks.Header;
blocks.transactions id:ton.blockIdExt req_count:int32 incomplete:Bool
transactions:vector<blocks.shortTxId> = blocks.Transactions;
blocks.transactionsExt id:ton.blockIdExt req_count:int32 incomplete:Bool
transactions:vector<raw.transaction> = blocks.TransactionsExt;
blocks.blockSignatures id:ton.blockIdExt signatures:(vector blocks.signature) = blocks.BlockSignatures;
blocks.shardBlockProof from:ton.blockIdExt mc_id:ton.blockIdExt
links:(vector blocks.shardBlockLink) mc_proof:(vector blocks.blockLinkBack) = blocks.ShardBlockProof;
blocks.outMsgQueueSizes shards:(vector blocks.outMsgQueueSize)
ext_msg_queue_size_limit:int32 = blocks.OutMsgQueueSizes;
@type valueAPI schema Description blocks.masterchainInfoMasterchainInfoLatest and genesis block references. blocks.shardsShardsActive shard block identifiers. blocks.headerBlockHeaderBlock metadata, merge or split flags, timing. blocks.transactionsBlockTransactionsShort transaction IDs within a block. blocks.transactionsExtBlockTransactionsExtFull transactions within a block. blocks.shortTxIdShortTxIdCompact reference: account, lt, hash. blocks.blockSignaturesMasterchainBlockSignaturesValidator signatures for a block. blocks.signatureBlockSignatureSingle validator signature. blocks.shardBlockProofShardBlockProofMerkle proof chain to masterchain. blocks.shardBlockLinkShardBlockLinkSingle link in a proof chain. blocks.blockLinkBackBlockLinkBackBackward proof link between blocks. blocks.outMsgQueueSizeOutMsgQueueSizePer-shard queue size. blocks.outMsgQueueSizesOutMsgQueueSizesQueue sizes across all shards. ext.blocks.consensusBlockConsensusBlockLatest finalized block; TON Center extension.
raw.transaction address:accountAddress utime:int53 data:bytes transaction_id:internal.transactionId
fee:int64 storage_fee:int64 other_fee:int64 in_msg:raw.message
out_msgs:vector<raw.message> = raw.Transaction;
raw.transactions transactions:vector<raw.transaction>
previous_transaction_id:internal.transactionId = raw.Transactions;
raw.message hash:bytes source:accountAddress destination:accountAddress value:int64
extra_currencies:vector<extraCurrency> fwd_fee:int64 ihr_fee:int64 created_lt:int64
body_hash:bytes msg_data:msg.Data = raw.Message;
raw.extMessageInfo hash:bytes hash_norm:bytes = raw.ExtMessageInfo;
internal.transactionId lt:int64 hash:bytes = internal.TransactionId;
@type valueAPI schema Description raw.transactionTransactionStdRaw transaction with messages and fees. raw.transactionsTransactionsStdPaginated transaction list with cursor. raw.messageMessageStdRaw message with sender, recipient, value. raw.extMessageInfoExtMessageInfoExternal message hash after broadcast. internal.transactionIdInternalTransactionIdTransaction reference: lt + hash. ext.transactionTransactionTransaction with decoded comments; TON Center extension. ext.messageMessageMessage with decoded text comments; TON Center extension.
The msg_data field on messages uses @type to indicate how to interpret the body:
msg.dataRaw body:bytes init_state:bytes = msg.Data;
msg.dataText text:bytes = msg.Data;
msg.dataDecryptedText text:bytes = msg.Data;
msg.dataEncryptedText text:bytes = msg.Data;
@type valueAPI schema Description msg.dataRawMsgDataRawRaw binary body + optional init state. msg.dataTextMsgDataTextPlain text comment; base64-encoded UTF-8. msg.dataEncryptedTextMsgDataEncryptedTextEncrypted message body. msg.dataDecryptedTextMsgDataDecryptedTextDecrypted message body.
Used as input and output for smart contract get methods: runGetMethod, runGetMethodStd.
Each stack entry wraps a value with a type tag:
tvm.stackEntryNumber number:tvm.Number = tvm.StackEntry;
tvm.stackEntryCell cell:tvm.cell = tvm.StackEntry;
tvm.stackEntrySlice slice:tvm.slice = tvm.StackEntry;
tvm.stackEntryTuple tuple:tvm.Tuple = tvm.StackEntry;
tvm.stackEntryList list:tvm.List = tvm.StackEntry;
tvm.stackEntryUnsupported = tvm.StackEntry;
@type valueAPI schema Value field tvm.stackEntryNumberTvmStackEntryNumbernumber (decimal string via tvm.numberDecimal)tvm.stackEntryCellTvmStackEntryCellcell (base64 BoC via tvm.cell)tvm.stackEntrySliceTvmStackEntrySliceslice (base64 BoC via tvm.slice)tvm.stackEntryTupleTvmStackEntryTupletuple (nested stack entries)tvm.stackEntryListTvmStackEntryListlist (nested stack entries)tvm.stackEntryUnsupportedTvmStackEntryUnsupportedNo value (type not representable)
tvm.cell bytes:bytes = tvm.Cell;
tvm.slice bytes:bytes = tvm.Slice;
tvm.numberDecimal number:string = tvm.Number;
tvm.tuple elements:vector<tvm.StackEntry> = tvm.Tuple;
tvm.list elements:vector<tvm.StackEntry> = tvm.List;
@type valueAPI schema TL fields tvm.cellTvmCellbytes (base64 BoC)tvm.sliceTvmSlicebytes (base64 BoC)tvm.numberDecimalTvmNumberDecimalnumber (decimal string)tvm.tupleTvmTupleelements (stack entries)tvm.listTvmListelements (stack entries)
smc.runResult gas_used:int53 stack:vector<tvm.StackEntry> exit_code:int32 = smc.RunResult;
@type valueAPI schema TL fields smc.runResultRunGetMethodResultgas_used, stack, exit_codesmc.runResultRunGetMethodStdResultSame fields, typed stack entries
fees in_fwd_fee:int53 storage_fee:int53 gas_fee:int53 fwd_fee:int53 = Fees;
query.fees source_fees:fees destination_fees:vector<fees> = query.Fees;
@type valueAPI schema TL fields feesFeesin_fwd_fee, storage_fee, gas_fee, fwd_feequery.feesQueryFeessource_fees, destination_fees
configInfo config:tvm.cell = ConfigInfo;
@type valueAPI schema TL fields configInfoConfigInfoconfig TVM cell with parameters
smc.libraryEntry hash:int256 data:bytes = smc.LibraryEntry;
smc.libraryResult result:(vector smc.libraryEntry) = smc.LibraryResult;
@type valueAPI schema TL fields smc.libraryEntryLibraryEntryhash, datasmc.libraryResultLibraryResultresult (entries)
These types are not in the base tonlib TL schema. They are added by TON Center to provide parsed Jetton and NFT data via the getTokenData endpoint.
@type valueAPI schema Description ext.tokens.jettonMasterDataJettonMasterDataJetton master: total supply, admin, metadata. ext.tokens.jettonWalletDataJettonWalletDataJetton wallet: balance, owner, master reference. ext.tokens.nftCollectionDataNftCollectionDataNFT collection: item count, owner, metadata. ext.tokens.nftItemDataNftItemDataNFT item: index, owner, collection reference.
DNS entries use @type to indicate the record type stored at a domain:
dns.entryDataNextResolver resolver:AccountAddress = dns.EntryData;
dns.entryDataSmcAddress smc_address:AccountAddress = dns.EntryData;
dns.entryDataAdnlAddress adnl_address:AdnlAddress = dns.EntryData;
dns.entryDataStorageAddress bag_id:int256 = dns.EntryData;
@type valueAPI schema TL fields dns.entryDataNextResolverDnsRecordNextResolverresolver (address)dns.entryDataSmcAddressDnsRecordSmcAddresssmc_address (address)dns.entryDataAdnlAddress DnsRecordAdnlAddressadnl_addressdns.entryDataStorageAddress DnsRecordStorageAddressbag_id (int256)
pchan.config alice_public_key:string alice_address:accountAddress bob_public_key:string
bob_address:accountAddress init_timeout:int32 close_timeout:int32 channel_id:int64 = pchan.Config;
pchan.stateInit signed_A:Bool signed_B:Bool min_A:int64 min_B:int64
expire_at:int53 A:int64 B:int64 = pchan.State;
pchan.stateClose signed_A:Bool signed_B:Bool min_A:int64 min_B:int64
expire_at:int53 A:int64 B:int64 = pchan.State;
pchan.statePayout A:int64 B:int64 = pchan.State;
@type valueAPI schema Description pchan.configPChanConfigChannel parties, timeouts, ID pchan.stateInitPChanStateInitInitialization phase (signing) pchan.stateClosePChanStateCloseClosing phase (signing) pchan.statePayoutPChanStatePayoutPayout phase (final balances)
rwallet.limit seconds:int32 value:int64 = rwallet.Limit;
rwallet.config start_at:int53 limits:vector<rwallet.limit> = rwallet.Config;
@type valueAPI schema TL fields rwallet.configRWalletConfigstart_at, limitsrwallet.limitRWalletLimitseconds, value
TON Center extensions.
@type valueAPI schema Description ext.utils.detectedAddressDetectAddressAddress in all encoding formats ext.utils.detectedAddressVariantDetectAddressBase64VariantBase64 and URL-safe base64 pair ext.utils.detectedHashDetectHashHash in hex, base64, URL-safe extraCurrencyExtraCurrencyBalanceNon-TON currency ID and balance okResultOkSuccess with no return data
For background on the TL-B format used across the TON ecosystem, see the TL-B overview .
Types prefixed with ext. are TON Center extensions not present in the upstream TL schema.