Exemple #1
0
        public async Task GetAccountsInfoPublicKeys()
        {
            var expected1 = "SCEYFB35CYFF2U7UZ32RYXXZ5JTPCSKU4P6BRXZR";

            var accounts = new PublicKeysDTO()
            {
                PublicKeys = new[]
                {
                    "B974668ABED344BE9C35EE257ACC246117EFFED939EAF42391AE995912F985FE"
                }
            };

            var response = await new AccountHttp(host).GetAccountsInfo(accounts);

            Assert.AreEqual(expected1, response[0].Address.Plain);
        }
Exemple #2
0
        /// <summary>
        /// Get account information.
        /// </summary>
        /// <param name="accountIds">The account ids for which account information should be returned.</param>
        /// <returns>An IObservable of a List of AccountInfoDTO</returns>
        /// <exception cref="ArgumentNullException">accountIds</exception>
        public IObservable <List <AccountInfo> > GetAccountsInfo(PublicKeysDTO accountIds)
        {
            if (accountIds == null)
            {
                throw new ArgumentNullException(nameof(accountIds));
            }

            return(Observable.FromAsync(async ar => await AccountRoutesApi.GetAccountsInfoAsync(accountIds)).Select(e =>
                                                                                                                    e.Select(accountInfo => new AccountInfo(
                                                                                                                                 Address.CreateFromEncoded(accountInfo.Account.Address),
                                                                                                                                 accountInfo.Account.AddressHeight,
                                                                                                                                 accountInfo.Account.PublicKey,
                                                                                                                                 accountInfo.Account.PublicKeyHeight,
                                                                                                                                 accountInfo.Account.Importance,
                                                                                                                                 accountInfo.Account.ImportanceHeight,
                                                                                                                                 accountInfo.Account.Mosaics.Select(
                                                                                                                                     mosaic => new Mosaic(new MosaicId(
                                                                                                                                                              BitConverter.ToUInt64(mosaic.MosaicId.FromHex().Reverse().ToArray(), 0)),
                                                                                                                                                          mosaic.Amount)
                                                                                                                                     ).ToList())
                                                                                                                             ).ToList()));
        }