Exemple #1
0
        public void WriteAmount(StAmountFieldCode fieldCode, IssuedAmount value)
        {
            WriteFieldId(StTypeCode.Amount, (uint)fieldCode);
            var span = bufferWriter.GetSpan(48);

            System.Buffers.Binary.BinaryPrimitives.WriteUInt64BigEndian(bufferWriter.GetSpan(8), Currency.ToUInt64Bits(value.Value));
            value.CurrencyCode.CopyTo(span.Slice(8));
            value.Issuer.CopyTo(span.Slice(28));
            bufferWriter.Advance(48);
        }
Exemple #2
0
        public void WriteAmount(StAmountFieldCode fieldCode, Amount value)
        {
            var xrp = value.XrpAmount;

            if (xrp.HasValue)
            {
                WriteAmount(fieldCode, xrp.Value);
            }
            else
            {
                WriteAmount(fieldCode, value.IssuedAmount.Value);
            }
        }
Exemple #3
0
 public void WriteAmount(StAmountFieldCode fieldCode, XrpAmount value)
 {
     WriteFieldId(StTypeCode.Amount, (uint)fieldCode);
     System.Buffers.Binary.BinaryPrimitives.WriteUInt64BigEndian(bufferWriter.GetSpan(8), value.Drops | 0x4000000000000000);
     bufferWriter.Advance(8);
 }