This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
docs - sendtransaction has wrong return in docs #7185
Closed
Description
https://docs.web3js.org/api/web3/class/Web3Eth#sendTransaction
sendTransaction will return a receipt object, not transactionHash
const transaction = {
from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
value: '0x1'
}
const transactionHash = await web3.eth.sendTransaction(transaction);
console.log(transactionHash);
> 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
web3.eth.sendTransaction(transaction).then(console.log);
> 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
web3.eth.sendTransaction(transaction).catch(console.log);
> <Some TransactionError>
// Example using options.ignoreGasPricing = true
web3.eth.sendTransaction(transaction, undefined, { ignoreGasPricing: true }).then(console.log);
> 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
Expected behavior
Actual behavior
Steps to reproduce the behavior
- [First step]
- [Second step]
- [and so on...]