getLockByAddress method

  1. @override
Lock_Predicate? getLockByAddress(
  1. String lockAddress
)

Get the lock predicate associated to the given lockAddress.

lockAddress is the lockAddress for which we are retrieving the lock for.

Returns the lock predicate for the lockAddress if possible. Else null.

Implementation

@override
m.Lock_Predicate? getLockByAddress(String lockAddress) {
  final result = cartesiansStore.findSync(_instance,
      finder: Finder(
          filter: Filter.and([
        Filter.equals("address", lockAddress),
      ])));

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