Skip to content

Conversation

ferrabled
Copy link

@ferrabled ferrabled commented Oct 3, 2025

Description

This PR introduces support for the latest Safe API endpoints, adds the ability to use a Safe API key for more reliable requests, and includes compatibility for Safe version 1.5.0. 0g, monad and plasma networks have also been added.

Motivation

Previously, our application relied on older Safe API endpoints that were becoming deprecated. This PR updates our API integrations to the new endpoints, preventing future failures. Additionally, it introduces the ability to use a Safe API key to avoid rate-limiting issues and reorganizes network configurations for better scalability.

Changes

.env.example

  • Added the SAFE_API_KEY variable to the example environment file, providing a clear template for users who wish to use their own API key locally.

app/constants.ts

  • Introduced a BASE_URL constant for the Safe Transaction API to centralize the endpoint.
  • Refactored the NETWORKS array to include a new apiUrl field for each network, which simplifies URL construction.
  • Updated the list of supported networks and reordered them for clarity.
  • Added Safe version 1.5.0 to the SAFE_VERSIONS array to support the latest wallet contracts.
  • Added new networks 0g, monad and plasma

components/result/trusted-addresses.tsx

  • Added new canonical contract addresses for MultiSendCallOnly, SafeMigration, and SignMessageLib corresponding to Safe version 1.5.0, ensuring that transactions involving these contracts are correctly identified as trusted.

components/transaction/ApiInputFields.tsx

  • Modified the network selection dropdown to only display networks that have a valid apiUrl defined. This ensures that users can only select networks that are compatible with the API-based calculation method.

lib/utils.ts

  • Removed the now-redundant API_URLS object and the isValidNetwork function. This logic has been replaced by the apiUrl field within the NETWORKS constant.

utils/api.ts

  • Implemented a getSafeApiKey function to retrieve the user's API key from environment variables.
  • Updated fetchSafeVersion and fetchTransactionDataFromApi to dynamically use the appropriate apiUrl for each network.
  • Both API-calling functions now include an Authorization: Bearer header in requests when an API key is provided.
  • Switched to the /api/v2/ endpoint for fetching multisig transactions to align with the latest Safe API version.
  • Introduced a 1.1-second delay between API calls when no API key is used to mitigate rate-limiting errors.

Issues

@ferrabled ferrabled self-assigned this Oct 3, 2025
@ferrabled ferrabled requested a review from Copilot October 3, 2025 15:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the application to support new Safe API endpoints, introduces Safe API key authentication for improved request reliability, and adds support for Safe version 1.5.0. The changes modernize the API integration and enhance security through proper authentication while maintaining backward compatibility.

  • Centralizes API endpoint configuration and adds new canonical contract addresses for Safe v1.5.0
  • Implements Safe API key authentication with automatic rate limiting when no key is provided
  • Updates to use the latest v2 Safe Transaction Service API endpoints

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.env.example Added SAFE_API_KEY environment variable template
app/constants.ts Centralized API configuration with BASE_URL constant and added apiUrl field to networks
components/result/trusted-addresses.tsx Added Safe v1.5.0 canonical contract addresses
components/transaction/ApiInputFields.tsx Modified network selection to only show networks with valid API URLs
lib/utils.ts Removed redundant API_URLS object and isValidNetwork function
utils/api.ts Implemented API key authentication and updated to v2 endpoints with rate limiting
safe_hashes.sh Removed entire bash script file
app/api/calculate-hashes/route.ts Removed API route that used the bash script
README.md Updated documentation for new API key feature and removed bash script references

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@josepchetrit12 josepchetrit12 self-requested a review October 20, 2025 06:56
Copy link
Member

@josepchetrit12 josepchetrit12 left a comment

Choose a reason for hiding this comment

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

LGTM! Great job @ferrabled

@josepchetrit12 josepchetrit12 merged commit 77356d0 into main Oct 20, 2025
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for plasma, monad, 0G

3 participants