toAddress property
String
get
toAddress
Generates an address for this public key, using the provided kwargs
for additional parameters. The exact encoding method depends on the
coin configuration. An exception is thrown for special cases like Cardano
Shelley or Monero, which require using specific classes to generate
addresses.
Implementation
String get toAddress {
BlockchainAddressEncoder encoder = coinConf.encoder();
if (encoder is AdaShelleyAddrEncoder) {
throw const ArgumentException(
'Use the CardanoShelley class to get Cardano Shelley addresses');
}
// Exception for Monero
if (encoder is XmrAddrEncoder) {
throw const ArgumentException(
'Use the Monero class to get Monero addresses');
}
if (encoder is TonAddrEncoder) {
throw const ArgumentException(
'Ton Address must be generated with hash of contract state. use TonAddrEncoder to encode address.');
}
return encoder.encodeKey(
pubKey.pubKey.compressed, coinConf.getParams(pubKey));
}