Beispiel #1
0
            public static LedgerEntryData Decode(IByteReader stream)
            {
                LedgerEntryData decodedLedgerEntryData = new LedgerEntryData();

                decodedLedgerEntryData.Discriminant = LedgerEntryType.Decode(stream);
                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);
            }
            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;

                case LedgerEntryType.LedgerEntryTypeEnum.CLAIMABLE_BALANCE:
                    decodedLedgerEntryData.ClaimableBalance = ClaimableBalanceEntry.Decode(stream);
                    break;
                }
                return(decodedLedgerEntryData);
            }
Beispiel #3
0
 public SleFormat(LedgerEntryType type, params Object[] args)
     : base(args)
 {
     LedgerEntryType = type;
     AddCommonFields();
     Formats.Add(type, this);
 }
Beispiel #4
0
 public LedgerEntry(string nominalCode, string nominalName, LedgerEntryType ledgerEntryType, decimal amount)
 {
     NominalCode     = nominalCode;
     NominalName     = nominalName;
     LedgerEntryType = ledgerEntryType;
     Amount          = amount;
 }
Beispiel #5
0
        public static LedgerKey Decode(XdrDataInputStream stream)
        {
            var decodedLedgerKey = new LedgerKey();
            var discriminant     = LedgerEntryType.Decode(stream);

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

            case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE:
                decodedLedgerKey.TrustLine = LedgerKeyTrustLine.Decode(stream);
                break;

            case LedgerEntryType.LedgerEntryTypeEnum.OFFER:
                decodedLedgerKey.Offer = LedgerKeyOffer.Decode(stream);
                break;

            case LedgerEntryType.LedgerEntryTypeEnum.DATA:
                decodedLedgerKey.Data = LedgerKeyData.Decode(stream);
                break;
            }
            return(decodedLedgerKey);
        }
Beispiel #6
0
 public static SleFormat GetLedgerFormat(LedgerEntryType key)
 {
     if (key == null)
     {
         return(null);
     }
     return(Formats[key]);
 }
 public SqlLedgerEntry(string transactionId, string username, DateTime transactionDate, string nominalCode, decimal amount, LedgerEntryType type, string description, string nominalCodeName, string transactionType)
 {
     TransactionId   = transactionId;
     Username        = username;
     TransactionDate = transactionDate;
     NominalCode     = nominalCode;
     Amount          = amount;
     LedgerEntryType = type;
     Description     = description;
     NominalCodeName = nominalCodeName;
     TransactionType = transactionType;
 }
Beispiel #8
0
        private static StObject LedgerFormatted(StObject source, LedgerEntryType ledgerEntryType)
        {
            StObject constructed = null;

            if (ledgerEntryType == Enums.LedgerEntryType.Offer)
            {
                constructed = new Offer();
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.RippleState)
            {
                constructed = new RippleState();
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.AccountRoot)
            {
                constructed = new AccountRoot();
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.Invalid)
            {
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.DirectoryNode)
            {
                constructed = new DirectoryNode();
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.GeneratorMap)
            {
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.Nickname)
            {
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.Contract)
            {
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.LedgerHashes)
            {
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.EnabledFeatures)
            {
            }
            else if (ledgerEntryType == Enums.LedgerEntryType.FeeSettings)
            {
            }

            if (constructed == null)
            {
                constructed = new LedgerEntry(ledgerEntryType);
            }

            constructed.fields = source.fields;

            return(constructed);
        }
Beispiel #9
0
        public static AccountState FromJson(JToken jToken, bool normalise = false)
        {
            var map   = new AccountState();
            var items = from JObject entry in jToken
                        where normalise == false ||
                        LedgerEntryType.FromJson(entry["LedgerEntryType"]) !=
                        LedgerEntryType.LedgerHashes
                        select new LedgerEntry(entry);

            foreach (var ledgerEntry in items)
            {
                map.AddItem(ledgerEntry.Index(), ledgerEntry);
            }
            return(map);
        }
 public static void Encode(IByteWriter stream, LedgerEntryType value)
 {
     XdrEncoding.EncodeInt32((int)value.InnerValue, stream);
 }
 protected ThreadedLedgerEntry(LedgerEntryType type)
     : base(type)
 {
 }
Beispiel #12
0
 public int AsInteger(string s)
 {
     return LedgerEntryType.FromString(s).AsInteger;
 }
Beispiel #13
0
 public void LedgerEntryType(LedgerEntryType val)
 {
     Add(Field.LedgerEntryType, val.AsInteger);
 }
Beispiel #14
0
 public LedgerEntry(LedgerEntryType type)
 {
     SetFormat(SleFormat.Formats[type]);
     Add(Coretypes.UInt.UInt16.LedgerEntryType, type.AsInteger);
 }
		public static void Encode(IByteWriter stream, LedgerEntryType value) {
		  XdrEncoding.EncodeInt32((int)value.InnerValue, stream);
		}
Beispiel #16
0
 public LedgerEntryData(string asset, decimal qty, LedgerEntryType type)
 {
     Asset = asset;
     Qty   = qty;
     Type  = type;
 }
Beispiel #17
0
 public string AsString(int i)
 {
     return LedgerEntryType.FromNumber(i).GetName();
 }