Skip to content

Commit

Permalink
update to use published proto types
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldjeffrey committed Oct 17, 2024
1 parent 35ded33 commit f1255c2
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 59 deletions.
56 changes: 36 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ helium-lib = { git = "https://github.com/helium/helium-wallet-rs.git", branch =
hextree = { git = "https://github.com/jaykickliter/HexTree", branch = "main", features = [
"disktree",
] }
helium-proto = { git = "https://github.com/helium/proto", branch = "master", features = [
helium-proto = { git = "https://github.com/helium/proto", branch = "mj/sp-promotions-v2", features = [
"services",
] }
beacon = { git = "https://github.com/helium/proto", branch = "master" }
beacon = { git = "https://github.com/helium/proto", branch = "mj/sp-promotions-v2" }
solana-client = "1.18"
solana-sdk = "1.18"
solana-program = "1.18"
Expand Down
9 changes: 5 additions & 4 deletions mobile_config/src/client/carrier_service_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use file_store::traits::{MsgVerify, TimestampEncode};
use helium_crypto::{Keypair, PublicKey, Sign};
use helium_proto::{
services::{mobile_config, Channel},
Message, ServiceProvider, ServiceProviderPromotion,
Message, ServiceProvider, ServiceProviderPromotions,
};
use retainer::Cache;
use std::{str::FromStr, sync::Arc, time::Duration};
Expand All @@ -17,8 +17,9 @@ pub trait CarrierServiceVerifier {
payer: &str,
) -> Result<ServiceProvider, Self::Error>;

async fn list_incentive_promotions(&self)
-> Result<Vec<ServiceProviderPromotion>, Self::Error>;
async fn list_incentive_promotions(
&self,
) -> Result<Vec<ServiceProviderPromotions>, Self::Error>;
}
#[derive(Clone)]
pub struct CarrierServiceClient {
Expand Down Expand Up @@ -68,7 +69,7 @@ impl CarrierServiceVerifier for CarrierServiceClient {

async fn list_incentive_promotions(
&self,
) -> Result<Vec<ServiceProviderPromotion>, Self::Error> {
) -> Result<Vec<ServiceProviderPromotions>, Self::Error> {
let mut request = mobile_config::CarrierIncentivePromotionListReqV1 {
timestamp: Utc::now().encode_timestamp_millis(),
signer: self.signing_key.public_key().into(),
Expand Down
2 changes: 1 addition & 1 deletion mobile_verifier/src/rewarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ where
boosted_poc_bones_per_reward_share: Some(helium_proto::Decimal {
value: poc_dc_shares.boost.to_string(),
}),
sp_promotions: sp_promotions.into_proto(),
service_provider_promotions: sp_promotions.into_proto(),
};
self.reward_manifests
.write(
Expand Down
4 changes: 2 additions & 2 deletions mobile_verifier/src/service_provider/dc_sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ where
pub mod tests {

use chrono::Duration;
use helium_proto::{ServiceProvider, ServiceProviderPromotion};
use helium_proto::{ServiceProvider, ServiceProviderPromotions};

use crate::data_session::HotspotDataSession;

Expand Down Expand Up @@ -136,7 +136,7 @@ pub mod tests {

async fn list_incentive_promotions(
&self,
) -> Result<Vec<ServiceProviderPromotion>, Self::Error> {
) -> Result<Vec<ServiceProviderPromotions>, Self::Error> {
Ok(vec![])
}
}
Expand Down
10 changes: 5 additions & 5 deletions mobile_verifier/src/service_provider/promotions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rust_decimal_macros::dec;
use crate::service_provider::ServiceProviderId;

mod proto {
pub use helium_proto::{Promotion, ServiceProviderPromotion};
pub use helium_proto::{service_provider_promotions::Promotion, ServiceProviderPromotions};
}

pub async fn get_promotions(
Expand All @@ -16,10 +16,10 @@ pub async fn get_promotions(
}

#[derive(Debug, Default, Clone)]
pub struct ServiceProviderPromotions(Vec<proto::ServiceProviderPromotion>);
pub struct ServiceProviderPromotions(Vec<proto::ServiceProviderPromotions>);

impl ServiceProviderPromotions {
pub fn into_proto(self) -> Vec<proto::ServiceProviderPromotion> {
pub fn into_proto(self) -> Vec<proto::ServiceProviderPromotions> {
self.0
}

Expand All @@ -44,8 +44,8 @@ impl ServiceProviderPromotions {
}
}

impl From<Vec<proto::ServiceProviderPromotion>> for ServiceProviderPromotions {
fn from(value: Vec<proto::ServiceProviderPromotion>) -> Self {
impl From<Vec<proto::ServiceProviderPromotions>> for ServiceProviderPromotions {
fn from(value: Vec<proto::ServiceProviderPromotions>) -> Self {
Self(value)
}
}
Loading

0 comments on commit f1255c2

Please sign in to comment.