public async Task <long> GetUnconfirmedNqtBalanceAsync() { try { var accountService = _serviceFactory.CreateAccountService(); var balanceResult = await accountService.GetBalance(_walletRepository.NxtAccount, requireBlock : requireBlock); IsOnline = true; return(balanceResult.UnconfirmedBalance.Nqt); } catch (HttpRequestException) { IsOnline = false; throw; } catch (JsonReaderException e) { IsOnline = false; throw new Exception("Error when parsing response", e); } catch (NxtException e) { if (!e.Message.Equals("Unknown account")) { IsOnline = false; throw new Exception("", e); } } IsOnline = true; return(0); }
public NxtConnector(IServiceFactory serviceFactory) { accountService = serviceFactory.CreateAccountService(); monetarySystemService = serviceFactory.CreateMonetarySystemService(); assetExchangeService = serviceFactory.CreateAssetExchangeService(); taggedDataService = serviceFactory.CreateTaggedDataService(); }
public NxtConnector(IServiceFactory serviceFactory, string walletfile, int confirmations) { accountService = serviceFactory.CreateAccountService(); blockService = serviceFactory.CreateBlockService(); serverInfoService = serviceFactory.CreateServerInfoService(); this.confirmations = confirmations; wallet = InitWallet(walletfile); }
public void SetUp() { ServiceFactoryProxy.Singleton.SetServiceFactory(new MockServiceFactory()); Factory = ServiceFactoryProxy.Singleton.ServiceFactory; AccountService = Factory.CreateAccountService(); }