From 9d171893a0dd8d89f89acff48bcd841b0a963f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thoralf=20M=C3=BCller?= Date: Fri, 3 Nov 2023 10:11:44 +0100 Subject: [PATCH 1/2] Merge wallet methods into single enum --- bindings/core/src/lib.rs | 2 +- bindings/core/src/method/mod.rs | 6 +- bindings/core/src/method/wallet.rs | 423 +++++++++++++++--- bindings/core/src/method/wallet_command.rs | 319 ------------- bindings/core/src/method_handler/mod.rs | 1 - bindings/core/src/method_handler/wallet.rs | 279 +++++++++++- .../core/src/method_handler/wallet_command.rs | 287 ------------ bindings/core/tests/combined.rs | 6 +- 8 files changed, 643 insertions(+), 680 deletions(-) delete mode 100644 bindings/core/src/method/wallet_command.rs delete mode 100644 bindings/core/src/method_handler/wallet_command.rs diff --git a/bindings/core/src/lib.rs b/bindings/core/src/lib.rs index ea1bac6fdd..0d88cd4fbe 100644 --- a/bindings/core/src/lib.rs +++ b/bindings/core/src/lib.rs @@ -27,7 +27,7 @@ pub use self::method_handler::listen_mqtt; pub use self::method_handler::CallMethod; pub use self::{ error::{Error, Result}, - method::{ClientMethod, SecretManagerMethod, UtilsMethod, WalletCommandMethod, WalletMethod}, + method::{ClientMethod, SecretManagerMethod, UtilsMethod, WalletMethod}, method_handler::{call_client_method, call_secret_manager_method, call_utils_method, call_wallet_method}, response::Response, }; diff --git a/bindings/core/src/method/mod.rs b/bindings/core/src/method/mod.rs index 7aaf0baa5a..6e47c80767 100644 --- a/bindings/core/src/method/mod.rs +++ b/bindings/core/src/method/mod.rs @@ -5,9 +5,5 @@ mod client; mod secret_manager; mod utils; mod wallet; -mod wallet_command; -pub use self::{ - client::ClientMethod, secret_manager::SecretManagerMethod, utils::UtilsMethod, wallet::WalletMethod, - wallet_command::WalletCommandMethod, -}; +pub use self::{client::ClientMethod, secret_manager::SecretManagerMethod, utils::UtilsMethod, wallet::WalletMethod}; diff --git a/bindings/core/src/method/wallet.rs b/bindings/core/src/method/wallet.rs index e99dfa1831..2748e34864 100644 --- a/bindings/core/src/method/wallet.rs +++ b/bindings/core/src/method/wallet.rs @@ -7,15 +7,33 @@ use std::path::PathBuf; use derivative::Derivative; #[cfg(feature = "events")] use iota_sdk::wallet::events::types::{WalletEvent, WalletEventType}; +#[cfg(feature = "participation")] use iota_sdk::{ - client::{node_manager::node::NodeAuth, secret::GenerateAddressOptions}, - types::block::address::Hrp, - wallet::{ClientOptions, SyncOptions}, + client::node_manager::node::Node, + types::api::plugins::participation::types::{ParticipationEventId, ParticipationEventType}, + wallet::types::participation::ParticipationEventRegistrationOptions, +}; +use iota_sdk::{ + client::{ + api::{input_selection::Burn, PreparedTransactionDataDto, SignedTransactionDataDto}, + node_manager::node::NodeAuth, + secret::GenerateAddressOptions, + }, + types::block::{ + address::{Bech32Address, Hrp}, + output::{dto::OutputDto, OutputId, TokenId}, + payload::signed_transaction::TransactionId, + }, + wallet::{ + ClientOptions, ConsolidationParams, CreateAccountParams, CreateNativeTokenParams, FilterOptions, MintNftParams, + OutputParams, OutputsToClaim, SendNativeTokensParams, SendNftParams, SendParams, SyncOptions, + TransactionOptions, + }, + U256, }; use serde::{Deserialize, Serialize}; use url::Url; -use crate::method::WalletCommandMethod; #[cfg(feature = "stronghold")] use crate::OmittedDebug; @@ -25,13 +43,6 @@ use crate::OmittedDebug; #[serde(tag = "name", content = "data", rename_all = "camelCase")] #[non_exhaustive] pub enum WalletMethod { - /// Consume a wallet command method. - /// Returns [`Response`](crate::Response) - #[serde(rename_all = "camelCase")] - CallMethod { - /// The wallet command method to call. - method: WalletCommandMethod, - }, /// Backup storage. Password must be the current one, when Stronghold is used as SecretManager. /// Expected response: [`Ok`](crate::Response::Ok) #[cfg(feature = "stronghold")] @@ -43,28 +54,6 @@ pub enum WalletMethod { #[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] password: String, }, - /// Change the Stronghold password to another one and also re-encrypt the values in the loaded snapshot with it. - /// Expected response: [`Ok`](crate::Response::Ok) - #[cfg(feature = "stronghold")] - #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] - #[serde(rename_all = "camelCase")] - ChangeStrongholdPassword { - #[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] - current_password: String, - #[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] - new_password: String, - }, - /// Clears the Stronghold password from memory. - /// Expected response: [`Ok`](crate::Response::Ok) - #[cfg(feature = "stronghold")] - #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] - ClearStrongholdPassword, - /// Checks if the Stronghold password is available. - /// Expected response: - /// [`Bool`](crate::Response::Bool) - #[cfg(feature = "stronghold")] - #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] - IsStrongholdPasswordAvailable, /// Restore a backup from a Stronghold file /// Replaces client_options, coin_type, secret_manager and wallet. Returns an error if the wallet was already /// created If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a @@ -95,6 +84,329 @@ pub enum WalletMethod { /// Expected response: [`Ok`](crate::Response::Ok) #[serde(rename_all = "camelCase")] SetClientOptions { client_options: Box }, + /// Start background syncing. + /// Expected response: [`Ok`](crate::Response::Ok) + #[serde(rename_all = "camelCase")] + StartBackgroundSync { + /// Sync options + options: Option, + /// Interval in milliseconds + interval_in_milliseconds: Option, + }, + /// Stop background syncing. + /// Expected response: [`Ok`](crate::Response::Ok) + StopBackgroundSync, + // Remove all listeners of this type. Empty vec clears all listeners + /// Expected response: [`Ok`](crate::Response::Ok) + #[cfg(feature = "events")] + #[cfg_attr(docsrs, doc(cfg(feature = "events")))] + #[serde(rename_all = "camelCase")] + ClearListeners { event_types: Vec }, + /// Update the authentication for the provided node. + /// Expected response: [`Ok`](crate::Response::Ok) + UpdateNodeAuth { + /// Node url + url: Url, + /// Authentication options + auth: Option, + }, + /// Get outputs with additional unlock conditions + /// Expected response: [`OutputIds`](crate::Response::OutputIds) + #[serde(rename_all = "camelCase")] + ClaimableOutputs { outputs_to_claim: OutputsToClaim }, + /// Claim outputs. + /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) + #[serde(rename_all = "camelCase")] + ClaimOutputs { output_ids_to_claim: Vec }, + /// Removes a previously registered participation event from local storage. + /// Expected response: [`Ok`](crate::Response::Ok) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + DeregisterParticipationEvent { event_id: ParticipationEventId }, + /// Get the wallet address. + /// Expected response: [`Address`](crate::Response::Address) + GetAddress, + /// Get wallet balance information. + /// Expected response: [`Balance`](crate::Response::Balance) + GetBalance, + /// Get the [`Output`](iota_sdk::types::block::output::Output) that minted a native token by its TokenId + /// Expected response: [`Output`](crate::Response::Output) + #[serde(rename_all = "camelCase")] + GetFoundryOutput { token_id: TokenId }, + /// Get the transaction with inputs of an incoming transaction stored in the wallet + /// List might not be complete, if the node pruned the data already + /// Expected response: [`Transaction`](crate::Response::Transaction) + #[serde(rename_all = "camelCase")] + GetIncomingTransaction { transaction_id: TransactionId }, + /// Get the [`OutputData`](iota_sdk::wallet::types::OutputData) of an output stored in the wallet + /// Expected response: [`OutputData`](crate::Response::OutputData) + #[serde(rename_all = "camelCase")] + GetOutput { output_id: OutputId }, + /// Expected response: [`ParticipationEvent`](crate::Response::ParticipationEvent) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + GetParticipationEvent { event_id: ParticipationEventId }, + /// Expected response: [`ParticipationEventIds`](crate::Response::ParticipationEventIds) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + GetParticipationEventIds { + node: Node, + event_type: Option, + }, + /// Expected response: + /// [`ParticipationEventStatus`](crate::Response::ParticipationEventStatus) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + GetParticipationEventStatus { event_id: ParticipationEventId }, + /// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + GetParticipationEvents, + /// Calculates a participation overview for the wallet. If event_ids are provided, only return outputs and tracked + /// participations for them. + /// Expected response: + /// [`ParticipationOverview`](crate::Response::ParticipationOverview) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + GetParticipationOverview { + event_ids: Option>, + }, + /// Get the [`Transaction`](iota_sdk::wallet::types::Transaction) of a transaction stored in the wallet + /// Expected response: [`Transaction`](crate::Response::Transaction) + #[serde(rename_all = "camelCase")] + GetTransaction { transaction_id: TransactionId }, + /// Get the wallet's total voting power (voting or NOT voting). + /// Expected response: [`VotingPower`](crate::Response::VotingPower) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + GetVotingPower, + /// Returns the implicit account creation address of the wallet if it is Ed25519 based. + /// Expected response: [`Bech32Address`](crate::Response::Bech32Address) + ImplicitAccountCreationAddress, + /// Returns all incoming transactions of the wallet + /// Expected response: + /// [`Transactions`](crate::Response::Transactions) + IncomingTransactions, + /// Returns all outputs of the wallet + /// Expected response: [`OutputsData`](crate::Response::OutputsData) + #[serde(rename_all = "camelCase")] + Outputs { filter_options: Option }, + /// Returns all pending transactions of the wallet + /// Expected response: [`Transactions`](crate::Response::Transactions) + PendingTransactions, + /// A generic function that can be used to burn native tokens, nfts, foundries and accounts. + /// + /// Note that burning **native tokens** doesn't require the foundry output which minted them, but will not + /// increase the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. + /// Therefore it's recommended to use melting, if the foundry output is available. + /// + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareBurn { + burn: Burn, + options: Option, + }, + /// Consolidate outputs. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareConsolidateOutputs { params: ConsolidationParams }, + /// Create an alias output. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareCreateAccountOutput { + params: Option, + options: Option, + }, + /// Prepare to create a native token. + /// Expected response: + /// [`PreparedCreateNativeTokenTransaction`](crate::Response::PreparedCreateNativeTokenTransaction) + PrepareCreateNativeToken { + params: CreateNativeTokenParams, + options: Option, + }, + /// Reduces a wallet's "voting power" by a given amount. + /// This will stop voting, but the voting data isn't lost and calling `Vote` without parameters will revote. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + PrepareDecreaseVotingPower { + #[serde(with = "iota_sdk::utils::serde::string")] + amount: u64, + }, + /// Designates a given amount of tokens towards a wallet's "voting power" by creating a + /// special output, which is really a basic one with some metadata. + /// This will stop voting in most cases (if there is a remainder output), but the voting data isn't lost and + /// calling `Vote` without parameters will revote. Expected response: + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + PrepareIncreaseVotingPower { + #[serde(with = "iota_sdk::utils::serde::string")] + amount: u64, + }, + /// Prepare to melt native tokens. This happens with the foundry output which minted them, by increasing it's + /// `melted_tokens` field. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + #[serde(rename_all = "camelCase")] + PrepareMeltNativeToken { + /// Native token id + token_id: TokenId, + /// To be melted amount + melt_amount: U256, + options: Option, + }, + /// Prepare to mint additional native tokens. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + #[serde(rename_all = "camelCase")] + PrepareMintNativeToken { + /// Native token id + token_id: TokenId, + /// To be minted amount + mint_amount: U256, + options: Option, + }, + /// Prepare to mint NFTs. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareMintNfts { + params: Vec, + options: Option, + }, + /// Prepare an output. + /// Expected response: [`Output`](crate::Response::Output) + #[serde(rename_all = "camelCase")] + PrepareOutput { + params: Box, + transaction_options: Option, + }, + /// Prepare to send base coins. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareSend { + params: Vec, + options: Option, + }, + /// Prepare to send native tokens. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareSendNativeTokens { + params: Vec, + options: Option, + }, + /// Prepare to Send nft. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareSendNft { + params: Vec, + options: Option, + }, + /// Stop participating for an event. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + PrepareStopParticipating { event_id: ParticipationEventId }, + /// Prepare transaction. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + PrepareTransaction { + outputs: Vec, + options: Option, + }, + /// Vote for a participation event. + /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + #[serde(rename_all = "camelCase")] + PrepareVote { + event_id: Option, + answers: Option>, + }, + /// Stores participation information locally and returns the event. + /// + /// This will NOT store the node url and auth inside the client options. + /// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents) + #[cfg(feature = "participation")] + #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] + RegisterParticipationEvents { + options: ParticipationEventRegistrationOptions, + }, + /// Reissues a transaction sent from the wallet for a provided transaction id until it's + /// included (referenced by a milestone). Returns the included block id. + /// Expected response: [`BlockId`](crate::Response::BlockId) + #[serde(rename_all = "camelCase")] + ReissueTransactionUntilIncluded { + /// Transaction id + transaction_id: TransactionId, + /// Interval + interval: Option, + /// Maximum attempts + max_attempts: Option, + }, + /// Send base coins. + /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) + Send { + #[serde(with = "iota_sdk::utils::serde::string")] + amount: u64, + address: Bech32Address, + options: Option, + }, + /// Send base coins to multiple addresses, or with additional parameters. + /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) + SendWithParams { + params: Vec, + options: Option, + }, + /// Send outputs in a transaction. + /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) + SendOutputs { + outputs: Vec, + options: Option, + }, + /// Set the alias of the wallet. + /// Expected response: [`Ok`](crate::Response::Ok) + SetAlias { alias: String }, + /// Set the fallback SyncOptions for wallet syncing. + /// If storage is enabled, will persist during restarts. + /// Expected response: [`Ok`](crate::Response::Ok) + SetDefaultSyncOptions { options: SyncOptions }, + /// Validate the transaction, sign it, submit it to a node and store it in the wallet. + /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) + #[serde(rename_all = "camelCase")] + SignAndSubmitTransaction { + prepared_transaction_data: PreparedTransactionDataDto, + }, + /// Sign a prepared transaction. + /// Expected response: [`SignedTransactionData`](crate::Response::SignedTransactionData) + #[serde(rename_all = "camelCase")] + SignTransaction { + prepared_transaction_data: PreparedTransactionDataDto, + }, + /// Validate the transaction, submit it to a node and store it in the wallet. + /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) + #[serde(rename_all = "camelCase")] + SubmitAndStoreTransaction { + signed_transaction_data: SignedTransactionDataDto, + }, + /// Sync the wallet by fetching new information from the nodes. Will also reissue pending transactions + /// if necessary. A custom default can be set using SetDefaultSyncOptions. + /// Expected response: [`Balance`](crate::Response::Balance) + Sync { + /// Sync options + options: Option, + }, + /// Returns all transactions of the wallet + /// Expected response: [`Transactions`](crate::Response::Transactions) + Transactions, + /// Returns all unspent outputs of the wallet + /// Expected response: [`OutputsData`](crate::Response::OutputsData) + #[serde(rename_all = "camelCase")] + UnspentOutputs { filter_options: Option }, + + /// Emits an event for testing if the event system is working + /// Expected response: [`Ok`](crate::Response::Ok) + #[cfg(feature = "events")] + #[cfg_attr(docsrs, doc(cfg(feature = "events")))] + EmitTestEvent { event: WalletEvent }, + + // TODO: reconsider whether to have the following methods on the wallet /// Generate an address without storing it /// Expected response: [`Bech32Address`](crate::Response::Bech32Address) #[serde(rename_all = "camelCase")] @@ -135,35 +447,26 @@ pub enum WalletMethod { #[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] mnemonic: String, }, - /// Start background syncing. + /// Change the Stronghold password to another one and also re-encrypt the values in the loaded snapshot with it. /// Expected response: [`Ok`](crate::Response::Ok) + #[cfg(feature = "stronghold")] + #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] #[serde(rename_all = "camelCase")] - StartBackgroundSync { - /// Sync options - options: Option, - /// Interval in milliseconds - interval_in_milliseconds: Option, + ChangeStrongholdPassword { + #[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] + current_password: String, + #[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] + new_password: String, }, - /// Stop background syncing. - /// Expected response: [`Ok`](crate::Response::Ok) - StopBackgroundSync, - /// Emits an event for testing if the event system is working - /// Expected response: [`Ok`](crate::Response::Ok) - #[cfg(feature = "events")] - #[cfg_attr(docsrs, doc(cfg(feature = "events")))] - EmitTestEvent { event: WalletEvent }, - // Remove all listeners of this type. Empty vec clears all listeners - /// Expected response: [`Ok`](crate::Response::Ok) - #[cfg(feature = "events")] - #[cfg_attr(docsrs, doc(cfg(feature = "events")))] - #[serde(rename_all = "camelCase")] - ClearListeners { event_types: Vec }, - /// Update the authentication for the provided node. + /// Clears the Stronghold password from memory. /// Expected response: [`Ok`](crate::Response::Ok) - UpdateNodeAuth { - /// Node url - url: Url, - /// Authentication options - auth: Option, - }, + #[cfg(feature = "stronghold")] + #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] + ClearStrongholdPassword, + /// Checks if the Stronghold password is available. + /// Expected response: + /// [`Bool`](crate::Response::Bool) + #[cfg(feature = "stronghold")] + #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] + IsStrongholdPasswordAvailable, } diff --git a/bindings/core/src/method/wallet_command.rs b/bindings/core/src/method/wallet_command.rs deleted file mode 100644 index e3ab0dafe4..0000000000 --- a/bindings/core/src/method/wallet_command.rs +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright 2023 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use iota_sdk::{ - client::api::{input_selection::Burn, PreparedTransactionDataDto, SignedTransactionDataDto}, - types::block::{ - address::Bech32Address, - output::{dto::OutputDto, OutputId, TokenId}, - payload::signed_transaction::TransactionId, - }, - wallet::{ - ConsolidationParams, CreateAccountParams, CreateNativeTokenParams, FilterOptions, MintNftParams, OutputParams, - OutputsToClaim, SendNativeTokensParams, SendNftParams, SendParams, SyncOptions, TransactionOptions, - }, - U256, -}; -#[cfg(feature = "participation")] -use iota_sdk::{ - client::node_manager::node::Node, - types::api::plugins::participation::types::{ParticipationEventId, ParticipationEventType}, - wallet::types::participation::ParticipationEventRegistrationOptions, -}; -use serde::{Deserialize, Serialize}; - -/// Each public wallet command method. -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(tag = "name", content = "data", rename_all = "camelCase")] -#[non_exhaustive] -pub enum WalletCommandMethod { - /// Get outputs with additional unlock conditions - /// Expected response: [`OutputIds`](crate::Response::OutputIds) - #[serde(rename_all = "camelCase")] - ClaimableOutputs { outputs_to_claim: OutputsToClaim }, - /// Claim outputs. - /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) - #[serde(rename_all = "camelCase")] - ClaimOutputs { output_ids_to_claim: Vec }, - /// Removes a previously registered participation event from local storage. - /// Expected response: [`Ok`](crate::Response::Ok) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - DeregisterParticipationEvent { event_id: ParticipationEventId }, - /// Get the wallet address. - /// Expected response: [`Address`](crate::Response::Address) - GetAddress, - /// Get wallet balance information. - /// Expected response: [`Balance`](crate::Response::Balance) - GetBalance, - /// Get the [`Output`](iota_sdk::types::block::output::Output) that minted a native token by its TokenId - /// Expected response: [`Output`](crate::Response::Output) - #[serde(rename_all = "camelCase")] - GetFoundryOutput { token_id: TokenId }, - /// Get the transaction with inputs of an incoming transaction stored in the wallet - /// List might not be complete, if the node pruned the data already - /// Expected response: [`Transaction`](crate::Response::Transaction) - #[serde(rename_all = "camelCase")] - GetIncomingTransaction { transaction_id: TransactionId }, - /// Get the [`OutputData`](iota_sdk::wallet::types::OutputData) of an output stored in the wallet - /// Expected response: [`OutputData`](crate::Response::OutputData) - #[serde(rename_all = "camelCase")] - GetOutput { output_id: OutputId }, - /// Expected response: [`ParticipationEvent`](crate::Response::ParticipationEvent) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - GetParticipationEvent { event_id: ParticipationEventId }, - /// Expected response: [`ParticipationEventIds`](crate::Response::ParticipationEventIds) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - GetParticipationEventIds { - node: Node, - event_type: Option, - }, - /// Expected response: - /// [`ParticipationEventStatus`](crate::Response::ParticipationEventStatus) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - GetParticipationEventStatus { event_id: ParticipationEventId }, - /// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - GetParticipationEvents, - /// Calculates a participation overview for the wallet. If event_ids are provided, only return outputs and tracked - /// participations for them. - /// Expected response: - /// [`ParticipationOverview`](crate::Response::ParticipationOverview) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - GetParticipationOverview { - event_ids: Option>, - }, - /// Get the [`Transaction`](iota_sdk::wallet::types::Transaction) of a transaction stored in the wallet - /// Expected response: [`Transaction`](crate::Response::Transaction) - #[serde(rename_all = "camelCase")] - GetTransaction { transaction_id: TransactionId }, - /// Get the wallet's total voting power (voting or NOT voting). - /// Expected response: [`VotingPower`](crate::Response::VotingPower) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - GetVotingPower, - /// Returns the implicit account creation address of the wallet if it is Ed25519 based. - /// Expected response: [`Bech32Address`](crate::Response::Bech32Address) - ImplicitAccountCreationAddress, - /// Returns all incoming transactions of the wallet - /// Expected response: - /// [`Transactions`](crate::Response::Transactions) - IncomingTransactions, - /// Returns all outputs of the wallet - /// Expected response: [`OutputsData`](crate::Response::OutputsData) - #[serde(rename_all = "camelCase")] - Outputs { filter_options: Option }, - /// Returns all pending transactions of the wallet - /// Expected response: [`Transactions`](crate::Response::Transactions) - PendingTransactions, - /// A generic function that can be used to burn native tokens, nfts, foundries and accounts. - /// - /// Note that burning **native tokens** doesn't require the foundry output which minted them, but will not - /// increase the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. - /// Therefore it's recommended to use melting, if the foundry output is available. - /// - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareBurn { - burn: Burn, - options: Option, - }, - /// Consolidate outputs. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareConsolidateOutputs { params: ConsolidationParams }, - /// Create an alias output. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareCreateAccountOutput { - params: Option, - options: Option, - }, - /// Prepare to create a native token. - /// Expected response: - /// [`PreparedCreateNativeTokenTransaction`](crate::Response::PreparedCreateNativeTokenTransaction) - PrepareCreateNativeToken { - params: CreateNativeTokenParams, - options: Option, - }, - /// Reduces a wallet's "voting power" by a given amount. - /// This will stop voting, but the voting data isn't lost and calling `Vote` without parameters will revote. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - PrepareDecreaseVotingPower { - #[serde(with = "iota_sdk::utils::serde::string")] - amount: u64, - }, - /// Designates a given amount of tokens towards a wallet's "voting power" by creating a - /// special output, which is really a basic one with some metadata. - /// This will stop voting in most cases (if there is a remainder output), but the voting data isn't lost and - /// calling `Vote` without parameters will revote. Expected response: - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - PrepareIncreaseVotingPower { - #[serde(with = "iota_sdk::utils::serde::string")] - amount: u64, - }, - /// Prepare to melt native tokens. This happens with the foundry output which minted them, by increasing it's - /// `melted_tokens` field. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - #[serde(rename_all = "camelCase")] - PrepareMeltNativeToken { - /// Native token id - token_id: TokenId, - /// To be melted amount - melt_amount: U256, - options: Option, - }, - /// Prepare to mint additional native tokens. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - #[serde(rename_all = "camelCase")] - PrepareMintNativeToken { - /// Native token id - token_id: TokenId, - /// To be minted amount - mint_amount: U256, - options: Option, - }, - /// Prepare to mint NFTs. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareMintNfts { - params: Vec, - options: Option, - }, - /// Prepare an output. - /// Expected response: [`Output`](crate::Response::Output) - #[serde(rename_all = "camelCase")] - PrepareOutput { - params: Box, - transaction_options: Option, - }, - /// Prepare to send base coins. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareSend { - params: Vec, - options: Option, - }, - /// Prepare to send native tokens. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareSendNativeTokens { - params: Vec, - options: Option, - }, - /// Prepare to Send nft. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareSendNft { - params: Vec, - options: Option, - }, - /// Stop participating for an event. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - PrepareStopParticipating { event_id: ParticipationEventId }, - /// Prepare transaction. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - PrepareTransaction { - outputs: Vec, - options: Option, - }, - /// Vote for a participation event. - /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - #[serde(rename_all = "camelCase")] - PrepareVote { - event_id: Option, - answers: Option>, - }, - /// Stores participation information locally and returns the event. - /// - /// This will NOT store the node url and auth inside the client options. - /// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents) - #[cfg(feature = "participation")] - #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] - RegisterParticipationEvents { - options: ParticipationEventRegistrationOptions, - }, - /// Reissues a transaction sent from the wallet for a provided transaction id until it's - /// included (referenced by a milestone). Returns the included block id. - /// Expected response: [`BlockId`](crate::Response::BlockId) - #[serde(rename_all = "camelCase")] - ReissueTransactionUntilIncluded { - /// Transaction id - transaction_id: TransactionId, - /// Interval - interval: Option, - /// Maximum attempts - max_attempts: Option, - }, - /// Send base coins. - /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) - Send { - #[serde(with = "iota_sdk::utils::serde::string")] - amount: u64, - address: Bech32Address, - options: Option, - }, - /// Send base coins to multiple addresses, or with additional parameters. - /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) - SendWithParams { - params: Vec, - options: Option, - }, - /// Send outputs in a transaction. - /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) - SendOutputs { - outputs: Vec, - options: Option, - }, - /// Set the alias of the wallet. - /// Expected response: [`Ok`](crate::Response::Ok) - SetAlias { alias: String }, - /// Set the fallback SyncOptions for wallet syncing. - /// If storage is enabled, will persist during restarts. - /// Expected response: [`Ok`](crate::Response::Ok) - SetDefaultSyncOptions { options: SyncOptions }, - /// Validate the transaction, sign it, submit it to a node and store it in the wallet. - /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) - #[serde(rename_all = "camelCase")] - SignAndSubmitTransaction { - prepared_transaction_data: PreparedTransactionDataDto, - }, - /// Sign a prepared transaction. - /// Expected response: [`SignedTransactionData`](crate::Response::SignedTransactionData) - #[serde(rename_all = "camelCase")] - SignTransaction { - prepared_transaction_data: PreparedTransactionDataDto, - }, - /// Validate the transaction, submit it to a node and store it in the wallet. - /// Expected response: [`SentTransaction`](crate::Response::SentTransaction) - #[serde(rename_all = "camelCase")] - SubmitAndStoreTransaction { - signed_transaction_data: SignedTransactionDataDto, - }, - /// Sync the wallet by fetching new information from the nodes. Will also reissue pending transactions - /// if necessary. A custom default can be set using SetDefaultSyncOptions. - /// Expected response: [`Balance`](crate::Response::Balance) - Sync { - /// Sync options - options: Option, - }, - /// Returns all transactions of the wallet - /// Expected response: [`Transactions`](crate::Response::Transactions) - Transactions, - /// Returns all unspent outputs of the wallet - /// Expected response: [`OutputsData`](crate::Response::OutputsData) - #[serde(rename_all = "camelCase")] - UnspentOutputs { filter_options: Option }, -} diff --git a/bindings/core/src/method_handler/mod.rs b/bindings/core/src/method_handler/mod.rs index 35bccfbbc6..5b39e211fa 100644 --- a/bindings/core/src/method_handler/mod.rs +++ b/bindings/core/src/method_handler/mod.rs @@ -6,7 +6,6 @@ mod client; mod secret_manager; mod utils; mod wallet; -mod wallet_command; pub use call_method::{ call_client_method, call_secret_manager_method, call_utils_method, call_wallet_method, CallMethod, diff --git a/bindings/core/src/method_handler/wallet.rs b/bindings/core/src/method_handler/wallet.rs index b24ac505d7..b83cda4e7c 100644 --- a/bindings/core/src/method_handler/wallet.rs +++ b/bindings/core/src/method_handler/wallet.rs @@ -3,15 +3,25 @@ use std::time::Duration; -use iota_sdk::{types::block::address::ToBech32Ext, wallet::Wallet}; +use iota_sdk::{ + client::api::{ + PreparedTransactionData, PreparedTransactionDataDto, SignedTransactionData, SignedTransactionDataDto, + }, + types::{ + block::{ + address::ToBech32Ext, + output::{dto::OutputDto, Output}, + }, + TryFromDto, + }, + wallet::{types::TransactionWithMetadataDto, OutputDataDto, PreparedCreateNativeTokenTransactionDto, Wallet}, +}; -use super::wallet_command::call_wallet_command_method_internal; use crate::{method::WalletMethod, response::Response, Result}; /// Call a wallet method. pub(crate) async fn call_wallet_method_internal(wallet: &Wallet, method: WalletMethod) -> Result { let response = match method { - WalletMethod::CallMethod { method } => call_wallet_command_method_internal(&wallet, method).await?, #[cfg(feature = "stronghold")] WalletMethod::Backup { destination, password } => { wallet.backup(destination, password).await?; @@ -124,6 +134,269 @@ pub(crate) async fn call_wallet_method_internal(wallet: &Wallet, method: WalletM wallet.update_node_auth(url, auth).await?; Response::Ok } + WalletMethod::ClaimableOutputs { outputs_to_claim } => { + let output_ids = wallet.claimable_outputs(outputs_to_claim).await?; + Response::OutputIds(output_ids) + } + WalletMethod::ClaimOutputs { output_ids_to_claim } => { + let transaction = wallet.claim_outputs(output_ids_to_claim.to_vec()).await?; + Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) + } + #[cfg(feature = "participation")] + WalletMethod::DeregisterParticipationEvent { event_id } => { + wallet.deregister_participation_event(&event_id).await?; + Response::Ok + } + WalletMethod::GetAddress => { + let address = wallet.address().await; + Response::Address(address) + } + WalletMethod::GetBalance => Response::Balance(wallet.balance().await?), + WalletMethod::GetFoundryOutput { token_id } => { + let output = wallet.get_foundry_output(token_id).await?; + Response::Output(OutputDto::from(&output)) + } + WalletMethod::GetIncomingTransaction { transaction_id } => { + let transaction = wallet.get_incoming_transaction(&transaction_id).await; + + transaction.map_or_else( + || Response::Transaction(None), + |transaction| Response::Transaction(Some(Box::new(TransactionWithMetadataDto::from(&transaction)))), + ) + } + WalletMethod::GetOutput { output_id } => { + let output_data = wallet.get_output(&output_id).await; + Response::OutputData(output_data.as_ref().map(OutputDataDto::from).map(Box::new)) + } + #[cfg(feature = "participation")] + WalletMethod::GetParticipationEvent { event_id } => { + let event_and_nodes = wallet.get_participation_event(event_id).await?; + Response::ParticipationEvent(event_and_nodes) + } + #[cfg(feature = "participation")] + WalletMethod::GetParticipationEventIds { node, event_type } => { + let event_ids = wallet.get_participation_event_ids(&node, event_type).await?; + Response::ParticipationEventIds(event_ids) + } + #[cfg(feature = "participation")] + WalletMethod::GetParticipationEventStatus { event_id } => { + let event_status = wallet.get_participation_event_status(&event_id).await?; + Response::ParticipationEventStatus(event_status) + } + #[cfg(feature = "participation")] + WalletMethod::GetParticipationEvents => { + let events = wallet.get_participation_events().await?; + Response::ParticipationEvents(events) + } + #[cfg(feature = "participation")] + WalletMethod::GetParticipationOverview { event_ids } => { + let overview = wallet.get_participation_overview(event_ids).await?; + Response::ParticipationOverview(overview) + } + WalletMethod::GetTransaction { transaction_id } => { + let transaction = wallet.get_transaction(&transaction_id).await; + Response::Transaction(transaction.as_ref().map(TransactionWithMetadataDto::from).map(Box::new)) + } + #[cfg(feature = "participation")] + WalletMethod::GetVotingPower => { + let voting_power = wallet.get_voting_power().await?; + Response::VotingPower(voting_power.to_string()) + } + WalletMethod::ImplicitAccountCreationAddress => { + let implicit_account_creation_address = wallet.implicit_account_creation_address().await?; + Response::Bech32Address(implicit_account_creation_address) + } + WalletMethod::IncomingTransactions => { + let transactions = wallet.incoming_transactions().await; + Response::Transactions(transactions.iter().map(TransactionWithMetadataDto::from).collect()) + } + WalletMethod::Outputs { filter_options } => { + let outputs = wallet.outputs(filter_options).await?; + Response::OutputsData(outputs.iter().map(OutputDataDto::from).collect()) + } + WalletMethod::PendingTransactions => { + let transactions = wallet.pending_transactions().await; + Response::Transactions(transactions.iter().map(TransactionWithMetadataDto::from).collect()) + } + WalletMethod::PrepareBurn { burn, options } => { + let data = wallet.prepare_burn(burn, options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareConsolidateOutputs { params } => { + let data = wallet.prepare_consolidate_outputs(params).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareCreateAccountOutput { params, options } => { + let data = wallet.prepare_create_account_output(params, options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareMeltNativeToken { + token_id, + melt_amount, + options, + } => { + let data = wallet.prepare_melt_native_token(token_id, melt_amount, options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + #[cfg(feature = "participation")] + WalletMethod::PrepareDecreaseVotingPower { amount } => { + let data = wallet.prepare_decrease_voting_power(amount).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareMintNativeToken { + token_id, + mint_amount, + options, + } => { + let data = wallet.prepare_mint_native_token(token_id, mint_amount, options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + #[cfg(feature = "participation")] + WalletMethod::PrepareIncreaseVotingPower { amount } => { + let data = wallet.prepare_increase_voting_power(amount).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareMintNfts { params, options } => { + let data = wallet.prepare_mint_nfts(params, options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareCreateNativeToken { params, options } => { + let data = wallet.prepare_create_native_token(params, options).await?; + Response::PreparedCreateNativeTokenTransaction(PreparedCreateNativeTokenTransactionDto::from(&data)) + } + WalletMethod::PrepareOutput { + params, + transaction_options, + } => { + let output = wallet.prepare_output(*params, transaction_options).await?; + Response::Output(OutputDto::from(&output)) + } + WalletMethod::PrepareSend { params, options } => { + let data = wallet.prepare_send(params, options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareSendNativeTokens { params, options } => { + let data = wallet.prepare_send_native_tokens(params.clone(), options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareSendNft { params, options } => { + let data = wallet.prepare_send_nft(params.clone(), options).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + #[cfg(feature = "participation")] + WalletMethod::PrepareStopParticipating { event_id } => { + let data = wallet.prepare_stop_participating(event_id).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + WalletMethod::PrepareTransaction { outputs, options } => { + let token_supply = wallet.client().get_token_supply().await?; + let data = wallet + .prepare_transaction( + outputs + .into_iter() + .map(|o| Ok(Output::try_from_dto_with_params(o, token_supply)?)) + .collect::>>()?, + options, + ) + .await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + #[cfg(feature = "participation")] + WalletMethod::PrepareVote { event_id, answers } => { + let data = wallet.prepare_vote(event_id, answers).await?; + Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) + } + #[cfg(feature = "participation")] + WalletMethod::RegisterParticipationEvents { options } => { + let events = wallet.register_participation_events(&options).await?; + Response::ParticipationEvents(events) + } + WalletMethod::ReissueTransactionUntilIncluded { + transaction_id, + interval, + max_attempts, + } => { + let block_id = wallet + .reissue_transaction_until_included(&transaction_id, interval, max_attempts) + .await?; + Response::BlockId(block_id) + } + WalletMethod::Send { + amount, + address, + options, + } => { + let transaction = wallet.send(amount, address, options).await?; + Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) + } + WalletMethod::SendWithParams { params, options } => { + let transaction = wallet.send_with_params(params, options).await?; + Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) + } + WalletMethod::SendOutputs { outputs, options } => { + let token_supply = wallet.client().get_token_supply().await?; + let transaction = wallet + .send_outputs( + outputs + .into_iter() + .map(|o| Ok(Output::try_from_dto_with_params(o, token_supply)?)) + .collect::>>()?, + options, + ) + .await?; + Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) + } + WalletMethod::SetAlias { alias } => { + wallet.set_alias(&alias).await?; + Response::Ok + } + WalletMethod::SetDefaultSyncOptions { options } => { + wallet.set_default_sync_options(options).await?; + Response::Ok + } + WalletMethod::SignAndSubmitTransaction { + prepared_transaction_data, + } => { + let transaction = wallet + .sign_and_submit_transaction( + PreparedTransactionData::try_from_dto_with_params( + prepared_transaction_data, + wallet.client().get_protocol_parameters().await?, + )?, + None, + ) + .await?; + Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) + } + WalletMethod::SignTransaction { + prepared_transaction_data, + } => { + let signed_transaction_data = wallet + .sign_transaction(&PreparedTransactionData::try_from_dto(prepared_transaction_data)?) + .await?; + Response::SignedTransactionData(SignedTransactionDataDto::from(&signed_transaction_data)) + } + WalletMethod::SubmitAndStoreTransaction { + signed_transaction_data, + } => { + let signed_transaction_data = SignedTransactionData::try_from_dto_with_params( + signed_transaction_data, + wallet.client().get_protocol_parameters().await?, + )?; + let transaction = wallet + .submit_and_store_transaction(signed_transaction_data, None) + .await?; + Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) + } + WalletMethod::Sync { options } => Response::Balance(wallet.sync(options).await?), + WalletMethod::Transactions => { + let transactions = wallet.transactions().await; + Response::Transactions(transactions.iter().map(TransactionWithMetadataDto::from).collect()) + } + WalletMethod::UnspentOutputs { filter_options } => { + let outputs = wallet.unspent_outputs(filter_options).await?; + Response::OutputsData(outputs.iter().map(OutputDataDto::from).collect()) + } }; Ok(response) } diff --git a/bindings/core/src/method_handler/wallet_command.rs b/bindings/core/src/method_handler/wallet_command.rs deleted file mode 100644 index 93a5994bdf..0000000000 --- a/bindings/core/src/method_handler/wallet_command.rs +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright 2023 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use iota_sdk::{ - client::api::{ - PreparedTransactionData, PreparedTransactionDataDto, SignedTransactionData, SignedTransactionDataDto, - }, - types::{ - block::output::{dto::OutputDto, Output}, - TryFromDto, - }, - wallet::{types::TransactionWithMetadataDto, OutputDataDto, PreparedCreateNativeTokenTransactionDto, Wallet}, -}; - -use crate::{method::WalletCommandMethod, Response, Result}; - -pub(crate) async fn call_wallet_command_method_internal( - wallet: &Wallet, - method: WalletCommandMethod, -) -> Result { - let response = match method { - WalletCommandMethod::ClaimableOutputs { outputs_to_claim } => { - let output_ids = wallet.claimable_outputs(outputs_to_claim).await?; - Response::OutputIds(output_ids) - } - WalletCommandMethod::ClaimOutputs { output_ids_to_claim } => { - let transaction = wallet.claim_outputs(output_ids_to_claim.to_vec()).await?; - Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::DeregisterParticipationEvent { event_id } => { - wallet.deregister_participation_event(&event_id).await?; - Response::Ok - } - WalletCommandMethod::GetAddress => { - let address = wallet.address().await; - Response::Address(address) - } - WalletCommandMethod::GetBalance => Response::Balance(wallet.balance().await?), - WalletCommandMethod::GetFoundryOutput { token_id } => { - let output = wallet.get_foundry_output(token_id).await?; - Response::Output(OutputDto::from(&output)) - } - WalletCommandMethod::GetIncomingTransaction { transaction_id } => { - let transaction = wallet.get_incoming_transaction(&transaction_id).await; - - transaction.map_or_else( - || Response::Transaction(None), - |transaction| Response::Transaction(Some(Box::new(TransactionWithMetadataDto::from(&transaction)))), - ) - } - WalletCommandMethod::GetOutput { output_id } => { - let output_data = wallet.get_output(&output_id).await; - Response::OutputData(output_data.as_ref().map(OutputDataDto::from).map(Box::new)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::GetParticipationEvent { event_id } => { - let event_and_nodes = wallet.get_participation_event(event_id).await?; - Response::ParticipationEvent(event_and_nodes) - } - #[cfg(feature = "participation")] - WalletCommandMethod::GetParticipationEventIds { node, event_type } => { - let event_ids = wallet.get_participation_event_ids(&node, event_type).await?; - Response::ParticipationEventIds(event_ids) - } - #[cfg(feature = "participation")] - WalletCommandMethod::GetParticipationEventStatus { event_id } => { - let event_status = wallet.get_participation_event_status(&event_id).await?; - Response::ParticipationEventStatus(event_status) - } - #[cfg(feature = "participation")] - WalletCommandMethod::GetParticipationEvents => { - let events = wallet.get_participation_events().await?; - Response::ParticipationEvents(events) - } - #[cfg(feature = "participation")] - WalletCommandMethod::GetParticipationOverview { event_ids } => { - let overview = wallet.get_participation_overview(event_ids).await?; - Response::ParticipationOverview(overview) - } - WalletCommandMethod::GetTransaction { transaction_id } => { - let transaction = wallet.get_transaction(&transaction_id).await; - Response::Transaction(transaction.as_ref().map(TransactionWithMetadataDto::from).map(Box::new)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::GetVotingPower => { - let voting_power = wallet.get_voting_power().await?; - Response::VotingPower(voting_power.to_string()) - } - WalletCommandMethod::ImplicitAccountCreationAddress => { - let implicit_account_creation_address = wallet.implicit_account_creation_address().await?; - Response::Bech32Address(implicit_account_creation_address) - } - WalletCommandMethod::IncomingTransactions => { - let transactions = wallet.incoming_transactions().await; - Response::Transactions(transactions.iter().map(TransactionWithMetadataDto::from).collect()) - } - WalletCommandMethod::Outputs { filter_options } => { - let outputs = wallet.outputs(filter_options).await?; - Response::OutputsData(outputs.iter().map(OutputDataDto::from).collect()) - } - WalletCommandMethod::PendingTransactions => { - let transactions = wallet.pending_transactions().await; - Response::Transactions(transactions.iter().map(TransactionWithMetadataDto::from).collect()) - } - WalletCommandMethod::PrepareBurn { burn, options } => { - let data = wallet.prepare_burn(burn, options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareConsolidateOutputs { params } => { - let data = wallet.prepare_consolidate_outputs(params).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareCreateAccountOutput { params, options } => { - let data = wallet.prepare_create_account_output(params, options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareMeltNativeToken { - token_id, - melt_amount, - options, - } => { - let data = wallet.prepare_melt_native_token(token_id, melt_amount, options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::PrepareDecreaseVotingPower { amount } => { - let data = wallet.prepare_decrease_voting_power(amount).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareMintNativeToken { - token_id, - mint_amount, - options, - } => { - let data = wallet.prepare_mint_native_token(token_id, mint_amount, options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::PrepareIncreaseVotingPower { amount } => { - let data = wallet.prepare_increase_voting_power(amount).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareMintNfts { params, options } => { - let data = wallet.prepare_mint_nfts(params, options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareCreateNativeToken { params, options } => { - let data = wallet.prepare_create_native_token(params, options).await?; - Response::PreparedCreateNativeTokenTransaction(PreparedCreateNativeTokenTransactionDto::from(&data)) - } - WalletCommandMethod::PrepareOutput { - params, - transaction_options, - } => { - let output = wallet.prepare_output(*params, transaction_options).await?; - Response::Output(OutputDto::from(&output)) - } - WalletCommandMethod::PrepareSend { params, options } => { - let data = wallet.prepare_send(params, options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareSendNativeTokens { params, options } => { - let data = wallet.prepare_send_native_tokens(params.clone(), options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareSendNft { params, options } => { - let data = wallet.prepare_send_nft(params.clone(), options).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::PrepareStopParticipating { event_id } => { - let data = wallet.prepare_stop_participating(event_id).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - WalletCommandMethod::PrepareTransaction { outputs, options } => { - let token_supply = wallet.client().get_token_supply().await?; - let data = wallet - .prepare_transaction( - outputs - .into_iter() - .map(|o| Ok(Output::try_from_dto_with_params(o, token_supply)?)) - .collect::>>()?, - options, - ) - .await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::PrepareVote { event_id, answers } => { - let data = wallet.prepare_vote(event_id, answers).await?; - Response::PreparedTransaction(PreparedTransactionDataDto::from(&data)) - } - #[cfg(feature = "participation")] - WalletCommandMethod::RegisterParticipationEvents { options } => { - let events = wallet.register_participation_events(&options).await?; - Response::ParticipationEvents(events) - } - WalletCommandMethod::ReissueTransactionUntilIncluded { - transaction_id, - interval, - max_attempts, - } => { - let block_id = wallet - .reissue_transaction_until_included(&transaction_id, interval, max_attempts) - .await?; - Response::BlockId(block_id) - } - WalletCommandMethod::Send { - amount, - address, - options, - } => { - let transaction = wallet.send(amount, address, options).await?; - Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) - } - WalletCommandMethod::SendWithParams { params, options } => { - let transaction = wallet.send_with_params(params, options).await?; - Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) - } - WalletCommandMethod::SendOutputs { outputs, options } => { - let token_supply = wallet.client().get_token_supply().await?; - let transaction = wallet - .send_outputs( - outputs - .into_iter() - .map(|o| Ok(Output::try_from_dto_with_params(o, token_supply)?)) - .collect::>>()?, - options, - ) - .await?; - Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) - } - WalletCommandMethod::SetAlias { alias } => { - wallet.set_alias(&alias).await?; - Response::Ok - } - WalletCommandMethod::SetDefaultSyncOptions { options } => { - wallet.set_default_sync_options(options).await?; - Response::Ok - } - WalletCommandMethod::SignAndSubmitTransaction { - prepared_transaction_data, - } => { - let transaction = wallet - .sign_and_submit_transaction( - PreparedTransactionData::try_from_dto_with_params( - prepared_transaction_data, - wallet.client().get_protocol_parameters().await?, - )?, - None, - ) - .await?; - Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) - } - WalletCommandMethod::SignTransaction { - prepared_transaction_data, - } => { - let signed_transaction_data = wallet - .sign_transaction(&PreparedTransactionData::try_from_dto(prepared_transaction_data)?) - .await?; - Response::SignedTransactionData(SignedTransactionDataDto::from(&signed_transaction_data)) - } - WalletCommandMethod::SubmitAndStoreTransaction { - signed_transaction_data, - } => { - let signed_transaction_data = SignedTransactionData::try_from_dto_with_params( - signed_transaction_data, - wallet.client().get_protocol_parameters().await?, - )?; - let transaction = wallet - .submit_and_store_transaction(signed_transaction_data, None) - .await?; - Response::SentTransaction(TransactionWithMetadataDto::from(&transaction)) - } - WalletCommandMethod::Sync { options } => Response::Balance(wallet.sync(options).await?), - WalletCommandMethod::Transactions => { - let transactions = wallet.transactions().await; - Response::Transactions(transactions.iter().map(TransactionWithMetadataDto::from).collect()) - } - WalletCommandMethod::UnspentOutputs { filter_options } => { - let outputs = wallet.unspent_outputs(filter_options).await?; - Response::OutputsData(outputs.iter().map(OutputDataDto::from).collect()) - } - }; - Ok(response) -} diff --git a/bindings/core/tests/combined.rs b/bindings/core/tests/combined.rs index 7025bf713e..79d838ed83 100644 --- a/bindings/core/tests/combined.rs +++ b/bindings/core/tests/combined.rs @@ -20,7 +20,7 @@ use iota_sdk::{ }; use iota_sdk_bindings_core::{ call_client_method, call_secret_manager_method, CallMethod, ClientMethod, Response, Result, SecretManagerMethod, - WalletCommandMethod, WalletMethod, WalletOptions, + WalletMethod, WalletOptions, }; use pretty_assertions::assert_eq; @@ -49,9 +49,7 @@ async fn create_wallet() -> Result<()> { .await?; let response = wallet - .call_method(WalletMethod::CallMethod { - method: WalletCommandMethod::UnspentOutputs { filter_options: None }, - }) + .call_method(WalletMethod::UnspentOutputs { filter_options: None }) .await; match response { From 7760e30122af6c0118ed5d8f51d8252b9b2210db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thoralf=20M=C3=BCller?= Date: Fri, 3 Nov 2023 12:25:06 +0100 Subject: [PATCH 2/2] Rename in docs --- bindings/core/src/response.rs | 94 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/bindings/core/src/response.rs b/bindings/core/src/response.rs index 52bacb01cd..da8d25c5d2 100644 --- a/bindings/core/src/response.rs +++ b/bindings/core/src/response.rs @@ -198,15 +198,15 @@ pub enum Response { /// - [`BuildBasicOutput`](crate::method::ClientMethod::BuildBasicOutput) /// - [`BuildFoundryOutput`](crate::method::ClientMethod::BuildFoundryOutput) /// - [`BuildNftOutput`](crate::method::ClientMethod::BuildNftOutput) - /// - [`GetFoundryOutput`](crate::method::WalletCommandMethod::GetFoundryOutput) - /// - [`PrepareOutput`](crate::method::WalletCommandMethod::PrepareOutput) + /// - [`GetFoundryOutput`](crate::method::WalletMethod::GetFoundryOutput) + /// - [`PrepareOutput`](crate::method::WalletMethod::PrepareOutput) Output(OutputDto), /// Response for: /// - [`AccountIdToBech32`](crate::method::ClientMethod::AccountIdToBech32) /// - [`HexPublicKeyToBech32Address`](crate::method::ClientMethod::HexPublicKeyToBech32Address) /// - [`HexToBech32`](crate::method::ClientMethod::HexToBech32) /// - [`NftIdToBech32`](crate::method::ClientMethod::NftIdToBech32) - /// - [`ImplicitAccountCreationAddress`](crate::method::WalletCommandMethod::ImplicitAccountCreationAddress) + /// - [`ImplicitAccountCreationAddress`](crate::method::WalletMethod::ImplicitAccountCreationAddress) Bech32Address(Bech32Address), /// - [`Faucet`](crate::method::ClientMethod::RequestFundsFromFaucet) Faucet(String), @@ -222,7 +222,7 @@ pub enum Response { /// - [`BlockId`](crate::method::UtilsMethod::BlockId) /// - [`PostBlock`](crate::method::ClientMethod::PostBlock) /// - [`PostBlockRaw`](crate::method::ClientMethod::PostBlockRaw) - /// - [`ReissueTransactionUntilIncluded`](crate::method::WalletCommandMethod::ReissueTransactionUntilIncluded) + /// - [`ReissueTransactionUntilIncluded`](crate::method::WalletMethod::ReissueTransactionUntilIncluded) BlockId(BlockId), /// Response for: /// - [`GetHealth`](crate::method::ClientMethod::GetHealth) @@ -234,12 +234,12 @@ pub enum Response { /// - [`Backup`](crate::method::WalletMethod::Backup), /// - [`ClearListeners`](crate::method::WalletMethod::ClearListeners) /// - [`ClearStrongholdPassword`](crate::method::WalletMethod::ClearStrongholdPassword), - /// - [`DeregisterParticipationEvent`](crate::method::WalletCommandMethod::DeregisterParticipationEvent), + /// - [`DeregisterParticipationEvent`](crate::method::WalletMethod::DeregisterParticipationEvent), /// - [`EmitTestEvent`](crate::method::WalletMethod::EmitTestEvent), /// - [`RestoreBackup`](crate::method::WalletMethod::RestoreBackup), - /// - [`SetAlias`](crate::method::WalletCommandMethod::SetAlias), + /// - [`SetAlias`](crate::method::WalletMethod::SetAlias), /// - [`SetClientOptions`](crate::method::WalletMethod::SetClientOptions), - /// - [`SetDefaultSyncOptions`](crate::method::WalletCommandMethod::SetDefaultSyncOptions), + /// - [`SetDefaultSyncOptions`](crate::method::WalletMethod::SetDefaultSyncOptions), /// - [`SetStrongholdPassword`](crate::method::WalletMethod::SetStrongholdPassword), /// - [`SetStrongholdPasswordClearInterval`](crate::method::WalletMethod::SetStrongholdPasswordClearInterval), /// - [`StartBackgroundSync`](crate::method::WalletMethod::StartBackgroundSync), @@ -253,92 +253,92 @@ pub enum Response { // wallet responses /// Response for: - /// - [`GetAddress`](crate::method::WalletCommandMethod::GetAddress) + /// - [`GetAddress`](crate::method::WalletMethod::GetAddress) Address(Bech32Address), /// Response for: /// - [`MinimumRequiredStorageDeposit`](crate::method::ClientMethod::MinimumRequiredStorageDeposit) /// - [`ComputeStorageDeposit`](crate::method::UtilsMethod::ComputeStorageDeposit) MinimumRequiredStorageDeposit(String), /// Response for: - /// - [`ClaimableOutputs`](crate::method::WalletCommandMethod::ClaimableOutputs) + /// - [`ClaimableOutputs`](crate::method::WalletMethod::ClaimableOutputs) OutputIds(Vec), /// Response for: - /// - [`GetOutput`](crate::method::WalletCommandMethod::GetOutput) + /// - [`GetOutput`](crate::method::WalletMethod::GetOutput) OutputData(Option>), /// Response for: - /// - [`Outputs`](crate::method::WalletCommandMethod::Outputs), - /// - [`UnspentOutputs`](crate::method::WalletCommandMethod::UnspentOutputs) + /// - [`Outputs`](crate::method::WalletMethod::Outputs), + /// - [`UnspentOutputs`](crate::method::WalletMethod::UnspentOutputs) OutputsData(Vec), /// Response for: - /// - [`PrepareBurn`](crate::method::WalletCommandMethod::PrepareBurn), - /// - [`PrepareConsolidateOutputs`](crate::method::WalletCommandMethod::PrepareConsolidateOutputs) - /// - [`PrepareCreateAccountOutput`](crate::method::WalletCommandMethod::PrepareCreateAccountOutput) - /// - [`PrepareDecreaseVotingPower`](crate::method::WalletCommandMethod::PrepareDecreaseVotingPower) - /// - [`PrepareIncreaseVotingPower`](crate::method::WalletCommandMethod::PrepareIncreaseVotingPower) - /// - [`PrepareMeltNativeToken`](crate::method::WalletCommandMethod::PrepareMeltNativeToken) - /// - [`PrepareMintNativeToken`](crate::method::WalletCommandMethod::PrepareMintNativeToken), - /// - [`PrepareMintNfts`](crate::method::WalletCommandMethod::PrepareMintNfts), - /// - [`PrepareSend`](crate::method::WalletCommandMethod::PrepareSend), - /// - [`PrepareSendNativeTokens`](crate::method::WalletCommandMethod::PrepareSendNativeTokens), - /// - [`PrepareSendNft`](crate::method::WalletCommandMethod::PrepareSendNft), - /// - [`PrepareStopParticipating`](crate::method::WalletCommandMethod::PrepareStopParticipating) - /// - [`PrepareTransaction`](crate::method::WalletCommandMethod::PrepareTransaction) - /// - [`PrepareVote`](crate::method::WalletCommandMethod::PrepareVote) + /// - [`PrepareBurn`](crate::method::WalletMethod::PrepareBurn), + /// - [`PrepareConsolidateOutputs`](crate::method::WalletMethod::PrepareConsolidateOutputs) + /// - [`PrepareCreateAccountOutput`](crate::method::WalletMethod::PrepareCreateAccountOutput) + /// - [`PrepareDecreaseVotingPower`](crate::method::WalletMethod::PrepareDecreaseVotingPower) + /// - [`PrepareIncreaseVotingPower`](crate::method::WalletMethod::PrepareIncreaseVotingPower) + /// - [`PrepareMeltNativeToken`](crate::method::WalletMethod::PrepareMeltNativeToken) + /// - [`PrepareMintNativeToken`](crate::method::WalletMethod::PrepareMintNativeToken), + /// - [`PrepareMintNfts`](crate::method::WalletMethod::PrepareMintNfts), + /// - [`PrepareSend`](crate::method::WalletMethod::PrepareSend), + /// - [`PrepareSendNativeTokens`](crate::method::WalletMethod::PrepareSendNativeTokens), + /// - [`PrepareSendNft`](crate::method::WalletMethod::PrepareSendNft), + /// - [`PrepareStopParticipating`](crate::method::WalletMethod::PrepareStopParticipating) + /// - [`PrepareTransaction`](crate::method::WalletMethod::PrepareTransaction) + /// - [`PrepareVote`](crate::method::WalletMethod::PrepareVote) PreparedTransaction(PreparedTransactionDataDto), /// Response for: - /// - [`PrepareCreateNativeToken`](crate::method::WalletCommandMethod::PrepareCreateNativeToken), + /// - [`PrepareCreateNativeToken`](crate::method::WalletMethod::PrepareCreateNativeToken), PreparedCreateNativeTokenTransaction(PreparedCreateNativeTokenTransactionDto), /// Response for: - /// - [`GetIncomingTransaction`](crate::method::WalletCommandMethod::GetIncomingTransaction) - /// - [`GetTransaction`](crate::method::WalletCommandMethod::GetTransaction), + /// - [`GetIncomingTransaction`](crate::method::WalletMethod::GetIncomingTransaction) + /// - [`GetTransaction`](crate::method::WalletMethod::GetTransaction), Transaction(Option>), /// Response for: - /// - [`IncomingTransactions`](crate::method::WalletCommandMethod::IncomingTransactions) - /// - [`PendingTransactions`](crate::method::WalletCommandMethod::PendingTransactions), - /// - [`Transactions`](crate::method::WalletCommandMethod::Transactions), + /// - [`IncomingTransactions`](crate::method::WalletMethod::IncomingTransactions) + /// - [`PendingTransactions`](crate::method::WalletMethod::PendingTransactions), + /// - [`Transactions`](crate::method::WalletMethod::Transactions), Transactions(Vec), /// Response for: - /// - [`SignTransaction`](crate::method::WalletCommandMethod::SignTransaction) + /// - [`SignTransaction`](crate::method::WalletMethod::SignTransaction) SignedTransactionData(SignedTransactionDataDto), /// Response for: - /// - [`GetBalance`](crate::method::WalletCommandMethod::GetBalance), - /// - [`Sync`](crate::method::WalletCommandMethod::Sync) + /// - [`GetBalance`](crate::method::WalletMethod::GetBalance), + /// - [`Sync`](crate::method::WalletMethod::Sync) Balance(Balance), /// Response for: - /// - [`ClaimOutputs`](crate::method::WalletCommandMethod::ClaimOutputs) - /// - [`Send`](crate::method::WalletCommandMethod::Send) - /// - [`SendOutputs`](crate::method::WalletCommandMethod::SendOutputs) - /// - [`SignAndSubmitTransaction`](crate::method::WalletCommandMethod::SignAndSubmitTransaction) - /// - [`SubmitAndStoreTransaction`](crate::method::WalletCommandMethod::SubmitAndStoreTransaction) + /// - [`ClaimOutputs`](crate::method::WalletMethod::ClaimOutputs) + /// - [`Send`](crate::method::WalletMethod::Send) + /// - [`SendOutputs`](crate::method::WalletMethod::SendOutputs) + /// - [`SignAndSubmitTransaction`](crate::method::WalletMethod::SignAndSubmitTransaction) + /// - [`SubmitAndStoreTransaction`](crate::method::WalletMethod::SubmitAndStoreTransaction) SentTransaction(TransactionWithMetadataDto), /// Response for: - /// - [`GetParticipationEvent`](crate::method::WalletCommandMethod::GetParticipationEvent) + /// - [`GetParticipationEvent`](crate::method::WalletMethod::GetParticipationEvent) #[cfg(feature = "participation")] #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] ParticipationEvent(Option), /// Response for: - /// - [`GetParticipationEventIds`](crate::method::WalletCommandMethod::GetParticipationEventIds) + /// - [`GetParticipationEventIds`](crate::method::WalletMethod::GetParticipationEventIds) #[cfg(feature = "participation")] #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] ParticipationEventIds(Vec), /// Response for: - /// - [`GetParticipationEventStatus`](crate::method::WalletCommandMethod::GetParticipationEventStatus) + /// - [`GetParticipationEventStatus`](crate::method::WalletMethod::GetParticipationEventStatus) #[cfg(feature = "participation")] #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] ParticipationEventStatus(ParticipationEventStatus), /// Response for: - /// - [`GetParticipationEvents`](crate::method::WalletCommandMethod::GetParticipationEvents) - /// - [`RegisterParticipationEvents`](crate::method::WalletCommandMethod::RegisterParticipationEvents) + /// - [`GetParticipationEvents`](crate::method::WalletMethod::GetParticipationEvents) + /// - [`RegisterParticipationEvents`](crate::method::WalletMethod::RegisterParticipationEvents) #[cfg(feature = "participation")] #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] ParticipationEvents(HashMap), /// Response for: - /// - [`GetVotingPower`](crate::method::WalletCommandMethod::GetVotingPower) + /// - [`GetVotingPower`](crate::method::WalletMethod::GetVotingPower) #[cfg(feature = "participation")] #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] VotingPower(String), /// Response for: - /// - [`GetParticipationOverview`](crate::method::WalletCommandMethod::GetParticipationOverview) + /// - [`GetParticipationOverview`](crate::method::WalletMethod::GetParticipationOverview) #[cfg(feature = "participation")] #[cfg_attr(docsrs, doc(cfg(feature = "participation")))] ParticipationOverview(ParticipationOverview),