diff --git a/radix-engine-toolkit-uniffi/src/builder/manifest_builder/builder.rs b/radix-engine-toolkit-uniffi/src/builder/manifest_builder/builder.rs index bc7cde17..f2d52db8 100644 --- a/radix-engine-toolkit-uniffi/src/builder/manifest_builder/builder.rs +++ b/radix-engine-toolkit-uniffi/src/builder/manifest_builder/builder.rs @@ -746,6 +746,110 @@ impl ManifestBuilder { /* Access Controller */ + pub fn access_controller_initiate_recovery( + self: Arc, + access_controller_address: Arc
, + proposer: Proposer, + proposed_primary_role: Arc, + proposed_recovery_role: Arc, + proposed_confirmation_role: Arc, + proposed_timed_recovery_delay_in_minutes: Option, + ) -> Result> { + builder_arc_map(self, |builder| { + let rule_set = NativeRuleSet { + primary_role: proposed_primary_role.0.clone(), + recovery_role: proposed_recovery_role.0.clone(), + confirmation_role: proposed_confirmation_role.0.clone(), + }; + + let (method_name, args) = match proposer { + Proposer::Primary => ( + NATIVE_ACCESS_CONTROLLER_INITIATE_RECOVERY_AS_PRIMARY_IDENT, + native_to_manifest_value_and_unwrap!( + &NativeAccessControllerInitiateRecoveryAsPrimaryInput { + rule_set, + timed_recovery_delay_in_minutes: + proposed_timed_recovery_delay_in_minutes, + } + ), + ), + Proposer::Recovery => ( + NATIVE_ACCESS_CONTROLLER_INITIATE_RECOVERY_AS_RECOVERY_IDENT, + native_to_manifest_value_and_unwrap!( + &NativeAccessControllerInitiateRecoveryAsRecoveryInput { + rule_set, + timed_recovery_delay_in_minutes: + proposed_timed_recovery_delay_in_minutes, + } + ), + ), + }; + + let instruction = NativeInstruction::CallMethod { + address: NativeDynamicGlobalAddress::Static( + (*access_controller_address).try_into()?, + ), + method_name: method_name.to_owned(), + args, + }; + builder.instructions.push(instruction); + + Ok(()) + }) + } + + pub fn access_controller_quick_confirm_recovery( + self: Arc, + access_controller_address: Arc
, + proposer: Proposer, + proposed_primary_role: Arc, + proposed_recovery_role: Arc, + proposed_confirmation_role: Arc, + proposed_timed_recovery_delay_in_minutes: Option, + ) -> Result> { + builder_arc_map(self, |builder| { + let rule_set = NativeRuleSet { + primary_role: proposed_primary_role.0.clone(), + recovery_role: proposed_recovery_role.0.clone(), + confirmation_role: proposed_confirmation_role.0.clone(), + }; + + let (method_name, args) = match proposer { + Proposer::Primary => ( + NATIVE_ACCESS_CONTROLLER_QUICK_CONFIRM_PRIMARY_ROLE_RECOVERY_PROPOSAL_IDENT, + native_to_manifest_value_and_unwrap!( + &NativeAccessControllerQuickConfirmPrimaryRoleRecoveryProposalInput { + rule_set, + timed_recovery_delay_in_minutes: + proposed_timed_recovery_delay_in_minutes, + } + ), + ), + Proposer::Recovery => ( + NATIVE_ACCESS_CONTROLLER_QUICK_CONFIRM_RECOVERY_ROLE_RECOVERY_PROPOSAL_IDENT, + native_to_manifest_value_and_unwrap!( + &NativeAccessControllerQuickConfirmRecoveryRoleRecoveryProposalInput { + rule_set, + timed_recovery_delay_in_minutes: + proposed_timed_recovery_delay_in_minutes, + } + ), + ), + }; + + let instruction = NativeInstruction::CallMethod { + address: NativeDynamicGlobalAddress::Static( + (*access_controller_address).try_into()?, + ), + method_name: method_name.to_owned(), + args, + }; + builder.instructions.push(instruction); + + Ok(()) + }) + } + pub fn create_signature_based_access_controller( self: Arc, controlled_asset: ManifestBuilderBucket, @@ -941,3 +1045,4 @@ macro_rules! manifest_args { } use manifest_args; use radix_engine::types::FromPublicKey; +use radix_engine_common::prelude::to_manifest_value; diff --git a/radix-engine-toolkit-uniffi/src/lib.rs b/radix-engine-toolkit-uniffi/src/lib.rs index ae9c9595..44476b5e 100644 --- a/radix-engine-toolkit-uniffi/src/lib.rs +++ b/radix-engine-toolkit-uniffi/src/lib.rs @@ -66,6 +66,7 @@ pub mod prelude { pub use crate::error::*; /* Events */ + pub use crate::events::functions::*; pub use crate::events::*; /* Cryptography */