cleanup console logs

pull/5370/head
Joseph Izang 1 year ago
parent a4a40d0b65
commit c49c00f6ff
  1. 2
      apps/vyper/src/app/components/CompilerButton.tsx
  2. 14
      apps/vyper/src/app/utils/compiler.tsx

@ -36,9 +36,7 @@ function CompilerButton({contract, setOutput, compilerUrl, setCompilerResponse}:
}) })
let output let output
try { try {
console.log('calling comile endpoint now')
output = await compile(compilerUrl, _contract) output = await compile(compilerUrl, _contract)
console.log('output from compile endpoint', {output})
} catch (e: any) { } catch (e: any) {
setOutput(_contract.name, {status: 'failed', message: e.message}) setOutput(_contract.name, {status: 'failed', message: e.message})
return return

@ -51,7 +51,6 @@ export function normalizeContractPath(contractPath: string): string[] {
* @param contract The name and content of the contract * @param contract The name and content of the contract
*/ */
export async function compile(url: string, contract: Contract): Promise<VyperCompilationOutput> { export async function compile(url: string, contract: Contract): Promise<VyperCompilationOutput> {
console.log('responding to call to comile')
if (!contract.name) { if (!contract.name) {
throw new Error('Set your Vyper contract file.') throw new Error('Set your Vyper contract file.')
} }
@ -87,7 +86,6 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
result = await(await axios.get(url + '/compiled_artifact/' + compileCode , { result = await(await axios.get(url + '/compiled_artifact/' + compileCode , {
method: 'Get' method: 'Get'
})).data })).data
console.log({ result })
return result return result
} else if (status === 'PENDING' || status === 'FAILED') { } else if (status === 'PENDING' || status === 'FAILED') {
console.log('pending or failed state encountered') console.log('pending or failed state encountered')
@ -109,12 +107,16 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
*/ */
export function toStandardOutput(fileName: string, compilationResult: VyperCompilationResultType): CompilationResult { export function toStandardOutput(fileName: string, compilationResult: VyperCompilationResultType): CompilationResult {
const contractName = fileName.split('/').slice(-1)[0].split('.')[0] const contractName = fileName.split('/').slice(-1)[0].split('.')[0]
const compiledAbi = compilationResult['contractTypes'][contractName].abi
const deployedBytecode = compilationResult['contractTypes'][contractName].deploymentBytecode.bytecode.replace('0x', '')
const bytecode = compilationResult['contractTypes'][contractName].runtimeBytecode.bytecode.replace('0x', '')
const compiledAst = compilationResult['contractTypes'][contractName].abi
//const methodIdentifiers = JSON.parse(JSON.stringify(compilationResult['method_identifiers']).replace(/0x/g, '')) //const methodIdentifiers = JSON.parse(JSON.stringify(compilationResult['method_identifiers']).replace(/0x/g, ''))
return { return {
sources: { sources: {
[fileName]: { [fileName]: {
id: 1, id: 1,
ast: {} as any, ast: compiledAst,//{} as any,
legacyAST: {} as any legacyAST: {} as any
} }
}, },
@ -124,16 +126,16 @@ export function toStandardOutput(fileName: string, compilationResult: VyperCompi
[contractName]: { [contractName]: {
// The Ethereum Contract ABI. If empty, it is represented as an empty array. // The Ethereum Contract ABI. If empty, it is represented as an empty array.
// See https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI // See https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
abi: compilationResult['abi'], abi: compiledAbi,
evm: { evm: {
bytecode: { bytecode: {
linkReferences: {}, linkReferences: {},
object: compilationResult['bytecode'].replace('0x', ''), object: deployedBytecode,
opcodes: '' opcodes: ''
}, },
deployedBytecode: { deployedBytecode: {
linkReferences: {}, linkReferences: {},
object: compilationResult['bytecode_runtime'].replace('0x', ''), object: bytecode,
opcodes: '' opcodes: ''
}, },
// methodIdentifiers: methodIdentifiers // methodIdentifiers: methodIdentifiers

Loading…
Cancel
Save