diff --git a/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs b/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs index 62c7f32ec76..a01cabe947c 100644 --- a/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs +++ b/packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs @@ -23,7 +23,7 @@ use wasm_bindgen::prelude::wasm_bindgen; use wasm_bindgen::{JsError, JsValue}; #[derive(Clone)] -#[wasm_bindgen(js_name = MasternodeVoteTransition)] +#[wasm_bindgen(js_name=MasternodeVoteTransition)] pub struct MasternodeVoteTransitionWasm(MasternodeVoteTransition); impl From for MasternodeVoteTransitionWasm { @@ -38,7 +38,7 @@ impl From for MasternodeVoteTransition { } } -#[wasm_bindgen(js_class = MasternodeVoteTransition)] +#[wasm_bindgen(js_class=MasternodeVoteTransition)] impl MasternodeVoteTransitionWasm { #[wasm_bindgen(constructor)] pub fn new(platform_version: u32) -> Result { @@ -50,42 +50,27 @@ impl MasternodeVoteTransitionWasm { .map_err(from_dpp_err) } - #[wasm_bindgen(js_name = getOwnerId)] + #[wasm_bindgen(js_name=getOwnerId)] pub fn get_owner_id(&self) -> IdentifierWrapper { self.0.owner_id().to_owned().into() } - #[wasm_bindgen(js_name = getType)] + #[wasm_bindgen(js_name=getType)] pub fn get_type(&self) -> u8 { self.0.state_transition_type() as u8 } - #[wasm_bindgen(js_name = getProTxHash)] + #[wasm_bindgen(js_name=getProTxHash)] pub fn get_pro_tx_hash(&self) -> IdentifierWrapper { self.0.pro_tx_hash().into() } - #[wasm_bindgen(js_name = setProTxHash)] + #[wasm_bindgen(js_name=setProTxHash)] pub fn set_pro_tx_hash(&mut self, pro_tx_hash: &IdentifierWrapper) { self.0.set_pro_tx_hash(pro_tx_hash.into()); } - #[wasm_bindgen(js_name=getUserFeeIncrease)] - pub fn get_user_fee_increase(&self) -> u16 { - self.0.user_fee_increase() as u16 - } - - #[wasm_bindgen(js_name=setUserFeeIncrease)] - pub fn set_user_fee_increase(&mut self, user_fee_increase: u16) { - self.0.set_user_fee_increase(user_fee_increase); - } - - #[wasm_bindgen(js_name=getIdentityContractNonce)] - pub fn get_identity_nonce(&self) -> u64 { - self.0.nonce() - } - - #[wasm_bindgen(js_name = toObject)] + #[wasm_bindgen(js_name=toObject)] pub fn to_object(&self, options: JsValue) -> Result { let opts: self::to_object::ToObjectOptions = if options.is_object() { with_js_error!(serde_wasm_bindgen::from_value(options))? @@ -143,7 +128,7 @@ impl MasternodeVoteTransitionWasm { Ok(js_object.into()) } - #[wasm_bindgen(js_name = toBuffer)] + #[wasm_bindgen(js_name=toBuffer)] pub fn to_buffer(&self) -> Result { let bytes = PlatformSerializable::serialize_to_bytes(&StateTransition::MasternodeVote( self.0.clone(), @@ -152,7 +137,7 @@ impl MasternodeVoteTransitionWasm { Ok(Buffer::from_bytes(&bytes)) } - #[wasm_bindgen(js_name = toJSON)] + #[wasm_bindgen(js_name=toJSON)] pub fn to_json(&self) -> Result { let object = self::to_object::to_object_struct(&self.0, Default::default()); let js_object = js_sys::Object::new(); @@ -206,7 +191,7 @@ impl MasternodeVoteTransitionWasm { Ok(js_object.into()) } - #[wasm_bindgen(js_name = getModifiedDataIds)] + #[wasm_bindgen(js_name=getModifiedDataIds)] pub fn modified_data_ids(&self) -> Vec { let ids = self.0.modified_data_ids(); @@ -215,27 +200,42 @@ impl MasternodeVoteTransitionWasm { .collect() } - #[wasm_bindgen(js_name = isDataContractStateTransition)] + #[wasm_bindgen(js_name=isDataContractStateTransition)] pub fn is_data_contract_state_transition(&self) -> bool { self.0.is_data_contract_state_transition() } - #[wasm_bindgen(js_name = isDocumentStateTransition)] + #[wasm_bindgen(js_name=isDocumentStateTransition)] pub fn is_document_state_transition(&self) -> bool { self.0.is_document_state_transition() } - #[wasm_bindgen(js_name = isIdentityStateTransition)] + #[wasm_bindgen(js_name=isIdentityStateTransition)] pub fn is_identity_state_transition(&self) -> bool { self.0.is_identity_state_transition() } - #[wasm_bindgen(js_name = isVotingStateTransition)] + #[wasm_bindgen(js_name=isVotingStateTransition)] pub fn is_voting_state_transition(&self) -> bool { self.0.is_voting_state_transition() } - #[wasm_bindgen(js_name = getContestedDocumentResourceVotePoll)] + #[wasm_bindgen(js_name=getUserFeeIncrease)] + pub fn get_user_fee_increase(&self) -> u16 { + self.0.user_fee_increase() as u16 + } + + #[wasm_bindgen(js_name=setUserFeeIncrease)] + pub fn set_user_fee_increase(&mut self, user_fee_increase: u16) { + self.0.set_user_fee_increase(user_fee_increase); + } + + #[wasm_bindgen(js_name=getIdentityContractNonce)] + pub fn get_identity_nonce(&self) -> u64 { + self.0.nonce() + } + + #[wasm_bindgen(js_name=getContestedDocumentResourceVotePoll)] pub fn contested_document_resource_vote_poll(&self) -> Option { match self.0.vote() { Vote::ResourceVote(vote) => { @@ -304,7 +304,7 @@ impl MasternodeVoteTransitionWasm { } } - #[wasm_bindgen(js_name = signByPrivateKey)] + #[wasm_bindgen(js_name=signByPrivateKey)] pub fn sign_by_private_key( &mut self, private_key: Vec, @@ -340,22 +340,17 @@ impl MasternodeVoteTransitionWasm { Ok(()) } - #[wasm_bindgen(js_name = getSignature)] + #[wasm_bindgen(js_name=getSignature)] pub fn get_signature(&self) -> Buffer { Buffer::from_bytes(self.0.signature().as_slice()) } - #[wasm_bindgen(js_name = setSignature)] + #[wasm_bindgen(js_name=setSignature)] pub fn set_signature(&mut self, signature: Option>) { self.0 .set_signature(BinaryData::new(signature.unwrap_or_default())) } - #[wasm_bindgen(js_name=getSignaturePublicKeyId)] - pub fn get_signature_public_key_id(&self) -> u32 { - self.0.signature_public_key_id() - } - #[wasm_bindgen] pub fn sign( &mut self, @@ -383,4 +378,4 @@ impl MasternodeVoteTransitionWasm { Ok(()) } -} +} \ No newline at end of file