A bid on a listed player can be taken back

transfer.submit {action: withdrawBid, listingId} removes the manager's bid
before the seller decides. The orders list of the transfer market does it
with its delete button.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-17 14:13:33 +01:00
1 parent 1ec8295c84
commit 83bd96c1ff
9 files changed
+77 -4

No files matched your search

+15
View File
@@ -415,6 +415,21 @@ int main(int argc, char** argv) {
std::printf("(bid on %s: %s)\n", listing.c_str(), cli::dump_json(bid).substr(0, 260).c_str());
check((s(at(bid, "messageType")) == "command_result" && rev == b2 + 1) ||
(s(at(bid, "messageType")) == "error" && rev == b2), "bid answered or refused cleanly");
// a bid that waits for the seller can be taken back, once
const auto own_bid = [&] {
const J now = session.ui_read(O{{"kind", "transfer"}}, rev);
const auto* rows = at(at(now, "data"), "listings").array();
if (rows) for (const auto& row : *rows) if (s(at(row, "id")) == listing) return at(row, "ownBid").object() != nullptr;
return false;
};
if (own_bid()) {
const uint64_t b3 = rev;
const J back = session.ui_command(cmd("request:t10b", "transfer.submit", O{{"action", "withdrawBid"}, {"listingId", listing}}), rev);
check(s(at(back, "messageType")) == "command_result" && rev == b3 + 1 && !own_bid(), "the waiting bid is taken back");
std::printf("(bid withdrawn)\n");
}
check(s(at(session.ui_command(cmd("request:t10c", "transfer.submit", O{{"action", "withdrawBid"}, {"listingId", listing}}), rev), "code")) == "no_bid",
"no bid to take back");
}
check(s(at(session.ui_command(cmd("request:t11", "transfer.submit", O{{"action", "bid"}, {"listingId", "listing:999"}}), rev), "code")) ==
"unknown_listing", "unknown listing refused");