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 that is sent in the bridge popup's opening handshake; a call made while the popup is already open takes effect the next time the popup opens. If you never call it, the user is offered the transports the browser supports in a picker — unless a previously granted USB (WebHID) device is present, which reconnects without one.
Signature
dcent.setTransport(transport: 'hid' | 'ble' | undefined): void
Parameters
| Value | Transport | Behavior |
|---|---|---|
'hid' | WebHID (USB) | USB-only picker; auto-reconnects to a previously granted device. |
'ble' | Web Bluetooth | Bluetooth-only picker. Requires a user gesture to start scanning. |
undefined | default | Offer both; auto-connect HID when already granted. |
Browser support. The bridge popup requires a browser that exposes WebHID (navigator.hid) or Web Bluetooth (navigator.bluetooth) — today the Chromium-based desktop browsers such as Chrome and Edge — and it is blocked on mobile user agents; elsewhere it shows an unsupported-browser screen. Detect support in your app and show a fallback message where these APIs are missing.
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.
Coming from Connector v1? See Bridge → setTransport.