コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SignedTransaction"/> class.
 /// </summary>
 /// <param name="payload">The payload.</param>
 /// <param name="hash">The hash.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionType">The transaction type.</param>
 /// <exception cref="ArgumentException">
 /// Value cannot be null or empty. - payload
 /// or
 /// Invalid hash.
 /// or
 /// Invalid signer key.
 /// </exception>
 internal SignedTransaction(string payload, string hash, string signer, TransactionTypes.Types transactionType)
 {
     if (hash.Length != 64 || !Regex.IsMatch(hash, @"\A\b[0-9a-fA-F]+\b\Z"))
     {
         throw new ArgumentException("Invalid hash.");
     }
     TransactionType = transactionType;
     Payload         = payload;
     Hash            = hash;
     Signer          = signer;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SignedTransaction"/> class.
 /// </summary>
 /// <param name="payload">The payload.</param>
 /// <param name="hash">The hash.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionType">The transaction type.</param>
 /// <exception cref="ArgumentException">
 /// Value cannot be null or empty. - payload
 /// or
 /// Invalid hash.
 /// or
 /// Invalid signer key.
 /// </exception>
 internal SignedTransaction(string payload, string signature, string hash, string signer, TransactionTypes.Types transactionType)
 {
     if (hash.Length != 64 || !Regex.IsMatch(hash, @"\A\b[0-9a-fA-F]+\b\Z"))
     {
         throw new ArgumentException("Invalid hash.");
     }
     TransactionType   = transactionType;
     Payload           = payload;
     Hash              = hash;
     Signer            = signer;
     TransactionPacket = JObject.Parse("{\"data\":\"" + payload + "\",\"signature\":\"" + signature + "\"}");
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AggregateTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The transaction version.</param>
 /// <param name="transactionType">Type of the transaction.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="innerTransactions">The inner transactions.</param>
 /// <param name="cosignatures">The cosignatures.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public AggregateTransaction(NetworkType.Types networkType, int version, TransactionTypes.Types transactionType, Deadline deadline, ulong fee, List <Transaction> innerTransactions, List <AggregateTransactionCosignature> cosignatures, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     InnerTransactions = innerTransactions;
     Cosignatures      = cosignatures;
     Deadline          = deadline;
     NetworkType       = networkType;
     Fee             = fee;
     TransactionType = transactionType;
     Version         = version;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
 }
コード例 #4
0
        /// <summary>
        /// Static creates a new instance of the <see cref="SignedTransaction"/> class.
        /// </summary>
        /// <param name="payload">The payload.</param>
        /// <param name="hash">The hash.</param>
        /// <param name="signer">The signer.</param>
        /// <param name="transactionType">The transaction type.</param>
        /// <returns><see cref="SignedTransaction"/>.</returns>
        /// <exception cref="ArgumentNullException">
        /// payload
        /// or
        /// hash
        /// or
        /// signer
        /// </exception>
        /// <exception cref="ArgumentException">
        /// invalid hash length
        /// or
        /// invalid signer length
        /// </exception>
        public static SignedMultisigTransaction Create(byte[] payload, byte[] signature, byte[] hash, byte[] innerHash, byte[] signer, TransactionTypes.Types transactionType)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }
            if (signature == null)
            {
                throw new ArgumentNullException(nameof(signature));
            }
            if (hash == null)
            {
                throw new ArgumentNullException(nameof(hash));
            }
            if (hash.Length != 32)
            {
                throw new ArgumentException("invalid hash length");
            }
            if (signer == null)
            {
                throw new ArgumentNullException(nameof(signer));
            }
            if (signer.Length != 32)
            {
                throw new ArgumentException("invalid signer length");
            }

            return(new SignedMultisigTransaction(payload.ToHexLower(), signature.ToHexLower(), hash.ToHexLower(), innerHash.ToHexLower(), signer.ToHexLower(), transactionType));
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AggregateTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The transaction version.</param>
 /// <param name="transactionType">Type of the transaction.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="innerTransactions">The inner transactions.</param>
 /// <param name="cosignatures">The cosignatures.</param>
 public AggregateTransaction(NetworkType.Types networkType, int version, TransactionTypes.Types transactionType, Deadline deadline, ulong fee, List <Transaction> innerTransactions, List <AggregateTransactionCosignature> cosignatures)
     : this(networkType, version, transactionType, deadline, fee, innerTransactions, cosignatures, null, null, null)
 {
 }