public async Task <TU> GetAsync(string key)
        {
            var entity = await _table.GetDataAsync(TableKeyHelper.GetHashedRowKey(key), key);

            var result = entity?.ToDomain();

            return(result);
        }
        public async Task <WalletBalance> GetAsync(string assetId, string address)
        {
            var rowKey = WalletBalanceEntity.GetRowKey(assetId, address);
            var entity = await _balanceTable.GetDataAsync(TableKeyHelper.GetHashedRowKey(rowKey), rowKey);

            var wallet = entity?.ToDomain();

            return(wallet);
        }
        public async Task <TxBuild> GetAsync(Guid operationId)
        {
            var rowKey = GetRowKey(operationId);
            var entity = await _table.GetDataAsync(TableKeyHelper.GetHashedRowKey(rowKey), rowKey);

            var build = entity?.ToDomain();

            return(build);
        }
        public async Task InsertOrReplaceAsync(TU observation)
        {
            var entity = new T
            {
                Timestamp = DateTimeOffset.UtcNow
            };

            entity.ToEntity(observation);
            entity.PartitionKey = TableKeyHelper.GetHashedRowKey(entity.RowKey);
            await _table.InsertOrReplaceAsync(entity);
        }
Пример #5
0
        public static TxBuildEntity ToEntity(this TxBuild domain)
        {
            var rowKey = TableKeyHelper.GetRowKey(domain.OperationId);
            var entity = new TxBuildEntity
            {
                PartitionKey = TableKeyHelper.GetHashedRowKey(rowKey),
                RowKey       = rowKey,
                Timestamp    = domain.Timestamp,
                XdrBase64    = domain.XdrBase64
            };

            return(entity);
        }
        public async Task MergeAsync(TxBroadcast broadcast)
        {
            TxBroadcastEntity MergeAction(TxBroadcastEntity entity)
            {
                entity.State     = broadcast.State;
                entity.Amount    = broadcast.Amount;
                entity.Fee       = broadcast.Fee;
                entity.Ledger    = broadcast.Ledger;
                entity.CreatedAt = broadcast.CreatedAt;
                entity.Error     = broadcast.Error;
                entity.ErrorCode = broadcast.ErrorCode;

                return(entity);
            }

            var rowKey = TableKeyHelper.GetRowKey(broadcast.OperationId);
            await _table.MergeAsync(TableKeyHelper.GetHashedRowKey(rowKey), rowKey, MergeAction);
        }
Пример #7
0
        public static TxBroadcastEntity ToEntity(this TxBroadcast domain)
        {
            var rowKey = TableKeyHelper.GetRowKey(domain.OperationId);
            var entity = new TxBroadcastEntity
            {
                PartitionKey = TableKeyHelper.GetHashedRowKey(rowKey),
                RowKey       = rowKey,
                State        = domain.State,
                Amount       = domain.Amount,
                Fee          = domain.Fee,
                Hash         = domain.Hash,
                Ledger       = domain.Ledger,
                CreatedAt    = domain.CreatedAt,
                Error        = domain.Error,
                ErrorCode    = domain.ErrorCode
            };

            return(entity);
        }
 public async Task DeleteIfExistAsync(string assetId, string address)
 {
     var rowKey = WalletBalanceEntity.GetRowKey(assetId, address);
     await _balanceTable.DeleteIfExistAsync(TableKeyHelper.GetHashedRowKey(rowKey), rowKey);
 }
 public async Task DeleteIfExistAsync(string key)
 {
     await _table.DeleteIfExistAsync(TableKeyHelper.GetHashedRowKey(key), key);
 }
 public async Task DeleteAsync(Guid operationId)
 {
     var rowKey = TableKeyHelper.GetRowKey(operationId);
     await _table.DeleteAsync(TableKeyHelper.GetHashedRowKey(rowKey), rowKey);
 }
 public override string GetRowKey(BroadcastObservation observation)
 {
     return(TableKeyHelper.GetRowKey(observation.OperationId));
 }