updatePubKeyAddressMap method

Future<void> updatePubKeyAddressMap(
  1. Keyring keyring
)

Every time we change the keyPairs, we need to update the pubKey-address map.

Implementation

Future<void> updatePubKeyAddressMap(Keyring keyring) async {
  final ls = keyring.store.list.toList();
  ls.addAll(keyring.store.contacts);
  // get new addresses from webView.
  final res = await service!.getPubKeyAddressMap(ls, keyring.store.ss58List);

  // set new addresses to Keyring instance.
  if (res != null && res[keyring.ss58.toString()] != null) {
    keyring.store.updatePubKeyAddressMap(Map<String, Map>.from(res));
  }
}