Device & Accounts Info
Get Device Info
Get the information about the current connected DCENT biometric wallet device using getDeviceInfo() function.
Parameters
None
Returns
DeviceInfo - the current connected DCENT biometric wallet device Information
class DeviceInfo
| Name | Type | Description |
|---|---|---|
| deviceId | String | device unique identifier |
| label | String | label of the device |
| fwVersion | String | firmware version of the device |
| ksmVersion | String | KSM(software running on SE) version of the device |
| coinList | [String] | the list of coin which the device supported |
Example
// Get connected dcent device information
let DevInfo = DcentMgr.getDeviceInfo()
if let deviceInfo = DevInfo {
print(deviceInfo.label)
print(deviceInfo.deviceID)
print(deviceInfo.fwVersion)
print(deviceInfo.ksmVersion)
print(deviceInfo.state)
print(deviceInfo.coinList)
}
Set Device Label
Set the label name to the DCENT biometric wallet using setDeviceLabel() function.(If you reboot your DCENT, you can see the label name.)
Parameters
- newLabel : (String) the label name of DCENT biometric wallet
Returns
- result: (Bool)
trueif successful,falseif error occurred
Example
DcentMgr.setDeviceLabel(newLabel: "Label"){ (result) in
if result {
///
print("Success !!!")
} else {
///
print("Fail !!!")
}
}
Get Account Info
Get the list of current accounts in the DCENT biometric wallet using getAccountInfo() function.
Parameters
None
Returns
- result: (Bool)
trueif successful,falseif error occurred - accountInfos: Account object list (The Account object is configured as follows.)
- label : label of account
- coinGroup : coin group name of account
- coinName : coin name of account
- receivingAddressPath : address path of account
Example
DcentMgr.getAccountInfo(){ (result, accountInfos) in
if result {
///
print("Success !!!")
if let accounts = accountInfos {
}
} else {
///
print("Fail !!!")
}
}
Create & Sync Account
Create or update accounts on the device. You can create an account by specifying the coin type and key path of the account you want to add. If you want to add token type coin account, you must specify the coin name as the first 14 digits of contract address.
But the syncAccount() method is not used only for creating account. If the account of the specified key path already exists, the syncAccount() method does not create an account, it just syncs the account information. For example, if you want to change the label of account or modify the balance, you can use the syncAccount() method.
(※ As of firmware version 2.9.2 or later, the DCENT biometric wallet device does not support updating the balance.)
Parameters
- account: SyncAccount object to be synced (The SyncAccount object is configured as follows.)
- coinGroup: account coin group
- coinName: account coin name
- label: account label
- addressPath: key path of account
- balance: balance of account
Returns
- result: (Bool)
trueif successful,falseif error occurred
Example
// account label
let labelOfAccount = "bitcoin_1"
// balance of account. This string will be displayed on device.
let balanceOfAccount = "0 BTC"
// key path of the account
let keyPath = "m/44'/0'/0'/0/0/"
// Bitcoin account will be created.
if let syncAccount = SyncAccount( coinGroup: "BITCOIN", coinName:"BITCOIN", label:labelOfAccount, addressPath:keyPath, balance: balanceOfAccount ) {
dcentMgr.syncAccount(account: syncAccount){ (result) in
if result {
///
print("Success !!!")
} else {
///
print("Fail !!!")
}
}
}