[SOLVED] Params passed through write method of Moralis.executeFunction is not being read by smart contract

ABI

{
  "inputs": [
    {
      "internalType": "address",
      "name": "to",
      "type": "address"
    }
  ],
  "name": "initializeBundle",
  "outputs": [
    {
      "internalType": "uint256",
      "name": "",
      "type": "uint256"
    }
  ],
  "stateMutability": "nonpayable",
  "type": "function"
}

CODE

const options = {
            functionName: 'initializeBundle',
            contractAddress: '0x19',
            abi: AssetWrapperABI.abi,
            params: { 
              to: nft.token_address
            }
          }

          const bundle = await Moralis.executeFunction(options)

          await bundle.wait(3);

Looks correct to me, what do you mean params not being read? any error you get in the console?

here you had a real address?

Yes I have cropped the full address

intializeBundle accepts a parameter called to, I have tried passing under params object in option but the value to is not being read by the smart contract, I’m not getting where the issue is coming from, I have synced the abi in server.

you have close to latest version of Moralis SDK?

yes 1.0.0 is the current moralis version that I’m using

does your code look similar to this: https://docs.moralis.io/moralis-server/web3/web3#executefunction

for example on how abi has []

Yes, I have abi in an array which looks similar to the documentation.

what is the error that you get? when you get that error?
can you provide full code?

It is not really an error but the parameter to is not being read by the initializeBundle function inside smart contract, so it is returing to is required.

Code

          const options = {
            functionName: 'initializeBundle',
            contractAddress: '0x19',
            abi: AssetWrapperABI.abi,
            params: { 
              to: nft.token_address
            }
          }

          const bundle = await Moralis.executeFunction(options)

          await bundle.wait(3);

try this:

const options = {
            functionName: 'initializeBundle',
            contractAddress: '0x19',
            abi: AssetWrapperABI.abi,
            to: nft.token_address
          }

Did tried that, but the issue remains the same, and by the way smart contract and server are up in Rinkeby testnet, if that helps.

did you try with runContractFunction?

I think runContractFunction is for read only functions, but I did tried it is throwing you can use only readOnly functions alike.

ok, you can try to use this for the abi:

{
  "inputs": [
    {
      "internalType": "address",
      "name": "to_2",
      "type": "address"
    }
  ],
  "name": "initializeBundle",
  "outputs": [
    {
      "internalType": "uint256",
      "name": "",
      "type": "uint256"
    }
  ],
  "stateMutability": "nonpayable",
  "type": "function"
}

Same issue persists after testing your solution.

how did you test it? what is the error now?

I did made changes to smart contract as you suggested in abi redeployed the smart contract and tested, same to_2 is required is the message returned after request.

you didn’t have to redeploy the smart contract, only to change the abi

what parameters are you using now?