Skip to content

feat(agent): allow passing identity into all HttpAgent canister requests#1286

Open
hpeebles wants to merge 14 commits intodfinity:mainfrom
hpeebles:polling
Open

feat(agent): allow passing identity into all HttpAgent canister requests#1286
hpeebles wants to merge 14 commits intodfinity:mainfrom
hpeebles:polling

Conversation

@hpeebles
Copy link
Copy Markdown
Contributor

@hpeebles hpeebles commented Mar 11, 2026

Description

You can already specify the identity when using call, query and readState, but this option was not exposed by pollForResponse. This PR simply brings pollForResponse in line with the other similar functions.

By setting the identity with each request we are able to construct a single HttpAgent instance when the app starts, and can continue to use it after the user signs in / out by simply passing in the updated identity.

How Has This Been Tested?

I have used this new functionality locally within an app I'm building.

Checklist:

  • My changes follow the guidelines in CONTRIBUTING.md.
  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@hpeebles hpeebles requested a review from a team as a code owner March 11, 2026 17:01
@hpeebles hpeebles changed the title feat(agent): allow specifying identity within pollForResponse feat(agent): allow specifying identity when calling pollForResponse Mar 11, 2026
@hpeebles hpeebles changed the title feat(agent): allow specifying identity when calling pollForResponse feat(agent): allow specifying identity when using pollForResponse Mar 11, 2026
@hpeebles hpeebles changed the title feat(agent): allow specifying identity when using pollForResponse feat(agent): allow passing identity into pollForResponse Mar 11, 2026
@hpeebles hpeebles changed the title feat(agent): allow passing identity into pollForResponse feat(agent): allow passing identity into all HttpAgent canister requests Mar 25, 2026
requestId = getRequestId(fields);

// Always create a fresh request with the current identity
const identity = await this.#identity;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to calculate the identity here since that already happens within createReadStateRequest

* @see https://internetcomputer.org/docs/current/references/ic-interface-spec/#http-effective-canister-id
*/
effectiveCanisterId: Principal | string;
effectiveCanisterId?: Principal | string;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this optional to be consistent with QueryFields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants