Skip to content
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

✨ Add etherscan api #70

Merged
merged 6 commits into from
May 29, 2024
Merged

✨ Add etherscan api #70

merged 6 commits into from
May 29, 2024

Conversation

kylewandishin
Copy link
Collaborator

closes #66

@dawsbot please review this commit. this is a hacky solution that works but I think there is some duplicate code to clean up.


public convertToTokenRows(data: ApiResponse): TokenRows {
const tokens = data.d.data.map((obj) => ({
tokenName: obj.tokenName,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be cleaner to do this like:

const tokens = data.d.data.map(obj => ({
...obj,
address: obj.contractAddress
});

import { firefox } from "playwright";

export async function openBrowser(): Promise<{ browser: Browser; page: Page }> {
const browser = await firefox.launch({ headless: false });
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we already have an area in the codebase with browser automation like this? It could be good to de-duplicate so we only depend on playwright in one place.

@@ -38,6 +44,22 @@ export class EtherscanHtmlParser extends HtmlParser {
return addressesInfo;
}

public async login(page: Page, baseUrl: string) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never needed this login before, how come it's needed now?

I thought the parent class did the login

import type { AccountRows, TokenRows } from "../AnyscanPuller";
import { ApiParser } from "../ApiParser";

async function sleep(ms: number): Promise<void> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we already have a sleep function elsewhere in the codebase? Let's de-duplicate if so

address: "0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656",
});
await closeBrowser(browser);
}, 1000000);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this magic number?

@dawsbot dawsbot changed the title [NOT READY] Add etherscan api ✨ Add etherscan api May 29, 2024
@dawsbot dawsbot merged commit 1a41382 into v1 May 29, 2024
@dawsbot dawsbot deleted the add-etherscan-api branch May 29, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pull full token name etherscan
2 participants