From fc0e7b1132f8956c470a49b0e964d9ca1812e591 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 7 Nov 2018 10:20:19 -0800 Subject: cleaner bind --- packages/order-utils/test/abi_encoder_test.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/order-utils/test/abi_encoder_test.ts b/packages/order-utils/test/abi_encoder_test.ts index 1a33e4f78..292e615f3 100644 --- a/packages/order-utils/test/abi_encoder_test.ts +++ b/packages/order-utils/test/abi_encoder_test.ts @@ -216,7 +216,7 @@ namespace AbiEncoder { this.bindList = {}; } - public bind(dataType: DataType, section: CalldataSection = CalldataSection.DATA) { + public bind(dataType: DataType, section: CalldataSection) { if (dataType.getId() in this.bindList) { throw `Rebind on ${dataType.getId()}`; } @@ -284,12 +284,12 @@ namespace AbiEncoder { this.memblock = memblock; } - public bind(calldata: Calldata) { + public bind(calldata: Calldata, section: CalldataSection) { if (this.memblock === undefined) { - calldata.bind(this); + calldata.bind(this, section); } _.each(this.children, (child: DataType) => { - child.bind(calldata); + child.bind(calldata, CalldataSection.DATA); }); } @@ -729,17 +729,10 @@ namespace AbiEncoder { encode(args: any[]): string { const calldata = new Calldata(this.selector, this.params.length); - - // Write params section const params = this.params; _.each(params, (param: DataType, i: number) => { - // Assign value to param param.assignValue(args[i]); - // Binds top-level parameter to the params section of calldata - calldata.bind(param, CalldataSection.PARAMS); - // Binds parameter's children to the data section of calldata, - // while retaining internal pointers - param.bind(calldata); + param.bind(calldata, CalldataSection.PARAMS); }); console.log(calldata); -- cgit