-
-
Notifications
You must be signed in to change notification settings - Fork 274
add money account upgrade controller #8426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Jwhiles
wants to merge
21
commits into
add-chomp-api
Choose a base branch
from
add-money-account-upgrade-controller
base: add-chomp-api
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3b713bd
feat: add chomp-api-service
Jwhiles 84bdd06
feat: add stubs for all API methods
Jwhiles 22706ec
feat: add implementation of chomp-api
Jwhiles e35fea5
chore: fix spelling of chomp
Jwhiles dd4629a
feat: use the fetchQuery for non cached calls
Jwhiles 3674b4b
fix: small error in changelog
Jwhiles 58b2b1f
fix: update tsconfig files
Jwhiles 5b47a8f
feat: validate hex strings and share upgrade reponse type
Jwhiles ea3ea2e
feat: use the messenger to get token
Jwhiles 5476a1b
fix: re-generate lockfile
Jwhiles cd392ec
chore: update teams.json to include new chomp service
Jwhiles 5db43ed
feat: get service detail method to chomp client
Jwhiles d2309e2
feat: add scaffold for money account upgrade controller
Jwhiles 429cd67
feat: add initial version of the money account upgrade controller
Jwhiles c4b4f25
feat: use webcrypto instead of global this
Jwhiles 8b4fc01
chore: fix version of auto-changelog
Jwhiles c5f3a1d
chore: update teams.json
Jwhiles eab1074
chore: fix linting of package.json files
Jwhiles e31c503
fix: include new upgrade controller in build
Jwhiles 9c8c0a0
chore: regen lockfile
Jwhiles 9fac52d
feat: add init method to upgrade controller
Jwhiles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,8 @@ | |||||
| ## Earn Team | ||||||
| /packages/earn-controller @MetaMask/earn | ||||||
| /packages/money-account-balance-service @MetaMask/earn | ||||||
| /packages/chomp-api-service @MetaMask/earn | ||||||
| /packages/money-account-upgrade-controller @MetaMask/earn | ||||||
|
|
||||||
| ## Social AI Team | ||||||
| /packages/ai-controllers @MetaMask/social-ai | ||||||
|
|
@@ -229,3 +231,7 @@ | |||||
| /packages/social-controllers/CHANGELOG.md @MetaMask/social-ai @MetaMask/core-platform | ||||||
| /packages/money-account-controller/package.json @MetaMask/accounts-engineers @MetaMask/core-platform | ||||||
| /packages/money-account-controller/CHANGELOG.md @MetaMask/accounts-engineers @MetaMask/core-platform | ||||||
| /packages/chomp-api-service/package.json @MetaMask/accounts-engineers @MetaMask/core-platform | ||||||
| /packages/chomp-api-service/CHANGELOG.md @MetaMask/accounts-engineers @MetaMask/core-platform | ||||||
| /packages/money-account-upgrade-controller/package.json @MetaMask/accounts-engineers @MetaMask/core-platform | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| /packages/money-account-upgrade-controller/CHANGELOG.md @MetaMask/accounts-engineers @MetaMask/core-platform | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| ### Added | ||
|
|
||
| - Add `ChompApiService` ([#8413](https://github.com/MetaMask/core/pull/8413)) | ||
| - Add `getServiceDetails` method to retrieve delegation redeemer addresses and DeFi contract details for auto-deposit functionality | ||
|
|
||
| [Unreleased]: https://github.com/MetaMask/core/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 MetaMask | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # `@metamask/chomp-api-service` | ||
|
|
||
| Chomp API data service. | ||
|
|
||
| ## Installation | ||
|
|
||
| `yarn add @metamask/chomp-api-service` | ||
|
|
||
| or | ||
|
|
||
| `npm install @metamask/chomp-api-service` | ||
|
|
||
| ## Contributing | ||
|
|
||
| This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * For a detailed explanation regarding each configuration property and type check, visit: | ||
| * https://jestjs.io/docs/configuration | ||
| */ | ||
|
|
||
| const merge = require('deepmerge'); | ||
| const path = require('path'); | ||
|
|
||
| const baseConfig = require('../../jest.config.packages'); | ||
|
|
||
| const displayName = path.basename(__dirname); | ||
|
|
||
| module.exports = merge(baseConfig, { | ||
| // The display name when running multiple projects | ||
| displayName, | ||
|
|
||
| // An object that configures minimum threshold enforcement for coverage results | ||
| coverageThreshold: { | ||
| global: { | ||
| branches: 100, | ||
| functions: 100, | ||
| lines: 100, | ||
| statements: 100, | ||
| }, | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| "name": "@metamask/chomp-api-service", | ||
| "version": "0.0.0", | ||
| "description": "Data service for the Chomp API", | ||
| "keywords": [ | ||
| "Ethereum", | ||
| "MetaMask" | ||
| ], | ||
| "homepage": "https://github.com/MetaMask/core/tree/main/packages/chomp-api-service#readme", | ||
| "bugs": { | ||
| "url": "https://github.com/MetaMask/core/issues" | ||
| }, | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/MetaMask/core.git" | ||
| }, | ||
| "files": [ | ||
| "dist/" | ||
| ], | ||
| "sideEffects": false, | ||
| "main": "./dist/index.cjs", | ||
| "types": "./dist/index.d.cts", | ||
| "exports": { | ||
| ".": { | ||
| "import": { | ||
| "types": "./dist/index.d.mts", | ||
| "default": "./dist/index.mjs" | ||
| }, | ||
| "require": { | ||
| "types": "./dist/index.d.cts", | ||
| "default": "./dist/index.cjs" | ||
| } | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "registry": "https://registry.npmjs.org/" | ||
| }, | ||
| "scripts": { | ||
| "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", | ||
| "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean", | ||
| "build:docs": "typedoc", | ||
| "changelog:update": "../../scripts/update-changelog.sh @metamask/chomp-api-service", | ||
| "changelog:validate": "../../scripts/validate-changelog.sh @metamask/chomp-api-service", | ||
| "since-latest-release": "../../scripts/since-latest-release.sh", | ||
| "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", | ||
| "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", | ||
| "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", | ||
| "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" | ||
| }, | ||
| "dependencies": { | ||
| "@metamask/base-data-service": "^0.1.1", | ||
| "@metamask/controller-utils": "^11.20.0", | ||
| "@metamask/messenger": "^1.1.1", | ||
| "@metamask/superstruct": "^3.1.0", | ||
| "@metamask/utils": "^11.9.0", | ||
| "@tanstack/query-core": "^4.43.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@metamask/auto-changelog": "^6.0.0", | ||
| "@ts-bridge/cli": "^0.6.4", | ||
| "@types/jest": "^29.5.14", | ||
| "deepmerge": "^4.2.2", | ||
| "jest": "^29.7.0", | ||
| "nock": "^13.3.1", | ||
| "ts-jest": "^29.2.5", | ||
| "typedoc": "^0.25.13", | ||
| "typedoc-plugin-missing-exports": "^2.0.0", | ||
| "typescript": "~5.3.3" | ||
| }, | ||
| "engines": { | ||
| "node": "^18.18 || >=20" | ||
| } | ||
| } |
83 changes: 83 additions & 0 deletions
83
packages/chomp-api-service/src/chomp-api-service-method-action-types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /** | ||
| * This file is auto generated. | ||
| * Do not edit manually. | ||
| */ | ||
|
|
||
| import type { ChompApiService } from './chomp-api-service'; | ||
|
|
||
| /** | ||
| * Associates an address with a CHOMP profile via POST /v1/auth/address. | ||
| */ | ||
| export type ChompApiServiceAssociateAddressAction = { | ||
| type: `ChompApiService:associateAddress`; | ||
| handler: ChompApiService['associateAddress']; | ||
| }; | ||
|
|
||
| /** | ||
| * Creates an account upgrade via POST /v1/account-upgrade. | ||
| */ | ||
| export type ChompApiServiceCreateUpgradeAction = { | ||
| type: `ChompApiService:createUpgrade`; | ||
| handler: ChompApiService['createUpgrade']; | ||
| }; | ||
|
|
||
| /** | ||
| * Fetches the upgrade record for an address via GET /v1/account-upgrade/:address. | ||
| */ | ||
| export type ChompApiServiceGetUpgradeAction = { | ||
| type: `ChompApiService:getUpgrade`; | ||
| handler: ChompApiService['getUpgrade']; | ||
| }; | ||
|
|
||
| /** | ||
| * Verifies a delegation via POST /v1/intent/verify-delegation. | ||
| */ | ||
| export type ChompApiServiceVerifyDelegationAction = { | ||
| type: `ChompApiService:verifyDelegation`; | ||
| handler: ChompApiService['verifyDelegation']; | ||
| }; | ||
|
|
||
| /** | ||
| * Submits intents via POST /v1/intent. | ||
| */ | ||
| export type ChompApiServiceCreateIntentsAction = { | ||
| type: `ChompApiService:createIntents`; | ||
| handler: ChompApiService['createIntents']; | ||
| }; | ||
|
|
||
| /** | ||
| * Fetches intents by address via GET /v1/intent/account/:address. | ||
| */ | ||
| export type ChompApiServiceGetIntentsByAddressAction = { | ||
| type: `ChompApiService:getIntentsByAddress`; | ||
| handler: ChompApiService['getIntentsByAddress']; | ||
| }; | ||
|
|
||
| /** | ||
| * Creates a withdrawal for card spend flows. | ||
| */ | ||
| export type ChompApiServiceCreateWithdrawalAction = { | ||
| type: `ChompApiService:createWithdrawal`; | ||
| handler: ChompApiService['createWithdrawal']; | ||
| }; | ||
|
|
||
| /** | ||
| * Retrieves service details via GET /v1/chomp. | ||
| */ | ||
| export type ChompApiServiceGetServiceDetailsAction = { | ||
| type: `ChompApiService:getServiceDetails`; | ||
| handler: ChompApiService['getServiceDetails']; | ||
| }; | ||
|
|
||
| /** | ||
| * Union of all ChompApiService action types. | ||
| */ | ||
| export type ChompApiServiceMethodActions = | ||
| | ChompApiServiceAssociateAddressAction | ||
| | ChompApiServiceCreateUpgradeAction | ||
| | ChompApiServiceGetUpgradeAction | ||
| | ChompApiServiceVerifyDelegationAction | ||
| | ChompApiServiceCreateIntentsAction | ||
| | ChompApiServiceGetIntentsByAddressAction | ||
| | ChompApiServiceCreateWithdrawalAction | ||
| | ChompApiServiceGetServiceDetailsAction; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.