web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

the contract methods call function mutates its options argument

Open karmaniverous opened this issue 3 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

A simple options argument passed to the call function acquires new keys.

{ from: '0xD28D1f59...' }

becomes

{
  from: '0xd28d1f59...',
  data: '0x5e615a6b',
  gasPrice: undefined,
  gas: undefined,
  to: '0xb97da33a...'
}

after the call.

Expected Behavior

This function shouldn't mutate its configuration arguments. This cause problems when you want to reuse them elsewhere.

Steps to Reproduce

See my writeup at https://karmanivero.us/blog/unexpected-mutations/

Web3.js Version

1.7.4

Environment

  • Operating System: Windows
  • Browser: Chrome (but this is happening on the back end)
  • Node.js Version: 18.2.0
  • NPM Version: 8.9.0

Anything Else?

No response

karmaniverous avatar Aug 01 '22 13:08 karmaniverous

Thank you for reporting this issue to us, apologies it took so long - we've been working on the 4.x rewrite

spacesailor24 avatar Aug 30 '22 04:08 spacesailor24