Skip to content

Commit

Permalink
improve convert_timestamp naming and add description
Browse files Browse the repository at this point in the history
  • Loading branch information
sotnikov-s committed Dec 11, 2023
1 parent f8a4721 commit 4fa9c69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/neutron-sdk/src/stargate/aux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ pub(crate) fn create_stargate_msg<Req: prost::Message>(req: Req, path: &str) ->
}
}

pub(crate) fn convert_timestamp(timestamp: i64) -> TimestampGen {
/// creates a prost_types::Timestamp from a given unix timestamp value in seconds.
pub(crate) fn proto_timestamp_from_i64(timestamp: i64) -> TimestampGen {
TimestampGen {
seconds: timestamp,
nanos: 0,
Expand Down
6 changes: 3 additions & 3 deletions packages/neutron-sdk/src/stargate/types_dex.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::bindings::query::{PageRequest, PageResponse};
use crate::stargate::aux::convert_timestamp;
use crate::stargate::aux::proto_timestamp_from_i64;
use crate::stargate::proto_types::neutron::dex::{
DepositOptions as DepositOptionsGen, MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap,
MsgPlaceLimitOrder, MsgWithdrawFilledLimitOrder, MsgWithdrawal, MultiHopRoute,
Expand Down Expand Up @@ -107,7 +107,7 @@ impl From<PlaceLimitOrderRequest> for MsgPlaceLimitOrder {
tick_index_in_to_out: v.tick_index_in_to_out,
amount_in: v.amount_in,
order_type: v.order_type as i32,
expiration_time: v.expiration_time.map(convert_timestamp),
expiration_time: v.expiration_time.map(proto_timestamp_from_i64),
max_amount_out: v.max_amount_out.unwrap_or_default(),
}
}
Expand Down Expand Up @@ -527,7 +527,7 @@ impl From<EstimatePlaceLimitOrderRequest> for QueryEstimatePlaceLimitOrderReques
tick_index_in_to_out: v.tick_index_in_to_out,
amount_in: v.amount_in,
order_type: v.order_type as i32,
expiration_time: v.expiration_time.map(convert_timestamp),
expiration_time: v.expiration_time.map(proto_timestamp_from_i64),
max_amount_out: v.max_amount_out.unwrap_or_default(),
}
}
Expand Down

0 comments on commit 4fa9c69

Please sign in to comment.