Skip to content

Commit

Permalink
feat: implement SearchUtxosAsync method in QueryServiceClient (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercurial authored Nov 24, 2024
1 parent 0bdd47b commit e998f15
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
28 changes: 27 additions & 1 deletion src/Utxorpc.Sdk/QueryServiceClient.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Google.Protobuf;
using Grpc.Net.Client;
using Utxorpc.V1alpha.Query;

Expand Down Expand Up @@ -28,6 +29,31 @@ public QueryServiceClient(string url, IDictionary<string, string>? headers = nul
var channel = GrpcChannel.ForAddress(url, channelOptions);
_client = new QueryService.QueryServiceClient(channel);
}

public async Task<SearchUtxosResponse> SearchUtxosAsync(byte[] address, string? start_token = null)
{
SearchUtxosRequest request = new()
{
Predicate = new()
{
Match = new()
{
Cardano = new()
{
Address = new ()
{
ExactAddress = ByteString.CopyFrom(address)
}
}
}
},
};

// TODO: Implement ReadData, ReadParams, ReadUtxos, SearchUtxos methods
if (start_token != null)
{
request.StartToken = start_token;
}

return await _client.SearchUtxosAsync(request);
}
}
1 change: 0 additions & 1 deletion src/Utxorpc.Sdk/SubmitServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public SubmitServiceClient(string url, IDictionary<string, string>? headers = nu
var channel = GrpcChannel.ForAddress(url, channelOptions);
_client = new SubmitService.SubmitServiceClient(channel);
}
// TODO: Implement EvalTx, ReadMempool, SubmitTx, WaitForTx, WatchMempool methods
}

0 comments on commit e998f15

Please sign in to comment.