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

Accounts.getGasPrice() invocation error in Accounts.signTransaction() #2578

Closed
mmshihov opened this issue Mar 26, 2019 · 3 comments
Closed
Labels
Bug Addressing a bug

Comments

@mmshihov
Copy link

Description

I've got the error when I specify gasPrice:0 in raw tx object to be signed by web3.eth.accounts.signTransaction(). Example code snippet:

let tx = {
    ... 
    gasPrice: 0, // it is OK in JP Quorum blockchain
    ...
}

let signedTx = await web3.eth.accounts.signTransaction(tx, privateKey);

Expected behavior

Signed tx object insignedTx variable.

Actual behavior

TypeError: this.getGasPrice is not a function at Proxy._callee

Also it may be worthwhile to change the condition for checking the tx.gasPrice:

        // web3.js/packages/web3-eth-accounts/src/Accounts.js:128
        if (!tx.gasPrice) {
            tx.gasPrice = await this.getGasPrice();
        }

The condition is true if ts.gasPrice directly specified by user as 0. May be somthing like:

        if ((typeof tx.gasPrice == "undefined") || (tx.gasPrice < 0)) {
            tx.gasPrice = await this.getGasPrice();
        }

Versions

  • web3.js: 1.0.0-beta.50
  • nodejs: v8.11.3
  • ethereum node: JP Quorum
@nivida
Copy link
Contributor

nivida commented Mar 26, 2019

This got already fixed and will be released this week. PR: #2566

@nivida nivida closed this as completed Mar 26, 2019
@nivida
Copy link
Contributor

nivida commented Mar 26, 2019

Sorry, didn't saw the last example. Will fix it asap.

@nivida nivida reopened this Mar 26, 2019
@nivida nivida added the Bug Addressing a bug label Mar 26, 2019
@mmshihov
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

2 participants