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

[typescript] Account interface does not seems to be right #2374

Closed
oktapodia opened this issue Feb 12, 2019 · 3 comments
Closed

[typescript] Account interface does not seems to be right #2374

oktapodia opened this issue Feb 12, 2019 · 3 comments
Labels
Types Incorrect or missing types

Comments

@oktapodia
Copy link

All issues which aren't created with this template will get immediately closed.
Hello,

I'm not sure the typing Account.signTransaction interface is correct here, should be that isn't it?

Expected behavior

    signTransaction(tx: Transaction, privateKey: string, callback?: () => void): Promise<SignedTransaction>;

source

or similar

Actual behavior

    signTransaction?: (tx: Transaction) => {};

source

Steps to reproduce the behavior

  1. Use typescript
  2. Install the version >1.0.0-beta.36
  3. Use the Account typing definition

Error Logs

Expected 1 arguments, but got 2.ts(2554)

Versions

Typescript latest
npm latest

@joshstevens19 joshstevens19 added the Types Incorrect or missing types label Feb 12, 2019
@joshstevens19
Copy link
Contributor

Hey @oktapodia Thanks for raising this looking at it you are correct. In actual fact the documents are incorrect as well https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#signtransaction

I think it needs to be

signTransaction(tx: Transaction, callback?: (signTransaction: SignedTransaction) => void): Promise<SignedTransaction>;

as it gets your private key from your account so the typing's should be above.

https://github.com/ethereum/web3.js/blob/v1.0.0-beta.46/packages/web3-eth-accounts/src/Accounts.js#L92

I will do a PR later on and update the docs to be inline with the code. good spot!

@oktapodia
Copy link
Author

Awesome! Let me know if you need any help on that

@joshstevens19
Copy link
Contributor

Hey sorry about the delay i have been away from my computer.

#2417

It is fixed in this PR and will be released within the next release - thanks again for the issue raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Types Incorrect or missing types
Projects
None yet
Development

No branches or pull requests

2 participants