/// <summary> /// Creates a vote transaction. /// </summary> /// /// <param name="votes">The votes.</param> /// /// <param name="passphrase">The account's first passphrase.</param> /// /// <param name="secondPassphrase">The account's second passphrase.</param> /// /// <returns>Returns an instance of the <see cref="TransactionApi"/> type.</returns> /// public TransactionApi CreateVote(List <string> votes, string passphrase, string secondPassphrase = null) { try { var tx = new TransactionApi(3, 0, _networkApi.NetworkSettings.Fee.Vote); tx.asset.Add("votes", votes); tx.Timestamp = Slot.GetTime(); tx.RecipientId = Crypto.GetAddress(Crypto.GetKeys(passphrase), _networkApi.NetworkSettings.BytePrefix); tx.Sign(passphrase); tx.StrBytes = Encoders.Hex.EncodeData(tx.ToBytes()); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); _logger.Info(string.Format("Creating vote transaction <<{0}>>", JsonConvert.SerializeObject(tx))); return(tx); } catch (Exception e) { _logger.Error(e.ToString()); throw e; } }
public static TransactionApi CreateDelegate(string username, string passphrase, string secondPassphrase = null) { var tx = new TransactionApi(2, 0, ArkNetApi.Instance.NetworkSettings.Fee.Delegate); tx.asset.Add("username", username); tx.Timestamp = Slot.GetTime(); tx.Sign(passphrase); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); return(tx); }
public static TransactionApi CreateTransaction(string recipientId, long satoshiAmount, string vendorField, string passphrase, string secondPassphrase = null) { var tx = new TransactionApi(0, recipientId, satoshiAmount, ArkNetApi.Instance.NetworkSettings.Fee.Send, vendorField); tx.Timestamp = Slot.GetTime(); tx.Sign(passphrase); tx.StrBytes = Encoders.Hex.EncodeData(tx.ToBytes()); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); return(tx); }
public static TransactionApi CreateVote(List <string> votes, string passphrase, string secondPassphrase = null) { var tx = new TransactionApi(3, 0, ArkNetApi.Instance.NetworkSettings.Fee.Vote); tx.asset.Add("votes", votes); tx.Timestamp = Slot.GetTime(); tx.RecipientId = Crypto.GetAddress(Crypto.GetKeys(passphrase), ArkNetApi.Instance.NetworkSettings.BytePrefix); tx.Sign(passphrase); tx.StrBytes = Encoders.Hex.EncodeData(tx.ToBytes()); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); return(tx); }
/// <summary> /// Creates a delegate transaction. /// </summary> /// /// <param name="username">The delegate's username.</param> /// /// <param name="passphrase">The account's first passphrase.</param> /// /// <param name="secondPassphrase">The account's second passphrase.</param> /// /// <returns>Returns an instance of the <see cref="TransactionApi"/> type.</returns> /// public TransactionApi CreateDelegate(string username, string passphrase, string secondPassphrase = null) { try { var tx = new TransactionApi(2, 0, _networkApi.NetworkSettings.Fee.Delegate); tx.asset.Add("username", username); tx.Timestamp = Slot.GetTime(); tx.Sign(passphrase); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); _logger.Info(string.Format("Creating delegate transaction <<{0}>>", JsonConvert.SerializeObject(tx))); return(tx); } catch (Exception e) { _logger.Error(e.ToString()); throw e; } }
/// <summary> /// Creates a transaction. /// </summary> /// /// <param name="recipientId">The address of the transaction's recipient.</param> /// /// <param name="satoshiAmount">The amount in satoshi of the transaction.</param> /// /// <param name="vendorField">The vendorfield of the transaction.</param> /// /// <param name="passphrase">The account first's passphrase.</param> /// /// <param name="secondPassphrase">The account's second passphrase.</param> /// /// <returns>Returns an instance of the <see cref="TransactionApi"/> type.</returns> /// public TransactionApi CreateTransaction(string recipientId, long satoshiAmount, string vendorField, string passphrase, string secondPassphrase = null) { try { var tx = new TransactionApi(0, recipientId, satoshiAmount, _networkApi.NetworkSettings.Fee.Send, vendorField); tx.Timestamp = Slot.GetTime(); tx.Sign(passphrase); tx.StrBytes = Encoders.Hex.EncodeData(tx.ToBytes()); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); _logger.Info(string.Format("Creating transaction <<{0}>>", JsonConvert.SerializeObject(tx))); return(tx); } catch (Exception e) { _logger.Error(e.ToString()); throw e; } }