import { ResponseHandler } from "./bin" ; interface IClient { request ( functionName , functionParams ? , responseHandler ? ) : Promise < any > ; resolve_app_request ( app_request_id , result ) : Promise < void > ; reject_app_request ( app_request_id , error ) : Promise < void > ; } export enum ClientErrorCode { 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 } export type ClientError = { /**
     */ code : number ; /**
     */ message : string ; /**
     */ data : any ; } ; export type ClientConfig = { /**
     */ network ? : NetworkConfig ; /**
     */ crypto ? : CryptoConfig ; /**
     */ abi ? : AbiConfig ; /**
     */ boc ? : BocConfig ; /**
     */ proofs ? : ProofsConfig ; /**
     * 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.
     */ local_storage_path ? : string ; } ; export type NetworkConfig = { /**
     * DApp Server public address. For instance, for `net.ton.dev/graphql` GraphQL endpoint the server address will be net.ton.dev
     */ server_address ? : string ; remarks endpoints ? : string [ ] ; remarks network_retries_count ? : number ; remarks max_reconnect_timeout ? : number ; /**
     * Deprecated
     */ reconnect_timeout ? : number ; remarks message_retries_count ? : number ; remarks message_processing_timeout ? : number ; remarks wait_for_timeout ? : number ; remarks out_of_sync_threshold ? : number ; remarks sending_endpoint_count ? : number ; remarks latency_detection_interval ? : number ; remarks max_latency ? : number ; remarks query_timeout ? : number ; remarks access_key ? : string ; } ; export type CryptoConfig = { /**
     * Mnemonic dictionary that will be used by default in crypto functions. If not specified, 1 dictionary will be used.
     */ mnemonic_dictionary ? : number ; /**
     * Mnemonic word count that will be used by default in crypto functions. If not specified the default value will be 12.
     */ mnemonic_word_count ? : number ; /**
     * Derivation path that will be used by default in crypto functions. If not specified `m/44'/396'/0'/0/0` will be used.
     */ hdkey_derivation_path ? : string ; } ; export type AbiConfig = { /**
     * Workchain id that is used by default in DeploySet
     */ workchain ? : number ; /**
     * Message lifetime for contracts which ABI includes "expire" header. The default value is 40 sec.
     */ message_expiration_timeout ? : number ; /**
     * Factor that increases the expiration timeout for each retry The default value is 1.5
     */ message_expiration_timeout_grow_factor ? : number ; } ; export type BocConfig = { remarks cache_max_size ? : number ; } ; export type ProofsConfig = { remarks cache_in_local_storage ? : boolean ; } ; export type BuildInfoDependency = { remarks name : string ; /**
     * Git commit hash of the related repository.
     */ git_commit : string ; } ; export type ParamsOfAppRequest = { remarks app_request_id : number ; /**
     * Request describing data
     */ request_data : any ; } ; export type AppRequestResult = { type : 'Error' ; /**
     * Error description
     */ text : string ; } | { type : 'Ok' ; /**
     * Request processing result
     */ result : any ; } ; export function appRequestResultError ( text ) { return { type : 'Error' , text , } ; } export function appRequestResultOk ( result ) { return { type : 'Ok' , result , } ; } export type ResultOfGetApiReference = { /**
     */ api : any ; } ; export type ResultOfVersion = { /**
     * Core Library version
     */ version : string ; } ; export type ResultOfBuildInfo = { /**
     * Build number assigned to this build by the CI.
     */ build_number : number ; /**
     * Fingerprint of the most important dependencies.
     */ dependencies : BuildInfoDependency [ ] ; } ; export type ParamsOfResolveAppRequest = { /**
     * Request ID received from SDK
     */ app_request_id : number ; /**
     * Result of request processing
     */ result : AppRequestResult ; } ; /**
 * Provides information about library.
 */ export class ClientModule { client : IClient ; constructor ( client ) { this . client = client ; } returns get_api_reference ( ) { return this . client . request ( 'client.get_api_reference' ) ; } returns version ( ) { return this . client . request ( 'client.version' ) ; } returns build_info ( ) { return this . client . request ( 'client.build_info' ) ; } param { ParamsOfResolveAppRequest } params returns resolve_app_request ( params ) { return this . client . request ( 'client.resolve_app_request' , params ) ; } } export enum CryptoErrorCode { InvalidPublicKey = 100 , InvalidSecretKey = 101 , InvalidKey = 102 , InvalidFactorizeChallenge = 106 , InvalidBigInt = 107 , ScryptFailed = 108 , InvalidKeySize = 109 , NaclSecretBoxFailed = 110 , NaclBoxFailed = 111 , NaclSignFailed = 112 , Bip39InvalidEntropy = 113 , Bip39InvalidPhrase = 114 , Bip32InvalidKey = 115 , Bip32InvalidDerivePath = 116 , Bip39InvalidDictionary = 117 , Bip39InvalidWordCount = 118 , MnemonicGenerationFailed = 119 , MnemonicFromEntropyFailed = 120 , SigningBoxNotRegistered = 121 , InvalidSignature = 122 , EncryptionBoxNotRegistered = 123 , InvalidIvSize = 124 , UnsupportedCipherMode = 125 , CannotCreateCipher = 126 , EncryptDataError = 127 , DecryptDataError = 128 , IvRequired = 129 } export type SigningBoxHandle = number ; export type EncryptionBoxHandle = number ; export type EncryptionBoxInfo = { /**
     * Derivation path, for instance "m/44'/396'/0'/0/0"
     */ hdpath ? : string ; /**
     * Cryptographic algorithm, used by this encryption box
     */ algorithm ? : string ; /**
     * Options, depends on algorithm and specific encryption box implementation
     */ options ? : any ; /**
     * Public information, depends on algorithm
     */ public ? : any ; } ; export type EncryptionAlgorithm = ( { type : 'AES' ; } & AesParams ) ; export function encryptionAlgorithmAES ( params ) { return { type : 'AES' , ... params , } ; } export enum CipherMode { CBC = "CBC" , CFB = "CFB" , CTR = "CTR" , ECB = "ECB" , OFB = "OFB" } export type AesParams = { /**
     */ mode : CipherMode ; /**
     */ key : string ; /**
     */ iv ? : string ; } ; export type AesInfo = { /**
     */ mode : CipherMode ; /**
     */ iv ? : string ; } ; export type ParamsOfFactorize = { /**
     * Hexadecimal representation of u64 composite number.
     */ composite : string ; } ; export type ResultOfFactorize = { /**
     * Two factors of composite or empty if composite can't be factorized.
     */ factors : string [ ] ; } ; export type ParamsOfModularPower = { /**
     * `base` argument of calculation.
     */ base : string ; /**
     * `exponent` argument of calculation.
     */ exponent : string ; /**
     * `modulus` argument of calculation.
     */ modulus : string ; } ; export type ResultOfModularPower = { /**
     * Result of modular exponentiation
     */ modular_power : string ; } ; export type ParamsOfTonCrc16 = { remarks data : string ; } ; export type ResultOfTonCrc16 = { /**
     * Calculated CRC for input data.
     */ crc : number ; } ; export type ParamsOfGenerateRandomBytes = { /**
     * Size of random byte array.
     */ length : number ; } ; export type ResultOfGenerateRandomBytes = { /**
     * Generated bytes encoded in `base64`.
     */ bytes : string ; } ; export type ParamsOfConvertPublicKeyToTonSafeFormat = { /**
     * Public key - 64 symbols hex string
     */ public_key : string ; } ; export type ResultOfConvertPublicKeyToTonSafeFormat = { /**
     * Public key represented in TON safe format.
     */ ton_public_key : string ; } ; export type KeyPair = { /**
     * Public key - 64 symbols hex string
     */ public : string ; /**
     * Private key - u64 symbols hex string
     */ secret : string ; } ; export type ParamsOfSign = { /**
     * Data that must be signed encoded in `base64`.
     */ unsigned : string ; /**
     * Sign keys.
     */ keys : KeyPair ; } ; export type ResultOfSign = { /**
     * Signed data combined with signature encoded in `base64`.
     */ signed : string ; /**
     * Signature encoded in `hex`.
     */ signature : string ; } ; export type ParamsOfVerifySignature = { /**
     * Signed data that must be verified encoded in `base64`.
     */ signed : string ; /**
     * Signer's public key - 64 symbols hex string
     */ public : string ; } ; export type ResultOfVerifySignature = { /**
     * Unsigned data encoded in `base64`.
     */ unsigned : string ; } ; export type ParamsOfHash = { remarks data : string ; } ; export type ResultOfHash = { remarks hash : string ; } ; export type ParamsOfScrypt = { /**
     * The password bytes to be hashed. Must be encoded with `base64`.
     */ password : string ; /**
     * Salt bytes that modify the hash to protect against Rainbow table attacks. Must be encoded with `base64`.
     */ salt : string ; /**
     * CPU/memory cost parameter
     */ log_n : number ; /**
     * The block size parameter, which fine-tunes sequential memory read size and performance.
     */ r : number ; /**
     * Parallelization parameter.
     */ p : number ; /**
     * Intended output length in octets of the derived key.
     */ dk_len : number ; } ; export type ResultOfScrypt = { remarks key : string ; } ; export type ParamsOfNaclSignKeyPairFromSecret = { /**
     * Secret key - unprefixed 0-padded to 64 symbols hex string
     */ secret : string ; } ; export type ParamsOfNaclSign = { /**
     * Data that must be signed encoded in `base64`.
     */ unsigned : string ; /**
     * Signer's secret key - unprefixed 0-padded to 128 symbols hex string (concatenation of 64 symbols secret and 64 symbols public keys). See `nacl_sign_keypair_from_secret_key`.
     */ secret : string ; } ; export type ResultOfNaclSign = { /**
     * Signed data, encoded in `base64`.
     */ signed : string ; } ; export type ParamsOfNaclSignOpen = { remarks signed : string ; /**
     * Signer's public key - unprefixed 0-padded to 64 symbols hex string
     */ public : string ; } ; export type ResultOfNaclSignOpen = { /**
     * Unsigned data, encoded in `base64`.
     */ unsigned : string ; } ; export type ResultOfNaclSignDetached = { /**
     * Signature encoded in `hex`.
     */ signature : string ; } ; export type ParamsOfNaclSignDetachedVerify = { remarks unsigned : string ; remarks signature : string ; /**
     * Signer's public key - unprefixed 0-padded to 64 symbols hex string.
     */ public : string ; } ; export type ResultOfNaclSignDetachedVerify = { /**
     * `true` if verification succeeded or `false` if it failed
     */ succeeded : boolean ; } ; export type ParamsOfNaclBoxKeyPairFromSecret = { /**
     * Secret key - unprefixed 0-padded to 64 symbols hex string
     */ secret : string ; } ; export type ParamsOfNaclBox = { /**
     * Data that must be encrypted encoded in `base64`.
     */ decrypted : string ; /**
     * Nonce, encoded in `hex`
     */ nonce : string ; /**
     * Receiver's public key - unprefixed 0-padded to 64 symbols hex string
     */ their_public : string ; /**
     * Sender's private key - unprefixed 0-padded to 64 symbols hex string
     */ secret : string ; } ; export type ResultOfNaclBox = { /**
     * Encrypted data encoded in `base64`.
     */ encrypted : string ; } ; export type ParamsOfNaclBoxOpen = { remarks encrypted : string ; /**
     */ nonce : string ; /**
     * Sender's public key - unprefixed 0-padded to 64 symbols hex string
     */ their_public : string ; /**
     * Receiver's private key - unprefixed 0-padded to 64 symbols hex string
     */ secret : string ; } ; export type ResultOfNaclBoxOpen = { /**
     * Decrypted data encoded in `base64`.
     */ decrypted : string ; } ; export type ParamsOfNaclSecretBox = { remarks decrypted : string ; /**
     * Nonce in `hex`
     */ nonce : string ; /**
     * Secret key - unprefixed 0-padded to 64 symbols hex string
     */ key : string ; } ; export type ParamsOfNaclSecretBoxOpen = { remarks encrypted : string ; /**
     * Nonce in `hex`
     */ nonce : string ; /**
     * Public key - unprefixed 0-padded to 64 symbols hex string
     */ key : string ; } ; export type ParamsOfMnemonicWords = { /**
     * Dictionary identifier
     */ dictionary ? : number ; } ; export type ResultOfMnemonicWords = { /**
     * The list of mnemonic words
     */ words : string ; } ; export type ParamsOfMnemonicFromRandom = { /**
     * Dictionary identifier
     */ dictionary ? : number ; /**
     * Mnemonic word count
     */ word_count ? : number ; } ; export type ResultOfMnemonicFromRandom = { /**
     * String of mnemonic words
     */ phrase : string ; } ; export type ParamsOfMnemonicFromEntropy = { remarks entropy : string ; /**
     * Dictionary identifier
     */ dictionary ? : number ; /**
     * Mnemonic word count
     */ word_count ? : number ; } ; export type ResultOfMnemonicFromEntropy = { /**
     * Phrase
     */ phrase : string ; } ; export type ParamsOfMnemonicVerify = { /**
     * Phrase
     */ phrase : string ; /**
     * Dictionary identifier
     */ dictionary ? : number ; /**
     * Word count
     */ word_count ? : number ; } ; export type ResultOfMnemonicVerify = { /**
     * Flag indicating if the mnemonic is valid or not
     */ valid : boolean ; } ; export type ParamsOfMnemonicDeriveSignKeys = { /**
     * Phrase
     */ phrase : string ; /**
     * Derivation path, for instance "m/44'/396'/0'/0/0"
     */ path ? : string ; /**
     * Dictionary identifier
     */ dictionary ? : number ; /**
     * Word count
     */ word_count ? : number ; } ; export type ParamsOfHDKeyXPrvFromMnemonic = { /**
     * String with seed phrase
     */ phrase : string ; /**
     * Dictionary identifier
     */ dictionary ? : number ; /**
     * Mnemonic word count
     */ word_count ? : number ; } ; export type ResultOfHDKeyXPrvFromMnemonic = { /**
     * Serialized extended master private key
     */ xprv : string ; } ; export type ParamsOfHDKeyDeriveFromXPrv = { /**
     * Serialized extended private key
     */ xprv : string ; /**
     * Child index (see BIP-0032)
     */ child_index : number ; /**
     * Indicates the derivation of hardened/not-hardened key (see BIP-0032)
     */ hardened : boolean ; } ; export type ResultOfHDKeyDeriveFromXPrv = { /**
     * Serialized extended private key
     */ xprv : string ; } ; export type ParamsOfHDKeyDeriveFromXPrvPath = { /**
     * Serialized extended private key
     */ xprv : string ; /**
     * Derivation path, for instance "m/44'/396'/0'/0/0"
     */ path : string ; } ; export type ResultOfHDKeyDeriveFromXPrvPath = { /**
     * Derived serialized extended private key
     */ xprv : string ; } ; export type ParamsOfHDKeySecretFromXPrv = { /**
     * Serialized extended private key
     */ xprv : string ; } ; export type ResultOfHDKeySecretFromXPrv = { /**
     * Private key - 64 symbols hex string
     */ secret : string ; } ; export type ParamsOfHDKeyPublicFromXPrv = { /**
     * Serialized extended private key
     */ xprv : string ; } ; export type ResultOfHDKeyPublicFromXPrv = { /**
     * Public key - 64 symbols hex string
     */ public : string ; } ; export type ParamsOfChaCha20 = { remarks data : string ; remarks key : string ; remarks nonce : string ; } ; export type ResultOfChaCha20 = { remarks data : string ; } ; export type RegisteredSigningBox = { /**
     * Handle of the signing box.
     */ handle : SigningBoxHandle ; } ; export type ParamsOfAppSigningBox = { type : 'GetPublicKey' ; } | { type : 'Sign' ; /**
     * Data to sign encoded as base64
     */ unsigned : string ; } ; export function paramsOfAppSigningBoxGetPublicKey ( ) { return { type : 'GetPublicKey' , } ; } export function paramsOfAppSigningBoxSign ( unsigned ) { return { type : 'Sign' , unsigned , } ; } export type ResultOfAppSigningBox = { type : 'GetPublicKey' ; /**
     * Signing box public key
     */ public_key : string ; } | { type : 'Sign' ; /**
     * Data signature encoded as hex
     */ signature : string ; } ; export function resultOfAppSigningBoxGetPublicKey ( public_key ) { return { type : 'GetPublicKey' , public_key , } ; } export function resultOfAppSigningBoxSign ( signature ) { return { type : 'Sign' , signature , } ; } export type ResultOfSigningBoxGetPublicKey = { remarks pubkey : string ; } ; export type ParamsOfSigningBoxSign = { /**
     * Signing Box handle.
     */ signing_box : SigningBoxHandle ; remarks unsigned : string ; } ; export type ResultOfSigningBoxSign = { remarks signature : string ; } ; export type RegisteredEncryptionBox = { /**
     * Handle of the encryption box
     */ handle : EncryptionBoxHandle ; } ; export type ParamsOfAppEncryptionBox = { type : 'GetInfo' ; } | { type : 'Encrypt' ; /**
     * Data, encoded in Base64
     */ data : string ; } | { type : 'Decrypt' ; /**
     * Data, encoded in Base64
     */ data : string ; } ; export function paramsOfAppEncryptionBoxGetInfo ( ) { return { type : 'GetInfo' , } ; } export function paramsOfAppEncryptionBoxEncrypt ( data ) { return { type : 'Encrypt' , data , } ; } export function paramsOfAppEncryptionBoxDecrypt ( data ) { return { type : 'Decrypt' , data , } ; } export type ResultOfAppEncryptionBox = { type : 'GetInfo' ; /**
     */ info : EncryptionBoxInfo ; } | { type : 'Encrypt' ; /**
     * Encrypted data, encoded in Base64
     */ data : string ; } | { type : 'Decrypt' ; /**
     * Decrypted data, encoded in Base64
     */ data : string ; } ; export function resultOfAppEncryptionBoxGetInfo ( info ) { return { type : 'GetInfo' , info , } ; } export function resultOfAppEncryptionBoxEncrypt ( data ) { return { type : 'Encrypt' , data , } ; } export function resultOfAppEncryptionBoxDecrypt ( data ) { return { type : 'Decrypt' , data , } ; } export type ParamsOfEncryptionBoxGetInfo = { /**
     * Encryption box handle
     */ encryption_box : EncryptionBoxHandle ; } ; export type ResultOfEncryptionBoxGetInfo = { /**
     * Encryption box information
     */ info : EncryptionBoxInfo ; } ; export type ParamsOfEncryptionBoxEncrypt = { /**
     * Encryption box handle
     */ encryption_box : EncryptionBoxHandle ; /**
     * Data to be encrypted, encoded in Base64
     */ data : string ; } ; export type ResultOfEncryptionBoxEncrypt = { remarks data : string ; } ; export type ParamsOfEncryptionBoxDecrypt = { /**
     * Encryption box handle
     */ encryption_box : EncryptionBoxHandle ; /**
     * Data to be decrypted, encoded in Base64
     */ data : string ; } ; export type ResultOfEncryptionBoxDecrypt = { /**
     * Decrypted data, encoded in Base64.
     */ data : string ; } ; export type ParamsOfCreateEncryptionBox = { /**
     * Encryption algorithm specifier including cipher parameters (key, IV, etc)
     */ algorithm : EncryptionAlgorithm ; } ; type ResultOfAppSigningBoxGetPublicKey = { public_key : string ; } ; type ParamsOfAppSigningBoxSign = { unsigned : string ; } ; type ResultOfAppSigningBoxSign = { signature : string ; } ; export interface AppSigningBox { get_public_key ( ) : Promise < ResultOfAppSigningBoxGetPublicKey > ; sign ( params ) : Promise < ResultOfAppSigningBoxSign > ; } async function dispatchAppSigningBox ( obj , params , app_request_id , client ) { try { let result = { } ; switch ( params . type ) { case 'GetPublicKey' : result = await obj . get_public_key ( ) ; break ; case 'Sign' : result = await obj . sign ( params ) ; break ; } client . resolve_app_request ( app_request_id , { type : params . type , ... result } ) ; } catch ( error ) { client . reject_app_request ( app_request_id , error ) ; } } type ResultOfAppEncryptionBoxGetInfo = { info : EncryptionBoxInfo ; } ; type ParamsOfAppEncryptionBoxEncrypt = { data : string ; } ; type ResultOfAppEncryptionBoxEncrypt = { data : string ; } ; type ParamsOfAppEncryptionBoxDecrypt = { data : string ; } ; type ResultOfAppEncryptionBoxDecrypt = { data : string ; } ; export interface AppEncryptionBox { get_info ( ) : Promise < ResultOfAppEncryptionBoxGetInfo > ; encrypt ( params ) : Promise < ResultOfAppEncryptionBoxEncrypt > ; decrypt ( params ) : Promise < ResultOfAppEncryptionBoxDecrypt > ; } async function dispatchAppEncryptionBox ( obj , params , app_request_id , client ) { try { let result = { } ; switch ( params . type ) { case 'GetInfo' : result = await obj . get_info ( ) ; break ; case 'Encrypt' : result = await obj . encrypt ( params ) ; break ; case 'Decrypt' : result = await obj . decrypt ( params ) ; break ; } client . resolve_app_request ( app_request_id , { type : params . type , ... result } ) ; } catch ( error ) { client . reject_app_request ( app_request_id , error ) ; } } /**
 * Crypto functions.
 */ export class CryptoModule { client : IClient ; constructor ( client ) { this . client = client ; } remarks param { ParamsOfFactorize } params returns factorize ( params ) { return this . client . request ( 'crypto.factorize' , params ) ; } remarks param { ParamsOfModularPower } params returns modular_power ( params ) { return this . client . request ( 'crypto.modular_power' , params ) ; } param { ParamsOfTonCrc16 } params returns ton_crc16 ( params ) { return this . client . request ( 'crypto.ton_crc16' , params ) ; } param { ParamsOfGenerateRandomBytes } params returns generate_random_bytes ( params ) { return this . client . request ( 'crypto.generate_random_bytes' , params ) ; } param { ParamsOfConvertPublicKeyToTonSafeFormat } params returns convert_public_key_to_ton_safe_format ( params ) { return this . client . request ( 'crypto.convert_public_key_to_ton_safe_format' , params ) ; } returns generate_random_sign_keys ( ) { return this . client . request ( 'crypto.generate_random_sign_keys' ) ; } param { ParamsOfSign } params returns sign ( params ) { return this . client . request ( 'crypto.sign' , params ) ; } param { ParamsOfVerifySignature } params returns verify_signature ( params ) { return this . client . request ( 'crypto.verify_signature' , params ) ; } param { ParamsOfHash } params returns sha256 ( params ) { return this . client . request ( 'crypto.sha256' , params ) ; } param { ParamsOfHash } params returns sha512 ( params ) { return this . client . request ( 'crypto.sha512' , params ) ; } remarks param { ParamsOfScrypt } params returns scrypt ( params ) { return this . client . request ( 'crypto.scrypt' , params ) ; } remarks param { ParamsOfNaclSignKeyPairFromSecret } params returns nacl_sign_keypair_from_secret_key ( params ) { return this . client . request ( 'crypto.nacl_sign_keypair_from_secret_key' , params ) ; } param { ParamsOfNaclSign } params returns nacl_sign ( params ) { return this . client . request ( 'crypto.nacl_sign' , params ) ; } remarks param { ParamsOfNaclSignOpen } params returns nacl_sign_open ( params ) { return this . client . request ( 'crypto.nacl_sign_open' , params ) ; } remarks param { ParamsOfNaclSign } params returns nacl_sign_detached ( params ) { return this . client . request ( 'crypto.nacl_sign_detached' , params ) ; } param { ParamsOfNaclSignDetachedVerify } params returns nacl_sign_detached_verify ( params ) { return this . client . request ( 'crypto.nacl_sign_detached_verify' , params ) ; } returns nacl_box_keypair ( ) { return this . client . request ( 'crypto.nacl_box_keypair' ) ; } param { ParamsOfNaclBoxKeyPairFromSecret } params returns nacl_box_keypair_from_secret_key ( params ) { return this . client . request ( 'crypto.nacl_box_keypair_from_secret_key' , params ) ; } remarks param { ParamsOfNaclBox } params returns nacl_box ( params ) { return this . client . request ( 'crypto.nacl_box' , params ) ; } param { ParamsOfNaclBoxOpen } params returns nacl_box_open ( params ) { return this . client . request ( 'crypto.nacl_box_open' , params ) ; } param { ParamsOfNaclSecretBox } params returns nacl_secret_box ( params ) { return this . client . request ( 'crypto.nacl_secret_box' , params ) ; } param { ParamsOfNaclSecretBoxOpen } params returns nacl_secret_box_open ( params ) { return this . client . request ( 'crypto.nacl_secret_box_open' , params ) ; } param { ParamsOfMnemonicWords } params returns mnemonic_words ( params ) { return this . client . request ( 'crypto.mnemonic_words' , params ) ; } remarks param { ParamsOfMnemonicFromRandom } params returns mnemonic_from_random ( params ) { return this . client . request ( 'crypto.mnemonic_from_random' , params ) ; } param { ParamsOfMnemonicFromEntropy } params returns mnemonic_from_entropy ( params ) { return this . client . request ( 'crypto.mnemonic_from_entropy' , params ) ; } remarks param { ParamsOfMnemonicVerify } params returns mnemonic_verify ( params ) { return this . client . request ( 'crypto.mnemonic_verify' , params ) ; } remarks param { ParamsOfMnemonicDeriveSignKeys } params returns mnemonic_derive_sign_keys ( params ) { return this . client . request ( 'crypto.mnemonic_derive_sign_keys' , params ) ; } param { ParamsOfHDKeyXPrvFromMnemonic } params returns hdkey_xprv_from_mnemonic ( params ) { return this . client . request ( 'crypto.hdkey_xprv_from_mnemonic' , params ) ; } param { ParamsOfHDKeyDeriveFromXPrv } params returns hdkey_derive_from_xprv ( params ) { return this . client . request ( 'crypto.hdkey_derive_from_xprv' , params ) ; } param { ParamsOfHDKeyDeriveFromXPrvPath } params returns hdkey_derive_from_xprv_path ( params ) { return this . client . request ( 'crypto.hdkey_derive_from_xprv_path' , params ) ; } param { ParamsOfHDKeySecretFromXPrv } params returns hdkey_secret_from_xprv ( params ) { return this . client . request ( 'crypto.hdkey_secret_from_xprv' , params ) ; } param { ParamsOfHDKeyPublicFromXPrv } params returns hdkey_public_from_xprv ( params ) { return this . client . request ( 'crypto.hdkey_public_from_xprv' , params ) ; } param { ParamsOfChaCha20 } params returns chacha20 ( params ) { return this . client . request ( 'crypto.chacha20' , params ) ; } returns register_signing_box ( obj ) { return this . client . request ( 'crypto.register_signing_box' , undefined , ( params , responseType ) => { if ( responseType === 3 ) { dispatchAppSigningBox ( obj , params . request_data , params . app_request_id , this . client ) ; } else if ( responseType === 4 ) { dispatchAppSigningBox ( obj , params , null , this . client ) ; } } ) ; } param { KeyPair } params returns get_signing_box ( params ) { return this . client . request ( 'crypto.get_signing_box' , params ) ; } param { RegisteredSigningBox } params returns signing_box_get_public_key ( params ) { return this . client . request ( 'crypto.signing_box_get_public_key' , params ) ; } param { ParamsOfSigningBoxSign } params returns signing_box_sign ( params ) { return this . client . request ( 'crypto.signing_box_sign' , params ) ; } param { RegisteredSigningBox } params returns remove_signing_box ( params ) { return this . client . request ( 'crypto.remove_signing_box' , params ) ; } returns register_encryption_box ( obj ) { return this . client . request ( 'crypto.register_encryption_box' , undefined , ( params , responseType ) => { if ( responseType === 3 ) { dispatchAppEncryptionBox ( obj , params . request_data , params . app_request_id , this . client ) ; } else if ( responseType === 4 ) { dispatchAppEncryptionBox ( obj , params , null , this . client ) ; } } ) ; } param { RegisteredEncryptionBox } params returns remove_encryption_box ( params ) { return this . client . request ( 'crypto.remove_encryption_box' , params ) ; } param { ParamsOfEncryptionBoxGetInfo } params returns encryption_box_get_info ( params ) { return this . client . request ( 'crypto.encryption_box_get_info' , params ) ; } remarks param { ParamsOfEncryptionBoxEncrypt } params returns encryption_box_encrypt ( params ) { return this . client . request ( 'crypto.encryption_box_encrypt' , params ) ; } remarks param { ParamsOfEncryptionBoxDecrypt } params returns encryption_box_decrypt ( params ) { return this . client . request ( 'crypto.encryption_box_decrypt' , params ) ; } param { ParamsOfCreateEncryptionBox } params returns create_encryption_box ( params ) { return this . client . request ( 'crypto.create_encryption_box' , params ) ; } } export 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 } export type Abi = { type : 'Contract' ; /**
     */ value : AbiContract ; } | { type : 'Json' ; /**
     */ value : string ; } | { type : 'Handle' ; /**
     */ value : AbiHandle ; } | { type : 'Serialized' ; /**
     */ value : AbiContract ; } ; export function abiContract ( value ) { return { type : 'Contract' , value , } ; } export function abiJson ( value ) { return { type : 'Json' , value , } ; } export function abiHandle ( value ) { return { type : 'Handle' , value , } ; } export function abiSerialized ( value ) { return { type : 'Serialized' , value , } ; } export type AbiHandle = number ; export type FunctionHeader = { /**
     * Message expiration 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).
     */ expire ? : number ; remarks time ? : bigint ; remarks pubkey ? : string ; } ; export type CallSet = { /**
     * Function name that is being called. Or function id encoded as string in hex (starting with 0x).
     */ function_name : string ; remarks header ? : FunctionHeader ; /**
     * Function input parameters according to ABI.
     */ input ? : any ; } ; export type DeploySet = { /**
     * Content of TVC file encoded in `base64`.
     */ tvc : string ; remarks workchain_id ? : number ; /**
     * List of initial values for contract's public variables.
     */ initial_data ? : any ; remarks initial_pubkey ? : string ; } ; export type Signer = { type : 'None' ; } | { type : 'External' ; /**
     */ public_key : string ; } | { type : 'Keys' ; /**
     */ keys : KeyPair ; } | { type : 'SigningBox' ; /**
     */ handle : SigningBoxHandle ; } ; export function signerNone ( ) { return { type : 'None' , } ; } export function signerExternal ( public_key ) { return { type : 'External' , public_key , } ; } export function signerKeys ( keys ) { return { type : 'Keys' , keys , } ; } export function signerSigningBox ( handle ) { return { type : 'SigningBox' , handle , } ; } export enum MessageBodyType { Input = "Input" , Output = "Output" , InternalOutput = "InternalOutput" , Event = "Event" } export type StateInitSource = { type : 'Message' ; /**
     */ source : MessageSource ; } | { type : 'StateInit' ; remarks code : string ; remarks data : string ; remarks library ? : string ; } | { type : 'Tvc' ; /**
     */ tvc : string ; /**
     */ public_key ? : string ; /**
     */ init_params ? : StateInitParams ; } ; export function stateInitSourceMessage ( source ) { return { type : 'Message' , source , } ; } export function stateInitSourceStateInit ( code , data , library ? ) { return { type : 'StateInit' , code , data , library , } ; } export function stateInitSourceTvc ( tvc , public_key ? , init_params ? ) { return { type : 'Tvc' , tvc , public_key , init_params , } ; } export type StateInitParams = { /**
     */ abi : Abi ; /**
     */ value : any ; } ; export type MessageSource = { type : 'Encoded' ; /**
     */ message : string ; /**
     */ abi ? : Abi ; } | ( { type : 'EncodingParams' ; } & ParamsOfEncodeMessage ) ; export function messageSourceEncoded ( message , abi ? ) { return { type : 'Encoded' , message , abi , } ; } export function messageSourceEncodingParams ( params ) { return { type : 'EncodingParams' , ... params , } ; } export type AbiParam = { /**
     */ name : string ; /**
     */ type : string ; /**
     */ components ? : AbiParam [ ] ; } ; export type AbiEvent = { /**
     */ name : string ; /**
     */ inputs : AbiParam [ ] ; /**
     */ id ? : string | null ; } ; export type AbiData = { /**
     */ key : number ; /**
     */ name : string ; /**
     */ type : string ; /**
     */ components ? : AbiParam [ ] ; } ; export type AbiFunction = { /**
     */ name : string ; /**
     */ inputs : AbiParam [ ] ; /**
     */ outputs : AbiParam [ ] ; /**
     */ id ? : string | null ; } ; export type AbiContract = { /**
     */ 'ABI version' ? : number ; /**
     */ abi_version ? : number ; /**
     */ version ? : string | null ; /**
     */ header ? : string [ ] ; /**
     */ functions ? : AbiFunction [ ] ; /**
     */ events ? : AbiEvent [ ] ; /**
     */ data ? : AbiData [ ] ; /**
     */ fields ? : AbiParam [ ] ; } ; export type ParamsOfEncodeMessageBody = { /**
     * Contract ABI.
     */ abi : Abi ; remarks call_set : CallSet ; /**
     * True if internal message body must be encoded.
     */ is_internal : boolean ; /**
     * Signing parameters.
     */ signer : Signer ; remarks processing_try_index ? : number ; } ; export type ResultOfEncodeMessageBody = { /**
     * Message body BOC encoded with `base64`.
     */ body : string ; remarks data_to_sign ? : string ; } ; export type ParamsOfAttachSignatureToMessageBody = { /**
     * Contract ABI
     */ abi : Abi ; remarks public_key : string ; remarks message : string ; remarks signature : string ; } ; export type ResultOfAttachSignatureToMessageBody = { /**
     */ body : string ; } ; export type ParamsOfEncodeMessage = { /**
     * Contract ABI.
     */ abi : Abi ; remarks address ? : string ; remarks deploy_set ? : DeploySet ; remarks call_set ? : CallSet ; /**
     * Signing parameters.
     */ signer : Signer ; remarks processing_try_index ? : number ; } ; export type ResultOfEncodeMessage = { /**
     * Message BOC encoded with `base64`.
     */ message : string ; remarks data_to_sign ? : string ; /**
     * Destination address.
     */ address : string ; /**
     * Message id.
     */ message_id : string ; } ; export type ParamsOfEncodeInternalMessage = { remarks abi ? : Abi ; remarks address ? : string ; /**
     * Source address of the message.
     */ src_address ? : string ; remarks deploy_set ? : DeploySet ; remarks call_set ? : CallSet ; /**
     * Value in nanotokens to be sent with message.
     */ value : string ; remarks bounce ? : boolean ; remarks enable_ihr ? : boolean ; } ; export type ResultOfEncodeInternalMessage = { /**
     * Message BOC encoded with `base64`.
     */ message : string ; /**
     * Destination address.
     */ address : string ; /**
     * Message id.
     */ message_id : string ; } ; export type ParamsOfAttachSignature = { /**
     * Contract ABI
     */ abi : Abi ; /**
     * Public key encoded in `hex`.
     */ public_key : string ; /**
     * Unsigned message BOC encoded in `base64`.
     */ message : string ; /**
     * Signature encoded in `hex`.
     */ signature : string ; } ; export type ResultOfAttachSignature = { /**
     * Signed message BOC
     */ message : string ; /**
     * Message ID
     */ message_id : string ; } ; export type ParamsOfDecodeMessage = { /**
     * contract ABI
     */ abi : Abi ; /**
     * Message BOC
     */ message : string ; } ; export type DecodedMessageBody = { /**
     * Type of the message body content.
     */ body_type : MessageBodyType ; /**
     * Function or event name.
     */ name : string ; /**
     * Parameters or result value.
     */ value ? : any ; /**
     * Function header.
     */ header ? : FunctionHeader ; } ; export type ParamsOfDecodeMessageBody = { /**
     * Contract ABI used to decode.
     */ abi : Abi ; /**
     * Message body BOC encoded in `base64`.
     */ body : string ; /**
     * True if the body belongs to the internal message.
     */ is_internal : boolean ; } ; export type ParamsOfEncodeAccount = { /**
     * Source of the account state init.
     */ state_init : StateInitSource ; /**
     * Initial balance.
     */ balance ? : bigint ; /**
     * Initial value for the `last_trans_lt`.
     */ last_trans_lt ? : bigint ; /**
     * Initial value for the `last_paid`.
     */ last_paid ? : number ; remarks boc_cache ? : BocCacheType ; } ; export type ResultOfEncodeAccount = { /**
     * Account BOC encoded in `base64`.
     */ account : string ; /**
     * Account ID  encoded in `hex`.
     */ id : string ; } ; export type ParamsOfDecodeAccountData = { /**
     * Contract ABI
     */ abi : Abi ; /**
     * Data BOC or BOC handle
     */ data : string ; } ; export type ResultOfDecodeAccountData = { /**
     * Decoded data as a JSON structure.
     */ data : any ; } ; export type ParamsOfUpdateInitialData = { /**
     * Contract ABI
     */ abi ? : Abi ; /**
     * Data BOC or BOC handle
     */ data : string ; remarks initial_data ? : any ; /**
     * Initial account owner's public key to set into account data
     */ initial_pubkey ? : string ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfUpdateInitialData = { /**
     * Updated data BOC or BOC handle
     */ data : string ; } ; export type ParamsOfEncodeInitialData = { /**
     * Contract ABI
     */ abi ? : Abi ; remarks initial_data ? : any ; /**
     * Initial account owner's public key to set into account data
     */ initial_pubkey ? : string ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfEncodeInitialData = { /**
     * Updated data BOC or BOC handle
     */ data : string ; } ; export type ParamsOfDecodeInitialData = { remarks abi ? : Abi ; /**
     * Data BOC or BOC handle
     */ data : string ; } ; export type ResultOfDecodeInitialData = { remarks initial_data ? : any ; /**
     * Initial account owner's public key
     */ initial_pubkey : string ; } ; export type ParamsOfDecodeBoc = { /**
     * Parameters to decode from BOC
     */ params : AbiParam [ ] ; /**
     * Data BOC or BOC handle
     */ boc : string ; /**
     */ allow_partial : boolean ; } ; export type ResultOfDecodeBoc = { /**
     * Decoded data as a JSON structure.
     */ data : any ; } ; /**
 * Provides message encoding and decoding according to the ABI specification.
 */ export class AbiModule { client : IClient ; constructor ( client ) { this . client = client ; } param { ParamsOfEncodeMessageBody } params returns encode_message_body ( params ) { return this . client . request ( 'abi.encode_message_body' , params ) ; } param { ParamsOfAttachSignatureToMessageBody } params returns attach_signature_to_message_body ( params ) { return this . client . request ( 'abi.attach_signature_to_message_body' , params ) ; } remarks param { ParamsOfEncodeMessage } params returns encode_message ( params ) { return this . client . request ( 'abi.encode_message' , params ) ; } remarks param { ParamsOfEncodeInternalMessage } params returns encode_internal_message ( params ) { return this . client . request ( 'abi.encode_internal_message' , params ) ; } param { ParamsOfAttachSignature } params returns attach_signature ( params ) { return this . client . request ( 'abi.attach_signature' , params ) ; } param { ParamsOfDecodeMessage } params returns decode_message ( params ) { return this . client . request ( 'abi.decode_message' , params ) ; } param { ParamsOfDecodeMessageBody } params returns decode_message_body ( params ) { return this . client . request ( 'abi.decode_message_body' , params ) ; } remarks param { ParamsOfEncodeAccount } params returns encode_account ( params ) { return this . client . request ( 'abi.encode_account' , params ) ; } remarks param { ParamsOfDecodeAccountData } params returns decode_account_data ( params ) { return this . client . request ( 'abi.decode_account_data' , params ) ; } param { ParamsOfUpdateInitialData } params returns update_initial_data ( params ) { return this . client . request ( 'abi.update_initial_data' , params ) ; } remarks param { ParamsOfEncodeInitialData } params returns encode_initial_data ( params ) { return this . client . request ( 'abi.encode_initial_data' , params ) ; } param { ParamsOfDecodeInitialData } params returns decode_initial_data ( params ) { return this . client . request ( 'abi.decode_initial_data' , params ) ; } remarks param { ParamsOfDecodeBoc } params returns decode_boc ( params ) { return this . client . request ( 'abi.decode_boc' , params ) ; } } export type BocCacheType = { type : 'Pinned' ; /**
     */ pin : string ; } | { type : 'Unpinned' ; } ; export function bocCacheTypePinned ( pin ) { return { type : 'Pinned' , pin , } ; } export function bocCacheTypeUnpinned ( ) { return { type : 'Unpinned' , } ; } export enum BocErrorCode { InvalidBoc = 201 , SerializationError = 202 , InappropriateBlock = 203 , MissingSourceBoc = 204 , InsufficientCacheSize = 205 , BocRefNotFound = 206 , InvalidBocRef = 207 } export type ParamsOfParse = { /**
     * BOC encoded as base64
     */ boc : string ; } ; export type ResultOfParse = { /**
     * JSON containing parsed BOC
     */ parsed : any ; } ; export type ParamsOfParseShardstate = { /**
     * BOC encoded as base64
     */ boc : string ; /**
     * Shardstate identificator
     */ id : string ; /**
     * Workchain shardstate belongs to
     */ workchain_id : number ; } ; export type ParamsOfGetBlockchainConfig = { /**
     * Key block BOC or zerostate BOC encoded as base64
     */ block_boc : string ; } ; export type ResultOfGetBlockchainConfig = { /**
     * Blockchain config BOC encoded as base64
     */ config_boc : string ; } ; export type ParamsOfGetBocHash = { /**
     * BOC encoded as base64 or BOC handle
     */ boc : string ; } ; export type ResultOfGetBocHash = { /**
     * BOC root hash encoded with hex
     */ hash : string ; } ; export type ParamsOfGetBocDepth = { /**
     * BOC encoded as base64 or BOC handle
     */ boc : string ; } ; export type ResultOfGetBocDepth = { /**
     * BOC root cell depth
     */ depth : number ; } ; export type ParamsOfGetCodeFromTvc = { /**
     * Contract TVC image or image BOC handle
     */ tvc : string ; } ; export type ResultOfGetCodeFromTvc = { /**
     * Contract code encoded as base64
     */ code : string ; } ; export type ParamsOfBocCacheGet = { /**
     * Reference to the cached BOC
     */ boc_ref : string ; } ; export type ResultOfBocCacheGet = { /**
     * BOC encoded as base64.
     */ boc ? : string ; } ; export type ParamsOfBocCacheSet = { /**
     * BOC encoded as base64 or BOC reference
     */ boc : string ; /**
     * Cache type
     */ cache_type : BocCacheType ; } ; export type ResultOfBocCacheSet = { /**
     * Reference to the cached BOC
     */ boc_ref : string ; } ; export type ParamsOfBocCacheUnpin = { /**
     * Pinned name
     */ pin : string ; remarks boc_ref ? : string ; } ; export type BuilderOp = { type : 'Integer' ; /**
     * Bit size of the value.
     */ size : number ; remarks value : any ; } | { type : 'BitString' ; remarks value : string ; } | { type : 'Cell' ; /**
     * Nested cell builder
     */ builder : BuilderOp [ ] ; } | { type : 'CellBoc' ; /**
     * Nested cell BOC encoded with `base64` or BOC cache key.
     */ boc : string ; } ; export function builderOpInteger ( size , value ) { return { type : 'Integer' , size , value , } ; } export function builderOpBitString ( value ) { return { type : 'BitString' , value , } ; } export function builderOpCell ( builder ) { return { type : 'Cell' , builder , } ; } export function builderOpCellBoc ( boc ) { return { type : 'CellBoc' , boc , } ; } export type ParamsOfEncodeBoc = { /**
     * Cell builder operations.
     */ builder : BuilderOp [ ] ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfEncodeBoc = { /**
     * Encoded cell BOC or BOC cache key.
     */ boc : string ; } ; export type ParamsOfGetCodeSalt = { /**
     * Contract code BOC encoded as base64 or code BOC handle
     */ code : string ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfGetCodeSalt = { remarks salt ? : string ; } ; export type ParamsOfSetCodeSalt = { /**
     * Contract code BOC encoded as base64 or code BOC handle
     */ code : string ; remarks salt : string ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfSetCodeSalt = { remarks code : string ; } ; export type ParamsOfDecodeTvc = { /**
     * Contract TVC image BOC encoded as base64 or BOC handle
     */ tvc : string ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfDecodeTvc = { /**
     * Contract code BOC encoded as base64 or BOC handle
     */ code ? : string ; /**
     * Contract code hash
     */ code_hash ? : string ; /**
     * Contract code depth
     */ code_depth ? : number ; /**
     * Contract data BOC encoded as base64 or BOC handle
     */ data ? : string ; /**
     * Contract data hash
     */ data_hash ? : string ; /**
     * Contract data depth
     */ data_depth ? : number ; /**
     * Contract library BOC encoded as base64 or BOC handle
     */ library ? : string ; remarks tick ? : boolean ; remarks tock ? : boolean ; /**
     * Is present and non-zero only in instances of large smart contracts
     */ split_depth ? : number ; /**
     * Compiler version, for example 'sol 0.49.0'
     */ compiler_version ? : string ; } ; export type ParamsOfEncodeTvc = { /**
     * Contract code BOC encoded as base64 or BOC handle
     */ code ? : string ; /**
     * Contract data BOC encoded as base64 or BOC handle
     */ data ? : string ; /**
     * Contract library BOC encoded as base64 or BOC handle
     */ library ? : string ; remarks tick ? : boolean ; remarks tock ? : boolean ; /**
     * Is present and non-zero only in instances of large smart contracts
     */ split_depth ? : number ; /**
     * Cache type to put the result. The BOC itself returned if no cache type provided.
     */ boc_cache ? : BocCacheType ; } ; export type ResultOfEncodeTvc = { /**
     * Contract TVC image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
     */ tvc : string ; } ; export type ParamsOfGetCompilerVersion = { /**
     * Contract code BOC encoded as base64 or code BOC handle
     */ code : string ; } ; export type ResultOfGetCompilerVersion = { /**
     * Compiler version, for example 'sol 0.49.0'
     */ version ? : string ; } ; /**
 * BOC manipulation module.
 */ export class BocModule { client : IClient ; constructor ( client ) { this . client = client ; } remarks param { ParamsOfParse } params returns parse_message ( params ) { return this . client . request ( 'boc.parse_message' , params ) ; } remarks param { ParamsOfParse } params returns parse_transaction ( params ) { return this . client . request ( 'boc.parse_transaction' , params ) ; } remarks param { ParamsOfParse } params returns parse_account ( params ) { return this . client . request ( 'boc.parse_account' , params ) ; } remarks param { ParamsOfParse } params returns parse_block ( params ) { return this . client . request ( 'boc.parse_block' , params ) ; } remarks param { ParamsOfParseShardstate } params returns parse_shardstate ( params ) { return this . client . request ( 'boc.parse_shardstate' , params ) ; } param { ParamsOfGetBlockchainConfig } params returns get_blockchain_config ( params ) { return this . client . request ( 'boc.get_blockchain_config' , params ) ; } param { ParamsOfGetBocHash } params returns get_boc_hash ( params ) { return this . client . request ( 'boc.get_boc_hash' , params ) ; } param { ParamsOfGetBocDepth } params returns get_boc_depth ( params ) { return this . client . request ( 'boc.get_boc_depth' , params ) ; } param { ParamsOfGetCodeFromTvc } params returns get_code_from_tvc ( params ) { return this . client . request ( 'boc.get_code_from_tvc' , params ) ; } param { ParamsOfBocCacheGet } params returns cache_get ( params ) { return this . client . request ( 'boc.cache_get' , params ) ; } param { ParamsOfBocCacheSet } params returns cache_set ( params ) { return this . client . request ( 'boc.cache_set' , params ) ; } remarks param { ParamsOfBocCacheUnpin } params returns cache_unpin ( params ) { return this . client . request ( 'boc.cache_unpin' , params ) ; } param { ParamsOfEncodeBoc } params returns encode_boc ( params ) { return this . client . request ( 'boc.encode_boc' , params ) ; } param { ParamsOfGetCodeSalt } params returns get_code_salt ( params ) { return this . client . request ( 'boc.get_code_salt' , params ) ; } remarks param { ParamsOfSetCodeSalt } params returns set_code_salt ( params ) { return this . client . request ( 'boc.set_code_salt' , params ) ; } param { ParamsOfDecodeTvc } params returns decode_tvc ( params ) { return this . client . request ( 'boc.decode_tvc' , params ) ; } param { ParamsOfEncodeTvc } params returns encode_tvc ( params ) { return this . client . request ( 'boc.encode_tvc' , params ) ; } param { ParamsOfGetCompilerVersion } params returns get_compiler_version ( params ) { return this . client . request ( 'boc.get_compiler_version' , params ) ; } } export enum ProcessingErrorCode { MessageAlreadyExpired = 501 , MessageHasNotDestinationAddress = 502 , CanNotBuildMessageCell = 503 , FetchBlockFailed = 504 , SendMessageFailed = 505 , InvalidMessageBoc = 506 , MessageExpired = 507 , TransactionWaitTimeout = 508 , InvalidBlockReceived = 509 , CanNotCheckBlockShard = 510 , BlockNotFound = 511 , InvalidData = 512 , ExternalSignerMustNotBeUsed = 513 } export type ProcessingEvent = { type : 'WillFetchFirstBlock' ; } | { type : 'FetchFirstBlockFailed' ; /**
     */ error : ClientError ; } | { type : 'WillSend' ; /**
     */ shard_block_id : string ; /**
     */ message_id : string ; /**
     */ message : string ; } | { type : 'DidSend' ; /**
     */ shard_block_id : string ; /**
     */ message_id : string ; /**
     */ message : string ; } | { type : 'SendFailed' ; /**
     */ shard_block_id : string ; /**
     */ message_id : string ; /**
     */ message : string ; /**
     */ error : ClientError ; } | { type : 'WillFetchNextBlock' ; /**
     */ shard_block_id : string ; /**
     */ message_id : string ; /**
     */ message : string ; } | { type : 'FetchNextBlockFailed' ; /**
     */ shard_block_id : string ; /**
     */ message_id : string ; /**
     */ message : string ; /**
     */ error : ClientError ; } | { type : 'MessageExpired' ; /**
     */ message_id : string ; /**
     */ message : string ; /**
     */ error : ClientError ; } ; export function processingEventWillFetchFirstBlock ( ) { return { type : 'WillFetchFirstBlock' , } ; } export function processingEventFetchFirstBlockFailed ( error ) { return { type : 'FetchFirstBlockFailed' , error , } ; } export function processingEventWillSend ( shard_block_id , message_id , message ) { return { type : 'WillSend' , shard_block_id , message_id , message , } ; } export function processingEventDidSend ( shard_block_id , message_id , message ) { return { type : 'DidSend' , shard_block_id , message_id , message , } ; } export function processingEventSendFailed ( shard_block_id , message_id , message , error ) { return { type : 'SendFailed' , shard_block_id , message_id , message , error , } ; } export function processingEventWillFetchNextBlock ( shard_block_id , message_id , message ) { return { type : 'WillFetchNextBlock' , shard_block_id , message_id , message , } ; } export function processingEventFetchNextBlockFailed ( shard_block_id , message_id , message , error ) { return { type : 'FetchNextBlockFailed' , shard_block_id , message_id , message , error , } ; } export function processingEventMessageExpired ( message_id , message , error ) { return { type : 'MessageExpired' , message_id , message , error , } ; } export type ResultOfProcessMessage = { remarks transaction : any ; remarks out_messages : string [ ] ; /**
     * Optional decoded message bodies according to the optional `abi` parameter.
     */ decoded ? : DecodedOutput ; /**
     * Transaction fees
     */ fees : TransactionFees ; } ; export type DecodedOutput = { remarks out_messages : DecodedMessageBody | null [ ] ; /**
     * Decoded body of the function output message.
     */ output ? : any ; } ; export type ParamsOfSendMessage = { /**
     * Message BOC.
     */ message : string ; remarks abi ? : Abi ; /**
     * Flag for requesting events sending
     */ send_events : boolean ; } ; export type ResultOfSendMessage = { remarks shard_block_id : string ; remarks sending_endpoints : string [ ] ; } ; export type ParamsOfWaitForTransaction = { remarks abi ? : Abi ; remarks message : string ; remarks shard_block_id : string ; /**
     * Flag that enables/disables intermediate events
     */ send_events : boolean ; remarks sending_endpoints ? : string [ ] ; } ; export type ParamsOfProcessMessage = { /**
     * Message encode parameters.
     */ message_encode_params : ParamsOfEncodeMessage ; /**
     * Flag for requesting events sending
     */ send_events : boolean ; } ; remarks export class ProcessingModule { client : IClient ; constructor ( client ) { this . client = client ; } remarks param { ParamsOfSendMessage } params returns send_message ( params , responseHandler ? ) { return this . client . request ( 'processing.send_message' , params , responseHandler ) ; } remarks param { ParamsOfWaitForTransaction } params returns wait_for_transaction ( params , responseHandler ? ) { return this . client . request ( 'processing.wait_for_transaction' , params , responseHandler ) ; } remarks param { ParamsOfProcessMessage } params returns process_message ( params , responseHandler ? ) { return this . client . request ( 'processing.process_message' , params , responseHandler ) ; } } export type AddressStringFormat = { type : 'AccountId' ; } | { type : 'Hex' ; } | { type : 'Base64' ; /**
     */ url : boolean ; /**
     */ test : boolean ; /**
     */ bounce : boolean ; } ; export function addressStringFormatAccountId ( ) { return { type : 'AccountId' , } ; } export function addressStringFormatHex ( ) { return { type : 'Hex' , } ; } export function addressStringFormatBase64 ( url , test , bounce ) { return { type : 'Base64' , url , test , bounce , } ; } export enum AccountAddressType { AccountId = "AccountId" , Hex = "Hex" , Base64 = "Base64" } export type ParamsOfConvertAddress = { /**
     * Account address in any TON format.
     */ address : string ; /**
     * Specify the format to convert to.
     */ output_format : AddressStringFormat ; } ; export type ResultOfConvertAddress = { /**
     * Address in the specified format
     */ address : string ; } ; export type ParamsOfGetAddressType = { /**
     * Account address in any TON format.
     */ address : string ; } ; export type ResultOfGetAddressType = { /**
     * Account address type.
     */ address_type : AccountAddressType ; } ; export type ParamsOfCalcStorageFee = { /**
     */ account : string ; /**
     */ period : number ; } ; export type ResultOfCalcStorageFee = { /**
     */ fee : string ; } ; export type ParamsOfCompressZstd = { remarks uncompressed : string ; /**
     * 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`).
     */ level ? : number ; } ; export type ResultOfCompressZstd = { remarks compressed : string ; } ; export type ParamsOfDecompressZstd = { remarks compressed : string ; } ; export type ResultOfDecompressZstd = { remarks decompressed : string ; } ; /**
 * Misc utility Functions.
 */ export class UtilsModule { client : IClient ; constructor ( client ) { this . client = client ; } param { ParamsOfConvertAddress } params returns convert_address ( params ) { return this . client . request ( 'utils.convert_address' , params ) ; } remarks param { ParamsOfGetAddressType } params returns get_address_type ( params ) { return this . client . request ( 'utils.get_address_type' , params ) ; } param { ParamsOfCalcStorageFee } params returns calc_storage_fee ( params ) { return this . client . request ( 'utils.calc_storage_fee' , params ) ; } param { ParamsOfCompressZstd } params returns compress_zstd ( params ) { return this . client . request ( 'utils.compress_zstd' , params ) ; } param { ParamsOfDecompressZstd } params returns decompress_zstd ( params ) { return this . client . request ( 'utils.decompress_zstd' , params ) ; } } export enum TvmErrorCode { CanNotReadTransaction = 401 , CanNotReadBlockchainConfig = 402 , TransactionAborted = 403 , InternalError = 404 , ActionPhaseFailed = 405 , AccountCodeMissing = 406 , LowBalance = 407 , AccountFrozenOrDeleted = 408 , AccountMissing = 409 , UnknownExecutionError = 410 , InvalidInputStack = 411 , InvalidAccountBoc = 412 , InvalidMessageType = 413 , ContractExecutionError = 414 } export type ExecutionOptions = { /**
     * boc with config
     */ blockchain_config ? : string ; /**
     * time that is used as transaction time
     */ block_time ? : number ; /**
     * block logical time
     */ block_lt ? : bigint ; /**
     * transaction logical time
     */ transaction_lt ? : bigint ; } ; export type AccountForExecutor = { type : 'None' ; } | { type : 'Uninit' ; } | { type : 'Account' ; remarks boc : string ; remarks unlimited_balance ? : boolean ; } ; export function accountForExecutorNone ( ) { return { type : 'None' , } ; } export function accountForExecutorUninit ( ) { return { type : 'Uninit' , } ; } export function accountForExecutorAccount ( boc , unlimited_balance ? ) { return { type : 'Account' , boc , unlimited_balance , } ; } export type TransactionFees = { /**
     */ in_msg_fwd_fee : bigint ; /**
     */ storage_fee : bigint ; /**
     */ gas_fee : bigint ; /**
     */ out_msgs_fwd_fee : bigint ; /**
     */ total_account_fees : bigint ; /**
     */ total_output : bigint ; } ; export type ParamsOfRunExecutor = { remarks message : string ; /**
     * Account to run on executor
     */ account : AccountForExecutor ; /**
     * Execution options.
     */ execution_options ? : ExecutionOptions ; /**
     * Contract ABI for decoding output messages
     */ abi ? : Abi ; /**
     * Skip transaction check flag
     */ skip_transaction_check ? : boolean ; remarks boc_cache ? : BocCacheType ; remarks return_updated_account ? : boolean ; } ; export type ResultOfRunExecutor = { remarks transaction : any ; remarks out_messages : string [ ] ; /**
     * Optional decoded message bodies according to the optional `abi` parameter.
     */ decoded ? : DecodedOutput ; remarks account : string ; /**
     * Transaction fees
     */ fees : TransactionFees ; } ; export type ParamsOfRunTvm = { remarks message : string ; remarks account : string ; /**
     * Execution options.
     */ execution_options ? : ExecutionOptions ; /**
     * Contract ABI for decoding output messages
     */ abi ? : Abi ; remarks boc_cache ? : BocCacheType ; remarks return_updated_account ? : boolean ; } ; export type ResultOfRunTvm = { remarks out_messages : string [ ] ; /**
     * Optional decoded message bodies according to the optional `abi` parameter.
     */ decoded ? : DecodedOutput ; remarks account : string ; } ; export type ParamsOfRunGet = { /**
     * Account BOC in `base64`
     */ account : string ; /**
     * Function name
     */ function_name : string ; /**
     * Input parameters
     */ input ? : any ; /**
     * Execution options
     */ execution_options ? : ExecutionOptions ; remarks tuple_list_as_array ? : boolean ; } ; export type ResultOfRunGet = { /**
     * Values returned by get-method on stack
     */ output : any ; } ; /**
 */ export class TvmModule { client : IClient ; constructor ( client ) { this . client = client ; } remarks param { ParamsOfRunExecutor } params returns run_executor ( params ) { return this . client . request ( 'tvm.run_executor' , params ) ; } remarks param { ParamsOfRunTvm } params returns run_tvm ( params ) { return this . client . request ( 'tvm.run_tvm' , params ) ; } remarks param { ParamsOfRunGet } params returns run_get ( params ) { return this . client . request ( 'tvm.run_get' , params ) ; } } export enum NetErrorCode { QueryFailed = 601 , SubscribeFailed = 602 , WaitForFailed = 603 , GetSubscriptionResultFailed = 604 , InvalidServerResponse = 605 , ClockOutOfSync = 606 , WaitForTimeout = 607 , GraphqlError = 608 , NetworkModuleSuspended = 609 , WebsocketDisconnected = 610 , NotSupported = 611 , NoEndpointsProvided = 612 , GraphqlWebsocketInitError = 613 , NetworkModuleResumed = 614 } export type OrderBy = { /**
     */ path : string ; /**
     */ direction : SortDirection ; } ; export enum SortDirection { ASC = "ASC" , DESC = "DESC" } export type ParamsOfQueryOperation = ( { type : 'QueryCollection' ; } & ParamsOfQueryCollection ) | ( { type : 'WaitForCollection' ; } & ParamsOfWaitForCollection ) | ( { type : 'AggregateCollection' ; } & ParamsOfAggregateCollection ) | ( { type : 'QueryCounterparties' ; } & ParamsOfQueryCounterparties ) ; export function paramsOfQueryOperationQueryCollection ( params ) { return { type : 'QueryCollection' , ... params , } ; } export function paramsOfQueryOperationWaitForCollection ( params ) { return { type : 'WaitForCollection' , ... params , } ; } export function paramsOfQueryOperationAggregateCollection ( params ) { return { type : 'AggregateCollection' , ... params , } ; } export function paramsOfQueryOperationQueryCounterparties ( params ) { return { type : 'QueryCounterparties' , ... params , } ; } export type FieldAggregation = { /**
     * Dot separated path to the field
     */ field : string ; /**
     * Aggregation function that must be applied to field values
     */ fn : AggregationFn ; } ; export enum AggregationFn { COUNT = "COUNT" , MIN = "MIN" , MAX = "MAX" , SUM = "SUM" , AVERAGE = "AVERAGE" } export type TransactionNode = { /**
     * Transaction id.
     */ id : string ; /**
     * In message id.
     */ in_msg : string ; /**
     * Out message ids.
     */ out_msgs : string [ ] ; /**
     * Account address.
     */ account_addr : string ; /**
     * Transactions total fees.
     */ total_fees : string ; /**
     * Aborted flag.
     */ aborted : boolean ; /**
     * Compute phase exit code.
     */ exit_code ? : number ; } ; export type MessageNode = { /**
     * Message id.
     */ id : string ; remarks src_transaction_id ? : string ; remarks dst_transaction_id ? : string ; /**
     * Source address.
     */ src ? : string ; /**
     * Destination address.
     */ dst ? : string ; /**
     * Transferred tokens value.
     */ value ? : string ; /**
     * Bounce flag.
     */ bounce : boolean ; remarks decoded_body ? : DecodedMessageBody ; } ; export type ParamsOfQuery = { /**
     * GraphQL query text.
     */ query : string ; remarks variables ? : any ; } ; export type ResultOfQuery = { /**
     * Result provided by DAppServer.
     */ result : any ; } ; export type ParamsOfBatchQuery = { /**
     * List of query operations that must be performed per single fetch.
     */ operations : ParamsOfQueryOperation [ ] ; } ; export type ResultOfBatchQuery = { remarks results : any [ ] ; } ; export type ParamsOfQueryCollection = { /**
     * Collection name (accounts, blocks, transactions, messages, block_signatures)
     */ collection : string ; /**
     * Collection filter
     */ filter ? : any ; /**
     * Projection (result) string
     */ result : string ; /**
     * Sorting order
     */ order ? : OrderBy [ ] ; /**
     * Number of documents to return
     */ limit ? : number ; } ; export type ResultOfQueryCollection = { /**
     * Objects that match the provided criteria
     */ result : any [ ] ; } ; export type ParamsOfAggregateCollection = { /**
     * Collection name (accounts, blocks, transactions, messages, block_signatures)
     */ collection : string ; /**
     * Collection filter
     */ filter ? : any ; /**
     * Projection (result) string
     */ fields ? : FieldAggregation [ ] ; } ; export type ResultOfAggregateCollection = { remarks values : any ; } ; export type ParamsOfWaitForCollection = { /**
     * Collection name (accounts, blocks, transactions, messages, block_signatures)
     */ collection : string ; /**
     * Collection filter
     */ filter ? : any ; /**
     * Projection (result) string
     */ result : string ; /**
     * Query timeout
     */ timeout ? : number ; } ; export type ResultOfWaitForCollection = { /**
     * First found object that matches the provided criteria
     */ result : any ; } ; export type ResultOfSubscribeCollection = { remarks handle : number ; } ; export type ParamsOfSubscribeCollection = { /**
     * Collection name (accounts, blocks, transactions, messages, block_signatures)
     */ collection : string ; /**
     * Collection filter
     */ filter ? : any ; /**
     * Projection (result) string
     */ result : string ; } ; export type ParamsOfFindLastShardBlock = { /**
     * Account address
     */ address : string ; } ; export type ResultOfFindLastShardBlock = { /**
     * Account shard last block ID
     */ block_id : string ; } ; export type EndpointsSet = { /**
     * List of endpoints provided by server
     */ endpoints : string [ ] ; } ; export type ResultOfGetEndpoints = { /**
     * Current query endpoint
     */ query : string ; /**
     * List of all endpoints used by client
     */ endpoints : string [ ] ; } ; export type ParamsOfQueryCounterparties = { /**
     * Account address
     */ account : string ; /**
     * Projection (result) string
     */ result : string ; /**
     * Number of counterparties to return
     */ first ? : number ; /**
     * `cursor` field of the last received result
     */ after ? : string ; } ; export type ParamsOfQueryTransactionTree = { /**
     * Input message id.
     */ in_msg : string ; /**
     * List of contract ABIs that will be used to decode message bodies. Library will try to decode each returned message body using any ABI from the registry.
     */ abi_registry ? : Abi [ ] ; remarks timeout ? : number ; } ; export type ResultOfQueryTransactionTree = { /**
     * Messages.
     */ messages : MessageNode [ ] ; /**
     * Transactions.
     */ transactions : TransactionNode [ ] ; } ; export type ParamsOfCreateBlockIterator = { remarks start_time ? : number ; remarks end_time ? : number ; remarks shard_filter ? : string [ ] ; remarks result ? : string ; } ; export type RegisteredIterator = { remarks handle : number ; } ; export type ParamsOfResumeBlockIterator = { remarks resume_state : any ; } ; export type ParamsOfCreateTransactionIterator = { remarks start_time ? : number ; remarks end_time ? : number ; remarks shard_filter ? : string [ ] ; remarks accounts_filter ? : string [ ] ; remarks result ? : string ; remarks include_transfers ? : boolean ; } ; export type ParamsOfResumeTransactionIterator = { remarks resume_state : any ; remarks accounts_filter ? : string [ ] ; } ; export type ParamsOfIteratorNext = { /**
     * Iterator handle
     */ iterator : number ; remarks limit ? : number ; /**
     * Indicates that function must return the iterator state that can be used for resuming iteration.
     */ return_resume_state ? : boolean ; } ; export type ResultOfIteratorNext = { remarks items : any [ ] ; /**
     * Indicates that there are more available items in iterated range.
     */ has_more : boolean ; remarks resume_state ? : any ; } ; /**
 * Network access.
 */ export class NetModule { client : IClient ; constructor ( client ) { this . client = client ; } param { ParamsOfQuery } params returns query ( params ) { return this . client . request ( 'net.query' , params ) ; } param { ParamsOfBatchQuery } params returns batch_query ( params ) { return this . client . request ( 'net.batch_query' , params ) ; } remarks param { ParamsOfQueryCollection } params returns query_collection ( params ) { return this . client . request ( 'net.query_collection' , params ) ; } remarks param { ParamsOfAggregateCollection } params returns aggregate_collection ( params ) { return this . client . request ( 'net.aggregate_collection' , params ) ; } remarks param { ParamsOfWaitForCollection } params returns wait_for_collection ( params ) { return this . client . request ( 'net.wait_for_collection' , params ) ; } remarks param { ResultOfSubscribeCollection } params returns unsubscribe ( params ) { return this . client . request ( 'net.unsubscribe' , params ) ; } remarks param { ParamsOfSubscribeCollection } params returns subscribe_collection ( params , responseHandler ? ) { return this . client . request ( 'net.subscribe_collection' , params , responseHandler ) ; } returns suspend ( ) { return this . client . request ( 'net.suspend' ) ; } returns resume ( ) { return this . client . request ( 'net.resume' ) ; } param { ParamsOfFindLastShardBlock } params returns find_last_shard_block ( params ) { return this . client . request ( 'net.find_last_shard_block' , params ) ; } returns fetch_endpoints ( ) { return this . client . request ( 'net.fetch_endpoints' ) ; } param { EndpointsSet } params returns set_endpoints ( params ) { return this . client . request ( 'net.set_endpoints' , params ) ; } returns get_endpoints ( ) { return this . client . request ( 'net.get_endpoints' ) ; } remarks param { ParamsOfQueryCounterparties } params returns query_counterparties ( params ) { return this . client . request ( 'net.query_counterparties' , params ) ; } remarks param { ParamsOfQueryTransactionTree } params returns query_transaction_tree ( params ) { return this . client . request ( 'net.query_transaction_tree' , params ) ; } remarks param { ParamsOfCreateBlockIterator } params returns create_block_iterator ( params ) { return this . client . request ( 'net.create_block_iterator' , params ) ; } remarks param { ParamsOfResumeBlockIterator } params returns resume_block_iterator ( params ) { return this . client . request ( 'net.resume_block_iterator' , params ) ; } remarks param { ParamsOfCreateTransactionIterator } params returns create_transaction_iterator ( params ) { return this . client . request ( 'net.create_transaction_iterator' , params ) ; } remarks param { ParamsOfResumeTransactionIterator } params returns resume_transaction_iterator ( params ) { return this . client . request ( 'net.resume_transaction_iterator' , params ) ; } remarks param { ParamsOfIteratorNext } params returns iterator_next ( params ) { return this . client . request ( 'net.iterator_next' , params ) ; } remarks param { RegisteredIterator } params returns remove_iterator ( params ) { return this . client . request ( 'net.remove_iterator' , params ) ; } } export enum DebotErrorCode { DebotStartFailed = 801 , DebotFetchFailed = 802 , DebotExecutionFailed = 803 , DebotInvalidHandle = 804 , DebotInvalidJsonParams = 805 , DebotInvalidFunctionId = 806 , DebotInvalidAbi = 807 , DebotGetMethodFailed = 808 , DebotInvalidMsg = 809 , DebotExternalCallFailed = 810 , DebotBrowserCallbackFailed = 811 , DebotOperationRejected = 812 , DebotNoCode = 813 } export type DebotHandle = number ; export type DebotAction = { remarks description : string ; remarks name : string ; /**
     * Action type.
     */ action_type : number ; /**
     * ID of debot context to switch after action execution.
     */ to : number ; remarks attributes : string ; remarks misc : string ; } ; export type DebotInfo = { /**
     * DeBot short name.
     */ name ? : string ; /**
     * DeBot semantic version.
     */ version ? : string ; /**
     * The name of DeBot deployer.
     */ publisher ? : string ; /**
     * Short info about DeBot.
     */ caption ? : string ; /**
     * The name of DeBot developer.
     */ author ? : string ; /**
     * TON address of author for questions and donations.
     */ support ? : string ; /**
     * String with the first messsage from DeBot.
     */ hello ? : string ; /**
     * String with DeBot interface language (ISO-639).
     */ language ? : string ; /**
     * String with DeBot ABI.
     */ dabi ? : string ; /**
     * DeBot icon.
     */ icon ? : string ; /**
     * Vector with IDs of DInterfaces used by DeBot.
     */ interfaces : string [ ] ; /**
     * ABI version ("x.y") supported by DeBot
     */ dabiVersion : string ; } ; export type DebotActivity = { type : 'Transaction' ; /**
     * External inbound message BOC.
     */ msg : string ; /**
     * Target smart contract address.
     */ dst : string ; /**
     * List of spendings as a result of transaction.
     */ out : Spending [ ] ; /**
     * Transaction total fee.
     */ fee : bigint ; /**
     * Indicates if target smart contract updates its code.
     */ setcode : boolean ; /**
     * Public key from keypair that was used to sign external message.
     */ signkey : string ; /**
     * Signing box handle used to sign external message.
     */ signing_box_handle : number ; } ; export function debotActivityTransaction ( msg , dst , out , fee , setcode , signkey , signing_box_handle ) { return { type : 'Transaction' , msg , dst , out , fee , setcode , signkey , signing_box_handle , } ; } export type Spending = { /**
     * Amount of nanotokens that will be sent to `dst` address.
     */ amount : bigint ; /**
     * Destination address of recipient of funds.
     */ dst : string ; } ; export type ParamsOfInit = { /**
     * Debot smart contract address
     */ address : string ; } ; export type RegisteredDebot = { /**
     * Debot handle which references an instance of debot engine.
     */ debot_handle : DebotHandle ; /**
     * Debot abi as json string.
     */ debot_abi : string ; /**
     * Debot metadata.
     */ info : DebotInfo ; } ; export type ParamsOfAppDebotBrowser = { type : 'Log' ; /**
     * A string that must be printed to user.
     */ msg : string ; } | { type : 'Switch' ; /**
     * Debot context ID to which debot is switched.
     */ context_id : number ; } | { type : 'SwitchCompleted' ; } | { type : 'ShowAction' ; /**
     * Debot action that must be shown to user as menu item. At least `description` property must be shown from [DebotAction] structure.
     */ action : DebotAction ; } | { type : 'Input' ; /**
     * A prompt string that must be printed to user before input request.
     */ prompt : string ; } | { type : 'GetSigningBox' ; } | { type : 'InvokeDebot' ; /**
     * Address of debot in blockchain.
     */ debot_addr : string ; /**
     * Debot action to execute.
     */ action : DebotAction ; } | { type : 'Send' ; remarks message : string ; } | { type : 'Approve' ; /**
     * DeBot activity details.
     */ activity : DebotActivity ; } ; export function paramsOfAppDebotBrowserLog ( msg ) { return { type : 'Log' , msg , } ; } export function paramsOfAppDebotBrowserSwitch ( context_id ) { return { type : 'Switch' , context_id , } ; } export function paramsOfAppDebotBrowserSwitchCompleted ( ) { return { type : 'SwitchCompleted' , } ; } export function paramsOfAppDebotBrowserShowAction ( action ) { return { type : 'ShowAction' , action , } ; } export function paramsOfAppDebotBrowserInput ( prompt ) { return { type : 'Input' , prompt , } ; } export function paramsOfAppDebotBrowserGetSigningBox ( ) { return { type : 'GetSigningBox' , } ; } export function paramsOfAppDebotBrowserInvokeDebot ( debot_addr , action ) { return { type : 'InvokeDebot' , debot_addr , action , } ; } export function paramsOfAppDebotBrowserSend ( message ) { return { type : 'Send' , message , } ; } export function paramsOfAppDebotBrowserApprove ( activity ) { return { type : 'Approve' , activity , } ; } export type ResultOfAppDebotBrowser = { type : 'Input' ; /**
     * String entered by user.
     */ value : string ; } | { type : 'GetSigningBox' ; remarks signing_box : SigningBoxHandle ; } | { type : 'InvokeDebot' ; } | { type : 'Approve' ; /**
     * Indicates whether the DeBot is allowed to perform the specified operation.
     */ approved : boolean ; } ; export function resultOfAppDebotBrowserInput ( value ) { return { type : 'Input' , value , } ; } export function resultOfAppDebotBrowserGetSigningBox ( signing_box ) { return { type : 'GetSigningBox' , signing_box , } ; } export function resultOfAppDebotBrowserInvokeDebot ( ) { return { type : 'InvokeDebot' , } ; } export function resultOfAppDebotBrowserApprove ( approved ) { return { type : 'Approve' , approved , } ; } export type ParamsOfStart = { /**
     * Debot handle which references an instance of debot engine.
     */ debot_handle : DebotHandle ; } ; export type ParamsOfFetch = { /**
     * Debot smart contract address.
     */ address : string ; } ; export type ResultOfFetch = { /**
     * Debot metadata.
     */ info : DebotInfo ; } ; export type ParamsOfExecute = { /**
     * Debot handle which references an instance of debot engine.
     */ debot_handle : DebotHandle ; /**
     * Debot Action that must be executed.
     */ action : DebotAction ; } ; export type ParamsOfSend = { /**
     * Debot handle which references an instance of debot engine.
     */ debot_handle : DebotHandle ; /**
     * BOC of internal message to debot encoded in base64 format.
     */ message : string ; } ; export type ParamsOfRemove = { /**
     * Debot handle which references an instance of debot engine.
     */ debot_handle : DebotHandle ; } ; type ParamsOfAppDebotBrowserLog = { msg : string ; } ; type ParamsOfAppDebotBrowserSwitch = { context_id : number ; } ; type ParamsOfAppDebotBrowserShowAction = { action : DebotAction ; } ; type ParamsOfAppDebotBrowserInput = { prompt : string ; } ; type ResultOfAppDebotBrowserInput = { value : string ; } ; type ResultOfAppDebotBrowserGetSigningBox = { signing_box : SigningBoxHandle ; } ; type ParamsOfAppDebotBrowserInvokeDebot = { debot_addr : string ; action : DebotAction ; } ; type ParamsOfAppDebotBrowserSend = { message : string ; } ; type ParamsOfAppDebotBrowserApprove = { activity : DebotActivity ; } ; type ResultOfAppDebotBrowserApprove = { approved : boolean ; } ; export interface AppDebotBrowser { log ( params ) : void ; switch ( params ) : void ; switch_completed ( ) : void ; show_action ( params ) : void ; input ( params ) : Promise < ResultOfAppDebotBrowserInput > ; get_signing_box ( ) : Promise < ResultOfAppDebotBrowserGetSigningBox > ; invoke_debot ( params ) : Promise < void > ; send ( params ) : void ; approve ( params ) : Promise < ResultOfAppDebotBrowserApprove > ; } async function dispatchAppDebotBrowser ( obj , params , app_request_id , client ) { try { let result = { } ; switch ( params . type ) { case 'Log' : obj . log ( params ) ; break ; case 'Switch' : obj . switch ( params ) ; break ; case 'SwitchCompleted' : obj . switch_completed ( ) ; break ; case 'ShowAction' : obj . show_action ( params ) ; break ; case 'Input' : result = await obj . input ( params ) ; break ; case 'GetSigningBox' : result = await obj . get_signing_box ( ) ; break ; case 'InvokeDebot' : await obj . invoke_debot ( params ) ; break ; case 'Send' : obj . send ( params ) ; break ; case 'Approve' : result = await obj . approve ( params ) ; break ; } client . resolve_app_request ( app_request_id , { type : params . type , ... result } ) ; } catch ( error ) { client . reject_app_request ( app_request_id , error ) ; } } /**
 * [UNSTABLE](UNSTABLE.md) Module for working with debot.
 */ export class DebotModule { client : IClient ; constructor ( client ) { this . client = client ; } remarks param { ParamsOfInit } params returns init ( params , obj ) { return this . client . request ( 'debot.init' , params , ( params , responseType ) => { if ( responseType === 3 ) { dispatchAppDebotBrowser ( obj , params . request_data , params . app_request_id , this . client ) ; } else if ( responseType === 4 ) { dispatchAppDebotBrowser ( obj , params , null , this . client ) ; } } ) ; } remarks param { ParamsOfStart } params returns start ( params ) { return this . client . request ( 'debot.start' , params ) ; } remarks param { ParamsOfFetch } params returns fetch ( params ) { return this . client . request ( 'debot.fetch' , params ) ; } remarks param { ParamsOfExecute } params returns execute ( params ) { return this . client . request ( 'debot.execute' , params ) ; } remarks param { ParamsOfSend } params returns send ( params ) { return this . client . request ( 'debot.send' , params ) ; } remarks param { ParamsOfRemove } params returns remove ( params ) { return this . client . request ( 'debot.remove' , params ) ; } } export enum ProofsErrorCode { InvalidData = 901 , ProofCheckFailed = 902 , InternalError = 903 , DataDiffersFromProven = 904 } export type ParamsOfProofBlockData = { /**
     * Single block's data, retrieved from TONOS API, that needs proof. Required fields are `id` and/or top-level `boc` (for block identification), others are optional.
     */ block : any ; } ; export type ParamsOfProofTransactionData = { /**
     * Single transaction's data as queried from DApp server, without modifications. The required fields are `id` and/or top-level `boc`, others are optional. In order to reduce network requests count, it is recommended to provide `block_id` and `boc` of transaction.
     */ transaction : any ; } ; export type ParamsOfProofMessageData = { /**
     * Single message's data as queried from DApp server, without modifications. The required fields are `id` and/or top-level `boc`, others are optional. In order to reduce network requests count, it is recommended to provide at least `boc` of message and non-null `src_transaction.id` or `dst_transaction.id`.
     */ message : any ; } ; /**
 * [UNSTABLE](UNSTABLE.md) Module for proving data, retrieved from TONOS API.
 */ export class ProofsModule { client : IClient ; constructor ( client ) { this . client = client ; } remarks param { ParamsOfProofBlockData } params returns proof_block_data ( params ) { return this . client . request ( 'proofs.proof_block_data' , params ) ; } remarks param { ParamsOfProofTransactionData } params returns proof_transaction_data ( params ) { return this . client . request ( 'proofs.proof_transaction_data' , params ) ; } remarks param { ParamsOfProofMessageData } params returns proof_message_data ( params ) { return this . client . request ( 'proofs.proof_message_data' , params ) ; } }