Skip to content

Commit

Permalink
Upstream 0.18.0 (#92)
Browse files Browse the repository at this point in the history
Moved a client into a separate crate to improve build time
---------

Co-authored-by: Dmitrii Korchagin <[email protected]>
Co-authored-by: Aleksei Dolgii <[email protected]>
Co-authored-by: dbaranov34 <[email protected]>
  • Loading branch information
4 people authored Sep 17, 2024
1 parent 2120666 commit 53fffca
Show file tree
Hide file tree
Showing 144 changed files with 2,544 additions and 622 deletions.
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[profile.default]
slow-timeout = { period = "30s", terminate-after = 4 }
slow-timeout = { period = "90s", terminate-after = 4 }
success-output = "never"
failure-output = "final"
retries = 20
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
.vscode/

# Config
/resources/config/local
/client/resources/config/local
/client/var
/var
36 changes: 16 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
[package]
name = "tonlib"
version = "0.17.6"
[workspace]
members = [
"core",
"client",
]

resolver = "2"


[workspace.package]
version = "0.18.0"
edition = "2021"
description = "Rust SDK for The Open Network"
license = "MIT"
repository = "https://github.com/ston-fi/tonlib-rs"
include = [
"src/*",
"resources/*",
"Cargo.toml"
]

[features]
default=[]
state_cache = []
emulate_get_method = []
with_c_backtrace = ["tonlib-sys/with_debug_info"]
no_avx512 = ["tonlib-sys/no_avx512"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
[workspace.dependencies]
anyhow = "1"
async-trait = "0.1"
base64 = "0.22"
base64-serde = "0.7"
Expand All @@ -32,6 +31,7 @@ hex = "0.4"
hmac = {version = "0.12", features = ["std"]}
lazy_static = "1"
log = "0.4"
log4rs = "1"
moka = { version = "0.12", features = ["future"] }
nacl = "0.5"
num-bigint = { version = "0.4", features = ["serde"] }
Expand All @@ -47,9 +47,5 @@ reqwest = "0.12"
thiserror = "1"
tokio = { version = "1", features = ["rt","macros"] }
tokio-retry = "0.3"
tonlib-sys = "=2024.8"

[dev-dependencies]
anyhow = "1"
log4rs = "1"
tokio-test = "0.4"
tonlib-sys = "=2024.8.0"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async fn call_blockchain_methods()-> anyhow::Result<()>{
txs.incomplete
);
for tx_id in txs.transactions {
let mut t: [u8; 32] = [0; 32];
let mut t: Hash256Bit = ZERO_HASH;
t.clone_from_slice(tx_id.account.as_slice());
let addr = TonAddress::new(workchain, &t);
let id = InternalTransactionId {
Expand Down
57 changes: 57 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[package]
name = "tonlib-client"
description = "Thin wrapper for tonlibjson"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true


include = [
"src/*",
"resources/*",
"Cargo.toml"
]

[features]
default=["state_cache", "emulate_get_method"]
state_cache = []
emulate_get_method = []
no_avx512 = ["tonlib-sys/no_avx512"]
with_debug_info = ["tonlib-sys/with_debug_info"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow.workspace = true
async-trait.workspace = true
base64.workspace = true
base64-serde.workspace = true

crc.workspace = true
dashmap.workspace = true
futures.workspace = true
hex.workspace = true

lazy_static.workspace = true
log.workspace = true
log4rs.workspace = true
num-bigint.workspace = true
num-traits.workspace = true
moka.workspace = true
pbkdf2.workspace = true
rand.workspace = true
reqwest.workspace = true
serde.workspace = true
serde-aux.workspace = true
serde_json.workspace = true
sha2.workspace = true
strum.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-retry.workspace = true
tokio-test.workspace = true
tonlib-sys.workspace = true


tonlib-core = {path = "../core"}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
},
"init_block": {
"root_hash": "VpWyfNOLm8Rqt6CZZ9dZGqJRO3NyrlHHYN1k1oLbJ6g=",
"seqno": 34835953,
"file_hash": "8o12KX54BtJM8RERD1J97Qe1ZWk61LIIyXydlBnixK8=",
"root_hash": "WFgmnfd3wuQR9HydL54EjcuDvLYM/SIwDbDxbNzDyjU=",
"seqno": 39812357,
"file_hash": "scgMz5C3n0uBeb2pdf2e8/BWlfzTB8FcRsNvvHgXKYM=",
"workchain": -1,
"shard": -9223372036854775808
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use async_trait::async_trait;
use futures::future::try_join_all;
use futures::FutureExt;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::client::{TonClientError, TonClientInterface, TxId};
use crate::tl::{
BlockIdExt, BlocksAccountTransactionId, BlocksTransactions, RawTransaction,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/client/error.rs → client/src/client/error.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::io;

use thiserror::Error;
use tonlib_core::TonAddressParseError;

use crate::address::TonAddressParseError;
use crate::tl::{TlError, TonResult, TonResultDiscriminants};

#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/client/interface.rs → client/src/client/interface.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use tonlib_core::TonAddress;

use super::{SmcLibraryQueryExt, SmcLibraryResult, SmcLibraryResultExt, TonLibraryId};
use crate::address::TonAddress;
use crate::client::{TonClientError, TonConnection};
use crate::contract::LoadedSmcState;
use crate::tl::{
Expand Down
2 changes: 1 addition & 1 deletion src/client/types.rs → client/src/client/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use std::sync::Arc;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use tokio::sync::broadcast;
use tonlib_core::TonAddress;

use super::{
BlocksShortTxId, TonClientError, DEFAULT_CONNECTION_CONCURRENCY_LIMIT,
DEFAULT_NOTIFICATION_QUEUE_LENGTH,
};
use crate::address::TonAddress;
use crate::config::MAINNET_CONFIG;
use crate::tl::{InternalTransactionId, TonNotification};

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/contract.rs → client/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pub use jetton::*;
pub use latest_transactions_cache::*;
pub use nft::*;
pub use state::*;
use tonlib_core::TonAddress;
pub use wallet::*;

use crate::address::TonAddress;
use crate::client::TonClientInterface;
use crate::tl::{InternalTransactionId, RawFullAccountState};
use crate::types::{TonMethodId, TvmStackEntry, TvmSuccess};
Expand Down
4 changes: 2 additions & 2 deletions src/contract/error.rs → client/src/contract/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
use std::sync::Arc;

use thiserror::Error;
use tonlib_core::cell::TonCellError;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::cell::TonCellError;
use crate::client::TonClientError;
use crate::emulator::TvmEmulatorError;
use crate::tl::TvmStackError;
Expand Down
2 changes: 1 addition & 1 deletion src/contract/factory.rs → client/src/contract/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pub use cache::*;
pub use library_loader::*;
pub use library_provider::*;
use tokio::sync::OnceCell;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::client::{TonClient, TonClientError, TonClientInterface};
use crate::contract::{LoadedSmcState, TonContract, TonContractError, TonContractState};
use crate::tl::{ConfigInfo, InternalTransactionId, RawFullAccountState};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::time::Duration;
use futures::future::join_all;
use futures::join;
use moka::future::Cache;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::client::{
BlockStream, BlockStreamItem, TonBlockFunctions, TonClient, TonClientInterface,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::sync::Arc;
use async_trait::async_trait;
use base64::engine::general_purpose::STANDARD;
use base64::Engine;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::client::{TonClient, TonClientInterface};
use crate::contract::TonContractError;
use crate::tl::{SmcLibraryQueryExt, TonLibraryId};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::sync::Arc;

use tonlib_core::TonAddress;

use super::{ContractLibraryDict, LibraryLoader};
use crate::address::TonAddress;
use crate::contract::TonContractError;
use crate::tl::RawFullAccountState;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::sync::Arc;

use async_trait::async_trait;
use tonlib_core::TonAddress;

use super::TonContractError;
use crate::address::TonAddress;
use crate::client::TonConnection;
use crate::contract::TonContractFactory;
use crate::tl::RawFullAccountState;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use async_trait::async_trait;
use num_bigint::BigUint;
use strum::IntoStaticStr;
use tonlib_core::cell::{ArcCell, BagOfCells, CellBuilder, CellSlice, TonCellError};
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::cell::{ArcCell, BagOfCells, CellBuilder, CellSlice, TonCellError};
use crate::contract::{MapCellError, MapStackError, TonContractError, TonContractInterface};
use crate::meta::MetaDataContent;
use crate::types::TvmStackEntry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use async_trait::async_trait;
use num_bigint::BigUint;
use strum::IntoStaticStr;
use tonlib_core::cell::ArcCell;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::cell::ArcCell;
use crate::contract::{MapStackError, TonContractError, TonContractInterface};

#[derive(Debug, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use tokio::sync::Mutex;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::client::TonClientError;
use crate::contract::{TonClientInterface, TonContractError, TonContractFactory};
use crate::tl::{InternalTransactionId, RawTransaction, NULL_TRANSACTION_ID};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use async_trait::async_trait;
use num_bigint::BigUint;
use num_traits::Zero;
use strum::IntoStaticStr;
use tonlib_core::cell::{ArcCell, BagOfCells};
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::cell::{ArcCell, BagOfCells};
use crate::contract::factory::TonContractFactory;
use crate::contract::{
MapCellError, MapStackError, NftItemContract, TonContractError, TonContractInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use async_trait::async_trait;
use factory::TonContractFactory;
use num_bigint::{BigInt, BigUint};
use strum::IntoStaticStr;
use tonlib_core::cell::{ArcCell, BagOfCells};
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::cell::{ArcCell, BagOfCells};
use crate::contract::{
factory, MapCellError, MapStackError, TonContractError, TonContractInterface,
};
Expand Down
4 changes: 2 additions & 2 deletions src/contract/state.rs → client/src/contract/state.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::sync::Arc;

use async_trait::async_trait;
use tonlib_core::cell::Cell;
use tonlib_core::TonAddress;

use crate::address::TonAddress;
use crate::cell::Cell;
use crate::client::{TonClientError, TonClientInterface};
use crate::contract::{TonContractError, TonContractFactory, TonContractInterface};
use crate::emulator::{TvmEmulator, TvmEmulatorC7Builder};
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 53fffca

Please sign in to comment.