Module client
Module client
Provides information about library.
Functions
get_api_reference – Returns Core Library API reference
version – Returns Core Library version
config – Returns Core Library API reference
build_info – Returns detailed information about this build.
resolve_app_request – Resolves application request processing result
Types
NetworkQueriesProtocol – Network protocol used to perform GraphQL queries.
CryptoConfig – Crypto config.
AppRequestResultErrorVariant – Error occurred during request processing
AppRequestResultOkVariant – Request processed successfully
Functions
get_api_reference
Returns Core Library API reference
NOTE: Sync version is available only for lib-node
binding.
Result
api
: API
version
Returns Core Library version
NOTE: Sync version is available only for lib-node
binding.
Result
version
: string – Core Library version
config
Returns Core Library API reference
NOTE: Sync version is available only for lib-node
binding.
Result
binding
?: BindingConfignetwork
?: NetworkConfigcrypto
?: CryptoConfigabi
?: AbiConfigboc
?: BocConfigproofs
?: ProofsConfiglocal_storage_path
?: string – For file based storage is a folder name where SDK will store its data. For browser based is a browser async storage key prefix. Default (recommended) value is "~/.tonclient" for native environments and ".tonclient" for web-browser.
build_info
Returns detailed information about this build.
NOTE: Sync version is available only for lib-node
binding.
Result
build_number
: number – Build number assigned to this build by the CI.dependencies
: BuildInfoDependency[] – Fingerprint of the most important dependencies.
resolve_app_request
Resolves application request processing result
NOTE: Sync version is available only for lib-node
binding.
Parameters
app_request_id
: number – Request ID received from SDKresult
: AppRequestResult – Result of request processing
Types
ClientErrorCode
One of the following value:
NotImplemented = 1
InvalidHex = 2
InvalidBase64 = 3
InvalidAddress = 4
CallbackParamsCantBeConvertedToJson = 5
WebsocketConnectError = 6
WebsocketReceiveError = 7
WebsocketSendError = 8
HttpClientCreateError = 9
HttpRequestCreateError = 10
HttpRequestSendError = 11
HttpRequestParseError = 12
CallbackNotRegistered = 13
NetModuleNotInit = 14
InvalidConfig = 15
CannotCreateRuntime = 16
InvalidContextHandle = 17
CannotSerializeResult = 18
CannotSerializeError = 19
CannotConvertJsValueToJson = 20
CannotReceiveSpawnedResult = 21
SetTimerError = 22
InvalidParams = 23
ContractsAddressConversionFailed = 24
UnknownFunction = 25
AppRequestError = 26
NoSuchRequest = 27
CanNotSendRequestResult = 28
CanNotReceiveRequestResult = 29
CanNotParseRequestResult = 30
UnexpectedCallbackResponse = 31
CanNotParseNumber = 32
InternalError = 33
InvalidHandle = 34
LocalStorageError = 35
InvalidData = 36
ClientError
code
: numbermessage
: stringdata
: any
ClientConfig
binding
?: BindingConfignetwork
?: NetworkConfigcrypto
?: CryptoConfigabi
?: AbiConfigboc
?: BocConfigproofs
?: ProofsConfiglocal_storage_path
?: string – For file based storage is a folder name where SDK will store its data. For browser based is a browser async storage key prefix. Default (recommended) value is "~/.tonclient" for native environments and ".tonclient" for web-browser.
NetworkConfig
server_address
?: string – This field is deprecated, but left for backward-compatibility. Evernode endpoint.endpoints
?: string[] – List of Evernode endpoints. Any correct URL format can be specified, including IP addresses. This parameter is prevailing overserver_address
. Check the full list of supported network endpoints.network_retries_count
?: number – Deprecated. You must usenetwork.max_reconnect_timeout
that allows to specify maximum network resolving timeout.max_reconnect_timeout
?: number – Maximum time for sequential reconnections. Must be specified in milliseconds. Default is 120000 (2 min).reconnect_timeout
?: number – Deprecatedmessage_retries_count
?: number – The number of automatic message processing retries that SDK performs in case ofMessage Expired (507)
error - but only for those messages which local emulation was successful or failed with replay protection error. Default is 5.message_processing_timeout
?: number – Timeout that is used to process message delivery for the contracts which ABI does not include "expire" header. If the message is not delivered within the specified timeout the appropriate error occurs. Must be specified in milliseconds. Default is 40000 (40 sec).wait_for_timeout
?: number – Maximum timeout that is used for query response. Must be specified in milliseconds. Default is 40000 (40 sec).out_of_sync_threshold
?: number – DEPRECATED: This parameter was deprecated.sending_endpoint_count
?: number – Maximum number of randomly chosen endpoints the library uses to broadcast a message. Default is 1.latency_detection_interval
?: number – Frequency of sync latency detection. Library periodically checks the current endpoint for blockchain data synchronization latency. If the latency (time-lag) is less thenNetworkConfig.max_latency
then library selects another endpoint. Must be specified in milliseconds. Default is 60000 (1 min).max_latency
?: number – Maximum value for the endpoint's blockchain data synchronization latency (time-lag). Library periodically checks the current endpoint for blockchain data synchronization latency. If the latency (time-lag) is less thenNetworkConfig.max_latency
then library selects another endpoint. Must be specified in milliseconds. Default is 60000 (1 min).query_timeout
?: number – Default timeout for http requests. Is is used when no timeout specified for the request to limit the answer waiting time. If no answer received during the timeout requests ends with error. Must be specified in milliseconds. Default is 60000 (1 min).queries_protocol
?: NetworkQueriesProtocol – Queries protocol.HTTP
orWS
. Default isHTTP
.first_remp_status_timeout
?: number – UNSTABLE. First REMP status awaiting timeout. If no status received during the timeout than fallback transaction scenario is activated. Must be specified in milliseconds. Default is 1 (1 ms) in order to start fallback scenario together with REMP statuses processing while REMP is not properly tuned yet.next_remp_status_timeout
?: number – UNSTABLE. Subsequent REMP status awaiting timeout. If no status received during the timeout than fallback transaction scenario is activated. Must be specified in milliseconds. Default is 5000 (5 sec).signature_id
?: number – Network signature ID which is used by VM in signature verifying instructions if capabilityCapSignatureWithId
is enabled in blockchain configuration parameters. This parameter should be set toglobal_id
field from any blockchain block if network can not be reachable at the moment of message encoding and the message is aimed to be sent into network withCapSignatureWithId
enabled. Otherwise signature ID is detected automatically inside message encoding functionsaccess_key
?: string – Access key to GraphQL API (Project secret)
BindingConfig
library
?: stringversion
?: string
NetworkQueriesProtocol
Network protocol used to perform GraphQL queries.
One of the following value:
HTTP = "HTTP"
– Each GraphQL query uses separate HTTP request.WS = "WS"
– All GraphQL queries will be served using single web socket connection. SDK is tested to reliably handle 5000 parallel network requests (sending and processing messages, quering and awaiting blockchain data)
CryptoConfig
Crypto config.
mnemonic_dictionary
?: MnemonicDictionary – Mnemonic dictionary that will be used by default in crypto functions. If not specified,English
dictionary will be used.mnemonic_word_count
?: number – Mnemonic word count that will be used by default in crypto functions. If not specified the default value will be 12.hdkey_derivation_path
?: string – Derivation path that will be used by default in crypto functions. If not specifiedm/44'/396'/0'/0/0
will be used.
AbiConfig
workchain
?: number – Workchain id that is used by default in DeploySetmessage_expiration_timeout
?: number – Message lifetime for contracts which ABI includes "expire" header. Must be specified in milliseconds. Default is 40000 (40 sec).message_expiration_timeout_grow_factor
?: number – Factor that increases the expiration timeout for each retry Default is 1.5
BocConfig
cache_max_size
?: number – Maximum BOC cache size in kilobytes. Default is 10 MB
ProofsConfig
cache_in_local_storage
?: boolean – Cache proofs in the local storage. Default istrue
. If this value is set totrue
, downloaded proofs and master-chain BOCs are saved into the persistent local storage (e.g. file system for native environments or browser's IndexedDB for the web); otherwise all the data is cached only in memory in current client's context and will be lost after destruction of the client.
BuildInfoDependency
name
: string – Dependency name. Usually it is a crate name.git_commit
: string – Git commit hash of the related repository.
ParamsOfAppRequest
app_request_id
: number – Request ID. Should be used inresolve_app_request
callrequest_data
: any – Request describing data
AppRequestResultErrorVariant
Error occurred during request processing
text
: string – Error description
AppRequestResultOkVariant
Request processed successfully
result
: any – Request processing result
AppRequestResult
Depends on value of the type
field.
When type is 'Error'
Error occurred during request processing
text
: string – Error description
When type is 'Ok'
Request processed successfully
result
: any – Request processing result
Variant constructors:
ResultOfGetApiReference
api
: API
ResultOfVersion
version
: string – Core Library version
ResultOfBuildInfo
build_number
: number – Build number assigned to this build by the CI.dependencies
: BuildInfoDependency[] – Fingerprint of the most important dependencies.
ParamsOfResolveAppRequest
app_request_id
: number – Request ID received from SDKresult
: AppRequestResult – Result of request processing
Last updated