This documentation is under construction and documents the 2.x alpha versions of web3.js. The current stable version of web3.js is 1.0 and should get preferred for production use cases.

Contract Module API

The Contract Module API does provide to possibility to create project specific contracts with pre-injecting of the ABI or customizing of the default behaviour of a Web3 contract.


The exported class Contract is here to simply pre-inject a contract ABI.


  1. provider - AbstractSocketProvider | HttpProvider | CustomProvider | String: A Web3.js provider.
  2. abi - Array: Contract ABI
  3. accounts - Accounts
  4. options - Web3ModuleOptions


import {MyABI, options} from '../folder/file.js';
import {Accounts} from 'web3-eth-accounts';
import {Contract} from 'web3-eth-contract';

export class MyContract extends Contract {
    constructor(provider) {
        super(provider, MyAbi, new Accounts(...), '0x0', options);