Generate TypeScript bindings from a smart contract ABI
Produce typed TypeScript bindings from a smart contract ABI through a GitMyABI build.
To generate TypeScript bindings from a smart contract ABI, create a GitMyABI project for a Hardhat or Foundry repository and run a build. A successful build extracts the ABI and publishes a typed npm package alongside the ABI JSON on the CDN, so the typed bindings can be installed and used directly from an application. This guide describes the per-build steps; the shape of the resulting package is documented separately.
Before you start
- A GitHub repository containing your contract source.
- The repository builds locally with Hardhat or Foundry.
- You have access to create a project in GitMyABI.
Steps
- Connect GitHub and create a project for the repository that holds the contract source.
- Choose the framework:
hardhatorfoundry. The Build and Output Settings are pre-filled with framework-specific defaults; adjust them only if your repository deviates. - (Optional) Configure NPM Package Visibility. By default, project visibility tracks the repository's visibility. See publish generated contract bindings to npm.
- Configure a build for the branch, tag, release, or commit that should produce the bindings, and trigger it.
- On a successful build, the build detail page shows the package name, version, install command, and the CDN URL for each contract's ABI.
Default build settings per framework
GitMyABI pre-fills the following defaults in the Build and Output Settings, sourced from each framework's standard layout:
| Field | Hardhat | Foundry |
|---|---|---|
| Artifacts Path | artifacts | out |
| Install Command | npm install | forge install |
| Build Command | npx hardhat compile | forge build |
| Test Command | npm test | forge test |
Result
The published package exposes one named class export per compiled contract, each with a viem-style constructor. See generated contract bindings for the runtime shape and review the package format for the exact artifact layout.
FAQ
How do I generate TypeScript bindings from a smart contract ABI?
Create a GitMyABI project from a GitHub repository, choose Hardhat or Foundry, and run a build for a branch, tag, release, or commit. A successful build extracts the ABIs and publishes the generated TypeScript bindings.
Which frameworks are supported?
GitMyABI supports Hardhat and Foundry. The selected framework controls the default artifacts path and the install, build, and test commands.
Where do I find the published package and ABI URL?
After a successful build, the build detail page shows the ABI CDN URL and the generated package information, including package name, version, install command, and registry configuration where relevant.
Related
- Generated contract bindings
TypeScript packages produced from contract ABIs for typed integration.
- Use generated bindings in a frontend
Consume a published bindings package from a frontend application.
- Publish generated bindings to npm
Configure a project so each build publishes a typed bindings package to npm.
- Package format
Shape of the published bindings package and the CDN-hosted ABI artifacts.