diff --git a/crates/apps_lib/src/client/tx.rs b/crates/apps_lib/src/client/tx.rs index e183b0a17d..36b15a4898 100644 --- a/crates/apps_lib/src/client/tx.rs +++ b/crates/apps_lib/src/client/tx.rs @@ -775,21 +775,6 @@ pub async fn submit_shielded_transfer( pub async fn submit_shielding_transfer( namada: &impl Namada, args: args::TxShieldingTransfer, -) -> Result<(), error::Error> { - let (mut tx, signing_data) = args.clone().build(namada).await?; - - if args.tx.dump_tx { - tx::dump_tx(namada.io(), &args.tx, tx); - } else { - sign(namada, &mut tx, &args.tx, signing_data).await?; - namada.submit(tx, &args.tx).await?; - } - Ok(()) -} - -pub async fn submit_unshielding_transfer( - namada: &impl Namada, - args: args::TxUnshieldingTransfer, ) -> Result<(), error::Error> { // Repeat once if the tx fails on a crossover of an epoch for _ in 0..2 { @@ -813,7 +798,7 @@ pub async fn submit_unshielding_transfer( if tx_epoch != submission_epoch { // Then we probably straddled an epoch boundary. Let's retry... edisplay_line!(namada.io(), - "Unshielding transaction rejected and this may be due to the \ + "Shielding transaction rejected and this may be due to the \ epoch changing. Attempting to resubmit transaction.", ); continue; @@ -828,6 +813,21 @@ pub async fn submit_unshielding_transfer( Ok(()) } +pub async fn submit_unshielding_transfer( + namada: &impl Namada, + args: args::TxUnshieldingTransfer, +) -> Result<(), error::Error> { + let (mut tx, signing_data) = args.clone().build(namada).await?; + + if args.tx.dump_tx { + tx::dump_tx(namada.io(), &args.tx, tx); + } else { + sign(namada, &mut tx, &args.tx, signing_data).await?; + namada.submit(tx, &args.tx).await?; + } + Ok(()) +} + pub async fn submit_ibc_transfer( namada: &N, args: args::TxIbcTransfer, diff --git a/crates/sdk/src/args.rs b/crates/sdk/src/args.rs index 4709e5d2c4..b794bf7649 100644 --- a/crates/sdk/src/args.rs +++ b/crates/sdk/src/args.rs @@ -347,7 +347,7 @@ impl TxShieldingTransfer { pub async fn build( &mut self, context: &impl Namada, - ) -> crate::error::Result<(namada_tx::Tx, SigningTxData)> { + ) -> crate::error::Result<(namada_tx::Tx, SigningTxData, Epoch)> { tx::build_shielding_transfer(context, self).await } } @@ -374,7 +374,7 @@ impl TxUnshieldingTransfer { pub async fn build( &mut self, context: &impl Namada, - ) -> crate::error::Result<(namada_tx::Tx, SigningTxData, Epoch)> { + ) -> crate::error::Result<(namada_tx::Tx, SigningTxData)> { tx::build_unshielding_transfer(context, self).await } } diff --git a/crates/sdk/src/tx.rs b/crates/sdk/src/tx.rs index 1f004a8398..afa2e5a5cf 100644 --- a/crates/sdk/src/tx.rs +++ b/crates/sdk/src/tx.rs @@ -2989,7 +2989,7 @@ pub async fn build_shielded_transfer( pub async fn build_shielding_transfer( context: &N, args: &mut args::TxShieldingTransfer, -) -> Result<(Tx, SigningTxData)> { +) -> Result<(Tx, SigningTxData, Epoch)> { let source = &args.source; let default_signer = Some(source.clone()); let signing_data = signing::aux_signing_data( @@ -3044,6 +3044,7 @@ pub async fn build_shielding_transfer( ) .await? .expect("Shielding transfer must have shielded parts"); + let shielded_tx_epoch = shielded_parts.0.epoch; let add_shielded_parts = |tx: &mut Tx, data: &mut token::ShieldingTransfer| { @@ -3093,14 +3094,14 @@ pub async fn build_shielding_transfer( &signing_data.fee_payer, ) .await?; - Ok((tx, signing_data)) + Ok((tx, signing_data, shielded_tx_epoch)) } /// Build an unshielding transfer pub async fn build_unshielding_transfer( context: &N, args: &mut args::TxUnshieldingTransfer, -) -> Result<(Tx, SigningTxData, Epoch)> { +) -> Result<(Tx, SigningTxData)> { let default_signer = Some(MASP); let signing_data = signing::aux_signing_data( context, @@ -3130,7 +3131,6 @@ pub async fn build_unshielding_transfer( ) .await? .expect("Shielding transfer must have shielded parts"); - let shielded_tx_epoch = shielded_parts.0.epoch; let add_shielded_parts = |tx: &mut Tx, data: &mut token::UnshieldingTransfer| { @@ -3179,7 +3179,7 @@ pub async fn build_unshielding_transfer( &signing_data.fee_payer, ) .await?; - Ok((tx, signing_data, shielded_tx_epoch)) + Ok((tx, signing_data)) } // Construct the shielded part of the transaction, if any