BOC manipulation module.
parse_message – Parses message boc into a JSON
parse_transaction – Parses transaction boc into a JSON
parse_account – Parses account boc into a JSON
parse_block – Parses block boc into a JSON
parse_shardstate – Parses shardstate boc into a JSON
get_boc_hash – Calculates BOC root hash
get_code_from_tvc – Extracts code from TVC contract image
cache_get – Get BOC from cache
cache_set – Save BOC into cache
cache_unpin – Unpin BOCs with specified pin.
Parses message boc into a JSON
JSON structure is compatible with GraphQL API message object
type ParamsOfParse = {
boc: string
}
type ResultOfParse = {
parsed: any
}
function parse_message(
params: ParamsOfParse,
): Promise<ResultOfParse>;
boc
: string – BOC encoded as base64
parsed
: any – JSON containing parsed BOC
Parses transaction boc into a JSON
JSON structure is compatible with GraphQL API transaction object
type ParamsOfParse = {
boc: string
}
type ResultOfParse = {
parsed: any
}
function parse_transaction(
params: ParamsOfParse,
): Promise<ResultOfParse>;
boc
: string – BOC encoded as base64
parsed
: any – JSON containing parsed BOC
Parses account boc into a JSON
JSON structure is compatible with GraphQL API account object
type ParamsOfParse = {
boc: string
}
type ResultOfParse = {
parsed: any
}
function parse_account(
params: ParamsOfParse,
): Promise<ResultOfParse>;
boc
: string – BOC encoded as base64
parsed
: any – JSON containing parsed BOC
Parses block boc into a JSON
JSON structure is compatible with GraphQL API block object
type ParamsOfParse = {
boc: string
}
type ResultOfParse = {
parsed: any
}
function parse_block(
params: ParamsOfParse,
): Promise<ResultOfParse>;
boc
: string – BOC encoded as base64
parsed
: any – JSON containing parsed BOC
Parses shardstate boc into a JSON
JSON structure is compatible with GraphQL API shardstate object
type ParamsOfParseShardstate = {
boc: string,
id: string,
workchain_id: number
}
type ResultOfParse = {
parsed: any
}
function parse_shardstate(
params: ParamsOfParseShardstate,
): Promise<ResultOfParse>;
boc
: string – BOC encoded as base64id
: string – Shardstate identificatorworkchain_id
: number – Workchain shardstate belongs to
parsed
: any – JSON containing parsed BOC
type ParamsOfGetBlockchainConfig = {
block_boc: string
}
type ResultOfGetBlockchainConfig = {
config_boc: string
}
function get_blockchain_config(
params: ParamsOfGetBlockchainConfig,
): Promise<ResultOfGetBlockchainConfig>;
block_boc
: string – Key block BOC encoded as base64
config_boc
: string – Blockchain config BOC encoded as base64
Calculates BOC root hash
type ParamsOfGetBocHash = {
boc: string
}
type ResultOfGetBocHash = {
hash: string
}
function get_boc_hash(
params: ParamsOfGetBocHash,
): Promise<ResultOfGetBocHash>;
boc
: string – BOC encoded as base64
hash
: string – BOC root hash encoded with hex
Extracts code from TVC contract image
type ParamsOfGetCodeFromTvc = {
tvc: string
}
type ResultOfGetCodeFromTvc = {
code: string
}
function get_code_from_tvc(
params: ParamsOfGetCodeFromTvc,
): Promise<ResultOfGetCodeFromTvc>;
tvc
: string – Contract TVC image encoded as base64
code
: string – Contract code encoded as base64
Get BOC from cache
type ParamsOfBocCacheGet = {
boc_ref: string
}
type ResultOfBocCacheGet = {
boc?: string
}
function cache_get(
params: ParamsOfBocCacheGet,
): Promise<ResultOfBocCacheGet>;
boc_ref
: string – Reference to the cached BOC
boc
?: string – BOC encoded as base64.
Save BOC into cache
type ParamsOfBocCacheSet = {
boc: string,
cache_type: BocCacheType
}
type ResultOfBocCacheSet = {
boc_ref: string
}
function cache_set(
params: ParamsOfBocCacheSet,
): Promise<ResultOfBocCacheSet>;
boc
: string – BOC encoded as base64 or BOC referencecache_type
: BocCacheType – Cache type
boc_ref
: string – Reference to the cached BOC
Unpin BOCs with specified pin.
BOCs which don't have another pins will be removed from cache
type ParamsOfBocCacheUnpin = {
pin: string,
boc_ref?: string
}
function cache_unpin(
params: ParamsOfBocCacheUnpin,
): Promise<void>;
pin
: string – Pinned nameboc_ref
?: string – Reference to the cached BOC.
If it is provided then only referenced BOC is unpinned
type BocCacheType = {
type: 'Pinned'
pin: string
} | {
type: 'Unpinned'
}
Depends on value of the type
field.
When type is 'Pinned'
Pin the BOC with pin
name.
Such BOC will not be removed from cache until it is unpinned
pin
: string
When type is 'Unpinned'
enum BocErrorCode {
InvalidBoc = 201,
SerializationError = 202,
InappropriateBlock = 203,
MissingSourceBoc = 204,
InsufficientCacheSize = 205,
BocRefNotFound = 206,
InvalidBocRef = 207
}
One of the following value:
InvalidBoc = 201
SerializationError = 202
InappropriateBlock = 203
MissingSourceBoc = 204
InsufficientCacheSize = 205
BocRefNotFound = 206
InvalidBocRef = 207
type ParamsOfParse = {
boc: string
}
boc
: string – BOC encoded as base64
type ResultOfParse = {
parsed: any
}
parsed
: any – JSON containing parsed BOC
type ParamsOfParseShardstate = {
boc: string,
id: string,
workchain_id: number
}
boc
: string – BOC encoded as base64id
: string – Shardstate identificatorworkchain_id
: number – Workchain shardstate belongs to
type ParamsOfGetBlockchainConfig = {
block_boc: string
}
block_boc
: string – Key block BOC encoded as base64
type ResultOfGetBlockchainConfig = {
config_boc: string
}
config_boc
: string – Blockchain config BOC encoded as base64
type ParamsOfGetBocHash = {
boc: string
}
boc
: string – BOC encoded as base64
type ResultOfGetBocHash = {
hash: string
}
hash
: string – BOC root hash encoded with hex
type ParamsOfGetCodeFromTvc = {
tvc: string
}
tvc
: string – Contract TVC image encoded as base64
type ResultOfGetCodeFromTvc = {
code: string
}
code
: string – Contract code encoded as base64
type ParamsOfBocCacheGet = {
boc_ref: string
}
boc_ref
: string – Reference to the cached BOC
type ResultOfBocCacheGet = {
boc?: string
}
boc
?: string – BOC encoded as base64.
type ParamsOfBocCacheSet = {
boc: string,
cache_type: BocCacheType
}
boc
: string – BOC encoded as base64 or BOC referencecache_type
: BocCacheType – Cache type
type ResultOfBocCacheSet = {
boc_ref: string
}
boc_ref
: string – Reference to the cached BOC
type ParamsOfBocCacheUnpin = {
pin: string,
boc_ref?: string
}
pin
: string – Pinned nameboc_ref
?: string – Reference to the cached BOC.
If it is provided then only referenced BOC is unpinned