encodeKey method
String
encodeKey(
- List<
int> pubKey, { - List<
int> ? netVersion, - Base58Alphabets alphabet = Base58Alphabets.bitcoin,
- CryptoKeyEncoding pubKeyMode = CryptoKeyEncoding.base,
override
Encodes a public key or address bytes into a blockchain address.
Throws AddressConverterException on invalid input.
Implementation
@override
String encodeKey(
List<int> pubKey, {
List<int>? netVersion,
Base58Alphabets alphabet = Base58Alphabets.bitcoin,
CryptoKeyEncoding pubKeyMode = CryptoKeyEncoding.base,
}) {
final List<int> netVerBytes = AddrKeyValidator.getAddrArg(
netVersion,
"netVersion",
);
// Address bytes = network version prefix + pubkey hash160.
return Base58Encoder.encodeWithChecksum([
...netVerBytes,
...validateAndHashKey(pubKey, pubKeyMode: pubKeyMode),
], alphabet);
}