UNPKG

2.32 kBMarkdownView Raw
1[![npm](https://img.shields.io/npm/v/@nomiclabs/buidler-truffle5.svg)](https://www.npmjs.com/package/@nomiclabs/buidler-truffle5)
2[![buidler](https://buidler.dev/buidler-plugin-badge.svg?1)](https://buidler.dev)
3
4# buidler-truffle5
5
6[Buidler](http://getbuidler.com) plugin for integration with TruffleContract from Truffle 5. This allows tests and scripts written for Truffle to work with Buidler.
7
8## What
9
10This plugin brings to Buidler TruffleContracts from Truffle 5. With it you can call [`contract()` and `artifacts.require()`](https://truffleframework.com/docs/truffle/testing/writing-tests-in-javascript) like you normally would with Truffle. Interact with your contracts with a familiar API from tasks, scripts and tests.
11
12## Required plugins
13
14This plugin requires [buidler-web3](https://github.com/nomiclabs/buidler/tree/master/packages/buidler-web3) as a prerequisite.
15
16## Installation
17
18```bash
19npm install --save-dev @nomiclabs/buidler-truffle5 @nomiclabs/buidler-web3 web3
20```
21
22And add the following statement to your `buidler.config.js`:
23
24```js
25usePlugin("@nomiclabs/buidler-truffle5");
26```
27
28## Tasks
29
30This plugin creates no additional tasks.
31
32## Environment extensions
33
34An instance of [`TruffleEnvironmentArtifacts`](https://github.com/nomiclabs/buidler/blob/master/packages/buidler-truffle5/src/artifacts.ts) is injected into `env.artifacts` and the method `contract()` is injected into the global scope for using in tests.
35
36## Usage
37
38There are no additional steps you need to take for this plugin to work.
39Install it, run `npx buidler test` and your Truffle tests should run with no need to make any modifications.
40
41Take a look at the [testing guide](https://buidler.dev/guides/testing) for a tutorial using it.
42
43## TypeScript support
44
45This plugin supports TypeScript through a type extensions file `type-extensions.d.ts`. Add it to the `files` field of your `tsconfig.json` file to enable TypeScript support. This plugins depends on the [buidler-web3](https://github.com/nomiclabs/buidler/tree/master/packages/buidler-web3) plugin, so you should add that plugin's type extensions file as well, like this:
46
47```json
48"files": [
49 "./buidler.config.ts",
50 "./node_modules/@nomiclabs/buidler-web3/src/type-extensions.d.ts",
51 "./node_modules/@nomiclabs/buidler-truffle5/src/type-extensions.d.ts"
52 ]
53```