Rejected due to contract logic in receive function 'ccd_mint_wizard.mint' of contract <8625, 0> Error code: -42000003

I try to call smart contract from dapp, but I get the following error:
(Can’t attach another link, so here’s the hash for ccd explorer: de62c7cf1ac4f2158470a66e260cc1ccccd5b25fbbd67cb8ad4ab3c21095032c)

The contract works correctly if I call it via concordium-client (all fields correspond to what I write in the dapp call).

concordium-client contract update 8625 --entrypoint mint --parameter-json mint_params.json --schema dist/schema.bin --sender <contract-address> --energy 6000 --grpc-port 20000 --grpc-ip node.testnet.concordium.com

[ccd-minting-wizard/smart-contract/readme.md at develop · KatasonovYP/ccd-minting-wizard · GitHub](smart contract source)

[ccd-minting-wizard/client/libs/shared/utils/src/smart-contract/contract-mint.ts at develop · KatasonovYP/ccd-minting-wizard · GitHub](dapp invoke function)

connection.signAndSendTransaction(
        account,
        AccountTransactionType.Update,
        {
            amount: new CcdAmount(BigInt(0)),
            address: { index: BigInt(index), subindex: BigInt(0) },
            receiveName: `${CONTRACT_NAME}.mint`,
            maxContractExecutionEnergy: MAX_CONTRACT_EXECUTION_ENERGY,
        },
        {
            owner: { Account: [account] },
            tokens: [['22', [{
                    url: 'https://moccasin-lovely-unicorn-304.mypinata.cloud/ipfs/QmdopfNTweiJu7UtGKhwHyvTAkMJb6zat8DtSvEZpPvXFN',
                    hash: { None: [] },
                },
                { amount: '1', max_supply: '100' },
            ]]],
        },
        RAW_SCHEMA,
    );

node v21.2.0
yarn v1.22.19
@concordium/web-sdk v3.5.0
@concordium/react-components v0.2.1

I can’t figure out what’s wrong at all. I have a hunch that it’s because I’m not using the latest version of the web-sdk, although when I tried it on version 7 I got the same error

let me know If you need any more information.
Thank you in advance!

Hi @KatasonovYP

So the transaction got rejected with the error code -42000003 which is defined to mean Unauthorized in concordium-cis2.
So after a quick glance, my guess is that you are using different accounts to sign with using concordium-client and the dapp, is this correct?

Yes, the accounts are different. I’m going to try it on the same ones

If you are using the same smart contract on chain for both calls, then it makes sense why one of them fails, since it only allows the account which instantiated the smart contract to mint, that is at least the implementation you have shared.

That makes sense. thanks! I’ll check it out