-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
370 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
lightspark/src/objects/account_to_payment_requests_connection.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
use crate::objects::currency_amount::CurrencyAmount; | ||
use crate::objects::lightning_payment_direction::LightningPaymentDirection; | ||
use crate::types::custom_date_formats::custom_date_only_format; | ||
use chrono::NaiveDate; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Clone, Deserialize, Serialize)] | ||
pub struct DailyLiquidityForecast { | ||
/// The date for which this forecast was generated. | ||
#[serde( | ||
with = "custom_date_only_format", | ||
rename = "daily_liquidity_forecast_date" | ||
)] | ||
pub date: NaiveDate, | ||
|
||
/// The direction for which this forecast was generated. | ||
#[serde(rename = "daily_liquidity_forecast_direction")] | ||
pub direction: LightningPaymentDirection, | ||
|
||
/// The value of the forecast. It represents the amount of msats that we think will be moved for that specified direction, for that node, on that date. | ||
#[serde(rename = "daily_liquidity_forecast_amount")] | ||
pub amount: CurrencyAmount, | ||
} | ||
|
||
pub const FRAGMENT: &str = " | ||
fragment DailyLiquidityForecastFragment on DailyLiquidityForecast { | ||
__typename | ||
daily_liquidity_forecast_date: date | ||
daily_liquidity_forecast_direction: direction | ||
daily_liquidity_forecast_amount: amount { | ||
__typename | ||
currency_amount_original_value: original_value | ||
currency_amount_original_unit: original_unit | ||
currency_amount_preferred_currency_unit: preferred_currency_unit | ||
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded | ||
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx | ||
} | ||
} | ||
"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::Value; | ||
use std::fmt; | ||
|
||
/// This is an enum identifying the payment direction. | ||
#[derive(Debug, Clone, Deserialize, Serialize)] | ||
pub enum LightningPaymentDirection { | ||
/// A payment that is received by the node. | ||
#[serde(rename = "INCOMING")] | ||
Incoming, | ||
/// A payment that is sent by the node. | ||
#[serde(rename = "OUTGOING")] | ||
Outgoing, | ||
} | ||
|
||
impl From<LightningPaymentDirection> for Value { | ||
fn from(val: LightningPaymentDirection) -> Self { | ||
Value::from(val.to_string()) | ||
} | ||
} | ||
|
||
impl fmt::Display for LightningPaymentDirection { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match self { | ||
Self::Incoming => write!(f, "INCOMING"), | ||
Self::Outgoing => write!(f, "OUTGOING"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
lightspark/src/objects/lightspark_node_to_daily_liquidity_forecasts_connection.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
use crate::objects::daily_liquidity_forecast::DailyLiquidityForecast; | ||
use crate::objects::lightning_payment_direction::LightningPaymentDirection; | ||
use crate::types::custom_date_formats::custom_date_only_format; | ||
use chrono::NaiveDate; | ||
use serde::{Deserialize, Serialize}; | ||
use std::vec::Vec; | ||
|
||
#[derive(Debug, Clone, Deserialize, Serialize)] | ||
pub struct LightsparkNodeToDailyLiquidityForecastsConnection { | ||
#[serde( | ||
with = "custom_date_only_format", | ||
rename = "lightspark_node_to_daily_liquidity_forecasts_connection_from_date" | ||
)] | ||
pub from_date: NaiveDate, | ||
|
||
#[serde( | ||
with = "custom_date_only_format", | ||
rename = "lightspark_node_to_daily_liquidity_forecasts_connection_to_date" | ||
)] | ||
pub to_date: NaiveDate, | ||
|
||
#[serde(rename = "lightspark_node_to_daily_liquidity_forecasts_connection_direction")] | ||
pub direction: LightningPaymentDirection, | ||
|
||
/// The daily liquidity forecasts for the current page of this connection. | ||
#[serde(rename = "lightspark_node_to_daily_liquidity_forecasts_connection_entities")] | ||
pub entities: Vec<DailyLiquidityForecast>, | ||
} | ||
|
||
pub const FRAGMENT: &str = " | ||
fragment LightsparkNodeToDailyLiquidityForecastsConnectionFragment on LightsparkNodeToDailyLiquidityForecastsConnection { | ||
__typename | ||
lightspark_node_to_daily_liquidity_forecasts_connection_from_date: from_date | ||
lightspark_node_to_daily_liquidity_forecasts_connection_to_date: to_date | ||
lightspark_node_to_daily_liquidity_forecasts_connection_direction: direction | ||
lightspark_node_to_daily_liquidity_forecasts_connection_entities: entities { | ||
__typename | ||
daily_liquidity_forecast_date: date | ||
daily_liquidity_forecast_direction: direction | ||
daily_liquidity_forecast_amount: amount { | ||
__typename | ||
currency_amount_original_value: original_value | ||
currency_amount_original_unit: original_unit | ||
currency_amount_preferred_currency_unit: preferred_currency_unit | ||
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded | ||
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx | ||
} | ||
} | ||
} | ||
"; |
Oops, something went wrong.