diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d809f91..4d07ddd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. +## [1.16.0] – 2021-05-25 + +### New + +- `query_transaction_tree` function that returns messages and transactions tree produced + by the specified message was added to `query` module. [See the documentation](https://github.com/tonlabs/TON-SDK/blob/1.16.0/docs/mod_net.md#query_transaction_tree) +- `libOptions.loadModule` – ability to specify alternative WASM module loader. + +### Fixed + +- `AbiData.key` type changed to u32. +- attempt to use `orderBy` instead of `order` in `query_collection` will raise error. + ## [1.15.0] – 2021-05-18 ### New diff --git a/lerna.json b/lerna.json index 4cde3958..56d74034 100644 --- a/lerna.json +++ b/lerna.json @@ -3,7 +3,7 @@ "packages": [ "packages/*" ], - "version": "1.15.0", + "version": "1.16.0", "command": { "version": { "message": "Release" diff --git a/packages/core/package.json b/packages/core/package.json index 990bfa30..23b8b545 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/core", - "version": "1.15.0", + "version": "1.16.0", "description": "TON Client for Java Script", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/core/src/modules.ts b/packages/core/src/modules.ts index 68e07d6e..753286b5 100644 --- a/packages/core/src/modules.ts +++ b/packages/core/src/modules.ts @@ -2009,7 +2009,7 @@ export type AbiData = { /** */ - key: bigint, + key: number, /** */ @@ -4158,6 +4158,97 @@ export enum AggregationFn { AVERAGE = "AVERAGE" } +export type TransactionNode = { + + /** + * Transaction id. + */ + id: string, + + /** + * In message id. + */ + in_msg: string, + + /** + * Out message ids. + */ + out_msgs: string[], + + /** + * Account address. + */ + account_addr: string, + + /** + * Transactions total fees. + */ + total_fees: string, + + /** + * Aborted flag. + */ + aborted: boolean, + + /** + * Compute phase exit code. + */ + exit_code?: number +} + +export type MessageNode = { + + /** + * Message id. + */ + id: string, + + /** + * Source transaction id. + * + * @remarks + * This field is missing for an external inbound messages. + */ + src_transaction_id?: string, + + /** + * Destination transaction id. + * + * @remarks + * This field is missing for an external outbound messages. + */ + dst_transaction_id?: string, + + /** + * Source address. + */ + src?: string, + + /** + * Destination address. + */ + dst?: string, + + /** + * Transferred tokens value. + */ + value?: string, + + /** + * Bounce flag. + */ + bounce: boolean, + + /** + * Decoded body. + * + * @remarks + * Library tries to decode message body using provided `params.abi_registry`. + * This field will be missing if none of the provided abi can be used to decode. + */ + decoded_body?: DecodedMessageBody +} + export type ParamsOfQuery = { /** @@ -4387,6 +4478,32 @@ export type ParamsOfQueryCounterparties = { after?: string } +export type ParamsOfQueryTransactionTree = { + + /** + * Input message id. + */ + in_msg: string, + + /** + * List of contract ABIs that will be used to decode message bodies. Library will try to decode each returned message body using any ABI from the registry. + */ + abi_registry?: Abi[] +} + +export type ResultOfQueryTransactionTree = { + + /** + * Messages. + */ + messages: MessageNode[], + + /** + * Transactions. + */ + transactions: TransactionNode[] +} + /** * Network access. */ @@ -4595,6 +4712,32 @@ export class NetModule { query_counterparties(params: ParamsOfQueryCounterparties): Promise { return this.client.request('net.query_counterparties', params); } + + /** + * Returns transactions tree for specific message. + * + * @remarks + * Performs recursive retrieval of the transactions tree produced by the specific message: + * in_msg -> dst_transaction -> out_messages -> dst_transaction -> ... + * + * All retrieved messages and transactions will be included + * into `result.messages` and `result.transactions` respectively. + * + * The retrieval process will stop when the retrieved transaction count is more than 50. + * + * It is guaranteed that each message in `result.messages` has the corresponding transaction + * in the `result.transactions`. + * + * But there are no guaranties that all messages from transactions `out_msgs` are + * presented in `result.messages`. + * So the application have to continue retrieval for missing messages if it requires. + * + * @param {ParamsOfQueryTransactionTree} params + * @returns ResultOfQueryTransactionTree + */ + query_transaction_tree(params: ParamsOfQueryTransactionTree): Promise { + return this.client.request('net.query_transaction_tree', params); + } } // debot module diff --git a/packages/lib-node/package.json b/packages/lib-node/package.json index 9ddc4994..2a0d651f 100644 --- a/packages/lib-node/package.json +++ b/packages/lib-node/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/lib-node", - "version": "1.15.0", + "version": "1.16.0", "description": "TON Client NodeJs AddOn", "repository": { "type": "git", diff --git a/packages/lib-react-native/package.json b/packages/lib-react-native/package.json index 0f425ee1..40541c8f 100644 --- a/packages/lib-react-native/package.json +++ b/packages/lib-react-native/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/lib-react-native", - "version": "1.15.0", + "version": "1.16.0", "description": "TON Client React Native Module", "main": "index.js", "repository": { diff --git a/packages/lib-web/index.d.ts b/packages/lib-web/index.d.ts index 2de9c7e2..a32771ca 100644 --- a/packages/lib-web/index.d.ts +++ b/packages/lib-web/index.d.ts @@ -47,6 +47,10 @@ type LibWebOptions = { * Default is "/tonclient.wasm" */ binaryURL?: string, + /** + * Alternative WASM module loader. + */ + loadModule?: () => Promise, } export declare function libWebSetup(libOptions?: LibWebOptions): void; diff --git a/packages/lib-web/lib/index-template.js b/packages/lib-web/lib/index-template.js index 45b8c856..374f77f3 100644 --- a/packages/lib-web/lib/index-template.js +++ b/packages/lib-web/lib/index-template.js @@ -120,17 +120,19 @@ export function libWeb() { console.log(`Error from Web Worker: ${evt.message}`); }; - (async () => { - const e = Date.now(); - let wasmModule; + const loadModule = async () => { const fetched = fetch((options && options.binaryURL) || '/tonclient.wasm'); if (WebAssembly.compileStreaming) { debugLog('compileStreaming binary'); - wasmModule = await WebAssembly.compileStreaming(fetched); - } else { - debugLog('compile binary'); - wasmModule = await WebAssembly.compile(await (await fetched).arrayBuffer()); + return await WebAssembly.compileStreaming(fetched); } + debugLog('compile binary'); + return await WebAssembly.compile(await (await fetched).arrayBuffer()); + }; + + (async () => { + const e = Date.now(); + const wasmModule = await ((options && options.loadModule) || loadModule)(); worker.postMessage({ type: 'init', wasmModule, diff --git a/packages/lib-web/package.json b/packages/lib-web/package.json index 12ae7132..36e77bda 100644 --- a/packages/lib-web/package.json +++ b/packages/lib-web/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/lib-web", - "version": "1.15.0", + "version": "1.16.0", "description": "TON Client WASM module for browsers", "main": "index.js", "repository": { diff --git a/packages/tests-node/package.json b/packages/tests-node/package.json index a4b7ad9e..678d586b 100644 --- a/packages/tests-node/package.json +++ b/packages/tests-node/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/tests-node", - "version": "1.15.0", + "version": "1.16.0", "private": true, "description": "TON Client Tests runner on NodeJs", "main": "index.js", diff --git a/packages/tests-react-native/package.json b/packages/tests-react-native/package.json index b9ffd30c..c08cb426 100644 --- a/packages/tests-react-native/package.json +++ b/packages/tests-react-native/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/tests-react-native", - "version": "1.15.0", + "version": "1.16.0", "private": true, "main": "index.js", "browser": true, diff --git a/packages/tests-web/package.json b/packages/tests-web/package.json index 61a5da61..8b2a3acc 100644 --- a/packages/tests-web/package.json +++ b/packages/tests-web/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/tests-web", - "version": "1.15.0", + "version": "1.16.0", "private": true, "description": "TON Client WASM module tests runner", "scripts": { diff --git a/packages/tests/package.json b/packages/tests/package.json index 8a43ce2f..f52ca5f4 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@tonclient/tests", - "version": "1.15.0", + "version": "1.16.0", "private": true, "description": "TON Client Tests", "main": "dist/index.js",