How to call a "safeMint" and send Ether at the same time to pay the mint NFT price?


I would like to ask for help.

I create classic 721 contract , wrapped it using web3j and I am able to deploy, mint, transfret , etc…

But now, I have changed my mint function, so user needs to send ether to mint the NFT (based on the tutorial), so the function is payable

    function safeMint(address to, string memory uri) public payable  returns (uint256)   {
        require(msg.value == MINT_PRICE, "Transaction value did not equal the mint price");
        uint256 tokenId = _tokenIdCounter.current();
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, uri);
        return tokenId;

in my wrapped Java class, how can I please mint and send ether at the same time? I am not able to figure this out, thanks.

with best regards

found a solution here

I will try that.