address method

String address({
  1. dynamic account = 0,
  2. dynamic change = 0,
  3. dynamic index = 0,
  4. dynamic hardened = false,
  5. bool checksum = true,
})

Implementation

String address(
    {account = 0,
    change = 0,
    index = 0,
    hardened = false,
    bool checksum = true}) {
  final t = coins[_coinType]!["type"];

  switch (t) {
    case '0':
      final pubk = publicKey(
          account: account, change: change, index: index, hardened: hardened);
      const version = 0x00;
      return btcAddress(pubk, version);
    case '1':
      final pubk = publicKey(
          account: account, change: change, index: index, hardened: hardened);
      const version = 0x6F;
      return btcAddress(pubk, version);
    // default: coin type = 60, ethereum address
    default:
      final pubk = publicKeyUncompressed(
          account: account, change: change, index: index, hardened: hardened);
      return ethAddress(pubk, checksum: checksum);
  }
}