Catalog npm
Back to packageRELEASE DETAILS

0.5.1

npm

@0xdoublesharp/hardhat-abi-typegen

Hardhat plugin for abi-typegen — auto-generate typed bindings on compile

abicodegenethereumethershardhathardhat-pluginsmart-contractssoliditytypechaintypegentypescriptviemwagmiweb3zod
Published24 Sept 2026
Direct dependencies2
Transitive dependenciesNot calculated

README

Current package documentation

abi-typegen

Fast typed bindings from Solidity ABI artifacts.

Hardhat plugin · auto-generate on compile · ~30x faster than TypeChain

@0xdoublesharp/hardhat-abi-typegen

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.

Install

npm install -D @0xdoublesharp/hardhat-abi-typegen
yarn add -D @0xdoublesharp/hardhat-abi-typegen
pnpm add -D @0xdoublesharp/hardhat-abi-typegen

Setup

Hardhat 3

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

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.

Usage

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

Configuration

OptionTypeDefaultDescription
outstring"src/generated"Output directory for generated files
targetstring | string[]"viem"Target name, comma-separated targets, or array of targets (see below)
wrappersbooleantrueEmit typed wrapper files when supported
contractsstring[][]Limit to named contracts (empty = all)
excludestring[][]Exclude contracts matching glob patterns

Targets

There are 28 CLI targets across 21 languages. Unity uses the csharp target with an adapter package.

JavaScript and TypeScript

TargetFramework or SDKWhat you get
viemviemTyped contract helpers and ABI
wagmiwagmiReact hooks for reads, writes, and events
ethersethers v6Typed contract interfaces and connection helpers
ethers5ethers v5Typed contract interfaces and connection helpers
web3jsweb3.js v4Typed contract methods
zodZod 4Validation schemas and ABI

Native languages

LanguageTargetRuntime or SDKWhat you get
CcShared Rust runtimeC11 codecs and client helpers with explicit ownership
C++cppShared Rust runtimeC++17 codecs and client helpers with automatic cleanup
C#csharpNethereumTyped DTOs, contract methods, and deployment
Dartdartweb3dartTyped values, codecs, calls, and transactions
ElixirelixirEthersTransaction data, reads, sends, events, and errors
F#fsharpNethereumRecords, ABI codecs, and contract helpers
Gogogo-ethereumTyped calls, transactions, deployment, and events
Javajavaweb3jTyped values, codecs, calls, and transactions
Kotlinkotlinweb3jTyped values, codecs, calls, and transactions
OCamlocamlZarith and shared Rust runtimeRecords, ABI codecs, and caller-supplied transport
PHPphpBrick Math, ethereum-tx, cURLCodecs, RPC reads, signed legacy transactions, receipts, and logs
Pythonpythonweb3.pyReads, transaction builders, codecs, events, and errors
qqkdb+ and shared Rust runtimeEvent table schemas, decoders, and log rows
RubyrubyethCalls, transaction builders, codecs, events, and errors
RustrustAlloysol! types, codecs, and contract instances
Swiftswiftweb3swiftTyped values, codecs, and contract operations

Game engines

EngineTargetWhat you get
Unitycsharp + Unity adapterC# bindings with Unity HTTP transport and object lifecycle support
GodotgodotGDScript bindings and a native extension for codecs and asynchronous RPC
Unreal EngineunrealC++ codecs and Blueprint nodes for asynchronous scalar reads

See engine packages for setup and native bindings for supported features and platforms.

Shell and ABI formats

TargetWorks withWhat you get
shellBash and Foundry castSourceable helpers for encoding, reads, sends, deployment, and logs
soliditySolidityInterfaces, tuple structs, events, and errors
yamlYAMLReadable 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.

COBOL

TargetWorks withWhat you get
cobolGnuCOBOL and the shared Rust runtimeReads 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

Notes

  • When using target: "zod", install the latest zod package in the consuming project
  • Use comma-separated multi-target generation instead of the removed all and all-ts aliases

See github.com/doublesharp/abi-typegen for full documentation.

Native contract bindings

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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@0xdoublesharp/abi-typegen
Environment
{
  "local_name": "@0xdoublesharp/abi-typegen",
  "alias": false,
  "peer_metadata": null
}
^0.5.1runtime
hardhat
Environment
{
  "local_name": "hardhat",
  "alias": false,
  "peer_metadata": {
    "optional": true
  }
}
^2.0.0 || ^3.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "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
}

Repository

PENDING
doublesharp/abi-typegen

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 23:06 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:b7733f404999f5b006e4d54b7bb28844d324a98ab4233d95e57e90e87c2d63b2

Other collected versions

0.8.01 Oct0.7.028 Sept0.6.025 Sept0.5.024 Sept0.4.323 Sept0.4.223 SeptView all collected versions →