diff --git a/src/utils/initializeProviders.test.ts b/src/utils/initializeProviders.test.ts index 62999be2..232d6c1f 100644 --- a/src/utils/initializeProviders.test.ts +++ b/src/utils/initializeProviders.test.ts @@ -97,7 +97,7 @@ describe('initializeProviders', () => { const result = await initializeProviders(providers) // Check if the returned object has the correct keys - expect(Object.keys(result)).toEqual(expect.arrayContaining(providers)) + expect(Object.keys(result)).toEqual(providers) // Check if the returned clients are instances of BaseClient for (const clientInstance of Object.values(result)) { diff --git a/src/utils/initializeProviders.ts b/src/utils/initializeProviders.ts index d6f010f7..6653bd00 100644 --- a/src/utils/initializeProviders.ts +++ b/src/utils/initializeProviders.ts @@ -50,7 +50,11 @@ export const initializeProviders = async debugLog('Initializing providers:', getProviderList(providers)) - const initPromises = providers.map((provider) => initClient(provider)) + const initPromises = providers.map((provider) => { + const providerId = typeof provider === 'string'? provider : provider.id + initializedProviders[providerId] = null // Set to null to preserve order of providers + initClient(provider) + }) await Promise.all(initPromises) return initializedProviders