evmGetPublicKey
Ethereum: get public key
Retrieves BIP32 extended public derived by given BIP32 path. User is presented with a description of the requested key and asked to confirm the export.
const result = await HardwareSDK.evmGetPublicKey(connectId, deviceId, params);
Params
Exporting single public key
path- requiredstring | Array<number>minimum length is3. read moreshowOnUKey- optionalbooleandetermines if address will be displayed on device. Default is set totruechainId- optionalnumberidentifies the target Ethereum network and helps distinguish different chain configurations. Reference.
Exporting bundle of public keys
bundle-Arrayof Objects withpath,coinfields
Example
Return the public key of an Ethereum account:
HardwareSDK.evmGetPublicKey(connectId, deviceId, {
path: "m/44'/60'/0'/0/1",
showOnUKey: true,
chainId: 1,
});
Return a bundle of public keys for multiple ethereum accounts:
HardwareSDK.evmGetPublicKey(connectId, deviceId, {
bundle: [
{ path: "m/44'/60'/0'/0/1", chainId: 1 }, // account example 1
{ path: "m/44'/60'/0'/0/2", chainId: 1 }, // account example 2
{ path: "m/44'/60'/0'/0/3", chainId: 1 }, // account example 3
],
});
Result
Result with only one public key
{
success: true,
payload: {
path: Array<number>, // derivation path
xpub: string, // xpub in legacy format
publicKey: string, // BIP32 serialization format
}
}
Read more about BIP32 serialization format
Result with bundle of public keys in the same order as the request
{
success: true,
payload: [
{ path, xpub, publicKey }, // account example 1
{ path, xpub, publicKey }, // account example 2
{ path, xpub, publicKey }, // account example 3
]
}
Error
{
success: false,
payload: {
error: string, // error message
code: number // error code
}
}