public TransactionContent(TransactionEntity[] Sources, TransactionEntity[] Destinations, long TransactionFee, long Timestamp) { this.Destinations = Destinations.ToList(); this.Sources = Sources.ToList(); this.transactionFee = TransactionFee; this.timeStamp = Timestamp; }
public TransactionContent(TransactionEntity[] Sources, TransactionEntity[] Destinations, long TransactionFee, List<Hash> Signatures, long Timestamp) { this.Destinations = Destinations.ToList(); this.timeStamp = Timestamp; this.Sources = Sources.ToList(); this.Signatures = Signatures; this.transactionFee = TransactionFee; UpdateIntHash(); }
public SingleTransactionFactory(AccountIdentifier source, AccountIdentifier destination, long transactionFee, long destValue) { this.source = source; this.destination = destination; this.destValue = destValue; this.transactionFee = transactionFee; TransactionEntity teSrc = new TransactionEntity(this.source, destValue + transactionFee); TransactionEntity teDst = new TransactionEntity(this.destination, destValue); long Time = DateTime.UtcNow.ToFileTimeUtc(); TC = new TransactionContent(new TransactionEntity[] { teSrc }, new TransactionEntity[] { teDst }, transactionFee, Time); tranxData = TC.GetTransactionData(); }
public void Deserialize(byte[] Data) { Init(); List<ProtocolDataType> PDTs = ProtocolPackager.UnPackRaw(Data); int cnt = 0; while (cnt < (int)PDTs.Count) { ProtocolDataType PDT = PDTs[cnt++]; switch (PDT.NameType) { case 0: { ProtocolPackager.UnpackByteVector(PDT, 0, ref versionData); } break; case 1: { ProtocolPackager.UnpackByteVector(PDT, 1, ref executionData); } break; case 2: { ProtocolPackager.UnpackInt64(PDT, 2, ref timeStamp); } break; case 3: { byte[] tempSource = new byte[0]; ProtocolPackager.UnpackByteVector(PDT, 3, ref tempSource); if (tempSource.Length > 0) { TransactionEntity tsk = new TransactionEntity(); tsk.Deserialize(tempSource); Sources.Add(tsk); } } break; case 4: { byte[] tempDestination = new byte[0]; ProtocolPackager.UnpackByteVector(PDT, 4, ref tempDestination); if (tempDestination.Length > 0) { TransactionEntity tsk = new TransactionEntity(); tsk.Deserialize(tempDestination); Destinations.Add(tsk); } } break; case 5: { ProtocolPackager.UnpackInt64(PDT, 5, ref transactionFee); } break; case 6: { Hash tempSignature; ProtocolPackager.UnpackHash(PDT, 6, out tempSignature); if (tempSignature.Hex.Length > 0) { Signatures.Add(tempSignature); } } break; } } // Update the internal Hash of the object. UpdateIntHash(); }
private DBResponse InsertToHistoryTable(Hash transactionID, long timeStamp, TransactionEntity entity, SQLiteTransaction transaction) { DBResponse response = DBResponse.Exception; using (SQLiteCommand cmd = new SQLiteCommand("INSERT INTO TransactionHistory VALUES(@transactionID, @publicKey, @timeStamp);", sqliteConnection, transaction)) { cmd.Parameters.Add(new SQLiteParameter("@transactionID", transactionID.Hex)); cmd.Parameters.Add(new SQLiteParameter("@publicKey", entity.PublicKey)); cmd.Parameters.Add(new SQLiteParameter("@timeStamp", timeStamp)); if (cmd.ExecuteNonQuery() != 1) { response = DBResponse.InsertFailed; } else { response = DBResponse.InsertSuccess; } } return response; }
public JS_TransactionEntity(TransactionEntity entity) { PublicKey = entity.PublicKey; Name = entity.Name; Address = entity.Address; Value = entity.Value; }