-
Notifications
You must be signed in to change notification settings - Fork 17
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
Set gRPC endpoint during onboarding, part 2 #877
Conversation
cd7806e
to
9057be9
Compare
@@ -6,7 +6,7 @@ import { ImportSeedPhrase } from './import'; | |||
import { OnboardingSuccess } from './success'; | |||
import { SetPassword } from './set-password'; | |||
import { pageIndexLoader } from '..'; | |||
import { SetRpcEndpoint } from './set-rpc-endpoint'; | |||
import { SetGrpcEndpoint } from './set-grpc-endpoint'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consolidating the naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer to align on "rpc", it's a more generic term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, same. I'll merge this and then discuss in Discord. The issue was, the local storage key is grpcEndpoint
, so I figured we should standardize on that since it's already in a bunch of users' local storage.
import { ServicesMessage } from '@penumbra-zone/types/src/services'; | ||
import { GrpcEndpointForm } from '../../../shared/components/grpc-endpoint-form'; | ||
|
||
export const SetGrpcEndpoint = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file used to be set-rpc-endpoint.tsx
. When I renamed it to set-grpc-endpoint.tsx
, and extracted the GrpcEndpointForm
component, the file was so different that Git thought of it as an entirely different file.
} | ||
}; | ||
|
||
export const useGrpcEndpointForm = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hook basically extracts all the business logic out of the SettingsRPC
component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of this logic could alternatively go into zustand, it seems like that's generally preferred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right — I'll do a follow-up PR for that
apps/extension/src/shared/components/grpc-endpoint-form/index.tsx
Outdated
Show resolved
Hide resolved
) => { | ||
setIsSubmitButtonEnabled(false); | ||
await setGrpcEndpoint(grpcEndpointInput); | ||
// If the chain id has changed, our cache is invalid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on mainnet, this is a more serious condition than is typical in our experience as developers constantly flipping between testnet/preview. there should be a confirmation or other significant ui hurdle at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I added a confirmation dialog in this commit.
Was the rest of this PR a ✅ ? If so, could you please approve if that latest commit looks good?
rel='noreferrer' | ||
className='block text-right text-xs text-muted-foreground' | ||
> | ||
Add to this list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clicking on this link in the RPC settings page of the extension takes you to this outdated link: https://github.com/penumbra-zone/web/blob/main/packages/constants/src/grpc-endpoints.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TalDerei that's actually the new link!
This PR takes the UI from #868 and uses it in the RPC settings page of the extension. It also does a bit of refactoring to better share the functionality between the RPC settings page and the RPC onboarding page. And lastly, it shows the selected chain ID (or error message) at the bottom of the form.
Screen.Recording.2024-04-03.at.5.41.13.PM.mov
Screen.Recording.2024-04-03.at.5.45.16.PM.mov
In this PR
<GrpcEndpointForm />
component that's shared between the onboarding screen and the settings screen of the extension.<PaddingWrapper />
component to ensure consistent padding in the various component popup screens.Closes #605