import * as React from "react";
import styled from "styled-components";
import Icon from "./Icon";
import { AssetData, fromWad } from "../helpers";
import eth from "../assets/eth.svg";
import erc20 from "../assets/erc20.svg";
import { getChainMetadata } from "../chains";
const xdai = getChainMetadata("eip155:100").logo;
const matic = getChainMetadata("eip155:137").logo;
const SAsset = styled.div`
width: 100%;
padding: 20px;
display: flex;
justify-content: space-between;
`;
const SAssetLeft = styled.div`
display: flex;
`;
const SAssetName = styled.div`
display: flex;
margin-left: 10px;
`;
const SAssetRight = styled.div`
display: flex;
`;
const SAssetBalance = styled.div`
display: flex;
`;
function getAssetIcon(asset: AssetData): JSX.Element {
if (!!asset.contractAddress) {
const src = `https://raw.githubusercontent.com/TrustWallet/tokens/master/tokens/${asset.contractAddress.toLowerCase()}.png`;
return ;
}
switch (asset.symbol.toLowerCase()) {
case "eth":
return ;
case "xdai":
return ;
case "matic":
return ;
default:
return ;
}
}
interface AssetProps {
asset: AssetData;
}
const Asset = (props: AssetProps) => {
const { asset } = props;
return (
{getAssetIcon(asset)}
{asset.name}
{`${fromWad(asset.balance || "0")} ${asset.symbol}`}
);
};
export default Asset;