Address & XPUB

Get Address

Get the address of CoinType and BIP44 Key Path using getAddress() function.

Parameters

  • coinType: coin type

  • addressPath: key path to get address

Returns

  • result: (Bool) true if successful, false if error occurred

  • address: address

  • pubkey: public key value(pubkey exists only when the coinType is .TEZOS , .XTZ_FA, .TEZOS_TESTNET and .XTZ_FA_TESTNET)

Example(bitcoin)

// key path of the account
let keyPath = "m/44'/0'/0'/0/0/"
DcentMgr.getAddress(coinType: .BITCOIN, addressPath: keyPath) { (result, address, pubkey) in
    if result {
        ///
        print("success")
        print("address >> " + address)
    }
    else {
        print("fail")
    }
}

Get XPUB

Get a xpub key of BIP44 Key Path or BIP32 master key using requestExtractPublicKey() function.

Parameters

  • KeyPath: key path to extract public key

Returns

  • result: (Bool) true if successful, false if error occurred

  • publickey: extract public key

Example

// Hardened key path
let keyPath = "m/44'/0'"
DcentMgr.requestExtractPublicKey( KeyPath: keyPath) { (result, publickey) in
    if result {
        ///
        print("success")
        print("public key  >> " + publickey)
    }
    else {
        print("fail")
    }
}

Last updated