Documentation ¶
Overview ¶
Package node contains imperative library code for running a go-nitro node inside another application.
Index ¶
- type Node
- func (n *Node) Close() error
- func (n *Node) CloseLedgerChannel(channelId types.Destination) (protocols.ObjectiveId, error)
- func (n *Node) ClosePaymentChannel(channelId types.Destination) (protocols.ObjectiveId, error)
- func (n *Node) CompletedObjectives() <-chan protocols.ObjectiveId
- func (n *Node) CreateLedgerChannel(Counterparty types.Address, ChallengeDuration uint32, outcome outcome.Exit) (directfund.ObjectiveResponse, error)
- func (n *Node) CreatePaymentChannel(Intermediaries []types.Address, CounterParty types.Address, ...) (virtualfund.ObjectiveResponse, error)
- func (n *Node) CreateVoucher(channelId types.Destination, amount *big.Int) (payments.Voucher, error)
- func (n *Node) FailedObjectives() <-chan protocols.ObjectiveId
- func (n *Node) GetAllLedgerChannels() ([]query.LedgerChannelInfo, error)
- func (n *Node) GetLastBlockNum() (uint64, error)
- func (n *Node) GetLedgerChannel(id types.Destination) (query.LedgerChannelInfo, error)
- func (n *Node) GetPaymentChannel(id types.Destination) (query.PaymentChannelInfo, error)
- func (n *Node) GetPaymentChannelsByLedger(ledgerId types.Destination) ([]query.PaymentChannelInfo, error)
- func (n *Node) LedgerUpdatedChan(ledgerId types.Destination) <-chan query.LedgerChannelInfo
- func (n *Node) LedgerUpdates() <-chan query.LedgerChannelInfo
- func (n *Node) ObjectiveCompleteChan(id protocols.ObjectiveId) <-chan struct{}
- func (n *Node) Pay(channelId types.Destination, amount *big.Int)
- func (n *Node) PaymentChannelUpdatedChan(ledgerId types.Destination) <-chan query.PaymentChannelInfo
- func (n *Node) PaymentUpdates() <-chan query.PaymentChannelInfo
- func (c *Node) ReceiveVoucher(v payments.Voucher) (payments.ReceiveVoucherSummary, error)
- func (n *Node) ReceivedVouchers() <-chan payments.Voucher
- func (n *Node) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
Node provides the interface for the consuming application
func New ¶
func New(messageService messageservice.MessageService, chainservice chainservice.ChainService, store store.Store, policymaker engine.PolicyMaker) Node
New is the constructor for a Node. It accepts a messaging service, a chain service, and a store as injected dependencies.
func (*Node) CloseLedgerChannel ¶
func (n *Node) CloseLedgerChannel(channelId types.Destination) (protocols.ObjectiveId, error)
CloseLedgerChannel attempts to close and defund the given directly funded channel.
func (*Node) ClosePaymentChannel ¶
func (n *Node) ClosePaymentChannel(channelId types.Destination) (protocols.ObjectiveId, error)
ClosePaymentChannel attempts to close and defund the given virtually funded channel.
func (*Node) CompletedObjectives ¶
func (n *Node) CompletedObjectives() <-chan protocols.ObjectiveId
CompletedObjectives returns a chan that receives a objective id whenever that objective is completed. Not suitable fo multiple subscribers.
func (*Node) CreateLedgerChannel ¶
func (n *Node) CreateLedgerChannel(Counterparty types.Address, ChallengeDuration uint32, outcome outcome.Exit) (directfund.ObjectiveResponse, error)
CreateLedgerChannel creates a directly funded ledger channel with the given counterparty. The channel will run under full consensus rules (it is not possible to provide a custom AppDefinition or AppData).
func (*Node) CreatePaymentChannel ¶
func (n *Node) CreatePaymentChannel(Intermediaries []types.Address, CounterParty types.Address, ChallengeDuration uint32, Outcome outcome.Exit) (virtualfund.ObjectiveResponse, error)
CreatePaymentChannel creates a virtual channel with the counterParty using ledger channels with the supplied intermediaries.
func (*Node) CreateVoucher ¶
func (n *Node) CreateVoucher(channelId types.Destination, amount *big.Int) (payments.Voucher, error)
CreateVoucher creates and returns a voucher for the given channelId which increments the redeemable balance by amount. It is the responsibility of the caller to send the voucher to the payee.
func (*Node) FailedObjectives ¶
func (n *Node) FailedObjectives() <-chan protocols.ObjectiveId
FailedObjectives returns a chan that receives an objective id whenever that objective has failed
func (*Node) GetAllLedgerChannels ¶
func (n *Node) GetAllLedgerChannels() ([]query.LedgerChannelInfo, error)
GetAllLedgerChannels returns all ledger channels.
func (*Node) GetLastBlockNum ¶ added in v0.1.1
GetLastBlockNum returns last confirmed blockNum read from store
func (*Node) GetLedgerChannel ¶
func (n *Node) GetLedgerChannel(id types.Destination) (query.LedgerChannelInfo, error)
GetLedgerChannel returns the ledger channel with the given id. If no ledger channel exists with the given id an error is returned.
func (*Node) GetPaymentChannel ¶
func (n *Node) GetPaymentChannel(id types.Destination) (query.PaymentChannelInfo, error)
GetPaymentChannel returns the payment channel with the given id. If no ledger channel exists with the given id an error is returned.
func (*Node) GetPaymentChannelsByLedger ¶
func (n *Node) GetPaymentChannelsByLedger(ledgerId types.Destination) ([]query.PaymentChannelInfo, error)
GetPaymentChannelsByLedger returns all active payment channels that are funded by the given ledger channel.
func (*Node) LedgerUpdatedChan ¶
func (n *Node) LedgerUpdatedChan(ledgerId types.Destination) <-chan query.LedgerChannelInfo
LedgerUpdatedChan returns a chan that receives a ledger channel info whenever the ledger with given id is updated
func (*Node) LedgerUpdates ¶
func (n *Node) LedgerUpdates() <-chan query.LedgerChannelInfo
LedgerUpdates returns a chan that receives ledger channel info whenever that ledger channel is updated. Not suitable for multiple subscribers.
func (*Node) ObjectiveCompleteChan ¶
func (n *Node) ObjectiveCompleteChan(id protocols.ObjectiveId) <-chan struct{}
ObjectiveCompleteChan returns a chan that is closed when the objective with given id is completed
func (*Node) Pay ¶
func (n *Node) Pay(channelId types.Destination, amount *big.Int)
Pay will send a signed voucher to the payee that they can redeem for the given amount.
func (*Node) PaymentChannelUpdatedChan ¶
func (n *Node) PaymentChannelUpdatedChan(ledgerId types.Destination) <-chan query.PaymentChannelInfo
PaymentChannelUpdatedChan returns a chan that receives a payment channel info whenever the payment channel with given id is updated
func (*Node) PaymentUpdates ¶
func (n *Node) PaymentUpdates() <-chan query.PaymentChannelInfo
PaymentUpdates returns a chan that receives payment channel info whenever that payment channel is updated. Not suitable fo multiple subscribers.
func (*Node) ReceiveVoucher ¶
ReceiveVoucher receives a voucher and returns the amount that was paid. It can be used to add a voucher that was sent outside of the go-nitro system.
func (*Node) ReceivedVouchers ¶
ReceivedVouchers returns a chan that receives a voucher every time we receive a payment voucher
Directories ¶
Path | Synopsis |
---|---|
Package engine contains the types and imperative code for the business logic of a go-nitro Node.
|
Package engine contains the types and imperative code for the business logic of a go-nitro Node. |
chainservice
Package chainservice is a chain service responsible for submitting blockchain transactions and relaying blockchain events.
|
Package chainservice is a chain service responsible for submitting blockchain transactions and relaying blockchain events. |
chainservice/adjudicator
package NitroAdjudicator contains bindings generated from the Nitro Adjudicator solidity contract, as well as utilities for converting client types to on-chain types.
|
package NitroAdjudicator contains bindings generated from the Nitro Adjudicator solidity contract, as well as utilities for converting client types to on-chain types. |
messageservice
Package messageservice is a messaging service responsible for routing messages to peers and relaying messages received from peers.
|
Package messageservice is a messaging service responsible for routing messages to peers and relaying messages received from peers. |
store
Package store contains the interface for a go-nitro store.
|
Package store contains the interface for a go-nitro store. |