ethers.js
ethers.js copied to clipboard
provider.getTransaction hangs for contract deploy transactions
Ethers Beta Version
6.0.0-beta.9
Describe the Problem
While deploying contracts using the sendTransaction way:
const tx = await signer.sendTransaction({
data: "0x" + json.evm.bytecode.object,
});
I noticed that this promise doesn't resolve. When looked into rpc logs, saw that it does an eth_getTransactionByHash
call and I tried that which gave me an error. Please see the code snippet on which this error can be reproduced with a mainnet contract deployment tx hash.
Code Snippet
const provider = new AlchemyProvider();
console.log(
await provider.getTransaction(
"0xa4e10b0578187107bf533d0a6c1106c79cc9ce91a1fd662961d9b2a97c80634b"
)
);
Errors
% node contract.js
file:///Users/sohamzemse/Workspace/ethers-v6/node_modules/@ethersproject/logger/lib/logger.js:81
const error = (new create(message));
^
Error: invalid value for value.to (invalid address (argument="address", value=null, code=INVALID_ARGUMENT, version=@ethersproject/[email protected])) (value={"hash":"0xa4e10b0578187107bf533d0a6c1106c79cc9ce91a1fd662961d9b2a97c80634b","blockHash":"0x68a585dc6965bce72e7658b3f350e96c1911dca116a2ae10fd0ecf20a51da4d0","blockNumber":"0x883b8d","chainId":"0x1","from":"0xddb108893104de4e1c6d0e47c42237db4e617acc","gas":"0x6acfc0","gasPrice":"0x218711a00","input":"0x60806040526.....lot-of-bytecode.......728b6acd372d00000000000000000000000084f2b4648990d93c0f478d5d82d3c38d98a4ee91","gasLimit":"0x6acfc0"}, code=BAD_DATA, version=@ethersproject/[email protected])
at Logger.makeError (file:///Users/sohamzemse/Workspace/ethers-v6/node_modules/@ethersproject/logger/lib/logger.js:81:24)
at Logger.throwError (file:///Users/sohamzemse/Workspace/ethers-v6/node_modules/@ethersproject/logger/lib/logger.js:91:20)
at Object.transactionResponse (file:///Users/sohamzemse/Workspace/ethers-v6/node_modules/@ethersproject/providers/lib/formatter.js:388:28)
at Formatter.transactionResponse (file:///Users/sohamzemse/Workspace/ethers-v6/node_modules/@ethersproject/providers/lib/formatter.js:184:70)
at AlchemyProvider.getTransaction (file:///Users/sohamzemse/Workspace/ethers-v6/node_modules/@ethersproject/providers/lib/abstract-provider.js:437:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///Users/sohamzemse/Workspace/ethers-v6/contract.js:23:3 {
code: 'BAD_DATA',
value: {
hash: '0xa4e10b0578187107bf533d0a6c1106c79cc9ce91a1fd662961d9b2a97c80634b',
blockHash: '0x68a585dc6965bce72e7658b3f350e96c1911dca116a2ae10fd0ecf20a51da4d0',
blockNumber: '0x883b8d',
chainId: '0x1',
from: '0xddb108893104de4e1c6d0e47c42237db4e617acc',
gas: '0x6acfc0',
gasPrice: '0x218711a00',
input: '0x6080604052601e805460ff1916905....lot-of-bytecode....
nonce: '0x4c9',
r: '0xd2c30107b91ffd71e39dd89814e3463884a9989a838d067b678c7af352ba8377',
s: '0x1fa3f63e29213d5850bd4bed9853ad7b54cb5223828ec964e37051a16c07b509',
to: null,
transactionIndex: '0x3',
v: '0x26',
value: '0x0',
data: '0x608060405....lot-of-bytecode....
gasLimit: '0x6acfc0'
}
}
Environment
node.js
Environment (Other)
No response
hi ricmoo i am interested in resolving this issue. can you help me in that?