PathCallBuilder

PathCallBuilder

The Stellar Network allows payments to be made across assets through path payments. A path payment specifies a series of assets to route a payment through, from source asset (the asset debited from the payer) to destination asset (the asset credited to the payee).

A path search is specified using:

  • The destination address
  • The source address
  • The asset and amount that the destination account should receive

As part of the search, horizon will load a list of assets available to the source address and will find any payment paths from those source assets to the desired destination asset. The search's amount parameter will be used to determine if there a given path can satisfy a payment of the desired amount.

Do not create this object directly, use Server#paths.

Constructor

new PathCallBuilder(serverUrl, source, destination, destinationAsset, destinationAmount)

Source:
See:
Parameters:
Name Type Description
serverUrl string

Horizon server URL.

source string

The sender's account ID. Any returned path must use a source that the sender can hold.

destination string

The destination account ID that any returned path should use.

destinationAsset Asset

The destination asset.

destinationAmount string

The amount, denominated in the destination asset, that any returned path should be able to satisfy.

Extends

Methods

call() → {Promise}

Triggers a HTTP request using this builder's current configuration.

Inherited From:
Source:
Returns:
Type:
Promise

a Promise that resolves to the server's response.

cursor(cursor) → {object}

Sets cursor parameter for the current call. Returns the CallBuilder object on which this method has been called.

Inherited From:
Source:
See:
Parameters:
Name Type Description
cursor string

A cursor is a value that points to a specific location in a collection of resources.

Returns:
Type:
object

current CallBuilder instance

join(join) → {object}

Sets join parameter for the current call. The join parameter includes the requested resource in the response. Currently, the only valid value for the parameter is transactions and is only supported on the operations and payments endpoints. The response will include a transaction field for each operation in the response.

Inherited From:
Source:
Parameters:
Name Type Description
join "transactions"

Records to be included in the response.

Returns:
Type:
object

current CallBuilder instance.

limit(number) → {object}

Sets limit parameter for the current call. Returns the CallBuilder object on which this method has been called.

Inherited From:
Source:
See:
Parameters:
Name Type Description
number number

Number of records the server should return.

Returns:
Type:
object

current CallBuilder instance

order(direction) → {object}

Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.

Inherited From:
Source:
Parameters:
Name Type Description
direction "asc" | "desc"

Sort direction

Returns:
Type:
object

current CallBuilder instance

stream(optionsopt) → {function}

Creates an EventSource that listens for incoming messages from the server. To stop listening for new events call the function returned by this method.

Inherited From:
Source:
See:
Parameters:
Name Type Attributes Description
options object <optional>

EventSource options.

Name Type Attributes Description
onmessage function <optional>

Callback function to handle incoming messages.

onerror function <optional>

Callback function to handle errors.

reconnectTimeout number <optional>

Custom stream connection timeout in ms, default is 15 seconds.

Returns:
Type:
function

Close function. Run to close the connection and stop listening for new events.