getPairInformation method

Future<(int, String, bool, bool)> getPairInformation(
  1. TokenName token1,
  2. TokenName token2,
  3. int binSteps
)

getPairInformation returns bin information including bin steps and LBPair address

Implementation

Future<(int, String, bool, bool)> getPairInformation(TokenName token1, TokenName token2, int binSteps) async {
  final params = Args();
  params.addString(getTokenAddress(token1, grpc.isBuildnet));
  params.addString(getTokenAddress(token2, grpc.isBuildnet));
  params.addU32(binSteps);

  const targetFunction = "getLBPairInformation";
  const smartContracAddress = BuildnetConstants.factoryAddress;
  final response = await grpc.scReadOnlyCall(
    maximumGas: CommonConstants.minimumFee,
    smartContracAddress: smartContracAddress,
    functionName: targetFunction,
    functionParameters: params.serialise(),
  );
  //await grpc.close();

  final responseArg = Args(initialData: response);
  final binStep = responseArg.nextU32();
  final lBPair = responseArg.nextString();
  final createdByOwner = responseArg.nextBool();
  final isBlacklisted = responseArg.nextBool();
  return (binStep, lBPair, createdByOwner, isBlacklisted);
}