Struct signed signature is not verifying onchain

Hi Community,

I have been stuck in an issue. I have been using Opensea Seaport contracts for my NFT marketplace order settlement. All stuff is done except signature verification.

We have been passing a struct tuple which contains signature of other struct tuple. When I generate and pass tuple, signature is mismatched.

Can anyone help me out. @abcoathup #support

Here is my existing code in smart contract

 struct OfferItem {
    uint256 startAmount;
 struct OrderComponents {
    address offerer;
    OfferItem[] offer;

 function verifyOwnerSignature(bytes32 hash, bytes memory signature) public view returns(address){
     return hash.toEthSignedMessageHash().recover(signature);

Here is my code on JS side

const encode_value = web3.eth.abi.encodeParameter({
"OrderComponents": {
       "offerer": 'address',
            "OfferItem": [{
                  "startAmount": 'uint256'
    "offerer": '0xe2b5a5b611643c7e0e4D705315bf580B75472d7b',
          "OfferItem": [{
              "startAmount": 1

 const privateKey = process.env.PRIVATE_KEY;
 const hashGettingFromECDSAAfterPassingTheStructHash = web3.eth.accounts.hashMessage(structHash);
 const signature = web3.eth.accounts.sign(structHash, privateKey);
 const signerAddress = web3.eth.accounts.recover(structHash, signature.signature);

The signature onchain and offchain mismatches. Please help me out.

I don't understand, are you interacting with Seaport? If so why are you validating the signature yourself?

Seaport uses EIP-712 signatures. Check out eth-sig-util to generate these signatures using web3.js.
For ethers.js, look for signTypedData.