EVER SDK
Developer ToolsEver PlatformForum
  • Ever SDK
  • Quick start (JavaScript)
  • Add EVER to your backend
  • Reference
    • Types and Methods
      • Modules
      • Module abi
      • Module boc
      • Module client
      • Module crypto
      • Module debot
      • Module net
      • Module processing
      • Module proofs
      • Module tvm
      • Module utils
    • Error API
    • Error Codes
    • JavaScript Reference
    • Rust Reference
  • Samples
    • JavaScript Samples
  • guides
    • Installation
      • Add SDK to your App
    • Configuration
      • Endpoint Configuration
      • Message Expiration
      • Message Retry
      • Config Reference
    • Work with contracts
      • Add Contract to your App
      • Use your own Giver
      • Deploy
      • Run on-chain
      • Run ABI Get Method
      • Run Fift Get Method
      • Query/Subscribe for messages(events)
      • Decode Messages(Event)
      • External Signing
      • Emulate Transaction
      • Estimate Fees
      • Validate address, convert address
      • Monitor Messages
      • Trace message processing with REMP
    • Crypto
      • Mnemonics and Keys
    • Queries and subscriptions
      • Use-cases
      • How to work with net module
      • net.query syntax
      • Data pagination
      • Subscribe to Updates
      • Query Collection
      • Aggregate Collection
  • For Binding Developers
    • How to work with Application Objects in binding generators
    • JSON Interface to Ton Client
  • Links
    • Ever SDK repository
    • AppKit JS documentation
Powered by GitBook
On this page
  • Module utils
  • Functions
  • Types
  • Functions
  • convert_address
  • get_address_type
  • calc_storage_fee
  • compress_zstd
  • decompress_zstd
  • Types
  • AddressStringFormatAccountIdVariant
  • AddressStringFormatHexVariant
  • AddressStringFormatBase64Variant
  • AddressStringFormat
  • AccountAddressType
  • ParamsOfConvertAddress
  • ResultOfConvertAddress
  • ParamsOfGetAddressType
  • ResultOfGetAddressType
  • ParamsOfCalcStorageFee
  • ResultOfCalcStorageFee
  • ParamsOfCompressZstd
  • ResultOfCompressZstd
  • ParamsOfDecompressZstd
  • ResultOfDecompressZstd

Was this helpful?

  1. Reference
  2. Types and Methods

Module utils

PreviousModule tvmNextError API

Last updated 1 year ago

Was this helpful?

Module utils

Misc utility Functions.

Functions

– Converts address from any TON format to any TON format

– Validates and returns the type of any TON address.

– Calculates storage fee for an account over a specified time period

– Compresses data using Zstandard algorithm

– Decompresses data using Zstandard algorithm

Types

Functions

convert_address

Converts address from any TON format to any TON format

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.

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

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

calc_storage_fee

Calculates storage fee for an account over a specified time period

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

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

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

type AddressStringFormatAccountIdVariant = {

}

AddressStringFormatHexVariant

type AddressStringFormatHexVariant = {

}

AddressStringFormatBase64Variant

type AddressStringFormatBase64Variant = {
    url: boolean,
    test: boolean,
    bounce: boolean
}
  • url: boolean

  • test: boolean

  • bounce: boolean

AddressStringFormat

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:

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

AccountAddressType

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

One of the following value:

  • AccountId = "AccountId"

  • Hex = "Hex"

  • Base64 = "Base64"

ParamsOfConvertAddress

type ParamsOfConvertAddress = {
    address: string,
    output_format: AddressStringFormat
}
  • address: string – Account address in any TON format.

ResultOfConvertAddress

type ResultOfConvertAddress = {
    address: string
}
  • address: string – Address in the specified format

ParamsOfGetAddressType

type ParamsOfGetAddressType = {
    address: string
}
  • address: string – Account address in any TON format.

ResultOfGetAddressType

type ResultOfGetAddressType = {
    address_type: AccountAddressType
}

ParamsOfCalcStorageFee

type ParamsOfCalcStorageFee = {
    account: string,
    period: number
}
  • account: string

  • period: number

ResultOfCalcStorageFee

type ResultOfCalcStorageFee = {
    fee: string
}
  • fee: string

ParamsOfCompressZstd

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

type ResultOfCompressZstd = {
    compressed: string
}
  • compressed: string – Compressed data. Must be encoded as base64.

ParamsOfDecompressZstd

type ParamsOfDecompressZstd = {
    compressed: string
}
  • compressed: string – Compressed data. Must be encoded as base64.

ResultOfDecompressZstd

type ResultOfDecompressZstd = {
    decompressed: string
}
  • decompressed: string – Decompressed data. Must be encoded as base64.

output_format: – Specify the format to convert to.

address_type: – Account address type.

output_format: – Specify the format to convert to.

address_type: – Account address type.

convert_address
get_address_type
calc_storage_fee
compress_zstd
decompress_zstd
AddressStringFormatAccountIdVariant
AddressStringFormatHexVariant
AddressStringFormatBase64Variant
AddressStringFormat
AccountAddressType
ParamsOfConvertAddress
ResultOfConvertAddress
ParamsOfGetAddressType
ResultOfGetAddressType
ParamsOfCalcStorageFee
ResultOfCalcStorageFee
ParamsOfCompressZstd
ResultOfCompressZstd
ParamsOfDecompressZstd
ResultOfDecompressZstd
AddressStringFormat
AccountAddressType
AddressStringFormat
AccountAddressType