Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate HttpAgent constructor in favor of new create #873

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

krpeacock
Copy link
Contributor

Description

Following the pattern used by other interfaces in the library, this function switches to an async create method, that will be able to make the syncTime and fetchRootKey calls before completing. This will also support future async setup calls if needed in the future. createSync initializes the agent but skips any async steps, and is useful for testing or more sophisticated applications

The agent also has a from method, and will support either the v1 or v2 agent interfaces.

The HttpAgent also switches to true es6 private class fields, and will formally reveal its config and its host as fields. This supports the from method, but the _-prefixed methods from older HttpAgents will be supported.

Note: the constructor is marked deprecated in this PR. Existing code will not break yet, but will inform the developer that they should switch to create or createSync`.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

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.

@krpeacock krpeacock requested a review from a team as a code owner April 12, 2024 23:37
@krpeacock krpeacock changed the title feat!: deprecate HttpAgent constructor in favor of new create feat: deprecate HttpAgent constructor in favor of new create Apr 12, 2024
@krpeacock krpeacock marked this pull request as draft April 12, 2024 23:41
Copy link
Contributor

github-actions bot commented May 1, 2024

size-limit report 📦

Path Size
@dfinity/agent 85.7 KB (+0.1% 🔺)
@dfinity/candid 13.58 KB (0%)
@dfinity/principal 4.97 KB (0%)
@dfinity/auth-client 60.75 KB (+0.07% 🔺)
@dfinity/assets 80.28 KB (+0.05% 🔺)
@dfinity/identity 57.94 KB (+0.05% 🔺)
@dfinity/identity-secp256k1 265.87 KB (+0.09% 🔺)

@krpeacock krpeacock marked this pull request as ready for review May 1, 2024 22:28
@krpeacock krpeacock marked this pull request as draft May 22, 2024 12:47
@krpeacock
Copy link
Contributor Author

@roelstorms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant