예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleWallet"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="network">The network.</param>
 /// <param name="wlt">The WLT.</param>
 /// <param name="encryptedPrivateKey">The encrypted private key.</param>
 internal SimpleWallet(string name, NetworkType.Types network, WalletObject wlt, EncryptedPrivateKey encryptedPrivateKey)
 {
     Name = name;
     EncryptedPrivateKey = encryptedPrivateKey;
     WalletObj           = wlt;
     Network             = network;
 }
예제 #2
0
        /// <summary>
        /// Creates an Account from a private key.
        /// </summary>
        /// <param name="privateKey">The private key.</param>
        /// <param name="networkType">Type of the network.</param>
        /// <returns>Account.</returns>
        public static Account CreateFromPrivateKey(string privateKey, NetworkType.Types networkType)
        {
            var keyPair = KeyPair.CreateFromPrivateKey(privateKey);
            var address = Address.CreateFromPublicKey(keyPair.PublicKeyString, networkType);

            return(new Account(address, keyPair));
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterNamespaceTransaction"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="version">The version.</param>
        /// <param name="deadline">The deadline.</param>
        /// <param name="fee">The fee.</param>
        /// <param name="namespaceType">Type of the namespace.</param>
        /// <param name="duration">The duration.</param>
        /// <param name="parentId">The parent identifier.</param>
        /// <param name="namespaceName">Name of the namespace.</param>
        /// <param name="signer">The signer.</param>
        /// <param name="signature">The signature.</param>
        /// <param name="transactionInfo">The transaction information.</param>
        /// <exception cref="ArgumentNullException">parentId</exception>
        /// <exception cref="InvalidEnumArgumentException">type</exception>
        /// <exception cref="ArgumentOutOfRangeException">namespaceType</exception>
        public RegisterNamespaceTransaction(NetworkType.Types type, int version, Deadline deadline, ulong fee, byte namespaceType, ulong duration, NamespaceId parentId, NamespaceId namespaceName, PublicAccount signer, string signature, TransactionInfo transactionInfo)
        {
            if (parentId == null && namespaceName == null)
            {
                throw new ArgumentNullException(nameof(parentId) + " and " + nameof(namespaceName) + " cannot both be null");
            }
            if (!Enum.IsDefined(typeof(NetworkType.Types), type))
            {
                throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(NetworkType.Types));
            }
            if (namespaceType != 0 && namespaceType != 1)
            {
                throw new ArgumentOutOfRangeException(nameof(namespaceType));
            }

            NetworkType     = type;
            Version         = version;
            Deadline        = deadline;
            Fee             = fee;
            NamespaceType   = NamespaceTypes.GetRawValue(namespaceType);
            TransactionType = TransactionTypes.Types.RegisterNamespace;
            Duration        = duration;
            ParentId        = parentId;
            NamespaceId     = namespaceName;
            Signer          = signer;
            Signature       = signature;
            TransactionInfo = transactionInfo;
        }
예제 #4
0
 // constructor for unit testing purposes
 internal Searcher(NetworkType.Types networkType,
                   AccountClient accountClient,
                   RetrieveProximaxMessagePayloadService retrieveProximaxMessagePayloadService)
 {
     NetworkType   = networkType;
     AccountClient = accountClient;
     RetrieveProximaxMessagePayloadService = retrieveProximaxMessagePayloadService;
 }
예제 #5
0
        /// <summary>
        /// Creates the complete.
        /// </summary>
        /// <param name="networkType">Type of the network.</param>
        /// <param name="deadline">The deadline.</param>
        /// <param name="innerTransactions">The inner transactions.</param>
        /// <param name="cosignatures">The cosignatures.</param>
        /// <returns>AggregateTransaction.</returns>
        /// <exception cref="InvalidEnumArgumentException">networkType</exception>
        public static AggregateTransaction CreateComplete(NetworkType.Types networkType, Deadline deadline, List <Transaction> innerTransactions)
        {
            if (!Enum.IsDefined(typeof(NetworkType.Types), networkType))
            {
                throw new InvalidEnumArgumentException(nameof(networkType), (int)networkType, typeof(NetworkType.Types));
            }

            return(new AggregateTransaction(networkType, 2, TransactionTypes.Types.AggregateComplete, deadline, 0, innerTransactions, new List <AggregateTransactionCosignature>()));
        }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultisigTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="innerTransaction">The inner transaction.</param>
 public MultisigTransaction(NetworkType.Types networkType, byte version, Deadline deadline, ulong fee, Transaction innerTransaction)
 {
     TransactionType  = TransactionTypes.Types.Multisig;
     NetworkType      = networkType;
     Version          = version;
     Deadline         = deadline;
     Fee              = fee == 0 ? 150000 : fee;
     InnerTransaction = innerTransaction;
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultisigAggregateModificationTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="modifications">The modifications.</param>
 public MultisigAggregateModificationTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, List <MultisigModification> modifications)
 {
     TransactionType = TransactionTypes.Types.MultisigAggregateModification;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Fee             = fee == 0 ? 500000 : fee;
     Modifications   = modifications;
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProvisionNamespaceTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="newPart">The new part.</param>
 /// <param name="parent">The parent.</param>
 public ProvisionNamespaceTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, string newPart, string parent)
 {
     TransactionType = TransactionTypes.Types.ProvisionNamespace;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Fee             = fee == 0 ? 150000 : fee;
     Parent          = parent;
     NewPart         = newPart;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CosignatureTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="hash">The hash of the transaction to sign.</param>
 /// <param name="multisigAddress">The multisig address.</param>
 public CosignatureTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, string hash, Address multisigAddress)
 {
     TransactionType = TransactionTypes.Types.SignatureTransaction;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Fee             = fee == 0 ? 150000 : fee;
     OtherHash       = hash;
     MultisigAddress = multisigAddress;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportanceTransferTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="remoteAccount">The remote account.</param>
 public ImportanceTransferTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, ImportanceTransferMode.Mode mode, PublicAccount remoteAccount)
 {
     TransactionType = TransactionTypes.Types.ImportanceTransfer;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Fee             = fee == 0 ? 150000 : fee;
     RemoteAccount   = remoteAccount;
     Mode            = mode;
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SupplyChangeTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="delta">The delta.</param>
 /// <param name="mosaicId">The mosaic identifier.</param>
 /// <param name="supplyType">Type of the supply.</param>
 public SupplyChangeTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, ulong delta, MosaicId mosaicId, int supplyType)
 {
     TransactionType = TransactionTypes.Types.SupplyChange;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Fee             = fee == 0 ? 150000 : fee;
     Delta           = delta;
     MosaicId        = mosaicId;
     SupplyType      = supplyType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="recipient">The recipient.</param>
 /// <param name="mosaics">The mosaics.</param>
 /// <param name="message">The message.</param>
 /// <exception cref="System.ArgumentNullException">recipient</exception>
 internal TransferTransaction(NetworkType.Types networkType, byte version, Deadline deadline, ulong fee, Address recipient, List <Mosaic> mosaics, IMessage message)
 {
     Address         = recipient ?? throw new ArgumentNullException(nameof(recipient));
     TransactionType = TransactionTypes.Types.Transfer;
     Version         = version;
     Deadline        = deadline;
     Message         = message ?? EmptyMessage.Create();
     Mosaics         = mosaics ?? new List <Mosaic>();;
     NetworkType     = networkType;
     Fee             = fee == 0 ? CalculateFee() : fee;
 }
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultisigTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="innerTransaction">The inner transaction.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public MultisigTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, Transaction innerTransaction, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     TransactionType  = TransactionTypes.Types.Multisig;
     NetworkType      = networkType;
     Version          = version;
     Deadline         = deadline;
     Fee              = fee == 0 ? 150000 : fee;
     InnerTransaction = innerTransaction;
     Signer           = signer;
     Signature        = signature;
     TransactionInfo  = transactionInfo;
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProvisionNamespaceTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="newPart">The new part.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public ProvisionNamespaceTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, string newPart, string parent, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     TransactionType = TransactionTypes.Types.ProvisionNamespace;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
     Fee             = fee == 0 ? 150000 : fee;
     Parent          = parent;
     NewPart         = newPart;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CosignatureTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="hash">The hash of the transaction to sign.</param>
 /// <param name="multisigAddress">The multisig address.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public CosignatureTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, string hash, Address multisigAddress, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     TransactionType = TransactionTypes.Types.SignatureTransaction;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
     Fee             = fee == 0 ? 150000 : fee;
     OtherHash       = hash;
     MultisigAddress = multisigAddress;
 }
예제 #16
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;
 }
 public static MosaicDefinitionTransaction Create(NetworkType.Types networkType, Deadline deadline, string namespaceId, string mosaicName, MosaicProperties properties)
 {
     return(new MosaicDefinitionTransaction(
                networkType,
                3,
                deadline,
                0,
                mosaicName,
                NamespaceId.Create(namespaceId),
                MosaicId.CreateFromMosaicIdentifier(namespaceId + ":" + mosaicName),
                properties
                ));
 }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodeInfo"/> class.
 /// </summary>
 /// <param name="features">The features.</param>
 /// <param name="application">The application.</param>
 /// <param name="networktype">The networktype.</param>
 /// <param name="version">The version.</param>
 /// <param name="platform">The platform.</param>
 /// <param name="protocol">The protocol.</param>
 /// <param name="port">The port.</param>
 /// <param name="host">The host.</param>
 /// <param name="publicKey">The public key.</param>
 /// <param name="name">The name.</param>
 public NodeInfo(int features, string application, NetworkType.Types networktype, string version, string platform, string protocol, string port, string host, string publicKey, string name)
 {
     Features    = features;
     Application = application;
     Networktype = networktype;
     Version     = version;
     Platform    = platform;
     Protocol    = protocol;
     Port        = port;
     Host        = host;
     PublicKey   = publicKey;
     Name        = name;
 }
예제 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultisigAggregateModificationTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="relativeChange">The relative change.</param>
 /// <param name="modifications">The modifications.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public MultisigAggregateModificationTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, int relativeChange, List <MultisigModification> modifications, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     TransactionType = TransactionTypes.Types.MultisigAggregateModification;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
     Fee             = fee == 0 ? 500000 : fee;
     RelativeChange  = relativeChange;
     Modifications   = modifications;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportanceTransferTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="remoteAccount">The remote account.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public ImportanceTransferTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, ImportanceTransferMode.Mode mode, PublicAccount remoteAccount, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     TransactionType = TransactionTypes.Types.ImportanceTransfer;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
     Fee             = fee == 0 ? 150000 : fee;
     RemoteAccount   = remoteAccount;
     Mode            = mode;
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MosaicDefinitionTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="properties">The properties.</param>
 /// <param name="mosaic">The mosaic.</param>
 /// <param name="mosaicLevy">The mosaic levy.</param>
 /// <param name="creator">The creator.</param>
 /// <param name="description">The description.</param>
 /// <exception cref="System.ArgumentNullException">
 /// properties
 /// or
 /// mosaic
 /// or
 /// creator
 /// </exception>
 public MosaicDefinitionTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, MosaicProperties properties, MosaicId mosaic, MosaicLevy mosaicLevy, PublicAccount creator, string description)
 {
     TransactionType = TransactionTypes.Types.MosaicDefinition;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Fee             = fee == 0 ? 150000 : fee;
     Properties      = properties ?? throw new ArgumentNullException(nameof(properties));
     Mosaic          = mosaic ?? throw new ArgumentNullException(nameof(mosaic));
     Creator         = creator ?? throw new ArgumentNullException(nameof(creator));
     Description     = description;
     MosaicLevy      = mosaicLevy;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="recipient">The recipient.</param>
 /// <param name="mosaics">The mosaics.</param>
 /// <param name="message">The message.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 /// <exception cref="System.ArgumentNullException">recipient</exception>
 internal TransferTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, Address recipient, List <Mosaic> mosaics, IMessage message, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     Address         = recipient ?? throw new ArgumentNullException(nameof(recipient));
     Mosaics         = mosaics ?? new List <Mosaic>();
     TransactionType = TransactionTypes.Types.Transfer;
     Version         = version;
     Deadline        = deadline;
     Message         = message ?? EmptyMessage.Create();
     NetworkType     = networkType;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
     Fee             = fee == 0 ? CalculateFee() : fee;
 }
예제 #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SupplyChangeTransaction"/> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="delta">The delta.</param>
 /// <param name="mosaicId">The mosaic identifier.</param>
 /// <param name="supplyType">Type of the supply.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public SupplyChangeTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, ulong delta, MosaicId mosaicId, int supplyType, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     TransactionType = TransactionTypes.Types.SupplyChange;
     Version         = version;
     Deadline        = deadline;
     NetworkType     = networkType;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
     Fee             = fee == 0 ? 150000 : fee;
     Delta           = delta;
     MosaicId        = mosaicId;
     SupplyType      = supplyType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SecretProofTransaction"/> class.
 /// </summary>
 /// <param name="deadline">The deadline.</param>
 /// <param name="hashAlgo">The hash algo.</param>
 /// <param name="secret">The secret.</param>
 /// <param name="proof">The proof.</param>
 /// <param name="networkType">Type of the network.</param>
 public SecretProofTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, HashType.Types hashAlgo, string secret, string proof, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     Deadline        = deadline;
     Version         = version;
     Fee             = fee;
     NetworkType     = networkType;
     HashAlgo        = hashAlgo;
     Secret          = secret.FromHex();
     Proof           = proof.FromHex();
     TransactionType = TransactionTypes.Types.SecretProof;
     Signer          = signer;
     Signature       = signature;
     TransactionInfo = transactionInfo;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public MosaicDefinitionTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, string mosaicName, NamespaceId namespaceId, MosaicId mosaicId, MosaicProperties properties, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     Deadline        = deadline;
     NetworkType     = networkType;
     Version         = version;
     Properties      = properties;
     MosaicId        = mosaicId;
     NamespaceId     = namespaceId;
     MosaicName      = mosaicName;
     Fee             = fee;
     TransactionType = TransactionTypes.Types.MosaicDefinition;
     Signature       = signature;
     Signer          = signer;
     TransactionInfo = transactionInfo;
 }
예제 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferTransaction" /> class.
 /// </summary>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="version">The version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="fee">The fee.</param>
 /// <param name="recipient">The recipient.</param>
 /// <param name="mosaics">The mosaics.</param>
 /// <param name="message">The message.</param>
 /// <exception cref="ArgumentNullException">mosaics
 /// or
 /// recipient</exception>
 internal TransferTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, Address recipient, List <Mosaic> mosaics, IMessage message)
 {
     if (mosaics == null)
     {
         throw new ArgumentNullException(nameof(mosaics));
     }
     Address         = recipient ?? throw new ArgumentNullException(nameof(recipient));
     TransactionType = TransactionTypes.Types.Transfer;
     Version         = version;
     mosaics.Sort((c1, c2) => string.CompareOrdinal(c1.MosaicId.MosaicName, c2.MosaicId.MosaicName));
     Deadline    = deadline;
     Message     = message ?? EmptyMessage.Create();
     Mosaics     = mosaics;
     NetworkType = networkType;
     Fee         = fee;
 }
예제 #27
0
        /// <summary>
        /// Generates a new account.
        /// </summary>
        /// <param name="networkType">Type of the network.</param>
        /// <returns>Account.</returns>
        public static Account GenerateNewAccount(NetworkType.Types networkType)
        {
            using (var ng = RandomNumberGenerator.Create())
            {
                var bytes = new byte[2048];
                ng.GetNonZeroBytes(bytes);

                var digestSha3 = new Sha3Digest(256);
                var stepOne    = new byte[32];
                digestSha3.BlockUpdate(bytes, 0, 32);
                digestSha3.DoFinal(stepOne, 0);

                var keyPair = KeyPair.CreateFromPrivateKey(stepOne.ToHexLower());

                return(new Account(Address.CreateFromPublicKey(keyPair.PublicKeyString, networkType), keyPair));
            }
        }
예제 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LockFundsTransaction"/> class.
 /// </summary>
 /// <param name="version">The transaction version.</param>
 /// <param name="deadline">The deadline.</param>
 /// <param name="duration">The duration.</param>
 /// <param name="fee">The transaction fee.</param>
 /// <param name="mosaic">The mosaic.</param>
 /// <param name="transaction">The transaction.</param>
 /// <param name="networkType">Type of the network.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="signer">The signer.</param>
 /// <param name="transactionInfo">The transaction information.</param>
 public LockFundsTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, Mosaic mosaic, ulong duration, SignedTransaction transaction, string signature, PublicAccount signer, TransactionInfo transactionInfo)
 {
     if (transaction.TransactionType != TransactionTypes.Types.AggregateBonded)
     {
         throw new ArgumentException("Cannot lock non-aggregate-bonded transaction");
     }
     Deadline        = deadline;
     Version         = version;
     Duration        = duration;
     Mosaic          = mosaic;
     NetworkType     = networkType;
     Transaction     = transaction;
     TransactionType = TransactionTypes.Types.LockFunds;
     Signer          = signer;
     Signature       = signature;
     TransactionInfo = transactionInfo;
     Fee             = fee;
 }
예제 #29
0
 public BlockInfo(string hash, string generationHash, ulong totalFee,
                  int numTransactions, string signature, PublicAccount signer, NetworkType.Types networkType,
                  int version, int type, ulong height, ulong timestamp, ulong difficulty,
                  String previousBlockHash, String blockTransactionsHash)
 {
     Hash                  = hash;
     GenerationHash        = generationHash;
     TotalFee              = totalFee;
     NumTransactions       = numTransactions;
     Signature             = signature;
     Signer                = signer;
     NetworkType           = networkType;
     Version               = version;
     Type                  = type;
     Height                = height;
     Timestamp             = timestamp;
     Difficulty            = difficulty;
     PreviousBlockHash     = previousBlockHash;
     BlockTransactionsHash = blockTransactionsHash;
 }
예제 #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SecretLockTransaction"/> class.
        /// </summary>
        /// <param name="networkType">Type of the network.</param>
        /// <param name="deadline">The deadline.</param>
        /// <param name="fee">The fee.</param>
        /// <param name="mosaic">The mosaic.</param>
        /// <param name="duration">The duration.</param>
        /// <param name="hashAlgo">The hash algo.</param>
        /// <param name="secret">The secret.</param>
        /// <param name="recipient">The recipient.</param>
        /// <param name="signature">The signature.</param>
        /// <param name="signer">The signer.</param>
        /// <param name="transactionInfo">The transaction information.</param>
        /// <exception cref="ArgumentException">invalid secret</exception>
        public SecretLockTransaction(NetworkType.Types networkType, int version, Deadline deadline, ulong fee, Mosaic mosaic, ulong duration, HashType.Types hashAlgo, string secret, Address recipient, string signature, PublicAccount signer, TransactionInfo transactionInfo)
        {
            if (hashAlgo.GetHashTypeValue() == 0 && secret.Length != 128)
            {
                throw new ArgumentException("invalid secret");
            }

            Deadline        = deadline;
            Version         = version;
            Fee             = fee;
            Duration        = duration;
            Mosaic          = mosaic;
            NetworkType     = networkType;
            HashAlgo        = hashAlgo;
            Secret          = secret.FromHex();
            Recipient       = recipient;
            TransactionType = TransactionTypes.Types.SecretLock;
            Signer          = signer;
            Signature       = signature;
            TransactionInfo = transactionInfo;
        }