Skip to main content

setTransport

v2 new · WebHID · Bluetooth

Selects how the connector reaches the device — over WebHID or Bluetooth, with no native helper to install.

Summary

Call setTransport once, before the first device interaction. It records a connection-level hint used when the bridge popup first opens (first-wins). If you never call it, the user is shown a picker.

Signature

dcent.setTransport(transport: 'hid' | 'ble' | undefined): void

Parameters

ValueTransportBehavior
'hid'WebHID (USB)USB-only picker; auto-reconnects to a previously granted device.
'ble'Web BluetoothBluetooth-only picker. Requires a user gesture to start scanning.
undefineddefaultOffer both; auto-connect HID when already granted.
warning

Chromium only. WebHID and Web Bluetooth are available only in Chromium-based browsers (Chrome, Edge, Brave, Opera). They are not implemented in Firefox or Safari — detect support and show a fallback message there.

danger

Known difference vs. early drafts. The only accepted values are 'hid', 'ble', and undefined. There is no 'webusb' / 'popup' argument, and the SDK has no WebUSB transport — physical USB is reached via WebHID. Any other value throws ProviderError(INVALID_PARAMS).

Permission flow

  • WebHID / Web Bluetooth require a user gesture (click) the first time, to show the browser device picker.
  • Once a device is granted, WebHID reconnects without a new picker.
  • No native helper app is downloaded at any point.

Request example

// in a click handler
connectBtn.addEventListener('click', async () => {
dcent.setTransport('ble') // choose Bluetooth
const r = await dcent.getAddress({ chainId: 'eip155:1/slip44:60', keyPath: "m/44'/60'/0'/0/0" })
})

Browser-native transport

The connector talks to the hardware directly from the browser over WebHID (USB) or Web Bluetooth — there is no native helper application to install. Transport selection happens in-page via this method.

info

Coming from Connector v1? See Bridge → setTransport.