* Rename ui-* -> react-* * Rename actual folders * react-app -> react-components * CSS links
22 lines
681 B
TypeScript
22 lines
681 B
TypeScript
// Copyright 2017-2019 @polkadot/react-components authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
|
|
|
import { KeyringItemType, KeyringJson$Meta } from '@polkadot/ui-keyring/types';
|
|
|
|
import keyring from '@polkadot/ui-keyring';
|
|
|
|
export default function getAddressMeta (address: string, type: KeyringItemType | null = null): KeyringJson$Meta {
|
|
let meta: KeyringJson$Meta | undefined;
|
|
|
|
try {
|
|
const pair = keyring.getAddress(address, type);
|
|
|
|
meta = pair && pair.meta;
|
|
} catch (error) {
|
|
// we could pass invalid addresses, so it may throw
|
|
}
|
|
|
|
return meta || {};
|
|
}
|