Documentation ¶
Index ¶
- Variables
- type B
- type Client
- type Ctx
- type E
- type Error
- type GetBalanceRequest
- type GetBalanceResponse
- type GetInfo
- type GetInfoRequest
- type GetInfoResponse
- type Invoice
- type InvoiceResponse
- type ListTransactions
- type ListTransactionsRequest
- type ListTransactionsResponse
- type LookupInvoice
- type LookupInvoiceRequest
- type LookupInvoiceResponse
- type MakeInvoiceRequest
- type MakeInvoiceResponse
- type Msat
- type MultiPayInvoiceRequest
- type MultiPayInvoiceResponse
- type MultiPayKeysendRequest
- type MultiPayKeysendResponse
- type N
- type Notification
- type Notifier
- type PayInvoiceRequest
- type PayInvoiceResponse
- type PayKeysendRequest
- type PayKeysendResponse
- type PaymentReceivedNotification
- type PaymentSentNotification
- type Request
- type Requester
- type Response
- type Resulter
- type S
- type Server
- type TLV
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PaymentSent = B("payment_sent") PaymentReceived = B("payment_received") )
View Source
var Errors = struct { // RateLimited - The client is sending commands too fast.It should retry in a few seconds. RateLimited, NotImplemented, InsufficientBalance, QuotaExceeded, Restricted, Unauthorized, Internal, Other B }{ B("RATE_LIMITED"), B("NOT_IMPLEMENTED"), B("INSUFFICIENT_BALANCE"), B("QUOTA_EXCEEDED"), B("RESTRICTED"), B("UNAUTHORIZED"), B("INTERNAL"), B("OTHER"), }
View Source
var Keys = struct { Method, Params, ResultType, Error, Result, Invoice, Amount, Preimage, FeesPaid, Id, TLVRecords, Type, Value, Pubkey, Description, DescriptionHash, Expiry, CreatedAt, ExpiresAt, Metadata, SettledAt, From, Until, Offset, Unpaid, Balance, Notifications, NotificationType, Notification, PaymentHash B }{ B("method"), B("params"), B("result_type"), B("error"), B("result"), B("invoice"), B("amount"), B("preimage"), B("fees_paid"), B("id"), B("tlv_records"), B("type"), B("value"), B("pubkey"), B("description"), B("description_hash"), B("expiry"), B("created_at"), B("expires_at"), B("metadata"), B("settled_at"), B("from"), B("until"), B("offset"), B("unpaid"), B("balance"), B("notifications"), B("notification_type"), B("notification"), B("payment_hash"), }
Keys are the proper JSON bytes for the JSON object keys of the structs of the same-named type used lower in the following. Anonymous struct syntax is used to make neater addressing of these fields as symbols.
View Source
var Kinds = []*kind.T{ kind.WalletInfo, kind.WalletRequest, kind.WalletResponse, kind.WalletNotification, }
View Source
var Methods = struct { PayInvoice, MultiPayInvoice, PayKeysend, MultiPayKeysend, MakeInvoice, LookupInvoice, ListTransactions, GetBalance, GetInfo B }{ B("pay_invoice"), B("multi_pay_invoice"), B("pay_keysend"), B("multi_pay_keysend"), B("make_invoice"), B("lookup_invoice"), B("list_transactions"), B("get_balance"), B("get_info"), }
Methods are the text of the value of the Method field of Request.Method and Response.ResultType in a form that allows more convenient reference than using a map or package scoped variable. These appear in the API Request and Response types.
View Source
var Notifications = struct { PaymentReceived, PaymentSent B }{ B("payment_received"), B("payment_sent"), }
Notifications are the proper strings for the Notification.NotificationType
Functions ¶
This section is empty.
Types ¶
type GetBalanceRequest ¶
type GetBalanceRequest struct {
Request
}
func NewGetBalanceRequest ¶
func NewGetBalanceRequest() *GetBalanceRequest
type GetBalanceResponse ¶
func NewGetBalanceResponse ¶
func NewGetBalanceResponse(balance Msat) *GetBalanceResponse
type GetInfoRequest ¶
type GetInfoRequest struct {
Request
}
func NewGetInfoRequest ¶
func NewGetInfoRequest() GetInfoRequest
type GetInfoResponse ¶
func NewGetInfoResponse ¶
func NewGetInfoResponse(gi GetInfo) GetInfoResponse
type InvoiceResponse ¶
type InvoiceResponse struct { Type B // incoming or outgoing Invoice B // optional Description B // optional DescriptionHash B // optional Preimage B // optional if unpaid PaymentHash B Amount Msat FeesPaid Msat CreatedAt int64 ExpiresAt int64 // optional if not applicable Metadata []any // optional, probably like tags but retardation can be retarded so allow also numbers and floats }
type ListTransactions ¶
type ListTransactionsRequest ¶
type ListTransactionsRequest struct { Request ListTransactions }
func NewListTransactionsRequest ¶
func NewListTransactionsRequest(req ListTransactions) *ListTransactionsRequest
type ListTransactionsResponse ¶
type ListTransactionsResponse struct { Response Transactions []LookupInvoice }
func NewListTransactionsResponse ¶
func NewListTransactionsResponse(txs []LookupInvoice) ListTransactionsResponse
type LookupInvoice ¶
type LookupInvoice struct { Response InvoiceResponse SettledAt int64 // optional if unpaid }
type LookupInvoiceRequest ¶
func NewLookupInvoiceRequest ¶
func NewLookupInvoiceRequest(paymentHash, invoice B) *LookupInvoiceRequest
type LookupInvoiceResponse ¶
type LookupInvoiceResponse struct { Response LookupInvoice }
func NewLookupInvoiceResponse ¶
func NewLookupInvoiceResponse(resp LookupInvoice) LookupInvoiceResponse
type MakeInvoiceRequest ¶
type MakeInvoiceRequest struct { Request Amount Msat Description B // optional DescriptionHash B // optional Expiry N // optional }
func NewMakeInvoiceRequest ¶
func NewMakeInvoiceRequest(amount Msat, description, descriptionHash B, expiry N) MakeInvoiceRequest
type MakeInvoiceResponse ¶
type MakeInvoiceResponse struct { Response InvoiceResponse }
func NewMakeInvoiceResponse ¶
func NewMakeInvoiceResponse(resp InvoiceResponse) MakeInvoiceResponse
type Msat ¶
type Msat uint64
Msat is milli-sat, max possible value is 1000 x 21 x 100 000 000 (well, under 19 places of 64 bits in base 10)
type MultiPayInvoiceRequest ¶
func NewMultiPayInvoiceRequest ¶
func NewMultiPayInvoiceRequest(invoices []Invoice) MultiPayInvoiceRequest
type MultiPayInvoiceResponse ¶
type MultiPayInvoiceResponse = PayInvoiceResponse
func NewMultiPayInvoiceResponse ¶
func NewMultiPayInvoiceResponse(preimage B, feesPaid Msat) MultiPayInvoiceResponse
type MultiPayKeysendRequest ¶
type MultiPayKeysendRequest struct { Request Keysends []PayKeysendRequest }
func NewMultiPayKeysendRequest ¶
func NewMultiPayKeysendRequest(keysends []PayKeysendRequest) MultiPayKeysendRequest
type MultiPayKeysendResponse ¶
type MultiPayKeysendResponse = PayKeysendResponse
func NewMultiPayKKeysendResponse ¶
func NewMultiPayKKeysendResponse(preimage B, feesPaid Msat) MultiPayKeysendResponse
type Notification ¶
type Notification struct {
Type B
}
func (Notification) NotificationType ¶
func (n Notification) NotificationType() B
type PayInvoiceRequest ¶
func NewPayInvoiceRequest ¶
func NewPayInvoiceRequest[V S | B](invoice V, amount Msat) PayInvoiceRequest
func (PayInvoiceRequest) MarshalJSON ¶
func (p PayInvoiceRequest) MarshalJSON(dst B) (b B, err E)
Example ¶
ir := NewPayInvoiceRequest("lnbc50n1...", 0) var b B var err E if b, err = ir.MarshalJSON(b); chk.E(err) { return } fmt.Printf("%s\n", b) b = b[:0] ir = NewPayInvoiceRequest("lnbc50n1...", 123) if b, err = ir.MarshalJSON(b); chk.E(err) { return } fmt.Printf("%s\n", b)
Output: {"method":"pay_invoice","params":{"invoice":"lnbc50n1..."}} {"method":"pay_invoice","params":{"invoice":"lnbc50n1...","amount":123}}
func (PayInvoiceRequest) UnmarshalJSON ¶
func (p PayInvoiceRequest) UnmarshalJSON(b B) (r B, err E)
type PayInvoiceResponse ¶
func NewPayInvoiceResponse ¶
func NewPayInvoiceResponse(preimage B, feesPaid Msat) PayInvoiceResponse
func (PayInvoiceResponse) MarshalJSON ¶
func (p PayInvoiceResponse) MarshalJSON(dst B) (b B, err E)
func (PayInvoiceResponse) UnmarshalJSON ¶
func (p PayInvoiceResponse) UnmarshalJSON(b B) (r B, err E)
type PayKeysendRequest ¶
type PayKeysendRequest struct { Request Amount Msat Pubkey B Preimage B // optional TLVRecords []TLV // optional }
func NewPayKeysendRequest ¶
func NewPayKeysendRequest(amount Msat, pubkey, preimage B, tlvRecords []TLV) PayKeysendRequest
type PayKeysendResponse ¶
type PayKeysendResponse = PayInvoiceResponse
func NewPayKeysendResponse ¶
func NewPayKeysendResponse(preimage B, feesPaid Msat) PayKeysendResponse
type PaymentReceivedNotification ¶
type PaymentReceivedNotification struct {
LookupInvoiceResponse
}
type PaymentSentNotification ¶
type PaymentSentNotification struct {
LookupInvoiceResponse
}
type Response ¶
func (Response) ResultType ¶
Click to show internal directories.
Click to hide internal directories.