diff --git a/src/utils/actor.utils.ts b/src/utils/actor.utils.ts index 317b3190..e7c59e48 100644 --- a/src/utils/actor.utils.ts +++ b/src/utils/actor.utils.ts @@ -39,12 +39,11 @@ export const initAgent = async (): Promise => { : container : 'https://icp-api.io'; - const agent = new HttpAgent({identity, host, retryTimes: 10, fetch}); - - if (localActor) { - // Fetch root key for certificate validation during development - await agent.fetchRootKey(); - } - - return agent; + return await HttpAgent.create({ + identity, + host, + retryTimes: 10, + fetch, + shouldFetchRootKey: localActor + }); };