Skip to content

Commit

Permalink
Generate bindings for SDK 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Voronezhskii committed Dec 22, 2020
1 parent 5ed3a66 commit 60fdf7b
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 11 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Release Notes
All notable changes to this project will be documented in this file.

## 1.4.1 Dec 22, 2020

### New
- `net.find_last_shard_block` function returning account shard last block ID.
- `boc.get_code_from_tvc` function extracting contract code from TVC image.
- **Debot Module:**
- Add new variant `ParamsOfAppDebotBrowser::SwitchCompleted` to notify browser when all context actions are shown.

## 1.3.3 - Dec 16, 2020

### Fix
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.4.0",
"version": "1.4.1",
"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.4.0",
"version": "1.4.1",
"description": "TON Client for Java Script",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
122 changes: 120 additions & 2 deletions packages/core/src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,13 @@ export class CryptoModule {
}

/**
* Verifies the signature and returns the unsigned message
*
* @remarks
* Verifies the signature in `signed` using the signer's public key `public`
* and returns the message `unsigned`.
*
* If the signature fails verification, crypto_sign_open raises an exception.
*
* @param {ParamsOfNaclSignOpen} params
* @returns ResultOfNaclSignOpen
Expand All @@ -1207,6 +1214,11 @@ export class CryptoModule {
}

/**
* Signs the message using the secret key and returns a signature.
*
* @remarks
* Signs the message `unsigned` using the secret key `secret`
* and returns a signature `signature`.
*
* @param {ParamsOfNaclSign} params
* @returns ResultOfNaclSignDetached
Expand All @@ -1216,6 +1228,7 @@ export class CryptoModule {
}

/**
* Generates a random NaCl key pair
* @returns KeyPair
*/
nacl_box_keypair(): Promise<KeyPair> {
Expand Down Expand Up @@ -2318,6 +2331,22 @@ export type ResultOfGetBocHash = {
hash: string
};

export type ParamsOfGetCodeFromTvc = {

/**
* Contract TVC image encoded as base64
*/
tvc: string
};

export type ResultOfGetCodeFromTvc = {

/**
* Contract code encoded as base64
*/
code: string
};

/**
* BOC manipulation module.
*/
Expand Down Expand Up @@ -2411,6 +2440,16 @@ export class BocModule {
get_boc_hash(params: ParamsOfGetBocHash): Promise<ResultOfGetBocHash> {
return this.client.request('boc.get_boc_hash', params);
}

/**
* Extracts code from TVC contract image
*
* @param {ParamsOfGetCodeFromTvc} params
* @returns ResultOfGetCodeFromTvc
*/
get_code_from_tvc(params: ParamsOfGetCodeFromTvc): Promise<ResultOfGetCodeFromTvc> {
return this.client.request('boc.get_code_from_tvc', params);
}
}

// processing module
Expand Down Expand Up @@ -3122,7 +3161,7 @@ export type ResultOfRunTvm = {
* Updated account state BOC.
*
* @remarks
* Encoded as `base64`.Attention! Only data in account state is updated.
* Encoded as `base64`.Attention! Only `account_state.storage.state.data` part of the boc is updated.
*/
account: string
};
Expand Down Expand Up @@ -3167,6 +3206,28 @@ export class TvmModule {
}

/**
* Emulates all the phases of contract execution locally
*
* @remarks
* Performs all the phases of contract execution on Transaction Executor -
* the same component that is used on Validator Nodes.
*
* Can be used for contract debug, to find out the reason of message unsuccessful
* delivery - as Validators just throw away failed transactions, here you can catch it.
*
* Another use case is to estimate fees for message execution. Set `AccountForExecutor::Account.unlimited_balance`
* to `true` so that emulation will not depend on the actual balance.
*
* One more use case - you can procude the sequence of operations,
* thus emulating the multiple contract calls locally.
* And so on.
*
* To get the account boc (bag of cells) - use `net.query` method to download it from graphql api
* (field `boc` of `account`) or generate it with `abi.encode_account method`.
* To get the message boc - use `abi.encode_message` or prepare it any other way, for instance, with Fift script.
*
* If you need this emulation to be as precise as possible then specify `ParamsOfRunExecutor` parameter.
* If you need to see the aborted transaction as a result, not as an error, set `skip_transaction_check` to `true`.
*
* @param {ParamsOfRunExecutor} params
* @returns ResultOfRunExecutor
Expand All @@ -3176,6 +3237,21 @@ export class TvmModule {
}

/**
* Executes get methods of ABI-compatible contracts
*
* @remarks
* Performs only a part of compute phase of transaction execution
* that is used to run get-methods of ABI-compatible contracts.
*
* If you try to run get methods with `run_executor` you will get an error, because it checks ACCEPT and exits
* if there is none, which is actually true for get methods.
*
* To get the account boc (bag of cells) - use `net.query` method to download it from graphql api
* (field `boc` of `account`) or generate it with `abi.encode_account method`.
* To get the message boc - use `abi.encode_message` or prepare it any other way, for instance, with Fift script.
*
* Attention! Updated account state is produces as well, but only
* `account_state.storage.state.data` part of the boc is updated.
*
* @param {ParamsOfRunTvm} params
* @returns ResultOfRunTvm
Expand All @@ -3185,7 +3261,11 @@ export class TvmModule {
}

/**
* Executes getmethod and returns data from TVM stack
* Executes a getmethod of FIFT contract
*
* @remarks
* Executes a getmethod of FIFT contract that fulfills the smc-guidelines https://test.ton.org/smc-guidelines.txt
* and returns the result data from TVM's stack
*
* @param {ParamsOfRunGet} params
* @returns ResultOfRunGet
Expand Down Expand Up @@ -3331,6 +3411,22 @@ export type ParamsOfSubscribeCollection = {
result: string
};

export type ParamsOfFindLastShardBlock = {

/**
* Account address
*/
address: string
};

export type ResultOfFindLastShardBlock = {

/**
* Account shard last block ID
*/
block_id: string
};

/**
* Network access.
*/
Expand Down Expand Up @@ -3427,6 +3523,16 @@ export class NetModule {
resume(): Promise<void> {
return this.client.request('net.resume');
}

/**
* Returns ID of the last block in a specified account shard
*
* @param {ParamsOfFindLastShardBlock} params
* @returns ResultOfFindLastShardBlock
*/
find_last_shard_block(params: ParamsOfFindLastShardBlock): Promise<ResultOfFindLastShardBlock> {
return this.client.request('net.find_last_shard_block', params);
}
}

// debot module
Expand Down Expand Up @@ -3509,6 +3615,8 @@ export type ParamsOfAppDebotBrowser = {
* Debot context ID to which debot is switched.
*/
context_id: number
} | {
type: 'SwitchCompleted'
} | {
type: 'ShowAction'

Expand Down Expand Up @@ -3553,6 +3661,12 @@ export function paramsOfAppDebotBrowserSwitch(context_id: number): ParamsOfAppDe
};
}

export function paramsOfAppDebotBrowserSwitchCompleted(): ParamsOfAppDebotBrowser {
return {
type: 'SwitchCompleted',
};
}

export function paramsOfAppDebotBrowserShowAction(action: DebotAction): ParamsOfAppDebotBrowser {
return {
type: 'ShowAction',
Expand Down Expand Up @@ -3675,6 +3789,7 @@ type ParamsOfAppDebotBrowserInvokeDebot = {
export interface AppDebotBrowser {
log(params: ParamsOfAppDebotBrowserLog): void,
switch(params: ParamsOfAppDebotBrowserSwitch): void,
switch_completed(): void,
show_action(params: ParamsOfAppDebotBrowserShowAction): void,
input(params: ParamsOfAppDebotBrowserInput): Promise<ResultOfAppDebotBrowserInput>,
get_signing_box(): Promise<ResultOfAppDebotBrowserGetSigningBox>,
Expand All @@ -3691,6 +3806,9 @@ async function dispatchAppDebotBrowser(obj: AppDebotBrowser, params: ParamsOfApp
case 'Switch':
obj.switch(params);
break;
case 'SwitchCompleted':
obj.switch_completed();
break;
case 'ShowAction':
obj.show_action(params);
break;
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.4.0",
"version": "1.4.1",
"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.4.0",
"version": "1.4.1",
"description": "TON Client React Native Module",
"main": "index.js",
"repository": {
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.4.0",
"version": "1.4.1",
"description": "TON Client WASM module for browsers",
"main": "index.js",
"scripts": {
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.4.0",
"version": "1.4.1",
"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.4.0",
"version": "1.4.1",
"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.4.0",
"version": "1.4.1",
"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.4.0",
"version": "1.4.1",
"private": true,
"description": "TON Client Tests",
"main": "dist/index.js",
Expand Down

0 comments on commit 60fdf7b

Please sign in to comment.