tonlib-rs
tonlib-rs copied to clipboard
take time too long
env: macos x86, cargo 1.79.0,
cargo.toml: tonlib-core = { git="https://github.com/ston-fi/tonlib-rs.git", branch="main" } tonlib-client = { git="https://github.com/ston-fi/tonlib-rs.git", branch="main" } tonlib-sys = { version="2024.9" }
testnet config: https://ton.org/testnet-global.config.json
` async fn create_client()-> anyhow::Result<TonClient>{ TonClient::set_log_verbosity_level(2); let retry = RetryStrategy { interval_ms: 1000, max_retries: 10, }; let client = TonClientBuilder::new() .with_connection_params(&TonConnectionParams { config: TESTNET_ACTUAL.to_string(), blockchain_name: None, use_callbacks_for_network: false, ignore_cache: false, keystore_dir: None, notification_queue_length: DEFAULT_NOTIFICATION_QUEUE_LENGTH, concurrency_limit: DEFAULT_CONNECTION_CONCURRENCY_LIMIT, }) .with_pool_size(10) // .with_retry_strategy(&retry) .build() .await?; Ok(client) }
pub async fn test() -> anyhow::Result<()> { let client = create_client().await?; let (_, info) = client.get_masterchain_info().await?; info!("MasterchainInfo: {:?}", &info);
let block_id = BlockId { workchain: info.last.workchain, shard: info.last.shard, seqno: info.last.seqno, }; let block_id_ext = client.lookup_block(1, &block_id, 0, 0).await?; info!("BlockIdExt: {:?}", &block_id_ext); } `