Skip to content

♻️ (chore) [NO-ISSUE]: Replace axios with native fetch API#1334

Draft
mbertin-ledger wants to merge 8 commits intodevelopfrom
chore/no-issue-migrate-axios-to-fetch
Draft

♻️ (chore) [NO-ISSUE]: Replace axios with native fetch API#1334
mbertin-ledger wants to merge 8 commits intodevelopfrom
chore/no-issue-migrate-axios-to-fetch

Conversation

@mbertin-ledger
Copy link
Member

📝 Description

Remove the axios dependency from all packages and replace all HTTP calls with the native fetch API.

Changes per package:

  • context-module: Migrated 16 data sources from axios.request()/axios.get() to fetch() with URL/URLSearchParams for query params
  • device-management-kit: Migrated AxiosManagerApiDataSource (9 API methods) from axios.get()/axios.post() to fetch() within EitherAsync blocks
  • speculos-transport: Replaced axiosClientFactory and axios instance with direct fetch() calls and AbortController for timeouts
  • speculos-device-controller: Introduced HttpClient interface replacing AxiosInstance, implemented with fetch() and AbortController-based timeouts
  • cal-interceptor: Rewrote AxiosInterceptor as FetchInterceptor using globalThis.fetch monkey-patching instead of axios interceptors/cancel tokens. Exported backwards-compatible AxiosInterceptor alias.
  • clear-signing-tester: Migrated 4 HTTP adapters (Etherscan, CAL, screenshot, screen reader)
  • Removed axios from all 6 package.json files and the pnpm-workspace.yaml catalog

❓ Context

  • JIRA or GitHub link: [NO-ISSUE]
  • Feature: Remove third-party HTTP client dependency in favor of the native fetch API, reducing bundle size and external dependencies.

✅ Checklist

  • Covered by automatic tests — All existing tests migrated from mocking axios to mocking globalThis.fetch. 1,592 tests pass across affected packages.
  • Changeset is provided
  • Documentation is up-to-date
  • Impact of the changes:
    • All HTTP calls now use native fetch instead of axios
    • FetchInterceptor replaces AxiosInterceptor in cal-interceptor (backwards-compatible alias provided)
    • HttpClient interface replaces AxiosInstance in speculos-device-controller
    • No public API changes for consumers of the packages

Made with Cursor

…sources

Migrate all HTTP data sources from axios to the native fetch API,
using URL/URLSearchParams for query params and conditional header spreading
for optional origin tokens.

Made-with: Cursor
Migrate AxiosManagerApiDataSource from axios.get/post to native fetch,
building URLs with URLSearchParams and returning parsed JSON directly
from EitherAsync blocks.

Made-with: Cursor
Remove axios instance factory and use fetch directly for APDU posting,
server availability checks with AbortController timeout, and SSE streaming.

Made-with: Cursor
Introduce HttpClient interface replacing AxiosInstance, implement it with
native fetch and AbortController-based timeouts in the controller factory.

Made-with: Cursor
Replace axios request/response interceptors with globalThis.fetch
monkey-patching. Export FetchInterceptor with AxiosInterceptor alias
for backwards compatibility.

Made-with: Cursor
Migrate all HTTP adapters from axios to fetch, using AbortController for
timeouts, response.arrayBuffer() for binary data, and standard Error
handling instead of AxiosError.

Made-with: Cursor
…talog

Remove axios from 6 package.json files and the pnpm-workspace.yaml catalog
now that all HTTP calls use the native fetch API.

Made-with: Cursor
@vercel
Copy link

vercel bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
device-sdk-ts-sample Building Building Preview, Comment Mar 2, 2026 4:22pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
doc-device-management-kit Ignored Ignored Mar 2, 2026 4:22pm

Request Review

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.

1 participant