Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs - sendtransaction has wrong return in docs #7185

Open
luu-alex opened this issue Aug 4, 2024 · 0 comments
Open

docs - sendtransaction has wrong return in docs #7185

luu-alex opened this issue Aug 4, 2024 · 0 comments
Labels
4.x 4.0 related Documentation Relates to project wiki or documentation P3 Low severity bugs

Comments

@luu-alex
Copy link
Contributor

luu-alex commented Aug 4, 2024

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

  1. [First step]
  2. [Second step]
  3. [and so on...]

Logs

Environment

@luu-alex luu-alex added Documentation Relates to project wiki or documentation 4.x 4.0 related labels Aug 4, 2024
@mconnelly8 mconnelly8 added the P3 Low severity bugs label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Documentation Relates to project wiki or documentation P3 Low severity bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants