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

Separate Transaction and TransactionConfig in typings #2479

Merged
merged 3 commits into from
Mar 18, 2019
Merged

Separate Transaction and TransactionConfig in typings #2479

merged 3 commits into from
Mar 18, 2019

Conversation

vshab
Copy link

@vshab vshab commented Mar 8, 2019

Description

Currently Transaction has all field optional what is incorrect. This causes senseless checks when using transaction:

eth.getTransaction(transactionHash).then((transaction: Transaction) => {
  if (transaction.hash) {
    transaction.hash //...
  }

  if (transaction.nonce) {
    transaction.nonce //...
  }
});

I think the Transaction and TransactionConfig should be different types, as it has been done before: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web3/eth/index.d.ts (See Transaction and Tx) I change names though and corrected types a bit. This also should fix #2474

I also updated RLPEncodedTransaction type with respect to https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html#signtransaction but I'm not 100% sure about this. @nivida could you take a closer look please?

Type of change

  • Bug fix
  • Breaking change
  • Enhancement

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no warnings.
  • I have updated or added types for all modules I've changed
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run test in the root folder with success and extended the tests if necessary.
  • I ran npm run build in the root folder and tested it in the browser and with node.
  • I ran npm run dtslint in the root folder and tested that all my types are correct
  • I have tested my code on an ethereum test network.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.529% when pulling 7e7fa42 on vshab:feature/fix-transation-typings into 970d837 on ethereum:1.0.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.529% when pulling 7e7fa42 on vshab:feature/fix-transation-typings into 970d837 on ethereum:1.0.

@coveralls
Copy link

coveralls commented Mar 8, 2019

Coverage Status

Coverage remained the same at 98.505% when pulling c7270e8 on vshab:feature/fix-transation-typings into 7739107 on ethereum:1.0.

@nivida nivida mentioned this pull request Mar 8, 2019
11 tasks
@nivida
Copy link
Contributor

nivida commented Mar 8, 2019

Great idea! I'll check it if we probably forgot something somewhere and will merge it later.

@joshstevens19
Copy link
Contributor

joshstevens19 commented Mar 8, 2019

@vshab awesome idea! types look spot on to me. Thanks for the PR! great work.

@joshstevens19 joshstevens19 added the Types Incorrect or missing types label Mar 8, 2019
@nivida nivida merged commit 441135e into web3:1.0 Mar 18, 2019
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

Successfully merging this pull request may close these issues.

4 participants