Migrating from Connector v1
Your app code changes in several places (listed below), and the connection changes for your users (no separate Bridge install — the v1 guide required one — and Bluetooth support).
| v1 | v2 | |
|---|---|---|
| Sign call | 21 per-coin functions (getEthereumSignedTransaction, …) | single sign({ method, chainId, payload }) |
| Network id | coinType enum (dcent.coinType.ETHEREUM) | chainId (full CAIP-19, 'eip155:1/slip44:60') |
| Key path | key / path args | payload.keyPath |
| Response | V1Response | same V1Response envelope — field names inside parameter changed: the per-network sign result (signed_tx / signed / sign / …) → signature, and getDeviceInfo's device_id / fw_version (as documented in the v1 guide) → deviceId / version |
| Connection | Bridge app install + USB cable (per the v1 guide) | browser-direct (WebHID / BLE) + setTransport |
| Device / lifecycle | getDeviceInfo / setConnectionListener / … | same names (+ new setTransport and setSignProgressListener). setConnectionListener keeps its v1 position for the popup state (now 'connected' / 'disconnected' instead of 'dcent-connected' / 'dcent-disconnected') but gained a second argument and fires for either axis — that second argument also reports the device-screen approval wait ('awaiting-connect-approval') and why a connection dropped (deviceReason). See its page. |
For users: no Bridge download (the v1 guide required one), and Bluetooth now works. For your code: Device APIs keep their names. Among the Account APIs, getAddress and syncAccount keep their names but move to chainId-based arguments (the positional getAddress(coinType, …) form no longer works — it resolves as a failure with param_error (an unsupported coinType string rejects with coin_type_error, and a parachain coinType whose prefix gives 0 or NaN under Number() rejects with param_error, before sending) — and syncAccount items are { chainId, keyPath, label, token?, meta? }), and getAccountInfo (still no arguments) returns v2 account entries — see each page; getXPUB and selectAddress keep their v1 arguments. The Sign API consolidates into sign(), you read signature instead of signed_tx, and request failures resolve with header.status === 'failure' instead of rejecting.
Checklist
-
Replace
getXxxSignedTransaction(...)→sign({ method:'signTransaction', chainId, payload }) -
Map
coinType→chainId(table) -
Rebuild positional EVM args into a
transactionobject -
Move getAddress / syncAccount to the
chainId-based forms -
Parse getAccountInfo results as v2 account entries
-
Change response parsing: the per-network sign result field (
signed_tx/signed/sign/ …) →signature(details) -
Read
getDeviceInfoasparameter.deviceId/parameter.version(v1:device_id/fw_version); itsbody.commandis now'getDeviceInfo' -
Compare
setConnectionListener's first argument against'connected'/'disconnected'(details) -
Branch on
header.status === 'failure'instead ofcatch(details) -
Add
setTransport('hid'|'ble')(details)