-
Notifications
You must be signed in to change notification settings - Fork 22
feat(core): migrate agent-js to icp-sdk #1044
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
size-limit report 📦
|
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
peterpeterparker
added a commit
that referenced
this pull request
Oct 15, 2025
# Motivation Migrating to the `@icp-sdk` (#1044) requires importing modules (agent, identity etc.) from sub-entries - e.g. `@icp-sdk/core/agent` instead of `@dfinity/agent`. Our current `moduleResolution: node` set in `tsconfig.json` cannot resolve those kind of path. Without any changes, it leads to issue at build time like: > src/utils/governance.utils.ts:7:32 - error TS2307: Cannot find module '@icp-sdk/core/principal' or its corresponding type declarations. > There are types at '/Users/daviddalbusco/projects/dfinity/ic-js/node_modules/@icp-sdk/core/lib/esm/principal/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. That is why we are switching to a more modern [module resolution](https://www.typescriptlang.org/tsconfig/#moduleResolution) approach, `bundler`. # Notes We switch to `bundler` because we are generating JS with a tool - esbuild - and not TSC itself. # Changes - Set `moduleResolution: bundler`. Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
peterpeterparker
added a commit
that referenced
this pull request
Oct 15, 2025
# Motivation We want to migrate agent-js to `@icp-sdk/core`. Since this library currently re-export all underlying libraries - e.g. `@dfinity/agent` and `@dfinity/principal` - we are using, in this first step we can solely switch the dependencies. # Temporary "Workaround" Without migrating all imports to their corresponding sub-paths (will be resolved in #1044), the generate bundles end including the code of the agent which per extension lead the library to become more heavy. As temporary workaroung, we add an explicit exclude in the bundler script which we can remove afterwards. # Notes Announcement: https://forum.dfinity.org/t/icp-javascript-sdk-v4-0-0-is-released/55915 # Changes - Update helper script that handles lib upgrades. - Replace `@dfinity/*` peer dependencies by `@icp-sdk/core`. - Exclude `@icp-sdk/core` from `size-limit` checker (similarly to the `@dfinity/...` libs). - Temporary manually list `@dfinity/...` as peer dependencies for the build (see workaround above). --------- Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
AntonioVentilii
approved these changes
Oct 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
While we can technically continue to import modules from AgentJS using the legacy libraries - inherited as peer dependencies of
@icp-sdk/core
- we want to fully migrate to the new subentry-paths library. That is why this PR adapts all imports. Basically a search and replace.Notes
This PR does not migrate the imports in the DID files and the scripts that generates those. This will be resolve separately and partially - for the huge part - automatically.
Changes
@dfinity/agent
and replace by@icp-sdk/core/agent
@dfinity/identity
and replace by@icp-sdk/core/identity
@dfinity/candid
and replace by@icp-sdk/core/candid
@dfinity/principal
and replace by@icp-sdk/core/principal