public AccountWithPublicKey GetAccountFromSecretPhrase(string secretPhrase) { var localAccountService = new LocalAccountService(); var accountWithPublicKey = localAccountService.GetAccount(AccountIdLocator.BySecretPhrase(secretPhrase)); return(accountWithPublicKey); }
private void GetAccountProperties() { var localAccountService = new LocalAccountService(); TestSettings.Account1 = localAccountService.GetAccount(AccountIdLocator.BySecretPhrase(TestSettings.SecretPhrase1)); TestSettings.Account2 = localAccountService.GetAccount(AccountIdLocator.BySecretPhrase(TestSettings.SecretPhrase2)); }
static CreateTransaction() { var localCrypto = new LocalAccountService(); SecretPhrase = TestSettings.SecretPhrase1; Account = localCrypto.GetAccount(AccountIdLocator.BySecretPhrase(SecretPhrase)); }
public AdminController(ILogger <AdminController> logger, IOptions <AuthenticationSettings> authSettings, IBlogAudit blogAudit, LocalAccountService localAccountService) { _blogAudit = blogAudit; _localAccountService = localAccountService; _authenticationSettings = authSettings.Value; _logger = logger; }
private async Task CheckShufflingDistributionTransactions() { if (!_knownTransactions.Any()) { var shufflings = (await _nxtServer.GetShufflingsStageDone()).ToList(); var localAccountService = new LocalAccountService(); var found = false; var shufflingIndex = 0; while (!found && shufflings.Count() > shufflingIndex) { var shuffling = shufflings[shufflingIndex]; foreach (var recipientPublicKey in shuffling.RecipientPublicKeys) { var account = localAccountService.GetAccount(AccountIdLocator.ByPublicKey(recipientPublicKey)); if (_walletRepository.NxtAccount.AccountId == account.AccountId) { var participants = await _nxtServer.GetShufflingParticipants(shuffling.ShufflingId); var lastParticipant = participants.Participants.Single(p => p.NextAccountId == 0); var lastParticipantToVerify = participants.Participants.Single(p => p.NextAccountId == lastParticipant.AccountId); var verifyShufflingTransactions = await _nxtServer.GetTransactionsAsync(lastParticipantToVerify.AccountRs, TransactionSubType.ShufflingVerification); var verifyShufflingTransaction = verifyShufflingTransactions.Single(t => ((ShufflingVerificationAttachment)t.Attachment).ShufflingId == shuffling.ShufflingId); var block = await _nxtServer.GetBlockAsync(verifyShufflingTransaction.Height); var transaction = new ShufflingDistributionTransaction { AccountFrom = Transaction.GeneratedFromAddress, AccountTo = _walletRepository.NxtAccount.AccountRs, Height = verifyShufflingTransaction.Height, IsConfirmed = true, NqtAmount = shuffling.Amount.Nqt, Message = "[Shuffling Distribution]", NqtFee = 0, RecipientPublicKey = recipientPublicKey.ToHexString(), ShufflingId = (long)shuffling.ShufflingId, Timestamp = block.Timestamp, TransactionType = TransactionType.ShufflingDistribution, UserIsTransactionSender = false, UserIsTransactionRecipient = true }; _newTransactions.Add(transaction); found = true; break; } } shufflingIndex++; } } }
private void SetupAccounts(string readOnlyAccount) { IsReadOnlyAccount = !string.IsNullOrEmpty(readOnlyAccount); if (IsReadOnlyAccount) { NxtAccount = readOnlyAccount; } else { NxtAccountWithPublicKey = new LocalAccountService().GetAccount(AccountIdLocator.BySecretPhrase(SecretPhrase)); NxtAccount = NxtAccountWithPublicKey; } }
private static void Main() { var generator = new LocalPasswordGenerator(); var accountService = new LocalAccountService(); Console.Write("Enter desired ending:"); var ending = Console.ReadLine(); var secretPhrase = generator.GeneratePasswordWithAccountEnding(ending); var account = accountService.GetAccount(AccountIdLocator.BySecretPhrase(secretPhrase)); Console.WriteLine($"Generated NXT Address: {account.AccountRs}"); Console.WriteLine($"Secret phrase: {secretPhrase}"); Console.WriteLine("Press enter to quit."); Console.ReadLine(); }
public async Task <NxtAccount> AddAccount() { var localPasswordGenerator = new LocalPasswordGenerator(); var localAccountService = new LocalAccountService(); var secretPhrase = localPasswordGenerator.GeneratePassword(); var accountWithPublicKey = localAccountService.GetAccount(AccountIdLocator.BySecretPhrase(secretPhrase)); var account = new NxtAccount { Address = accountWithPublicKey.AccountRs, SecretPhrase = secretPhrase, BalanceNqt = 0 }; await wallet.AddAccount(account); return(account); }
public string HashPassword(string plainMessage) { return(LocalAccountService.HashPassword(plainMessage)); }