public static Uint256 Decode(IByteReader stream) { Uint256 decodedUint256 = new Uint256(); int uint256size = 32; decodedUint256.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)uint256size); return decodedUint256; }
public static Uint256 Decode(IByteReader stream) { Uint256 decodedUint256 = new Uint256(); int uint256size = 32; decodedUint256.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)uint256size); return(decodedUint256); }
public static DontHave Decode(XdrDataInputStream stream) { var decodedDontHave = new DontHave(); decodedDontHave.Type = MessageType.Decode(stream); decodedDontHave.ReqHash = Uint256.Decode(stream); return(decodedDontHave); }
public static MuxedAccountMed25519 Decode(XdrDataInputStream stream) { MuxedAccountMed25519 decodedMuxedAccountMed25519 = new MuxedAccountMed25519(); decodedMuxedAccountMed25519.Id = Uint64.Decode(stream); decodedMuxedAccountMed25519.Ed25519 = Uint256.Decode(stream); return(decodedMuxedAccountMed25519); }
public static DontHave Decode(IByteReader stream) { DontHave decodedDontHave = new DontHave(); decodedDontHave.Type = MessageType.Decode(stream); decodedDontHave.ReqHash = Uint256.Decode(stream); return(decodedDontHave); }
public static Uint256 Decode(XdrDataInputStream stream) { Uint256 decodedUint256 = new Uint256(); int uint256size = 32; decodedUint256.InnerValue = new byte[uint256size]; stream.Read(decodedUint256.InnerValue, 0, uint256size); return(decodedUint256); }
public static void Encode(XdrDataOutputStream stream, PublicKey encodedPublicKey) { stream.WriteInt((int)encodedPublicKey.Discriminant.InnerValue); switch (encodedPublicKey.Discriminant.InnerValue) { case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: Uint256.Encode(stream, encodedPublicKey.Ed25519); break; } }
public static void Encode(IByteWriter stream, PublicKey encodedPublicKey) { XdrEncoding.EncodeInt32((int)encodedPublicKey.Discriminant.InnerValue, stream); switch (encodedPublicKey.Discriminant.InnerValue) { case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: Uint256.Encode(stream, encodedPublicKey.Ed25519); break; } }
public static void Encode(IByteWriter stream, Hello encodedHello) { Uint32.Encode(stream, encodedHello.LedgerVersion); Uint32.Encode(stream, encodedHello.OverlayVersion); Uint32.Encode(stream, encodedHello.OverlayMinVersion); Hash.Encode(stream, encodedHello.NetworkID); XdrEncoding.WriteString(stream, encodedHello.VersionStr); XdrEncoding.EncodeInt32(encodedHello.ListeningPort, stream); NodeID.Encode(stream, encodedHello.PeerID); AuthCert.Encode(stream, encodedHello.Cert); Uint256.Encode(stream, encodedHello.Nonce); }
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 PublicKey Decode(IByteReader stream) { PublicKey decodedPublicKey = new PublicKey(); decodedPublicKey.Discriminant = CryptoKeyType.Decode(stream); switch (decodedPublicKey.Discriminant.InnerValue) { case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: decodedPublicKey.Ed25519 = Uint256.Decode(stream); break; } return(decodedPublicKey); }
public static PublicKey Decode(XdrDataInputStream stream) { var decodedPublicKey = new PublicKey(); var discriminant = PublicKeyType.Decode(stream); decodedPublicKey.Discriminant = discriminant; switch (decodedPublicKey.Discriminant.InnerValue) { case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519: decodedPublicKey.Ed25519 = Uint256.Decode(stream); break; } return(decodedPublicKey); }
public static void Encode(XdrDataOutputStream stream, MuxedAccount encodedMuxedAccount) { stream.WriteInt((int)encodedMuxedAccount.Discriminant.InnerValue); switch (encodedMuxedAccount.Discriminant.InnerValue) { case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: Uint256.Encode(stream, encodedMuxedAccount.Ed25519); break; case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: MuxedAccountMed25519.Encode(stream, encodedMuxedAccount.Med25519); break; } }
public static Hello Decode(IByteReader 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 = XdrEncoding.ReadString(stream); decodedHello.ListeningPort = XdrEncoding.DecodeInt32(stream); decodedHello.PeerID = NodeID.Decode(stream); decodedHello.Cert = AuthCert.Decode(stream); decodedHello.Nonce = Uint256.Decode(stream); return(decodedHello); }
public static Hello Decode(XdrDataInputStream stream) { var 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); }
/// <summary> /// Generates Transaction XDR object. /// </summary> /// <returns></returns> public TransactionV0 ToXdrV0() { if (!(SourceAccount is KeyPair)) { throw new Exception("TransactionEnvelope V0 expects a KeyPair source account"); } // fee var fee = new Uint32 { InnerValue = Fee }; // sequenceNumber var sequenceNumberUint = new xdr.Int64(SequenceNumber); var sequenceNumber = new SequenceNumber { InnerValue = sequenceNumberUint }; // sourceAccount var sourceAccount = new Uint256(SourceAccount.PublicKey); // operations var operations = new xdr.Operation[Operations.Length]; for (var i = 0; i < Operations.Length; i++) { operations[i] = Operations[i].ToXdr(); } // ext var ext = new TransactionV0.TransactionV0Ext { Discriminant = 0 }; var transaction = new TransactionV0 { Fee = fee, SeqNum = sequenceNumber, SourceAccountEd25519 = sourceAccount, Operations = operations, Memo = Memo.ToXdr(), TimeBounds = TimeBounds?.ToXdr(), Ext = ext }; return(transaction); }
public static void Encode(XdrDataOutputStream stream, SignerKey encodedSignerKey) { stream.WriteInt((int)encodedSignerKey.Discriminant.InnerValue); switch (encodedSignerKey.Discriminant.InnerValue) { case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: Uint256.Encode(stream, encodedSignerKey.Ed25519); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: Uint256.Encode(stream, encodedSignerKey.PreAuthTx); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: Uint256.Encode(stream, encodedSignerKey.HashX); break; } }
public static void Encode(IByteWriter stream, SignerKey encodedSignerKey) { XdrEncoding.EncodeInt32((int)encodedSignerKey.Discriminant.InnerValue, stream); switch (encodedSignerKey.Discriminant.InnerValue) { case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: Uint256.Encode(stream, encodedSignerKey.Ed25519); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: Uint256.Encode(stream, encodedSignerKey.PreAuthTx); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: Uint256.Encode(stream, encodedSignerKey.HashX); break; } }
public static MuxedAccount Decode(XdrDataInputStream stream) { MuxedAccount decodedMuxedAccount = new MuxedAccount(); CryptoKeyType discriminant = CryptoKeyType.Decode(stream); decodedMuxedAccount.Discriminant = discriminant; switch (decodedMuxedAccount.Discriminant.InnerValue) { case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_ED25519: decodedMuxedAccount.Ed25519 = Uint256.Decode(stream); break; case CryptoKeyType.CryptoKeyTypeEnum.KEY_TYPE_MUXED_ED25519: decodedMuxedAccount.Med25519 = MuxedAccountMed25519.Decode(stream); break; } return(decodedMuxedAccount); }
public static SignerKey Decode(IByteReader stream) { SignerKey decodedSignerKey = new SignerKey(); decodedSignerKey.Discriminant = SignerKeyType.Decode(stream); switch (decodedSignerKey.Discriminant.InnerValue) { case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: decodedSignerKey.Ed25519 = Uint256.Decode(stream); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: decodedSignerKey.PreAuthTx = Uint256.Decode(stream); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: decodedSignerKey.HashX = Uint256.Decode(stream); break; } return(decodedSignerKey); }
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); }
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, DontHave encodedDontHave) { MessageType.Encode(stream, encodedDontHave.Type); Uint256.Encode(stream, encodedDontHave.ReqHash); }
public static void Encode(XdrDataOutputStream stream, MuxedAccountMed25519 encodedMuxedAccountMed25519) { Uint64.Encode(stream, encodedMuxedAccountMed25519.Id); Uint256.Encode(stream, encodedMuxedAccountMed25519.Ed25519); }
public static void Encode(XdrDataOutputStream stream, Uint256 encodedUint256) { int uint256size = encodedUint256.InnerValue.Length; stream.Write(encodedUint256.InnerValue, 0, uint256size); }
public static void Encode(IByteWriter stream, Uint256 encodedUint256) { int uint256Size = encodedUint256.InnerValue.Length; XdrEncoding.WriteFixOpaque(stream, (uint)uint256Size, encodedUint256.InnerValue); }
public static void Encode(IByteWriter stream, DontHave encodedDontHave) { MessageType.Encode(stream, encodedDontHave.Type); Uint256.Encode(stream, encodedDontHave.ReqHash); }
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; } }
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); }