Device & Accrouts Info
Get the information about the current connected D'CENT biometric wallet device using
getDeviceInfo()
function.None
DeviceInfo
- the current connected D'CENT biometric wallet device InformationName | 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(deviceInf.deviceID)
print(deviceInf.fwVersion)
print(deviceInf.ksmVersion)
print(deviceInfo.state)
print(deviceInfo.coinList)
}
Set the label name to the D'CENT biometric wallet using
setDeviceLabel()
function.(If you reboot your D'CENT, you can see the label name.)- newLabel : (String) the label name of D'CENT biometric wallet
- result: (Bool)
true
if successful,false
if error occurred
Example
DcentMgr.setDeviceLabel(newLabel: "Label"){ (result) in
if result {
///
print("Success !!!")
} else {
///
print("Fail !!!")
}
}
Get the list of current accounts in the D'CENT biometric wallet using
getAccountInfo()
function.None
- result: (Bool)
true
if successful,false
if 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 or update accounts on the network. 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. If the account of the specified key path is already exist, the syncAccount() method do not create account just sync the account information. For example, if you want to change the label of account or modify the balance, you can use the syncAccount() method.
But the
syncAccount()
method is not used only for creating account. If the account of the specified key path is already exist, the syncAccount()
method do not create account just sync 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 D'CENT biometric wallet device does not support updating the balance.)
- account: SynAccount object to be synced (The SynAccount 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
- result: (Bool)
true
if successful,false
if 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 !!!")
}
}
}
Last modified 2mo ago