-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update agent-js #2624
Update agent-js #2624
Conversation
`npm update` clashes with incompatible peer dependencies due to agent-js being on version 1.x.x but `@dfinity/utils` wanting 2.x.x. Hence agent-js and related dependencies are upgraded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were breaking changes in the way Agent creation works, introduced in v2. Doesn't II's codebase need some adaptation for this? Did you double-check?
Yes, you are right. The old way still works as it was just deprecated. But switching is definitely better. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -61,7 +61,7 @@ document.getElementById("loginBtn")?.addEventListener("click", async () => { | |||
// At this point we're authenticated, and we can get the identity from the auth client: | |||
const identity = authClient.getIdentity(); | |||
// Using the identity obtained from the auth client, we can create an agent to interact with the IC. | |||
const agent = new HttpAgent({ identity }); | |||
const agent = await HttpAgent.create({ identity, shouldFetchRootKey: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always shouldFetchRootKey
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is in the dev build demo, which runs on the local replica and hence always needs fetching the root key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional context: there was no fetchRootKey
before in the example. However, that only worked because the whoami
call was a query call, which is uncertified.
Anyone expanding that example with an update call would immediately run into an issue. Hence the fetchRootKey
is added now.
npm update
clashes with incompatible peer dependencies due to agent-js being on version 1.x.x but@dfinity/utils
wanting 2.x.x. Hence agent-js and related dependencies are upgraded.