Skip to content

Commit e998f15

Browse files
authored
feat: implement SearchUtxosAsync method in QueryServiceClient (#23)
1 parent 0bdd47b commit e998f15

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/Utxorpc.Sdk/QueryServiceClient.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Google.Protobuf;
12
using Grpc.Net.Client;
23
using Utxorpc.V1alpha.Query;
34

@@ -28,6 +29,31 @@ public QueryServiceClient(string url, IDictionary<string, string>? headers = nul
2829
var channel = GrpcChannel.ForAddress(url, channelOptions);
2930
_client = new QueryService.QueryServiceClient(channel);
3031
}
32+
33+
public async Task<SearchUtxosResponse> SearchUtxosAsync(byte[] address, string? start_token = null)
34+
{
35+
SearchUtxosRequest request = new()
36+
{
37+
Predicate = new()
38+
{
39+
Match = new()
40+
{
41+
Cardano = new()
42+
{
43+
Address = new ()
44+
{
45+
ExactAddress = ByteString.CopyFrom(address)
46+
}
47+
}
48+
}
49+
},
50+
};
3151

32-
// TODO: Implement ReadData, ReadParams, ReadUtxos, SearchUtxos methods
52+
if (start_token != null)
53+
{
54+
request.StartToken = start_token;
55+
}
56+
57+
return await _client.SearchUtxosAsync(request);
58+
}
3359
}

src/Utxorpc.Sdk/SubmitServiceClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ public SubmitServiceClient(string url, IDictionary<string, string>? headers = nu
2828
var channel = GrpcChannel.ForAddress(url, channelOptions);
2929
_client = new SubmitService.SubmitServiceClient(channel);
3030
}
31-
// TODO: Implement EvalTx, ReadMempool, SubmitTx, WaitForTx, WatchMempool methods
3231
}

0 commit comments

Comments
 (0)