Releases: dfinity/agent-js
Release 2.1.3
What's Changed
We have a couple fixes and some improvements to errors in this release.
Fixes
- Fixed an issue where
read_state
polling requests would fail after the initial expiry, but before the request was processed- This was an edge case for subnets under high load. The
read_state
is allowed to use a fresh ingress_expiry, sopollForResponse
andretry
logic now uses this pattern
- This was an edge case for subnets under high load. The
- Added a check to handle a regression when calling the management canister using the new sync_call flow
Error handling
-
Fixed an issue where
reject_code
andreject_message
weren't passed correctly to the error in synchronous callreject
ortrap
responses. -
new
ActorCallError
class -
AgentError
andActorCallError
supportinstanceof
checks, as well as aname
attribute that you can use for easier error handling- some old generic
Error
s are now labeled more preciesely
- some old generic
-
chore: Correct the typo in
agent/src/actor.ts
by @AlexV525 in #939 -
fix: trap and throw handling in v3 sync call by @krpeacock in #940
-
fix: read state with fresh expiry by @krpeacock in #938
-
test: automatically deploys trap canister if it doesn't exist yet dur… by @krpeacock in #942
-
chore: skip range check when the certificate comes from the management canister by @dfx-json in #945
-
feat: allow for setting HttpAgent ingress expiry using
ingressExpiryInMinutes
option by @krpeacock in #905 -
feat: improved assertion options for agent errors by @krpeacock in #908
New Contributors
Full Changelog: v2.1.2...v2.1.3
Release 2.1.2
What's Changed
Full Changelog: v2.1.1...v2.1.2
Release 2.1.1
What's Changed
- feat(asset): add headers to StoreArgs by @chenyan-dfinity in #928
Full Changelog: v2.1.0...v2.1.1
Release 2.1.0
Noteworthy Features
This feature includes the v3 synchronous call API! Calls to mainnet are able to bypass polling using the new endpoint
The HttpAgent allows you to set and read replicaTime
, which it will maintain information about in order to handle disagreements between the client and replica about time.
Fixes and improvements for the useAuthClient
library
Other changes and enhancements
- chore: updating dependencies for elliptic advisory by @krpeacock in #912
- feat: management canister interface schnorr update by @krpeacock in #913
- feat: use-auth-client react hook by @krpeacock in #911
- docs: documentation and metadata for use-auth-client by @krpeacock in #914
- feat: ensure that seed phrase must produce a 64 byte seed by @krpeacock in #915
- feat: new option for setting rootKey during agent creation by @krpeacock in #918
- chore: npm audit by @krpeacock in #919
- fix: passing request correctly during pollForResponse Processing status by @krpeacock in #909
- feat: v3 api sync call by @krpeacock in #906
- docs: clarifies meaning of
effectiveCanisterId
inCallOptions
by @krpeacock in #920 - feat: exports polling utilities from
@dfinity/agent
by @krpeacock in #921 - feat: multi-actor config by @krpeacock in #916
- feat: expose inner certificate in Certificate by @krpeacock in #925
- fix: build paths on use-auth-client by @pocesar in #922
- feat: allow option set agent replica time by @krpeacock in #923
- chore: awaits prettier formatting by @krpeacock in #926
New Contributors
Full Changelog: v2.0.0...v2.1.0
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
Release 1.4.0
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
- @r-birkner made their first contribution in #888
- @tmu0 made their first contribution in #891
Full Changelog: v1.3.0...v1.4.0
Release 1.3.0
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
});
- chore: adds required
npm audit
check to PRs by @krpeacock in #880 - feat: retry delay strategy by @krpeacock in #871
- docs: adds instructions on how to run unit and e2e tests to the README by @krpeacock in #881
Full Changelog: v1.2.1...v1.3.0
Release 1.2.1
What's Changed
- feat: make
IdbStorage
get/set
methods generic by @hpeebles in #869 - chore: Add context to errors thrown on cbor decode by @frederikrothenberger in #874
- chore: replaces global npm install with setup-node by @krpeacock in #875
Full Changelog: v1.2.0...v1.2.1
Release 1.2.0
What's Changed
- feat: allow passing
DBCreateOptions
toIdbStorage
constructor by @hpeebles in #850 - fix: pads date numbers in changelog automation by @krpeacock in #862
- feat: support for management canister logging by @krpeacock in #863
- feat: pure JS BLS verification by @krpeacock in #817
- feat: support for restricting II auth methods by @krpeacock in #856
- chore: npm audit by @krpeacock in #865
Full Changelog: v1.1.1...v1.2.0
Release 1.1.1
What's Changed
- fix: Work around credentials not being enumerable by @frederikrothenberger in #860
Full Changelog: v1.1.0...v1.1.1