Socket
Socket
Sign inDemoInstall

typechain

Package Overview
Dependencies
Maintainers
2
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


Version published
Weekly downloads
203K
increased by1.31%
Maintainers
2
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 24 May 2023

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