Skip to content
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
@luu-alex

Description

@luu-alex

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

Metadata

Metadata

Assignees

Labels

4.x4.0 relatedDocumentationRelates to project wiki or documentationP3Low severity bugs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions