Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typechain

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typechain

🔌 TypeScript bindings for Ethereum smartcontracts

  • 1.0.0-beta.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
68K
decreased by-66.96%
Maintainers
1
Weekly downloads
 
Created

What is typechain?

TypeChain is a tool for generating TypeScript typings for Ethereum smart contracts. It helps developers interact with smart contracts in a type-safe manner, reducing runtime errors and improving the development experience.

What are typechain's main functionalities?

Generating TypeScript typings for smart contracts

This command generates TypeScript typings for smart contracts using the Ethers.js target. The generated typings are placed in the 'src/types' directory, and the input JSON files are located in the 'artifacts' directory.

npx typechain --target ethers-v5 --out-dir src/types './artifacts/**/*.json'

Using generated typings in a TypeScript project

This code demonstrates how to use the generated TypeScript typings in a TypeScript project. It imports the typings for a contract named 'MyContract', interacts with the contract using Ethers.js, and logs the result of calling a method on the contract.

import { MyContract } from './types/MyContract';

async function main() {
  const myContract: MyContract = await ethers.getContractAt('MyContract', '0x123...');
  const value = await myContract.myMethod();
  console.log(value);
}

Other packages similar to typechain

Keywords

FAQs

Package last updated on 28 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc