0

I have a smart contract contains this method:

function addOneUser (User memory _user) public {

         bytes32 hash = keccak256(abi.encode(_user.name));
         users[hash] = _user;

    }

I want to invoke this method using singTransaction then sendSignedTransaction, how to encode data (which _user) into transaction raw ?

maroodb
  • 1,111
  • 1
  • 10
  • 32

1 Answers1

-1

In current versions of Solidity you cannot send struct type parameters to the methods unless you use experimental mode using this statement in the header:

pragma experimental ABIEncoderV2;

You should see this question for more details: Passing Struct as an argument in call

Alireza Zojaji
  • 594
  • 8
  • 28
  • the question about signing a transaction, the code above is not the full smart contract, unless you can say also: "you can not declare function outside contract {...}" – maroodb Sep 26 '19 at 08:18