public Account( IHdWallet wallet, SecureString password, ICurrenciesProvider currenciesProvider, ClientType clientType, Action <MigrationActionType> migrationCompleteCallback = null) { Wallet = wallet ?? throw new ArgumentNullException(nameof(wallet)); Currencies = currenciesProvider.GetCurrencies(Network); DataRepository = new LiteDbAccountDataRepository( pathToDb: Path.Combine(Path.GetDirectoryName(Wallet.PathToWallet), DefaultDataFileName), password: password, currencies: Currencies, network: wallet.Network, migrationCompleteCallback); CurrencyAccounts = CurrencyAccountCreator.Create(Currencies, wallet, DataRepository); UserSettings = UserSettings.TryLoadFromFile( pathToFile: $"{Path.GetDirectoryName(Wallet.PathToWallet)}/{DefaultUserSettingsFileName}", password: password) ?? UserSettings.DefaultSettings; _clientType = clientType; }
public Account( IHdWallet wallet, SecureString password, ICurrenciesProvider currenciesProvider, ISymbolsProvider symbolsProvider) { Wallet = wallet ?? throw new ArgumentNullException(nameof(wallet)); Currencies = currenciesProvider.GetCurrencies(Network); Symbols = symbolsProvider.GetSymbols(Network); DataRepository = new LiteDbAccountDataRepository( pathToDb: $"{Path.GetDirectoryName(Wallet.PathToWallet)}/{DefaultDataFileName}", password: password, currencies: Currencies, network: wallet.Network); CurrencyAccounts = Currencies .ToDictionary( c => c.Name, c => CurrencyAccountCreator.Create( currency: c.Name, wallet: Wallet, dataRepository: DataRepository, currencies: Currencies)); UserSettings = UserSettings.TryLoadFromFile( pathToFile: $"{Path.GetDirectoryName(Wallet.PathToWallet)}/{DefaultUserSettingsFileName}", password: password) ?? UserSettings.DefaultSettings; }
public static Account LoadFromFile( string pathToAccount, SecureString password, ICurrenciesProvider currenciesProvider, ISymbolsProvider symbolsProvider) { return(new Account(pathToAccount, password, currenciesProvider, symbolsProvider)); }
public static Account LoadFromFile( string pathToAccount, SecureString password, ICurrenciesProvider currenciesProvider, ClientType clientType, Action <MigrationActionType> migrationCompleteCallback = null) { return(new Account(pathToAccount, password, currenciesProvider, clientType, migrationCompleteCallback)); }
private Account( string pathToAccount, SecureString password, ICurrenciesProvider currenciesProvider, ISymbolsProvider symbolsProvider) : this(wallet : HdWallet.LoadFromFile(pathToAccount, password), password : password, currenciesProvider : currenciesProvider, symbolsProvider : symbolsProvider) { }
private Account( string pathToAccount, SecureString password, ICurrenciesProvider currenciesProvider, ClientType clientType, Action <MigrationActionType> migrationCompleteCallback = null) : this(wallet : HdWallet.LoadFromFile(pathToAccount, password), password : password, currenciesProvider : currenciesProvider, clientType : clientType, migrationCompleteCallback : migrationCompleteCallback) { }
public SymbolsProvider( IConfiguration configuration, ICurrenciesProvider currenciesProvider) { foreach (var network in Networks) { var networkConfiguration = configuration.GetSection(network.ToString()); if (networkConfiguration != null) { _symbols.Add(network, new Symbols( configuration: networkConfiguration, currencies: currenciesProvider.GetCurrencies(network))); } } }
public Account( IHdWallet wallet, SecureString password, IAccountDataRepository dataRepository, ICurrenciesProvider currenciesProvider, ClientType clientType) { Wallet = wallet ?? throw new ArgumentNullException(nameof(wallet)); DataRepository = dataRepository ?? throw new ArgumentNullException(nameof(dataRepository)); Currencies = currenciesProvider.GetCurrencies(Network); CurrencyAccounts = CurrencyAccountCreator.Create(Currencies, wallet, DataRepository); UserSettings = UserSettings.TryLoadFromFile( pathToFile: $"{Path.GetDirectoryName(Wallet.PathToWallet)}/{DefaultUserSettingsFileName}", password: password) ?? UserSettings.DefaultSettings; _clientType = clientType; }
public static IAccount LoadFromConfiguration( IConfiguration configuration, SecureString password, ICurrenciesProvider currenciesProvider, ISymbolsProvider symbolsProvider) { var pathToAccount = configuration[DefaultAccountKey]; if (string.IsNullOrEmpty(pathToAccount)) { Log.Error("Path to default account is null or empty"); return(null); } if (!File.Exists(PathEx.ToFullPath(pathToAccount))) { Log.Error("Default account not found"); return(null); } return(LoadFromFile(pathToAccount, password, currenciesProvider, symbolsProvider)); }
public IAtomexApp UseCurrenciesProvider(ICurrenciesProvider currenciesProvider) { CurrenciesProvider = currenciesProvider; return(this); }
public CurrenciesUpdater(ICurrenciesProvider currenciesProvider) { _currenciesProvider = currenciesProvider ?? throw new ArgumentNullException(nameof(currenciesProvider)); }