# clean-contract

> Easily get address from wallet and initialize accessor to interact with smart contract.

Latest version **1.1.0** (published 2020-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install clean-contract
pnpm add clean-contract
yarn add clean-contract
bun add clean-contract
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-11-07 |
| First published | 2020-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | sangya2001 |
| Maintainers | pheonix2001 |

## Links

- npm: https://www.npmjs.com/package/clean-contract
- Repository: https://github.com/sangya2001/open-contract
- Homepage: https://github.com/sangya2001/open-contract#readme
- Issues: https://github.com/sangya2001/open-contract/issues
- npm.io page: https://npm.io/package/clean-contract

## Recent versions

- 1.1.0 (latest) — 2020-11-07
- 1.0.3 — 2020-11-07
- 1.0.2 — 2020-11-07
- 1.0.1 — 2020-11-07
- 1.0.0 — 2020-11-07

## README

# clean-contract

> Easily get public address from active wallet and initialize contract method accessor.🚀

[![NPM](https://img.shields.io/npm/v/open-contract.svg)](https://www.npmjs.com/package/open-contract) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save open-contract
```

## Usage

```jsx
import React, { useEffect } from 'react'
//import your contract json
import ContractJSON from './build/contracts/MyContract.json' // path to your contract build

import { CleanContract } from 'clean-contract'

export default function App() {
  const [account, setAccount] = useState('')
  const [contract, setContract] = useState(null)
  const [loading, setLoading] = useState(false)

  // get your api and contract address
  const { apiKey, contractAddress } = process.env

  useEffect(() => {
    (async function fetchData() {
      const result = await CleanContract(apiKey, ContractJSON, contractAddress)
      const { account, contract, contractState } = result

      setAccount(account)
      setContract(contract)
      setLoading(contractState)
    })()
  }, [])
  return (
    {
      !loading ? 
      <div>Happy Hacking!🚀</div>: 
      <h1> Loading... </h1>
    }
  )
}
```

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