All icon theme per chain (#155)
This commit is contained in:
parent
caa9245ce3
commit
d51182e884
@ -1,6 +1,10 @@
|
||||
# 0.11.0-beta.x
|
||||
|
||||
- Integrate polkadot-js/common 1.4.1 & polkadot-js/ui 0.44.1
|
||||
- Cleanup metadata handling, when outdated for a node, transparently handle parsing errors
|
||||
- Added Edgeware mainnet metadata information
|
||||
- Display addresses correctly formatted by on the ss58 chain identifiers
|
||||
- Display identity icons based on chain typed (only for known chains)
|
||||
- Integrate latest polkadot-js/common 1.4.1 & polkadot-js/ui 0.44.1 dependencies
|
||||
- Updated to babe 7.6 (build and runtime improvememnts)
|
||||
|
||||
# 0.10.1
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
export default {
|
||||
chain: 'Alexander',
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
icon: 'polkadot',
|
||||
specVersion: 112,
|
||||
ss58Format: 42,
|
||||
tokenDecimals: 15,
|
||||
|
||||
@ -12,6 +12,7 @@ import { VotingTypes } from 'edgeware-node-types/dist/voting';
|
||||
export default {
|
||||
chain: 'Edgeware',
|
||||
genesisHash: '0xda60008770287b5eb4f9b5241317ac4c7e42c3c3d8e85fbbfa2a88705394d75e',
|
||||
icon: 'substrate',
|
||||
specVersion: 20,
|
||||
ss58Format: 42,
|
||||
tokenDecimals: 18,
|
||||
|
||||
@ -13,10 +13,11 @@ import kusamaCC1 from './kusama-cc1';
|
||||
|
||||
const chains: Map<string, Chain> = new Map(
|
||||
[alexander, edgeware, kusamaCC1].map(
|
||||
({ chain, genesisHash, metaCalls, specVersion, ss58Format, tokenDecimals, tokenSymbol, types }): [string, Chain] => [
|
||||
({ chain, genesisHash, icon, metaCalls, specVersion, ss58Format, tokenDecimals, tokenSymbol, types }): [string, Chain] => [
|
||||
genesisHash,
|
||||
{
|
||||
genesisHash,
|
||||
icon,
|
||||
meta: metaCalls
|
||||
? new Metadata(Buffer.from(metaCalls, 'base64'))
|
||||
: undefined,
|
||||
@ -32,6 +33,7 @@ const chains: Map<string, Chain> = new Map(
|
||||
);
|
||||
|
||||
const UNKNOWN_CHAIN: Chain = {
|
||||
icon: 'polkadot',
|
||||
isUnknown: true,
|
||||
name: 'Unknown chain',
|
||||
specVersion: 0,
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
export default {
|
||||
chain: 'Kusama CC1',
|
||||
genesisHash: '0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf',
|
||||
icon: 'polkadot',
|
||||
specVersion: 1001,
|
||||
ss58Format: 2,
|
||||
tokenDecimals: 12,
|
||||
|
||||
@ -5,8 +5,9 @@
|
||||
import { Metadata } from '@polkadot/types';
|
||||
|
||||
export interface Chain {
|
||||
isUnknown?: boolean;
|
||||
genesisHash?: string;
|
||||
icon: string;
|
||||
isUnknown?: boolean;
|
||||
meta?: Metadata;
|
||||
name: string;
|
||||
specVersion: number;
|
||||
|
||||
@ -22,7 +22,6 @@ interface Props {
|
||||
className?: string;
|
||||
name?: React.ReactNode | null;
|
||||
genesisHash?: string | null;
|
||||
theme?: 'polkadot' | 'substrate';
|
||||
}
|
||||
|
||||
// find an account in our list
|
||||
@ -51,7 +50,7 @@ function recodeAddress (address: string, accounts: AccountJson[], genesisHash?:
|
||||
];
|
||||
}
|
||||
|
||||
function Address ({ address, children, className, genesisHash, name, theme = 'polkadot' }: Props): React.ReactElement<Props> {
|
||||
function Address ({ address, children, className, genesisHash, name }: Props): React.ReactElement<Props> {
|
||||
const accounts = useContext(AccountContext);
|
||||
const [account, setAccount] = useState<AccountJson | null>(null);
|
||||
const [chain, setChain] = useState<Chain | null>(null);
|
||||
@ -69,6 +68,8 @@ function Address ({ address, children, className, genesisHash, name, theme = 'po
|
||||
setAccount(account);
|
||||
}, [address]);
|
||||
|
||||
const theme = ((chain && chain.icon) || 'polkadot') as 'polkadot';
|
||||
|
||||
return (
|
||||
<IconBox
|
||||
banner={chain && chain.genesisHash && chain.name}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user