From 0e4f88f3951cc58d364fd481f45cbcf973fb6d7e Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Fri, 6 May 2022 10:02:46 +0300 Subject: [PATCH 01/19] NEW: doc for enums --- tools/ts-code.ts | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/tools/ts-code.ts b/tools/ts-code.ts index 811cf9105..3b158a353 100644 --- a/tools/ts-code.ts +++ b/tools/ts-code.ts @@ -69,7 +69,11 @@ export function typeName(fullName: string) { } function jsDocStart(element: Documented, indent: string = ""): string { - let ts = `\n${indent}/**`; + return `\n${indent}/**${jsDocNext(element, indent)}`; +} + +function jsDocNext(element: Documented, indent: string = ""): string { + let ts = ""; if (element.summary) { ts += jsDoc(element.summary, indent); } @@ -90,7 +94,26 @@ function jsDocEnd(indent: string = ""): string { } function elementJsDoc(element: Documented, indent: string = ""): string { - return `${jsDocStart(element, indent)}${jsDocEnd(indent)}`; + return element.summary || element.description ? + `${jsDocStart(element, indent)}${jsDocEnd(indent)}` + : ""; +} + +function enumOfTypesJsDoc(type: ApiEnumOfTypes, indent = "") { + let ts = jsDocStart(type); + ts += jsDoc("\nDepends on `type` field.\n", indent); + for (const variant of type.enum_types) { + ts += jsDoc(`\n### \`${variant.name}\`\n`, indent); + if (variant.summary) { + ts += jsDoc(variant.summary, indent); + } + if (variant.description) { + ts += jsDoc("", indent); + ts += jsDoc(variant.description, indent); + } + } + ts += jsDocEnd(indent); + return ts; } function getRefName(type: ApiType): string { @@ -106,6 +129,12 @@ export class TSCode extends Code { let ts = `// ${module.name} module\n\n`; for (const type of module.types) { + if (type.type === ApiTypeIs.EnumOfTypes) { + ts += enumOfTypesJsDoc(type); + } else { + ts += elementJsDoc(type); + } + ts += `\nexport ${this.typeDef(type, true)}`; if (type.type === ApiTypeIs.EnumOfTypes) { ts += this.typeVariantConstructors(type.name, type); @@ -232,7 +261,11 @@ export class ${Code.upperFirst(module.name)}Module { case ApiTypeIs.Array: return `${this.type(type.array_item, indent)}[]`; case ApiTypeIs.EnumOfConsts: - const variants = type.enum_consts.map(c => this.constVariant(c, `${indent} `, includeDoc)); + const variants = type.enum_consts.map(c => this.constVariant( + c, + `${indent} `, + includeDoc, + )); return `{\n${variants.join(",\n")}\n${indent}}`; case ApiTypeIs.BigInt: return "bigint"; @@ -250,7 +283,9 @@ export class ${Code.upperFirst(module.name)}Module { } typeDef(type: ApiField, includeDoc?: boolean): string { - const decl = type.type === ApiTypeIs.EnumOfConsts ? `enum ${type.name}` : `type ${type.name} =`; + const decl = type.type === ApiTypeIs.EnumOfConsts + ? `enum ${type.name}` + : `type ${type.name} =`; return `${decl} ${this.type(type, "", includeDoc)}\n`; } @@ -271,7 +306,7 @@ export class ${Code.upperFirst(module.name)}Module { const paramsInfo = this.getFunctionInfo(func); const paramsDecls = this.paramsDecls(paramsInfo); const paramsDecl = paramsDecls.length > 0 ? `\n${paramsDecls.map(p => ` ${p},`) - .join("\n")}\n` : ""; + .join("\n")}\n` : ""; const resultDecl = this.type(func.result, ""); return `function ${func.name}(${paramsDecl}): Promise<${resultDecl}>;`; } From d17e999c5232dc488572d64896155e2594047b75 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Fri, 6 May 2022 13:17:11 +0300 Subject: [PATCH 02/19] NEW: separate types for each type enum variant --- tools/api.ts | 37 +++++++++++++++++++++++++++++++++++-- tools/ts-code.ts | 15 +-------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/tools/api.ts b/tools/api.ts index 21de74fed..fb87c4b41 100644 --- a/tools/api.ts +++ b/tools/api.ts @@ -160,6 +160,39 @@ export function parseApi(json: any): Api { const types = new Map(); for (const module of api.modules) { module.api = api; + const originalTypes = module.types; + module.types = []; + for (const type of originalTypes) { + if (type.type === ApiTypeIs.EnumOfTypes) { + const originalVariants = type.enum_types; + type.enum_types = []; + for (const variant of originalVariants) { + if (variant.type === ApiTypeIs.Struct) { + const name = `${type.name}${variant.name}Variant`; + const variantType: ApiField ={ + module, + name, + summary: variant.summary, + description: variant.description, + type: ApiTypeIs.Struct, + struct_fields: variant.struct_fields + } ; + module.types.push(variantType) + type.enum_types.push({ + module, + name: variant.name, + summary: variant.summary, + description: variant.description, + type: ApiTypeIs.Ref, + ref_name: name, + }); + } else { + type.enum_types.push(variant); + } + } + } + module.types.push(type); + } for (const type of module.types) { type.module = module; types.set(`${module.name}.${type.name}`, type); @@ -257,7 +290,7 @@ export abstract class Code { const result = resolvedResult.enum_types.find(x => x.name === params.name); const functionParams: ApiField[] = []; if (params.type === ApiTypeIs.Struct && params.struct_fields.length > 0) { - const paramsTypeName = `ParamsOf${obj.name}${params.name}`; + const paramsTypeName = `ParamsOf${obj.name}${params.name}Variant`; obj.types.push({ ...params, module: obj, @@ -271,7 +304,7 @@ export abstract class Code { }); } - const resultTypeName = `ResultOf${obj.name}${params.name}`; + const resultTypeName = `ResultOf${obj.name}${params.name}Variant`; if (result && result.type === ApiTypeIs.Struct && result.struct_fields.length > 0) { obj.types.push({ ...result, diff --git a/tools/ts-code.ts b/tools/ts-code.ts index 3b158a353..6cc4c21de 100644 --- a/tools/ts-code.ts +++ b/tools/ts-code.ts @@ -20,7 +20,6 @@ import { ApiFunction, ApiFunctionInfo, ApiModule, - ApiStruct, ApiType, ApiTypeIs, Code, @@ -107,10 +106,6 @@ function enumOfTypesJsDoc(type: ApiEnumOfTypes, indent = "") { if (variant.summary) { ts += jsDoc(variant.summary, indent); } - if (variant.description) { - ts += jsDoc("", indent); - ts += jsDoc(variant.description, indent); - } } ts += jsDocEnd(indent); return ts; @@ -195,19 +190,11 @@ export class ${Code.upperFirst(module.name)}Module { return fields.map(f => this.field(f, indent, includeDoc)).join(",\n"); } - typeVariantStructFields(variant: ApiStruct, _indent: string): ApiField[] { - const fields = variant.struct_fields; - if (fields.length === 0) { - return fields; - } - return fields; - } - typeVariant(variant: ApiField, indent: string, includeDoc?: boolean): string { if (variant.type === ApiTypeIs.Ref) { return `({\n${indent} type: '${variant.name}'\n${indent}} & ${typeName(variant.ref_name)})`; } else if (variant.type === ApiTypeIs.Struct) { - const fields = this.typeVariantStructFields(variant, indent); + const fields = variant.struct_fields; let fieldsDecl: string; if (fields.length === 0) { fieldsDecl = ""; From 9015849c9451c0821809c781713f4da2b46df0b1 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Tue, 10 May 2022 11:01:58 +0300 Subject: [PATCH 03/19] FIX: binding gen backward compatibility --- tools/api.ts | 36 ++++++++++++++++++++++++++++-------- tools/ts-code.ts | 28 +++++++++++++++++----------- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/tools/api.ts b/tools/api.ts index fb87c4b41..3f97c822a 100644 --- a/tools/api.ts +++ b/tools/api.ts @@ -26,6 +26,7 @@ export type ApiField = ApiType & { name: string, summary?: string, description?: string, + isInternal?: boolean, } export enum ApiConstValueIs { @@ -169,22 +170,23 @@ export function parseApi(json: any): Api { for (const variant of originalVariants) { if (variant.type === ApiTypeIs.Struct) { const name = `${type.name}${variant.name}Variant`; - const variantType: ApiField ={ + const variantType: ApiField = { module, name, summary: variant.summary, description: variant.description, type: ApiTypeIs.Struct, - struct_fields: variant.struct_fields - } ; - module.types.push(variantType) + struct_fields: variant.struct_fields, + isInternal: true, + }; + module.types.push(variantType); type.enum_types.push({ module, name: variant.name, summary: variant.summary, description: variant.description, type: ApiTypeIs.Ref, - ref_name: name, + ref_name: `${module.name}.${name}`, }); } else { type.enum_types.push(variant); @@ -261,6 +263,22 @@ export abstract class Code { } + getVariantStructType(variant: ApiField | undefined): ApiStruct | undefined { + if (!variant) { + return undefined; + } + if (variant.type === ApiTypeIs.Struct) { + return variant; + } + if (variant.type === ApiTypeIs.Ref) { + const refType = this.findType(variant.ref_name); + if (refType && refType.type === ApiTypeIs.Struct) { + return refType; + } + } + return undefined; + } + getAppObject(source: ApiGeneric): ApiModule { const requiredRefEnum = (type: ApiType, name: string): ApiEnumOfTypes => { const refType = type.type === ApiTypeIs.Ref ? this.findType(type.ref_name) : null; @@ -289,7 +307,8 @@ export abstract class Code { for (const params of resolvedParams.enum_types) { const result = resolvedResult.enum_types.find(x => x.name === params.name); const functionParams: ApiField[] = []; - if (params.type === ApiTypeIs.Struct && params.struct_fields.length > 0) { + const paramsStructType = this.getVariantStructType(params); + if (paramsStructType && paramsStructType.struct_fields.length > 0) { const paramsTypeName = `ParamsOf${obj.name}${params.name}Variant`; obj.types.push({ ...params, @@ -305,7 +324,8 @@ export abstract class Code { } const resultTypeName = `ResultOf${obj.name}${params.name}Variant`; - if (result && result.type === ApiTypeIs.Struct && result.struct_fields.length > 0) { + const resultStructType = this.getVariantStructType(result); + if (result && resultStructType && resultStructType.struct_fields.length > 0) { obj.types.push({ ...result, module: obj, @@ -316,7 +336,7 @@ export abstract class Code { module: obj, name: Code.pascalToSnake(params.name), params: functionParams, - result: (result && result.type === ApiTypeIs.Struct && result.struct_fields.length == 0) + result: (result && resultStructType && resultStructType.struct_fields.length == 0) ? { type: ApiTypeIs.None, module: obj, diff --git a/tools/ts-code.ts b/tools/ts-code.ts index 6cc4c21de..532400613 100644 --- a/tools/ts-code.ts +++ b/tools/ts-code.ts @@ -300,10 +300,9 @@ export class ${Code.upperFirst(module.name)}Module { appObjectInterface(obj: ApiModule): string { let ts = ""; - for (const type of obj.types) { - ts += "\n"; - ts += this.typeDef(type); - } + // for (const type of obj.types) { + // ts += `\ntype ${type.name} = ${type.name}Variant`; + // } ts += `\nexport interface ${obj.name} {`; for (const f of obj.functions) { const isNotify = (f.result.type === ApiTypeIs.Ref) && f.result.ref_name === ""; @@ -391,13 +390,7 @@ ${this.api.modules.map(m => this.module(m)).join("")} for (const variant of type.enum_types) { let params = ""; let properties = ""; - switch (variant.type) { - case ApiTypeIs.Ref: - params = `params: ${typeName(variant.ref_name)}`; - properties = ` ...params,\n`; - break; - case ApiTypeIs.Struct: - const fields = variant.struct_fields; + const addFields = (fields: ApiField[]) => { for (const field of fields) { if (params !== "") { params += ", "; @@ -406,6 +399,19 @@ ${this.api.modules.map(m => this.module(m)).join("")} properties += ` ${fixFieldName(field.name)},\n`; } + }; + switch (variant.type) { + case ApiTypeIs.Ref: + const refType = this.findType(variant.ref_name); + if (refType && refType.type === ApiTypeIs.Struct && refType.isInternal) { + addFields(refType.struct_fields); + } else { + params = `params: ${typeName(variant.ref_name)}`; + properties = ` ...params,\n`; + } + break; + case ApiTypeIs.Struct: + addFields(variant.struct_fields); break; } ts += From c2dbc05903a569d84c700cc73e9f14c5d571f0e8 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Tue, 10 May 2022 20:55:47 +0300 Subject: [PATCH 04/19] FIX: doc for variant constructor --- tools/docs.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/docs.ts b/tools/docs.ts index a3a8d40bf..ae2f8bb8e 100644 --- a/tools/docs.ts +++ b/tools/docs.ts @@ -377,18 +377,25 @@ Where: let md = "Variant constructors:\n\n```ts"; for (const variant of type.enum_types) { let params = ""; - switch (variant.type) { - case ApiTypeIs.Ref: - params = `params: ${typeName(variant.ref_name)}`; - break; - case ApiTypeIs.Struct: - const fields = variant.struct_fields; + const addFields = (fields: ApiField[]) => { for (const field of fields) { if (params !== "") { params += ", "; } - params += `${this.code.field(field, "")}`; + params += `${this.field(field)}`; } + }; + switch (variant.type) { + case ApiTypeIs.Ref: + const refType = this.findType(variant.ref_name); + if (refType && refType.type === ApiTypeIs.Struct && refType.isInternal) { + addFields(refType.struct_fields); + } else { + params = `params: ${typeName(variant.ref_name)}`; + } + break; + case ApiTypeIs.Struct: + addFields(variant.struct_fields); break; } md += `\nfunction ${TSCode.lowerFirst(enumName)}${variant.name}(${params}): ${enumName};`; From 1776c90c3fb87d0395eec71b03154630f26efe6a Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Wed, 11 May 2022 09:59:36 +0300 Subject: [PATCH 05/19] CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 573daf87d..4764848bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [1.34.0] – 2022-05-15 + +### New + +- binding-gen: enum of types produces own type for each enum variant. + ## [1.33.1] – 2022-05-10 ### Fixed From bf36289f49a33559912968079a447a9598597d30 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Wed, 11 May 2022 11:42:06 +0300 Subject: [PATCH 06/19] ### New - `client.config` function returns current client config --- CHANGELOG.md | 6 ++++++ ton_client/src/abi/mod.rs | 2 +- ton_client/src/boc/mod.rs | 2 +- ton_client/src/client/client.rs | 2 +- ton_client/src/client/mod.rs | 7 +++++++ ton_client/src/client/tests.rs | 21 +++++++++++++++++++++ ton_client/src/crypto/mod.rs | 2 +- ton_client/src/json_interface/modules.rs | 1 + ton_client/src/proofs/mod.rs | 10 +++++----- 9 files changed, 44 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 573daf87d..bd6e9c8ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [1.34.0] – 2022-05-10 + +### New + +- `client.config` function returns current client config + ## [1.33.1] – 2022-05-10 ### Fixed diff --git a/ton_client/src/abi/mod.rs b/ton_client/src/abi/mod.rs index db7a6d956..70c4dbbd8 100644 --- a/ton_client/src/abi/mod.rs +++ b/ton_client/src/abi/mod.rs @@ -89,7 +89,7 @@ fn deserialize_message_expiration_timeout_grow_factor<'de, D: Deserializer<'de>> .unwrap_or(default_message_expiration_timeout_grow_factor())) } -#[derive(Deserialize, Debug, Clone, ApiType)] +#[derive(Deserialize, Serialize, Debug, Clone, ApiType)] pub struct AbiConfig { /// Workchain id that is used by default in DeploySet #[serde( diff --git a/ton_client/src/boc/mod.rs b/ton_client/src/boc/mod.rs index 0ab9f734f..aa19a65a3 100644 --- a/ton_client/src/boc/mod.rs +++ b/ton_client/src/boc/mod.rs @@ -61,7 +61,7 @@ fn deserialize_cache_max_size<'de, D: Deserializer<'de>>(deserializer: D) -> Res Ok(Option::deserialize(deserializer)?.unwrap_or(default_cache_max_size())) } -#[derive(Deserialize, Debug, Clone, ApiType)] +#[derive(Deserialize, Serialize, Debug, Clone, ApiType)] pub struct BocConfig { /// Maximum BOC cache size in kilobytes. Default is 10 MB #[serde( diff --git a/ton_client/src/client/client.rs b/ton_client/src/client/client.rs index c1d431c9d..49c1d5db1 100644 --- a/ton_client/src/client/client.rs +++ b/ton_client/src/client/client.rs @@ -159,7 +159,7 @@ Note that default values are used if parameters are omitted in config"#, } } -#[derive(Deserialize, Debug, Clone, ApiType)] +#[derive(Deserialize, Serialize, Debug, Clone, ApiType)] pub struct ClientConfig { #[serde(default, deserialize_with = "deserialize_network_config")] pub network: NetworkConfig, diff --git a/ton_client/src/client/mod.rs b/ton_client/src/client/mod.rs index 57c1c0bf6..6b742620b 100644 --- a/ton_client/src/client/mod.rs +++ b/ton_client/src/client/mod.rs @@ -159,3 +159,10 @@ pub async fn resolve_app_request( sender.send(params.result) .map_err(|_| Error::can_not_send_request_result(request_id)) } + +/// Returns Core Library API reference +#[api_function] +pub fn config(context: Arc) -> ClientResult { + Ok(context.config.clone()) +} + diff --git a/ton_client/src/client/tests.rs b/ton_client/src/client/tests.rs index efb5ddb6c..0196ba7e6 100644 --- a/ton_client/src/client/tests.rs +++ b/ton_client/src/client/tests.rs @@ -27,6 +27,27 @@ fn test_config_fields() { assert_eq!(config.network.max_reconnect_timeout, 100); } +#[test] +fn test_config() { + let client = TestClient::new_with_config(json!({ + "abi": { + "message_expiration_timeout": 456 + }, + "network": { + "max_reconnect_timeout": 123 + } + })); + let config: ClientConfig = client + .request_no_params(&format!( + "{}.{}", + ClientModule::api().name, + crate::client::config_api().name + )) + .unwrap(); + assert_eq!(config.abi.message_expiration_timeout, 456); + assert_eq!(config.network.max_reconnect_timeout, 123); +} + #[test] fn api_reference() { let client = TestClient::new(); diff --git a/ton_client/src/crypto/mod.rs b/ton_client/src/crypto/mod.rs index 69a8d0c88..0a77589e9 100644 --- a/ton_client/src/crypto/mod.rs +++ b/ton_client/src/crypto/mod.rs @@ -129,7 +129,7 @@ fn deserialize_hdkey_derivation_path<'de, D: Deserializer<'de>>( Ok(Option::deserialize(deserializer)?.unwrap_or(default_hdkey_derivation_path())) } -#[derive(Deserialize, Debug, Clone, ApiType)] +#[derive(Deserialize, Serialize, Debug, Clone, ApiType)] /// Crypto config. pub struct CryptoConfig { /// Mnemonic dictionary that will be used by default in crypto functions. diff --git a/ton_client/src/json_interface/modules.rs b/ton_client/src/json_interface/modules.rs index 17866915f..4a3d8d4b8 100644 --- a/ton_client/src/json_interface/modules.rs +++ b/ton_client/src/json_interface/modules.rs @@ -41,6 +41,7 @@ fn register_client(handlers: &mut RuntimeHandlers) { crate::client::get_api_reference_api, ); module.register_sync_fn_without_args(crate::client::version, crate::client::version_api); + module.register_sync_fn_without_args(crate::client::config, crate::client::config_api); module.register_sync_fn_without_args(crate::client::build_info, crate::client::build_info_api); module.register_async_fn( crate::client::resolve_app_request, diff --git a/ton_client/src/proofs/mod.rs b/ton_client/src/proofs/mod.rs index 14d99044f..c33a9d67b 100644 --- a/ton_client/src/proofs/mod.rs +++ b/ton_client/src/proofs/mod.rs @@ -35,7 +35,7 @@ mod validators; mod tests; mod json; -#[derive(Deserialize, Debug, Clone, ApiType)] +#[derive(Deserialize, Serialize, Debug, Clone, ApiType)] pub struct ProofsConfig { /// Cache proofs in the local storage. Default is `true`. /// If this value is set to `true`, downloaded proofs and master-chain BOCs are saved into the @@ -76,7 +76,7 @@ pub struct ParamsOfProofBlockData { } /// Proves that a given block's data, which is queried from TONOS API, can be trusted. -/// +/// /// This function checks block proofs and compares given data with the proven. /// If the given data differs from the proven, the exception will be thrown. /// The input param is a single block's JSON object, which was queried from DApp server using @@ -178,10 +178,10 @@ pub struct ParamsOfProofTransactionData { /// This function requests the corresponding block, checks block proofs, ensures that given /// transaction exists in the proven block and compares given data with the proven. /// If the given data differs from the proven, the exception will be thrown. -/// The input parameter is a single transaction's JSON object (see params description), -/// which was queried from TONOS API using functions such as `net.query`, `net.query_collection` +/// The input parameter is a single transaction's JSON object (see params description), +/// which was queried from TONOS API using functions such as `net.query`, `net.query_collection` /// or `net.wait_for_collection`. -/// +/// /// If transaction's BOC and/or `block_id` are not provided in the JSON, they will be queried from /// TONOS API. /// From c22c2eaef0b7dca55298a3e50ef3c0fbd396c8ef Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Wed, 11 May 2022 12:16:06 +0300 Subject: [PATCH 07/19] FIX: docs gen: md was inside code blocks --- tools/docs.ts | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/tools/docs.ts b/tools/docs.ts index ae2f8bb8e..5f7d6b55a 100644 --- a/tools/docs.ts +++ b/tools/docs.ts @@ -7,7 +7,6 @@ import { ApiField, ApiFunction, ApiModule, - ApiStruct, ApiType, ApiTypeIs, Code, @@ -104,39 +103,11 @@ export class Docs extends Code { } return ""; } - - tupleFields(variant: ApiStruct, indent: string): ApiField[] { - let fields = variant.struct_fields; - const innerType = fields[0]; - if (innerType.type === ApiTypeIs.Ref) { - const refType = this.findType(innerType.ref_name); - if (refType && refType.type === ApiTypeIs.Struct) { - return this.structFields(refType, indent); - } - } else if (innerType.type === ApiTypeIs.Struct) { - return this.structFields(innerType, indent); - } - return [ - { - ...innerType, - name: "value", - }, - ]; - } - - structFields(variant: ApiStruct, _indent: string): ApiField[] { - const fields = variant.struct_fields; - if (fields.length === 0) { - return fields; - } - return fields; - } - typeVariant(variant: ApiField, indent: string): string { let md = `When _type_ is _'${variant.name}'_\n\n`; md += docOf(variant); if (variant.type === ApiTypeIs.Struct) { - const fields = this.structFields(variant, indent); + const fields = variant.struct_fields; let fieldsDecl: string; if (fields.length === 0) { fieldsDecl = ""; @@ -254,7 +225,7 @@ export class Docs extends Code { md += this.type(params, ""); } if (appObject) { - md += `- \`obj\`: ${appObjectTypeRef(appObject)}${summaryOf(appObject)}\n\n` + md += `- \`obj\`: ${appObjectTypeRef(appObject)}${summaryOf(appObject)}\n\n`; } if (funcInfo.hasResponseHandler) { md += `- \`responseHandler\`?: _[ResponseHandler](modules.md#responsehandler)_ – additional responses handler.`; @@ -321,7 +292,7 @@ This section contains documents describing TON SDK Types and Methods supported b `; for (const module of this.api.modules.slice().sort( - (left, right) => left.name.localeCompare(right.name) + (left, right) => left.name.localeCompare(right.name), )) { md += `* [Module ${module.name}](${moduleFile(module)})\n`; } @@ -377,15 +348,15 @@ Where: let md = "Variant constructors:\n\n```ts"; for (const variant of type.enum_types) { let params = ""; - const addFields = (fields: ApiField[]) => { + const addFields = (fields: ApiField[]) => { for (const field of fields) { if (params !== "") { params += ", "; } - params += `${this.field(field)}`; + params += `${this.code.field(field, "")}`; } }; - switch (variant.type) { + switch (variant.type) { case ApiTypeIs.Ref: const refType = this.findType(variant.ref_name); if (refType && refType.type === ApiTypeIs.Struct && refType.isInternal) { From f79d2379f761b2cb8dd0b2749d04966321a026f1 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Wed, 11 May 2022 19:15:11 +0300 Subject: [PATCH 08/19] NEW: `ext_in_msg_fee`, `total_fwd_fees`, `account_fees` fields to `run_executor().fees` --- CHANGELOG.md | 1 + ton_client/src/tvm/tests.rs | 88 ++++++++++++++++++++++++++++++++++++- ton_sdk/src/transaction.rs | 60 ++++++++++++++++++------- 3 files changed, 132 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd6e9c8ee..0195b159c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### New - `client.config` function returns current client config +- `ext_in_msg_fee`, `total_fwd_fees`, `account_fees` fields to `run_executor().fees` ## [1.33.1] – 2022-05-10 diff --git a/ton_client/src/tvm/tests.rs b/ton_client/src/tvm/tests.rs index e5a6e697f..00868a317 100644 --- a/ton_client/src/tvm/tests.rs +++ b/ton_client/src/tvm/tests.rs @@ -18,7 +18,10 @@ use crate::abi::{ encode_account::{ParamsOfEncodeAccount, StateInitSource}, Abi, CallSet, DeploySet, ParamsOfEncodeMessage, ResultOfEncodeMessage, Signer, }; -use crate::boc::{internal::{deserialize_object_from_base64, serialize_cell_to_base64}, BocCacheType}; +use crate::boc::{ + internal::{deserialize_object_from_base64, serialize_cell_to_base64}, + BocCacheType, +}; use crate::error::ClientResult; use crate::json_interface::modules::{AbiModule, TvmModule}; use crate::net::{ParamsOfQueryCollection, ResultOfQueryCollection}; @@ -950,3 +953,86 @@ async fn test_my_code() { println!("{:?}", get_my_code); } + +#[tokio::test(core_threads = 2)] +async fn test_run_executor_fees() { + let client = TestClient::new(); + let (abi, tvc) = TestClient::package("Events", None); + + let keys = client.generate_sign_keys(); + + let signer = Signer::Keys { keys: keys.clone() }; + let deploy_message: ResultOfEncodeMessage = client + .request_async( + "abi.encode_message", + ParamsOfEncodeMessage { + abi: abi.clone(), + call_set: Some(CallSet { + function_name: "constructor".into(), + ..Default::default() + }), + deploy_set: Some(DeploySet { + tvc: tvc.clone(), + ..Default::default() + }), + signer: signer.clone(), + ..Default::default() + }, + ) + .await + .unwrap(); + + let deployed: ResultOfRunExecutor = client + .request_async( + "tvm.run_executor", + ParamsOfRunExecutor { + message: deploy_message.message.clone(), + account: AccountForExecutor::Uninit, + return_updated_account: Some(true), + abi: Some(abi.clone()), + ..Default::default() + }, + ) + .await + .unwrap(); + + let return_value_message: ResultOfEncodeMessage = client + .request_async( + "abi.encode_message", + ParamsOfEncodeMessage { + abi: abi.clone(), + address: Some(deploy_message.address.clone()), + call_set: Some(CallSet { + function_name: "returnValue".into(), + input: Some(json!({ + "id": "0x1" + })), + ..Default::default() + }), + signer: signer.clone(), + ..Default::default() + }, + ) + .await + .unwrap(); + + let return_value: ResultOfRunExecutor = client + .request_async( + "tvm.run_executor", + ParamsOfRunExecutor { + message: return_value_message.message.clone(), + account: AccountForExecutor::Account { + boc: deployed.account.clone(), + unlimited_balance: Some(true), + }, + abi: Some(abi.clone()), + ..Default::default() + }, + ) + .await + .unwrap(); + + assert_eq!(2354000, return_value.fees.ext_in_msg_fee); + assert_eq!(1166500, return_value.fees.account_fees/10); + assert_eq!(2000000, return_value.fees.total_fwd_fees); +} diff --git a/ton_sdk/src/transaction.rs b/ton_sdk/src/transaction.rs index ccfde6aa7..fefe1dd75 100644 --- a/ton_sdk/src/transaction.rs +++ b/ton_sdk/src/transaction.rs @@ -18,8 +18,8 @@ use crate::types::StringId; use crate::{Message, MessageId}; use ton_block::{ - AccStatusChange, ComputeSkipReason, GetRepresentationHash, - TrComputePhase, TransactionDescr, TransactionProcessingStatus, + AccStatusChange, AddSub, ComputeSkipReason, GetRepresentationHash, TrComputePhase, + TransactionDescr, TransactionProcessingStatus, }; use ton_types::Result; @@ -79,6 +79,11 @@ pub struct Transaction { pub action: Option, #[serde(with = "json_helper::uint")] pub total_fees: u64, + + #[serde(with = "json_helper::uint")] + ext_in_msg_fee: u64, + #[serde(with = "json_helper::uint")] + account_fees: u64, } impl TryFrom<&ton_block::Transaction> for Transaction { @@ -93,7 +98,11 @@ impl TryFrom<&ton_block::Transaction> for Transaction { .into()); }; + let account_fees = transaction.total_fees().grams.clone(); + let mut in_msg_fee = account_fees.clone(); + let storage_phase = if let Some(phase) = descr.storage_ph { + in_msg_fee.sub(&phase.storage_fees_collected)?; Some(StoragePhase { status_change: phase.status_change, storage_fees_collected: grams_to_u64(&phase.storage_fees_collected)?, @@ -111,17 +120,24 @@ impl TryFrom<&ton_block::Transaction> for Transaction { gas_fees: 0, gas_used: 0, }, - TrComputePhase::Vm(ph) => ComputePhase { - skipped_reason: None, - exit_code: Some(ph.exit_code), - exit_arg: ph.exit_arg, - success: Some(ph.success), - gas_fees: grams_to_u64(&ph.gas_fees)?, - gas_used: ph.gas_used.0, - }, + TrComputePhase::Vm(ph) => { + in_msg_fee.sub(&ph.gas_fees)?; + ComputePhase { + skipped_reason: None, + exit_code: Some(ph.exit_code), + exit_arg: ph.exit_arg, + success: Some(ph.success), + gas_fees: grams_to_u64(&ph.gas_fees)?, + gas_used: ph.gas_used.0, + } + } }; let action_phase = if let Some(phase) = descr.action { + if let Some(fees) = phase.total_action_fees.as_ref() { + in_msg_fee.sub(fees)?; + } + Some(ActionPhase { success: phase.success, valid: phase.valid, @@ -134,10 +150,7 @@ impl TryFrom<&ton_block::Transaction> for Transaction { None }; - let in_msg = transaction - .in_msg - .as_ref() - .map(|msg| msg.hash().into()); + let in_msg = transaction.in_msg.as_ref().map(|msg| msg.hash().into()); let mut out_msgs = vec![]; transaction.out_msgs.iterate_slices(|slice| { if let Ok(cell) = slice.reference(0) { @@ -151,6 +164,11 @@ impl TryFrom<&ton_block::Transaction> for Transaction { Ok(true) })?; + let is_ext_in = if let Some(msg) = transaction.in_msg.as_ref() { + msg.read_struct()?.is_inbound_external() + } else { + false + }; Ok(Transaction { id: transaction.hash()?.into(), status: TransactionProcessingStatus::Finalized, @@ -163,6 +181,12 @@ impl TryFrom<&ton_block::Transaction> for Transaction { storage: storage_phase, compute: compute_phase, action: action_phase, + ext_in_msg_fee: if is_ext_in { + grams_to_u64(&in_msg_fee)? + } else { + 0 + }, + account_fees: grams_to_u64(&account_fees)?, }) } } @@ -175,6 +199,9 @@ pub struct TransactionFees { pub out_msgs_fwd_fee: u64, pub total_account_fees: u64, pub total_output: u64, + pub ext_in_msg_fee: u64, + pub total_fwd_fees: u64, + pub account_fees: u64, } // The struct represents performed transaction and allows to access their properties. @@ -213,13 +240,12 @@ impl Transaction { if let Some(storage) = &self.storage { fees.storage_fee = storage.storage_fees_collected; } - let mut total_action_fees = 0; if let Some(action) = &self.action { fees.out_msgs_fwd_fee = action.total_fwd_fees; + fees.total_fwd_fees = action.total_fwd_fees; total_action_fees = action.total_action_fees; } - // `transaction.total_fees` is calculated as // `transaction.total_fees = inbound_fwd_fees + storage_fees + gas_fees + total_action_fees` // but this total_fees is fees collected the validators, not the all fees taken from account @@ -253,6 +279,8 @@ impl Transaction { 0 }; + fees.ext_in_msg_fee = self.ext_in_msg_fee; + fees.account_fees = self.account_fees; fees } } From 4c872cb1fd760db6e8e17ca294caf6cb09e24ebe Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Thu, 12 May 2022 19:52:47 +0300 Subject: [PATCH 09/19] NEW: `main` and `dev` endpoints aliases --- CHANGELOG.md | 1 + ton_client/src/net/server_link.rs | 38 ++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e4aa1c79..a3d632742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - binding-gen: enum of types produces own type for each enum variant. - `client.config` function returns current client config - `ext_in_msg_fee`, `total_fwd_fees`, `account_fees` fields to `run_executor().fees` +- `main` and `dev` endpoints aliases ## [1.33.1] – 2022-05-10 diff --git a/ton_client/src/net/server_link.rs b/ton_client/src/net/server_link.rs index 24a63c14e..8d28a45c5 100644 --- a/ton_client/src/net/server_link.rs +++ b/ton_client/src/net/server_link.rs @@ -40,24 +40,36 @@ struct EndpointsReplacement<'a> { aliases: &'a [&'a str], } -const ENDPOINTS_REPLACE: [EndpointsReplacement; 2] = [ +const MAIN_ALIASES: [&str; 5] = [ + "eri01.main.everos.dev", + "gra01.main.everos.dev", + "gra02.main.everos.dev", + "lim01.main.everos.dev", + "rbx01.main.everos.dev", +]; + +const DEV_ALIASES: [&str; 3] = [ + "eri01.net.everos.dev", + "rbx01.net.everos.dev", + "gra01.net.everos.dev", +]; + +const ENDPOINTS_REPLACE: [EndpointsReplacement; 4] = [ EndpointsReplacement { url: "main.ton.dev", - aliases: &[ - "eri01.main.everos.dev", - "gra01.main.everos.dev", - "gra02.main.everos.dev", - "lim01.main.everos.dev", - "rbx01.main.everos.dev", - ], + aliases: &MAIN_ALIASES, }, EndpointsReplacement { url: "net.ton.dev", - aliases: &[ - "eri01.net.everos.dev", - "rbx01.net.everos.dev", - "gra01.net.everos.dev", - ], + aliases: &DEV_ALIASES, + }, + EndpointsReplacement { + url: "main", + aliases: &MAIN_ALIASES, + }, + EndpointsReplacement { + url: "dev", + aliases: &DEV_ALIASES, }, ]; From 028399a61f55dddaaf928950cd7ec4125ed79168 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Fri, 13 May 2022 09:58:45 +0300 Subject: [PATCH 10/19] upgraded zstd dependency --- ton_client/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ton_client/Cargo.toml b/ton_client/Cargo.toml index 40688415d..295f41640 100644 --- a/ton_client/Cargo.toml +++ b/ton_client/Cargo.toml @@ -64,7 +64,7 @@ serde_repr = '0.1.7' sha2 = '0.9.5' tokio = { default-features = false, features = [ 'sync', 'stream', 'fs' ], version = '0.2.13' } zeroize = { features = [ 'zeroize_derive' ], version = '1.3' } -zstd = { default-features = false, version = '0.8.0' } +zstd = { default-features = false, version = '0.11.2' } # TODO: remove fixed versioning when indexmap compilation issue is resolved indexmap = '=1.6.2' # TODO: remove fixed versioning when tiny-bip39 compilation issue is resolved From 8b5697c0966bb075bb554de4b3d50f037c8ea640 Mon Sep 17 00:00:00 2001 From: elasticLove1 Date: Fri, 13 May 2022 10:18:28 +0200 Subject: [PATCH 11/19] Update CHANGELOG.md --- CHANGELOG.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3d632742..b1c761f54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,23 @@ All notable changes to this project will be documented in this file. -## [1.34.0] – 2022-05-15 +## [1.34.0] – 2022-05-16 ### New -- binding-gen: enum of types produces own type for each enum variant. -- `client.config` function returns current client config -- `ext_in_msg_fee`, `total_fwd_fees`, `account_fees` fields to `run_executor().fees` -- `main` and `dev` endpoints aliases +- `client.config` function that returns the current client config +- `run_executor().fees` is extended with these fields: + + - `ext_in_msg_fee` - fee for processing external inbound message + - `total_fwd_fees` - total fees of action phase + - `account_fees` - total fees the account pays for the transaction + +- `main` and `dev` endpoints aliases for Evernode Cloud Mainnet and Devnet endpoints + +### Fixed + +- Documentation now includes `enum` types descriptions. + To achieve it we updated binding-gen: enum of types now produces its own type for each enum variant. ## [1.33.1] – 2022-05-10 From 0e2d6a7b3bc0ff771efab3907589f8cc45fca520 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Fri, 13 May 2022 11:48:03 +0300 Subject: [PATCH 12/19] NEW: feature wasm-base without zstd --- ton_client/Cargo.toml | 18 ++++++++++++++---- ton_client/src/client/client.rs | 4 ++-- ton_client/src/client/client_env_tests.rs | 6 +++--- ton_client/src/client/mod.rs | 12 ++++++------ ton_client/src/client/network_mock.rs | 4 ++-- ton_client/src/debot/calltype.rs | 4 ++-- ton_client/src/debot/mod.rs | 4 ++-- ton_client/src/json_interface/mod.rs | 1 + ton_client/src/json_interface/modules.rs | 2 ++ ton_client/src/json_interface/registrar.rs | 4 ++-- ton_client/src/net/mod.rs | 2 +- ton_client/src/utils/mod.rs | 2 ++ 12 files changed, 39 insertions(+), 24 deletions(-) diff --git a/ton_client/Cargo.toml b/ton_client/Cargo.toml index 295f41640..abd2e26db 100644 --- a/ton_client/Cargo.toml +++ b/ton_client/Cargo.toml @@ -64,12 +64,14 @@ serde_repr = '0.1.7' sha2 = '0.9.5' tokio = { default-features = false, features = [ 'sync', 'stream', 'fs' ], version = '0.2.13' } zeroize = { features = [ 'zeroize_derive' ], version = '1.3' } -zstd = { default-features = false, version = '0.11.2' } # TODO: remove fixed versioning when indexmap compilation issue is resolved indexmap = '=1.6.2' # TODO: remove fixed versioning when tiny-bip39 compilation issue is resolved tiny-bip39 = '=0.7.3' +# optional +zstd = { optional = true, default-features = false, version = '0.11.2' } + # optional for std reqwest = { optional = true, version = '0.10.4' } tokio-tungstenite = { features = [ 'tls' ], optional = true, version = '0.11.0' } @@ -109,14 +111,24 @@ pretty_assertions = '0.6.1' [features] default = [ 'std' ] +include-zstd = [] std = [ 'tokio/rt-threaded', 'tokio/macros', 'reqwest', 'tokio-tungstenite', - 'home' + 'home', + 'include-zstd', + 'zstd' ] wasm = [ + 'wasm-base', + 'include-zstd', + 'zstd', + 'zstd/thin', + 'zstd/wasm' +] +wasm-base = [ 'chrono/wasmbind', 'indexed_db_futures', 'js-sys', @@ -124,6 +136,4 @@ wasm = [ 'wasm-bindgen', 'wasm-bindgen-futures', 'web-sys', - 'zstd/thin', - 'zstd/wasm' ] diff --git a/ton_client/src/client/client.rs b/ton_client/src/client/client.rs index 49c1d5db1..def6a0976 100644 --- a/ton_client/src/client/client.rs +++ b/ton_client/src/client/client.rs @@ -34,9 +34,9 @@ use crate::net::{ subscriptions::SubscriptionAction, ChainIterator, NetworkConfig, ServerLink, }; use crate::proofs::ProofsConfig; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] use super::std_client_env::ClientEnv; -#[cfg(feature = "wasm")] +#[cfg(feature = "wasm-base")] use super::wasm_client_env::ClientEnv; #[derive(Default)] diff --git a/ton_client/src/client/client_env_tests.rs b/ton_client/src/client/client_env_tests.rs index e9715508f..fff691609 100644 --- a/ton_client/src/client/client_env_tests.rs +++ b/ton_client/src/client/client_env_tests.rs @@ -3,7 +3,7 @@ use ton_types::Result; use crate::client::LocalStorage; use crate::client::storage::KeyValueStorage; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] mod env { use crate::client::std_client_env::LocalStorage; @@ -56,7 +56,7 @@ mod env { } } -#[cfg(feature = "wasm")] +#[cfg(feature = "wasm-base")] mod env { pub struct LocalStoragePathManager; @@ -73,7 +73,7 @@ mod env { } } -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] #[test] fn test_storage_path_calculation() { assert_eq!( diff --git a/ton_client/src/client/mod.rs b/ton_client/src/client/mod.rs index 6b742620b..3a939ece5 100644 --- a/ton_client/src/client/mod.rs +++ b/ton_client/src/client/mod.rs @@ -15,23 +15,23 @@ mod client; mod client_env; pub(crate) mod errors; pub(crate) mod storage; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] mod std_client_env; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] pub(crate) use std_client_env::{ClientEnv, LocalStorage}; -#[cfg(feature = "wasm")] +#[cfg(feature = "wasm-base")] mod wasm_client_env; -#[cfg(feature = "wasm")] +#[cfg(feature = "wasm-base")] pub(crate) use wasm_client_env::{ClientEnv, LocalStorage}; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] #[cfg(test)] pub(crate) use crate::client::network_mock::{NetworkMock}; #[cfg(test)] mod tests; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] #[cfg(test)] mod network_mock; diff --git a/ton_client/src/client/network_mock.rs b/ton_client/src/client/network_mock.rs index ab1948a41..cc0d5dc69 100644 --- a/ton_client/src/client/network_mock.rs +++ b/ton_client/src/client/network_mock.rs @@ -170,7 +170,7 @@ impl NetworkMock { } } - #[cfg(not(feature = "wasm"))] + #[cfg(not(feature = "wasm-base"))] #[cfg(test)] pub async fn get_len(client: &ClientContext) -> usize { client @@ -283,7 +283,7 @@ impl NetworkMockBuilder { ))) } - #[cfg(not(feature = "wasm"))] + #[cfg(not(feature = "wasm-base"))] #[cfg(test)] pub async fn reset_client(&self, client: &ClientContext) { client diff --git a/ton_client/src/debot/calltype.rs b/ton_client/src/debot/calltype.rs index a1c2b0f25..94b1712a8 100644 --- a/ton_client/src/debot/calltype.rs +++ b/ton_client/src/debot/calltype.rs @@ -4,7 +4,7 @@ use super::{BrowserCallbacks, DebotActivity, Spending, TonClient}; use crate::abi::Signer; use crate::boc::internal::{deserialize_object_from_base64, serialize_object_to_base64}; use crate::boc::{get_boc_hash, parse_message, ParamsOfParse, ParamsOfGetBocHash}; -use crate::crypto::{KeyPair, SigningBoxHandle, get_signing_box}; +use crate::crypto::{SigningBoxHandle, get_signing_box}; use crate::encoding::decode_abi_number; use crate::error::{ClientError, ClientResult}; use crate::processing::{ @@ -84,7 +84,7 @@ impl TryFrom for Metadata { } } -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] pub fn prepare_ext_in_message( msg: &Message, now_ms: u64, diff --git a/ton_client/src/debot/mod.rs b/ton_client/src/debot/mod.rs index ecb2f23f3..ae028acc5 100644 --- a/ton_client/src/debot/mod.rs +++ b/ton_client/src/debot/mod.rs @@ -37,7 +37,7 @@ mod tests; #[cfg(test)] mod tests_interfaces; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] pub use calltype::prepare_ext_in_message; pub use action::DAction; @@ -325,4 +325,4 @@ pub async fn send(context: Arc, params: ParamsOfSend) -> ClientRe dengine .send(params.message) .await -} \ No newline at end of file +} diff --git a/ton_client/src/json_interface/mod.rs b/ton_client/src/json_interface/mod.rs index 39baa1cbc..d5974d159 100644 --- a/ton_client/src/json_interface/mod.rs +++ b/ton_client/src/json_interface/mod.rs @@ -18,6 +18,7 @@ pub(crate) mod handlers; pub(crate) mod interop; pub(crate) mod net; pub(crate) mod processing; +#[cfg(feature = "include-zstd")] pub(crate) mod utils; pub(crate) mod modules; diff --git a/ton_client/src/json_interface/modules.rs b/ton_client/src/json_interface/modules.rs index 4a3d8d4b8..1201a2977 100644 --- a/ton_client/src/json_interface/modules.rs +++ b/ton_client/src/json_interface/modules.rs @@ -605,7 +605,9 @@ fn register_utils(handlers: &mut RuntimeHandlers) { crate::utils::calc_storage_fee, crate::utils::calc_storage_fee::calc_storage_fee_api, ); + #[cfg(feature = "include-zstd")] module.register_sync_fn(super::utils::compress_zstd, super::utils::compress_zstd_api); + #[cfg(feature = "include-zstd")] module.register_sync_fn( super::utils::decompress_zstd, super::utils::decompress_zstd_api, diff --git a/ton_client/src/json_interface/registrar.rs b/ton_client/src/json_interface/registrar.rs index abb401654..93cc45b58 100644 --- a/ton_client/src/json_interface/registrar.rs +++ b/ton_client/src/json_interface/registrar.rs @@ -89,7 +89,7 @@ impl<'h> ModuleReg<'h> { self.handlers .register_async(name.clone(), Box::new(SpawnHandler::new(handler))); - #[cfg(not(feature = "wasm"))] + #[cfg(not(feature = "wasm-base"))] self.handlers.register_sync( name, Box::new(CallHandler::new(move |context, params| { @@ -113,7 +113,7 @@ impl<'h> ModuleReg<'h> { self.handlers .register_async(name.clone(), Box::new(SpawnNoArgsHandler::new(handler))); - #[cfg(not(feature = "wasm"))] + #[cfg(not(feature = "wasm-base"))] self.handlers.register_sync( name, Box::new(CallNoArgsHandler::new(move |context| { diff --git a/ton_client/src/net/mod.rs b/ton_client/src/net/mod.rs index 3626116fb..d10eea4e6 100644 --- a/ton_client/src/net/mod.rs +++ b/ton_client/src/net/mod.rs @@ -66,7 +66,7 @@ pub(crate) mod transaction_tree; pub(crate) mod types; mod websocket_link; -#[cfg(not(feature = "wasm"))] +#[cfg(not(feature = "wasm-base"))] #[cfg(test)] mod tests; diff --git a/ton_client/src/utils/mod.rs b/ton_client/src/utils/mod.rs index 9cd818282..3af57f404 100644 --- a/ton_client/src/utils/mod.rs +++ b/ton_client/src/utils/mod.rs @@ -17,6 +17,7 @@ mod tests; pub(crate) mod calc_storage_fee; pub(crate) mod conversion; +#[cfg(feature = "include-zstd")] pub(crate) mod compression; pub(crate) mod json; mod errors; @@ -28,6 +29,7 @@ pub use conversion::{ convert_address, AddressStringFormat, ParamsOfConvertAddress, ResultOfConvertAddress, get_address_type, ParamsOfGetAddressType, ResultOfGetAddressType, }; +#[cfg(feature = "include-zstd")] pub use compression::{compress_zstd, decompress_zstd}; pub use errors::{Error, ErrorCode}; pub use crate::encoding::AccountAddressType; From be8ba9a1db506b4d769f4db25f9a9a7cd08495cd Mon Sep 17 00:00:00 2001 From: elasticLove1 Date: Fri, 13 May 2022 11:12:31 +0200 Subject: [PATCH 13/19] transaction_executor docs added --- CHANGELOG.md | 4 +++- ton_sdk/src/transaction.rs | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c761f54..e92dc8bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,13 @@ All notable changes to this project will be documented in this file. - `main` and `dev` endpoints aliases for Evernode Cloud Mainnet and Devnet endpoints -### Fixed +### Improved +- Added documentation for `run_executor` result fields. - Documentation now includes `enum` types descriptions. To achieve it we updated binding-gen: enum of types now produces its own type for each enum variant. + ## [1.33.1] – 2022-05-10 ### Fixed diff --git a/ton_sdk/src/transaction.rs b/ton_sdk/src/transaction.rs index fefe1dd75..12f4c67c5 100644 --- a/ton_sdk/src/transaction.rs +++ b/ton_sdk/src/transaction.rs @@ -193,14 +193,32 @@ impl TryFrom<&ton_block::Transaction> for Transaction { #[derive(Serialize, Deserialize, ApiType, Debug, PartialEq, Clone, Default)] pub struct TransactionFees { + /// Deprecated. Left for backward compatibility. + /// Does not participate in account transaction fees calculation. pub in_msg_fwd_fee: u64, + /// Fee for account storage pub storage_fee: u64, + /// Fee for processing pub gas_fee: u64, + /// Deprecated. Contains the same data as total_fwd_fees field. Deprecated because of + /// its confusing name, that is not the same with GraphQL API Transaction type's field. pub out_msgs_fwd_fee: u64, + /// Deprecated. This is the field that is named as `total_fees` in GraphQL API Transaction type. + /// `total_account_fees` name is misleading, because it does not mean account fees, instead it means + /// validators total fees received for the transaction execution. It does not include some forward fees that account + /// actually pays now, but validators will receive later during value delivery to another account (not even in the receiving + /// transaction). + /// Because of all of this, this field is not interesting for those who wants to understand + /// the real account fees, this is why it is deprecated and left for backward compatibility. pub total_account_fees: u64, + /// Deprecated because it means total value sent in the transaction, which does not relate to any fees. pub total_output: u64, + /// Fee for inbound external message import. pub ext_in_msg_fee: u64, + /// Total fees the account pays for message forwarding pub total_fwd_fees: u64, + /// Total account fees for the transaction execution. + /// Compounds of storage_fee + gas_fee + ext_in_msg_fee + total_fwd_fees pub account_fees: u64, } From af7d02e25de8c426cef11316abb0fe418e65be70 Mon Sep 17 00:00:00 2001 From: elasticLove1 Date: Fri, 13 May 2022 11:15:02 +0200 Subject: [PATCH 14/19] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e92dc8bac..6f157bb52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ All notable changes to this project will be documented in this file. ### Improved -- Added documentation for `run_executor` result fields. +- Added documentation for `TransactionFees` type (returned in `result.fees` of `tvm.run_executor`). - Documentation now includes `enum` types descriptions. To achieve it we updated binding-gen: enum of types now produces its own type for each enum variant. From 2759f640ac81e15e50d8db227f667ae1c1a490bd Mon Sep 17 00:00:00 2001 From: elasticLove1 Date: Fri, 13 May 2022 11:18:20 +0200 Subject: [PATCH 15/19] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f157bb52..6d27112f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ All notable changes to this project will be documented in this file. ### Improved -- Added documentation for `TransactionFees` type (returned in `result.fees` of `tvm.run_executor`). +- Added documentation for `TransactionFees` type (`run_executor().fees`). - Documentation now includes `enum` types descriptions. To achieve it we updated binding-gen: enum of types now produces its own type for each enum variant. From e1ef90007beb2776400e1473260072e42ab59fd4 Mon Sep 17 00:00:00 2001 From: Michael Vlasov Date: Fri, 13 May 2022 12:26:09 +0300 Subject: [PATCH 16/19] FIX: restore KeyPair use --- ton_client/src/debot/calltype.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ton_client/src/debot/calltype.rs b/ton_client/src/debot/calltype.rs index 94b1712a8..b88898256 100644 --- a/ton_client/src/debot/calltype.rs +++ b/ton_client/src/debot/calltype.rs @@ -4,7 +4,7 @@ use super::{BrowserCallbacks, DebotActivity, Spending, TonClient}; use crate::abi::Signer; use crate::boc::internal::{deserialize_object_from_base64, serialize_object_to_base64}; use crate::boc::{get_boc_hash, parse_message, ParamsOfParse, ParamsOfGetBocHash}; -use crate::crypto::{SigningBoxHandle, get_signing_box}; +use crate::crypto::{KeyPair, SigningBoxHandle, get_signing_box}; use crate::encoding::decode_abi_number; use crate::error::{ClientError, ClientResult}; use crate::processing::{ From 96eb4adfe6788b85ba50a8a05bf8368a63fa1feb Mon Sep 17 00:00:00 2001 From: Sergei Voronezhskii Date: Mon, 16 May 2022 10:12:38 +0300 Subject: [PATCH 17/19] Revert updating zstd version --- ton_client/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ton_client/Cargo.toml b/ton_client/Cargo.toml index abd2e26db..aa5614e0c 100644 --- a/ton_client/Cargo.toml +++ b/ton_client/Cargo.toml @@ -70,7 +70,7 @@ indexmap = '=1.6.2' tiny-bip39 = '=0.7.3' # optional -zstd = { optional = true, default-features = false, version = '0.11.2' } +zstd = { optional = true, default-features = false, version = '0.8.0' } # optional for std reqwest = { optional = true, version = '0.10.4' } From 456bff08a30e03805d2f809889d9aa0d3a52587e Mon Sep 17 00:00:00 2001 From: Sergei Voronezhskii Date: Wed, 18 May 2022 10:49:19 +0300 Subject: [PATCH 18/19] Version 1.34.0 --- CHANGELOG.md | 2 +- api/derive/Cargo.toml | 2 +- api/info/Cargo.toml | 2 +- api/test/Cargo.toml | 2 +- docs/reference/types-and-methods/mod_abi.md | 213 ++++++++-- docs/reference/types-and-methods/mod_boc.md | 127 +++++- .../reference/types-and-methods/mod_client.md | 66 ++- .../reference/types-and-methods/mod_crypto.md | 397 ++++++++++++------ docs/reference/types-and-methods/mod_debot.md | 368 ++++++++++------ .../types-and-methods/mod_processing.md | 281 +++++++++++-- docs/reference/types-and-methods/mod_tvm.md | 75 +++- docs/reference/types-and-methods/mod_utils.md | 47 ++- docs/reference/types-and-methods/modules.md | 2 + ton_client/Cargo.toml | 2 +- ton_client/src/proofs/trusted_key_blocks.bin | Bin 152512 -> 157552 bytes ton_sdk/Cargo.toml | 2 +- toncli/Cargo.toml | 2 +- tools/api.json | 75 +++- 18 files changed, 1251 insertions(+), 414 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d27112f2..ab79c95da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [1.34.0] – 2022-05-16 +## [1.34.0] – 2022-05-18 ### New diff --git a/api/derive/Cargo.toml b/api/derive/Cargo.toml index 0e5d82ebb..9fa8e6b51 100644 --- a/api/derive/Cargo.toml +++ b/api/derive/Cargo.toml @@ -2,7 +2,7 @@ authors = [ 'TON Labs LTD ' ] edition = '2018' name = 'api_derive' -version = '1.33.1' +version = '1.34.0' [dependencies] quote = '1.0' diff --git a/api/info/Cargo.toml b/api/info/Cargo.toml index 710b0da89..12e52abf9 100644 --- a/api/info/Cargo.toml +++ b/api/info/Cargo.toml @@ -2,7 +2,7 @@ authors = [ 'TON Labs LTD ' ] edition = '2018' name = 'api_info' -version = '1.33.1' +version = '1.34.0' [dependencies] serde = '1.0.115' diff --git a/api/test/Cargo.toml b/api/test/Cargo.toml index cd46b2a47..b4dd4cab6 100644 --- a/api/test/Cargo.toml +++ b/api/test/Cargo.toml @@ -2,7 +2,7 @@ authors = [ 'TON Labs LTD ' ] edition = '2018' name = 'api_test' -version = '1.33.1' +version = '1.34.0' [dependencies] serde = '1.0.115' diff --git a/docs/reference/types-and-methods/mod_abi.md b/docs/reference/types-and-methods/mod_abi.md index afd5dc45b..192fe7261 100644 --- a/docs/reference/types-and-methods/mod_abi.md +++ b/docs/reference/types-and-methods/mod_abi.md @@ -35,6 +35,14 @@ Provides message encoding and decoding according to the ABI specification. ## Types [AbiErrorCode](mod\_abi.md#abierrorcode) +[AbiContractVariant](mod\_abi.md#abicontractvariant) + +[AbiJsonVariant](mod\_abi.md#abijsonvariant) + +[AbiHandleVariant](mod\_abi.md#abihandlevariant) + +[AbiSerializedVariant](mod\_abi.md#abiserializedvariant) + [Abi](mod\_abi.md#abi) [AbiHandle](mod\_abi.md#abihandle) @@ -45,14 +53,30 @@ Provides message encoding and decoding according to the ABI specification. [DeploySet](mod\_abi.md#deployset) +[SignerNoneVariant](mod\_abi.md#signernonevariant) – No keys are provided. + +[SignerExternalVariant](mod\_abi.md#signerexternalvariant) – Only public key is provided in unprefixed hex string format to generate unsigned message and `data_to_sign` which can be signed later. + +[SignerKeysVariant](mod\_abi.md#signerkeysvariant) – Key pair is provided for signing + +[SignerSigningBoxVariant](mod\_abi.md#signersigningboxvariant) – Signing Box interface is provided for signing, allows Dapps to sign messages using external APIs, such as HSM, cold wallet, etc. + [Signer](mod\_abi.md#signer) [MessageBodyType](mod\_abi.md#messagebodytype) +[StateInitSourceMessageVariant](mod\_abi.md#stateinitsourcemessagevariant) – Deploy message. + +[StateInitSourceStateInitVariant](mod\_abi.md#stateinitsourcestateinitvariant) – State init data. + +[StateInitSourceTvcVariant](mod\_abi.md#stateinitsourcetvcvariant) – Content of the TVC file. + [StateInitSource](mod\_abi.md#stateinitsource) [StateInitParams](mod\_abi.md#stateinitparams) +[MessageSourceEncodedVariant](mod\_abi.md#messagesourceencodedvariant) + [MessageSource](mod\_abi.md#messagesource) [AbiParam](mod\_abi.md#abiparam) @@ -736,42 +760,70 @@ One of the following value: - `EncodeInitialDataFailed = 314` -## Abi +## AbiContractVariant ```ts -type Abi = { - type: 'Contract' +type AbiContractVariant = { value: AbiContract -} | { - type: 'Json' +} +``` +- `value`: _[AbiContract](mod\_abi.md#abicontract)_ + + +## AbiJsonVariant +```ts +type AbiJsonVariant = { value: string -} | { - type: 'Handle' +} +``` +- `value`: _string_ + + +## AbiHandleVariant +```ts +type AbiHandleVariant = { value: AbiHandle -} | { - type: 'Serialized' +} +``` +- `value`: _[AbiHandle](mod\_abi.md#abihandle)_ + + +## AbiSerializedVariant +```ts +type AbiSerializedVariant = { value: AbiContract } ``` +- `value`: _[AbiContract](mod\_abi.md#abicontract)_ + + +## Abi +```ts +type Abi = ({ + type: 'Contract' +} & AbiContractVariant) | ({ + type: 'Json' +} & AbiJsonVariant) | ({ + type: 'Handle' +} & AbiHandleVariant) | ({ + type: 'Serialized' +} & AbiSerializedVariant) +``` Depends on value of the `type` field. When _type_ is _'Contract'_ - - `value`: _[AbiContract](mod\_abi.md#abicontract)_ When _type_ is _'Json'_ - - `value`: _string_ When _type_ is _'Handle'_ - - `value`: _[AbiHandle](mod\_abi.md#abihandle)_ When _type_ is _'Serialized'_ - - `value`: _[AbiContract](mod\_abi.md#abicontract)_ @@ -844,20 +896,62 @@ type DeploySet = {
Public key resolving priority:
1. Public key from deploy set.
2. Public key, specified in TVM file.
3. Public key, provided by Signer. +## SignerNoneVariant +No keys are provided. + +Creates an unsigned message. + +```ts +type SignerNoneVariant = { + +} +``` + + +## SignerExternalVariant +Only public key is provided in unprefixed hex string format to generate unsigned message and `data_to_sign` which can be signed later. + +```ts +type SignerExternalVariant = { + public_key: string +} +``` +- `public_key`: _string_ + + +## SignerKeysVariant +Key pair is provided for signing + +```ts +type SignerKeysVariant = { + keys: KeyPair +} +``` +- `keys`: _[KeyPair](mod\_crypto.md#keypair)_ + + +## SignerSigningBoxVariant +Signing Box interface is provided for signing, allows Dapps to sign messages using external APIs, such as HSM, cold wallet, etc. + +```ts +type SignerSigningBoxVariant = { + handle: SigningBoxHandle +} +``` +- `handle`: _[SigningBoxHandle](mod\_crypto.md#signingboxhandle)_ + + ## Signer ```ts -type Signer = { +type Signer = ({ type: 'None' -} | { +} & SignerNoneVariant) | ({ type: 'External' - public_key: string -} | { +} & SignerExternalVariant) | ({ type: 'Keys' - keys: KeyPair -} | { +} & SignerKeysVariant) | ({ type: 'SigningBox' - handle: SigningBoxHandle -} +} & SignerSigningBoxVariant) ``` Depends on value of the `type` field. @@ -872,21 +966,18 @@ When _type_ is _'External'_ Only public key is provided in unprefixed hex string format to generate unsigned message and `data_to_sign` which can be signed later. - - `public_key`: _string_ When _type_ is _'Keys'_ Key pair is provided for signing - - `keys`: _[KeyPair](mod\_crypto.md#keypair)_ When _type_ is _'SigningBox'_ Signing Box interface is provided for signing, allows Dapps to sign messages using external APIs, such as HSM, cold wallet, etc. - - `handle`: _[SigningBoxHandle](mod\_crypto.md#signingboxhandle)_ @@ -917,37 +1008,74 @@ One of the following value: - `Event = "Event"` – Message contains the input of the ABI event. -## StateInitSource +## StateInitSourceMessageVariant +Deploy message. + ```ts -type StateInitSource = { - type: 'Message' +type StateInitSourceMessageVariant = { source: MessageSource -} | { - type: 'StateInit' +} +``` +- `source`: _[MessageSource](mod\_abi.md#messagesource)_ + + +## StateInitSourceStateInitVariant +State init data. + +```ts +type StateInitSourceStateInitVariant = { code: string, data: string, library?: string -} | { - type: 'Tvc' +} +``` +- `code`: _string_ – Code BOC. +
Encoded in `base64`. +- `data`: _string_ – Data BOC. +
Encoded in `base64`. +- `library`?: _string_ – Library BOC. +
Encoded in `base64`. + + +## StateInitSourceTvcVariant +Content of the TVC file. + +Encoded in `base64`. + +```ts +type StateInitSourceTvcVariant = { tvc: string, public_key?: string, init_params?: StateInitParams } ``` +- `tvc`: _string_ +- `public_key`?: _string_ +- `init_params`?: _[StateInitParams](mod\_abi.md#stateinitparams)_ + + +## StateInitSource +```ts +type StateInitSource = ({ + type: 'Message' +} & StateInitSourceMessageVariant) | ({ + type: 'StateInit' +} & StateInitSourceStateInitVariant) | ({ + type: 'Tvc' +} & StateInitSourceTvcVariant) +``` Depends on value of the `type` field. When _type_ is _'Message'_ Deploy message. - - `source`: _[MessageSource](mod\_abi.md#messagesource)_ When _type_ is _'StateInit'_ State init data. - - `code`: _string_ – Code BOC.
Encoded in `base64`. - `data`: _string_ – Data BOC. @@ -961,7 +1089,6 @@ Content of the TVC file. Encoded in `base64`. - - `tvc`: _string_ - `public_key`?: _string_ - `init_params`?: _[StateInitParams](mod\_abi.md#stateinitparams)_ @@ -986,13 +1113,22 @@ type StateInitParams = { - `value`: _any_ -## MessageSource +## MessageSourceEncodedVariant ```ts -type MessageSource = { - type: 'Encoded' +type MessageSourceEncodedVariant = { message: string, abi?: Abi -} | ({ +} +``` +- `message`: _string_ +- `abi`?: _[Abi](mod\_abi.md#abi)_ + + +## MessageSource +```ts +type MessageSource = ({ + type: 'Encoded' +} & MessageSourceEncodedVariant) | ({ type: 'EncodingParams' } & ParamsOfEncodeMessage) ``` @@ -1000,7 +1136,6 @@ Depends on value of the `type` field. When _type_ is _'Encoded'_ - - `message`: _string_ - `abi`?: _[Abi](mod\_abi.md#abi)_ diff --git a/docs/reference/types-and-methods/mod_boc.md b/docs/reference/types-and-methods/mod_boc.md index cd39b165e..2d6e68b21 100644 --- a/docs/reference/types-and-methods/mod_boc.md +++ b/docs/reference/types-and-methods/mod_boc.md @@ -43,6 +43,10 @@ BOC manipulation module. [get_compiler_version](mod\_boc.md#get_compiler_version) – Returns the compiler version used to compile the code. ## Types +[BocCacheTypePinnedVariant](mod\_boc.md#boccachetypepinnedvariant) – Pin the BOC with `pin` name. + +[BocCacheTypeUnpinnedVariant](mod\_boc.md#boccachetypeunpinnedvariant) – + [BocCacheType](mod\_boc.md#boccachetype) [BocErrorCode](mod\_boc.md#bocerrorcode) @@ -79,6 +83,16 @@ BOC manipulation module. [ParamsOfBocCacheUnpin](mod\_boc.md#paramsofboccacheunpin) +[BuilderOpIntegerVariant](mod\_boc.md#builderopintegervariant) – Append integer to cell data. + +[BuilderOpBitStringVariant](mod\_boc.md#builderopbitstringvariant) – Append bit string to cell data. + +[BuilderOpCellVariant](mod\_boc.md#builderopcellvariant) – Append ref to nested cells. + +[BuilderOpCellBocVariant](mod\_boc.md#builderopcellbocvariant) – Append ref to nested cell. + +[BuilderOpAddressVariant](mod\_boc.md#builderopaddressvariant) – Address. + [BuilderOp](mod\_boc.md#builderop) – Cell builder operation. [ParamsOfEncodeBoc](mod\_boc.md#paramsofencodeboc) @@ -682,14 +696,36 @@ function get_compiler_version( # Types +## BocCacheTypePinnedVariant +Pin the BOC with `pin` name. + +Such BOC will not be removed from cache until it is unpinned + +```ts +type BocCacheTypePinnedVariant = { + pin: string +} +``` +- `pin`: _string_ + + +## BocCacheTypeUnpinnedVariant + + +```ts +type BocCacheTypeUnpinnedVariant = { + +} +``` + + ## BocCacheType ```ts -type BocCacheType = { +type BocCacheType = ({ type: 'Pinned' - pin: string -} | { +} & BocCacheTypePinnedVariant) | ({ type: 'Unpinned' -} +} & BocCacheTypeUnpinnedVariant) ``` Depends on value of the `type` field. @@ -699,7 +735,6 @@ Pin the BOC with `pin` name. Such BOC will not be removed from cache until it is unpinned - - `pin`: _string_ When _type_ is _'Unpinned'_ @@ -891,35 +926,87 @@ type ParamsOfBocCacheUnpin = {
If it is provided then only referenced BOC is unpinned -## BuilderOp -Cell builder operation. +## BuilderOpIntegerVariant +Append integer to cell data. ```ts -type BuilderOp = { - type: 'Integer' +type BuilderOpIntegerVariant = { size: number, value: any -} | { - type: 'BitString' +} +``` +- `size`: _number_ – Bit size of the value. +- `value`: _any_ – Value: - `Number` containing integer number. +
e.g. `123`, `-123`. - Decimal string. e.g. `"123"`, `"-123"`.
- `0x` prefixed hexadecimal string.
e.g `0x123`, `0X123`, `-0x123`. + + +## BuilderOpBitStringVariant +Append bit string to cell data. + +```ts +type BuilderOpBitStringVariant = { value: string -} | { - type: 'Cell' +} +``` +- `value`: _string_ – Bit string content using bitstring notation. See `TON VM specification` 1.0. +
Contains hexadecimal string representation:
- Can end with `_` tag.
- Can be prefixed with `x` or `X`.
- Can be prefixed with `x{` or `X{` and ended with `}`.

Contains binary string represented as a sequence
of `0` and `1` prefixed with `n` or `N`.

Examples:
`1AB`, `x1ab`, `X1AB`, `x{1abc}`, `X{1ABC}`
`2D9_`, `x2D9_`, `X2D9_`, `x{2D9_}`, `X{2D9_}`
`n00101101100`, `N00101101100` + + +## BuilderOpCellVariant +Append ref to nested cells. + +```ts +type BuilderOpCellVariant = { builder: BuilderOp[] -} | { - type: 'CellBoc' +} +``` +- `builder`: _[BuilderOp](mod\_boc.md#builderop)[]_ – Nested cell builder. + + +## BuilderOpCellBocVariant +Append ref to nested cell. + +```ts +type BuilderOpCellBocVariant = { boc: string -} | { - type: 'Address' +} +``` +- `boc`: _string_ – Nested cell BOC encoded with `base64` or BOC cache key. + + +## BuilderOpAddressVariant +Address. + +```ts +type BuilderOpAddressVariant = { address: string } ``` +- `address`: _string_ – Address in a common `workchain:account` or base64 format. + + +## BuilderOp +Cell builder operation. + +```ts +type BuilderOp = ({ + type: 'Integer' +} & BuilderOpIntegerVariant) | ({ + type: 'BitString' +} & BuilderOpBitStringVariant) | ({ + type: 'Cell' +} & BuilderOpCellVariant) | ({ + type: 'CellBoc' +} & BuilderOpCellBocVariant) | ({ + type: 'Address' +} & BuilderOpAddressVariant) +``` Depends on value of the `type` field. When _type_ is _'Integer'_ Append integer to cell data. - - `size`: _number_ – Bit size of the value. - `value`: _any_ – Value: - `Number` containing integer number.
e.g. `123`, `-123`. - Decimal string. e.g. `"123"`, `"-123"`.
- `0x` prefixed hexadecimal string.
e.g `0x123`, `0X123`, `-0x123`. @@ -928,7 +1015,6 @@ When _type_ is _'BitString'_ Append bit string to cell data. - - `value`: _string_ – Bit string content using bitstring notation. See `TON VM specification` 1.0.
Contains hexadecimal string representation:
- Can end with `_` tag.
- Can be prefixed with `x` or `X`.
- Can be prefixed with `x{` or `X{` and ended with `}`.

Contains binary string represented as a sequence
of `0` and `1` prefixed with `n` or `N`.

Examples:
`1AB`, `x1ab`, `X1AB`, `x{1abc}`, `X{1ABC}`
`2D9_`, `x2D9_`, `X2D9_`, `x{2D9_}`, `X{2D9_}`
`n00101101100`, `N00101101100` @@ -936,21 +1022,18 @@ When _type_ is _'Cell'_ Append ref to nested cells. - - `builder`: _[BuilderOp](mod\_boc.md#builderop)[]_ – Nested cell builder. When _type_ is _'CellBoc'_ Append ref to nested cell. - - `boc`: _string_ – Nested cell BOC encoded with `base64` or BOC cache key. When _type_ is _'Address'_ Address. - - `address`: _string_ – Address in a common `workchain:account` or base64 format. diff --git a/docs/reference/types-and-methods/mod_client.md b/docs/reference/types-and-methods/mod_client.md index 79b075b11..6ea9272e5 100644 --- a/docs/reference/types-and-methods/mod_client.md +++ b/docs/reference/types-and-methods/mod_client.md @@ -8,6 +8,8 @@ Provides information about library. [version](mod\_client.md#version) – Returns Core Library version +[config](mod\_client.md#config) – Returns Core Library API reference + [build_info](mod\_client.md#build_info) – Returns detailed information about this build. [resolve_app_request](mod\_client.md#resolve_app_request) – Resolves application request processing result @@ -35,6 +37,10 @@ Provides information about library. [ParamsOfAppRequest](mod\_client.md#paramsofapprequest) +[AppRequestResultErrorVariant](mod\_client.md#apprequestresulterrorvariant) – Error occurred during request processing + +[AppRequestResultOkVariant](mod\_client.md#apprequestresultokvariant) – Request processed successfully + [AppRequestResult](mod\_client.md#apprequestresult) [ResultOfGetApiReference](mod\_client.md#resultofgetapireference) @@ -83,6 +89,34 @@ function version(): Promise; - `version`: _string_ – Core Library version +## config + +Returns Core Library API reference + +```ts +type ClientConfig = { + network?: NetworkConfig, + crypto?: CryptoConfig, + abi?: AbiConfig, + boc?: BocConfig, + proofs?: ProofsConfig, + local_storage_path?: string +} + +function config(): Promise; +``` + + +### Result + +- `network`?: _[NetworkConfig](mod\_client.md#networkconfig)_ +- `crypto`?: _[CryptoConfig](mod\_client.md#cryptoconfig)_ +- `abi`?: _[AbiConfig](mod\_client.md#abiconfig)_ +- `boc`?: _[BocConfig](mod\_client.md#bocconfig)_ +- `proofs`?: _[ProofsConfig](mod\_client.md#proofsconfig)_ +- `local_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. @@ -377,30 +411,48 @@ type ParamsOfAppRequest = { - `request_data`: _any_ – Request describing data -## AppRequestResult +## AppRequestResultErrorVariant +Error occurred during request processing + ```ts -type AppRequestResult = { - type: 'Error' +type AppRequestResultErrorVariant = { text: string -} | { - type: 'Ok' +} +``` +- `text`: _string_ – Error description + + +## AppRequestResultOkVariant +Request processed successfully + +```ts +type AppRequestResultOkVariant = { result: any } ``` +- `result`: _any_ – Request processing result + + +## AppRequestResult +```ts +type AppRequestResult = ({ + type: 'Error' +} & AppRequestResultErrorVariant) | ({ + type: 'Ok' +} & AppRequestResultOkVariant) +``` 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 diff --git a/docs/reference/types-and-methods/mod_crypto.md b/docs/reference/types-and-methods/mod_crypto.md index a0d9d8955..01b53d0d0 100644 --- a/docs/reference/types-and-methods/mod_crypto.md +++ b/docs/reference/types-and-methods/mod_crypto.md @@ -129,6 +129,12 @@ Crypto functions. [NaclSecretBoxParamsEB](mod\_crypto.md#naclsecretboxparamseb) +[CryptoBoxSecretRandomSeedPhraseVariant](mod\_crypto.md#cryptoboxsecretrandomseedphrasevariant) – Creates Crypto Box from a random seed phrase. This option can be used if a developer doesn't want the seed phrase to leave the core library's memory, where it is stored encrypted. + +[CryptoBoxSecretPredefinedSeedPhraseVariant](mod\_crypto.md#cryptoboxsecretpredefinedseedphrasevariant) – Restores crypto box instance from an existing seed phrase. This type should be used when Crypto Box is initialized from a seed phrase, entered by a user. + +[CryptoBoxSecretEncryptedSecretVariant](mod\_crypto.md#cryptoboxsecretencryptedsecretvariant) – Use this type for wallet reinitializations, when you already have `encrypted_secret` on hands. To get `encrypted_secret`, use `get_crypto_box_info` function after you initialized your crypto box for the first time. + [CryptoBoxSecret](mod\_crypto.md#cryptoboxsecret) – Crypto Box Secret. [CryptoBoxHandle](mod\_crypto.md#cryptoboxhandle) @@ -255,8 +261,12 @@ Crypto functions. [RegisteredCryptoBox](mod\_crypto.md#registeredcryptobox) +[ParamsOfAppPasswordProviderGetPasswordVariant](mod\_crypto.md#paramsofapppasswordprovidergetpasswordvariant) + [ParamsOfAppPasswordProvider](mod\_crypto.md#paramsofapppasswordprovider) – Interface that provides a callback that returns an encrypted password, used for cryptobox secret encryption +[ResultOfAppPasswordProviderGetPasswordVariant](mod\_crypto.md#resultofapppasswordprovidergetpasswordvariant) + [ResultOfAppPasswordProvider](mod\_crypto.md#resultofapppasswordprovider) [ResultOfGetCryptoBoxInfo](mod\_crypto.md#resultofgetcryptoboxinfo) @@ -271,8 +281,16 @@ Crypto functions. [RegisteredEncryptionBox](mod\_crypto.md#registeredencryptionbox) +[ParamsOfAppSigningBoxGetPublicKeyVariant](mod\_crypto.md#paramsofappsigningboxgetpublickeyvariant) – Get signing box public key + +[ParamsOfAppSigningBoxSignVariant](mod\_crypto.md#paramsofappsigningboxsignvariant) – Sign data + [ParamsOfAppSigningBox](mod\_crypto.md#paramsofappsigningbox) – Signing box callbacks. +[ResultOfAppSigningBoxGetPublicKeyVariant](mod\_crypto.md#resultofappsigningboxgetpublickeyvariant) – Result of getting public key + +[ResultOfAppSigningBoxSignVariant](mod\_crypto.md#resultofappsigningboxsignvariant) – Result of signing data + [ResultOfAppSigningBox](mod\_crypto.md#resultofappsigningbox) – Returning values from signing box callbacks. [ResultOfSigningBoxGetPublicKey](mod\_crypto.md#resultofsigningboxgetpublickey) @@ -281,8 +299,20 @@ Crypto functions. [ResultOfSigningBoxSign](mod\_crypto.md#resultofsigningboxsign) +[ParamsOfAppEncryptionBoxGetInfoVariant](mod\_crypto.md#paramsofappencryptionboxgetinfovariant) – Get encryption box info + +[ParamsOfAppEncryptionBoxEncryptVariant](mod\_crypto.md#paramsofappencryptionboxencryptvariant) – Encrypt data + +[ParamsOfAppEncryptionBoxDecryptVariant](mod\_crypto.md#paramsofappencryptionboxdecryptvariant) – Decrypt data + [ParamsOfAppEncryptionBox](mod\_crypto.md#paramsofappencryptionbox) – Interface for data encryption/decryption +[ResultOfAppEncryptionBoxGetInfoVariant](mod\_crypto.md#resultofappencryptionboxgetinfovariant) – Result of getting encryption box info + +[ResultOfAppEncryptionBoxEncryptVariant](mod\_crypto.md#resultofappencryptionboxencryptvariant) – Result of encrypting data + +[ResultOfAppEncryptionBoxDecryptVariant](mod\_crypto.md#resultofappencryptionboxdecryptvariant) – Result of decrypting data + [ResultOfAppEncryptionBox](mod\_crypto.md#resultofappencryptionbox) – Returning values from signing box callbacks. [ParamsOfEncryptionBoxGetInfo](mod\_crypto.md#paramsofencryptionboxgetinfo) @@ -2022,24 +2052,74 @@ type NaclSecretBoxParamsEB = { - `nonce`: _string_ – Nonce in `hex` -## CryptoBoxSecret -Crypto Box Secret. +## CryptoBoxSecretRandomSeedPhraseVariant +Creates Crypto Box from a random seed phrase. This option can be used if a developer doesn't want the seed phrase to leave the core library's memory, where it is stored encrypted. + +This type should be used upon the first wallet initialization, all further initializations +should use `EncryptedSecret` type instead. + +Get `encrypted_secret` with `get_crypto_box_info` function and store it on your side. ```ts -type CryptoBoxSecret = { - type: 'RandomSeedPhrase' +type CryptoBoxSecretRandomSeedPhraseVariant = { dictionary: number, wordcount: number -} | { - type: 'PredefinedSeedPhrase' +} +``` +- `dictionary`: _number_ +- `wordcount`: _number_ + + +## CryptoBoxSecretPredefinedSeedPhraseVariant +Restores crypto box instance from an existing seed phrase. This type should be used when Crypto Box is initialized from a seed phrase, entered by a user. + +This type should be used only upon the first wallet initialization, all further +initializations should use `EncryptedSecret` type instead. + +Get `encrypted_secret` with `get_crypto_box_info` function and store it on your side. + +```ts +type CryptoBoxSecretPredefinedSeedPhraseVariant = { phrase: string, dictionary: number, wordcount: number -} | { - type: 'EncryptedSecret' +} +``` +- `phrase`: _string_ +- `dictionary`: _number_ +- `wordcount`: _number_ + + +## CryptoBoxSecretEncryptedSecretVariant +Use this type for wallet reinitializations, when you already have `encrypted_secret` on hands. To get `encrypted_secret`, use `get_crypto_box_info` function after you initialized your crypto box for the first time. + +It is an object, containing seed phrase or private key, encrypted with +`secret_encryption_salt` and password from `password_provider`. + +Note that if you want to change salt or password provider, then you need to reinitialize +the wallet with `PredefinedSeedPhrase`, then get `EncryptedSecret` via `get_crypto_box_info`, +store it somewhere, and only after that initialize the wallet with `EncryptedSecret` type. + +```ts +type CryptoBoxSecretEncryptedSecretVariant = { encrypted_secret: string } ``` +- `encrypted_secret`: _string_ – It is an object, containing encrypted seed phrase or private key (now we support only seed phrase). + + +## CryptoBoxSecret +Crypto Box Secret. + +```ts +type CryptoBoxSecret = ({ + type: 'RandomSeedPhrase' +} & CryptoBoxSecretRandomSeedPhraseVariant) | ({ + type: 'PredefinedSeedPhrase' +} & CryptoBoxSecretPredefinedSeedPhraseVariant) | ({ + type: 'EncryptedSecret' +} & CryptoBoxSecretEncryptedSecretVariant) +``` Depends on value of the `type` field. When _type_ is _'RandomSeedPhrase'_ @@ -2051,7 +2131,6 @@ should use `EncryptedSecret` type instead. Get `encrypted_secret` with `get_crypto_box_info` function and store it on your side. - - `dictionary`: _number_ - `wordcount`: _number_ @@ -2064,7 +2143,6 @@ initializations should use `EncryptedSecret` type instead. Get `encrypted_secret` with `get_crypto_box_info` function and store it on your side. - - `phrase`: _string_ - `dictionary`: _number_ - `wordcount`: _number_ @@ -2080,7 +2158,6 @@ Note that if you want to change salt or password provider, then you need to rein the wallet with `PredefinedSeedPhrase`, then get `EncryptedSecret` via `get_crypto_box_info`, store it somewhere, and only after that initialize the wallet with `EncryptedSecret` type. - - `encrypted_secret`: _string_ – It is an object, containing encrypted seed phrase or private key (now we support only seed phrase). @@ -2777,6 +2854,15 @@ type RegisteredCryptoBox = { - `handle`: _[CryptoBoxHandle](mod\_crypto.md#cryptoboxhandle)_ +## ParamsOfAppPasswordProviderGetPasswordVariant +```ts +type ParamsOfAppPasswordProviderGetPasswordVariant = { + encryption_public_key: string +} +``` +- `encryption_public_key`: _string_ – Temporary library pubkey, that is used on application side for password encryption, along with application temporary private key and nonce. Used for password decryption on library side. + + ## ParamsOfAppPasswordProvider Interface that provides a callback that returns an encrypted password, used for cryptobox secret encryption @@ -2790,16 +2876,14 @@ and encrypt the password with naclbox function using nacl_box_keypair.secret and encryption_public_key keys + nonce = 24-byte prefix of encryption_public_key. ```ts -type ParamsOfAppPasswordProvider = { +type ParamsOfAppPasswordProvider = ({ type: 'GetPassword' - encryption_public_key: string -} +} & ParamsOfAppPasswordProviderGetPasswordVariant) ``` Depends on value of the `type` field. When _type_ is _'GetPassword'_ - - `encryption_public_key`: _string_ – Temporary library pubkey, that is used on application side for password encryption, along with application temporary private key and nonce. Used for password decryption on library side. @@ -2809,19 +2893,28 @@ Variant constructors: function paramsOfAppPasswordProviderGetPassword(encryption_public_key: string): ParamsOfAppPasswordProvider; ``` -## ResultOfAppPasswordProvider +## ResultOfAppPasswordProviderGetPasswordVariant ```ts -type ResultOfAppPasswordProvider = { - type: 'GetPassword' +type ResultOfAppPasswordProviderGetPasswordVariant = { encrypted_password: string, app_encryption_pubkey: string } ``` +- `encrypted_password`: _string_ – Password, encrypted and encoded to base64. Crypto box uses this password to decrypt its secret (seed phrase). +- `app_encryption_pubkey`: _string_ – Hex encoded public key of a temporary key pair, used for password encryption on application side. +
Used together with `encryption_public_key` to decode `encrypted_password`. + + +## ResultOfAppPasswordProvider +```ts +type ResultOfAppPasswordProvider = ({ + type: 'GetPassword' +} & ResultOfAppPasswordProviderGetPasswordVariant) +``` Depends on value of the `type` field. When _type_ is _'GetPassword'_ - - `encrypted_password`: _string_ – Password, encrypted and encoded to base64. Crypto box uses this password to decrypt its secret (seed phrase). - `app_encryption_pubkey`: _string_ – Hex encoded public key of a temporary key pair, used for password encryption on application side.
Used together with `encryption_public_key` to decode `encrypted_password`. @@ -2903,16 +2996,36 @@ type RegisteredEncryptionBox = { - `handle`: _[EncryptionBoxHandle](mod\_crypto.md#encryptionboxhandle)_ – Handle of the encryption box. +## ParamsOfAppSigningBoxGetPublicKeyVariant +Get signing box public key + +```ts +type ParamsOfAppSigningBoxGetPublicKeyVariant = { + +} +``` + + +## ParamsOfAppSigningBoxSignVariant +Sign data + +```ts +type ParamsOfAppSigningBoxSignVariant = { + unsigned: string +} +``` +- `unsigned`: _string_ – Data to sign encoded as base64 + + ## ParamsOfAppSigningBox Signing box callbacks. ```ts -type ParamsOfAppSigningBox = { +type ParamsOfAppSigningBox = ({ type: 'GetPublicKey' -} | { +} & ParamsOfAppSigningBoxGetPublicKeyVariant) | ({ type: 'Sign' - unsigned: string -} +} & ParamsOfAppSigningBoxSignVariant) ``` Depends on value of the `type` field. @@ -2925,7 +3038,6 @@ When _type_ is _'Sign'_ Sign data - - `unsigned`: _string_ – Data to sign encoded as base64 @@ -2936,17 +3048,37 @@ function paramsOfAppSigningBoxGetPublicKey(): ParamsOfAppSigningBox; function paramsOfAppSigningBoxSign(unsigned: string): ParamsOfAppSigningBox; ``` +## ResultOfAppSigningBoxGetPublicKeyVariant +Result of getting public key + +```ts +type ResultOfAppSigningBoxGetPublicKeyVariant = { + public_key: string +} +``` +- `public_key`: _string_ – Signing box public key + + +## ResultOfAppSigningBoxSignVariant +Result of signing data + +```ts +type ResultOfAppSigningBoxSignVariant = { + signature: string +} +``` +- `signature`: _string_ – Data signature encoded as hex + + ## ResultOfAppSigningBox Returning values from signing box callbacks. ```ts -type ResultOfAppSigningBox = { +type ResultOfAppSigningBox = ({ type: 'GetPublicKey' - public_key: string -} | { +} & ResultOfAppSigningBoxGetPublicKeyVariant) | ({ type: 'Sign' - signature: string -} +} & ResultOfAppSigningBoxSignVariant) ``` Depends on value of the `type` field. @@ -2954,14 +3086,12 @@ When _type_ is _'GetPublicKey'_ Result of getting public key - - `public_key`: _string_ – Signing box public key When _type_ is _'Sign'_ Result of signing data - - `signature`: _string_ – Data signature encoded as hex @@ -3004,19 +3134,49 @@ type ResultOfSigningBoxSign = {
Encoded with `hex`. +## ParamsOfAppEncryptionBoxGetInfoVariant +Get encryption box info + +```ts +type ParamsOfAppEncryptionBoxGetInfoVariant = { + +} +``` + + +## ParamsOfAppEncryptionBoxEncryptVariant +Encrypt data + +```ts +type ParamsOfAppEncryptionBoxEncryptVariant = { + data: string +} +``` +- `data`: _string_ – Data, encoded in Base64 + + +## ParamsOfAppEncryptionBoxDecryptVariant +Decrypt data + +```ts +type ParamsOfAppEncryptionBoxDecryptVariant = { + data: string +} +``` +- `data`: _string_ – Data, encoded in Base64 + + ## ParamsOfAppEncryptionBox Interface for data encryption/decryption ```ts -type ParamsOfAppEncryptionBox = { +type ParamsOfAppEncryptionBox = ({ type: 'GetInfo' -} | { +} & ParamsOfAppEncryptionBoxGetInfoVariant) | ({ type: 'Encrypt' - data: string -} | { +} & ParamsOfAppEncryptionBoxEncryptVariant) | ({ type: 'Decrypt' - data: string -} +} & ParamsOfAppEncryptionBoxDecryptVariant) ``` Depends on value of the `type` field. @@ -3029,14 +3189,12 @@ When _type_ is _'Encrypt'_ Encrypt data - - `data`: _string_ – Data, encoded in Base64 When _type_ is _'Decrypt'_ Decrypt data - - `data`: _string_ – Data, encoded in Base64 @@ -3048,20 +3206,50 @@ function paramsOfAppEncryptionBoxEncrypt(data: string): ParamsOfAppEncryptionBox function paramsOfAppEncryptionBoxDecrypt(data: string): ParamsOfAppEncryptionBox; ``` +## ResultOfAppEncryptionBoxGetInfoVariant +Result of getting encryption box info + +```ts +type ResultOfAppEncryptionBoxGetInfoVariant = { + info: EncryptionBoxInfo +} +``` +- `info`: _[EncryptionBoxInfo](mod\_crypto.md#encryptionboxinfo)_ + + +## ResultOfAppEncryptionBoxEncryptVariant +Result of encrypting data + +```ts +type ResultOfAppEncryptionBoxEncryptVariant = { + data: string +} +``` +- `data`: _string_ – Encrypted data, encoded in Base64 + + +## ResultOfAppEncryptionBoxDecryptVariant +Result of decrypting data + +```ts +type ResultOfAppEncryptionBoxDecryptVariant = { + data: string +} +``` +- `data`: _string_ – Decrypted data, encoded in Base64 + + ## ResultOfAppEncryptionBox Returning values from signing box callbacks. ```ts -type ResultOfAppEncryptionBox = { +type ResultOfAppEncryptionBox = ({ type: 'GetInfo' - info: EncryptionBoxInfo -} | { +} & ResultOfAppEncryptionBoxGetInfoVariant) | ({ type: 'Encrypt' - data: string -} | { +} & ResultOfAppEncryptionBoxEncryptVariant) | ({ type: 'Decrypt' - data: string -} +} & ResultOfAppEncryptionBoxDecryptVariant) ``` Depends on value of the `type` field. @@ -3069,21 +3257,18 @@ When _type_ is _'GetInfo'_ Result of getting encryption box info - - `info`: _[EncryptionBoxInfo](mod\_crypto.md#encryptionboxinfo)_ When _type_ is _'Encrypt'_ Result of encrypting data - - `data`: _string_ – Encrypted data, encoded in Base64 When _type_ is _'Decrypt'_ Result of decrypting data - - `data`: _string_ – Decrypted data, encoded in Base64 @@ -3178,35 +3363,21 @@ and encryption_public_key keys + nonce = 24-byte prefix of encryption_public_key ```ts -type ParamsOfAppPasswordProviderGetPassword = { - encryption_public_key: string -} - -type ResultOfAppPasswordProviderGetPassword = { - encrypted_password: string, - app_encryption_pubkey: string -} - export interface AppPasswordProvider { - get_password(params: ParamsOfAppPasswordProviderGetPassword): Promise, + get_password(params: ParamsOfAppPasswordProviderGetPasswordVariant): Promise, } ``` ## get_password ```ts -type ParamsOfAppPasswordProviderGetPassword = { - encryption_public_key: string -} +type ParamsOfAppPasswordProviderGetPasswordVariant = ParamsOfAppPasswordProviderGetPasswordVariant -type ResultOfAppPasswordProviderGetPassword = { - encrypted_password: string, - app_encryption_pubkey: string -} +type ResultOfAppPasswordProviderGetPasswordVariant = ResultOfAppPasswordProviderGetPasswordVariant function get_password( - params: ParamsOfAppPasswordProviderGetPassword, -): Promise; + params: ParamsOfAppPasswordProviderGetPasswordVariant, +): Promise; ``` ### Parameters - `encryption_public_key`: _string_ – Temporary library pubkey, that is used on application side for password encryption, along with application temporary private key and nonce. Used for password decryption on library side. @@ -3225,21 +3396,9 @@ Signing box callbacks. ```ts -type ResultOfAppSigningBoxGetPublicKey = { - public_key: string -} - -type ParamsOfAppSigningBoxSign = { - unsigned: string -} - -type ResultOfAppSigningBoxSign = { - signature: string -} - export interface AppSigningBox { - get_public_key(): Promise, - sign(params: ParamsOfAppSigningBoxSign): Promise, + get_public_key(): Promise, + sign(params: ParamsOfAppSigningBoxSignVariant): Promise, } ``` @@ -3248,11 +3407,9 @@ export interface AppSigningBox { Get signing box public key ```ts -type ResultOfAppSigningBoxGetPublicKey = { - public_key: string -} +type ResultOfAppSigningBoxGetPublicKeyVariant = ResultOfAppSigningBoxGetPublicKeyVariant -function get_public_key(): Promise; +function get_public_key(): Promise; ``` @@ -3266,17 +3423,13 @@ function get_public_key(): Promise; Sign data ```ts -type ParamsOfAppSigningBoxSign = { - unsigned: string -} +type ParamsOfAppSigningBoxSignVariant = ParamsOfAppSigningBoxSignVariant -type ResultOfAppSigningBoxSign = { - signature: string -} +type ResultOfAppSigningBoxSignVariant = ResultOfAppSigningBoxSignVariant function sign( - params: ParamsOfAppSigningBoxSign, -): Promise; + params: ParamsOfAppSigningBoxSignVariant, +): Promise; ``` ### Parameters - `unsigned`: _string_ – Data to sign encoded as base64 @@ -3293,30 +3446,10 @@ Interface for data encryption/decryption ```ts -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, - encrypt(params: ParamsOfAppEncryptionBoxEncrypt): Promise, - decrypt(params: ParamsOfAppEncryptionBoxDecrypt): Promise, + get_info(): Promise, + encrypt(params: ParamsOfAppEncryptionBoxEncryptVariant): Promise, + decrypt(params: ParamsOfAppEncryptionBoxDecryptVariant): Promise, } ``` @@ -3325,11 +3458,9 @@ export interface AppEncryptionBox { Get encryption box info ```ts -type ResultOfAppEncryptionBoxGetInfo = { - info: EncryptionBoxInfo -} +type ResultOfAppEncryptionBoxGetInfoVariant = ResultOfAppEncryptionBoxGetInfoVariant -function get_info(): Promise; +function get_info(): Promise; ``` @@ -3343,17 +3474,13 @@ function get_info(): Promise; Encrypt data ```ts -type ParamsOfAppEncryptionBoxEncrypt = { - data: string -} +type ParamsOfAppEncryptionBoxEncryptVariant = ParamsOfAppEncryptionBoxEncryptVariant -type ResultOfAppEncryptionBoxEncrypt = { - data: string -} +type ResultOfAppEncryptionBoxEncryptVariant = ResultOfAppEncryptionBoxEncryptVariant function encrypt( - params: ParamsOfAppEncryptionBoxEncrypt, -): Promise; + params: ParamsOfAppEncryptionBoxEncryptVariant, +): Promise; ``` ### Parameters - `data`: _string_ – Data, encoded in Base64 @@ -3369,17 +3496,13 @@ function encrypt( Decrypt data ```ts -type ParamsOfAppEncryptionBoxDecrypt = { - data: string -} +type ParamsOfAppEncryptionBoxDecryptVariant = ParamsOfAppEncryptionBoxDecryptVariant -type ResultOfAppEncryptionBoxDecrypt = { - data: string -} +type ResultOfAppEncryptionBoxDecryptVariant = ResultOfAppEncryptionBoxDecryptVariant function decrypt( - params: ParamsOfAppEncryptionBoxDecrypt, -): Promise; + params: ParamsOfAppEncryptionBoxDecryptVariant, +): Promise; ``` ### Parameters - `data`: _string_ – Data, encoded in Base64 diff --git a/docs/reference/types-and-methods/mod_debot.md b/docs/reference/types-and-methods/mod_debot.md index 2b5b40d8b..9fa7cc4c1 100644 --- a/docs/reference/types-and-methods/mod_debot.md +++ b/docs/reference/types-and-methods/mod_debot.md @@ -25,6 +25,8 @@ [DebotInfo](mod\_debot.md#debotinfo) – [UNSTABLE](UNSTABLE.md) Describes DeBot metadata. +[DebotActivityTransactionVariant](mod\_debot.md#debotactivitytransactionvariant) – DeBot wants to create new transaction in blockchain. + [DebotActivity](mod\_debot.md#debotactivity) – [UNSTABLE](UNSTABLE.md) Describes the operation that the DeBot wants to perform. [Spending](mod\_debot.md#spending) – [UNSTABLE](UNSTABLE.md) Describes how much funds will be debited from the target contract balance as a result of the transaction. @@ -33,8 +35,34 @@ [RegisteredDebot](mod\_debot.md#registereddebot) – [UNSTABLE](UNSTABLE.md) Structure for storing debot handle returned from `init` function. +[ParamsOfAppDebotBrowserLogVariant](mod\_debot.md#paramsofappdebotbrowserlogvariant) – Print message to user. + +[ParamsOfAppDebotBrowserSwitchVariant](mod\_debot.md#paramsofappdebotbrowserswitchvariant) – Switch debot to another context (menu). + +[ParamsOfAppDebotBrowserSwitchCompletedVariant](mod\_debot.md#paramsofappdebotbrowserswitchcompletedvariant) – Notify browser that all context actions are shown. + +[ParamsOfAppDebotBrowserShowActionVariant](mod\_debot.md#paramsofappdebotbrowsershowactionvariant) – Show action to the user. Called after `switch` for each action in context. + +[ParamsOfAppDebotBrowserInputVariant](mod\_debot.md#paramsofappdebotbrowserinputvariant) – Request user input. + +[ParamsOfAppDebotBrowserGetSigningBoxVariant](mod\_debot.md#paramsofappdebotbrowsergetsigningboxvariant) – Get signing box to sign data. + +[ParamsOfAppDebotBrowserInvokeDebotVariant](mod\_debot.md#paramsofappdebotbrowserinvokedebotvariant) – Execute action of another debot. + +[ParamsOfAppDebotBrowserSendVariant](mod\_debot.md#paramsofappdebotbrowsersendvariant) – Used by Debot to call DInterface implemented by Debot Browser. + +[ParamsOfAppDebotBrowserApproveVariant](mod\_debot.md#paramsofappdebotbrowserapprovevariant) – Requests permission from DeBot Browser to execute DeBot operation. + [ParamsOfAppDebotBrowser](mod\_debot.md#paramsofappdebotbrowser) – [UNSTABLE](UNSTABLE.md) Debot Browser callbacks +[ResultOfAppDebotBrowserInputVariant](mod\_debot.md#resultofappdebotbrowserinputvariant) – Result of user input. + +[ResultOfAppDebotBrowserGetSigningBoxVariant](mod\_debot.md#resultofappdebotbrowsergetsigningboxvariant) – Result of getting signing box. + +[ResultOfAppDebotBrowserInvokeDebotVariant](mod\_debot.md#resultofappdebotbrowserinvokedebotvariant) – Result of debot invoking. + +[ResultOfAppDebotBrowserApproveVariant](mod\_debot.md#resultofappdebotbrowserapprovevariant) – Result of `approve` callback. + [ResultOfAppDebotBrowser](mod\_debot.md#resultofappdebotbrowser) – [UNSTABLE](UNSTABLE.md) Returning values from Debot Browser callbacks. [ParamsOfStart](mod\_debot.md#paramsofstart) – [UNSTABLE](UNSTABLE.md) Parameters to start DeBot. DeBot must be already initialized with init() function. @@ -315,12 +343,11 @@ type DebotInfo = { - `dabiVersion`: _string_ – ABI version ("x.y") supported by DeBot -## DebotActivity -[UNSTABLE](UNSTABLE.md) Describes the operation that the DeBot wants to perform. +## DebotActivityTransactionVariant +DeBot wants to create new transaction in blockchain. ```ts -type DebotActivity = { - type: 'Transaction' +type DebotActivityTransactionVariant = { msg: string, dst: string, out: Spending[], @@ -330,13 +357,29 @@ type DebotActivity = { signing_box_handle: number } ``` +- `msg`: _string_ – External inbound message BOC. +- `dst`: _string_ – Target smart contract address. +- `out`: _[Spending](mod\_debot.md#spending)[]_ – List of spendings as a result of transaction. +- `fee`: _bigint_ – Transaction total fee. +- `setcode`: _boolean_ – Indicates if target smart contract updates its code. +- `signkey`: _string_ – Public key from keypair that was used to sign external message. +- `signing_box_handle`: _number_ – Signing box handle used to sign external message. + + +## DebotActivity +[UNSTABLE](UNSTABLE.md) Describes the operation that the DeBot wants to perform. + +```ts +type DebotActivity = ({ + type: 'Transaction' +} & DebotActivityTransactionVariant) +``` Depends on value of the `type` field. When _type_ is _'Transaction'_ DeBot wants to create new transaction in blockchain. - - `msg`: _string_ – External inbound message BOC. - `dst`: _string_ – Target smart contract address. - `out`: _[Spending](mod\_debot.md#spending)[]_ – List of spendings as a result of transaction. @@ -391,39 +434,133 @@ type RegisteredDebot = { - `info`: _[DebotInfo](mod\_debot.md#debotinfo)_ – Debot metadata. +## ParamsOfAppDebotBrowserLogVariant +Print message to user. + +```ts +type ParamsOfAppDebotBrowserLogVariant = { + msg: string +} +``` +- `msg`: _string_ – A string that must be printed to user. + + +## ParamsOfAppDebotBrowserSwitchVariant +Switch debot to another context (menu). + +```ts +type ParamsOfAppDebotBrowserSwitchVariant = { + context_id: number +} +``` +- `context_id`: _number_ – Debot context ID to which debot is switched. + + +## ParamsOfAppDebotBrowserSwitchCompletedVariant +Notify browser that all context actions are shown. + +```ts +type ParamsOfAppDebotBrowserSwitchCompletedVariant = { + +} +``` + + +## ParamsOfAppDebotBrowserShowActionVariant +Show action to the user. Called after `switch` for each action in context. + +```ts +type ParamsOfAppDebotBrowserShowActionVariant = { + action: DebotAction +} +``` +- `action`: _[DebotAction](mod\_debot.md#debotaction)_ – Debot action that must be shown to user as menu item. At least `description` property must be shown from [DebotAction] structure. + + +## ParamsOfAppDebotBrowserInputVariant +Request user input. + +```ts +type ParamsOfAppDebotBrowserInputVariant = { + prompt: string +} +``` +- `prompt`: _string_ – A prompt string that must be printed to user before input request. + + +## ParamsOfAppDebotBrowserGetSigningBoxVariant +Get signing box to sign data. + +Signing box returned is owned and disposed by debot engine + +```ts +type ParamsOfAppDebotBrowserGetSigningBoxVariant = { + +} +``` + + +## ParamsOfAppDebotBrowserInvokeDebotVariant +Execute action of another debot. + +```ts +type ParamsOfAppDebotBrowserInvokeDebotVariant = { + debot_addr: string, + action: DebotAction +} +``` +- `debot_addr`: _string_ – Address of debot in blockchain. +- `action`: _[DebotAction](mod\_debot.md#debotaction)_ – Debot action to execute. + + +## ParamsOfAppDebotBrowserSendVariant +Used by Debot to call DInterface implemented by Debot Browser. + +```ts +type ParamsOfAppDebotBrowserSendVariant = { + message: string +} +``` +- `message`: _string_ – Internal message to DInterface address. +
Message body contains interface function and parameters. + + +## ParamsOfAppDebotBrowserApproveVariant +Requests permission from DeBot Browser to execute DeBot operation. + +```ts +type ParamsOfAppDebotBrowserApproveVariant = { + activity: DebotActivity +} +``` +- `activity`: _[DebotActivity](mod\_debot.md#debotactivity)_ – DeBot activity details. + + ## ParamsOfAppDebotBrowser [UNSTABLE](UNSTABLE.md) Debot Browser callbacks Called by debot engine to communicate with debot browser. ```ts -type ParamsOfAppDebotBrowser = { +type ParamsOfAppDebotBrowser = ({ type: 'Log' - msg: string -} | { +} & ParamsOfAppDebotBrowserLogVariant) | ({ type: 'Switch' - context_id: number -} | { +} & ParamsOfAppDebotBrowserSwitchVariant) | ({ type: 'SwitchCompleted' -} | { +} & ParamsOfAppDebotBrowserSwitchCompletedVariant) | ({ type: 'ShowAction' - action: DebotAction -} | { +} & ParamsOfAppDebotBrowserShowActionVariant) | ({ type: 'Input' - prompt: string -} | { +} & ParamsOfAppDebotBrowserInputVariant) | ({ type: 'GetSigningBox' -} | { +} & ParamsOfAppDebotBrowserGetSigningBoxVariant) | ({ type: 'InvokeDebot' - debot_addr: string, - action: DebotAction -} | { +} & ParamsOfAppDebotBrowserInvokeDebotVariant) | ({ type: 'Send' - message: string -} | { +} & ParamsOfAppDebotBrowserSendVariant) | ({ type: 'Approve' - activity: DebotActivity -} +} & ParamsOfAppDebotBrowserApproveVariant) ``` Depends on value of the `type` field. @@ -431,14 +568,12 @@ When _type_ is _'Log'_ Print message to user. - - `msg`: _string_ – A string that must be printed to user. When _type_ is _'Switch'_ Switch debot to another context (menu). - - `context_id`: _number_ – Debot context ID to which debot is switched. When _type_ is _'SwitchCompleted'_ @@ -450,14 +585,12 @@ When _type_ is _'ShowAction'_ Show action to the user. Called after `switch` for each action in context. - - `action`: _[DebotAction](mod\_debot.md#debotaction)_ – Debot action that must be shown to user as menu item. At least `description` property must be shown from [DebotAction] structure. When _type_ is _'Input'_ Request user input. - - `prompt`: _string_ – A prompt string that must be printed to user before input request. When _type_ is _'GetSigningBox'_ @@ -471,7 +604,6 @@ When _type_ is _'InvokeDebot'_ Execute action of another debot. - - `debot_addr`: _string_ – Address of debot in blockchain. - `action`: _[DebotAction](mod\_debot.md#debotaction)_ – Debot action to execute. @@ -479,7 +611,6 @@ When _type_ is _'Send'_ Used by Debot to call DInterface implemented by Debot Browser. - - `message`: _string_ – Internal message to DInterface address.
Message body contains interface function and parameters. @@ -487,7 +618,6 @@ When _type_ is _'Approve'_ Requests permission from DeBot Browser to execute DeBot operation. - - `activity`: _[DebotActivity](mod\_debot.md#debotactivity)_ – DeBot activity details. @@ -505,22 +635,63 @@ function paramsOfAppDebotBrowserSend(message: string): ParamsOfAppDebotBrowser; function paramsOfAppDebotBrowserApprove(activity: DebotActivity): ParamsOfAppDebotBrowser; ``` +## ResultOfAppDebotBrowserInputVariant +Result of user input. + +```ts +type ResultOfAppDebotBrowserInputVariant = { + value: string +} +``` +- `value`: _string_ – String entered by user. + + +## ResultOfAppDebotBrowserGetSigningBoxVariant +Result of getting signing box. + +```ts +type ResultOfAppDebotBrowserGetSigningBoxVariant = { + signing_box: SigningBoxHandle +} +``` +- `signing_box`: _[SigningBoxHandle](mod\_crypto.md#signingboxhandle)_ – Signing box for signing data requested by debot engine. +
Signing box is owned and disposed by debot engine + + +## ResultOfAppDebotBrowserInvokeDebotVariant +Result of debot invoking. + +```ts +type ResultOfAppDebotBrowserInvokeDebotVariant = { + +} +``` + + +## ResultOfAppDebotBrowserApproveVariant +Result of `approve` callback. + +```ts +type ResultOfAppDebotBrowserApproveVariant = { + approved: boolean +} +``` +- `approved`: _boolean_ – Indicates whether the DeBot is allowed to perform the specified operation. + + ## ResultOfAppDebotBrowser [UNSTABLE](UNSTABLE.md) Returning values from Debot Browser callbacks. ```ts -type ResultOfAppDebotBrowser = { +type ResultOfAppDebotBrowser = ({ type: 'Input' - value: string -} | { +} & ResultOfAppDebotBrowserInputVariant) | ({ type: 'GetSigningBox' - signing_box: SigningBoxHandle -} | { +} & ResultOfAppDebotBrowserGetSigningBoxVariant) | ({ type: 'InvokeDebot' -} | { +} & ResultOfAppDebotBrowserInvokeDebotVariant) | ({ type: 'Approve' - approved: boolean -} +} & ResultOfAppDebotBrowserApproveVariant) ``` Depends on value of the `type` field. @@ -528,14 +699,12 @@ When _type_ is _'Input'_ Result of user input. - - `value`: _string_ – String entered by user. When _type_ is _'GetSigningBox'_ Result of getting signing box. - - `signing_box`: _[SigningBoxHandle](mod\_crypto.md#signingboxhandle)_ – Signing box for signing data requested by debot engine.
Signing box is owned and disposed by debot engine @@ -548,7 +717,6 @@ When _type_ is _'Approve'_ Result of `approve` callback. - - `approved`: _boolean_ – Indicates whether the DeBot is allowed to perform the specified operation. @@ -639,57 +807,16 @@ Called by debot engine to communicate with debot browser. ```ts -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: ParamsOfAppDebotBrowserLog): void, - switch(params: ParamsOfAppDebotBrowserSwitch): void, + log(params: ParamsOfAppDebotBrowserLogVariant): void, + switch(params: ParamsOfAppDebotBrowserSwitchVariant): void, switch_completed(): void, - show_action(params: ParamsOfAppDebotBrowserShowAction): void, - input(params: ParamsOfAppDebotBrowserInput): Promise, - get_signing_box(): Promise, - invoke_debot(params: ParamsOfAppDebotBrowserInvokeDebot): Promise, - send(params: ParamsOfAppDebotBrowserSend): void, - approve(params: ParamsOfAppDebotBrowserApprove): Promise, + show_action(params: ParamsOfAppDebotBrowserShowActionVariant): void, + input(params: ParamsOfAppDebotBrowserInputVariant): Promise, + get_signing_box(): Promise, + invoke_debot(params: ParamsOfAppDebotBrowserInvokeDebotVariant): Promise, + send(params: ParamsOfAppDebotBrowserSendVariant): void, + approve(params: ParamsOfAppDebotBrowserApproveVariant): Promise, } ``` @@ -698,12 +825,10 @@ export interface AppDebotBrowser { Print message to user. ```ts -type ParamsOfAppDebotBrowserLog = { - msg: string -} +type ParamsOfAppDebotBrowserLogVariant = ParamsOfAppDebotBrowserLogVariant function log( - params: ParamsOfAppDebotBrowserLog, + params: ParamsOfAppDebotBrowserLogVariant, ): Promise<>; ``` ### Parameters @@ -715,12 +840,10 @@ function log( Switch debot to another context (menu). ```ts -type ParamsOfAppDebotBrowserSwitch = { - context_id: number -} +type ParamsOfAppDebotBrowserSwitchVariant = ParamsOfAppDebotBrowserSwitchVariant function switch( - params: ParamsOfAppDebotBrowserSwitch, + params: ParamsOfAppDebotBrowserSwitchVariant, ): Promise<>; ``` ### Parameters @@ -741,12 +864,10 @@ function switch_completed(): Promise<>; Show action to the user. Called after `switch` for each action in context. ```ts -type ParamsOfAppDebotBrowserShowAction = { - action: DebotAction -} +type ParamsOfAppDebotBrowserShowActionVariant = ParamsOfAppDebotBrowserShowActionVariant function show_action( - params: ParamsOfAppDebotBrowserShowAction, + params: ParamsOfAppDebotBrowserShowActionVariant, ): Promise<>; ``` ### Parameters @@ -758,17 +879,13 @@ function show_action( Request user input. ```ts -type ParamsOfAppDebotBrowserInput = { - prompt: string -} +type ParamsOfAppDebotBrowserInputVariant = ParamsOfAppDebotBrowserInputVariant -type ResultOfAppDebotBrowserInput = { - value: string -} +type ResultOfAppDebotBrowserInputVariant = ResultOfAppDebotBrowserInputVariant function input( - params: ParamsOfAppDebotBrowserInput, -): Promise; + params: ParamsOfAppDebotBrowserInputVariant, +): Promise; ``` ### Parameters - `prompt`: _string_ – A prompt string that must be printed to user before input request. @@ -786,11 +903,9 @@ Get signing box to sign data. Signing box returned is owned and disposed by debot engine ```ts -type ResultOfAppDebotBrowserGetSigningBox = { - signing_box: SigningBoxHandle -} +type ResultOfAppDebotBrowserGetSigningBoxVariant = ResultOfAppDebotBrowserGetSigningBoxVariant -function get_signing_box(): Promise; +function get_signing_box(): Promise; ``` @@ -805,13 +920,10 @@ function get_signing_box(): Promise; Execute action of another debot. ```ts -type ParamsOfAppDebotBrowserInvokeDebot = { - debot_addr: string, - action: DebotAction -} +type ParamsOfAppDebotBrowserInvokeDebotVariant = ParamsOfAppDebotBrowserInvokeDebotVariant function invoke_debot( - params: ParamsOfAppDebotBrowserInvokeDebot, + params: ParamsOfAppDebotBrowserInvokeDebotVariant, ): Promise; ``` ### Parameters @@ -824,12 +936,10 @@ function invoke_debot( Used by Debot to call DInterface implemented by Debot Browser. ```ts -type ParamsOfAppDebotBrowserSend = { - message: string -} +type ParamsOfAppDebotBrowserSendVariant = ParamsOfAppDebotBrowserSendVariant function send( - params: ParamsOfAppDebotBrowserSend, + params: ParamsOfAppDebotBrowserSendVariant, ): Promise<>; ``` ### Parameters @@ -842,17 +952,13 @@ function send( Requests permission from DeBot Browser to execute DeBot operation. ```ts -type ParamsOfAppDebotBrowserApprove = { - activity: DebotActivity -} +type ParamsOfAppDebotBrowserApproveVariant = ParamsOfAppDebotBrowserApproveVariant -type ResultOfAppDebotBrowserApprove = { - approved: boolean -} +type ResultOfAppDebotBrowserApproveVariant = ResultOfAppDebotBrowserApproveVariant function approve( - params: ParamsOfAppDebotBrowserApprove, -): Promise; + params: ParamsOfAppDebotBrowserApproveVariant, +): Promise; ``` ### Parameters - `activity`: _[DebotActivity](mod\_debot.md#debotactivity)_ – DeBot activity details. diff --git a/docs/reference/types-and-methods/mod_processing.md b/docs/reference/types-and-methods/mod_processing.md index 1cf3f3fa5..6fb537845 100644 --- a/docs/reference/types-and-methods/mod_processing.md +++ b/docs/reference/types-and-methods/mod_processing.md @@ -16,6 +16,32 @@ processing scenarios. ## Types [ProcessingErrorCode](mod\_processing.md#processingerrorcode) +[ProcessingEventWillFetchFirstBlockVariant](mod\_processing.md#processingeventwillfetchfirstblockvariant) – Notifies the application that the account's current shard block will be fetched from the network. This step is performed before the message sending so that sdk knows starting from which block it will search for the transaction. + +[ProcessingEventFetchFirstBlockFailedVariant](mod\_processing.md#processingeventfetchfirstblockfailedvariant) – Notifies the app that the client has failed to fetch the account's current shard block. + +[ProcessingEventWillSendVariant](mod\_processing.md#processingeventwillsendvariant) – Notifies the app that the message will be sent to the network. This event means that the account's current shard block was successfully fetched and the message was successfully created (`abi.encode_message` function was executed successfully). + +[ProcessingEventDidSendVariant](mod\_processing.md#processingeventdidsendvariant) – Notifies the app that the message was sent to the network, i.e `processing.send_message` was successfuly executed. Now, the message is in the blockchain. If Application exits at this phase, Developer needs to proceed with processing after the application is restored with `wait_for_transaction` function, passing shard_block_id and message from this event. + +[ProcessingEventSendFailedVariant](mod\_processing.md#processingeventsendfailedvariant) – Notifies the app that the sending operation was failed with network error. + +[ProcessingEventWillFetchNextBlockVariant](mod\_processing.md#processingeventwillfetchnextblockvariant) – Notifies the app that the next shard block will be fetched from the network. + +[ProcessingEventFetchNextBlockFailedVariant](mod\_processing.md#processingeventfetchnextblockfailedvariant) – Notifies the app that the next block can't be fetched. + +[ProcessingEventMessageExpiredVariant](mod\_processing.md#processingeventmessageexpiredvariant) – Notifies the app that the message was not executed within expire timeout on-chain and will never be because it is already expired. The expiration timeout can be configured with `AbiConfig` parameters. + +[ProcessingEventRempSentToValidatorsVariant](mod\_processing.md#processingeventrempsenttovalidatorsvariant) – Notifies the app that the message has been delivered to the thread's validators + +[ProcessingEventRempIncludedIntoBlockVariant](mod\_processing.md#processingeventrempincludedintoblockvariant) – Notifies the app that the message has been successfully included into a block candidate by the thread's collator + +[ProcessingEventRempIncludedIntoAcceptedBlockVariant](mod\_processing.md#processingeventrempincludedintoacceptedblockvariant) – Notifies the app that the block candicate with the message has been accepted by the thread's validators + +[ProcessingEventRempOtherVariant](mod\_processing.md#processingeventrempothervariant) – Notifies the app about some other minor REMP statuses occurring during message processing + +[ProcessingEventRempErrorVariant](mod\_processing.md#processingeventremperrorvariant) – Notifies the app about any problem that has occured in REMP processing - in this case library switches to the fallback transaction awaiting scenario (sequential block reading). + [ProcessingEvent](mod\_processing.md#processingevent) [ResultOfProcessMessage](mod\_processing.md#resultofprocessmessage) @@ -239,70 +265,259 @@ One of the following value: - `NextRempStatusTimeout = 516` -## ProcessingEvent +## ProcessingEventWillFetchFirstBlockVariant +Notifies the application that the account's current shard block will be fetched from the network. This step is performed before the message sending so that sdk knows starting from which block it will search for the transaction. + +Fetched block will be used later in waiting phase. + ```ts -type ProcessingEvent = { - type: 'WillFetchFirstBlock' -} | { - type: 'FetchFirstBlockFailed' +type ProcessingEventWillFetchFirstBlockVariant = { + +} +``` + + +## ProcessingEventFetchFirstBlockFailedVariant +Notifies the app that the client has failed to fetch the account's current shard block. + +This may happen due to the network issues. Receiving this event means that message processing will not proceed - +message was not sent, and Developer can try to run `process_message` again, +in the hope that the connection is restored. + +```ts +type ProcessingEventFetchFirstBlockFailedVariant = { error: ClientError -} | { - type: 'WillSend' +} +``` +- `error`: _[ClientError](mod\_client.md#clienterror)_ + + +## ProcessingEventWillSendVariant +Notifies the app that the message will be sent to the network. This event means that the account's current shard block was successfully fetched and the message was successfully created (`abi.encode_message` function was executed successfully). + +```ts +type ProcessingEventWillSendVariant = { shard_block_id: string, message_id: string, message: string -} | { - type: 'DidSend' +} +``` +- `shard_block_id`: _string_ +- `message_id`: _string_ +- `message`: _string_ + + +## ProcessingEventDidSendVariant +Notifies the app that the message was sent to the network, i.e `processing.send_message` was successfuly executed. Now, the message is in the blockchain. If Application exits at this phase, Developer needs to proceed with processing after the application is restored with `wait_for_transaction` function, passing shard_block_id and message from this event. + +Do not forget to specify abi of your contract as well, it is crucial for proccessing. See `processing.wait_for_transaction` documentation. + +```ts +type ProcessingEventDidSendVariant = { shard_block_id: string, message_id: string, message: string -} | { - type: 'SendFailed' +} +``` +- `shard_block_id`: _string_ +- `message_id`: _string_ +- `message`: _string_ + + +## ProcessingEventSendFailedVariant +Notifies the app that the sending operation was failed with network error. + +Nevertheless the processing will be continued at the waiting +phase because the message possibly has been delivered to the +node. +If Application exits at this phase, Developer needs to proceed with processing +after the application is restored with `wait_for_transaction` function, passing +shard_block_id and message from this event. Do not forget to specify abi of your contract +as well, it is crucial for proccessing. See `processing.wait_for_transaction` documentation. + +```ts +type ProcessingEventSendFailedVariant = { shard_block_id: string, message_id: string, message: string, error: ClientError -} | { - type: 'WillFetchNextBlock' +} +``` +- `shard_block_id`: _string_ +- `message_id`: _string_ +- `message`: _string_ +- `error`: _[ClientError](mod\_client.md#clienterror)_ + + +## ProcessingEventWillFetchNextBlockVariant +Notifies the app that the next shard block will be fetched from the network. + +Event can occurs more than one time due to block walking +procedure. +If Application exits at this phase, Developer needs to proceed with processing +after the application is restored with `wait_for_transaction` function, passing +shard_block_id and message from this event. Do not forget to specify abi of your contract +as well, it is crucial for proccessing. See `processing.wait_for_transaction` documentation. + +```ts +type ProcessingEventWillFetchNextBlockVariant = { shard_block_id: string, message_id: string, message: string -} | { - type: 'FetchNextBlockFailed' +} +``` +- `shard_block_id`: _string_ +- `message_id`: _string_ +- `message`: _string_ + + +## ProcessingEventFetchNextBlockFailedVariant +Notifies the app that the next block can't be fetched. + +If no block was fetched within `NetworkConfig.wait_for_timeout` then processing stops. +This may happen when the shard stops, or there are other network issues. +In this case Developer should resume message processing with `wait_for_transaction`, passing shard_block_id, +message and contract abi to it. Note that passing ABI is crucial, because it will influence the processing strategy. + +Another way to tune this is to specify long timeout in `NetworkConfig.wait_for_timeout` + +```ts +type ProcessingEventFetchNextBlockFailedVariant = { shard_block_id: string, message_id: string, message: string, error: ClientError -} | { - type: 'MessageExpired' +} +``` +- `shard_block_id`: _string_ +- `message_id`: _string_ +- `message`: _string_ +- `error`: _[ClientError](mod\_client.md#clienterror)_ + + +## ProcessingEventMessageExpiredVariant +Notifies the app that the message was not executed within expire timeout on-chain and will never be because it is already expired. The expiration timeout can be configured with `AbiConfig` parameters. + +This event occurs only for the contracts which ABI includes "expire" header. + +If Application specifies `NetworkConfig.message_retries_count` > 0, then `process_message` +will perform retries: will create a new message and send it again and repeat it untill it reaches +the maximum retries count or receives a successful result. All the processing +events will be repeated. + +```ts +type ProcessingEventMessageExpiredVariant = { message_id: string, message: string, error: ClientError -} | { - type: 'RempSentToValidators' +} +``` +- `message_id`: _string_ +- `message`: _string_ +- `error`: _[ClientError](mod\_client.md#clienterror)_ + + +## ProcessingEventRempSentToValidatorsVariant +Notifies the app that the message has been delivered to the thread's validators + +```ts +type ProcessingEventRempSentToValidatorsVariant = { message_id: string, timestamp: bigint, json: any -} | { - type: 'RempIncludedIntoBlock' +} +``` +- `message_id`: _string_ +- `timestamp`: _bigint_ +- `json`: _any_ + + +## ProcessingEventRempIncludedIntoBlockVariant +Notifies the app that the message has been successfully included into a block candidate by the thread's collator + +```ts +type ProcessingEventRempIncludedIntoBlockVariant = { message_id: string, timestamp: bigint, json: any -} | { - type: 'RempIncludedIntoAcceptedBlock' +} +``` +- `message_id`: _string_ +- `timestamp`: _bigint_ +- `json`: _any_ + + +## ProcessingEventRempIncludedIntoAcceptedBlockVariant +Notifies the app that the block candicate with the message has been accepted by the thread's validators + +```ts +type ProcessingEventRempIncludedIntoAcceptedBlockVariant = { message_id: string, timestamp: bigint, json: any -} | { - type: 'RempOther' +} +``` +- `message_id`: _string_ +- `timestamp`: _bigint_ +- `json`: _any_ + + +## ProcessingEventRempOtherVariant +Notifies the app about some other minor REMP statuses occurring during message processing + +```ts +type ProcessingEventRempOtherVariant = { message_id: string, timestamp: bigint, json: any -} | { - type: 'RempError' +} +``` +- `message_id`: _string_ +- `timestamp`: _bigint_ +- `json`: _any_ + + +## ProcessingEventRempErrorVariant +Notifies the app about any problem that has occured in REMP processing - in this case library switches to the fallback transaction awaiting scenario (sequential block reading). + +```ts +type ProcessingEventRempErrorVariant = { error: ClientError } ``` +- `error`: _[ClientError](mod\_client.md#clienterror)_ + + +## ProcessingEvent +```ts +type ProcessingEvent = ({ + type: 'WillFetchFirstBlock' +} & ProcessingEventWillFetchFirstBlockVariant) | ({ + type: 'FetchFirstBlockFailed' +} & ProcessingEventFetchFirstBlockFailedVariant) | ({ + type: 'WillSend' +} & ProcessingEventWillSendVariant) | ({ + type: 'DidSend' +} & ProcessingEventDidSendVariant) | ({ + type: 'SendFailed' +} & ProcessingEventSendFailedVariant) | ({ + type: 'WillFetchNextBlock' +} & ProcessingEventWillFetchNextBlockVariant) | ({ + type: 'FetchNextBlockFailed' +} & ProcessingEventFetchNextBlockFailedVariant) | ({ + type: 'MessageExpired' +} & ProcessingEventMessageExpiredVariant) | ({ + type: 'RempSentToValidators' +} & ProcessingEventRempSentToValidatorsVariant) | ({ + type: 'RempIncludedIntoBlock' +} & ProcessingEventRempIncludedIntoBlockVariant) | ({ + type: 'RempIncludedIntoAcceptedBlock' +} & ProcessingEventRempIncludedIntoAcceptedBlockVariant) | ({ + type: 'RempOther' +} & ProcessingEventRempOtherVariant) | ({ + type: 'RempError' +} & ProcessingEventRempErrorVariant) +``` Depends on value of the `type` field. When _type_ is _'WillFetchFirstBlock'_ @@ -320,14 +535,12 @@ This may happen due to the network issues. Receiving this event means that messa message was not sent, and Developer can try to run `process_message` again, in the hope that the connection is restored. - - `error`: _[ClientError](mod\_client.md#clienterror)_ When _type_ is _'WillSend'_ Notifies the app that the message will be sent to the network. This event means that the account's current shard block was successfully fetched and the message was successfully created (`abi.encode_message` function was executed successfully). - - `shard_block_id`: _string_ - `message_id`: _string_ - `message`: _string_ @@ -338,7 +551,6 @@ Notifies the app that the message was sent to the network, i.e `processing.send_ Do not forget to specify abi of your contract as well, it is crucial for proccessing. See `processing.wait_for_transaction` documentation. - - `shard_block_id`: _string_ - `message_id`: _string_ - `message`: _string_ @@ -355,7 +567,6 @@ after the application is restored with `wait_for_transaction` function, passing shard_block_id and message from this event. Do not forget to specify abi of your contract as well, it is crucial for proccessing. See `processing.wait_for_transaction` documentation. - - `shard_block_id`: _string_ - `message_id`: _string_ - `message`: _string_ @@ -372,7 +583,6 @@ after the application is restored with `wait_for_transaction` function, passing shard_block_id and message from this event. Do not forget to specify abi of your contract as well, it is crucial for proccessing. See `processing.wait_for_transaction` documentation. - - `shard_block_id`: _string_ - `message_id`: _string_ - `message`: _string_ @@ -388,7 +598,6 @@ message and contract abi to it. Note that passing ABI is crucial, because it wil Another way to tune this is to specify long timeout in `NetworkConfig.wait_for_timeout` - - `shard_block_id`: _string_ - `message_id`: _string_ - `message`: _string_ @@ -405,7 +614,6 @@ will perform retries: will create a new message and send it again and repeat it the maximum retries count or receives a successful result. All the processing events will be repeated. - - `message_id`: _string_ - `message`: _string_ - `error`: _[ClientError](mod\_client.md#clienterror)_ @@ -414,7 +622,6 @@ When _type_ is _'RempSentToValidators'_ Notifies the app that the message has been delivered to the thread's validators - - `message_id`: _string_ - `timestamp`: _bigint_ - `json`: _any_ @@ -423,7 +630,6 @@ When _type_ is _'RempIncludedIntoBlock'_ Notifies the app that the message has been successfully included into a block candidate by the thread's collator - - `message_id`: _string_ - `timestamp`: _bigint_ - `json`: _any_ @@ -432,7 +638,6 @@ When _type_ is _'RempIncludedIntoAcceptedBlock'_ Notifies the app that the block candicate with the message has been accepted by the thread's validators - - `message_id`: _string_ - `timestamp`: _bigint_ - `json`: _any_ @@ -441,7 +646,6 @@ When _type_ is _'RempOther'_ Notifies the app about some other minor REMP statuses occurring during message processing - - `message_id`: _string_ - `timestamp`: _bigint_ - `json`: _any_ @@ -450,7 +654,6 @@ When _type_ is _'RempError'_ Notifies the app about any problem that has occured in REMP processing - in this case library switches to the fallback transaction awaiting scenario (sequential block reading). - - `error`: _[ClientError](mod\_client.md#clienterror)_ diff --git a/docs/reference/types-and-methods/mod_tvm.md b/docs/reference/types-and-methods/mod_tvm.md index 0d1c3c645..a8a6a0a61 100644 --- a/docs/reference/types-and-methods/mod_tvm.md +++ b/docs/reference/types-and-methods/mod_tvm.md @@ -13,6 +13,12 @@ [ExecutionOptions](mod\_tvm.md#executionoptions) +[AccountForExecutorNoneVariant](mod\_tvm.md#accountforexecutornonevariant) – Non-existing account to run a creation internal message. Should be used with `skip_transaction_check = true` if the message has no deploy data since transactions on the uninitialized account are always aborted + +[AccountForExecutorUninitVariant](mod\_tvm.md#accountforexecutoruninitvariant) – Emulate uninitialized account to run deploy message + +[AccountForExecutorAccountVariant](mod\_tvm.md#accountforexecutoraccountvariant) – Account state to run message + [AccountForExecutor](mod\_tvm.md#accountforexecutor) [TransactionFees](mod\_tvm.md#transactionfees) @@ -265,17 +271,50 @@ type ExecutionOptions = { - `transaction_lt`?: _bigint_ – transaction logical time +## AccountForExecutorNoneVariant +Non-existing account to run a creation internal message. Should be used with `skip_transaction_check = true` if the message has no deploy data since transactions on the uninitialized account are always aborted + +```ts +type AccountForExecutorNoneVariant = { + +} +``` + + +## AccountForExecutorUninitVariant +Emulate uninitialized account to run deploy message + +```ts +type AccountForExecutorUninitVariant = { + +} +``` + + +## AccountForExecutorAccountVariant +Account state to run message + +```ts +type AccountForExecutorAccountVariant = { + boc: string, + unlimited_balance?: boolean +} +``` +- `boc`: _string_ – Account BOC. +
Encoded as base64. +- `unlimited_balance`?: _boolean_ – Flag for running account with the unlimited balance. +
Can be used to calculate transaction fees without balance check + + ## AccountForExecutor ```ts -type AccountForExecutor = { +type AccountForExecutor = ({ type: 'None' -} | { +} & AccountForExecutorNoneVariant) | ({ type: 'Uninit' -} | { +} & AccountForExecutorUninitVariant) | ({ type: 'Account' - boc: string, - unlimited_balance?: boolean -} +} & AccountForExecutorAccountVariant) ``` Depends on value of the `type` field. @@ -293,7 +332,6 @@ When _type_ is _'Account'_ Account state to run message - - `boc`: _string_ – Account BOC.
Encoded as base64. - `unlimited_balance`?: _boolean_ – Flag for running account with the unlimited balance. @@ -316,15 +354,24 @@ type TransactionFees = { gas_fee: bigint, out_msgs_fwd_fee: bigint, total_account_fees: bigint, - total_output: bigint + total_output: bigint, + ext_in_msg_fee: bigint, + total_fwd_fees: bigint, + account_fees: bigint } ``` -- `in_msg_fwd_fee`: _bigint_ -- `storage_fee`: _bigint_ -- `gas_fee`: _bigint_ -- `out_msgs_fwd_fee`: _bigint_ -- `total_account_fees`: _bigint_ -- `total_output`: _bigint_ +- `in_msg_fwd_fee`: _bigint_ – Deprecated. +
Left for backward compatibility. Does not participate in account transaction fees calculation. +- `storage_fee`: _bigint_ – Fee for account storage +- `gas_fee`: _bigint_ – Fee for processing +- `out_msgs_fwd_fee`: _bigint_ – Deprecated. +
Contains the same data as total_fwd_fees field. Deprecated because of its confusing name, that is not the same with GraphQL API Transaction type's field. +- `total_account_fees`: _bigint_ – Deprecated. +
This is the field that is named as `total_fees` in GraphQL API Transaction type. `total_account_fees` name is misleading, because it does not mean account fees, instead it means
validators total fees received for the transaction execution. It does not include some forward fees that account
actually pays now, but validators will receive later during value delivery to another account (not even in the receiving
transaction).
Because of all of this, this field is not interesting for those who wants to understand
the real account fees, this is why it is deprecated and left for backward compatibility. +- `total_output`: _bigint_ – Deprecated because it means total value sent in the transaction, which does not relate to any fees. +- `ext_in_msg_fee`: _bigint_ – Fee for inbound external message import. +- `total_fwd_fees`: _bigint_ – Total fees the account pays for message forwarding +- `account_fees`: _bigint_ – Total account fees for the transaction execution. Compounds of storage_fee + gas_fee + ext_in_msg_fee + total_fwd_fees ## ParamsOfRunExecutor diff --git a/docs/reference/types-and-methods/mod_utils.md b/docs/reference/types-and-methods/mod_utils.md index 29a1859a8..a2c0ff551 100644 --- a/docs/reference/types-and-methods/mod_utils.md +++ b/docs/reference/types-and-methods/mod_utils.md @@ -15,6 +15,12 @@ Misc utility Functions. [decompress_zstd](mod\_utils.md#decompress_zstd) – Decompresses data using Zstandard algorithm ## Types +[AddressStringFormatAccountIdVariant](mod\_utils.md#addressstringformataccountidvariant) + +[AddressStringFormatHexVariant](mod\_utils.md#addressstringformathexvariant) + +[AddressStringFormatBase64Variant](mod\_utils.md#addressstringformatbase64variant) + [AddressStringFormat](mod\_utils.md#addressstringformat) [AccountAddressType](mod\_utils.md#accountaddresstype) @@ -191,19 +197,45 @@ function decompress_zstd( # Types -## AddressStringFormat +## AddressStringFormatAccountIdVariant ```ts -type AddressStringFormat = { - type: 'AccountId' -} | { - type: 'Hex' -} | { - type: 'Base64' +type AddressStringFormatAccountIdVariant = { + +} +``` + + +## AddressStringFormatHexVariant +```ts +type AddressStringFormatHexVariant = { + +} +``` + + +## AddressStringFormatBase64Variant +```ts +type AddressStringFormatBase64Variant = { url: boolean, test: boolean, bounce: boolean } ``` +- `url`: _boolean_ +- `test`: _boolean_ +- `bounce`: _boolean_ + + +## AddressStringFormat +```ts +type AddressStringFormat = ({ + type: 'AccountId' +} & AddressStringFormatAccountIdVariant) | ({ + type: 'Hex' +} & AddressStringFormatHexVariant) | ({ + type: 'Base64' +} & AddressStringFormatBase64Variant) +``` Depends on value of the `type` field. When _type_ is _'AccountId'_ @@ -214,7 +246,6 @@ When _type_ is _'Hex'_ When _type_ is _'Base64'_ - - `url`: _boolean_ - `test`: _boolean_ - `bounce`: _boolean_ diff --git a/docs/reference/types-and-methods/modules.md b/docs/reference/types-and-methods/modules.md index 72181a803..f4bdda421 100644 --- a/docs/reference/types-and-methods/modules.md +++ b/docs/reference/types-and-methods/modules.md @@ -17,6 +17,8 @@ Where: [version](mod\_client.md#version) – Returns Core Library version +[config](mod\_client.md#config) – Returns Core Library API reference + [build_info](mod\_client.md#build_info) – Returns detailed information about this build. [resolve_app_request](mod\_client.md#resolve_app_request) – Resolves application request processing result diff --git a/ton_client/Cargo.toml b/ton_client/Cargo.toml index aa5614e0c..d09af8101 100644 --- a/ton_client/Cargo.toml +++ b/ton_client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'ton_client' -version = '1.33.1' +version = '1.34.0' authors = [ 'TON Labs LTD ' ] edition = '2018' license = 'Apache-2.0' diff --git a/ton_client/src/proofs/trusted_key_blocks.bin b/ton_client/src/proofs/trusted_key_blocks.bin index f5061410ebf45369029fa01a2c28d0525f44d9d7..6630b1e51597fa3439caa7faa502911a90dec90f 100644 GIT binary patch delta 5125 zcmV+g6#DDHrwQ=R2?zoJ00000005T+MgbrJkB22j0kxJGbOx z$}L`s6SjFCjt<(IcD`aus%}Tk2jkoDBESU!SLxU5?+k>8-@p5kD;tPkJ2?G5lWben zogCwVuEm!>={$Ikl@aETxB%#6UVdJCfdTa6I9Z3!?jlj9VU9;*dWc{3cytc0Y*amkHL&qQ939MF^sOiV>p8| z`5v_J-dn%!Xwf6*VZmPp0nBdoBT4L>K()IL_{H%#saV17L}wTPA{2Mku@5G75lW^8 z0b2EN#e^Tl9_Jpvr$2Y~L+GECs>o3H7+IEd4ighhZcng(1_8tdwKe^1SOCpC1_W*2 zA!QPVlLrCtt)mOvE*S;y<==h8jxUW30J+^7k`N!}BBjmC5)%nRod*Hkvn3#0 zb+bQKBl&YdRk15&VdJT)g7=!pzx_n<{7~8v;|BqMKFNY|i1x%p@)%nrEgeK>ES&D2 zN%EJzODw_xNkx(@>g)#rVVH$+%HxS>!Rs!q(IbJ@7QYYK^Z@&Y4%+`9HW$Qzjxh)U z{LM+uDQ+s-V9i8>W6+1wkq&BYkEsfkxZ2Fc;u0s^YdZ)5P6jpb1-4+(#an{~&^4B| z4we`V;Wg1?Ys`{arB*9N>5&K^0f&JpwJ8DHMSs4?LIB?`HlyJU|1^u+CQ((iBX~{r z2<~wsgzH!XpBL#T7Z*CqLI6=$1#Z?ATeteoODTwRVn8>_0mY0z2dxqZ<&Dm~mRhyf zLIBic17Xe!Kry1=SrzCAte5g#ev#B8Ayj;LExzD2?!GhHLIC-kDXTKsUvO-||LS1n z8Grg$rtroC7LFuY=2&LfP|RVU=0X6^)gQgy%A!@9noDwm~sG^)^{uPp~6>UJ#CFb^@KHAiPHh&>Q z0D&2B{vKLI$_`spzicWP;g7D|bd`|Zi$lO}R)vcXhTkJY03I`;l4<$&q6mawIDf4R z{NRC*)G2YZD2qJ&Dh^yvQSmQB0DtXmXt>!mZG{B`cdhP3*9-_LQNDy_^wQ z)(lxPLjY!H0@-O;A=JwDOeXHxH);pjdq>p@OOiP$dB22qDArm&LjY?xzpc6!a8lZO zRo;2Rhhhe1f#S2lDwhdUNq8x%Lw%zyT9Bzj`z z)Cr~oc+QnLO+x@-bPhZ`cn4|GX1Du$P8`%C4Yx1=6xc4lI7@C1)QxAjPeTCMW8Tp~ zcDaHCdy-QnF6Y-Xdt7)CYOg*Ex}2}8^KV##o23(-3-`TrN46CF z5RyxlHKy)=6?tSsyJw)|6?#JeX*~97#p{NPTgi)TA0WDf#I;`?4SzBx+Hc97Q8Kp5 zo{W4$0J(imrbVs!rA@2(Yas}$y1HKb-f0319BwaZd*FEtU6zPL0P<$ICgIbQa)#sP zV69Uq{iIKYzs-Qu#2zL6+Nt2KU;m0j0K3@i+!Ja@UZr10%G$$iQ;?ADfvXSWv~V1! z9T}j6;MSHy0PiSh@qg|@Q`(-E8C;Xm(7#{^mDs*Tav`9>Y8xn}Lja9ktuWu?bHgtAU0`igf?^h*y!vRu zjZ{lrdk71*e)y87Ljbj9(3AZci4SJy5K8)-V6GZLu9dCb@Dl#p{p()#F2hLuwL<`w$E@u`T=rPrETH3mk3--Y zR(*pP?Q?XWg!RsXi66~p!b1R@^(y>kLVJ?~QRYnP3||e<3uvLeWD2LqFJWLQx%mM2n#h<^g|(9HxrYq8=(0Nd=Pw3iag zmBo9LL?6#aHCyfE=^gIP{Lo6|m2Vx01Wuegf?|TiqEJvX9N=}!*KchM_SNXZTo6f=KkU&ppE;EkE51NO zElI$eoxHdqNIXOU!F*w+bM2T;Uh@3Tccm#F@l||i%Z1Lp}BraC*E#9L=ajGtFT09s#`r*aX8zgeH$J}okXx0AI5&{^!9`}Wv&I1qlr<{Mf> z0O%6j;E{m>peMf~irb0)iQTsglQl=jNKE<9z*nM6iGF5802~`K_Gr3De;-MguYZTG zjpHEH@G>=REM0ka`M=IM$O8CiL;&T7bfCqK`vQU3^@mcyx=Jl|35{kvO5EgY6kYcM zhS+CyL;zD%*&NdQ+RTe}*LEZN@XCuzKr&Gj!1WYftU1^}6({9)L;(7xnb!eBoX3MX zW=5;`0hKuYVei4@@`k5RK8hU;9GonNQcH<{|MvZ%o3<`zt^eIId0Y}NhLK4C1LcI=lXZHD@tfWK$ zM&!PCasuguJMg!{D08s#@AZxRD7;ERhE*WkP_d>QA+baNIh+;ZKa!ptibZC(ycN(i z`3Y_Q2}OcNDVKIJQfInZo`17M0AKL`P)jZ2Zu4jp63FQDI_&Tv{0URW;eNV}5A(zb z`3}HD03mm*?cMN@fQ%^#I#!g~q>3|aLGA8qJj6@)^0UVXuZO}!07y$|=-TR3s>|5A ztmM-Dn_LJQEg`vbt!pnEHPcj^yY|jR0EMm13sCz^Z*Ni8A)r@TiM{R6hEzpM@o`@PDN-cxLJdU#Zmq zW9Yf)?j&@^QMPZ*PHdCg#}MTzKp8~oGLRPVgV}%nx3o9EgX!1kLpY@U1D|eT zelx6ks2fE94u5D}3zjLOoKF?9(J`R5(XGUIpnk+xio|XDUnFs!g|;U}0Lb1_;x)HX z5&pGt$&QiZ&r^CdnPrTS`+!BL3kYa@fCZ^xbD6=Q4jQ>M9%9{ zMF7ge&40iBa=|=Eg)U=u8|VV%q5I_<&_za$#F{uLDTV!2RYd^uS81>fOK`;hslO!~ zUsz-z;qzi1(tM4&qr&f`rJ|WqVMPEA=kL-t8XlqSIJ6)RJsAu*lrtD1=jMVsjGH&_ z^!RzSV?_X#RFkX5*koRM<^Z9LEJn~uY<}86^?y&BpvrI>o7tE|$ZbUcpC;#B@6h%x zW#~4uZ`bpiPxse)ySS6keGAcHSXC%EXm3RT?%$DI!lDx$Pzei6zdLL(2mOMXp5Y0* z?WEE`$t#`h7;;4bVnWiN7nJl3`a5=b3kC|FdmKjCw2{aSrGBb7(F=pGcydJmI5OQ@ zXn%4zfrXX9-4Py#L}W3a2Vir=^HG2caJBrUO{H^1013z!(3ar>zZeu9;87bhR*2Jf zEC&&%nikRU@brdTgT`}30N95mJd6nK7S?O8U-T41GbSQo)m_{-a@Z~A&g z0A0S>iB0!J4hff6VnJ^+qjXM5Y0-4b5`RA*r~cl?v0sRNMF71Fl=r5P~qC$HXSb3g!1w=A&$ z*co7qMF5#VMye^dNTCY@-gA!G5{(efPjR?L4Xr!nhRDqU2_?svMF2_KPhYd$iGN=F zLOacuzQrus;f+;=xesyLR!&BHgn?(SpqjlWt(8FHAZ19T1m_h}Hmp^5rrSr|x z*JVc#(28&yszm@r5eVO^iw?aytjb`6#yMRV}IN%E1JvRinc`nhuDS#%`WHI-lzL_dV{jHWns!I z+Ky3x;Ze!yZR^c)1i3{3^0#4RZ@f)RMTF_WPHq`I)jAP*OV?h4@s#w(aKi5hX~jhV ziu5-$cab~oqSHtyDsl>vxWq~}_n&_=E04i!BLw9=>BmI?Mf9U=lf#rU$$v8Tr8G&N zt{fMBZ0MYfZE1bc%;xhV%T3fp00&eR#`D_2VqjT|<^|Pk*&xY(vA13QD2JGkE@Lt% zBEr^1049pt67U)TXKIk4isrLP4l+ObdD71TDWd=Etq1$V!7JlM08v~Fsr08OlkLkZ zy4D=7bJtqY4-R5J9Hr?c~kM6ZqXMF6CA*bfWX zVHWP4<6Z?sI#nf$m0IGBlX@0Yr(t3()7bm~MgRrKI$DTW1;<|cz<)aS{vFNZf;97Y zNvP0kEnOz)S0l7_14aP4niKqJIAz|yW8nG3(HAh(?5vSQ+EqwHa9M~0Hh7>25Jmv> zZ08DS_%`HnjqH0xLVH3^?H3&4RE?hVSTwhTKuCL?5=H>q-Q@3gfgInLr`)D}QDSDJ zt%1?P8mckOUQjJM^-9-eh#y7(e-{4DdcKDsM>Ut|NYIU`FS`|w6NfVptWw$0%{|9*@c4h6>AM$N67jI((G`Jf9Y diff --git a/ton_sdk/Cargo.toml b/ton_sdk/Cargo.toml index 8d1e4c8fd..279d8b88d 100644 --- a/ton_sdk/Cargo.toml +++ b/ton_sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'ton_sdk' -version = '1.33.1' +version = '1.34.0' edition = '2018' license = 'Apache-2.0' authors = [ 'TON Labs LTD ' ] diff --git a/toncli/Cargo.toml b/toncli/Cargo.toml index 8a80475d4..73754465d 100644 --- a/toncli/Cargo.toml +++ b/toncli/Cargo.toml @@ -9,7 +9,7 @@ license = 'Apache-2.0' name = 'toncli' readme = 'README.md' repository = 'https://github.com/tonlabs/ever-sdk' -version = '1.33.1' +version = '1.34.0' [dependencies] base64 = '0.13.0' diff --git a/tools/api.json b/tools/api.json index 6e19f5508..5a93b9bc3 100644 --- a/tools/api.json +++ b/tools/api.json @@ -1,5 +1,5 @@ { - "version": "1.33.1", + "version": "1.34.0", "modules": [ { "name": "client", @@ -904,6 +904,37 @@ }, "errors": null }, + { + "name": "config", + "summary": "Returns Core Library API reference", + "description": null, + "params": [ + { + "name": "context", + "type": "Generic", + "generic_name": "Arc", + "generic_args": [ + { + "type": "Ref", + "ref_name": "ClientContext" + } + ], + "summary": null, + "description": null + } + ], + "result": { + "type": "Generic", + "generic_name": "ClientResult", + "generic_args": [ + { + "type": "Ref", + "ref_name": "client.ClientConfig" + } + ] + }, + "errors": null + }, { "name": "build_info", "summary": "Returns detailed information about this build.", @@ -10540,15 +10571,15 @@ "type": "BigInt", "number_type": "UInt", "number_size": 64, - "summary": null, - "description": null + "summary": "Deprecated.", + "description": "Left for backward compatibility. Does not participate in account transaction fees calculation." }, { "name": "storage_fee", "type": "BigInt", "number_type": "UInt", "number_size": 64, - "summary": null, + "summary": "Fee for account storage", "description": null }, { @@ -10556,7 +10587,7 @@ "type": "BigInt", "number_type": "UInt", "number_size": 64, - "summary": null, + "summary": "Fee for processing", "description": null }, { @@ -10564,23 +10595,47 @@ "type": "BigInt", "number_type": "UInt", "number_size": 64, - "summary": null, - "description": null + "summary": "Deprecated.", + "description": "Contains the same data as total_fwd_fees field. Deprecated because of its confusing name, that is not the same with GraphQL API Transaction type's field." }, { "name": "total_account_fees", "type": "BigInt", "number_type": "UInt", "number_size": 64, - "summary": null, - "description": null + "summary": "Deprecated.", + "description": "This is the field that is named as `total_fees` in GraphQL API Transaction type. `total_account_fees` name is misleading, because it does not mean account fees, instead it means\nvalidators total fees received for the transaction execution. It does not include some forward fees that account\nactually pays now, but validators will receive later during value delivery to another account (not even in the receiving\ntransaction).\nBecause of all of this, this field is not interesting for those who wants to understand\nthe real account fees, this is why it is deprecated and left for backward compatibility." }, { "name": "total_output", "type": "BigInt", "number_type": "UInt", "number_size": 64, - "summary": null, + "summary": "Deprecated because it means total value sent in the transaction, which does not relate to any fees.", + "description": null + }, + { + "name": "ext_in_msg_fee", + "type": "BigInt", + "number_type": "UInt", + "number_size": 64, + "summary": "Fee for inbound external message import.", + "description": null + }, + { + "name": "total_fwd_fees", + "type": "BigInt", + "number_type": "UInt", + "number_size": 64, + "summary": "Total fees the account pays for message forwarding", + "description": null + }, + { + "name": "account_fees", + "type": "BigInt", + "number_type": "UInt", + "number_size": 64, + "summary": "Total account fees for the transaction execution. Compounds of storage_fee + gas_fee + ext_in_msg_fee + total_fwd_fees", "description": null } ], From 3c0e9762a6787fa42ea211172ffa0529e9d9e6a6 Mon Sep 17 00:00:00 2001 From: Sergei Voronezhskii Date: Wed, 18 May 2022 10:52:30 +0300 Subject: [PATCH 19/19] Update tags --- ton_client/Cargo.toml | 6 +++--- ton_sdk/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ton_client/Cargo.toml b/ton_client/Cargo.toml index d09af8101..c4ac2dc1b 100644 --- a/ton_client/Cargo.toml +++ b/ton_client/Cargo.toml @@ -20,10 +20,10 @@ api_derive = { path = '../api/derive' } api_info = { path = '../api/info' } ton_sdk = { default-features = false, path = '../ton_sdk' } -ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.2.0' } +ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.2.2' } ton_block = { git = 'https://github.com/tonlabs/ton-labs-block.git', tag = '1.7.43' } -ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.10' } -ton_executor = { default-features = false, git = 'https://github.com/tonlabs/ton-labs-executor.git', tag = '1.15.63' } +ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.12' } +ton_executor = { default-features = false, git = 'https://github.com/tonlabs/ton-labs-executor.git', tag = '1.15.65' } ton_types = { git = 'https://github.com/tonlabs/ton-labs-types.git', tag = '1.10.14' } ton_vm = { default-features = false, git = 'https://github.com/tonlabs/ton-labs-vm.git', tag = '1.8.33' } diff --git a/ton_sdk/Cargo.toml b/ton_sdk/Cargo.toml index 279d8b88d..d8494aba6 100644 --- a/ton_sdk/Cargo.toml +++ b/ton_sdk/Cargo.toml @@ -6,7 +6,7 @@ license = 'Apache-2.0' authors = [ 'TON Labs LTD ' ] [dependencies] -ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.2.0' } +ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.2.2' } ton_block = { git = 'https://github.com/tonlabs/ton-labs-block.git', tag = '1.7.43' } ton_vm = { default-features = false, git = 'https://github.com/tonlabs/ton-labs-vm.git', tag = '1.8.33' } ton_types = { git = 'https://github.com/tonlabs/ton-labs-types.git', tag = '1.10.14' }