Cannot read properties of undefined (reading 'toHexString')

I’m not converting anything I’m just passing string to all params ,
except on the _salt parameter I do not set any value
what I’m trying to do is to interact with this function

can you show me where exactly you are getting the error ?
you can pass all as a string, but the _salt should be in byte so the smart contract can processed it

1 Like

This error happens when use useWeb3Contract hook to execute on-chain function

the function i am using to runc contract is this one

const runContract = useWeb3ExecuteFunction()
 async function createEventFunc() {
        let options = {
          chain: "rinkeby",
          contractAddress:  "0xD8C88BE5e8EB88E38E6ff5cE186d764676012B0b",
          functionName: "createLock",
           abi: unlockABI2,
           //Parameters 
           params: {
            _expirationDuration: "100",
            _tokenAddress:  "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",  //USDC ADDRESS
            _keyPrice:   "120",
            _maxNumberOfKeys: "300",
            _lockName: "abdul",
            
          },
         
           
        }
        await runContract({
          params: options,
          onSuccess:() =>{
            alert("you  have  succesful  ran  function")
          },
          onError: (errori) =>{
            alert(errori.message)
          }
        })
        console.log("clicked button")
      }

as unlock team said the _salt parameter is deprecated I don’t pass it I omitted it
also this is PROXY contract is there defference between interacting with proxy contract and noraml contract in moralis ??

@0xprof i saw your member of unlock discord server can you take look in developer group today’s discussion, The conversation is related to this question i think this will help to know the source of error

No, they should be the same
ok, i will take a look

thank you i’ll be waiting :blush: for your help

Got another idea

someone answered :point_down:t3:

It shows the smart contract is output format not readable by moralis

is there any way to console the result of smart contract in console ??

This function will not return output as long as it isnt view
Although it has a returns and returns

1 Like

Good Morning everyone @0xprof @cryptokid I’m still in lockdown because of this error :sweat_smile: Let’s try this
can you guy’s try to run / interact this function it may help us to know the source of this error function info :point_down:t3:

contractAddress: ‘0xD8C88BE5e8EB88E38E6ff5cE186d764676012B0b’
this function ABI: [ {"inputs":[{"internalType":"uint256","name":"_expirationDuration","type":"uint256"}, {"internalType":"address","name":"_tokenAddress","type":"address"}, {"internalType":"uint256","name":"_keyPrice","type":"uint256"}, {"internalType":"uint256","name":"_maxNumberOfKeys","type":"uint256"}, {"internalType":"string","name":"_lockName","type":"string"}, {"internalType":"bytes12","name":"","type":"bytes12"}],"name":"createLock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},]

functionName : “createLock”

and these are required parameters
https://docs.unlock-protocol.com/unlock/developers/smart-contracts/unlock-api#createlock
NOTE: _salt Parameter is deprecated don’t use it

if something is in an abi, you should pass it, even if the salt is not required, if it is in the abi, it should be passed from the front end

In this new version there is no salt param
in ABI