You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it's a scoped context. a provider doesn't have to be used at the top level of the page.
the provider can be used as a top level component to provide a scope that encompasses the page.
or it can be used in a smaller component, and will then be scoped only part of the page. this would allow a dapp to connect to multiple providers at once.
the context provider and hook model is common among other react wallet packages and APIs.
i've done some work to make a hook executing without a provider use a default global scope. i'll push that branch up soon as a PR.
Update Aug 26th:
====
Now that Prax v11.14 is live and client package is updated, we should re-write the react package to support it.
=====
Was relevant in last React package:
The PenumbraContextProvider is a react component that consumers are required to wrap around their app.
It should be possible to convert this to a hook so consumers aren't required to wrap their app in it.
PenumbraState has a failure state, so this shouldn't be necessary:
web/packages/react/src/components/penumbra-context-provider.tsx
Lines 32 to 49 in f515113
assertGlobalPresent()
in the client package performs this:web/packages/react/src/components/penumbra-context-provider.tsx
Lines 51 to 66 in f515113
This will have to remain, but can live in a hook and attach itself on mount:
web/packages/react/src/components/penumbra-context-provider.tsx
Lines 68 to 94 in f515113
Should not exist (#1522):
web/packages/react/src/components/penumbra-context-provider.tsx
Lines 96 to 117 in f515113
Can be moved to hook:
web/packages/react/src/components/penumbra-context-provider.tsx
Lines 119 to 149 in f515113
Can be exposed by hook:
web/packages/react/src/components/penumbra-context-provider.tsx
Lines 151 to 196 in f515113
All told, I don't see a reason to require consumers to have a global context for this when a hook would be easier.
The text was updated successfully, but these errors were encountered: