Skip to content

Commit

Permalink
fix: return type of sendTransaction in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysu committed Nov 13, 2024
1 parent 0915cf4 commit 2ecc688
Showing 1 changed file with 63 additions and 21 deletions.
84 changes: 63 additions & 21 deletions packages/web3-eth/src/web3_eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1021,19 +1021,61 @@ export class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscrip
* value: '0x1'
* }
*
* const transactionHash = await web3.eth.sendTransaction(transaction);
* console.log(transactionHash);
* > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
* const transactionReceipt = await web3.eth.sendTransaction(transaction);
* console.log(transactionReceipt);
* > {
* blockHash: '0x39cee0da843293ae3136cee0de4c0803745868b6e72b7cd05fba395bffa0ee85',
* blockNumber: 6659547n,
* cumulativeGasUsed: 1029036n,
* effectiveGasPrice: 6765796845n,
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* gasUsed: 21000n,
* logs: [],
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
* status: 1n,
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
* transactionHash: '0x619de868dd73c07bd0c096adcd405c93c1e924fdf741e684a127a52324c28bb9',
* transactionIndex: 16n,
* type: 2n
*}
*
* web3.eth.sendTransaction(transaction).then(console.log);
* > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
* > {
* blockHash: '0x39cee0da843293ae3136cee0de4c0803745868b6e72b7cd05fba395bffa0ee85',
* blockNumber: 6659547n,
* cumulativeGasUsed: 1029036n,
* effectiveGasPrice: 6765796845n,
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* gasUsed: 21000n,
* logs: [],
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
* status: 1n,
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
* transactionHash: '0x619de868dd73c07bd0c096adcd405c93c1e924fdf741e684a127a52324c28bb9',
* transactionIndex: 16n,
* type: 2n
*}
*
* 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
* > {
* blockHash: '0x39cee0da843293ae3136cee0de4c0803745868b6e72b7cd05fba395bffa0ee85',
* blockNumber: 6659547n,
* cumulativeGasUsed: 1029036n,
* effectiveGasPrice: 6765796845n,
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* gasUsed: 21000n,
* logs: [],
* logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
* status: 1n,
* to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
* transactionHash: '0x619de868dd73c07bd0c096adcd405c93c1e924fdf741e684a127a52324c28bb9',
* transactionIndex: 16n,
* type: 2n
*}
* ```
*
*
Expand All @@ -1042,24 +1084,24 @@ export class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscrip
* ```ts
* web3.eth.sendTransaction(transaction).on('sending', transactionToBeSent => console.log(transactionToBeSent));
* > {
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
* value: '0x1',
* gasPrice: '0x77359400',
* maxPriorityFeePerGas: undefined,
* maxFeePerGas: undefined
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
* value: '0x1',
* gasPrice: '0x77359400',
* maxPriorityFeePerGas: undefined,
* maxFeePerGas: undefined
* }
* ```
* - `sent`
* ```ts
* web3.eth.sendTransaction(transaction).on('sent', sentTransaction => console.log(sentTransaction));
* > {
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
* value: '0x1',
* gasPrice: '0x77359400',
* maxPriorityFeePerGas: undefined,
* maxFeePerGas: undefined
* from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
* to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
* value: '0x1',
* gasPrice: '0x77359400',
* maxPriorityFeePerGas: undefined,
* maxFeePerGas: undefined
* }
* ```
* - `transactionHash`
Expand Down Expand Up @@ -1090,8 +1132,8 @@ export class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscrip
* ```ts
* web3.eth.sendTransaction(transaction).on('confirmation', confirmation => console.log(confirmation));
* > {
* confirmations: 1n,
* receipt: {
* confirmations: 1n,
* receipt: {
* transactionHash: '0xb4a3a35ae0f3e77ef0ff7be42010d948d011b21a4e341072ee18717b67e99ab8',
* transactionIndex: 0n,
* blockNumber: 5n,
Expand All @@ -1105,8 +1147,8 @@ export class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscrip
* status: 1n,
* effectiveGasPrice: 2000000000n,
* type: 0n
* },
* latestBlockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548'
* },
* latestBlockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548'
* }
* ```
* - `error`
Expand Down

0 comments on commit 2ecc688

Please sign in to comment.