-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Conversation
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.
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.
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. |
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.
We could create a type for this representing the minimum set of fields required
I'm ambivalent on whether we do this here or in a future change.
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.
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!
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.
The
signTransaction
method of the KeyringController had specified the wrong type for thetransaction
parameter. It mistakenly declared it as being of typeTransaction
, 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 tounknown
, and updated the JSDoc comment to explain what it should be.