diff --git a/crates/sdk/src/env/ext.rs b/crates/sdk/src/env/ext.rs index f6e03e614..f8c98995d 100644 --- a/crates/sdk/src/env/ext.rs +++ b/crates/sdk/src/env/ext.rs @@ -28,7 +28,7 @@ pub enum ProposalAction { args: String, /// The amount of tokens to attach to the call. - deposit: u64, + deposit: u128, /// The maximum amount of gas to use for the call. gas: u64, @@ -102,6 +102,51 @@ impl DraftProposal { self } + // Add an action to call an external function + #[must_use] + pub fn external_function_call( + mut self, + receiver_id: String, + method_name: String, + args: String, + deposit: u128, + gas: u64, + ) -> Self { + self.actions.push(ProposalAction::ExternalFunctionCall { + receiver_id: AccountId(receiver_id), + method_name, + args, + deposit, + gas, + }); + self + } + + /// Add an action to set a context value + #[must_use] + pub fn set_context_value(mut self, key: Box<[u8]>, value: Box<[u8]>) -> Self { + self.actions + .push(ProposalAction::SetContextValue { key, value }); + self + } + + /// Add an action to set number of approvals + #[must_use] + pub fn set_num_approvals(mut self, num_approvals: u32) -> Self { + self.actions + .push(ProposalAction::SetNumApprovals { num_approvals }); + self + } + + /// Add an action to set active proposals limit + #[must_use] + pub fn set_active_proposals_limit(mut self, active_proposals_limit: u32) -> Self { + self.actions.push(ProposalAction::SetActiveProposalsLimit { + active_proposals_limit, + }); + self + } + /// Finalise the proposal and send it to the blockchain. #[must_use] pub fn send(self) -> ProposalId {