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

Update transactions.md #6783

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions docs/docs/guides/wallet/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ const account = web3.eth.accounts.privateKeyToAccount('0x4651f9c219fc6401fe0b3f8
// 3rd - create a raw transaction object
const rawTransaction = {
from: account.address,
to: '0x5875da5854c2adadbc1a7a448b5b2a09b26baff8', //random wallet
value: 1, //1 wei
gasPrice: await web3.eth.getGasPrice(),
gasLimit: 300000,
nonce: await web3.eth.getTransactionCount(account.address), //get the current nonce of the account
to: '0x5875da5854c2adadbc1a7a448b5b2a09b26baff8', //random wallet or contract address
value: 1, //optional - value in wei
maxFeePerGas: (await web3.eth.getBlock()).baseFeePerGas * 2n, //updated depending on the network
maxPriorityFeePerGas: 100000, //high
gasLimit: 2000000
nonce: await web3.eth.getTransactionCount(account.address), //optional - get the current nonce of the account
data: "0x0" //optional - encoded function signature and arguments
};

// 4th - sign the raw transaction with the private key
Expand Down Expand Up @@ -342,4 +344,4 @@ Confirmation: {
latestBlockHash: '0xb52380054ad2382620615ba7b7b40638021d85c5904a402cd11d00fd4db9fba9'
}
*/
```
```
Loading