ManageOfferOperation

public class ManageOfferOperation : Operation, @unchecked Sendable

Represents a manage offer operation. Creates, updates, or deletes an offer. See Stellar developer docs

  • The asset being sold.

    Declaration

    Swift

    public let selling: Asset
  • The asset being bought.

    Declaration

    Swift

    public let buying: Asset
  • Amount of selling asset to sell. Set to 0 to delete an existing offer.

    Declaration

    Swift

    public let amount: Decimal
  • Price of 1 unit of selling in terms of buying.

    Declaration

    Swift

    public let price: Price
  • The ID of the offer. 0 for new offer. Set to existing offer ID to update or delete.

    Declaration

    Swift

    public let offerId: Int64
  • Creates a new ManageOfferOperation object.

    Declaration

    Swift

    public 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 selling being sold. Set to 0 if you want to delete an existing offer.

    price

    Price of 1 unit of selling in terms of buying. For example, if you wanted to sell 30 XLM and buy 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 ManageOfferOperation object from the given ManageOfferOperationXDR object.

    Declaration

    Swift

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

    Parameters

    fromXDR

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

    sourceAccountId

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