Пример #1
0
            public static LedgerEntryData Decode(XdrDataInputStream stream)
            {
                LedgerEntryData decodedLedgerEntryData = new LedgerEntryData();
                LedgerEntryType discriminant           = LedgerEntryType.Decode(stream);

                decodedLedgerEntryData.Discriminant = discriminant;
                switch (decodedLedgerEntryData.Discriminant.InnerValue)
                {
                case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT:
                    decodedLedgerEntryData.Account = AccountEntry.Decode(stream);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE:
                    decodedLedgerEntryData.TrustLine = TrustLineEntry.Decode(stream);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.OFFER:
                    decodedLedgerEntryData.Offer = OfferEntry.Decode(stream);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.DATA:
                    decodedLedgerEntryData.Data = DataEntry.Decode(stream);
                    break;
                }
                return(decodedLedgerEntryData);
            }
Пример #2
0
            public static void Encode(XdrDataOutputStream stream, LedgerEntryData encodedLedgerEntryData)
            {
                stream.WriteInt((int)encodedLedgerEntryData.Discriminant.InnerValue);
                switch (encodedLedgerEntryData.Discriminant.InnerValue)
                {
                case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT:
                    AccountEntry.Encode(stream, encodedLedgerEntryData.Account);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE:
                    TrustLineEntry.Encode(stream, encodedLedgerEntryData.TrustLine);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.OFFER:
                    OfferEntry.Encode(stream, encodedLedgerEntryData.Offer);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.DATA:
                    DataEntry.Encode(stream, encodedLedgerEntryData.Data);
                    break;

                case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE:
                    ClaimableBalanceEntry.Encode(stream, encodedLedgerEntryData.ClaimableBalance);
                    break;
                }
            }
Пример #3
0
 public static void Encode(XdrDataOutputStream stream, TrustLineEntry encodedTrustLineEntry)
 {
     AccountID.Encode(stream, encodedTrustLineEntry.AccountID);
     Asset.Encode(stream, encodedTrustLineEntry.Asset);
     Int64.Encode(stream, encodedTrustLineEntry.Balance);
     Int64.Encode(stream, encodedTrustLineEntry.Limit);
     Uint32.Encode(stream, encodedTrustLineEntry.Flags);
     TrustLineEntryExt.Encode(stream, encodedTrustLineEntry.Ext);
 }
Пример #4
0
        public static TrustLineEntry Decode(XdrDataInputStream stream)
        {
            TrustLineEntry decodedTrustLineEntry = new TrustLineEntry();

            decodedTrustLineEntry.AccountID = AccountID.Decode(stream);
            decodedTrustLineEntry.Asset     = Asset.Decode(stream);
            decodedTrustLineEntry.Balance   = Int64.Decode(stream);
            decodedTrustLineEntry.Limit     = Int64.Decode(stream);
            decodedTrustLineEntry.Flags     = Uint32.Decode(stream);
            decodedTrustLineEntry.Ext       = TrustLineEntryExt.Decode(stream);
            return(decodedTrustLineEntry);
        }