|
|
@ -1,4 +1,4 @@ |
|
|
|
import React, {useState, useEffect} from 'react' |
|
|
|
import React, {useState, useEffect, useRef} from 'react' |
|
|
|
|
|
|
|
|
|
|
|
import {remixClient} from './utils' |
|
|
|
import {remixClient} from './utils' |
|
|
|
import {CompilationResult} from '@remixproject/plugin-api' |
|
|
|
import {CompilationResult} from '@remixproject/plugin-api' |
|
|
@ -40,6 +40,8 @@ const App = () => { |
|
|
|
localUrl: 'http://localhost:8000/', |
|
|
|
localUrl: 'http://localhost:8000/', |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const spinnerIcon = useRef(null) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
async function start() { |
|
|
|
async function start() { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -101,8 +103,14 @@ const App = () => { |
|
|
|
setOutput(remixClient.compilerOutput) |
|
|
|
setOutput(remixClient.compilerOutput) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const [toggleAccordion, setToggleAccordion] = useState(false) |
|
|
|
const startingCompilation = () => { |
|
|
|
|
|
|
|
if (!spinnerIcon.current) return |
|
|
|
|
|
|
|
spinnerIcon.current.setAttribute('title', 'compiling...') |
|
|
|
|
|
|
|
spinnerIcon.current.classList.remove('remixui_bouncingIcon') |
|
|
|
|
|
|
|
spinnerIcon.current.classList.add('remixui_spinningIcon') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [toggleAccordion, setToggleAccordion] = useState(false) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<main id="vyper-plugin"> |
|
|
|
<main id="vyper-plugin"> |
|
|
@ -117,39 +125,46 @@ const App = () => { |
|
|
|
|
|
|
|
|
|
|
|
<Accordion className="border-0 w-100 mb-3 accordion-background"> |
|
|
|
<Accordion className="border-0 w-100 mb-3 accordion-background"> |
|
|
|
<div className="border-0"> |
|
|
|
<div className="border-0"> |
|
|
|
<div className="pl-3 d-flex flex-row justify-content-between"> |
|
|
|
<div className=""> |
|
|
|
<CustomAccordionToggle eventKey="0"> |
|
|
|
<CustomAccordionToggle eventKey="0"> |
|
|
|
<span className="">Advanced Compiler Settings</span> |
|
|
|
<span className="">Advanced Compiler Settings</span> |
|
|
|
</CustomAccordionToggle> |
|
|
|
</CustomAccordionToggle> |
|
|
|
{/* <i className={toggleAccordion ? 'far fa-angle-right' : 'far fa-angle-down'}></i> */} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Accordion.Collapse eventKey="0"> |
|
|
|
<Accordion.Collapse eventKey="0"> |
|
|
|
<div className="pl-3 pt-3 border-top-0"> |
|
|
|
<div className="pl-3 pt-3 border-top-0"> |
|
|
|
<Form> |
|
|
|
<Form> |
|
|
|
<div className="d-flex flex-row gap-5 mb-3 mt-2"> |
|
|
|
<div className="d-flex flex-row gap-5 mb-3 mt-2"> |
|
|
|
<Form.Check inline id="remote-compiler" data-id="remote-compiler" type="radio" name="remote" value={state.environment} checked={state.environment === 'remote'} onChange={() => setEnvironment('remote')} label="Remote Compiler" className={`${state.environment === 'remote' ? 'd-flex mr-4' : 'd-flex mr-4 cursor-status'}`} |
|
|
|
<Form.Check inline id="remote-compiler" data-id="remote-compiler" type="radio" name="remote" value={state.environment} checked={state.environment === 'remote'} onChange={() => setEnvironment('remote')} label="Remote Compiler" className={`${state.environment === 'remote' ? 'd-flex mr-4' : 'd-flex mr-4 cursor-status'}`} /> |
|
|
|
/> |
|
|
|
<Form.Check inline id="local-compiler" data-id="local-compiler" checked={state.environment === 'local'} type="radio" name="local" value={state.environment} onChange={() => setEnvironment('local')} label="Local Compiler" className={`${state.environment === 'local' ? '' : `cursor-status`}`} /> |
|
|
|
<Form.Check inline id="local-compiler" data-id="local-compiler" checked={state.environment === 'local'} type="radio" name="local" value={state.environment} onChange={() => setEnvironment('local')} label="Local Compiler" |
|
|
|
|
|
|
|
className={`${state.environment === 'local' ? '' : `cursor-status`}`}/> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Form> |
|
|
|
</Form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Accordion.Collapse> |
|
|
|
</Accordion.Collapse> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Accordion> |
|
|
|
</Accordion> |
|
|
|
<span className="px-3 mt-1 mb-1 small text-warning">Specify the <a className="text-warning" target="_blank" href="https://">compiler version</a> & <a className="text-warning" href="http://docs.vyperlang.org/en/stable/compiling-a-contract.html#setting-the-target-evm-version" target="_blank" rel="noopener noreferrer">EVM version</a> in the .vy file.</span> |
|
|
|
<span className="px-3 mt-1 mb-1 small text-warning"> |
|
|
|
|
|
|
|
Specify the{' '} |
|
|
|
|
|
|
|
<a className="text-warning" target="_blank" href="https://"> |
|
|
|
|
|
|
|
compiler version |
|
|
|
|
|
|
|
</a>{' '} |
|
|
|
|
|
|
|
&{' '} |
|
|
|
|
|
|
|
<a className="text-warning" href="http://docs.vyperlang.org/en/stable/compiling-a-contract.html#setting-the-target-evm-version" target="_blank" rel="noopener noreferrer"> |
|
|
|
|
|
|
|
EVM version |
|
|
|
|
|
|
|
</a>{' '} |
|
|
|
|
|
|
|
in the .vy file. |
|
|
|
|
|
|
|
</span> |
|
|
|
<LocalUrlInput url={state.localUrl} setUrl={setLocalUrl} environment={state.environment} /> |
|
|
|
<LocalUrlInput url={state.localUrl} setUrl={setLocalUrl} environment={state.environment} /> |
|
|
|
<div className="px-3 w-100 mb-3 mt-1" id="compile-btn"> |
|
|
|
<div className="px-3 w-100 mb-3 mt-1" id="compile-btn"> |
|
|
|
<CompilerButton compilerUrl={compilerUrl()} contract={contract} setOutput={(name, update) => setOutput({...output, [name]: update})} resetCompilerState={resetCompilerResultState} /> |
|
|
|
<CompilerButton compilerUrl={compilerUrl()} contract={contract} setOutput={(name, update) => setOutput({...output, [name]: update})} resetCompilerState={resetCompilerResultState} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<article id="result" className="px-2 mx-2 border-top mt-3"> |
|
|
|
<article id="result" className="p-4 mx-3 border-top mt-2"> |
|
|
|
{output && Object.keys(output).length > 0 && output.status !== 'failed' ? ( |
|
|
|
{output && Object.keys(output).length > 0 && output.status !== 'failed' ? ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<VyperResult output={output} plugin={remixClient} /> |
|
|
|
<VyperResult output={output} plugin={remixClient} /> |
|
|
|
</> |
|
|
|
</> |
|
|
|
) : output.status === 'failed' ? ( |
|
|
|
) : output.status === 'failed' ? ( |
|
|
|
<CompileErrorCard output={output} /> |
|
|
|
<CompileErrorCard output={output} askGpt={remixClient.askGpt} /> |
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
</article> |
|
|
|
</article> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|