Skip to content

Commit

Permalink
fix: balance display for hardhat network
Browse files Browse the repository at this point in the history
  • Loading branch information
micwallace committed Nov 26, 2024
1 parent c7d544b commit 56f5229
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class DiscoveryAdapter implements ITokenDiscoveryAdapter {
const contract = this.getEthersContractInstance(token.contractAddress, token.chainId, token.tokenType);


let name, symbol, contractUri, description, image;
let name, symbol, contractUri, description, image, decimals = 1;

try {
name = await contract.name();
Expand Down Expand Up @@ -363,11 +363,20 @@ export class DiscoveryAdapter implements ITokenDiscoveryAdapter {
}
}

if (token.tokenType === "erc20"){
try {
decimals = Number((await contract.decimals()).toString());
} catch (e){
console.log(e);
}
}

return <ITokenCollection>{
name: name ?? "Test collection",
symbol: symbol,
description: description ?? "",
image,
decimals
}
}

Expand Down

0 comments on commit 56f5229

Please sign in to comment.