nut17

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONRPC_2   = "2.0"
	OK          = "OK"
	SUBSCRIBE   = "subscribe"
	UNSUBSCRIBE = "unsubscribe"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type InfoSetting

type InfoSetting struct {
	Supported []SupportedMethod `json:"supported"`
}

type NotificationParams

type NotificationParams struct {
	SubId   string          `json:"subId"`
	Payload json.RawMessage `json:"payload"`
}

type RequestParams

type RequestParams struct {
	Kind    string   `json:"kind"`
	SubId   string   `json:"subId"`
	Filters []string `json:"filters"`
}

type Result

type Result struct {
	Status string `json:"status"`
	SubId  string `json:"subId"`
}

type SubscriptionKind

type SubscriptionKind int
const (
	Bolt11MintQuote SubscriptionKind = iota
	Bolt11MeltQuote
	ProofState
	Unknown
)

func StringToKind

func StringToKind(kind string) SubscriptionKind

func (SubscriptionKind) String

func (kind SubscriptionKind) String() string

type SupportedMethod

type SupportedMethod struct {
	Method   string   `json:"method"`
	Unit     string   `json:"unit"`
	Commands []string `json:"commands"`
}

type WsError

type WsError struct {
	JsonRPC     string        `json:"jsonrpc"`
	ErrResponse ErrorResponse `json:"error"`
	Id          int           `json:"id"`
}

func NewWsError

func NewWsError(code int, message string, id int) WsError

func (WsError) Error

func (e WsError) Error() string

func (*WsError) UnmarshalJSON

func (e *WsError) UnmarshalJSON(data []byte) error

type WsNotification

type WsNotification struct {
	JsonRPC string             `json:"jsonrpc"`
	Method  string             `json:"method"`
	Params  NotificationParams `json:"params"`
}

func (*WsNotification) UnmarshalJSON

func (n *WsNotification) UnmarshalJSON(data []byte) error

type WsRequest

type WsRequest struct {
	JsonRPC string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  RequestParams `json:"params"`
	Id      int           `json:"id"`
}

type WsResponse

type WsResponse struct {
	JsonRPC string `json:"jsonrpc"`
	Result  Result `json:"result"`
	Id      int    `json:"id"`
}

func (*WsResponse) UnmarshalJSON

func (r *WsResponse) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL