ethers.js: Confirmations undefined on response from JsonRpcProvider.sendTransaction
Describe the bug
TransactionResponse
declared confirmations
as required when it appears to be optional. I am hitting some public MATIC mainnet nodes, so not 100% sure if this is a typing issue brought about by the differences in JsonRPC there. I am hitting ethers.providers.JsonRpcProvider.sendTransaction
Reproduction steps
this.mSecondaryProviders.forEach((aProvider: ethers.providers.JsonRpcProvider): void =>
{
console.log("Sending to provider:", aProvider.connection.url);
aProvider.sendTransaction(lSignedTransaction)
.then((aResponse: ethers.providers.TransactionResponse): void =>
{
console.log(aProvider.connection.url, "succeeded");
console.log(aResponse);
console.log("Confirmations:", aResponse.confirmations);
if (aResponse.confirmations > 0)
{
lTransactionHash = aResponse.hash;
}
})
.catch((aError: any): void =>
{
console.error(aProvider.connection.url, " had an error");
});
});
Console output:
Sending to provider: https://rpc-mainnet.matic.network
Sending to provider: https://rpc-mainnet.maticvigil.com
Sending to provider: https://rpc-mainnet.matic.quiknode.pro
Sending to provider: https://matic-mainnet.chainstacklabs.com
Sending to provider: https://matic-mainnet-full-rpc.bwarelabs.com
Sending to provider: https://matic-mainnet-archive-rpc.bwarelabs.com
https://rpc-mainnet.maticvigil.com succeeded
{
nonce: 170,
gasPrice: BigNumber { _hex: '0x01a13b8600', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x1e8480', _isBigNumber: true },
to: 'redacted',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: 'redacted',
chainId: 137,
v: 309,
r: 'redacted',
s: 'redacted',
from: 'redacted',
hash: 'redacted',
type: null,
wait: [Function (anonymous)]
}
Confirmations: undefined
https://rpc-mainnet.matic.quiknode.pro had an error
https://matic-mainnet.chainstacklabs.com had an error
https://rpc-mainnet.matic.network had an error
https://matic-mainnet-archive-rpc.bwarelabs.com had an error
Environment:
Node: v16.2
Ethers: v5.3.1
Search Terms Often similar issues have come up before. Include any search terms you have tried in this repository’s Issues (including closed issues) and “Discussions”, so if there are matching issues, we can be sure to add those keywords and link this issue to it, making it easier for people to find in the future.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (9 by maintainers)
Commits related to this issue
- Fixed null confirmations in Wallet transaction (#1706). — committed to ethers-io/ethers.js by ricmoo 3 years ago
I’ve fixed it locally, but have a few other changes I am working on. It will go out with the next release. 😃
@ricmoo I see, makes sense. Cheers!