Skip to content

x5engine/wyre-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


wyre-widget


Wyre Widget

New Version using Hooks and no side effects.

React component for the Wyre widget.

License Build Status dependencies Status NPM version

Demo first?

Live Demo

Install

npm i -S wyre-widget

Getting started

import React from 'react'
import Wyre from 'wyre-widget'

class App extends React.Component {
  constructor (props) {
    super(props)

    this.state = {
      open: false
    }
  }

  render () {
    return (
      <Wyre
        config={{
          env: 'test',
          accountId: 'AC-BAAA2222',
          auth: {
            type: 'secretKey',
            secretKey: '6a6f7f9187f766f66938638f1afd79b20fb5989e2837e6f989'
          },
          operation: {
            type: 'debitcard',
            destCurrency: 'ETH',
            destAmount: 0.01,
            dest: '0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1'
          },
          style: {
            primaryColor: '#0055ff'
          }
        }}
        onReady={() => console.log('ready')}
        onClose={event => console.log('close', event)}
        onComplete={event => console.log('complete', event)}
        open={this.state.open}>

        <button onClick={() => this.setState({ open: true })}>
          Buy ETH
        </button>

      </Wyre>
    )
  }
}


export default App

Please read the Wyre documentation for the configuration options.

Development

npm install
npm run build
npm run lint

License

MIT