paths

package
v0.0.0-...-fb9541f Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package paths provides utilities and facilities for payment paths as needed by horizon. Most importantly, it provides the Finder interface, allowing for pluggable path finding back ends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

type Finder interface {
	// Return a list of payment paths and the most recent ledger
	// for a Query of a maximum length `maxLength`. The payment paths
	// are accurate and consistent with the returned ledger sequence number
	Find(q Query, maxLength uint) ([]Path, uint32, error)
	// FindFixedPaths return a list of payment paths the most recent ledger
	// Each of the payment paths start by spending `amountToSpend` of `sourceAsset` and end
	// with delivering a postive amount of `destinationAsset`.
	// The payment paths are accurate and consistent with the returned ledger sequence number
	FindFixedPaths(
		sourceAsset xdr.Asset,
		amountToSpend xdr.Int64,
		destinationAssets []xdr.Asset,
		maxLength uint,
	) ([]Path, uint32, error)
}

Finder finds paths.

type Path

type Path struct {
	Path              []xdr.Asset
	Source            xdr.Asset
	SourceAmount      xdr.Int64
	Destination       xdr.Asset
	DestinationAmount xdr.Int64
}

Path is the result returned by a path finder and is tied to the DestinationAmount used in the input query

type Query

type Query struct {
	DestinationAsset    xdr.Asset
	DestinationAmount   xdr.Int64
	SourceAssets        []xdr.Asset
	SourceAssetBalances []xdr.Int64
	// if ValidateSourceBalance is true then we won't consider payment paths
	// which require a source asset amount which exceeds the balance present in `SourceAssetBalances`
	ValidateSourceBalance bool
	SourceAccount         *xdr.AccountId
}

Query is a query for paths

Jump to

Keyboard shortcuts

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