TypeChain icon indicating copy to clipboard operation
TypeChain copied to clipboard

feat: add support for custom extractAbi from target

Open luizstacio opened this issue 2 years ago • 1 comments

Problem

Currently on fuels-ts a TS SDK for Fuel. We enable users to generate contract types using our typechain-target-fuels. Recently we have implemented a flat ABI.json model, that is not a valid Ether ABI.

But when running runTypeChain by CI or API, the implementation on typechain executes an extractAbi method to filter empty ABI files (see file line in typechain). The current way it's implementated is impossible for the Target, to implement a custom extractAbi.

Solution

The proposed solution for this use case is to enable the TypeChainTarget to also export extractAbi function wich will replace the extractAbi, on the skipEmptyAbis.

export const extractAbi = (rawJson: string) => myCustomExtractAbi(rawJson);

export default class MyCustomTarget extends TypeChainTarget {
  .....
}

luizstacio avatar Aug 26 '22 03:08 luizstacio

⚠️ No Changeset found

Latest commit: 0a2a9d5d7e288194f41bbe247f3915c6ffa68e8b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Aug 26 '22 03:08 changeset-bot[bot]