/// <summary>
        ///     Initializes a new instance of the <see cref="RegisterNamespaceTransaction" /> class.
        /// </summary>
        /// <param name="networkType"></param>
        /// <param name="version"></param>
        /// <param name="deadline"></param>
        /// <param name="maxFee"></param>
        /// <param name="namespaceName"></param>
        /// <param name="namespaceId"></param>
        /// <param name="namespaceType"></param>
        /// <param name="duration"></param>
        /// <param name="parentId"></param>
        /// <param name="signature"></param>
        /// <param name="signer"></param>
        /// <param name="transactionInfo"></param>
        public RegisterNamespaceTransaction(NetworkType networkType, int version, Deadline deadline, ulong?maxFee,
                                            string namespaceName, NamespaceId namespaceId, NamespaceType namespaceType, ulong?duration,
                                            NamespaceId parentId            = null, string signature = null, PublicAccount signer = null,
                                            TransactionInfo transactionInfo = null)
            : base(networkType, version, EntityType.REGISTER_NAMESPACE, deadline, maxFee, signature, signer,
                   transactionInfo)
        {
            if (string.IsNullOrEmpty(namespaceName))
            {
                throw new ArgumentNullException(nameof(namespaceName));
            }

            if (!Enum.IsDefined(typeof(NetworkType), networkType))
            {
                throw new InvalidEnumArgumentException(nameof(networkType), networkType.GetValue(),
                                                       typeof(NetworkType));
            }
            if (namespaceType != NamespaceType.ROOT_NAMESPACE && namespaceType != NamespaceType.SUB_NAMESPACE)
            {
                throw new ArgumentOutOfRangeException(nameof(namespaceType));
            }
            if (namespaceType == NamespaceType.ROOT_NAMESPACE)
            {
                if (!duration.HasValue)
                {
                    throw new ArgumentNullException(nameof(duration));
                }
            }
            else
            {
                if (parentId == null)
                {
                    throw new ArgumentNullException(nameof(parentId));
                }
            }


            Duration      = duration;
            NamespaceName = namespaceName;
            NamespaceType = namespaceType;
            NamespaceId   = namespaceId;
            ParentId      = parentId;
        }
        public SecretProofTransaction(NetworkType networkType, int version, Deadline deadline, ulong?maxFee,
                                      HashType hashType, Recipient recipient, string secret, string proof, string signature = null, PublicAccount signer = null,
                                      TransactionInfo transactionInfo = null)
            : base(networkType, version, EntityType.SECRET_PROOF, deadline, maxFee, signature, signer,
                   transactionInfo)
        {
            Guard.NotNullOrEmpty(secret, "Secret must not be null");
            Guard.NotNullOrEmpty(proof, "Proof must not be null");
            Guard.NotNull(recipient, "Recipient must not be null");
            if (!hashType.Validate(secret))
            {
                throw new ArgumentOutOfRangeException(
                          "HashType and Secret have incompatible length or not hexadecimal string");
            }

            HashType  = hashType;
            Proof     = proof;
            Secret    = secret;
            Recipient = recipient;
        }
Пример #3
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="networkType"></param>
        /// <param name="version"></param>
        /// <param name="deadline"></param>
        /// <param name="maxFee"></param>
        /// <param name="mosaic"></param>
        /// <param name="duration"></param>
        /// <param name="hashType"></param>
        /// <param name="secret"></param>
        /// <param name="recipient"></param>
        /// <param name="signature"></param>
        /// <param name="signer"></param>
        /// <param name="transactionInfo"></param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public SecretLockTransaction(NetworkType networkType, int version, Deadline deadline, ulong?maxFee,
                                     Mosaic mosaic, ulong duration, HashType hashType, string secret, Address recipient,
                                     string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null)
            : base(networkType, version, EntityType.SECRET_LOCK, deadline, maxFee, signature, signer,
                   transactionInfo)
        {
            Guard.NotNull(mosaic, "Mosaic must not be null");
            Guard.NotNull(secret, "Secret must not be null");
            Guard.NotNull(recipient, "Recipient must not be null");
            if (!hashType.Validate(secret))
            {
                throw new ArgumentOutOfRangeException(
                          "HashType and Secret have incompatible length or not hexadecimal string");
            }

            Mosaic    = mosaic;
            Duration  = duration;
            HashType  = hashType;
            Secret    = secret;
            Recipient = recipient;
        }
Пример #4
0
        /// <summary>
        ///     Account Metadata
        /// </summary>
        /// <param name="deadline"></param>
        /// <param name="account"></param>
        /// <param name="scopedKey"></param>
        /// <param name="newValue"></param>
        /// <param name="oldValue"></param>
        /// <param name="networkType"></param>
        /// <param name="maxFee"></param>
        /// <returns>AccountMetadataTransaction</returns>
        public static AccountMetadataTransaction Create(Deadline deadline, PublicAccount account, string scopedKey, string newValue, string oldValue, NetworkType networkType, ulong?maxFee = 0)
        {
            byte[] newV           = Encoding.UTF8.GetBytes(newValue);
            byte[] oldV           = Encoding.UTF8.GetBytes(oldValue);
            byte[] scope_key      = Encoding.UTF8.GetBytes(scopedKey);
            var    scopekey       = CryptoUtils.Sha3_256_To_Ulong(scope_key);
            var    ValueSizeDelta = Convert.ToInt16(newV.Length - oldV.Length);
            var    newValueSize   = Math.Max(newV.Length, oldV.Length);

            valueDifference_Bytes = Converter.CompareValues(newV, oldV);

            return(new AccountMetadataTransaction(
                       networkType,
                       EntityVersion.METADATA_ACCOUNT.GetValue(),
                       EntityType.ACCOUNT_METADATA_V2,
                       deadline,
                       maxFee,
                       scopekey,
                       account,
                       newValue,
                       ValueSizeDelta,
                       (ushort)newValueSize
                       ));
        }
 /// <summary>
 ///     Creates SecretProofTransaction
 /// </summary>
 /// <param name="deadline"></param>
 /// <param name="hashType"></param>
 /// <param name="secret"></param>
 /// <param name="proof"></param>
 /// <param name="networkType"></param>
 /// <returns></returns>
 public static SecretProofTransaction Create(Deadline deadline, HashType hashType, Recipient recipient, string secret, string proof,
                                             NetworkType networkType)
 {
     return(new SecretProofTransaction(networkType, EntityVersion.SECRET_PROOF.GetValue(),
                                       deadline, 0, hashType, recipient, secret, proof));
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="networkType"></param>
 /// <param name="version"></param>
 /// <param name="transactionType"></param>
 /// <param name="deadline"></param>
 /// <param name="maxFee"></param>
 /// <param name="scopedKey"></param>
 /// <param name="targetPublicKey"></param>
 /// <param name="targetId"></param>
 /// <param name="newValue"></param>
 /// <param name="valueSizeDelta"></param>
 /// <param name="valueSize"></param>
 /// <param name="signature"></param>
 /// <param name="signer"></param>
 /// <param name="transactionInfo"></param>
 public MosaicMetadataTransaction(NetworkType networkType, int version, EntityType transactionType, Deadline deadline, ulong?maxFee, ulong scopedKey, PublicAccount targetPublicKey, MosaicId targetId, string newValue, short valueSizeDelta, ushort valueSize, string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null) : base(networkType, version, transactionType, deadline, maxFee, signature, signer, transactionInfo)
 {
     ScopedKey       = scopedKey;
     TargetPublicKey = targetPublicKey;
     TargetId        = targetId;
     Value           = newValue;
     ValueSizeDelta  = valueSizeDelta;
     ValueSize       = valueSize;
 }
 /// <summary>
 ///     Modifies mosaic levy
 /// </summary>
 /// <param name="deadline"></param>
 /// <param name="mosaicid"></param>
 /// <param name="LevyInfo"></param>
 /// <param name="networkType"></param>
 /// <returns></returns>
 public static ModifyMosaicLevyTransaction Create(Deadline deadline, MosaicId mosaicid, Mosaics.MosaicLevy LevyInfo, NetworkType networkType)
 {
     return(new ModifyMosaicLevyTransaction(networkType, EntityVersion.MODIFY_MOSAIC_LEVY_VERSION.GetValue(), deadline, mosaicid, LevyInfo, 0));
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="networkType"></param>
 /// <param name="version"></param>
 /// <param name="deadline"></param>
 /// <param name="mosaidId"></param>
 /// <param name="levy"></param>
 /// <param name="maxFee"></param>
 /// <param name="signature"></param>
 /// <param name="signer"></param>
 /// <param name="transactionInfo"></param>
 public ModifyMosaicLevyTransaction(NetworkType networkType, int version, Deadline deadline, MosaicId mosaidId, Mosaics.MosaicLevy levy, ulong?maxFee, string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null) : base(networkType, version, EntityType.MODIFY_MOSAIC_LEVY, deadline, maxFee, signature, signer, transactionInfo)
 {
     LevyInfo = levy;
     MosaicId = mosaidId;
 }
 protected Transaction(NetworkType networkType, int version, EntityType transactionType, Deadline deadline,
                       ulong?maxFee, string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null)
 {
     TransactionType = transactionType;
     NetworkType     = networkType;
     Version         = version;
     Deadline        = deadline;
     MaxFee          = maxFee;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
 }
 /// <summary>
 /// </summary>
 /// <param name="deadline"></param>
 /// <param name="mosaicId"></param>
 /// <param name="mosaicSupplyType"></param>
 /// <param name="delta"></param>
 /// <param name="networkType"></param>
 /// <returns></returns>
 public static MosaicSupplyChangeTransaction Create(Deadline deadline, MosaicId mosaicId,
                                                    MosaicSupplyType mosaicSupplyType, ulong delta, NetworkType networkType)
 {
     return(new MosaicSupplyChangeTransaction(networkType, EntityVersion.MOSAIC_SUPPLY_CHANGE.GetValue(),
                                              deadline, 0, mosaicId, mosaicSupplyType, delta));
 }
Пример #11
0
 /// <summary>
 ///     Creates LockFundsTransaction
 /// </summary>
 /// <param name="deadline"></param>
 /// <param name="mosaic"></param>
 /// <param name="duration"></param>
 /// <param name="signedTransaction"></param>
 /// <param name="networkType"></param>
 /// <returns></returns>
 public static LockFundsTransaction Create(Deadline deadline, Mosaic mosaic, ulong duration,
                                           SignedTransaction signedTransaction, NetworkType networkType)
 {
     return(new LockFundsTransaction(networkType, EntityVersion.LOCK.GetValue(), deadline, 0, mosaic,
                                     duration, signedTransaction));
 }
Пример #12
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="networkType"></param>
 /// <param name="version"></param>
 /// <param name="deadline"></param>
 /// <param name="maxFee"></param>
 /// <param name="minApprovalDelta"></param>
 /// <param name="minRemovalDelta"></param>
 /// <param name="modifications"></param>
 /// <param name="signature"></param>
 /// <param name="signer"></param>
 /// <param name="transactionInfo"></param>
 public ModifyMultisigAccountTransaction(NetworkType networkType, int version, Deadline deadline, ulong?maxFee,
                                         int minApprovalDelta, int minRemovalDelta, IList <MultisigCosignatoryModification> modifications,
                                         string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null)
     : base(networkType, version, EntityType.MODIFY_MULTISIG_ACCOUNT, deadline, maxFee, signature, signer,
            transactionInfo)
 {
     MinApprovalDelta = minApprovalDelta;
     MinRemovalDelta  = minRemovalDelta;
     Modifications    = modifications;
 }
 public static RemoveMosaicLevyTransaction Create(Deadline deadline, MosaicId mosaicid, NetworkType networkType)
 {
     return(new RemoveMosaicLevyTransaction(networkType, EntityVersion.REMOVE_MOSAIC_LEVY_VERSION.GetValue(), deadline, mosaicid, 0));
 }
 public RemoveMosaicLevyTransaction(NetworkType networkType, int version, Deadline deadline, MosaicId mosaidId, ulong?maxFee, string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null) : base(networkType, version, EntityType.REMOVE_MOSAIC_LEVY, deadline, maxFee, signature, signer, transactionInfo)
 {
     MosaicId = mosaidId;
 }
        public static MosaicDefinitionTransaction Create(MosaicNonce nonce, MosaicId mosaicId, Deadline deadline,
                                                         MosaicProperties properties, NetworkType networkType)
        {
            if (mosaicId == null)
            {
                throw new ArgumentNullException(nameof(mosaicId));
            }

            return(new MosaicDefinitionTransaction(networkType, EntityVersion.MOSAIC_DEFINITION.GetValue(),
                                                   deadline, 0, nonce, mosaicId, properties));
        }
 /// <summary>
 /// Create new instance of account link transaction
 /// </summary>
 /// <param name="remoteAccount">The remote account</param>
 /// <param name="action">The action</param>
 /// <param name="deadline">The transaction deadline</param>
 /// <param name="maxFee">The max fee</param>
 /// <param name="NetworkType">The network type</param>
 /// <returns>AccountLinkTransaction</returns>
 public static AccountLinkTransaction Create(PublicAccount remoteAccount, AccountLinkAction action, Deadline deadline, ulong?maxFee, NetworkType NetworkType)
 {
     return(new AccountLinkTransaction(NetworkType, EntityVersion.LINK_ACCOUNT.GetValue(), deadline,
                                       maxFee, EntityType.LINK_ACCOUNT, remoteAccount, action));
 }
Пример #17
0
 /// <summary>
 ///     CreateForEntityType
 /// </summary>
 /// <param name="deadline"></param>
 /// <param name="maxFee"></param>
 /// <param name="propertyType"></param>
 /// <param name="propertyModifications"></param>
 /// <param name="networkType"></param>
 /// <returns></returns>
 public static ModifyAccountPropertyTransaction <EntityType> CreateForEntityType(Deadline deadline,
                                                                                 ulong?maxFee,
                                                                                 PropertyType propertyType,
                                                                                 List <AccountPropertyModification <EntityType> > propertyModifications, NetworkType networkType)
 {
     return(new EntityTypeModification(networkType,
                                       EntityVersion.MODIFY_ACCOUNT_PROPERTY_ENTITY_TYPE.GetValue(),
                                       deadline, propertyType, propertyModifications, maxFee));
 }
 public ExchangeOfferRemoveTransaction(NetworkType networkType, int version, Deadline deadline, ulong?maxFee, List <RemoveExchangeOffer> offers, string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null) :
     base(networkType, version, EntityType.EXCHANGE_OFFER_REMOVE, deadline, maxFee, signature, signer, transactionInfo)
 {
     Offers = offers ?? throw new ArgumentNullException(nameof(offers));
 }
 public static TransferTransaction Create(Deadline deadline, Recipient recipient, List <Mosaic> mosaics,
                                          IMessage message, NetworkType networkType, ulong?maxFee = 0)
 {
     return(new TransferTransaction(networkType, EntityVersion.TRANSFER.GetValue(), deadline, maxFee,
                                    recipient, mosaics, message));
 }
Пример #20
0
 /// <summary>
 ///     Create SecretLockTransaction
 /// </summary>
 /// <param name="deadline"></param>
 /// <param name="mosaic"></param>
 /// <param name="duration"></param>
 /// <param name="hashType"></param>
 /// <param name="secret"></param>
 /// <param name="recipient"></param>
 /// <param name="networkType"></param>
 /// <returns></returns>
 public static SecretLockTransaction Create(Deadline deadline, Mosaic mosaic, ulong duration, HashType hashType,
                                            string secret, Address recipient, NetworkType networkType)
 {
     return(new SecretLockTransaction(networkType, EntityVersion.SECRET_LOCK.GetValue(),
                                      deadline, 0, mosaic, duration, hashType, secret, recipient));
 }