diff --git a/crates/avalanche-types/src/wallet/p/add_permissionless_validator.rs b/crates/avalanche-types/src/wallet/p/add_permissionless_validator.rs index a6c0522..c98ad1b 100644 --- a/crates/avalanche-types/src/wallet/p/add_permissionless_validator.rs +++ b/crates/avalanche-types/src/wallet/p/add_permissionless_validator.rs @@ -7,7 +7,7 @@ use crate::{ jsonrpc::client::p as client_p, key, platformvm, txs, units, }; -use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; +use chrono::{DateTime, TimeZone, Utc}; use tokio::time::{sleep, Duration, Instant}; /// Represents P-chain "AddPermissionlessValidator" transaction. @@ -64,14 +64,14 @@ where .as_secs(); let start_time = now_unix + 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(start_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(start_time as i64, 0).unwrap(); let start_time = Utc.from_utc_datetime(&naive_dt); // 100-day // must be smaller than the primary network default // otherwise "staking period must be a subset of the primary network" let end_time = now_unix + 100 * 24 * 60 * 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(end_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(end_time as i64, 0).unwrap(); let end_time = Utc.from_utc_datetime(&naive_dt); Self { @@ -135,13 +135,13 @@ where .as_secs(); let start_time = now_unix + offset_seconds; - let naive_dt = NaiveDateTime::from_timestamp_opt(start_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(start_time as i64, 0).unwrap(); let start_time = Utc.from_utc_datetime(&naive_dt); // must be smaller than the primary network default // otherwise "staking period must be a subset of the primary network" let end_time = now_unix + days * 24 * 60 * 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(end_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(end_time as i64, 0).unwrap(); let end_time = Utc.from_utc_datetime(&naive_dt); self.start_time = start_time; diff --git a/crates/avalanche-types/src/wallet/p/add_subnet_validator.rs b/crates/avalanche-types/src/wallet/p/add_subnet_validator.rs index 5ef7d9f..fcc7679 100644 --- a/crates/avalanche-types/src/wallet/p/add_subnet_validator.rs +++ b/crates/avalanche-types/src/wallet/p/add_subnet_validator.rs @@ -7,7 +7,7 @@ use crate::{ jsonrpc::client::p as client_p, key, platformvm, txs, }; -use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; +use chrono::{DateTime, TimeZone, Utc}; use tokio::time::{sleep, Duration, Instant}; /// Represents P-chain "AddSubnetValidator" transaction. @@ -52,7 +52,7 @@ where .as_secs(); let start_time = now_unix + 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(start_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(start_time as i64, 0).unwrap(); let start_time = Utc.from_utc_datetime(&naive_dt); // 14-day + 5-min @@ -60,7 +60,7 @@ where // otherwise "staking period must be a subset of the primary network" // ref. "Validator.BoundedBy" let end_time = now_unix + 15 * 24 * 60 * 60 + 5 * 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(end_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(end_time as i64, 0).unwrap(); let end_time = Utc.from_utc_datetime(&naive_dt); Self { @@ -122,13 +122,13 @@ where .as_secs(); let start_time = now_unix + offset_seconds; - let naive_dt = NaiveDateTime::from_timestamp_opt(start_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(start_time as i64, 0).unwrap(); let start_time = Utc.from_utc_datetime(&naive_dt); // must be smaller than the primary network default // otherwise "staking period must be a subset of the primary network" let end_time = now_unix + days * 24 * 60 * 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(end_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(end_time as i64, 0).unwrap(); let end_time = Utc.from_utc_datetime(&naive_dt); self.start_time = start_time; diff --git a/crates/avalanche-types/src/wallet/p/add_validator.rs b/crates/avalanche-types/src/wallet/p/add_validator.rs index b5caa86..50938d0 100644 --- a/crates/avalanche-types/src/wallet/p/add_validator.rs +++ b/crates/avalanche-types/src/wallet/p/add_validator.rs @@ -7,7 +7,7 @@ use crate::{ jsonrpc::client::p as client_p, key, platformvm, txs, units, }; -use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; +use chrono::{DateTime, TimeZone, Utc}; use tokio::time::{sleep, Duration, Instant}; /// Represents P-chain "AddValidator" transaction. @@ -60,7 +60,7 @@ where .as_secs(); let start_time = now_unix + 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(start_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(start_time as i64, 0).unwrap(); let start_time = Utc.from_utc_datetime(&naive_dt); // 15-day + 5-min @@ -69,7 +69,7 @@ where // 15 that subnet validator defaults can be bounded within // ref. "Validator.BoundedBy" let end_time = now_unix + 14 * 24 * 60 * 60 + 5 * 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(end_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(end_time as i64, 0).unwrap(); let end_time = Utc.from_utc_datetime(&naive_dt); Self { @@ -124,13 +124,13 @@ where .as_secs(); let start_time = now_unix + offset_seconds; - let naive_dt = NaiveDateTime::from_timestamp_opt(start_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(start_time as i64, 0).unwrap(); let start_time = Utc.from_utc_datetime(&naive_dt); // must be smaller than the primary network default // otherwise "staking period must be a subset of the primary network" let end_time = now_unix + days * 24 * 60 * 60; - let naive_dt = NaiveDateTime::from_timestamp_opt(end_time as i64, 0).unwrap(); + let naive_dt = DateTime::from_timestamp(end_time as i64, 0).unwrap(); let end_time = Utc.from_utc_datetime(&naive_dt); self.start_time = start_time;