diff --git a/packages/engine/src/dbs/simple/entity/SimpleDbEntitySetting.ts b/packages/engine/src/dbs/simple/entity/SimpleDbEntitySetting.ts index 91c3d5d655c..caf3ab8459b 100644 --- a/packages/engine/src/dbs/simple/entity/SimpleDbEntitySetting.ts +++ b/packages/engine/src/dbs/simple/entity/SimpleDbEntitySetting.ts @@ -109,7 +109,7 @@ export class SimpleDbEntitySetting extends SimpleDbEntityBase t.type === 'custom') ?? []; return this.setRawData({ ...rawData, - rpcBatchWhitelists: values?.concat(customWhitelist) ?? [], + rpcBatchWhitelists: (values ?? []).concat(customWhitelist), }); } @@ -136,7 +136,7 @@ export class SimpleDbEntitySetting extends SimpleDbEntityBase n.url !== value && n.type === 'custom', + (n) => n.url !== value || n.type !== 'custom', ) ?? [], }); } diff --git a/packages/kit-bg/src/services/ServiceNetwork.ts b/packages/kit-bg/src/services/ServiceNetwork.ts index 4a4425d9cbb..1a9495e5947 100644 --- a/packages/kit-bg/src/services/ServiceNetwork.ts +++ b/packages/kit-bg/src/services/ServiceNetwork.ts @@ -366,12 +366,6 @@ class ServiceNetwork extends ServiceBase { }; const network = await engine.getNetwork(networkId); const url = network.rpcURL; - const whitelistHosts = - await simpleDb.setting.getRpcBatchFallbackWhitelistHosts(); - - const item = whitelistHosts.find((n) => url.includes(n.url)); - const isRpcInWhitelistHost = !!item; - try { if (networkId.startsWith(IMPL_EVM)) { const vault = await engine.getChainOnlyVault(networkId); @@ -381,6 +375,12 @@ class ServiceNetwork extends ServiceBase { } if (networkId.startsWith(IMPL_EVM)) { + const whitelistHosts = + await simpleDb.setting.getRpcBatchFallbackWhitelistHosts(); + + const item = whitelistHosts.find((n) => url.includes(n.url)); + const isRpcInWhitelistHost = !!item; + const ts = rpcUrlSupportBatchCheckTimestampMap.get(url); if (status.rpcBatchSupported === false && !isRpcInWhitelistHost) { if (!ts || Date.now() - ts > getTimeDurationMs({ day: 1 })) {