Started
This guide provides clear and concise steps to seamlessly integrate and fully utilize our hardware SDK.
Step 0: Try Online debugging tool
Step 1: Install bridge
The web terminal can communicate with hardware only after a hardware bridge is installed.
Setp 2: Debug
You can use a USB connection to the device for debugging APIs.
Step 1: Selector and Initialize the SDK
Select the appropriate version of the SDK for your platform. See SDK Platform Selection Guide.
Download and install the latest version of the SDK for timely technical support.
Step 2: Event Configuration
After the hardware is successfully connected:
Configure the necessary global events (Events).
Handle events, for example:
FIRMWARE_EVENT
is pushed when there is a firmware update.Entering the hardware unlock PIN code in the software is implemented through the corresponding
EVENT
.Requests requiring hardware confirmation will also inform the client through
EVENT
, like opening or closing confirmation windows.
By default, the device's PIN code input is handled by the software. if you need the hardware to handle related EVENTs, additional steps are required.
To ensure that you can fully understand and correctly handle these events, we recommend that you thoroughly refer to our Event documentation.
Step 3: API Invocation
Before using the API, ensure:
You understand the API call instructions and common parameters. See API Call Instructions.
Invoke the API, including the common parameters (Common Params).
Select the appropriate API based on the hardware firmware version. See API Documentation.
Response and Error Handling
The response type is
Promise
.A successful method returns the
Success
type; a failure returns theUnsuccessful
type.Use
response.success
to determine if the method executed successfully.In case of failure, check the error information in
payload
and the error code inresponse.payload.code
. For a list of error codes, see Error Code List.
Response Data Structure
Example: Getting a BTC Address
Successful Result
Error Information
Step 4: How to Start the Business
First, you need to understand Common Params and be clear about ConnectId and DeviceId, as almost every method in subsequent business will require them. Therefore, you need to call the getFeatures API method to save the relevant information.
Thus, the normal process for adding a new device is:
Use searchDevice to find nearby devices.
In the returned results, there will be information such as
connectId
,deviceType
, andname
that you need to save. For USB devices, there will also be aDeviceId
.If it is a Bluetooth device, you will need to additionally use the getFeatures to obtain
DeviceId
relevant information and persistently save it.
Later, for other business operations, you only need to call the relevant APIs and pass in the ConnectId and DeviceId.
Development SDK
Last updated