DePayFi / web3-mock

🤡 JavaScript library to mock web3 responses either by emulating web3 wallets or web3 RPC requests.
https://depay.com
MIT License
84 stars 20 forks source link

Mock contract transactions with single parameter will not accept an object for the params entry #12

Closed megamattron closed 2 years ago

megamattron commented 2 years ago

When mocking a transaction for a contract interaction, if the transaction has a single parameter then for some reason you can no longer specify the params entry as an object. You can see this in effect here (this test passes): https://github.com/larvalabs/cryptopunksmarket/blob/cypresstests/cypress/integration/owner-actions.spec.js#L122 Whereas multiple params can be specified as an object as you would expect: https://github.com/larvalabs/cryptopunksmarket/blob/cypresstests/cypress/integration/owner-actions.spec.js#L100

Any idea why this might be the case? I was expecting to be able to specify single params as usual, for example:

params: {
    punkIndex: 0
}
10xSebastian commented 2 years ago

Was a bug.

Just fixed in v11.2.1

New test case: https://github.com/DePayFi/web3-mock/commit/879127623e0c1a849fc132568bbdf81ce754dcb7#diff-fe6fe320fa60ac9c617d97b7b8057683af963e998a16d2ab5b894dac9619207eR85-R87

megamattron commented 2 years ago

Confirmed fixed in 11.2.1 - thanks!