0.6.1 • Published 6 years ago
metasdk-react v0.6.1
metasdk-react
SDK to communicate between React and App using QRCode
Install
npm i metasdk-reactComponents
- Login
- Request
- SendTransaction
Usage
If callbackUrl will be given as prop, a component shows QR code directly, not popup button.
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
- qrpopupdecides if QRCode exists within popup or not. default:- false
- qrsizechanges the size of QRCode by pixel. default:- 128
- qrvoffsetis a vertical offset from origin. default:- 20
- qrpaddingapplies padding thickness of QRCode as style. default:- 1em
- qrpositiondecides relative position from origin, declaration for positions are in- util.js. default:- bottom right
- qrtextsets- Buttontext to open QRCode popup
Test
cd metasdk-react
npm start
[Ctrl+C]
cd example
npm start0.6.1
6 years ago
0.6.0
7 years ago
0.5.4
7 years ago
0.5.3
7 years ago
0.5.2
7 years ago
0.5.1
7 years ago
0.5.0
7 years ago
0.4.2
7 years ago
0.4.1
7 years ago
0.4.0
7 years ago
0.3.3
7 years ago
0.3.2
7 years ago
0.3.1
7 years ago
0.3.0
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago