Skip to content

Commit

Permalink
Merge pull request #187 from joemphilips/fix_lnmoney_constructor
Browse files Browse the repository at this point in the history
update LNMoney.Satoshis
  • Loading branch information
joemphilips authored Apr 26, 2022
2 parents 55b6a34 + e26fa8d commit c813b77
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/DotNetLightning.Core/Utils/LNMoney.fs
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,30 @@ type LNMoney =
LNMoneyUnit.MilliSatoshi
)

static member MilliSatoshis(sats: int64) =
LNMoney sats

static member MilliSatoshis(sats: uint64) =
LNMoney(Checked.int64 sats)

static member MilliSatoshis(sats: int) =
LNMoney(Checked.int64 sats)

static member MilliSatoshis(sats: uint32) =
LNMoney(Checked.int64 sats)

static member Satoshis(sats: int64) =
LNMoney.MilliSatoshis(Checked.op_Multiply 1000L sats)

static member inline Satoshis sats =
LNMoney.Satoshis(int64 sats)

static member Satoshis(sats: uint64) =
LNMoney.MilliSatoshis(Checked.op_Multiply 1000UL sats)

static member MilliSatoshis(sats: int64) =
LNMoney(sats)
static member Satoshis(sats: int) =
LNMoney.Satoshis(Checked.int64 sats)

static member inline MilliSatoshis sats =
LNMoney(int64 sats)
static member Satoshis(sats: uint32) =
LNMoney.Satoshis(Checked.int64 sats)

static member MilliSatoshis(sats: uint64) =
LNMoney(Checked.int64 sats)

static member Zero = LNMoney(0L)
static member One = LNMoney(1L)
Expand Down

0 comments on commit c813b77

Please sign in to comment.