Giter Club home page Giter Club logo

buidler-web3-v2's Introduction

npm buidler

buidler-web3

This plugin integrates Web3.js 2.x into Buidler.

What

This plugin brings to Buidler the Web3 module and an initialized instance of Web3.

Installation

npm install --save-dev @xiawpohr/buidler-web3-v2 [email protected]

And add the following statement to your buidler.config.js:

usePlugin("@xiawpohr/buidler-web3-v2");

Tasks

This plugin creates no additional tasks.

Environment extensions

This plugin adds the following elements to the BuidlerRuntimeEnvironment:

  • Web3: The Web3.js module.
  • web3: An instantiated Web3.js object connected to the selected network.

Usage

Install it and access Web3.js through the Buidler Runtime Environment anywhere you need it (tasks, scripts, tests, etc). For example, in your buidler.config.js:

usePlugin("@nomiclabs/buidler-web3");

// task action function receives the Buidler Runtime Environment as second argument
task("accounts", "Prints accounts", async (_, { web3 }) => {
  
  console.log(await web3.eth.getAccounts());
  
});

module.exports = {};

And then run npx buidler accounts to try it.

Read the documentation on the Buidler Runtime Environment to learn how to access the BRE in different ways to use Web3.js from anywhere the BRE is accessible.

TypeScript support

You need to add this to your tsconfig.json's files array: "node_modules/@xiawpohr/buidler-web3-v2/src/type-extensions.d.ts"

buidler-web3-v2's People

Contributors

alcuadrado avatar fzeoli avatar xiawpohr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.