Skip to content

Commit e42b934

Browse files
committed
remove using old constructors
1 parent 4d43695 commit e42b934

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

rust/src/utils.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ impl TryFrom<BigNum> for u32 {
241241
}
242242
}
243243

244+
impl From<u64> for BigNum {
245+
fn from(value: u64) -> Self {
246+
return BigNum(value)
247+
}
248+
}
249+
244250
impl From<u32> for BigNum {
245251
fn from(value: u32) -> Self {
246252
return BigNum(value.into())
@@ -1288,9 +1294,9 @@ fn encode_template_to_native_script(
12881294
serde_json::Value::Object(map) if map.contains_key("active_from") => {
12891295
if let serde_json::Value::Number(active_from) = map.get("active_from").unwrap() {
12901296
if let Some(n) = active_from.as_u64() {
1291-
let slot: u32 = n as u32;
1297+
let slot: SlotBigNum = n.into();
12921298

1293-
let time_lock_start = TimelockStart::new(slot);
1299+
let time_lock_start = TimelockStart::new_timelockstart(&slot);
12941300

12951301
Ok(NativeScript::new_timelock_start(&time_lock_start))
12961302
} else {
@@ -1305,9 +1311,9 @@ fn encode_template_to_native_script(
13051311
serde_json::Value::Object(map) if map.contains_key("active_until") => {
13061312
if let serde_json::Value::Number(active_until) = map.get("active_until").unwrap() {
13071313
if let Some(n) = active_until.as_u64() {
1308-
let slot: u32 = n as u32;
1314+
let slot: SlotBigNum = n.into();
13091315

1310-
let time_lock_expiry = TimelockExpiry::new(slot);
1316+
let time_lock_expiry = TimelockExpiry::new_timelockexpiry(&slot);
13111317

13121318
Ok(NativeScript::new_timelock_expiry(&time_lock_expiry))
13131319
} else {

0 commit comments

Comments
 (0)