Skip to content

Commit 0957f71

Browse files
committed
fix(cardano-blockchain-types): cip36 validation implement getter
Signed-off-by: bkioshn <[email protected]>
1 parent be138fe commit 0957f71

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

rust/cardano-blockchain-types/src/metadata/cip36/validation.rs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,35 @@ pub const SIGNDATA_PREAMBLE: [u8; 4] = [0xA1, 0x19, 0xEF, 0x64];
1717
#[derive(Clone, Default, Debug)]
1818
pub struct Cip36Validation {
1919
/// Is the signature valid? (signature in 61285)
20-
pub is_valid_signature: bool,
20+
is_valid_signature: bool,
2121
/// Is the payment address on the correct network?
22-
pub is_valid_payment_address_network: bool,
22+
is_valid_payment_address_network: bool,
2323
/// Is the voting keys valid?
24-
pub is_valid_voting_keys: bool,
24+
is_valid_voting_keys: bool,
2525
/// Is the purpose valid? (Always 0 for Catalyst)
26-
pub is_valid_purpose: bool,
26+
is_valid_purpose: bool,
27+
}
28+
29+
impl Cip36Validation {
30+
/// Is the signature from witness registration valid?
31+
pub fn is_valid_signature(&self) -> bool {
32+
self.is_valid_signature
33+
}
34+
35+
/// Is the payment address network valid?
36+
pub fn is_valid_payment_address_network(&self) -> bool {
37+
self.is_valid_payment_address_network
38+
}
39+
40+
/// Are the voting keys valid?
41+
pub fn is_valid_voting_keys(&self) -> bool {
42+
self.is_valid_voting_keys
43+
}
44+
45+
/// Is the purpose valid?
46+
pub fn is_valid_purpose(&self) -> bool {
47+
self.is_valid_purpose
48+
}
2749
}
2850

2951
/// Validation for CIP-36

0 commit comments

Comments
 (0)