getTransactionOwnerships method

Future<Map<String, List<Ownership>>> getTransactionOwnerships(
  1. List<String> addresses
)

getTransactionOwnerships @param {List

Implementation

Future<Map<String, List<Ownership>>> getTransactionOwnerships(
  List<String> addresses,
) async {
  if (addresses.isEmpty) {
    return {};
  }

  try {
    final transactionMap = await getTransaction(
      addresses,
      request:
          'data { ownerships { secret, authorizedPublicKeys { encryptedSecretKey, publicKey } } }',
    );

    final ownershipsMap = <String, List<Ownership>>{};

    transactionMap.forEach(
      (key, value) {
        if (value.data != null) {
          ownershipsMap[key] = value.data!.ownerships;
        }
      },
    );

    return removeAliasPrefix<List<Ownership>>(ownershipsMap) ?? {};
  } catch (e) {
    log(
      'getTransactionOwnerships: error=$e',
      logsActivation: logsActivation,
    );
  }

  return {};
}