Example #1
0
        public async Task <ulong> Epoch(LocalNodeInfoRequest request, DateTime?deadline = null, CancellationToken context = default)
        {
            var resp = await NetmapClient.LocalNodeInfoAsync(request, deadline : deadline, cancellationToken : context);

            if (!resp.Verify())
            {
                throw new FormatException(nameof(LocalNodeInfo) + " invalid LocalNodeInfo response");
            }
            return(resp.MetaHeader.Epoch);
        }
Example #2
0
        public async Task <NodeInfo> LocalNodeInfo(LocalNodeInfoRequest request, DateTime?deadline = null, CancellationToken context = default)
        {
            var resp = await NetmapClient.LocalNodeInfoAsync(request, deadline : deadline, cancellationToken : context);

            if (!resp.Verify())
            {
                throw new FormatException(nameof(LocalNodeInfo) + " invalid LocalNodeInfo response");
            }
            CheckStatus(resp);
            return(resp.Body.NodeInfo);
        }
Example #3
0
        public async Task <ulong> Epoch(CallOptions options = null, CancellationToken context = default)
        {
            var opts = DefaultCallOptions.ApplyCustomOptions(options);

            CheckOptions(opts);
            var req = new LocalNodeInfoRequest
            {
                Body = new LocalNodeInfoRequest.Types.Body {
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            opts.Key.Sign(req);

            return(await Epoch(req, opts.Deadline, context));
        }
Example #4
0
        public NodeInfo LocalNodeInfo(CancellationToken context, CallOptions options = null)
        {
            var netmap_client = new NetmapService.NetmapServiceClient(channel);
            var opts          = DefaultCallOptions.ApplyCustomOptions(options);
            var req           = new LocalNodeInfoRequest
            {
                Body = new LocalNodeInfoRequest.Types.Body {
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            req.SignRequest(key);
            var resp = netmap_client.LocalNodeInfo(req, cancellationToken: context);

            if (!resp.VerifyResponse())
            {
                throw new FormatException(nameof(LocalNodeInfo) + " invalid LocalNodeInfo response");
            }
            return(resp.Body.NodeInfo);
        }