title: How to pass a string to a setter function in solidity?
body: <p>I am trying to execute a simple function in solidity where I pass a value to a <code>set()</code> function and it stores it in a predeclared variable in the Smart Contract.</p>
  
  <p>The initial code presented by <code>truffle unbox react</code> works fine.
  You pass it an <code>int</code> and it returns the transaction hash.However, if I pass it a string, it throws me an error.</p>
  
  <p>This is the initial code/contract provided by <code>truffle unbox react</code> </p>
  
  <pre><code>react.pragma solidity ^0.5.0;
  
  contract SimpleStorage {
    uint storedData;
  
    function set(uint x) public {
      storedData = x;
    }
  
    function get() public view returns (uint) {
      return storedData;
    }
  }
  </code></pre>
  
  <p>I call it like so,</p>
  
  <pre><code>  componentDidMount = async () =&gt; {
      try {
        const web3 = await getWeb3();
        const accounts = await web3.eth.getAccounts();
        const networkId = await web3.eth.net.getId();
        const deployedNetwork = SimpleStorageContract.networks[networkId];
        const contract = new web3.eth.Contract(
          SimpleStorageContract.abi,
          deployedNetwork &amp;&amp; deployedNetwork.address
        );
        this.setState({ web3, accounts, contract });
      } catch (error) {
        alert(
          `Failed to load web3, accounts, or contract. Check console for details.`
        );
      }
    };
  </code></pre>
  
  <p>This is the function,</p>
  
  <pre><code>contract.methods.set(5).send({ from: accounts[0] });
  const response = await contract.methods.get().call();
  </code></pre>
  
  <p>This is the new contract:</p>
  
  <pre><code>pragma solidity ^0.5.0;
  
  contract SimpleStorage {
    string storedData;
  
    function set(string memory x) public {
      storedData = x;
    }
  
    function get() public view returns (string memory) {
      return storedData;
    }
  }
  </code></pre>
  
  <p>And I call like so,</p>
  
  <pre><code>contract.methods.set("5").send({ from: accounts[0] });
  const response = await contract.methods.get().call();
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>errors.js:85 Uncaught (in promise) Error: insufficient data for dynamicBytes length (arg="", coderType="dynamicBytes", value="0x000000000000000000000000000000000000000000000000000000000005", version=4.0.33)
  </code></pre>
  
  <p>What am I doing wrong?</p>