Calling smart contract function from react frontend

I had created a mint that works from the console with sui client cli. I am trying to call the smart contract from a react app. Here is the code in react js:

  const { mutate: signAndExecuteTransactionBlock } = useSignAndExecuteTransactionBlock();
 const txb = new TransactionBlock();
      const gasBudgetAmount = Number(MIST_PER_SUI)*2;
      txb.setGasBudget(gasBudgetAmount);
      const [coin] = txb.splitCoins(txb.gas, [txb.pure(1)]);
      txb.moveCall({
      target: `${contractInfo.PACKAGE_ID}::protocol::mint`,
      arguments: [
        txb.pure(channelName),
        txb.pure("unstoppable channel"),
        txb.pure("https://assets-global.website-files.com/65cc508da73d6666440ac030/65cf601634658984e214a47c_CharMian_pfp_07_VisionGuy%20(1).png"),
        txb.object(contractInfo.CHANNEL_LIST),
        txb.object(contractInfo.RESERVE_CHANNEL_LIST),
        coin
      ],
    });

    signAndExecuteTransactionBlock(
    {
      transactionBlock: txb,
      chain: 'sui:devnet',
    },
    {
      onSuccess: (result) => {
        console.log('executed transaction block', result);
      }
    }  
    )

This is the function signature of the mint function:

public entry fun mint(
        name: String,
        description: String,
        url: String,
        channel_list: &mut ChannelList,
        reserved_channel_list: &mut ReservedChannelList,
        fee: &mut Coin<SUI>,
        ctx: &mut TxContext
    ) {

Connecting to Suiet wallet and calling the smart contract I am getting this error in the wallet:

MoveAbort(MoveLocation { module: ModuleId { address: 
8622d71a2522a4f2cde8481b3072d1730d1668f0bc79d2def4579ec362381d30, name: 
Identifier("protocol") }, function: 2, instruction: 49, function_name: 
Some("mint") }, 0) in command 1 | (RpcError:-5000) (code: -5000)

Connecting to Sui wallet and calling the smart contract I am getting this error in the wall for the same code:

Error: Invalid user signature: Signature is not valid: General cryptographic 
error: Groth16 proof verify failed

What does the errors indicate and How to resolve this?

Hey Tahlil, can you provide the full mint function? Seems that an assertion is breaking inside it.

@teohaik I ran it with the sui cli client it worked. So I am assuming the problem is in the frontend code.

Specifically this command worked:

sui client call --package 0x8622d71a2522a4f2cde8481b3072d1730d1668f0bc79d2def4579ec362381d30 --module protocol --function mint --gas-budget 1000000000 --args "Godzilla" "A test production channel" "https://i.ibb.co/KWFyxqc/gorilla-jacket-hood-871710-7964.jpg" "0xfcbbb8c30d4dff9e4cea35dca046e7dbb991910101b5e8cfffbd3916f3180d0f" "0xa39c4cc30925b3dc2c81aa35d79ed8730b3d7497ceaaf355b6a0304cd90bdbd1" "0x6be9a88dfd03468997742ee148396c10cdaf42aee11d6c406cbc218af2b3269e"

This is the full mint function:

public entry fun mint(
        name: String,
        description: String,
        url: String,
        channel_list: &mut ChannelList,
        reserved_channel_list: &mut ReservedChannelList,
        fee: &mut Coin<SUI>,
        ctx: &mut TxContext
    ) { 

        //Check channel names are available to mint or not
        assert!(query_channel(channel_list, name) == false, 0);
        assert!(query_resereve_channel(reserved_channel_list, name) == false, 0);

         let mint_fee = calculate_mint_fee(&name);
         assert!(coin::value(fee) >= mint_fee, EInsufficientFunds);
         let coin_balance = coin::balance_mut(fee);
         let paid = balance::split(coin_balance, mint_fee);
         transfer::public_transfer(coin::from_balance(paid, ctx), channel_list.contract_owner);
            
        //  balance::join(&mut nftshop.profits, paid);
    
        // create NFT Object
        let nft = NFT {
            id: object::new(ctx),
            channel_name: name,
            channel_description: description,
            url: url       
        };

        // get sender info
        let sender = tx_context::sender(ctx);
        // emit event
        event::emit(MintNFTEvent {
            object_id: object::uid_to_inner(&nft.id),
            creator: sender,
            name: nft.channel_name,
        });


        registry(channel_list, sender, name);
        // transfer nft to sender
        transfer::transfer(nft, sender)
    }