|
| 1 | +diff --git a/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.cjs b/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.cjs |
| 2 | +index 9749434..fed49f4 100644 |
| 3 | +--- a/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.cjs |
| 4 | ++++ b/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.cjs |
| 5 | +@@ -148,27 +148,33 @@ class AccountTrackerController extends (0, polling_controller_1.StaticIntervalPo |
| 6 | + this.syncAccounts(chainIds); |
| 7 | + // Create an array of promises for each networkClientId |
| 8 | + const updatePromises = networkClientIds.map(async (networkClientId) => { |
| 9 | +- const { chainId, ethQuery, provider } = __classPrivateFieldGet(this, _AccountTrackerController_instances, "m", _AccountTrackerController_getCorrectNetworkClient).call(this, networkClientId); |
| 10 | ++ const { chainId, ethQuery, provider, blockTracker } = __classPrivateFieldGet(this, _AccountTrackerController_instances, "m", _AccountTrackerController_getCorrectNetworkClient).call(this, networkClientId); |
| 11 | + const { accountsByChainId } = this.state; |
| 12 | + const { isMultiAccountBalancesEnabled } = this.messagingSystem.call('PreferencesController:getState'); |
| 13 | + const accountsToUpdate = isMultiAccountBalancesEnabled |
| 14 | + ? Object.keys(accountsByChainId[chainId]) |
| 15 | + : [(0, controller_utils_1.toChecksumHexAddress)(selectedAccount.address)]; |
| 16 | + const accountsForChain = { ...accountsByChainId[chainId] }; |
| 17 | ++ // Force fresh block data before multicall |
| 18 | ++ // TODO: This is a temporary fix to ensure that the block number is up to date. |
| 19 | ++ // We should remove this once we have a better solution for this on the block tracker controller. |
| 20 | ++ await (0, controller_utils_1.safelyExecuteWithTimeout)(() => blockTracker?.checkForLatestBlock?.()); |
| 21 | + const stakedBalancesPromise = __classPrivateFieldGet(this, _AccountTrackerController_includeStakedAssets, "f") |
| 22 | + ? __classPrivateFieldGet(this, _AccountTrackerController_getStakedBalanceForChain, "f").call(this, accountsToUpdate, networkClientId) |
| 23 | + : Promise.resolve({}); |
| 24 | + if ((0, utils_1.hasProperty)(AssetsContractController_1.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID, chainId)) { |
| 25 | + const contractAddress = AssetsContractController_1.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID[chainId]; |
| 26 | + const contract = new contracts_1.Contract(contractAddress, single_call_balance_checker_abi_1.default, new providers_1.Web3Provider(provider)); |
| 27 | +- const nativeBalances = await contract.balances(accountsToUpdate, [ |
| 28 | ++ const nativeBalances = await (0, controller_utils_1.safelyExecuteWithTimeout)(() => contract.balances(accountsToUpdate, [ |
| 29 | + '0x0000000000000000000000000000000000000000', |
| 30 | +- ]); |
| 31 | +- accountsToUpdate.forEach((address, index) => { |
| 32 | +- accountsForChain[address] = { |
| 33 | +- balance: nativeBalances[index].toHexString(), |
| 34 | +- }; |
| 35 | +- }); |
| 36 | ++ ]), false, 3000); |
| 37 | ++ if (nativeBalances) { |
| 38 | ++ accountsToUpdate.forEach((address, index) => { |
| 39 | ++ accountsForChain[address] = { |
| 40 | ++ balance: nativeBalances[index].toHexString(), |
| 41 | ++ }; |
| 42 | ++ }); |
| 43 | ++ } |
| 44 | + } |
| 45 | + else { |
| 46 | + // Process accounts in batches using reduceInBatchesSerially |
| 47 | +@@ -191,8 +197,8 @@ class AccountTrackerController extends (0, polling_controller_1.StaticIntervalPo |
| 48 | + }, |
| 49 | + }); |
| 50 | + } |
| 51 | +- const stakedBalanceResult = (await stakedBalancesPromise); |
| 52 | +- Object.entries(stakedBalanceResult).forEach(([address, balance]) => { |
| 53 | ++ const stakedBalanceResult = await (0, controller_utils_1.safelyExecuteWithTimeout)(async () => (await stakedBalancesPromise)); |
| 54 | ++ Object.entries(stakedBalanceResult ?? {}).forEach(([address, balance]) => { |
| 55 | + accountsForChain[address] = { |
| 56 | + ...accountsForChain[address], |
| 57 | + stakedBalance: balance, |
| 58 | +@@ -269,11 +275,12 @@ _AccountTrackerController_refreshMutex = new WeakMap(), _AccountTrackerControlle |
| 59 | + const selectedNetworkClientId = networkClientId ?? |
| 60 | + this.messagingSystem.call('NetworkController:getState') |
| 61 | + .selectedNetworkClientId; |
| 62 | +- const { configuration: { chainId }, provider, } = this.messagingSystem.call('NetworkController:getNetworkClientById', selectedNetworkClientId); |
| 63 | ++ const { configuration: { chainId }, provider, blockTracker, } = this.messagingSystem.call('NetworkController:getNetworkClientById', selectedNetworkClientId); |
| 64 | + return { |
| 65 | + chainId, |
| 66 | + provider, |
| 67 | + ethQuery: new eth_query_1.default(provider), |
| 68 | ++ blockTracker, |
| 69 | + }; |
| 70 | + }, _AccountTrackerController_getNetworkClientIds = function _AccountTrackerController_getNetworkClientIds() { |
| 71 | + const { networkConfigurationsByChainId } = this.messagingSystem.call('NetworkController:getState'); |
1 | 72 | diff --git a/node_modules/@metamask/assets-controllers/dist/NftController.cjs b/node_modules/@metamask/assets-controllers/dist/NftController.cjs
|
2 | 73 | index 3e7b205..00ad856 100644
|
3 | 74 | --- a/node_modules/@metamask/assets-controllers/dist/NftController.cjs
|
@@ -150,7 +221,7 @@ index 3e7b205..00ad856 100644
|
150 | 221 | }
|
151 | 222 | }
|
152 | 223 | diff --git a/node_modules/@metamask/assets-controllers/dist/NftController.d.cts b/node_modules/@metamask/assets-controllers/dist/NftController.d.cts
|
153 |
| -index e16e91f..3168b35 100644 |
| 224 | +index 4a81bbc..6cd5476 100644 |
154 | 225 | --- a/node_modules/@metamask/assets-controllers/dist/NftController.d.cts
|
155 | 226 | +++ b/node_modules/@metamask/assets-controllers/dist/NftController.d.cts
|
156 | 227 | @@ -110,6 +110,7 @@ export type NftMetadata = {
|
|
0 commit comments