# Module utils

## Module utils

Misc utility Functions.

### Functions

[convert\_address](#convert_address) – Converts address from any TON format to any TON format

[get\_address\_type](#get_address_type) – Validates and returns the type of any TON address.

[calc\_storage\_fee](#calc_storage_fee) – Calculates storage fee for an account over a specified time period

[compress\_zstd](#compress_zstd) – Compresses data using Zstandard algorithm

[decompress\_zstd](#decompress_zstd) – Decompresses data using Zstandard algorithm

### Types

[AddressStringFormatAccountIdVariant](#addressstringformataccountidvariant)

[AddressStringFormatHexVariant](#addressstringformathexvariant)

[AddressStringFormatBase64Variant](#addressstringformatbase64variant)

[AddressStringFormat](#addressstringformat)

[AccountAddressType](#accountaddresstype)

[ParamsOfConvertAddress](#paramsofconvertaddress)

[ResultOfConvertAddress](#resultofconvertaddress)

[ParamsOfGetAddressType](#paramsofgetaddresstype)

[ResultOfGetAddressType](#resultofgetaddresstype)

[ParamsOfCalcStorageFee](#paramsofcalcstoragefee)

[ResultOfCalcStorageFee](#resultofcalcstoragefee)

[ParamsOfCompressZstd](#paramsofcompresszstd)

[ResultOfCompressZstd](#resultofcompresszstd)

[ParamsOfDecompressZstd](#paramsofdecompresszstd)

[ResultOfDecompressZstd](#resultofdecompresszstd)

## Functions

### convert\_address

Converts address from any TON format to any TON format

```ts
type ParamsOfConvertAddress = {
    address: string,
    output_format: AddressStringFormat
}

type ResultOfConvertAddress = {
    address: string
}

function convert_address(
    params: ParamsOfConvertAddress,
): Promise<ResultOfConvertAddress>;

function convert_address_sync(
    params: ParamsOfConvertAddress,
): ResultOfConvertAddress;
```

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

#### Parameters

* `address`: *string* – Account address in any TON format.
* `output_format`: [*AddressStringFormat*](#addressstringformat) – Specify the format to convert to.

#### Result

* `address`: *string* – Address in the specified format

### get\_address\_type

Validates and returns the type of any TON address.

Address types are the following

`0:919db8e740d50bf349df2eea03fa30c385d846b991ff5542e67098ee833fc7f7` - standard TON address most commonly used in all cases. Also called as hex address `919db8e740d50bf349df2eea03fa30c385d846b991ff5542e67098ee833fc7f7` - account ID. A part of full address. Identifies account inside particular workchain `EQCRnbjnQNUL80nfLuoD+jDDhdhGuZH/VULmcJjugz/H9wam` - base64 address. Also called "user-friendly". Was used at the beginning of TON. Now it is supported for compatibility

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

type ResultOfGetAddressType = {
    address_type: AccountAddressType
}

function get_address_type(
    params: ParamsOfGetAddressType,
): Promise<ResultOfGetAddressType>;

function get_address_type_sync(
    params: ParamsOfGetAddressType,
): ResultOfGetAddressType;
```

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

#### Parameters

* `address`: *string* – Account address in any TON format.

#### Result

* `address_type`: [*AccountAddressType*](#accountaddresstype) – Account address type.

### calc\_storage\_fee

Calculates storage fee for an account over a specified time period

```ts
type ParamsOfCalcStorageFee = {
    account: string,
    period: number
}

type ResultOfCalcStorageFee = {
    fee: string
}

function calc_storage_fee(
    params: ParamsOfCalcStorageFee,
): Promise<ResultOfCalcStorageFee>;

function calc_storage_fee_sync(
    params: ParamsOfCalcStorageFee,
): ResultOfCalcStorageFee;
```

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

#### Parameters

* `account`: *string*
* `period`: *number*

#### Result

* `fee`: *string*

### compress\_zstd

Compresses data using Zstandard algorithm

```ts
type ParamsOfCompressZstd = {
    uncompressed: string,
    level?: number
}

type ResultOfCompressZstd = {
    compressed: string
}

function compress_zstd(
    params: ParamsOfCompressZstd,
): Promise<ResultOfCompressZstd>;

function compress_zstd_sync(
    params: ParamsOfCompressZstd,
): ResultOfCompressZstd;
```

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

#### Parameters

* `uncompressed`: *string* – Uncompressed data.\
  Must be encoded as base64.
* `level`?: *number* – Compression level, from 1 to 21. Where: 1 - lowest compression level (fastest compression); 21 - highest compression level (slowest compression). If level is omitted, the default compression level is used (currently `3`).

#### Result

* `compressed`: *string* – Compressed data.\
  Must be encoded as base64.

### decompress\_zstd

Decompresses data using Zstandard algorithm

```ts
type ParamsOfDecompressZstd = {
    compressed: string
}

type ResultOfDecompressZstd = {
    decompressed: string
}

function decompress_zstd(
    params: ParamsOfDecompressZstd,
): Promise<ResultOfDecompressZstd>;

function decompress_zstd_sync(
    params: ParamsOfDecompressZstd,
): ResultOfDecompressZstd;
```

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

#### Parameters

* `compressed`: *string* – Compressed data.\
  Must be encoded as base64.

#### Result

* `decompressed`: *string* – Decompressed data.\
  Must be encoded as base64.

## Types

### AddressStringFormatAccountIdVariant

```ts
type AddressStringFormatAccountIdVariant = {

}
```

### AddressStringFormatHexVariant

```ts
type AddressStringFormatHexVariant = {

}
```

### AddressStringFormatBase64Variant

```ts
type AddressStringFormatBase64Variant = {
    url: boolean,
    test: boolean,
    bounce: boolean
}
```

* `url`: *boolean*
* `test`: *boolean*
* `bounce`: *boolean*

### AddressStringFormat

```ts
type AddressStringFormat = ({
    type: 'AccountId'
} & AddressStringFormatAccountIdVariant) | ({
    type: 'Hex'
} & AddressStringFormatHexVariant) | ({
    type: 'Base64'
} & AddressStringFormatBase64Variant)
```

Depends on value of the `type` field.

When *type* is *'AccountId'*

When *type* is *'Hex'*

When *type* is *'Base64'*

* `url`: *boolean*
* `test`: *boolean*
* `bounce`: *boolean*

Variant constructors:

```ts
function addressStringFormatAccountId(): AddressStringFormat;
function addressStringFormatHex(): AddressStringFormat;
function addressStringFormatBase64(url: boolean, test: boolean, bounce: boolean): AddressStringFormat;
```

### AccountAddressType

```ts
enum AccountAddressType {
    AccountId = "AccountId",
    Hex = "Hex",
    Base64 = "Base64"
}
```

One of the following value:

* `AccountId = "AccountId"`
* `Hex = "Hex"`
* `Base64 = "Base64"`

### ParamsOfConvertAddress

```ts
type ParamsOfConvertAddress = {
    address: string,
    output_format: AddressStringFormat
}
```

* `address`: *string* – Account address in any TON format.
* `output_format`: [*AddressStringFormat*](#addressstringformat) – Specify the format to convert to.

### ResultOfConvertAddress

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

* `address`: *string* – Address in the specified format

### ParamsOfGetAddressType

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

* `address`: *string* – Account address in any TON format.

### ResultOfGetAddressType

```ts
type ResultOfGetAddressType = {
    address_type: AccountAddressType
}
```

* `address_type`: [*AccountAddressType*](#accountaddresstype) – Account address type.

### ParamsOfCalcStorageFee

```ts
type ParamsOfCalcStorageFee = {
    account: string,
    period: number
}
```

* `account`: *string*
* `period`: *number*

### ResultOfCalcStorageFee

```ts
type ResultOfCalcStorageFee = {
    fee: string
}
```

* `fee`: *string*

### ParamsOfCompressZstd

```ts
type ParamsOfCompressZstd = {
    uncompressed: string,
    level?: number
}
```

* `uncompressed`: *string* – Uncompressed data.\
  Must be encoded as base64.
* `level`?: *number* – Compression level, from 1 to 21. Where: 1 - lowest compression level (fastest compression); 21 - highest compression level (slowest compression). If level is omitted, the default compression level is used (currently `3`).

### ResultOfCompressZstd

```ts
type ResultOfCompressZstd = {
    compressed: string
}
```

* `compressed`: *string* – Compressed data.\
  Must be encoded as base64.

### ParamsOfDecompressZstd

```ts
type ParamsOfDecompressZstd = {
    compressed: string
}
```

* `compressed`: *string* – Compressed data.\
  Must be encoded as base64.

### ResultOfDecompressZstd

```ts
type ResultOfDecompressZstd = {
    decompressed: string
}
```

* `decompressed`: *string* – Decompressed data.\
  Must be encoded as 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_utils.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.
