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

Add encoder/decoder with simple string based definition #8

Merged
merged 2 commits into from
Apr 25, 2016

Conversation

axic
Copy link
Member

@axic axic commented Mar 26, 2016

I like it (as described in #2), but not sure it should be included.

Sample code:

var tmp

tmp = abi.simpleEncode('someMethod(bytes,uint):(bool)', '12341234234', 1234)
console.log('encoded method', tmp.toString('hex'))

tmp = abi.simpleDecode('someMethod(bytes,uint):(bool)', tmp)
console.log('decoded method', tmp)

Output:

encoded method 2e1b8e21000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004d2000000000000000000000000000000000000000000000000000000000000000b3132333431323334323334000000000000000000000000000000000000000000
decoded method [ false ]

Works with arrays too someMethod(bytes,uint[]):(bool):

encoded method d75ceaf400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b3132333431323334323334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004d20000000000000000000000000000000000000000000000000000000000000001

@axic axic force-pushed the feature/simple-encoder branch 2 times, most recently from e86b84f to 9c91705 Compare March 26, 2016 00:27
@axic axic force-pushed the feature/simple-encoder branch 3 times, most recently from 9107053 to 6c80b49 Compare April 25, 2016 01:21
@coveralls
Copy link

Coverage Status

Coverage decreased (-4.2%) to 78.808% when pulling 6c80b49 on feature/simple-encoder into 79aaec5 on master.

@axic axic merged commit c788b96 into master Apr 25, 2016
@axic axic deleted the feature/simple-encoder branch April 25, 2016 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants