/// <summary> /// Gets the namespaces from accounts. /// </summary> /// <param name="accounts">The accounts.</param> /// <param name="query">The query.</param> /// <returns>IObservable<List<NamespaceInfoDTO>>.</returns> /// <exception cref="ArgumentNullException">accounts /// or /// query</exception> /// <exception cref="ArgumentException">Value cannot be an empty collection. - accounts</exception> public IObservable <List <NamespaceInfo> > GetNamespacesFromAccounts(List <Address> accounts, QueryParams query) { if (accounts == null) { throw new ArgumentNullException(nameof(accounts)); } if (query == null) { throw new ArgumentNullException(nameof(query)); } if (accounts.Count == 0) { throw new ArgumentException("Value cannot be an empty collection.", nameof(accounts)); } IObservable <NetworkType.Types> networkTypeResolve = GetNetworkTypeObservable().Take(1); return(Observable.FromAsync(async ar => await NamespaceRoutesApi.GetNamespacesFromAccountsAsync( new AddressesDTO { Addresses = accounts.Select(e => e.Plain).ToArray() }, query.GetPageSize(), query.GetId() )).Select(i => i.Select(e => new NamespaceInfo( e.Meta.Active, e.Meta.Index, e.Meta.Id, NamespaceTypes.GetRawValue(e.Namespace.Type), e.Namespace.Depth, ExtractLevels(e.Namespace), new NamespaceId(e.Namespace.ParentId), e.Namespace.StartHeight, e.Namespace.EndHeight, new PublicAccount(e.Namespace.Owner, networkTypeResolve.Wait()) )).ToList()));; }
/// <summary> /// Gets the block transactions. /// </summary> /// <param name="height">The height.</param> /// <param name="query">The query.</param> /// <returns>IObservable<List<TransactionInfoDTO>>.</returns> /// <exception cref="ArgumentNullException">query</exception> public IObservable <List <Transaction> > GetBlockTransactions(ulong height, QueryParams query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } return(Observable.FromAsync(async ar => await BlockchainRoutesApi.GetBlockTransactionsAsync(height, query.GetPageSize(), query.GetId()))); }
/// <summary> /// Get all transactions. /// </summary> /// <param name="account">The account for which transactions should be returned.</param> /// <param name="query">The query parameters.</param> /// <returns>IObservable list of type Transaction.</returns> /// <exception cref="ArgumentNullException">account /// or /// query</exception> public IObservable <List <Transaction> > Transactions(PublicAccount account, QueryParams query) { if (account == null) { throw new ArgumentNullException(nameof(account)); } if (query == null) { throw new ArgumentNullException(nameof(query)); } return(Observable.FromAsync(async ar => await AccountRoutesApi.TransactionsAsync(account.PublicKey, query.GetPageSize(), query.GetId()))); }
/// <summary> /// Gets the namespaces from account. /// </summary> /// <param name="account">The account.</param> /// <param name="query">The query.</param> /// <returns>IObservable<List<NamespaceInfoDTO>>.</returns> /// <exception cref="ArgumentNullException">account /// or /// query</exception> public IObservable <List <NamespaceInfo> > GetNamespacesFromAccount(PublicAccount account, QueryParams query) { if (account == null) { throw new ArgumentNullException(nameof(account)); } if (query == null) { throw new ArgumentNullException(nameof(query)); } IObservable <NetworkType.Types> networkTypeResolve = GetNetworkTypeObservable().Take(1); return(Observable.FromAsync(async ar => await NamespaceRoutesApi.GetNamespacesFromAccountAsync(account.PublicKey, query.GetPageSize(), query.GetId())) .Select(i => i.Select(e => new NamespaceInfo( e.Meta.Active, e.Meta.Index, e.Meta.Id, NamespaceTypes.GetRawValue(e.Namespace.Type), e.Namespace.Depth, ExtractLevels(e.Namespace), new NamespaceId(e.Namespace.ParentId), e.Namespace.StartHeight, e.Namespace.EndHeight, new PublicAccount(e.Namespace.Owner, networkTypeResolve.Wait()) )).ToList())); }