Exemplo n.º 1
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.º 2
0
        public static AccountEntry Decode(XdrDataInputStream 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 = 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);
            int signerssize = stream.ReadInt();

            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);
        }
        public static TransactionV0 Decode(XdrDataInputStream stream)
        {
            TransactionV0 decodedTransactionV0 = new TransactionV0();

            decodedTransactionV0.SourceAccountEd25519 = Uint256.Decode(stream);
            decodedTransactionV0.Fee    = Uint32.Decode(stream);
            decodedTransactionV0.SeqNum = SequenceNumber.Decode(stream);
            int TimeBoundsPresent = stream.ReadInt();

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

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

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

            decodedTransactionV0.Ext = TransactionV0Ext.Decode(stream);
            return(decodedTransactionV0);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public static Transaction Decode(XdrDataInputStream stream)
        {
            Transaction decodedTransaction = new Transaction();

            decodedTransaction.SourceAccount = MuxedAccount.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);
        }
Exemplo n.º 6
0
        public static SetOptionsOp Decode(XdrDataInputStream stream)
        {
            SetOptionsOp decodedSetOptionsOp  = new SetOptionsOp();
            int          InflationDestPresent = stream.ReadInt();

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

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

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

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

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

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

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

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

            if (SignerPresent != 0)
            {
                decodedSetOptionsOp.Signer = Signer.Decode(stream);
            }
            return(decodedSetOptionsOp);
        }
        public static ClaimableBalanceEntryExtensionV1 Decode(XdrDataInputStream stream)
        {
            ClaimableBalanceEntryExtensionV1 decodedClaimableBalanceEntryExtensionV1 = new ClaimableBalanceEntryExtensionV1();

            decodedClaimableBalanceEntryExtensionV1.Ext   = ClaimableBalanceEntryExtensionV1Ext.Decode(stream);
            decodedClaimableBalanceEntryExtensionV1.Flags = Uint32.Decode(stream);
            return(decodedClaimableBalanceEntryExtensionV1);
        }
Exemplo n.º 8
0
        public static Signer Decode(XdrDataInputStream stream)
        {
            Signer decodedSigner = new Signer();

            decodedSigner.Key    = SignerKey.Decode(stream);
            decodedSigner.Weight = Uint32.Decode(stream);
            return(decodedSigner);
        }
Exemplo n.º 9
0
        public static SCPBallot Decode(XdrDataInputStream stream)
        {
            SCPBallot decodedSCPBallot = new SCPBallot();

            decodedSCPBallot.Counter = Uint32.Decode(stream);
            decodedSCPBallot.Value   = Value.Decode(stream);
            return(decodedSCPBallot);
        }
Exemplo 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);
        }
Exemplo n.º 11
0
        public static AllowTrustOp Decode(XdrDataInputStream stream)
        {
            AllowTrustOp decodedAllowTrustOp = new AllowTrustOp();

            decodedAllowTrustOp.Trustor   = AccountID.Decode(stream);
            decodedAllowTrustOp.Asset     = AssetCode.Decode(stream);
            decodedAllowTrustOp.Authorize = Uint32.Decode(stream);
            return(decodedAllowTrustOp);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
0
        public static TransactionHistoryResultEntry Decode(XdrDataInputStream stream)
        {
            TransactionHistoryResultEntry decodedTransactionHistoryResultEntry = new TransactionHistoryResultEntry();

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

                    decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream);
                    decodedSCPStatementExternalize.NH     = Uint32.Decode(stream);
                    decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream);
                    return(decodedSCPStatementExternalize);
                }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
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);
            }
        public static SetTrustLineFlagsOp Decode(XdrDataInputStream stream)
        {
            SetTrustLineFlagsOp decodedSetTrustLineFlagsOp = new SetTrustLineFlagsOp();

            decodedSetTrustLineFlagsOp.Trustor    = AccountID.Decode(stream);
            decodedSetTrustLineFlagsOp.Asset      = Asset.Decode(stream);
            decodedSetTrustLineFlagsOp.ClearFlags = Uint32.Decode(stream);
            decodedSetTrustLineFlagsOp.SetFlags   = Uint32.Decode(stream);
            return(decodedSetTrustLineFlagsOp);
        }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
                public static SCPStatementConfirm Decode(XdrDataInputStream 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 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);
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
0
        public static OfferEntry Decode(XdrDataInputStream stream)
        {
            OfferEntry decodedOfferEntry = new OfferEntry();

            decodedOfferEntry.SellerID = AccountID.Decode(stream);
            decodedOfferEntry.OfferID  = Int64.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.º 24
0
        public static AuthenticatedMessage Decode(XdrDataInputStream stream)
        {
            AuthenticatedMessage decodedAuthenticatedMessage = new AuthenticatedMessage();
            Uint32 discriminant = Uint32.Decode(stream);

            decodedAuthenticatedMessage.Discriminant = discriminant;
            switch (decodedAuthenticatedMessage.Discriminant.InnerValue)
            {
            case 0:
                decodedAuthenticatedMessage.V0 = AuthenticatedMessageV0.Decode(stream);
                break;
            }
            return(decodedAuthenticatedMessage);
        }
Exemplo n.º 25
0
        public static LedgerSCPMessages Decode(XdrDataInputStream stream)
        {
            LedgerSCPMessages decodedLedgerSCPMessages = new LedgerSCPMessages();

            decodedLedgerSCPMessages.LedgerSeq = Uint32.Decode(stream);
            int messagessize = stream.ReadInt();

            decodedLedgerSCPMessages.Messages = new SCPEnvelope[messagessize];
            for (int i = 0; i < messagessize; i++)
            {
                decodedLedgerSCPMessages.Messages[i] = SCPEnvelope.Decode(stream);
            }
            return(decodedLedgerSCPMessages);
        }
Exemplo n.º 26
0
        public static Hello Decode(XdrDataInputStream stream)
        {
            Hello decodedHello = new Hello();

            decodedHello.LedgerVersion     = Uint32.Decode(stream);
            decodedHello.OverlayVersion    = Uint32.Decode(stream);
            decodedHello.OverlayMinVersion = Uint32.Decode(stream);
            decodedHello.NetworkID         = Hash.Decode(stream);
            decodedHello.VersionStr        = stream.ReadString();
            decodedHello.ListeningPort     = stream.ReadInt();
            decodedHello.PeerID            = NodeID.Decode(stream);
            decodedHello.Cert  = AuthCert.Decode(stream);
            decodedHello.Nonce = Uint256.Decode(stream);
            return(decodedHello);
        }
        public static AccountEntryExtensionV2 Decode(XdrDataInputStream stream)
        {
            AccountEntryExtensionV2 decodedAccountEntryExtensionV2 = new AccountEntryExtensionV2();

            decodedAccountEntryExtensionV2.NumSponsored  = Uint32.Decode(stream);
            decodedAccountEntryExtensionV2.NumSponsoring = Uint32.Decode(stream);
            int signerSponsoringIDssize = stream.ReadInt();

            decodedAccountEntryExtensionV2.SignerSponsoringIDs = new SponsorshipDescriptor[signerSponsoringIDssize];
            for (int i = 0; i < signerSponsoringIDssize; i++)
            {
                decodedAccountEntryExtensionV2.SignerSponsoringIDs[i] = SponsorshipDescriptor.Decode(stream);
            }
            decodedAccountEntryExtensionV2.Ext = AccountEntryExtensionV2Ext.Decode(stream);
            return(decodedAccountEntryExtensionV2);
        }
Exemplo n.º 28
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] = SCPQuorumSet.Decode(stream);
            }
            return(decodedSCPQuorumSet);
        }
Exemplo n.º 29
0
                public static SCPStatementPrepare Decode(XdrDataInputStream stream)
                {
                    SCPStatementPrepare decodedSCPStatementPrepare = new SCPStatementPrepare();

                    decodedSCPStatementPrepare.QuorumSetHash = Hash.Decode(stream);
                    decodedSCPStatementPrepare.Ballot        = SCPBallot.Decode(stream);
                    int PreparedPresent = stream.ReadInt();

                    if (PreparedPresent != 0)
                    {
                        decodedSCPStatementPrepare.Prepared = SCPBallot.Decode(stream);
                    }
                    int PreparedPrimePresent = stream.ReadInt();

                    if (PreparedPrimePresent != 0)
                    {
                        decodedSCPStatementPrepare.PreparedPrime = SCPBallot.Decode(stream);
                    }
                    decodedSCPStatementPrepare.NC = Uint32.Decode(stream);
                    decodedSCPStatementPrepare.NH = Uint32.Decode(stream);
                    return(decodedSCPStatementPrepare);
                }
Exemplo n.º 30
0
        public static StellarMessage Decode(XdrDataInputStream stream)
        {
            StellarMessage decodedStellarMessage = new StellarMessage();
            MessageType    discriminant          = MessageType.Decode(stream);

            decodedStellarMessage.Discriminant = discriminant;
            switch (decodedStellarMessage.Discriminant.InnerValue)
            {
            case MessageType.MessageTypeEnum.ERROR_MSG:
                decodedStellarMessage.Error = Error.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.HELLO:
                decodedStellarMessage.Hello = Hello.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.AUTH:
                decodedStellarMessage.Auth = Auth.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.DONT_HAVE:
                decodedStellarMessage.DontHave = DontHave.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.GET_PEERS:
                break;

            case MessageType.MessageTypeEnum.PEERS:
                int peerssize = stream.ReadInt();
                decodedStellarMessage.Peers = new PeerAddress[peerssize];
                for (int i = 0; i < peerssize; i++)
                {
                    decodedStellarMessage.Peers[i] = PeerAddress.Decode(stream);
                }

                break;

            case MessageType.MessageTypeEnum.GET_TX_SET:
                decodedStellarMessage.TxSetHash = Uint256.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.TX_SET:
                decodedStellarMessage.TxSet = TransactionSet.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.TRANSACTION:
                decodedStellarMessage.Transaction = TransactionEnvelope.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET:
                decodedStellarMessage.QSetHash = Uint256.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.SCP_QUORUMSET:
                decodedStellarMessage.QSet = SCPQuorumSet.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.SCP_MESSAGE:
                decodedStellarMessage.Envelope = SCPEnvelope.Decode(stream);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_STATE:
                decodedStellarMessage.GetSCPLedgerSeq = Uint32.Decode(stream);
                break;
            }

            return(decodedStellarMessage);
        }