Documentation ¶
Index ¶
- Variables
- type Client
- 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 Notification
- type Notifier
- type PayInvoiceRequest
- type PayInvoiceResponse
- type PayKeysendRequest
- type PayKeysendResponse
- type PaymentReceivedNotification
- type PaymentSentNotification
- type Request
- type Requester
- type Response
- type Resulter
- type Server
- type TLV
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PaymentSent = by("payment_sent") PaymentReceived = by("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 by }{ by("RATE_LIMITED"), by("NOT_IMPLEMENTED"), by("INSUFFICIENT_BALANCE"), by("QUOTA_EXCEEDED"), by("RESTRICTED"), by("UNAUTHORIZED"), by("INTERNAL"), by("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 by
}{
by("method"),
by("params"),
by("result_type"),
by("error"),
by("result"),
by("invoice"),
by("amount"),
by("preimage"),
by("fees_paid"),
by("id"),
by("tlv_records"),
by("type"),
by("value"),
by("pubkey"),
by("description"),
by("description_hash"),
by("expiry"),
by("created_at"),
by("expires_at"),
by("metadata"),
by("settled_at"),
by("from"),
by("until"),
by("offset"),
by("unpaid"),
by("balance"),
by("notifications"),
by("notification_type"),
by("notification"),
by("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 by
}{
by("pay_invoice"),
by("multi_pay_invoice"),
by("pay_keysend"),
by("multi_pay_keysend"),
by("make_invoice"),
by("lookup_invoice"),
by("list_transactions"),
by("get_balance"),
by("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 by
}{
by("payment_received"),
by("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 GetInfo ¶
type GetInfo struct { Alias by Color by // Hex string Pubkey by Network by // mainnet/testnet/signet/regtest BlockHeight uint64 BlockHash by Methods by // pay_invoice, get_balance, make_invoice, lookup_invoice, list_transactions, get_info (list of methods) }
type GetInfoRequest ¶
type GetInfoRequest struct {
Request
}
func NewGetInfoRequest ¶
func NewGetInfoRequest() GetInfoRequest
type GetInfoResponse ¶
func NewGetInfoResponse ¶
func NewGetInfoResponse(gi GetInfo) GetInfoResponse
type Invoice ¶
type Invoice struct { Id by // nil for request, required for responses (omitted if nil) Invoice by Amount Msat // optional, omitted if zero }
type InvoiceResponse ¶
type InvoiceResponse struct { Type by // incoming or outgoing Invoice by // optional Description by // optional DescriptionHash by // optional Preimage by // optional if unpaid PaymentHash by 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 ¶
type LookupInvoiceRequest struct { Request PaymentHash, Invoice by }
func NewLookupInvoiceRequest ¶
func NewLookupInvoiceRequest(paymentHash, invoice by) *LookupInvoiceRequest
type LookupInvoiceResponse ¶
type LookupInvoiceResponse struct { Response LookupInvoice }
func NewLookupInvoiceResponse ¶
func NewLookupInvoiceResponse(resp LookupInvoice) LookupInvoiceResponse
type MakeInvoiceRequest ¶
type MakeInvoiceRequest struct { Request Amount Msat Description by // optional DescriptionHash by // optional Expiry no // optional }
func NewMakeInvoiceRequest ¶
func NewMakeInvoiceRequest(amount Msat, description, descriptionHash by, expiry no) 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 by, 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 by, feesPaid Msat) MultiPayKeysendResponse
type Notification ¶
type Notification struct {
Type by
}
func (Notification) NotificationType ¶
func (n Notification) NotificationType() by
type PayInvoiceRequest ¶
func NewPayInvoiceRequest ¶
func NewPayInvoiceRequest[V st | by](invoice V, amount Msat) PayInvoiceRequest
func (PayInvoiceRequest) MarshalJSON ¶
func (p PayInvoiceRequest) MarshalJSON(dst by) (b by, err er)
Example ¶
ir := NewPayInvoiceRequest("lnbc50n1...", 0) var b by var err er 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 by) (r by, err er)
type PayInvoiceResponse ¶
func NewPayInvoiceResponse ¶
func NewPayInvoiceResponse(preimage by, feesPaid Msat) PayInvoiceResponse
func (PayInvoiceResponse) MarshalJSON ¶
func (p PayInvoiceResponse) MarshalJSON(dst by) (b by, err er)
func (PayInvoiceResponse) UnmarshalJSON ¶
func (p PayInvoiceResponse) UnmarshalJSON(b by) (r by, err er)
type PayKeysendRequest ¶
type PayKeysendRequest struct { Request Amount Msat Pubkey by Preimage by // optional TLVRecords []TLV // optional }
func NewPayKeysendRequest ¶
func NewPayKeysendRequest(amount Msat, pubkey, preimage by, tlvRecords []TLV) PayKeysendRequest
type PayKeysendResponse ¶
type PayKeysendResponse = PayInvoiceResponse
func NewPayKeysendResponse ¶
func NewPayKeysendResponse(preimage by, feesPaid Msat) PayKeysendResponse
type PaymentReceivedNotification ¶
type PaymentReceivedNotification struct {
LookupInvoiceResponse
}
type PaymentSentNotification ¶
type PaymentSentNotification struct {
LookupInvoiceResponse
}
type Request ¶
type Request struct {
Method by
}
func (Request) RequestType ¶
func (r Request) RequestType() by
Click to show internal directories.
Click to hide internal directories.