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

feat(wallet-ui): provision new wallet #6289

Merged
merged 9 commits into from
Sep 22, 2022
Merged

feat(wallet-ui): provision new wallet #6289

merged 9 commits into from
Sep 22, 2022

Conversation

samsiegart
Copy link
Contributor

fixes: #6211

@samsiegart samsiegart marked this pull request as ready for review September 21, 2022 06:31
@samsiegart samsiegart requested a review from turadg September 21, 2022 06:31
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Doesn't seem ready for merge. I left some comments. Also the git commits are noisy. Please clean those up for the changelog

return;
}

setError('');
Copy link
Member

Choose a reason for hiding this comment

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

why is this necessary? seems an odd place for it. do you want to reset the error when the user initiates a new action?

why use empty string instead of null or undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea we want to reset the error when the user initiates a new action.

I sometimes get in the habit of using empty string because certain input elements don't play well with null, but no reason otherwise. Typically I never set things to undefined explicitly but maybe that's okay as well.

Copy link
Member

Choose a reason for hiding this comment

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

Yea we want to reset the error when the user initiates a new action.

Then please put it where they initiate the action. Either at the top of this function or sooner.

certain input elements don't play well with null, but no reason otherwise

Please use null for "no error". Empty string could be an error that just doesn't have any description. If there are elements where this causes problems I'd like to fix them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to use null instead of empty string

I didn't want to have two setErrors in the case of the early return above. I just split this into another function to make it more readable if that's any better?

<b>Wallet Address:</b> {address}
</DialogContentText>
<DialogContentText sx={{ pt: 2 }}>
There is no smart wallet provisioned for this address yet. A fee
Copy link
Member

Choose a reason for hiding this comment

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

if we're not going to read it from params, at least make it a const. should have a comment indicating the tech debt and why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made a const and TODO

Comment on lines 62 to 71
const { href, smartConnectionMethod } = connectionConfig;
let publicAddress;
if (
smartConnectionMethod === SmartConnectionMethod.KEPLR &&
keplrConnection
) {
publicAddress = keplrConnection.address;
} else if (smartConnectionMethod === SmartConnectionMethod.READ_ONLY) {
publicAddress = connectionConfig.publicAddress;
}
Copy link
Member

Choose a reason for hiding this comment

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

consider a helper method so this is one line here assigning to a const

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

packages/wallet/ui/src/contexts/Provider.jsx Show resolved Hide resolved
packages/wallet/ui/src/tests/App.test.jsx Show resolved Hide resolved
value: {
address: b64address,
nickname: 'my wallet',
// XXX dry with PowerFlags const
Copy link
Member

Choose a reason for hiding this comment

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

how about now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One concern I have is when we import these packages just to use a const or type etc, we increase the bundle size by a lot. Maybe it's better to just leave it?

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't the bundler have tree shaking? If not please make a ticket to get that working and include it in the comment here as to why these aren't imported yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it does have tree shaking yes. Importing this only increased the bundle size by ~4kB. Still the bundle size is getting up there, so I created a separate issue for that #6291

@samsiegart
Copy link
Contributor Author

Also the git commits are noisy. Please clean those up for the changelog

You mean just squash? I'm not sure how else.

@samsiegart samsiegart requested a review from turadg September 21, 2022 15:23
@turadg
Copy link
Member

turadg commented Sep 21, 2022

You mean just squash?

I was thinking an interactive rebase with renaming. E.g. git rebase --interactive master or a GUI like Github Desktop. The latter lets you drag commits together to squash particular ones.

@samsiegart
Copy link
Contributor Author

I was thinking an interactive rebase with renaming. E.g. git rebase --interactive master or a GUI like Github Desktop. The latter lets you drag commits together to squash particular ones.

Ah okay, yea just tried to clean up the messages now

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Approved assuming the PR will be squashed with a feat title.

@samsiegart samsiegart changed the title Provision wallet UI feat(wallet-ui): provision new wallet Sep 21, 2022
@samsiegart samsiegart added automerge:squash Automatically squash merge bypass:integration Prevent integration tests from running on PR automerge:rebase Automatically rebase updates, then merge labels Sep 21, 2022
@mergify mergify bot merged commit f73c2a7 into master Sep 22, 2022
@mergify mergify bot deleted the provision-wallet-ui branch September 22, 2022 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge automerge:squash Automatically squash merge bypass:integration Prevent integration tests from running on PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI for getting a smart wallet
2 participants