Files
web3.js/test/eth.abi.encodeParameter.js
Samuel Furter 0ef6ee8e99 ABI v2 added (#1820)
* wip adding new decoder

* improved web3.js readme

* reworked decodeParameters

* bumped ethers version

* fixed tests

* fixed decode Log tests

* fixed decoding tests

* fixed encoding tests

* removed old encoder/decoder

* fixed all tests

* updated ether-js

* struct encoding and decoding

* decoding index params separate

* improved log decoding for indexed paramaters

* removed lock files

* fixed tests

* fixed test

* add components to contract

* Added some struct tests

* Finished decodeParameters testing

* Finished encodeParameter and encodeParameters tests

* fixed ABICoder decodeParameters

* fixed ABICoder decodeParameters

* removed console.log

* removed out commented code

* console.log removed

* decodeParameter in ABICoder fixed

* codestyle improvement

* new version of ethersjs abiCoder implemented and tested

* testcases added for structs

* package-lock removed

* encodeParameters extended for simplified format

* codestyle improvement

* simplified types added to decodeParameters

* types mapping fixed

* Started with updating of the documentation for encoding and decoding of parameters

* new abi lib tested and documentation updated

* decodeParameter/s tested and documentation updated

* package-locks fixed

* web3-eth-abi package version fixed

* gitignore updated

* web3.js removed

* modified package.lock

* documentation updated
2018-08-07 14:52:04 +02:00

23 lines
931 B
JavaScript

var chai = require('chai');
var assert = chai.assert;
var Abi = require('../packages/web3-eth-abi');
var tests = [{
params: ['uint256', '2345675643'],
result: '0x000000000000000000000000000000000000000000000000000000008bd02b7b'
},{
params: ['bytes32', '0xdf3234'],
result: '0xdf32340000000000000000000000000000000000000000000000000000000000'
},{
params: ['bytes32[]', ['0xdf3234', '0xfdfd']],
result: '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002df32340000000000000000000000000000000000000000000000000000000000fdfd000000000000000000000000000000000000000000000000000000000000'
}];
describe('encodeParameter', function () {
tests.forEach(function (test) {
it('should convert correctly', function () {
assert.equal(Abi.encodeParameter.apply(Abi, test.params), test.result);
});
});
});