mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2025-08-14 04:22:54 +02:00
「🔨」 fix: fixed random skill issue
This commit is contained in:
@ -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);
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user