public static async Task <IEnumerable <IPrivateWallet> > GetAllPrivateWallets(this IPrivateWalletsRepository repo, string clientId,
                                                                                      IWalletCredentials walletCreds, string defaultWalletName = "default")
        {
            var storedWallets = (await repo.GetStoredWallets(clientId))?.ToArray();

            var wallets = new List <IPrivateWallet>((storedWallets?.Length ?? 0) + 1);

            if (walletCreds != null)
            {
                wallets.Add(new PrivateWallet
                {
                    ClientId       = walletCreds.ClientId,
                    WalletAddress  = walletCreds.Address,
                    BlockchainType = Lykke.Service.Assets.Client.Models.Blockchain.Bitcoin,
                    WalletName     = defaultWalletName,
                });
            }

            if (storedWallets != null)
            {
                wallets.AddRange(storedWallets);
            }

            return(wallets);
        }
示例#2
0
        public async Task WarmUp(string clientId)
        {
            var wallets = await _privateWalletsRepository.GetStoredWallets(clientId);

            foreach (var wallet in wallets)
            {
                await _ninjaFacade.SendBalanceRequest(wallet.WalletAddress);
            }
        }
        public static async Task <IEnumerable <IPrivateWallet> > GetAllPrivateWallets(this IPrivateWalletsRepository repo, string clientId,
                                                                                      IWalletCredentials walletCreds, string defaultWalletName)
        {
            var wallets = (await repo.GetStoredWallets(clientId)).ToList();

            IPrivateWallet defaultWallet = new PrivateWallet
            {
                ClientId      = walletCreds.ClientId,
                WalletAddress = walletCreds.Address,
                WalletName    = defaultWalletName
            };

            wallets.Add(defaultWallet);

            return(wallets);
        }