Skip to content

Commit

Permalink
update docs so web is imported by default (#6112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex authored May 23, 2023
1 parent 3b95b5e commit bf1311f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
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
2 changes: 1 addition & 1 deletion docs/docs/guides/web3_providers_guide/events_listening.md
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

0 comments on commit bf1311f

Please sign in to comment.