0

I am trying to deploy a contract on react. But I can't seem to pull it off :(

This is my code:

this.myContract.deploy({
          data:[big boi bytecode here],
          arguments: ['name', 'description', 20, 20]
      });

And this is the error I am receiving: "TypeError: this.gamechanger.deploy is not a function"

I have also tried using:

this.myContract.deployed().then(() => [...]

However, it would not deploy.

How should I go about doing this? Help would be insanely appreciated!

P.s. I am using Web3 version 1.2.6

0

It looks like this.myContract is undefined in your scope.

Also you forgot .send() to deploy a contract

Example:

this.myContract.deploy({
   data:[big boi bytecode here], // Don't forget about '0x' on the start of bytecode
   arguments: ['name', 'description', 20, 20]
}).send({ from: account });

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.