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 docs so web is imported by default #6112

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions docs/docs/guides/sign_and_send_tx/local_wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The simplest way to sign and send transactions is using a local wallet:

```ts
// First step: initialize `web3` instance
import { Web3 } from 'web3';
import Web3 from 'web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: add an account to wallet
Expand Down Expand Up @@ -45,7 +45,7 @@ List of references:

```ts
// First step: initialize `web3` instance
import { Web3 } from 'web3';
import Web3 from 'web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: add an account to wallet
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guides/sign_and_send_tx/raw.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar_label: 'Raw Transaction'

```ts
// First step: initialize web3 instance
import { Web3 } from 'web3';
import Web3 from 'web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: convert private key to account
Expand Down Expand Up @@ -43,7 +43,7 @@ List of references:

```ts
// First step: initialize web3 instance
import { Web3 } from 'web3';
import Web3 from 'web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: convert private key to account
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guides/sign_and_send_tx/wallet_of_eth_node.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If Eth node have unlocked account in its wallet you can send transaction without

```ts
// First step: initialize web3 instance
import { Web3 } from 'web3';
import Web3 from 'web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: add an account to the Ethereum node and unlock it
Expand Down Expand Up @@ -54,7 +54,7 @@ List of references:

```ts
// First step: initialize web3 instance
import { Web3 } from 'web3';
import Web3 from 'web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: add an account to the Ethereum node and unlock it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Actually, the events can be categorized as follows ([according to EIP 1193](http
Below a sample code for listening and remove listening to EIP 1193 events:

```ts
import { Web3 } from 'web3'
import Web3 from 'web3'

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

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/web3_providers_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_label: 'Providers'
Connecting to a chain happens through a provider. You can pass the provider to the constructor as in the following example:

```ts
import { Web3 } from 'web3';
import Web3 from 'web3';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Note that we are installing the latest version of 4.x, at the time of this tutor
Next, create a new file called `index.js` in your project directory and add the following code to it:

```javascript
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import { Web3 } from 'web3'`)
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)

// Set up a connection to the Ganache network
const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'));
Expand Down Expand Up @@ -214,7 +214,7 @@ Create a file named `deploy.js` and fill it with the following code:
```javascript
// For simplicity we use `web3` package here. However, if you are concerned with the size,
// you may import individual packages like 'web3-eth', 'web3-eth-contract' and 'web3-providers-http'.
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import { Web3 } from 'web3'`)
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const fs = require('fs');
const path = require('path');

Expand Down Expand Up @@ -289,7 +289,7 @@ In this step, we will use web3.js to interact with the smart contract on the Gan
Create a file named `interact.js` and fill it with the following code:

```javascript
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import { Web3 } from 'web3'`)
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const fs = require('fs');
const path = require('path');

Expand Down
2 changes: 1 addition & 1 deletion packages/web3-eth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*
* To use this package within the `web3` object use:
* ```ts
* import { Web3 } from 'web3';
* import Web3 from 'web3';
*
* const web3 = new Web3(Web3.givenProvider || 'ws://some.local-or-remote.node:8546');
* web3.eth.getBalance('0x407d73d8a49eeb85d32cf465507dd71d507100c1').then(console.log);
Expand Down