aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils/doxity_utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website/ts/utils/doxity_utils.ts')
-rw-r--r--packages/website/ts/utils/doxity_utils.ts74
1 files changed, 40 insertions, 34 deletions
diff --git a/packages/website/ts/utils/doxity_utils.ts b/packages/website/ts/utils/doxity_utils.ts
index 26e555b16..5f1d02132 100644
--- a/packages/website/ts/utils/doxity_utils.ts
+++ b/packages/website/ts/utils/doxity_utils.ts
@@ -36,41 +36,46 @@ export const doxityUtils = {
constructors.push(constructor);
}
- const doxityMethods: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>
- (doxityContractObj.abiDocs, (abiDoc: DoxityAbiDoc) => {
- return this._isMethod(abiDoc);
- });
- const methods: SolidityMethod[] = _.map<DoxityAbiDoc, SolidityMethod>(doxityMethods,
+ const doxityMethods: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
+ doxityContractObj.abiDocs,
+ (abiDoc: DoxityAbiDoc) => {
+ return this._isMethod(abiDoc);
+ },
+ );
+ 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;
- // For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken
- const callPath = contractName !== 'ZRXToken' ?
- `${contractName[0].toLowerCase()}${contractName.slice(1)}.` :
- `${contractName.slice(0, 3).toLowerCase()}${contractName.slice(3)}.`;
- const method = {
- isConstructor: false,
- isConstant: doxityMethod.constant,
- isPayable: doxityMethod.payable,
- name: doxityMethod.name,
- comment: doxityMethod.details,
- returnComment: doxityMethod.return,
- callPath,
- parameters: this._convertParameters(doxityMethod.inputs),
- returnType: returnTypeIfExists,
- };
- return method;
- });
+ // 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;
+ // For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken
+ const callPath =
+ contractName !== 'ZRXToken'
+ ? `${contractName[0].toLowerCase()}${contractName.slice(1)}.`
+ : `${contractName.slice(0, 3).toLowerCase()}${contractName.slice(3)}.`;
+ const method = {
+ isConstructor: false,
+ isConstant: doxityMethod.constant,
+ isPayable: doxityMethod.payable,
+ name: doxityMethod.name,
+ comment: doxityMethod.details,
+ returnComment: doxityMethod.return,
+ callPath,
+ parameters: this._convertParameters(doxityMethod.inputs),
+ returnType: returnTypeIfExists,
+ };
+ return method;
+ },
+ );
- const doxityProperties: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>
- (doxityContractObj.abiDocs, (abiDoc: DoxityAbiDoc) => {
- return this._isProperty(abiDoc);
- });
+ const doxityProperties: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
+ doxityContractObj.abiDocs,
+ (abiDoc: DoxityAbiDoc) => {
+ return this._isProperty(abiDoc);
+ },
+ );
const properties = _.map<DoxityAbiDoc, Property>(doxityProperties, (doxityProperty: DoxityAbiDoc) => {
// We assume that none of our functions return more then a single return value
let typeName = doxityProperty.outputs[0].type;
@@ -87,7 +92,8 @@ export const doxityUtils = {
});
const doxityEvents = _.filter(
- doxityContractObj.abiDocs, (abiDoc: DoxityAbiDoc) => abiDoc.type === AbiTypes.Event,
+ doxityContractObj.abiDocs,
+ (abiDoc: DoxityAbiDoc) => abiDoc.type === AbiTypes.Event,
);
const events = _.map(doxityEvents, doxityEvent => {
const event = {