cardano_serialization_lib/protocol_types/certificates/
drep_update.rs1use crate::*;
2
3#[derive(
4 Clone,
5 Debug,
6 Hash,
7 Eq,
8 Ord,
9 PartialEq,
10 PartialOrd,
11 serde::Serialize,
12 serde::Deserialize,
13 JsonSchema,
14)]
15#[wasm_bindgen]
16pub struct DRepUpdate {
17 pub(crate) voting_credential: Credential,
18 pub(crate) anchor: Option<Anchor>,
19}
20
21impl_to_from!(DRepUpdate);
22
23#[wasm_bindgen]
24impl DRepUpdate {
25 pub fn voting_credential(&self) -> Credential {
26 self.voting_credential.clone()
27 }
28
29 pub fn anchor(&self) -> Option<Anchor> {
30 self.anchor.clone()
31 }
32
33 pub fn new(voting_credential: &Credential) -> Self {
34 Self {
35 voting_credential: voting_credential.clone(),
36 anchor: None,
37 }
38 }
39
40 pub fn new_with_anchor(voting_credential: &Credential, anchor: &Anchor) -> Self {
41 Self {
42 voting_credential: voting_credential.clone(),
43 anchor: Some(anchor.clone()),
44 }
45 }
46
47 pub fn has_script_credentials(&self) -> bool {
48 self.voting_credential.has_script_hash()
49 }
50}