@metamask-previews/earn-controller 11.2.1-preview-d9d1316f5 → 11.2.1-preview-d5ac72227
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 +0 -6
- package/dist/EarnController-method-action-types.cjs.map +1 -1
- package/dist/EarnController-method-action-types.d.cts +13 -1
- package/dist/EarnController-method-action-types.d.cts.map +1 -1
- package/dist/EarnController-method-action-types.d.mts +13 -1
- package/dist/EarnController-method-action-types.d.mts.map +1 -1
- package/dist/EarnController-method-action-types.mjs.map +1 -1
- package/dist/EarnController.cjs +51 -53
- package/dist/EarnController.cjs.map +1 -1
- package/dist/EarnController.d.cts +19 -11
- package/dist/EarnController.d.cts.map +1 -1
- package/dist/EarnController.d.mts +19 -11
- package/dist/EarnController.d.mts.map +1 -1
- package/dist/EarnController.mjs +51 -53
- package/dist/EarnController.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,16 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
11
|
|
|
12
|
-
- **BREAKING:** `EarnController` constructor no longer accepts `selectedNetworkClientId` and no longer performs async work during construction. Consumers must call `init()` after construction. The messenger must now allow `AccountTreeController:stateChange` and `NetworkController:getState` ([#8421](https://github.com/MetaMask/core/pull/8421))
|
|
13
|
-
- **BREAKING:** `refreshPooledStakingData` and `refreshLendingData` no longer call eligibility checks internally. Eligibility is fetched once during `init()`. Consumers that relied on these methods to keep eligibility state current must call `refreshEarnEligibility` separately ([#8421](https://github.com/MetaMask/core/pull/8421))
|
|
14
12
|
- Bump `@metamask/controller-utils` from `^11.19.0` to `^11.20.0` ([#8344](https://github.com/MetaMask/core/pull/8344))
|
|
15
13
|
- Bump `@metamask/messenger` from `^1.0.0` to `^1.1.1` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373))
|
|
16
14
|
- Bump `@metamask/transaction-controller` from `^64.0.0` to `^64.1.0` ([#8432](https://github.com/MetaMask/core/pull/8432))
|
|
17
15
|
|
|
18
|
-
### Removed
|
|
19
|
-
|
|
20
|
-
- **BREAKING:** Removed `EarnController:refreshLendingEligibility` messenger action and `EarnControllerRefreshLendingEligibilityAction` type. Use `EarnController:refreshEarnEligibility` instead ([#8421](https://github.com/MetaMask/core/pull/8421))
|
|
21
|
-
|
|
22
16
|
## [11.2.1]
|
|
23
17
|
|
|
24
18
|
### Changed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EarnController-method-action-types.cjs","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';\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
|
+
{"version":3,"file":"EarnController-method-action-types.cjs","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';\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 the lending 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 * @param options - Optional arguments\n * @param [options.address] - The address to refresh lending eligibility for (optional).\n * @returns A promise that resolves when the eligibility status has been updated\n */\nexport type EarnControllerRefreshLendingEligibilityAction = {\n type: `EarnController:refreshLendingEligibility`;\n handler: EarnController['refreshLendingEligibility'];\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 | EarnControllerRefreshLendingEligibilityAction\n | EarnControllerRefreshLendingDataAction\n | EarnControllerRefreshTronStakingApyAction\n | EarnControllerGetTronStakingApyAction\n | EarnControllerGetLendingPositionHistoryAction\n | EarnControllerGetLendingMarketDailyApysAndAveragesAction\n | EarnControllerExecuteLendingDepositAction\n | EarnControllerExecuteLendingWithdrawAction\n | EarnControllerExecuteLendingTokenApproveAction\n | EarnControllerGetLendingTokenAllowanceAction\n | EarnControllerGetLendingTokenMaxWithdrawAction\n | EarnControllerGetLendingTokenMaxDepositAction;\n"]}
|
|
@@ -106,6 +106,18 @@ export type EarnControllerRefreshLendingPositionsAction = {
|
|
|
106
106
|
type: `EarnController:refreshLendingPositions`;
|
|
107
107
|
handler: EarnController['refreshLendingPositions'];
|
|
108
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* Refreshes the lending eligibility status for the current account.
|
|
111
|
+
* Updates the eligibility status in the controller state based on the location and address blocklist for compliance.
|
|
112
|
+
*
|
|
113
|
+
* @param options - Optional arguments
|
|
114
|
+
* @param [options.address] - The address to refresh lending eligibility for (optional).
|
|
115
|
+
* @returns A promise that resolves when the eligibility status has been updated
|
|
116
|
+
*/
|
|
117
|
+
export type EarnControllerRefreshLendingEligibilityAction = {
|
|
118
|
+
type: `EarnController:refreshLendingEligibility`;
|
|
119
|
+
handler: EarnController['refreshLendingEligibility'];
|
|
120
|
+
};
|
|
109
121
|
/**
|
|
110
122
|
* Refreshes all lending related data including markets, positions, and eligibility.
|
|
111
123
|
* This method allows partial success, meaning some data may update while other requests fail.
|
|
@@ -259,5 +271,5 @@ export type EarnControllerGetLendingTokenMaxDepositAction = {
|
|
|
259
271
|
/**
|
|
260
272
|
* Union of all EarnController action types.
|
|
261
273
|
*/
|
|
262
|
-
export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
|
|
274
|
+
export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingEligibilityAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
|
|
263
275
|
//# sourceMappingURL=EarnController-method-action-types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EarnController-method-action-types.d.cts","sourceRoot":"","sources":["../src/EarnController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAEvD;;;;;;;;;;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,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D,OAAO,EAAE,cAAc,CAAC,2BAA2B,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,uCAAuC,GACvC,0CAA0C,GAC1C,qDAAqD,GACrD,sDAAsD,GACtD,wDAAwD,GACxD,4CAA4C,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"}
|
|
1
|
+
{"version":3,"file":"EarnController-method-action-types.d.cts","sourceRoot":"","sources":["../src/EarnController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAEvD;;;;;;;;;;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,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,cAAc,CAAC,oCAAoC,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO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tC,yCAAyC,GACzC,qCAAqC,GACrC,6CAA6C,GAC7C,wDAAwD,GACxD,yCAAyC,GACzC,0CAA0C,GAC1C,8CAA8C,GAC9C,4CAA4C,GAC5C,8CAA8C,GAC9C,6CAA6C,CAAC"}
|
|
@@ -106,6 +106,18 @@ export type EarnControllerRefreshLendingPositionsAction = {
|
|
|
106
106
|
type: `EarnController:refreshLendingPositions`;
|
|
107
107
|
handler: EarnController['refreshLendingPositions'];
|
|
108
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* Refreshes the lending eligibility status for the current account.
|
|
111
|
+
* Updates the eligibility status in the controller state based on the location and address blocklist for compliance.
|
|
112
|
+
*
|
|
113
|
+
* @param options - Optional arguments
|
|
114
|
+
* @param [options.address] - The address to refresh lending eligibility for (optional).
|
|
115
|
+
* @returns A promise that resolves when the eligibility status has been updated
|
|
116
|
+
*/
|
|
117
|
+
export type EarnControllerRefreshLendingEligibilityAction = {
|
|
118
|
+
type: `EarnController:refreshLendingEligibility`;
|
|
119
|
+
handler: EarnController['refreshLendingEligibility'];
|
|
120
|
+
};
|
|
109
121
|
/**
|
|
110
122
|
* Refreshes all lending related data including markets, positions, and eligibility.
|
|
111
123
|
* This method allows partial success, meaning some data may update while other requests fail.
|
|
@@ -259,5 +271,5 @@ export type EarnControllerGetLendingTokenMaxDepositAction = {
|
|
|
259
271
|
/**
|
|
260
272
|
* Union of all EarnController action types.
|
|
261
273
|
*/
|
|
262
|
-
export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
|
|
274
|
+
export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingEligibilityAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
|
|
263
275
|
//# sourceMappingURL=EarnController-method-action-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EarnController-method-action-types.d.mts","sourceRoot":"","sources":["../src/EarnController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAEvD;;;;;;;;;;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,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D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,cAAc,CAAC,2BAA2B,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,uCAAuC,GACvC,0CAA0C,GAC1C,qDAAqD,GACrD,sDAAsD,GACtD,wDAAwD,GACxD,4CAA4C,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"}
|
|
1
|
+
{"version":3,"file":"EarnController-method-action-types.d.mts","sourceRoot":"","sources":["../src/EarnController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAEvD;;;;;;;;;;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,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,cAAc,CAAC,oCAAoC,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,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AC3C,6CAA6C,GAC7C,sCAAsC,GACtC,yCAAyC,GACzC,qCAAqC,GACrC,6CAA6C,GAC7C,wDAAwD,GACxD,yCAAyC,GACzC,0CAA0C,GAC1C,8CAA8C,GAC9C,4CAA4C,GAC5C,8CAA8C,GAC9C,6CAA6C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EarnController-method-action-types.mjs","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';\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
|
+
{"version":3,"file":"EarnController-method-action-types.mjs","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';\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 the lending 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 * @param options - Optional arguments\n * @param [options.address] - The address to refresh lending eligibility for (optional).\n * @returns A promise that resolves when the eligibility status has been updated\n */\nexport type EarnControllerRefreshLendingEligibilityAction = {\n type: `EarnController:refreshLendingEligibility`;\n handler: EarnController['refreshLendingEligibility'];\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 | EarnControllerRefreshLendingEligibilityAction\n | EarnControllerRefreshLendingDataAction\n | EarnControllerRefreshTronStakingApyAction\n | EarnControllerGetTronStakingApyAction\n | EarnControllerGetLendingPositionHistoryAction\n | EarnControllerGetLendingMarketDailyApysAndAveragesAction\n | EarnControllerExecuteLendingDepositAction\n | EarnControllerExecuteLendingWithdrawAction\n | EarnControllerExecuteLendingTokenApproveAction\n | EarnControllerGetLendingTokenAllowanceAction\n | EarnControllerGetLendingTokenMaxWithdrawAction\n | EarnControllerGetLendingTokenMaxDepositAction;\n"]}
|
package/dist/EarnController.cjs
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _EarnController_instances, _EarnController_earnSDK,
|
|
13
|
+
var _EarnController_instances, _EarnController_earnSDK, _EarnController_selectedNetworkClientId, _EarnController_earnApiService, _EarnController_addTransactionFn, _EarnController_supportedPooledStakingChains, _EarnController_env, _EarnController_initializeSDK, _EarnController_getSelectedEvmAccount, _EarnController_getSelectedEvmAccountAddress;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.EarnController = exports.getDefaultEarnControllerState = exports.DEFAULT_TRON_STAKING_STATE = exports.DEFAULT_POOLED_STAKING_CHAIN_STATE = exports.DEFAULT_POOLED_STAKING_VAULT_APY_AVERAGES = exports.DEFAULT_LENDING_POSITION = exports.DEFAULT_LENDING_MARKET = exports.controllerName = void 0;
|
|
16
16
|
const providers_1 = require("@ethersproject/providers");
|
|
@@ -151,6 +151,7 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
151
151
|
'refreshPooledStakingData',
|
|
152
152
|
'refreshLendingMarkets',
|
|
153
153
|
'refreshLendingPositions',
|
|
154
|
+
'refreshLendingEligibility',
|
|
154
155
|
'refreshLendingData',
|
|
155
156
|
'refreshTronStakingApy',
|
|
156
157
|
'getTronStakingApy',
|
|
@@ -168,7 +169,7 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
168
169
|
* EarnController manages DeFi earning opportunities across different protocols and chains.
|
|
169
170
|
*/
|
|
170
171
|
class EarnController extends base_controller_1.BaseController {
|
|
171
|
-
constructor({ messenger, state = {}, addTransactionFn, env = stake_sdk_1.EarnEnvironments.PROD, }) {
|
|
172
|
+
constructor({ messenger, state = {}, addTransactionFn, selectedNetworkClientId, env = stake_sdk_1.EarnEnvironments.PROD, }) {
|
|
172
173
|
super({
|
|
173
174
|
name: exports.controllerName,
|
|
174
175
|
metadata: earnControllerMetadata,
|
|
@@ -180,7 +181,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
180
181
|
});
|
|
181
182
|
_EarnController_instances.add(this);
|
|
182
183
|
_EarnController_earnSDK.set(this, null);
|
|
183
|
-
|
|
184
|
+
_EarnController_selectedNetworkClientId.set(this, void 0);
|
|
184
185
|
_EarnController_earnApiService.set(this, void 0);
|
|
185
186
|
_EarnController_addTransactionFn.set(this, void 0);
|
|
186
187
|
_EarnController_supportedPooledStakingChains.set(this, void 0);
|
|
@@ -192,9 +193,14 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
192
193
|
// from sdk or api to get lending and pooled staking chains
|
|
193
194
|
__classPrivateFieldSet(this, _EarnController_supportedPooledStakingChains, [stake_sdk_1.ChainId.ETHEREUM, stake_sdk_1.ChainId.HOODI], "f");
|
|
194
195
|
__classPrivateFieldSet(this, _EarnController_addTransactionFn, addTransactionFn, "f");
|
|
196
|
+
__classPrivateFieldSet(this, _EarnController_selectedNetworkClientId, selectedNetworkClientId, "f");
|
|
197
|
+
__classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_initializeSDK).call(this, selectedNetworkClientId).catch(console.error);
|
|
198
|
+
this.refreshPooledStakingData().catch(console.error);
|
|
199
|
+
this.refreshLendingData().catch(console.error);
|
|
195
200
|
// Listen for network changes
|
|
196
201
|
this.messenger.subscribe('NetworkController:networkDidChange', (networkControllerState) => {
|
|
197
|
-
|
|
202
|
+
__classPrivateFieldSet(this, _EarnController_selectedNetworkClientId, networkControllerState.selectedNetworkClientId, "f");
|
|
203
|
+
__classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_initializeSDK).call(this, __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")).catch(console.error);
|
|
198
204
|
// refresh pooled staking data
|
|
199
205
|
this.refreshPooledStakingVaultMetadata().catch(console.error);
|
|
200
206
|
this.refreshPooledStakingVaultDailyApys().catch(console.error);
|
|
@@ -235,23 +241,6 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
235
241
|
}
|
|
236
242
|
});
|
|
237
243
|
}
|
|
238
|
-
async init() {
|
|
239
|
-
if (__classPrivateFieldGet(this, _EarnController_initPromise, "f")) {
|
|
240
|
-
return __classPrivateFieldGet(this, _EarnController_initPromise, "f");
|
|
241
|
-
}
|
|
242
|
-
__classPrivateFieldSet(this, _EarnController_initPromise, (async () => {
|
|
243
|
-
await __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_initializeSDK).call(this, __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this));
|
|
244
|
-
const address = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedEvmAccountAddress).call(this);
|
|
245
|
-
if (address) {
|
|
246
|
-
__classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_refreshEarnPortfolio).call(this, address);
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
// Account tree state is not yet available, so we defer the refresh to when it is.
|
|
250
|
-
__classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_refreshEarnPortfolioOnAccountReady).call(this);
|
|
251
|
-
}
|
|
252
|
-
})(), "f");
|
|
253
|
-
return __classPrivateFieldGet(this, _EarnController_initPromise, "f");
|
|
254
|
-
}
|
|
255
244
|
/**
|
|
256
245
|
* Refreshes the pooled stakes data for the current account.
|
|
257
246
|
* Fetches updated stake information including lifetime rewards, assets, and exit requests
|
|
@@ -385,6 +374,10 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
385
374
|
*/
|
|
386
375
|
async refreshPooledStakingData({ resetCache, address, } = {}) {
|
|
387
376
|
const errors = [];
|
|
377
|
+
// Refresh earn eligibility once since it's not chain-specific
|
|
378
|
+
await this.refreshEarnEligibility({ address }).catch((error) => {
|
|
379
|
+
errors.push(error);
|
|
380
|
+
});
|
|
388
381
|
for (const chainId of __classPrivateFieldGet(this, _EarnController_supportedPooledStakingChains, "f")) {
|
|
389
382
|
await Promise.all([
|
|
390
383
|
this.refreshPooledStakes({ resetCache, address, chainId }).catch((error) => {
|
|
@@ -403,7 +396,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
403
396
|
}
|
|
404
397
|
if (errors.length > 0) {
|
|
405
398
|
throw new Error(`Failed to refresh some staking data: ${errors
|
|
406
|
-
.map((
|
|
399
|
+
.map((e) => e.message)
|
|
407
400
|
.join(', ')}`);
|
|
408
401
|
}
|
|
409
402
|
}
|
|
@@ -444,6 +437,31 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
444
437
|
}));
|
|
445
438
|
});
|
|
446
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Refreshes the lending eligibility status for the current account.
|
|
442
|
+
* Updates the eligibility status in the controller state based on the location and address blocklist for compliance.
|
|
443
|
+
*
|
|
444
|
+
* @param options - Optional arguments
|
|
445
|
+
* @param [options.address] - The address to refresh lending eligibility for (optional).
|
|
446
|
+
* @returns A promise that resolves when the eligibility status has been updated
|
|
447
|
+
*/
|
|
448
|
+
async refreshLendingEligibility({ address, } = {}) {
|
|
449
|
+
const addressToUse = address ?? __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedEvmAccountAddress).call(this);
|
|
450
|
+
// TODO: this is a temporary solution to refresh lending eligibility as
|
|
451
|
+
// the eligibility check is not yet implemented for lending
|
|
452
|
+
// this check will check the address against the same blocklist as the
|
|
453
|
+
// staking eligibility check
|
|
454
|
+
if (!addressToUse) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
const { eligible: isEligible } = await __classPrivateFieldGet(this, _EarnController_earnApiService, "f").pooledStaking.getPooledStakingEligibility([
|
|
458
|
+
addressToUse,
|
|
459
|
+
]);
|
|
460
|
+
this.update((state) => {
|
|
461
|
+
state.lending.isEligible = isEligible;
|
|
462
|
+
state.pooled_staking.isEligible = isEligible;
|
|
463
|
+
});
|
|
464
|
+
}
|
|
447
465
|
/**
|
|
448
466
|
* Refreshes all lending related data including markets, positions, and eligibility.
|
|
449
467
|
* This method allows partial success, meaning some data may update while other requests fail.
|
|
@@ -461,10 +479,13 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
461
479
|
this.refreshLendingPositions().catch((error) => {
|
|
462
480
|
errors.push(error);
|
|
463
481
|
}),
|
|
482
|
+
this.refreshLendingEligibility().catch((error) => {
|
|
483
|
+
errors.push(error);
|
|
484
|
+
}),
|
|
464
485
|
]);
|
|
465
486
|
if (errors.length > 0) {
|
|
466
487
|
throw new Error(`Failed to refresh some lending data: ${errors
|
|
467
|
-
.map((
|
|
488
|
+
.map((e) => e.message)
|
|
468
489
|
.join(', ')}`);
|
|
469
490
|
}
|
|
470
491
|
}
|
|
@@ -551,8 +572,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
551
572
|
if (!transactionData) {
|
|
552
573
|
throw new Error('Transaction data not found');
|
|
553
574
|
}
|
|
554
|
-
|
|
555
|
-
if (!selectedNetworkClientId) {
|
|
575
|
+
if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
|
|
556
576
|
throw new Error('Selected network client id not found');
|
|
557
577
|
}
|
|
558
578
|
const gasLimit = !transactionData.gasLimit
|
|
@@ -565,7 +585,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
565
585
|
gasLimit,
|
|
566
586
|
}, {
|
|
567
587
|
...txOptions,
|
|
568
|
-
networkClientId:
|
|
588
|
+
networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
|
|
569
589
|
});
|
|
570
590
|
return txHash;
|
|
571
591
|
}
|
|
@@ -592,8 +612,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
592
612
|
if (!transactionData) {
|
|
593
613
|
throw new Error('Transaction data not found');
|
|
594
614
|
}
|
|
595
|
-
|
|
596
|
-
if (!selectedNetworkClientId) {
|
|
615
|
+
if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
|
|
597
616
|
throw new Error('Selected network client id not found');
|
|
598
617
|
}
|
|
599
618
|
const gasLimit = !transactionData.gasLimit
|
|
@@ -606,7 +625,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
606
625
|
gasLimit,
|
|
607
626
|
}, {
|
|
608
627
|
...txOptions,
|
|
609
|
-
networkClientId:
|
|
628
|
+
networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
|
|
610
629
|
});
|
|
611
630
|
return txHash;
|
|
612
631
|
}
|
|
@@ -633,8 +652,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
633
652
|
if (!transactionData) {
|
|
634
653
|
throw new Error('Transaction data not found');
|
|
635
654
|
}
|
|
636
|
-
|
|
637
|
-
if (!selectedNetworkClientId) {
|
|
655
|
+
if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
|
|
638
656
|
throw new Error('Selected network client id not found');
|
|
639
657
|
}
|
|
640
658
|
const gasLimit = !transactionData.gasLimit
|
|
@@ -647,7 +665,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
647
665
|
gasLimit,
|
|
648
666
|
}, {
|
|
649
667
|
...txOptions,
|
|
650
|
-
networkClientId:
|
|
668
|
+
networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
|
|
651
669
|
});
|
|
652
670
|
return txHash;
|
|
653
671
|
}
|
|
@@ -698,11 +716,7 @@ class EarnController extends base_controller_1.BaseController {
|
|
|
698
716
|
}
|
|
699
717
|
}
|
|
700
718
|
exports.EarnController = EarnController;
|
|
701
|
-
_EarnController_earnSDK = new WeakMap(),
|
|
702
|
-
this.refreshEarnEligibility({ address }).catch(console.error);
|
|
703
|
-
this.refreshPooledStakingData({ address }).catch(console.error);
|
|
704
|
-
this.refreshLendingData().catch(console.error);
|
|
705
|
-
}, _EarnController_initializeSDK =
|
|
719
|
+
_EarnController_earnSDK = new WeakMap(), _EarnController_selectedNetworkClientId = new WeakMap(), _EarnController_earnApiService = new WeakMap(), _EarnController_addTransactionFn = new WeakMap(), _EarnController_supportedPooledStakingChains = new WeakMap(), _EarnController_env = new WeakMap(), _EarnController_instances = new WeakSet(), _EarnController_initializeSDK =
|
|
706
720
|
/**
|
|
707
721
|
* Initializes the Earn SDK.
|
|
708
722
|
*
|
|
@@ -732,27 +746,11 @@ async function _EarnController_initializeSDK(networkClientId) {
|
|
|
732
746
|
console.error('Earn SDK initialization failed:', error);
|
|
733
747
|
}
|
|
734
748
|
}
|
|
735
|
-
}, _EarnController_getSelectedNetworkClientId = function _EarnController_getSelectedNetworkClientId() {
|
|
736
|
-
return this.messenger.call('NetworkController:getState')
|
|
737
|
-
.selectedNetworkClientId;
|
|
738
749
|
}, _EarnController_getSelectedEvmAccount = function _EarnController_getSelectedEvmAccount() {
|
|
739
750
|
return this.messenger
|
|
740
751
|
.call('AccountTreeController:getAccountsFromSelectedAccountGroup')
|
|
741
752
|
.find((account) => (0, keyring_api_1.isEvmAccountType)(account.type));
|
|
742
753
|
}, _EarnController_getSelectedEvmAccountAddress = function _EarnController_getSelectedEvmAccountAddress() {
|
|
743
754
|
return __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedEvmAccount).call(this)?.address;
|
|
744
|
-
}, _EarnController_refreshEarnPortfolioOnAccountReady = function _EarnController_refreshEarnPortfolioOnAccountReady() {
|
|
745
|
-
const handler = ({ selectedAccountGroup, }) => {
|
|
746
|
-
if (!selectedAccountGroup) {
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
const address = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedEvmAccountAddress).call(this);
|
|
750
|
-
if (!address) {
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
this.messenger.unsubscribe('AccountTreeController:stateChange', handler);
|
|
754
|
-
__classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_refreshEarnPortfolio).call(this, address);
|
|
755
|
-
};
|
|
756
|
-
this.messenger.subscribe('AccountTreeController:stateChange', handler);
|
|
757
755
|
};
|
|
758
756
|
//# sourceMappingURL=EarnController.cjs.map
|