ManageSellOfferOperation class
Creates, updates, or deletes a sell offer on the Stellar DEX.
ManageSellOffer creates an offer to sell a specific amount of one asset for another at a specified price. This is the sell-side equivalent of a limit order on a traditional exchange. You specify how much you want to sell and at what price, and the network matches it with compatible buy offers.
Use this operation when:
- Creating new sell orders on the DEX
- Updating existing sell offers
- Canceling sell offers (by setting amount to 0)
- Implementing trading functionality
Important notes:
- Setting offerId to 0 creates a new offer
- Using an existing offerId updates or deletes that offer
- Setting amount to 0 deletes the offer
- Price is specified as amount of buying per unit of selling
- The source account must have sufficient balance of the selling asset
- Offers can be partially filled
Example:
// Create a new sell offer: sell 100 USD for XLM at 2.5 XLM per USD
var usd = AssetTypeCreditAlphaNum4("USD", issuerAccountId);
var sellOffer = ManageSellOfferOperationBuilder(
usd,
Asset.native(),
"100.0", // Sell 100 USD
"2.5" // Price: 2.5 XLM per USD
).build();
// Update an existing offer
var updateOffer = ManageSellOfferOperationBuilder(
usd,
Asset.native(),
"150.0",
"2.6"
).setOfferId("12345").build();
// Cancel an offer
var cancelOffer = ManageSellOfferOperationBuilder(
usd,
Asset.native(),
"0", // Amount 0 cancels the offer
"2.5"
).setOfferId("12345").build();
See also:
- ManageBuyOfferOperation for creating buy offers
- CreatePassiveSellOfferOperation for passive offers
- Operation for general operation documentation
Constructors
Properties
- amount → String
-
Amount of selling being sold.
no setter
- buying → Asset
-
The asset being bought in this operation.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- offerId → String
-
The ID of the offer.
no setter
- price → String
-
Price of 1 unit of selling in terms of buying.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selling → Asset
-
The asset being sold in this operation.
no setter
- sourceAccount ↔ MuxedAccount?
-
Optional source account for this operation.
getter/setter pairinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toOperationBody(
) → XdrOperationBody -
Converts this operation to its XDR OperationBody representation.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
toXdr(
) → XdrOperation -
Converts this operation to its XDR representation.
inherited
-
toXdrBase64(
) → String -
Returns base64-encoded Operation XDR object from this operation.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
builder(
XdrManageSellOfferOp op) → ManageSellOfferOperationBuilder - Constructs a ManageSellOfferOperationBuilder from XDR.