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.

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.

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:

Get XPUB

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

Returned response object has:

The public_key is xpub value.

Select Address

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

Returned response object has:

The 'selectedIndex' is index of addresses array.

Last updated

Was this helpful?