@metamask-previews/earn-controller 11.2.1-preview-d5ac72227 → 12.0.0-preview-08b3d87

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
@@ -7,12 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [12.0.0]
11
+
12
+ ### Added
13
+
14
+ - feat(messenger): add `generate-action-types` CLI tool as subpath export ([#8264](https://github.com/MetaMask/core/pull/8264))
15
+ - Release/895.0.0 ([#8359](https://github.com/MetaMask/core/pull/8359))
16
+
10
17
  ### Changed
11
18
 
19
+ - feat: extract generate-action-types CLI into @metamask/messenger-cli ([#8378](https://github.com/MetaMask/core/pull/8378))
20
+ - **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))
21
+ - **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
22
  - Bump `@metamask/controller-utils` from `^11.19.0` to `^11.20.0` ([#8344](https://github.com/MetaMask/core/pull/8344))
13
23
  - 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
24
  - Bump `@metamask/transaction-controller` from `^64.0.0` to `^64.1.0` ([#8432](https://github.com/MetaMask/core/pull/8432))
15
25
 
26
+ ### Removed
27
+
28
+ - **BREAKING:** Removed `EarnController:refreshLendingEligibility` messenger action and `EarnControllerRefreshLendingEligibilityAction` type. Use `EarnController:refreshEarnEligibility` instead ([#8421](https://github.com/MetaMask/core/pull/8421))
29
+
16
30
  ## [11.2.1]
17
31
 
18
32
  ### Changed
@@ -409,7 +423,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
409
423
 
410
424
  - Initial release ([#5271](https://github.com/MetaMask/core/pull/5271))
411
425
 
412
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@11.2.1...HEAD
426
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@12.0.0...HEAD
427
+ [12.0.0]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@11.2.1...@metamask/earn-controller@12.0.0
413
428
  [11.2.1]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@11.2.0...@metamask/earn-controller@11.2.1
414
429
  [11.2.0]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@11.1.2...@metamask/earn-controller@11.2.0
415
430
  [11.1.2]: https://github.com/MetaMask/core/compare/@metamask/earn-controller@11.1.1...@metamask/earn-controller@11.1.2
@@ -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,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,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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;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,EAAE,cAAc,CAAC,sCAAsC,CAAC,CAAC;CACjE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4CA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OAAO,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;;;;GAaG;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,4CAA4C,GAAG;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,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,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,EAAE,cAAc,CAAC,sCAAsC,CAAC,CAAC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C,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,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,cAAc,CAAC,sCAAsC,CAAC,CAAC;CACjE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAA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B,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;;;;GAaG;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,4CAA4C,GAAG;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,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 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,26 @@ 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
+ })().catch((error) => {
253
+ __classPrivateFieldSet(this, _EarnController_initPromise, null, "f");
254
+ throw error;
255
+ }), "f");
256
+ return __classPrivateFieldGet(this, _EarnController_initPromise, "f");
257
+ }
244
258
  /**
245
259
  * Refreshes the pooled stakes data for the current account.
246
260
  * Fetches updated stake information including lifetime rewards, assets, and exit requests
@@ -374,10 +388,6 @@ class EarnController extends base_controller_1.BaseController {
374
388
  */
375
389
  async refreshPooledStakingData({ resetCache, address, } = {}) {
376
390
  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
391
  for (const chainId of __classPrivateFieldGet(this, _EarnController_supportedPooledStakingChains, "f")) {
382
392
  await Promise.all([
383
393
  this.refreshPooledStakes({ resetCache, address, chainId }).catch((error) => {
@@ -396,7 +406,7 @@ class EarnController extends base_controller_1.BaseController {
396
406
  }
397
407
  if (errors.length > 0) {
398
408
  throw new Error(`Failed to refresh some staking data: ${errors
399
- .map((e) => e.message)
409
+ .map((error) => error.message)
400
410
  .join(', ')}`);
401
411
  }
402
412
  }
@@ -437,31 +447,6 @@ class EarnController extends base_controller_1.BaseController {
437
447
  }));
438
448
  });
439
449
  }
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
450
  /**
466
451
  * Refreshes all lending related data including markets, positions, and eligibility.
467
452
  * This method allows partial success, meaning some data may update while other requests fail.
@@ -479,13 +464,10 @@ class EarnController extends base_controller_1.BaseController {
479
464
  this.refreshLendingPositions().catch((error) => {
480
465
  errors.push(error);
481
466
  }),
482
- this.refreshLendingEligibility().catch((error) => {
483
- errors.push(error);
484
- }),
485
467
  ]);
486
468
  if (errors.length > 0) {
487
469
  throw new Error(`Failed to refresh some lending data: ${errors
488
- .map((e) => e.message)
470
+ .map((error) => error.message)
489
471
  .join(', ')}`);
490
472
  }
491
473
  }
@@ -572,7 +554,8 @@ class EarnController extends base_controller_1.BaseController {
572
554
  if (!transactionData) {
573
555
  throw new Error('Transaction data not found');
574
556
  }
575
- if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
557
+ const selectedNetworkClientId = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this);
558
+ if (!selectedNetworkClientId) {
576
559
  throw new Error('Selected network client id not found');
577
560
  }
578
561
  const gasLimit = !transactionData.gasLimit
@@ -585,7 +568,7 @@ class EarnController extends base_controller_1.BaseController {
585
568
  gasLimit,
586
569
  }, {
587
570
  ...txOptions,
588
- networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
571
+ networkClientId: selectedNetworkClientId,
589
572
  });
590
573
  return txHash;
591
574
  }
@@ -612,7 +595,8 @@ class EarnController extends base_controller_1.BaseController {
612
595
  if (!transactionData) {
613
596
  throw new Error('Transaction data not found');
614
597
  }
615
- if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
598
+ const selectedNetworkClientId = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this);
599
+ if (!selectedNetworkClientId) {
616
600
  throw new Error('Selected network client id not found');
617
601
  }
618
602
  const gasLimit = !transactionData.gasLimit
@@ -625,7 +609,7 @@ class EarnController extends base_controller_1.BaseController {
625
609
  gasLimit,
626
610
  }, {
627
611
  ...txOptions,
628
- networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
612
+ networkClientId: selectedNetworkClientId,
629
613
  });
630
614
  return txHash;
631
615
  }
@@ -652,7 +636,8 @@ class EarnController extends base_controller_1.BaseController {
652
636
  if (!transactionData) {
653
637
  throw new Error('Transaction data not found');
654
638
  }
655
- if (!__classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f")) {
639
+ const selectedNetworkClientId = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedNetworkClientId).call(this);
640
+ if (!selectedNetworkClientId) {
656
641
  throw new Error('Selected network client id not found');
657
642
  }
658
643
  const gasLimit = !transactionData.gasLimit
@@ -665,7 +650,7 @@ class EarnController extends base_controller_1.BaseController {
665
650
  gasLimit,
666
651
  }, {
667
652
  ...txOptions,
668
- networkClientId: __classPrivateFieldGet(this, _EarnController_selectedNetworkClientId, "f"),
653
+ networkClientId: selectedNetworkClientId,
669
654
  });
670
655
  return txHash;
671
656
  }
@@ -716,7 +701,11 @@ class EarnController extends base_controller_1.BaseController {
716
701
  }
717
702
  }
718
703
  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 =
704
+ _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) {
705
+ this.refreshEarnEligibility({ address }).catch(console.error);
706
+ this.refreshPooledStakingData({ address }).catch(console.error);
707
+ this.refreshLendingData().catch(console.error);
708
+ }, _EarnController_initializeSDK =
720
709
  /**
721
710
  * Initializes the Earn SDK.
722
711
  *
@@ -746,11 +735,27 @@ async function _EarnController_initializeSDK(networkClientId) {
746
735
  console.error('Earn SDK initialization failed:', error);
747
736
  }
748
737
  }
738
+ }, _EarnController_getSelectedNetworkClientId = function _EarnController_getSelectedNetworkClientId() {
739
+ return this.messenger.call('NetworkController:getState')
740
+ .selectedNetworkClientId;
749
741
  }, _EarnController_getSelectedEvmAccount = function _EarnController_getSelectedEvmAccount() {
750
742
  return this.messenger
751
743
  .call('AccountTreeController:getAccountsFromSelectedAccountGroup')
752
744
  .find((account) => (0, keyring_api_1.isEvmAccountType)(account.type));
753
745
  }, _EarnController_getSelectedEvmAccountAddress = function _EarnController_getSelectedEvmAccountAddress() {
754
746
  return __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedEvmAccount).call(this)?.address;
747
+ }, _EarnController_refreshEarnPortfolioOnAccountReady = function _EarnController_refreshEarnPortfolioOnAccountReady() {
748
+ const handler = ({ selectedAccountGroup, }) => {
749
+ if (!selectedAccountGroup) {
750
+ return;
751
+ }
752
+ const address = __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_getSelectedEvmAccountAddress).call(this);
753
+ if (!address) {
754
+ return;
755
+ }
756
+ this.messenger.unsubscribe('AccountTreeController:stateChange', handler);
757
+ __classPrivateFieldGet(this, _EarnController_instances, "m", _EarnController_refreshEarnPortfolio).call(this, address);
758
+ };
759
+ this.messenger.subscribe('AccountTreeController:stateChange', handler);
755
760
  };
756
761
  //# sourceMappingURL=EarnController.cjs.map