Skip to content

Commit

Permalink
Map authorization for IssueAuth (#108)
Browse files Browse the repository at this point in the history
Added a new mehod map_authorization for IssueBundle to support workflow
in Librustzcash where we trasform a Transaction from one authorization
state (e,g, Unauthorized) to another (e.g. Aurhotized/Signed) by
transfroming all underlying bundles
  • Loading branch information
dmidem authored Jun 13, 2024
2 parents f04c205 + f7789bf commit 3cd8294
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/issuance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,19 @@ impl<T: IssueAuth> IssueBundle<T> {
authorization,
}
}

/// Transitions this bundle from one authorization state to another.
pub fn map_authorization<T2: IssueAuth>(
self,
map_auth: impl FnOnce(T) -> T2,
) -> IssueBundle<T2> {
let authorization = self.authorization;
IssueBundle {
ik: self.ik,
actions: self.actions,
authorization: map_auth(authorization),
}
}
}

impl IssueBundle<Unauthorized> {
Expand Down

0 comments on commit 3cd8294

Please sign in to comment.