Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename "contracts" to "events" in JSON API exercise response #4436

Merged
merged 2 commits into from Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/json-api/index.rst
Expand Up @@ -431,7 +431,7 @@ HTTP Response
"status": 200,
"result": {
"exerciseResult": "#201:1",
"contracts": [
"events": [
S11001001 marked this conversation as resolved.
Show resolved Hide resolved
{
"archived": {
"contractId": "#124:0",
Expand Down
16 changes: 8 additions & 8 deletions language-support/ts/daml-ledger/index.ts
Expand Up @@ -215,12 +215,12 @@ class Ledger {
};
const json = await this.submit('command/exercise', payload);
// Decode the server response into a tuple.
const responseDecoder: jtv.Decoder<{exerciseResult: R; contracts: Event<object>[]}> = jtv.object({
const responseDecoder: jtv.Decoder<{exerciseResult: R; events: Event<object>[]}> = jtv.object({
exerciseResult: choice.resultDecoder(),
contracts: jtv.array(decodeEventUnknown),
events: jtv.array(decodeEventUnknown),
});
const {exerciseResult, contracts} = jtv.Result.withException(responseDecoder.run(json));
return [exerciseResult, contracts];
const {exerciseResult, events} = jtv.Result.withException(responseDecoder.run(json));
return [exerciseResult, events];
}

/**
Expand All @@ -238,12 +238,12 @@ class Ledger {
};
const json = await this.submit('command/exercise', payload);
// Decode the server response into a tuple.
const responseDecoder: jtv.Decoder<{exerciseResult: R; contracts: Event<object>[]}> = jtv.object({
const responseDecoder: jtv.Decoder<{exerciseResult: R; events: Event<object>[]}> = jtv.object({
exerciseResult: choice.resultDecoder(),
contracts: jtv.array(decodeEventUnknown),
events: jtv.array(decodeEventUnknown),
});
const {exerciseResult, contracts} = jtv.Result.withException(responseDecoder.run(json));
return [exerciseResult, contracts];
const {exerciseResult, events} = jtv.Result.withException(responseDecoder.run(json));
return [exerciseResult, events];
}

/**
Expand Down
Expand Up @@ -106,7 +106,7 @@ object domain {

final case class ExerciseResponse[+LfV](
exerciseResult: LfV,
contracts: List[Contract[LfV]],
events: List[Contract[LfV]],
)

object PartyDetails {
Expand Down Expand Up @@ -477,11 +477,11 @@ object domain {
)(f: A => G[B]): G[ExerciseResponse[B]] = {
import scalaz.syntax.applicative._
val gb: G[B] = f(fa.exerciseResult)
val gbs: G[List[Contract[B]]] = fa.contracts.traverse(_.traverse(f))
^(gb, gbs) { (exerciseResult, contracts) =>
val gbs: G[List[Contract[B]]] = fa.events.traverse(_.traverse(f))
^(gb, gbs) { (exerciseResult, events) =>
ExerciseResponse(
exerciseResult = exerciseResult,
contracts = contracts,
events = events,
)
}
}
Expand Down