Skip to content

Commit

Permalink
fix cargo doc, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Dec 31, 2024
1 parent f8a2840 commit c8ca172
Show file tree
Hide file tree
Showing 374 changed files with 1,155 additions and 1,171 deletions.
2 changes: 1 addition & 1 deletion bindings/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use packable::error::UnexpectedEOF;
use serde::{ser::SerializeMap, Serialize, Serializer};
use serde::{Serialize, Serializer, ser::SerializeMap};

/// Result type of the bindings core crate.
pub type Result<T> = std::result::Result<T, Error>;
Expand Down
6 changes: 3 additions & 3 deletions bindings/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ mod response;
use std::fmt::{Formatter, Result as FmtResult};

use derivative::Derivative;
use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder};
use fern_logger::{LoggerConfig, LoggerOutputConfigBuilder, logger_init};
pub use iota_sdk;
use iota_sdk::{
client::secret::{SecretManager, SecretManagerDto},
wallet::{ClientOptions, Wallet},
};
use serde::Deserialize;

#[cfg(feature = "mqtt")]
pub use self::method_handler::listen_mqtt;
#[cfg(not(target_family = "wasm"))]
pub use self::method_handler::CallMethod;
#[cfg(feature = "mqtt")]
pub use self::method_handler::listen_mqtt;
pub use self::{
error::{Error, Result},
method::{AccountMethod, ClientMethod, SecretManagerMethod, UtilsMethod, WalletMethod},
Expand Down
20 changes: 10 additions & 10 deletions bindings/core/src/method/account.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

#[cfg(feature = "participation")]
use iota_sdk::{
client::node_manager::node::Node,
types::api::plugins::participation::types::{ParticipationEventId, ParticipationEventType},
wallet::account::types::participation::ParticipationEventRegistrationOptions,
};
use iota_sdk::{
U256,
client::{
api::{input_selection::BurnDto, PreparedTransactionDataDto, SignedTransactionDataDto},
api::{PreparedTransactionDataDto, SignedTransactionDataDto, input_selection::BurnDto},
secret::GenerateAddressOptions,
},
types::block::{
address::Bech32Address,
output::{dto::OutputDto, OutputId, TokenId},
output::{OutputId, TokenId, dto::OutputDto},
payload::transaction::TransactionId,
},
wallet::{
SendNativeTokensParams, SendNftParams, SendParams,
account::{
ConsolidationParams, CreateAliasParams, CreateNativeTokenParams, FilterOptions, MintNftParams,
OutputParams, OutputsToClaim, SyncOptions, TransactionOptionsDto,
},
SendNativeTokensParams, SendNftParams, SendParams,
},
U256,
};
#[cfg(feature = "participation")]
use iota_sdk::{
client::node_manager::node::Node,
types::api::plugins::participation::types::{ParticipationEventId, ParticipationEventType},
wallet::account::types::participation::ParticipationEventRegistrationOptions,
};
use serde::{Deserialize, Serialize};

Expand Down
4 changes: 2 additions & 2 deletions bindings/core/src/method/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ use iota_sdk::{
secret::SecretManagerDto,
},
types::block::{
BlockDto, BlockId,
address::{Bech32Address, Hrp},
output::{
AliasId, FoundryId, NativeToken, NftId, OutputId,
dto::{OutputDto, TokenSchemeDto},
feature::dto::FeatureDto,
unlock_condition::dto::UnlockConditionDto,
AliasId, FoundryId, NativeToken, NftId, OutputId,
},
payload::{dto::PayloadDto, milestone::MilestoneId, transaction::TransactionId},
BlockDto, BlockId,
},
};
use serde::{Deserialize, Serialize};
Expand Down
6 changes: 3 additions & 3 deletions bindings/core/src/method/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use derivative::Derivative;
use iota_sdk::{
client::secret::types::InputSigningDataDto,
types::block::{
BlockDto,
address::{Bech32Address, Hrp},
output::{dto::OutputDto, AliasId, NftId, OutputId, RentStructure},
output::{AliasId, NftId, OutputId, RentStructure, dto::OutputDto},
payload::{
dto::MilestonePayloadDto,
transaction::{
dto::{TransactionEssenceDto, TransactionPayloadDto},
TransactionId,
dto::{TransactionEssenceDto, TransactionPayloadDto},
},
},
protocol::ProtocolParameters,
signature::dto::Ed25519SignatureDto,
BlockDto,
},
};
use serde::{Deserialize, Serialize};
Expand Down
8 changes: 4 additions & 4 deletions bindings/core/src/method/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ use derivative::Derivative;
#[cfg(feature = "events")]
use iota_sdk::wallet::events::types::{WalletEvent, WalletEventType};
use iota_sdk::{
Url,
client::{node_manager::node::NodeAuth, secret::GenerateAddressOptions},
types::block::address::Hrp,
wallet::{
ClientOptions,
account::{
types::{AccountAddress, AccountIdentifier},
SyncOptions,
types::{AccountAddress, AccountIdentifier},
},
ClientOptions,
},
Url,
};
use serde::{Deserialize, Serialize};

use crate::method::account::AccountMethod;
#[cfg(feature = "stronghold")]
use crate::OmittedDebug;
use crate::method::account::AccountMethod;

/// The methods that can be sent to the actor.
#[derive(Clone, Derivative, Serialize, Deserialize)]
Expand Down
6 changes: 3 additions & 3 deletions bindings/core/src/method_handler/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ use iota_sdk::{
PreparedTransactionData, PreparedTransactionDataDto, SignedTransactionData, SignedTransactionDataDto,
},
types::{
block::output::{dto::OutputDto, Output},
TryFromDto,
block::output::{Output, dto::OutputDto},
},
wallet::account::{
types::TransactionDto, Account, OutputDataDto, PreparedCreateNativeTokenTransactionDto, TransactionOptions,
Account, OutputDataDto, PreparedCreateNativeTokenTransactionDto, TransactionOptions, types::TransactionDto,
},
};

use crate::{method::AccountMethod, Response, Result};
use crate::{Response, Result, method::AccountMethod};

pub(crate) async fn call_account_method_internal(account: &Account, method: AccountMethod) -> Result<Response> {
let response = match method {
Expand Down
4 changes: 2 additions & 2 deletions bindings/core/src/method_handler/call_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ use std::pin::Pin;

use futures::Future;
use iota_sdk::{
client::{secret::SecretManager, Client},
client::{Client, secret::SecretManager},
wallet::Wallet,
};
use tokio::sync::RwLock;

use crate::{
UtilsMethod,
method::{ClientMethod, SecretManagerMethod, WalletMethod},
method_handler::{
client::call_client_method_internal, secret_manager::call_secret_manager_method_internal,
utils::call_utils_method_internal, wallet::call_wallet_method_internal,
},
panic::{convert_async_panics, convert_panics},
response::Response,
UtilsMethod,
};

pub trait CallMethod {
Expand Down
13 changes: 7 additions & 6 deletions bindings/core/src/method_handler/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@
use iota_sdk::client::mqtt::{MqttPayload, Topic};
use iota_sdk::{
client::{
Client,
api::{PreparedTransactionData, PreparedTransactionDataDto},
request_funds_from_faucet, Client,
request_funds_from_faucet,
},
types::{
TryFromDto,
api::core::response::OutputWithMetadataResponse,
block::{
Block, BlockDto,
input::dto::UtxoInputDto,
output::{
dto::{OutputBuilderAmountDto, OutputDto},
AliasOutput, BasicOutput, FoundryOutput, NftOutput, Output, Rent,
dto::{OutputBuilderAmountDto, OutputDto},
},
payload::{dto::MilestonePayloadDto, Payload},
Block, BlockDto,
payload::{Payload, dto::MilestonePayloadDto},
},
TryFromDto,
},
};

use crate::{method::ClientMethod, response::Response, Result};
use crate::{Result, method::ClientMethod, response::Response};

/// Listen to MQTT events
#[cfg(feature = "mqtt")]
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/src/method_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod utils;
mod wallet;

pub use call_method::{
call_client_method, call_secret_manager_method, call_utils_method, call_wallet_method, CallMethod,
CallMethod, call_client_method, call_secret_manager_method, call_utils_method, call_wallet_method,
};
#[cfg(feature = "mqtt")]
pub use client::listen_mqtt;
4 changes: 2 additions & 2 deletions bindings/core/src/method_handler/secret_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use iota_sdk::{
secret::{SecretManage, SecretManager},
},
types::{
block::{signature::dto::Ed25519SignatureDto, unlock::Unlock},
TryFromDto,
block::{signature::dto::Ed25519SignatureDto, unlock::Unlock},
},
};
use tokio::sync::RwLock;

use crate::{method::SecretManagerMethod, response::Response, Result};
use crate::{Result, method::SecretManagerMethod, response::Response};

/// Call a secret manager method.
pub(crate) async fn call_secret_manager_method_internal(
Expand Down
14 changes: 7 additions & 7 deletions bindings/core/src/method_handler/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
use crypto::keys::bip39::Mnemonic;
use iota_sdk::{
client::{
api::verify_semantic, hex_public_key_to_bech32_address, hex_to_bech32, secret::types::InputSigningData,
verify_mnemonic, Client,
Client, api::verify_semantic, hex_public_key_to_bech32_address, hex_to_bech32, secret::types::InputSigningData,
verify_mnemonic,
},
types::{
TryFromDto,
block::{
address::{dto::AddressDto, Address, AliasAddress, ToBech32Ext},
Block, Error,
address::{Address, AliasAddress, ToBech32Ext, dto::AddressDto},
input::UtxoInput,
output::{AliasId, FoundryId, InputsCommitment, NftId, Output, OutputId, Rent, TokenId},
payload::{transaction::TransactionEssence, MilestonePayload, TransactionPayload},
payload::{MilestonePayload, TransactionPayload, transaction::TransactionEssence},
signature::Ed25519Signature,
Block, Error,
},
TryFromDto,
},
};
use packable::PackableExt;

use crate::{method::UtilsMethod, response::Response, Result};
use crate::{Result, method::UtilsMethod, response::Response};

/// Call a utils method.
pub(crate) fn call_utils_method_internal(method: UtilsMethod) -> Result<Response> {
Expand Down
4 changes: 2 additions & 2 deletions bindings/core/src/method_handler/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use std::time::Duration;

use iota_sdk::{
types::block::address::ToBech32Ext,
wallet::{account::AccountDetailsDto, Wallet},
wallet::{Wallet, account::AccountDetailsDto},
};

use super::account::call_account_method_internal;
use crate::{method::WalletMethod, response::Response, Result};
use crate::{Result, method::WalletMethod, response::Response};

/// Call a wallet method.
pub(crate) async fn call_wallet_method_internal(wallet: &Wallet, method: WalletMethod) -> Result<Response> {
Expand Down
6 changes: 3 additions & 3 deletions bindings/core/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

use std::{
any::Any,
panic::{catch_unwind, AssertUnwindSafe},
panic::{AssertUnwindSafe, catch_unwind},
};

use backtrace::Backtrace;
use futures::{Future, FutureExt};

use crate::{response::Response, Result};
use crate::{Result, response::Response};

fn panic_to_response_message(panic: Box<dyn Any>) -> Response {
let msg = panic.downcast_ref::<String>().map_or_else(
Expand Down Expand Up @@ -58,7 +58,7 @@ pub(crate) fn convert_panics<F: FnOnce() -> Result<Response>>(f: F) -> Result<Re

#[cfg(test)]
mod tests {
use super::super::{panic::convert_async_panics, Response};
use super::super::{Response, panic::convert_async_panics};

#[tokio::test]
async fn panic_to_response() {
Expand Down
12 changes: 6 additions & 6 deletions bindings/core/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use derivative::Derivative;
use iota_sdk::client::secret::LedgerNanoStatus;
use iota_sdk::{
client::{
NetworkInfo, NodeInfoWrapper,
api::{PreparedTransactionDataDto, SignedTransactionDataDto},
node_manager::node::Node,
NetworkInfo, NodeInfoWrapper,
},
types::{
api::{
Expand All @@ -23,9 +23,10 @@ use iota_sdk::{
plugins::indexer::OutputIdsResponse,
},
block::{
address::{dto::AddressDto, Bech32Address, Hrp},
BlockDto, BlockId,
address::{Bech32Address, Hrp, dto::AddressDto},
input::dto::UtxoInputDto,
output::{dto::OutputDto, AliasId, FoundryId, NftId, OutputId, OutputMetadata, TokenId},
output::{AliasId, FoundryId, NftId, OutputId, OutputMetadata, TokenId, dto::OutputDto},
payload::{
dto::{MilestonePayloadDto, TransactionPayloadDto},
milestone::MilestoneId,
Expand All @@ -35,12 +36,11 @@ use iota_sdk::{
semantic::ConflictReason,
signature::dto::Ed25519SignatureDto,
unlock::dto::UnlockDto,
BlockDto, BlockId,
},
},
wallet::account::{
types::{AccountAddress, AddressWithUnspentOutputs, Balance, OutputDataDto, TransactionDto},
AccountDetailsDto, PreparedCreateNativeTokenTransactionDto,
types::{AccountAddress, AddressWithUnspentOutputs, Balance, OutputDataDto, TransactionDto},
},
};
use serde::Serialize;
Expand All @@ -50,7 +50,7 @@ use {
iota_sdk::wallet::account::{AccountParticipationOverview, ParticipationEventWithNodes},
};

use crate::{error::Error, OmittedDebug};
use crate::{OmittedDebug, error::Error};

/// The response message.
#[derive(Serialize, Derivative)]
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/tests/combined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::collections::BTreeMap;

use iota_sdk::{
client::{constants::SHIMMER_COIN_TYPE, secret::SecretManagerDto, ClientBuilder},
client::{ClientBuilder, constants::SHIMMER_COIN_TYPE, secret::SecretManagerDto},
wallet::account::types::AccountIdentifier,
};
use iota_sdk_bindings_core::{AccountMethod, CallMethod, ClientMethod, Response, Result, WalletMethod, WalletOptions};
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/tests/secrets_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::sync::Arc;

use iota_sdk::client::{api::GetAddressesOptions, constants::ETHER_COIN_TYPE, secret::SecretManager};
use iota_sdk_bindings_core::{call_secret_manager_method, Response, Result, SecretManagerMethod};
use iota_sdk_bindings_core::{Response, Result, SecretManagerMethod, call_secret_manager_method};
use pretty_assertions::assert_eq;
use tokio::sync::RwLock;

Expand Down
2 changes: 1 addition & 1 deletion bindings/core/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use iota_sdk::types::block::address::{Bech32Address, Hrp};
use iota_sdk_bindings_core::{call_utils_method, Response, Result, UtilsMethod};
use iota_sdk_bindings_core::{Response, Result, UtilsMethod, call_utils_method};
use pretty_assertions::assert_eq;

#[tokio::test]
Expand Down
6 changes: 3 additions & 3 deletions bindings/nodejs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use std::sync::Arc;

use iota_sdk_bindings_core::{
call_client_method as rust_call_client_method,
iota_sdk::client::{mqtt::Topic, Client, ClientBuilder},
listen_mqtt as rust_listen_mqtt, ClientMethod, Response, Result,
ClientMethod, Response, Result, call_client_method as rust_call_client_method,
iota_sdk::client::{Client, ClientBuilder, mqtt::Topic},
listen_mqtt as rust_listen_mqtt,
};
use neon::prelude::*;
use tokio::sync::RwLock;
Expand Down
Loading

0 comments on commit c8ca172

Please sign in to comment.