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

Thin gRPC wrapper around WalletManager #34

Merged
merged 80 commits into from
May 29, 2023
Merged

Conversation

CiottiGiorgio
Copy link
Contributor

Started fresh with a new branch name / draft PR because the old one was diverging too much from the original goal.

At this stage, there is a gRPC wrapper around the needed functionality of WalletManager in grpc-wrapper folder. There is also an example of WalletManager using a stub object to hook into the gRPC service in examples-d folder.

…ary when wrapping WalletManager within a gRPC service.
…not the best and it is because now the inner components of WalletManager need to call the API of WalletManager.
# Conflicts:
#	examples/wallet-manager.ts
#	package-lock.json
#	package.json
grpc-wrapper/service.js Outdated Show resolved Hide resolved
@CiottiGiorgio
Copy link
Contributor Author

We just added linting and formatting utilities to the project but actually triggering them would cause huge changes. It's best to trigger those utilities into another PR.

examples/rebalancing.ts Show resolved Hide resolved
examples/rebalancing.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated
// This function will return the same object with the minimal set of methods required to work for the
// requested context.
export function buildWalletManager(rawWMFullConfig: any): IClientWalletManager | ILibraryWalletManager {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should type the param here. Since this is the actual interface that the user will see it's usefull to have it typed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm. This function is just parsing with a known schema for the full config and then deciding if it must return a client object or the library object. Maybe it's doing too much but if we type the argument like fullConfig: WalletManagerFullConfig, then we shift the burden of parsing to the developer (which may not know how to do it or may forget to do it).

Maybe the goal for this function is different from what I understood?

Copy link
Collaborator

Choose a reason for hiding this comment

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

What i mean is that ultimately this is the function that will be exposed to the user, won't it? So in that case, typing the parameter can be helpful for the user of the lib, IMO, since you can use the hints of the IDE to understand what the function is expecting as arguments. If the argument names are expressive enough, you might even get started without looking at any documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Changed as suggested.

@CiottiGiorgio
Copy link
Contributor Author

Missing documentation and then should be good to go

@@ -1,12 +1,17 @@
{
"name": "@xlabs-xyz/wallet-monitor",
"version": "0.1.16",
"version": "0.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

excellent!

@CiottiGiorgio CiottiGiorgio merged commit de240e7 into main May 29, 2023
@CiottiGiorgio
Copy link
Contributor Author

🎉

@CiottiGiorgio CiottiGiorgio deleted the feat/wallet-manager-grpc branch May 29, 2023 12:54
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.

4 participants