1
1
use crate :: publisher_update:: feed_update:: Update ;
2
2
use crate :: publisher_update:: { FeedUpdate , FundingRateUpdate , PriceUpdate } ;
3
3
use crate :: state:: FeedState ;
4
+ use :: protobuf:: MessageField ;
4
5
use pyth_lazer_protocol:: jrpc:: { FeedUpdateParams , UpdateParams } ;
5
6
use pyth_lazer_protocol:: symbol_state:: SymbolState ;
6
7
use pyth_lazer_protocol:: FeedKind ;
@@ -60,13 +61,18 @@ impl From<UpdateParams> for Update {
60
61
best_ask_price : best_ask_price. map ( |p| p. 0 . into ( ) ) ,
61
62
special_fields : Default :: default ( ) ,
62
63
} ) ,
63
- UpdateParams :: FundingRateUpdate { price, rate } => {
64
- Update :: FundingRateUpdate ( FundingRateUpdate {
65
- price : price. map ( |p| p. 0 . into ( ) ) ,
66
- rate : Some ( rate. 0 ) ,
67
- special_fields : Default :: default ( ) ,
68
- } )
69
- }
64
+ UpdateParams :: FundingRateUpdate {
65
+ price,
66
+ rate,
67
+ funding_rate_interval,
68
+ } => Update :: FundingRateUpdate ( FundingRateUpdate {
69
+ price : price. map ( |p| p. 0 . into ( ) ) ,
70
+ rate : Some ( rate. 0 ) ,
71
+ funding_rate_interval : MessageField :: from_option (
72
+ funding_rate_interval. map ( |i| i. into ( ) ) ,
73
+ ) ,
74
+ special_fields : Default :: default ( ) ,
75
+ } ) ,
70
76
}
71
77
}
72
78
}
@@ -91,20 +97,20 @@ impl From<SymbolState> for FeedState {
91
97
}
92
98
}
93
99
94
- impl From < FeedKind > for protobuf :: state:: FeedKind {
100
+ impl From < FeedKind > for state:: FeedKind {
95
101
fn from ( value : FeedKind ) -> Self {
96
102
match value {
97
- FeedKind :: Price => protobuf :: state:: FeedKind :: PRICE ,
98
- FeedKind :: FundingRate => protobuf :: state:: FeedKind :: FUNDING_RATE ,
103
+ FeedKind :: Price => state:: FeedKind :: PRICE ,
104
+ FeedKind :: FundingRate => state:: FeedKind :: FUNDING_RATE ,
99
105
}
100
106
}
101
107
}
102
108
103
- impl From < protobuf :: state:: FeedKind > for FeedKind {
104
- fn from ( value : protobuf :: state:: FeedKind ) -> Self {
109
+ impl From < state:: FeedKind > for FeedKind {
110
+ fn from ( value : state:: FeedKind ) -> Self {
105
111
match value {
106
- protobuf :: state:: FeedKind :: PRICE => FeedKind :: Price ,
107
- protobuf :: state:: FeedKind :: FUNDING_RATE => FeedKind :: FundingRate ,
112
+ state:: FeedKind :: PRICE => FeedKind :: Price ,
113
+ state:: FeedKind :: FUNDING_RATE => FeedKind :: FundingRate ,
108
114
}
109
115
}
110
116
}
0 commit comments