Documentation
¶
Index ¶
- Constants
- Variables
- func ChannelBalance(ctx *cli.Context) error
- func ListChannels(ctx *cli.Context) error
- func Main()
- func NewProtoOutPoint(op string) (*lnrpc.OutPoint, error)
- func PaymentFlags() []cli.Flag
- func PrintLivePayment(ctxc context.Context, stream PaymentResultStream, ...) (*lnrpc.Payment, error)
- func SendPayment(ctx *cli.Context) error
- func SendPaymentRequest(ctx *cli.Context, req *routerrpc.SendPaymentRequest, ...) error
- func StripPrefix(s string) string
- func UtxosToOutpoints(utxos []string) ([]*lnrpc.OutPoint, error)
- type DebugPackage
- type FailedUpdate
- type OutPoint
- type PaymentResultStream
- type PendingSweep
- type SendPaymentFn
- type Utxo
Constants ¶
const ESC = 27
ESC is the ASCII code for escape character.
Variables ¶
var AddInvoiceCommand = cli.Command{ Name: "addinvoice", Category: "Invoices", Usage: "Add a new invoice.", Description: ` Add a new invoice, expressing intent for a future payment. Invoices without an amount can be created by not supplying any parameters or providing an amount of 0. These invoices allow the payer to specify the amount of satoshis they wish to send.`, ArgsUsage: "value preimage", Flags: []cli.Flag{ cli.StringFlag{ Name: "memo", Usage: "a description of the payment to attach along " + "with the invoice (default=\"\")", }, cli.StringFlag{ Name: "preimage", Usage: "the hex-encoded preimage (32 byte) which will " + "allow settling an incoming HTLC payable to this " + "preimage. If not set, a random preimage will be " + "created.", }, cli.Int64Flag{ Name: "amt", Usage: "the amt of satoshis in this invoice", }, cli.Int64Flag{ Name: "amt_msat", Usage: "the amt of millisatoshis in this invoice", }, cli.StringFlag{ Name: "description_hash", Usage: "SHA-256 hash of the description of the payment. " + "Used if the purpose of payment cannot naturally " + "fit within the memo. If provided this will be " + "used instead of the description(memo) field in " + "the encoded invoice.", }, cli.StringFlag{ Name: "fallback_addr", Usage: "fallback on-chain address that can be used in " + "case the lightning payment fails", }, cli.Int64Flag{ Name: "expiry", Usage: "the invoice's expiry time in seconds. If not " + "specified, an expiry of " + "86400 seconds (24 hours) is implied.", }, cli.Uint64Flag{ Name: "cltv_expiry_delta", Usage: "The minimum CLTV delta to use for the final " + "hop. If this is set to 0, the default value " + "is used. The default value for " + "cltv_expiry_delta is configured by the " + "'bitcoin.timelockdelta' option.", }, cli.BoolFlag{ Name: "private", Usage: "encode routing hints in the invoice with " + "private channels in order to assist the " + "payer in reaching you. If amt and amt_msat " + "are zero, a large number of hints with " + "these channels can be included, which " + "might not be desirable.", }, cli.BoolFlag{ Name: "amp", Usage: "creates an AMP invoice. If true, preimage " + "should not be set.", }, cli.BoolFlag{ Name: "blind", Usage: "creates an invoice that contains blinded " + "paths. Note that invoices with blinded " + "paths will be signed using a random " + "ephemeral key so as not to reveal the real " + "node ID of this node.", }, cli.UintFlag{ Name: "min_real_blinded_hops", Usage: "The minimum number of real hops to use in a " + "blinded path. This option will only be used " + "if `--blind` has also been set.", }, cli.UintFlag{ Name: "num_blinded_hops", Usage: "The number of hops to use for each " + "blinded path included in the invoice. This " + "option will only be used if `--blind` has " + "also been set. Dummy hops will be used to " + "pad paths shorter than this.", }, cli.UintFlag{ Name: "max_blinded_paths", Usage: "The maximum number of blinded paths to add " + "to an invoice. This option will only be " + "used if `--blind` has also been set.", }, cli.StringSliceFlag{ Name: "blinded_path_omit_node", Usage: "The pub key (in hex) of a node not to " + "use on a blinded path. The flag may be " + "specified multiple times.", }, }, Action: actionDecorator(addInvoice), }
var ChannelBalanceCommand = cli.Command{ Name: "channelbalance", Category: "Channels", Usage: "Returns the sum of the total available channel balance across " + "all open channels.", Action: actionDecorator(ChannelBalance), }
var (
DefaultLndDir = btcutil.AppDataDir("lnd", false)
)
var ListChannelsCommand = cli.Command{ Name: "listchannels", Category: "Channels", Usage: "List all open channels.", Flags: []cli.Flag{ cli.BoolFlag{ Name: "active_only", Usage: "only list channels which are currently active", }, cli.BoolFlag{ Name: "inactive_only", Usage: "only list channels which are currently inactive", }, cli.BoolFlag{ Name: "public_only", Usage: "only list channels which are currently public", }, cli.BoolFlag{ Name: "private_only", Usage: "only list channels which are currently private", }, cli.StringFlag{ Name: "peer", Usage: "(optional) only display channels with a " + "particular peer, accepts 66-byte, " + "hex-encoded pubkeys", }, cli.BoolFlag{ Name: "skip_peer_alias_lookup", Usage: "skip the peer alias lookup per channel in " + "order to improve performance", }, }, Action: actionDecorator(ListChannels), }
var SendPaymentCommand = cli.Command{ Name: "sendpayment", Category: "Payments", Usage: "Send a payment over lightning.", Description: ` Send a payment over Lightning. One can either specify the full parameters of the payment, or just use a payment request which encodes all the payment details. If payment isn't manually specified, then only a payment request needs to be passed using the --pay_req argument. If the payment *is* manually specified, then the following arguments need to be specified in order to complete the payment: For invoice with keysend, --dest=N --amt=A --final_cltv_delta=T --keysend For invoice without payment address: --dest=N --amt=A --payment_hash=H --final_cltv_delta=T For invoice with payment address: --dest=N --amt=A --payment_hash=H --final_cltv_delta=T --pay_addr=H `, ArgsUsage: "dest amt payment_hash final_cltv_delta pay_addr | " + "--pay_req=R [--pay_addr=H]", Flags: append(PaymentFlags(), cli.StringFlag{ Name: "dest, d", Usage: "the compressed identity pubkey of the " + "payment recipient", }, cli.Int64Flag{ Name: "amt, a", Usage: "number of satoshis to send", }, cli.StringFlag{ Name: "payment_hash, r", Usage: "the hash to use within the payment's HTLC", }, cli.Int64Flag{ Name: "final_cltv_delta", Usage: "the number of blocks the last hop has to reveal the preimage", }, cli.StringFlag{ Name: "pay_addr", Usage: "the payment address of the generated invoice", }, cli.BoolFlag{ Name: "keysend", Usage: "will generate a pre-image and encode it in the sphinx packet, a dest must be set [experimental]", }, ), Action: SendPayment, }
Functions ¶
func ChannelBalance ¶
func ListChannels ¶
func NewProtoOutPoint ¶
NewProtoOutPoint parses an OutPoint into its corresponding lnrpc.OutPoint type.
func PaymentFlags ¶
PaymentFlags returns common flags for sendpayment and payinvoice.
func PrintLivePayment ¶
func PrintLivePayment(ctxc context.Context, stream PaymentResultStream, lnClient lnrpc.LightningClient, json bool) (*lnrpc.Payment, error)
PrintLivePayment receives payment updates from the given stream and either outputs them as json or as a more user-friendly formatted table. The table option uses terminal control codes to rewrite the output. This call terminates when the payment reaches a final state.
func SendPayment ¶
func SendPaymentRequest ¶
func SendPaymentRequest(ctx *cli.Context, req *routerrpc.SendPaymentRequest, lnConn, paymentConn grpc.ClientConnInterface, callSendPayment SendPaymentFn) error
func StripPrefix ¶
StripPrefix removes accidentally copied 'lightning:' prefix.
Types ¶
type DebugPackage ¶
type FailedUpdate ¶
type FailedUpdate struct { OutPoint OutPoint `json:"outpoint"` Reason string `json:"reason"` UpdateError string `json:"update_error"` }
FailedUpdate displays information about a failed update, including its address, reason and update error.
func NewFailedUpdateFromProto ¶
func NewFailedUpdateFromProto(update *lnrpc.FailedUpdate) *FailedUpdate
NewFailedUpdateFromProto creates a display from the FailedUpdate proto. This filters out the raw txid bytes from the provided outpoint, which will otherwise be printed in base64.
type OutPoint ¶
type OutPoint string
OutPoint displays an outpoint string in the form "<txid>:<output-index>".
func NewOutPointFromProto ¶
NewOutPointFromProto formats the lnrpc.OutPoint into an OutPoint for display.
type PaymentResultStream ¶
PaymentResultStream is an interface that abstracts the Recv method of the SendPaymentV2 or TrackPaymentV2 client stream.
type PendingSweep ¶
type PendingSweep struct { OutPoint OutPoint `json:"outpoint"` WitnessType string `json:"witness_type"` AmountSat uint32 `json:"amount_sat"` SatPerVByte uint32 `json:"sat_per_vbyte"` BroadcastAttempts uint32 `json:"broadcast_attempts"` RequestedSatPerVByte uint32 `json:"requested_sat_per_vbyte"` Immediate bool `json:"immediate"` Budget uint64 `json:"budget"` DeadlineHeight uint32 `json:"deadline_height"` MaturityHeight uint32 `json:"maturity_height"` NextBroadcastHeight uint32 `json:"next_broadcast_height"` RequestedConfTarget uint32 `json:"requested_conf_target"` Force bool `json:"force"` }
PendingSweep is a CLI-friendly type of the walletrpc.PendingSweep proto. We use this to show more useful string versions of byte slices and enums.
TODO(yy): Remove this struct as it's easy to forget to update the values here. Instead, we should rely on the struct defined in the proto `PendingSweepsResponse` only.
func NewPendingSweepFromProto ¶
func NewPendingSweepFromProto(pendingSweep *walletrpc.PendingSweep) *PendingSweep
NewPendingSweepFromProto converts the walletrpc.PendingSweep proto type into its corresponding CLI-friendly type.
type SendPaymentFn ¶
type SendPaymentFn func(ctx context.Context, payConn grpc.ClientConnInterface, req *routerrpc.SendPaymentRequest) (PaymentResultStream, error)
SendPaymentFn is a function type that abstracts the SendPaymentV2 call of the router client.
type Utxo ¶
type Utxo struct { Type lnrpc.AddressType `json:"address_type"` Address string `json:"address"` AmountSat int64 `json:"amount_sat"` PkScript string `json:"pk_script"` OutPoint OutPoint `json:"outpoint"` Confirmations int64 `json:"confirmations"` }
Utxo displays information about an unspent output, including its address, amount, pkscript, and confirmations.
func NewUtxoFromProto ¶
NewUtxoFromProto creates a display Utxo from the Utxo proto. This filters out the raw txid bytes from the provided outpoint, which will otherwise be printed in base64.
Source Files
¶
- arg_parse.go
- autopilotrpc_default.go
- chainrpc_default.go
- cmd_custom.go
- cmd_debug.go
- cmd_import_mission_control.go
- cmd_invoice.go
- cmd_macaroon.go
- cmd_mission_control.go
- cmd_open_channel.go
- cmd_payments.go
- cmd_profile.go
- cmd_state.go
- cmd_update_chan_status.go
- cmd_version.go
- cmd_walletunlocker.go
- commands.go
- devrpc_default.go
- invoicesrpc_default.go
- macaroon_jar.go
- main.go
- neutrino_default.go
- peersrpc_default.go
- profile.go
- routerrpc.go
- types.go
- walletrpc_default.go
- walletrpc_types.go
- watchtower_default.go
- wtclient.go