@metamask-previews/earn-controller 12.2.7-preview-6eff555ee → 13.0.0-preview-97d6b86c0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/dist/{EarnController-method-action-types.d.mts → EarnController-method-action-types.d.ts} +2 -2
- package/dist/EarnController-method-action-types.d.ts.map +1 -0
- package/dist/{EarnController-method-action-types.mjs → EarnController-method-action-types.js} +1 -1
- package/dist/EarnController-method-action-types.js.map +1 -0
- package/dist/{EarnController.d.cts → EarnController.d.ts} +12 -12
- package/dist/EarnController.d.ts.map +1 -0
- package/dist/{EarnController.mjs → EarnController.js} +150 -135
- package/dist/EarnController.js.map +1 -0
- package/dist/{index.d.cts → index.d.ts} +6 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/{index.mjs → index.js} +4 -4
- package/dist/index.js.map +1 -0
- package/dist/{selectors.d.cts → selectors.d.ts} +117 -117
- package/dist/selectors.d.ts.map +1 -0
- package/dist/{selectors.mjs → selectors.js} +4 -5
- package/dist/selectors.js.map +1 -0
- package/dist/{types.d.cts → types.d.ts} +1 -1
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +18 -22
- package/dist/EarnController-method-action-types.cjs +0 -7
- package/dist/EarnController-method-action-types.cjs.map +0 -1
- package/dist/EarnController-method-action-types.d.cts +0 -263
- package/dist/EarnController-method-action-types.d.cts.map +0 -1
- package/dist/EarnController-method-action-types.d.mts.map +0 -1
- package/dist/EarnController-method-action-types.mjs.map +0 -1
- package/dist/EarnController.cjs +0 -778
- package/dist/EarnController.cjs.map +0 -1
- package/dist/EarnController.d.cts.map +0 -1
- package/dist/EarnController.d.mts +0 -365
- package/dist/EarnController.d.mts.map +0 -1
- package/dist/EarnController.mjs.map +0 -1
- package/dist/index.cjs +0 -33
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -6
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/selectors.cjs +0 -121
- package/dist/selectors.cjs.map +0 -1
- package/dist/selectors.d.cts.map +0 -1
- package/dist/selectors.d.mts +0 -1518
- package/dist/selectors.d.mts.map +0 -1
- package/dist/selectors.mjs.map +0 -1
- package/dist/types.cjs +0 -3
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts +0 -21
- package/dist/types.d.mts.map +0 -1
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [13.0.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Drop CommonJS support ([#9536](https://github.com/MetaMask/core/pull/9536))
|
|
15
|
+
- This package is now ESM-only, but can still be used in CommonJS projects via `require(esm)` in modern Node.js versions (22+), or dynamic imports in older Node.js versions.
|
|
16
|
+
- **BREAKING:** Bump minimum Node.js version to 22 ([#9976](https://github.com/MetaMask/core/pull/9976))
|
|
17
|
+
- **BREAKING:** Bump TypeScript target to ES2022 ([#10019](https://github.com/MetaMask/core/pull/10019))
|
|
18
|
+
- This package now ships ES2022 code, requiring a compatible modern environment or bundler configuration to consume.
|
|
19
|
+
- Bump `@metamask/account-tree-controller` from `^9.0.0` to `^10.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
20
|
+
- Bump `@metamask/base-controller` from `^9.1.0` to `^10.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
21
|
+
- Bump `@metamask/controller-utils` from `^12.3.0` to `^13.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
22
|
+
- Bump `@metamask/messenger` from `^2.0.0` to `^3.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
23
|
+
- Bump `@metamask/network-controller` from `^36.0.0` to `^37.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
24
|
+
|
|
10
25
|
## [12.2.7]
|
|
11
26
|
|
|
12
27
|
### Changed
|
|
@@ -517,7 +532,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
517
532
|
|
|
518
533
|
- Initial release ([#5271](https://github.com/MetaMask/core/pull/5271))
|
|
519
534
|
|
|
520
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@
|
|
535
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@13.0.0...HEAD
|
|
536
|
+
[13.0.0]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@12.2.7...@metamask/earn-controller@13.0.0
|
|
521
537
|
[12.2.7]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@12.2.6...@metamask/earn-controller@12.2.7
|
|
522
538
|
[12.2.6]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@12.2.5...@metamask/earn-controller@12.2.6
|
|
523
539
|
[12.2.5]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@12.2.4...@metamask/earn-controller@12.2.5
|
package/dist/{EarnController-method-action-types.d.mts → EarnController-method-action-types.d.ts}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { EarnController } from
|
|
5
|
+
import type { EarnController } from './EarnController.js';
|
|
6
6
|
/**
|
|
7
7
|
* Refreshes the pooled stakes data for the current account.
|
|
8
8
|
* Fetches updated stake information including lifetime rewards, assets, and exit requests
|
|
@@ -260,4 +260,4 @@ export type EarnControllerGetLendingTokenMaxDepositAction = {
|
|
|
260
260
|
* Union of all EarnController action types.
|
|
261
261
|
*/
|
|
262
262
|
export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
|
|
263
|
-
//# sourceMappingURL=EarnController-method-action-types.d.
|
|
263
|
+
//# sourceMappingURL=EarnController-method-action-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EarnController-method-action-types.d.ts","sourceRoot":"","sources":["../src/EarnController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,cAAc,CAAC,mCAAmC,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,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,GAC5C,yCAAyC,GACzC,2CAA2C,GAC3C,sCAAsC,GACtC,yCAAyC,GACzC,qCAAqC,GACrC,6CAA6C,GAC7C,wDAAwD,GACxD,yCAAyC,GACzC,0CAA0C,GAC1C,8CAA8C,GAC9C,4CAA4C,GAC5C,8CAA8C,GAC9C,6CAA6C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EarnController-method-action-types.js","sourceRoot":"","sources":["../src/EarnController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { EarnController } from './EarnController.js';\n\n/**\n * Refreshes the pooled stakes data for the current account.\n * Fetches updated stake information including lifetime rewards, assets, and exit requests\n * from the staking API service and updates the state.\n *\n * @param options - Optional arguments\n * @param [options.resetCache] - Control whether the BE cache should be invalidated (optional).\n * @param [options.address] - The address to refresh pooled stakes for (optional).\n * @param [options.chainId] - The chain id to refresh pooled stakes for (optional).\n * @returns A promise that resolves when the stakes data has been updated\n */\nexport type EarnControllerRefreshPooledStakesAction = {\n type: `EarnController:refreshPooledStakes`;\n handler: EarnController['refreshPooledStakes'];\n};\n\n/**\n * Refreshes the earn eligibility status for the current account.\n * Updates the eligibility status in the controller state based on the location and address blocklist for compliance.\n *\n * Note: Pooled-staking and Lending used the same result since there isn't a need to split these up right now.\n *\n * @param options - Optional arguments\n * @param [options.address] - Address to refresh earn eligibility for (optional).\n * @returns A promise that resolves when the eligibility status has been updated\n */\nexport type EarnControllerRefreshEarnEligibilityAction = {\n type: `EarnController:refreshEarnEligibility`;\n handler: EarnController['refreshEarnEligibility'];\n};\n\n/**\n * Refreshes pooled staking vault metadata for the current chain.\n * Updates the vault metadata in the controller state including APY, capacity,\n * fee percentage, total assets, and vault address.\n *\n * @param [chainId] - The chain id to refresh pooled staking vault metadata for (optional).\n * @returns A promise that resolves when the vault metadata has been updated\n */\nexport type EarnControllerRefreshPooledStakingVaultMetadataAction = {\n type: `EarnController:refreshPooledStakingVaultMetadata`;\n handler: EarnController['refreshPooledStakingVaultMetadata'];\n};\n\n/**\n * Refreshes pooled staking vault daily apys for the current chain.\n * Updates the pooled staking vault daily apys controller state.\n *\n * @param [options] - The options for refreshing pooled staking vault daily apys.\n * @param [options.chainId] - The chain id to refresh pooled staking vault daily apys for (defaults to Ethereum).\n * @param [options.days] - The number of days to fetch pooled staking vault daily apys for (defaults to 365).\n * @param [options.order] - The order in which to fetch pooled staking vault daily apys. Descending order fetches the latest N days (latest working backwards). Ascending order fetches the oldest N days (oldest working forwards) (defaults to 'desc').\n * @returns A promise that resolves when the pooled staking vault daily apys have been updated.\n */\nexport type EarnControllerRefreshPooledStakingVaultDailyApysAction = {\n type: `EarnController:refreshPooledStakingVaultDailyApys`;\n handler: EarnController['refreshPooledStakingVaultDailyApys'];\n};\n\n/**\n * Refreshes pooled staking vault apy averages for the current chain.\n * Updates the pooled staking vault apy averages controller state.\n *\n * @param [chainId] - The chain id to refresh pooled staking vault apy averages for (optional).\n * @returns A promise that resolves when the pooled staking vault apy averages have been updated.\n */\nexport type EarnControllerRefreshPooledStakingVaultApyAveragesAction = {\n type: `EarnController:refreshPooledStakingVaultApyAverages`;\n handler: EarnController['refreshPooledStakingVaultApyAverages'];\n};\n\n/**\n * Refreshes all pooled staking related data including stakes, eligibility, and vault data.\n * This method allows partial success, meaning some data may update while other requests fail.\n * All errors are collected and thrown as a single error message.\n *\n * @param options - Optional arguments\n * @param [options.resetCache] - Control whether the BE cache should be invalidated (optional).\n * @param [options.address] - The address to refresh pooled stakes for (optional).\n * @returns A promise that resolves when all possible data has been updated\n * @throws {Error} If any of the refresh operations fail, with concatenated error messages\n */\nexport type EarnControllerRefreshPooledStakingDataAction = {\n type: `EarnController:refreshPooledStakingData`;\n handler: EarnController['refreshPooledStakingData'];\n};\n\n/**\n * Refreshes the lending markets data for all chains.\n * Updates the lending markets in the controller state.\n *\n * @returns A promise that resolves when the lending markets have been updated\n */\nexport type EarnControllerRefreshLendingMarketsAction = {\n type: `EarnController:refreshLendingMarkets`;\n handler: EarnController['refreshLendingMarkets'];\n};\n\n/**\n * Refreshes the lending positions for the current account.\n * Updates the lending positions in the controller state.\n *\n * @param options - Optional arguments\n * @param [options.address] - The address to refresh lending positions for (optional).\n * @returns A promise that resolves when the lending positions have been updated\n */\nexport type EarnControllerRefreshLendingPositionsAction = {\n type: `EarnController:refreshLendingPositions`;\n handler: EarnController['refreshLendingPositions'];\n};\n\n/**\n * Refreshes all lending related data including markets, positions, and eligibility.\n * This method allows partial success, meaning some data may update while other requests fail.\n * All errors are collected and thrown as a single error message.\n *\n * @returns A promise that resolves when all possible data has been updated\n * @throws {Error} If any of the refresh operations fail, with concatenated error messages\n */\nexport type EarnControllerRefreshLendingDataAction = {\n type: `EarnController:refreshLendingData`;\n handler: EarnController['refreshLendingData'];\n};\n\n/**\n * Refreshes the APY for TRON staking.\n * The consumer provides a fetcher function that returns the APY for TRON.\n *\n * @param apyFetcher - An async function that fetches and returns the APY as a decimal string.\n * @returns A promise that resolves when the APY has been updated.\n */\nexport type EarnControllerRefreshTronStakingApyAction = {\n type: `EarnController:refreshTronStakingApy`;\n handler: EarnController['refreshTronStakingApy'];\n};\n\n/**\n * Gets the TRON staking APY.\n *\n * @returns The APY for TRON staking, or undefined if not available.\n */\nexport type EarnControllerGetTronStakingApyAction = {\n type: `EarnController:getTronStakingApy`;\n handler: EarnController['getTronStakingApy'];\n};\n\n/**\n * Gets the lending position history for the current account.\n *\n * @param options - Optional arguments\n * @param [options.address] - The address to get lending position history for (optional).\n * @param options.chainId - The chain id to get lending position history for.\n * @param [options.positionId] - The position id to get lending position history for.\n * @param [options.marketId] - The market id to get lending position history for.\n * @param [options.marketAddress] - The market address to get lending position history for.\n * @param [options.protocol] - The protocol to get lending position history for.\n * @param [options.days] - The number of days to get lending position history for (optional).\n * @returns A promise that resolves when the lending position history has been updated\n */\nexport type EarnControllerGetLendingPositionHistoryAction = {\n type: `EarnController:getLendingPositionHistory`;\n handler: EarnController['getLendingPositionHistory'];\n};\n\n/**\n * Gets the lending market daily apys and averages for the current chain.\n *\n * @param options - Optional arguments\n * @param options.chainId - The chain id to get lending market daily apys and averages for.\n * @param [options.protocol] - The protocol to get lending market daily apys and averages for.\n * @param [options.marketId] - The market id to get lending market daily apys and averages for.\n * @param [options.days] - The number of days to get lending market daily apys and averages for (optional).\n * @returns A promise that resolves when the lending market daily apys and averages have been updated\n */\nexport type EarnControllerGetLendingMarketDailyApysAndAveragesAction = {\n type: `EarnController:getLendingMarketDailyApysAndAverages`;\n handler: EarnController['getLendingMarketDailyApysAndAverages'];\n};\n\n/**\n * Executes a lending deposit transaction.\n *\n * @param options - The options for the lending deposit transaction.\n * @param options.amount - The amount to deposit.\n * @param options.chainId - The chain ID for the lending deposit transaction.\n * @param options.protocol - The protocol of the lending market.\n * @param options.underlyingTokenAddress - The address of the underlying token.\n * @param options.gasOptions - The gas options for the transaction.\n * @param options.gasOptions.gasLimit - The gas limit for the transaction.\n * @param options.gasOptions.gasBufferPct - The gas buffer percentage for the transaction.\n * @param options.txOptions - The transaction options for the transaction.\n * @returns A promise that resolves to the transaction hash.\n */\nexport type EarnControllerExecuteLendingDepositAction = {\n type: `EarnController:executeLendingDeposit`;\n handler: EarnController['executeLendingDeposit'];\n};\n\n/**\n * Executes a lending withdraw transaction.\n *\n * @param options - The options for the lending withdraw transaction.\n * @param options.amount - The amount to withdraw.\n * @param options.chainId - The chain ID for the lending withdraw transaction.\n * @param options.protocol - The protocol of the lending market.\n * @param options.underlyingTokenAddress - The address of the underlying token.\n * @param options.gasOptions - The gas options for the transaction.\n * @param options.gasOptions.gasLimit - The gas limit for the transaction.\n * @param options.gasOptions.gasBufferPct - The gas buffer percentage for the transaction.\n * @param options.txOptions - The transaction options for the transaction.\n * @returns A promise that resolves to the transaction hash.\n */\nexport type EarnControllerExecuteLendingWithdrawAction = {\n type: `EarnController:executeLendingWithdraw`;\n handler: EarnController['executeLendingWithdraw'];\n};\n\n/**\n * Executes a lending token approve transaction.\n *\n * @param options - The options for the lending token approve transaction.\n * @param options.amount - The amount to approve.\n * @param options.chainId - The chain ID for the lending token approve transaction.\n * @param options.protocol - The protocol of the lending market.\n * @param options.underlyingTokenAddress - The address of the underlying token.\n * @param options.gasOptions - The gas options for the transaction.\n * @param options.gasOptions.gasLimit - The gas limit for the transaction.\n * @param options.gasOptions.gasBufferPct - The gas buffer percentage for the transaction.\n * @param options.txOptions - The transaction options for the transaction.\n * @returns A promise that resolves to the transaction hash.\n */\nexport type EarnControllerExecuteLendingTokenApproveAction = {\n type: `EarnController:executeLendingTokenApprove`;\n handler: EarnController['executeLendingTokenApprove'];\n};\n\n/**\n * Gets the allowance for a lending token.\n *\n * @param protocol - The protocol of the lending market.\n * @param underlyingTokenAddress - The address of the underlying token.\n * @returns A promise that resolves to the allowance.\n */\nexport type EarnControllerGetLendingTokenAllowanceAction = {\n type: `EarnController:getLendingTokenAllowance`;\n handler: EarnController['getLendingTokenAllowance'];\n};\n\n/**\n * Gets the maximum withdraw amount for a lending token's output token or shares if no output token.\n *\n * @param protocol - The protocol of the lending market.\n * @param underlyingTokenAddress - The address of the underlying token.\n * @returns A promise that resolves to the maximum withdraw amount.\n */\nexport type EarnControllerGetLendingTokenMaxWithdrawAction = {\n type: `EarnController:getLendingTokenMaxWithdraw`;\n handler: EarnController['getLendingTokenMaxWithdraw'];\n};\n\n/**\n * Gets the maximum deposit amount for a lending token.\n *\n * @param protocol - The protocol of the lending market.\n * @param underlyingTokenAddress - The address of the underlying token.\n * @returns A promise that resolves to the maximum deposit amount.\n */\nexport type EarnControllerGetLendingTokenMaxDepositAction = {\n type: `EarnController:getLendingTokenMaxDeposit`;\n handler: EarnController['getLendingTokenMaxDeposit'];\n};\n\n/**\n * Union of all EarnController action types.\n */\nexport type EarnControllerMethodActions =\n | EarnControllerRefreshPooledStakesAction\n | EarnControllerRefreshEarnEligibilityAction\n | EarnControllerRefreshPooledStakingVaultMetadataAction\n | EarnControllerRefreshPooledStakingVaultDailyApysAction\n | EarnControllerRefreshPooledStakingVaultApyAveragesAction\n | EarnControllerRefreshPooledStakingDataAction\n | EarnControllerRefreshLendingMarketsAction\n | EarnControllerRefreshLendingPositionsAction\n | EarnControllerRefreshLendingDataAction\n | EarnControllerRefreshTronStakingApyAction\n | EarnControllerGetTronStakingApyAction\n | EarnControllerGetLendingPositionHistoryAction\n | EarnControllerGetLendingMarketDailyApysAndAveragesAction\n | EarnControllerExecuteLendingDepositAction\n | EarnControllerExecuteLendingWithdrawAction\n | EarnControllerExecuteLendingTokenApproveAction\n | EarnControllerGetLendingTokenAllowanceAction\n | EarnControllerGetLendingTokenMaxWithdrawAction\n | EarnControllerGetLendingTokenMaxDepositAction;\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { BigNumber } from
|
|
2
|
-
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerSelectedAccountGroupChangeEvent, AccountTreeControllerStateChangeEvent } from
|
|
3
|
-
import type { ControllerGetStateAction, ControllerStateChangeEvent } from
|
|
4
|
-
import { BaseController } from
|
|
5
|
-
import type { Messenger } from
|
|
6
|
-
import type { NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction, NetworkControllerNetworkDidChangeEvent } from
|
|
7
|
-
import { EarnEnvironments } from
|
|
8
|
-
import type { LendingMarket, PooledStake, VaultData, VaultDailyApy, VaultApyAverages, LendingPosition, GasLimitParams, HistoricLendingMarketApys } from
|
|
9
|
-
import type { TransactionController, TransactionControllerTransactionConfirmedEvent } from
|
|
10
|
-
import type { EarnControllerMethodActions } from
|
|
11
|
-
import type { RefreshEarnEligibilityOptions, RefreshLendingPositionsOptions, RefreshPooledStakesOptions, RefreshPooledStakingDataOptions, RefreshPooledStakingVaultDailyApysOptions } from
|
|
1
|
+
import type { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerSelectedAccountGroupChangeEvent, AccountTreeControllerStateChangeEvent } from '@metamask/account-tree-controller';
|
|
3
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
|
|
4
|
+
import { BaseController } from '@metamask/base-controller';
|
|
5
|
+
import type { Messenger } from '@metamask/messenger';
|
|
6
|
+
import type { NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction, NetworkControllerNetworkDidChangeEvent } from '@metamask/network-controller';
|
|
7
|
+
import { EarnEnvironments } from '@metamask/stake-sdk';
|
|
8
|
+
import type { LendingMarket, PooledStake, VaultData, VaultDailyApy, VaultApyAverages, LendingPosition, GasLimitParams, HistoricLendingMarketApys } from '@metamask/stake-sdk';
|
|
9
|
+
import type { TransactionController, TransactionControllerTransactionConfirmedEvent } from '@metamask/transaction-controller';
|
|
10
|
+
import type { EarnControllerMethodActions } from './EarnController-method-action-types.js';
|
|
11
|
+
import type { RefreshEarnEligibilityOptions, RefreshLendingPositionsOptions, RefreshPooledStakesOptions, RefreshPooledStakingDataOptions, RefreshPooledStakingVaultDailyApysOptions } from './types.js';
|
|
12
12
|
export declare const controllerName = "EarnController";
|
|
13
13
|
export type PooledStakingState = {
|
|
14
14
|
[chainId: number]: {
|
|
@@ -362,4 +362,4 @@ export declare class EarnController extends BaseController<typeof controllerName
|
|
|
362
362
|
*/
|
|
363
363
|
getLendingTokenMaxDeposit(protocol: LendingMarket['protocol'], underlyingTokenAddress: string): Promise<BigNumber | undefined>;
|
|
364
364
|
}
|
|
365
|
-
//# sourceMappingURL=EarnController.d.
|
|
365
|
+
//# sourceMappingURL=EarnController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EarnController.d.ts","sourceRoot":"","sources":["../src/EarnController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EACV,8DAA8D,EAC9D,oDAAoD,EACpD,qCAAqC,EACtC,MAAM,mC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