Hi everyone,
I am trying automatically deploy a smart contract when user enters certain parameters and clicks the create button. I am using solc to compile the smart contract and then deploy it using web3.js. I am following a Youtube tutorial to learn so please donât assume I know my stuff To do that I need the user to sign. âweb3.eth.accounts.signTransaction()â method requires âfrom addressâ and âprivate keyâ. Is it possible to call a Moralis method to do the signing here instead of the web3.js method? The user is already logged in using Moralis Web3 Auth. So what I want to do basically is replace the âweb3.eth.accounts.signTransaction()â with a Moralis function or call the current wallet provider to do the signing and filling the âfrom: addressâ in this function. If you have any knowledge about this please let me know. Thank you in advance!
const erc20Minter = new web3.eth.Contract(abi);
const deployTx = erc20Minter.deploy({
data: bytecode
});
const createTransaction = await web3.eth.accounts.signTransaction({
from: myAddress, //HERE
data: deployTx.encodeABI(),
gas: '4000000000',
},
privateKey //HERE
);
const createReceipt = await web3.eth.sendSignedTransaction(
createTransaction.rawTransaction
);