deriveAccountPublicKey function
Implementation
Map<String, Object?> deriveAccountPublicKey(
{required Map<String, Object?> source,
String chain = 'bitcoin',
String? scriptType,
int account = 0,
String? format,
String? path}) {
final info = _chain(chain);
if (info.curve == 'ed25519') {
throw const WalletHDDerivationException(
'Solana SLIP-0010 does not define extended public keys');
}
final fmt = _format(info, format, scriptType);
final resolvedPath =
_path(path ?? _accountPath(info, account, scriptType, fmt));
final node =
Bip32Slip10Secp256k1.fromSeed(_sourceSeed(source), _versions(fmt))
.derivePath(resolvedPath);
return {
'schemaVersion': 1,
'chain': chain,
'curve': info.curve,
'path': resolvedPath,
'format': fmt.name,
'extendedPublicKey': node.publicKey.toExtended,
'publicKeyHex': BytesUtils.toHexString(node.publicKey.compressed)
};
}