Exemplo n.º 1
0
        public static TimePoint Decode(XdrDataInputStream stream)
        {
            TimePoint decodedTimePoint = new TimePoint();

            decodedTimePoint.InnerValue = Uint64.Decode(stream);
            return(decodedTimePoint);
        }
Exemplo n.º 2
0
        public static Memo Decode(XdrDataInputStream stream)
        {
            Memo     decodedMemo  = new Memo();
            MemoType discriminant = MemoType.Decode(stream);

            decodedMemo.Discriminant = discriminant;
            switch (decodedMemo.Discriminant.InnerValue)
            {
            case MemoType.MemoTypeEnum.MEMO_NONE:
                break;

            case MemoType.MemoTypeEnum.MEMO_TEXT:
                decodedMemo.Text = stream.ReadString();
                break;

            case MemoType.MemoTypeEnum.MEMO_ID:
                decodedMemo.Id = Uint64.Decode(stream);
                break;

            case MemoType.MemoTypeEnum.MEMO_HASH:
                decodedMemo.Hash = Hash.Decode(stream);
                break;

            case MemoType.MemoTypeEnum.MEMO_RETURN:
                decodedMemo.RetHash = Hash.Decode(stream);
                break;
            }
            return(decodedMemo);
        }
Exemplo n.º 3
0
        public static LedgerHeader Decode(XdrDataInputStream stream)
        {
            LedgerHeader decodedLedgerHeader = new LedgerHeader();

            decodedLedgerHeader.LedgerVersion      = Uint32.Decode(stream);
            decodedLedgerHeader.PreviousLedgerHash = Hash.Decode(stream);
            decodedLedgerHeader.ScpValue           = StellarValue.Decode(stream);
            decodedLedgerHeader.TxSetResultHash    = Hash.Decode(stream);
            decodedLedgerHeader.BucketListHash     = Hash.Decode(stream);
            decodedLedgerHeader.LedgerSeq          = Uint32.Decode(stream);
            decodedLedgerHeader.TotalCoins         = Int64.Decode(stream);
            decodedLedgerHeader.FeePool            = Int64.Decode(stream);
            decodedLedgerHeader.InflationSeq       = Uint32.Decode(stream);
            decodedLedgerHeader.IdPool             = Uint64.Decode(stream);
            decodedLedgerHeader.BaseFee            = Uint32.Decode(stream);
            decodedLedgerHeader.BaseReserve        = Uint32.Decode(stream);
            decodedLedgerHeader.MaxTxSetSize       = Uint32.Decode(stream);
            int skipListsize = 4;

            decodedLedgerHeader.SkipList = new Hash[skipListsize];
            for (int i = 0; i < skipListsize; i++)
            {
                decodedLedgerHeader.SkipList[i] = Hash.Decode(stream);
            }
            decodedLedgerHeader.Ext = LedgerHeaderExt.Decode(stream);
            return(decodedLedgerHeader);
        }
Exemplo n.º 4
0
        public static TimeBounds Decode(XdrDataInputStream stream)
        {
            TimeBounds decodedTimeBounds = new TimeBounds();

            decodedTimeBounds.MinTime = Uint64.Decode(stream);
            decodedTimeBounds.MaxTime = Uint64.Decode(stream);
            return(decodedTimeBounds);
        }
Exemplo n.º 5
0
            public static MuxedAccountMed25519 Decode(XdrDataInputStream stream)
            {
                MuxedAccountMed25519 decodedMuxedAccountMed25519 = new MuxedAccountMed25519();

                decodedMuxedAccountMed25519.Id      = Uint64.Decode(stream);
                decodedMuxedAccountMed25519.Ed25519 = Uint256.Decode(stream);
                return(decodedMuxedAccountMed25519);
            }
Exemplo n.º 6
0
            public static LedgerKeyOffer Decode(XdrDataInputStream stream)
            {
                LedgerKeyOffer decodedLedgerKeyOffer = new LedgerKeyOffer();

                decodedLedgerKeyOffer.SellerID = AccountID.Decode(stream);
                decodedLedgerKeyOffer.OfferID  = Uint64.Decode(stream);
                return(decodedLedgerKeyOffer);
            }
Exemplo n.º 7
0
        public static SCPStatement Decode(XdrDataInputStream stream)
        {
            SCPStatement decodedSCPStatement = new SCPStatement();

            decodedSCPStatement.NodeID    = NodeID.Decode(stream);
            decodedSCPStatement.SlotIndex = Uint64.Decode(stream);
            decodedSCPStatement.Pledges   = SCPStatementPledges.Decode(stream);
            return(decodedSCPStatement);
        }
Exemplo n.º 8
0
        public static AuthCert Decode(XdrDataInputStream stream)
        {
            AuthCert decodedAuthCert = new AuthCert();

            decodedAuthCert.Pubkey     = Curve25519Public.Decode(stream);
            decodedAuthCert.Expiration = Uint64.Decode(stream);
            decodedAuthCert.Sig        = Signature.Decode(stream);
            return(decodedAuthCert);
        }
Exemplo n.º 9
0
            public static AuthenticatedMessageV0 Decode(XdrDataInputStream stream)
            {
                AuthenticatedMessageV0 decodedAuthenticatedMessageV0 = new AuthenticatedMessageV0();

                decodedAuthenticatedMessageV0.Sequence = Uint64.Decode(stream);
                decodedAuthenticatedMessageV0.Message  = StellarMessage.Decode(stream);
                decodedAuthenticatedMessageV0.Mac      = HmacSha256Mac.Decode(stream);
                return(decodedAuthenticatedMessageV0);
            }
Exemplo n.º 10
0
        public static ManageOfferOp Decode(XdrDataInputStream stream)
        {
            ManageOfferOp decodedManageOfferOp = new ManageOfferOp();

            decodedManageOfferOp.Selling = Asset.Decode(stream);
            decodedManageOfferOp.Buying  = Asset.Decode(stream);
            decodedManageOfferOp.Amount  = Int64.Decode(stream);
            decodedManageOfferOp.Price   = Price.Decode(stream);
            decodedManageOfferOp.OfferID = Uint64.Decode(stream);
            return(decodedManageOfferOp);
        }
Exemplo n.º 11
0
        public static ClaimOfferAtom Decode(XdrDataInputStream stream)
        {
            ClaimOfferAtom decodedClaimOfferAtom = new ClaimOfferAtom();

            decodedClaimOfferAtom.SellerID     = AccountID.Decode(stream);
            decodedClaimOfferAtom.OfferID      = Uint64.Decode(stream);
            decodedClaimOfferAtom.AssetSold    = Asset.Decode(stream);
            decodedClaimOfferAtom.AmountSold   = Int64.Decode(stream);
            decodedClaimOfferAtom.AssetBought  = Asset.Decode(stream);
            decodedClaimOfferAtom.AmountBought = Int64.Decode(stream);
            return(decodedClaimOfferAtom);
        }
Exemplo n.º 12
0
        public static OfferEntry Decode(XdrDataInputStream stream)
        {
            OfferEntry decodedOfferEntry = new OfferEntry();

            decodedOfferEntry.SellerID = AccountID.Decode(stream);
            decodedOfferEntry.OfferID  = Uint64.Decode(stream);
            decodedOfferEntry.Selling  = Asset.Decode(stream);
            decodedOfferEntry.Buying   = Asset.Decode(stream);
            decodedOfferEntry.Amount   = Int64.Decode(stream);
            decodedOfferEntry.Price    = Price.Decode(stream);
            decodedOfferEntry.Flags    = Uint32.Decode(stream);
            decodedOfferEntry.Ext      = OfferEntryExt.Decode(stream);
            return(decodedOfferEntry);
        }
Exemplo n.º 13
0
        public static StellarValue Decode(XdrDataInputStream stream)
        {
            StellarValue decodedStellarValue = new StellarValue();

            decodedStellarValue.TxSetHash = Hash.Decode(stream);
            decodedStellarValue.CloseTime = Uint64.Decode(stream);
            int upgradessize = stream.ReadInt();

            decodedStellarValue.Upgrades = new UpgradeType[upgradessize];
            for (int i = 0; i < upgradessize; i++)
            {
                decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream);
            }
            decodedStellarValue.Ext = StellarValueExt.Decode(stream);
            return(decodedStellarValue);
        }
Exemplo n.º 14
0
        public static PeerStats Decode(XdrDataInputStream stream)
        {
            PeerStats decodedPeerStats = new PeerStats();

            decodedPeerStats.Id                        = NodeID.Decode(stream);
            decodedPeerStats.VersionStr                = stream.ReadString();
            decodedPeerStats.MessagesRead              = Uint64.Decode(stream);
            decodedPeerStats.MessagesWritten           = Uint64.Decode(stream);
            decodedPeerStats.BytesRead                 = Uint64.Decode(stream);
            decodedPeerStats.BytesWritten              = Uint64.Decode(stream);
            decodedPeerStats.SecondsConnected          = Uint64.Decode(stream);
            decodedPeerStats.UniqueFloodBytesRecv      = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFloodBytesRecv   = Uint64.Decode(stream);
            decodedPeerStats.UniqueFetchBytesRecv      = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFetchBytesRecv   = Uint64.Decode(stream);
            decodedPeerStats.UniqueFloodMessageRecv    = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFloodMessageRecv = Uint64.Decode(stream);
            decodedPeerStats.UniqueFetchMessageRecv    = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFetchMessageRecv = Uint64.Decode(stream);
            return(decodedPeerStats);
        }