I want to deploy transaction with raw transaction without using hardhat or web3 method.
my code looks like this.
// constructor params
const name = 'My Contract';
const symbol = 'MC';
const maxSupply = 500;
const baseURI = 'https://sample/link';
const jsonRpcProvider = new ethers.providers.JsonRpcProvider(MUMBAI_URL);
const executer = new Wallet(PRIVATE_KEY, jsonRpcProvider);
const executerAddress = await executer.getAddress();
const MyContractAbi = new ethers.utils.Interface(MyContract__factory.abi);
const constructorEncodedData = MyContractAbi.encodeDeploy([name, symbol, maxSupply, baseURI]);
const txData = hexlify(concat([MyContract__factory.bytecode, constructorEncodedData]));
const unserializedTx = {
to: '0x0000000000000000000000000000000000000000',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: txData,
gasLimit: BigNumber { _hex: '0x1e8480', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x06fc23ac00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x06fc23ac00', _isBigNumber: true },
nonce: 28,
type: 2,
chainId: 80001
};
const signedTx = await executer.signTransaction(unserializedTx);
const txResponse = await (await jsonRpcProvider.sendTransaction(signedTx)).wait();
when I send transaction, it does executed, but it doesn't seem to create contract.
my transaction result link is here.
I refer to 'deploy' method in @ethersproject, but I don't know why it doesn't work.
any ideas?