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

Web3ApiClient adding default config should extend interface implementations #760

Closed
Tracked by #714
nerfZael opened this issue Mar 17, 2022 · 1 comment
Closed
Tracked by #714
Assignees
Milestone

Comments

@nerfZael
Copy link
Contributor

nerfZael commented Mar 17, 2022

When registering interface implementations

const client = new Web3ApiClient({
  interfaces: [
    { 
      uri: "uri1",
      implementations: [ "impl1" ]
    }
  ]
});

The expected behavior is to have the default implementations for that interface be added to the implementations array

client.getInterfaces();
/*
[
    { 
      uri: "uri1",
      implementations: [ "impl1" , "default1"]
    }
]
*/

The actual behavior is that the interface implementations pair is added.

client.getInterfaces();
/*
[
    { 
      uri: "uri1",
      implementations: [ "impl1" , "default1"]
    },
    { 
      uri: "uri1",
      implementations: [ "default1"]
    }
]
*/

Additionally, if the developer registers multiple interface implementations pairs for the same interface. They should be merged together:

const client = new Web3ApiClient({
  interfaces: [
    { 
      uri: "uri1",
      implementations: [ "impl1" ]
    },
    { 
      uri: "uri1",
      implementations: [ "impl2" ]
    }
  ]
});

client.getInterfaces();
/*
[
    { 
      uri: "uri1",
      implementations: [ "impl1" , "impl2"]
    }
]
*/
@nerfZael
Copy link
Contributor Author

Fixed in #766

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