-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: test ethers verify API + AppKit in iframe verify test case #2831
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fe07db7
chore: test ethers verify API
chris13524 c216164
chore: fix name conflicts
chris13524 166da40
Merge branch 'main' of https://github.com/reown-com/appkit into chore…
1cb5095
chore: fixup ethers tests
b2846d9
chore: enable verify tests
6dff309
chore: update README
c4f313f
chore: test AppKit in iframe
213fa81
chore: fix tests
0b3e685
chore: fix prettier
0357e02
chore: remove unused secrets
0d9ee66
chore: disable intercept Verify Server logic for now
3f4d2c3
chore: fix prettier
85b7236
Merge branch 'main' of https://github.com/reown-com/appkit into chore…
b1b59ab
chore: remove redundant fixture & properly implement scoping tests to…
32827b7
chore: run prettier
657c46f
Merge branch 'main' into chore/test-ethers-verify
chris13524 9ea67a6
Merge branch 'main' into chore/test-ethers-verify
chris13524 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
apps/laboratory/src/pages/library/ethers-verify-domain-mismatch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { createAppKit } from '@reown/appkit/react' | ||
import { EthersAdapter } from '@reown/appkit-adapter-ethers' | ||
import { EthersTests } from '../../components/Ethers/EthersTests' | ||
import { AppKitButtons } from '../../components/AppKitButtons' | ||
import { ThemeStore } from '../../utils/StoreUtil' | ||
import { ConstantsUtil } from '../../utils/ConstantsUtil' | ||
import { EthersModalInfo } from '../../components/Ethers/EthersModalInfo' | ||
import { mainnet } from '@reown/appkit/networks' | ||
|
||
// Special project ID with verify enabled on localhost | ||
const projectId = 'e4eae1aad4503db9966a04fd045a7e4d' | ||
|
||
const modal = createAppKit({ | ||
adapters: [new EthersAdapter()], | ||
networks: ConstantsUtil.EvmNetworks, | ||
defaultNetwork: mainnet, | ||
projectId, | ||
metadata: { | ||
name: 'AppKit', | ||
description: 'AppKit Laboratory', | ||
url: 'https://example.com', | ||
icons: [] | ||
}, | ||
features: { | ||
analytics: true | ||
}, | ||
customWallets: ConstantsUtil.CustomWallets | ||
}) | ||
|
||
ThemeStore.setModal(modal) | ||
|
||
export default function Ethers() { | ||
return ( | ||
<> | ||
<AppKitButtons /> | ||
<EthersModalInfo /> | ||
<EthersTests /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { createAppKit } from '@reown/appkit/react' | ||
import { EthersAdapter } from '@reown/appkit-adapter-ethers' | ||
import { EthersTests } from '../../components/Ethers/EthersTests' | ||
import { AppKitButtons } from '../../components/AppKitButtons' | ||
import { ThemeStore } from '../../utils/StoreUtil' | ||
import { ConstantsUtil } from '../../utils/ConstantsUtil' | ||
import { EthersModalInfo } from '../../components/Ethers/EthersModalInfo' | ||
import { mainnet } from '@reown/appkit/networks' | ||
|
||
// Special project ID with https://malicious-app-verify-simulation.vercel.app/ as the verified domain and this domain is marked as a scam | ||
const projectId = '9d176efa3150a1df0a76c8c138b6b657' | ||
|
||
const modal = createAppKit({ | ||
adapters: [new EthersAdapter()], | ||
networks: ConstantsUtil.EvmNetworks, | ||
defaultNetwork: mainnet, | ||
projectId, | ||
features: { | ||
analytics: true | ||
}, | ||
customWallets: ConstantsUtil.CustomWallets | ||
}) | ||
|
||
ThemeStore.setModal(modal) | ||
|
||
export default function Ethers() { | ||
return ( | ||
<> | ||
<AppKitButtons /> | ||
<EthersModalInfo /> | ||
<EthersTests /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { createAppKit } from '@reown/appkit/react' | ||
import { EthersAdapter } from '@reown/appkit-adapter-ethers' | ||
import { EthersTests } from '../../components/Ethers/EthersTests' | ||
import { AppKitButtons } from '../../components/AppKitButtons' | ||
import { ThemeStore } from '../../utils/StoreUtil' | ||
import { ConstantsUtil } from '../../utils/ConstantsUtil' | ||
import { EthersModalInfo } from '../../components/Ethers/EthersModalInfo' | ||
import { mainnet } from '@reown/appkit/networks' | ||
|
||
// Special project ID with verify enabled on localhost | ||
const projectId = 'e4eae1aad4503db9966a04fd045a7e4d' | ||
|
||
const modal = createAppKit({ | ||
adapters: [new EthersAdapter()], | ||
networks: ConstantsUtil.EvmNetworks, | ||
defaultNetwork: mainnet, | ||
projectId, | ||
features: { | ||
analytics: true | ||
}, | ||
customWallets: ConstantsUtil.CustomWallets | ||
}) | ||
|
||
ThemeStore.setModal(modal) | ||
|
||
export default function Ethers() { | ||
return ( | ||
<> | ||
<AppKitButtons /> | ||
<EthersModalInfo /> | ||
<EthersTests /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
apps/laboratory/tests/shared/fixtures/w3m-ethers-verify-domain-mismatch-fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { ModalFixture } from './w3m-fixture' | ||
import { ModalPage } from '../pages/ModalPage' | ||
import { timingFixture } from './timing-fixture' | ||
|
||
export const testMEthersVerifyDomainMismatch = timingFixture.extend<ModalFixture>({ | ||
library: ['ethers', { option: true }], | ||
modalPage: async ({ page, library }, use) => { | ||
const modalPage = new ModalPage(page, library, 'ethers-verify-domain-mismatch') | ||
await modalPage.load() | ||
await use(modalPage) | ||
} | ||
}) |
12 changes: 12 additions & 0 deletions
12
apps/laboratory/tests/shared/fixtures/w3m-ethers-verify-evil-fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { ModalFixture } from './w3m-fixture' | ||
import { ModalPage } from '../pages/ModalPage' | ||
import { timingFixture } from './timing-fixture' | ||
|
||
export const testMEthersVerifyEvil = timingFixture.extend<ModalFixture>({ | ||
library: ['ethers', { option: true }], | ||
modalPage: async ({ page, library }, use) => { | ||
const modalPage = new ModalPage(page, library, 'ethers-verify-evil') | ||
await modalPage.load() | ||
await use(modalPage) | ||
} | ||
}) |
12 changes: 12 additions & 0 deletions
12
apps/laboratory/tests/shared/fixtures/w3m-ethers-verify-valid-fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { ModalFixture } from './w3m-fixture' | ||
import { ModalPage } from '../pages/ModalPage' | ||
import { timingFixture } from './timing-fixture' | ||
|
||
export const testMEthersVerifyValid = timingFixture.extend<ModalFixture>({ | ||
library: ['ethers', { option: true }], | ||
modalPage: async ({ page, library }, use) => { | ||
const modalPage = new ModalPage(page, library, 'ethers-verify-valid') | ||
await modalPage.load() | ||
await use(modalPage) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to conditionally add this on test env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc adding it conditionally was tricky because the app is always built with
NODE_ENV
production, so it didn't know if it was building for tests or notDidn't bother going deeper I don't think, so hardcoded an intentionally-long domain here which wouldn't be valid anyway