Bump common (#1563)

This commit is contained in:
Jaco Greeff
2019-11-11 11:34:08 +01:00
committed by GitHub
parent 8ea07727ba
commit f080d6ed1c
11 changed files with 47 additions and 49 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes>
api.query.indices.enumSet.multi([...Array(next.toNumber() + 1).keys()]) as Observable<any>
),
map((all: (AccountId[] | undefined)[]): AccountIndexes =>
(all || []).reduce((result, list, outerIndex): AccountIndexes => {
(all || []).reduce((result: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
@@ -51,7 +51,7 @@ export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes>
});
return result;
}, {} as AccountIndexes)),
}, {})),
drr()
);
}
+12 -12
View File
@@ -4,7 +4,7 @@
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces';
import { Codec } from '@polkadot/types/types';
import { ITuple } from '@polkadot/types/types';
import { DeriveAccountInfo } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
@@ -15,17 +15,17 @@ import { u8aToString } from '@polkadot/util';
import { drr } from '../util';
function retrieveNick (api: ApiInterfaceRx, accountId?: AccountId): Observable<string | undefined> {
return accountId && api.query.nicks
? api.query.nicks
.nameOf<Option<[Bytes, Balance] & Codec>>(accountId)
.pipe(
map((nameOf): string | undefined =>
nameOf?.isSome
? u8aToString(nameOf.unwrap()[0]).substr(0, (api.consts.nicks.maxLength as u32).toNumber())
: undefined
)
)
: of(undefined);
return ((
accountId && api.query.nicks
? api.query.nicks.nameOf<Option<ITuple<[Bytes, Balance]>>>(accountId)
: of(undefined)
) as Observable<Option<ITuple<[Bytes, Balance]>> | undefined>).pipe(
map((nameOf): string | undefined =>
nameOf?.isSome
? u8aToString(nameOf.unwrap()[0]).substr(0, (api.consts.nicks.maxLength as u32).toNumber())
: undefined
)
);
}
/**