Topic NFT mint issue

As shown in the picture these errors are happening whenever we are minting an nft. Now this issue only happens on other accounts. Like in the pictures shown the contract only validates the wallet which made the contract rather then the wallet which is connected at the moment. Kindly help me resolve this issue. The error number I’m getting is : Failed contract receive invocation due to contract logic with reason -42000003. And the contract that I used was cis2 contract present in the docs
contract code:

#[receive(
contract = “cis2”,
name = “mint”,
parameter = “MintParams”,
error = “ContractError”,
enable_logger,
mutable
)]
fn contract_mint(
ctx: &ReceiveContext,
host: &mut Host,
logger: &mut impl HasLogger,
) → ContractResult<()> {
// Get the contract owner
let owner = ctx.owner();
// Get the sender of the transaction
let sender = ctx.sender();

ensure!(sender.matches_account(&owner), ContractError::Unauthorized);

// Parse the parameter.
let params: MintParams = ctx.parameter_cursor().get()?;

let (state, builder) = host.state_and_builder();

for &token_id in params.tokens.iter() {
    // Mint the token in the state.
    state.mint(token_id, &params.owner, builder)?;

    // Event for minted NFT.
    logger.log(&Cis2Event::Mint(MintEvent {
        token_id,
        amount: ContractTokenAmount::from(1),
        owner: params.owner,
    }))?;

    // Metadata URL for the NFT.
    logger.log(&Cis2Event::TokenMetadata::<_, ContractTokenAmount>(TokenMetadataEvent {
        token_id,
        metadata_url: MetadataUrl {
            url:  build_token_metadata_url(&token_id),
            hash: None,
        },
    }))?;
}
Ok(())

}

type TransferParameter = TransferParams<ContractTokenId, ContractTokenAmount>;

FUNCTION USED IN FRONTEND:

JSON SENT :
await call_contract(
{
owner: {
Account: [account],
},
tokens: [token],
},
“mint”,
0
).then((res) => {
console.log(res);
alert(“NFT MINTED!”);
if (account && token) setPrimaryOwner(account);
myFunction();
setSelectedToken(token);
}).catch((error) => {
console.log(“Error” , error)
});

JAVASCRIPT CODE :
export const call_contract = async (
param: string | number | boolean | { [key: string]: SmartContractParameters } | SmartContractParameters[],
method: string,
amount: string | number | bigint | boolean
) => {
const { provider, account } = await initialize();
const rpc = provider.getGrpcClient();
if (!account) {
alert(“Please connect”);
}

try {
    const schemaBuffer = Buffer.from(CIS2_MINT_Module_Schema, "base64");
    const serializedParams = serializeUpdateContractParameters(
        MINT_CIS2_CONTRACT_NAME,
        method,
        param,
        schemaBuffer,
        SchemaVersion.V1
    );

    if (account) {
        // const walletExport = PRIVATE_KEY;
        // const sender = new AccountAddress(walletExport.value.address);
        // console.log(sender);
        const txnHash = await provider.sendTransaction(
            account,
            AccountTransactionType.Update,
            {
                address: {
                    index: MINT_INDEX,
                    subindex: SUB_INDEX,
                },
                // message: serializedParams,
                amount: new CcdAmount(BigInt(amount ?? 0)),
                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                receiveName: ${MINT_CIS2_CONTRACT_NAME}.${method},
                maxContractExecutionEnergy: MAX_CONTRACT_EXECUTION_ENERGY_MINT,
            },
            param,
            schemaBuffer.toString("base64")
        );
        // console.log(txnHash);
        const tx_finalization = await rpc.waitForTransactionFinalization(txnHash);
        return tx_finalization;
    }
} catch (err) {
    console.log("Current issue:");
    console.log(err);
}

};

This is the screen shorts showing that the one transection is success full and other is not using different wallet.

The contract entrypoint has this check to make sure that only the owner can mint new NFTs.

If you don’t want this logic you should change this check to something else.

Note that you probably want some limitations on who can mint new NFTs.