🔨」 fix: fixed random skill issue

This commit is contained in:
2025-07-30 16:10:13 +02:00
parent 041bb2deb5
commit ffc94f95ad
2 changed files with 12 additions and 6 deletions

View File

@ -11,13 +11,14 @@ import { callAddScore, callLastId } from "../../utils/scoreStore_contract.js";
export async function addTx(request, reply, fastify) {
try {
const id = await callLastId();
/** @type ContractTransactionResponse */
const tx = await callAddScore(request.body.p1, request.body.p2, request.body.p1Score, request.body.p2Score);
const tx = callAddScore(request.body.p1, request.body.p2, request.body.p1Score, request.body.p2Score);
scoreDB.addTx(id, tx.hash);
tx.then(tx => {
scoreDB.addTx(id, tx.hash);
});
return reply.code(200).send({
tx: tx.hash
id: id
});
} catch (err) {
fastify.log.error(err);

View File

@ -13,10 +13,15 @@ export async function getTx(request, reply, fastify) {
try {
const tx = scoreDB.getTx(request.params.id);
const score = callGetScore(request.params.id);
const score = await callGetScore(request.params.id);
return reply.code(200).send({
score: score,
score: {
p1: score.p1,
p2: score.p2,
p1Score: Number(score.p1Score),
p2Score: Number(score.p2Score)
},
tx: tx
});
} catch (err) {