From 285fb3deadd0413bf993557575a3f96a840f0e10 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 17 Dec 2018 18:26:03 -0800 Subject: Progress --- packages/abi-gen-templates/partials/tx.handlebars | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'packages/abi-gen-templates/partials/tx.handlebars') diff --git a/packages/abi-gen-templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars index b39156583..102316b44 100644 --- a/packages/abi-gen-templates/partials/tx.handlebars +++ b/packages/abi-gen-templates/partials/tx.handlebars @@ -9,10 +9,8 @@ public {{this.tsName}} = { {{/this.payable}} ): Promise { const self = this as any as {{contractName}}Contract; - const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; - [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]); - const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); + const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); + const encodedData = abiEncoder.encode([{{> params inputs=inputs}}], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -33,9 +31,8 @@ public {{this.tsName}} = { txData: Partial = {}, ): Promise { const self = this as any as {{contractName}}Contract; - const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; - [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); + const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); + const encodedData = abiEncoder.encode([{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -51,9 +48,8 @@ public {{this.tsName}} = { {{> typed_params inputs=inputs}} ): string { const self = this as any as {{contractName}}Contract; - const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; - [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); + const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); + const abiEncodedTransactionData = abiEncoder.encode([{{> params inputs=inputs}}]); return abiEncodedTransactionData; }, {{> callAsync}} -- cgit v1.2.3 From b06f8239e1fe75703f88d34c0d225701406e28c2 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Sat, 22 Dec 2018 17:23:02 -0800 Subject: Finished porting new abi encoder to contracts --- packages/abi-gen-templates/partials/tx.handlebars | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'packages/abi-gen-templates/partials/tx.handlebars') diff --git a/packages/abi-gen-templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars index 102316b44..0f1027fae 100644 --- a/packages/abi-gen-templates/partials/tx.handlebars +++ b/packages/abi-gen-templates/partials/tx.handlebars @@ -9,8 +9,7 @@ public {{this.tsName}} = { {{/this.payable}} ): Promise { const self = this as any as {{contractName}}Contract; - const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); - const encodedData = abiEncoder.encode([{{> params inputs=inputs}}], {optimize: false}); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -31,8 +30,7 @@ public {{this.tsName}} = { txData: Partial = {}, ): Promise { const self = this as any as {{contractName}}Contract; - const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); - const encodedData = abiEncoder.encode([{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -48,8 +46,7 @@ public {{this.tsName}} = { {{> typed_params inputs=inputs}} ): string { const self = this as any as {{contractName}}Contract; - const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); - const abiEncodedTransactionData = abiEncoder.encode([{{> params inputs=inputs}}]); + const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); return abiEncodedTransactionData; }, {{> callAsync}} -- cgit v1.2.3