Module boc
Last updated
Last updated
BOC manipulation module.
– Decodes tvc according to the tvc spec. Read more about tvc structure
– Parses message boc into a JSON
– Parses transaction boc into a JSON
– Parses account boc into a JSON
– Parses block boc into a JSON
– Parses shardstate boc into a JSON
– Extract blockchain configuration from key block and also from zerostate.
– Calculates BOC root hash
– Calculates BOC depth
– Extracts code from TVC contract image
– Get BOC from cache
– Save BOC into cache or increase pin counter for existing pinned BOC
– Unpin BOCs with specified pin defined in the cache_set
. Decrease pin reference counter for BOCs with specified pin defined in the cache_set
. BOCs which have only 1 pin and its reference counter become 0 will be removed from cache
ResultOfBocCacheSet
ParamsOfBocCacheUnpin
ParamsOfEncodeBoc
ResultOfEncodeBoc
ParamsOfGetCodeSalt
ResultOfGetCodeSalt
ParamsOfSetCodeSalt
ResultOfSetCodeSalt
ParamsOfDecodeStateInit
ResultOfDecodeStateInit
ParamsOfEncodeStateInit
ResultOfEncodeStateInit
ParamsOfEncodeExternalInMessage
ResultOfEncodeExternalInMessage
ParamsOfGetCompilerVersion
ResultOfGetCompilerVersion
NOTE: Sync version is available only for lib-node
binding.
tvc
: string – Contract TVC BOC encoded as base64 or BOC handle
Parses message boc into a JSON
JSON structure is compatible with GraphQL API message object
NOTE: Sync version is available only for lib-node
binding.
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
NOTE: Sync version is available only for lib-node
binding.
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
NOTE: Sync version is available only for lib-node
binding.
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
NOTE: Sync version is available only for lib-node
binding.
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
NOTE: Sync version is available only for lib-node
binding.
boc
: string – BOC encoded as base64
id
: string – Shardstate identifier
workchain_id
: number – Workchain shardstate belongs to
parsed
: any – JSON containing parsed BOC
Extract blockchain configuration from key block and also from zerostate.
NOTE: Sync version is available only for lib-node
binding.
block_boc
: string – Key block BOC or zerostate BOC encoded as base64
config_boc
: string – Blockchain config BOC encoded as base64
Calculates BOC root hash
NOTE: Sync version is available only for lib-node
binding.
boc
: string – BOC encoded as base64 or BOC handle
hash
: string – BOC root hash encoded with hex
Calculates BOC depth
NOTE: Sync version is available only for lib-node
binding.
boc
: string – BOC encoded as base64 or BOC handle
depth
: number – BOC root cell depth
Extracts code from TVC contract image
NOTE: Sync version is available only for lib-node
binding.
tvc
: string – Contract TVC image or image BOC handle
code
: string – Contract code encoded as base64
Get BOC from cache
NOTE: Sync version is available only for lib-node
binding.
boc_ref
: string – Reference to the cached BOC
boc
?: string – BOC encoded as base64.
Save BOC into cache or increase pin counter for existing pinned BOC
NOTE: Sync version is available only for lib-node
binding.
boc
: string – BOC encoded as base64 or BOC reference
boc_ref
: string – Reference to the cached BOC
Unpin BOCs with specified pin defined in the cache_set
. Decrease pin reference counter for BOCs with specified pin defined in the cache_set
. BOCs which have only 1 pin and its reference counter become 0 will be removed from cache
NOTE: Sync version is available only for lib-node
binding.
pin
: string – Pinned name
boc_ref
?: string – Reference to the cached BOC.
If it is provided then only referenced BOC is unpinned
Encodes bag of cells (BOC) with builder operations. This method provides the same functionality as Solidity TvmBuilder. Resulting BOC of this method can be passed into Solidity and C++ contracts as TvmCell type.
NOTE: Sync version is available only for lib-node
binding.
boc
: string – Encoded cell BOC or BOC cache key.
Returns the contract code's salt if it is present.
NOTE: Sync version is available only for lib-node
binding.
code
: string – Contract code BOC encoded as base64 or code BOC handle
salt
?: string – Contract code salt if present.
BOC encoded as base64 or BOC handle
Sets new salt to contract code.
Returns the new contract code with salt.
NOTE: Sync version is available only for lib-node
binding.
code
: string – Contract code BOC encoded as base64 or code BOC handle
salt
: string – Code salt to set.
BOC encoded as base64 or BOC handle
code
: string – Contract code with salt set.
BOC encoded as base64 or BOC handle
Decodes contract's initial state into code, data, libraries and special options.
NOTE: Sync version is available only for lib-node
binding.
state_init
: string – Contract StateInit image BOC encoded as base64 or BOC handle
code
?: string – Contract code BOC encoded as base64 or BOC handle
code_hash
?: string – Contract code hash
code_depth
?: number – Contract code depth
data
?: string – Contract data BOC encoded as base64 or BOC handle
data_hash
?: string – Contract data hash
data_depth
?: number – Contract data depth
library
?: string – Contract library BOC encoded as base64 or BOC handle
tick
?: boolean – special.tick
field.
Specifies the contract ability to handle tick transactions
tock
?: boolean – special.tock
field.
Specifies the contract ability to handle tock transactions
split_depth
?: number – Is present and non-zero only in instances of large smart contracts
compiler_version
?: string – Compiler version, for example 'sol 0.49.0'
Encodes initial contract state from code, data, libraries ans special options (see input params)
NOTE: Sync version is available only for lib-node
binding.
code
?: string – Contract code BOC encoded as base64 or BOC handle
data
?: string – Contract data BOC encoded as base64 or BOC handle
library
?: string – Contract library BOC encoded as base64 or BOC handle
tick
?: boolean – special.tick
field.
Specifies the contract ability to handle tick transactions
tock
?: boolean – special.tock
field.
Specifies the contract ability to handle tock transactions
split_depth
?: number – Is present and non-zero only in instances of large smart contracts
state_init
: string – Contract StateInit image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
Encodes a message
Allows to encode any external inbound message.
NOTE: Sync version is available only for lib-node
binding.
src
?: string – Source address.
dst
: string – Destination address.
init
?: string – Bag of cells with state init (used in deploy messages).
body
?: string – Bag of cells with the message body encoded as base64.
message
: string – Message BOC encoded with base64
.
message_id
: string – Message id.
Returns the compiler version used to compile the code.
NOTE: Sync version is available only for lib-node
binding.
code
: string – Contract code BOC encoded as base64 or code BOC handle
version
?: string – Compiler version, for example 'sol 0.49.0'
Pin the BOC with pin
name.
Such BOC will not be removed from cache until it is unpinned BOCs can have several pins and each of the pins has reference counter indicating how many times the BOC was pinned with the pin. BOC is removed from cache after all references for all pins are unpinned with cache_unpin
function calls.
pin
: string
BOC is placed into a common BOC pool with limited size regulated by LRU (least recently used) cache lifecycle.
BOC resides there until it is replaced with other BOCs if it is not used
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 BOCs can have several pins and each of the pins has reference counter indicating how many times the BOC was pinned with the pin. BOC is removed from cache after all references for all pins are unpinned with cache_unpin
function calls.
pin
: string
When type is 'Unpinned'
BOC is placed into a common BOC pool with limited size regulated by LRU (least recently used) cache lifecycle.
BOC resides there until it is replaced with other BOCs if it is not used
Variant constructors:
Append integer to cell data.
size
: number – Bit size of the value.
value
: any – Value: - Number
containing integer number.
e.g. 123
, -123
. - Decimal string. e.g. "123"
, "-123"
.
- 0x
prefixed hexadecimal string.
e.g 0x123
, 0X123
, -0x123
.
Append bit string to cell data.
value
: string – Bit string content using bitstring notation. See TON specification
1.0.
Contains hexadecimal string representation:
- Can end with _
tag.
- Can be prefixed with x
or X
.
- Can be prefixed with x{
or X{
and ended with }
.
Contains binary string represented as a sequence
of 0
and 1
prefixed with n
or N
.
Examples:
1AB
, x1ab
, X1AB
, x{1abc}
, X{1ABC}
2D9_
, x2D9_
, X2D9_
, x{2D9_}
, X{2D9_}
n00101101100
, N00101101100
Append ref to nested cells.
Append ref to nested cell.
boc
: string – Nested cell BOC encoded with base64
or BOC cache key.
Address.
address
: string – Address in a common workchain:account
or base64 format.
Cell builder operation.
Depends on value of the type
field.
When type is 'Integer'
Append integer to cell data.
size
: number – Bit size of the value.
value
: any – Value: - Number
containing integer number.
e.g. 123
, -123
. - Decimal string. e.g. "123"
, "-123"
.
- 0x
prefixed hexadecimal string.
e.g 0x123
, 0X123
, -0x123
.
When type is 'BitString'
Append bit string to cell data.
value
: string – Bit string content using bitstring notation. See TVM specification
1.0.
Contains hexadecimal string representation:
- Can end with _
tag.
- Can be prefixed with x
or X
.
- Can be prefixed with x{
or X{
and ended with }
.
Contains binary string represented as a sequence
of 0
and 1
prefixed with n
or N
.
Examples:
1AB
, x1ab
, X1AB
, x{1abc}
, X{1ABC}
2D9_
, x2D9_
, X2D9_
, x{2D9_}
, X{2D9_}
n00101101100
, N00101101100
When type is 'Cell'
Append ref to nested cells.
When type is 'CellBoc'
Append ref to nested cell.
boc
: string – Nested cell BOC encoded with base64
or BOC cache key.
When type is 'Address'
Address.
address
: string – Address in a common workchain:account
or base64 format.
Variant constructors:
Depends on value of the type
field.
When type is 'V1'
Variant constructors:
code
?: string
description
?: string
One of the following value:
InvalidBoc = 201
SerializationError = 202
InappropriateBlock = 203
MissingSourceBoc = 204
InsufficientCacheSize = 205
BocRefNotFound = 206
InvalidBocRef = 207
tvc
: string – Contract TVC BOC encoded as base64 or BOC handle
boc
: string – BOC encoded as base64
parsed
: any – JSON containing parsed BOC
boc
: string – BOC encoded as base64
id
: string – Shardstate identifier
workchain_id
: number – Workchain shardstate belongs to
block_boc
: string – Key block BOC or zerostate BOC encoded as base64
config_boc
: string – Blockchain config BOC encoded as base64
boc
: string – BOC encoded as base64 or BOC handle
hash
: string – BOC root hash encoded with hex
boc
: string – BOC encoded as base64 or BOC handle
depth
: number – BOC root cell depth
tvc
: string – Contract TVC image or image BOC handle
code
: string – Contract code encoded as base64
boc_ref
: string – Reference to the cached BOC
boc
?: string – BOC encoded as base64.
boc
: string – BOC encoded as base64 or BOC reference
boc_ref
: string – Reference to the cached BOC
pin
: string – Pinned name
boc_ref
?: string – Reference to the cached BOC.
If it is provided then only referenced BOC is unpinned
boc
: string – Encoded cell BOC or BOC cache key.
code
: string – Contract code BOC encoded as base64 or code BOC handle
salt
?: string – Contract code salt if present.
BOC encoded as base64 or BOC handle
code
: string – Contract code BOC encoded as base64 or code BOC handle
salt
: string – Code salt to set.
BOC encoded as base64 or BOC handle
code
: string – Contract code with salt set.
BOC encoded as base64 or BOC handle
state_init
: string – Contract StateInit image BOC encoded as base64 or BOC handle
code
?: string – Contract code BOC encoded as base64 or BOC handle
code_hash
?: string – Contract code hash
code_depth
?: number – Contract code depth
data
?: string – Contract data BOC encoded as base64 or BOC handle
data_hash
?: string – Contract data hash
data_depth
?: number – Contract data depth
library
?: string – Contract library BOC encoded as base64 or BOC handle
tick
?: boolean – special.tick
field.
Specifies the contract ability to handle tick transactions
tock
?: boolean – special.tock
field.
Specifies the contract ability to handle tock transactions
split_depth
?: number – Is present and non-zero only in instances of large smart contracts
compiler_version
?: string – Compiler version, for example 'sol 0.49.0'
code
?: string – Contract code BOC encoded as base64 or BOC handle
data
?: string – Contract data BOC encoded as base64 or BOC handle
library
?: string – Contract library BOC encoded as base64 or BOC handle
tick
?: boolean – special.tick
field.
Specifies the contract ability to handle tick transactions
tock
?: boolean – special.tock
field.
Specifies the contract ability to handle tock transactions
split_depth
?: number – Is present and non-zero only in instances of large smart contracts
state_init
: string – Contract StateInit image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
src
?: string – Source address.
dst
: string – Destination address.
init
?: string – Bag of cells with state init (used in deploy messages).
body
?: string – Bag of cells with the message body encoded as base64.
message
: string – Message BOC encoded with base64
.
message_id
: string – Message id.
code
: string – Contract code BOC encoded as base64 or code BOC handle
version
?: string – Compiler version, for example 'sol 0.49.0'
– Encodes bag of cells (BOC) with builder operations. This method provides the same functionality as Solidity TvmBuilder. Resulting BOC of this method can be passed into Solidity and C++ contracts as TvmCell type.
– Returns the contract code's salt if it is present.
– Sets new salt to contract code.
– Decodes contract's initial state into code, data, libraries and special options.
– Encodes initial contract state from code, data, libraries ans special options (see input params)
– Encodes a message
– Returns the compiler version used to compile the code.
– Pin the BOC with pin
name.
– BOC is placed into a common BOC pool with limited size regulated by LRU (least recently used) cache lifecycle.
– Append integer to cell data.
– Append bit string to cell data.
– Append ref to nested cells.
– Append ref to nested cell.
– Address.
– Cell builder operation.
Decodes tvc according to the tvc spec. Read more about tvc structure
tvc
: – Decoded TVC
cache_type
: – Cache type
builder
: [] – Cell builder operations.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result.
The BOC itself returned if no cache type provided
builder
: [] – Nested cell builder.
builder
: [] – Nested cell builder.
value
:
value
:
tvc
: – Decoded TVC
cache_type
: – Cache type
builder
: [] – Cell builder operations.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result. The BOC itself returned if no cache type provided.
boc_cache
?: – Cache type to put the result.
The BOC itself returned if no cache type provided