Repository navigation
Update base-stats extension - #21710
Conversation
|
Thank you for the update! 🎉 You can expect an initial review within five business days. |
There was a problem hiding this comment.
Greptile Summary
This PR migrates the base-stats extension from using BaseScan API to Etherscan API for fetching Base network gas prices. The change updates the API endpoint to https://api.etherscan.io/v2/api?chainid=8453 (Base chain ID) and updates all user-facing references from BaseScan to Etherscan.
- Updated README and package.json to reference Etherscan instead of BaseScan
- Changed API endpoints in both gas price commands to use Etherscan's v2 API with Base chain ID
- Maintained backward compatibility in response parsing and caching logic
Confidence score: 2/5
- This PR has multiple syntax issues that need to be resolved before merging
- While the API migration logic is sound, there are critical naming inconsistencies with interfaces still referencing
BaseScanResponsedespite using Etherscan API, and manual creation ofPreferencesinterface violates Raycast extension guidelines - Both TypeScript files need attention for interface naming and preferences handling
Important Files Changed
File Analysis
| Filename | Score | Overview | Issues |
|---|---|---|---|
| extensions/base-stats/src/gas-price-no-unit.tsx | 2/5 | Changed API endpoint from BaseScan to Etherscan with Base chain ID 8453 | Interface name mismatch and manual Preferences interface creation |
| extensions/base-stats/src/gas-price.tsx | 2/5 | Changed API endpoint from BaseScan to Etherscan with Base chain ID 8453 | Interface name mismatch and manual Preferences interface creation |
4 files reviewed, 6 comments
|
This pull request has been automatically marked as stale because it did not have any recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊 |
- Upgrade BaseScan API (v1) to Etherscan Multichain API (v2) - Initial commit
Greptile naming conventions and linting Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Greptile naming conventions Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Greptile Overview
Summary
This PR migrates the base-stats extension from BaseScan API v1 to Etherscan API v2, representing a significant architectural change. The migration involves updating the API endpoint to use Etherscan's v2 structure with chain ID 8453 specifically for the Base network. The extension has been streamlined by removing the stats command entirely, which previously scraped data from L2Beat to display Base network statistics like TVL and TPS. Now the extension focuses solely on gas price monitoring through two menu bar commands.The changes update all API preferences from BaseScan to Etherscan, requiring users to obtain new API keys from etherscan.io instead of basescan.org. The codebase has been modernized with dependency upgrades including @raycast/api to v1.103.0 and Node.js types to v22.13.10. The ESLint configuration has been migrated from the legacy JSON format to the new flat config format, though it doesn't follow Raycast's standard template. A macOS platform restriction has been added to the package.json.
The gas price fetching logic now uses the Etherscan v2 endpoint with explicit chain ID parameters, and error handling has been simplified by removing try-catch wrappers and console logging. The interface has been renamed from BaseScanResponse to EtherscanResponse to reflect the API change. This migration ensures continued functionality as the old API version is being deprecated.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| extensions/base-stats/package.json | 4/5 | Migrated from BaseScan to Etherscan API, removed stats command, upgraded dependencies |
| extensions/base-stats/README.md | 5/5 | Updated documentation to reflect Etherscan API requirement instead of BaseScan |
| extensions/base-stats/eslint.config.mjs | 2/5 | Added flat ESLint config but doesn't follow Raycast's standard template |
| extensions/base-stats/src/gas-price.tsx | 4/5 | Updated to use Etherscan v2 API with chain ID 8453, simplified error handling |
| extensions/base-stats/CHANGELOG.md | 5/5 | Properly documented API migration and feature changes with correct versioning |
| extensions/base-stats/src/stats.tsx | 4/5 | Removed entire L2Beat-based statistics functionality to focus on gas prices only |
| extensions/base-stats/src/gas-price-no-unit.tsx | 4/5 | Updated to use Etherscan v2 API, removed logging, simplified error handling |
Confidence score: 3/5
- This PR requires careful review due to significant API migration and breaking changes for existing users
- Score reflects concerns about non-standard ESLint configuration and potential breaking changes requiring user reconfiguration
- Pay close attention to eslint.config.mjs which doesn't follow Raycast's standard template and may cause linting inconsistencies
Context used:
Rule from dashboard - ## ESLint Configuration
Import Path for defineConfig
- The correct import path for `defineConf... (source)
7 files reviewed, 3 comments
| import { FlatCompat } from "@eslint/eslintrc"; | ||
| import js from "@eslint/js"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| const compat = new FlatCompat({ | ||
| baseDirectory: __dirname, | ||
| recommendedConfig: js.configs.recommended, | ||
| allConfig: js.configs.all, | ||
| }); | ||
|
|
||
| export default [ | ||
| { | ||
| ignores: ["**/node_modules/**", "**/dist/**"], | ||
| }, | ||
| ...compat.extends("@raycast"), | ||
| ]; No newline at end of file |
There was a problem hiding this comment.
style: This ESLint configuration doesn't follow Raycast's standard template. Should use the simpler pattern:
| import { FlatCompat } from "@eslint/eslintrc"; | |
| import js from "@eslint/js"; | |
| import path from "node:path"; | |
| import { fileURLToPath } from "node:url"; | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); | |
| const compat = new FlatCompat({ | |
| baseDirectory: __dirname, | |
| recommendedConfig: js.configs.recommended, | |
| allConfig: js.configs.all, | |
| }); | |
| export default [ | |
| { | |
| ignores: ["**/node_modules/**", "**/dist/**"], | |
| }, | |
| ...compat.extends("@raycast"), | |
| ]; | |
| const { defineConfig } = require("eslint/config"); | |
| const raycastConfig = require("@raycast/eslint-config"); | |
| module.exports = defineConfig([ | |
| ...raycastConfig, | |
| ]); |
Context Used: Rule from dashboard - ## ESLint Configuration
Import Path for defineConfig
- The correct import path for `defineConf... (source)
|
This should be ready for review now - Critical fix for this extension as everything is broken currently |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Does this extension still make sense since we have multiple Etherscan extensions? (I know nothing about crypto) |
|
Yes - this is an entirely separate use case (getting Gas price in menu bar) and network (Base the L2) compared to the others. |
…json for improved linting and compatibility. Update TypeScript target to ES2023 and refactor imports in gas-price components.
…ces. Remove redundant state management and improve error handling. Update display logic to include unit in gas price.
|
I rewrote the extension a bit and after doing that I realized that there is only one difference between the two menu bar commands, why not make it a preference? |
0xOsprey
left a comment
There was a problem hiding this comment.
Sincerely appreciate the contributions. I personally like just activating once versus the other, but would be open to a preference addition.
Regardless, I've had a few of the users ping my asking when this extension would get fixed since it's entirely broken pending this update. Given that, I'd like to request we leave it as is for now.
There was a problem hiding this comment.
Greptile Overview
Summary
This PR migrates the base-stats extension from BaseScan API v1 to Etherscan API v2, implementing a cleaner architecture with a custom React hook.
Key Changes:
- Migrated API endpoint from
api.basescan.orgtoapi.etherscan.io/v2/api?chainid=8453for Base network support - Extracted gas price fetching logic into reusable
useGasPricecustom hook using@raycast/utils - Removed deprecated stats command that relied on outdated API
- Refactored both gas-price components, reducing code from ~75 lines to ~21 lines each
- Updated ESLint configuration to flat config format for ESLint 9.x compatibility
- Updated all dependencies to latest versions
- Removed
node-fetchdependency (no longer needed with Node.js 21+)
Breaking Changes:
- Users must obtain new Etherscan API key from https://etherscan.io/apidashboard (BaseScan keys no longer work)
The refactoring follows Raycast best practices by using useFetch from @raycast/utils and properly handles errors, loading states, and data formatting.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The code changes are well-structured, follow Raycast best practices, and properly migrate to the newer Etherscan v2 API. The refactoring significantly improves code quality by eliminating duplication and using established utilities from
@raycast/utils. All configuration updates are appropriate, and the CHANGELOG clearly documents breaking changes for users. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| extensions/base-stats/src/hook/useGasPrice.ts | 5/5 | New custom hook extracts gas price fetching logic using useFetch from @raycast/utils, properly handles API v2 migration with clean error handling |
| extensions/base-stats/src/gas-price.tsx | 5/5 | Refactored to use custom hook, significantly reduced code complexity from 75 to 21 lines with cleaner state management |
| extensions/base-stats/src/gas-price-no-unit.tsx | 5/5 | Refactored to use custom hook with includeUnit: false, eliminating code duplication |
| extensions/base-stats/package.json | 5/5 | Updated dependencies to latest versions, removed deprecated stats command, updated API key preference from BaseScan to Etherscan, added platforms field |
9 files reviewed, no comments
pernielsentikaer
left a comment
There was a problem hiding this comment.
Looks good to me, approved 🔥
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |
Description
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder