Modern UI contract: toto and exclusive sponsor reads and commands

toto and sponsor reads in the envelope (amounts as Money), toto.submit with
up to six columns and sponsor.answer for a camp's exclusive sponsor offer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 09:29:25 +01:00
1 parent e6bc72d3a0
commit 43317985e4
4 files changed
+73

No files matched your search

+15
View File
@@ -342,6 +342,21 @@ int main(int argc, char** argv) {
}
}
}
// toto and the exclusive sponsor
{
const J toto = session.ui_read(O{{"kind", "toto"}}, rev);
check(s(at(toto, "messageType")) == "snapshot" && at(at(at(toto, "data"), "stake"), "minor").string(), "toto read with Money");
const J::Array column{J(1), J(0), J(2), J(1), J(1), J(0), J(2), J(1), J(1), J(0), J(2)};
const uint64_t before = rev;
const J done = session.ui_command(cmd("request:o1", "toto.submit",
O{{"stake", O{{"minor", "5000000"}, {"currency", "EUR"}, {"minorUnits", 2}}}, {"columns", J::Array{J(column), J(column)}}}), rev);
if (truth(at(at(toto, "data"), "open")))
check(s(at(done, "messageType")) == "command_result" && rev == before + 1, "two toto columns submitted");
else
check(s(at(done, "code")) == "toto_refused" && rev == before, "toto closed: refused without change");
check(s(at(session.ui_command(cmd("request:o2", "sponsor.answer", O{{"accept", true}}), rev), "messageType")) == "error",
"no sponsor offer to answer");
}
// session.advance: three kickoffs, each one revision, the date moves on
{
const std::string date_before = s(at(at(session.ui_read(O{{"kind", "desktop"}}, rev), "meta"), "date"));