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 v2 verify routes #73

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

iainnash
Copy link

@iainnash iainnash commented Jan 7, 2025

  • Fix existing verify integration tests
  • Add standard-json-input integration tests
  • Fix current single file test
  • Add v2 integration tests
  • Allow v2 setting on client with etherscan client

This is a prerequisite PR for foundry-rs/foundry#9196

Notes:

  • Fantomscan test has no env var passed in and can be removed safely.
  • Gas estimates now do not fail with even 1 passed in, so skipping the failure test because I couldn't find a failure test.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

ty, smol nits and suggestions

crates/block-explorers/src/lib.rs Outdated Show resolved Hide resolved
crates/block-explorers/src/lib.rs Show resolved Hide resolved
crates/block-explorers/src/lib.rs Outdated Show resolved Hide resolved
@iainnash
Copy link
Author

@mattsse updated with suggestions

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

sorry for the delay, last nits

crates/block-explorers/src/lib.rs Outdated Show resolved Hide resolved
@@ -99,6 +115,16 @@ impl Client {
Client::builder().with_api_key(api_key).chain(chain)?.build()
}

/// Create a new client with the correct endpoint with the chain and chosen API v2 version
pub fn new_v2_from_env(chain: Chain) -> Result<Self> {
Copy link
Member

Choose a reason for hiding this comment

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

I think we also want a way to set the version, like

fn with_version(self, v) -> Self

Copy link
Author

Choose a reason for hiding this comment

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

This already exists:

    /// Configures the etherscan api version
    pub fn with_api_version(mut self, api_version: EtherscanApiVersion) -> Self {
        self.etherscan_api_version = api_version;
        self
    }

Comment on lines +120 to +125
let api_key = std::env::var("ETHERSCAN_API_KEY")?;
Client::builder()
.with_api_version(EtherscanApiVersion::V2)
.with_api_key(api_key)
.chain(chain)?
.build()
Copy link
Member

Choose a reason for hiding this comment

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

then this can just call new ad with_version(v2)

Copy link
Author

Choose a reason for hiding this comment

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

A little confused as to where this would be called -- within the builder or skip the builder entirely and use with_version() rather than new_v2_from_env?

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.

2 participants