diff --git a/src/bundle.rs b/src/bundle.rs index 5ebab773..817ee303 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -242,6 +242,21 @@ impl Bundle { todo!() } + /// Construct a new bundle by applying a transformation that might fail + /// to the value balance. + pub fn try_map_value_balance Result>( + self, + f: F, + ) -> Result, E> { + Ok(Bundle { + actions: self.actions, + flags: self.flags, + value_balance: f(self.value_balance)?, + anchor: self.anchor, + authorization: self.authorization, + }) + } + /// Transitions this bundle from one authorization state to another. pub fn authorize( self,