|
| 1 | +diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs |
| 2 | +index ab23c95d667357db365f925c4c4acce4736797f8..8fd5efde7a3c24080f8a43f79d10300e8c271245 100644 |
| 3 | +--- a/dist/TokenDetectionController.cjs |
| 4 | ++++ b/dist/TokenDetectionController.cjs |
| 5 | +@@ -204,13 +204,10 @@ class TokenDetectionController extends (0, polling_controller_1.StaticIntervalPo |
| 6 | + // Try detecting tokens via Account API first if conditions allow |
| 7 | + if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) { |
| 8 | + const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks); |
| 9 | +- // If API succeeds and no chains are left for RPC detection, we can return early |
| 10 | +- if (apiResult?.result === 'success' && |
| 11 | +- chainsToDetectUsingRpc.length === 0) { |
| 12 | +- return; |
| 13 | ++ // If the account API call failed, have those chains fall back to RPC detection |
| 14 | ++ if (apiResult?.result === 'failed') { |
| 15 | ++ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); |
| 16 | + } |
| 17 | +- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection |
| 18 | +- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); |
| 19 | + } |
| 20 | + // Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc |
| 21 | + if (chainsToDetectUsingRpc.length > 0) { |
| 22 | +@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre |
| 23 | + const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f") |
| 24 | + .getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks) |
| 25 | + .catch(() => null); |
| 26 | +- if (!tokenBalancesByChain || |
| 27 | +- Object.keys(tokenBalancesByChain).length === 0) { |
| 28 | ++ if (tokenBalancesByChain === null) { |
| 29 | + return { result: 'failed' }; |
| 30 | + } |
| 31 | + // Process each chain ID individually |
| 32 | +diff --git a/dist/TokenDetectionController.mjs b/dist/TokenDetectionController.mjs |
| 33 | +index f75eb5c2c74f2a9d15a79760985111171dc938e1..ebc30bb915cc39dabf49f9e0da84a7948ae1ed48 100644 |
| 34 | +--- a/dist/TokenDetectionController.mjs |
| 35 | ++++ b/dist/TokenDetectionController.mjs |
| 36 | +@@ -205,13 +205,10 @@ export class TokenDetectionController extends StaticIntervalPollingController() |
| 37 | + // Try detecting tokens via Account API first if conditions allow |
| 38 | + if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) { |
| 39 | + const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks); |
| 40 | +- // If API succeeds and no chains are left for RPC detection, we can return early |
| 41 | +- if (apiResult?.result === 'success' && |
| 42 | +- chainsToDetectUsingRpc.length === 0) { |
| 43 | +- return; |
| 44 | ++ // If the account API call failed, have those chains fall back to RPC detection |
| 45 | ++ if (apiResult?.result === 'failed') { |
| 46 | ++ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); |
| 47 | + } |
| 48 | +- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection |
| 49 | +- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); |
| 50 | + } |
| 51 | + // Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc |
| 52 | + if (chainsToDetectUsingRpc.length > 0) { |
| 53 | +@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre |
| 54 | + const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f") |
| 55 | + .getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks) |
| 56 | + .catch(() => null); |
| 57 | +- if (!tokenBalancesByChain || |
| 58 | +- Object.keys(tokenBalancesByChain).length === 0) { |
| 59 | ++ if (tokenBalancesByChain === null) { |
| 60 | + return { result: 'failed' }; |
| 61 | + } |
| 62 | + // Process each chain ID individually |
0 commit comments