Ejemplo n.º 1
0
        public static Transaction Decode(XdrDataInputStream stream)
        {
            Transaction decodedTransaction = new Transaction();

            decodedTransaction.SourceAccount = AccountID.Decode(stream);
            decodedTransaction.Fee           = Uint32.Decode(stream);
            decodedTransaction.SeqNum        = SequenceNumber.Decode(stream);
            int TimeBoundsPresent = stream.ReadInt();

            if (TimeBoundsPresent != 0)
            {
                decodedTransaction.TimeBounds = TimeBounds.Decode(stream);
            }

            decodedTransaction.Memo = Memo.Decode(stream);
            int operationssize = stream.ReadInt();

            decodedTransaction.Operations = new Operation[operationssize];

            for (int i = 0; i < operationssize; i++)
            {
                decodedTransaction.Operations[i] = Operation.Decode(stream);
            }

            decodedTransaction.Ext = TransactionExt.Decode(stream);
            return(decodedTransaction);
        }
Ejemplo n.º 2
0
        public static AccountEntry Decode(XdrDataInputStream stream)
        {
            var decodedAccountEntry = new AccountEntry();

            decodedAccountEntry.AccountID     = AccountID.Decode(stream);
            decodedAccountEntry.Balance       = Int64.Decode(stream);
            decodedAccountEntry.SeqNum        = SequenceNumber.Decode(stream);
            decodedAccountEntry.NumSubEntries = Uint32.Decode(stream);
            var InflationDestPresent = stream.ReadInt();

            if (InflationDestPresent != 0)
            {
                decodedAccountEntry.InflationDest = AccountID.Decode(stream);
            }
            decodedAccountEntry.Flags      = Uint32.Decode(stream);
            decodedAccountEntry.HomeDomain = String32.Decode(stream);
            decodedAccountEntry.Thresholds = Thresholds.Decode(stream);
            var signerssize = stream.ReadInt();

            decodedAccountEntry.Signers = new Signer[signerssize];
            for (var i = 0; i < signerssize; i++)
            {
                decodedAccountEntry.Signers[i] = Signer.Decode(stream);
            }
            decodedAccountEntry.Ext = AccountEntryExt.Decode(stream);
            return(decodedAccountEntry);
        }
Ejemplo n.º 3
0
        public static LedgerUpgrade Decode(XdrDataInputStream stream)
        {
            LedgerUpgrade     decodedLedgerUpgrade = new LedgerUpgrade();
            LedgerUpgradeType discriminant         = LedgerUpgradeType.Decode(stream);

            decodedLedgerUpgrade.Discriminant = discriminant;

            switch (decodedLedgerUpgrade.Discriminant.InnerValue)
            {
            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION:
                decodedLedgerUpgrade.NewLedgerVersion = Uint32.Decode(stream);
                break;

            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE:
                decodedLedgerUpgrade.NewBaseFee = Uint32.Decode(stream);
                break;

            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE:
                decodedLedgerUpgrade.NewMaxTxSetSize = Uint32.Decode(stream);
                break;

            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE:
                decodedLedgerUpgrade.NewBaseReserve = Uint32.Decode(stream);
                break;
            }

            return(decodedLedgerUpgrade);
        }
Ejemplo n.º 4
0
        public static AccountEntry Decode(IByteReader stream)
        {
            AccountEntry decodedAccountEntry = new AccountEntry();

            decodedAccountEntry.AccountID     = AccountID.Decode(stream);
            decodedAccountEntry.Balance       = Int64.Decode(stream);
            decodedAccountEntry.SeqNum        = SequenceNumber.Decode(stream);
            decodedAccountEntry.NumSubEntries = Uint32.Decode(stream);
            int inflationDestPresent = XdrEncoding.DecodeInt32(stream);

            if (inflationDestPresent != 0)
            {
                decodedAccountEntry.InflationDest = AccountID.Decode(stream);
            }
            decodedAccountEntry.Flags      = Uint32.Decode(stream);
            decodedAccountEntry.HomeDomain = String32.Decode(stream);
            decodedAccountEntry.Thresholds = Thresholds.Decode(stream);
            int signerssize = XdrEncoding.DecodeInt32(stream);

            decodedAccountEntry.Signers = new Signer[signerssize];
            for (int i = 0; i < signerssize; i++)
            {
                decodedAccountEntry.Signers[i] = Signer.Decode(stream);
            }
            decodedAccountEntry.Ext = AccountEntryExt.Decode(stream);
            return(decodedAccountEntry);
        }
Ejemplo n.º 5
0
        public static SCPQuorumSet Decode(XdrDataInputStream stream)
        {
            SCPQuorumSet decodedSCPQuorumSet = new SCPQuorumSet();

            decodedSCPQuorumSet.Threshold = Uint32.Decode(stream);
            int validatorssize = stream.ReadInt();

            decodedSCPQuorumSet.Validators = new PublicKey[validatorssize];

            for (int i = 0; i < validatorssize; i++)
            {
                decodedSCPQuorumSet.Validators[i] = PublicKey.Decode(stream);
            }

            int innerSetssize = stream.ReadInt();

            decodedSCPQuorumSet.InnerSets = new SCPQuorumSet[innerSetssize];

            for (int i = 0; i < innerSetssize; i++)
            {
                decodedSCPQuorumSet.InnerSets[i] = Decode(stream);
            }

            return(decodedSCPQuorumSet);
        }
Ejemplo n.º 6
0
        public static LedgerHeader Decode(XdrDataInputStream stream)
        {
            var 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);
            var skipListsize = 4;

            decodedLedgerHeader.SkipList = new Hash[skipListsize];
            for (var i = 0; i < skipListsize; i++)
            {
                decodedLedgerHeader.SkipList[i] = Hash.Decode(stream);
            }
            decodedLedgerHeader.Ext = LedgerHeaderExt.Decode(stream);
            return(decodedLedgerHeader);
        }
Ejemplo n.º 7
0
        public static SetOptionsOp Decode(XdrDataInputStream stream)
        {
            var decodedSetOptionsOp  = new SetOptionsOp();
            var InflationDestPresent = stream.ReadInt();

            if (InflationDestPresent != 0)
            {
                decodedSetOptionsOp.InflationDest = AccountID.Decode(stream);
            }
            var ClearFlagsPresent = stream.ReadInt();

            if (ClearFlagsPresent != 0)
            {
                decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream);
            }
            var SetFlagsPresent = stream.ReadInt();

            if (SetFlagsPresent != 0)
            {
                decodedSetOptionsOp.SetFlags = Uint32.Decode(stream);
            }
            var MasterWeightPresent = stream.ReadInt();

            if (MasterWeightPresent != 0)
            {
                decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream);
            }
            var LowThresholdPresent = stream.ReadInt();

            if (LowThresholdPresent != 0)
            {
                decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream);
            }
            var MedThresholdPresent = stream.ReadInt();

            if (MedThresholdPresent != 0)
            {
                decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream);
            }
            var HighThresholdPresent = stream.ReadInt();

            if (HighThresholdPresent != 0)
            {
                decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream);
            }
            var HomeDomainPresent = stream.ReadInt();

            if (HomeDomainPresent != 0)
            {
                decodedSetOptionsOp.HomeDomain = String32.Decode(stream);
            }
            var SignerPresent = stream.ReadInt();

            if (SignerPresent != 0)
            {
                decodedSetOptionsOp.Signer = Signer.Decode(stream);
            }
            return(decodedSetOptionsOp);
        }
Ejemplo n.º 8
0
        public static SetOptionsOp Decode(IByteReader stream)
        {
            SetOptionsOp decodedSetOptionsOp  = new SetOptionsOp();
            int          inflationDestPresent = XdrEncoding.DecodeInt32(stream);

            if (inflationDestPresent != 0)
            {
                decodedSetOptionsOp.InflationDest = AccountID.Decode(stream);
            }
            int clearFlagsPresent = XdrEncoding.DecodeInt32(stream);

            if (clearFlagsPresent != 0)
            {
                decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream);
            }
            int setFlagsPresent = XdrEncoding.DecodeInt32(stream);

            if (setFlagsPresent != 0)
            {
                decodedSetOptionsOp.SetFlags = Uint32.Decode(stream);
            }
            int masterWeightPresent = XdrEncoding.DecodeInt32(stream);

            if (masterWeightPresent != 0)
            {
                decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream);
            }
            int lowThresholdPresent = XdrEncoding.DecodeInt32(stream);

            if (lowThresholdPresent != 0)
            {
                decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream);
            }
            int medThresholdPresent = XdrEncoding.DecodeInt32(stream);

            if (medThresholdPresent != 0)
            {
                decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream);
            }
            int highThresholdPresent = XdrEncoding.DecodeInt32(stream);

            if (highThresholdPresent != 0)
            {
                decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream);
            }
            int homeDomainPresent = XdrEncoding.DecodeInt32(stream);

            if (homeDomainPresent != 0)
            {
                decodedSetOptionsOp.HomeDomain = String32.Decode(stream);
            }
            int signerPresent = XdrEncoding.DecodeInt32(stream);

            if (signerPresent != 0)
            {
                decodedSetOptionsOp.Signer = Signer.Decode(stream);
            }
            return(decodedSetOptionsOp);
        }
Ejemplo n.º 9
0
        public static SCPBallot Decode(IByteReader stream)
        {
            SCPBallot decodedSCPBallot = new SCPBallot();

            decodedSCPBallot.Counter = Uint32.Decode(stream);
            decodedSCPBallot.Value   = Value.Decode(stream);
            return(decodedSCPBallot);
        }
Ejemplo n.º 10
0
        public static BucketMetadata Decode(XdrDataInputStream stream)
        {
            BucketMetadata decodedBucketMetadata = new BucketMetadata();

            decodedBucketMetadata.LedgerVersion = Uint32.Decode(stream);
            decodedBucketMetadata.Ext           = BucketMetadataExt.Decode(stream);
            return(decodedBucketMetadata);
        }
Ejemplo n.º 11
0
        public static SCPBallot Decode(XdrDataInputStream stream)
        {
            SCPBallot decodedSCPBallot = new SCPBallot();

            decodedSCPBallot.Counter = Uint32.Decode(stream);
            decodedSCPBallot.Value   = Value.Decode(stream);
            return(decodedSCPBallot);
        }
Ejemplo n.º 12
0
        public static Signer Decode(IByteReader stream)
        {
            Signer decodedSigner = new Signer();

            decodedSigner.PubKey = AccountID.Decode(stream);
            decodedSigner.Weight = Uint32.Decode(stream);
            return(decodedSigner);
        }
Ejemplo n.º 13
0
        public static Signer Decode(XdrDataInputStream stream)
        {
            var decodedSigner = new Signer();

            decodedSigner.Key    = SignerKey.Decode(stream);
            decodedSigner.Weight = Uint32.Decode(stream);
            return(decodedSigner);
        }
Ejemplo n.º 14
0
        public static Signer Decode(IByteReader stream)
        {
            Signer decodedSigner = new Signer();

            decodedSigner.Key    = SignerKey.Decode(stream);
            decodedSigner.Weight = Uint32.Decode(stream);
            return(decodedSigner);
        }
        public static TransactionHistoryResultEntry Decode(XdrDataInputStream stream)
        {
            var decodedTransactionHistoryResultEntry = new TransactionHistoryResultEntry();

            decodedTransactionHistoryResultEntry.LedgerSeq   = Uint32.Decode(stream);
            decodedTransactionHistoryResultEntry.TxResultSet = TransactionResultSet.Decode(stream);
            decodedTransactionHistoryResultEntry.Ext         = TransactionHistoryResultEntryExt.Decode(stream);
            return(decodedTransactionHistoryResultEntry);
        }
Ejemplo n.º 16
0
        public static PeerAddress Decode(XdrDataInputStream stream)
        {
            PeerAddress decodedPeerAddress = new PeerAddress();

            decodedPeerAddress.Ip          = PeerAddressIp.Decode(stream);
            decodedPeerAddress.Port        = Uint32.Decode(stream);
            decodedPeerAddress.NumFailures = Uint32.Decode(stream);
            return(decodedPeerAddress);
        }
Ejemplo n.º 17
0
        public static TransactionHistoryResultEntry Decode(IByteReader stream)
        {
            TransactionHistoryResultEntry decodedTransactionHistoryResultEntry = new TransactionHistoryResultEntry();

            decodedTransactionHistoryResultEntry.LedgerSeq   = Uint32.Decode(stream);
            decodedTransactionHistoryResultEntry.TxResultSet = TransactionResultSet.Decode(stream);
            decodedTransactionHistoryResultEntry.Ext         = TransactionHistoryResultEntryExt.Decode(stream);
            return(decodedTransactionHistoryResultEntry);
        }
Ejemplo n.º 18
0
                public static SCPStatementExternalize Decode(IByteReader stream)
                {
                    SCPStatementExternalize decodedSCPStatementExternalize = new SCPStatementExternalize();

                    decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream);
                    decodedSCPStatementExternalize.NH     = Uint32.Decode(stream);
                    decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream);
                    return(decodedSCPStatementExternalize);
                }
Ejemplo n.º 19
0
            public static OperationIDId Decode(XdrDataInputStream stream)
            {
                OperationIDId decodedOperationIDId = new OperationIDId();

                decodedOperationIDId.SourceAccount = MuxedAccount.Decode(stream);
                decodedOperationIDId.SeqNum        = SequenceNumber.Decode(stream);
                decodedOperationIDId.OpNum         = Uint32.Decode(stream);
                return(decodedOperationIDId);
            }
Ejemplo n.º 20
0
        public static LedgerEntry Decode(XdrDataInputStream stream)
        {
            LedgerEntry decodedLedgerEntry = new LedgerEntry();

            decodedLedgerEntry.LastModifiedLedgerSeq = Uint32.Decode(stream);
            decodedLedgerEntry.Data = LedgerEntryData.Decode(stream);
            decodedLedgerEntry.Ext  = LedgerEntryExt.Decode(stream);
            return(decodedLedgerEntry);
        }
Ejemplo n.º 21
0
        public static AllowTrustOp Decode(XdrDataInputStream stream)
        {
            AllowTrustOp decodedAllowTrustOp = new AllowTrustOp();

            decodedAllowTrustOp.Trustor   = AccountID.Decode(stream);
            decodedAllowTrustOp.Asset     = AllowTrustOpAsset.Decode(stream);
            decodedAllowTrustOp.Authorize = Uint32.Decode(stream);
            return(decodedAllowTrustOp);
        }
Ejemplo n.º 22
0
        public static PeerAddress Decode(IByteReader stream)
        {
            PeerAddress decodedPeerAddress = new PeerAddress();

            decodedPeerAddress.Ip          = PeerAddressIp.Decode(stream);
            decodedPeerAddress.Port        = Uint32.Decode(stream);
            decodedPeerAddress.NumFailures = Uint32.Decode(stream);
            return(decodedPeerAddress);
        }
Ejemplo n.º 23
0
                public static SCPStatementExternalize Decode(XdrDataInputStream stream)
                {
                    var decodedSCPStatementExternalize = new SCPStatementExternalize();

                    decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream);
                    decodedSCPStatementExternalize.NH     = Uint32.Decode(stream);
                    decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream);
                    return(decodedSCPStatementExternalize);
                }
Ejemplo n.º 24
0
        public static TopologyResponseBody Decode(XdrDataInputStream stream)
        {
            TopologyResponseBody decodedTopologyResponseBody = new TopologyResponseBody();

            decodedTopologyResponseBody.InboundPeers           = PeerStatList.Decode(stream);
            decodedTopologyResponseBody.OutboundPeers          = PeerStatList.Decode(stream);
            decodedTopologyResponseBody.TotalInboundPeerCount  = Uint32.Decode(stream);
            decodedTopologyResponseBody.TotalOutboundPeerCount = Uint32.Decode(stream);
            return(decodedTopologyResponseBody);
        }
Ejemplo n.º 25
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;
 }
Ejemplo n.º 26
0
                public static SCPStatementConfirm Decode(XdrDataInputStream stream)
                {
                    var decodedSCPStatementConfirm = new SCPStatementConfirm();

                    decodedSCPStatementConfirm.Ballot        = SCPBallot.Decode(stream);
                    decodedSCPStatementConfirm.NPrepared     = Uint32.Decode(stream);
                    decodedSCPStatementConfirm.NCommit       = Uint32.Decode(stream);
                    decodedSCPStatementConfirm.NH            = Uint32.Decode(stream);
                    decodedSCPStatementConfirm.QuorumSetHash = Hash.Decode(stream);
                    return(decodedSCPStatementConfirm);
                }
Ejemplo n.º 27
0
                public static SCPStatementConfirm Decode(IByteReader stream)
                {
                    SCPStatementConfirm decodedSCPStatementConfirm = new SCPStatementConfirm();

                    decodedSCPStatementConfirm.Ballot        = SCPBallot.Decode(stream);
                    decodedSCPStatementConfirm.NPrepared     = Uint32.Decode(stream);
                    decodedSCPStatementConfirm.NCommit       = Uint32.Decode(stream);
                    decodedSCPStatementConfirm.NH            = Uint32.Decode(stream);
                    decodedSCPStatementConfirm.QuorumSetHash = Hash.Decode(stream);
                    return(decodedSCPStatementConfirm);
                }
        public static SurveyRequestMessage Decode(XdrDataInputStream stream)
        {
            SurveyRequestMessage decodedSurveyRequestMessage = new SurveyRequestMessage();

            decodedSurveyRequestMessage.SurveyorPeerID = NodeID.Decode(stream);
            decodedSurveyRequestMessage.SurveyedPeerID = NodeID.Decode(stream);
            decodedSurveyRequestMessage.LedgerNum      = Uint32.Decode(stream);
            decodedSurveyRequestMessage.EncryptionKey  = Curve25519Public.Decode(stream);
            decodedSurveyRequestMessage.CommandType    = SurveyMessageCommandType.Decode(stream);
            return(decodedSurveyRequestMessage);
        }
        public static SurveyResponseMessage Decode(XdrDataInputStream stream)
        {
            SurveyResponseMessage decodedSurveyResponseMessage = new SurveyResponseMessage();

            decodedSurveyResponseMessage.SurveyorPeerID = NodeID.Decode(stream);
            decodedSurveyResponseMessage.SurveyedPeerID = NodeID.Decode(stream);
            decodedSurveyResponseMessage.LedgerNum      = Uint32.Decode(stream);
            decodedSurveyResponseMessage.CommandType    = SurveyMessageCommandType.Decode(stream);
            decodedSurveyResponseMessage.EncryptedBody  = EncryptedBody.Decode(stream);
            return(decodedSurveyResponseMessage);
        }
Ejemplo n.º 30
0
        public static TrustLineEntry Decode(IByteReader 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);
        }