-
Notifications
You must be signed in to change notification settings - Fork 20
feat: export react context, return wallet session on wallet connect and break circular deps #4
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
base: main
Are you sure you want to change the base?
feat: export react context, return wallet session on wallet connect and break circular deps #4
Conversation
|
@tomiiide I've updated a lot of things and will cut the first minor release. Do you want to review anything in this PR before i review or good to go? |
|
@GuiBibeau Since there are no merge conflicts, I think it's good to go. |
|
@tomiiide perfect. I'm not planning any changes until monday on the react codebase after a bit of testing round by others. Hit me up once you want me to review/merge. the only changes i will work on until then will be repo management stuff:
|
|
@tomiiide Just checking a last time if you want to get this resolved in conflicts and merged? I can take it on if you don't have the time. Most of the API surface is now solidified and won't change much other than patches and new features |
|
@GuiBibeau I've resolved the conflicts, you can take a look now. Thanks. |
What does this PR do?
This PR does a couple of things:
SolanaClientContextfor external use casesWalletSessionobject after a connector connects.Why was it implemented this way?
Exporting
SolanaClientContextWe needed this in a widget use case. The widget has it's internal wallet management. However, we want our partners to be able bring their own wallet management solution and the widget to use the external wallet management when available.
We do this by checking if there is an existing
SolanaClientContextin the tree, and reusing it if there is, else, we create a new context.Returning the
WalletSessionafter connectionAlthough there is a
useSessionhook to fetch when the session. In our use case, we have a synchronous flow where onConnect, we show the user he a connecting modal and after connection, our internal state is updated, and the we close the modal. Doing this with the hook would work but would not be a linear flow.Break circular dependencies in the repo.
After making the above updates, I discovered there were circular dependencies in the repo.
src/types.tsfiles into smallertypes.tsfiles for each module / folder.madgeto the devDependencies to help check for circular dependencies.