public static void Encode(IByteWriter stream, Memo encodedMemo) { XdrEncoding.EncodeInt32((int)encodedMemo.Discriminant.InnerValue, stream); switch (encodedMemo.Discriminant.InnerValue) { case MemoType.MemoTypeEnum.MEMO_NONE: break; case MemoType.MemoTypeEnum.MEMO_TEXT: XdrEncoding.WriteString(stream, encodedMemo.Text); break; case MemoType.MemoTypeEnum.MEMO_ID: Uint64.Encode(stream, encodedMemo.Id); break; case MemoType.MemoTypeEnum.MEMO_HASH: Hash.Encode(stream, encodedMemo.Hash); break; case MemoType.MemoTypeEnum.MEMO_RETURN: Hash.Encode(stream, encodedMemo.RetHash); break; } }
public static Memo Decode(XdrDataInputStream stream) { var decodedMemo = new Memo(); var discriminant = MemoType.Decode(stream); decodedMemo.Discriminant = discriminant; switch (decodedMemo.Discriminant.InnerValue) { case MemoType.MemoTypeEnum.MEMO_NONE: break; case MemoType.MemoTypeEnum.MEMO_TEXT: decodedMemo.Text = stream.ReadString(); break; case MemoType.MemoTypeEnum.MEMO_ID: decodedMemo.Id = Uint64.Decode(stream); break; case MemoType.MemoTypeEnum.MEMO_HASH: decodedMemo.Hash = Hash.Decode(stream); break; case MemoType.MemoTypeEnum.MEMO_RETURN: decodedMemo.RetHash = Hash.Decode(stream); break; } return(decodedMemo); }
/// <summary> /// </summary> /// <returns></returns> public new Type GetType() { switch (Type) { case 0x00: case 0x01: return(Uint8.GetType()); case 0x02: case 0x03: return(Uint16.GetType()); case 0x04: case 0x05: return(Uint32.GetType()); case 0x06: case 0x07: return(Uint64.GetType()); case 0x08: return(Ufloat.GetType()); case 0x0A: return(Str.GetType()); case 0x0B: return(Data.GetType()); default: return(null); } }
public static SequenceNumber Decode(IByteReader stream) { SequenceNumber decodedSequenceNumber = new SequenceNumber(); decodedSequenceNumber.InnerValue = Uint64.Decode(stream); return(decodedSequenceNumber); }
public static SequenceNumber Decode(XdrDataInputStream stream) { var decodedSequenceNumber = new SequenceNumber(); decodedSequenceNumber.InnerValue = Uint64.Decode(stream); return(decodedSequenceNumber); }
/// <summary> /// Generates Transaction XDR object. /// </summary> /// <returns></returns> public xdr.Transaction ToXdr() { // fee var fee = new Uint32 { InnerValue = Fee }; // sequenceNumber var sequenceNumberUint = new Uint64 { InnerValue = SequenceNumber }; var sequenceNumber = new SequenceNumber { InnerValue = sequenceNumberUint }; // sourceAccount var sourceAccount = new AccountID { InnerValue = SourceAccount.XdrPublicKey }; // 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 xdr.Transaction.TransactionExt { Discriminant = 0 }; var transaction = new xdr.Transaction { Fee = fee, SeqNum = sequenceNumber, SourceAccount = sourceAccount, Operations = operations, Memo = Memo.ToXdr(), TimeBounds = TimeBounds?.ToXdr(), Ext = ext }; return transaction; }
public static TimePoint Decode(XdrDataInputStream stream) { TimePoint decodedTimePoint = new TimePoint(); decodedTimePoint.InnerValue = Uint64.Decode(stream); return(decodedTimePoint); }
public static void Encode(XdrDataOutputStream stream, Memo encodedMemo) { stream.WriteInt((int)encodedMemo.Discriminant.InnerValue); switch (encodedMemo.Discriminant.InnerValue) { case MemoType.MemoTypeEnum.MEMO_NONE: break; case MemoType.MemoTypeEnum.MEMO_TEXT: stream.WriteString(encodedMemo.Text); break; case MemoType.MemoTypeEnum.MEMO_ID: Uint64.Encode(stream, encodedMemo.Id); break; case MemoType.MemoTypeEnum.MEMO_HASH: Hash.Encode(stream, encodedMemo.Hash); break; case MemoType.MemoTypeEnum.MEMO_RETURN: Hash.Encode(stream, encodedMemo.RetHash); break; } }
public static Uint64 Decode(XdrDataInputStream stream) { var decodedUint64 = new Uint64(); decodedUint64.InnerValue = stream.ReadLong(); return(decodedUint64); }
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); }
public static Uint64 Decode(IByteReader stream) { Uint64 decodedUint64 = new Uint64(); decodedUint64.InnerValue = XdrEncoding.DecodeUInt64(stream); return(decodedUint64); }
public static Memo Decode(IByteReader stream) { Memo decodedMemo = new Memo(); decodedMemo.Discriminant = MemoType.Decode(stream); switch (decodedMemo.Discriminant.InnerValue) { case MemoType.MemoTypeEnum.MEMO_NONE: break; case MemoType.MemoTypeEnum.MEMO_TEXT: decodedMemo.Text = XdrEncoding.ReadString(stream); break; case MemoType.MemoTypeEnum.MEMO_ID: decodedMemo.Id = Uint64.Decode(stream); break; case MemoType.MemoTypeEnum.MEMO_HASH: decodedMemo.Hash = Hash.Decode(stream); break; case MemoType.MemoTypeEnum.MEMO_RETURN: decodedMemo.RetHash = Hash.Decode(stream); break; } return(decodedMemo); }
public static TimeBounds Decode(IByteReader stream) { TimeBounds decodedTimeBounds = new TimeBounds(); decodedTimeBounds.MinTime = Uint64.Decode(stream); decodedTimeBounds.MaxTime = Uint64.Decode(stream); return(decodedTimeBounds); }
public static MuxedAccountMed25519 Decode(XdrDataInputStream stream) { MuxedAccountMed25519 decodedMuxedAccountMed25519 = new MuxedAccountMed25519(); decodedMuxedAccountMed25519.Id = Uint64.Decode(stream); decodedMuxedAccountMed25519.Ed25519 = Uint256.Decode(stream); return(decodedMuxedAccountMed25519); }
public static void Encode(IByteWriter stream, ManageOfferOp encodedManageOfferOp) { Asset.Encode(stream, encodedManageOfferOp.Selling); Asset.Encode(stream, encodedManageOfferOp.Buying); Int64.Encode(stream, encodedManageOfferOp.Amount); Price.Encode(stream, encodedManageOfferOp.Price); Uint64.Encode(stream, encodedManageOfferOp.OfferID); }
public static void Encode(XdrDataOutputStream stream, ManageOfferOp encodedManageOfferOp) { Asset.Encode(stream, encodedManageOfferOp.Selling); Asset.Encode(stream, encodedManageOfferOp.Buying); Int64.Encode(stream, encodedManageOfferOp.Amount); Price.Encode(stream, encodedManageOfferOp.Price); Uint64.Encode(stream, encodedManageOfferOp.OfferID); }
public static LedgerKeyOffer Decode(XdrDataInputStream stream) { var decodedLedgerKeyOffer = new LedgerKeyOffer(); decodedLedgerKeyOffer.SellerID = AccountID.Decode(stream); decodedLedgerKeyOffer.OfferID = Uint64.Decode(stream); return(decodedLedgerKeyOffer); }
public static LedgerKeyOffer Decode(IByteReader stream) { LedgerKeyOffer decodedLedgerKeyOffer = new LedgerKeyOffer(); decodedLedgerKeyOffer.SellerID = AccountID.Decode(stream); decodedLedgerKeyOffer.OfferID = Uint64.Decode(stream); return(decodedLedgerKeyOffer); }
public static TimeBounds Decode(XdrDataInputStream stream) { var decodedTimeBounds = new TimeBounds(); decodedTimeBounds.MinTime = Uint64.Decode(stream); decodedTimeBounds.MaxTime = Uint64.Decode(stream); return(decodedTimeBounds); }
public static AuthenticatedMessageV0 Decode(XdrDataInputStream stream) { var decodedAuthenticatedMessageV0 = new AuthenticatedMessageV0(); decodedAuthenticatedMessageV0.Sequence = Uint64.Decode(stream); decodedAuthenticatedMessageV0.Message = StellarMessage.Decode(stream); decodedAuthenticatedMessageV0.Mac = HmacSha256Mac.Decode(stream); return decodedAuthenticatedMessageV0; }
public static SCPStatement Decode(IByteReader stream) { SCPStatement decodedSCPStatement = new SCPStatement(); decodedSCPStatement.NodeID = NodeID.Decode(stream); decodedSCPStatement.SlotIndex = Uint64.Decode(stream); decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); return(decodedSCPStatement); }
public static AuthCert Decode(XdrDataInputStream stream) { var decodedAuthCert = new AuthCert(); decodedAuthCert.Pubkey = Curve25519Public.Decode(stream); decodedAuthCert.Expiration = Uint64.Decode(stream); decodedAuthCert.Sig = Signature.Decode(stream); return(decodedAuthCert); }
public static AuthCert Decode(IByteReader stream) { AuthCert decodedAuthCert = new AuthCert(); decodedAuthCert.Pubkey = Curve25519Public.Decode(stream); decodedAuthCert.Expiration = Uint64.Decode(stream); decodedAuthCert.Sig = Signature.Decode(stream); return(decodedAuthCert); }
public static void Encode(IByteWriter stream, ClaimOfferAtom encodedClaimOfferAtom) { AccountID.Encode(stream, encodedClaimOfferAtom.SellerID); Uint64.Encode(stream, encodedClaimOfferAtom.OfferID); Asset.Encode(stream, encodedClaimOfferAtom.AssetSold); Int64.Encode(stream, encodedClaimOfferAtom.AmountSold); Asset.Encode(stream, encodedClaimOfferAtom.AssetBought); Int64.Encode(stream, encodedClaimOfferAtom.AmountBought); }
public static void Encode(XdrDataOutputStream stream, ClaimOfferAtom encodedClaimOfferAtom) { AccountID.Encode(stream, encodedClaimOfferAtom.SellerID); Uint64.Encode(stream, encodedClaimOfferAtom.OfferID); Asset.Encode(stream, encodedClaimOfferAtom.AssetSold); Int64.Encode(stream, encodedClaimOfferAtom.AmountSold); Asset.Encode(stream, encodedClaimOfferAtom.AssetBought); Int64.Encode(stream, encodedClaimOfferAtom.AmountBought); }
public static SCPStatement Decode(XdrDataInputStream stream) { var decodedSCPStatement = new SCPStatement(); decodedSCPStatement.NodeID = NodeID.Decode(stream); decodedSCPStatement.SlotIndex = Uint64.Decode(stream); decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); return(decodedSCPStatement); }
public static AuthenticatedMessageV0 Decode(IByteReader stream) { AuthenticatedMessageV0 decodedAuthenticatedMessageV0 = new AuthenticatedMessageV0(); decodedAuthenticatedMessageV0.Sequence = Uint64.Decode(stream); decodedAuthenticatedMessageV0.Message = StellarMessage.Decode(stream); decodedAuthenticatedMessageV0.Mac = HmacSha256Mac.Decode(stream); return(decodedAuthenticatedMessageV0); }
public override xdr.Memo ToXdr() { xdr.Memo memo = new xdr.Memo(); memo.Discriminant = MemoType.Create(MemoType.MemoTypeEnum.MEMO_ID); Uint64 idXdr = new Uint64(); idXdr.InnerValue = IdValue; memo.Id = idXdr; return(memo); }
public static void Encode(IByteWriter stream, OfferEntry encodedOfferEntry) { AccountID.Encode(stream, encodedOfferEntry.SellerID); Uint64.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); }
public static ManageOfferOp Decode(IByteReader stream) { ManageOfferOp decodedManageOfferOp = new ManageOfferOp(); decodedManageOfferOp.Selling = Asset.Decode(stream); decodedManageOfferOp.Buying = Asset.Decode(stream); decodedManageOfferOp.Amount = Int64.Decode(stream); decodedManageOfferOp.Price = Price.Decode(stream); decodedManageOfferOp.OfferID = Uint64.Decode(stream); return(decodedManageOfferOp); }
public static void Encode(IByteWriter stream, Uint64 encodedUint64) { XdrEncoding.EncodeUInt64(encodedUint64.InnerValue, stream); }
public static Uint64 Decode(IByteReader stream) { Uint64 decodedUint64 = new Uint64(); decodedUint64.InnerValue = XdrEncoding.DecodeUInt64(stream); return decodedUint64; }
public SequenceNumber(Uint64 SequenceNumber) { InnerValue = SequenceNumber; }