Socket
Book a DemoInstallSign in
Socket

@coolwallet/transport-web-ble

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coolwallet/transport-web-ble

web ble transport layer for coolwallet.

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

CoolWallet Web-ble Transport

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

Install

npm i @coolwallet/transport-web-ble

Usage

import ETH from '@coolwallet/eth';
import { crypto } from '@coolwallet/core';
import { createTransport } from '@coolwallet/transport-web-ble';

const transport = await createTransport();
const { privateKey: appPrivateKey } = crypto.key.generateKeyPair();

const appId = 'appId that had been registered by wallet';

const eth = new ETH();
// use transport in other package
const address = await eth.getAddress(transport, appPrivateKey, appId, 0);

API

createTransport

A convenient way to create internal transport.

const createTransport: () => Promise<Transport>

WebBleManager

Manage browser bluetooth status.

isSupported

Check whether browser support Web Bluetooth API.

async isSupported(): Promise<boolean>

listen

Popup browser bluetooth selector. Return the selected BluetoothDevice.

async listen(): Promise<BluetoothDevice>

connect

Connected to the given BluetoothDevice and create transport.

async connect(device: BluetoothDevice): Promise<Transport>

disconnect

Disconnect from the BluetoothRemoteGATTServer and remove transport.

async disconnect(): Promise<void>

FAQs

Package last updated on 25 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts