@@ -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
@@ -131,7 +165,7 @@ export class AccountHttp extends Http implements AccountRepository {
131165 * @param address - User address
132166 * @returns Observable<MultisigAccountGraphInfo>
133167 */
134- public getMultisigAccountGraphInfo ( address : Address ) : Observable < MultisigAccountGraphInfo > {
168+ public getMultisigAccountGraphInfo ( address : Address ) : Observable < MultisigAccountGraphInfo > {
135169 return this . getNetworkTypeObservable ( ) . pipe (
136170 mergeMap ( ( networkType ) => observableFrom (
137171 this . accountRoutesApi . getAccountMultisigGraph ( address . plain ( ) ) ) . pipe ( map ( ( multisigAccountGraphInfosDTO ) => {
@@ -161,7 +195,7 @@ export class AccountHttp extends Http implements AccountRepository {
161195 * @returns Observable<Transaction[]>
162196 */
163197 public transactions ( publicAccount : PublicAccount ,
164- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
198+ queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
165199 return observableFrom (
166200 this . accountRoutesApi . transactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
167201 map ( ( transactionsDTO ) => {
@@ -178,8 +212,7 @@ export class AccountHttp extends Http implements AccountRepository {
178212 * @param queryParams - (Optional) Query params
179213 * @returns Observable<Transaction[]>
180214 */
181- public incomingTransactions ( publicAccount : PublicAccount ,
182- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
215+ public incomingTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
183216 return observableFrom (
184217 this . accountRoutesApi . incomingTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
185218 map ( ( transactionsDTO ) => {
@@ -196,8 +229,7 @@ export class AccountHttp extends Http implements AccountRepository {
196229 * @param queryParams - (Optional) Query params
197230 * @returns Observable<Transaction[]>
198231 */
199- public outgoingTransactions ( publicAccount : PublicAccount ,
200- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
232+ public outgoingTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
201233 return observableFrom (
202234 this . accountRoutesApi . outgoingTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
203235 map ( ( transactionsDTO ) => {
@@ -215,8 +247,7 @@ export class AccountHttp extends Http implements AccountRepository {
215247 * @param queryParams - (Optional) Query params
216248 * @returns Observable<Transaction[]>
217249 */
218- public unconfirmedTransactions ( publicAccount : PublicAccount ,
219- queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
250+ public unconfirmedTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < Transaction [ ] > {
220251 return observableFrom (
221252 this . accountRoutesApi . unconfirmedTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
222253 map ( ( transactionsDTO ) => {
@@ -233,9 +264,7 @@ export class AccountHttp extends Http implements AccountRepository {
233264 * @param queryParams - (Optional) Query params
234265 * @returns Observable<AggregateTransaction[]>
235266 */
236- public aggregateBondedTransactions ( publicAccount : PublicAccount ,
237- queryParams ?: QueryParams ) : Observable < AggregateTransaction [ ] > {
238-
267+ public aggregateBondedTransactions ( publicAccount : PublicAccount , queryParams ?: QueryParams ) : Observable < AggregateTransaction [ ] > {
239268 return observableFrom (
240269 this . accountRoutesApi . partialTransactions ( publicAccount . publicKey , queryParams != null ? queryParams : { } ) ) . pipe (
241270 map ( ( transactionsDTO ) => {
0 commit comments