toOperationBody method

  1. @override
XdrOperationBody toOperationBody ()
override

Generates OperationBody XDR object.

Implementation

@override
XdrOperationBody toOperationBody() {
  XdrManageSellOfferOp op = new XdrManageSellOfferOp();
  op.selling = selling.toXdr();
  op.buying = buying.toXdr();
  XdrInt64 amount = new XdrInt64();
  amount.int64 = Operation.toXdrAmount(this.amount);
  op.amount = amount;
  Price price = Price.fromString(this.price);
  op.price = price.toXdr();
  XdrUint64 offerId = new XdrUint64();
  offerId.uint64 = int.parse(this.offerId);
  op.offerID = offerId;

  XdrOperationBody body = new XdrOperationBody();
  body.discriminant = XdrOperationType.MANAGE_SELL_OFFER;
  body.manageSellOfferOp = op;

  return body;
}