aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-08 02:20:19 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:10 +0800
commitfc0e7b1132f8956c470a49b0e964d9ca1812e591 (patch)
tree5dc89bde626c7b4a41f32e062b5b084dd2ae20a8 /packages/order-utils/test
parentb99252baaedd9bc37ef4e53d02e4085bed7e5142 (diff)
downloaddexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.tar
dexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.tar.gz
dexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.tar.bz2
dexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.tar.lz
dexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.tar.xz
dexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.tar.zst
dexon-sol-tools-fc0e7b1132f8956c470a49b0e964d9ca1812e591.zip
cleaner bind
Diffstat (limited to 'packages/order-utils/test')
-rw-r--r--packages/order-utils/test/abi_encoder_test.ts17
1 files 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);