use crate::*;
#[wasm_bindgen]
#[derive(
Clone,
Debug,
Hash,
Eq,
Ord,
PartialEq,
PartialOrd,
serde::Serialize,
serde::Deserialize,
JsonSchema,
)]
pub struct StakeDelegation {
pub(crate) stake_credential: Credential,
pub(crate) pool_keyhash: Ed25519KeyHash,
}
impl_to_from!(StakeDelegation);
#[wasm_bindgen]
impl StakeDelegation {
pub fn stake_credential(&self) -> Credential {
self.stake_credential.clone()
}
pub fn pool_keyhash(&self) -> Ed25519KeyHash {
self.pool_keyhash.clone()
}
pub fn new(stake_credential: &Credential, pool_keyhash: &Ed25519KeyHash) -> Self {
Self {
stake_credential: stake_credential.clone(),
pool_keyhash: pool_keyhash.clone(),
}
}
pub fn has_script_credentials(&self) -> bool {
self.stake_credential.has_script_hash()
}
}