Documentation ¶
Index ¶
- Constants
- func EncodeMoneysocketRequest(msg MoneysocketRequest, toEncode map[string]interface{}) error
- func FromText(payload []byte) (base.MoneysocketMessage, base.MessageType, error)
- type BaseMoneySocketRequest
- type Invoice
- type MoneysocketRequest
- type OpinionInvoice
- type Pay
- type PingRequest
- type Provider
- type Rendezvous
Constants ¶
const ( // UUIDKey is the key used when encoding json. UUIDKey = "request_uuid" // NameKey is the key used for encoding json. NameKey = "request_name" )
Variables ¶
This section is empty.
Functions ¶
func EncodeMoneysocketRequest ¶
func EncodeMoneysocketRequest(msg MoneysocketRequest, toEncode map[string]interface{}) error
EncodeMoneysocketRequest creates a moneysocket request.
func FromText ¶ added in v0.54.0
func FromText(payload []byte) (base.MoneysocketMessage, base.MessageType, error)
FromText converts a payload to a decoded moneysocket message TODO handle more elegantly.
Types ¶
type BaseMoneySocketRequest ¶
type BaseMoneySocketRequest struct { base.MoneysocketMessage // BaseUUID is the uuid of the request BaseUUID string // RequestType is the request type RequestType base.MessageType }
BaseMoneySocketRequest is a moneysocket request.
func DecodeRequest ¶
func DecodeRequest(request []byte) (b BaseMoneySocketRequest, err error)
DecodeRequest decodes a base moneysocket request.
func NewBaseMoneySocketRequest ¶
func NewBaseMoneySocketRequest(requestType base.MessageType) BaseMoneySocketRequest
NewBaseMoneySocketRequest generates a new base moneysocket request. Should only be used by other message classes.
func (BaseMoneySocketRequest) MessageClass ¶
func (b BaseMoneySocketRequest) MessageClass() base.MessageClass
MessageClass is the base.MessageClass. This is always base.Request.
func (BaseMoneySocketRequest) MessageType ¶
func (b BaseMoneySocketRequest) MessageType() base.MessageType
MessageType gets the message type.
func (BaseMoneySocketRequest) RequestName ¶
func (b BaseMoneySocketRequest) RequestName() string
RequestName gets the request name from the MessageClass.
func (BaseMoneySocketRequest) UUID ¶ added in v0.54.0
func (b BaseMoneySocketRequest) UUID() string
UUID is the uuid of the BaseMoneySocketRequest.
type Invoice ¶ added in v0.54.0
type Invoice struct { BaseMoneySocketRequest // Msats is the invoice amount Msats int64 }
Invoice request a given number of Msats.
func DecodeRequestInvoice ¶
DecodeRequestInvoice turns a byte slice into a request invoice, return an error if not possible.
func NewRequestInvoice ¶
NewRequestInvoice creates a new request for an invoice.
type MoneysocketRequest ¶
type MoneysocketRequest interface { base.MoneysocketMessage // UUID is the uuid of the of the request UUID() string // RequestName gets the request name RequestName() string // MessageType is the type of the message MessageType() base.MessageType }
MoneysocketRequest is an interface for requests.
type OpinionInvoice ¶ added in v0.54.0
type OpinionInvoice struct { BaseMoneySocketRequest // ItemID is the item we're invoicing for ItemID string }
OpinionInvoice is a request for payment of a given ItemId.
func DecodeRequestOpinionInvoice ¶
func DecodeRequestOpinionInvoice(payload []byte) (r OpinionInvoice, err error)
DecodeRequestOpinionInvoice decodes an OpinionInvoice from json.
func NewRequestOpinionInvoice ¶
func NewRequestOpinionInvoice(itemID, requestUUID string) OpinionInvoice
NewRequestOpinionInvoice creates a new OpinionInvoice.
func (OpinionInvoice) ToJSON ¶ added in v0.54.0
func (r OpinionInvoice) ToJSON() ([]byte, error)
ToJSON encodes an OpinionInvoice to json.
type Pay ¶ added in v0.54.0
type Pay struct { BaseMoneySocketRequest Bolt11 string }
Pay is a payment request.
func DecodeRequestPay ¶
DecodeRequestPay decodes a Pay from json.
func NewRequestPay ¶
NewRequestPay creates a new request pay with a given bolt 11 bolt 11 is not validated client (moneysocket) side.
type PingRequest ¶
type PingRequest struct {
BaseMoneySocketRequest
}
PingRequest is a message type used for pinging.
func DecodePing ¶
func DecodePing(payload []byte) (PingRequest, error)
DecodePing gets a PingRequest from json.
func (PingRequest) ToJSON ¶ added in v0.54.0
func (p PingRequest) ToJSON() ([]byte, error)
ToJSON encodes a PingRequest to json.
type Provider ¶ added in v0.54.0
type Provider struct {
BaseMoneySocketRequest
}
Provider is a provider message.
func DecodeRequestProvider ¶
DecodeRequestProvider decode a request provider from json.
func NewRequestProvider ¶
func NewRequestProvider() Provider
NewRequestProvider creates a Provider for messages of base.ProviderRequest type.
type Rendezvous ¶ added in v0.54.0
type Rendezvous struct { BaseMoneySocketRequest // RendezvousID is the id of the rendezvous we're requesting (normally derived from the shared seed) RendezvousID string }
Rendezvous is a rendezvous request.
func DecodeRendezvousRequest ¶
func DecodeRendezvousRequest(payload []byte) (r Rendezvous, err error)
DecodeRendezvousRequest decodes a Rendezvous request from a payload.
func NewRendezvousRequest ¶
func NewRendezvousRequest(id string) Rendezvous
NewRendezvousRequest is the request the server start a rendezvous w/ a given rendezvous id.
func (Rendezvous) MustBeClearText ¶ added in v0.54.0
func (r Rendezvous) MustBeClearText() bool
MustBeClearText determines that a rendezvous message can be a clear text message.
func (Rendezvous) ToJSON ¶ added in v0.54.0
func (r Rendezvous) ToJSON() ([]byte, error)
ToJSON marshals the Rendezvous message.