Skip to content

Instantly share code, notes, and snippets.

@pizzarob
Created June 6, 2019 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pizzarob/15c686e88014ad0f767a1b6f540ebbbd to your computer and use it in GitHub Desktop.
Save pizzarob/15c686e88014ad0f767a1b6f540ebbbd to your computer and use it in GitHub Desktop.
function displayContractContent(contracts, resaleItems) {
let template = '';
contracts.forEach(contract => {
const { name, symbol, tokenAddress, tokenContractId } = contract;
const currentResaleItems = resaleItems[tokenContractId];
let tokenMarkup = '';
currentResaleItems.forEach(token => {
const { metadata, price } = token;
tokenMarkup += `
<div class="tile">
<img src=${metadata.image} />
<h3 class="bold">${metadata.name}</h3>
<h3 class="color-primary">${cargo.web3.fromWei(
price,
'ether'
)} ETH</h3>
</div>
`;
});
template += `
<div class="contract-header">
<h2>${name} ${symbol}</h2>
<h3>${tokenAddress}</h3>
</div>
${tokenMarkup}
`;
});
document.querySelector('[data-id="token-rows"]').innerHTML = template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment