예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MultisigCosignatoryModification"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="publicAccount">The public key.</param>
        public MultisigCosignatoryModification(MultisigCosignatoryModificationType.Type type, PublicAccount publicAccount)
        {
            if (type != MultisigCosignatoryModificationType.Type.Add && type != MultisigCosignatoryModificationType.Type.Remove)
            {
                throw new ArgumentOutOfRangeException(nameof(type));
            }
            if (publicAccount == null)
            {
                throw new ArgumentNullException(nameof(publicAccount));
            }
            if (!Regex.IsMatch(publicAccount.PublicKey, @"\A\b[0-9a-fA-F]+\b\Z"))
            {
                throw new ArgumentException("invalid public key length");
            }
            if (publicAccount.PublicKey.Length != 64)
            {
                throw new ArgumentException("invalid public key not hex");
            }

            Type          = type;
            PublicAccount = publicAccount;
        }
예제 #2
0
 /// <summary>
 /// Creates a new instance of <see cref="MultisigCosignatoryModification"/>.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="publicKey">The public key.</param>
 /// <returns>MultisigCosignatoryModification.</returns>
 public static MultisigCosignatoryModification Create(MultisigCosignatoryModificationType.Type type, PublicAccount publicKey)
 {
     return(new MultisigCosignatoryModification(type, publicKey));
 }