Skip to content

Commit

Permalink
[refactor]: Export iroha_data_model, iroha_config, iroha_crypto throu…
Browse files Browse the repository at this point in the history
…gh iroha_client (hyperledger-iroha#4081)

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
  • Loading branch information
mversic committed Dec 13, 2023
1 parent 94b9466 commit 4707238
Show file tree
Hide file tree
Showing 59 changed files with 981 additions and 809 deletions.
1,138 changes: 619 additions & 519 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions client/benches/torii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ use std::thread;

use criterion::{criterion_group, criterion_main, Criterion, Throughput};
use iroha::samples::{construct_executor, get_config};
use iroha_client::client::{asset, Client};
use iroha_client::{
client::{asset, Client},
crypto::KeyPair,
data_model::prelude::*,
};
use iroha_config::base::runtime_upgrades::Reload;
use iroha_crypto::KeyPair;
use iroha_data_model::prelude::*;
use iroha_genesis::{GenesisNetwork, RawGenesisBlockBuilder};
use iroha_primitives::unique_vec;
use iroha_version::Encode;
Expand Down Expand Up @@ -45,7 +47,7 @@ fn query_requests(criterion: &mut Criterion) {
configuration
.logger
.max_log_level
.reload(iroha_data_model::Level::ERROR)
.reload(iroha_client::data_model::Level::ERROR)
.expect("Should not fail");
let mut group = criterion.benchmark_group("query-requests");
let domain_id: DomainId = "domain".parse().expect("Valid");
Expand Down
13 changes: 8 additions & 5 deletions client/benches/tps/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ use std::{
};

use eyre::{Result, WrapErr};
use iroha_client::client::Client;
use iroha_data_model::{
parameter::{default::MAX_TRANSACTIONS_IN_BLOCK, ParametersBuilder},
prelude::*,
use iroha_client::{
client::Client,
data_model::{
parameter::{default::MAX_TRANSACTIONS_IN_BLOCK, ParametersBuilder},
prelude::*,
},
};
use serde::Deserialize;
use serde_json::json;
Expand Down Expand Up @@ -164,7 +166,8 @@ impl MeasurerUnit {

/// Submit initial transactions for measurement
fn ready(self) -> Result<Self> {
let keypair = iroha_crypto::KeyPair::generate().expect("Failed to generate KeyPair.");
let keypair =
iroha_client::crypto::KeyPair::generate().expect("Failed to generate KeyPair.");

let account_id = account_id(self.name);
let alice_id = AccountId::from_str("alice@wonderland")?;
Expand Down
2 changes: 1 addition & 1 deletion client/examples/million_accounts_genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::{thread, time::Duration};

use iroha::samples::{construct_executor, get_config};
use iroha_data_model::prelude::*;
use iroha_client::data_model::prelude::*;
use iroha_genesis::{GenesisNetwork, RawGenesisBlock, RawGenesisBlockBuilder};
use iroha_primitives::unique_vec;
use test_network::{
Expand Down
57 changes: 33 additions & 24 deletions client/examples/tutorial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
use std::fs::File;

use eyre::{Error, WrapErr};
use iroha_client::{config::Configuration, data_model::TryToValue};
// #region rust_config_crates
use iroha_config::client::Configuration;
use iroha_data_model::TryToValue;
// #endregion rust_config_crates

fn main() {
Expand Down Expand Up @@ -47,10 +46,12 @@ fn json_config_client_test(config: &Configuration) -> Result<(), Error> {

fn domain_registration_test(config: &Configuration) -> Result<(), Error> {
// #region domain_register_example_crates
use iroha_client::client::Client;
use iroha_data_model::{
metadata::UnlimitedMetadata,
prelude::{Domain, DomainId, InstructionExpr, RegisterExpr},
use iroha_client::{
client::Client,
data_model::{
metadata::UnlimitedMetadata,
prelude::{Domain, DomainId, InstructionExpr, RegisterExpr},
},
};
// #endregion domain_register_example_crates

Expand Down Expand Up @@ -91,9 +92,9 @@ fn domain_registration_test(config: &Configuration) -> Result<(), Error> {

fn account_definition_test() -> Result<(), Error> {
// #region account_definition_comparison
use iroha_data_model::prelude::AccountId;
use iroha_client::data_model::prelude::AccountId;

// Create an `iroha_data_model::AccountId` instance
// Create an `iroha_client::data_model::AccountId` instance
// with a DomainId instance and a Domain ID for an account
let longhand_account_id = AccountId::new("white_rabbit".parse()?, "looking_glass".parse()?);
let account_id: AccountId = "white_rabbit@looking_glass"
Expand All @@ -111,11 +112,13 @@ fn account_definition_test() -> Result<(), Error> {

fn account_registration_test(config: &Configuration) -> Result<(), Error> {
// #region register_account_crates
use iroha_client::client::Client;
use iroha_crypto::KeyPair;
use iroha_data_model::{
metadata::UnlimitedMetadata,
prelude::{Account, AccountId, InstructionExpr, RegisterExpr},
use iroha_client::{
client::Client,
crypto::KeyPair,
data_model::{
metadata::UnlimitedMetadata,
prelude::{Account, AccountId, InstructionExpr, RegisterExpr},
},
};
// #endregion register_account_crates

Expand Down Expand Up @@ -161,9 +164,11 @@ fn asset_registration_test(config: &Configuration) -> Result<(), Error> {
// #region register_asset_crates
use std::str::FromStr as _;

use iroha_client::client::Client;
use iroha_data_model::prelude::{
AccountId, AssetDefinition, AssetDefinitionId, AssetId, IdBox, MintExpr, RegisterExpr,
use iroha_client::{
client::Client,
data_model::prelude::{
AccountId, AssetDefinition, AssetDefinitionId, AssetId, IdBox, MintExpr, RegisterExpr,
},
};
// #endregion register_asset_crates

Expand Down Expand Up @@ -209,10 +214,12 @@ fn asset_minting_test(config: &Configuration) -> Result<(), Error> {
// #region mint_asset_crates
use std::str::FromStr;

use iroha_client::client::Client;
use iroha_data_model::{
prelude::{AccountId, AssetDefinitionId, AssetId, MintExpr, ToValue},
IdBox,
use iroha_client::{
client::Client,
data_model::{
prelude::{AccountId, AssetDefinitionId, AssetId, MintExpr, ToValue},
IdBox,
},
};
// #endregion mint_asset_crates

Expand Down Expand Up @@ -267,10 +274,12 @@ fn asset_burning_test(config: &Configuration) -> Result<(), Error> {
// #region burn_asset_crates
use std::str::FromStr;

use iroha_client::client::Client;
use iroha_data_model::{
prelude::{AccountId, AssetDefinitionId, AssetId, BurnExpr, ToValue},
IdBox,
use iroha_client::{
client::Client,
data_model::{
prelude::{AccountId, AssetDefinitionId, AssetId, BurnExpr, ToValue},
IdBox,
},
};
// #endregion burn_asset_crates

Expand Down
Loading

0 comments on commit 4707238

Please sign in to comment.