Skip to content

feat(money): scaffold a data service package which talks to Money Account API#9278

Merged
ffmcgee725 merged 1 commit into
mainfrom
jc/MUSD-1042
Jul 7, 2026
Merged

feat(money): scaffold a data service package which talks to Money Account API#9278
ffmcgee725 merged 1 commit into
mainfrom
jc/MUSD-1042

Conversation

@ffmcgee725

@ffmcgee725 ffmcgee725 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Explanation

Scaffolds the new @metamask/money-account-api-data-service package using yarn create-package. This is the minimal setup required before implementing the service logic (which will follow in a stacked PR).

Changes include:

  • Generated package structure (package.json, tsconfig.json, tsconfig.build.json, jest.config.js, typedoc.json, LICENSE, README.md, CHANGELOG.md, placeholder src/index.ts)
  • Root tsconfig.json and tsconfig.build.json project references
  • CODEOWNERS ownership entries for @MetaMask/earn
  • teams.json mapping to team-earn
  • yarn.lock update

References

  • Sibling package: packages/money-account-balance-service

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: No breaking changes — this is a new empty package scaffold.


Note

Low Risk
New package with no production logic or consumer integrations; changes are mostly boilerplate and metadata.

Overview
Adds a new monorepo package @metamask/money-account-api-data-service, intended (per README) to fetch Money Account API data such as positions, interest, cash-flow history, and vault rate history. This PR is scaffold only: standard create-package layout (build/test/tsconfig, licenses, changelog) and a placeholder greeter export in src/index.ts—no API client or base-data-service integration yet.

Wires the package into the repo: root tsconfig.json / tsconfig.build.json references, README package list and dependency graph node, CODEOWNERS and teams.json (@MetaMask/earn / team-earn), release ownership entries, and yarn.lock. Also reorders platform-api-docs in the root tsconfig reference lists (no functional change to that package).

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

@ffmcgee725 ffmcgee725 requested a review from a team as a code owner June 26, 2026 09:16

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 9c5495a. Configure here.

Comment thread packages/money-account-api-data-service/src/money-account-api-data-service.ts Outdated
@ffmcgee725 ffmcgee725 requested a review from Matt561 June 26, 2026 09:30
shane-t
shane-t previously approved these changes Jul 7, 2026
Adds the initial package scaffold for the Money Account API data service
using `yarn create-package`, along with monorepo registration in
CODEOWNERS and teams.json.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ffmcgee725 ffmcgee725 changed the title feat(money): add a data service which talks to Money Account API feat(money): scaffold a data service package which talks to Money Account API Jul 7, 2026
@ffmcgee725 ffmcgee725 added this pull request to the merge queue Jul 7, 2026
Merged via the queue into main with commit 9821507 Jul 7, 2026
418 of 419 checks passed
@ffmcgee725 ffmcgee725 deleted the jc/MUSD-1042 branch July 7, 2026 09:26
defiQUG pushed a commit to defiQUG/core that referenced this pull request Jul 7, 2026
## Explanation

The Earn team currently lacks a dedicated data service for fetching user
positions, interest accruals, cash-flow history, and vault rate history
from the **Money Account API** (vertical app hosted at
`money.api.cx.metamask.io`).

Follow up to MetaMask#9278

This PR introduces `@metamask/money-account-api-data-service`, a new
package that:

- Extends `BaseDataService` to leverage TanStack Query caching, service
policy (retries + circuit-breaking), and messenger integration out of
the box.
- Exposes 4 methods via the messenger: `fetchPositions`,
`fetchInterest`, `fetchHistory`, `fetchRateHistory`.
- Uses `@metamask/superstruct` for runtime response validation, with
types derived from structs (`Infer<typeof ...Struct>`) to prevent
type/struct drift.
- Includes detailed validation error messages (superstruct failure
details + error `cause` chain) for easier production debugging.
- Uses `fetchInfiniteQuery` for the cursor-paginated history endpoint,
giving consumers proper TanStack Query pagination semantics.
- Configures `retryFilterPolicy` to skip retrying validation errors
(malformed responses won't fix themselves).
- Supports environment switching (`dev` / `uat` / `prd`) via an `Env`
enum + URL map, following the `claims-controller` pattern.

This is architected as an **independent service**. The client calls it
directly for API-sourced data, separate from
`money-account-balance-service` which handles RPC-based balance
fetching. **A future orchestration layer may unify these**.

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [x] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

> **Note:** No breaking changes introduced — this is an entirely new
package (`v0.0.0`).

---

> [!NOTE]
> **Low Risk**
> New isolated package with no changes to existing controllers; risk is
limited to future consumers trusting API-sourced financial display data
and external API contract stability.
> 
> **Overview**
> Adds **`@metamask/money-account-api-data-service`**, a new Earn-team
package that fetches vault positions, interest, cash-flow history, and
vault rate history from the Money Account HTTP API (separate from
RPC-based `money-account-balance-service`).
> 
> **`MoneyAccountApiDataService`** extends `BaseDataService` with
TanStack Query caching, messenger actions (`fetchPositions`,
`fetchInterest`, `fetchHistory`, `fetchRateHistory`,
`invalidateQueries`), dev/uat/prd base URLs via `Env`, and
superstruct-validated responses with
**`MoneyAccountApiResponseValidationError`** (no retries on validation
failures). History uses **`fetchInfiniteQuery`** for cursor pagination;
other endpoints use tuned stale times aligned with server cache TTLs.
> 
> Monorepo wiring updates **CODEOWNERS**, **README**, **teams.json**,
root **tsconfig** references, and **yarn.lock** for the new workspace
package.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ae6334b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants