# @arteq-io/react-common

> Arteq common react biased tools and helpers

Latest version **0.10.14** (published 2022-04-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @arteq-io/react-common
pnpm add @arteq-io/react-common
yarn add @arteq-io/react-common
bun add @arteq-io/react-common
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.14 |
| Published | 2022-04-29 |
| First published | 2022-04-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >14 |
| Dependencies | 4 |
| Unpacked size | 460 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | kamcpp |

## Links

- npm: https://www.npmjs.com/package/@arteq-io/react-common
- Repository: https://github.com/arteq-io/npm-react-common
- Homepage: https://github.com/arteq-io/npm-react-common#readme
- Issues: https://github.com/arteq-io/npm-react-common/issues
- npm.io page: https://npm.io/package/@arteq-io/react-common

## Dependencies (4)

- [ethers](https://npm.io/package/ethers.md) ^5.6.1
- [@web3-react/core](https://npm.io/package/@web3-react/core.md) ^6.1.9
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.4.1
- [@web3-react/walletconnect-connector](https://npm.io/package/@web3-react/walletconnect-connector.md) ^6.2.13

## Recent versions

- 0.10.14 (latest) — 2022-04-29
- 0.10.13 — 2022-04-29
- 0.10.12 — 2022-04-29
- 0.10.11 — 2022-04-29
- 0.10.10 — 2022-04-29
- 0.10.9 — 2022-04-29
- 0.10.8 — 2022-04-29
- 0.10.7 — 2022-04-29
- 0.10.6 — 2022-04-29
- 0.10.5 — 2022-04-29
- 0.10.4 — 2022-04-29
- 0.10.3 — 2022-04-28
- 0.10.2 — 2022-04-28
- 0.10.1 — 2022-04-28
- 0.10.0 — 2022-04-28
- … 21 more at https://npm.io/package/@arteq-io/react-common/versions

## README

# npm-react-common
A repo to hold all reusable common react components


# Connecting wallet and authenticating


**important**

always set these:
```
window.chain = "ETHEREUM";
window.network = "RINKEBY";
window.SKEPTICS_BASE_URL="https://skeptic-dev.arteq.auction/skeptic/v1";
ReactDOM.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
    document.getElementById('root')
);

```
** if you want to disable reCaptcha (local testing) **
add also this global variable:
```
window.DISABLE_RECAPTCHA
```

or add recaptcha lib in your index.html
and set sitekey like so:
```
window.rcSiteKey = "6LfJSDceAAAAAPLNlczwZMQbOXbATkOZiW0u0GA3";
```

* To customize sign message, please set SIGN_MESSAGE environment variable before building your repo


** to set sign message, set this global variable: **
```
window.MESSAGE_TO_SIGN = "Welcome to skeptics! signing this message means you agree with our terms of use (https://example.org/temrs-of-use), please sign this message in order to log in"
```


```
import { useWallet } from "@arteq-io/react-common";

window.chain = "ETHEREUM";
window.network = "RINKEBY";
window.servicesURL = "[https://skeptics-base-url]";


const WalletConnect = () => {

  const {
    logout,
    account,
    initMetamask,
    isWalletConnected,
    initWalletConnect,
  } = useWallet();

  return (
    <main>
      {isWalletConnected 
        ?  (
          <>
            <h1>Login with wallet</h1>
            <ul>
              <li onClick={initMetamask}>with Metamask</li>
              <li onClick={initWalletConnect}>with WalletConnect</li>
            </ul>
          </>
        ) : (
          <>
            <h2>Wallet Address: {account}</h2>
            <button onClick={logout}>Logout</button>
          </>
        )
      }
    </main>
  );
}

const App = () => (
  <WalletProvider>
    <WalletConnect />
  </WaletProvider>
);

```


## possible issues:

* you're not using React@17
this package is created based on react 17 and haven't been tested on react 18 which was just released
if you've installed react with create-react-app, you can downgrade react to 17 like so:

- edit `package.json` and change react from 18 (or any other versions) to 17 in dependecies section
- `rm -rf ./node_modules`
- do a `yarn` or `npm install` again
- change index.jsx to use previous react-dom import and syntax


* you're using react-scripts>4.0
this version has some issues with source map (because of webpack 5)

it should be fine as long as you disable source-map in .env file:
- add a line to .env file: `GENERATE_SOURCEMAP=false`


## TODO:

add these functions:

- login [DONE]
- logout [DONE]
- profile
- updateProfile
- sendEmailOTP
- verifyEmailOTP
- balances (nft, ethereum, erc20 token)

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