mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
cmd: ln addinvoice supports sat/msat amount
This commit is contained in:
parent
0015ca29af
commit
17ab5e21dd
1 changed files with 15 additions and 2 deletions
|
|
@ -679,12 +679,23 @@ func addInvoice(cli *cli.Context) error {
|
|||
|
||||
var (
|
||||
assetAmount = cli.Uint64("asset_amount")
|
||||
msatAmount = cli.Int64("amt_msat")
|
||||
satAmount = cli.Int64("amt")
|
||||
preimage []byte
|
||||
descHash []byte
|
||||
err error
|
||||
)
|
||||
if assetAmount == 0 {
|
||||
return fmt.Errorf("asset_amount argument missing")
|
||||
if assetAmount == 0 && msatAmount == 0 && satAmount == 0 {
|
||||
return fmt.Errorf("must set asset amount or sat/msat amount")
|
||||
}
|
||||
|
||||
if assetAmount != 0 && (msatAmount != 0 || satAmount != 0) {
|
||||
return fmt.Errorf("must only set one of asset amount or " +
|
||||
"sat/msat amount")
|
||||
}
|
||||
|
||||
if msatAmount != 0 && satAmount != 0 {
|
||||
return fmt.Errorf("must only set one of amt or amt_msat")
|
||||
}
|
||||
|
||||
if cli.IsSet("preimage") {
|
||||
|
|
@ -731,6 +742,8 @@ func addInvoice(cli *cli.Context) error {
|
|||
Memo: cli.String("memo"),
|
||||
RPreimage: preimage,
|
||||
DescriptionHash: descHash,
|
||||
Value: satAmount,
|
||||
ValueMsat: msatAmount,
|
||||
FallbackAddr: cli.String("fallback_addr"),
|
||||
Expiry: expirySeconds,
|
||||
Private: cli.Bool("private"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue