toOperationBody method

  1. @override
XdrOperationBody toOperationBody()
override

Converts this operation to its XDR OperationBody representation.

Returns: XDR OperationBody for this manage sell offer operation.

Implementation

@override
XdrOperationBody toOperationBody() {
  XdrInt64 amount =
      new XdrInt64(Util.decimalStringToStroops(this.amount));
  Price price = Price.fromString(this.price);
  XdrUint64 offerId = XdrUint64(BigInt.parse(this.offerId));

  XdrOperationBody body =
      new XdrOperationBody(XdrOperationType.MANAGE_SELL_OFFER);
  body.manageSellOfferOp = new XdrManageSellOfferOp(
      selling.toXdr(), buying.toXdr(), amount, price.toXdr(), offerId);
  ;

  return body;
}