Commit 152df378 authored by Kelvin Fichter's avatar Kelvin Fichter

feat(itests): use asL2Provider function

Replaces usage of injectL2Context with the new asL2Provider function
which is intended to eventually replace injectL2Context entirely.
parent dd4b2055
---
'@eth-optimism/integration-tests': patch
---
Use new asL2Provider function for integration tests
/* Imports: External */
import { ethers } from 'hardhat'
import { injectL2Context, expectApprox } from '@eth-optimism/core-utils'
import { expectApprox } from '@eth-optimism/core-utils'
import { predeploys } from '@eth-optimism/contracts'
import { asL2Provider } from '@eth-optimism/sdk'
import { Contract, BigNumber } from 'ethers'
/* Imports: Internal */
......@@ -21,7 +22,7 @@ import { Direction } from './shared/watcher-utils'
* must be equal to the blocknumber/timestamp of the L1 transaction.
*/
describe('OVM Context: Layer 2 EVM Context', () => {
const L2Provider = injectL2Context(l2Provider)
const L2Provider = asL2Provider(l2Provider)
let env: OptimismEnv
before(async () => {
env = await OptimismEnv.new()
......
/* Imports: Internal */
import { providers } from 'ethers'
import { injectL2Context, applyL1ToL2Alias } from '@eth-optimism/core-utils'
import { applyL1ToL2Alias } from '@eth-optimism/core-utils'
import { asL2Provider } from '@eth-optimism/sdk'
/* Imports: External */
import { expect } from './shared/setup'
......@@ -13,7 +14,7 @@ describe('Queue Ingestion', () => {
let l2Provider: providers.JsonRpcProvider
before(async () => {
env = await OptimismEnv.new()
l2Provider = injectL2Context(env.l2Wallet.provider as any)
l2Provider = asL2Provider(env.l2Wallet.provider as any)
})
// The batch submitter will notice that there are transactions
......
/* Imports: External */
import { expectApprox, injectL2Context, sleep } from '@eth-optimism/core-utils'
import { expectApprox, sleep } from '@eth-optimism/core-utils'
import { asL2Provider } from '@eth-optimism/sdk'
import { Wallet, BigNumber, Contract, ContractFactory, constants } from 'ethers'
import { serialize } from '@ethersproject/transactions'
import { ethers } from 'hardhat'
......@@ -26,7 +27,7 @@ describe('Basic RPC tests', () => {
let env: OptimismEnv
let wallet: Wallet
const provider = injectL2Context(l2Provider)
const provider = asL2Provider(l2Provider)
let Reverter: Contract
let ValueContext: Contract
......
......@@ -12,8 +12,12 @@ import {
getContractInterface,
predeploys,
} from '@eth-optimism/contracts'
import { injectL2Context, remove0x } from '@eth-optimism/core-utils'
import { CrossChainMessenger, NumberLike } from '@eth-optimism/sdk'
import { remove0x } from '@eth-optimism/core-utils'
import {
CrossChainMessenger,
NumberLike,
asL2Provider,
} from '@eth-optimism/sdk'
import { cleanEnv, str, num, bool, makeValidator } from 'envalid'
import dotenv from 'dotenv'
dotenv.config()
......@@ -112,17 +116,17 @@ export const envConfig = procEnv
export const l1Provider = new providers.JsonRpcProvider(procEnv.L1_URL)
l1Provider.pollingInterval = procEnv.L1_POLLING_INTERVAL
export const l2Provider = injectL2Context(
export const l2Provider = asL2Provider(
new providers.JsonRpcProvider(procEnv.L2_URL)
)
l2Provider.pollingInterval = procEnv.L2_POLLING_INTERVAL
export const replicaProvider = injectL2Context(
export const replicaProvider = asL2Provider(
new providers.JsonRpcProvider(procEnv.REPLICA_URL)
)
replicaProvider.pollingInterval = procEnv.REPLICA_POLLING_INTERVAL
export const verifierProvider = injectL2Context(
export const verifierProvider = asL2Provider(
new providers.JsonRpcProvider(procEnv.VERIFIER_URL)
)
verifierProvider.pollingInterval = procEnv.L2_POLLING_INTERVAL
......
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