# Module boc

## Module boc

BOC manipulation module.

### Functions

[decode\_tvc](#decode_tvc) – Decodes tvc according to the tvc spec. Read more about tvc structure [here](https://github.com/tvmlabs/tvm-sdk/blob/00fd198e4f8f404d5f495c6a65d84b54fe76881b/tvm_struct/src/scheme/mod.rs#L31)

[parse\_message](#parse_message) – Parses message boc into a JSON

[parse\_transaction](#parse_transaction) – Parses transaction boc into a JSON

[parse\_account](#parse_account) – Parses account boc into a JSON

[parse\_block](#parse_block) – Parses block boc into a JSON

[parse\_shardstate](#parse_shardstate) – Parses shardstate boc into a JSON

[get\_blockchain\_config](#get_blockchain_config) – Extract blockchain configuration from key block and also from zerostate.

[get\_boc\_hash](#get_boc_hash) – Calculates BOC root hash

[get\_boc\_depth](#get_boc_depth) – Calculates BOC depth

[get\_code\_from\_tvc](#get_code_from_tvc) – Extracts code from TVC contract image

[cache\_get](#cache_get) – Get BOC from cache

[cache\_set](#cache_set) – Save BOC into cache or increase pin counter for existing pinned BOC

[cache\_unpin](#cache_unpin) – 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

[encode\_boc](#encode_boc) – 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.

[get\_code\_salt](#get_code_salt) – Returns the contract code's salt if it is present.

[set\_code\_salt](#set_code_salt) – Sets new salt to contract code.

[decode\_state\_init](#decode_state_init) – Decodes contract's initial state into code, data, libraries and special options.

[encode\_state\_init](#encode_state_init) – Encodes initial contract state from code, data, libraries ans special options (see input params)

[encode\_external\_in\_message](#encode_external_in_message) – Encodes a message

[get\_compiler\_version](#get_compiler_version) – Returns the compiler version used to compile the code.

### Types

[BocCacheTypePinnedVariant](#boccachetypepinnedvariant) – Pin the BOC with `pin` name.

[BocCacheTypeUnpinnedVariant](#boccachetypeunpinnedvariant) – BOC is placed into a common BOC pool with limited size regulated by LRU (least recently used) cache lifecycle.

[BocCacheType](#boccachetype)

[BuilderOpIntegerVariant](#builderopintegervariant) – Append integer to cell data.

[BuilderOpBitStringVariant](#builderopbitstringvariant) – Append bit string to cell data.

[BuilderOpCellVariant](#builderopcellvariant) – Append ref to nested cells.

[BuilderOpCellBocVariant](#builderopcellbocvariant) – Append ref to nested cell.

[BuilderOpAddressVariant](#builderopaddressvariant) – Address.

[BuilderOp](#builderop) – Cell builder operation.

[TvcV1Variant](#tvcv1variant)

[Tvc](#tvc)

[TvcV1](#tvcv1)

[BocErrorCode](#bocerrorcode)

[ParamsOfDecodeTvc](#paramsofdecodetvc)

[ResultOfDecodeTvc](#resultofdecodetvc)

[ParamsOfParse](#paramsofparse)

[ResultOfParse](#resultofparse)

[ParamsOfParseShardstate](#paramsofparseshardstate)

[ParamsOfGetBlockchainConfig](#paramsofgetblockchainconfig)

[ResultOfGetBlockchainConfig](#resultofgetblockchainconfig)

[ParamsOfGetBocHash](#paramsofgetbochash)

[ResultOfGetBocHash](#resultofgetbochash)

[ParamsOfGetBocDepth](#paramsofgetbocdepth)

[ResultOfGetBocDepth](#resultofgetbocdepth)

[ParamsOfGetCodeFromTvc](#paramsofgetcodefromtvc)

[ResultOfGetCodeFromTvc](#resultofgetcodefromtvc)

[ParamsOfBocCacheGet](#paramsofboccacheget)

[ResultOfBocCacheGet](#resultofboccacheget)

[ParamsOfBocCacheSet](#paramsofboccacheget)

ResultOfBocCacheSet

ParamsOfBocCacheUnpin

ParamsOfEncodeBoc

ResultOfEncodeBoc

ParamsOfGetCodeSalt

ResultOfGetCodeSalt

ParamsOfSetCodeSalt

ResultOfSetCodeSalt

ParamsOfDecodeStateInit

ResultOfDecodeStateInit

ParamsOfEncodeStateInit

ResultOfEncodeStateInit

ParamsOfEncodeExternalInMessage

ResultOfEncodeExternalInMessage

ParamsOfGetCompilerVersion

ResultOfGetCompilerVersion

## Functions

### decode\_tvc

Decodes tvc according to the tvc spec. Read more about tvc structure [here](https://github.com/tvmlabs/tvm-sdk/blob/00fd198e4f8f404d5f495c6a65d84b54fe76881b/tvm_struct/src/scheme/mod.rs#L31)

```ts
type ParamsOfDecodeTvc = {
    tvc: string
}

type ResultOfDecodeTvc = {
    tvc: Tvc
}

function decode_tvc(
    params: ParamsOfDecodeTvc,
): Promise<ResultOfDecodeTvc>;

function decode_tvc_sync(
    params: ParamsOfDecodeTvc,
): ResultOfDecodeTvc;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `tvc`: *string* – Contract TVC BOC encoded as base64 or BOC handle

#### Result

* `tvc`: [*Tvc*](#tvc) – Decoded TVC

### parse\_message

Parses message boc into a JSON

JSON structure is compatible with GraphQL API message object

```ts
type ParamsOfParse = {
    boc: string
}

type ResultOfParse = {
    parsed: any
}

function parse_message(
    params: ParamsOfParse,
): Promise<ResultOfParse>;

function parse_message_sync(
    params: ParamsOfParse,
): ResultOfParse;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64

#### Result

* `parsed`: *any* – JSON containing parsed BOC

### parse\_transaction

Parses transaction boc into a JSON

JSON structure is compatible with GraphQL API transaction object

```ts
type ParamsOfParse = {
    boc: string
}

type ResultOfParse = {
    parsed: any
}

function parse_transaction(
    params: ParamsOfParse,
): Promise<ResultOfParse>;

function parse_transaction_sync(
    params: ParamsOfParse,
): ResultOfParse;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64

#### Result

* `parsed`: *any* – JSON containing parsed BOC

### parse\_account

Parses account boc into a JSON

JSON structure is compatible with GraphQL API account object

```ts
type ParamsOfParse = {
    boc: string
}

type ResultOfParse = {
    parsed: any
}

function parse_account(
    params: ParamsOfParse,
): Promise<ResultOfParse>;

function parse_account_sync(
    params: ParamsOfParse,
): ResultOfParse;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64

#### Result

* `parsed`: *any* – JSON containing parsed BOC

### parse\_block

Parses block boc into a JSON

JSON structure is compatible with GraphQL API block object

```ts
type ParamsOfParse = {
    boc: string
}

type ResultOfParse = {
    parsed: any
}

function parse_block(
    params: ParamsOfParse,
): Promise<ResultOfParse>;

function parse_block_sync(
    params: ParamsOfParse,
): ResultOfParse;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64

#### Result

* `parsed`: *any* – JSON containing parsed BOC

### parse\_shardstate

Parses shardstate boc into a JSON

JSON structure is compatible with GraphQL API shardstate object

```ts
type ParamsOfParseShardstate = {
    boc: string,
    id: string,
    workchain_id: number
}

type ResultOfParse = {
    parsed: any
}

function parse_shardstate(
    params: ParamsOfParseShardstate,
): Promise<ResultOfParse>;

function parse_shardstate_sync(
    params: ParamsOfParseShardstate,
): ResultOfParse;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64
* `id`: *string* – Shardstate identifier
* `workchain_id`: *number* – Workchain shardstate belongs to

#### Result

* `parsed`: *any* – JSON containing parsed BOC

### get\_blockchain\_config

Extract blockchain configuration from key block and also from zerostate.

```ts
type ParamsOfGetBlockchainConfig = {
    block_boc: string
}

type ResultOfGetBlockchainConfig = {
    config_boc: string
}

function get_blockchain_config(
    params: ParamsOfGetBlockchainConfig,
): Promise<ResultOfGetBlockchainConfig>;

function get_blockchain_config_sync(
    params: ParamsOfGetBlockchainConfig,
): ResultOfGetBlockchainConfig;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `block_boc`: *string* – Key block BOC or zerostate BOC encoded as base64

#### Result

* `config_boc`: *string* – Blockchain config BOC encoded as base64

### get\_boc\_hash

Calculates BOC root hash

```ts
type ParamsOfGetBocHash = {
    boc: string
}

type ResultOfGetBocHash = {
    hash: string
}

function get_boc_hash(
    params: ParamsOfGetBocHash,
): Promise<ResultOfGetBocHash>;

function get_boc_hash_sync(
    params: ParamsOfGetBocHash,
): ResultOfGetBocHash;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64 or BOC handle

#### Result

* `hash`: *string* – BOC root hash encoded with hex

### get\_boc\_depth

Calculates BOC depth

```ts
type ParamsOfGetBocDepth = {
    boc: string
}

type ResultOfGetBocDepth = {
    depth: number
}

function get_boc_depth(
    params: ParamsOfGetBocDepth,
): Promise<ResultOfGetBocDepth>;

function get_boc_depth_sync(
    params: ParamsOfGetBocDepth,
): ResultOfGetBocDepth;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64 or BOC handle

#### Result

* `depth`: *number* – BOC root cell depth

### get\_code\_from\_tvc

Extracts code from TVC contract image

```ts
type ParamsOfGetCodeFromTvc = {
    tvc: string
}

type ResultOfGetCodeFromTvc = {
    code: string
}

function get_code_from_tvc(
    params: ParamsOfGetCodeFromTvc,
): Promise<ResultOfGetCodeFromTvc>;

function get_code_from_tvc_sync(
    params: ParamsOfGetCodeFromTvc,
): ResultOfGetCodeFromTvc;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `tvc`: *string* – Contract TVC image or image BOC handle

#### Result

* `code`: *string* – Contract code encoded as base64

### cache\_get

Get BOC from cache

```ts
type ParamsOfBocCacheGet = {
    boc_ref: string
}

type ResultOfBocCacheGet = {
    boc?: string
}

function cache_get(
    params: ParamsOfBocCacheGet,
): Promise<ResultOfBocCacheGet>;

function cache_get_sync(
    params: ParamsOfBocCacheGet,
): ResultOfBocCacheGet;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc_ref`: *string* – Reference to the cached BOC

#### Result

* `boc`?: *string* – BOC encoded as base64.

### cache\_set

Save BOC into cache or increase pin counter for existing pinned BOC

```ts
type ParamsOfBocCacheSet = {
    boc: string,
    cache_type: BocCacheType
}

type ResultOfBocCacheSet = {
    boc_ref: string
}

function cache_set(
    params: ParamsOfBocCacheSet,
): Promise<ResultOfBocCacheSet>;

function cache_set_sync(
    params: ParamsOfBocCacheSet,
): ResultOfBocCacheSet;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `boc`: *string* – BOC encoded as base64 or BOC reference
* `cache_type`: [*BocCacheType*](#boccachetype) – Cache type

#### Result

* `boc_ref`: *string* – Reference to the cached BOC

### cache\_unpin

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

```ts
type ParamsOfBocCacheUnpin = {
    pin: string,
    boc_ref?: string
}

function cache_unpin(
    params: ParamsOfBocCacheUnpin,
): Promise<void>;

function cache_unpin_sync(
    params: ParamsOfBocCacheUnpin,
): void;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `pin`: *string* – Pinned name
* `boc_ref`?: *string* – Reference to the cached BOC.\
  If it is provided then only referenced BOC is unpinned

### encode\_boc

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.

```ts
type ParamsOfEncodeBoc = {
    builder: BuilderOp[],
    boc_cache?: BocCacheType
}

type ResultOfEncodeBoc = {
    boc: string
}

function encode_boc(
    params: ParamsOfEncodeBoc,
): Promise<ResultOfEncodeBoc>;

function encode_boc_sync(
    params: ParamsOfEncodeBoc,
): ResultOfEncodeBoc;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `builder`: [*BuilderOp*](#builderop)*\[]* – Cell builder operations.
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `boc`: *string* – Encoded cell BOC or BOC cache key.

### get\_code\_salt

Returns the contract code's salt if it is present.

```ts
type ParamsOfGetCodeSalt = {
    code: string,
    boc_cache?: BocCacheType
}

type ResultOfGetCodeSalt = {
    salt?: string
}

function get_code_salt(
    params: ParamsOfGetCodeSalt,
): Promise<ResultOfGetCodeSalt>;

function get_code_salt_sync(
    params: ParamsOfGetCodeSalt,
): ResultOfGetCodeSalt;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `code`: *string* – Contract code BOC encoded as base64 or code BOC handle
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `salt`?: *string* – Contract code salt if present.\
  BOC encoded as base64 or BOC handle

### set\_code\_salt

Sets new salt to contract code.

Returns the new contract code with salt.

```ts
type ParamsOfSetCodeSalt = {
    code: string,
    salt: string,
    boc_cache?: BocCacheType
}

type ResultOfSetCodeSalt = {
    code: string
}

function set_code_salt(
    params: ParamsOfSetCodeSalt,
): Promise<ResultOfSetCodeSalt>;

function set_code_salt_sync(
    params: ParamsOfSetCodeSalt,
): ResultOfSetCodeSalt;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `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
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `code`: *string* – Contract code with salt set.\
  BOC encoded as base64 or BOC handle

### decode\_state\_init

Decodes contract's initial state into code, data, libraries and special options.

```ts
type ParamsOfDecodeStateInit = {
    state_init: string,
    boc_cache?: BocCacheType
}

type ResultOfDecodeStateInit = {
    code?: string,
    code_hash?: string,
    code_depth?: number,
    data?: string,
    data_hash?: string,
    data_depth?: number,
    library?: string,
    tick?: boolean,
    tock?: boolean,
    split_depth?: number,
    compiler_version?: string
}

function decode_state_init(
    params: ParamsOfDecodeStateInit,
): Promise<ResultOfDecodeStateInit>;

function decode_state_init_sync(
    params: ParamsOfDecodeStateInit,
): ResultOfDecodeStateInit;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `state_init`: *string* – Contract StateInit image BOC encoded as base64 or BOC handle
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `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'

### encode\_state\_init

Encodes initial contract state from code, data, libraries ans special options (see input params)

```ts
type ParamsOfEncodeStateInit = {
    code?: string,
    data?: string,
    library?: string,
    tick?: boolean,
    tock?: boolean,
    split_depth?: number,
    boc_cache?: BocCacheType
}

type ResultOfEncodeStateInit = {
    state_init: string
}

function encode_state_init(
    params: ParamsOfEncodeStateInit,
): Promise<ResultOfEncodeStateInit>;

function encode_state_init_sync(
    params: ParamsOfEncodeStateInit,
): ResultOfEncodeStateInit;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `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
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `state_init`: *string* – Contract StateInit image BOC encoded as base64 or BOC handle of boc\_cache parameter was specified

### encode\_external\_in\_message

Encodes a message

Allows to encode any external inbound message.

```ts
type ParamsOfEncodeExternalInMessage = {
    src?: string,
    dst: string,
    init?: string,
    body?: string,
    boc_cache?: BocCacheType
}

type ResultOfEncodeExternalInMessage = {
    message: string,
    message_id: string
}

function encode_external_in_message(
    params: ParamsOfEncodeExternalInMessage,
): Promise<ResultOfEncodeExternalInMessage>;

function encode_external_in_message_sync(
    params: ParamsOfEncodeExternalInMessage,
): ResultOfEncodeExternalInMessage;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `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.
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result.\
  The BOC itself returned if no cache type provided

#### Result

* `message`: *string* – Message BOC encoded with `base64`.
* `message_id`: *string* – Message id.

### get\_compiler\_version

Returns the compiler version used to compile the code.

```ts
type ParamsOfGetCompilerVersion = {
    code: string
}

type ResultOfGetCompilerVersion = {
    version?: string
}

function get_compiler_version(
    params: ParamsOfGetCompilerVersion,
): Promise<ResultOfGetCompilerVersion>;

function get_compiler_version_sync(
    params: ParamsOfGetCompilerVersion,
): ResultOfGetCompilerVersion;
```

NOTE: Sync version is available only for `lib-node` binding.

#### Parameters

* `code`: *string* – Contract code BOC encoded as base64 or code BOC handle

#### Result

* `version`?: *string* – Compiler version, for example 'sol 0.49.0'

## Types

### BocCacheTypePinnedVariant

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.

```ts
type BocCacheTypePinnedVariant = {
    pin: string
}
```

* `pin`: *string*

### BocCacheTypeUnpinnedVariant

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

```ts
type BocCacheTypeUnpinnedVariant = {

}
```

### BocCacheType

```ts
type BocCacheType = ({
    type: 'Pinned'
} & BocCacheTypePinnedVariant) | ({
    type: 'Unpinned'
} & BocCacheTypeUnpinnedVariant)
```

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:

```ts
function bocCacheTypePinned(pin: string): BocCacheType;
function bocCacheTypeUnpinned(): BocCacheType;
```

### BuilderOpIntegerVariant

Append integer to cell data.

```ts
type BuilderOpIntegerVariant = {
    size: number,
    value: any
}
```

* `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`.

### BuilderOpBitStringVariant

Append bit string to cell data.

```ts
type BuilderOpBitStringVariant = {
    value: string
}
```

* `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`

### BuilderOpCellVariant

Append ref to nested cells.

```ts
type BuilderOpCellVariant = {
    builder: BuilderOp[]
}
```

* `builder`: [*BuilderOp*](#builderop)*\[]* – Nested cell builder.

### BuilderOpCellBocVariant

Append ref to nested cell.

```ts
type BuilderOpCellBocVariant = {
    boc: string
}
```

* `boc`: *string* – Nested cell BOC encoded with `base64` or BOC cache key.

### BuilderOpAddressVariant

Address.

```ts
type BuilderOpAddressVariant = {
    address: string
}
```

* `address`: *string* – Address in a common `workchain:account` or base64 format.

### BuilderOp

Cell builder operation.

```ts
type BuilderOp = ({
    type: 'Integer'
} & BuilderOpIntegerVariant) | ({
    type: 'BitString'
} & BuilderOpBitStringVariant) | ({
    type: 'Cell'
} & BuilderOpCellVariant) | ({
    type: 'CellBoc'
} & BuilderOpCellBocVariant) | ({
    type: 'Address'
} & BuilderOpAddressVariant)
```

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.

* `builder`: [*BuilderOp*](#builderop)*\[]* – Nested cell builder.

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:

```ts
function builderOpInteger(size: number, value: any): BuilderOp;
function builderOpBitString(value: string): BuilderOp;
function builderOpCell(builder: BuilderOp[]): BuilderOp;
function builderOpCellBoc(boc: string): BuilderOp;
function builderOpAddress(address: string): BuilderOp;
```

### TvcV1Variant

```ts
type TvcV1Variant = {
    value: TvcV1
}
```

* `value`: [*TvcV1*](#tvcv1)

### Tvc

```ts
type Tvc = ({
    type: 'V1'
} & TvcV1Variant)
```

Depends on value of the `type` field.

When *type* is *'V1'*

* `value`: [*TvcV1*](#tvcv1)

Variant constructors:

```ts
function tvcV1(value: TvcV1): Tvc;
```

### TvcV1

```ts
type TvcV1 = {
    code?: string,
    description?: string
}
```

* `code`?: *string*
* `description`?: *string*

### BocErrorCode

```ts
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`

### ParamsOfDecodeTvc

```ts
type ParamsOfDecodeTvc = {
    tvc: string
}
```

* `tvc`: *string* – Contract TVC BOC encoded as base64 or BOC handle

### ResultOfDecodeTvc

```ts
type ResultOfDecodeTvc = {
    tvc: Tvc
}
```

* `tvc`: [*Tvc*](#tvc) – Decoded TVC

### ParamsOfParse

```ts
type ParamsOfParse = {
    boc: string
}
```

* `boc`: *string* – BOC encoded as base64

### ResultOfParse

```ts
type ResultOfParse = {
    parsed: any
}
```

* `parsed`: *any* – JSON containing parsed BOC

### ParamsOfParseShardstate

```ts
type ParamsOfParseShardstate = {
    boc: string,
    id: string,
    workchain_id: number
}
```

* `boc`: *string* – BOC encoded as base64
* `id`: *string* – Shardstate identifier
* `workchain_id`: *number* – Workchain shardstate belongs to

### ParamsOfGetBlockchainConfig

```ts
type ParamsOfGetBlockchainConfig = {
    block_boc: string
}
```

* `block_boc`: *string* – Key block BOC or zerostate BOC encoded as base64

### ResultOfGetBlockchainConfig

```ts
type ResultOfGetBlockchainConfig = {
    config_boc: string
}
```

* `config_boc`: *string* – Blockchain config BOC encoded as base64

### ParamsOfGetBocHash

```ts
type ParamsOfGetBocHash = {
    boc: string
}
```

* `boc`: *string* – BOC encoded as base64 or BOC handle

### ResultOfGetBocHash

```ts
type ResultOfGetBocHash = {
    hash: string
}
```

* `hash`: *string* – BOC root hash encoded with hex

### ParamsOfGetBocDepth

```ts
type ParamsOfGetBocDepth = {
    boc: string
}
```

* `boc`: *string* – BOC encoded as base64 or BOC handle

### ResultOfGetBocDepth

```ts
type ResultOfGetBocDepth = {
    depth: number
}
```

* `depth`: *number* – BOC root cell depth

### ParamsOfGetCodeFromTvc

```ts
type ParamsOfGetCodeFromTvc = {
    tvc: string
}
```

* `tvc`: *string* – Contract TVC image or image BOC handle

### ResultOfGetCodeFromTvc

```ts
type ResultOfGetCodeFromTvc = {
    code: string
}
```

* `code`: *string* – Contract code encoded as base64

### ParamsOfBocCacheGet

```ts
type ParamsOfBocCacheGet = {
    boc_ref: string
}
```

* `boc_ref`: *string* – Reference to the cached BOC

### ResultOfBocCacheGet

```ts
type ResultOfBocCacheGet = {
    boc?: string
}
```

* `boc`?: *string* – BOC encoded as base64.

### ParamsOfBocCacheSet

```ts
type ParamsOfBocCacheSet = {
    boc: string,
    cache_type: BocCacheType
}
```

* `boc`: *string* – BOC encoded as base64 or BOC reference
* `cache_type`: [*BocCacheType*](#boccachetype) – Cache type

### ResultOfBocCacheSet

```ts
type ResultOfBocCacheSet = {
    boc_ref: string
}
```

* `boc_ref`: *string* – Reference to the cached BOC

### ParamsOfBocCacheUnpin

```ts
type ParamsOfBocCacheUnpin = {
    pin: string,
    boc_ref?: string
}
```

* `pin`: *string* – Pinned name
* `boc_ref`?: *string* – Reference to the cached BOC.\
  If it is provided then only referenced BOC is unpinned

### ParamsOfEncodeBoc

```ts
type ParamsOfEncodeBoc = {
    builder: BuilderOp[],
    boc_cache?: BocCacheType
}
```

* `builder`: [*BuilderOp*](#builderop)*\[]* – Cell builder operations.
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfEncodeBoc

```ts
type ResultOfEncodeBoc = {
    boc: string
}
```

* `boc`: *string* – Encoded cell BOC or BOC cache key.

### ParamsOfGetCodeSalt

```ts
type ParamsOfGetCodeSalt = {
    code: string,
    boc_cache?: BocCacheType
}
```

* `code`: *string* – Contract code BOC encoded as base64 or code BOC handle
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfGetCodeSalt

```ts
type ResultOfGetCodeSalt = {
    salt?: string
}
```

* `salt`?: *string* – Contract code salt if present.\
  BOC encoded as base64 or BOC handle

### ParamsOfSetCodeSalt

```ts
type ParamsOfSetCodeSalt = {
    code: string,
    salt: string,
    boc_cache?: BocCacheType
}
```

* `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
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfSetCodeSalt

```ts
type ResultOfSetCodeSalt = {
    code: string
}
```

* `code`: *string* – Contract code with salt set.\
  BOC encoded as base64 or BOC handle

### ParamsOfDecodeStateInit

```ts
type ParamsOfDecodeStateInit = {
    state_init: string,
    boc_cache?: BocCacheType
}
```

* `state_init`: *string* – Contract StateInit image BOC encoded as base64 or BOC handle
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfDecodeStateInit

```ts
type ResultOfDecodeStateInit = {
    code?: string,
    code_hash?: string,
    code_depth?: number,
    data?: string,
    data_hash?: string,
    data_depth?: number,
    library?: string,
    tick?: boolean,
    tock?: boolean,
    split_depth?: number,
    compiler_version?: string
}
```

* `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'

### ParamsOfEncodeStateInit

```ts
type ParamsOfEncodeStateInit = {
    code?: string,
    data?: string,
    library?: string,
    tick?: boolean,
    tock?: boolean,
    split_depth?: number,
    boc_cache?: BocCacheType
}
```

* `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
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfEncodeStateInit

```ts
type ResultOfEncodeStateInit = {
    state_init: string
}
```

* `state_init`: *string* – Contract StateInit image BOC encoded as base64 or BOC handle of boc\_cache parameter was specified

### ParamsOfEncodeExternalInMessage

```ts
type ParamsOfEncodeExternalInMessage = {
    src?: string,
    dst: string,
    init?: string,
    body?: string,
    boc_cache?: BocCacheType
}
```

* `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.
* `boc_cache`?: [*BocCacheType*](#boccachetype) – Cache type to put the result.\
  The BOC itself returned if no cache type provided

### ResultOfEncodeExternalInMessage

```ts
type ResultOfEncodeExternalInMessage = {
    message: string,
    message_id: string
}
```

* `message`: *string* – Message BOC encoded with `base64`.
* `message_id`: *string* – Message id.

### ParamsOfGetCompilerVersion

```ts
type ParamsOfGetCompilerVersion = {
    code: string
}
```

* `code`: *string* – Contract code BOC encoded as base64 or code BOC handle

### ResultOfGetCompilerVersion

```ts
type ResultOfGetCompilerVersion = {
    version?: string
}
```

* `version`?: *string* – Compiler version, for example 'sol 0.49.0'
