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

allow for custom DWN override in web5 connect. #162

Closed
andorsk opened this issue Aug 2, 2023 · 9 comments · Fixed by #168
Closed

allow for custom DWN override in web5 connect. #162

andorsk opened this issue Aug 2, 2023 · 9 comments · Fixed by #168

Comments

@andorsk
Copy link

andorsk commented Aug 2, 2023

is there a reason:
https://github.com/TBD54566975/web5-js/blob/main/packages/web5/src/web5.ts#L72C1-L72C1 is private?

I'm trying to implement something similar to :

export const web5 = new Web5({ dwn: { node: dwnNode }});

but because the constructor is private I am unable to:

est/utils.ts:30:17 - error TS2673: Constructor of class 'Web5' is private and only accessible within the class declaration.

30   new Web5({ dwn: { node: dwnNode } });
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The context for this: I want to do some testing for interactions between two different DWNs in my test suite. If there's a better way to do this let me know!

@andorsk
Copy link
Author

andorsk commented Aug 2, 2023

Want to clarify here that maybe another way to do this is override the connect api:

const dwn = await Dwn.create();

Note the above:

@andorsk
Copy link
Author

andorsk commented Aug 2, 2023

@andorsk andorsk changed the title suggestion/feature request: remove private constructor for Web5 allow for custom DWN in web5 connect. Aug 2, 2023
@andorsk andorsk changed the title allow for custom DWN in web5 connect. allow for custom DWN override in web5 connect. Aug 2, 2023
@cbruguera
Copy link

Hey @andorsk Has there been any progress on this? I still cannot find a way to connect the web5 client to my locally running DWN, or even to use a specific DID to connect to the default DWNs. I don't know if I'm missing something... If there's a way to circumvent this limitation I'd appreciate any pointers.. 🙏

@andorsk
Copy link
Author

andorsk commented Aug 20, 2023

@cbruguera there's a few different things you are discussing in the above comment:

  1. Sync (i.e connecting a remote DWN to a local one ) : https://developer.tbd.website/docs/web5/learn/sync.
  2. Adding a specific DID to a DWN, ( which this added option to web5 connect to allow custom dwn #163 does slightly address but not in completeness). https://github.com/TBD54566975/web5-js/blob/main/packages/web5/src/web5.ts#L127

There is supposed to be an update to web5 connect in the near future, so this #163 is on hold until that PR gets merged. Tagging @frankhinek, who might know a little more about the web5 connect update here

@cbruguera
Copy link

@andorsk thanks for your reply. I'll look forward to that PR merge then.

In the meantime, however, what would be the way to connect to a local DWN?... Maybe I'm digressing a bit from the topic of this thread, but I'm running a DWN (from the dwn-server repo) and I would like to connect to it to do some simple data store and retrieve tests. Now, given that the web5 agent is not ready yet, what would be the way? Are there any other clients other than the web5 SDK, or should I connect to it through a third party JSON-RPC client? Is there any simple way to test the DWN server at the moment?

@frankhinek
Copy link
Contributor

frankhinek commented Aug 21, 2023

is there a reason: https://github.com/TBD54566975/web5-js/blob/main/packages/web5/src/web5.ts#L72C1-L72C1 is private?

@andorsk Partly for historical reasons & DevEx. The intent was to direct devs to use Web5.connect() and not try to create instances of Web5() directly, which prior to PR #168, would involve quite a bit of manual setup code (e.g., these 60 lines).

Once PR #168 is merged (likely today), you'll be able to instantiate many DIDs to test interactions between different identities or provide a custom DWN instantiation that is using a different local path for the underlying DB to test interactions between DWNs.

@cbruguera Web5.connect() already connects to the local DWN -- that is the default behavior. Perhaps when you say "local" you mean locahost over a network and not the in-memory DWN? Probably best to continue the discussion on Discord to get into the details and see how we can help.

@andorsk
Copy link
Author

andorsk commented Aug 21, 2023

@frankhinek awesome on the merge getting resolved today. That will be very helpful. Looking forward to it.

@andorsk
Copy link
Author

andorsk commented Aug 21, 2023

@frankhinek took a look at that PR. 401 files is crazy. 🤯

@frankhinek frankhinek linked a pull request Aug 21, 2023 that will close this issue
@cbruguera
Copy link

@frankhinek yes, when I say "local" DWN I mean a dwn-server I'm manually running on my computer (either with docker or npm run server), so it would actually be a "remote" for the Web5 SDK, not the node running in memory. My question was how to connect to this node as I understood the SDK was only connecting to the default DWN URL endpoints and there was no overriding of it, but maybe I'm missing something.

I'm already making some related questions in the dwn channel on Discord. @frankhinek @andorsk thanks for replying!

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 a pull request may close this issue.

3 participants