Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WaitForRequestNoAuth ¶
func WaitForRequestNoAuth[T serde.RequestPayload, U serde.ResponsePayload](rc *rpcClient, method serde.RequestMethod, requestData T) (U, error)
WaitForRequestNoAuth calls waitForRequest with an empty auth token
Types ¶
type RpcClientApi ¶
type RpcClientApi interface {
// Address returns the address of the nitro node
Address() (common.Address, error)
// CreateVoucher creates a voucher for the given channelId and amount and returns it.
// It is the responsibility of the caller to send the voucher to the payee.
CreateVoucher(chId types.Destination, amount uint64) (payments.Voucher, error)
// ReceiveVoucher receives a voucher and adds it to the go-nitro store.
// It returns the total amount received so far and the amount received from the voucher supplied.
// It can be used to add a voucher that was sent outside of the go-nitro system.
ReceiveVoucher(v payments.Voucher) (payments.ReceiveVoucherSummary, error)
// GetPaymentChannel returns the payment channel information for the given channelId
GetPaymentChannel(chId types.Destination) (query.PaymentChannelInfo, error)
// CreatePaymentChannel creates a new virtual payment channel with the specified intermediaries, counterparty, ChallengeDuration, and outcome
CreatePaymentChannel(intermediaries []types.Address, counterparty types.Address, ChallengeDuration uint32, outcome outcome.Exit) (virtualfund.ObjectiveResponse, error)
// ClosePaymentChannel attempts to close the payment channel with the specified channelId
ClosePaymentChannel(id types.Destination) (protocols.ObjectiveId, error)
// GetLedgerChannel returns the ledger channel information for the given channelId
GetLedgerChannel(id types.Destination) (query.LedgerChannelInfo, error)
// GetAllLedgerChannels returns information about all ledger channels
GetAllLedgerChannels() ([]query.LedgerChannelInfo, error)
// GetPaymentChannelsByLedger returns all active payment channels for a given ledger channel
GetPaymentChannelsByLedger(ledgerId types.Destination) ([]query.PaymentChannelInfo, error)
// CreateLedgerChannel creates a new ledger channel with the specified counterparty, ChallengeDuration, and outcome
CreateLedgerChannel(counterparty types.Address, ChallengeDuration uint32, outcome outcome.Exit) (directfund.ObjectiveResponse, error)
// CloseLedgerChannel attempts to close the ledger channel with the specified channelId
CloseLedgerChannel(id types.Destination) (protocols.ObjectiveId, error)
// Pay uses the specified channel to pay the specified amount
Pay(id types.Destination, amount uint64) (serde.PaymentRequest, error)
// Close shuts down the RpcClient and closes the underlying transport
Close() error
// ObjectiveCompleteChan returns a channel that receives an empty struct when the objective with the given id is completed
ObjectiveCompleteChan(id protocols.ObjectiveId) <-chan struct{}
// LedgerChannelUpdatesChan returns a channel that receives ledger channel updates for the given ledger channel id
LedgerChannelUpdatesChan(ledgerChannelId types.Destination) <-chan query.LedgerChannelInfo
// PaymentChannelUpdatesChan returns a channel that receives payment channel updates for the given payment channel id
PaymentChannelUpdatesChan(paymentChannelId types.Destination) <-chan query.PaymentChannelInfo
}
RpcClientApi provides various functions to make RPC API calls to a nitro RPC server
func NewHttpRpcClient ¶
func NewHttpRpcClient(rpcServerUrl string) (RpcClientApi, error)
NewHttpRpcClient creates a new rpcClient using an http transport
func NewRpcClient ¶
func NewRpcClient(trans transport.Requester) (RpcClientApi, error)
NewRpcClient creates a new RpcClient
type RpcServer ¶
type RpcServer struct {
// contains filtered or unexported fields
}
RpcServer handles nitro rpc requests and executes them on the nitro node
func NewRpcServer ¶
Click to show internal directories.
Click to hide internal directories.