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

setConfig doesnt working as expected #6557

Closed
Zahar44 opened this issue Nov 1, 2023 · 3 comments
Closed

setConfig doesnt working as expected #6557

Zahar44 opened this issue Nov 1, 2023 · 3 comments
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@Zahar44
Copy link

Zahar44 commented Nov 1, 2023

I checked code of web3-eth-contract/lib/commonjs/contract.js and from what I see it looks like this.config.contractDataInputFill used only to set it to this._dataInputFill and when called setConfig with contractDataInputFill it doesnt override this._dataInputFill.

Expected behavior

this code should override transaction input/data behavior

const token = new this.web3.eth.Contract(ERC20Abi);
token.setConfig({ contractDataInputFill: 'both' });

Actual behavior

Transaction sent with behavior of initial contractDataInputFill value

Steps to reproduce the behavior

this should throw exception if used in local hardhat node

const token = new this.web3.eth.Contract(ERC20Abi);
token.setConfig({ contractDataInputFill: 'both' });
token.methods.decimals().call();

Logs

this will log 'input'

const token = new this.web3.eth.Contract(ERC20Abi);
token.setConfig({ contractDataInputFill: 'both' });
console.log(token['_dataInputFill']);

Environment

"web3": "^4.2.1"

@Zahar44
Copy link
Author

Zahar44 commented Nov 1, 2023

For now I'm using this workaround and it works

(token as any)['_dataInputFill'] = 'both';

@luu-alex
Copy link
Contributor

luu-alex commented Nov 1, 2023

thanks for submitting this issue, theres a fix to removing _dataInputFill all together and just use config
#6555
this should be merged in soon

@luu-alex luu-alex added Bug Addressing a bug 4.x 4.0 related labels Nov 1, 2023
@Muhammad-Altabba
Copy link
Contributor

Muhammad-Altabba commented Nov 2, 2023

Many thanks @Zahar44 for opening the issue and suggesting a workaround. This is helpful till the issue is fixed at #6555.
However, I am closing this issue in favor of keeping the discussion on #6555.

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

No branches or pull requests

3 participants