How to use the @ethersproject/strings.parseBytes32String function in @ethersproject/strings

To help you get started, we’ve selected a few @ethersproject/strings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mrtenz / FindETH / src / utils / tokens.ts View on Github external
const getMetaData = async (contract: Contract): Promise<{ name: string; symbol: string }> => {
  try {
    return {
      name: await contract.name(),
      symbol: await contract.symbol()
    };
  } catch {
    const alternativeContract = new Contract(
      contract.address,
      ALT_TOKEN_METADATA_ABI,
      contract.provider
    );

    return {
      name: parseBytes32String(await alternativeContract.name()),
      symbol: parseBytes32String(await alternativeContract.symbol())
    };
  }
};
github Mrtenz / FindETH / src / utils / tokens.ts View on Github external
const getMetaData = async (contract: Contract): Promise<{ name: string; symbol: string }> => {
  try {
    return {
      name: await contract.name(),
      symbol: await contract.symbol()
    };
  } catch {
    const alternativeContract = new Contract(
      contract.address,
      ALT_TOKEN_METADATA_ABI,
      contract.provider
    );

    return {
      name: parseBytes32String(await alternativeContract.name()),
      symbol: parseBytes32String(await alternativeContract.symbol())
    };
  }
};