Skip to content

Commit

Permalink
Merge pull request #278 from tonlabs/1.2.0-rc
Browse files Browse the repository at this point in the history
Version: 1.2.0
  • Loading branch information
g9d committed Nov 26, 2020
2 parents b9543ca + 34d1941 commit 98dbb10
Show file tree
Hide file tree
Showing 188 changed files with 9,692 additions and 5,226 deletions.
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Cargo.lock
*.pdb
*.exe
*.rlib
build/

# IDE files
.idea
Expand All @@ -25,16 +26,9 @@ Cargo.lock
/ton_client/**/*.so
/ton_client/**/*.gz
/ton_client/**/*.dylib
/ton_client/platforms/ton-client-node-js/build/
/ton_client/platforms/ton-client-react-native/build/
/ton_client/platforms/ton-client-web/build/
/ton_client/platforms/ton-client-web/build/tonclient.wasm
/ton_client/platforms/ton-client-web/build/index.js
/ton_client/client/bin/
/ton_client/client/build/
/ton_client/client/src/build_info.json
/ton_client/platforms/ton-client-react-native/android/src/main/jniLibs/
/ton_client/platforms/ton-client-react-native/ios/libtonclient.a
/ton_client/src/build_info.json
/examples/c/libton_client.dylib
/tools/node_modules/
/tools/**/*.map
Expand Down
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
# Release Notes
All notable changes to this project will be documented in this file.

## 1.2.0 Nov 26, 2020

### Featured
- **UNSTABLE API. This API is experimental. It can be changed in the next releases**.
`debot` module was added with debot engine functions, such as : `start`, `fetch`, `execute`, `remove`. See the `debot` module documentation for more info.
Check our tests for code examples.

- External signing was supported for message encoding: `SigningBox` type for `Signer` enum was supported.
Now it is possible to sign messages with externally implemented signing box interface without private key disclosure to the library. Can be used in case of signing via HSM API or via cold wallet - when there is no access to the private key.

It is also possible to create a Signing Box instance inside SDK - from a key pair passed into the library with `get_signing_box` method. It can be used for some test cases. Also it increases security - you need to pass your keys one time only.

Check the `crypto` module documentation for `SigningBoxHandle` type and `register_signing_box`, `get_signing_box`, `signing_box_get_public_key`, `signing_box_sign`.
Check our tests for code examples.

### Fixed
- panic after `tc_destroy_context` call. Now all contexts use global async runtime
- field `mnemonic_hdkey_compliant` was removed from `CryptoConfig` (unused by the library)
- original and resolved errors are swapped in result. Now `error.code` contains original error code

## 1.1.2 Nov 15, 2020
### Fixed
- `wasm` feature was not worked.
- `wasm` feature has been fixed
- `crypto.factorize` doesn't panic on invalid challenge
- `client.get_api_reference` returns proper version
- ABI JSON with explicit function ID is parsed properly

## 1.1.1 Nov 11, 2020
### Fixed
- To be compatible with older rust version change api type derivation with `vec![]`
- Compatible with older rust version change api type derivation with `vec![]`
instead of prev `[].into()`

## 1.1.0 Nov 3, 2020
Expand Down
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[workspace]
members = [
"ton_sdk",
"ton_client/client",
"ton_client",
"toncli",
"api/test",
]

exclude = [
"ton_client/platforms/ton-client-node-js",
"ton_client/platforms/ton-client-web",
"examples/rust"
]
35 changes: 10 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ Binding is a thin client library written on the specific language that acts like
a client library and an application code written on that language.

List of known bindings:
- [Web binding](https://github.com/tonlabs/ton-client-web-js)
- [Node.js binding](https://github.com/tonlabs/ton-client-node-js)
- [React-native binding](https://github.com/tonlabs/ton-client-react-native-js)
- [Rust binding](https://github.com/tonlabs/ton-client-rs)
- [Web binding](https://github.com/tonlabs/ton-client-js)
- [Node.js binding](https://github.com/tonlabs/ton-client-js)
- [React-native binding](https://github.com/tonlabs/ton-client-js)

# Build client library

Expand All @@ -129,17 +128,7 @@ run `node build.js`.

The resulting binaries are placed to `bin` folder in the gz-compressed format.

The list defines all build targets (paths are relative and determined to the location where
you clone this repo):

- `ton_client/platforms/ton-client-node-js` – Node.js add-on (and an optional dylib for Mac OS) used in Node.js-based JavaScript binding.

Note that the build script generates binaries compatible with the platform used to run the script. For example, if you run it on Mac OS, you get binaries targeted at Darwin (macOS) platform.

- `ton_client/platforms/ton-client-react-native` – iOS and Android native libraries for react-native mobile applications.
- `ton_client/platforms/ton-client-web` – WASM and JavaScript wrapper for browser-based applications.
- `ton_client/client` – general purpose dynamic link library. Currently, it is used in rust binding. It is a good starting place for creating a new bindings.

Note that the build script generates binaries compatible with the platform used to run the script. For example, if you run it on Mac OS, you get binaries targeted at Darwin (macOS) platform.

# Download precompiled binaries

Expand All @@ -148,16 +137,12 @@ TON Labs SDK Binaries Store.

Platform | Major | Download links
-------- | ----- | --------------
Win32 | 0 | [`ton_client.lib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_win32_lib.gz), [`ton_client.dll`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_win32_dll.gz), [`tonclient.node`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_nodejs_addon_win32.gz)
  | 1 | [`ton_client.lib`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_win32_lib.gz), [`ton_client.dll`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_win32_dll.gz), [`tonclient.node`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_nodejs_addon_win32.gz)
macOS | 0 | [`libton_client.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_darwin.gz), [`tonclient.node`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_nodejs_addon_darwin.gz), [`libtonclientnodejs.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_nodejs_dylib_darwin.gz)
  | 1 | [`libton_client.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_darwin.gz), [`tonclient.node`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_nodejs_addon_darwin.gz)
Linux | 0 | [`libton_client.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_linux.gz), [`tonclient.node`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_nodejs_addon_linux.gz)
  | 1 | [`libton_client.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_linux.gz), [`tonclient.node`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_nodejs_addon_linux.gz)
WASM | 0 | [`tonclient.wasm`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_wasm.gz), [`tonclient.js`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_wasm_js.gz)
  | 1 | [`tonclient.wasm`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_wasm.gz), [`tonclient.js`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_wasm_js.gz)
iOS | 0 | [`libtonclient.a`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_react_native_ios.gz)
Android | 0 | [`armeabi-v7a/libtonclient.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_react_native_armv7-linux-androideabi.gz), [`arm64-v8a/libtonclient.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_react_native_aarch64-linux-android.gz), [`x86/libtonclient.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_react_native_i686-linux-android.gz)
Win32 | 0 | [`ton_client.lib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_win32_lib.gz), [`ton_client.dll`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_win32_dll.gz)
  | 1 | [`ton_client.lib`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_win32_lib.gz), [`ton_client.dll`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_win32_dll.gz)
macOS | 0 | [`libton_client.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_darwin.gz)
  | 1 | [`libton_client.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_darwin.gz)
Linux | 0 | [`libton_client.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_linux.gz)
  | 1 | [`libton_client.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_linux.gz)

If you want an older version of library (e.g. `0.25.0` for macOS), you need to choose a link to your platform from the list above and replace `0` with a version:
[http://sdkbinaries.tonlabs.io/tonclient_<b>0_25_0</b>_darwin.gz](http://sdkbinaries.tonlabs.io/tonclient_0_25_0_darwin.gz)
Expand Down
2 changes: 1 addition & 1 deletion api/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api_derive"
version = "1.1.2"
version = "1.2.0"
authors = ["Michael Vlasov <melsomino@gmail.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion api/derive/src/api_module.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::{module_from, module_to_tokens};
use quote::quote;
use syn::{DeriveInput};
use syn::DeriveInput;

pub fn impl_api_module(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = syn::parse::<DeriveInput>(input).expect("Derive input");
Expand Down
6 changes: 1 addition & 5 deletions api/derive/src/api_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ fn enum_type(data: &DataEnum) -> api_info::Type {
fn enum_of_types(data: &DataEnum) -> api_info::Type {
let types = data.variants.iter().map(|v| {
let fields = fields_from(&v.fields);
field_from(
Some(&v.ident),
&v.attrs,
api_info::Type::Struct { fields },
)
field_from(Some(&v.ident), &v.attrs, api_info::Type::Struct { fields })
});
api_info::Type::EnumOfTypes {
types: types.collect(),
Expand Down
8 changes: 6 additions & 2 deletions api/derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod api_function;
mod api_module;
mod api_type;
mod utils;
mod api_module;

extern crate api_info;
extern crate proc_macro;
Expand All @@ -28,7 +28,11 @@ extern crate quote;

#[proc_macro]
pub fn include_build_info(_input: TokenStream) -> TokenStream {
let content = match std::fs::read_to_string(std::env::current_dir().unwrap().join("ton_client/client/src/build_info.json")) {
let content = match std::fs::read_to_string(
std::env::current_dir()
.unwrap()
.join("ton_client/src/build_info.json"),
) {
Err(_e) => return quote!("").into(),
Ok(content) => content,
};
Expand Down
2 changes: 1 addition & 1 deletion api/info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api_info"
version = "1.1.2"
version = "1.2.0"
authors = ["Michael Vlasov <melsomino@gmail.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion api/test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api_test"
version = "1.1.2"
version = "1.2.0"
authors = ["Michael Vlasov <melsomino@gmail.com>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions api/test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ extern crate api_derive;

use api_info;

use api_info::{ApiModule, ApiType};
use serde_derive::{Deserialize, Serialize};
use api_info::{ApiType, ApiModule};

#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
pub struct StringId(String);
Expand Down Expand Up @@ -53,7 +53,7 @@ struct Bar {
struct FooHandle(u32);

#[derive(ApiModule)]
#[api_module(name="module")]
#[api_module(name = "module")]
struct Module;

/// This is baz function
Expand Down
5 changes: 5 additions & 0 deletions docs/UNSTABLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# UNSTABLE API

API elements marked as **UNSTABLE** are experimental.

They can be changed in the next releases.
12 changes: 6 additions & 6 deletions docs/mod_abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function attach_signature_to_message_body(
### Parameters
- `abi`: _[Abi](mod_abi.md#Abi)_ – Contract ABI
- `public_key`: _string_ – Public key. Must be encoded with `hex`.
- `message`: _string_ – Unsigned message BOC. Must be encoded with `base64`.
- `message`: _string_ – Unsigned message body BOC. Must be encoded with `base64`.
- `signature`: _string_ – Signature. Must be encoded with `hex`.
### Result

Expand Down Expand Up @@ -600,12 +600,12 @@ type AbiParam = {
type AbiEvent = {
name: string,
inputs: AbiParam[],
id?: number | null
id?: string | null
};
```
- `name`: _string_
- `inputs`: _[AbiParam](mod_abi.md#AbiParam)[]_
- `id`?: _number?_
- `id`?: _string?_


## AbiData
Expand All @@ -629,13 +629,13 @@ type AbiFunction = {
name: string,
inputs: AbiParam[],
outputs: AbiParam[],
id?: number | null
id?: string | null
};
```
- `name`: _string_
- `inputs`: _[AbiParam](mod_abi.md#AbiParam)[]_
- `outputs`: _[AbiParam](mod_abi.md#AbiParam)[]_
- `id`?: _number?_
- `id`?: _string?_


## AbiContract
Expand Down Expand Up @@ -699,7 +699,7 @@ type ParamsOfAttachSignatureToMessageBody = {
```
- `abi`: _[Abi](mod_abi.md#Abi)_ – Contract ABI
- `public_key`: _string_ – Public key. Must be encoded with `hex`.
- `message`: _string_ – Unsigned message BOC. Must be encoded with `base64`.
- `message`: _string_ – Unsigned message body BOC. Must be encoded with `base64`.
- `signature`: _string_ – Signature. Must be encoded with `hex`.


Expand Down
Loading

0 comments on commit 98dbb10

Please sign in to comment.