Generated contract bindings
Typed TypeScript packages produced from smart contract ABIs.
Generated contract bindings are TypeScript packages that GitMyABI produces from your smart contract ABI as part of a successful build. Each package wraps each compiled contract's ABI in a typed class so callers do not handle the raw ABI manually and get full type checking and IDE autocomplete on contract methods.
What the package contains
- One named class export per compiled contract (for example,
YourContract). - A viem-style constructor:
new YourContract(address, { publicClient, walletClient }). - Typed instance methods for both read and write functions; the same call shape is used for views and transactions.
- TypeScript declarations bundled with the package.
Versioning
The published version comes from the project's package.json if one is set on the build, otherwise it falls back to 0.0.<buildNumber>. The exact published name and version are shown on the build detail page.
Install
Use the package name and version shown on the build detail page. Examples (replace <package-name> and <version>):
npm install <package-name>@<version>
# or
yarn add <package-name>@<version>
# or
pnpm add <package-name>@<version>Use in code
The bindings are designed to plug into viem's public and wallet clients:
import { createPublicClient, createWalletClient, http } from 'viem';
import { mainnet } from 'viem/chains';
import { YourContract } from '<package-name>';
const publicClient = createPublicClient({ chain: mainnet, transport: http() });
const walletClient = createWalletClient({ chain: mainnet, transport: http() });
// Create contract instance
const contract = new YourContract('0x...', { publicClient, walletClient });
// Read functions — call directly
const result = await contract.yourMethod(param1, param2);
// Write functions — also call directly
const hash = await contract.transfer('0x...', 1000n);Where it's published
The package is published to an npm registry on every successful build. The package visibility tracks the source repository's visibility: public repositories produce publicly installable packages, and private repositories produce packages that require the registry configuration shown in the package installation instructions on the build detail page.
See review the package format for the exact artifact shape, and use generated contract bindings in a frontend for end-to-end consumption examples.
FAQ
What are generated contract bindings?
Generated contract bindings are typed TypeScript packages that GitMyABI produces from smart contract ABIs. Each compiled contract is exported as a typed class so applications can call its methods with full TypeScript support.
What is the difference between an ABI JSON file and generated TypeScript bindings?
The ABI JSON file describes the contract's callable surface. The generated TypeScript bindings wrap that ABI in a typed class, so callers get type checking, method names, and IDE autocomplete instead of working against the raw JSON.
How is the package version chosen?
The package version is shown on the build detail page. If the build has a version configured in package.json, that version is used; otherwise GitMyABI falls back to 0.0.<buildNumber>.
Related
- ABI and bindings publishing
How GitMyABI delivers ABIs via CDN and bindings via npm.
- Use generated bindings in a frontend
Consume a published bindings package from a frontend application.
- Generate TypeScript bindings from an ABI
Produce typed bindings from a smart contract ABI through a GitMyABI build.
- Package format
Shape of the published bindings package and the CDN-hosted ABI artifacts.