Documentation
¶
Index ¶
- type OrderBookGraph
- func (graph *OrderBookGraph) AddOffer(offer xdr.OfferEntry) *OrderBookGraph
- func (graph *OrderBookGraph) Apply() error
- func (graph *OrderBookGraph) FindPaths(maxPathLength int, destinationAsset xdr.Asset, destinationAmount xdr.Int64, ...) ([]Path, error)
- func (graph *OrderBookGraph) RemoveOffer(offerID xdr.Int64) *OrderBookGraph
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderBookGraph ¶
type OrderBookGraph struct {
// contains filtered or unexported fields
}
OrderBookGraph is an in memory graph representation of all the offers in the stellar ledger
func NewOrderBookGraph ¶
func NewOrderBookGraph() *OrderBookGraph
NewOrderBookGraph constructs a new OrderBookGraph
func (*OrderBookGraph) AddOffer ¶
func (graph *OrderBookGraph) AddOffer(offer xdr.OfferEntry) *OrderBookGraph
AddOffer will queue an operation to add the given offer to the order book in the internal batch. You need to run Apply() to apply all enqueued operations.
func (*OrderBookGraph) Apply ¶
func (graph *OrderBookGraph) Apply() error
Apply will attempt to apply all the updates in the internal batch to the order book. When Apply is successful, a new empty, instance of internal batch will be created.
func (*OrderBookGraph) FindPaths ¶
func (graph *OrderBookGraph) FindPaths( maxPathLength int, destinationAsset xdr.Asset, destinationAmount xdr.Int64, sourceAccountID xdr.AccountId, sourceAssets []xdr.Asset, sourceAssetBalances []xdr.Int64, maxAssetsPerPath int, ) ([]Path, error)
FindPaths returns a list of payment paths originating from a source account and ending with a given destinaton asset and amount.
func (*OrderBookGraph) RemoveOffer ¶
func (graph *OrderBookGraph) RemoveOffer(offerID xdr.Int64) *OrderBookGraph
RemoveOffer will queue an operation to remove the given offer from the order book in the internal batch. You need to run Apply() to apply all enqueued operations.