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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
 public static void Encode(XdrDataOutputStream stream,
                           TransactionHistoryResultEntry encodedTransactionHistoryResultEntry)
 {
     Uint32.Encode(stream, encodedTransactionHistoryResultEntry.LedgerSeq);
     TransactionResultSet.Encode(stream, encodedTransactionHistoryResultEntry.TxResultSet);
     TransactionHistoryResultEntryExt.Encode(stream, encodedTransactionHistoryResultEntry.Ext);
 }
Exemplo n.º 5
0
 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);
 }
 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, SetTrustLineFlagsOp encodedSetTrustLineFlagsOp)
 {
     AccountID.Encode(stream, encodedSetTrustLineFlagsOp.Trustor);
     Asset.Encode(stream, encodedSetTrustLineFlagsOp.Asset);
     Uint32.Encode(stream, encodedSetTrustLineFlagsOp.ClearFlags);
     Uint32.Encode(stream, encodedSetTrustLineFlagsOp.SetFlags);
 }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
0
 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);
 }
 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);
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
0
        public static void Encode(XdrDataOutputStream stream, LedgerSCPMessages encodedLedgerSCPMessages)
        {
            Uint32.Encode(stream, encodedLedgerSCPMessages.LedgerSeq);
            int messagessize = encodedLedgerSCPMessages.Messages.Length;

            stream.WriteInt(messagessize);
            for (int i = 0; i < messagessize; i++)
            {
                SCPEnvelope.Encode(stream, encodedLedgerSCPMessages.Messages[i]);
            }
        }
Exemplo n.º 13
0
 public static void Encode(XdrDataOutputStream stream, OfferEntry encodedOfferEntry)
 {
     AccountID.Encode(stream, encodedOfferEntry.SellerID);
     Int64.Encode(stream, encodedOfferEntry.OfferID);
     Asset.Encode(stream, encodedOfferEntry.Selling);
     Asset.Encode(stream, encodedOfferEntry.Buying);
     Int64.Encode(stream, encodedOfferEntry.Amount);
     Price.Encode(stream, encodedOfferEntry.Price);
     Uint32.Encode(stream, encodedOfferEntry.Flags);
     OfferEntryExt.Encode(stream, encodedOfferEntry.Ext);
 }
Exemplo n.º 14
0
 public static void Encode(XdrDataOutputStream stream, Hello encodedHello)
 {
     Uint32.Encode(stream, encodedHello.LedgerVersion);
     Uint32.Encode(stream, encodedHello.OverlayVersion);
     Uint32.Encode(stream, encodedHello.OverlayMinVersion);
     Hash.Encode(stream, encodedHello.NetworkID);
     stream.WriteString(encodedHello.VersionStr);
     stream.WriteInt(encodedHello.ListeningPort);
     NodeID.Encode(stream, encodedHello.PeerID);
     AuthCert.Encode(stream, encodedHello.Cert);
     Uint256.Encode(stream, encodedHello.Nonce);
 }
        public static void Encode(XdrDataOutputStream stream, AccountEntryExtensionV2 encodedAccountEntryExtensionV2)
        {
            Uint32.Encode(stream, encodedAccountEntryExtensionV2.NumSponsored);
            Uint32.Encode(stream, encodedAccountEntryExtensionV2.NumSponsoring);
            int signerSponsoringIDssize = encodedAccountEntryExtensionV2.SignerSponsoringIDs.Length;

            stream.WriteInt(signerSponsoringIDssize);
            for (int i = 0; i < signerSponsoringIDssize; i++)
            {
                SponsorshipDescriptor.Encode(stream, encodedAccountEntryExtensionV2.SignerSponsoringIDs[i]);
            }
            AccountEntryExtensionV2Ext.Encode(stream, encodedAccountEntryExtensionV2.Ext);
        }
Exemplo n.º 16
0
        public static void Encode(XdrDataOutputStream stream, SCPQuorumSet encodedSCPQuorumSet)
        {
            Uint32.Encode(stream, encodedSCPQuorumSet.Threshold);
            int validatorssize = encodedSCPQuorumSet.Validators.Length;

            stream.WriteInt(validatorssize);
            for (int i = 0; i < validatorssize; i++)
            {
                PublicKey.Encode(stream, encodedSCPQuorumSet.Validators[i]);
            }
            int innerSetssize = encodedSCPQuorumSet.InnerSets.Length;

            stream.WriteInt(innerSetssize);
            for (int i = 0; i < innerSetssize; i++)
            {
                SCPQuorumSet.Encode(stream, encodedSCPQuorumSet.InnerSets[i]);
            }
        }
Exemplo n.º 17
0
        public static void Encode(XdrDataOutputStream stream, LedgerUpgrade encodedLedgerUpgrade)
        {
            stream.WriteInt((int)encodedLedgerUpgrade.Discriminant.InnerValue);
            switch (encodedLedgerUpgrade.Discriminant.InnerValue)
            {
            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION:
                Uint32.Encode(stream, encodedLedgerUpgrade.NewLedgerVersion);
                break;

            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE:
                Uint32.Encode(stream, encodedLedgerUpgrade.NewBaseFee);
                break;

            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE:
                Uint32.Encode(stream, encodedLedgerUpgrade.NewMaxTxSetSize);
                break;

            case LedgerUpgradeType.LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_RESERVE:
                Uint32.Encode(stream, encodedLedgerUpgrade.NewBaseReserve);
                break;
            }
        }
Exemplo n.º 18
0
        public static void Encode(XdrDataOutputStream stream, LedgerHeader encodedLedgerHeader)
        {
            Uint32.Encode(stream, encodedLedgerHeader.LedgerVersion);
            Hash.Encode(stream, encodedLedgerHeader.PreviousLedgerHash);
            StellarValue.Encode(stream, encodedLedgerHeader.ScpValue);
            Hash.Encode(stream, encodedLedgerHeader.TxSetResultHash);
            Hash.Encode(stream, encodedLedgerHeader.BucketListHash);
            Uint32.Encode(stream, encodedLedgerHeader.LedgerSeq);
            Int64.Encode(stream, encodedLedgerHeader.TotalCoins);
            Int64.Encode(stream, encodedLedgerHeader.FeePool);
            Uint32.Encode(stream, encodedLedgerHeader.InflationSeq);
            Uint64.Encode(stream, encodedLedgerHeader.IdPool);
            Uint32.Encode(stream, encodedLedgerHeader.BaseFee);
            Uint32.Encode(stream, encodedLedgerHeader.BaseReserve);
            Uint32.Encode(stream, encodedLedgerHeader.MaxTxSetSize);
            int skipListsize = encodedLedgerHeader.SkipList.Length;

            for (int i = 0; i < skipListsize; i++)
            {
                Hash.Encode(stream, encodedLedgerHeader.SkipList[i]);
            }
            LedgerHeaderExt.Encode(stream, encodedLedgerHeader.Ext);
        }
Exemplo n.º 19
0
 public static void Encode(XdrDataOutputStream stream, LedgerEntry encodedLedgerEntry)
 {
     Uint32.Encode(stream, encodedLedgerEntry.LastModifiedLedgerSeq);
     LedgerEntryData.Encode(stream, encodedLedgerEntry.Data);
     LedgerEntryExt.Encode(stream, encodedLedgerEntry.Ext);
 }
Exemplo n.º 20
0
        public static void Encode(XdrDataOutputStream stream, StellarMessage encodedStellarMessage)
        {
            stream.WriteInt((int)encodedStellarMessage.Discriminant.InnerValue);
            switch (encodedStellarMessage.Discriminant.InnerValue)
            {
            case MessageType.MessageTypeEnum.ERROR_MSG:
                Error.Encode(stream, encodedStellarMessage.Error);
                break;

            case MessageType.MessageTypeEnum.HELLO:
                Hello.Encode(stream, encodedStellarMessage.Hello);
                break;

            case MessageType.MessageTypeEnum.AUTH:
                Auth.Encode(stream, encodedStellarMessage.Auth);
                break;

            case MessageType.MessageTypeEnum.DONT_HAVE:
                DontHave.Encode(stream, encodedStellarMessage.DontHave);
                break;

            case MessageType.MessageTypeEnum.GET_PEERS:
                break;

            case MessageType.MessageTypeEnum.PEERS:
                int peerssize = encodedStellarMessage.Peers.Length;
                stream.WriteInt(peerssize);
                for (int i = 0; i < peerssize; i++)
                {
                    PeerAddress.Encode(stream, encodedStellarMessage.Peers[i]);
                }

                break;

            case MessageType.MessageTypeEnum.GET_TX_SET:
                Uint256.Encode(stream, encodedStellarMessage.TxSetHash);
                break;

            case MessageType.MessageTypeEnum.TX_SET:
                TransactionSet.Encode(stream, encodedStellarMessage.TxSet);
                break;

            case MessageType.MessageTypeEnum.TRANSACTION:
                TransactionEnvelope.Encode(stream, encodedStellarMessage.Transaction);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET:
                Uint256.Encode(stream, encodedStellarMessage.QSetHash);
                break;

            case MessageType.MessageTypeEnum.SCP_QUORUMSET:
                SCPQuorumSet.Encode(stream, encodedStellarMessage.QSet);
                break;

            case MessageType.MessageTypeEnum.SCP_MESSAGE:
                SCPEnvelope.Encode(stream, encodedStellarMessage.Envelope);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_STATE:
                Uint32.Encode(stream, encodedStellarMessage.GetSCPLedgerSeq);
                break;
            }
        }
Exemplo n.º 21
0
 public static void Encode(XdrDataOutputStream stream, SCPBallot encodedSCPBallot)
 {
     Uint32.Encode(stream, encodedSCPBallot.Counter);
     Value.Encode(stream, encodedSCPBallot.Value);
 }
Exemplo n.º 22
0
 public static void Encode(XdrDataOutputStream stream, Signer encodedSigner)
 {
     SignerKey.Encode(stream, encodedSigner.Key);
     Uint32.Encode(stream, encodedSigner.Weight);
 }
Exemplo n.º 23
0
        public static void Encode(XdrDataOutputStream stream, SetOptionsOp encodedSetOptionsOp)
        {
            if (encodedSetOptionsOp.InflationDest != null)
            {
                stream.WriteInt(1);
                AccountID.Encode(stream, encodedSetOptionsOp.InflationDest);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.ClearFlags != null)
            {
                stream.WriteInt(1);
                Uint32.Encode(stream, encodedSetOptionsOp.ClearFlags);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.SetFlags != null)
            {
                stream.WriteInt(1);
                Uint32.Encode(stream, encodedSetOptionsOp.SetFlags);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.MasterWeight != null)
            {
                stream.WriteInt(1);
                Uint32.Encode(stream, encodedSetOptionsOp.MasterWeight);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.LowThreshold != null)
            {
                stream.WriteInt(1);
                Uint32.Encode(stream, encodedSetOptionsOp.LowThreshold);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.MedThreshold != null)
            {
                stream.WriteInt(1);
                Uint32.Encode(stream, encodedSetOptionsOp.MedThreshold);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.HighThreshold != null)
            {
                stream.WriteInt(1);
                Uint32.Encode(stream, encodedSetOptionsOp.HighThreshold);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.HomeDomain != null)
            {
                stream.WriteInt(1);
                String32.Encode(stream, encodedSetOptionsOp.HomeDomain);
            }
            else
            {
                stream.WriteInt(0);
            }

            if (encodedSetOptionsOp.Signer != null)
            {
                stream.WriteInt(1);
                Signer.Encode(stream, encodedSetOptionsOp.Signer);
            }
            else
            {
                stream.WriteInt(0);
            }
        }
Exemplo n.º 24
0
 public static void Encode(XdrDataOutputStream stream, OperationIDId encodedOperationIDId)
 {
     MuxedAccount.Encode(stream, encodedOperationIDId.SourceAccount);
     SequenceNumber.Encode(stream, encodedOperationIDId.SeqNum);
     Uint32.Encode(stream, encodedOperationIDId.OpNum);
 }
Exemplo n.º 25
0
 public static void Encode(XdrDataOutputStream stream, PeerAddress encodedPeerAddress)
 {
     PeerAddressIp.Encode(stream, encodedPeerAddress.Ip);
     Uint32.Encode(stream, encodedPeerAddress.Port);
     Uint32.Encode(stream, encodedPeerAddress.NumFailures);
 }
Exemplo n.º 26
0
 public static void Encode(XdrDataOutputStream stream, AllowTrustOp encodedAllowTrustOp)
 {
     AccountID.Encode(stream, encodedAllowTrustOp.Trustor);
     AssetCode.Encode(stream, encodedAllowTrustOp.Asset);
     Uint32.Encode(stream, encodedAllowTrustOp.Authorize);
 }
Exemplo n.º 27
0
 public static void Encode(XdrDataOutputStream stream, BucketMetadata encodedBucketMetadata)
 {
     Uint32.Encode(stream, encodedBucketMetadata.LedgerVersion);
     BucketMetadataExt.Encode(stream, encodedBucketMetadata.Ext);
 }
 public static void Encode(XdrDataOutputStream stream, ClaimableBalanceEntryExtensionV1 encodedClaimableBalanceEntryExtensionV1)
 {
     ClaimableBalanceEntryExtensionV1Ext.Encode(stream, encodedClaimableBalanceEntryExtensionV1.Ext);
     Uint32.Encode(stream, encodedClaimableBalanceEntryExtensionV1.Flags);
 }