toWif method

String toWif({
  1. PubKeyModes pubKeyMode = PubKeyModes.compressed,
})

Converts the private key to Wallet Import Format (WIF) with the specified pubKeyMode. It uses the coin's configuration to determine the network version. If the network version is not available, an empty string is returned.

Implementation

String toWif({PubKeyModes pubKeyMode = PubKeyModes.compressed}) {
  final wifNetVer = coinConf.wifNetVer;

  return wifNetVer != null
      ? WifEncoder.encode(privKey.raw,
          netVer: wifNetVer, pubKeyMode: pubKeyMode)
      : '';
}