Skip to content

Commit

Permalink
Merge branch 'fraccaman/sdk-builder-fix' (#3518)
Browse files Browse the repository at this point in the history
* fraccaman/sdk-builder-fix:
  changelog: add #3518
  sdk: add impl to shielded transfer
  sdk: add impl to shielding transfer
  • Loading branch information
brentstone committed Jul 19, 2024
2 parents a0d8e92 + 5c1dc13 commit e53d57b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/3518-sdk-builder-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Adds SDK builder to shielded and shielding transfers.
([\#3518](https://github.com/anoma/namada/pull/3518))
24 changes: 24 additions & 0 deletions crates/sdk/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,18 @@ pub struct TxShieldedTransfer<C: NamadaTypes = SdkTypes> {
pub tx_code_path: PathBuf,
}

impl<C: NamadaTypes> TxBuilder<C> for TxShieldedTransfer<C> {
fn tx<F>(self, func: F) -> Self
where
F: FnOnce(Tx<C>) -> Tx<C>,
{
TxShieldedTransfer {
tx: func(self.tx),
..self
}
}
}

impl TxShieldedTransfer {
/// Build a transaction from this builder
pub async fn build(
Expand Down Expand Up @@ -373,6 +385,18 @@ pub struct TxShieldingTransfer<C: NamadaTypes = SdkTypes> {
pub tx_code_path: PathBuf,
}

impl<C: NamadaTypes> TxBuilder<C> for TxShieldingTransfer<C> {
fn tx<F>(self, func: F) -> Self
where
F: FnOnce(Tx<C>) -> Tx<C>,
{
TxShieldingTransfer {
tx: func(self.tx),
..self
}
}
}

impl TxShieldingTransfer {
/// Build a transaction from this builder
pub async fn build(
Expand Down

0 comments on commit e53d57b

Please sign in to comment.