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

feat: add Polygon, Base mainnet and test in the network list #55

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jul 22, 2024

Closes: #53

Summary by CodeRabbit

  • New Features
    • Expanded support for multiple blockchain networks, including base_mainnet, base_testnet, and polygon_mainnet.
    • Enhanced configurations include detailed attributes such as chain IDs, fee structures, asset definitions, and API endpoints for improved network integration.

Copy link

coderabbitai bot commented Jul 22, 2024

Walkthrough

This update enhances the data/networks.json file by adding configurations for base_mainnet, base_testnet, and polygon_mainnet. Each configuration includes essential attributes such as chain_id, aliases, fee structures, assets, and API endpoints, allowing for improved integration and interaction with these blockchain networks.

Changes

File Change Summary
data/networks.json Added configurations for base_mainnet, base_testnet, and polygon_mainnet with detailed attributes.

Assessment against linked issues

Objective Addressed Explanation
Add Polygon mainnet and Base testnet (53)
Include Base mainnet if values are known

🐇 In the land of blocks and chains so bright,
New networks have sprung, bringing delight!
Base and Polygon join the fray,
With fees and assets to pave the way.
Let's hop along and explore anew,
In the world of crypto, we’ve much to pursue! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5a1325a and a4457f4.

Files selected for processing (1)
  • data/networks.json (1 hunks)
Additional comments not posted (19)
data/networks.json (19)

3-3: Verify the chain_id for base_mainnet.

Ensure that the chain_id of 8453 is correct and consistent with the official Base Mainnet documentation.


4-10: Ensure consistency in chain_aliases.

The aliases should be consistent with naming conventions and documentation. Verify that all aliases are accurate and relevant.


12-12: Confirm the chain_name for base_mainnet.

Ensure that "Base Mainnet" is the correct and official name for this network.


13-21: Review the fee structure for base_mainnet.

Ensure that the gas and gas price values are accurate and reflect the current network conditions.


22-37: Verify the asset definitions for base_mainnet.

Ensure that the denominations and their exponents are correct. Confirm that "ETH" is the appropriate symbol for the base asset.


38-46: Validate the API endpoints for base_mainnet.

Ensure that the provided URLs are correct and functional. Verify that they point to the appropriate EVM-compatible endpoints.


50-50: Verify the chain_id for base_testnet.

Ensure that the chain_id of 84532 is correct and consistent with the official Base Testnet documentation.


51-61: Ensure consistency in chain_aliases.

The aliases should be consistent with naming conventions and documentation. Verify that all aliases are accurate and relevant.


63-63: Confirm the chain_name for base_testnet.

Ensure that "Base Sepolia Testnet" is the correct and official name for this network.


64-71: Review the fee structure for base_testnet.

Ensure that the gas and gas price values are accurate and reflect the current network conditions.


73-87: Verify the asset definitions for base_testnet.

Ensure that the denominations and their exponents are correct. Confirm that "ETH" is the appropriate symbol for the base asset.


89-97: Validate the API endpoints for base_testnet.

Ensure that the provided URLs are correct and functional. Verify that they point to the appropriate EVM-compatible endpoints.


101-101: Verify the chain_id for polygon_mainnet.

Ensure that the chain_id of 137 is correct and consistent with the official Polygon Mainnet documentation.


102-108: Ensure consistency in chain_aliases.

The aliases should be consistent with naming conventions and documentation. Verify that all aliases are accurate and relevant.


111-111: Confirm the chain_name for polygon_mainnet.

Ensure that "Polygon PoS Mainnet" is the correct and official name for this network.


112-119: Review the fee structure for polygon_mainnet.

Ensure that the gas and gas price values are accurate and reflect the current network conditions.


121-135: Verify the asset definitions for polygon_mainnet.

Ensure that the denominations and their exponents are correct. Confirm that "POL" is the appropriate symbol for the base asset.


137-143: Validate the explorer configuration for polygon_mainnet.

Ensure that the explorer URLs and placeholders for transactions and addresses are correct.


145-153: Validate the API endpoints for polygon_mainnet.

Ensure that the provided URLs are correct and functional. Verify that they point to the appropriate EVM-compatible endpoints.

@fadeev
Copy link
Member

fadeev commented Jul 22, 2024

I would add explorers, but other than that, looks good.

@lumtis
Copy link
Member Author

lumtis commented Jul 22, 2024

CI error looks unrelated to the change

lumtis and others added 3 commits July 22, 2024 13:07
Co-authored-by: Denis Fadeev <denis@fadeev.org>
Co-authored-by: Denis Fadeev <denis@fadeev.org>
@lumtis lumtis requested a review from fadeev July 22, 2024 11:08
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
data/networks.json (1)

162-168: Update the Ankr URL and note the correct usage for BlockPI endpoint

  • The Ankr URL should be updated to https://www.ankr.com/rpc/polygon/ in the networks.json file.
  • The BlockPI endpoint https://polygon.blockpi.network/v1/rpc/public should be used with POST requests, not GET requests.

Code Changes Needed:

  • Update the Ankr URL in networks.json:
    {
      "url": "https://www.ankr.com/rpc/polygon/",
      "type": "evm"
    }

Category:

Analysis chain

Verify the API endpoints.

Ensure that the API endpoints for polygon_mainnet are correct and functional.


To verify the API endpoints more thoroughly, we need to follow the redirect for the 301 status code and identify the allowed methods for the endpoint returning a 405 status code.


To complete the verification, we need to test the functionality of the new Ankr URL and the GET and POST methods for the BlockPI endpoint.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the API endpoints for `polygon_mainnet`.

# Test: Check if the URLs are reachable. Expect: HTTP status 200.
curl -o /dev/null -s -w "%{http_code}\n" https://polygon.blockpi.network/v1/rpc/public
curl -o /dev/null -s -w "%{http_code}\n" https://rpc.ankr.com/polygon

Length of output: 168


Script:

#!/bin/bash
# Description: Follow the redirect for the 301 status code and identify allowed methods for the 405 status code.

# Follow the redirect for the 301 status code.
new_url=$(curl -s -o /dev/null -w "%{redirect_url}" https://rpc.ankr.com/polygon)
echo "Redirected URL for https://rpc.ankr.com/polygon: $new_url"

# Identify allowed methods for the 405 status code.
allowed_methods=$(curl -s -I -X OPTIONS https://polygon.blockpi.network/v1/rpc/public | grep 'allow' | awk '{print $2}')
echo "Allowed methods for https://polygon.blockpi.network/v1/rpc/public: $allowed_methods"

Length of output: 685


Script:

#!/bin/bash
# Description: Verify the functionality of the new Ankr URL and test the GET and POST methods for the BlockPI endpoint.

# Test the new Ankr URL.
curl -o /dev/null -s -w "%{http_code}\n" https://www.ankr.com/rpc/polygon/

# Test the GET method for the BlockPI endpoint.
curl -o /dev/null -s -w "%{http_code}\n" -X GET https://polygon.blockpi.network/v1/rpc/public

# Test the POST method for the BlockPI endpoint with a sample payload.
curl -o /dev/null -s -w "%{http_code}\n" -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' https://polygon.blockpi.network/v1/rpc/public

Length of output: 386

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a4457f4 and 341a596.

Files selected for processing (1)
  • data/networks.json (1 hunks)
Additional comments not posted (5)
data/networks.json (5)

155-158: Verify the explorer URL.

Ensure that the explorer URL https://polygonscan.com is correct and functional.

Verification successful

Verify the API endpoints for transactions and addresses.

Ensure that the API endpoints /tx/${tx} and /address/${address} are correctly formed and functional.


Verification successful.

The explorer URL https://polygonscan.com and the API endpoints /tx/${tx} and /address/${address} are correctly formed and functional, as confirmed by HTTP status 200 responses.

  • https://polygonscan.com
  • /tx/${tx}
  • /address/${address}
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the explorer URL for `polygon_mainnet`.

# Test: Check if the URL is reachable. Expect: HTTP status 200.
curl -o /dev/null -s -w "%{http_code}\n" https://polygonscan.com

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the API endpoints for `polygon_mainnet`.

# Test: Check if the transaction endpoint is reachable. Expect: HTTP status 200.
tx_endpoint="https://polygonscan.com/tx/0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
curl -o /dev/null -s -w "%{http_code}\n" "$tx_endpoint"

# Test: Check if the address endpoint is reachable. Expect: HTTP status 200.
address_endpoint="https://polygonscan.com/address/0x1234567890abcdef1234567890abcdef12345678"
curl -o /dev/null -s -w "%{http_code}\n" "$address_endpoint"

Length of output: 464


48-54: Verify the API endpoints.

Ensure that the API endpoints for base_mainnet are correct and functional.

Verification successful

Both API endpoints are functional.

  • The endpoint https://base.blockpi.network/v1/rpc/public returned a status code of 200 when checked for allowed methods.
  • The endpoint https://rpc.ankr.com/base returned a status code of 200 after following redirects.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the API endpoints for `base_mainnet`.

# Test: Check if the URLs are reachable. Expect: HTTP status 200.
curl -o /dev/null -s -w "%{http_code}\n" https://base.blockpi.network/v1/rpc/public
curl -o /dev/null -s -w "%{http_code}\n" https://rpc.ankr.com/base

Length of output: 162


Script:

#!/bin/bash
# Description: Verify the API endpoints for `base_mainnet`.

# Test: Check if the URLs are reachable. Expect: HTTP status 200.

# Follow redirects and check final status code for the second URL
curl -o /dev/null -s -w "%{http_code}\n" -L https://rpc.ankr.com/base

# Check allowed methods for the first URL
curl -o /dev/null -s -w "%{http_code}\n" -X OPTIONS https://base.blockpi.network/v1/rpc/public

Length of output: 176


100-103: Verify the explorer URL.

Ensure that the explorer URL https://sepolia.basescan.org/ is correct and functional.

Verification successful

Verify the API endpoints.

Ensure that the API endpoints /tx/${tx} and /address/${address} are correctly formatted and functional.


Verification Summary:

  • The explorer URL https://sepolia.basescan.org/ is reachable and returns HTTP status 200, indicating it is functional.

  • The address endpoint /address/${address} is correctly formatted and functional, returning HTTP status 200.

  • The transaction endpoint /tx/${tx} returns HTTP status 302, indicating a redirection. This suggests the endpoint exists but may require further verification to ensure it redirects correctly to the intended resource.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the explorer URL for `base_testnet`.

# Test: Check if the URL is reachable. Expect: HTTP status 200.
curl -o /dev/null -s -w "%{http_code}\n" https://sepolia.basescan.org/

Length of output: 76


Script:

#!/bin/bash
# Description: Verify the API endpoints for `base_testnet`.

# Test: Check if the transaction endpoint is reachable. Expect: HTTP status 200.
tx_url="https://sepolia.basescan.org/tx/sample_tx_id"
curl -o /dev/null -s -w "%{http_code}\n" $tx_url

# Test: Check if the address endpoint is reachable. Expect: HTTP status 200.
address_url="https://sepolia.basescan.org/address/sample_address_id"
curl -o /dev/null -s -w "%{http_code}\n" $address_url

Length of output: 316


107-113: Verify the API endpoints.

Ensure that the API endpoints for base_testnet are correct and functional.

Verification successful

API endpoints verified and functional.

  • The URL https://rpc.ankr.com/base_sepolia redirects to https://www.ankr.com/rpc/base/base_sepolia/, which is accessible and returns a 200 status code.
  • The URL https://base-sepolia.blockpi.network/v1/rpc/public requires a POST request to return a 200 status code.

Ensure to use the correct HTTP methods for accessing these endpoints.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the API endpoints for `base_testnet`.

# Test: Check if the URLs are reachable. Expect: HTTP status 200.
curl -o /dev/null -s -w "%{http_code}\n" https://base-sepolia.blockpi.network/v1/rpc/public
curl -o /dev/null -s -w "%{http_code}\n" https://rpc.ankr.com/base_sepolia

Length of output: 178


Script:

#!/bin/bash
# Description: Follow the redirect for the 301 status code and determine the final URL.
# Check if the final URL is reachable with HTTP status 200.

# Follow the redirect and get the final URL.
final_url=$(curl -s -o /dev/null -w "%{redirect_url}" https://rpc.ankr.com/base_sepolia)

# Check if the final URL is reachable.
curl -o /dev/null -s -w "%{http_code}\n" "$final_url"

# Check if the 405 status code endpoint requires a different HTTP method or additional headers.
# Trying a POST request.
curl -X POST -o /dev/null -s -w "%{http_code}\n" https://base-sepolia.blockpi.network/v1/rpc/public

Length of output: 331


40-44: Verify the explorer URL.

Ensure that the explorer URL https://basescan.org/ is correct and functional.

Verification successful

Verification successful. The explorer URLs and placeholders for base_mainnet, base_testnet, and polygon_mainnet are correct and functional.

  • base_mainnet: URL https://basescan.org/ is reachable, and placeholders ${tx} and ${address} are correctly used.
  • base_testnet: URL https://basescan.org/ is reachable, and placeholders ${tx} and ${address} are correctly used.
  • polygon_mainnet: URL https://polygonscan.com/ is reachable, and placeholders ${tx} and ${address} are correctly used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the explorer URL for `base_mainnet`.

# Test: Check if the URL is reachable. Expect: HTTP status 200.
curl -o /dev/null -s -w "%{http_code}\n" https://basescan.org/

Length of output: 68


Script:

#!/bin/bash
# Description: Verify the correct usage of placeholders within the URL paths for transactions and addresses.

# Test: Check if the URL paths contain the correct placeholders.
echo "Checking transaction URL path..."
tx_url_path="/tx/\${tx}"
if [[ "$tx_url_path" == *"\${tx}"* ]]; then
  echo "Transaction URL path contains the placeholder \${tx}."
else
  echo "Transaction URL path does not contain the placeholder \${tx}."
fi

echo "Checking address URL path..."
address_url_path="/address/\${address}"
if [[ "$address_url_path" == *"\${address}"* ]]; then
  echo "Address URL path contains the placeholder \${address}."
else
  echo "Address URL path does not contain the placeholder \${address}."
fi

Length of output: 528


Script:

#!/bin/bash
# Description: Verify the explorer URLs and placeholders for `base_testnet` and `polygon_mainnet`.

# Function to check URL reachability
check_url() {
  local url=$1
  local name=$2
  echo "Checking URL reachability for $name..."
  status_code=$(curl -o /dev/null -s -w "%{http_code}\n" "$url")
  if [ "$status_code" -eq 200 ]; then
    echo "$name URL is reachable."
  else
    echo "$name URL is not reachable. Status code: $status_code"
  fi
}

# Function to check placeholders in URL paths
check_placeholders() {
  local tx_path=$1
  local address_path=$2
  echo "Checking transaction URL path..."
  if [[ "$tx_path" == *"\${tx}"* ]]; then
    echo "Transaction URL path contains the placeholder \${tx}."
  else
    echo "Transaction URL path does not contain the placeholder \${tx}."
  fi

  echo "Checking address URL path..."
  if [[ "$address_path" == *"\${address}"* ]]; then
    echo "Address URL path contains the placeholder \${address}."
  else
    echo "Address URL path does not contain the placeholder \${address}."
  fi
}

# Verify base_testnet
check_url "https://basescan.org/" "base_testnet"
check_placeholders "/tx/\${tx}" "/address/\${address}"

# Verify polygon_mainnet
check_url "https://polygonscan.com/" "polygon_mainnet"
check_placeholders "/tx/\${tx}" "/address/\${address}"

Length of output: 1972

@lumtis lumtis merged commit c05ca38 into main Jul 22, 2024
60 of 61 checks passed
@lumtis lumtis deleted the feat/next-integrations branch July 22, 2024 11:46
@coderabbitai coderabbitai bot mentioned this pull request Sep 13, 2024
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.

Add Polygon mainnet and Base testnet
2 participants