From 157b680ddd798a472746634b9318f56f37bbd6f7 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 23 Dec 2022 09:10:58 +0100 Subject: [PATCH] move --- .../src/lib/contract-selection.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx index a23efd7618..3501ac084b 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx @@ -4,6 +4,10 @@ import { ContractSelectionProps } from './types' import { PublishToStorage } from '@remix-ui/publish-to-storage' // eslint-disable-line import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-disable-line import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line +import { convertAST2UmlClasses } from 'sol2uml/lib/converterAST2Classes' +const parser = (window as any).SolidityParser +import { convertUmlClasses2Dot } from 'sol2uml/lib/converterClasses2Dot' +import vizRenderStringSync from '@aduh95/viz.js/sync' import './css/style.css' import { CustomTooltip } from '@remix-ui/helper' @@ -194,6 +198,17 @@ export const ContractSelection = (props: ContractSelectionProps) => { return copyContractProperty('bytecode') } + const generateUML = async () => { + try { + const currentFile = api.currentFile + const ast = parser.parse(api.getCompilationResult().source.sources[currentFile].content) + const svgResult = vizRenderStringSync(convertUmlClasses2Dot(convertAST2UmlClasses(ast, currentFile))) + console.log({ svgResult }) + } catch (error) { + console.log({ error }) + } + } + return ( // define swarm logo <> @@ -207,6 +222,8 @@ export const ContractSelection = (props: ContractSelectionProps) => {
+ +