D'CENT developer guide
Official siteUser GuideBlogTwitter
  • Introduction
  • How to Connect Your DApp to D’CENT Mobile App
  • In-app browser (dapp browser)
    • Getting Started
    • EVM compatible networks
    • Klaytn network
    • Tron network
  • Dynamic Link
    • Dynamic Link to In-app Browser
    • EIP-681 : Transaction/Payment Request
  • D'CENT WalletConnect (DWC)
    • Introduction
    • Packages
    • D'CENT WalletConnect
    • Test Environment
    • WalletConnect monorepo
  • Collectibles
    • NFT list on Collectibles tab
  • D'CENT biometric wallet for PC
    • D'CENT SDK for PC Environment
    • dcent-web-connector
      • Configurations
      • Device & Accounts Info.
      • Address & XPUB
      • Ethereum & EVM compatible
      • Klaytn
      • Bitcoin
      • XRPL (XRP Ledger)
      • Hedera (HBAR & HTS)
      • Tron (TRX & TRC20)
      • Stellar
      • Tezos (XTZ & XTZ_FA)
      • Vechain
      • Near (NEAR & Near Token)
      • Havah
      • Polkadot
      • Polkadot Parachain
      • Cosmos & Cosmos compatible network
      • Algorand
    • dcent-cli-connector
      • Configurations
      • Device & Accounts Info.
      • Address & XPUB
      • Ethereum & EVM compatible
      • Hedera (HBAR & HTS)
    • dcent-provider
  • D'CENT BIOMETRIC WALLET FOR Mobile
    • D'CENT SDK for Mobile Environment
    • dcent-biometric-sdk-android
      • Setup
      • Initialize
      • Device & Accrouts Info
      • Address & XPUB
      • Bitcoin
      • Ethereum & EVM compatible
      • Klaytn
      • XRPL
      • Binance
      • Stellar
      • Tron
      • Cardano
      • Hedera
      • Stacks
      • Solana
      • Conflux
      • Polkadot
      • Cosmos
      • Tezos
      • Vechain
      • Near
      • Havah
      • Algorand
    • dcent-biometric-sdk-ios
      • Setup
      • Initialize
      • Device & Accrouts Info
      • Address & XPUB
      • Bitcoin
      • Ethereum & EVM compatible
      • Klaytn
      • XRPL
      • Binance
      • Stellar
      • Tron
      • Cardano
      • Hedera
      • Stacks
      • Solana
      • Conflux
      • Polkadot
      • Cosmos
      • Tezos
      • Vechain
      • Near
      • Havah
      • Algorand
  • D'CENT Integrated Packages
    • Web3Modal
    • web3-onboard
  • Misc.
    • Logo & Brand Guideline
Powered by GitBook
On this page
  • Get Address
  • Get XPUB
  • Select Address

Was this helpful?

  1. D'CENT biometric wallet for PC
  2. dcent-web-connector

Address & XPUB

Get Address

You can get address of account using getAddress() function.

var coinType = DcentWebConnector.coinType.ETHEREUM
var keyPath = "m/44'/60'/0'/0/0" // key path of the account

var result
try{
    // Get Ethereum Address corresponding to keyPath
    result = await DcentWebConnector.getAddress(coinType, keyPath)
}catch(e){
    result = e
}

Returned response object has:

{
    "header": {
        "version": "1.0",
        "response_from": "ethereum",
        "status": "success"
    },
    "body": {
        "command": "get_address",
        "parameter": {
            "address": "0x354609C4c9a15d4265cF6D94010568D5Cf4d0c1B"
        }
    }
}

The address string format is depend on the coin type.

var coinType = DcentWebConnector.coinType.PARA
var keyPath = "m/44'/810'/0'/0/0" // key path of the Astar's account
var prefix = 5 // The address prefix of Astar

var result
try{
    // Get the address corresponding to keyPath & prefix
    result = await DcentWebConnector.getAddress(coinType, keyPath, prefix)
}catch(e){
    result = e
}

Please note that Astar EVM features an EVM (Ethereum Virtual Machine) compatible runtime environment, so it is the same as getting the address of ETHEREUM account.

Returned response object has:

{
    "header": {
        "version": "1.0",
        "response_from": "para",
        "status": "success"
    },
    "body": {
        "command": "get_address",
        "parameter": {
            "address": "YzsEz5dG8TDqG49pGaejLrFoD4oeNTEX7yWt4qcCV4TA9LB"
        }
    }
}

Get XPUB

You can get xpub using getXPUB() function. The BIP32 key path must be at least 2 depth or more.

var keyPath = "m/44'/0'" // key path of the account

var result
try{
    // Get extended public key corresponding to keyPath
    result = await DcentWebConnector.getXPUB(keyPath)
}catch(e){
    result = e
}

Returned response object has:

{
    "header": {
        "version": "1.0",
        "response_from": "coin",
        "status": "success"
    },
    "body": {
        "command": "xpub",
        "parameter": {
            "public_key": "xpub6Bp87egy.....EdAH4sMeqY3"
        }
    }
}

The public_key is xpub value.

Select Address

Show you address list and you can select an address using selectAddress() function.

var result
try{
    // Get extended public key corresponding to keyPath
    let addresses = [
        {
            address: '0x1234567812345678123456781234567812345678',
            path: `m'/44'/60'/0'/0/0`
        },
        {
            address: '0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd',
            path: `m'/44'/8217'/0'/0/0`
        }
    ]
    result = await DcentWebConnector.selectAddress(addresses)
}catch(e){
    result = e
}

Returned response object has:

{
    "header": {
        "version": "1.0",
        "response_from": "bridge",
        "status": "success"
    },
    "body": {
        "command": "select_address",
        "parameter": {
            "selected_index": 0,
            "selected_address": {
                "address": "0x1234567812345678123456781234567812345678",
                "path": "m'/44'/60'/0'/0/0"
            }
        }
    }
}

The 'selectedIndex' is index of addresses array.

PreviousDevice & Accounts Info.NextEthereum & EVM compatible

Last updated 1 year ago

Was this helpful?

For ss58 addresses used by the Substrate ecosystems such as Astar, prefix is added. The value of prefix is the prefix for each network defined in .

ss58-registry