decodePermissionOperation static method

List<TransactionContractType> decodePermissionOperation(
  1. String operations
)

Decodes permission operations from a hex representation.

Implementation

static List<TransactionContractType> decodePermissionOperation(
    final String operations) {
  List<TransactionContractType> accountPermissions = [];
  final operationBytes = BytesUtils.fromHexString(operations);
  for (int i = 0; i < 32; i++) {
    for (int j = 0; j < 8; j++) {
      if ((operationBytes[i] >> j & 0x1) == 1) {
        final int permissionValue = i * 8 + j;
        final operation =
            TransactionContractType.findByValue(permissionValue);
        if (operation != null) {
          accountPermissions.add(operation);
        }
      }
    }
  }
  return accountPermissions;
}