@@ -18,6 +18,8 @@ import {AccountRoutesApi} from 'nem2-library';
1818import { from as observableFrom , Observable } from 'rxjs' ;
1919import { map , mergeMap } from 'rxjs/operators' ;
2020import { AccountInfo } from '../model/account/AccountInfo' ;
21+ import { AccountPropertiesInfo } from '../model/account/AccountPropertiesInfo' ;
22+ import { AccountProperty } from '../model/account/AccountProperty' ;
2123import { Address } from '../model/account/Address' ;
2224import { MultisigAccountGraphInfo } from '../model/account/MultisigAccountGraphInfo' ;
2325import { MultisigAccountInfo } from '../model/account/MultisigAccountInfo' ;
@@ -79,6 +81,38 @@ export class AccountHttp extends Http implements AccountRepository {
7981 } ) ) ;
8082 }
8183
84+ /**
85+ * Gets Account property.
86+ * @param publicAccount public account
87+ * @returns Observable<AccountProperty>
88+ */
89+ public getAccountProperty ( publicAccount : PublicAccount ) : Observable < AccountPropertiesInfo > {
90+ return observableFrom ( this . accountRoutesApi . getAccountProperties ( publicAccount . publicKey ) ) . pipe ( map ( ( accountProperties ) => {
91+ return new AccountPropertiesInfo (
92+ accountProperties . meta ,
93+ accountProperties . accountProperties ,
94+ ) ;
95+ } ) ) ;
96+ }
97+
98+ /**
99+ * Gets Account properties.
100+ * @param address list of addresses
101+ * @returns Observable<AccountProperty[]>
102+ */
103+ public getAccountProperties ( addresses : Address [ ] ) : Observable < AccountPropertiesInfo [ ] > {
104+ const accountIds = addresses . map ( ( address ) => address . plain ( ) ) ;
105+ return observableFrom (
106+ this . accountRoutesApi . getAccountPropertiesFromAccounts ( accountIds ) ) . pipe ( map ( ( accountProperties ) => {
107+ return accountProperties . map ( ( property ) => {
108+ return new AccountPropertiesInfo (
109+ property . meta ,
110+ property . accountProperties ,
111+ ) ;
112+ } ) ;
113+ } ) ) ;
114+ }
115+
82116 /**
83117 * Gets AccountsInfo for different accounts.
84118 * @param addresses List of Address
@@ -160,8 +194,7 @@ export class AccountHttp extends Http implements AccountRepository {
160194 * @param queryParams - (Optional) Query params
161195 * @returns Observable<Transaction[]>
162196 */
163- public transactions ( publicAccount : PublicAccount ,
164- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
197+ public transactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
165198 return observableFrom (
166199 this . accountRoutesApi . transactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
167200 map ( ( transactionsDTO ) => {
@@ -178,8 +211,7 @@ export class AccountHttp extends Http implements AccountRepository {
178211 * @param queryParams - (Optional) Query params
179212 * @returns Observable<Transaction[]>
180213 */
181- public incomingTransactions ( publicAccount : PublicAccount ,
182- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
214+ public incomingTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
183215 return observableFrom (
184216 this . accountRoutesApi . incomingTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
185217 map ( ( transactionsDTO ) => {
@@ -196,8 +228,7 @@ export class AccountHttp extends Http implements AccountRepository {
196228 * @param queryParams - (Optional) Query params
197229 * @returns Observable<Transaction[]>
198230 */
199- public outgoingTransactions ( publicAccount : PublicAccount ,
200- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
231+ public outgoingTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
201232 return observableFrom (
202233 this . accountRoutesApi . outgoingTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
203234 map ( ( transactionsDTO ) => {
@@ -215,8 +246,7 @@ export class AccountHttp extends Http implements AccountRepository {
215246 * @param queryParams - (Optional) Query params
216247 * @returns Observable<Transaction[]>
217248 */
218- public unconfirmedTransactions ( publicAccount : PublicAccount ,
219- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
249+ public unconfirmedTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
220250 return observableFrom (
221251 this . accountRoutesApi . unconfirmedTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
222252 map ( ( transactionsDTO ) => {
@@ -233,9 +263,7 @@ export class AccountHttp extends Http implements AccountRepository {
233263 * @param queryParams - (Optional) Query params
234264 * @returns Observable<AggregateTransaction[]>
235265 */
236- public aggregateBondedTransactions ( publicAccount : PublicAccount ,
237- queryParams ?: QueryParams ) : Observable < AggregateTransaction [ ] > {
238-
266+ public aggregateBondedTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < AggregateTransaction [ ] > {
239267 return observableFrom (
240268 this . accountRoutesApi . partialTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
241269 map ( ( transactionsDTO ) => {
0 commit comments