Class

OperationCallBuilder

(private) OperationCallBuilder(serverUrl)

Creates a new OperationCallBuilder pointed to server defined by serverUrl.

Do not create this object directly, use Horizon.Server#operations.

Constructor

# private new OperationCallBuilder(serverUrl)

Parameters:
Name Type Description
serverUrl string

Horizon server URL.

See:

View Source lib/horizon/operation_call_builder.js, line 20

Extends

Members

# private _parseRecord

Given the json response, find and convert each link into a function that calls that link.

Overrides:

View Source lib/horizon/call_builder.d.ts, line 106

Convert a link object to a function that fetches that link.

Overrides:

View Source lib/horizon/call_builder.d.ts, line 97

Methods

# call() → {Promise}

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

Overrides:

View Source lib/horizon/call_builder.d.ts, line 14

a Promise that resolves to the server's response.

Promise

# cursor(cursor) → {object}

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

Parameters:
Name Type Description
cursor string

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

Overrides:
See:

View Source lib/horizon/call_builder.d.ts, line 35

current CallBuilder instance

object

# forAccount(accountId) → {OperationCallBuilder}

This endpoint represents all operations that were included in valid transactions that affected a particular account.

Parameters:
Name Type Description
accountId string

For example: GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD

See:

View Source lib/horizon/operation_call_builder.js, line 45

this OperationCallBuilder instance

# forClaimableBalance(claimableBalanceId) → {OperationCallBuilder}

This endpoint represents all operations that reference a given claimable_balance.

Parameters:
Name Type Description
claimableBalanceId string

Claimable Balance ID

See:

View Source lib/horizon/operation_call_builder.js, line 55

this OperationCallBuilder instance

# protected forEndpoint(endpoint, param) → {CallBuilder}

A helper method to craft queries to "neighbor" endpoints.

For example, we have an /effects suffix endpoint on many different "root" endpoints, such as /transactions/:id and /accounts/:id. So, it's helpful to be able to conveniently create queries to the /accounts/:id/effects endpoint:

this.forEndpoint("accounts", accountId)`.

Parameters:
Name Type Description
endpoint string

neighbor endpoint in question, like /operations

param string

filter parameter, like an operation ID

Overrides:

View Source lib/horizon/call_builder.d.ts, line 81

this CallBuilder instance

CallBuilder

# forLedger(sequence) → {OperationCallBuilder}

This endpoint returns all operations that occurred in a given ledger.

Parameters:
Name Type Description
sequence number | string

Ledger sequence

See:

View Source lib/horizon/operation_call_builder.js, line 66

this OperationCallBuilder instance

# forLiquidityPool(poolId) → {OperationCallBuilder}

This endpoint represents all operations involving a particular liquidity pool.

Parameters:
Name Type Description
poolId string

liquidity pool ID

View Source lib/horizon/operation_call_builder.js, line 86

this OperationCallBuilder instance

# forTransaction(transactionId) → {OperationCallBuilder}

This endpoint represents all operations that are part of a given transaction.

Parameters:
Name Type Description
transactionId string

Transaction ID

See:

View Source lib/horizon/operation_call_builder.js, line 76

this OperationCallBuilder instance

# includeFailed(value) → {OperationCallBuilder}

Adds a parameter defining whether to include failed transactions. By default, only operations of successful transactions are returned.

Parameters:
Name Type Description
value boolean

Set to true to include operations of failed transactions.

View Source lib/horizon/operation_call_builder.js, line 97

this OperationCallBuilder instance

# join("include") → {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.

Parameters:
Name Type Description
"include"

join Records to be included in the response.

Overrides:

View Source lib/horizon/call_builder.d.ts, line 63

current CallBuilder instance.

object

# limit(recordsNumber) → {object}

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

Parameters:
Name Type Description
recordsNumber number

Number of records the server should return.

Overrides:
See:

View Source lib/horizon/call_builder.d.ts, line 43

current CallBuilder instance

object

# operation(operationId) → {CallBuilder}

The operation details endpoint provides information on a single operation. The operation ID provided in the id argument specifies which operation to load.

Parameters:
Name Type Description
operationId number

Operation ID

See:

View Source lib/horizon/operation_call_builder.js, line 33

this OperationCallBuilder instance

CallBuilder

# order(direction) → {object}

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

Parameters:
Name Type Description
direction "asc" | "desc"

Sort direction

Overrides:

View Source lib/horizon/call_builder.d.ts, line 50

current CallBuilder instance

object

# 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.

Parameters:
Name Type Attributes Description
options object <optional>

EventSource options.

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.

Overrides:
See:

View Source lib/horizon/call_builder.d.ts, line 27

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

function