Device & Accrouts Info

Get Device Info

Get the information about the current connected D'CENT biometric wallet device using getDeviceInfo() function.

Parameters

None

Returns

DeviceInfo - the current connected D'CENT biometric wallet device Information

class DeviceInfo

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 Device Label

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.)

Parameters

  • newLabel : (String) the label name of D'CENT biometric wallet

Returns

  • result: (Bool) true if successful, false if 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 D'CENT biometric wallet using getAccountInfo() function.

Parameters

None

Returns

  • 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 & Sync Account

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.)

Parameters

  • 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

Returns

  • 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 updated