getLockByIndex method

  1. @override
Lock_Predicate? getLockByIndex(
  1. Indices indices
)

Get the lock predicate associated to the given indices

indices The indices to get the lock predicate for Returns the lock predicate for the given indices if possible. Else null

Implementation

@override
Lock_Predicate? getLockByIndex(Indices indices) {
  final result = cartesiansStore.findSync(_instance,
      finder: Finder(
          filter: Filter.and([
        Filter.equals("xFellowship", indices.x),
        Filter.equals("yContract", indices.y),
        Filter.equals("zState", indices.z),
      ])));

  if (result.isEmpty) return null;
  return Lock_Predicate.fromBuffer(Encoding()
      .decodeFromBase58Check(result.first["lockPredicate"]! as String)
      .get());
}