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

            var broadcast = entity?.ToDomain();

            return(broadcast);
        }
Example #2
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);
        }
Example #4
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 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));
 }