/// <inheritdoc /> public void GetObjectData( SerializationInfo info, StreamingContext context) { bool includeSignature = context.Context is TransactionSerializationContext txContext && txContext.IncludeSignature; RawTransaction rawTx = ToRawTransaction(includeSignature); rawTx.GetObjectData(info, context); }
internal Transaction(RawTransaction rawTx) { Sender = new Address(rawTx.Sender); PublicKey = new PublicKey(rawTx.PublicKey); Recipient = new Address(rawTx.Recipient); Timestamp = DateTimeOffset.ParseExact( rawTx.Timestamp, TimestampFormat, CultureInfo.InvariantCulture).ToUniversalTime(); Actions = rawTx.Actions.Select(ToAction).ToList(); Signature = rawTx.Signature; }
internal Transaction(RawTransaction rawTx) { Signer = new Address(rawTx.Signer); PublicKey = new PublicKey(rawTx.PublicKey); UpdatedAddresses = rawTx.UpdatedAddresses.Select(a => new Address(a)).ToImmutableHashSet(); Timestamp = DateTimeOffset.ParseExact( rawTx.Timestamp, TimestampFormat, CultureInfo.InvariantCulture).ToUniversalTime(); Actions = rawTx.Actions.Select(ToAction).ToImmutableList(); Signature = rawTx.Signature; }
public Transaction(RawTransaction rawTx) : this( new Address(rawTx.Sender), new PublicKey(rawTx.PublicKey), new Address(rawTx.Recipient), DateTime.ParseExact( rawTx.Timestamp, TimestampFormat, CultureInfo.InvariantCulture ).ToUniversalTime(), rawTx.Actions.Select(ToAction).ToList(), rawTx.Signature ) { }
internal Transaction(RawTransaction rawTx) : this( new Address(rawTx.Signer), new PublicKey(rawTx.PublicKey), rawTx.UpdatedAddresses.Select( a => new Address(a) ).ToImmutableHashSet(), DateTimeOffset.ParseExact( rawTx.Timestamp, TimestampFormat, CultureInfo.InvariantCulture).ToUniversalTime(), rawTx.Actions.Select(ToAction).ToImmutableList(), rawTx.Signature, false) { }
internal RawTransaction ToRawTransaction(bool includeSign) { var rawTx = new RawTransaction( nonce: Nonce, signer: Signer.ByteArray, updatedAddresses: UpdatedAddresses.Select(a => a.ByteArray).ToImmutableArray(), publicKey: PublicKey.Format(false).ToImmutableArray(), timestamp: Timestamp.ToString(TimestampFormat, CultureInfo.InvariantCulture), actions: Actions.Select(a => a.PlainValue) ); if (includeSign) { rawTx = rawTx.AddSignature(Signature); } return(rawTx); }
#pragma warning disable SA1118 // Parameter spans multiple line internal Transaction(RawTransaction rawTx) : this( rawTx.Nonce, new Address(rawTx.Signer), new PublicKey(rawTx.PublicKey.ToArray()), rawTx.GenesisHash != ImmutableArray <byte> .Empty ? new HashDigest <SHA256>(rawTx.GenesisHash.ToArray()) : (HashDigest <SHA256>?)null, rawTx.UpdatedAddresses.Select( a => new Address(a) ).ToImmutableHashSet(), DateTimeOffset.ParseExact( rawTx.Timestamp, TimestampFormat, CultureInfo.InvariantCulture).ToUniversalTime(), rawTx.Actions.Select(ToAction).ToImmutableList(), rawTx.Signature.ToArray()) #pragma warning restore SA1118 // Parameter spans multiple line { }
public RawTransaction ToRawTransaction(bool includeSign) { var rawTx = new RawTransaction( sender: Sender.ToByteArray(), recipient: Recipient.ToByteArray(), publicKey: PublicKey.Format(false), timestamp: Timestamp.ToString(TimestampFormat), actions: Actions.Select(a => new Dictionary <string, object> { { "type_id", ActionTypeAttribute.ValueOf(a.GetType()) }, { "values", a.PlainValue }, }) ); if (includeSign) { rawTx = rawTx.AddSignature(Signature); } return(rawTx); }
internal RawTransaction ToRawTransaction(bool includeSign) { var rawTx = new RawTransaction( signer: Signer.ToByteArray(), updatedAddresses: UpdatedAddresses.Select(a => a.ToByteArray()).ToArray(), publicKey: PublicKey.Format(false), timestamp: Timestamp.ToString(TimestampFormat), actions: Actions.Select(a => a.PlainValue.ToDictionary( kv => kv.Key, kv => kv.Value ) ) ); if (includeSign) { rawTx = rawTx.AddSignature(Signature); } return(rawTx); }