public NxtConnector(IServiceFactory serviceFactory, string walletfile, int confirmations) { accountService = serviceFactory.CreateAccountService(); blockService = serviceFactory.CreateBlockService(); serverInfoService = serviceFactory.CreateServerInfoService(); this.confirmations = confirmations; wallet = InitWallet(walletfile); }
public async Task <Block <ulong> > GetBlockAsync(ulong blockId) { try { var blockService = _serviceFactory.CreateBlockService(); var blockReply = await blockService.GetBlock(BlockLocator.ByBlockId(blockId)); IsOnline = true; return(blockReply); } catch (HttpRequestException) { IsOnline = false; throw; } catch (JsonReaderException e) { IsOnline = false; throw new Exception("Error when parsing response", e); } }