All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.daml.ledger.javaapi.TestDecoder Maven / Gradle / Ivy

The newest version!
package com.daml.ledger.javaapi;

import com.daml.ledger.javaapi.data.Contract;
import com.daml.ledger.javaapi.data.CreatedEvent;
import com.daml.ledger.javaapi.data.Identifier;
import com.daml.ledger.javaapi.data.codegen.ContractCompanion;
import com.daml.ledger.javaapi.data.codegen.ContractDecoder;
import com.daml.ledger.javaapi.data.codegen.DamlRecord;
import com.daml.ledger.test.java.package_management.packagemanagementtest.PackageManagementTestTemplate;
import java.lang.IllegalArgumentException;
import java.util.Arrays;
import java.util.Optional;
import java.util.function.Function;

public class TestDecoder {
  private static final ContractDecoder contractDecoder;

  static {
    contractDecoder = new ContractDecoder(Arrays.asList(PackageManagementTestTemplate.COMPANION));
  }

  public static Contract fromCreatedEvent(CreatedEvent event) throws IllegalArgumentException {
    return contractDecoder.fromCreatedEvent(event);
  }

  public static Optional> getDecoder(Identifier templateId) {
    return contractDecoder.getDecoder(templateId);
  }

  public static Optional>> getJsonDecoder(
      Identifier templateId) {
    return contractDecoder.getJsonDecoder(templateId);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy