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

Fix signTransaction transaction parameter type #400

Merged
merged 2 commits into from
Mar 16, 2021

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Mar 16, 2021

The signTransaction method of the KeyringController had specified the wrong type for the transaction parameter. It mistakenly declared it as being of type Transaction, the same type we use in our Transaction controller.

Instead the type it expects is an instance of ethereumjs-tx. This package doesn't have type definitions though, so for now I've changed it to unknown, and updated the JSDoc comment to explain what it should be.

The `signTransaction` method of the KeyringController had specified the
wrong type for the `transaction` parameter. It mistakenly declared it
as being of type `Transaction`, the same type we use in our Transaction
controller.

Instead the type it expects is an instance of `ethereumjs-tx`. This
package doesn't have type definitions though, so for now I've changed
it to `unknown`, and updated the JSDoc comment to explain what it
should be.
@Gudahtt Gudahtt requested a review from a team as a code owner March 16, 2021 15:06
Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -369,11 +368,11 @@ export class KeyringController extends BaseController<KeyringConfig, KeyringStat
/**
* Signs a transaction by calling down into a specific keyring
*
* @param transaction - Transaction object to sign
* @param transaction - Transaction object to sign. Must be a `ethereumjs-tx` transaction instance.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I'm somewhat inclined to leave it for now though, as fixing up the keyring controller is on the path to snaps anyway. I'm anticipating that we'll be changing this method signature to be more type-friendly in the near future, and removing the dependence upon ethereumjs-tx. At least I want to, now that I've discovered this!

@Gudahtt Gudahtt merged commit e4f618a into develop Mar 16, 2021
@Gudahtt Gudahtt deleted the fix-sign-transaction-type branch March 16, 2021 17:02
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The `signTransaction` method of the KeyringController had specified the
wrong type for the `transaction` parameter. It mistakenly declared it
as being of type `Transaction`, the same type we use in our Transaction
controller.

Instead the type it expects is an instance of `ethereumjs-tx`. This
package doesn't have type definitions though, so for now I've changed
it to `unknown`, and updated the JSDoc comment to explain what it
should be.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The `signTransaction` method of the KeyringController had specified the
wrong type for the `transaction` parameter. It mistakenly declared it
as being of type `Transaction`, the same type we use in our Transaction
controller.

Instead the type it expects is an instance of `ethereumjs-tx`. This
package doesn't have type definitions though, so for now I've changed
it to `unknown`, and updated the JSDoc comment to explain what it
should be.
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.

3 participants