aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-28 06:36:59 +0800
committerGitHub <noreply@github.com>2018-02-28 06:36:59 +0800
commitc2ec2291e8243266f52a3b89f38ba67ce1215c22 (patch)
treee16815b2d4dc3ee5a7dcd29aa44825e492a9b088
parent2da7f82171be76b36bac0500fb6dd78ba1669603 (diff)
parentce677fd55a964101e9c9641cc34841ada5ceecbd (diff)
downloaddexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.tar
dexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.tar.gz
dexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.tar.bz2
dexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.tar.lz
dexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.tar.xz
dexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.tar.zst
dexon-sol-tools-c2ec2291e8243266f52a3b89f38ba67ce1215c22.zip
Merge pull request #420 from 0xProject/fix/multiple-return-docs
Fix a bug with displaying solidity functions returning multiple retur…
-rw-r--r--packages/website/ts/utils/doxity_utils.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/website/ts/utils/doxity_utils.ts b/packages/website/ts/utils/doxity_utils.ts
index 5f1d02132..35ce05672 100644
--- a/packages/website/ts/utils/doxity_utils.ts
+++ b/packages/website/ts/utils/doxity_utils.ts
@@ -45,11 +45,17 @@ export const doxityUtils = {
const methods: SolidityMethod[] = _.map<DoxityAbiDoc, SolidityMethod>(
doxityMethods,
(doxityMethod: DoxityAbiDoc) => {
- // We assume that none of our functions returns more then a single value
- const outputIfExists = !_.isUndefined(doxityMethod.outputs) ? doxityMethod.outputs[0] : undefined;
- const returnTypeIfExists = !_.isUndefined(outputIfExists)
- ? this._convertType(outputIfExists.type)
- : undefined;
+ const outputs = !_.isUndefined(doxityMethod.outputs) ? doxityMethod.outputs : [];
+ let returnTypeIfExists: Type;
+ if (outputs.length === 0) {
+ // no-op. It's already undefined
+ } else if (outputs.length === 1) {
+ const outputsType = outputs[0].type;
+ returnTypeIfExists = this._convertType(outputsType);
+ } else {
+ const outputsType = `[${_.map(outputs, output => output.type).join(', ')}]`;
+ returnTypeIfExists = this._convertType(outputsType);
+ }
// For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken
const callPath =
contractName !== 'ZRXToken'