# Module abi

## Module abi

Provides message encoding and decoding according to the ABI specification.

### Functions

[encode\_message\_body](#encode_message_body) – Encodes message body according to ABI function call.

[attach\_signature\_to\_message\_body](#attach_signature_to_message_body)

[encode\_message](#encode_message) – Encodes an ABI-compatible message

[encode\_internal\_message](#encode_internal_message) – Encodes an internal ABI-compatible message

[attach\_signature](#attach_signature) – Combines `hex`-encoded `signature` with `base64`-encoded `unsigned_message`. Returns signed message encoded in `base64`.

[decode\_message](#decode_message) – Decodes message body using provided message BOC and ABI.

[decode\_message\_body](#decode_message_body) – Decodes message body using provided body BOC and ABI.

[encode\_account](#encode_account) – Creates account state BOC

[decode\_account\_data](#decode_account_data) – Decodes account data using provided data BOC and ABI.

[update\_initial\_data](#update_initial_data) – Updates initial account data with initial values for the contract's static variables and owner's public key. This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.

[encode\_initial\_data](#encode_initial_data) – Encodes initial account data with initial values for the contract's static variables and owner's public key into a data BOC that can be passed to `encode_tvc` function afterwards.

[decode\_initial\_data](#decode_initial_data) – Decodes initial values of a contract's static variables and owner's public key from account initial data This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.

[decode\_boc](#decode_boc) – Decodes BOC into JSON as a set of provided parameters.

[encode\_boc](#encode_boc) – Encodes given parameters in JSON into a BOC using param types from ABI.

[calc\_function\_id](#calc_function_id) – Calculates contract function ID by contract ABI

[get\_signature\_data](#get_signature_data) – Extracts signature from message body and calculates hash to verify the signature

### Types

[AbiErrorCode](#abierrorcode)

[AbiContractVariant](#abicontractvariant)

[AbiJsonVariant](#abijsonvariant)

[AbiHandleVariant](#abihandlevariant)

[AbiSerializedVariant](#abiserializedvariant)

[Abi](#abi)

[AbiHandle](#abihandle)

[FunctionHeader](#functionheader) – The ABI function header.

[CallSet](#callset)

[DeploySet](#deployset)

[SignerNoneVariant](#signernonevariant) – No keys are provided.

[SignerExternalVariant](#signerexternalvariant) – Only public key is provided in unprefixed hex string format to generate unsigned message and `data_to_sign` which can be signed later.

[SignerKeysVariant](#signerkeysvariant) – Key pair is provided for signing

[SignerSigningBoxVariant](#signersigningboxvariant) – Signing Box interface is provided for signing, allows Dapps to sign messages using external APIs, such as HSM, cold wallet, etc.

[Signer](#signer)

[MessageBodyType](#messagebodytype)

[AbiParam](#abiparam)

[AbiEvent](#abievent)

[AbiData](#abidata)

[AbiFunction](#abifunction)

[AbiContract](#abicontract)

[DataLayout](#datalayout)

[ParamsOfEncodeMessageBody](#paramsofencodemessagebody)

[ResultOfEncodeMessageBody](#resultofencodemessagebody)

[ParamsOfAttachSignatureToMessageBody](#paramsofattachsignaturetomessagebody)

[ResultOfAttachSignatureToMessageBody](#resultofattachsignaturetomessagebody)

[ParamsOfEncodeMessage](#paramsofencodemessage)

[ResultOfEncodeMessage](#resultofencodemessage)

[ParamsOfEncodeInternalMessage](#paramsofencodeinternalmessage)

[ResultOfEncodeInternalMessage](#resultofencodeinternalmessage)

[ParamsOfAttachSignature](#paramsofattachsignature)

[ResultOfAttachSignature](#resultofattachsignature)

[ParamsOfDecodeMessage](#paramsofdecodemessage)

[DecodedMessageBody](#decodedmessagebody)

[ParamsOfDecodeMessageBody](#paramsofdecodemessagebody)

[ParamsOfEncodeAccount](#paramsofencodeaccount)

[ResultOfEncodeAccount](#resultofencodeaccount)

[ParamsOfDecodeAccountData](#paramsofdecodeaccountdata)

[ResultOfDecodeAccountData](#resultofdecodeaccountdata)

[ParamsOfUpdateInitialData](#paramsofupdateinitialdata)

[ResultOfUpdateInitialData](#resultofupdateinitialdata)

[ParamsOfEncodeInitialData](#paramsofencodeinitialdata)

[ResultOfEncodeInitialData](#resultofencodeinitialdata)

[ParamsOfDecodeInitialData](#paramsofdecodeinitialdata)

[ResultOfDecodeInitialData](#resultofdecodeinitialdata)

[ParamsOfDecodeBoc](#paramsofdecodeboc)

[ResultOfDecodeBoc](#resultofdecodeboc)

[ParamsOfAbiEncodeBoc](#paramsofabiencodeboc)

[ResultOfAbiEncodeBoc](#resultofabiencodeboc)

[ParamsOfCalcFunctionId](#paramsofcalcfunctionid)

[ResultOfCalcFunctionId](#resultofcalcfunctionid)

[ParamsOfGetSignatureData](#paramsofgetsignaturedata)

[ResultOfGetSignatureData](#resultofgetsignaturedata)

## Functions

### encode\_message\_body

Encodes message body according to ABI function call.

```ts
type ParamsOfEncodeMessageBody = {
    abi: Abi,
    call_set: CallSet,
    is_internal: boolean,
    signer: Signer,
    processing_try_index?: number,
    address?: string,
    signature_id?: number
}

type ResultOfEncodeMessageBody = {
    body: string,
    data_to_sign?: string
}

function encode_message_body(
    params: ParamsOfEncodeMessageBody,
): Promise<ResultOfEncodeMessageBody>;

function encode_message_body_sync(
    params: ParamsOfEncodeMessageBody,
): ResultOfEncodeMessageBody;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI.
* `call_set`: [*CallSet*](#callset) – Function call parameters.\
  Must be specified in non deploy message.\
  \
  In case of deploy message contains parameters of constructor.
* `is_internal`: *boolean* – True if internal message body must be encoded.
* `signer`: [*Signer*](#signer) – Signing parameters.
* `processing_try_index`?: *number* – Processing try index.\
  Used in message processing with retries.\
  \
  Encoder uses the provided try index to calculate message\
  expiration time.\
  \
  Expiration timeouts will grow with every retry.\
  \
  Default value is 0.
* `address`?: *string* – Destination address of the message\
  Since ABI version 2.3 destination address of external inbound message is used in message\
  body signature calculation. Should be provided when signed external inbound message body is\
  created. Otherwise can be omitted.
* `signature_id`?: *number* – Signature ID to be used in data to sign preparing when CapSignatureWithId capability is enabled

#### Result

* `body`: *string* – Message body BOC encoded with `base64`.
* `data_to_sign`?: *string* – Optional data to sign.\
  Encoded with `base64`.\
  Presents when `message` is unsigned. Can be used for external\
  message signing. Is this case you need to sing this data and\
  produce signed message using `abi.attach_signature`.

### attach\_signature\_to\_message\_body

```ts
type ParamsOfAttachSignatureToMessageBody = {
    abi: Abi,
    public_key: string,
    message: string,
    signature: string
}

type ResultOfAttachSignatureToMessageBody = {
    body: string
}

function attach_signature_to_message_body(
    params: ParamsOfAttachSignatureToMessageBody,
): Promise<ResultOfAttachSignatureToMessageBody>;

function attach_signature_to_message_body_sync(
    params: ParamsOfAttachSignatureToMessageBody,
): ResultOfAttachSignatureToMessageBody;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI
* `public_key`: *string* – Public key.\
  Must be encoded with `hex`.
* `message`: *string* – Unsigned message body BOC.\
  Must be encoded with `base64`.
* `signature`: *string* – Signature.\
  Must be encoded with `hex`.

#### Result

* `body`: *string*

### encode\_message

Encodes an ABI-compatible message

Allows to encode deploy and function call messages, both signed and unsigned.

Use cases include messages of any possible type:

* deploy with initial function call (i.e. `constructor` or any other function that is used for some kind of initialization);
* deploy without initial function call;
* signed/unsigned + data for signing.

`Signer` defines how the message should or shouldn't be signed:

`Signer::None` creates an unsigned message. This may be needed in case of some public methods, that do not require authorization by pubkey.

`Signer::External` takes public key and returns `data_to_sign` for later signing. Use `attach_signature` method with the result signature to get the signed message.

`Signer::Keys` creates a signed message with provided key pair.

\[SOON] `Signer::SigningBox` Allows using a special interface to implement signing without private key disclosure to SDK. For instance, in case of using a cold wallet or HSM, when application calls some API to sign data.

There is an optional public key can be provided in deploy set in order to substitute one in TVM file.

Public key resolving priority:

1. Public key from deploy set.
2. Public key, specified in TVM file.
3. Public key, provided by signer.

```ts
type ParamsOfEncodeMessage = {
    abi: Abi,
    address?: string,
    deploy_set?: DeploySet,
    call_set?: CallSet,
    signer: Signer,
    processing_try_index?: number,
    signature_id?: number
}

type ResultOfEncodeMessage = {
    message: string,
    data_to_sign?: string,
    address: string,
    message_id: string
}

function encode_message(
    params: ParamsOfEncodeMessage,
): Promise<ResultOfEncodeMessage>;

function encode_message_sync(
    params: ParamsOfEncodeMessage,
): ResultOfEncodeMessage;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI.
* `address`?: *string* – Target address the message will be sent to.\
  Must be specified in case of non-deploy message.
* `deploy_set`?: [*DeploySet*](#deployset) – Deploy parameters.\
  Must be specified in case of deploy message.
* `call_set`?: [*CallSet*](#callset) – Function call parameters.\
  Must be specified in case of non-deploy message.\
  \
  In case of deploy message it is optional and contains parameters\
  of the functions that will to be called upon deploy transaction.
* `signer`: [*Signer*](#signer) – Signing parameters.
* `processing_try_index`?: *number* – Processing try index.\
  Used in message processing with retries (if contract's ABI includes "expire" header).\
  \
  Encoder uses the provided try index to calculate message\
  expiration time. The 1st message expiration time is specified in\
  Client config.\
  \
  Expiration timeouts will grow with every retry.\
  Retry grow factor is set in Client config:\
  <.....add config parameter with default value here>\
  \
  Default value is 0.
* `signature_id`?: *number* – Signature ID to be used in data to sign preparing when CapSignatureWithId capability is enabled

#### Result

* `message`: *string* – Message BOC encoded with `base64`.
* `data_to_sign`?: *string* – Optional data to be signed encoded in `base64`.\
  Returned in case of `Signer::External`. Can be used for external\
  message signing. Is this case you need to use this data to create signature and\
  then produce signed message using `abi.attach_signature`.
* `address`: *string* – Destination address.
* `message_id`: *string* – Message id.

### encode\_internal\_message

Encodes an internal ABI-compatible message

Allows to encode deploy and function call messages.

Use cases include messages of any possible type:

* deploy with initial function call (i.e. `constructor` or any other function that is used for some kind of initialization);
* deploy without initial function call;
* simple function call

There is an optional public key can be provided in deploy set in order to substitute one in TVM file.

Public key resolving priority:

1. Public key from deploy set.
2. Public key, specified in TVM file.

```ts
type ParamsOfEncodeInternalMessage = {
    abi?: Abi,
    address?: string,
    src_address?: string,
    deploy_set?: DeploySet,
    call_set?: CallSet,
    value: string,
    bounce?: boolean,
    enable_ihr?: boolean
}

type ResultOfEncodeInternalMessage = {
    message: string,
    address: string,
    message_id: string
}

function encode_internal_message(
    params: ParamsOfEncodeInternalMessage,
): Promise<ResultOfEncodeInternalMessage>;

function encode_internal_message_sync(
    params: ParamsOfEncodeInternalMessage,
): ResultOfEncodeInternalMessage;
```

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

#### Parameters

* `abi`?: [*Abi*](#abi) – Contract ABI.\
  Can be None if both deploy\_set and call\_set are None.
* `address`?: *string* – Target address the message will be sent to.\
  Must be specified in case of non-deploy message.
* `src_address`?: *string* – Source address of the message.
* `deploy_set`?: [*DeploySet*](#deployset) – Deploy parameters.\
  Must be specified in case of deploy message.
* `call_set`?: [*CallSet*](#callset) – Function call parameters.\
  Must be specified in case of non-deploy message.\
  \
  In case of deploy message it is optional and contains parameters\
  of the functions that will to be called upon deploy transaction.
* `value`: *string* – Value in nanotokens to be sent with message.
* `bounce`?: *boolean* – Flag of bounceable message.\
  Default is true.
* `enable_ihr`?: *boolean* – Enable Instant Hypercube Routing for the message.\
  Default is false.

#### Result

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

### attach\_signature

Combines `hex`-encoded `signature` with `base64`-encoded `unsigned_message`. Returns signed message encoded in `base64`.

```ts
type ParamsOfAttachSignature = {
    abi: Abi,
    public_key: string,
    message: string,
    signature: string
}

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

function attach_signature(
    params: ParamsOfAttachSignature,
): Promise<ResultOfAttachSignature>;

function attach_signature_sync(
    params: ParamsOfAttachSignature,
): ResultOfAttachSignature;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI
* `public_key`: *string* – Public key encoded in `hex`.
* `message`: *string* – Unsigned message BOC encoded in `base64`.
* `signature`: *string* – Signature encoded in `hex`.

#### Result

* `message`: *string* – Signed message BOC
* `message_id`: *string* – Message ID

### decode\_message

Decodes message body using provided message BOC and ABI.

```ts
type ParamsOfDecodeMessage = {
    abi: Abi,
    message: string,
    allow_partial?: boolean,
    function_name?: string,
    data_layout?: DataLayout
}

type DecodedMessageBody = {
    body_type: MessageBodyType,
    name: string,
    value?: any,
    header?: FunctionHeader
}

function decode_message(
    params: ParamsOfDecodeMessage,
): Promise<DecodedMessageBody>;

function decode_message_sync(
    params: ParamsOfDecodeMessage,
): DecodedMessageBody;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – contract ABI
* `message`: *string* – Message BOC
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
* `function_name`?: *string* – Function name or function id if is known in advance
* `data_layout`?: [*DataLayout*](#datalayout)

#### Result

* `body_type`: [*MessageBodyType*](#messagebodytype) – Type of the message body content.
* `name`: *string* – Function or event name.
* `value`?: *any* – Parameters or result value.
* `header`?: [*FunctionHeader*](#functionheader) – Function header.

### decode\_message\_body

Decodes message body using provided body BOC and ABI.

```ts
type ParamsOfDecodeMessageBody = {
    abi: Abi,
    body: string,
    is_internal: boolean,
    allow_partial?: boolean,
    function_name?: string,
    data_layout?: DataLayout
}

type DecodedMessageBody = {
    body_type: MessageBodyType,
    name: string,
    value?: any,
    header?: FunctionHeader
}

function decode_message_body(
    params: ParamsOfDecodeMessageBody,
): Promise<DecodedMessageBody>;

function decode_message_body_sync(
    params: ParamsOfDecodeMessageBody,
): DecodedMessageBody;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI used to decode.
* `body`: *string* – Message body BOC encoded in `base64`.
* `is_internal`: *boolean* – True if the body belongs to the internal message.
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
* `function_name`?: *string* – Function name or function id if is known in advance
* `data_layout`?: [*DataLayout*](#datalayout)

#### Result

* `body_type`: [*MessageBodyType*](#messagebodytype) – Type of the message body content.
* `name`: *string* – Function or event name.
* `value`?: *any* – Parameters or result value.
* `header`?: [*FunctionHeader*](#functionheader) – Function header.

### encode\_account

Creates account state BOC

```ts
type ParamsOfEncodeAccount = {
    state_init: string,
    balance?: bigint,
    last_trans_lt?: bigint,
    last_paid?: number,
    boc_cache?: BocCacheType
}

type ResultOfEncodeAccount = {
    account: string,
    id: string
}

function encode_account(
    params: ParamsOfEncodeAccount,
): Promise<ResultOfEncodeAccount>;

function encode_account_sync(
    params: ParamsOfEncodeAccount,
): ResultOfEncodeAccount;
```

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

#### Parameters

* `state_init`: *string* – Account state init.
* `balance`?: *bigint* – Initial balance.
* `last_trans_lt`?: *bigint* – Initial value for the `last_trans_lt`.
* `last_paid`?: *number* – Initial value for the `last_paid`.
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result.\
  The BOC itself returned if no cache type provided

#### Result

* `account`: *string* – Account BOC encoded in `base64`.
* `id`: *string* – Account ID encoded in `hex`.

### decode\_account\_data

Decodes account data using provided data BOC and ABI.

Note: this feature requires ABI 2.1 or higher.

```ts
type ParamsOfDecodeAccountData = {
    abi: Abi,
    data: string,
    allow_partial?: boolean
}

type ResultOfDecodeAccountData = {
    data: any
}

function decode_account_data(
    params: ParamsOfDecodeAccountData,
): Promise<ResultOfDecodeAccountData>;

function decode_account_data_sync(
    params: ParamsOfDecodeAccountData,
): ResultOfDecodeAccountData;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI
* `data`: *string* – Data BOC or BOC handle
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)

#### Result

* `data`: *any* – Decoded data as a JSON structure.

### update\_initial\_data

Updates initial account data with initial values for the contract's static variables and owner's public key. This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.

Doesn't support ABI version >= 2.4. Use `encode_initial_data` instead

```ts
type ParamsOfUpdateInitialData = {
    abi: Abi,
    data: string,
    initial_data?: any,
    initial_pubkey?: string,
    boc_cache?: BocCacheType
}

type ResultOfUpdateInitialData = {
    data: string
}

function update_initial_data(
    params: ParamsOfUpdateInitialData,
): Promise<ResultOfUpdateInitialData>;

function update_initial_data_sync(
    params: ParamsOfUpdateInitialData,
): ResultOfUpdateInitialData;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI
* `data`: *string* – Data BOC or BOC handle
* `initial_data`?: *any* – List of initial values for contract's static variables.\
  `abi` parameter should be provided to set initial data
* `initial_pubkey`?: *string* – Initial account owner's public key to set into account data
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `data`: *string* – Updated data BOC or BOC handle

### encode\_initial\_data

Encodes initial account data with initial values for the contract's static variables and owner's public key into a data BOC that can be passed to `encode_tvc` function afterwards.

This function is analogue of `tvm.buildDataInit` function in Solidity.

```ts
type ParamsOfEncodeInitialData = {
    abi: Abi,
    initial_data?: any,
    initial_pubkey?: string,
    boc_cache?: BocCacheType
}

type ResultOfEncodeInitialData = {
    data: string
}

function encode_initial_data(
    params: ParamsOfEncodeInitialData,
): Promise<ResultOfEncodeInitialData>;

function encode_initial_data_sync(
    params: ParamsOfEncodeInitialData,
): ResultOfEncodeInitialData;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI
* `initial_data`?: *any* – List of initial values for contract's static variables.\
  `abi` parameter should be provided to set initial data
* `initial_pubkey`?: *string* – Initial account owner's public key to set into account data
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

#### Result

* `data`: *string* – Updated data BOC or BOC handle

### decode\_initial\_data

Decodes initial values of a contract's static variables and owner's public key from account initial data This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.

Doesn't support ABI version >= 2.4. Use `decode_account_data` instead

```ts
type ParamsOfDecodeInitialData = {
    abi: Abi,
    data: string,
    allow_partial?: boolean
}

type ResultOfDecodeInitialData = {
    initial_data: any,
    initial_pubkey: string
}

function decode_initial_data(
    params: ParamsOfDecodeInitialData,
): Promise<ResultOfDecodeInitialData>;

function decode_initial_data_sync(
    params: ParamsOfDecodeInitialData,
): ResultOfDecodeInitialData;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI.\
  Initial data is decoded if this parameter is provided
* `data`: *string* – Data BOC or BOC handle
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)

#### Result

* `initial_data`: *any* – List of initial values of contract's public variables.\
  Initial data is decoded if `abi` input parameter is provided
* `initial_pubkey`: *string* – Initial account owner's public key

### decode\_boc

Decodes BOC into JSON as a set of provided parameters.

Solidity functions use ABI types for [builder encoding](https://github.com/everx-labs/TVM-Solidity-Compiler/blob/master/API.md#tvmbuilderstore). The simplest way to decode such a BOC is to use ABI decoding. ABI has it own rules for fields layout in cells so manually encoded BOC can not be described in terms of ABI rules.

To solve this problem we introduce a new ABI type `Ref(<ParamType>)` which allows to store `ParamType` ABI parameter in cell reference and, thus, decode manually encoded BOCs. This type is available only in `decode_boc` function and will not be available in ABI messages encoding until it is included into some ABI revision.

Such BOC descriptions covers most users needs. If someone wants to decode some BOC which can not be described by these rules (i.e. BOC with TLB containing constructors of flags defining some parsing conditions) then they can decode the fields up to fork condition, check the parsed data manually, expand the parsing schema and then decode the whole BOC with the full schema.

```ts
type ParamsOfDecodeBoc = {
    params: AbiParam[],
    boc: string,
    allow_partial: boolean
}

type ResultOfDecodeBoc = {
    data: any
}

function decode_boc(
    params: ParamsOfDecodeBoc,
): Promise<ResultOfDecodeBoc>;

function decode_boc_sync(
    params: ParamsOfDecodeBoc,
): ResultOfDecodeBoc;
```

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

#### Parameters

* `params`: [*AbiParam*](#abiparam)*\[]* – Parameters to decode from BOC
* `boc`: *string* – Data BOC or BOC handle
* `allow_partial`: *boolean*

#### Result

* `data`: *any* – Decoded data as a JSON structure.

### encode\_boc

Encodes given parameters in JSON into a BOC using param types from ABI.

```ts
type ParamsOfAbiEncodeBoc = {
    params: AbiParam[],
    data: any,
    boc_cache?: BocCacheType
}

type ResultOfAbiEncodeBoc = {
    boc: string
}

function encode_boc(
    params: ParamsOfAbiEncodeBoc,
): Promise<ResultOfAbiEncodeBoc>;

function encode_boc_sync(
    params: ParamsOfAbiEncodeBoc,
): ResultOfAbiEncodeBoc;
```

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

#### Parameters

* `params`: [*AbiParam*](#abiparam)*\[]* – Parameters to encode into BOC
* `data`: *any* – Parameters and values as a JSON structure
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result.\
  The BOC itself returned if no cache type provided

#### Result

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

### calc\_function\_id

Calculates contract function ID by contract ABI

```ts
type ParamsOfCalcFunctionId = {
    abi: Abi,
    function_name: string,
    output?: boolean
}

type ResultOfCalcFunctionId = {
    function_id: number
}

function calc_function_id(
    params: ParamsOfCalcFunctionId,
): Promise<ResultOfCalcFunctionId>;

function calc_function_id_sync(
    params: ParamsOfCalcFunctionId,
): ResultOfCalcFunctionId;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI.
* `function_name`: *string* – Contract function name
* `output`?: *boolean* – If set to `true` output function ID will be returned which is used in contract response. Default is `false`

#### Result

* `function_id`: *number* – Contract function ID

### get\_signature\_data

Extracts signature from message body and calculates hash to verify the signature

```ts
type ParamsOfGetSignatureData = {
    abi: Abi,
    message: string,
    signature_id?: number
}

type ResultOfGetSignatureData = {
    signature: string,
    unsigned: string
}

function get_signature_data(
    params: ParamsOfGetSignatureData,
): Promise<ResultOfGetSignatureData>;

function get_signature_data_sync(
    params: ParamsOfGetSignatureData,
): ResultOfGetSignatureData;
```

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

#### Parameters

* `abi`: [*Abi*](#abi) – Contract ABI used to decode.
* `message`: *string* – Message BOC encoded in `base64`.
* `signature_id`?: *number* – Signature ID to be used in unsigned data preparing when CapSignatureWithId capability is enabled

#### Result

* `signature`: *string* – Signature from the message in `hex`.
* `unsigned`: *string* – Data to verify the signature in `base64`.

## Types

### AbiErrorCode

```ts
enum AbiErrorCode {
    RequiredAddressMissingForEncodeMessage = 301,
    RequiredCallSetMissingForEncodeMessage = 302,
    InvalidJson = 303,
    InvalidMessage = 304,
    EncodeDeployMessageFailed = 305,
    EncodeRunMessageFailed = 306,
    AttachSignatureFailed = 307,
    InvalidTvcImage = 308,
    RequiredPublicKeyMissingForFunctionHeader = 309,
    InvalidSigner = 310,
    InvalidAbi = 311,
    InvalidFunctionId = 312,
    InvalidData = 313,
    EncodeInitialDataFailed = 314,
    InvalidFunctionName = 315,
    PubKeyNotSupported = 316
}
```

One of the following value:

* `RequiredAddressMissingForEncodeMessage = 301`
* `RequiredCallSetMissingForEncodeMessage = 302`
* `InvalidJson = 303`
* `InvalidMessage = 304`
* `EncodeDeployMessageFailed = 305`
* `EncodeRunMessageFailed = 306`
* `AttachSignatureFailed = 307`
* `InvalidTvcImage = 308`
* `RequiredPublicKeyMissingForFunctionHeader = 309`
* `InvalidSigner = 310`
* `InvalidAbi = 311`
* `InvalidFunctionId = 312`
* `InvalidData = 313`
* `EncodeInitialDataFailed = 314`
* `InvalidFunctionName = 315`
* `PubKeyNotSupported = 316`

### AbiContractVariant

```ts
type AbiContractVariant = {
    value: AbiContract
}
```

* `value`: [*AbiContract*](#abicontract)

### AbiJsonVariant

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

* `value`: *string*

### AbiHandleVariant

```ts
type AbiHandleVariant = {
    value: AbiHandle
}
```

* `value`: [*AbiHandle*](#abihandle)

### AbiSerializedVariant

```ts
type AbiSerializedVariant = {
    value: AbiContract
}
```

* `value`: [*AbiContract*](#abicontract)

### Abi

```ts
type Abi = ({
    type: 'Contract'
} & AbiContractVariant) | ({
    type: 'Json'
} & AbiJsonVariant) | ({
    type: 'Handle'
} & AbiHandleVariant) | ({
    type: 'Serialized'
} & AbiSerializedVariant)
```

Depends on value of the `type` field.

When *type* is *'Contract'*

* `value`: [*AbiContract*](#abicontract)

When *type* is *'Json'*

* `value`: *string*

When *type* is *'Handle'*

* `value`: [*AbiHandle*](#abihandle)

When *type* is *'Serialized'*

* `value`: [*AbiContract*](#abicontract)

Variant constructors:

```ts
function abiContract(value: AbiContract): Abi;
function abiJson(value: string): Abi;
function abiHandle(value: AbiHandle): Abi;
function abiSerialized(value: AbiContract): Abi;
```

### AbiHandle

```ts
type AbiHandle = number
```

### FunctionHeader

The ABI function header.

Includes several hidden function parameters that contract uses for security, message delivery monitoring and replay protection reasons.

The actual set of header fields depends on the contract's ABI. If a contract's ABI does not include some headers, then they are not filled.

```ts
type FunctionHeader = {
    expire?: number,
    time?: bigint,
    pubkey?: string
}
```

* `expire`?: *number* – Message expiration timestamp (UNIX time) in seconds.\
  If not specified - calculated automatically from message\_expiration\_timeout(),\
  try\_index and message\_expiration\_timeout\_grow\_factor() (if ABI includes `expire` header).
* `time`?: *bigint* – Message creation time in milliseconds.\
  If not specified, `now` is used (if ABI includes `time` header).
* `pubkey`?: *string* – Public key is used by the contract to check the signature.\
  Encoded in `hex`. If not specified, method fails with exception (if ABI includes `pubkey` header).

### CallSet

```ts
type CallSet = {
    function_name: string,
    header?: FunctionHeader,
    input?: any
}
```

* `function_name`: *string* – Function name that is being called. Or function id encoded as string in hex (starting with 0x).
* `header`?: [*FunctionHeader*](#functionheader) – Function header.\
  If an application omits some header parameters required by the\
  contract's ABI, the library will set the default values for\
  them.
* `input`?: *any* – Function input parameters according to ABI.

### DeploySet

```ts
type DeploySet = {
    tvc?: string,
    code?: string,
    state_init?: string,
    workchain_id?: number,
    initial_data?: any,
    initial_pubkey?: string
}
```

* `tvc`?: *string* – Content of TVC file encoded in `base64`. For compatibility reason this field can contain an encoded `StateInit`.
* `code`?: *string* – Contract code BOC encoded with base64.
* `state_init`?: *string* – State init BOC encoded with base64.
* `workchain_id`?: *number* – Target workchain for destination address.\
  Default is `0`.
* `initial_data`?: *any* – List of initial values for contract's public variables.
* `initial_pubkey`?: *string* – Optional public key that can be provided in deploy set in order to substitute one in TVM file or provided by Signer.\
  Public key resolving priority:\
  1\. Public key from deploy set.\
  2\. Public key, specified in TVM file.\
  3\. Public key, provided by Signer.\
  \
  Applicable only for contracts with ABI version < 2.4. Contract initial public key should be\
  explicitly provided inside `initial_data` since ABI 2.4

### SignerNoneVariant

No keys are provided.

Creates an unsigned message.

```ts
type SignerNoneVariant = {

}
```

### SignerExternalVariant

Only public key is provided in unprefixed hex string format to generate unsigned message and `data_to_sign` which can be signed later.

```ts
type SignerExternalVariant = {
    public_key: string
}
```

* `public_key`: *string*

### SignerKeysVariant

Key pair is provided for signing

```ts
type SignerKeysVariant = {
    keys: KeyPair
}
```

* `keys`: [*KeyPair*](https://docs.everos.dev/ever-sdk/reference/mod_crypto#keypair)

### SignerSigningBoxVariant

Signing Box interface is provided for signing, allows Dapps to sign messages using external APIs, such as HSM, cold wallet, etc.

```ts
type SignerSigningBoxVariant = {
    handle: SigningBoxHandle
}
```

* `handle`: [*SigningBoxHandle*](https://docs.everos.dev/ever-sdk/reference/mod_crypto#signingboxhandle)

### Signer

```ts
type Signer = ({
    type: 'None'
} & SignerNoneVariant) | ({
    type: 'External'
} & SignerExternalVariant) | ({
    type: 'Keys'
} & SignerKeysVariant) | ({
    type: 'SigningBox'
} & SignerSigningBoxVariant)
```

Depends on value of the `type` field.

When *type* is *'None'*

No keys are provided.

Creates an unsigned message.

When *type* is *'External'*

Only public key is provided in unprefixed hex string format to generate unsigned message and `data_to_sign` which can be signed later.

* `public_key`: *string*

When *type* is *'Keys'*

Key pair is provided for signing

* `keys`: [*KeyPair*](https://docs.everos.dev/ever-sdk/reference/mod_crypto#keypair)

When *type* is *'SigningBox'*

Signing Box interface is provided for signing, allows Dapps to sign messages using external APIs, such as HSM, cold wallet, etc.

* `handle`: [*SigningBoxHandle*](https://docs.everos.dev/ever-sdk/reference/mod_crypto#signingboxhandle)

Variant constructors:

```ts
function signerNone(): Signer;
function signerExternal(public_key: string): Signer;
function signerKeys(keys: KeyPair): Signer;
function signerSigningBox(handle: SigningBoxHandle): Signer;
```

### MessageBodyType

```ts
enum MessageBodyType {
    Input = "Input",
    Output = "Output",
    InternalOutput = "InternalOutput",
    Event = "Event"
}
```

One of the following value:

* `Input = "Input"` – Message contains the input of the ABI function.
* `Output = "Output"` – Message contains the output of the ABI function.
* `InternalOutput = "InternalOutput"` – Message contains the input of the imported ABI function.\
  Occurs when contract sends an internal message to other\
  contract.
* `Event = "Event"` – Message contains the input of the ABI event.

### AbiParam

```ts
type AbiParam = {
    name: string,
    type: string,
    components?: AbiParam[],
    init?: boolean
}
```

* `name`: *string*
* `type`: *string*
* `components`?: [*AbiParam*](#abiparam)*\[]*
* `init`?: *boolean*

### AbiEvent

```ts
type AbiEvent = {
    name: string,
    inputs: AbiParam[],
    id?: string | null
}
```

* `name`: *string*
* `inputs`: [*AbiParam*](#abiparam)*\[]*
* `id`?: *string?*

### AbiData

```ts
type AbiData = {
    key: number,
    name: string,
    type: string,
    components?: AbiParam[]
}
```

* `key`: *number*
* `name`: *string*
* `type`: *string*
* `components`?: [*AbiParam*](#abiparam)*\[]*

### AbiFunction

```ts
type AbiFunction = {
    name: string,
    inputs: AbiParam[],
    outputs: AbiParam[],
    id?: string | null
}
```

* `name`: *string*
* `inputs`: [*AbiParam*](#abiparam)*\[]*
* `outputs`: [*AbiParam*](#abiparam)*\[]*
* `id`?: *string?*

### AbiContract

```ts
type AbiContract = {
    'ABI version'?: number,
    abi_version?: number,
    version?: string | null,
    header?: string[],
    functions?: AbiFunction[],
    events?: AbiEvent[],
    data?: AbiData[],
    fields?: AbiParam[]
}
```

* `ABI version`?: *number*
* `abi_version`?: *number*
* `version`?: *string?*
* `header`?: *string\[]*
* `functions`?: [*AbiFunction*](#abifunction)*\[]*
* `events`?: [*AbiEvent*](#abievent)*\[]*
* `data`?: [*AbiData*](#abidata)*\[]*
* `fields`?: [*AbiParam*](#abiparam)*\[]*

### DataLayout

```ts
enum DataLayout {
    Input = "Input",
    Output = "Output"
}
```

One of the following value:

* `Input = "Input"` – Decode message body as function input parameters.
* `Output = "Output"` – Decode message body as function output.

### ParamsOfEncodeMessageBody

```ts
type ParamsOfEncodeMessageBody = {
    abi: Abi,
    call_set: CallSet,
    is_internal: boolean,
    signer: Signer,
    processing_try_index?: number,
    address?: string,
    signature_id?: number
}
```

* `abi`: [*Abi*](#abi) – Contract ABI.
* `call_set`: [*CallSet*](#callset) – Function call parameters.\
  Must be specified in non deploy message.\
  \
  In case of deploy message contains parameters of constructor.
* `is_internal`: *boolean* – True if internal message body must be encoded.
* `signer`: [*Signer*](#signer) – Signing parameters.
* `processing_try_index`?: *number* – Processing try index.\
  Used in message processing with retries.\
  \
  Encoder uses the provided try index to calculate message\
  expiration time.\
  \
  Expiration timeouts will grow with every retry.\
  \
  Default value is 0.
* `address`?: *string* – Destination address of the message\
  Since ABI version 2.3 destination address of external inbound message is used in message\
  body signature calculation. Should be provided when signed external inbound message body is\
  created. Otherwise can be omitted.
* `signature_id`?: *number* – Signature ID to be used in data to sign preparing when CapSignatureWithId capability is enabled

### ResultOfEncodeMessageBody

```ts
type ResultOfEncodeMessageBody = {
    body: string,
    data_to_sign?: string
}
```

* `body`: *string* – Message body BOC encoded with `base64`.
* `data_to_sign`?: *string* – Optional data to sign.\
  Encoded with `base64`.\
  Presents when `message` is unsigned. Can be used for external\
  message signing. Is this case you need to sing this data and\
  produce signed message using `abi.attach_signature`.

### ParamsOfAttachSignatureToMessageBody

```ts
type ParamsOfAttachSignatureToMessageBody = {
    abi: Abi,
    public_key: string,
    message: string,
    signature: string
}
```

* `abi`: [*Abi*](#abi) – Contract ABI
* `public_key`: *string* – Public key.\
  Must be encoded with `hex`.
* `message`: *string* – Unsigned message body BOC.\
  Must be encoded with `base64`.
* `signature`: *string* – Signature.\
  Must be encoded with `hex`.

### ResultOfAttachSignatureToMessageBody

```ts
type ResultOfAttachSignatureToMessageBody = {
    body: string
}
```

* `body`: *string*

### ParamsOfEncodeMessage

```ts
type ParamsOfEncodeMessage = {
    abi: Abi,
    address?: string,
    deploy_set?: DeploySet,
    call_set?: CallSet,
    signer: Signer,
    processing_try_index?: number,
    signature_id?: number
}
```

* `abi`: [*Abi*](#abi) – Contract ABI.
* `address`?: *string* – Target address the message will be sent to.\
  Must be specified in case of non-deploy message.
* `deploy_set`?: [*DeploySet*](#deployset) – Deploy parameters.\
  Must be specified in case of deploy message.
* `call_set`?: [*CallSet*](#callset) – Function call parameters.\
  Must be specified in case of non-deploy message.\
  \
  In case of deploy message it is optional and contains parameters\
  of the functions that will to be called upon deploy transaction.
* `signer`: [*Signer*](#signer) – Signing parameters.
* `processing_try_index`?: *number* – Processing try index.\
  Used in message processing with retries (if contract's ABI includes "expire" header).\
  \
  Encoder uses the provided try index to calculate message\
  expiration time. The 1st message expiration time is specified in\
  Client config.\
  \
  Expiration timeouts will grow with every retry.\
  Retry grow factor is set in Client config:\
  <.....add config parameter with default value here>\
  \
  Default value is 0.
* `signature_id`?: *number* – Signature ID to be used in data to sign preparing when CapSignatureWithId capability is enabled

### ResultOfEncodeMessage

```ts
type ResultOfEncodeMessage = {
    message: string,
    data_to_sign?: string,
    address: string,
    message_id: string
}
```

* `message`: *string* – Message BOC encoded with `base64`.
* `data_to_sign`?: *string* – Optional data to be signed encoded in `base64`.\
  Returned in case of `Signer::External`. Can be used for external\
  message signing. Is this case you need to use this data to create signature and\
  then produce signed message using `abi.attach_signature`.
* `address`: *string* – Destination address.
* `message_id`: *string* – Message id.

### ParamsOfEncodeInternalMessage

```ts
type ParamsOfEncodeInternalMessage = {
    abi?: Abi,
    address?: string,
    src_address?: string,
    deploy_set?: DeploySet,
    call_set?: CallSet,
    value: string,
    bounce?: boolean,
    enable_ihr?: boolean
}
```

* `abi`?: [*Abi*](#abi) – Contract ABI.\
  Can be None if both deploy\_set and call\_set are None.
* `address`?: *string* – Target address the message will be sent to.\
  Must be specified in case of non-deploy message.
* `src_address`?: *string* – Source address of the message.
* `deploy_set`?: [*DeploySet*](#deployset) – Deploy parameters.\
  Must be specified in case of deploy message.
* `call_set`?: [*CallSet*](#callset) – Function call parameters.\
  Must be specified in case of non-deploy message.\
  \
  In case of deploy message it is optional and contains parameters\
  of the functions that will to be called upon deploy transaction.
* `value`: *string* – Value in nanotokens to be sent with message.
* `bounce`?: *boolean* – Flag of bounceable message.\
  Default is true.
* `enable_ihr`?: *boolean* – Enable Instant Hypercube Routing for the message.\
  Default is false.

### ResultOfEncodeInternalMessage

```ts
type ResultOfEncodeInternalMessage = {
    message: string,
    address: string,
    message_id: string
}
```

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

### ParamsOfAttachSignature

```ts
type ParamsOfAttachSignature = {
    abi: Abi,
    public_key: string,
    message: string,
    signature: string
}
```

* `abi`: [*Abi*](#abi) – Contract ABI
* `public_key`: *string* – Public key encoded in `hex`.
* `message`: *string* – Unsigned message BOC encoded in `base64`.
* `signature`: *string* – Signature encoded in `hex`.

### ResultOfAttachSignature

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

* `message`: *string* – Signed message BOC
* `message_id`: *string* – Message ID

### ParamsOfDecodeMessage

```ts
type ParamsOfDecodeMessage = {
    abi: Abi,
    message: string,
    allow_partial?: boolean,
    function_name?: string,
    data_layout?: DataLayout
}
```

* `abi`: [*Abi*](#abi) – contract ABI
* `message`: *string* – Message BOC
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
* `function_name`?: *string* – Function name or function id if is known in advance
* `data_layout`?: [*DataLayout*](#datalayout)

### DecodedMessageBody

```ts
type DecodedMessageBody = {
    body_type: MessageBodyType,
    name: string,
    value?: any,
    header?: FunctionHeader
}
```

* `body_type`: [*MessageBodyType*](#messagebodytype) – Type of the message body content.
* `name`: *string* – Function or event name.
* `value`?: *any* – Parameters or result value.
* `header`?: [*FunctionHeader*](#functionheader) – Function header.

### ParamsOfDecodeMessageBody

```ts
type ParamsOfDecodeMessageBody = {
    abi: Abi,
    body: string,
    is_internal: boolean,
    allow_partial?: boolean,
    function_name?: string,
    data_layout?: DataLayout
}
```

* `abi`: [*Abi*](#abi) – Contract ABI used to decode.
* `body`: *string* – Message body BOC encoded in `base64`.
* `is_internal`: *boolean* – True if the body belongs to the internal message.
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
* `function_name`?: *string* – Function name or function id if is known in advance
* `data_layout`?: [*DataLayout*](#datalayout)

### ParamsOfEncodeAccount

```ts
type ParamsOfEncodeAccount = {
    state_init: string,
    balance?: bigint,
    last_trans_lt?: bigint,
    last_paid?: number,
    boc_cache?: BocCacheType
}
```

* `state_init`: *string* – Account state init.
* `balance`?: *bigint* – Initial balance.
* `last_trans_lt`?: *bigint* – Initial value for the `last_trans_lt`.
* `last_paid`?: *number* – Initial value for the `last_paid`.
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result.\
  The BOC itself returned if no cache type provided

### ResultOfEncodeAccount

```ts
type ResultOfEncodeAccount = {
    account: string,
    id: string
}
```

* `account`: *string* – Account BOC encoded in `base64`.
* `id`: *string* – Account ID encoded in `hex`.

### ParamsOfDecodeAccountData

```ts
type ParamsOfDecodeAccountData = {
    abi: Abi,
    data: string,
    allow_partial?: boolean
}
```

* `abi`: [*Abi*](#abi) – Contract ABI
* `data`: *string* – Data BOC or BOC handle
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)

### ResultOfDecodeAccountData

```ts
type ResultOfDecodeAccountData = {
    data: any
}
```

* `data`: *any* – Decoded data as a JSON structure.

### ParamsOfUpdateInitialData

```ts
type ParamsOfUpdateInitialData = {
    abi: Abi,
    data: string,
    initial_data?: any,
    initial_pubkey?: string,
    boc_cache?: BocCacheType
}
```

* `abi`: [*Abi*](#abi) – Contract ABI
* `data`: *string* – Data BOC or BOC handle
* `initial_data`?: *any* – List of initial values for contract's static variables.\
  `abi` parameter should be provided to set initial data
* `initial_pubkey`?: *string* – Initial account owner's public key to set into account data
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfUpdateInitialData

```ts
type ResultOfUpdateInitialData = {
    data: string
}
```

* `data`: *string* – Updated data BOC or BOC handle

### ParamsOfEncodeInitialData

```ts
type ParamsOfEncodeInitialData = {
    abi: Abi,
    initial_data?: any,
    initial_pubkey?: string,
    boc_cache?: BocCacheType
}
```

* `abi`: [*Abi*](#abi) – Contract ABI
* `initial_data`?: *any* – List of initial values for contract's static variables.\
  `abi` parameter should be provided to set initial data
* `initial_pubkey`?: *string* – Initial account owner's public key to set into account data
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result. The BOC itself returned if no cache type provided.

### ResultOfEncodeInitialData

```ts
type ResultOfEncodeInitialData = {
    data: string
}
```

* `data`: *string* – Updated data BOC or BOC handle

### ParamsOfDecodeInitialData

```ts
type ParamsOfDecodeInitialData = {
    abi: Abi,
    data: string,
    allow_partial?: boolean
}
```

* `abi`: [*Abi*](#abi) – Contract ABI.\
  Initial data is decoded if this parameter is provided
* `data`: *string* – Data BOC or BOC handle
* `allow_partial`?: *boolean* – Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)

### ResultOfDecodeInitialData

```ts
type ResultOfDecodeInitialData = {
    initial_data: any,
    initial_pubkey: string
}
```

* `initial_data`: *any* – List of initial values of contract's public variables.\
  Initial data is decoded if `abi` input parameter is provided
* `initial_pubkey`: *string* – Initial account owner's public key

### ParamsOfDecodeBoc

```ts
type ParamsOfDecodeBoc = {
    params: AbiParam[],
    boc: string,
    allow_partial: boolean
}
```

* `params`: [*AbiParam*](#abiparam)*\[]* – Parameters to decode from BOC
* `boc`: *string* – Data BOC or BOC handle
* `allow_partial`: *boolean*

### ResultOfDecodeBoc

```ts
type ResultOfDecodeBoc = {
    data: any
}
```

* `data`: *any* – Decoded data as a JSON structure.

### ParamsOfAbiEncodeBoc

```ts
type ParamsOfAbiEncodeBoc = {
    params: AbiParam[],
    data: any,
    boc_cache?: BocCacheType
}
```

* `params`: [*AbiParam*](#abiparam)*\[]* – Parameters to encode into BOC
* `data`: *any* – Parameters and values as a JSON structure
* `boc_cache`?: [*BocCacheType*](https://docs.everos.dev/ever-sdk/reference/mod_boc#boccachetype) – Cache type to put the result.\
  The BOC itself returned if no cache type provided

### ResultOfAbiEncodeBoc

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

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

### ParamsOfCalcFunctionId

```ts
type ParamsOfCalcFunctionId = {
    abi: Abi,
    function_name: string,
    output?: boolean
}
```

* `abi`: [*Abi*](#abi) – Contract ABI.
* `function_name`: *string* – Contract function name
* `output`?: *boolean* – If set to `true` output function ID will be returned which is used in contract response. Default is `false`

### ResultOfCalcFunctionId

```ts
type ResultOfCalcFunctionId = {
    function_id: number
}
```

* `function_id`: *number* – Contract function ID

### ParamsOfGetSignatureData

```ts
type ParamsOfGetSignatureData = {
    abi: Abi,
    message: string,
    signature_id?: number
}
```

* `abi`: [*Abi*](#abi) – Contract ABI used to decode.
* `message`: *string* – Message BOC encoded in `base64`.
* `signature_id`?: *number* – Signature ID to be used in unsigned data preparing when CapSignatureWithId capability is enabled

### ResultOfGetSignatureData

```ts
type ResultOfGetSignatureData = {
    signature: string,
    unsigned: string
}
```

* `signature`: *string* – Signature from the message in `hex`.
* `unsigned`: *string* – Data to verify the signature in `base64`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.everos.dev/ever-sdk/reference/types-and-methods/mod_abi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
