public async Task InsertOrReplace(IPendingTransaction pendingTransactions) { var entity = PendingTransactionEntity.CreateEntity(pendingTransactions); AzureIndex index = new AzureIndex(_indexName, pendingTransactions.TransactionHash, entity); await _table.InsertOrReplaceAsync(entity); await _index.InsertOrReplaceAsync(index); }
public static PendingTransactionEntity CreateEntity(IPendingTransaction pendingTransaction) { return(new PendingTransactionEntity { PartitionKey = GeneratePartitionKey(pendingTransaction.CoinAdapterAddress), CoinAdapterAddress = pendingTransaction.CoinAdapterAddress, UserAddress = pendingTransaction.UserAddress, TransactionHash = pendingTransaction.TransactionHash }); }
public static async Task <string> Format(this IPendingTransaction transaction, IUserService users, bool mention = false) { return(await TransactionFormatting.FormatTransaction( users, transaction.FromId, transaction.ToId, transaction.Note, transaction.Instant, transaction.Amount, transaction.Unit, mention )); }
public async Task Delete(string transactionHash) { AzureIndex index = await _index.GetDataAsync(_indexName, transactionHash); if (index == null) { return; } IPendingTransaction transaction = await _table.GetDataAsync(index); if (transaction == null) { return; } await _table.DeleteIfExistAsync(PendingTransactionEntity.GeneratePartitionKey(transaction.CoinAdapterAddress), transaction.UserAddress); await _table.DeleteIfExistAsync(_indexName, index.RowKey); }
public async Task <bool> CheckLastTransactionCompleted(string coinAddress, string clientAddr) { IPendingTransaction pendingTransaction = await _pendingTransactionsRepository.GetAsync(coinAddress, clientAddr); return(pendingTransaction == null); }
public async Task <IPendingTransaction> GetAsync(string coinAdapterAddress, string userAddress) { IPendingTransaction transaction = await _table.GetDataAsync(PendingTransactionEntity.GeneratePartitionKey(coinAdapterAddress), userAddress); return(transaction); }
[NotNull] public static string FormatTransaction([NotNull] BaseModule module, [NotNull] IPendingTransaction transaction, bool mention = false) { return(FormatTransaction(module, transaction.FromId, transaction.ToId, transaction.Note, transaction.Instant, transaction.Amount, transaction.Unit, mention)); }