@coolwallets/transport-web-ble

0.1.0 • Public • Published

CoolWalletS Web-ble Transport

If you're building a WebApp with CoolWalletS, this is the one you need to use as transport in other api.

Install

npm i @coolwallets/transport-web-ble

Usage

The listen() method takes in an callback function to handle bluetooth scanning. In web-ble, this is when the popup show and the user select the device to pair, so the returned device is only one selected device.

import WebBleTransport from '@coolwallets/transport-web-ble'
await WebBleTransport.listen(async (error, device) => { // browser shows popup
  if (device) {
    const transport = await WebBleTransport.connect(device)
    /**
     * Do something with transport
     **/
  } else throw error
})

// use transport in other package:
import CoolWallet from '@coolwallets/wallet'
const wallet = new CoolWallet(transport, appPrivateKey, appId)

Readme

Keywords

none

Package Sidebar

Install

npm i @coolwallets/transport-web-ble

Weekly Downloads

36

Version

0.1.0

License

Apache-2.0

Unpacked Size

8.99 kB

Total Files

6

Last publish

Collaborators

  • coolwallet-team