Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output storage score tests #1827

Merged
merged 11 commits into from
Jan 17, 2024
7 changes: 3 additions & 4 deletions sdk/src/types/block/output/unlock_condition/expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ pub(crate) mod dto {
#[serde(rename = "type")]
kind: u8,
return_address: Address,
slot_index: SlotIndex,
slot: SlotIndex,
}

impl From<&ExpirationUnlockCondition> for ExpirationUnlockConditionDto {
fn from(value: &ExpirationUnlockCondition) -> Self {
Self {
kind: ExpirationUnlockCondition::KIND,
return_address: value.return_address().clone(),
slot_index: value.slot_index(),
slot: value.slot_index(),
}
}
}
Expand All @@ -142,8 +142,7 @@ pub(crate) mod dto {
type Error = Error;

fn try_from(value: ExpirationUnlockConditionDto) -> Result<Self, Error> {
Self::new(value.return_address, value.slot_index)
.map_err(|_| Error::InvalidField("expirationUnlockCondition"))
Self::new(value.return_address, value.slot).map_err(|_| Error::InvalidField("expirationUnlockCondition"))
}
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/unlock_condition/timelock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ pub(crate) mod dto {
struct TimelockUnlockConditionDto {
#[serde(rename = "type")]
kind: u8,
slot_index: SlotIndex,
slot: SlotIndex,
}

impl From<&TimelockUnlockCondition> for TimelockUnlockConditionDto {
fn from(value: &TimelockUnlockCondition) -> Self {
Self {
kind: TimelockUnlockCondition::KIND,
slot_index: value.slot_index(),
slot: value.slot_index(),
}
}
}
Expand All @@ -75,7 +75,7 @@ pub(crate) mod dto {
type Error = Error;

fn try_from(value: TimelockUnlockConditionDto) -> Result<Self, Error> {
Self::new(value.slot_index).map_err(|_| Error::InvalidField("timelockUnlockCondition"))
Self::new(value.slot).map_err(|_| Error::InvalidField("timelockUnlockCondition"))
}
}

Expand Down
Loading