This repository was archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathProtobufTest.cs
More file actions
54 lines (43 loc) · 1.58 KB
/
ProtobufTest.cs
File metadata and controls
54 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Grpc.Core;
using Waves;
using Waves.Node.Grpc;
using WavesCS;
using Google.Protobuf;
using System.Threading.Tasks;
namespace WavesCSTests.Protobuf
{
[TestClass]
public class ProtobufTest
{
public TestContext TestContext { get; set; }
[TestInitialize]
public void Init()
{
Http.Tracing = true;
}
[TestMethod]
public void TestGrpcBlocksApiClient()
{
Channel channel = new Channel("mainnet-aws-fr-1.wavesnodes.com:6871", ChannelCredentials.Insecure);
BlocksApi.BlocksApiClient client = new BlocksApi.BlocksApiClient(channel);
BlockWithHeight block = client.GetBlock(new BlockRequest() { Height = -1 });
TestContext.WriteLine(block.ToString());
}
[TestMethod]
public void TestGrpcTransactionsApiClient()
{
Channel channel = new Channel("mainnet-aws-fr-1.wavesnodes.com:6871", ChannelCredentials.Insecure);
var client = new TransactionsApi.TransactionsApiClient(channel);
var txId = "76TxtthzU6YxLMAEVpPj7RJtJcXAG8FCRvDZy4KR4zW2";
var request = new TransactionsRequest()
{
TransactionIds = { ByteString.CopyFrom(txId.FromBase58()) }
};
var t = client.GetTransactions(request);
var task = Task.Run(async () => { await t.ResponseStream.MoveNext(); });
task.Wait();
TestContext.WriteLine(t.ResponseStream.Current.ToString());
}
}
}