Skip to content

Commit

Permalink
Merge pull request #222 from tonlabs/1.16.0-rc
Browse files Browse the repository at this point in the history
Version 1.16.0
  • Loading branch information
d3p authored May 25, 2021
2 parents bf94fee + bc90abb commit d399363
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 17 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
"packages/*"
],
"version": "1.15.0",
"version": "1.16.0",
"command": {
"version": {
"message": "Release"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
145 changes: 144 additions & 1 deletion packages/core/src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ export type AbiData = {

/**
*/
key: bigint,
key: number,

/**
*/
Expand Down Expand Up @@ -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 = {

/**
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -4595,6 +4712,32 @@ export class NetModule {
query_counterparties(params: ParamsOfQueryCounterparties): Promise<ResultOfQueryCollection> {
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<ResultOfQueryTransactionTree> {
return this.client.request('net.query_transaction_tree', params);
}
}

// debot module
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonclient/lib-node",
"version": "1.15.0",
"version": "1.16.0",
"description": "TON Client NodeJs AddOn",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-react-native/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions packages/lib-web/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ type LibWebOptions = {
* Default is "/tonclient.wasm"
*/
binaryURL?: string,
/**
* Alternative WASM module loader.
*/
loadModule?: () => Promise<WebAssembly.Module>,
}

export declare function libWebSetup(libOptions?: LibWebOptions): void;
Expand Down
16 changes: 9 additions & 7 deletions packages/lib-web/lib/index-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-web/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tests-node/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/tests-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonclient/tests-react-native",
"version": "1.15.0",
"version": "1.16.0",
"private": true,
"main": "index.js",
"browser": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/tests-web/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit d399363

Please sign in to comment.