0.1.24 • Published 3 months ago

@0xweb/hardhat v0.1.24

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

0xweb plugin for Hardhat


npm version CircleCI

The plugin generates 0xWeb classes for compiled solidity contracts, making the blockchain development transparent.

We use 📦 dequanto library for the classes


Documentation 📜

Install

Install automatically the dependencies and configurations

# install 0xweb
$ npm i 0xweb -g

# initialize 0xweb and hardhat project
$ 0xweb init --hardhat

Compile

any/directory/Foo.sol

pragma solidity ^0.8.2;

contract Foo {
    string public name;

    function setName(string memory _name) public {
        name = _name;
    }
}

Plugin adds also ability to specify the sources folder. As per default this is /contracts/**.sol

$ npx hardhat compile --sources ./any/directory/

Use in local development

example.ts

import { Foo } from '0xc/hardhat/Foo/Foo.ts'
import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider'

// automatically deploys the contract to hardhat chain const deployer = new HardhatProvider(); const foo = await deployer.deployClass(Foo, { arguments: 'Hello' });

// write const tx = await foo.setName('Hello world') const receipt = await tx.wait();

// read const text = await foo.name();

# Use already deployed contracts to any chain

If the contract is already deployed, initialize the contract with the Address as normal class. If the contract is deployed to any other chain - set also the client in constructor

> `example.ts`
```ts
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client'


const client =  new EthWeb3Client();
const foo = new Foo('0x12345...', client);

// write
const tx = await foo.setName('Hello world');
const receipt = tx.wait();
// read
const text = await foo.name();

Additional parameters

  • npx hardhat compile --sources /foo/bar/qux - compiles solidity files which are located outside the /contracts folder
  • npx hardhat compile --artifacts /dist - set custom folder for artifacts (ABI JSONs and TS contracts)
  • npx hardhat compile --watch - Compile the sources and waits to recompile on changes
  • npx hardhat compile --tsgen false - Do not generate the TS classes
  • npx hardhat compile --package path/to/package/folder - You can split your project into packages, and with the command compile the contracts in a package, the sources will be searched in that directory, and the artifacts output will be written to that directory

0.1.24

3 months ago

0.1.23

4 months ago

0.1.20

6 months ago

0.1.17

6 months ago

0.1.18

6 months ago

0.1.19

6 months ago

0.1.16

9 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.2

1 year ago

0.1.3

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago