Пример #1
0
        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);
        }
Пример #2
0
 public static PendingTransactionEntity CreateEntity(IPendingTransaction pendingTransaction)
 {
     return(new PendingTransactionEntity
     {
         PartitionKey = GeneratePartitionKey(pendingTransaction.CoinAdapterAddress),
         CoinAdapterAddress = pendingTransaction.CoinAdapterAddress,
         UserAddress = pendingTransaction.UserAddress,
         TransactionHash = pendingTransaction.TransactionHash
     });
 }
Пример #3
0
 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
                ));
 }
Пример #4
0
        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);
        }
Пример #5
0
        public async Task <bool> CheckLastTransactionCompleted(string coinAddress, string clientAddr)
        {
            IPendingTransaction pendingTransaction = await _pendingTransactionsRepository.GetAsync(coinAddress, clientAddr);

            return(pendingTransaction == null);
        }
Пример #6
0
        public async Task <IPendingTransaction> GetAsync(string coinAdapterAddress, string userAddress)
        {
            IPendingTransaction transaction = await _table.GetDataAsync(PendingTransactionEntity.GeneratePartitionKey(coinAdapterAddress), userAddress);

            return(transaction);
        }
Пример #7
0
 [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));
 }