npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jamo/web3-eth-contract

v4.0.0-alpha.3389

Published

Web3 module to interact with Ethereum smart contracts.

Downloads

3

Readme

web3.js - Eth Contract Package

ES Version Node Version NPM Package Dependency Status Dev Dependency Status

This is a sub-package of web3.js.

web3-eth-contract contains the contract package used in web3-eth.

Get it from the NPM Registry
yarn add web3-eth-contract

Getting Started

Prerequisites

Usage

You can initialize the typesafe Contract API instance with the following.

import { Contract } from 'web3-eth-contract';

const abi = [...] as const;

const contract = new Contract(abi);
  • We prefer that you use web3.eth.Contract API in normal usage.
  • The use of as const is necessary to have fully type-safe interface for the contract.
  • As the ABIs are not extensive in size, we suggest declaring them as const in your TS project.
  • This approach is more flexible and seamless compared to other approaches of off-line compiling ABIs to TS interfaces (such as TypeChain.

Compatibility

We have tested the Typescript interface support for the ABIs compiled with solidity version v0.4.x and above. If you face any issue regarding the contract typing, please create an issue to report to us.

The Typescript support for fixed length array types are supported up 30 elements. See more details here. This limitation is only to provide more performant developer experience in IDEs. In future we may come up with a workaround to avoid this limitation. If you have any idea feel free to share.

Package.json Scripts

| Script | Description | | ---------------- | -------------------------------------------------- | | clean | Uses rimraf to remove dist/ | | build | Uses tsc to build package and dependent packages | | lint | Uses eslint to lint package | | lint:fix | Uses eslint to check and fix any warnings | | format | Uses prettier to format the code | | test | Uses jest to run unit tests | | test:integration | Uses jest to run tests under /test/integration | | test:unit | Uses jest to run tests under /test/unit |