# metasdk-react

> SDK to communicate between React and App using QRCode

Latest version **0.6.1** (published 2019-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install metasdk-react
pnpm add metasdk-react
yarn add metasdk-react
bun add metasdk-react
```

## 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.6.1 |
| Published | 2019-05-21 |
| First published | 2018-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 6 |
| Unpacked size | 6.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | hexoul |
| Maintainers | hexoul |
| Keywords | Ethereum, DApp, React, QRCode |

## Links

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

## Dependencies (6)

- [https](https://npm.io/package/https.md) ^1.0.0
- [node-rsa](https://npm.io/package/node-rsa.md) ^1.0.1
- [qrcode.es](https://npm.io/package/qrcode.es.md) ^1.0.0
- [react-loading](https://npm.io/package/react-loading.md) ^2.0.3
- [ipfs-http-client](https://npm.io/package/ipfs-http-client.md) ^31.1.0
- [semantic-ui-react](https://npm.io/package/semantic-ui-react.md) ^0.84.0

## 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.6.1 (latest) — 2019-05-21
- 0.6.0 — 2019-01-04
- 0.5.4 — 2018-12-14
- 0.5.3 — 2018-12-05
- 0.5.2 — 2018-12-05
- 0.5.1 — 2018-11-23
- 0.5.0 — 2018-11-23
- 0.4.2 — 2018-11-16
- 0.4.1 — 2018-11-01
- 0.4.0 — 2018-11-01
- 0.3.3 — 2018-10-29
- 0.3.2 — 2018-10-29
- 0.3.1 — 2018-09-27
- 0.3.0 — 2018-09-19
- 0.2.4 — 2018-09-18
- … 12 more at https://npm.io/package/metasdk-react/versions

## README

# metasdk-react

[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/hexoul/metasdk-react/master/LICENSE)
[![NPM](https://img.shields.io/npm/v/metasdk-react.svg)](https://www.npmjs.com/package/metasdk-react)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

> SDK to communicate between React and App using QRCode

## Install

```bash
npm i metasdk-react
```

## Components

1. Login
2. Request
2. SendTransaction

## Usage

If `callbackUrl` will be given as prop, a component shows QR code directly, not popup button.

```jsx
import React, { Component } from 'react'
import { Login, Request, SendTransaction } from 'metasdk-react'

class Example extends Component {
  callbackExample(arg) {}
  
  render () {
    return (
      <div>
        <Login
          data='testmsg'
          service='example'
          qrpopup={true}
          callback={this.callbackExample}
        />

        <Request
          request={['10', '20', '30']}
          usage='example'
          qrpopup={true}
          callback={this.callbackExample}
        />

        <SendTransaction
          id='sendTransactionByRequest'
          request={this.trxRequest}
          usage='method'
          qrpopup={true}
          callback={this.callbackExample}
        />

        <SendTransaction
          id='sendTransactionWithCallbackURL'
          request={this.trxRequest}
          usage='method'
          qrpopup={false}
          callbackUrl='http://localhost/callback'
        />

        <SendTransaction
          id='sendTransactionByRaw'
          to='0x8101487270f5411cf213b8d348a2ab46df66245d'
          value='0x01'
          data='0x02'
          qrsize={256}
          qrvoffset={20}
          qrpadding='2em'
          qrposition='bottom right'
          qrtext='SendTransaction'
          qrpopup={true}
          callback={this.callbackExample}
        />
      </div>
    )
  }
}
```

QRCode styles can be set for all components like above example `SendTransaction`
- `qrpopup` decides if QRCode exists within popup or not. default: `false`
- `qrsize` changes the size of QRCode by pixel. default: `128`
- `qrvoffset` is a vertical offset from origin. default: `20`
- `qrpadding` applies padding thickness of QRCode as style. default: `1em`
- `qrposition` decides relative position from origin, declaration for positions are in `util.js`. default: `bottom right`
- `qrtext` sets `Button` text to open QRCode popup

## Test

```
cd metasdk-react
npm start
[Ctrl+C]
cd example
npm start
```

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