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

Simplify usage of Registry #36

Open
webmaster128 opened this issue Feb 3, 2022 · 0 comments
Open

Simplify usage of Registry #36

webmaster128 opened this issue Feb 3, 2022 · 0 comments

Comments

@webmaster128
Copy link
Member

The code

            const registry = new Registry();

            // register custom types here

            defaultRegistryTypes.forEach((v) => {
                registry.register(v[0], v[1]);
            });

in

defaultRegistryTypes.forEach((v) => {
registry.register(v[0], v[1]);
});
seems correct but can be simplified to

const registry = new Registry(defaultRegistryTypes);

// register custom types here

The only thing this changes is the registration order, which only matters if you register a type that is part of the defaults. In this case the second version is probably what you want.

By the way, /cosmos.gov.v1beta1.MsgSubmitProposal is registered by default in CosmJS 0.27 and the two authz messages are coming with CosmJS 0.28.

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

No branches or pull requests

1 participant