Release 2.0.0
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
- ci: npm cache and cypress action by @krpeacock in #897
- ci: fix cypress by @krpeacock in #898
- ci: removing headless browser tests pending a rewrite by @krpeacock in #900
- feat!: support getting certificate back from call by @krpeacock in #892
- feat: deprecate
HttpAgent
constructor in favor of newcreate
by @krpeacock in #873 - chore: v1 agent compatibility with v2 actor tests by @krpeacock in #902
- ci: changing github token for creating release by @krpeacock in #903
Full Changelog: v1.4.0...v2.0.0