EffectsRequestBuilder class
Builds requests to query effects from Horizon.
Effects represent specific changes to the ledger state resulting from operations. Examples include account credited, account debited, signer created, trustline created, trade executed, and many others. Each operation can produce multiple effects.
This builder supports filtering effects by account, ledger, transaction, operation, or liquidity pool. It also supports streaming effects via Server-Sent Events and pagination through result sets.
Example:
// Get effects for a specific account
final effects = await sdk.effects
.forAccount('GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B')
.order(RequestBuilderOrder.DESC)
.limit(10)
.execute();
// Get effects for a specific operation
final opEffects = await sdk.effects
.forOperation('operation_id')
.execute();
// Stream effects in real-time
sdk.effects
.forAccount('account_id')
.cursor('now')
.stream()
.listen((effect) {
print('New effect: ${effect.type}');
});
See also:
- Stellar developer docs
- EffectResponse for response structure
- Inheritance
-
- Object
- RequestBuilder
- EffectsRequestBuilder
Constructors
- EffectsRequestBuilder(Client httpClient, Uri serverURI)
- Creates an EffectsRequestBuilder for querying operation effects from Horizon.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClient ↔ Client
-
getter/setter pairinherited
-
queryParameters
↔ Map<
String, String> -
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uriBuilder ↔ Uri
-
getter/setter pairinherited
Methods
-
buildUri(
) → Uri -
Constructs the complete URI for the API request.
inherited
-
cursor(
String token) → EffectsRequestBuilder -
Sets the cursor for pagination to start returning records from a specific point.
Returns this builder for method chaining.
override
-
encodeAsset(
Asset asset) → String -
Encodes an asset to its string representation for API requests.
inherited
-
encodeAssets(
List< Asset> assets) → String -
Encodes a list of assets to comma-separated string for API requests.
inherited
-
execute(
) → Future< Page< EffectResponse> > - Build and execute the request.
-
forAccount(
String accountId) → EffectsRequestBuilder -
Effects request builder of a specific account given by
accountId. See: Stellar developer docs -
forLedger(
int ledgerSeq) → EffectsRequestBuilder -
Effects request builder of a specific ledger given by
ledgerSeq. See: Effects for Ledger -
forLiquidityPool(
String poolId) → EffectsRequestBuilder -
Effects request builder for a specific liquidity pool identified by
poolId. The pool ID can be provided in either hex format or Stellar-encoded format (starting with 'L'). See: Stellar developer docs -
forOperation(
String operationId) → EffectsRequestBuilder -
Effects request builder of a specific operation given by
operationId. See: Stellar developer docs -
forTransaction(
String transactionId) → EffectsRequestBuilder -
Effects request builder of a specific transaction given by
transactionId. See: Stellar developer docs -
limit(
int number) → EffectsRequestBuilder -
Sets the maximum number of records to return in a single page.
Returns this builder for method chaining.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
order(
RequestBuilderOrder direction) → EffectsRequestBuilder -
Sets the sort order for returned records (ascending or descending).
Returns this builder for method chaining.
override
-
setSegments(
List< String> segments) → RequestBuilder -
Sets the URL path segments for this request.
inherited
-
stream(
) → Stream< EffectResponse> - Allows to stream SSE events from horizon. Certain endpoints in Horizon can be called in streaming mode using Server-Sent Events. This mode will keep the connection to horizon open and horizon will continue to return responses as ledgers close. See: Stellar developer docs
-
streamEvents<
T> (T fromJson(dynamic json)) → Stream< T> -
Opens a stream of Server-Sent Events on the URI built by this builder
and emits one
Tper received record, parsed withfromJson.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
requestExecute(
Client httpClient, Uri uri) → Future< Page< EffectResponse> > -
Requests specific
uriand returns Page of EffectResponse. This method is helpful for getting the next set of results.override