@ -1,16 +1,21 @@
import React , { useState } from 'react'
import React , { useState } from 'react'
import { VyperCompilationOutput , isCompilationError } from '../utils'
import { isCompilationError } from '../utils'
import Tabs from 'react-bootstrap/Tabs'
import Tab from 'react-bootstrap/Tab'
import Button from 'react-bootstrap/Button'
import { CopyToClipboard } from '@remix-ui/clipboard'
import { CopyToClipboard } from '@remix-ui/clipboard'
import { VyperCompilationResult } from '../utils/types'
interface VyperResultProps {
interface VyperResultProps {
output? : any
output? : any
plugin? : any
plugin? : any
}
}
export type OutputType = {
contractName : string
abi : any
bytecode : any
runtimeBytecode : any
ir : string
methodIdentifiers : any
}
export type ExampleContract = {
export type ExampleContract = {
name : string
name : string
address : string
address : string
@ -24,7 +29,6 @@ type TabContentMembers = {
}
}
function VyperResult ( { output , plugin } : VyperResultProps ) {
function VyperResult ( { output , plugin } : VyperResultProps ) {
// const [active, setActive] = useState<keyof VyperCompilationResult>('abi')
if ( ! output )
if ( ! output )
return (
return (
@ -51,15 +55,34 @@ function VyperResult({ output, plugin }: VyperResultProps) {
< / div >
< / div >
)
)
}
}
return (
return (
< >
< >
< div className = "border border-top" > < / div >
< div className = "border border-top" > < / div >
< div className = "d-flex justify-content-center px-2 w-100" >
< div className = "d-flex justify-content-center px-2 w-100 flex-column " >
< button data - id = "compilation-details" className = "btn btn-secondary w-100" onClick = { async ( ) = > {
< button data - id = "compilation-details" className = "btn btn-secondary w-100" onClick = { async ( ) = > {
await plugin ? . call ( 'vyperCompilationDetails' , 'showDetails' , output )
await plugin ? . call ( 'vyperCompilationDetails' , 'showDetails' , output )
} } >
} } >
< span > Compilation Details < / span >
< span > Compilation Details < / span >
< / button >
< / button >
< div className = "mt-1" >
< div className = "input-group input-group mt-3 d-flex flex-row-reverse" >
< div className = "btn-group align-self-start" role = "group" aria - label = "Copy to Clipboard" >
< CopyToClipboard tip = { 'Copy ABI to clipboard' } getContent = { ( ) = > ( Object . values ( output ) [ 0 ] as OutputType ) . abi } direction = "bottom" icon = "far fa-copy" >
< button className = "btn remixui_copyButton" >
< i className = "remixui_copyIcon far fa-copy" aria - hidden = "true" > < / i >
< span > ABI < / span >
< / button >
< / CopyToClipboard >
< CopyToClipboard tip = { 'Copy Bytecode to clipboard' } getContent = { ( ) = > ( Object . values ( output ) [ 0 ] as OutputType ) . bytecode . object } direction = "bottom" icon = "far fa-copy" >
< button className = "btn remixui_copyButton" >
< i className = "remixui_copyIcon far fa-copy" aria - hidden = "true" > < / i >
< span > Bytecode < / span >
< / button >
< / CopyToClipboard >
< / div >
< / div >
< / div >
< / div >
< / div >
< / >
< / >
)
)