From 00facb084ffce4cfba44dce6a3e5e588b8cb7b08 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Mon, 25 Nov 2024 07:52:00 +0100 Subject: [PATCH] feat: adapt for Agent-js v2 --- src/utils/actor.utils.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 + }); };