@oasisprotocol/ionic-ledger-hw-transport-ble
TypeScript icon, indicating that this package has built-in type declarations

1.0.1-beta • Public • Published

ionic-ledger-hw-transport-ble

License CI test status

Ledger Hardware Wallet Bluetooth BLE transport for Ionic.

yarn add @oasisprotocol/ionic-ledger-hw-transport-ble

Pre-requisite

Minimal getting started

@oasisprotocol/ionic-ledger-hw-transport-ble works like any of @ledgerhq/hw-transport libraries.

The difference here is that the list() is costy and you likely don't want to always scan for devices, you would better save a selected device as "known" to suggest it to user later.

Important: you will also have to deal with specifics of Bluetooth BLE, for instance, you need to request the LOCATION permission on Android!

Here is a gist of the most important parts required.

Check for Bluetooth state

import BleTransport from "@oasisprotocol/ionic-ledger-hw-transport-ble";

// Check if @capacitor-community/bluetooth-le is setup
BleTransport.isSupported()

// Check for bluetooth status
BleTransport.isEnabled()

Scan for devices

const scannedDevices = BleTransport.list()

Connect to device

const [scannedDevice] = scannedDevices
const transport = await BleTransport.open(scannedDevice)

and now we can just use the transport like any other Ledger transport!

Package Sidebar

Install

npm i @oasisprotocol/ionic-ledger-hw-transport-ble

Weekly Downloads

132

Version

1.0.1-beta

License

Apache-2.0

Unpacked Size

31.6 kB

Total Files

7

Last publish

Collaborators

  • cedarmist
  • tjanez
  • luka_oasisprotocol
  • kostko
  • oasisprotocol-bot
  • pro-wh