fix: manually adds basic solana chain metadata until available via API

This commit is contained in:
Ben Kremer 2022-03-11 15:17:04 +01:00
parent 4932223b76
commit 2568b0d3bb
2 changed files with 18 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -97,6 +97,7 @@ interface BlockchainDisplayData {
meta: ChainMetadata; meta: ChainMetadata;
} }
// eslint-disable-next-line
function getBlockchainDisplayData( function getBlockchainDisplayData(
chainId: string, chainId: string,
chainData: ChainNamespaces, chainData: ChainNamespaces,
@ -113,18 +114,28 @@ function getBlockchainDisplayData(
return { data, meta }; return { data, meta };
} }
// TODO: add `solana` namespace + chains to https://github.com/pedrouid/blockchain-api
// Specifying solana chain metadata manually here for now.
const Blockchain: FC<PropsWithChildren<BlockchainProps>> = ( const Blockchain: FC<PropsWithChildren<BlockchainProps>> = (
props: PropsWithChildren<BlockchainProps>, props: PropsWithChildren<BlockchainProps>,
) => { ) => {
const { chainData, fetching, chainId, address, onClick, balances, active, actions } = props; const { fetching, chainId, address, onClick, balances, active, actions } = props;
if (!Object.keys(chainData).length) return null; // if (!Object.keys(chainData).length) return null;
const chain = getBlockchainDisplayData(chainId, chainData); // const chain = getBlockchainDisplayData(chainId, chainData);
if (typeof chain === "undefined") { // if (typeof chain === "undefined") {
return null; // return null;
} // }
const name = chain.meta.name || chain.data.name;
const chain = {
meta: {
name: "Solana",
rgb: "0, 0, 0",
logo: "/solana_logo.png",
},
};
const name = chain.meta.name; /*|| chain.data.name;*/
return ( return (
<React.Fragment> <React.Fragment>