-
Notifications
You must be signed in to change notification settings - Fork 7
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
11 changed files
with
317 additions
and
3 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
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,34 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
import "github.com/lightsparkdev/go-sdk/types" | ||
|
||
type DailyLiquidityForecast struct { | ||
|
||
// Date The date for which this forecast was generated. | ||
Date types.Date `json:"daily_liquidity_forecast_date"` | ||
|
||
// Direction The direction for which this forecast was generated. | ||
Direction LightningPaymentDirection `json:"daily_liquidity_forecast_direction"` | ||
|
||
// Amount 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. | ||
Amount CurrencyAmount `json:"daily_liquidity_forecast_amount"` | ||
} | ||
|
||
const ( | ||
DailyLiquidityForecastFragment = ` | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
// LightningPaymentDirection This is an enum identifying the payment direction. | ||
type LightningPaymentDirection int | ||
|
||
const ( | ||
LightningPaymentDirectionUndefined LightningPaymentDirection = iota | ||
|
||
// LightningPaymentDirectionIncoming A payment that is received by the node. | ||
LightningPaymentDirectionIncoming | ||
// LightningPaymentDirectionOutgoing A payment that is sent by the node. | ||
LightningPaymentDirectionOutgoing | ||
) | ||
|
||
func (a *LightningPaymentDirection) UnmarshalJSON(b []byte) error { | ||
var s string | ||
if err := json.Unmarshal(b, &s); err != nil { | ||
return err | ||
} | ||
switch s { | ||
default: | ||
*a = LightningPaymentDirectionUndefined | ||
case "INCOMING": | ||
*a = LightningPaymentDirectionIncoming | ||
case "OUTGOING": | ||
*a = LightningPaymentDirectionOutgoing | ||
|
||
} | ||
return nil | ||
} | ||
|
||
func (a LightningPaymentDirection) StringValue() string { | ||
var s string | ||
switch a { | ||
default: | ||
s = "undefined" | ||
case LightningPaymentDirectionIncoming: | ||
s = "INCOMING" | ||
case LightningPaymentDirectionOutgoing: | ||
s = "OUTGOING" | ||
|
||
} | ||
return s | ||
} | ||
|
||
func (a LightningPaymentDirection) MarshalJSON() ([]byte, error) { | ||
s := a.StringValue() | ||
return json.Marshal(s) | ||
} |
39 changes: 39 additions & 0 deletions
39
objects/lightspark_node_to_daily_liquidity_forecasts_connection.go
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,39 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
import "github.com/lightsparkdev/go-sdk/types" | ||
|
||
type LightsparkNodeToDailyLiquidityForecastsConnection struct { | ||
FromDate types.Date `json:"lightspark_node_to_daily_liquidity_forecasts_connection_from_date"` | ||
|
||
ToDate types.Date `json:"lightspark_node_to_daily_liquidity_forecasts_connection_to_date"` | ||
|
||
Direction LightningPaymentDirection `json:"lightspark_node_to_daily_liquidity_forecasts_connection_direction"` | ||
|
||
// Entities The daily liquidity forecasts for the current page of this connection. | ||
Entities []DailyLiquidityForecast `json:"lightspark_node_to_daily_liquidity_forecasts_connection_entities"` | ||
} | ||
|
||
const ( | ||
LightsparkNodeToDailyLiquidityForecastsConnectionFragment = ` | ||
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 | ||
} | ||
} | ||
} | ||
` | ||
) |
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,14 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
type WithdrawalFeeEstimateInput struct { | ||
|
||
// NodeId The node from which you'd like to make the withdrawal. | ||
NodeId string `json:"withdrawal_fee_estimate_input_node_id"` | ||
|
||
// AmountSats The amount you want to withdraw from this node in Satoshis. Use the special value -1 to withdrawal all funds from this node. | ||
AmountSats int64 `json:"withdrawal_fee_estimate_input_amount_sats"` | ||
|
||
// WithdrawalMode The strategy that should be used to withdraw the funds from this node. | ||
WithdrawalMode WithdrawalMode `json:"withdrawal_fee_estimate_input_withdrawal_mode"` | ||
} |
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,24 @@ | ||
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved | ||
package objects | ||
|
||
type WithdrawalFeeEstimateOutput struct { | ||
|
||
// FeeEstimate The estimated fee for the withdrawal. | ||
FeeEstimate CurrencyAmount `json:"withdrawal_fee_estimate_output_fee_estimate"` | ||
} | ||
|
||
const ( | ||
WithdrawalFeeEstimateOutputFragment = ` | ||
fragment WithdrawalFeeEstimateOutputFragment on WithdrawalFeeEstimateOutput { | ||
__typename | ||
withdrawal_fee_estimate_output_fee_estimate: fee_estimate { | ||
__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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package types | ||
|
||
import "time" | ||
|
||
type Date time.Time | ||
|
||
func (d *Date) UnmarshalJSON(b []byte) error { | ||
t, err := time.Parse("\"2006-01-02\"", string(b)) | ||
if err != nil { | ||
return err | ||
} | ||
*d = Date(t) | ||
return nil | ||
} | ||
|
||
func (d Date) MarshalJSON() ([]byte, error) { | ||
return []byte(time.Time(d).Format("\"2006-01-02\"")), nil | ||
} |