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

tidy up + make #register safer #385

Merged
merged 2 commits into from
Jun 24, 2024
Merged

tidy up + make #register safer #385

merged 2 commits into from
Jun 24, 2024

Conversation

mixmix
Copy link
Collaborator

@mixmix mixmix commented Jun 18, 2024

Reading the source I noticed that register was

  • messy
  • mutating a constant

This PR does a tiny tidy

const deviceKey = this.keyring.getLazyLoadAccountProxy(ChildKey.deviceKey)
deviceKey.used = true

const defaultProgram = xtend(DEVICE_KEY_PROXY_PROGRAM_INTERFACE, {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

xtend is a pure function - does not mutate DEVICE_KEY_PROXY_PROGRAM_INTERFACE

@@ -158,7 +162,7 @@ export default class Entropy {
*/

async signWithAdaptersInOrder (params: SigWithAdapptersOps): Promise<unknown> {
(await this.ready) && this.substrate.isReady
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this.ready is sufficient - it contains this.substrate.isReadyOrError already

@mixmix
Copy link
Collaborator Author

mixmix commented Jun 19, 2024

can has review @rh0delta ?

@rh0delta rh0delta merged commit a89c439 into main Jun 24, 2024
1 check passed
@rh0delta rh0delta deleted the mixmix/refactor_register branch June 24, 2024 02:45
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.

2 participants