Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateGetPaymentChannelRequest(req GetPaymentChannelRequest) error
- func ValidateGetPaymentChannelsByLedgerRequest(req GetPaymentChannelsByLedgerRequest) error
- func ValidatePaymentRequest(req PaymentRequest) error
- type AuthRequest
- type GetAllLedgersResponse
- type GetLedgerChannelRequest
- type GetPaymentChannelRequest
- type GetPaymentChannelsByLedgerRequest
- type GetPaymentChannelsByLedgerResponse
- type JsonRpcError
- type JsonRpcErrorResponse
- type JsonRpcGeneralRequest
- type JsonRpcGeneralResponse
- type JsonRpcSpecificRequest
- type JsonRpcSuccessResponse
- type NoPayloadRequest
- type NotificationMethod
- type NotificationOrRequest
- type NotificationPayload
- type Params
- type PaymentRequest
- type RequestMethod
- type RequestPayload
- type ResponsePayload
Constants ¶
View Source
const JsonRpcVersion = "2.0"
Variables ¶
View Source
var ( ParseError = JsonRpcError{Code: -32700, Message: "Parse error"} InvalidRequestError = JsonRpcError{Code: -32600, Message: "Invalid Request"} MethodNotFoundError = JsonRpcError{Code: -32601, Message: "Method not found"} InvalidParamsError = JsonRpcError{Code: -32602, Message: "Invalid params"} InternalServerError = JsonRpcError{Code: -32603, Message: "Internal error"} RequestUnmarshalError = JsonRpcError{Code: -32010, Message: "Could not unmarshal request object"} ParamsUnmarshalError = JsonRpcError{Code: -32009, Message: "Could not unmarshal params object"} InvalidAuthTokenError = JsonRpcError{Code: -32008, Message: "Invalid auth token"} )
Functions ¶
func ValidateGetPaymentChannelRequest ¶
func ValidateGetPaymentChannelRequest(req GetPaymentChannelRequest) error
func ValidateGetPaymentChannelsByLedgerRequest ¶
func ValidateGetPaymentChannelsByLedgerRequest(req GetPaymentChannelsByLedgerRequest) error
func ValidatePaymentRequest ¶
func ValidatePaymentRequest(req PaymentRequest) error
Types ¶
type AuthRequest ¶
type AuthRequest struct {
Id string
}
type GetAllLedgersResponse ¶
type GetAllLedgersResponse = []query.LedgerChannelInfo
type GetLedgerChannelRequest ¶
type GetLedgerChannelRequest struct {
Id types.Destination
}
type GetPaymentChannelRequest ¶
type GetPaymentChannelRequest struct {
Id types.Destination
}
type GetPaymentChannelsByLedgerRequest ¶
type GetPaymentChannelsByLedgerRequest struct {
LedgerId types.Destination
}
type GetPaymentChannelsByLedgerResponse ¶
type GetPaymentChannelsByLedgerResponse = []query.PaymentChannelInfo
type JsonRpcError ¶
type JsonRpcError struct { Code int64 `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
func (JsonRpcError) Error ¶
func (e JsonRpcError) Error() string
type JsonRpcErrorResponse ¶
type JsonRpcErrorResponse struct { Jsonrpc string `json:"jsonrpc"` Id uint64 `json:"id"` Error JsonRpcError `json:"error"` }
func NewJsonRpcErrorResponse ¶
func NewJsonRpcErrorResponse(requestId uint64, error JsonRpcError) *JsonRpcErrorResponse
type JsonRpcGeneralRequest ¶
type JsonRpcGeneralResponse ¶
type JsonRpcGeneralResponse struct { Jsonrpc string `json:"jsonrpc"` Id uint64 `json:"id"` Error JsonRpcError `json:"error"` Result interface{} `json:"result"` }
type JsonRpcSpecificRequest ¶
type JsonRpcSpecificRequest[T RequestPayload | NotificationPayload] struct { Jsonrpc string `json:"jsonrpc"` Id uint64 `json:"id"` Method string `json:"method"` Params Params[T] `json:"params"` }
func NewJsonRpcSpecificRequest ¶
func NewJsonRpcSpecificRequest[T RequestPayload | NotificationPayload, U RequestMethod | NotificationMethod](requestId uint64, method U, objectiveRequest T, authToken string) *JsonRpcSpecificRequest[T]
type JsonRpcSuccessResponse ¶
type JsonRpcSuccessResponse[T ResponsePayload] struct { Jsonrpc string `json:"jsonrpc"` Id uint64 `json:"id"` Result T `json:"result"` }
func NewJsonRpcResponse ¶
func NewJsonRpcResponse[T ResponsePayload](requestId uint64, objectiveResponse T) *JsonRpcSuccessResponse[T]
type NoPayloadRequest ¶
type NoPayloadRequest = struct{}
type NotificationMethod ¶
type NotificationMethod string
const ( ObjectiveCompleted NotificationMethod = "objective_completed" LedgerChannelUpdated NotificationMethod = "ledger_channel_updated" PaymentChannelUpdated NotificationMethod = "payment_channel_updated" )
type NotificationOrRequest ¶
type NotificationOrRequest interface { RequestMethod | NotificationMethod }
type NotificationPayload ¶
type NotificationPayload interface { protocols.ObjectiveId | query.PaymentChannelInfo | query.LedgerChannelInfo }
type Params ¶
type Params[T RequestPayload | NotificationPayload] struct { AuthToken string `json:"authtoken"` Payload T `json:"payload"` }
type PaymentRequest ¶
type PaymentRequest struct { Amount uint64 Channel types.Destination }
type RequestMethod ¶
type RequestMethod string
const ( GetAuthTokenMethod RequestMethod = "get_auth_token" GetAddressMethod RequestMethod = "get_address" VersionMethod RequestMethod = "version" CreateLedgerChannelRequestMethod RequestMethod = "create_ledger_channel" CloseLedgerChannelRequestMethod RequestMethod = "close_ledger_channel" CreatePaymentChannelRequestMethod RequestMethod = "create_payment_channel" ClosePaymentChannelRequestMethod RequestMethod = "close_payment_channel" PayRequestMethod RequestMethod = "pay" GetPaymentChannelRequestMethod RequestMethod = "get_payment_channel" GetLedgerChannelRequestMethod RequestMethod = "get_ledger_channel" GetPaymentChannelsByLedgerMethod RequestMethod = "get_payment_channels_by_ledger" GetAllLedgerChannelsMethod RequestMethod = "get_all_ledger_channels" CreateVoucherRequestMethod RequestMethod = "create_voucher" ReceiveVoucherRequestMethod RequestMethod = "receive_voucher" )
type RequestPayload ¶
type RequestPayload interface { directfund.ObjectiveRequest | directdefund.ObjectiveRequest | virtualfund.ObjectiveRequest | virtualdefund.ObjectiveRequest | AuthRequest | PaymentRequest | GetLedgerChannelRequest | GetPaymentChannelRequest | GetPaymentChannelsByLedgerRequest | NoPayloadRequest | payments.Voucher }
type ResponsePayload ¶
type ResponsePayload interface { directfund.ObjectiveResponse | protocols.ObjectiveId | virtualfund.ObjectiveResponse | PaymentRequest | query.PaymentChannelInfo | query.LedgerChannelInfo | GetAllLedgersResponse | GetPaymentChannelsByLedgerResponse | payments.Voucher | common.Address | string | payments.ReceiveVoucherSummary }
Click to show internal directories.
Click to hide internal directories.