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