Skip to content

Commit

Permalink
Merge pull request #103 from tyronbrand/http-client-collection-transa…
Browse files Browse the repository at this point in the history
…ctions

Transaction data added to FlowCollection
  • Loading branch information
tyronbrand authored Dec 2, 2022
2 parents 452c00b + 0281910 commit 7d06018
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Flow.Net.Sdk.Client.Http/FlowApiConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public static FlowCollection ToFlowCollection(this Collection collection)
};

if (collection.Transactions != null)
{
flowCollection.TransactionIds = collection.Transactions?.Select(s => s.ToFlowTransactionId()).ToList();
flowCollection.Transactions = collection.Transactions?.Select(x => x.ToFlowTransactionResponse()).ToList();
}

return flowCollection;
}
Expand Down Expand Up @@ -142,7 +145,7 @@ public static FlowTransactionResult ToFlowTransactionResult(this Transaction tra

return new FlowTransactionResult
{
BlockId = transaction.Reference_block_id,
BlockId = transaction.Result.Block_id,
ErrorMessage = transaction.Result.Error_message,
Status = (Core.TransactionStatus)Enum.Parse(typeof(Core.TransactionStatus), transaction.Result.Status.ToString()),
StatusCode = uint.Parse(transaction.Result.Status_code.ToString()),
Expand Down
2 changes: 1 addition & 1 deletion src/Flow.Net.Sdk.Client.Http/FlowHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public async Task<FlowTransactionResponse> GetTransactionAsync(string transactio
{
try
{
var response = await _flowApiV1.TransactionsAsync(transactionId, null, null, cancellationToken).ConfigureAwait(false);
var response = await _flowApiV1.TransactionsAsync(transactionId, new List<string> { "result" }, null, cancellationToken).ConfigureAwait(false);
return response.ToFlowTransactionResponse();
}
catch (Exception ex)
Expand Down
1 change: 1 addition & 0 deletions src/Flow.Net.Sdk.Core/Models/FlowCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public class FlowCollection
{
public string Id { get; set; }
public IList<FlowTransactionId> TransactionIds { get; set; } = new List<FlowTransactionId>();
public IList<FlowTransactionResponse> Transactions { get; set; } = new List<FlowTransactionResponse>();
}
}

0 comments on commit 7d06018

Please sign in to comment.