Documentation ¶
Index ¶
- Variables
- type Client
- func (ln *Client) Call(method string, params ...interface{}) (gjson.Result, error)
- func (ln *Client) CallMessage(timeout time.Duration, message JSONRPCMessage) (gjson.Result, error)
- func (ln *Client) CallMessageRaw(timeout time.Duration, message JSONRPCMessage) ([]byte, error)
- func (ln *Client) CallNamed(method string, params ...interface{}) (gjson.Result, error)
- func (ln *Client) CallNamedWithCustomTimeout(timeout time.Duration, method string, params ...interface{}) (res gjson.Result, err error)
- func (ln *Client) CallWithCustomTimeout(timeout time.Duration, method string, params ...interface{}) (gjson.Result, error)
- func (ln *Client) ListenForInvoices()
- func (ln *Client) PayAndWaitUntilResolution(bolt11 string, params map[string]interface{}) (success bool, payment gjson.Result, tries []Try, err error)
- type ErrorCommand
- type ErrorConnect
- type ErrorConnectionBroken
- type ErrorJSONDecode
- type ErrorTimeout
- type JSONRPCError
- type JSONRPCMessage
- type JSONRPCResponse
- type Try
Constants ¶
This section is empty.
Variables ¶
var DefaultTimeout = time.Second * 5
var InvoiceListeningTimeout = time.Minute * 150
var WaitPaymentMaxAttempts = 60
var WaitSendPayTimeout = time.Hour * 24
Functions ¶
This section is empty.
Types ¶
type Client ¶
func (*Client) CallMessage ¶
func (*Client) CallMessageRaw ¶
func (*Client) CallNamedWithCustomTimeout ¶
func (*Client) CallWithCustomTimeout ¶
func (*Client) ListenForInvoices ¶
func (ln *Client) ListenForInvoices()
ListenForInvoices starts a goroutine that will repeatedly call waitanyinvoice. Each payment received will be fed into the client.PaymentHandler function. You can change that function in the meantime. Or you can set it to nil if you want to stop listening for invoices.
func (*Client) PayAndWaitUntilResolution ¶
func (ln *Client) PayAndWaitUntilResolution( bolt11 string, params map[string]interface{}, ) (success bool, payment gjson.Result, tries []Try, err error)
PayAndWaitUntilResolution implements its 'pay' logic, querying and retrying routes. It's like the default 'pay' plugin, but it blocks until a final success or failure is achieved. After it returns you can be sure a failed payment will not succeed anymore. Any value in params will be passed to 'getroute' or 'sendpay' or smart defaults will be used. This includes values from the default 'pay' plugin.
type ErrorCommand ¶
type ErrorCommand struct { Message string `json:"msg"` Code int `json:"code"` Data interface{} `json:"data"` }
func (ErrorCommand) Error ¶
func (l ErrorCommand) Error() string
type ErrorConnect ¶
func (ErrorConnect) Error ¶
func (c ErrorConnect) Error() string
type ErrorConnectionBroken ¶
type ErrorConnectionBroken struct{}
func (ErrorConnectionBroken) Error ¶
func (c ErrorConnectionBroken) Error() string
type ErrorJSONDecode ¶
type ErrorJSONDecode struct {
Message string `json:"message"`
}
func (ErrorJSONDecode) Error ¶
func (j ErrorJSONDecode) Error() string
type ErrorTimeout ¶
type ErrorTimeout struct {
Seconds int `json:"seconds"`
}
func (ErrorTimeout) Error ¶
func (t ErrorTimeout) Error() string
type JSONRPCError ¶
type JSONRPCMessage ¶
type JSONRPCResponse ¶
type JSONRPCResponse struct { Version string `json:"jsonrpc"` Id interface{} `json:"id"` Result json.RawMessage `json:"result,omitempty"` Error *JSONRPCError `json:"error,omitempty"` }
type Try ¶
type Try struct { Route interface{} `json:"route"` Error *ErrorCommand `json:"error"` Success bool `json:"success"` }