All files / src/contracts/contract index.ts

66.67% Statements 10/15
100% Branches 2/2
25% Functions 1/4
66.67% Lines 10/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 632x                   2x 2x                   2x                                   2x 2x 2x 2x           2x               2x            
const ETHEREUM_FILENAME = [
  "coingecko",
  "marble-nft",
  "gods-unchained",
  "my-crypto-heroes-hero",
  "my-crypto-heroes-extension",
  "marble-nft",
  "coingecko",
  "su-squares"
];
const TOMOCHAIN_FILENAME: string[] = [];
const TOMOCHAIN_TESTNET_FILENAME: string[] = ["coingecko"];
 
interface FileInterface {
  [chainNo: string]: {
    filename: string[];
    name: string;
    id: number;
  };
}
 
export const FILE: FileInterface = {
  ethereum: {
    filename: ETHEREUM_FILENAME,
    name: "ethereum",
    id: 1
  },
  tomochain: {
    filename: TOMOCHAIN_FILENAME,
    name: "tomochain",
    id: 88
  },
  tomochain_testnet: {
    filename: TOMOCHAIN_TESTNET_FILENAME,
    name: "tomochain_testnet",
    id: 89
  }
};
 
export enum SUPPORTED_NETWORK {
  ethereum = 1,
  tomochain = 88,
  tomochain_testnet = 89
}
 
/**
 * @returns {Promise<Array<ContractJson>>}
 */
export const loadAllContract = async (network: string) => {
  const { filename, name } = FILE[network];
  const loadJson = filename.map(nftName =>
    import(`./${name}/${nftName}/contract.json`)
  );
  return Promise.all([...loadJson]);
};
 
export const loadSpecificContract = async (
  network: string,
  nftName: string
) => {
  return import(`./${network}/${nftName}/contract.json`);
};