abitype
Strict TypeScript types for Ethereum ABIs
Last updated a year ago by awkweb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install abitype 
SYNC missed versions from official npm registry.

<picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/wevm/abitype/main/.github/logo-dark.svg"> ABIType logo </picture>

Strict TypeScript types for Ethereum ABIs

<picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/abitype?colorA=21262d&colorB=21262d&style=flat"> Version </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/abitype?colorA=21262d&colorB=21262d&style=flat"> Downloads per month </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/abitype?colorA=21262d&colorB=21262d&style=flat"> MIT License </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/endpoint?colorA=21262d&colorB=21262d&style=flat&url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=wevm%2Fabitype%26since=daily"> Best of JS </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/codecov/c/github/wevm/abitype?colorA=21262d&colorB=21262d"> Code coverage </picture>

Strict TypeScript types for Ethereum ABIs. ABIType provides utilities and type definitions for ABI properties and values, covering the Contract ABI Specification, as well as EIP-712 Typed Data.

import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction, ExtractAbiFunctionNames } from 'abitype'
import { erc20Abi } from 'abitype/abis'

type FunctionNames = ExtractAbiFunctionNames<typeof erc20Abi, 'view'>
//   ^? type FunctionNames = "symbol" | "name" | "allowance" | "balanceOf" | "decimals" | "totalSupply"

type TransferInputTypes = AbiParametersToPrimitiveTypes<
  // ^? type TransferInputTypes = readonly [`0x${string}`, bigint]
  ExtractAbiFunction<typeof erc20Abi, 'transfer'>['inputs']
>

Works great for adding blazing fast autocomplete and type checking to functions, variables, or your own types. No need to generate types with third-party tools โ€“ just use your ABI and let TypeScript do the rest!

TL;DR

ABIType might be a good option for your project if:

  • You want to typecheck your ABIs or EIP-712 Typed Data.
  • You want to add type inference and autocomplete to your library based on user-provided ABIs or EIP-712 Typed Data, like Wagmi and Viem.
  • You need to convert ABI types (e.g. 'string') to TypeScript types (e.g. string) or other type transformations.
  • You need to validate ABIs at runtime (e.g. after fetching from external resource).
  • You donโ€™t want to set up a build process to generate types (e.g. TypeChain).

Documentation

For documentation and guides, visit abitype.dev.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discuss ABIType on GitHub

For casual chit-chat with others using the library:

Join the Wevm Discord

Sponsors

If you find ABIType useful or use it for work, please consider supporting development on GitHub Sponsors or sending crypto to wevm.eth. Thank you ๐Ÿ™

Contributing

Contributions to ABIType are greatly appreciated! If you're interested in contributing to ABIType, please read the Contributing Guide before submitting a pull request.

Current Tags

  • 1.0.7                                ...           latest (22 days ago)

181 Versions

  • 1.0.7                                ...           22 days ago
  • 1.0.6                                ...           5 months ago
  • 0.0.0-canary-20240806154016                                ...           5 months ago
  • 1.0.5                                ...           6 months ago
  • 0.0.0-canary-20240628164201                                ...           6 months ago
  • 1.0.4                                ...           6 months ago
  • 0.0.0-canary-20240620192132                                ...           6 months ago
  • 1.0.3                                ...           6 months ago
  • 1.0.2                                ...           9 months ago
  • 0.0.0-canary.20240315T081554                                ...           9 months ago
  • 0.0.0-canary.20240315T080912                                ...           9 months ago
  • 1.0.1                                ...           10 months ago
  • 0.0.0-canary.20240303T001930                                ...           10 months ago
  • 0.0.0-canary.20240302T224936                                ...           10 months ago
  • 0.0.0-canary.20240226T000921                                ...           10 months ago
  • 0.0.0-canary.20240216T151618                                ...           10 months ago
  • 0.0.0-canary.20240212T195416                                ...           10 months ago
  • 0.0.0-canary.20240201T164451                                ...           a year ago
  • 0.0.0-canary.20240130T053324                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.0.0-canary.20240117T191717                                ...           a year ago
  • 0.0.0-canary.20240117T191510                                ...           a year ago
  • 0.0.0-canary.20240117T190425                                ...           a year ago
  • 0.0.0-canary.20231201T171022                                ...           a year ago
  • 0.10.3                                ...           a year ago
  • 0.0.0-canary.20231129T120907                                ...           a year ago
  • 0.0.0-canary.20231102T144356                                ...           a year ago
  • 0.0.0-canary.20231102T144340                                ...           a year ago
  • 0.10.2                                ...           a year ago
  • 0.0.0-canary.20231029T214312                                ...           a year ago
  • 0.0.0-canary.20231029T213911                                ...           a year ago
  • 0.0.0-canary.20231013T212808                                ...           a year ago
  • 0.10.1                                ...           a year ago
  • 0.0.0-canary.20231012T190902                                ...           a year ago
  • 0.0.0-canary.20231012T184154                                ...           a year ago
  • 0.0.0-canary.20231011T214946                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.0.0-canary.20231011T200514                                ...           a year ago
  • 0.0.0-canary.20231011T200302                                ...           a year ago
  • 0.0.0-canary.20231011T200217                                ...           a year ago
  • 0.0.0-canary.20231011T162441                                ...           a year ago
  • 0.0.0-main.20231011T155840                                ...           a year ago
  • 0.9.10                                ...           a year ago
  • 0.10.0-canary.20231009T163000                                ...           a year ago
  • 0.10.0-canary.20231009T162603                                ...           a year ago
  • 0.9.9                                ...           a year ago
  • 0.10.0-canary.20231003T155507                                ...           a year ago
  • 0.10.0-canary.20231003T155159                                ...           a year ago
  • 0.10.0-canary.20230818T155013                                ...           a year ago
  • 0.9.8                                ...           a year ago
  • 0.10.0-canary.20230818T154540                                ...           a year ago
  • 0.10.0-canary.20230817T072055                                ...           a year ago
  • 0.9.7                                ...           a year ago
  • 0.10.0-canary.20230817T071453                                ...           a year ago
  • 0.10.0-canary.20230808T104015                                ...           a year ago
  • 0.9.6                                ...           a year ago
  • 0.10.0-canary.20230728T073407                                ...           a year ago
  • 0.10.0-canary.20230728T070827                                ...           a year ago
  • 0.9.5                                ...           a year ago
  • 0.9.4                                ...           a year ago
  • 0.10.0-canary.20230722T050005                                ...           a year ago
  • 0.10.0-canary.20230721T224834                                ...           a year ago
  • 0.10.0-canary.20230721T224227                                ...           a year ago
  • 0.10.0-canary.20230721T223822                                ...           a year ago
  • 0.10.0-canary.20230718T192634                                ...           a year ago
  • 0.9.3                                ...           a year ago
  • 0.10.0-canary.20230718T192117                                ...           a year ago
  • 0.10.0-canary.20230712T202658                                ...           a year ago
  • 0.9.2                                ...           a year ago
  • 0.10.0-canary.20230712T202156                                ...           a year ago
  • 0.10.0-canary.20230712T161506                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.10.0-canary.20230712T160300                                ...           a year ago
  • 0.10.0-canary.20230710T162259                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.10.0-canary.20230703T192812                                ...           a year ago
  • 0.9.0-canary.20230703T192612                                ...           a year ago
  • 0.9.0-canary.20230703T163137                                ...           a year ago
  • 0.9.0-canary.20230703T162405                                ...           a year ago
  • 0.9.0-canary.20230619T220944                                ...           2 years ago
  • 0.8.11                                ...           2 years ago
  • 0.9.0-canary.20230615T165341                                ...           2 years ago
  • 0.8.10                                ...           2 years ago
  • 0.9.0-canary.20230615T165008                                ...           2 years ago
  • 0.9.0-canary.20230615T155028                                ...           2 years ago
  • 0.8.9                                ...           2 years ago
  • 0.9.0-canary.20230612T181322                                ...           2 years ago
  • 0.9.0-canary.20230612T180914                                ...           2 years ago
  • 0.9.0-canary.20230609T231621                                ...           2 years ago
  • 0.8.8                                ...           2 years ago
  • 0.9.0-canary.20230609T225238                                ...           2 years ago
  • 0.9.0-canary.20230609T224631                                ...           2 years ago
  • 0.8.7                                ...           2 years ago
  • 0.9.0-canary.20230601T130059                                ...           2 years ago
  • 0.9.0-canary.20230601T125211                                ...           2 years ago
  • 0.8.6                                ...           2 years ago
  • 0.9.0-canary.20230530T221348                                ...           2 years ago
  • 0.9.0-canary.20230530T205343                                ...           2 years ago
  • 0.8.5                                ...           2 years ago
  • 0.9.0-canary.20230526T201323                                ...           2 years ago
  • 0.9.0-canary.20230526T200809                                ...           2 years ago
  • 0.9.0-canary.20230523T161103                                ...           2 years ago
  • 0.9.0-canary.20230521T155528                                ...           2 years ago
  • 0.9.0-canary.20230517T202204                                ...           2 years ago
  • 0.8.4                                ...           2 years ago
  • 0.9.0-canary.20230517T201921                                ...           2 years ago
  • 0.9.0-canary.20230516T213152                                ...           2 years ago
  • 0.9.0-canary.20230514T144422                                ...           2 years ago
  • 0.9.0-canary.20230510T225113                                ...           2 years ago
  • 0.8.3                                ...           2 years ago
  • 0.9.0-canary.20230510T214311                                ...           2 years ago
  • 0.9.0-canary.20230510T210609                                ...           2 years ago
  • 0.9.0-canary.20230510T205909                                ...           2 years ago
  • 0.9.0-canary.20230510T190801                                ...           2 years ago
  • 0.9.0-canary.20230507T150549                                ...           2 years ago
  • 0.9.0-canary.20230507T150114                                ...           2 years ago
  • 0.9.0-canary.20230503T123233                                ...           2 years ago
  • 0.9.0-canary.20230430T232743                                ...           2 years ago
  • 0.9.0-canary.20230430T180824                                ...           2 years ago
  • 0.9.0-canary.20230430T172648                                ...           2 years ago
  • 0.9.0-canary.20230430T165133                                ...           2 years ago
  • 0.8.2                                ...           2 years ago
  • 0.0.0-main-20230430000127                                ...           2 years ago
  • 0.0.0-main-20230429235553                                ...           2 years ago
  • 0.8.1                                ...           2 years ago
  • 0.9.0-canary.20230429T221906                                ...           2 years ago
  • 0.8.0                                ...           2 years ago
  • 0.8.0-canary.20230420T183122                                ...           2 years ago
  • 0.8.0-canary.20230414T231212                                ...           2 years ago
  • 0.8.0-canary.20230403T170518                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.8.0-canary.20230310T203353                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.7.0-canary.20230309T211213                                ...           2 years ago
  • 0.7.0-canary.20230309T205532                                ...           2 years ago
  • 0.7.0-canary.20230307T235025                                ...           2 years ago
  • 0.6.8                                ...           2 years ago
  • 0.7.0-canary.20230307T162852                                ...           2 years ago
  • 0.6.7                                ...           2 years ago
  • 0.6.6                                ...           2 years ago
  • 0.6.5                                ...           2 years ago
  • 0.6.4                                ...           2 years ago
  • 0.6.3                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.4                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.16                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (2)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE