Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
feat: create function to add token
Browse files Browse the repository at this point in the history
  • Loading branch information
bayological committed Nov 26, 2021
1 parent a290e07 commit 37833d4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/metamask/addToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Page } from 'puppeteer';

export const addToken = (page: Page) => async (tokenAddress: string): Promise<void> => {
await page.bringToFront();

const addTokenButton = await page.waitForSelector('.add-token-button > button');
await addTokenButton.click();

const addressInput = await page.waitForSelector('#custom-address');
addressInput.type(tokenAddress);

await page.waitForTimeout(4000);

const nextButton = await page.waitForSelector(`button[data-testid='page-container-footer-next']:not([disabled])`);
await nextButton.click();

const footerButtons = await page.$$('footer > button');
await footerButtons[1].click();
};

0 comments on commit 37833d4

Please sign in to comment.