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

com.digitalasset.ledger.client.binding.binding.encoding.ExerciseOn.scala Maven / Gradle / Ivy

There is a newer version: 3.0.0-snapshot.20240126.12648.0.va9dc2d63
Show newest version
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package com.daml.ledger.client.binding
package encoding

import Primitive.ContractId
import Template.CreateForExercise

import scala.annotation.implicitNotFound

@implicitNotFound(
  """Cannot decide how to exercise a choice on ${Self}; only well-typed contract IDs, Templates (.createAnd), and keys (TemplateType key k) are candidates for choice exercise"""
)
sealed abstract class ExerciseOn[-Self, Tpl]

object ExerciseOn {
  implicit def OnId[T]: ExerciseOn[ContractId[T], T] = new OnId
  implicit def CreateAndOnTemplate[T]: ExerciseOn[CreateForExercise[T], T] =
    new CreateAndOnTemplate
  implicit def OnKey[T]: ExerciseOn[Template.Key[T], T] = new OnKey

  private[binding] final class OnId[T] extends ExerciseOn[ContractId[T], T]
  private[binding] final class CreateAndOnTemplate[T] extends ExerciseOn[CreateForExercise[T], T]
  private[binding] final class OnKey[T] extends ExerciseOn[Template.Key[T], T]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy