aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen-templates
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-23 09:23:02 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-15 02:49:44 +0800
commitb06f8239e1fe75703f88d34c0d225701406e28c2 (patch)
tree9beb83b64b37fb6ad67d066f089b868a8ad25fcb /packages/abi-gen-templates
parent7991de9ed0b5f1e8a38097d902eae09cc6b5cf11 (diff)
downloaddexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.gz
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.bz2
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.lz
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.xz
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.zst
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.zip
Finished porting new abi encoder to contracts
Diffstat (limited to 'packages/abi-gen-templates')
-rw-r--r--packages/abi-gen-templates/partials/callAsync.handlebars5
-rw-r--r--packages/abi-gen-templates/partials/tx.handlebars9
2 files changed, 5 insertions, 9 deletions
diff --git a/packages/abi-gen-templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars
index d4fb772c7..e978f577d 100644
--- a/packages/abi-gen-templates/partials/callAsync.handlebars
+++ b/packages/abi-gen-templates/partials/callAsync.handlebars
@@ -4,9 +4,7 @@ async callAsync(
defaultBlock?: BlockParam,
): Promise<{{> return_type outputs=outputs}}> {
const self = this as any as {{contractName}}Contract;
- const functionSignature = '{{this.functionSignature}}';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([{{> params inputs=inputs}}]);
+ const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -17,6 +15,7 @@ async callAsync(
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}};
},
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<string> {
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<TxData> = {},
): Promise<number> {
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}}