@0x/contracts-test-utils: Add hexConcat() in hex_utils.ts.

This commit is contained in:
Lawrence Forman 2019-06-26 15:46:39 -04:00 committed by Amir Bandeali
parent 527256b416
commit 4734acbe61
3 changed files with 13 additions and 0 deletions

View File

@ -29,6 +29,10 @@
{ {
"note": "Remove formatters", "note": "Remove formatters",
"pr": 1834 "pr": 1834
},
{
"note": "Add `hexConcat()` in `hex_utils.ts`",
"pr": 1885
} }
] ]
}, },

View File

@ -0,0 +1,8 @@
import * as ethUtil from 'ethereumjs-util';
/**
* Concatenate all arguments as a hex string.
*/
export function hexConcat(...args: Array<string | number | Buffer>): string {
return ethUtil.bufferToHex(Buffer.concat(args.map(h => ethUtil.toBuffer(h))));
}

View File

@ -27,6 +27,7 @@ export { OrderFactory } from './order_factory';
export { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from './combinatorial_utils'; export { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from './combinatorial_utils';
export { TransactionFactory } from './transaction_factory'; export { TransactionFactory } from './transaction_factory';
export { testWithReferenceFuncAsync } from './test_with_reference'; export { testWithReferenceFuncAsync } from './test_with_reference';
export { hexConcat } from './hex_utils';
export { export {
ContractName, ContractName,
ERC20BalancesByOwner, ERC20BalancesByOwner,