Hardhat plugin
Generate and publish bindings as a Hardhat task.
CLI
@gitmyabi/hardhat is a local plugin that exposes gma generate and gma publish as Hardhat tasks. It runs entirely on your machine and does not call the GitMyABI API or use ~/.gma/config.json.
Install
npm i -D @gitmyabi/hardhatSet up
// hardhat.config.ts
import '@gitmyabi/hardhat';
import type { HardhatUserConfig } from 'hardhat/config';
const config: HardhatUserConfig = {
solidity: '0.8.24',
gma: {
packageName: '@my-org/my-bindings',
packageVersion: '0.1.0',
output: './gma-out',
target: 'viem'
}
};
export default config;Tasks
hardhat gma-generate
--out <dir>— override the output directory.--package-name <name>,--package-version <version>— override package metadata.--include-empty-abis— include contracts whose ABI is empty.
hardhat gma-publish
--tar <path>— tarball path.--registry <url>,--token <token>,--access <public|restricted>,--tag <tag>,--dry-run— same semantics asgma publish.
Configuration (gma key)
Fields recognised under the gma key in HardhatUserConfig:
packageName,packageVersion,projectName,output,target,includeEmptyAbis.tar,registry,access,tag,tokenEnvfor publish.
Limitations
The Hardhat plugin only covers local generate and publish. It does not include the API-backed commands (gma login, gma shell, gma project, gma build, gma team, gma repo, gma session); use the gma CLI for those.
Related
- CLI overview
What the gma CLI does and when to use it.
- Generate bindings with the CLI
Use gma generate to produce a typed bindings tarball.
- Publish bindings with the CLI
Use gma publish to upload a bindings tarball to npm.
- Generated contract bindings
TypeScript packages produced from contract ABIs for typed integration.