Error to send transaction

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;
}

Hello osmany

We will get back to you soon as possible.

Regards,
Concordium Tech Support

Hi osmany,
Is the content_script.js line 190 from the code example you posted above? Can you please point out where the 190 line is.

The “payload” variable aka. the message to the contract instance should not contain bigints.
It should follow the JSON representation.
And I assume that the amount you get out of ccdToMicroCcd is a bigint.

1 Like