# hardhat-craftform

> Hardhat plugin for continuous integration in TypeScript

Latest version **0.10.5** (published 2022-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install hardhat-craftform
pnpm add hardhat-craftform
yarn add hardhat-craftform
bun add hardhat-craftform
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.5 |
| Published | 2022-08-24 |
| First published | 2022-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 76.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | danny |
| Maintainers | swimmie |
| Keywords | ethereum, smart-contracts, hardhat, hardhat-plugin, hardhat-craftform |

## Links

- npm: https://www.npmjs.com/package/hardhat-craftform
- Repository: https://github.com/dannylisa/hardhat-craftform
- Homepage: https://github.com/dannylisa/hardhat-craftform#readme
- Issues: https://github.com/dannylisa/hardhat-craftform/issues
- npm.io page: https://npm.io/package/hardhat-craftform

## Dependencies (11)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [hardhat](https://npm.io/package/hardhat.md) ^2.9.9
- [enquirer](https://npm.io/package/enquirer.md) ^2.3.6
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.1.0
- [ts-morph](https://npm.io/package/ts-morph.md) ^15.1.0
- [typechain](https://npm.io/package/typechain.md) ^8.1.0
- [hardhat-deploy](https://npm.io/package/hardhat-deploy.md) ^0.11.11
- [hardhat-ethers](https://npm.io/package/hardhat-ethers.md) ^1.0.1
- [console-log-interceptor](https://npm.io/package/console-log-interceptor.md) ^1.2.0
- [@nomicfoundation/hardhat-toolbox](https://npm.io/package/@nomicfoundation/hardhat-toolbox.md) ^1.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.10.5 (latest) — 2022-08-24
- 0.10.4 — 2022-08-24
- 0.10.3 — 2022-08-24
- 0.10.2 — 2022-08-19
- 0.10.1 — 2022-08-19
- 0.10.0 — 2022-08-19
- 0.9.12 — 2022-08-18
- 0.9.11 — 2022-08-18
- 0.9.10 — 2022-08-18
- 0.9.9 — 2022-08-05
- 0.9.8 — 2022-08-05
- 0.9.7 — 2022-08-05
- 0.9.6 — 2022-08-05
- 0.9.5 — 2022-08-05
- 0.9.4 — 2022-08-04
- … 125 more at https://npm.io/package/hardhat-craftform/versions

## README

# Hardhat-Craftform

For consistent smart constract deploy environment

## Installation
```bash
npm install hardhat-craftform
```

## Quick Start
1. You should add some compilerOptions in tsconfig.json  
tsconfig.json
```json
"compilerOptions": {
    "experimentalDecorators": true,
    "strictPropertyInitialization": false
}
```
2. import hardhat-craftform at `hardhat.config.ts`
```typescript
import "hardhat-craftform"
```
3. then, import `craft` directory at the top of your scripts. (not in `hardhat.config.ts`)
```typescript
import "../crafts"
```
4. if you compile your solidity files, Contract Crafts will be auto-generated.
```
npx hardhat compile
```
 4-1. Or you can manually generate crafts with:
```
npx hardhat craftform
```

## Deploy Contract
```typescript
import { craftform, ethers } from "hardhat"
import "../crafts"  // Here: you should import "crafts" directory

async function deployMyContract(){
    const [ owner ] = await ethers.getSigners();
    const myCraft = await craftform
        .contract("MyContract")
        .deploy(
            "MyContractAlias",   // if set null, alias will be set as contract name.(in this case, "MyContract")
            // deploy options, typescript fully supported.
            {
                from: owner.address,
                args: ["Hello, World!", 41]
            },
            
            // your custom config for contract
            // you should set config props at {root}/crafts/contract/../your-contract.config.ts
            {
                message: "Hello, World!",
                magicNumber: 41
            }
        )
}
```

## Reuse deployed contract with saved configs
```typescript
import { craftform, ethers } from "hardhat"
import "../crafts"  // Here: you should import "crafts" directory

async function deployMyContract(){
    const [ owner ] = await ethers.getSigners();
    const myCraft = await craftform..contract("MyContract").attach("MyContractAlias");
    console.log(myCraft.$config.message)        // Hello, World!
    console.log(myCraft.$config.magicNumber)    // 41
}
```


There are 3 ways to attach deployed contracts.
```typescript
// default attach : alias will be set as contract name
const myCraft1 = await craftform.contract("MyContract").attach();

// aliased attach
const myCraft2 = await craftform.contract("MyContract").attach("MyContractAlias");

// address attach
const myCraft3 = await craftform.contract("MyContract").attach("0x0123456789abcdef...");
```

---
_Source: https://npm.io/package/hardhat-craftform · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
