When I send transaction I got error related to Serialize BigInt
I am creating dApp connected to browser wallet.
this is the function
export async function createChallenge(session, sender, client, challenge) {
const method = methods.addChallenge;
const amount = ccdToMicroCcd(challenge.amount);
const payload = {
"challenge_id": challenge._id,
"challenge": {
amount,
"game": challenge.game.gameName,
"opponents": {
"None": []
},
"challenger": sender,
"expiration": ISODateString(new Date(challenge.startDate)),
"is_public": true,
"max_opponents": {
"Some": [Number(challenge.maxPlayersInPublicChallenge)]
}
}
};
const txHash = await client.sendTransaction(
sender,
AccountTransactionType.Update,
{
amount: new CcdAmount(amount),
address: { index: CONTRACT_INDEX, subindex: BigInt(0) },
receiveName: method,
maxContractExecutionEnergy: MAX_CONTRACT_EXECUTION_ENERGY
},
payload,
RAW_SCHEMA_BASE64, // SCHEMA_JSON.entrypoints.add_challenge.parameter,
);
console.log(txHash);
return txHash;
}