Skip to content
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

feat: add earn controller package #5210

Merged
merged 22 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8a5918c
feat: add @metamask/earn-controller package
amitabh94 Jan 10, 2025
ceb6a86
feat: add stake-sdk dependency and update earn-controller package
amitabh94 Jan 23, 2025
aa97f71
fix: update earn-controller package.json for improved module exports …
amitabh94 Jan 23, 2025
e7fd2ec
feat: assign earn-controller to staking team
amitabh94 Jan 24, 2025
786d84b
chore: update earn-controller dependencies and typeScript configuration
amitabh94 Jan 27, 2025
1051206
feat: add method to fetch staking data and update state
amitabh94 Jan 28, 2025
4296194
refactor: update stablecoin lending product type and default state
amitabh94 Jan 28, 2025
56ee728
feat: add tests for earn controller
amitabh94 Jan 29, 2025
a29df11
feat: enhance EarnController network change and SDK initialization tests
amitabh94 Jan 29, 2025
8ffc575
refactor: improve EarnController data fetching and error handling
amitabh94 Jan 29, 2025
209b9ee
chore: revert threshold file change
amitabh94 Jan 29, 2025
1b006b3
chore: update CODEOWNERS for earn-controller package
amitabh94 Jan 29, 2025
f8272ba
chore: update earn-controller package dependencies and peer dependencies
amitabh94 Jan 29, 2025
472d096
refactor: simplify EarnController state management and remove enum
amitabh94 Jan 29, 2025
89f94ad
refactor: improve EarnController data fetching and error handling
amitabh94 Jan 31, 2025
aabeb1d
feat: improve EarnController test coverage and error handling
amitabh94 Jan 31, 2025
0cb360a
Merge branch 'main' into STAKE-896-create-new-earn-controller
amitabh94 Jan 31, 2025
d4c2fe7
chore: update @metamask/accounts-controller and network-controller de…
amitabh94 Jan 31, 2025
8f36ebc
chore: update team label for earn-controller from 'team-stake' to 'te…
amitabh94 Jan 31, 2025
edfe0a8
feat: add JSDoc for controller methods
amitabh94 Jan 31, 2025
db7a6c1
chore: remove skipLibCheck from tsconfig.build.json
amitabh94 Jan 31, 2025
b76aed1
Merge branch 'main' into STAKE-896-create-new-earn-controller
amitabh94 Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Each package in this repository has its own README where you can find installati
- [`@metamask/build-utils`](packages/build-utils)
- [`@metamask/composable-controller`](packages/composable-controller)
- [`@metamask/controller-utils`](packages/controller-utils)
- [`@metamask/earn-controller`](packages/earn-controller)
- [`@metamask/ens-controller`](packages/ens-controller)
- [`@metamask/eth-json-rpc-provider`](packages/eth-json-rpc-provider)
- [`@metamask/gas-fee-controller`](packages/gas-fee-controller)
Expand Down Expand Up @@ -74,6 +75,7 @@ linkStyle default opacity:0.5
build_utils(["@metamask/build-utils"]);
composable_controller(["@metamask/composable-controller"]);
controller_utils(["@metamask/controller-utils"]);
earn_controller(["@metamask/earn-controller"]);
ens_controller(["@metamask/ens-controller"]);
eth_json_rpc_provider(["@metamask/eth-json-rpc-provider"]);
gas_fee_controller(["@metamask/gas-fee-controller"]);
Expand Down
2 changes: 1 addition & 1 deletion eslint-warning-thresholds.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@typescript-eslint/no-unsafe-enum-comparison": 34,
"@typescript-eslint/no-unused-vars": 41,
"@typescript-eslint/prefer-promise-reject-errors": 33,
"@typescript-eslint/prefer-readonly": 143,
"@typescript-eslint/prefer-readonly": 142,
amitabh94 marked this conversation as resolved.
Show resolved Hide resolved
"import-x/namespace": 189,
"import-x/no-named-as-default": 1,
"import-x/no-named-as-default-member": 8,
Expand Down
10 changes: 10 additions & 0 deletions packages/earn-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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]

[Unreleased]: https://github.com/MetaMask/core/
20 changes: 20 additions & 0 deletions packages/earn-controller/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2025 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
15 changes: 15 additions & 0 deletions packages/earn-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `@metamask/earn-controller`

Manages state for earning features and coordinates interactions between staking services, SDK integrations, and other controllers to enable users to participate in various earning opportunities.

## Installation

`yarn add @metamask/earn-controller`

or

`npm install @metamask/earn-controller`

## Contributing

This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
26 changes: 26 additions & 0 deletions packages/earn-controller/jest.config.js
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,
},
},
});
76 changes: 76 additions & 0 deletions packages/earn-controller/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "@metamask/earn-controller",
"version": "0.0.0",
"description": "Manages state for earning features and coordinates interactions between staking services, SDK integrations, and other controllers to enable users to participate in various earning opportunities",
"keywords": [
"MetaMask",
"Ethereum"
],
"homepage": "https://github.com/MetaMask/core/tree/main/packages/earn-controller#readme",
"bugs": {
"url": "https://github.com/MetaMask/core/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/core.git"
},
"license": "MIT",
"sideEffects": false,
"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"
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/earn-controller",
"changelog:update": "../../scripts/update-changelog.sh @metamask/earn-controller",
"publish:preview": "yarn npm publish --tag preview",
"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",
"since-latest-release": "../../scripts/since-latest-release.sh"
},
"dependencies": {
"@metamask/base-controller": "^7.1.1",
"@metamask/stake-sdk": "^1.0.0"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@types/jest": "^27.4.1",
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.2.2"
},
"peerDependencies": {
"@ethersproject/providers": "^5.7.0",
"@metamask/accounts-controller": "^21.0.0",
amitabh94 marked this conversation as resolved.
Show resolved Hide resolved
"@metamask/controller-utils": "^11.4.5",
amitabh94 marked this conversation as resolved.
Show resolved Hide resolved
"@metamask/network-controller": "^22.0.0"
amitabh94 marked this conversation as resolved.
Show resolved Hide resolved
},
"engines": {
"node": "^18.18 || >=20"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
Loading
Loading