|
|
@ -54,14 +54,14 @@ export const template = ( |
|
|
|
<div id="ethdoc-viewer"> |
|
|
|
<div id="ethdoc-viewer"> |
|
|
|
|
|
|
|
|
|
|
|
${ |
|
|
|
${ |
|
|
|
functions.length === 0 |
|
|
|
functions.length === 0 |
|
|
|
? "No contract to display" |
|
|
|
? "No contract to display" |
|
|
|
: renderHeader(name, contractDoc) |
|
|
|
: renderHeader(name, contractDoc) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
${functions |
|
|
|
${functions |
|
|
|
.map( |
|
|
|
.map( |
|
|
|
(item) => ` |
|
|
|
(item) => ` |
|
|
|
<hr> |
|
|
|
<hr> |
|
|
|
<h6>${item.name} - ${item.type} </h6> |
|
|
|
<h6>${item.name} - ${item.type} </h6> |
|
|
|
|
|
|
|
|
|
|
@ -73,8 +73,8 @@ export const template = ( |
|
|
|
|
|
|
|
|
|
|
|
${renderParameterDocumentation(item.outputs)} |
|
|
|
${renderParameterDocumentation(item.outputs)} |
|
|
|
` |
|
|
|
` |
|
|
|
) |
|
|
|
) |
|
|
|
.join("\n")} |
|
|
|
.join("\n")} |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
`;
|
|
|
|
`;
|
|
|
@ -94,7 +94,7 @@ export const renderHeader = ( |
|
|
|
) => ` |
|
|
|
) => ` |
|
|
|
<h3>${name} ${ |
|
|
|
<h3>${name} ${ |
|
|
|
contractDoc.title ? `<small>: ${contractDoc.title}</small>` : "" |
|
|
|
contractDoc.title ? `<small>: ${contractDoc.title}</small>` : "" |
|
|
|
}</h3> |
|
|
|
}</h3> |
|
|
|
|
|
|
|
|
|
|
|
${contractDoc.notice ? `<p class="lead">${contractDoc.notice}</p>` : ""} |
|
|
|
${contractDoc.notice ? `<p class="lead">${contractDoc.notice}</p>` : ""} |
|
|
|
|
|
|
|
|
|
|
@ -107,8 +107,8 @@ export const renderParameterDocumentation = ( |
|
|
|
parameters: ParameterDocumentation[] |
|
|
|
parameters: ParameterDocumentation[] |
|
|
|
) => |
|
|
|
) => |
|
|
|
`${ |
|
|
|
`${ |
|
|
|
parameters.length > 0 |
|
|
|
parameters.length > 0 |
|
|
|
? `<table class="table table-sm table-bordered table-striped">
|
|
|
|
? `<table class="table table-sm table-bordered table-striped">
|
|
|
|
<thead> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<tr> |
|
|
|
<th>Name</th> |
|
|
|
<th>Name</th> |
|
|
@ -128,26 +128,26 @@ export const renderParameterDocumentation = ( |
|
|
|
.join("")} |
|
|
|
.join("")} |
|
|
|
</tbody> |
|
|
|
</tbody> |
|
|
|
</table>` |
|
|
|
</table>` |
|
|
|
: "<p>No parameters</p>" |
|
|
|
: "<p>No parameters</p>" |
|
|
|
}`;
|
|
|
|
}`;
|
|
|
|
|
|
|
|
|
|
|
|
export const getMethodDetails = (devMethod?: Partial<MethodDoc>) => { |
|
|
|
export const getMethodDetails = (devMethod?: Partial<MethodDoc>) => { |
|
|
|
const finalResult = !devMethod |
|
|
|
const finalResult = !devMethod |
|
|
|
? "<p><strong>**Add Documentation for the method here**</strong></p>" |
|
|
|
? "<p><strong>**Add Documentation for the method here**</strong></p>" |
|
|
|
: Object.keys(devMethod) |
|
|
|
: Object.keys(devMethod) |
|
|
|
.filter((key) => key !== "params") |
|
|
|
.filter((key) => key !== "params") |
|
|
|
.map((key) => { |
|
|
|
.map((key) => { |
|
|
|
const funcToGetTemplate = (devMethodDocTemplate as any)[key]; |
|
|
|
const funcToGetTemplate = (devMethodDocTemplate as any)[key]; |
|
|
|
|
|
|
|
|
|
|
|
if (!funcToGetTemplate) { |
|
|
|
if (!funcToGetTemplate) { |
|
|
|
return '' |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
const funcParameter = (devMethod as any)[key] |
|
|
|
const funcParameter = (devMethod as any)[key]; |
|
|
|
const result = funcToGetTemplate(funcParameter) |
|
|
|
const result = funcToGetTemplate(funcParameter); |
|
|
|
return result |
|
|
|
return result; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.join("\n"); |
|
|
|
.join("\n"); |
|
|
|
|
|
|
|
|
|
|
|
console.log('finalResult', finalResult) |
|
|
|
console.log("finalResult", finalResult); |
|
|
|
return finalResult |
|
|
|
return finalResult; |
|
|
|
}; |
|
|
|
}; |
|
|
|