Giter Site home page Giter Site logo

buidler-ethers-v5's Introduction

npm buidler

buidler-ethers-v5

Buidler plugin for integration with ethers.js version 5.

What

This plugin brings to Buidler the Ethereum library ethers.js, version 5, which allows you to interact with the Ethereum blockchain in a simple way.

it is in based on the existing effort by @nomicalbas : @nomiclabas/buidler-ethers

Installation

npm install --save-dev buidler-ethers-v5 ethers@next

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

usePlugin("buidler-ethers-v5");

Tasks

This plugin creates no additional tasks.

Environment extensions

This plugins adds an ethers object to the Buidler Runtime Environment.

This object has add some extra Buidler-specific functionality. But contrary to @nomiclabas/buidler-ethers it does not add ethers field that can already be accessed via the ethers library itself as import

Provider object

A provider field is added to ethers, which is an ethers.providers.Provider automatically connected to the selected network.

Helpers

These helpers are added to the ethers object:

function getContractFactory(name: string, signer?: ethers.Signer | string): Promise<ethers.ContractFactory>;

function getContractFactory(abi: any[], bytecode: ethers.BytesLike, | string, signer?: ethers.Signer | string): Promise<ethers.ContractFactory>;

function getContractAt(nameOrAbi: string | any[], address: string, signer?: ethers.Signer | string): Promise<ethers.Contract>;

function getSigners() => Promise<ethers.Signer[]>;

function getSigner(address: string) => Promise<ethers.Signer>;

function getContract(deploymentName: string, signer?: ethers.Signer | string): Promise<ethers.Contract>;

The Contracts and ContractFactorys returned by these helpers are connected to the first signer returned by getSigners be default.

Usage

There are no additional steps you need to take for this plugin to work.

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

It also automatically integrate with the buidler-deploy plugin if detected

...
const contract await bre.ethers.getContract('<deploymentName>');
...

TypeScript support

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

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.