Generate TypeScript bindings from a smart contract ABI

Produce typed TypeScript bindings from a smart contract ABI through a GitMyABI build.

Guides

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

  1. Connect GitHub and create a project for the repository that holds the contract source.
  2. Choose the framework: hardhat or foundry. The Build and Output Settings are pre-filled with framework-specific defaults; adjust them only if your repository deviates.
  3. (Optional) Configure NPM Package Visibility. By default, project visibility tracks the repository's visibility. See publish generated contract bindings to npm.
  4. Configure a build for the branch, tag, release, or commit that should produce the bindings, and trigger it.
  5. 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:

FieldHardhatFoundry
Artifacts Pathartifactsout
Install Commandnpm installforge install
Build Commandnpx hardhat compileforge build
Test Commandnpm testforge 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