Skip to content

Update base-stats extension - #21710

Merged
raycastbot merged 12 commits into
raycast:mainfrom
0xOsprey:ext/base-stats
Oct 15, 2025
Merged

raycastbot merged 12 commits into
raycast:mainfrom
0xOsprey:ext/base-stats

Conversation

@0xOsprey

@0xOsprey 0xOsprey commented Sep 20, 2025 •

Copy link
Copy Markdown
Contributor

Description

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: base-stats Issues related to the base-stats extension labels Sep 20, 2025
@raycastbot

raycastbot commented Sep 20, 2025 •

Copy link
Copy Markdown
Collaborator

Thank you for the update! 🎉

You can expect an initial review within five business days.

@raycastbot raycastbot added the OP is author The OP of the PR is the author of the extension label Sep 20, 2025

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 BaseScanResponse despite using Etherscan API, and manual creation of Preferences interface 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

Edit Code Review Bot Settings | Greptile

Comment thread extensions/base-stats/src/gas-price.tsx Resolved
@raycastbot

Copy link
Copy Markdown
Collaborator

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 😊

@raycastbot raycastbot added status: stalled Stalled due inactivity and removed status: stalled Stalled due inactivity labels Oct 6, 2025
0xOsprey and others added 7 commits October 6, 2025 10:20
- 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>
@0xOsprey 0xOsprey closed this Oct 6, 2025
@0xOsprey 0xOsprey reopened this Oct 6, 2025

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Edit Code Review Agent Settings | Greptile

Comment thread extensions/base-stats/eslint.config.mjs Outdated
Comment on lines +1 to +20
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: This ESLint configuration doesn't follow Raycast's standard template. Should use the simpler pattern:

Suggested change
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)

Comment thread extensions/base-stats/CHANGELOG.md Resolved
Comment thread extensions/base-stats/CHANGELOG.md Resolved
@0xOsprey

0xOsprey commented Oct 6, 2025

Copy link
Copy Markdown
Contributor Author

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>
@pernielsentikaer

Copy link
Copy Markdown
Contributor

Does this extension still make sense since we have multiple Etherscan extensions? (I know nothing about crypto)

@pernielsentikaer pernielsentikaer self-assigned this Oct 13, 2025
@0xOsprey

Copy link
Copy Markdown
Contributor Author

Yes - this is an entirely separate use case (getting Gas price in menu bar) and network (Base the L2) compared to the others.

Per Nielsen Tikær added 2 commits October 15, 2025 07:21
…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.
@pernielsentikaer

Copy link
Copy Markdown
Contributor

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?

@pernielsentikaer
pernielsentikaer marked this pull request as draft October 15, 2025 05:31

@0xOsprey 0xOsprey left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@0xOsprey
0xOsprey marked this pull request as ready for review October 15, 2025 05:41

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.org to api.etherscan.io/v2/api?chainid=8453 for Base network support
  • Extracted gas price fetching logic into reusable useGasPrice custom 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-fetch dependency (no longer needed with Node.js 21+)

Breaking Changes:

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

Edit Code Review Agent Settings | Greptile

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit 0bdaf04 into raycast:main Oct 15, 2025
@github-actions

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

tktcorporation added a commit to tktcorporation/extensions that referenced this pull request Nov 2, 2025