Skip to content

Commit

Permalink
Merge branch 'master' into use-raw-logs-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JustynaBroniszewska committed May 15, 2024
2 parents 548d973 + b9113ed commit 2363153
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 24 deletions.
6 changes: 1 addition & 5 deletions packages/docs/playwright/with-metamask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,8 @@ describe(`Browser: ${browserType.name()} with Metamask`, () => {
const popupPage = await popupPromise

await sleep(2000) // Wait for the popup to be fully loaded.
expect(
// if this link is visible, then the network does not match metamask records
await popupPage.isVisible(`//a[@href='https://metamask.zendesk.com/hc/en-us/articles/360057142392']`)
).to.be.false

await popupPage.click(XPath.text('a', 'View all'))
await popupPage.click(XPath.text('a', 'View all details'))
await waitForExpect(async () => {
expect(await popupPage.isVisible(`//*[text()='${Optimism.chainName}']`)).to.be.true
expect(await popupPage.isVisible(`//*[text()='${Optimism.rpcUrl}']`)).to.be.true
Expand Down
12 changes: 5 additions & 7 deletions packages/example/playwright/with-metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,19 @@ export const withMetamaskTest = (baseUrl: string) => {

await waitForExpect(async () => {
expect(await page.isVisible(XPath.text('span', 'Mainnet'))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Goerli'))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Optimism'))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Optimism Goerli'))).to.be.true
})
})

it('Check if all chains were loaded', async () => {
await page.goto(`${baseUrl}multichain`)

await waitForExpect(async () => {
expect(await page.isVisible(XPath.text('span', 'Chain id:', 4))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Current block timestamp:', 4))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Current difficulty:', 4))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Current block:', 4))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Ether balance:', 4))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Chain id:', 2))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Current block timestamp:', 2))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Current difficulty:', 2))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Current block:', 2))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Ether balance:', 2))).to.be.true
})
})
})
Expand Down
2 changes: 0 additions & 2 deletions packages/example/playwright/without-metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ export const withoutMetamaskTest = (baseUrl: string) => {

await waitForExpect(async () => {
expect(await page.isVisible(XPath.text('span', 'Mainnet'))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Goerli'))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Optimism'))).to.be.true
expect(await page.isVisible(XPath.text('span', 'Optimism Goerli'))).to.be.true
})
})

Expand Down
9 changes: 1 addition & 8 deletions packages/example/src/entrypoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
Localhost,
MetamaskConnector,
CoinbaseWalletConnector,
Goerli,
OptimismGoerli,
Optimism,
} from '@usedapp/core'
import { App } from './App'
Expand All @@ -18,11 +16,7 @@ import { getDefaultProvider } from '@ethersproject/providers'

const readOnlyUrls: Config['readOnlyUrls'] = {
[Mainnet.chainId]: process.env.MAINNET_URL || getDefaultProvider('mainnet'),
[Goerli.chainId]: process.env.MAINNET_URL
? process.env.MAINNET_URL.replace('mainnet', 'goerli')
: getDefaultProvider('goerli'),
[Optimism.chainId]: 'https://mainnet.optimism.io',
[OptimismGoerli.chainId]: 'https://goerli.optimism.io',
}

if (process.env.LOCALHOST_URL) {
Expand All @@ -45,8 +39,7 @@ const config: Config = {
projectId: 'bffbe493c0928ee125dc8f23e20167b7',
chains: [Mainnet],
rpcMap: {
1: 'https://mainnet.infura.io/v3/d8df2cb7844e4a54ab0a782f608749dd',
5: 'https://goerli.infura.io/v3/d8df2cb7844e4a54ab0a782f608749dd',
[Mainnet.chainId]: 'https://mainnet.infura.io/v3/d8df2cb7844e4a54ab0a782f608749dd',
},
}),
},
Expand Down
4 changes: 2 additions & 2 deletions packages/example/src/pages/Multichain.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react'
import { Container, MainContent, Section, SectionRow } from '../components/base/base'
import { Goerli, Mainnet, Optimism, OptimismGoerli } from '@usedapp/core'
import { Mainnet, Optimism } from '@usedapp/core'
import { ChainState } from '../components/ChainState'
import { Title } from '../typography/Title'
import styled from 'styled-components'

const chains = [Mainnet.chainId, Goerli.chainId, Optimism.chainId, OptimismGoerli.chainId]
const chains = [Mainnet.chainId, Optimism.chainId]

export const Multichain = () => {
return (
Expand Down

0 comments on commit 2363153

Please sign in to comment.