Skip to content

Releases: dfinity/icp-js-core

Release 2.0.0

16 Jul 17:30
ed4f2d0

Choose a tag to compare

Async HttpAgent and call response changes

Some small but backwards incompatible changes come with this release, but it enables some advanced use cases for libraries building with the HttpAgent.

Change 1 - HttpAgent constructor deprecation

The HttpAgent has a TSDoc warning against being constructed with the new constructor. We now prefer await HttpAgent.create(), which will automatically fetch the root key if you pass shouldFetchRootKey: true (for local development) to the HttpAgentOptions. HttpAgent.create will also automatically run the syncTime method, and configure the agent to calculate the difference between the system clock and the Internet Computer replica's time, which should reduce the occurrence of device sync issues. Since not all of your code may run inside of an async function, you can consider running a simple find and replace when upgrading to > v2.0.0.

The createSync method has identical behavior to new currently, and is preferred over accessing the constructor going forward.

function getActor(options){
-   return new HttpAgent(options);  
+   return HttpAgent.createSync(options);
}

Change 2 - Raw Call

In order to support ICRC-49, we need the HttpAgent to provide more details back after making a call. With this change, HttpAgent.call will provide:

requestId - the computed request ID to poll for
response - the raw `http` response from the boundary node
requestDetails - the details sent to the canister, used to compute the request ID

In addition, the output from pollForResponse needs to be updated as well. PollForResponse now returns

certificate: the Certificate tree sent along with the reply
reply: the certified response from the replica

Note

The v2 Actor is able to use older HttpAgent interfaces with backwards compatibility, but the pollForResponse type has a breaking return signature. You must use a v1 polling strategy with a v1 actor, and a v2 strategy with a v2 actor.

What's Changed

Full Changelog: v1.4.0...v2.0.0

Release 1.4.0

18 Jun 14:10
10a0950

Choose a tag to compare

What's Changed

  • chore: updates dfinity/conventional-pr-title-action to v3.2.0 by @krpeacock in #886
  • chore: updates dfinity/conventional-pr-title-action to v4.0.0 by @krpeacock in #889
  • chore: updates agent error response by @krpeacock in #885
  • fix: updated outdated urls in sample by @r-birkner in #888
  • fix: publish script will correctly update the package-lock.json file … by @krpeacock in #883
  • feat: add support for proof of absence in certificate lookups by @nathanosdev in #878
  • chore: update management canister interface with latest bitcoin features by @krpeacock in #890
  • fix: ObservableLog no longer extends Function by @krpeacock in #887
  • chore: bump braces by @tmu0 in #891
  • feat: strips out bitcoin query methods from management canister IDL by @krpeacock in #893

New Contributors

Full Changelog: v1.3.0...v1.4.0

Release 1.3.0

01 May 22:44
21e8d2b

Choose a tag to compare

What's Changed

New feature - exponential backoff for retries, using a new HttpAgent option - backoffStrategy. The agent can accept a BackoffStrategyFactory, which is a function that returns a BackoffStrategy. The strategy itself must include a next method, which yields a number or null

The default strategy mimics the one used by agent-rs. It will increase the interval using exponential backoff, and adding in a "jitter", randomizing the result a little to decrease the likelihood of calls firing at the same time as your application scales, which could cause performance issues under certain conditions.

If you prefer a constant backoff, a custom factory would look something like this in TypeScript:

import { HttpAgent, BackoffStrategy } from '@dfinity/agent'; 

const strat: BackoffStrategy = {
  next: () => 1000
}

const agent = new HttpAgent({
  backoffStrategy: () => strat
});

Full Changelog: v1.2.1...v1.3.0

Release 1.2.1

25 Apr 17:14
f000c7d

Choose a tag to compare

What's Changed

Full Changelog: v1.2.0...v1.2.1

Release 1.2.0

25 Mar 20:44
d73d5e9

Choose a tag to compare

What's Changed

Full Changelog: v1.1.1...v1.2.0

Release 1.1.1

19 Mar 16:03
4ba3407

Choose a tag to compare

What's Changed

Full Changelog: v1.1.0...v1.1.1

Release 1.1.0

18 Mar 17:50
ad6ba89

Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.1.0

Release 1.0.1

20 Feb 23:41
0f0e10a

Choose a tag to compare

What's Changed

  • chore: export AuthClientStorage to aid with custom implementations by @hpeebles in #848
  • fix: ed25519KeyIdentity generates unique identities when no seed is provided by @krpeacock in #851

Full Changelog: v1.0.0...v1.0.1

Release 1.0.0

13 Feb 22:22
31f1dc1

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.21.4...v1.0.0

Release 0.21.4

24 Jan 19:59
2063948

Choose a tag to compare

What's Changed

Full Changelog: v0.21.2...v0.21.4