Skip to content
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

Merged
merged 3 commits into from
Sep 24, 2024
Merged

Update agent-js #2624

merged 3 commits into from
Sep 24, 2024

Conversation

frederikrothenberger
Copy link
Contributor

@frederikrothenberger frederikrothenberger commented Sep 24, 2024

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.

`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.
Copy link
Member

@peterpeterparker peterpeterparker left a 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?

@frederikrothenberger
Copy link
Contributor Author

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.

Copy link
Collaborator

@lmuntaner lmuntaner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@frederikrothenberger frederikrothenberger added this pull request to the merge queue Sep 24, 2024
@@ -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 });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always shouldFetchRootKey?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Merged via the queue into main with commit 3e49ba1 Sep 24, 2024
66 checks passed
@frederikrothenberger frederikrothenberger deleted the frederik/bump-fe-deps branch September 24, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants