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);
        }
Example #2
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);
        }
 public static void Encode(XdrDataOutputStream stream, SetTrustLineFlagsOp encodedSetTrustLineFlagsOp)
 {
     AccountID.Encode(stream, encodedSetTrustLineFlagsOp.Trustor);
     Asset.Encode(stream, encodedSetTrustLineFlagsOp.Asset);
     Uint32.Encode(stream, encodedSetTrustLineFlagsOp.ClearFlags);
     Uint32.Encode(stream, encodedSetTrustLineFlagsOp.SetFlags);
 }
Example #4
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);
        }
Example #5
0
        public static void Encode(XdrDataOutputStream stream, AccountEntry encodedAccountEntry)
        {
            AccountID.Encode(stream, encodedAccountEntry.AccountID);
            Int64.Encode(stream, encodedAccountEntry.Balance);
            SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum);
            Uint32.Encode(stream, encodedAccountEntry.NumSubEntries);
            if (encodedAccountEntry.InflationDest != null)
            {
                stream.WriteInt(1);
                AccountID.Encode(stream, encodedAccountEntry.InflationDest);
            }
            else
            {
                stream.WriteInt(0);
            }
            Uint32.Encode(stream, encodedAccountEntry.Flags);
            String32.Encode(stream, encodedAccountEntry.HomeDomain);
            Thresholds.Encode(stream, encodedAccountEntry.Thresholds);
            int signerssize = encodedAccountEntry.Signers.Length;

            stream.WriteInt(signerssize);
            for (int i = 0; i < signerssize; i++)
            {
                Signer.Encode(stream, encodedAccountEntry.Signers[i]);
            }
            AccountEntryExt.Encode(stream, encodedAccountEntry.Ext);
        }
Example #6
0
 public static void Encode(XdrDataOutputStream stream, TopologyResponseBody encodedTopologyResponseBody)
 {
     PeerStatList.Encode(stream, encodedTopologyResponseBody.InboundPeers);
     PeerStatList.Encode(stream, encodedTopologyResponseBody.OutboundPeers);
     Uint32.Encode(stream, encodedTopologyResponseBody.TotalInboundPeerCount);
     Uint32.Encode(stream, encodedTopologyResponseBody.TotalOutboundPeerCount);
 }
Example #7
0
        public static Uint32 Decode(XdrDataInputStream stream)
        {
            Uint32 decodedUint32 = new Uint32();

            decodedUint32.InnerValue = stream.ReadInt();
            return(decodedUint32);
        }
Example #8
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);
        }
 public static void Encode(XdrDataOutputStream stream,
                           SCPStatementExternalize encodedSCPStatementExternalize)
 {
     SCPBallot.Encode(stream, encodedSCPStatementExternalize.Commit);
     Uint32.Encode(stream, encodedSCPStatementExternalize.NH);
     Hash.Encode(stream, encodedSCPStatementExternalize.CommitQuorumSetHash);
 }
 public static void Encode(XdrDataOutputStream stream, SCPStatementPrepare encodedSCPStatementPrepare)
 {
     Hash.Encode(stream, encodedSCPStatementPrepare.QuorumSetHash);
     SCPBallot.Encode(stream, encodedSCPStatementPrepare.Ballot);
     if (encodedSCPStatementPrepare.Prepared != null)
     {
         stream.WriteInt(1);
         SCPBallot.Encode(stream, encodedSCPStatementPrepare.Prepared);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSCPStatementPrepare.PreparedPrime != null)
     {
         stream.WriteInt(1);
         SCPBallot.Encode(stream, encodedSCPStatementPrepare.PreparedPrime);
     }
     else
     {
         stream.WriteInt(0);
     }
     Uint32.Encode(stream, encodedSCPStatementPrepare.NC);
     Uint32.Encode(stream, encodedSCPStatementPrepare.NH);
 }
Example #11
0
 public static void Encode(XdrDataOutputStream stream,
                           TransactionHistoryResultEntry encodedTransactionHistoryResultEntry)
 {
     Uint32.Encode(stream, encodedTransactionHistoryResultEntry.LedgerSeq);
     TransactionResultSet.Encode(stream, encodedTransactionHistoryResultEntry.TxResultSet);
     TransactionHistoryResultEntryExt.Encode(stream, encodedTransactionHistoryResultEntry.Ext);
 }
        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);
        }
        public static void Encode(XdrDataOutputStream stream, TransactionV0 encodedTransactionV0)
        {
            Uint256.Encode(stream, encodedTransactionV0.SourceAccountEd25519);
            Uint32.Encode(stream, encodedTransactionV0.Fee);
            SequenceNumber.Encode(stream, encodedTransactionV0.SeqNum);
            if (encodedTransactionV0.TimeBounds != null)
            {
                stream.WriteInt(1);
                TimeBounds.Encode(stream, encodedTransactionV0.TimeBounds);
            }
            else
            {
                stream.WriteInt(0);
            }

            Memo.Encode(stream, encodedTransactionV0.Memo);
            int operationssize = encodedTransactionV0.Operations.Length;

            stream.WriteInt(operationssize);
            for (int i = 0; i < operationssize; i++)
            {
                Operation.Encode(stream, encodedTransactionV0.Operations[i]);
            }

            TransactionV0Ext.Encode(stream, encodedTransactionV0.Ext);
        }
Example #14
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);
        }
Example #16
0
        public static Signer Decode(XdrDataInputStream stream)
        {
            Signer decodedSigner = new Signer();

            decodedSigner.Key    = SignerKey.Decode(stream);
            decodedSigner.Weight = Uint32.Decode(stream);
            return(decodedSigner);
        }
        public static BucketMetadata Decode(XdrDataInputStream stream)
        {
            BucketMetadata decodedBucketMetadata = new BucketMetadata();

            decodedBucketMetadata.LedgerVersion = Uint32.Decode(stream);
            decodedBucketMetadata.Ext           = BucketMetadataExt.Decode(stream);
            return(decodedBucketMetadata);
        }
 public static void Encode(XdrDataOutputStream stream, SurveyResponseMessage encodedSurveyResponseMessage)
 {
     NodeID.Encode(stream, encodedSurveyResponseMessage.SurveyorPeerID);
     NodeID.Encode(stream, encodedSurveyResponseMessage.SurveyedPeerID);
     Uint32.Encode(stream, encodedSurveyResponseMessage.LedgerNum);
     SurveyMessageCommandType.Encode(stream, encodedSurveyResponseMessage.CommandType);
     EncryptedBody.Encode(stream, encodedSurveyResponseMessage.EncryptedBody);
 }
Example #19
0
        public static SCPBallot Decode(XdrDataInputStream stream)
        {
            SCPBallot decodedSCPBallot = new SCPBallot();

            decodedSCPBallot.Counter = Uint32.Decode(stream);
            decodedSCPBallot.Value   = Value.Decode(stream);
            return(decodedSCPBallot);
        }
Example #20
0
 public static void Encode(XdrDataOutputStream stream, SurveyRequestMessage encodedSurveyRequestMessage)
 {
     NodeID.Encode(stream, encodedSurveyRequestMessage.SurveyorPeerID);
     NodeID.Encode(stream, encodedSurveyRequestMessage.SurveyedPeerID);
     Uint32.Encode(stream, encodedSurveyRequestMessage.LedgerNum);
     Curve25519Public.Encode(stream, encodedSurveyRequestMessage.EncryptionKey);
     SurveyMessageCommandType.Encode(stream, encodedSurveyRequestMessage.CommandType);
 }
 public static void Encode(XdrDataOutputStream stream, SCPStatementConfirm encodedSCPStatementConfirm)
 {
     SCPBallot.Encode(stream, encodedSCPStatementConfirm.Ballot);
     Uint32.Encode(stream, encodedSCPStatementConfirm.NPrepared);
     Uint32.Encode(stream, encodedSCPStatementConfirm.NCommit);
     Uint32.Encode(stream, encodedSCPStatementConfirm.NH);
     Hash.Encode(stream, encodedSCPStatementConfirm.QuorumSetHash);
 }
Example #22
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);
 }
                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);
                }
            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);
            }
Example #25
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);
        }
Example #26
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);
        }
        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);
        }
Example #28
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);
        }
        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);
        }
Example #30
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);
        }