Skip to content

Commit

Permalink
Merge branch '4.x' into 4195-plans-to-support-eth_maxpriorityfeeperga…
Browse files Browse the repository at this point in the history
…s-method
  • Loading branch information
Alex authored Jan 30, 2024
2 parents cee695a + a72e99a commit 229fdd0
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 43 deletions.
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Further details about versioning can be found in the [semver 2.0.0 specification

`E2E Network Tests` will be triggered to run via a Github workflow when a PR is open for a branch prefixed with `release/` and is being merged into `4.x` branch. These tests depend on a couple of ENVs to be set that are configurable in Github's Action Secrets when running these tests in CI. The following required secrets are:

- `E2E_TESTS_ALLOWED_SEND_TRANSACTION`: If set to `false` this will keep the Sepolia tests that spend ETH from runnning, setting to anything else will cause them to run
- `E2E_TESTS_ALLOWED_SEND_TRANSACTION`: If set to `false` this will keep the Sepolia tests that spend ETH from running, setting to anything else will cause them to run
- `TEST_ACCOUNT_PRIVATE_KEY`: The private key of the Sepolia account to use when submitting transactions
- `INFURA_SEPOLIA_HTTP`: The provider to be used to access the Sepolia network
- `INFURA_MAINNET_HTTP`: The provider to be used to access Mainnet
Expand Down Expand Up @@ -54,7 +54,7 @@ Further details about versioning can be found in the [semver 2.0.0 specification

- Select recently pushed tag in `choose a tag` drop down

- Check `Set as the latest release` if its latest release else select `This is a pre-release` if its not main release e.g. if its `RC` or `alpha`
- Check `Set as the latest release` if its latest release else select `This is a pre-release` if it's not main release e.g. if it's `RC` or `alpha`

- Check `Create a discussion for this release`

Expand Down
66 changes: 30 additions & 36 deletions docs/docs/guides/wallet/local_wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,47 @@ If used within the browser, wallets are not saved anywhere and disappear when th
If used within your application, wallets will disappear after the program is completed.
:::

## Create an account and add it to an empty `Wallet`
## Create a `Wallet` with a random account

```ts title='Creating an Account and Adding it to an Empty Wallet'
import { Web3 } from 'web3';
```ts title= Create Wallet with random account
import { Web3 } from "web3";

const web3 = new Web3(/* PROVIDER */);

// 1st - creating a new empty wallet (0 accounts inside)
const wallet = web3.eth.accounts.wallet.create();

console.log(wallet);
/*
* creates wallet with 1 account
* @param: number of accounts you want to create within the wallet
*/
const wallet = web3.eth.accounts.wallet.create(1);
/*
Wallet(0) [
Wallet(1) [
{
address: '0xE0A7859c5454B369Ab8089890A11efcB458eA13c',
privateKey: '0x0199829f0c95213670d48aa48abdb36c16c2ec3d11fe20e1fa8c0270ffb64110',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt]
},
_accountProvider: {
create: [Function: createWithContext],
privateKeyToAccount: [Function: privateKeyToAccountWithContext],
decrypt: [Function: decryptWithContext]
},
_addressMap: Map(0) {},
_addressMap: Map(1) { '0xe0a7859c5454b369ab8089890a11efcb458ea13c' => 0 },
_defaultKeyName: 'web3js_wallet'
]
*/
```

// 2nd - create an account
const account = web3.eth.accounts.create();
## Create an account and add it to an empty `Wallet`

```ts title='Creating an Account and add it to a Wallet'
import { Web3 } from "web3";

const web3 = new Web3(/* PROVIDER */);

console.log(account)
// 1st - creating a new account
const account = web3.eth.accounts.create();
/*
{
address: '0x0770B4713B62E0c08C43743bCFcfBAA39Fa703EF',
Expand All @@ -50,10 +64,8 @@ console.log(account)
}
*/

// 3rd - add the account to the wallet
web3.eth.accounts.wallet.add(account);

console.log(wallet);
// 2nd - add the account to the wallet
const wallet = web3.eth.accounts.wallet.add(account);
/*
Wallet(1) [
{
Expand Down Expand Up @@ -81,27 +93,9 @@ import { Web3 } from 'web3';

const web3 = new Web3(/* PROVIDER */);

// 1st - creating a new empty wallet
const wallet = web3.eth.accounts.wallet.create()

console.log(wallet);
/*
> Wallet(0) [
_accountProvider: {
create: [Function: createWithContext],
privateKeyToAccount: [Function: privateKeyToAccountWithContext],
decrypt: [Function: decryptWithContext]
},
_addressMap: Map(0) {},
_defaultKeyName: 'web3js_wallet'
]
*/

// 2nd - add an account to the wallet using a private key
// add an account to the wallet using a private key
const privateKey = '0x4651f9c219fc6401fe0b3f82129467c717012287ccb61950d2a8ede0687857ba'
web3.eth.accounts.wallet.add(privateKey);

console.log(wallet);
const wallet = web3.eth.accounts.wallet.add(privateKey);
/*
Wallet(1) [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/web3_eth/eth.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ transactionHash {
98999580000000000000 + 1000000000000000000 + (20000000000\*21000) = 100 Ether
:::

In the next example, we are going to use `estimateGas` function to see the expected gas for contract deployment. (For more on contracts, please see the corresponding tutotial). Create a file named `estimate.ts` and fill it with the following code:
In the next example, we are going to use `estimateGas` function to see the expected gas for contract deployment. (For more on contracts, please see the corresponding tutorial). Create a file named `estimate.ts` and fill it with the following code:

```typescript
import { Web3, ETH_DATA_FORMAT, DEFAULT_RETURN_FORMAT } from 'web3';
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/web3_plugin_guide/plugin_authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ It is important to note that the plugin name should be structured as `@<organiza
}
```

When your users install your plugin, this will allow the package manager to make use of the user installed `web3` if available and if the version satisfies the version constraints instead of installing it's own version of `web3`.
When your users install your plugin, this will allow the package manager to make use of the user installed `web3` if available and if the version satisfies the version constraints instead of installing its own version of `web3`.

## Add New Transaction Type

Expand Down
2 changes: 1 addition & 1 deletion packages/web3-eth-accounts/test/unit/tx/legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('[Transaction]', () => {
expect(tx.r!.toString(16)).toBe('5');
});

it('Initialization -> throws when creating a a transaction with incompatible chainid and v value', () => {
it('Initialization -> throws when creating a transaction with incompatible chainid and v value', () => {
let common = new Common({ chain: Chain.Goerli, hardfork: Hardfork.Petersburg });
let tx = Transaction.fromTxData({}, { common });
expect(tx.common.chainId()).toEqual(BigInt(5));
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ yarn add web3-validator

### Usage

You can use the the validator by importing as and using to validate;
You can use the validator by importing as and using to validate;

```ts
import { validator } from 'web3-validator';
Expand Down
2 changes: 1 addition & 1 deletion packages/web3/test/integration/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
jest.mock('web3-eth');

describe('Contract', () => {
describe('Contract use the the context wallet', () => {
describe('Contract use the context wallet', () => {
it('should work when created as web.eth.Contract', async () => {
const web3 = new Web3('https://rpc2.sepolia.org');
const contract = new web3.eth.Contract(
Expand Down

1 comment on commit 229fdd0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 229fdd0 Previous: 6c075db Ratio
processingTx 9466 ops/sec (±3.71%) 9301 ops/sec (±4.81%) 0.98
processingContractDeploy 40698 ops/sec (±6.99%) 39129 ops/sec (±7.62%) 0.96
processingContractMethodSend 20150 ops/sec (±4.56%) 19443 ops/sec (±5.19%) 0.96
processingContractMethodCall 38920 ops/sec (±6.04%) 38971 ops/sec (±6.34%) 1.00
abiEncode 43215 ops/sec (±8.30%) 44252 ops/sec (±6.92%) 1.02
abiDecode 32292 ops/sec (±7.00%) 30419 ops/sec (±8.89%) 0.94
sign 1666 ops/sec (±1.60%) 1656 ops/sec (±4.08%) 0.99
verify 370 ops/sec (±0.56%) 373 ops/sec (±0.78%) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.