All icon theme per chain (#155)
This commit is contained in:
parent
caa9245ce3
commit
d51182e884
@ -1,6 +1,10 @@
|
|||||||
# 0.11.0-beta.x
|
# 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)
|
- Updated to babe 7.6 (build and runtime improvememnts)
|
||||||
|
|
||||||
# 0.10.1
|
# 0.10.1
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
export default {
|
export default {
|
||||||
chain: 'Alexander',
|
chain: 'Alexander',
|
||||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||||
|
icon: 'polkadot',
|
||||||
specVersion: 112,
|
specVersion: 112,
|
||||||
ss58Format: 42,
|
ss58Format: 42,
|
||||||
tokenDecimals: 15,
|
tokenDecimals: 15,
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import { VotingTypes } from 'edgeware-node-types/dist/voting';
|
|||||||
export default {
|
export default {
|
||||||
chain: 'Edgeware',
|
chain: 'Edgeware',
|
||||||
genesisHash: '0xda60008770287b5eb4f9b5241317ac4c7e42c3c3d8e85fbbfa2a88705394d75e',
|
genesisHash: '0xda60008770287b5eb4f9b5241317ac4c7e42c3c3d8e85fbbfa2a88705394d75e',
|
||||||
|
icon: 'substrate',
|
||||||
specVersion: 20,
|
specVersion: 20,
|
||||||
ss58Format: 42,
|
ss58Format: 42,
|
||||||
tokenDecimals: 18,
|
tokenDecimals: 18,
|
||||||
|
|||||||
@ -13,10 +13,11 @@ import kusamaCC1 from './kusama-cc1';
|
|||||||
|
|
||||||
const chains: Map<string, Chain> = new Map(
|
const chains: Map<string, Chain> = new Map(
|
||||||
[alexander, edgeware, kusamaCC1].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,
|
||||||
{
|
{
|
||||||
genesisHash,
|
genesisHash,
|
||||||
|
icon,
|
||||||
meta: metaCalls
|
meta: metaCalls
|
||||||
? new Metadata(Buffer.from(metaCalls, 'base64'))
|
? new Metadata(Buffer.from(metaCalls, 'base64'))
|
||||||
: undefined,
|
: undefined,
|
||||||
@ -32,6 +33,7 @@ const chains: Map<string, Chain> = new Map(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const UNKNOWN_CHAIN: Chain = {
|
const UNKNOWN_CHAIN: Chain = {
|
||||||
|
icon: 'polkadot',
|
||||||
isUnknown: true,
|
isUnknown: true,
|
||||||
name: 'Unknown chain',
|
name: 'Unknown chain',
|
||||||
specVersion: 0,
|
specVersion: 0,
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
export default {
|
export default {
|
||||||
chain: 'Kusama CC1',
|
chain: 'Kusama CC1',
|
||||||
genesisHash: '0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf',
|
genesisHash: '0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf',
|
||||||
|
icon: 'polkadot',
|
||||||
specVersion: 1001,
|
specVersion: 1001,
|
||||||
ss58Format: 2,
|
ss58Format: 2,
|
||||||
tokenDecimals: 12,
|
tokenDecimals: 12,
|
||||||
|
|||||||
@ -5,8 +5,9 @@
|
|||||||
import { Metadata } from '@polkadot/types';
|
import { Metadata } from '@polkadot/types';
|
||||||
|
|
||||||
export interface Chain {
|
export interface Chain {
|
||||||
isUnknown?: boolean;
|
|
||||||
genesisHash?: string;
|
genesisHash?: string;
|
||||||
|
icon: string;
|
||||||
|
isUnknown?: boolean;
|
||||||
meta?: Metadata;
|
meta?: Metadata;
|
||||||
name: string;
|
name: string;
|
||||||
specVersion: number;
|
specVersion: number;
|
||||||
|
|||||||
@ -22,7 +22,6 @@ interface Props {
|
|||||||
className?: string;
|
className?: string;
|
||||||
name?: React.ReactNode | null;
|
name?: React.ReactNode | null;
|
||||||
genesisHash?: string | null;
|
genesisHash?: string | null;
|
||||||
theme?: 'polkadot' | 'substrate';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find an account in our list
|
// 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 accounts = useContext(AccountContext);
|
||||||
const [account, setAccount] = useState<AccountJson | null>(null);
|
const [account, setAccount] = useState<AccountJson | null>(null);
|
||||||
const [chain, setChain] = useState<Chain | null>(null);
|
const [chain, setChain] = useState<Chain | null>(null);
|
||||||
@ -69,6 +68,8 @@ function Address ({ address, children, className, genesisHash, name, theme = 'po
|
|||||||
setAccount(account);
|
setAccount(account);
|
||||||
}, [address]);
|
}, [address]);
|
||||||
|
|
||||||
|
const theme = ((chain && chain.icon) || 'polkadot') as 'polkadot';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconBox
|
<IconBox
|
||||||
banner={chain && chain.genesisHash && chain.name}
|
banner={chain && chain.genesisHash && chain.name}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user