Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Migrate encodeCall.ts to web3 per comment #1166

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

CallMeGwei
Copy link
Member

There was a comment at the top of helper encodeCall.ts about migrating to web3. I went ahead and migrated it for my own project. Thought I would submit it here as well.

Web3 handles encoding parameters just a little differently than what was being used before. Web3 wraps around if given a negative for type uint rather than throwing. It also appears to convert empty buffers to nulls rather than keeping them as empty buffers. I had to tweak the test file accordingly.

I also added a helper function in the test to convert from the web3 return value (which is an object) to what was expected in the asserts (which was an array).

required removal of tests where
unsigned ints were expected to fail
if given negative numbers, because web3
wraps such numbers around.
@spalladino
Copy link
Contributor

Thanks for the contribution, @CallMeGwei! We'll review this in a few days :-)

@spalladino spalladino added the status:to-review Awaiting review label Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:to-review Awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants