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

Set gRPC endpoint during onboarding, part 2 #877

Merged
merged 9 commits into from
Apr 5, 2024

Conversation

jessepinho
Copy link
Contributor

@jessepinho jessepinho commented Apr 3, 2024

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

  • Extract a <GrpcEndpointForm /> component that's shared between the onboarding screen and the settings screen of the extension.
  • Create a <PaddingWrapper /> component to ensure consistent padding in the various component popup screens.

Closes #605

@jessepinho jessepinho force-pushed the jessepinho/rpc-endpoint-part-2-web-605 branch from cd7806e to 9057be9 Compare April 4, 2024 00:36
@@ -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';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consolidating the naming

Copy link
Contributor

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

Copy link
Contributor Author

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 = () => {
Copy link
Contributor Author

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 = () => {
Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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

@jessepinho jessepinho changed the title WIP: Set gRPC endpoint during onboarding, part 2 Set gRPC endpoint during onboarding, part 2 Apr 4, 2024
@jessepinho jessepinho marked this pull request as ready for review April 4, 2024 01:01
) => {
setIsSubmitButtonEnabled(false);
await setGrpcEndpoint(grpcEndpointInput);
// If the chain id has changed, our cache is invalid
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On it

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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!

@jessepinho jessepinho merged commit a1e576d into main Apr 5, 2024
6 checks passed
@jessepinho jessepinho deleted the jessepinho/rpc-endpoint-part-2-web-605 branch April 5, 2024 17:47
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.

Add RPC selection to onboarding flow
3 participants