You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
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.4
Source
npmnpm
Version published
Weekly downloads
295K
-11.02%
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

ethereum

FAQs

Package last updated on 21 Jan 2020

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