How to use the typechain.getFileExtension function in typechain

To help you get started, we’ve selected a few typechain 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 ethereum-ts / TypeChain / packages / typechain-target-ethers / lib / index.ts View on Github external
transformFile(file: TFileDesc): TFileDesc[] | void {
    const fileExt = getFileExtension(file.path);

    // For json files with both ABI and bytecode, both the contract typing and factory can be
    // generated at once. For split files (.abi and .bin) we don't know in which order they will
    // be transformed -- so we temporarily store whichever comes first, and generate the factory
    // only when both ABI and bytecode are present.

    // TODO we might want to add a configuration switch to control whether we want to generate the
    // factories, or just contract type declarations.

    if (fileExt === ".bin") {
      return this.transformBinFile(file);
    }
    return this.transformAbiOrFullJsonFile(file);
  }