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: ensure the injectedRegsitry opt does deep comparisons #359

Merged
merged 28 commits into from
Feb 6, 2024

Conversation

bee344
Copy link
Contributor

@bee344 bee344 commented Feb 1, 2024

Description

It allows updating the entries of the existing registry with new info~, as well as overriding existing entries~. The injected registry no longer requires to have all the fields filled when updating an existing entry, but it errors out when adding a new entry and not specifying the chain's specName or tokens.

Added updateRegistry to parseRegistry

Added the function updateRegistry to handle checking whether the entry already exists or if it's new info, and if it's already present, it updates the corresponding fields.

Added alternative interfaces with optional values

Added InjectedChainInfoRegistry , InjectedChainInfo and InjectedChainInfoKeys alternative interfaces to allow for injected registries with partial info, as well as the AssetTransferApiInjectedOpts type for comparison made AssetTransferApiOpts, ChainInfo and ChainInfoRegistry to take either InjectedChainInfoKeys or ChainInfoKeys depending on what's needed.

Updated tests and adjustedMockSystemApi

Foreign assets' tests failed because TNKR is already in the registry, so I modified the adjustedMockSystemApi's foreignAssets to another asset, updated the corresponding tests, and updated the parseRegistry's tests to account for the new functionality.

Rel: #357

@bee344 bee344 changed the title d(feat): Allow for registry overriding and deep comparison [WIP] (feat): Allow for registry overriding and deep comparison Feb 2, 2024
@bee344 bee344 changed the title (feat): Allow for registry overriding and deep comparison feat: Allow for registry overriding and deep comparison Feb 2, 2024
@bee344 bee344 marked this pull request as ready for review February 2, 2024 12:12
@bee344 bee344 requested a review from TarikGul February 2, 2024 12:12
src/types.ts Outdated Show resolved Hide resolved
src/registry/Registry.ts Outdated Show resolved Hide resolved
src/registry/Registry.ts Outdated Show resolved Hide resolved
Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

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

On the first review I have some nits, and questions. So far though, amazing job!

@TarikGul
Copy link
Member

TarikGul commented Feb 2, 2024

As mentioned in an offline discussion we are moving this PR from a override to injection only, and a less rigid set of rules, making it as much as a deep comparison as possible

@TarikGul TarikGul changed the title feat: Allow for registry overriding and deep comparison feat: ensure the injectedRegsitry opt does deep comparisons Feb 5, 2024
Copy link
Contributor

@marshacb marshacb left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

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

Just one little nit, then this is good to go! Really great job :)

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

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

LGTM, really amazing job!

@bee344 bee344 merged commit 724a89d into main Feb 6, 2024
6 checks passed
@bee344 bee344 deleted the anp-registry-comparison branch February 6, 2024 17:35
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.

3 participants