/// <summary> /// Construct a new CreatePassiveOffer builder from a CreatePassiveOfferOp XDR. /// </summary> /// <param name="op"></param> public Builder(sdkxdr.CreatePassiveOfferOp 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(); }
public override sdkxdr.Operation.OperationBody ToOperationBody() { var op = new sdkxdr.CreatePassiveOfferOp(); 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 body = new sdkxdr.Operation.OperationBody(); body.Discriminant = sdkxdr.OperationType.Create(sdkxdr.OperationType.OperationTypeEnum.CREATE_PASSIVE_OFFER); body.CreatePassiveOfferOp = op; return(body); }