Skip to content

Commit

Permalink
updated web3.js v4 import and link
Browse files Browse the repository at this point in the history
  • Loading branch information
web3js-org committed Dec 13, 2023
1 parent 92bd6d1 commit 4fb8511
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/base-docs/docs/tools/web3.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: Documentation for using web3.js, a JavaScript library for interacti
keywords:
[
web3.js,
web3.js v4,
Base,
Base mainnet,
Base testnet,
Expand All @@ -21,7 +22,7 @@ keywords:

# web3.js

[web3.js](https://web3js.readthedocs.io/) is a JavaScript library that allows developers to interact with EVM-compatible blockchain networks.
[web3.js](https://web3js.org/) is a JavaScript library that allows developers to interact with EVM-compatible blockchain networks.

You can use web3.js to interact with smart contracts deployed on the Base network.

Expand All @@ -42,15 +43,19 @@ Before you can start using web3.js, you need to import it into your project.
Add the following line of code to the top of your file to import web3.js:

```javascript
//web3.js v1
const Web3 = require('web3');

//web3.js v4
const {Web3} = require('web3');
```

## Connecting to Base

You can connect to Base by instantiating a new web3.js `Web3` object with a RPC URL of the Base network:

```javascript
const Web3 = require('web3');
const {Web3} = require('web3');

const web3 = new Web3('https://mainnet.base.org');
```
Expand Down

0 comments on commit 4fb8511

Please sign in to comment.