@icp-sdk/core Release Announcements

This topic is used to announce new releases of @icp-sdk/core, the official JavaScript/TypeScript SDK for the Internet Computer.

Release announcements will be posted as replies to this topic.

i suppose dfx new will use @icp-sdk in the future instead of @dfinity ?

@kayicp I am not sure if there is a plan to change this behavior in dfx (cc @raymondk)

I recommend to switch over to icp-cli for new project :wink:

and if you need to switch over from existing projects, there is a migration-guide and an icp-cli skill that will help you doing this.

dfx generate already creates @icp-sdk/core imports. See changelog entry here. No other command is tied to the js agent

@icp-sdk/core v5.1.0

Release: v5.1.0 on GitHub
npm: npm install @icp-sdk/core@5.1.0

Highlights

New features:

  • update method on HttpAgent, combines call + polling in a single method (#1289)
  • rawCertificate is now available in pollForResponse return type (#1287)
  • New queryStrategy option on ActorConfig for controlling how query methods are executed (#1274)

Bug fixes:

  • Simplified getSubnetNodeKeys to remove redundant cache re-reads (#1291)
  • Improved error messages for candid decoding errors (#1292, #1270)
  • Fixed incorrect types in hashTreeToString (#1290)
  • Reject query responses with more signatures than subnet nodes (#1281)
  • Deduplicate parallel fetchSubnetKeys requests to avoid redundant read_state round-trips (#1278)
  • Resolved security vulnerabilities and upgraded dependencies (#1273)

Refactoring:

  • Simplified Actor to delegate update calls to agent.update (#1294)
  • Extracted #handleV4SyncResponse and #handleV2Rejection from update (#1306)
  • Reduced circular dependencies in the agent (#1285)
  • Made CallContext.httpDetails optional for polling error paths (#1284)
  • Extracted readCertifiedReject helper to deduplicate certified reject logic (#1283)
  • Use globalThis.fetch instead of custom environment detection (#1272)

Full changelog: icp-js-core/CHANGELOG.md at main · dfinity/icp-js-core · GitHub


We’d love your feedback! If you run into any issues, please report them on GitHub. Contributions are always welcome.

Thank you to everyone who contributed to this release!

@icp-sdk/core v5.2.0

We’re happy to announce v5.2.0 of @icp-sdk/core, which brings improved error readability, a fix for a common bundler issue, and pluggable caching for subnet node keys.

What’s New

Pluggable ExpirableStore for Subnet Node Key Caching (#1280)

HttpAgent now accepts a subnetNodeKeyExpirableStore option, allowing cached subnet node keys to be shared across multiple agent instances and page reloads. In browsers, an IndexedDB-backed store is used by default, eliminating redundant key fetches for dApps that create multiple agents.

Hex-Encoded Error Messages and Error Verbosity (#1312)

Uint8Array fields in error messages (e.g. arg, certificate, nonce) are now hex-encoded instead of being serialized byte-by-byte with JSON.stringify. This prevents multi-thousand-line error output that could freeze log viewers.

A new ErrorVerbosity setting lets you control the level of detail:

  • Normal (default): omits large binary fields with a hint to enable verbose mode
  • Verbose: includes full hex-encoded values
import { ErrorCode, ErrorVerbosity } from "@icp-sdk/core/agent";

ErrorCode.verbosity = ErrorVerbosity.Verbose;

Bug Fixes

Bind globalThis.fetch to Prevent “Illegal Invocation” (#1316)

Users of bundlers like Vite and webpack no longer need to manually pass fetch: window.fetch.bind(window) when creating an HttpAgent. The SDK now binds the default fetch to globalThis automatically, preventing the “Illegal invocation” error that occurred when bundlers stripped the this context.

Upgrading

npm install @icp-sdk/core@latest

No breaking changes.