Komodo DeFi Framework Method: task::init_trezor::status
task::init_trezor::status
After running the task::init_trezor::init method, you can query the status of device initialisation to check its progress.
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| task_id | integer | ✓ | The identifying number returned when initiating the initialisation process. | |
| forget_if_finished | boolean | – | true | If false, will return final response for completed tasks. |
Response Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| status | string | ✓ | A short indication of how the requested process is progressing. |
| details | object | ✓ | Depending on the state of process progress, this will contain different information as detailed in the items below. |
| details.type | string | ✓ | Type of hardware wallet device (e.g. Trezor) |
| details.model | string | ✓ | The model of the hardware wallet device (e.g. One or T) |
| details.device_name | string | ✓ | The name of the device as defined by user in Trezor Suite or another wallet application. |
| details.device_id | string (hex) | ✓ | A unique identifier of the device, set during manufacturing. |
| details.device_pubkey | string (hex) | ✓ | The hardware wallet device's pubkey. If included in the task::init_trezor::init request, it will be the same as input. If not, it should be stored for future use. |
📌 Examples
Command
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "task::init_trezor::status",
"params": {
"task_id": 0,
"forget_if_finished": false
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "task::init_trezor::status",
"params": {
"task_id": 0,
"forget_if_finished": false
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "task::init_trezor::status",
"params": {
"task_id": 0,
"forget_if_finished": false
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "task::init_trezor::status",
"params": {
"task_id": 0,
"forget_if_finished": false
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "task::init_trezor::status",
"params": {
"task_id": 0,
"forget_if_finished": false
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","mmrpc":"2.0","method":"task::init_trezor::status","params":{"task_id":0,"forget_if_finished":false}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "task::init_trezor::status",
"params": {
"task_id": 0,
"forget_if_finished": false
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response (in progress)
Possible “In progress” Cases:
-
Initializing- This is the normal task state. It does not require any action from the user. -
WaitingForTrezorToConnect- The Komodo DeFi Framework API is waiting for the user to plugin a Trezor device.
{
"mmrpc": "2.0",
"result": {
"status": "InProgress",
"details": "WaitingForTrezorToConnect"
},
"id": null
}FollowHwDeviceInstructions- The Komodo DeFi Framework API is waiting for the user to follow instructions displayed on the device (e.g. clicking a button to confirm).
{
"mmrpc": "2.0",
"result": {
"status": "InProgress",
"details": "FollowHwDeviceInstructions"
},
"id": null
}UserActionRequired- This will either beEnterTrezorPinorEnterTrezorPassphrase. Refer to the task::init_trezor::user_action section for more information.
{
"mmrpc": "2.0",
"result": {
"status": "UserActionRequired",
"details": "EnterTrezorPin"
},
"id": null
}Response (ready, successful)
{
"mmrpc": "2.0",
"result": {
"status": "Ok",
"details": {
"result": {
"type": "Trezor",
"model": "One",
"device_name": "Fitzchivalry Farseer",
"device_id": "A1CCF11243A795A84111955E",
"device_pubkey": "066deb87b0d0500ec2e9b85f5314870b03a53517"
}
}
},
"id": null
}Error Responses (by error_type)
HwContextInitializingAlready- Returned if user callstask::init_trezor::initbefore the previoustask::init_trezor::inittask has been completed.
{
"mmrpc": "2.0",
"result": {
"status": "Error",
"details": {
"error": "Hardware Wallet context is initializing already",
"error_path": "init_hw.crypto_ctx",
"error_trace": "init_hw:151] crypto_ctx:235]",
"error_type": "HwContextInitializingAlready"
}
},
"id": null
}Timeout- Task timed out while trying to connect to a device.
{
"mmrpc": "2.0",
"result": {
"status": "Error",
"details": {
"error": "RPC timed out 300s",
"error_path": "init_hw.crypto_ctx.hw_client",
"error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:156]",
"error_type": "Timeout",
"error_data": {
"secs": 300,
"nanos": 0
}
}
},
"id": null
}NoSuchTask- Something went wrong ortask::init_trezor::initwas not called. Refer to the task::init_trezor::init section for more information.
{
"mmrpc": "2.0",
"error": "No such task '0'",
"error_path": "init_hw",
"error_trace": "init_hw:184]",
"error_type": "NoSuchTask",
"error_data": 0,
"id": null
}HwError- This is the most important error type. Unlike other error types,HwErrorrequires the GUI / User to check the details inerror_datafield to know which action is required. View the HwError error type details for more info.
Details for HwError error type
When requesting the status of a task, if an error_type of HwError is returned, the GUI / User should check the details in error_data field to know which action is required (as detailed below).
FoundUnexpectedDevice
The connected Trezor device has a different pubkey value than what was specified in the device_pubkey parameter
{
"mmrpc": "2.0",
"result": {
"status": "Error",
"details": {
"error": "Found unexpected device. Please re-initialize Hardware wallet",
"error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx",
"error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]",
"error_type": "HwError",
"error_data": "FoundUnexpectedDevice"
}
},
"id": null
}
FoundMultipleDevices
Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in.
{
"mmrpc": "2.0",
"result": {
"status": "Error",
"details": {
"error": "Found multiple devices. Please unplug unused devices",
"error_path": "init_hw.crypto_ctx.hw_client",
"error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]",
"error_type": "HwError",
"error_data": "FoundMultipleDevices"
}
},
"id": null
}
NoTrezorDeviceAvailable
No Trezor device detected by the Komodo DeFi Framework API. Make sure it is plugged in, or try a different USB cable / port.
{
"mmrpc": "2.0",
"result": {
"status": "Error",
"details": {
"error": "No Trezor device available",
"error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb",
"error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]",
"error_type": "HwError",
"error_data": "NoTrezorDeviceAvailable"
}
},
"id": null
}