ManageBuyOfferOperation

public class ManageBuyOfferOperation : ManageOfferOperation, @unchecked Sendable

Represents a Stellar manage buy offer operation creating or modifying offers with fixed buy amounts.

  • Creates a new ManageOfferOperation object.

    Declaration

    Swift

    public override init(sourceAccountId: String?, selling: Asset, buying: Asset, amount: Decimal, price: Price, offerId: Int64)

    Parameters

    sourceAccountId

    (optional) source account Id, must be valid, otherwise it will be ignored.

    selling

    Asset the offer creator is selling.

    buying

    Asset the offer creator is buying.

    amount

    Amount of buying being bought. Set to 0 if you want to delete an existing offer.

    price

    Price of 1 unit of buying in terms of selling. For example, if you wanted to buy 30 XLM and sell 5 BTC, the price would be {numerator, denominator} = {5,30}.

    offerId

    The ID of the offer. 0 for new offer. Set to existing offer ID to update or delete. If you want to update an existing offer set Offer ID to existing offer ID. If you want to delete an existing offer set Offer ID to existing offer ID and set Amount to 0.

  • Creates a new ManageBuyOfferOperation object from the given ManageOfferOperationXDR object.

    Declaration

    Swift

    public override init(fromXDR: ManageOfferOperationXDR, sourceAccountId: String?)

    Parameters

    fromXDR

    the ManageOfferOperationXDR object to be used to create a new ManageBuyOfferOperation object.

    sourceAccountId

    (optional) source account Id, must be valid, otherwise it will be ignored.