Skip to content

feat: add chomp API service#8413

Merged
Jwhiles merged 19 commits intomainfrom
add-chomp-api
Apr 17, 2026
Merged

feat: add chomp API service#8413
Jwhiles merged 19 commits intomainfrom
add-chomp-api

Conversation

@Jwhiles
Copy link
Copy Markdown
Contributor

@Jwhiles Jwhiles commented Apr 9, 2026

  • feat: add chomp-api-service
  • feat: add stubs for all API methods

Explanation

In this PR we create an API client to allow our client applications to use the chomp API. It fixes this ticket

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Introduces a new authenticated HTTP client/service that fetches JWT bearer tokens via messenger and performs write operations against an external API, so incorrect request/response handling could impact downstream flows but existing packages are largely untouched.

Overview
Adds a new @metamask/chomp-api-service package implementing ChompApiService (a BaseDataService) to call the CHOMP API with JWT bearer auth sourced from AuthenticationController:getBearerToken.

The service exposes messenger-callable methods for address association, account upgrade create/get, delegation verification, intent create/list, withdrawal creation, and service-details lookup, with runtime response validation via superstruct, explicit status handling (e.g., 409/404), and comprehensive nock-based tests.

Repo wiring is updated to include the new package in TypeScript project references, the monorepo README package list/graph, CODEOWNERS/teams.json, and yarn.lock.

Reviewed by Cursor Bugbot for commit 0b15c9f. Bugbot is set up for automated code reviews on this repo. Configure here.

@Jwhiles Jwhiles force-pushed the add-chomp-api branch 4 times, most recently from 8b1785b to be04334 Compare April 10, 2026 16:01
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

This looks pretty good so far! I just had a few comments.

Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
});

this.#baseUrl = baseUrl;
this.#getAccessToken = getAccessToken;
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.

Where will this access token come from in the clients? Will this come from another controller or service? If so, then it would be better to use the messenger to retrieve this value instead of taking a callback.

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.

This is was included in the spec written by @MoMannn - but I'm open to using the messenger. Tadej, is there a reason that you called for this design in particular?

Comment thread packages/chomp-api-service/README.md Outdated
Comment thread packages/chomp-api-service/tsconfig.build.json
Comment thread packages/chomp-api-service/CHANGELOG.md Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/types.ts Outdated
@Jwhiles
Copy link
Copy Markdown
Contributor Author

Jwhiles commented Apr 14, 2026

@metamaskbot publish-preview

@Jwhiles
Copy link
Copy Markdown
Contributor Author

Jwhiles commented Apr 14, 2026

@metamaskbot publish-preview

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 14, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@Jwhiles
Copy link
Copy Markdown
Contributor Author

Jwhiles commented Apr 14, 2026

@metamaskbot publish-preview

@Jwhiles Jwhiles force-pushed the add-chomp-api branch 2 times, most recently from 0e8c506 to 08b3d87 Compare April 14, 2026 12:16
@Jwhiles
Copy link
Copy Markdown
Contributor Author

Jwhiles commented Apr 14, 2026

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.0.0-preview-08b3d87
@metamask-previews/accounts-controller@37.2.0-preview-08b3d87
@metamask-previews/address-book-controller@7.1.1-preview-08b3d87
@metamask-previews/ai-controllers@0.6.3-preview-08b3d87
@metamask-previews/analytics-controller@1.0.1-preview-08b3d87
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-08b3d87
@metamask-previews/announcement-controller@8.1.0-preview-08b3d87
@metamask-previews/app-metadata-controller@2.0.1-preview-08b3d87
@metamask-previews/approval-controller@9.0.1-preview-08b3d87
@metamask-previews/assets-controller@5.0.0-preview-08b3d87
@metamask-previews/assets-controllers@103.1.1-preview-08b3d87
@metamask-previews/base-controller@9.0.1-preview-08b3d87
@metamask-previews/base-data-service@0.1.1-preview-08b3d87
@metamask-previews/bridge-controller@70.0.1-preview-08b3d87
@metamask-previews/bridge-status-controller@70.0.5-preview-08b3d87
@metamask-previews/build-utils@3.0.4-preview-08b3d87
@metamask-previews/chain-agnostic-permission@1.5.0-preview-08b3d87
@metamask-previews/chomp-api-service@0.0.0-preview-08b3d87
@metamask-previews/claims-controller@0.5.0-preview-08b3d87
@metamask-previews/client-controller@1.0.1-preview-08b3d87
@metamask-previews/compliance-controller@2.0.0-preview-08b3d87
@metamask-previews/composable-controller@12.0.1-preview-08b3d87
@metamask-previews/config-registry-controller@0.2.0-preview-08b3d87
@metamask-previews/connectivity-controller@0.2.0-preview-08b3d87
@metamask-previews/controller-utils@11.20.0-preview-08b3d87
@metamask-previews/core-backend@6.2.1-preview-08b3d87
@metamask-previews/delegation-controller@3.0.0-preview-08b3d87
@metamask-previews/earn-controller@12.0.0-preview-08b3d87
@metamask-previews/eip-5792-middleware@3.0.3-preview-08b3d87
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.0-preview-08b3d87
@metamask-previews/eip1193-permission-middleware@1.0.3-preview-08b3d87
@metamask-previews/ens-controller@19.1.1-preview-08b3d87
@metamask-previews/eth-block-tracker@15.0.1-preview-08b3d87
@metamask-previews/eth-json-rpc-middleware@23.1.1-preview-08b3d87
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-08b3d87
@metamask-previews/foundryup@1.0.1-preview-08b3d87
@metamask-previews/gas-fee-controller@26.1.1-preview-08b3d87
@metamask-previews/gator-permissions-controller@3.0.1-preview-08b3d87
@metamask-previews/geolocation-controller@0.1.2-preview-08b3d87
@metamask-previews/json-rpc-engine@10.2.4-preview-08b3d87
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-08b3d87
@metamask-previews/keyring-controller@25.2.0-preview-08b3d87
@metamask-previews/logging-controller@8.0.1-preview-08b3d87
@metamask-previews/message-manager@14.1.1-preview-08b3d87
@metamask-previews/messenger@1.1.1-preview-08b3d87
@metamask-previews/messenger-cli@0.1.0-preview-08b3d87
@metamask-previews/money-account-controller@0.1.0-preview-08b3d87
@metamask-previews/multichain-account-service@8.0.1-preview-08b3d87
@metamask-previews/multichain-api-middleware@2.0.0-preview-08b3d87
@metamask-previews/multichain-network-controller@3.0.6-preview-08b3d87
@metamask-previews/multichain-transactions-controller@7.0.4-preview-08b3d87
@metamask-previews/name-controller@9.1.1-preview-08b3d87
@metamask-previews/network-controller@30.0.1-preview-08b3d87
@metamask-previews/network-enablement-controller@5.0.2-preview-08b3d87
@metamask-previews/notification-services-controller@23.0.1-preview-08b3d87
@metamask-previews/permission-controller@12.3.0-preview-08b3d87
@metamask-previews/permission-log-controller@5.1.0-preview-08b3d87
@metamask-previews/perps-controller@3.0.0-preview-08b3d87
@metamask-previews/phishing-controller@17.1.1-preview-08b3d87
@metamask-previews/polling-controller@16.0.4-preview-08b3d87
@metamask-previews/preferences-controller@23.1.0-preview-08b3d87
@metamask-previews/profile-metrics-controller@3.1.3-preview-08b3d87
@metamask-previews/profile-sync-controller@28.0.2-preview-08b3d87
@metamask-previews/ramps-controller@13.1.0-preview-08b3d87
@metamask-previews/rate-limit-controller@7.0.1-preview-08b3d87
@metamask-previews/react-data-query@0.2.0-preview-08b3d87
@metamask-previews/remote-feature-flag-controller@4.2.0-preview-08b3d87
@metamask-previews/sample-controllers@4.0.4-preview-08b3d87
@metamask-previews/seedless-onboarding-controller@9.1.0-preview-08b3d87
@metamask-previews/selected-network-controller@26.1.0-preview-08b3d87
@metamask-previews/shield-controller@5.1.1-preview-08b3d87
@metamask-previews/signature-controller@39.1.2-preview-08b3d87
@metamask-previews/social-controllers@0.1.0-preview-08b3d87
@metamask-previews/storage-service@1.0.1-preview-08b3d87
@metamask-previews/subscription-controller@6.1.2-preview-08b3d87
@metamask-previews/transaction-controller@64.2.0-preview-08b3d87
@metamask-previews/transaction-pay-controller@19.1.1-preview-08b3d87
@metamask-previews/user-operation-controller@41.2.0-preview-08b3d87

@Jwhiles Jwhiles force-pushed the add-chomp-api branch 5 times, most recently from 039faf6 to 2f413ac Compare April 16, 2026 14:35
@Jwhiles Jwhiles marked this pull request as ready for review April 16, 2026 14:43
@Jwhiles Jwhiles requested a review from a team as a code owner April 16, 2026 14:43
@Jwhiles Jwhiles requested review from MoMannn and mcmire April 16, 2026 14:45
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a820fad. Configure here.

Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
@Jwhiles Jwhiles added team-earn team-delegation MetaMask Delegation Team labels Apr 17, 2026
Comment thread packages/chomp-api-service/src/chomp-api-service-method-action-types.ts Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/types.ts Outdated
MoMannn
MoMannn previously approved these changes Apr 17, 2026
shane-t
shane-t previously approved these changes Apr 17, 2026
mcmire
mcmire previously approved these changes Apr 17, 2026
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Left some comments below. All are minor (some are nitpicks). The way you've used BaseDataService seems good to me and everything seems in order here.

Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts Outdated
Comment thread packages/chomp-api-service/src/chomp-api-service.ts
@Jwhiles Jwhiles dismissed stale reviews from mcmire, shane-t, and MoMannn via 0b15c9f April 17, 2026 14:30
@Jwhiles Jwhiles requested review from MoMannn, mcmire and shane-t April 17, 2026 14:30
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM!

@Jwhiles Jwhiles added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit c39290d Apr 17, 2026
350 checks passed
@Jwhiles Jwhiles deleted the add-chomp-api branch April 17, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-delegation MetaMask Delegation Team team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants