TradeEffectResponse class
Represents a trade effect response from Horizon.
This effect occurs when assets are exchanged on the Stellar decentralized exchange (DEX). Trades can be triggered by offer management operations or path payment operations.
Triggered by: ManageBuyOfferOperation, ManageSellOfferOperation, PathPaymentStrictSendOperation, PathPaymentStrictReceiveOperation Returned by: Horizon API effects endpoint when querying for trade effects
Example:
final effects = await sdk.effects.forAccount('account_id').execute();
for (var effect in effects.records) {
if (effect is TradeEffectResponse) {
print('Trade: sold ${effect.soldAmount} ${effect.soldAssetCode ?? "XLM"}');
print(' bought ${effect.boughtAmount} ${effect.boughtAssetCode ?? "XLM"}');
}
}
See also:
- ManageBuyOfferOperation and ManageSellOfferOperation for creating offers
- PathPaymentStrictSendOperation and PathPaymentStrictReceiveOperation for path payments
- Stellar developer docs
- Inheritance
-
- Object
- Response
- EffectResponse
- TradeEffectResponse
Constructors
- TradeEffectResponse(String seller, String? sellerMuxed, String? sellerMuxedId, String offerId, String soldAmount, String soldAssetType, String? soldAssetCode, String? soldAssetIssuer, String boughtAmount, String boughtAssetType, String? boughtAssetCode, String? boughtAssetIssuer, String id, int type_i, String type, String createdAt, String pagingToken, String account, EffectResponseLinks links)
- Creates a TradeEffectResponse with seller, offer ID, sold and bought asset details.
-
TradeEffectResponse.fromJson(Map<
String, dynamic> json) -
Creates a trade effect from Horizon API JSON response.
factory
Properties
- account ↔ String
-
Account ID affected by this effect
getter/setter pairinherited
- accountMuxed ↔ String?
-
Muxed account address if the account is a muxed account
getter/setter pairinherited
- accountMuxedId ↔ String?
-
Muxed account sub-account ID if applicable
getter/setter pairinherited
- boughtAmount ↔ String
-
Amount of asset bought
getter/setter pair
- boughtAsset → Asset
-
Returns the bought asset as an Asset object.
no setter
- boughtAssetCode ↔ String?
-
Code of asset bought (e.g., 'USD', 'EUR'), null for native XLM
getter/setter pair
- boughtAssetIssuer ↔ String?
-
Issuer of asset bought, null for native XLM
getter/setter pair
- boughtAssetType ↔ String
-
Type of asset bought ('native', 'credit_alphanum4', or 'credit_alphanum12')
getter/setter pair
- createdAt ↔ String
-
When this effect occurred in ISO 8601 format
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ String
-
Unique identifier for this effect
getter/setter pairinherited
- links ↔ EffectResponseLinks
-
Links to related resources
getter/setter pairinherited
- offerId ↔ String
-
The ID of the offer that was filled
getter/setter pair
- pagingToken ↔ String
-
Cursor for pagination
getter/setter pairinherited
- rateLimitLimit ↔ int?
-
Maximum number of requests allowed in the current rate limit window.
getter/setter pairinherited
- rateLimitRemaining ↔ int?
-
Number of requests remaining in the current rate limit window.
getter/setter pairinherited
- rateLimitReset ↔ int?
-
Unix timestamp when the rate limit window will reset.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seller ↔ String
-
The account ID of the seller
getter/setter pair
- sellerMuxed ↔ String?
-
The muxed account address of the seller, if using muxed accounts
getter/setter pair
- sellerMuxedId ↔ String?
-
The muxed account ID of the seller, if using muxed accounts
getter/setter pair
- soldAmount ↔ String
-
Amount of asset sold
getter/setter pair
- soldAsset → Asset
-
Returns the sold asset as an Asset object.
no setter
- soldAssetCode ↔ String?
-
Code of asset sold (e.g., 'USD', 'EUR'), null for native XLM
getter/setter pair
- soldAssetIssuer ↔ String?
-
Issuer of asset sold, null for native XLM
getter/setter pair
- soldAssetType ↔ String
-
Type of asset sold ('native', 'credit_alphanum4', or 'credit_alphanum12')
getter/setter pair
- type ↔ String
-
Human-readable effect type name
getter/setter pairinherited
- type_i ↔ int
-
Effect type as integer code
getter/setter pairinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setHeaders(
Map< String, String> headers) → void -
Populates rate limit fields from HTTP response headers.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited