Observed since 20 Oct, 23:06 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xdoublesharp/hardhat-abi-typegen
Hardhat plugin for abi-typegen — auto-generate typed bindings on compile
Fast typed bindings from Solidity ABI artifacts.
Hardhat plugin · auto-generate on compile · ~30x faster than TypeChain
Hardhat plugin for abi-typegen. Generates typed bindings from Solidity ABI artifacts on every hardhat compile. Downloads the pre-built abi-typegen binary for your platform automatically.
npm install -D @0xdoublesharp/hardhat-abi-typegen
yarn add -D @0xdoublesharp/hardhat-abi-typegen
pnpm add -D @0xdoublesharp/hardhat-abi-typegen
Add the plugin to plugins in hardhat.config.ts:
import { defineConfig } from "hardhat/config";
import abiTypegen from "@0xdoublesharp/hardhat-abi-typegen";
export default defineConfig({
plugins: [abiTypegen],
solidity: "0.8.34",
typegen: {
out: "src/generated", // output directory (default: "src/generated")
target: "viem", // target name or comma-separated targets
wrappers: true, // emit typed wrappers (default: true)
contracts: ["Token"], // optional - limit to named contracts
exclude: ["*Test", "*Mock"], // optional - exclude by glob pattern
},
});
Hardhat 2 projects can keep the side-effect import:
import "@0xdoublesharp/hardhat-abi-typegen";
const config: HardhatUserConfig = {
solidity: "0.8.34",
typegen: {
out: "src/generated", // output directory (default: "src/generated")
target: "viem", // target name or comma-separated targets
wrappers: true, // emit typed wrappers (default: true)
contracts: ["Token"], // optional - limit to named contracts
exclude: ["*Test", "*Mock"], // optional - exclude by glob pattern
},
};
export default config;
The package uses conditional exports: ESM imports get the Hardhat 3 plugin object, and CommonJS/Hardhat 2 imports get the legacy task-hook plugin. The explicit fallback subpath @0xdoublesharp/hardhat-abi-typegen/hardhat2 is also available for Hardhat 2 projects that want to pin the legacy adapter.
Types are generated automatically after every compile:
npx hardhat compile
# → abi-typegen: generated 5 contract(s) → src/generated
Or generate directly:
npx abi-typegen generate --hardhat --target viem
| Option | Type | Default | Description |
|---|---|---|---|
out | string | "src/generated" | Output directory for generated files |
target | string | string[] | "viem" | Target name, comma-separated targets, or array of targets (see below) |
wrappers | boolean | true | Emit typed wrapper files when supported |
contracts | string[] | [] | Limit to named contracts (empty = all) |
exclude | string[] | [] | Exclude contracts matching glob patterns |
There are 28 CLI targets across 21 languages. Unity uses the csharp target
with an adapter package.
| Target | Framework or SDK | What you get |
|---|---|---|
viem | viem | Typed contract helpers and ABI |
wagmi | wagmi | React hooks for reads, writes, and events |
ethers | ethers v6 | Typed contract interfaces and connection helpers |
ethers5 | ethers v5 | Typed contract interfaces and connection helpers |
web3js | web3.js v4 | Typed contract methods |
zod | Zod 4 | Validation schemas and ABI |
| Language | Target | Runtime or SDK | What you get |
|---|---|---|---|
| C | c | Shared Rust runtime | C11 codecs and client helpers with explicit ownership |
| C++ | cpp | Shared Rust runtime | C++17 codecs and client helpers with automatic cleanup |
| C# | csharp | Nethereum | Typed DTOs, contract methods, and deployment |
| Dart | dart | web3dart | Typed values, codecs, calls, and transactions |
| Elixir | elixir | Ethers | Transaction data, reads, sends, events, and errors |
| F# | fsharp | Nethereum | Records, ABI codecs, and contract helpers |
| Go | go | go-ethereum | Typed calls, transactions, deployment, and events |
| Java | java | web3j | Typed values, codecs, calls, and transactions |
| Kotlin | kotlin | web3j | Typed values, codecs, calls, and transactions |
| OCaml | ocaml | Zarith and shared Rust runtime | Records, ABI codecs, and caller-supplied transport |
| PHP | php | Brick Math, ethereum-tx, cURL | Codecs, RPC reads, signed legacy transactions, receipts, and logs |
| Python | python | web3.py | Reads, transaction builders, codecs, events, and errors |
| q | q | kdb+ and shared Rust runtime | Event table schemas, decoders, and log rows |
| Ruby | ruby | eth | Calls, transaction builders, codecs, events, and errors |
| Rust | rust | Alloy | sol! types, codecs, and contract instances |
| Swift | swift | web3swift | Typed values, codecs, and contract operations |
| Engine | Target | What you get |
|---|---|---|
| Unity | csharp + Unity adapter | C# bindings with Unity HTTP transport and object lifecycle support |
| Godot | godot | GDScript bindings and a native extension for codecs and asynchronous RPC |
| Unreal Engine | unreal | C++ codecs and Blueprint nodes for asynchronous scalar reads |
See engine packages for setup and native bindings for supported features and platforms.
| Target | Works with | What you get |
|---|---|---|
shell | Bash and Foundry cast | Sourceable helpers for encoding, reads, sends, deployment, and logs |
solidity | Solidity | Interfaces, tuple structs, events, and errors |
yaml | YAML | Readable ABI descriptions |
Zod, Solidity, and YAML describe or validate contracts; they do not submit transactions. See native bindings for SDK versions and configuration for target aliases.
| Target | Works with | What you get |
|---|---|---|
cobol | GnuCOBOL and the shared Rust runtime | Reads taking one address and returning one uint256 🤷 |
Target aliases: ethers6 → ethers, web3 → web3js, cs → csharp, kt → kotlin, sol → solidity, yml → yaml, c++ → cpp, fs/f# → fsharp, ml → ocaml, kdb/kdb+ → q
Multi-target examples — each target gets its own output subdirectory:
target: "viem,python,rust"; // comma-separated string
target: ["viem", "python", "rust"]; // array of strings
target: "zod", install the latest zod package in the consuming projectall and all-ts aliasesSee github.com/doublesharp/abi-typegen for full documentation.
Go, Swift, Kotlin, C#, F#, Java, and Dart wrappers use their runtime SDKs for contract
calls and transactions. PHP includes ABI codecs, JSON-RPC reads, legacy transaction
signing, receipt and log queries, and event/error decoding. It requires PHP 8.2+ with
cURL, GMP, mbstring, and iconv. It does not generate EIP-1559 or deployment helpers. C/C++ bindings link abi-typegen-runtime and accept a
caller-supplied transport/signing adapter. OCaml uses Zarith integers and the
shared runtime with application-supplied transport. q/kdb+ generates event schemas,
decoders, and log rows; it does not include an RPC client. OCaml and q also require
compiled bridges linked to the shared runtime. --no-wrappers preserves primary
ABI metadata, value types, and q table schemas. See the native binding guide
for dependencies, ownership rules, supported features, and SDK limits.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@0xdoublesharp/abi-typegenEnvironment{
"local_name": "@0xdoublesharp/abi-typegen",
"alias": false,
"peer_metadata": null
} | ^0.5.1 | runtime |
hardhatEnvironment{
"local_name": "hardhat",
"alias": false,
"peer_metadata": {
"optional": true
}
} | ^2.0.0 || ^3.0.0 | peer |
Source distribution
{
"shasum": "2f2ac830c1ac38a80658b39ad1c6c6903a764c1e",
"tarball": "https://registry.npmjs.org/@0xdoublesharp/hardhat-abi-typegen/-/hardhat-abi-typegen-0.5.1.tgz",
"fileCount": 8,
"integrity": "sha512-3FuMqe8TeKKLZkalTj23Nf2eJx83YqLmlLTqYPqFkxxcFnMaoX7NTXElcRrCBwqnUZvymnYOMf2kj+CpDl7sxg==",
"signatures": [
{
"sig": "MEUCIQCkUsiljk9NGNwTx3TpI7PuLdJZdJijqotTu5p06Zo6CwIgO6JNeKZ6JNy1PhbtY5tMgOmVKwZY/VtbfhkfFCi/A7M=",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
},
{
"sig": "MEUCIQD0Fi6VeyXg2QylDC/fR1b4vPTm+eUBzyzQ0ul/i/OqjAIgFeRNNdjucmKmVsDIMgUk50YXhBcKnTQf1SCtLfYRDAM=",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"attestations": {
"url": "https://registry.npmjs.org/-/npm/v1/attestations/@0xdoublesharp%2fhardhat-abi-typegen@0.5.1",
"provenance": {
"predicateType": "https://slsa.dev/provenance/v1"
}
},
"unpackedSize": 15142
}Observed since 20 Oct, 23:06 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:b7733f404999f5b006e4d54b7bb28844d324a98ab4233d95e57e90e87c2d63b2