Commit 5d1a445e authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6873 from ethereum-optimism/wyatt/web3js-plugin/update-readme

Update code examples in README
parents 4bb2e6c6 fdab6caa
---
'@eth-optimism/web3.js-plugin': patch
---
Update code exmaples in README
...@@ -28,10 +28,10 @@ yarn add @eth-optimism/web3.js-plugin ...@@ -28,10 +28,10 @@ yarn add @eth-optimism/web3.js-plugin
```typescript ```typescript
import Web3 from 'web3' import Web3 from 'web3'
import OptimismFeeEstimationPlugin from '@eth-optimism/web3.js-plugin' import { OptimismPlugin } from '@eth-optimism/web3.js-plugin'
const web3 = new Web3('http://yourProvider.com') const web3 = new Web3('http://yourProvider.com')
web3.registerPlugin(new OptimismFeeEstimationPlugin()) web3.registerPlugin(new OptimismPlugin())
``` ```
You will now have access to the following functions under the `op` namespace, i.e. `web3.op.someMethod` You will now have access to the following functions under the `op` namespace, i.e. `web3.op.someMethod`
...@@ -76,12 +76,15 @@ async estimateFees(transaction: Transaction, returnFormat?: ReturnFormat) ...@@ -76,12 +76,15 @@ async estimateFees(transaction: Transaction, returnFormat?: ReturnFormat)
```typescript ```typescript
import Web3 from 'web3' import Web3 from 'web3'
import { OptimismPlugin } from '@eth-optimism/web3.js-plugin'
import { import {
l2StandardBridgeABI, l2StandardBridgeABI,
l2StandardBridgeAddress, l2StandardBridgeAddress,
} from '@eth-optimism/contracts-ts' } from '@eth-optimism/contracts-ts'
const web3 = new Web3('https://mainnet.optimism.io') const web3 = new Web3('https://mainnet.optimism.io')
web3.registerPlugin(new OptimismPlugin())
const l2BridgeContract = new web3.eth.Contract( const l2BridgeContract = new web3.eth.Contract(
l2StandardBridgeABI, l2StandardBridgeABI,
optimistAddress[420] optimistAddress[420]
...@@ -117,12 +120,15 @@ console.log(totalFee) // 26608988767659n ...@@ -117,12 +120,15 @@ console.log(totalFee) // 26608988767659n
```typescript ```typescript
import Web3 from 'web3' import Web3 from 'web3'
import { OptimismPlugin } from '@eth-optimism/web3.js-plugin'
import { import {
l2StandardBridgeABI, l2StandardBridgeABI,
l2StandardBridgeAddress, l2StandardBridgeAddress,
} from '@eth-optimism/contracts-ts' } from '@eth-optimism/contracts-ts'
const web3 = new Web3('https://mainnet.optimism.io') const web3 = new Web3('https://mainnet.optimism.io')
web3.registerPlugin(new OptimismPlugin())
const l2BridgeContract = new web3.eth.Contract( const l2BridgeContract = new web3.eth.Contract(
l2StandardBridgeABI, l2StandardBridgeABI,
optimistAddress[420] optimistAddress[420]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment