|
|
@ -48,19 +48,21 @@ export function normalizeContractPath(contractPath: string): string[] { |
|
|
|
|
|
|
|
|
|
|
|
function parseErrorString(errorString) { |
|
|
|
function parseErrorString(errorString) { |
|
|
|
// Split the string into lines
|
|
|
|
// Split the string into lines
|
|
|
|
const lines = errorString.trim().split('\n') |
|
|
|
let lines = errorString.trim().split('\n') |
|
|
|
// Extract the line number and message
|
|
|
|
// Extract the line number and message
|
|
|
|
const message = lines[1].trim() |
|
|
|
let message = lines[1].trim() |
|
|
|
const targetLine = lines[2].split(',') |
|
|
|
let targetLine = lines[2].split(',') |
|
|
|
const lineColumn = targetLine[targetLine.length - 1].split(' ')[2].split(':') |
|
|
|
let lineColumn = targetLine[targetLine.length - 1].split(' ')[2].split(':') |
|
|
|
console.log('lineColumn', lineColumn) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const errorObject = { |
|
|
|
const errorObject = { |
|
|
|
status: 'failed', |
|
|
|
status: 'failed', |
|
|
|
message: message, |
|
|
|
message: message, |
|
|
|
column: parseInt(lineColumn[1]), |
|
|
|
column: parseInt(lineColumn[1]), |
|
|
|
line: parseInt(lineColumn[0]) |
|
|
|
line: parseInt(lineColumn[0]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
message = null |
|
|
|
|
|
|
|
targetLine = null |
|
|
|
|
|
|
|
lineColumn = null |
|
|
|
|
|
|
|
lines = null |
|
|
|
return errorObject |
|
|
|
return errorObject |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -78,15 +80,14 @@ export async function compile(url: string, contract: Contract): Promise<any> { |
|
|
|
throw new Error('Use extension .vy for Vyper.') |
|
|
|
throw new Error('Use extension .vy for Vyper.') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const contractName = contract['name'] |
|
|
|
let contractName = contract['name'] |
|
|
|
const compilePackage = { |
|
|
|
const compilePackage = { |
|
|
|
manifest: 'ethpm/3', |
|
|
|
manifest: 'ethpm/3', |
|
|
|
sources: { |
|
|
|
sources: { |
|
|
|
[contractName] : {content : contract.content} |
|
|
|
[contractName] : {content : contract.content} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('about to compile contract!!!') |
|
|
|
let response = await axios.post(`${url}compile`, compilePackage ) |
|
|
|
const response = await axios.post(`${url}compile`, compilePackage ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (response.status === 404) { |
|
|
|
if (response.status === 404) { |
|
|
|
throw new Error(`Vyper compiler not found at "${url}".`) |
|
|
|
throw new Error(`Vyper compiler not found at "${url}".`) |
|
|
@ -96,6 +97,8 @@ export async function compile(url: string, contract: Contract): Promise<any> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const compileCode = response.data |
|
|
|
const compileCode = response.data |
|
|
|
|
|
|
|
contractName = null |
|
|
|
|
|
|
|
response = null |
|
|
|
let result: any |
|
|
|
let result: any |
|
|
|
|
|
|
|
|
|
|
|
const status = await (await axios.get(url + 'status/' + compileCode , { |
|
|
|
const status = await (await axios.get(url + 'status/' + compileCode , { |
|
|
|