Skip to content

Commit

Permalink
chore: remove switchNetwork() function from wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
jake4take committed Dec 6, 2024
1 parent dd53f12 commit 10bf964
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
10 changes: 1 addition & 9 deletions packages/wallets/src/metamask/metamask.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,13 @@ export class MetamaskPage implements WalletPage {
await this.navigate();
await this.header.networkListButton.click();
await this.header.networkList.clickToNetwork(networkName);
if (networkName === 'Linea Mainnet') {
if (networkName === 'Linea') {
await this.popoverElements.closePopover(); //Linea network require additional confirmation
}
await this.page.close();
});
}

async switchNetwork(networkName = 'Linea Mainnet') {
await test.step(`Switch network to "${networkName}"`, async () => {
await this.navigate();
await this.header.networkList.switchNetwork(networkName);
await this.page.close();
});
}

async setupNetwork(standConfig: Record<string, any>) {
await test.step(`Setup "${standConfig.chainName}" Network`, async () => {
await this.header.networkListButton.click();
Expand Down
7 changes: 2 additions & 5 deletions packages/wallets/src/okx/okx.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ export class OkxPage implements WalletPage {
* - switch in wallet extension
* - switch in the connected dApp (switch in the extension doesn't switch the dApp network, but we do it to sync states)
* */
async switchNetwork(networkName: string) {
async changeNetwork(networkName: string) {
await test.step(`Switch network to "${networkName}"`, async () => {
networkName = await checkNetworkName(networkName);
await this.navigate();

// switch network for wallet
Expand All @@ -157,10 +158,6 @@ export class OkxPage implements WalletPage {
});
}

async changeNetwork(networkName: string) {
await this.switchNetwork(await checkNetworkName(networkName));
}

/** To add new wallet address using wallet `privateKey` */
async importKey(key: string) {
await this.navigate();
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/src/wallet.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface WalletPage {
assertReceiptAddress(page: Page, expectedAmount: string): Promise<void>;

getWalletAddress?(): Promise<string>;
switchNetwork?(networkName: string): Promise<void>;

setupNetwork?(standConfig: Record<string, any>): Promise<void>;

addNetwork(
Expand Down

0 comments on commit 10bf964

Please sign in to comment.