@metamask-previews/earn-controller 11.2.1-preview-97aa3f6 → 11.2.1-preview-d9d1316f5

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 CHANGED
@@ -9,10 +9,16 @@ 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))
12
14
  - Bump `@metamask/controller-utils` from `^11.19.0` to `^11.20.0` ([#8344](https://github.com/MetaMask/core/pull/8344))
13
15
  - 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))
14
16
  - Bump `@metamask/transaction-controller` from `^64.0.0` to `^64.1.0` ([#8432](https://github.com/MetaMask/core/pull/8432))
15
17
 
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
+
16
22
  ## [11.2.1]
17
23
 
18
24
  ### 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 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"]}
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"]}
@@ -106,18 +106,6 @@ 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
- };
121
109
  /**
122
110
  * Refreshes all lending related data including markets, positions, and eligibility.
123
111
  * This method allows partial success, meaning some data may update while other requests fail.
@@ -271,5 +259,5 @@ export type EarnControllerGetLendingTokenMaxDepositAction = {
271
259
  /**
272
260
  * Union of all EarnController action types.
273
261
  */
274
- export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingEligibilityAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
262
+ export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
275
263
  //# 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,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IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,cAAc,CAAC,4BAA4B,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,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,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
+ {"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;IACl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AEF;;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"}
@@ -106,18 +106,6 @@ 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
- };
121
109
  /**
122
110
  * Refreshes all lending related data including markets, positions, and eligibility.
123
111
  * This method allows partial success, meaning some data may update while other requests fail.
@@ -271,5 +259,5 @@ export type EarnControllerGetLendingTokenMaxDepositAction = {
271
259
  /**
272
260
  * Union of all EarnController action types.
273
261
  */
274
- export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingEligibilityAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
262
+ export type EarnControllerMethodActions = EarnControllerRefreshPooledStakesAction | EarnControllerRefreshEarnEligibilityAction | EarnControllerRefreshPooledStakingVaultMetadataAction | EarnControllerRefreshPooledStakingVaultDailyApysAction | EarnControllerRefreshPooledStakingVaultApyAveragesAction | EarnControllerRefreshPooledStakingDataAction | EarnControllerRefreshLendingMarketsAction | EarnControllerRefreshLendingPositionsAction | EarnControllerRefreshLendingDataAction | EarnControllerRefreshTronStakingApyAction | EarnControllerGetTronStakingApyAction | EarnControllerGetLendingPositionHistoryAction | EarnControllerGetLendingMarketDailyApysAndAveragesAction | EarnControllerExecuteLendingDepositAction | EarnControllerExecuteLendingWithdrawAction | EarnControllerExecuteLendingTokenApproveAction | EarnControllerGetLendingTokenAllowanceAction | EarnControllerGetLendingTokenMaxWithdrawAction | EarnControllerGetLendingTokenMaxDepositAction;
275
263
  //# 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,CAAC,wBAAwB,CAAC,CAAC;CACnD,CAA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OAAO,EAAE,cAAc,CAAC,4BAA4B,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,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,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
+ {"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,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,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 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"]}
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"]}
@@ -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, _EarnController_selectedNetworkClientId, _EarnController_earnApiService, _EarnController_addTransactionFn, _EarnController_supportedPooledStakingChains, _EarnController_env, _EarnController_initializeSDK, _EarnController_getSelectedEvmAccount, _EarnController_getSelectedEvmAccountAddress;
13
+ var _EarnController_instances, _EarnController_earnSDK, _EarnController_initPromise, _EarnController_earnApiService, _EarnController_addTransactionFn, _EarnController_supportedPooledStakingChains, _EarnController_env, _EarnController_refreshEarnPortfolio, _EarnController_initializeSDK, _EarnController_getSelectedNetworkClientId, _EarnController_getSelectedEvmAccount, _EarnController_getSelectedEvmAccountAddress, _EarnController_refreshEarnPortfolioOnAccountReady;
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,7 +151,6 @@ const MESSENGER_EXPOSED_METHODS = [
151
151
  'refreshPooledStakingData',
152
152
  'refreshLendingMarkets',
153
153
  'refreshLendingPositions',
154
- 'refreshLendingEligibility',
155
154
  'refreshLendingData',
156
155
  'refreshTronStakingApy',
157
156
  'getTronStakingApy',
@@ -169,7 +168,7 @@ const MESSENGER_EXPOSED_METHODS = [
169
168
  * EarnController manages DeFi earning opportunities across different protocols and chains.
170
169
  */
171
170
  class EarnController extends base_controller_1.BaseController {
172
- constructor({ messenger, state = {}, addTransactionFn, selectedNetworkClientId, env = stake_sdk_1.EarnEnvironments.PROD, }) {
171
+ constructor({ messenger, state = {}, addTransactionFn, env = stake_sdk_1.EarnEnvironments.PROD, }) {
173
172
  super({
174
173
  name: exports.controllerName,
175
174
  metadata: earnControllerMetadata,
@@ -181,7 +180,7 @@ class EarnController extends base_controller_1.BaseController {
181
180
  });
182
181
  _EarnController_instances.add(this);
183
182
  _EarnController_earnSDK.set(this, null);
184
- _EarnController_selectedNetworkClientId.set(this, void 0);
183
+ _EarnController_initPromise.set(this, null);
185
184
  _EarnController_earnApiService.set(this, void 0);
186
185
  _EarnController_addTransactionFn.set(this, void 0);
187
186
  _EarnController_supportedPooledStakingChains.set(this, void 0);
@@ -193,14 +192,9 @@ class EarnController extends base_controller_1.BaseController {
193
192
  // from sdk or api to get lending and pooled staking chains
194
193
  __classPrivateFieldSet(this, _EarnController_supportedPooledStakingChains, [stake_sdk_1.ChainId.ETHEREUM, stake_sdk_1.ChainId.HOODI], "f");
195
194
  __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);
200
195
  // Listen for network changes
201
196
  this.messenger.subscribe('NetworkController:networkDidChange', (networkControllerState) => {
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);
197
+ __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_initializeSDK).call(this, networkControllerState.selectedNetworkClientId).catch(console.error);
204
198
  // refresh pooled staking data
205
199
  this.refreshPooledStakingVaultMetadata().catch(console.error);
206
200
  this.refreshPooledStakingVaultDailyApys().catch(console.error);
@@ -241,6 +235,23 @@ class EarnController extends base_controller_1.BaseController {
241
235
  }
242
236
  });
243
237
  }
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
+ }
244
255
  /**
245
256
  * Refreshes the pooled stakes data for the current account.
246
257
  * Fetches updated stake information including lifetime rewards, assets, and exit requests
@@ -374,10 +385,6 @@ class EarnController extends base_controller_1.BaseController {
374
385
  */
375
386
  async refreshPooledStakingData({ resetCache, address, } = {}) {
376
387
  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
- });
381
388
  for (const chainId of __classPrivateFieldGet(this, _EarnController_supportedPooledStakingChains, "f")) {
382
389
  await Promise.all([
383
390
  this.refreshPooledStakes({ resetCache, address, chainId }).catch((error) => {
@@ -396,7 +403,7 @@ class EarnController extends base_controller_1.BaseController {
396
403
  }
397
404
  if (errors.length > 0) {
398
405
  throw new Error(`Failed to refresh some staking data: ${errors
399
- .map((e) => e.message)
406
+ .map((error) => error.message)
400
407
  .join(', ')}`);
401
408
  }
402
409
  }
@@ -437,31 +444,6 @@ class EarnController extends base_controller_1.BaseController {
437
444
  }));
438
445
  });
439
446
  }
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
- }
465
447
  /**
466
448
  * Refreshes all lending related data including markets, positions, and eligibility.
467
449
  * This method allows partial success, meaning some data may update while other requests fail.
@@ -479,13 +461,10 @@ class EarnController extends base_controller_1.BaseController {
479
461
  this.refreshLendingPositions().catch((error) => {
480
462
  errors.push(error);
481
463
  }),
482
- this.refreshLendingEligibility().catch((error) => {
483
- errors.push(error);
484
- }),
485
464
  ]);
486
465
  if (errors.length > 0) {
487
466
  throw new Error(`Failed to refresh some lending data: ${errors
488
- .map((e) => e.message)
467
+ .map((error) => error.message)
489
468
  .join(', ')}`);
490
469
  }
491
470
  }
@@ -572,7 +551,8 @@ class EarnController extends base_controller_1.BaseController {
572
551
  if (!transactionData) {
573
552
  throw new Error('Transaction data not found');
574
553
  }
575
- if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
554
+ const selectedNetworkClientId = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this);
555
+ if (!selectedNetworkClientId) {
576
556
  throw new Error('Selected network client id not found');
577
557
  }
578
558
  const gasLimit = !transactionData.gasLimit
@@ -585,7 +565,7 @@ class EarnController extends base_controller_1.BaseController {
585
565
  gasLimit,
586
566
  }, {
587
567
  ...txOptions,
588
- networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
568
+ networkClientId: selectedNetworkClientId,
589
569
  });
590
570
  return txHash;
591
571
  }
@@ -612,7 +592,8 @@ class EarnController extends base_controller_1.BaseController {
612
592
  if (!transactionData) {
613
593
  throw new Error('Transaction data not found');
614
594
  }
615
- if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
595
+ const selectedNetworkClientId = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this);
596
+ if (!selectedNetworkClientId) {
616
597
  throw new Error('Selected network client id not found');
617
598
  }
618
599
  const gasLimit = !transactionData.gasLimit
@@ -625,7 +606,7 @@ class EarnController extends base_controller_1.BaseController {
625
606
  gasLimit,
626
607
  }, {
627
608
  ...txOptions,
628
- networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
609
+ networkClientId: selectedNetworkClientId,
629
610
  });
630
611
  return txHash;
631
612
  }
@@ -652,7 +633,8 @@ class EarnController extends base_controller_1.BaseController {
652
633
  if (!transactionData) {
653
634
  throw new Error('Transaction data not found');
654
635
  }
655
- if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
636
+ const selectedNetworkClientId = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this);
637
+ if (!selectedNetworkClientId) {
656
638
  throw new Error('Selected network client id not found');
657
639
  }
658
640
  const gasLimit = !transactionData.gasLimit
@@ -665,7 +647,7 @@ class EarnController extends base_controller_1.BaseController {
665
647
  gasLimit,
666
648
  }, {
667
649
  ...txOptions,
668
- networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
650
+ networkClientId: selectedNetworkClientId,
669
651
  });
670
652
  return txHash;
671
653
  }
@@ -716,7 +698,11 @@ class EarnController extends base_controller_1.BaseController {
716
698
  }
717
699
  }
718
700
  exports.EarnController = EarnController;
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 =
701
+ _EarnController_earnSDK = new WeakMap(), _EarnController_initPromise = new WeakMap(), _EarnController_earnApiService = new WeakMap(), _EarnController_addTransactionFn = new WeakMap(), _EarnController_supportedPooledStakingChains = new WeakMap(), _EarnController_env = new WeakMap(), _EarnController_instances = new WeakSet(), _EarnController_refreshEarnPortfolio = function _EarnController_refreshEarnPortfolio(address) {
702
+ this.refreshEarnEligibility({ address }).catch(console.error);
703
+ this.refreshPooledStakingData({ address }).catch(console.error);
704
+ this.refreshLendingData().catch(console.error);
705
+ }, _EarnController_initializeSDK =
720
706
  /**
721
707
  * Initializes the Earn SDK.
722
708
  *
@@ -746,11 +732,27 @@ async function _EarnController_initializeSDK(networkClientId) {
746
732
  console.error('Earn SDK initialization failed:', error);
747
733
  }
748
734
  }
735
+ }, _EarnController_getSelectedNetworkClientId = function _EarnController_getSelectedNetworkClientId() {
736
+ return this.messenger.call('NetworkController:getState')
737
+ .selectedNetworkClientId;
749
738
  }, _EarnController_getSelectedEvmAccount = function _EarnController_getSelectedEvmAccount() {
750
739
  return this.messenger
751
740
  .call('AccountTreeController:getAccountsFromSelectedAccountGroup')
752
741
  .find((account) => (0, keyring_api_1.isEvmAccountType)(account.type));
753
742
  }, _EarnController_getSelectedEvmAccountAddress = function _EarnController_getSelectedEvmAccountAddress() {
754
743
  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);
755
757
  };
756
758
  //# sourceMappingURL=EarnController.cjs.map