public override sdkxdr.Operation.OperationBody ToOperationBody() { var op = new sdkxdr.ManageOfferOp(); op.Selling = Selling.ToXdr(); op.Buying = Buying.ToXdr(); var amount = new sdkxdr.Int64(); amount.InnerValue = ToXdrAmount(Amount); op.Amount = amount; var price = stellar_dotnetcore_sdk.Price.FromString(Price); op.Price = price.ToXdr(); var offerId = new sdkxdr.Uint64(); offerId.InnerValue = OfferId; op.OfferID = offerId; var body = new sdkxdr.Operation.OperationBody(); body.Discriminant = sdkxdr.OperationType.Create(sdkxdr.OperationType.OperationTypeEnum.MANAGE_OFFER); body.ManageOfferOp = op; return(body); }
/// <summary> /// Construct a new CreateAccount builder from a CreateAccountOp XDR. /// </summary> /// <param name="op"> /// <see cref="sdkxdr.ManageOfferOp" /> /// </param> public Builder(sdkxdr.ManageOfferOp op) { _Selling = Asset.FromXdr(op.Selling); _Buying = Asset.FromXdr(op.Buying); _Amount = FromXdrAmount(op.Amount.InnerValue); var n = new decimal(op.Price.N.InnerValue); var d = new decimal(op.Price.D.InnerValue); _Price = decimal.Divide(n, d).ToString(); offerId = op.OfferID.InnerValue; }