Skip to content

Commit

Permalink
Update client revision (#1899)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Feb 27, 2023
1 parent e920365 commit 0aa5943
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ futures = { version = "0.3.26", default-features = false }
getset = { version = "0.1.2", default-features = false }
instant = { version = "0.1.12", default-features = false }
# iota-client = { version = "2.0.1-rc.6", default-features = false, features = [ "message_interface", "tls" ] }
iota-client = { git = "https://github.com/iotaledger/iota.rs", rev = "e8422a87c89d3bcc811d41668ddd4d9078d36438", default-features = false, features = [ "message_interface", "tls" ] }
iota-client = { git = "https://github.com/iotaledger/iota.rs", rev = "4f58026c1be557fcc7a2268049f571733e675098", default-features = false, features = [ "message_interface", "tls" ] }
iota-crypto = { version = "0.15.3", default-features = false, features = [ "std", "chacha", "blake2b", "ed25519", "random", "slip10", "bip39", "bip39-en" ] }
log = { version = "0.4.17", default-features = false }
packable = { version = "0.7.0", default-features = false, features = [ "serde", "primitive-types" ] }
Expand Down
2 changes: 1 addition & 1 deletion wallet/examples/offline_signing/2_sign_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async fn main() -> Result<()> {

// Signs prepared transaction offline.
let unlocks = SecretManager::Stronghold(secret_manager)
.sign_transaction_essence(&prepared_transaction_data)
.sign_transaction_essence(&prepared_transaction_data, None)
.await?;
let signed_transaction = TransactionPayload::new(prepared_transaction_data.essence.clone(), unlocks)?;

Expand Down
7 changes: 4 additions & 3 deletions wallet/src/account/operations/output_claiming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,10 @@ impl AccountHandle {
.finish_output(token_supply)?,
);
} else if !new_native_tokens.finish()?.is_empty() {
return Err(crate::Error::Client(
iota_client::Error::NoBalanceForNativeTokenRemainder.into(),
));
return Err(iota_client::api::input_selection::Error::InsufficientAmount {
found: available_amount,
required: required_amount_for_nfts,
})?;
}

let claim_tx = self
Expand Down
29 changes: 12 additions & 17 deletions wallet/src/account/operations/transaction/input_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use iota_client::{
api::input_selection::{Burn, InputSelection, Selected},
block::{
address::Address,
input::INPUT_COUNT_MAX,
output::{AliasTransition, Output, OutputId},
},
secret::types::InputSigningData,
Expand Down Expand Up @@ -71,7 +70,6 @@ impl AccountHandle {
&account,
account.unspent_outputs.values(),
current_time,
protocol_parameters.bech32_hrp(),
&outputs,
burn,
custom_inputs.as_ref(),
Expand Down Expand Up @@ -176,17 +174,17 @@ impl AccountHandle {
let selected_transaction_data = match input_selection.select() {
Ok(r) => r,
// TODO this error doesn't exist with the new ISA
Err(iota_client::Error::ConsolidationRequired(output_count)) => {
#[cfg(feature = "events")]
self.event_emitter
.lock()
.await
.emit(account.index, WalletEvent::ConsolidationRequired);
return Err(crate::Error::ConsolidationRequired {
output_count,
output_count_max: INPUT_COUNT_MAX,
});
}
// Err(iota_client::Error::ConsolidationRequired(output_count)) => {
// #[cfg(feature = "events")]
// self.event_emitter
// .lock()
// .await
// .emit(account.index, WalletEvent::ConsolidationRequired);
// return Err(crate::Error::ConsolidationRequired {
// output_count,
// output_count_max: INPUT_COUNT_MAX,
// });
// }
Err(e) => return Err(e.into()),
};

Expand Down Expand Up @@ -223,7 +221,6 @@ fn filter_inputs(
account: &Account,
available_outputs: Values<'_, OutputId, OutputData>,
current_time: u32,
bech32_hrp: &str,
outputs: &[Output],
burn: Option<&Burn>,
custom_inputs: Option<&HashSet<OutputId>>,
Expand Down Expand Up @@ -256,9 +253,7 @@ fn filter_inputs(
// Defaults to state transition if it is not explicitly a governance transition or a burn.
let alias_state_transition = alias_state_transition(output_data, outputs, burn)?;

if let Some(available_input) =
output_data.input_signing_data(account, current_time, bech32_hrp, alias_state_transition)?
{
if let Some(available_input) = output_data.input_signing_data(account, current_time, alias_state_transition)? {
available_outputs_signing_data.push(available_input);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl AccountHandle {
.secret_manager
.read()
.await
.sign_transaction_essence(prepared_transaction_data)
.sign_transaction_essence(prepared_transaction_data, None)
.await?;

let transaction_payload = TransactionPayload::new(prepared_transaction_data.essence.clone(), unlocks)?;
Expand Down
2 changes: 0 additions & 2 deletions wallet/src/account/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ impl OutputData {
&self,
account: &Account,
current_time: u32,
bech32_hrp: &str,
alias_transition: Option<AliasTransition>,
) -> crate::Result<Option<InputSigningData>> {
let (unlock_address, _unlocked_alias_or_nft_address) =
Expand Down Expand Up @@ -97,7 +96,6 @@ impl OutputData {
output: self.output.clone(),
output_metadata: OutputMetadata::try_from(&self.metadata)?,
chain,
bech32_address: unlock_address.to_bech32(bech32_hrp),
}))
}
}
Expand Down
6 changes: 6 additions & 0 deletions wallet/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ impl From<iota_client::Error> for Error {
}
}

impl From<iota_client::api::input_selection::Error> for Error {
fn from(error: iota_client::api::input_selection::Error) -> Self {
Self::Client(Box::new(iota_client::Error::InputSelection(error)))
}
}

#[cfg(feature = "rocksdb")]
impl From<rocksdb::Error> for Error {
fn from(error: rocksdb::Error) -> Self {
Expand Down

0 comments on commit 0aa5943

Please sign in to comment.